OrderPrint.cshtml 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. @using IwbZero.Setting
  2. @using NPOI.SS.Formula.Functions
  3. @using ShwasherSys
  4. @using ShwasherSys.CustomerInfo
  5. @using ShwasherSys.Order
  6. @using ShwasherSys.Order.Dto
  7. @using ShwasherSys.OrderSendInfo
  8. @using ShwasherSys.OrderSendInfo.Dto
  9. @{
  10. Layout = null;
  11. ViewBag.Title = "OrderPrint";
  12. OrderHeaderDto orderHeader = ViewBag.OrderHeadDto;
  13. Customer customer = ViewBag.Customer;
  14. CustomerSend customerSend = ViewBag.CustomerSend;
  15. List<ViewOrderItems> orderItems = ViewBag.OrderItems;
  16. var tddate = orderHeader.OrderDate.ToString("yyyy-MM-dd");
  17. }
  18. <html>
  19. <head>
  20. <title>订单打印</title>
  21. <link href="~/Content/Css/PrintPage.css" rel="stylesheet" media="all" />
  22. <link href="~/Content/Plugins/PrintPreView/print-preview.css" rel="stylesheet" />
  23. @*<link href="~/Content/Plugins/jquery-print-preview/src/css/print-preview.css" rel="stylesheet" media="screen" />
  24. <script src="https://cdn.bootcss.com/jquery-tools/1.2.7/jquery.tools.min.js"></script>
  25. <script src="~/Content/Plugins/jquery-print-preview/src/jquery.print-preview.js"></script>*@
  26. @*<script src="~/Content/Plugins/PrintPreView/print-preView.js"></script>*@
  27. <style>
  28. </style>
  29. </head>
  30. <body>
  31. <header style="height: 40px;">
  32. <div style="position: absolute;left: calc(50% - 100px)">
  33. <input type="button" value="打印" class="btn" id="printBtn" />
  34. <input type="button" value="导入Excel" class="btn" onclick="ExportExcel('printContent','订单明细','exportCss')" />
  35. </div>
  36. <hr class="hr01" />
  37. </header>
  38. <div id="printContent">
  39. <table id="OrderDetailTBL0" border="0" align="center" cellpadding="1" cellspacing="1" style="width:900px; height:91px; border-collapse:collapse;" runat="server">
  40. <tr>
  41. <td colspan="12" style="text-align: center; height:30px;font-size:large;font-weight:bold;">分&nbsp;配&nbsp;单</td>
  42. </tr>
  43. <tr>
  44. <td id="tdCustomerId" colspan="12" style="text-align: center; height: 30px;font-size:large;font-weight:bold;"> @customer.CustomerName</td>
  45. </tr>
  46. <tr>
  47. <td colspan="2" style="height: 20px; width: 50px;">
  48. <div style="text-align: center"> <strong>流水号</strong>:</div>
  49. </td>
  50. <td colspan="3" style="height: 20px; width: 300px;">@orderHeader.Id</td>
  51. <td style="width: 50px ; height: 20px;" colspan="2">
  52. <div style="text-align: center"> <strong>订单号</strong>:</div>
  53. </td>
  54. <td style="width: auto; height: 20px;" colspan="5" id="TextStockNo">@orderHeader.StockNo</td>
  55. </tr>
  56. <tr>
  57. <td colspan="2" style="width: 50px ;height: 20px;"><div style="text-align: center"> <strong>送货地址</strong>:</div></td>
  58. <td colspan="10" style="height: 20px; width: auto;" id="tdSendAddr">@customerSend.SendAdress</td>
  59. </tr>
  60. <tr>
  61. <td colspan="2" style="width: 50px;height: 20px;">
  62. <div style="text-align: center"> <strong>联系人</strong>:</div>
  63. </td>
  64. <td id="tdLinkName" colspan="3" style="height: 20px; width: 300px;">@orderHeader.LinkName</td>
  65. <td style="width:50px ; height: 20px;" colspan="2">
  66. <div style="text-align: center"> <strong>电话</strong>:</div>
  67. </td>
  68. <td style="width: auto ; height: 20px;" colspan="5" id="TextTel">@orderHeader.Telephone</td>
  69. </tr>
  70. <tr>
  71. <td style="width:500px ; height: 28px;" colspan="5"></td>
  72. <td style="width: 100px ; height: 17px;" colspan="2">
  73. <div style="text-align: center"><strong> 订单日期</strong>:</div>
  74. </td>
  75. <td style="width: auto ; height: 17px;" id="tdOrderDate" colspan="5">@tddate</td>
  76. </tr>
  77. <tr>
  78. <td colspan="12">
  79. <table id="OrderDetailTBL" class="table-body" style="width: 1000px; height: 38px; border-collapse:collapse; table-layout: auto;" >
  80. <tr style="height:18px;">
  81. <td align="center" style="width:3%;">
  82. <strong>序号</strong>
  83. </td>
  84. <td align="center" style="width:8%;">
  85. <strong>零件号</strong>
  86. </td>
  87. <td align="center" style="width:8%; ">
  88. <strong>规格</strong>
  89. </td>
  90. <td align="center" style="width:8%">
  91. <strong>型号</strong>
  92. </td>
  93. <td align="center" style="width:8%; ">
  94. <strong>表色</strong>
  95. </td>
  96. <td align="center" style="width:8%; ">
  97. <strong>材质</strong>
  98. </td>
  99. <td align="center" style="width:8%;">
  100. <strong>硬度</strong>
  101. </td>
  102. <td align="center" style="width:4%;">
  103. <strong>数量</strong>
  104. </td>
  105. <td align="center" style="width:4%; ">
  106. <strong>单位</strong>
  107. </td>
  108. <td align="center" style="width:8% ">
  109. <strong>送货日期</strong>
  110. </td>
  111. <td align="center" style="width:10%">
  112. <strong>备注</strong>
  113. </td>
  114. <td align="center" style="width:12%">
  115. <strong>成品编号</strong>
  116. </td>
  117. <td align="center" style="width:12%">
  118. <strong>紧急程度</strong>
  119. </td>
  120. </tr>
  121. @{
  122. int index = 1;
  123. foreach (var item in orderItems)
  124. {
  125. string orderSendDate = item.SendDate ==new DateTime(1900,1,1) ? "" : string.Format("{0:d}", item.SendDate);
  126. string emergencyLevelStr = item.EmergencyLevel == OrderItemEmergencyLevel.Normal ? "正常" : item.EmergencyLevel == OrderItemEmergencyLevel.Urge ? "紧急" : "延期";
  127. <tr class="trColor">
  128. <td align="center">@index</td>
  129. <td align="center">@item.PartNo</td>
  130. <td align="center">@item.Model</td>
  131. <td align="center">@item.ProductName</td>
  132. <td align="center">@item.SurfaceColor</td>
  133. <td align="center">@item.Material</td>
  134. <td align="center">@item.Rigidity</td>
  135. <td align="center">@item.Quantity</td>
  136. <td align="center">@item.OrderUnitName</td>
  137. <td align="center">@orderSendDate</td>
  138. <td align="center">@item.OrderItemDesc</td>
  139. <td align="center">@item.ProductNo</td>
  140. <td align="center">@emergencyLevelStr</td>
  141. </tr>
  142. index++;
  143. }
  144. }
  145. </table>
  146. </td>
  147. </tr>
  148. </table>
  149. </div>
  150. <div id="exportCss">
  151. <style>
  152. #OrderDetailTBL tr td{
  153. border: 1pt solid gray;
  154. }
  155. </style>
  156. </div>
  157. <script src="~/Content/Scripts/Jquery/jquery-3.3.1.min.js"></script>
  158. @*<script src="~/Content/Plugins/printThis/printThis.js"></script>*@
  159. <script src="~/Content/Plugins/PrintPreView/print-preView.js"></script>
  160. <script src="~/Content/Scripts/MyScript/ExportExcel.js"></script>
  161. <script>
  162. $(function () {
  163. /*$("#printBtn").on('click',
  164. function () {
  165. $("#printContent").printThis({
  166. debug: false, // show the iframe for debugging
  167. importCSS: true, // import page CSS
  168. importStyle: false, // import style tags
  169. printContainer: true, // grab outer container as well as the contents of the selector
  170. //loadCSS: "path/to/my.css", // path to additional css file - use an array [] for multiple
  171. pageTitle: "", // add title to print page
  172. removeInline: false, // remove all inline styles from print elements
  173. printDelay: 333, // variable print delay
  174. header: null, // prefix to html
  175. footer: null, // postfix to html
  176. base: false, // preserve the BASE tag, or accept a string for the URL
  177. formValues: true, // preserve input/form values
  178. canvas: false, // copy canvas elements (experimental)
  179. //doctypeString: "...", // enter a different doctype for older markup
  180. removeScripts: false, // remove script tags from print content
  181. copyTagClasses: false // copy classes from the html & body tag#1#
  182. });
  183. });*/
  184. $("#printBtn").printPreview({
  185. printBody: "#printContent",
  186. modalWidth: 900
  187. })
  188. })
  189. </script>
  190. </body>
  191. </html>