%PDF- %PDF-
Direktori : /home/ugotscom/bos_naturals/resources/js/components/ |
Current File : /home/ugotscom/bos_naturals/resources/js/components/progresssteps.vue |
<template> <div class="container"> <div class="row"> <div style="overflow-x:auto;"> <table class="table table-bordered"> <thead> <tr> <th rowspan="2" scope="col">client</th> <th rowspan="2" scope="col">Cost Center</th> <th rowspan="2" scope="col">Project Name</th> <th rowspan="2" scope="col">Initial Contract</th> <th rowspan="2" scope="col">Variation</th> <th rowspan="2" scope="col">Final Contract without tax</th> <th rowspan="2" scope="col">GST</th> <th rowspan="2" scope="col">KFC</th> <th rowspan="2" scope="col">Total Contract With Tax</th> <th rowspan="2" scope="col">Amount Received</th> <th rowspan="2" scope="col">Amount Payable</th> <th colspan="6" class="col">Sub Contractor</th> </tr> <tr> <!-- skip 1st column because it merges vertically --> <th>Name</th> <th>initial Contract</th> <th>Variation</th> <th>GST</th> <th>KFC</th> <th>Total Cost</th> </tr> </thead> <tbody v-for="work in works" :key="work.id"> <tr v-for="a in work" :key="a.id" v-if="a.contract_type==1"> <td>{{a.project}}</td> <td>{{a.project_name}}</td> <td>{{a.description}}</td> <td>{{a.basic_amount}}</td> <td>{{totalItem(work)}}</td> <td>{{a.basic_amount+variation}}</td> <td>{{(a.basic_amount+variation)*0.18}}</td> <td>{{(a.basic_amount+variation)*0.01}}</td> <td>{{(a.basic_amount+variation)+((a.basic_amount+variation)*0.18)+((a.basic_amount+variation)*0.01)}}</td> <td></td> <td></td> <td></td> <td> <tr rowspan="2" v-for="subcontract in subcontracts" :key="subcontract.id"> {{subcontract.contractor_id}} <td v-for="s in subcontract" :key="a.id" v-if="a.project==s.project"> {{s.project}} {{s.Initial_contract}} </td> </tr> </td> </tr> </tbody> <tfoot> <tr> <td class="right" colspan="3">Total:</td><td></td><td></td><td></td> </tr> </tfoot> </table> </div> </div> </div> </template> <script> export default { data() { return { name: '', file: '', success: '', works:[], variation:'', content:{}, row:[], arr:[1], project_id:'', accounts:[], some:7, contracts:[], variation:'', work:'', allsub:[], subcontracts:[{"id":1,"contractor_id":3997,"project":"64","project_name":"8D El Castillo","description":"Kitchen & Cupboards","contract_type":1,"Initial_contract":101220,"variation":0,"gst":2020,"kfc":112,"status":1,"created_at":"2021-05-22T00:00:00.000000Z","updated_at":"2021-05-22T00:00:00.000000Z"},{"id":2,"contractor_id":1160,"project":"7","project_name":"8D El Castillo","description":"Kitchen Cupboard","contract_type":2,"Initial_contract":0,"variation":45000,"gst":8100,"kfc":0,"status":1,"created_at":"2021-05-22T00:00:00.000000Z","updated_at":"2021-05-22T00:00:00.000000Z"},{"id":4,"contractor_id":3997,"project":"7","project_name":"8D El Castillo","description":"Painting","contract_type":1,"Initial_contract":0,"variation":10000,"gst":1800,"kfc":0,"status":1,"created_at":"2021-05-22T00:00:00.000000Z","updated_at":"2021-05-22T00:00:00.000000Z"},{"id":5,"contractor_id":3997,"project":"9","project_name":"4A SFS","description":"Kitchen Cupboards Variation","contract_type":1,"Initial_contract":860250,"variation":0,"gst":10845,"kfc":603,"status":1,"created_at":"-000001-11-30T00:00:00.000000Z","updated_at":"-000001-11-30T00:00:00.000000Z"},{"id":6,"contractor_id":3997,"project":"9","project_name":"4A SFS","description":"metal painting","contract_type":2,"Initial_contract":0,"variation":10000,"gst":1800,"kfc":0,"status":1,"created_at":"2021-05-22T00:00:00.000000Z","updated_at":"2021-05-22T00:00:00.000000Z"},{"id":7,"contractor_id":1455,"project":"10","project_name":"Skyline 2A","description":"Kitchen renovation","contract_type":1,"Initial_contract":500000,"variation":0,"gst":0,"kfc":0,"status":1,"created_at":"-000001-11-30T00:00:00.000000Z","updated_at":"-000001-11-30T00:00:00.000000Z"}], }; }, methods: { hello(){ alert('hello'); }, loadworks(){ axios.get('/contractors/allcontracts') .then(response => { this.works = response.data; }) }, loadsubcontracts(){ axios.get('/subcontracts/subdetails/') .then(response => { // this.contracts =response.data; }) }, totalItem: function(work){ let sum=0; var i; for (i = 0; i < work.length; i++) { if(work[i].contract_type==2) sum += work[i].basic_amount; } this.variation=sum; return (sum); } , //this.arr.push(item[0]); filterdata:function(work){ this.some=work[0].project; var sum2 = this.accounts.filter(({project_id}) => project_id == this.some).reduce((acc, item) => acc + item.credit, 0); return sum2; }, allaccounts(){ axios.get('/maintenanceaccounts') .then(response => { this.accounts = response.data; }) }, subvariation(){ var sum = this.contracts.reduce((acc, item) => acc + item.variation, 0); return sum; } }, computed: { incompleteTasks() { return this.tasks.filter(task => task.completed); }, incompleteTasks2() { return this.accounts.filter(({credit}) => credit == 50000) }, theSubcontracts() { return this.contracts.filter(({contract_type}) => contract_type == 1) }, filteredPostsByAddress() { return this.subcontracts.filter((subcontract) => { return this.subcontract.filter((s) => { s.contract_type==1 }); }); }, totalContract(){ axios.get('/contractors/') .then(response => { this.allsub =response.data; }) var sum = this.allsub.reduce((acc, item) => acc + item.basic_amount, 0); var gst=sum*0.18; var kfc=sum*0.01 return (sum+kfc+gst); }, totalsubContract(){ // var sum = this.contracts.reduce((acc, item) => acc + item.Initial_contract, 0); // var sum2 = this.contracts.reduce((acc, item) => acc + item.variations, 0); //var gst=((sum+sum2)*0.18); // var kfc=((sum+sum2)*0.01); return (1); }, totalReceived(){ var sum=this.accounts.reduce((acc, item) => acc + item.credit, 0); return sum; } }, created:function(){ this.loadsubcontracts(), this.loadworks(), this.allaccounts(), this.filterdata() } } </script> <style scoped> table { border-collapse: collapse; width: 100%; } th { background: rgb(188, 235, 243); border: 1px solid white; text-align: center; } </style>