checkBill.blade.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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="checkBillExport(false)" href="javascript:">导出勾选内容</a>
  14. <a class="dropdown-item" @click="checkBillExport(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. <tr v-for="(procurementCheckSheet,i) in procurementCheckSheets">
  20. <td>
  21. <input class="checkItem" type="checkbox" :value="procurementCheckSheet.id">
  22. </td>
  23. <td><span>@{{ procurementCheckSheet.procurement_code }}</span></td>
  24. <td class="text-muted"><span>@{{ procurementCheckSheet.procurement_at }}</span></td>
  25. <td class="text-muted"><span>@{{ procurementCheckSheet.procurement_delivery_at }}</span></td>
  26. <td class="text-muted"><span>@{{ procurementCheckSheet.supplier_name }}</span></td>
  27. <td class="tooltipTarget" style="max-width: 200px;overflow:hidden"><span>@{{ procurementCheckSheet.material_code }}</span></td>
  28. <td class="text-muted"><span>@{{ procurementCheckSheet.material_name }}</span></td>
  29. <td class="text-muted"><span>@{{ procurementCheckSheet.procurement_quantity }}</span></td>
  30. <td class="text-muted"><span>@{{ procurementCheckSheet.amount }}</span></td>
  31. <td class="text-muted"><span>@{{ procurementCheckSheet.signer_name }}</span></td>
  32. <td class="text-muted"><span>@{{ procurementCheckSheet.signed_at }}</span></td>
  33. <td class="text-muted"><span>@{{ procurementCheckSheet.account_payable }}</span></td>
  34. <td><span>@{{ procurementCheckSheet.invoice_number }}</span></td>
  35. <td><span>@{{ procurement_check_sheet_status[procurementCheckSheet.status] }}</span></td>
  36. <td class="text-center">
  37. <a class="text-primary" @click="fillInvoiceNumber(procurementCheckSheet.id)" v-if="!procurementCheckSheet.invoice_number">填写发票号</a>
  38. <span v-else>-</span>
  39. </td>
  40. </tr>
  41. </table>
  42. @can('采购管理-财务-对账单')
  43. @include('procurement.finance._fillInvoiceNumber')
  44. @endcan
  45. <div class="text-info h5 btn btn">{{$procurementCheckSheets->count()}}/@{{ sum }}</div>
  46. <div>{{$procurementCheckSheets->appends($paginateParams)->links()}}</div>
  47. </div>
  48. @endsection
  49. @section('lastScript')
  50. <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
  51. <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
  52. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
  53. <script>
  54. let vue = new Vue({
  55. el: '#list',
  56. data: {
  57. procurementCheckSheets: [
  58. @foreach($procurementCheckSheets as $procurementCheckSheet)
  59. {
  60. id:'{{$procurementCheckSheet->id ??''}}',invoice_number:'{{$procurementCheckSheet->invoice_number ??''}}',account_payable:'{{$procurementCheckSheet->account_payable ??''}}',
  61. created_at:'{{$procurementCheckSheet->created_at ??''}}',auditor:'{{$procurementCheckSheet->auditor ??''}}',status:'{{$procurementCheckSheet->status ??''}}',
  62. @if($procurementCheckSheet->procurementDelivery)
  63. amount:'{{$procurementCheckSheet->procurementDelivery->amount ??''}}',initiator:'{{$procurementCheckSheet->procurementDelivery->initiator ??''}}',
  64. signer:'{{$procurementCheckSheet->procurementDelivery->signer ??''}}',signed_at:'{{$procurementCheckSheet->procurementDelivery->signed_at ??''}}',
  65. procurement_delivery_at:'{{$procurementCheckSheet->procurementDelivery->created_at ?? ''}}',@endif
  66. @if($procurementCheckSheet->procurementDelivery->procurement)
  67. procurement_quantity:'{{$procurementCheckSheet->procurementDelivery->procurement->quantity ??''}}',
  68. procurement_code:'{{$procurementCheckSheet->procurementDelivery->procurement->code ??''}}',
  69. procurement_at:'{{$procurementCheckSheet->procurementDelivery->procurement->created_at??''}}',@endif
  70. @if($procurementCheckSheet->procurementDelivery->receiver)
  71. signer_name:'{{$procurementCheckSheet->procurementDelivery->receiver->name ??''}}',@endif
  72. @if($procurementCheckSheet->procurementDelivery->procurement->supplier??'')
  73. supplier_id:'{{$procurementCheckSheet->procurementDelivery->procurement->supplier->id ??''}}',
  74. supplier_name:'{{$procurementCheckSheet->procurementDelivery->procurement->supplier->name ??''}}',@endif
  75. @if($procurementCheckSheet->procurementDelivery->procurement->ownerMaterial->material??'')
  76. material_id:'{{$procurementCheckSheet->procurementDelivery->procurement->ownerMaterial->material->id ??''}}',
  77. material_name:'{{$procurementCheckSheet->procurementDelivery->procurement->ownerMaterial->material->name ??''}}',
  78. material_code:'{{$procurementCheckSheet->procurementDelivery->procurement->ownerMaterial->material_code ??''}}',@endif
  79. },
  80. @endforeach
  81. ],
  82. suppliers:[
  83. @foreach($suppliers as $supplier)
  84. {name:'{{$supplier->id}}',value:'{{$supplier->name}}'},
  85. @endforeach
  86. ],
  87. materials: [
  88. @foreach($materials as $material)
  89. {name:'{{$material->id}}',value:'{{$material->name}}'},
  90. @endforeach
  91. ],
  92. sum:{!! $procurementCheckSheets->total() !!},
  93. procurement_check_sheet_status:{!! json_encode(\App\ProcurementCheckSheet::status,JSON_UNESCAPED_UNICODE) !!},
  94. invoice_number:'',procurementCheckSheetId:null,
  95. },
  96. mounted: function () {
  97. $(".tooltipTarget").tooltip({'trigger': 'hover'});
  98. $('#list').removeClass('d-none');
  99. let data = [
  100. [
  101. {name: 'signed_at', type: 'dateMonth', tip: '选择显示指定的签收日期'},
  102. {name:'code',type:'input',tip:'可支持多采购编号,模糊搜索可在两侧增加百分号(%)进行',placeholder: '采购编号'},
  103. {
  104. name: 'supplier_id', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的供应商'],
  105. placeholder: ['供应商', '定位或多选供应商'], data: this.suppliers
  106. },
  107. {
  108. name: 'status', type: 'select',
  109. tip: '输入关键词快速定位下拉列表,回车确定',
  110. placeholder: '对账单状态',
  111. data: [{name:0,value:'未出账'},{name:1,value:'待出账'},{name:2,value:'已出账'},{name:3,value:'已完结'},],
  112. },
  113. ],
  114. ];
  115. this.form = new query({
  116. el: "#form_div",
  117. condition: data,
  118. });
  119. this.form.init();
  120. let column = [
  121. {name: 'code', value: '采购编号', neglect: true,class: 'text-center'},
  122. {name: 'procurement_at', value: '采购日期',class: 'text-center'},
  123. {name: '送货日期', value: '送货日期',class: 'text-center'},
  124. {name: 'company_name', value: '供应商名称',class: 'text-center'},
  125. {name: 'material_code', value: '耗材编号',class: 'text-center'},
  126. {name: 'material_name', value: '耗材',class: 'text-center'},
  127. {name: 'quantity', value: '采购数量',class: 'text-center'},
  128. {name: 'amount', value: '送货数量',class: 'text-center'},
  129. {name: 'signer', value: '签收人',class: 'text-center'},
  130. {name: 'signed_at', value: '签收日期',class: 'text-center'},
  131. {name: '应付金额', value: '应付金额', neglect: true,class: 'text-center'},
  132. {name: '发票号', value: '发票号', neglect: true,class: 'text-center'},
  133. {name: '状态', value: '状态', neglect: true,class: 'text-center'},
  134. {name: '填写发票号', value: '填写发票号', neglect: true,class: 'text-center'},
  135. ];
  136. new Header({
  137. el: "table",
  138. name: "checkBill",
  139. column: column,
  140. data: this.procurementCheckSheets,
  141. fixedTop: ($('#form_div').height()) + 2,
  142. }).init();
  143. },
  144. methods: {
  145. fillInvoiceNumber(id){
  146. let _this=this;
  147. _this.procurementCheckSheetId=id;
  148. $('#fill-invoice-number').modal('show');
  149. },
  150. fillInvoice(){
  151. let _this=this;
  152. if (!_this.procurementCheckSheetId)return;
  153. if (!_this.invoice_number){
  154. tempTip.setDuration(3000);
  155. tempTip.show('发票号不可为空!');
  156. return;
  157. }
  158. let url = '{{url('procurement/finance/fillInvoice')}}';
  159. let params = {invoice_number:_this.invoice_number,procurementCheckSheetId:_this.procurementCheckSheetId};
  160. window.axios.post(url,params).then(function (res) {
  161. if (!res.data.success){
  162. tempTip.setDuration(3000);
  163. tempTip.show(res.data.message);
  164. }else {
  165. _this.procurementCheckSheets.forEach(function (procurementCheckSheet) {
  166. if (procurementCheckSheet.id===_this.procurementCheckSheetId){
  167. procurementCheckSheet.invoice_number=res.data.data;
  168. procurementCheckSheet.status=res.data.status;
  169. }
  170. });
  171. $("#fill-invoice-number").modal('hide');
  172. tempTip.setDuration(3000);
  173. tempTip.showSuccess('添加发票号成功!');
  174. }
  175. }).catch(function (err) {
  176. tempTip.setDuration(3000);
  177. tempTip.show('添加发票号失败!网络错误:'+err);
  178. });
  179. },
  180. checkBillExport(selectAll){
  181. let url = '{{url('procurement/finance/checkBillExport')}}';
  182. let token='{{ csrf_token() }}';
  183. excelExport(selectAll,checkData,url,this.sum,token);
  184. },
  185. }
  186. });
  187. </script>
  188. @endsection