OrderSendQueryMg.cshtml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. @using System.Web.UI.HtmlControls
  2. @using ShwasherSys.Authorization.Permissions
  3. @using ShwasherSys.Models.Layout
  4. @using ShwasherSys.Models.Modal
  5. @{
  6. /**/
  7. ViewBag.ActiveMenu = PermissionNames.PagesSendGoodsOrderSendQueryMg; //The menu item will be active for this page.
  8. ViewBag.Title = "客户订单发货统计";
  9. List<SelectListItem> OrderSaleTypeList = ViewBag.OrderSaleType;
  10. List<SelectListItem> isDoBillList = new List<SelectListItem>();
  11. isDoBillList.AddRange(new List<SelectListItem>()
  12. {
  13. new SelectListItem()
  14. {
  15. Value = "0",
  16. Text="未开票"
  17. },new SelectListItem()
  18. {
  19. Value = "1",
  20. Text="已开票"
  21. }
  22. });
  23. //List<SelectListItem> yearList = new List<SelectListItem>();
  24. //DateTime loDate = DateTime.Now;
  25. //int currentYear = loDate.Year;
  26. //int currentMonth = loDate.Month;
  27. //loDate = loDate.AddYears(-2);
  28. //yearList.Add(new SelectListItem()
  29. //{
  30. // Value = loDate.Year+"",
  31. // Text = loDate.Year+"年"
  32. //});
  33. //for (int i = 0; i < 2; i++)
  34. //{
  35. // loDate = loDate.AddYears(1);
  36. // yearList.Add(new SelectListItem()
  37. // {
  38. // Value = loDate.Year+"",
  39. // Text = loDate.Year+"年"
  40. // });
  41. //}
  42. //List<SelectListItem> monthList = new List<SelectListItem>();
  43. //for (int i = 1; i <= 12; i++)
  44. //{
  45. // bool selected = i == currentMonth;
  46. // monthList.Add(new SelectListItem()
  47. // {
  48. // Value = i+"",
  49. // Text = i+"月份"
  50. // });
  51. //}
  52. var searchForm = new SearchFormViewModal(new List<SearchItem>()
  53. {
  54. new SearchItem("customerId", "客户编号").SetSearchIcon("query_customer_modal"),
  55. //new SearchItem("year", "订单日期").SetSearchItem(yearList,isAddBlank:false),
  56. //new SearchItem("month", "到").SetSearchItem(monthList,isAddBlank:false),
  57. new SearchItem("orderDate", "订单日期",FiledType.D,ExpType.GreaterOrEqual),
  58. new SearchItem("orderDate", "到",FiledType.D,ExpType.LessOrEqual),
  59. new SearchItem("isDoBill", "是否开票",FiledType.S,ExpType.Equal).SetSearchItem(isDoBillList),
  60. //new SearchItem("saleType", "内销/外销",FiledType.Inull,ExpType.Equal).SetSearchItem(OrderSaleTypeList),
  61. new SearchItem("productNo", "产品编码"),
  62. new SearchItem("model", "规格"),
  63. new SearchItem("material", "材质"),
  64. }, false);
  65. }
  66. @section css{
  67. <link href="~/Content/Plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" />
  68. <style>
  69. .table {
  70. width: 100%;
  71. max-width: 100%;
  72. margin-bottom: 1px;
  73. }
  74. .table thead {
  75. background: #d1dcf9;
  76. }
  77. .table th, .table td {
  78. text-align: center;
  79. max-width: 159px;
  80. overflow: hidden;
  81. text-overflow: ellipsis;
  82. white-space: nowrap;
  83. }
  84. .table tbody tr td{
  85. padding: 0 4px;
  86. cursor: pointer;
  87. font-size: 12px;
  88. line-height: 23.5px;
  89. }
  90. .table thead tr th:first-child, .table tbody tr td:first-child {
  91. border-left: .3px #ddd solid;
  92. }
  93. .table thead tr th:last-child, .table tbody tr td:last-child {
  94. border-right: .3px #ddd solid;
  95. }
  96. </style>
  97. }
  98. <div class="table-box mr-4 iwb-bootstrap-table">
  99. @Html.Action("ToolMenu", "Layout", new { pageName = ViewBag.ActiveMenu, searchForm })
  100. <table id="table"
  101. data-url="/api/services/app/OrderSend/GetViewOrderItemAll"
  102. data-striped="true" data-id-field="id" data-unique-id="id"
  103. data-method="post"
  104. data-side-pagination="server"
  105. data-content-type="application/x-www-form-urlencoded; charset=UTF-8"
  106. data-cache="false"
  107. data-pagination="true" data-page-size="50" data-page-number="1" data-page-list="[30,50,100,200]" data-pagination-detail-h-align="right" data-pagination-h-align="left"
  108. data-query-params="QueryParams"
  109. data-response-handler="ResponseHandler"
  110. data-click-to-select="true"
  111. data-single-select="true" >
  112. <thead>
  113. <tr class="row" id="header">
  114. <th data-field="state" data-checkbox="true"></th>
  115. <th data-align="center" data-field="customerId">客户编号</th>
  116. <th data-align="center" data-field="customerName">客户编号</th>
  117. <th data-align="center" data-field="orderDate">订单日期</th>
  118. <th data-align="center" data-field="stockNo" >客户订单号</th>
  119. <th data-align="center" data-field="orderNo">订单流水号</th>
  120. <th data-align="center" data-field="partNo" data-formatter="PartNoFormatter">零件号</th>
  121. <th data-align="center" data-field="sendDate" data-formatter="SendDateFormatter">送货日期</th>
  122. <th data-align="center" data-field="productNo">产品编号</th>
  123. <th data-align="center" data-field="productName">产品名称</th>
  124. <th data-align="center" data-field="sendQuantity" data-formatter="QuantityFormatter">数量</th>
  125. <th data-align="center" data-field="orderUnitName">单位</th>
  126. @*<th data-align="center" data-field="totalPrice" data-formatter="TotalPriceFormatter" data-footer-formatter="AllTotalPriceFormatter">总价</th>*@
  127. <th data-align="center" data-field="orderStickBillNo" data-formatter="InvoiceBillFormatter">发票号</th>
  128. <th data-align="center" data-field="statementBillNo" data-formatter="InvoiceBillFormatter">对账单号</th>
  129. </tr>
  130. </thead>
  131. </table>
  132. @*<th data-align="center" data-field="isReport" data-formatter="IsReportFormatter">检验报告</th>
  133. <th data-align="center" data-field="isPartSend" data-formatter="IsPartSendFormatter">部分送货</th>
  134. <th data-align="center" data-field="model">型号</th>
  135. <th data-align="center" data-field="surfaceColor">表色</th>
  136. <th data-align="center" data-field="material">材质</th>
  137. <th data-align="center" data-field="rigidity">硬度</th>*@
  138. @*<table class="table table-striped table-hover">
  139. <thead>
  140. <tr>
  141. <th>客户编号</th>
  142. <th>客户名称</th>
  143. <th>订单日期</th>
  144. <th>客户订单号</th>
  145. <th>订单流水号</th>
  146. <th>零件号</th>
  147. <th>发货日期</th>
  148. <th>产品编号</th>
  149. <th>产品名称</th>
  150. <th>发货数量</th>
  151. <th>单位</th>
  152. <th>发票号</th>
  153. <th>对账单号</th>
  154. </tr>
  155. </thead>
  156. <tbody>
  157. </tbody>
  158. </table>*@
  159. </div>
  160. @section modal{
  161. <section>
  162. @Html.Partial("Modals/Query/_Customer", "KeyWords-1")
  163. </section>
  164. }
  165. @section scripts
  166. {
  167. <script src="~/Content/Plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
  168. <script src="~/Content/Plugins/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
  169. <script type="text/javascript">
  170. //cId cStockNo cOrderStatusId cCustomerId cStartDate cEndDate
  171. var datePickerOpt = {
  172. language: 'zh-CN',
  173. format: "yyyy-mm-dd",
  174. todayBtn: true,
  175. autoclose: true,
  176. startView: 2,
  177. minView: 2,
  178. maxView: 4
  179. //showSecond: true,
  180. //showHours: true,
  181. //minuteStep: 10
  182. };
  183. $(function () {
  184. //$("#KeyWords-2").datetimepicker(datePickerOpt);
  185. //$("#KeyWords-3").datetimepicker(datePickerOpt);
  186. var nowDate = new Date();
  187. var preDate = new Date(nowDate.getTime() - 7 * 24 * 60 * 60 * 1000);
  188. $("#KeyWords-2").val(preDate.Format("yyyy-MM-dd")).on("changeDate",
  189. function (e) {
  190. $("#KeyWords-3")
  191. .datetimepicker('setStartDate', e.date + 1000 * 60 * 60 * 24);
  192. $("#KeyWords-3")
  193. .datetimepicker('setEndDate', new Date(e.date.valueOf() + 1000 * 60 * 60 * 24 * 90));
  194. });
  195. $("#KeyWords-3").val(nowDate.Format("yyyy-MM-dd")).on("changeDate",
  196. function (e) {
  197. $("#KeyWords-2")
  198. .datetimepicker('setStartDate', new Date(e.date.valueOf() - 1000 * 60 * 60 * 24 * 90));
  199. $("#KeyWords-2")
  200. .datetimepicker('setEndDate', new Date(e.date.valueOf() - 1000 * 60 * 60 * 24 ));
  201. });
  202. //show完毕前执行
  203. LoadTable();
  204. //loadData();
  205. var funs = window.funs || { none: function () { console.log("No type"); } };
  206. //funs["btnUpdate"] = function () { BtnUpdate({ readonly: "standardName" }); };
  207. funs["btnExportExcel"] = function(url) {
  208. GetSearchList();
  209. $.iwbAjax4({
  210. url: url,
  211. data:_searchList,
  212. success: function(res) {
  213. window.location.href = res;
  214. }
  215. });
  216. }
  217. });
  218. //function BtnSearch(isCheck) {
  219. // loadData();
  220. //}
  221. function loadData() {
  222. GetSearchList();
  223. var queryObj= {
  224. SearchList: _searchList
  225. };
  226. SaveAjax({
  227. url: window.appUrl + "OrderSend/GetViewOrderItemAll",
  228. data: queryObj,
  229. isValidate: false,
  230. isAlert: false,
  231. success: function(res) {
  232. $(".table.table-striped tbody").empty();
  233. if (res && res.length > 0) {
  234. var allTotal = 0;
  235. res.forEach(function(v) {
  236. var $tr = $('<tr></tr>');
  237. $tr.append('<td>' + v.customerId + '</td>');
  238. $tr.append('<td>' + v.customerName + '</td>');
  239. $tr.append('<td>' + OrderDateFormatter(v.orderDate) + '</td>');
  240. $tr.append('<td>' + v.stockNo + '</td>');
  241. $tr.append('<td>' + v.orderNo + '</td>');
  242. $tr.append('<td>' + PartNoFormatter(v.partNo) + '</td>');
  243. $tr.append('<td>' + SendDateFormatter(v.sendDate) + '</td>');
  244. $tr.append('<td>' + v.productNo + '</td>');
  245. $tr.append('<td>' + v.productName + '</td>');
  246. $tr.append('<td>' + QuantityFormatter(v.sendQuantity) + '</td>');
  247. $tr.append('<td>' + v.orderUnitName + '</td>');
  248. $tr.append('<td>' + InvoiceBillFormatter(v.orderStickBillNo) + '</td>');
  249. $tr.append('<td>' + InvoiceBillFormatter(v.statementBillNo) + '</td>');
  250. $(".table.table-striped tbody").append($tr);
  251. allTotal += v.totalPrice;
  252. });
  253. //$(".table.table-striped tbody")
  254. // .append(
  255. // '<tr style="background:#d1dcf9;"><td colspan="5" style="text-align:right;">合计:</td><td colspan="6" style="text-align:right;padding-right:35px;">' +
  256. // allTotal +
  257. // 'CNY</td></tr>');
  258. }
  259. }
  260. });
  261. /*abp.ajax({
  262. url: window.appUrl +"OrderSend/GetViewOrderItemAll",
  263. async: true,
  264. data: JSON.stringify(queryObj),
  265. type: "Post",
  266. contentType: 'application/json',
  267. isValidate: false,
  268. dataType: "json",
  269. success: function (res) {
  270. $(".table.table-striped tbody").empty();
  271. if (res && res.length > 0) {
  272. var allTotal = 0;
  273. res.forEach(function(v) {
  274. var $tr = $('<tr></tr>');
  275. $tr.append('<td>' + v.customerId + '</td>');
  276. $tr.append('<td>' + OrderDateFormatter(v.orderDate) + '</td>');
  277. $tr.append('<td>' + v.stockNo + '</td>');
  278. $tr.append('<td>' + v.orderNo + '</td>');
  279. $tr.append('<td>' + v.partNo + '</td>');
  280. $tr.append('<td>' + SendDateFormatter(v.sendDate) + '</td>');
  281. $tr.append('<td>' + v.productNo + '</td>');
  282. $tr.append('<td>' + v.productName + '</td>');
  283. $tr.append('<td>' + QuantityFormatter(v.quantity) + '</td>');
  284. $tr.append('<td>' + v.orderUnitName + '</td>');
  285. $tr.append('<td>' + TotalPriceFormatter(v.totalPrice) + '</td>');
  286. $(".table.table-striped tbody").append($tr);
  287. allTotal += v.totalPrice;
  288. });
  289. $(".table.table-striped tbody").append('<tr><td colspan="5" style="text-align:right;">合计:</td><td colspan="6" style="text-align:right;padding-right:35px;color:red;">' + allTotal+'CNY</td></tr>');
  290. }
  291. }
  292. });*/
  293. }
  294. function PartNoFormatter(v) {
  295. if (v===null) {
  296. return "";
  297. }
  298. return v;
  299. }
  300. function OrderDateFormatter(v) {
  301. var orderDate = new Date(v);
  302. return '<span style="text-decoration:underline;" >' + orderDate.Format('yyyy-MM-dd') + '</span>';
  303. }
  304. function SendDateFormatter(v, r) {
  305. var dataNow = abp.clock.now();
  306. var sendDate = new Date(v);
  307. var s1 = dataNow.getTime(), s2 = sendDate.getTime();
  308. var span = (s2 - s1) / 1000;
  309. var dayspan = parseInt(span / (24 * 60 * 60));
  310. if (dayspan < 0) {
  311. return '<span style="text-decoration:underline;color:#ff0000" >' + sendDate.Format('yyyy-MM-dd') + '</span>';
  312. }
  313. if (dayspan > -1 && dayspan < 4) {
  314. return '<span style="text-decoration:underline;color:#dd4b39" >' + sendDate.Format('yyyy-MM-dd') + '</span>';
  315. }
  316. return '<span style="text-decoration:underline;" >' + sendDate.Format('yyyy-MM-dd') + '</span>';
  317. }
  318. function QuantityFormatter(v, r) {
  319. var str = '<span style="text-decoration:underline;" >' + v + '</span>';
  320. return str;
  321. }
  322. function TotalPriceFormatter(v, r) {
  323. var str = "0.00";
  324. if (v && v > 0) {
  325. v = (v * 10000) / 10000;
  326. str = _formatAmount(v, 4);
  327. }
  328. str = '<span style="text-decoration:underline;">' + str + ' ' + r+'</span>';
  329. return str;
  330. }
  331. function AllTotalPriceFormatter(data) {
  332. var count = 0;
  333. data.forEach(function (e) {
  334. count += e.totalPrice;
  335. });
  336. if (count && count > 0) {
  337. count = (count * 10000) / 10000;
  338. count = _formatAmount(count, 4);
  339. }
  340. return '<strong>' + count + ' CNY<strong>';
  341. }
  342. function InvoiceBillFormatter(invoiceBillNo) {
  343. if (invoiceBillNo) {
  344. return '<span class="label label-success">已开票(' + invoiceBillNo + ')</span>';
  345. } else {
  346. return '<span class="label label-warning">未开票</span>';
  347. }
  348. }
  349. </script>
  350. <script>
  351. // 对Date的扩展,将 Date 转化为指定格式的String
  352. // 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
  353. // 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
  354. // 例子:
  355. // (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
  356. // (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
  357. Date.prototype.Format = function (fmt) { //author: meizz
  358. var o = {
  359. "M+": this.getMonth() + 1, //月份
  360. "d+": this.getDate(), //日
  361. "h+": this.getHours(), //小时
  362. "m+": this.getMinutes(), //分
  363. "s+": this.getSeconds(), //秒
  364. "q+": Math.floor((this.getMonth() + 3) / 3), //季度
  365. "S": this.getMilliseconds() //毫秒
  366. };
  367. if (/(y+)/.test(fmt))
  368. fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  369. for (var k in o)
  370. if (new RegExp("(" + k + ")").test(fmt))
  371. fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  372. return fmt;
  373. }
  374. //将数字转换成金额显示 n是小数点后位数
  375. function toNumber(num, n) {
  376. var re = String(num);
  377. var dotfront = "";
  378. var dotlast = "";
  379. if (re.indexof('.') > -1) {
  380. var sarr = re.spilt('.');
  381. dotfront = sarr[0];
  382. dotlast = sarr[1];
  383. var dotlastlength = strlen(dotlast);
  384. if (dotlastlength < n) {
  385. for (var j = 0; j < n - dotlastlength; j++) {
  386. dotlast += "0";
  387. }
  388. }
  389. if (dotlastlength > n) {
  390. dotlast = dotlast.substr(0, n);
  391. }
  392. } else {
  393. dotfront = re;
  394. for (var i = 0; i < n; i++) {
  395. dotlast += "0";
  396. }
  397. }
  398. num = dotfront + '.' + dotlast;
  399. return num;
  400. }
  401. function _formatAmount(strData, n) {
  402. var CurrencyAndAmountRegExp = /^(\d{1,18})|(\d{1,18}\.)|(\d{1,17}\.\d{0,1})|(\d{1,16}\.\d{0,2})|(\.\d{1,2})$/;
  403. var _result = CurrencyAndAmountRegExp.test(strData);
  404. if (_result == false) {
  405. return strData;
  406. } // 一般来说最多就6位吧,当然如果有特殊需求可自行更改(`・∀・´)
  407. n = n > 0 && n <= 6 ? n : 2;
  408. var formatData = parseFloat((strData + '').replace(/[^\d\.-]/g, '')).toFixed(n) + '';
  409. var l = formatData.split('.')[0].split('').reverse();
  410. var r = formatData.split('.')[1];
  411. var t = '';
  412. for (i = 0; i < l.length; i++) {
  413. t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? ',' : '');
  414. }
  415. return t.split('').reverse().join('') + '.' + r;
  416. }
  417. function strlen(str) {
  418. var len = 0;
  419. for (var i = 0; i < str.length; i++) {
  420. var c = str.charCodeAt(i);
  421. //单字节加1
  422. if ((c >= 0x0001 && c <= 0x007e) || (0xff60 <= c && c <= 0xff9f)) {
  423. len++;
  424. }
  425. else {
  426. len += 2;
  427. }
  428. }
  429. return len;
  430. }
  431. </script>
  432. }