StatementBillDetail.cshtml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. @using Abp.Authorization
  2. @using IwbZero.Setting
  3. @using NPOI.SS.Formula.Functions
  4. @using ShwasherSys.Authorization.Permissions
  5. @using ShwasherSys.Common
  6. @using ShwasherSys.CustomerInfo
  7. @using ShwasherSys.Invoice
  8. @using ShwasherSys.OrderSendInfo
  9. @using ShwasherSys.OrderSendInfo.Dto
  10. @using ShwasherSys.ProductInfo
  11. @{
  12. Layout = null;
  13. ViewBag.Title = "InvoiceBillDetail";
  14. Customer customerInfo = ViewBag.CustomerInfo;
  15. OrderSendBillDto sendBill = ViewBag.SendBill;
  16. string sendStickBillNo = ViewBag.SendStickBillNo;
  17. List<ViewOrderSendStickBill> orderSends = ViewBag.OrderSends;
  18. /*string sendTitle = SettingManager.GetSettingValue("SysUserCop") + SettingManager.GetSettingValue("SENDBILLTITLE");
  19. string sendAddress = SettingManager.GetSettingValue("SENDADDRESS");
  20. string sendTel = SettingManager.GetSettingValue("SENDTELEPHONE");*/
  21. string tddate = "日期: " + DateTime.Now.Year + " 年 " + DateTime.Now.Month + " 月 " + DateTime.Now.Day + " 日 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
  22. bool isCanViewPrice = PermissionChecker.IsGranted(PermissionNames.PagesOrderInfoOrderMgQueryOrderPrice);
  23. List<CustomerDefaultProduct> customerDefaultProducts = ViewBag.CustomerDefaultProducts;
  24. List<ProductProperty> productProperties = ViewBag.MaterialProductProperties;
  25. }
  26. <html>
  27. <head>
  28. <title>对账单详情</title>
  29. <link href="~/Content/Css/PrintPage.css" rel="stylesheet" media="all" />
  30. <link href="~/Content/Plugins/PrintPreView/print-preview.css" rel="stylesheet" />
  31. @*<link href="~/Content/Plugins/jquery-print-preview/src/css/print-preview.css" rel="stylesheet" media="screen" />
  32. <script src="https://cdn.bootcss.com/jquery-tools/1.2.7/jquery.tools.min.js"></script>
  33. <script src="~/Content/Plugins/jquery-print-preview/src/jquery.print-preview.js"></script>*@
  34. @*<script src="~/Content/Plugins/PrintPreView/print-preView.js"></script>*@
  35. <style>
  36. </style>
  37. </head>
  38. <body>
  39. <div id="exportCss">
  40. <style>
  41. .table-body {
  42. width: 800px;
  43. border-collapse: collapse;
  44. font-size: 12px;
  45. border-width: thin;
  46. table-layout: fixed;
  47. WORD-BREAK: break-all;
  48. WORD-WRAP: break-word;
  49. }
  50. .table-body tr {
  51. height: 18px;
  52. border-top: 1px solid #888383
  53. }
  54. .table-body tr:last-of-type td {
  55. border-bottom: 1px solid #000
  56. }
  57. .table-body tr td {
  58. height: 18px;
  59. padding: 3px 2px;
  60. text-align: center;
  61. border-left: 1px solid #888383
  62. }
  63. .table-body tr td:last-of-type {
  64. height: 18px;
  65. border-right: 1px solid #000;
  66. }
  67. .trColor:nth-child(even) {
  68. background: #efe7e7
  69. }
  70. .trColor:nth-child(odd) {
  71. background: #FFF
  72. }
  73. </style>
  74. </div>
  75. <header style="height: 40px;">
  76. <div style="position: absolute;left: calc(50% - 100px)">
  77. <input type="button" value="打印" class="btn" id="printBtn" />
  78. <input type="button" value="导出Excel" class="btn" id="exportReport" />
  79. </div>
  80. <hr class="hr01" />
  81. </header>
  82. <div id="printContent" style="">
  83. @{
  84. var colspan = isCanViewPrice ? 17 : 11;
  85. var col3 = colspan/5;
  86. var col4 = colspan/4+1;
  87. var col5 = colspan/5;
  88. var col6 = colspan/3;
  89. var col7 = colspan/2+1;
  90. var col8 = colspan / 7;
  91. }
  92. <table style="width: 900px; margin: 0 auto" id="tableHeader">
  93. <tr style="height: auto">
  94. <td colspan="@col8"></td>
  95. @{
  96. var col2 = colspan - 2;
  97. }
  98. <td style="height: auto; text-align: left; padding: 10px 0px 10px 50px" colspan="@col2">
  99. <img src="~/Content/Images/excle/report.png" style="width: 650px; height: 100px;" />
  100. </td>
  101. </tr>
  102. <tr style="height: auto">
  103. <td style="height: auto; text-align: center; padding: 5px; font-size: 25px;" colspan="@colspan">
  104. <strong><span>开票前对账(对账单)</span></strong>
  105. </td>
  106. </tr>
  107. <tr style="height: auto">
  108. @{
  109. }
  110. <td style="width: 15%; text-align: right;" colspan="@col3">
  111. <strong><span>客户:</span></strong>
  112. </td>
  113. <td style="width: 25%; font-size: 13px; font-family: 黑体;" id="tdcustormer" colspan="@col4">
  114. @customerInfo.CustomerName
  115. </td>
  116. <td style="width: 20%; text-align: right;" colspan="@col5">
  117. <strong><span>地址:</span></strong>
  118. </td>
  119. <td style="width: 60%; font-size: 13px; font-family: 黑体;" id="tdsendaddr" colspan="@col6">
  120. @if (sendBill != null)
  121. {
  122. @sendBill.SendAddress
  123. }
  124. </td>
  125. </tr>
  126. <tr style="height: auto">
  127. <td style="width: 15%; text-align: right;" colspan="@col3">
  128. <strong><span>联系电话:</span></strong>
  129. </td>
  130. <td style="width: 25%; font-size: 13px; font-family: 黑体;" id="tdtel" colspan="@col4">
  131. @if (sendBill != null)
  132. {
  133. @sendBill.ContactTels
  134. }
  135. </td>
  136. <td style="width: 20%; text-align: right;" colspan="@col5">
  137. <strong><span>联系人:</span></strong>
  138. </td>
  139. <td style="width: auto; font-size: 13px; font-family: 黑体;" id="tdlinkman" colspan="@col6">
  140. @if (sendBill != null)
  141. {
  142. @sendBill.ContactMan
  143. }
  144. </td>
  145. </tr>
  146. <tr style="height: auto;">
  147. <td align=right colspan="@col5">
  148. <strong>单号:</strong>
  149. </td>
  150. <td id="tddanhao" colspan="@col4" style="font-size: 13px; font-family: 黑体;">
  151. @sendStickBillNo
  152. </td>
  153. <td style="width: auto; text-align: right; font-family: 黑体;" id="tddate" colspan="@col7">
  154. @Html.Raw(tddate)
  155. </td>
  156. </tr>
  157. <tr>
  158. <td colspan="@colspan">
  159. <table style="width: 1050px; table-layout: auto;" class="table-body">
  160. <tr>
  161. <td style="width: 35px; text-align: center;">
  162. <strong>序号</strong>
  163. </td>
  164. <td style="text-align: center; font-size: 14px;">
  165. <strong>
  166. 客户订单号
  167. </strong>
  168. </td>
  169. <td style="text-align: center; font-size: 14px;">
  170. <strong>
  171. 送货单号
  172. </strong>
  173. </td>
  174. <td style="text-align: center; font-size: 14px;">
  175. <strong>
  176. 送货日期
  177. </strong>
  178. </td>
  179. <td style="text-align: center; font-size: 14px;">
  180. <strong>
  181. 零件号
  182. </strong>
  183. </td>
  184. <td style="text-align: center; font-size: 14px;">
  185. <strong>
  186. HS Product
  187. </strong>
  188. </td>
  189. <td style="text-align: center; font-size: 14px;">
  190. <strong>
  191. 规格
  192. </strong>
  193. </td>
  194. <td style="text-align: center; font-size: 14px;">
  195. <strong>
  196. 材质
  197. </strong>
  198. </td>
  199. <td style="text-align: center; font-size: 14px;">
  200. <strong>
  201. HS raw material
  202. </strong>
  203. </td>
  204. <td style="text-align: center; font-size: 14px;">
  205. <strong>
  206. 产品名
  207. </strong>
  208. </td>
  209. <td style="text-align: center; font-size: 14px;">
  210. <strong>
  211. 硬度
  212. </strong>
  213. </td>
  214. <td style="text-align: center; font-size: 14px;">
  215. <strong>
  216. 表色
  217. </strong>
  218. </td>
  219. <td style="text-align: center; font-size: 14px;">
  220. <strong>
  221. 数量
  222. </strong>
  223. </td>
  224. <td style="text-align: center; font-size: 14px;">
  225. <strong>
  226. 单位
  227. </strong>
  228. </td>
  229. @if (isCanViewPrice)
  230. {
  231. <td style="text-align: center; font-size: 14px;">
  232. <strong>
  233. 含税单价
  234. </strong>
  235. </td>
  236. <td style="text-align: center; font-size: 14px;">
  237. <strong>
  238. 不含税单价
  239. </strong>
  240. </td>
  241. <td style="text-align: center; font-size: 14px;">
  242. <strong>
  243. 模具费
  244. </strong>
  245. </td>
  246. <td style="text-align: center; font-size: 14px;">
  247. <strong>
  248. 运费
  249. </strong>
  250. </td>
  251. <td style="text-align: center; font-size: 14px;">
  252. <strong>
  253. 含税总价
  254. </strong>
  255. </td>
  256. <td style="text-align: center; border-right: 1px solid #888383;">
  257. <strong>
  258. 不含税总价
  259. </strong>
  260. </td>
  261. }
  262. </tr>
  263. @{
  264. int index = 1;
  265. decimal ldAccontTotal = 0;
  266. decimal ldNoTaxTotal = 0;
  267. string currencyId = "CNY";
  268. foreach (var orderSend in orderSends)
  269. {
  270. var sendQuantity = string.Format("{0:N3}", orderSend.SendQuantity ?? 0);
  271. var price = string.Format("{0:N3}", orderSend.Price);
  272. var logisticsFee = string.Format("{0:N3}", orderSend.LogisticsFee);
  273. var moldFee = string.Format("{0:N3}", orderSend.MoldFee);
  274. var noTaxprice = string.Format("{0:N3}", orderSend.AfterTaxPrice);
  275. var totalprice = string.Format("{0:N3}", orderSend.totalprice);
  276. var totalNoTaxprice = string.Format("{0:N3}", (orderSend.SendQuantity ?? 0) * orderSend.AfterTaxPrice);
  277. var sendDate = string.Format("{0:yyyy-MM-dd}", orderSend.SendDate);
  278. currencyId = orderSend.CurrencyId;
  279. string mHsCode = CommonQueryService.GetMaterialHsCode(orderSend.ProductNo, productProperties);
  280. string productHsCode = CommonQueryService.GetProductHsCode(orderSend.CustomerId, orderSend.ProductNo, customerDefaultProducts);
  281. string tmp = "";
  282. <tr class="trColor">
  283. @if (index == orderSends.Count)
  284. {
  285. tmp = "border-bottom: 1px solid #888383;";
  286. }
  287. <td style="@tmp">@index</td>
  288. @if (string.IsNullOrEmpty(orderSend.StockNo))
  289. {
  290. <td style="font-family: 黑体; font-size: 13px; @tmp">@orderSend.OrderNo</td>
  291. }
  292. else
  293. {
  294. <td style="font-family: 黑体; font-size: 13px; @tmp">@orderSend.StockNo</td>
  295. }
  296. <td style="font-family: 黑体; font-size: 13px; @tmp">@orderSend.OrderSendBillNo</td>
  297. <td style="font-family: 黑体; font-size: 13px; @tmp">@sendDate</td>
  298. <td style="font-family: 黑体; font-size: 13px; @tmp">@orderSend.PartNo</td>
  299. <td style="font-family: 黑体; font-size: 13px; @tmp">@productHsCode</td>
  300. <td style="font-family: 黑体; font-size: 13px; @tmp">@orderSend.Model</td>
  301. <td style="font-family: 黑体; font-size: 13px; @tmp">@orderSend.Material</td>
  302. <td style="font-family: 黑体; font-size: 13px; @tmp">@mHsCode</td>
  303. <td style="font-family: 黑体; font-size: 13px; @tmp">@orderSend.ProductName</td>
  304. <td style="font-family: 黑体; font-size: 13px; @tmp">@orderSend.Rigidity</td>
  305. <td style="font-family: 黑体; font-size: 13px; @tmp">@orderSend.SurfaceColor</td>
  306. <td style="font-family: 黑体; font-size: 13px; @tmp">@sendQuantity</td>
  307. <td style="font-family: 黑体; font-size: 13px; @tmp">@orderSend.OrderUnitName</td>
  308. @if (isCanViewPrice)
  309. {
  310. <td style="font-family: 黑体; font-size: 13px; @tmp">@price</td>
  311. <td style="font-family: 黑体; font-size: 13px; @tmp">@noTaxprice</td>
  312. <td style="font-family: 黑体; font-size: 13px; @tmp">@moldFee</td>
  313. <td style="font-family: 黑体; font-size: 13px; @tmp">@logisticsFee</td>
  314. <td style="font-family: 黑体; font-size: 13px; @tmp">@totalprice</td>
  315. <td style="text-align: center; border-right: 1px solid #888383; @tmp">@totalNoTaxprice</td>
  316. }
  317. </tr>
  318. ldAccontTotal += orderSend.totalprice;
  319. //ldNoTaxTotal += (orderSend.SendQuantity ?? 0) * orderSend.AfterTaxPrice;
  320. ldNoTaxTotal += orderSend.AfterTaxTotalprice;
  321. index++;
  322. }
  323. string lcAccontTotal = string.Format("{0:N3}", ldAccontTotal);
  324. string lcNoTaxTotal = string.Format("{0:N3}", ldNoTaxTotal);
  325. }
  326. </table>
  327. </td>
  328. </tr>
  329. @if (isCanViewPrice)
  330. {
  331. <tr>
  332. <td style="text-align: right;" colspan="16">
  333. <strong>总金额(@currencyId):</strong>
  334. </td>
  335. <td style="text-align: right;" colspan="2">@lcAccontTotal&nbsp;&nbsp;&nbsp;@lcNoTaxTotal</td>
  336. </tr>
  337. }
  338. </table>
  339. </div>
  340. <script src="~/Content/Scripts/Jquery/jquery-3.3.1.min.js"></script>
  341. @*<script src="~/Content/Plugins/printThis/printThis.js"></script>*@
  342. <script src="~/Content/Plugins/PrintPreView/print-preView.js"></script>
  343. <script src="~/Content/Scripts/MyScript/ExportExcel.js"></script>
  344. <script src="~/Abp/Framework/scripts/abp.js"></script>
  345. <script src="~/Abp/Framework/scripts/libs/abp.jquery.js"></script>
  346. <script src="~/Content/Scripts/MyScript/UtilJs.js"></script>
  347. <script>
  348. $(function () {
  349. /*$("#printBtn").on('click',
  350. function () {
  351. $("#printContent").printThis({
  352. debug: false, // show the iframe for debugging
  353. importCSS: true, // import page CSS
  354. importStyle: false, // import style tags
  355. printContainer: true, // grab outer container as well as the contents of the selector
  356. //loadCSS: "path/to/my.css", // path to additional css file - use an array [] for multiple
  357. pageTitle: "", // add title to print page
  358. removeInline: false, // remove all inline styles from print elements
  359. printDelay: 333, // variable print delay
  360. header: null, // prefix to html
  361. footer: null, // postfix to html
  362. base: false, // preserve the BASE tag, or accept a string for the URL
  363. formValues: true, // preserve input/form values
  364. canvas: false, // copy canvas elements (experimental)
  365. //doctypeString: "...", // enter a different doctype for older markup
  366. removeScripts: false, // remove script tags from print content
  367. copyTagClasses: false // copy classes from the html & body tag#1#
  368. });
  369. });*/
  370. $("#printBtn").printPreview({
  371. printBody: "#printContent",
  372. modalWidth: 1050
  373. });
  374. //$("#exportReport").on('click',
  375. // function (e) {
  376. // var urlPath = window.document.location.href; //浏览器显示地址 http://10.15.5.83:5555/ISV/demo.aspx?a=1&b=2
  377. // var docPath = window.document.location.pathname; //文件在服务器相对地址 /ISV/demo.aspx
  378. // var index = urlPath.indexOf(docPath);
  379. // var serverPath = urlPath.substring(0, index); //服务器地址 http://10.15.5.83:5555
  380. // var imgTr = $("#tableHeader").find('tr:first').clone();
  381. // $("#tableHeader").find('tr:first img')
  382. // .attr("src", serverPath + "/Content/Images/excle/report2.png");
  383. // $("#tableHeader").find('tr:first td')
  384. // .css({ "height": "120px" });
  385. // $("#tableHeader").find('tr:first td img').css({ "width": "800px" });
  386. // ExportExcel('printContent', '发票明细', 'exportCss');
  387. // $("#tableHeader").find('tr:first').remove();
  388. // $("#tableHeader").prepend(imgTr);
  389. // //var imgTr = $("#tableHeader").find('tr:first').clone();
  390. // //$("#tableHeader").find('tr:first').remove();
  391. // //ExportExcel('printContent', '发票明细', 'exportCss');
  392. // //$("#tableHeader").prepend(imgTr);
  393. // });
  394. $("#exportReport").on('click',
  395. function(e) {
  396. SaveAjax({
  397. url: "/api/services/app/OrderStickBill/ExportStatementBill",
  398. isValidate: false,
  399. isAlert: false,
  400. data: { id: '@sendStickBillNo' },
  401. success: function (res) {
  402. var urlPath = window.document.location.href; //浏览器显示地址 http://10.15.5.83:5555/ISV/demo.aspx?a=1&b=2
  403. var docPath = window.document.location.pathname; //文件在服务器相对地址 /ISV/demo.aspx
  404. var index = urlPath.indexOf(docPath);
  405. var serverPath = urlPath.substring(0, index); //服务器地址 http://10.15.5.83:5555
  406. window.location.href = serverPath+"/" + res;
  407. }
  408. });
  409. });
  410. })
  411. </script>
  412. </body>
  413. </html>