checkBill.blade.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. @extends('layouts.app')
  2. @section('title')采购管理-财务-对账单@endsection
  3. @section('content')
  4. @component('procurement.finance.menu')@endcomponent
  5. <div class="container-fluid" id="list">
  6. <div id="form_div" class="mt-1"></div>
  7. <div class="row mt-2">
  8. <span class="dropdown ml-3">
  9. <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
  10. data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
  11. 导出Excel
  12. </button>
  13. <div class="dropdown-menu">
  14. <a class="dropdown-item" @click="checkBillExport(false)" href="javascript:">导出勾选内容</a>
  15. <a class="dropdown-item" @click="checkBillExport(true)" href="javascript:">导出所有页</a>
  16. </div>
  17. </span>
  18. </div>
  19. <table class="table table-sm table-striped table-bordered table-hover text-nowrap card-body mt-2 td-min-width-80" id="table">
  20. <tr v-for="(procurementCheckSheet,i) in procurementCheckSheets">
  21. <td>
  22. <input class="checkItem" type="checkbox" :value="procurementCheckSheet.id">
  23. </td>
  24. <td><span>@{{ procurementCheckSheet.procurement_code }}</span></td>
  25. <td class="text-muted"><span>@{{ procurementCheckSheet.procurement_at }}</span></td>
  26. <td class="text-muted"><span>@{{ procurementCheckSheet.procurement_delivery_at }}</span></td>
  27. <td class="text-muted"><span>@{{ procurementCheckSheet.supplier_name }}</span></td>
  28. <td class="tooltipTarget" style="max-width: 200px;overflow:hidden"><span>@{{ procurementCheckSheet.material_code }}</span></td>
  29. <td class="text-muted"><span>@{{ procurementCheckSheet.material_name }}</span></td>
  30. <td class="text-muted"><span>@{{ procurementCheckSheet.procurement_quantity }}</span></td>
  31. <td class="text-muted"><span>@{{ procurementCheckSheet.amount }}</span></td>
  32. <td class="text-muted"><span>@{{ procurementCheckSheet.signer_name }}</span></td>
  33. <td class="text-muted"><span>@{{ procurementCheckSheet.signed_at }}</span></td>
  34. <td class="text-muted"><span>@{{ procurementCheckSheet.account_payable }}</span></td>
  35. <td><span>@{{ procurementCheckSheet.invoice_number }}</span></td>
  36. <td><span>@{{ procurement_check_sheet_status[procurementCheckSheet.status] }}</span></td>
  37. <td class="text-center">
  38. <a class="text-primary" @click="fillInvoiceNumber(procurementCheckSheet.id)" v-if="!procurementCheckSheet.invoice_number">填写发票号</a>
  39. <span v-else>-</span>
  40. </td>
  41. </tr>
  42. </table>
  43. @can('采购管理-财务-对账单')
  44. @include('procurement.finance._fillInvoiceNumber')
  45. @endcan
  46. <div class="text-info h5 btn btn">{{$procurementCheckSheets->count()}}/@{{ sum }}</div>
  47. <div>{{$procurementCheckSheets->appends($paginateParams)->links()}}</div>
  48. </div>
  49. @endsection
  50. @section('lastScript')
  51. <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
  52. <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
  53. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
  54. <script>
  55. let vue = new Vue({
  56. el: '#list',
  57. data: {
  58. procurementCheckSheets: [
  59. @foreach($procurementCheckSheets as $procurementCheckSheet)
  60. {
  61. id:'{{$procurementCheckSheet->id ??''}}',invoice_number:'{{$procurementCheckSheet->invoice_number ??''}}',account_payable:'{{$procurementCheckSheet->account_payable ??''}}',
  62. created_at:'{{$procurementCheckSheet->created_at ??''}}',auditor:'{{$procurementCheckSheet->auditor ??''}}',status:'{{$procurementCheckSheet->status ??''}}',
  63. @if($procurementCheckSheet->procurementDelivery)
  64. amount:'{{$procurementCheckSheet->procurementDelivery->amount ??''}}',initiator:'{{$procurementCheckSheet->procurementDelivery->initiator ??''}}',
  65. signer:'{{$procurementCheckSheet->procurementDelivery->signer ??''}}',signed_at:'{{$procurementCheckSheet->procurementDelivery->signed_at ??''}}',
  66. procurement_delivery_at:'{{$procurementCheckSheet->procurementDelivery->created_at ?? ''}}',@endif
  67. @if($procurementCheckSheet->procurementDelivery->procurement)
  68. procurement_quantity:'{{$procurementCheckSheet->procurementDelivery->procurement->quantity ??''}}',
  69. procurement_code:'{{$procurementCheckSheet->procurementDelivery->procurement->code ??''}}',
  70. procurement_at:'{{$procurementCheckSheet->procurementDelivery->procurement->created_at??''}}',@endif
  71. @if($procurementCheckSheet->procurementDelivery->receiver)
  72. signer_name:'{{$procurementCheckSheet->procurementDelivery->receiver->name ??''}}',@endif
  73. @if($procurementCheckSheet->procurementDelivery->procurement->supplier??'')
  74. supplier_id:'{{$procurementCheckSheet->procurementDelivery->procurement->supplier->id ??''}}',
  75. supplier_name:'{{$procurementCheckSheet->procurementDelivery->procurement->supplier->name ??''}}',@endif
  76. @if($procurementCheckSheet->procurementDelivery->procurement->ownerMaterial->material??'')
  77. material_id:'{{$procurementCheckSheet->procurementDelivery->procurement->ownerMaterial->material->id ??''}}',
  78. material_name:'{{$procurementCheckSheet->procurementDelivery->procurement->ownerMaterial->material->name ??''}}',
  79. material_code:'{{$procurementCheckSheet->procurementDelivery->procurement->ownerMaterial->material_code ??''}}',@endif
  80. },
  81. @endforeach
  82. ],
  83. suppliers:[
  84. @foreach($suppliers as $supplier)
  85. {name:'{{$supplier->id}}',value:'{{$supplier->name}}'},
  86. @endforeach
  87. ],
  88. materials: [
  89. @foreach($materials as $material)
  90. {name:'{{$material->id}}',value:'{{$material->name}}'},
  91. @endforeach
  92. ],
  93. sum:{!! $procurementCheckSheets->total() !!},
  94. procurement_check_sheet_status:{!! json_encode(\App\ProcurementCheckSheet::status,JSON_UNESCAPED_UNICODE) !!},
  95. invoice_number:'',procurementCheckSheetId:null,
  96. },
  97. mounted: function () {
  98. $(".tooltipTarget").tooltip({'trigger': 'hover'});
  99. $('#list').removeClass('d-none');
  100. let data = [
  101. [
  102. {name: 'signed_at', type: 'dateMonth', tip: '选择显示指定的签收日期'},
  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