monthlyBillReport.blade.php 14 KB

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