OrderPrint.cshtml 9.3 KB

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