monthlyBillReport.blade.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. @extends('layouts.app')
  2. @section('title')采购管理-财务-月账单报表@endsection
  3. @section('content')
  4. <div class="container-fluid" id="list">
  5. <div id="form_div" class="mt-1"></div>
  6. <div class="row mt-2">
  7. <span class="dropdown ml-3">
  8. <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
  9. data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
  10. 导出Excel
  11. </button>
  12. <div class="dropdown-menu">
  13. <a class="dropdown-item" @click="procurementTotalBillExport(false)" href="javascript:">导出勾选内容</a>
  14. <a class="dropdown-item" @click="procurementTotalBillExport(true)" href="javascript:">导出所有页</a>
  15. </div>
  16. </span>
  17. </div>
  18. <table class="table table-sm table-striped table-bordered table-hover text-nowrap card-body mt-2 td-min-width-80" id="table">
  19. <template v-for="(procurementTotalBill,i) in procurementTotalBills">
  20. <tr>
  21. <td >
  22. <input class="checkItem" type="checkbox" :value="procurementTotalBill.id">
  23. </td>
  24. <td class="text-center"><span>@{{ procurementTotalBill.id }}</span></td>
  25. <td class="text-muted text-center"><span>@{{ procurementTotalBill.counting_month }}</span></td>
  26. <td class="text-muted text-center"><span>@{{ procurementTotalBill.created_at.substr(0,10) }}</span></td>
  27. <td class="text-muted text-center"><span>@{{ procurementTotalBill.supplier_name }}</span></td>
  28. <td class="text-center"><span>@{{ procurementTotalBill.total_payable }}</span></td>
  29. <td class="text-center"><span>@{{ procurement_total_bill_status[procurementTotalBill.status] }}</span></td>
  30. <td class="text-center">
  31. <button class="btn btn-sm btn-outline-info" @click="getCheckBill(procurementTotalBill,i,$event)">点击展开</button>
  32. </td>
  33. </tr>
  34. <tr v-if="procurementTotalBill.showSubject" class="p-0 up" >
  35. <td></td>
  36. <td colspan="7" class="p-0 m-0">
  37. <div class="p-0 " :id="'Statement' + i">
  38. <table class="table table-bordered m-0">
  39. <thead class="thead-light">
  40. <tr>
  41. <th>采购编号</th>
  42. <th>采购日期</th>
  43. <th>送货日期</th>
  44. <th>供应商</th>
  45. <th>耗材编号</th>
  46. <th>耗材</th>
  47. <th>采购数量</th>
  48. <th>送货数量</th>
  49. <th>签收人</th>
  50. <th>签收日期</th>
  51. <th>应付金额</th>
  52. <th>发票号</th>
  53. <th>状态</th>
  54. <th>填写发票号</th>
  55. </tr>
  56. </thead>
  57. <tbody>
  58. <tr v-for="(procurementCheckSheet,i) in procurementTotalBill.procurementCheckSheets">
  59. <td>
  60. <span v-if="procurementCheckSheet.procurement_delivery.procurement">@{{ procurementCheckSheet.procurement_delivery.procurement.code }}</span></td>
  61. <td class="text-muted">
  62. <span v-if="procurementCheckSheet.procurement_delivery.procurement">@{{ procurementCheckSheet.procurement_delivery.procurement.created_at }}</span></td>
  63. <td class="text-muted">
  64. <span v-if="procurementCheckSheet.procurement_delivery">@{{ procurementCheckSheet.procurement_delivery.created_at }}</span></td>
  65. <td class="text-muted">
  66. <span v-if="procurementCheckSheet.procurement_delivery.procurement.supplier">@{{ procurementCheckSheet.procurement_delivery.procurement.supplier.name }}</span></td>
  67. <td class="tooltipTarget" style="max-width: 200px;overflow:hidden">
  68. <span v-if="procurementCheckSheet.procurement_delivery.procurement.owner_material">@{{ procurementCheckSheet.procurement_delivery.procurement.owner_material.material_code }}</span></td>
  69. <td class="text-muted">
  70. <span v-if="procurementCheckSheet.procurement_delivery.procurement.owner_material">@{{ procurementCheckSheet.procurement_delivery.procurement.owner_material.material.name }}</span></td>
  71. <td class="text-muted">
  72. <span v-if="procurementCheckSheet.procurement_delivery.procurement">@{{ procurementCheckSheet.procurement_delivery.procurement.quantity }}</span></td>
  73. <td class="text-muted">
  74. <span v-if="procurementCheckSheet.procurement_delivery">@{{ procurementCheckSheet.procurement_delivery.amount }}</span></td>
  75. <td class="text-muted">
  76. <span v-if="procurementCheckSheet.procurement_delivery.receiver">@{{ procurementCheckSheet.procurement_delivery.receiver.name }}</span></td>
  77. <td class="text-muted">
  78. <span v-if="procurementCheckSheet.procurement_delivery">@{{ procurementCheckSheet.procurement_delivery.signed_at }}</span></td>
  79. <td class="text-muted"><span >@{{ procurementCheckSheet.account_payable }}</span></td>
  80. <td><span>@{{ procurementCheckSheet.invoice_number }}</span></td>
  81. <td><span>@{{ procurement_check_sheet_status[procurementCheckSheet.status] }}</span></td>
  82. <td class="text-center">
  83. <a class="text-primary" @click="fillInvoiceNumber(procurementCheckSheet.id)" v-if="!procurementCheckSheet.invoice_number">填写发票号</a>
  84. <span v-else>-</span>
  85. </td>
  86. </tr>
  87. </tbody>
  88. </table>
  89. </div>
  90. </td>
  91. </tr>
  92. </template>
  93. </table>
  94. @can('采购管理-财务-对账单')
  95. @include('procurement.finance._fillInvoiceNumber')
  96. @endcan
  97. <div class="text-info h5 btn btn">{{$procurementTotalBills->count()}}/@{{ sum }}</div>
  98. <div>{{$procurementTotalBills->appends($paginateParams)->links()}}</div>
  99. </div>
  100. @endsection
  101. @section('lastScript')
  102. <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
  103. <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
  104. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
  105. <script>
  106. let vue = new Vue({
  107. el: '#list',
  108. data: {
  109. procurementTotalBills: [
  110. @foreach($procurementTotalBills as $procurementTotalBill)
  111. {
  112. id:'{{$procurementTotalBill->id ?? ''}}',counting_month:'{{$procurementTotalBill->counting_month ?? ''}}',
  113. showSubject:false,procurementCheckSheets:[],
  114. created_at:'{{$procurementTotalBill->created_at ?? ''}}',status:'{{$procurementTotalBill->status ?? ''}}',total_payable:'{{$procurementTotalBill->total_payable ?? ''}}',
  115. @if($procurementTotalBill->supplier)
  116. supplier_id:'{{$procurementTotalBill->supplier->id ?? ''}}',supplier_name:'{{$procurementTotalBill->supplier->name ?? ''}}',@endif
  117. },
  118. @endforeach
  119. ],
  120. suppliers:[
  121. @foreach($suppliers as $supplier)
  122. {name:'{{$supplier->id}}',value:'{{$supplier->name}}'},
  123. @endforeach
  124. ],
  125. sum:{!! $procurementTotalBills->total() !!},
  126. procurement_total_bill_status:{!! json_encode(\App\ProcurementTotalBill::status,JSON_UNESCAPED_UNICODE) !!},
  127. procurement_check_sheet_status:{!! json_encode(\App\ProcurementCheckSheet::status,JSON_UNESCAPED_UNICODE) !!},
  128. invoice_number:'',procurementCheckSheetId:null,index:'',
  129. },
  130. mounted: function () {
  131. $(".up").slideUp();
  132. $(".tooltipTarget").tooltip({'trigger': 'hover'});
  133. $('#list').removeClass('d-none');
  134. let data = [
  135. [
  136. {name:'counting_month',type:'dateMonth',tip:'选择账单日期',placeholder: '----年--月'},
  137. {
  138. name: 'supplier_id', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的供应商'],
  139. placeholder: ['供应商', '定位或多选供应商'], data: this.suppliers
  140. },
  141. ],
  142. ];
  143. this.form = new query({
  144. el: "#form_div",
  145. condition: data,
  146. });
  147. this.form.init();
  148. let column = [
  149. {name: 'id', value: '对账编号', neglect: true,class: 'text-center'},
  150. {name: 'counting_month', value: '账单日期',class: 'text-center'},
  151. {name: 'created_at', value: '提交日期',class: 'text-center'},
  152. {name: 'supplier', value: '供应商',class: 'text-center'},
  153. {name: 'total_payable', value: '总金额',class: 'text-center'},
  154. {name: 'status', value: '状态',class: 'text-center'},
  155. {name: 'detail', value: '月账单详情',class: 'text-center'},
  156. ];
  157. new Header({
  158. el: "table",
  159. name: "monthlyBillReport",
  160. column: column,
  161. data: this.procurementTotalBills,
  162. fixedTop: ($('#form_div').height()) + 2,
  163. }).init();
  164. },
  165. methods: {
  166. procurementTotalBillExport(selectAll){
  167. let url = '{{url('procurement/finance/procurementTotalBillExport')}}';
  168. let token='{{ csrf_token() }}';
  169. excelExport(selectAll,checkData,url,this.sum,token);
  170. },
  171. getCheckBill(procurementTotalBill,index,$e){
  172. this.index=index;
  173. if(procurementTotalBill.showSubject){
  174. procurementTotalBill.showSubject=false;
  175. $($e.target).html('点击展开');
  176. return;
  177. }
  178. $($e.target).html('加载中...');
  179. let url = '{{url('procurement/finance/getCheckBillMonth')}}'
  180. let data = {
  181. 'procurement_total_bill_id':procurementTotalBill['id'],
  182. };
  183. window.axios.post(url,data).then(res=>{
  184. if(res.data.success){
  185. // this.$set(this.procurementTotalBills[index],'subjection',res.data.data);
  186. this.procurementTotalBills[index].procurementCheckSheets=res.data.data;
  187. procurementTotalBill['showSubject'] = true;
  188. $("#Statement"+index).slideToggle();
  189. $($e.target).html('点击收起');
  190. this.$forceUpdate();
  191. }
  192. }).catch(err=>{
  193. $($e.target).html('点击展开');
  194. window.tempTip.show(err);
  195. });
  196. },
  197. fillInvoiceNumber(id){
  198. let _this=this;
  199. _this.procurementCheckSheetId=id;
  200. $('#fill-invoice-number').modal('show');
  201. },
  202. fillInvoice(){
  203. let _this=this;
  204. if (!_this.procurementCheckSheetId)return;
  205. if (!_this.invoice_number){
  206. tempTip.setDuration(3000);
  207. tempTip.show('发票号不可为空!');
  208. return;
  209. }
  210. let url = '{{url('procurement/finance/fillInvoice')}}';
  211. let params = {invoice_number:_this.invoice_number,procurementCheckSheetId:_this.procurementCheckSheetId};
  212. window.axios.post(url,params).then(function (res) {
  213. if (!res.data.success){
  214. tempTip.setDuration(3000);
  215. tempTip.show(res.data.message);
  216. }else {
  217. _this.procurementTotalBills[_this.index].procurementCheckSheets.forEach(function (procurementCheckSheet) {
  218. if (procurementCheckSheet.id===_this.procurementCheckSheetId){
  219. procurementCheckSheet.invoice_number=res.data.data;
  220. procurementCheckSheet.status=res.data.status;
  221. }
  222. });
  223. if (res.data.totalStatus) _this.procurementTotalBills[_this.index].status=res.data.totalStatus;
  224. $("#fill-invoice-number").modal('hide');
  225. tempTip.setDuration(3000);
  226. tempTip.showSuccess('添加发票号成功!');
  227. }
  228. }).catch(function (err) {
  229. tempTip.setDuration(3000);
  230. tempTip.show('添加发票号失败!网络错误:'+err);
  231. });
  232. },
  233. }
  234. });
  235. </script>
  236. @endsection