stock.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  6. <title>仓库盘点</title>
  7. <meta name="description" content="">
  8. <meta name="keywords" content="">
  9. <link href="/css/ims/base.css" rel="stylesheet">
  10. <link href="/css/ims/ims.css" rel="stylesheet">
  11. <link rel="stylesheet" type="text/css" href="/css/ims/bootstrap.min.css"/>
  12. <link rel="stylesheet" type="text/css" href="/css/ims/jquery.datetimepicker.css"/>
  13. <link rel="stylesheet" type="text/css" href="/css/ims/ace.min.css"/>
  14. <style>
  15. .green {
  16. color: green;
  17. }
  18. .red {
  19. color: red;
  20. }
  21. .ims-box {
  22. margin: 20px;
  23. }
  24. .screen > div {
  25. float: left;
  26. margin-right: 5px;
  27. }
  28. .screen > span {
  29. line-height: 30px;
  30. margin-right: 5px;
  31. }
  32. .screen .date > input {
  33. height: 30px;
  34. border-radius: 4px;
  35. border: 1px solid #ccc;
  36. box-shadow: none;
  37. text-indent: 10px;
  38. }
  39. .screen button {
  40. padding: 4px 12px;
  41. }
  42. .table-box {
  43. margin-top: 30px;
  44. }
  45. .btn-formal-order {
  46. cursor: pointer;
  47. }
  48. .application-number-box {
  49. margin-top: 50px;
  50. text-align: center;
  51. }
  52. .application-number-box span {
  53. margin-right: 20px;
  54. }
  55. .layui-layer-btn .layui-layer-btn0 {
  56. border-color: #15ae68 !important;
  57. background-color: #15ae68 !important;
  58. color: #fff;
  59. }
  60. .stop-layer-box, .resubmit-layer-box, .delete-layer-box {
  61. line-height: 140px;
  62. text-align: center;
  63. }
  64. </style>
  65. </head>
  66. <body>
  67. <div class="ims-box">
  68. <form action="<?php echo Yii::app()->createUrl('imsStore/stock'); ?>" method="get">
  69. <div class="screen clearfix">
  70. <div class="diy_select select-status">
  71. <input type="hidden" id="status" name="status" class="diy_select_input" value="0">
  72. <div class="diy_select_txt">请选择审批状态</div>
  73. <div class="diy_select_btn"></div>
  74. <ul class="diy_select_list" style="display: none;">
  75. <li val="0">请选择审批状态</li>
  76. <?php foreach ($applyStatus as $as): ?>
  77. <li val="<?php echo($as['dictCode'] + 1); ?>"><?php echo $as['name']; ?></li>
  78. <?php endforeach; ?>
  79. </ul>
  80. </div>
  81. <div class="diy_select select-lossType">
  82. <input type="hidden" id="lossType" name="lossType" class="diy_select_input" value="0">
  83. <div class="diy_select_txt">请选择盈亏状态</div>
  84. <div class="diy_select_btn"></div>
  85. <ul class="diy_select_list" style="display: none;">
  86. <li val="0">盈亏状态</li>
  87. <li val="1">盘亏</li>
  88. <li val="2">盘盈</li>
  89. <li val="3">盘平</li>
  90. </ul>
  91. </div>
  92. <div class="diy_select select-itemId">
  93. <input type="hidden" id="itemId" name="itemId" class="diy_select_input" value="0">
  94. <div class="diy_select_txt">请选择品目名称</div>
  95. <div class="diy_select_btn"></div>
  96. <ul class="diy_select_list" style="display: none;">
  97. <li val="0">请选择品目名称</li>
  98. <?php foreach ($itemList as $item): ?>
  99. <li val="<?php echo $item['itemId'] ?>"><?php echo $item['itemName'] ?></li>
  100. <?php endforeach; ?>
  101. </ul>
  102. </div>
  103. <div class="date fl">
  104. <input type="text" readonly name="startStockDate" class="some_class" value="" id="some_class_1"/> --
  105. <input type="text" readonly name="endStockDate" class="some_class" value="" id="some_class_2"/>
  106. </div>
  107. <button type="submit" class="label-primary-s bth-s">搜索</button>
  108. <a href="<?php echo Yii::app()->createUrl('imsStore/stockAdd'); ?>" class="label-primary-s bth-s">新增盘点</a>
  109. </div>
  110. </form>
  111. <div class="table-box">
  112. <table id="record-table"
  113. class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable"
  114. style="font-size:12px">
  115. <thead>
  116. <tr>
  117. <th>盘点编号</th>
  118. <th>盘点名称</th>
  119. <th>盘点日期</th>
  120. <th>品目名称</th>
  121. <th>单位</th>
  122. <th>理论数量</th>
  123. <th>盘点数量</th>
  124. <th>盈亏状态</th>
  125. <th>盈亏数</th>
  126. <th>审批状态</th>
  127. <th>操作</th>
  128. </tr>
  129. </thead>
  130. <tbody>
  131. <?php if ($list): ?>
  132. <?php foreach ($list as $value): ?>
  133. <tr>
  134. <td><?php echo $value['stockCode'] ?></td>
  135. <td><?php echo $value['stockTitle'] ?></td>
  136. <td><?php echo date('Y-m-d',strtotime($value['stocktakingDate'])) ?></td>
  137. <td><?php echo $value['itemName'] ?></td>
  138. <td><?php echo isset($value['unitName'])?$value['unitName']:'' ?></td>
  139. <td><?php echo $value['theoreticalNo'] ?></td>
  140. <td><?php echo $value['stockNo'] ?></td>
  141. <td><?php echo $value['lossTypeName'] ?></td>
  142. <?php if ($value['lossNo'] < 0): ?>
  143. <td style="background: red;color: white"><?php echo $value['lossNo'] ?></td>
  144. <?php elseif ($value['lossNo'] > 0): ?>
  145. <td>+<?php echo $value['lossNo'] ?></td>
  146. <?php else: ?>
  147. <td>0</td>
  148. <?php endif; ?>
  149. <td><?php echo $value['statusName'] ?></td>
  150. <td>
  151. <?php if ($value['status'] == '0'): ?>
  152. <a href="<?php echo Yii::app()->createUrl('imsStore/stockView', array('stockId' => $value['stockId'],'processInstanceId'=>$value['processInfo']['processInstanceId'])); ?>">查看</a>
  153. <a href="#" class="stop-it" businessKey="<?php echo $value['processInfo']['businessKey']; ?>">取消</a>
  154. <?php endif; ?>
  155. <?php if ($value['status'] == '2' || $value['status'] == '3'): ?>
  156. <a href="<?php echo Yii::app()->createUrl('imsStore/stockEdit', array('stockId' => $value['stockId'])); ?>">重盘</a>
  157. <a href="#" class="delete-it" businessKey="<?php echo $value['processInfo']['businessKey']; ?>">删除</a>
  158. <?php endif; ?>
  159. <?php if ($value['status'] == '1'): ?>
  160. <a href="<?php echo Yii::app()->createUrl('imsStore/stockView', array('stockId' => $value['stockId'],'processInstanceId'=>$value['processInfo']['processInstanceId'])); ?>">查看</a>
  161. <?php endif; ?>
  162. </td>
  163. </tr>
  164. <?php endforeach; ?>
  165. <?php endif; ?>
  166. </tbody>
  167. </table>
  168. <?php if ($page): ?>
  169. <div class="col-sm-12">
  170. <ul class="pagination">
  171. <?php
  172. $params = array();
  173. if (isset($_GET['status']) && $_GET['status'] > 0) {
  174. $params['status'] = $_GET['status'];
  175. }
  176. if (isset($_GET['itemId']) && $_GET['itemId']) {
  177. $params['itemId'] = $_GET['itemId'];
  178. }
  179. if (isset($_GET['lossType']) && $_GET['lossType'] > 0) {
  180. $params['status'] = $_GET['status'];
  181. }
  182. if (isset($_GET['startStockDate']) && $_GET['startStockDate']) {
  183. $params['startStockDate'] = $_GET['startStockDate'];
  184. }
  185. if (isset($_GET['endStockDate']) && $_GET['endStockDate']) {
  186. $params['endStockDate'] = $_GET['endStockDate'];
  187. }
  188. if (isset($_GET['page'])) {
  189. $params['page'] = $_GET['page'];
  190. } else {
  191. $params['page'] = 1;
  192. }
  193. echo formatPage($page, 'imsStore/stock', $params)
  194. ?>
  195. </ul>
  196. </div>
  197. <?php endif; ?>
  198. </div>
  199. </div>
  200. <script src="/js/jquery-2.2.2.min.js"></script>
  201. <script src="/js/jquery.datetimepicker.js"></script>
  202. <script src="/js/layer/layer.js"></script>
  203. <script src="/js/xsgl.js"></script>
  204. <script>
  205. $(document).ready(function () {
  206. $('.some_class').datetimepicker({
  207. format: "Y-m-d", //格式化日期
  208. timepicker: false //关闭时间选项
  209. });
  210. <?php if (isset($_GET['startStockDate'])):?>
  211. $("#some_class_1").attr("value", "<?php echo $_GET['startStockDate']?>");
  212. $("#some_class_2").attr("value", "<?php echo $_GET['endStockDate']?>");
  213. <?php endif;?>
  214. <?php if(isset($_GET['status'])):?>
  215. var status = "<?php echo $_GET['status'];?>";
  216. $('#status').val(status);
  217. var txt = $('.select-status li[val='+status+']').html();
  218. $('.select-status .diy_select_txt').html(txt);
  219. <?php endif;?>
  220. <?php if(isset($_GET['lossType'])):?>
  221. var lossType = "<?php echo $_GET['lossType'];?>";
  222. $('#lossType').val(lossType);
  223. var txt = $('.select-lossType li[val='+lossType+']').html();
  224. $('.select-lossType .diy_select_txt').html(txt);
  225. <?php endif;?>
  226. <?php if(isset($_GET['itemId'])):?>
  227. var itemId = "<?php echo $_GET['itemId'];?>";
  228. $('#itemId').val(itemId);
  229. var txt = $('.select-itemId li[val='+itemId+']').html();
  230. $('.select-itemId .diy_select_txt').html(txt);
  231. <?php endif;?>
  232. $('.some_class').datetimepicker({
  233. format: "Y-m-d", //格式化日期
  234. timepicker: false //关闭时间选项
  235. });
  236. //取消
  237. $("body").on("click", ".stop-it", function () {
  238. var businessKey = $(this).attr('businessKey');
  239. layer.confirm('确认取消该盘点单吗?取消后可以重盘!', {
  240. btn: ['确定', '取消'] //按钮
  241. }, function () {
  242. $.ajax({
  243. type: 'post',
  244. url: "<?php echo Yii::app()->createUrl('imsStore/ajaxStopStock');?>",
  245. data: {'businessKey': businessKey},
  246. dataType: 'json',
  247. success: function (data) {
  248. if (data.status) {
  249. layer.alert("取消成功", {icon:1,closeBtn:0},function () {
  250. location.reload();
  251. })
  252. } else {
  253. layer.msg(data.msg);
  254. }
  255. },
  256. error: function () {
  257. layer.msg("网络异常");
  258. }
  259. });
  260. });
  261. });
  262. //删除
  263. $("body").on("click", ".delete-it", function () {
  264. var businessKey = $(this).attr('businessKey');
  265. layer.confirm('确认删除该盘点吗?', {
  266. btn: ['确定', '取消'] //按钮
  267. }, function () {
  268. $.ajax({
  269. type: 'post',
  270. url: "<?php echo Yii::app()->createUrl('imsStore/ajaxDeleteStock');?>",
  271. data: {'businessKey': businessKey},
  272. dataType: 'json',
  273. success: function (data) {
  274. if (data.status) {
  275. layer.alert("删除成功", {icon:1,closeBtn:0},function () {
  276. location.reload();
  277. })
  278. } else {
  279. layer.msg(data.msg);
  280. }
  281. },
  282. error: function () {
  283. layer.msg("网络异常");
  284. }
  285. });
  286. });
  287. });
  288. });
  289. </script>
  290. </body>
  291. </html>