SalesReport.cshtml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. @using ShwasherSys
  2. @using ShwasherSys.Authorization.Permissions
  3. @using ShwasherSys.Models.Layout
  4. @using ShwasherSys.Views.Shared.New.Modals
  5. @using ShwasherSys.Views.Shared.New.Table
  6. @{
  7. ViewBag.Title = "销售数据统计";
  8. string activeMenu = PermissionNames.Pages; //The menu item will be active for this page.
  9. ViewBag.ActiveMenu = activeMenu;
  10. }
  11. @section css{
  12. <link href="~/Content/Css/statistic.css" rel="stylesheet" />
  13. <style>
  14. #table1 th.td:not(.index) {
  15. min-width: 120px;
  16. max-width: 300px;
  17. }
  18. </style>
  19. }
  20. <div class="box-tool">
  21. <div class="tool-form">
  22. <form id="tool-form">
  23. <div style="float: left">
  24. <select id="year" name="year" class="form-control" autocomplete="off" style="width: 120px;">
  25. <option value="">请选择年份</option>
  26. @for (int i = DateTime.Now.Year; i >= 2019; i--)
  27. {
  28. <option value="@(i)">@(i)年</option>
  29. }
  30. </select>
  31. <select id="month" name="month" class="form-control" autocomplete="off" style="width: 180px;">
  32. <option value="">请选择月份/季度/年度</option>
  33. <optgroup label="月份">
  34. @for (int j = 1; j <= 12; j++)
  35. {
  36. <option value="@(j)">@(j)月</option>
  37. }
  38. </optgroup>
  39. <optgroup label="季度">
  40. @for (int j = 1; j <= 4; j++)
  41. {
  42. <option value="@(j+12)">第 @(j) 季度</option>
  43. }
  44. </optgroup>
  45. <optgroup label="年度">
  46. <option value="19">整年度</option>
  47. <option value="17">上半年</option>
  48. <option value="18">下半年</option>
  49. </optgroup>
  50. </select>
  51. @*<input id="query-date1" class="form-control iwb-date" type="text" value="" placeholder="请输入查询开始日期..." style="width: 250px;"/>
  52. <input id="query-date2" class="form-control iwb-date" type="text" value="" placeholder="请输入查询结束日期..." style="width: 250px;"/>*@
  53. </div>
  54. <div style="width: 250px; float: left;margin-left: 10px;">
  55. <div class="input-group form-group-sm " style="width: 100%;">
  56. <input id="employeeId" name="employeeId" class="form-control" type="hidden" autocomplete="off" placeholder="" style="width: 250px;" /><input id="employeeNo" name="employeeNo" class="form-control" type="hidden" autocomplete="off" placeholder="" style="width: 250px;" />
  57. <input class="form-control" id="query-man" name="query-man" type="text" autocomplete="off" required="" placeholder="请输入查询员工..." readonly="">
  58. <div class="input-group-addon" onclick="ShowQueryModal('query_employee_modal', '.tool-form');">
  59. <i class="iconfont icon-search"></i>
  60. </div>
  61. <div class="input-group-addon" title="清除员工信息" onclick="ClearQueryValue(this);">
  62. <i class="iconfont icon-close"></i>
  63. </div>
  64. </div>
  65. </div>
  66. </form>
  67. </div>
  68. <div class="tool-btn">
  69. <button class="btn btn-info btn-sm" onclick="Query()">查询</button>
  70. @* <button class="btn btn-success btn-sm" onclick="Export()">导出</button>*@
  71. </div>
  72. </div>
  73. <div class="box-data">
  74. <div class="box-body">
  75. <table id="table1" style="display: none">
  76. <thead>
  77. <tr class="title">
  78. <td class="td" colspan="20">上海上垫垫圈有限公司销售统计表</td>
  79. </tr>
  80. <tr class="title-sm">
  81. <th class="td department" colspan="3">部门:销售部</th>
  82. <th class="td date" colspan="4">日期:<span class="date"></span></th>
  83. </tr>
  84. <tr>
  85. <th class="td index">序号</th>
  86. <th class="td">工号</th>
  87. <th class="td">姓名</th>
  88. <th class="td">订单数</th>
  89. <th class="td">产品数量(千件)</th>
  90. <th class="td">税前金额</th>
  91. <th class="td">含税金额</th>
  92. </tr>
  93. </thead>
  94. <tbody class="tbody"></tbody>
  95. <tfoot>
  96. <tr>
  97. <td class="td" colspan="1"></td>
  98. <td class="td detail" colspan="2">
  99. 总订单数:<strong class="kg"></strong>
  100. </td>
  101. <td class="td detail" colspan="2">
  102. 总件数: <strong class="pcs"></strong> 千件
  103. </td>
  104. <td class="td" colspan="2"></td>
  105. @*<th class="td" colspan="1">本月总计</th>
  106. <td class="td detail" colspan="3">
  107. <p>总重量:<strong id="kg">44</strong> kg</p>
  108. <p>总件数:<strong id="pcs">55</strong> 千件</p>
  109. </td>*@
  110. </tr>
  111. </tfoot>
  112. </table>
  113. <table id="table2" style="display: none">
  114. <thead>
  115. <tr class="title">
  116. <td class="td" colspan="20">上海上垫垫圈有限公司销售统计表</td>
  117. </tr>
  118. <tr class="title-sm">
  119. <th class="td department" colspan="4">部门:销售部</th>
  120. <th class="td" colspan="2" style="border-left:none">工号:<span class="eNo"></span></th>
  121. <th class="td" colspan="2" style="border-left:none">姓名:<span class="eName"></span></th>
  122. <th class="td date" colspan="3">日期:<span class="date"></span></th>
  123. </tr>
  124. <tr>
  125. <th class="td index">序号</th>
  126. <th class="td">订单号</th>
  127. <th class="td">税前金额</th>
  128. <th class="td">含税金额</th>
  129. <th class="td">产品名称</th>
  130. <th class="td">产品数量</th>
  131. <th class="td">日期</th>
  132. @*<th class="td">零件号</th>
  133. <th class="td">规格</th>
  134. <th class="td">材质</th>
  135. <th class="td">表色</th>*@
  136. </tr>
  137. </thead>
  138. <tbody class="tbody"></tbody>
  139. <tfoot>
  140. <tr>
  141. <td class="td" colspan="1"></td>
  142. <td class="td detail" colspan="3">
  143. 总订单数:<strong class="kg"></strong> kg
  144. </td>
  145. <td class="td detail" colspan="3">
  146. 总件数: <strong class="pcs"></strong> 千件
  147. </td>
  148. <td class="td" colspan="5"></td>
  149. @*<th class="td" colspan="1">本月总计</th>
  150. <td class="td detail" colspan="3">
  151. <p>总重量:<strong id="kg">44</strong> kg</p>
  152. <p>总件数:<strong id="pcs">55</strong> 千件</p>
  153. </td>*@
  154. </tr>
  155. </tfoot>
  156. </table>
  157. </div>
  158. </div>
  159. @section modal{
  160. @Html.Partial("Modals/Query/_Employee", "employeeNo,query-man,employeeId")
  161. }
  162. @section scripts
  163. {
  164. <script type="text/javascript">
  165. var $table = $('#table');
  166. $(function () {
  167. $('#year').val(@(DateTime.Now.Year)).select2();
  168. $('#month').val(@(DateTime.Now.Month)).select2();
  169. Query();
  170. });
  171. function Query() {
  172. var date = $('#year').val();
  173. if (date) {
  174. $.iwbAjax4({
  175. url: window.appUrl + '/' ,
  176. form:'tool-form',
  177. success: function (res) {
  178. $table = $('#employeeId').val() ? $('#table2') : $('#table1');
  179. var $table2 = $('#employeeId').val() ? $('#table1') : $('#table2');
  180. $table.find('.date').html(res.dayDate || "");
  181. $table.find('.eNo').html(res.employeeNo || "");
  182. $table.find('.eName').html(res.employeeName || "");
  183. $table.find('.kg').html(res.kgTotal || "");
  184. $table.find('.pcs').html(res.pcsTotal || "");
  185. if (res) {
  186. var str = ItemFormatter(res.items);
  187. $table.find('.tbody').html(str);
  188. $table.fadeIn();
  189. $table2.hide();
  190. } else {
  191. $table.hide();
  192. $table2.hide();
  193. abp.message.warn("未查询到数据。");
  194. }
  195. }
  196. });
  197. } else {
  198. abp.message.warn("请选择年份。");
  199. }
  200. }
  201. function ItemFormatter(data) {
  202. var str = "";
  203. if (data && data.length > 0) {
  204. for (var i = 0; i < data.length; i++) {
  205. var item = data[i];
  206. str += '<tr>';
  207. str += '<td class="td">{0}</td>'.format(i+1);
  208. if ($('#employeeId').val()) {
  209. str += '<td class="td">{0}</td>'.format(item.productionOrderNo || "");
  210. str += '<td class="td">{0}</td>'.format(item.kgQuantity || "");
  211. str += '<td class="td">{0}</td>'.format(item.pcsQuantity || "");
  212. str += '<td class="td">{0}</td>'.format(item.kgWeight || "");
  213. str += '<td class="td">{0}</td>'.format(new Date(item.productDate).format('yyyy-MM-dd'));
  214. str += '<td class="td">{0}</td>'.format(item.productName || "");
  215. str += '<td class="td">{0}</td>'.format(item.partNo || "");
  216. str += '<td class="td">{0}</td>'.format(item.Model || "");
  217. str += '<td class="td">{0}</td>'.format(item.Material || "");
  218. str += '<td class="td">{0}</td>'.format(item.surfaceColor || "");
  219. }else
  220. {
  221. str += '<td class="td">{0}</td>'.format(item.employeeNo || "");
  222. str += '<td class="td">{0}</td>'.format(item.employeeName || "");
  223. str += '<td class="td">{0}</td>'.format(item.kgQuantity || "");
  224. str += '<td class="td">{0}</td>'.format(item.pcsQuantity || "");
  225. str += '<td class="td">{0}</td>'.format(new Date(item.productDate).format('yyyy-MM-dd'));
  226. }
  227. str += '</tr>';
  228. }
  229. } else {
  230. str += '<tr>';
  231. str += '<td class="td" colspan="20" style="color:red;padding:10px;">未查询到生产明细</td>';
  232. str += '</tr>';
  233. }
  234. return str;
  235. }
  236. function Export() {
  237. }
  238. function ClearQueryValue(that) {
  239. var $that = $(that).closest('.input-group');
  240. $that.find('input').val("");
  241. }
  242. </script>
  243. }
  244. <section style="display: none">
  245. <select id="hid-type">
  246. <option value=""></option>
  247. </select>
  248. @*@Html.DropDownList("hid-type", type)*@
  249. </section>