mirror of
https://github.com/dyiop/astute.git
synced 2025-04-05 21:10:16 -04:00
changed alot of things
This commit is contained in:
parent
c5081f6e38
commit
3ba902bfe4
6
AstuteClient2/package-lock.json
generated
6
AstuteClient2/package-lock.json
generated
|
@ -8510,9 +8510,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"semver-intersect": {
|
"semver-intersect": {
|
||||||
"version": "1.3.1",
|
"version": "1.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/semver-intersect/-/semver-intersect-1.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/semver-intersect/-/semver-intersect-1.4.0.tgz",
|
||||||
"integrity": "sha1-j6hKnhAovSOeRTDRo+GB5pjYhLo=",
|
"integrity": "sha512-d8fvGg5ycKAq0+I6nfWeCx6ffaWJCsBYU0H2Rq56+/zFePYfT8mXkB3tWBSjR5BerkHNZ5eTPIk1/LBYas35xQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"semver": "^5.0.0"
|
"semver": "^5.0.0"
|
||||||
|
|
|
@ -32,10 +32,9 @@
|
||||||
"zone.js": "^0.8.26"
|
"zone.js": "^0.8.26"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular/compiler-cli": "^6.0.2",
|
|
||||||
"@angular-devkit/build-angular": "~0.6.3",
|
"@angular-devkit/build-angular": "~0.6.3",
|
||||||
"typescript": "~2.7.2",
|
"@angular/cli": "^6.0.8",
|
||||||
"@angular/cli": "~6.0.3",
|
"@angular/compiler-cli": "^6.0.2",
|
||||||
"@angular/language-service": "^6.0.2",
|
"@angular/language-service": "^6.0.2",
|
||||||
"@types/jasmine": "~2.8.6",
|
"@types/jasmine": "~2.8.6",
|
||||||
"@types/jasminewd2": "~2.0.3",
|
"@types/jasminewd2": "~2.0.3",
|
||||||
|
@ -50,6 +49,7 @@
|
||||||
"karma-jasmine-html-reporter": "^0.2.2",
|
"karma-jasmine-html-reporter": "^0.2.2",
|
||||||
"protractor": "~5.3.0",
|
"protractor": "~5.3.0",
|
||||||
"ts-node": "~5.0.1",
|
"ts-node": "~5.0.1",
|
||||||
"tslint": "~5.9.1"
|
"tslint": "~5.9.1",
|
||||||
|
"typescript": "~2.7.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,6 @@ export class CustomerComponent implements OnInit {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
editCustomer(id, name, billTo, add1, add2, city, state, zip, zip4, email, phone, phExt, fax, ref) {
|
editCustomer(id, name, billTo, add1, add2, city, state, zip, zip4, email, phone, phExt, fax, ref) {
|
||||||
if (fax.length > 0 && fax.length < 14) {
|
if (fax.length > 0 && fax.length < 14) {
|
||||||
alert('Invalid fax.');
|
alert('Invalid fax.');
|
||||||
|
@ -194,7 +193,6 @@ export class CustomerComponent implements OnInit {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteCustomer(customerId) {
|
deleteCustomer(customerId) {
|
||||||
if (customerId) {
|
if (customerId) {
|
||||||
if (confirm('Are you sure you want to delete customer, ' + customerId)) {
|
if (confirm('Are you sure you want to delete customer, ' + customerId)) {
|
||||||
|
@ -236,7 +234,6 @@ export class CustomerComponent implements OnInit {
|
||||||
alert('Create customer failed: ' + reason);
|
alert('Create customer failed: ' + reason);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteContact() {
|
deleteContact() {
|
||||||
const selectedNodes = this.contactGridApi.getSelectedNodes();
|
const selectedNodes = this.contactGridApi.getSelectedNodes();
|
||||||
if (selectedNodes.length > 0) {
|
if (selectedNodes.length > 0) {
|
||||||
|
@ -262,25 +259,25 @@ export class CustomerComponent implements OnInit {
|
||||||
const eventData = event.data;
|
const eventData = event.data;
|
||||||
console.log(eventData);
|
console.log(eventData);
|
||||||
if (eventData.fax.length > 0 && eventData.fax.length < 14) {
|
if (eventData.fax.length > 0 && eventData.fax.length < 14) {
|
||||||
|
this.refreshData();
|
||||||
alert('Invalid fax.');
|
alert('Invalid fax.');
|
||||||
} else if (eventData.phone.length > 0 && eventData.phone.length < 14) {
|
} else if (eventData.phone.length > 0 && eventData.phone.length < 14) {
|
||||||
|
this.refreshData();
|
||||||
alert('Invalid phone.');
|
alert('Invalid phone.');
|
||||||
} else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(eventData.email) === false) {
|
} else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(eventData.email) === false) {
|
||||||
|
this.refreshData();
|
||||||
alert('You have entered an invalid email address!');
|
alert('You have entered an invalid email address!');
|
||||||
} else {
|
} else {
|
||||||
this.astuteClientService.updateCustomer(eventData.customerId, eventData).then((data) => {
|
this.astuteClientService.updateCustomer(eventData.customerId, eventData).then((data) => {
|
||||||
if (data) {
|
if (!data) {
|
||||||
this.refreshData();
|
this.refreshData();
|
||||||
} else {
|
|
||||||
alert('Customer Updating Failed, Check Input Fields');
|
alert('Customer Updating Failed, Check Input Fields');
|
||||||
}
|
}
|
||||||
}, (reason) => {
|
}, (reason) => {
|
||||||
alert('Update customer failed: ' + reason);
|
alert('Update customer failed: ' + reason);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.refreshData();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateContactRow(event) {
|
updateContactRow(event) {
|
||||||
console.log(event);
|
console.log(event);
|
||||||
|
|
||||||
|
@ -293,19 +290,18 @@ export class CustomerComponent implements OnInit {
|
||||||
// alert('Invalid work phone.');
|
// alert('Invalid work phone.');
|
||||||
// } else
|
// } else
|
||||||
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(eventData.email) === false) {
|
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(eventData.email) === false) {
|
||||||
|
this.contactsData = this.astuteClientService.getCustomerContacts(eventData.customerId);
|
||||||
alert('You have entered an invalid email address!');
|
alert('You have entered an invalid email address!');
|
||||||
} else {
|
} else {
|
||||||
this.astuteClientService.updateCustomerContact(eventData.customerId, eventData).then((data) => {
|
this.astuteClientService.updateCustomerContact(eventData.customerId, eventData).then((data) => {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
alert('Customer Updating Failed, Check Input Fields');
|
|
||||||
} else {
|
|
||||||
this.contactsData = this.astuteClientService.getCustomerContacts(eventData.customerId);
|
this.contactsData = this.astuteClientService.getCustomerContacts(eventData.customerId);
|
||||||
|
alert('Customer Updating Failed, Check Input Fields');
|
||||||
}
|
}
|
||||||
}, (reason) => {
|
}, (reason) => {
|
||||||
alert('Update customer failed: ' + reason);
|
alert('Update customer failed: ' + reason);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.contactsData = this.astuteClientService.getCustomerContacts(eventData.customerId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// opening and closing modal-form components
|
// opening and closing modal-form components
|
||||||
|
@ -316,7 +312,6 @@ export class CustomerComponent implements OnInit {
|
||||||
}
|
}
|
||||||
ref.open();
|
ref.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
close(ref) {
|
close(ref) {
|
||||||
ref.close();
|
ref.close();
|
||||||
}
|
}
|
||||||
|
@ -329,23 +324,19 @@ export class CustomerComponent implements OnInit {
|
||||||
this.customers = data;
|
this.customers = data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshContactData(customerId) {
|
refreshContactData(customerId) {
|
||||||
this.contactsData = this.astuteClientService.getCustomerContacts(customerId);
|
this.contactsData = this.astuteClientService.getCustomerContacts(customerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// on each grid ready: sets api's and enable auto-resizing
|
// on each grid ready: sets api's and enable auto-resizing
|
||||||
onGridReady(evt) {
|
onGridReady(evt) {
|
||||||
this.gridApi = evt.api;
|
this.gridApi = evt.api;
|
||||||
this.gridColumnApi = evt.columnApi;
|
this.gridColumnApi = evt.columnApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
onContactGridReady(evt) {
|
onContactGridReady(evt) {
|
||||||
this.contactGridApi = evt.api;
|
this.contactGridApi = evt.api;
|
||||||
this.contactColumnApi = evt.columnApi;
|
this.contactColumnApi = evt.columnApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
resizeColumns(evt) {
|
resizeColumns(evt) {
|
||||||
evt.columnApi.autoSizeAllColumns();
|
evt.columnApi.autoSizeAllColumns();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<ag-grid-angular
|
<ag-grid-angular
|
||||||
#agGrid
|
|
||||||
style="height: 500px;"
|
style="height: 500px;"
|
||||||
class="ag-theme-balham"
|
class="ag-theme-balham"
|
||||||
[gridOptions]="gridOptions"
|
[gridOptions]="gridOptions"
|
||||||
|
@ -13,8 +12,11 @@
|
||||||
[enableFilter]="true"
|
[enableFilter]="true"
|
||||||
[rowData]="source"
|
[rowData]="source"
|
||||||
[columnDefs]="columnDefs"
|
[columnDefs]="columnDefs"
|
||||||
|
(cellEditingStopped)="updateRow($event)"
|
||||||
|
(gridReady)="onGridReady($event)"
|
||||||
|
(rowDataChanged)="resizeColumns($event)"
|
||||||
|
(rowClicked)="setSelectedRow($event)"
|
||||||
rowSelection="single"
|
rowSelection="single"
|
||||||
rowDeselection="true"
|
|
||||||
></ag-grid-angular>
|
></ag-grid-angular>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -22,15 +24,20 @@
|
||||||
<!--Buttons-->
|
<!--Buttons-->
|
||||||
<div class="row justify-content-center mt-2">
|
<div class="row justify-content-center mt-2">
|
||||||
<div class="col-2">
|
<div class="col-2">
|
||||||
<button class="btn btn-success" style="width: 100%" (click)="open(new,null,null)">
|
<button class="btn btn-success" style="width: 100%" (click)="open(new)">
|
||||||
Add
|
Add
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-2">
|
<div class="col-2">
|
||||||
<button class="btn btn-info" style="width: 100%" (click)="open(edit,null,null)" [disabled]="!chosenInv">
|
<button class="btn btn-info" style="width: 100%" (click)="open(edit)" [disabled]="!chosenInv">
|
||||||
Edit
|
Edit
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-2">
|
||||||
|
<button class="btn btn-info" style="width: 100%" (click)="open(details)" [disabled]="!chosenInv">
|
||||||
|
Details
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<div class="col-2">
|
<div class="col-2">
|
||||||
<button class="btn btn-primary" style="width: 100%" (click)="submitInvoice(chosenInv.invoiceNumber)" [disabled]="!(chosenInv && chosenInv.invoiceStatus === 1)">
|
<button class="btn btn-primary" style="width: 100%" (click)="submitInvoice(chosenInv.invoiceNumber)" [disabled]="!(chosenInv && chosenInv.invoiceStatus === 1)">
|
||||||
Submit
|
Submit
|
||||||
|
@ -165,194 +172,194 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--Detials-->
|
<!--Detials-->
|
||||||
<div class="modal-body" *ngIf="chosenInv">
|
<!--<div class="modal-body" *ngIf="chosenInv">-->
|
||||||
<p class="h4 text-right">Detail</p>
|
<!--<p class="h4 text-right">Detail</p>-->
|
||||||
|
|
||||||
<table class="table">
|
<!--<table class="table">-->
|
||||||
<thead>
|
<!--<thead>-->
|
||||||
<tr>
|
|
||||||
<th scope="col" style="width: 50px">#</th>
|
|
||||||
<th scope="col">Description</th>
|
|
||||||
<th scope="col" style="width: 150px">Rate Type</th>
|
|
||||||
<th scope="col" style="width: 100px">Rate</th>
|
|
||||||
<th scope="col" style="width: 100px">Quantity</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<!--<tbody>-->
|
|
||||||
<tbody *ngFor="let inDet of selectedInDetails; let i = index">
|
|
||||||
<tr class="p-0 m-0">
|
|
||||||
<!--INV Detail Items: invoiceNum, lineItemNum, poLineItemNum, serviceTypeId, desc, qty, fee-->
|
|
||||||
<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="inDet.lineItemNum" disabled>
|
|
||||||
</td>
|
|
||||||
<td class="p-0 m-0"><textarea style="height: 36px" class="form-control text cell" [value]="inDet.desc"
|
|
||||||
(change)="onSelectedCellChange(i, 'desc', desc.value)" #desc [disabled]="chosenInv.invoiceStatus !== 1"></textarea>
|
|
||||||
<!--<input type="text" class="form-control cell" [value]="inDet.desc"-->
|
|
||||||
<!--(change)="onSelectedCellChange(i, 'desc', desc.value)" #desc>-->
|
|
||||||
</td>
|
|
||||||
<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="feeTypes[inDet.feeTypeId - 1]"
|
|
||||||
disabled></td>
|
|
||||||
<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="inDet.fee | currency" #fee [disabled]="chosenInv.invoiceStatus !== 1"
|
|
||||||
(change)="onSelectedCellChange(i, 'fee', fee.value.substr(1)); updateSelectedBillAmt()">
|
|
||||||
</td>
|
|
||||||
<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="inDet.qty"
|
|
||||||
[step]="inDet.remainingQty / 100"
|
|
||||||
(change)="onSelectedCellChange(i, 'qty', qty.value); updateSelectedBillAmt()" #qty [disabled]="chosenInv.invoiceStatus !== 1">
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="p-0 m-0" *ngIf="inDet.poLineItemNum != -1">
|
|
||||||
<th class="align-content-center">
|
|
||||||
<p>{{getPerc(qty.value, inDet.remainingQty)}}%</p>
|
|
||||||
</th>
|
|
||||||
<td colspan="4">
|
|
||||||
<div class="progress" style="height: 25px;">
|
|
||||||
<div class="progress-bar bg-success" role="progressbar"
|
|
||||||
[ngStyle]="{'width': getPerc(qty.value, inDet.remainingQty) + '%'}">
|
|
||||||
{{qty.value}}
|
|
||||||
</div>
|
|
||||||
<div class="progress-bar bg-danger" role="progressbar"
|
|
||||||
[ngStyle]="{'width': (100 - getPerc(qty.value, inDet.remainingQty)) + '%'}">
|
|
||||||
{{inDet.remainingQty - (qty.value)}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<!--<tr class="p-0 m-0">-->
|
|
||||||
<!--<!–INV Detail Items: invoiceNum, lineItemNum, poLineItemNum, serviceTypeId, desc, qty, fee–>-->
|
|
||||||
<!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="inDet.lineItemNum" disabled>-->
|
|
||||||
<!--</td>-->
|
|
||||||
<!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="inDet.desc"-->
|
|
||||||
<!--(change)="onNewCellChange(i, 'desc', desc.value)" #desc></td>-->
|
|
||||||
<!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="feeTypes[inDet.feeTypeId - 1]"-->
|
|
||||||
<!--disabled></td>-->
|
|
||||||
<!--<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="inDet.fee"-->
|
|
||||||
<!--(change)="onNewCellChange(i, 'fee', fee.value); updateNewBillAmt();" #fee>-->
|
|
||||||
<!--</td>-->
|
|
||||||
<!--<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="inDet.qty"-->
|
|
||||||
<!--(change)="onNewCellChange(i, 'qty', qty.value); updateNewBillAmt();" #qty>-->
|
|
||||||
<!--</td>-->
|
|
||||||
<!--</tr>-->
|
|
||||||
<!--<tr class="p-0 m-0">-->
|
|
||||||
<!--<th class="align-content-center">-->
|
|
||||||
<!--<p>{{getPerc(fee.value * qty.value, inDet.remainingQty)}}%</p>-->
|
|
||||||
<!--</th>-->
|
|
||||||
<!--<td colspan="4">-->
|
|
||||||
<!--<div class="progress" style="height: 25px;">-->
|
|
||||||
<!--<div class="progress-bar bg-success" role="progressbar"-->
|
|
||||||
<!--[ngStyle]="{'width': getPerc(fee.value * qty.value, inDet.remainingQty) + '%'}">-->
|
|
||||||
<!--${{fee.value * qty.value}}-->
|
|
||||||
<!--</div>-->
|
|
||||||
<!--<div class="progress-bar bg-danger" role="progressbar"-->
|
|
||||||
<!--[ngStyle]="{'width': (100 - getPerc(fee.value * qty.value, inDet.remainingQty)) + '%'}">-->
|
|
||||||
<!--${{inDet.remainingQty - (fee.value * qty.value)}}-->
|
|
||||||
<!--</div>-->
|
|
||||||
<!--</div>-->
|
|
||||||
<!--</td>-->
|
|
||||||
<!--</tr>-->
|
|
||||||
<!--<tr class="p-0 m-0" *ngIf="inDet.poLineItemNum !== -1">-->
|
|
||||||
<!--<th class="align-content-center">-->
|
|
||||||
<!--<p>{{getPerc(qty.value, inDet.remainingQty)}}%</p>-->
|
|
||||||
<!--</th>-->
|
|
||||||
<!--<td colspan="5">-->
|
|
||||||
<!--<div class="progress" style="height: 25px;">-->
|
|
||||||
<!--<div class="progress-bar bg-success" role="progressbar"-->
|
|
||||||
<!--[ngStyle]="{'width': getPerc(qty.value, inDet.remainingQty) + '%'}">-->
|
|
||||||
<!--Qty - {{(qty.value)}} / Amount - {{(qty.value * inDet.fee) | currency}}-->
|
|
||||||
<!--</div>-->
|
|
||||||
<!--<div class="progress-bar bg-danger" role="progressbar"-->
|
|
||||||
<!--[ngStyle]="{'width': (100 - getPerc(qty.value, inDet.remainingQty)) + '%'}">-->
|
|
||||||
<!--Qty - {{(inDet.remainingQty - qty.value)}} / Amount - {{(inDet.remainingQty - qty.value) * inDet.fee | currency}}-->
|
|
||||||
<!--</div>-->
|
|
||||||
<!--</div>-->
|
|
||||||
<!--</td>-->
|
|
||||||
<!--</tr>-->
|
|
||||||
</tbody>
|
|
||||||
<tbody>
|
|
||||||
<!--<tr >-->
|
|
||||||
<!--<td colspan="5" >-->
|
|
||||||
<!--<p *ngIf="chosenInv.invoiceStatus == 1">-->
|
|
||||||
<!--<select class="custom-select"-->
|
|
||||||
<!--(change)="pushOntoSelectedDetail(inNumIn.value, newInDetails.length + 1, selectedPODetails[poDetSelec.value].lineItemNo,-->
|
|
||||||
<!--selectedPODetails[poDetSelec.value].feeTypeId,-->
|
|
||||||
<!--selectedPODetails[poDetSelec.value].serviceDesc, 0, selectedPODetails[poDetSelec.value].fee)"-->
|
|
||||||
<!--[disabled]="!selectedPODetails.length && chosenInv.invoiceStatus !== 1"-->
|
|
||||||
<!--#poDetSelec>-->
|
|
||||||
<!--<option>Add new line item...</option>-->
|
|
||||||
<!--<option *ngFor="let po of selectedPODetails; let i = index;" [value]="i">{{po.serviceDesc}}-->
|
|
||||||
<!--</option>-->
|
|
||||||
<!--<option [value]="-1">Out of Pocket Expenses</option>-->
|
|
||||||
<!--</select>-->
|
|
||||||
<!--</p>-->
|
|
||||||
<!--</td>-->
|
|
||||||
<!--</tr>-->
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<table class="table table-borderless table-sm">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td style="width: 40%" class="text-right"><b>Original Contract Amount</b></td>
|
|
||||||
<td style="width: 10%" class="text-right">
|
|
||||||
<div *ngIf="selectedPO">{{selectedPO.contractAmt | currency}}</div>
|
|
||||||
</td>
|
|
||||||
<td style="width: 30%" class="text-right"> </td>
|
|
||||||
<td style="width: 20%" class="text-right"> </td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="text-right"><b>Net Changes by Change Orders</b></td>
|
|
||||||
<td class="text-right">
|
|
||||||
<div *ngIf="selectedPO">{{0 | currency}}</div>
|
|
||||||
</td>
|
|
||||||
<td class="text-right"> </td>
|
|
||||||
<td class="text-right"> </td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="text-right"><b>Total Contract Amount</b></td>
|
|
||||||
<td class="text-right"><div *ngIf="selectedPO">{{selectedPO.contractAmt | currency}}</div></td>
|
|
||||||
<td class="text-right"> </td>
|
|
||||||
<td class="text-right"> </td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="text-right"><b>Previously Billed</b></td>
|
|
||||||
<td class="text-right"><div *ngIf="selectedPO">{{selectedPO.previouslyBilledAmount | currency}}</div></td>
|
|
||||||
<td class="text-right"> </td>
|
|
||||||
<td class="text-right"> </td>
|
|
||||||
</tr>
|
|
||||||
<!--<tr>-->
|
<!--<tr>-->
|
||||||
<!--<td class="text-right"><b>Amount This Invoice</b></td>-->
|
<!--<th scope="col" style="width: 50px">#</th>-->
|
||||||
<!--<td>{{newBillAmt}}</td>-->
|
<!--<th scope="col">Description</th>-->
|
||||||
<!--<td class="text-right"> </td>-->
|
<!--<th scope="col" style="width: 150px">Rate Type</th>-->
|
||||||
<!--<td> </td>-->
|
<!--<th scope="col" style="width: 100px">Rate</th>-->
|
||||||
|
<!--<th scope="col" style="width: 100px">Quantity</th>-->
|
||||||
<!--</tr>-->
|
<!--</tr>-->
|
||||||
<tr>
|
<!--</thead>-->
|
||||||
<td class="text-right"><b>Balance to be Billed</b></td>
|
<!--<!–<tbody>–>-->
|
||||||
<td class="text-right"><div *ngIf="selectedPO">{{(selectedPO.contractAmt - selectedPO.previouslyBilledAmount - selectedBillAmt) | currency}}</div></td>
|
<!--<tbody *ngFor="let inDet of selectedInDetails; let i = index">-->
|
||||||
<!--<td>-->
|
<!--<tr class="p-0 m-0">-->
|
||||||
<!--<div class="input-group mb-3">-->
|
<!--<!–INV Detail Items: invoiceNum, lineItemNum, poLineItemNum, serviceTypeId, desc, qty, fee–>-->
|
||||||
<!--<div class="input-group-prepend">-->
|
<!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="inDet.lineItemNum" disabled>-->
|
||||||
<!--<span class="input-group-text"><b>Total</b></span>-->
|
|
||||||
<!--<span class="input-group-text">$</span>-->
|
|
||||||
<!--</div>-->
|
|
||||||
<!--<input type="number" class="form-control" [value]="newBillAmt" #billAmtIn disabled>-->
|
|
||||||
<!--<div class="input-group-append">-->
|
|
||||||
<!--<span class="input-group-text">.00</span>-->
|
|
||||||
<!--</div>-->
|
|
||||||
<!--</div>-->
|
|
||||||
<!--</td>-->
|
<!--</td>-->
|
||||||
<td class="text-right"><b>Total due this invoice</b></td>
|
<!--<td class="p-0 m-0"><textarea style="height: 36px" class="form-control text cell" [value]="inDet.desc"-->
|
||||||
<td>{{selectedBillAmt | currency}}</td>
|
<!--(change)="onSelectedCellChange(i, 'desc', desc.value)" #desc [disabled]="chosenInv.invoiceStatus !== 1"></textarea>-->
|
||||||
</tr>
|
<!--<!–<input type="text" class="form-control cell" [value]="inDet.desc"–>-->
|
||||||
</tbody>
|
<!--<!–(change)="onSelectedCellChange(i, 'desc', desc.value)" #desc>–>-->
|
||||||
</table>
|
<!--</td>-->
|
||||||
<!--<div class="input-group mb-3">-->
|
<!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="feeTypes[inDet.feeTypeId - 1]"-->
|
||||||
<!--<div class="input-group-prepend">-->
|
<!--disabled></td>-->
|
||||||
<!--<span class="input-group-text">Bill Amount*</span>-->
|
<!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="inDet.fee | currency" #fee [disabled]="chosenInv.invoiceStatus !== 1"-->
|
||||||
<!--<span class="input-group-text">$</span>-->
|
<!--(change)="onSelectedCellChange(i, 'fee', fee.value.substr(1)); updateSelectedBillAmt()">-->
|
||||||
<!--</div>-->
|
<!--</td>-->
|
||||||
<!--<input type="number" class="form-control" [value]="selectedBillAmt" #billAmtIn>-->
|
<!--<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="inDet.qty"-->
|
||||||
<!--<div class="input-group-append">-->
|
<!--[step]="inDet.remainingQty / 100"-->
|
||||||
<!--<span class="input-group-text">.00</span>-->
|
<!--(change)="onSelectedCellChange(i, 'qty', qty.value); updateSelectedBillAmt()" #qty [disabled]="chosenInv.invoiceStatus !== 1">-->
|
||||||
<!--</div>-->
|
<!--</td>-->
|
||||||
<!--</div>-->
|
<!--</tr>-->
|
||||||
</div>
|
<!--<tr class="p-0 m-0" *ngIf="inDet.poLineItemNum != -1">-->
|
||||||
|
<!--<th class="align-content-center">-->
|
||||||
|
<!--<p>{{getPerc(qty.value, inDet.remainingQty)}}%</p>-->
|
||||||
|
<!--</th>-->
|
||||||
|
<!--<td colspan="4">-->
|
||||||
|
<!--<div class="progress" style="height: 25px;">-->
|
||||||
|
<!--<div class="progress-bar bg-success" role="progressbar"-->
|
||||||
|
<!--[ngStyle]="{'width': getPerc(qty.value, inDet.remainingQty) + '%'}">-->
|
||||||
|
<!--{{qty.value}}-->
|
||||||
|
<!--</div>-->
|
||||||
|
<!--<div class="progress-bar bg-danger" role="progressbar"-->
|
||||||
|
<!--[ngStyle]="{'width': (100 - getPerc(qty.value, inDet.remainingQty)) + '%'}">-->
|
||||||
|
<!--{{inDet.remainingQty - (qty.value)}}-->
|
||||||
|
<!--</div>-->
|
||||||
|
<!--</div>-->
|
||||||
|
<!--</td>-->
|
||||||
|
<!--</tr>-->
|
||||||
|
<!--<!–<tr class="p-0 m-0">–>-->
|
||||||
|
<!--<!–<!–INV Detail Items: invoiceNum, lineItemNum, poLineItemNum, serviceTypeId, desc, qty, fee–>–>-->
|
||||||
|
<!--<!–<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="inDet.lineItemNum" disabled>–>-->
|
||||||
|
<!--<!–</td>–>-->
|
||||||
|
<!--<!–<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="inDet.desc"–>-->
|
||||||
|
<!--<!–(change)="onNewCellChange(i, 'desc', desc.value)" #desc></td>–>-->
|
||||||
|
<!--<!–<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="feeTypes[inDet.feeTypeId - 1]"–>-->
|
||||||
|
<!--<!–disabled></td>–>-->
|
||||||
|
<!--<!–<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="inDet.fee"–>-->
|
||||||
|
<!--<!–(change)="onNewCellChange(i, 'fee', fee.value); updateNewBillAmt();" #fee>–>-->
|
||||||
|
<!--<!–</td>–>-->
|
||||||
|
<!--<!–<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="inDet.qty"–>-->
|
||||||
|
<!--<!–(change)="onNewCellChange(i, 'qty', qty.value); updateNewBillAmt();" #qty>–>-->
|
||||||
|
<!--<!–</td>–>-->
|
||||||
|
<!--<!–</tr>–>-->
|
||||||
|
<!--<!–<tr class="p-0 m-0">–>-->
|
||||||
|
<!--<!–<th class="align-content-center">–>-->
|
||||||
|
<!--<!–<p>{{getPerc(fee.value * qty.value, inDet.remainingQty)}}%</p>–>-->
|
||||||
|
<!--<!–</th>–>-->
|
||||||
|
<!--<!–<td colspan="4">–>-->
|
||||||
|
<!--<!–<div class="progress" style="height: 25px;">–>-->
|
||||||
|
<!--<!–<div class="progress-bar bg-success" role="progressbar"–>-->
|
||||||
|
<!--<!–[ngStyle]="{'width': getPerc(fee.value * qty.value, inDet.remainingQty) + '%'}">–>-->
|
||||||
|
<!--<!–${{fee.value * qty.value}}–>-->
|
||||||
|
<!--<!–</div>–>-->
|
||||||
|
<!--<!–<div class="progress-bar bg-danger" role="progressbar"–>-->
|
||||||
|
<!--<!–[ngStyle]="{'width': (100 - getPerc(fee.value * qty.value, inDet.remainingQty)) + '%'}">–>-->
|
||||||
|
<!--<!–${{inDet.remainingQty - (fee.value * qty.value)}}–>-->
|
||||||
|
<!--<!–</div>–>-->
|
||||||
|
<!--<!–</div>–>-->
|
||||||
|
<!--<!–</td>–>-->
|
||||||
|
<!--<!–</tr>–>-->
|
||||||
|
<!--<!–<tr class="p-0 m-0" *ngIf="inDet.poLineItemNum !== -1">–>-->
|
||||||
|
<!--<!–<th class="align-content-center">–>-->
|
||||||
|
<!--<!–<p>{{getPerc(qty.value, inDet.remainingQty)}}%</p>–>-->
|
||||||
|
<!--<!–</th>–>-->
|
||||||
|
<!--<!–<td colspan="5">–>-->
|
||||||
|
<!--<!–<div class="progress" style="height: 25px;">–>-->
|
||||||
|
<!--<!–<div class="progress-bar bg-success" role="progressbar"–>-->
|
||||||
|
<!--<!–[ngStyle]="{'width': getPerc(qty.value, inDet.remainingQty) + '%'}">–>-->
|
||||||
|
<!--<!–Qty - {{(qty.value)}} / Amount - {{(qty.value * inDet.fee) | currency}}–>-->
|
||||||
|
<!--<!–</div>–>-->
|
||||||
|
<!--<!–<div class="progress-bar bg-danger" role="progressbar"–>-->
|
||||||
|
<!--<!–[ngStyle]="{'width': (100 - getPerc(qty.value, inDet.remainingQty)) + '%'}">–>-->
|
||||||
|
<!--<!–Qty - {{(inDet.remainingQty - qty.value)}} / Amount - {{(inDet.remainingQty - qty.value) * inDet.fee | currency}}–>-->
|
||||||
|
<!--<!–</div>–>-->
|
||||||
|
<!--<!–</div>–>-->
|
||||||
|
<!--<!–</td>–>-->
|
||||||
|
<!--<!–</tr>–>-->
|
||||||
|
<!--</tbody>-->
|
||||||
|
<!--<tbody>-->
|
||||||
|
<!--<!–<tr >–>-->
|
||||||
|
<!--<!–<td colspan="5" >–>-->
|
||||||
|
<!--<!–<p *ngIf="chosenInv.invoiceStatus == 1">–>-->
|
||||||
|
<!--<!–<select class="custom-select"–>-->
|
||||||
|
<!--<!–(change)="pushOntoSelectedDetail(inNumIn.value, newInDetails.length + 1, selectedPODetails[poDetSelec.value].lineItemNo,–>-->
|
||||||
|
<!--<!–selectedPODetails[poDetSelec.value].feeTypeId,–>-->
|
||||||
|
<!--<!–selectedPODetails[poDetSelec.value].serviceDesc, 0, selectedPODetails[poDetSelec.value].fee)"–>-->
|
||||||
|
<!--<!–[disabled]="!selectedPODetails.length && chosenInv.invoiceStatus !== 1"–>-->
|
||||||
|
<!--<!–#poDetSelec>–>-->
|
||||||
|
<!--<!–<option>Add new line item...</option>–>-->
|
||||||
|
<!--<!–<option *ngFor="let po of selectedPODetails; let i = index;" [value]="i">{{po.serviceDesc}}–>-->
|
||||||
|
<!--<!–</option>–>-->
|
||||||
|
<!--<!–<option [value]="-1">Out of Pocket Expenses</option>–>-->
|
||||||
|
<!--<!–</select>–>-->
|
||||||
|
<!--<!–</p>–>-->
|
||||||
|
<!--<!–</td>–>-->
|
||||||
|
<!--<!–</tr>–>-->
|
||||||
|
<!--</tbody>-->
|
||||||
|
<!--</table>-->
|
||||||
|
<!--<table class="table table-borderless table-sm">-->
|
||||||
|
<!--<tbody>-->
|
||||||
|
<!--<tr>-->
|
||||||
|
<!--<td style="width: 40%" class="text-right"><b>Original Contract Amount</b></td>-->
|
||||||
|
<!--<td style="width: 10%" class="text-right">-->
|
||||||
|
<!--<div *ngIf="selectedPO">{{selectedPO.contractAmt | currency}}</div>-->
|
||||||
|
<!--</td>-->
|
||||||
|
<!--<td style="width: 30%" class="text-right"> </td>-->
|
||||||
|
<!--<td style="width: 20%" class="text-right"> </td>-->
|
||||||
|
<!--</tr>-->
|
||||||
|
<!--<tr>-->
|
||||||
|
<!--<td class="text-right"><b>Net Changes by Change Orders</b></td>-->
|
||||||
|
<!--<td class="text-right">-->
|
||||||
|
<!--<div *ngIf="selectedPO">{{0 | currency}}</div>-->
|
||||||
|
<!--</td>-->
|
||||||
|
<!--<td class="text-right"> </td>-->
|
||||||
|
<!--<td class="text-right"> </td>-->
|
||||||
|
<!--</tr>-->
|
||||||
|
<!--<tr>-->
|
||||||
|
<!--<td class="text-right"><b>Total Contract Amount</b></td>-->
|
||||||
|
<!--<td class="text-right"><div *ngIf="selectedPO">{{selectedPO.contractAmt | currency}}</div></td>-->
|
||||||
|
<!--<td class="text-right"> </td>-->
|
||||||
|
<!--<td class="text-right"> </td>-->
|
||||||
|
<!--</tr>-->
|
||||||
|
<!--<tr>-->
|
||||||
|
<!--<td class="text-right"><b>Previously Billed</b></td>-->
|
||||||
|
<!--<td class="text-right"><div *ngIf="selectedPO">{{selectedPO.previouslyBilledAmount | currency}}</div></td>-->
|
||||||
|
<!--<td class="text-right"> </td>-->
|
||||||
|
<!--<td class="text-right"> </td>-->
|
||||||
|
<!--</tr>-->
|
||||||
|
<!--<!–<tr>–>-->
|
||||||
|
<!--<!–<td class="text-right"><b>Amount This Invoice</b></td>–>-->
|
||||||
|
<!--<!–<td>{{newBillAmt}}</td>–>-->
|
||||||
|
<!--<!–<td class="text-right"> </td>–>-->
|
||||||
|
<!--<!–<td> </td>–>-->
|
||||||
|
<!--<!–</tr>–>-->
|
||||||
|
<!--<tr>-->
|
||||||
|
<!--<td class="text-right"><b>Balance to be Billed</b></td>-->
|
||||||
|
<!--<td class="text-right"><div *ngIf="selectedPO">{{(selectedPO.contractAmt - selectedPO.previouslyBilledAmount - selectedBillAmt) | currency}}</div></td>-->
|
||||||
|
<!--<!–<td>–>-->
|
||||||
|
<!--<!–<div class="input-group mb-3">–>-->
|
||||||
|
<!--<!–<div class="input-group-prepend">–>-->
|
||||||
|
<!--<!–<span class="input-group-text"><b>Total</b></span>–>-->
|
||||||
|
<!--<!–<span class="input-group-text">$</span>–>-->
|
||||||
|
<!--<!–</div>–>-->
|
||||||
|
<!--<!–<input type="number" class="form-control" [value]="newBillAmt" #billAmtIn disabled>–>-->
|
||||||
|
<!--<!–<div class="input-group-append">–>-->
|
||||||
|
<!--<!–<span class="input-group-text">.00</span>–>-->
|
||||||
|
<!--<!–</div>–>-->
|
||||||
|
<!--<!–</div>–>-->
|
||||||
|
<!--<!–</td>–>-->
|
||||||
|
<!--<td class="text-right"><b>Total due this invoice</b></td>-->
|
||||||
|
<!--<td>{{selectedBillAmt | currency}}</td>-->
|
||||||
|
<!--</tr>-->
|
||||||
|
<!--</tbody>-->
|
||||||
|
<!--</table>-->
|
||||||
|
<!--<!–<div class="input-group mb-3">–>-->
|
||||||
|
<!--<!–<div class="input-group-prepend">–>-->
|
||||||
|
<!--<!–<span class="input-group-text">Bill Amount*</span>–>-->
|
||||||
|
<!--<!–<span class="input-group-text">$</span>–>-->
|
||||||
|
<!--<!–</div>–>-->
|
||||||
|
<!--<!–<input type="number" class="form-control" [value]="selectedBillAmt" #billAmtIn>–>-->
|
||||||
|
<!--<!–<div class="input-group-append">–>-->
|
||||||
|
<!--<!–<span class="input-group-text">.00</span>–>-->
|
||||||
|
<!--<!–</div>–>-->
|
||||||
|
<!--<!–</div>–>-->
|
||||||
|
<!--</div>-->
|
||||||
|
|
||||||
<!--Invoice Footer-->
|
<!--Invoice Footer-->
|
||||||
<div class="modal-body" *ngIf="chosenInv">
|
<div class="modal-body" *ngIf="chosenInv">
|
||||||
|
@ -403,7 +410,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 1%">
|
<td style="width: 1%">
|
||||||
<span class="input-group-text">Customer </span>
|
<span class="input-group-text">Customer</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="custom-select" (change)="customerDropdownChange(customerSelec.value)" #customerSelec>
|
<select class="custom-select" (change)="customerDropdownChange(customerSelec.value)" #customerSelec>
|
||||||
|
@ -477,156 +484,156 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--Detail-->
|
<!--Detail-->
|
||||||
<div class="modal-body">
|
<!--<div class="modal-body">-->
|
||||||
<p class="h4 text-right">Detail</p>
|
<!--<p class="h4 text-right">Detail</p>-->
|
||||||
<table class="table">
|
<!--<table class="table">-->
|
||||||
<thead>
|
<!--<thead>-->
|
||||||
<tr>
|
|
||||||
<th scope="col" style="width: 30px"></th>
|
|
||||||
<th scope="col" style="width: 50px">#</th>
|
|
||||||
<th scope="col">Description</th>
|
|
||||||
<th scope="col" style="width: 150px">Rate Type</th>
|
|
||||||
<th scope="col" style="width: 100px">Rate</th>
|
|
||||||
<th scope="col" style="width: 100px">Quantity</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<!--<tbody>-->
|
|
||||||
<tbody *ngFor="let inDet of newInDetails; let i = index">
|
|
||||||
<tr class="p-0 m-0">
|
|
||||||
<!--INV Detail Items: invoiceNum, lineItemNum, poLineItemNum, serviceTypeId, desc, qty, fee-->
|
|
||||||
<td class="p-0 m-0">
|
|
||||||
<button class="btn btn-outline-danger w-100" (click)="newInDetails.splice(0, 1)">-</button>
|
|
||||||
</td>
|
|
||||||
<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="inDet.lineItemNum" disabled>
|
|
||||||
</td>
|
|
||||||
<td class="p-0 m-0"><textarea style="height: 36px" class="form-control cell" [value]="inDet.desc"
|
|
||||||
(change)="onNewCellChange(i, 'desc', desc.value)" #desc></textarea>
|
|
||||||
<!--<input type="text" class="form-control cell" [value]="inDet.desc"-->
|
|
||||||
<!--(change)="onNewCellChange(i, 'desc', desc.value)" #desc>-->
|
|
||||||
</td>
|
|
||||||
<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="feeTypes[inDet.feeTypeId - 1]"
|
|
||||||
disabled></td>
|
|
||||||
<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="inDet.fee | currency" #fee [disabled] = "poDetails[poDetSelec.value].lineItemNo!==-1"
|
|
||||||
(change)="onNewCellChange(i, 'fee', fee.value.substr(1)); updateNewBillAmt();">
|
|
||||||
</td>
|
|
||||||
<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="inDet.qty"
|
|
||||||
[step]="inDet.remainingQty / 100"
|
|
||||||
(change)="onNewCellChange(i, 'qty', qty.value); updateNewBillAmt();" #qty>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="p-0 m-0" *ngIf="inDet.poLineItemNum !== -1">
|
|
||||||
<th class="align-content-center">
|
|
||||||
<p>{{getPerc(qty.value, inDet.remainingQty)}}%</p>
|
|
||||||
</th>
|
|
||||||
<td colspan="5">
|
|
||||||
<div class="progress" style="height: 25px;">
|
|
||||||
<div class="progress-bar bg-success" role="progressbar"
|
|
||||||
[ngStyle]="{'width': getPerc(qty.value, inDet.remainingQty) + '%'}">
|
|
||||||
Qty - {{(qty.value)}} / Amount - {{(qty.value * inDet.fee) | currency}}
|
|
||||||
</div>
|
|
||||||
<div class="progress-bar bg-danger" role="progressbar"
|
|
||||||
[ngStyle]="{'width': (100 - getPerc(qty.value, inDet.remainingQty)) + '%'}">
|
|
||||||
Qty - {{(inDet.remainingQty - qty.value)}} / Amount - {{(inDet.remainingQty - qty.value) * inDet.fee | currency}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="p-0 m-0" *ngIf="inDet.poLineItemNum == -1">
|
|
||||||
<th class="align-content-center">
|
|
||||||
<p>{{getPerc(qty.value, inDet.remainingQty)}}%</p>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td colspan="6">
|
|
||||||
<select class="custom-select"
|
|
||||||
(change)="pushOntoNewDetail(inNumIn.value, newInDetails.length + 1, poDetails[poDetSelec.value].lineItemNo,
|
|
||||||
poDetails[poDetSelec.value].feeTypeId, poDetails[poDetSelec.value].serviceTypeId,
|
|
||||||
poDetails[poDetSelec.value].serviceDesc, 0, poDetails[poDetSelec.value].fee, poDetails[poDetSelec.value].remainingQty,
|
|
||||||
poNumIn.value)"
|
|
||||||
[disabled]="!poDetails.length"
|
|
||||||
#poDetSelec>
|
|
||||||
<option>Add line item...</option>
|
|
||||||
<option *ngFor="let po of poDetails; let i = index;" [value]="i">{{po.serviceDesc}}</option>
|
|
||||||
<option [value]="-1">Out of Pocket Expenses</option>
|
|
||||||
</select>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<!--<tr>-->
|
<!--<tr>-->
|
||||||
<!--<td colspan="6">-->
|
<!--<th scope="col" style="width: 30px"></th>-->
|
||||||
<!--<select class="custom-select"-->
|
<!--<th scope="col" style="width: 50px">#</th>-->
|
||||||
<!--(change)="pushOntoNewDetail(inNumIn.value, newInDetails.length + 1, poDetails[poDetSelec.value].lineItemNo,-->
|
<!--<th scope="col">Description</th>-->
|
||||||
<!--poDetails[poDetSelec.value].feeTypeId, poDetails[poDetSelec.value].serviceTypeId,-->
|
<!--<th scope="col" style="width: 150px">Rate Type</th>-->
|
||||||
<!--poDetails[poDetSelec.value].serviceDesc, 0, poDetails[poDetSelec.value].fee, poDetails[poDetSelec.value].remainingQty,-->
|
<!--<th scope="col" style="width: 100px">Rate</th>-->
|
||||||
<!--poNumIn.value)"-->
|
<!--<th scope="col" style="width: 100px">Quantity</th>-->
|
||||||
<!--[disabled]="!poDetails.length"-->
|
|
||||||
<!--#poDetSelec>-->
|
|
||||||
<!--<option>Add line item...</option>-->
|
|
||||||
<!--<option *ngFor="let po of poDetails; let i = index;" [value]="i">{{po.serviceDesc}}</option>-->
|
|
||||||
<!--<option [value]="-1">Out of Pocket Expenses</option>-->
|
|
||||||
<!--</select>-->
|
|
||||||
<!--</td>-->
|
|
||||||
<!--</tr>-->
|
<!--</tr>-->
|
||||||
</tbody>
|
<!--</thead>-->
|
||||||
</table>
|
<!--<!–<tbody>–>-->
|
||||||
|
<!--<tbody *ngFor="let inDet of newInDetails; let i = index">-->
|
||||||
<table class="table table-borderless table-sm">
|
<!--<tr class="p-0 m-0">-->
|
||||||
<tbody>
|
<!--<!–INV Detail Items: invoiceNum, lineItemNum, poLineItemNum, serviceTypeId, desc, qty, fee–>-->
|
||||||
<tr>
|
<!--<td class="p-0 m-0">-->
|
||||||
<td class="text-right" style="width: 40%" class="text-right"><b>Original Contract Amount</b></td>
|
<!--<button class="btn btn-outline-danger w-100" (click)="newInDetails.splice(0, 1)">-</button>-->
|
||||||
<td class="text-right" style="width: 10%">
|
|
||||||
<div *ngIf="chosenPo">{{chosenPo.contractAmt | currency}}</div>
|
|
||||||
</td>
|
|
||||||
<td class="text-right" style="width: 30%" class="text-right"> </td>
|
|
||||||
<td class="text-right" style="width: 20%" > </td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="text-right"><b>Net Changes by Change Orders</b></td>
|
|
||||||
<td class="text-right"><div *ngIf="chosenPo">{{0 | currency}}</div></td>
|
|
||||||
<td class="text-right"> </td>
|
|
||||||
<td class="text-right"> </td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="text-right"><b>Total Contract Amount</b></td>
|
|
||||||
<td class="text-right"><div *ngIf="chosenPo">{{chosenPo.contractAmt | currency}}</div></td>
|
|
||||||
<td class="text-right"> </td>
|
|
||||||
<td class="text-right"> </td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="text-right"><b>Previously Billed</b></td>
|
|
||||||
<td class="text-right"><div *ngIf="chosenPo">{{chosenPo.previouslyBilledAmount | currency}}</div></td>
|
|
||||||
<td class="text-right"> </td>
|
|
||||||
<td class="text-right"> </td>
|
|
||||||
</tr>
|
|
||||||
<!--<tr>-->
|
|
||||||
<!--<td class="text-right"><b>Amount This Invoice</b></td>-->
|
|
||||||
<!--<td>{{newBillAmt}}</td>-->
|
|
||||||
<!--<td class="text-right"> </td>-->
|
|
||||||
<!--<td> </td>-->
|
|
||||||
<!--</tr>-->
|
|
||||||
<tr>
|
|
||||||
<td class="text-right"><b>Balance to be Billed</b></td>
|
|
||||||
<td class="text-right"><div *ngIf="chosenPo">{{(chosenPo.contractAmt - chosenPo.previouslyBilledAmount - newBillAmt) | currency}}</div></td>
|
|
||||||
<!--<td>-->
|
|
||||||
<!--<div class="input-group mb-3">-->
|
|
||||||
<!--<div class="input-group-prepend">-->
|
|
||||||
<!--<span class="input-group-text"><b>Total</b></span>-->
|
|
||||||
<!--<span class="input-group-text">$</span>-->
|
|
||||||
<!--</div>-->
|
|
||||||
<!--<input type="number" class="form-control" [value]="newBillAmt" #billAmtIn disabled>-->
|
|
||||||
<!--<div class="input-group-append">-->
|
|
||||||
<!--<span class="input-group-text">.00</span>-->
|
|
||||||
<!--</div>-->
|
|
||||||
<!--</div>-->
|
|
||||||
<!--</td>-->
|
<!--</td>-->
|
||||||
<td class="text-right"><b>Total due this invoice</b></td>
|
<!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="inDet.lineItemNum" disabled>-->
|
||||||
<td>{{newBillAmt | currency}}</td>
|
<!--</td>-->
|
||||||
</tr>
|
<!--<td class="p-0 m-0"><textarea style="height: 36px" class="form-control cell" [value]="inDet.desc"-->
|
||||||
</tbody>
|
<!--(change)="onNewCellChange(i, 'desc', desc.value)" #desc></textarea>-->
|
||||||
</table>
|
<!--<!–<input type="text" class="form-control cell" [value]="inDet.desc"–>-->
|
||||||
</div>
|
<!--<!–(change)="onNewCellChange(i, 'desc', desc.value)" #desc>–>-->
|
||||||
|
<!--</td>-->
|
||||||
|
<!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="feeTypes[inDet.feeTypeId - 1]"-->
|
||||||
|
<!--disabled></td>-->
|
||||||
|
<!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="inDet.fee | currency" #fee [disabled] = "poDetails[poDetSelec.value].lineItemNo!==-1"-->
|
||||||
|
<!--(change)="onNewCellChange(i, 'fee', fee.value.substr(1)); updateNewBillAmt();">-->
|
||||||
|
<!--</td>-->
|
||||||
|
<!--<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="inDet.qty"-->
|
||||||
|
<!--[step]="inDet.remainingQty / 100"-->
|
||||||
|
<!--(change)="onNewCellChange(i, 'qty', qty.value); updateNewBillAmt();" #qty>-->
|
||||||
|
<!--</td>-->
|
||||||
|
<!--</tr>-->
|
||||||
|
<!--<tr class="p-0 m-0" *ngIf="inDet.poLineItemNum !== -1">-->
|
||||||
|
<!--<th class="align-content-center">-->
|
||||||
|
<!--<p>{{getPerc(qty.value, inDet.remainingQty)}}%</p>-->
|
||||||
|
<!--</th>-->
|
||||||
|
<!--<td colspan="5">-->
|
||||||
|
<!--<div class="progress" style="height: 25px;">-->
|
||||||
|
<!--<div class="progress-bar bg-success" role="progressbar"-->
|
||||||
|
<!--[ngStyle]="{'width': getPerc(qty.value, inDet.remainingQty) + '%'}">-->
|
||||||
|
<!--Qty - {{(qty.value)}} / Amount - {{(qty.value * inDet.fee) | currency}}-->
|
||||||
|
<!--</div>-->
|
||||||
|
<!--<div class="progress-bar bg-danger" role="progressbar"-->
|
||||||
|
<!--[ngStyle]="{'width': (100 - getPerc(qty.value, inDet.remainingQty)) + '%'}">-->
|
||||||
|
<!--Qty - {{(inDet.remainingQty - qty.value)}} / Amount - {{(inDet.remainingQty - qty.value) * inDet.fee | currency}}-->
|
||||||
|
<!--</div>-->
|
||||||
|
<!--</div>-->
|
||||||
|
<!--</td>-->
|
||||||
|
<!--</tr>-->
|
||||||
|
<!--<tr class="p-0 m-0" *ngIf="inDet.poLineItemNum == -1">-->
|
||||||
|
<!--<th class="align-content-center">-->
|
||||||
|
<!--<p>{{getPerc(qty.value, inDet.remainingQty)}}%</p>-->
|
||||||
|
<!--</th>-->
|
||||||
|
<!--</tr>-->
|
||||||
|
<!--</tbody>-->
|
||||||
|
<!--<tbody>-->
|
||||||
|
<!--<tr>-->
|
||||||
|
<!--<td colspan="6">-->
|
||||||
|
<!--<select class="custom-select"-->
|
||||||
|
<!--(change)="pushOntoNewDetail(inNumIn.value, newInDetails.length + 1, poDetails[poDetSelec.value].lineItemNo,-->
|
||||||
|
<!--poDetails[poDetSelec.value].feeTypeId, poDetails[poDetSelec.value].serviceTypeId,-->
|
||||||
|
<!--poDetails[poDetSelec.value].serviceDesc, 0, poDetails[poDetSelec.value].fee, poDetails[poDetSelec.value].remainingQty,-->
|
||||||
|
<!--poNumIn.value)"-->
|
||||||
|
<!--[disabled]="!poDetails.length"-->
|
||||||
|
<!--#poDetSelec>-->
|
||||||
|
<!--<option>Add line item...</option>-->
|
||||||
|
<!--<option *ngFor="let po of poDetails; let i = index;" [value]="i">{{po.serviceDesc}}</option>-->
|
||||||
|
<!--<option [value]="-1">Out of Pocket Expenses</option>-->
|
||||||
|
<!--</select>-->
|
||||||
|
<!--</td>-->
|
||||||
|
<!--</tr>-->
|
||||||
|
|
||||||
|
<!--<!–<tr>–>-->
|
||||||
|
<!--<!–<td colspan="6">–>-->
|
||||||
|
<!--<!–<select class="custom-select"–>-->
|
||||||
|
<!--<!–(change)="pushOntoNewDetail(inNumIn.value, newInDetails.length + 1, poDetails[poDetSelec.value].lineItemNo,–>-->
|
||||||
|
<!--<!–poDetails[poDetSelec.value].feeTypeId, poDetails[poDetSelec.value].serviceTypeId,–>-->
|
||||||
|
<!--<!–poDetails[poDetSelec.value].serviceDesc, 0, poDetails[poDetSelec.value].fee, poDetails[poDetSelec.value].remainingQty,–>-->
|
||||||
|
<!--<!–poNumIn.value)"–>-->
|
||||||
|
<!--<!–[disabled]="!poDetails.length"–>-->
|
||||||
|
<!--<!–#poDetSelec>–>-->
|
||||||
|
<!--<!–<option>Add line item...</option>–>-->
|
||||||
|
<!--<!–<option *ngFor="let po of poDetails; let i = index;" [value]="i">{{po.serviceDesc}}</option>–>-->
|
||||||
|
<!--<!–<option [value]="-1">Out of Pocket Expenses</option>–>-->
|
||||||
|
<!--<!–</select>–>-->
|
||||||
|
<!--<!–</td>–>-->
|
||||||
|
<!--<!–</tr>–>-->
|
||||||
|
<!--</tbody>-->
|
||||||
|
<!--</table>-->
|
||||||
|
|
||||||
|
<!--<table class="table table-borderless table-sm">-->
|
||||||
|
<!--<tbody>-->
|
||||||
|
<!--<tr>-->
|
||||||
|
<!--<td class="text-right" style="width: 40%" class="text-right"><b>Original Contract Amount</b></td>-->
|
||||||
|
<!--<td class="text-right" style="width: 10%">-->
|
||||||
|
<!--<div *ngIf="chosenPo">{{chosenPo.contractAmt | currency}}</div>-->
|
||||||
|
<!--</td>-->
|
||||||
|
<!--<td class="text-right" style="width: 30%" class="text-right"> </td>-->
|
||||||
|
<!--<td class="text-right" style="width: 20%" > </td>-->
|
||||||
|
<!--</tr>-->
|
||||||
|
<!--<tr>-->
|
||||||
|
<!--<td class="text-right"><b>Net Changes by Change Orders</b></td>-->
|
||||||
|
<!--<td class="text-right"><div *ngIf="chosenPo">{{0 | currency}}</div></td>-->
|
||||||
|
<!--<td class="text-right"> </td>-->
|
||||||
|
<!--<td class="text-right"> </td>-->
|
||||||
|
<!--</tr>-->
|
||||||
|
<!--<tr>-->
|
||||||
|
<!--<td class="text-right"><b>Total Contract Amount</b></td>-->
|
||||||
|
<!--<td class="text-right"><div *ngIf="chosenPo">{{chosenPo.contractAmt | currency}}</div></td>-->
|
||||||
|
<!--<td class="text-right"> </td>-->
|
||||||
|
<!--<td class="text-right"> </td>-->
|
||||||
|
<!--</tr>-->
|
||||||
|
<!--<tr>-->
|
||||||
|
<!--<td class="text-right"><b>Previously Billed</b></td>-->
|
||||||
|
<!--<td class="text-right"><div *ngIf="chosenPo">{{chosenPo.previouslyBilledAmount | currency}}</div></td>-->
|
||||||
|
<!--<td class="text-right"> </td>-->
|
||||||
|
<!--<td class="text-right"> </td>-->
|
||||||
|
<!--</tr>-->
|
||||||
|
<!--<!–<tr>–>-->
|
||||||
|
<!--<!–<td class="text-right"><b>Amount This Invoice</b></td>–>-->
|
||||||
|
<!--<!–<td>{{newBillAmt}}</td>–>-->
|
||||||
|
<!--<!–<td class="text-right"> </td>–>-->
|
||||||
|
<!--<!–<td> </td>–>-->
|
||||||
|
<!--<!–</tr>–>-->
|
||||||
|
<!--<tr>-->
|
||||||
|
<!--<td class="text-right"><b>Balance to be Billed</b></td>-->
|
||||||
|
<!--<td class="text-right"><div *ngIf="chosenPo">{{(chosenPo.contractAmt - chosenPo.previouslyBilledAmount - newBillAmt) | currency}}</div></td>-->
|
||||||
|
<!--<!–<td>–>-->
|
||||||
|
<!--<!–<div class="input-group mb-3">–>-->
|
||||||
|
<!--<!–<div class="input-group-prepend">–>-->
|
||||||
|
<!--<!–<span class="input-group-text"><b>Total</b></span>–>-->
|
||||||
|
<!--<!–<span class="input-group-text">$</span>–>-->
|
||||||
|
<!--<!–</div>–>-->
|
||||||
|
<!--<!–<input type="number" class="form-control" [value]="newBillAmt" #billAmtIn disabled>–>-->
|
||||||
|
<!--<!–<div class="input-group-append">–>-->
|
||||||
|
<!--<!–<span class="input-group-text">.00</span>–>-->
|
||||||
|
<!--<!–</div>–>-->
|
||||||
|
<!--<!–</div>–>-->
|
||||||
|
<!--<!–</td>–>-->
|
||||||
|
<!--<td class="text-right"><b>Total due this invoice</b></td>-->
|
||||||
|
<!--<td>{{newBillAmt | currency}}</td>-->
|
||||||
|
<!--</tr>-->
|
||||||
|
<!--</tbody>-->
|
||||||
|
<!--</table>-->
|
||||||
|
<!--</div>-->
|
||||||
|
|
||||||
<!--Invoice Footer-->
|
<!--Invoice Footer-->
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
@ -653,10 +660,57 @@
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-success"
|
<button type="button" class="btn btn-success"
|
||||||
(click)="addInvoice(inNumIn.value, poNumIn.value, coNumIn.value, pmtStatusIn.value, newBillAmt, notesIn.value, certIn.value, 1, new)"
|
(click)="addInvoice(inNumIn.value, poNumIn.value, coNumIn.value, pmtStatusIn.value, newBillAmt, notesIn.value, certIn.value, 1, new)"
|
||||||
[disabled]="!(inNumIn.value && poNumIn.value && newBillAmt && certIn.value)">
|
[disabled]="!(inNumIn.value && poNumIn.value)">
|
||||||
|
<!--[disabled]="!(inNumIn.value && poNumIn.value && newBillAmt && certIn.value)">-->
|
||||||
Confirm
|
Confirm
|
||||||
</button>
|
</button>
|
||||||
<button type="reset" class="btn btn-danger" (click)="close(new)">Cancel</button>
|
<button type="reset" class="btn btn-danger" (click)="close(new)">Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
<!--</form>-->
|
<!--</form>-->
|
||||||
</app-modal-form>
|
</app-modal-form>
|
||||||
|
|
||||||
|
<!--MODAL: invoice details-->
|
||||||
|
<app-modal-form [title]="'Invoice Details of ' + (chosenInv ? chosenInv.invoiceNumber: '')" #details>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 align-items-end">
|
||||||
|
<ag-grid-angular
|
||||||
|
style="height: 350px;"
|
||||||
|
class="ag-theme-balham"
|
||||||
|
[enableColResize]="true"
|
||||||
|
[enableSorting]="true"
|
||||||
|
[enableFilter]="true"
|
||||||
|
[rowData]="selectedInDetails | async"
|
||||||
|
[columnDefs]="detailColumnDefs"
|
||||||
|
(cellEditingStopped)="updateDetailRow($event)"
|
||||||
|
(gridReady)="onDetailGridReady($event)"
|
||||||
|
(rowDataChanged)="resizeColumns($event)"
|
||||||
|
rowSelection="single"
|
||||||
|
></ag-grid-angular>
|
||||||
|
<div class="input-group mt-2">
|
||||||
|
<select class="custom-select"
|
||||||
|
[disabled]="!selectedPODetails.length"
|
||||||
|
#poDetSelec>
|
||||||
|
<option *ngFor="let po of selectedPODetails" [value]="po.lineItemNo">{{po.serviceDesc}}</option>
|
||||||
|
<option [value]="-1">Out of Pocket Expenses</option>
|
||||||
|
</select>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-primary btn-sm" type="button" (click)="addEmptyDetail()">Add</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<h4 align="end">Total Cost: {{selectedBillAmt | currency}}</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--<div class="modal-footer">-->
|
||||||
|
<!--<button class="btn btn-outline-danger" (click)="close(details)">Exit</button>-->
|
||||||
|
<!--</div>-->
|
||||||
|
</app-modal-form>
|
|
@ -11,71 +11,23 @@ declare var $: any;
|
||||||
styleUrls: ['./invoice.component.css']
|
styleUrls: ['./invoice.component.css']
|
||||||
})
|
})
|
||||||
export class InvoiceComponent implements OnInit {
|
export class InvoiceComponent implements OnInit {
|
||||||
@ViewChild('agGrid') agGrid;
|
gridApi;
|
||||||
chosenCustomerID: any = 0;
|
gridColumnApi;
|
||||||
chosenInv: any = 0;
|
detailGridApi;
|
||||||
source;
|
detailColumnApi;
|
||||||
customers;
|
|
||||||
pos = [];
|
|
||||||
chosenPo;
|
|
||||||
correspondingPos = [];
|
|
||||||
correspondingCustomer = [];
|
|
||||||
generatedInvoiceNumber = '';
|
|
||||||
feeTypes = ['Fixed Fee', 'Hourly'];
|
|
||||||
serviceTypes = ['Study', 'Design', 'Peer Review', 'Cost Investigation', 'Forensic Investigation'];
|
|
||||||
columnDefs = [
|
columnDefs = [
|
||||||
|
{headerName: 'Customer', field: 'customerId'},
|
||||||
{headerName: 'Invoice Number', field: 'invoiceNumber'},
|
{headerName: 'Invoice Number', field: 'invoiceNumber'},
|
||||||
{headerName: 'Date', field: 'invoiceDate'},
|
{headerName: 'Date', field: 'invoiceDate'},
|
||||||
{headerName: 'Sales Order Number', field: 'poNum'},
|
{headerName: 'Sales Order Number', field: 'poNum'},
|
||||||
{headerName: 'Change Order Number', field: 'changeOrderNum'},
|
{headerName: 'Change Order Number', field: 'changeOrderNum'},
|
||||||
{headerName: 'Outstanding Balance', field: 'outstandingBalance'},
|
{headerName: 'Outstanding Balance', field: 'outstandingBalanceString'},
|
||||||
{headerName: 'Bll Amount', field: 'billAmt'}
|
{headerName: 'Bill Amount', field: 'billAmtString'},
|
||||||
|
{headerName: 'Notes', field: 'specialNotes', editable: true, cellEditor: 'agLargeTextCellEditor'}
|
||||||
];
|
];
|
||||||
newInDetails = [];
|
|
||||||
newBillAmt = 0;
|
|
||||||
selectedInDetails = [];
|
|
||||||
selectedPO;
|
|
||||||
selectedBillAmt = 0;
|
|
||||||
poDetails = [];
|
|
||||||
selectedPODetails = [];
|
|
||||||
|
|
||||||
gridOptions = {
|
gridOptions = {
|
||||||
|
|
||||||
// PROPERTIES - object properties, myRowData and myColDefs are created somewhere in your application
|
|
||||||
rowData: this.source,
|
|
||||||
columnDefs: this.columnDefs,
|
|
||||||
|
|
||||||
// PROPERTIES - simple boolean / string / number properties
|
|
||||||
enableColResize: true,
|
|
||||||
rowSelection: 'single',
|
|
||||||
|
|
||||||
// EVENTS - add event callback handlers
|
|
||||||
onRowClicked: (event) => {
|
|
||||||
this.getSelectedRows();
|
|
||||||
},
|
|
||||||
onColumnResized: function (event) {
|
|
||||||
console.log('a column was resized');
|
|
||||||
},
|
|
||||||
onGridReady: (event) => {
|
|
||||||
},
|
|
||||||
// this.agGrid.sizeColumnsToFit();
|
|
||||||
// 1: draft
|
|
||||||
// 2: submitted
|
|
||||||
// 3: void
|
|
||||||
|
|
||||||
// getRowStyle: function(params) {
|
|
||||||
// if (params.data.invoiceStatus === 1) {
|
|
||||||
// return { 'color': 'red' }
|
|
||||||
// } else if (params.data.invoiceStatus === 3) {
|
|
||||||
// return { 'text-decoration': 'line-through'}
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
rowClassRules: {
|
rowClassRules: {
|
||||||
// apply green to 2008
|
|
||||||
// 'bg-red': true,
|
|
||||||
|
|
||||||
// apply amber 2004
|
|
||||||
'text-danger': function (params) {
|
'text-danger': function (params) {
|
||||||
return params.data.invoiceStatus === 1;
|
return params.data.invoiceStatus === 1;
|
||||||
},
|
},
|
||||||
|
@ -84,19 +36,58 @@ export class InvoiceComponent implements OnInit {
|
||||||
},
|
},
|
||||||
'text-warning': function (params) {
|
'text-warning': function (params) {
|
||||||
return params.data.invoiceStatus === 3;
|
return params.data.invoiceStatus === 3;
|
||||||
},
|
}
|
||||||
|
|
||||||
// apply red to 2000
|
|
||||||
// 'rag-red-outer': function(params) { return params.data.year === 2000}
|
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
detailColumnDefs = [
|
||||||
|
{headerName: '#', field: 'lineItemNum'},
|
||||||
|
{headerName: 'PO Detail', field: 'poDetailName'},
|
||||||
|
{headerName: 'Description', field: 'desc', editable: true, cellEditor: 'agLargeTextCellEditor'},
|
||||||
|
{headerName: 'Fee Type', field: 'feeTypeName'},
|
||||||
|
{headerName: 'Service Type', field: 'serviceTypeName'},
|
||||||
|
{headerName: 'Qty or Hours', field: 'qty', editable: true},
|
||||||
|
{headerName: '(/Remaining)', field: 'remainingQty'},
|
||||||
|
{headerName: 'Fee', field: 'fee', editable: true}
|
||||||
|
];
|
||||||
|
|
||||||
constructor(protected astuteClientService: AstuteClientService, protected printService: PrintInvoiceService) {
|
chosenCustomerID: any = 0;
|
||||||
|
chosenInv: any = 0;
|
||||||
|
source;
|
||||||
|
|
||||||
|
chosenPo;
|
||||||
|
correspondingPos = [];
|
||||||
|
generatedInvoiceNumber = '';
|
||||||
|
|
||||||
|
serviceTypes = [];
|
||||||
|
serviceNames = [];
|
||||||
|
rateTypes = [];
|
||||||
|
rateNames = [];
|
||||||
|
customers;
|
||||||
|
pos = [];
|
||||||
|
allPODetails = [];
|
||||||
|
|
||||||
|
newInDetails = [];
|
||||||
|
newBillAmt = 0;
|
||||||
|
|
||||||
|
selectedInDetails;
|
||||||
|
selectedPO;
|
||||||
|
selectedBillAmt = 0;
|
||||||
|
selectedPODetails = [];
|
||||||
|
|
||||||
|
// poDetails = [];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
constructor(protected astuteClientService: AstuteClientService,
|
||||||
|
protected printService: PrintInvoiceService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
customerDropdownChange(index) {
|
customerDropdownChange(index) {
|
||||||
this.chosenCustomerID = this.customers[index].customerId;
|
this.chosenCustomerID = this.customers[index].customerId;
|
||||||
this.setCorrespondingPos();
|
this.correspondingPos = this.pos.filter((po) => {
|
||||||
|
console.log(po);
|
||||||
|
return po.customerId === this.chosenCustomerID && !po.oneInvInDraft && po.isFinal;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
poDropdownChange(ponum) {
|
poDropdownChange(ponum) {
|
||||||
|
@ -105,31 +96,22 @@ export class InvoiceComponent implements OnInit {
|
||||||
this.chosenPo = po;
|
this.chosenPo = po;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.astuteClientService.getPODetail(ponum).then((data) => {
|
// this.astuteClientService.getPODetail(ponum).then((data) => {
|
||||||
if (data) {
|
// if (data) {
|
||||||
// fee
|
// // lineItemNo, feeTypeId, serviceTypeId, serviceDesc, fee, remainingQty
|
||||||
// feeTypeId
|
// this.poDetails = data;
|
||||||
// lineItemNo
|
// this.poDetails[-1] = {
|
||||||
// ponum
|
// 'lineItemNo': -1,
|
||||||
// qty
|
// 'feeTypeId': 1,
|
||||||
// remainingQty
|
// 'serviceTypeId': 1,
|
||||||
// serviceDesc
|
// 'serviceDesc': 'Out of Pocket Expenses',
|
||||||
// serviceTypeId
|
// 'fee': 0,
|
||||||
|
// 'remainingQty': 0
|
||||||
// lineItemNo, feeTypeId, serviceTypeId, serviceDesc, fee, remainingQty
|
// };
|
||||||
this.poDetails = data;
|
// } else {
|
||||||
this.poDetails[-1] = {
|
// alert('get PO detail failed!');
|
||||||
'lineItemNo': -1,
|
// }
|
||||||
'feeTypeId': 1,
|
// });
|
||||||
'serviceTypeId': 1,
|
|
||||||
'serviceDesc': 'Out of Pocket Expenses',
|
|
||||||
'fee': 0,
|
|
||||||
'remainingQty': 0
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
alert("get PO detail failed!");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.astuteClientService.generateInvoiceNumber(ponum).then((data) => {
|
this.astuteClientService.generateInvoiceNumber(ponum).then((data) => {
|
||||||
if (data) {
|
if (data) {
|
||||||
this.generatedInvoiceNumber = data;
|
this.generatedInvoiceNumber = data;
|
||||||
|
@ -140,42 +122,152 @@ export class InvoiceComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.astuteClientService.getServiceTypes().then((d) => {
|
||||||
|
if (d) {
|
||||||
|
this.serviceTypes = d;
|
||||||
|
this.serviceTypes.forEach((type) => {
|
||||||
|
this.serviceNames.push(type.serviceTypeDesc);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
alert ('Get service types failed');
|
||||||
|
}
|
||||||
|
}, reason => {
|
||||||
|
alert('Get service type failed: ' + reason);
|
||||||
|
});
|
||||||
|
this.astuteClientService.getRateTypes().then((d) => {
|
||||||
|
if (d) {
|
||||||
|
this.rateTypes = d;
|
||||||
|
this.rateTypes.forEach((type) => {
|
||||||
|
this.rateNames.push(type.feeTypeDesc);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
alert ('Get rate types failed');
|
||||||
|
}
|
||||||
|
}, reason => {
|
||||||
|
alert('Get rate type failed: ' + reason);
|
||||||
|
});
|
||||||
|
this.astuteClientService.getCustomers().then((customers) => {
|
||||||
|
if (customers) {
|
||||||
|
this.customers = customers;
|
||||||
|
} else {
|
||||||
|
alert('Get Customers Failed!');
|
||||||
|
}
|
||||||
|
}, (reason) => {
|
||||||
|
alert('Get Customers Failed: ' + reason);
|
||||||
|
});
|
||||||
|
this.astuteClientService.getPOs().then((data) => {
|
||||||
|
this.pos = data;
|
||||||
|
this.pos.forEach((po) => {
|
||||||
|
this.astuteClientService.getPODetail(po.ponum).then((details) => {
|
||||||
|
if (details) {
|
||||||
|
details.forEach((detail) => {
|
||||||
|
this.allPODetails.push(detail);
|
||||||
|
});
|
||||||
|
// console.log(this.allPODetails);
|
||||||
|
} else {
|
||||||
|
alert('Get PO Detail for ' + po.ponum + ' failed!');
|
||||||
|
}
|
||||||
|
}, (reason) => {
|
||||||
|
alert('Get PO Detail for ' + po.ponum + ' failed: ' + reason);
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}, (reason) => {
|
||||||
|
alert('Get SOs Failed: ' + reason);
|
||||||
|
});
|
||||||
this.refreshData();
|
this.refreshData();
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshData() {
|
refreshData() {
|
||||||
this.astuteClientService.getInvoices().then((data) => {
|
this.astuteClientService.getInvoices().then((data) => {
|
||||||
this.source = data;
|
if (data) {
|
||||||
console.log(data);
|
this.source = data;
|
||||||
this.source.forEach((row) => {
|
// console.log(data);
|
||||||
row.billAmt = formatCurrency(row.billAmt, 'en-US', '$', 'USD');
|
this.source.forEach((row) => {
|
||||||
});
|
row.billAmtString = formatCurrency(row.billAmt, 'en-US', '$', 'USD');
|
||||||
this.source.forEach((row) => {
|
row.outstandingBalanceString = formatCurrency(row.outstandingBalance, 'en-US', '$', 'USD');
|
||||||
row.outstandingBalance = formatCurrency(row.outstandingBalance, 'en-US', '$', 'USD');
|
});
|
||||||
});
|
} else {
|
||||||
});
|
alert('Get Invoices failed!');
|
||||||
|
}
|
||||||
this.astuteClientService.getCustomers().then((data) => {
|
|
||||||
this.customers = data;
|
|
||||||
});
|
|
||||||
|
|
||||||
this.astuteClientService.getPOs().then((data) => {
|
|
||||||
this.pos = data;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
refreshDetailsOfSelected() {
|
||||||
|
this.setSelectedRow(null);
|
||||||
|
}
|
||||||
|
|
||||||
getPODetails(poIndex) {
|
getPODetails(poIndex) {
|
||||||
let ponum = this.pos[poIndex].ponum;
|
const ponum = this.pos[poIndex].ponum;
|
||||||
this.astuteClientService.getPODetail(ponum).then((data) => {
|
this.selectedInDetails = this.astuteClientService.getPODetail(ponum);
|
||||||
this.selectedInDetails = data;
|
}
|
||||||
console.log("inDetails:");
|
|
||||||
console.log(this.selectedInDetails);
|
updateRow(event) {
|
||||||
|
const eventData = event.data;
|
||||||
|
console.log(eventData);
|
||||||
|
this.astuteClientService.updateInvoice(eventData.invoiceNumber, eventData).then((data) => {
|
||||||
|
if (!data) {
|
||||||
|
this.refreshData();
|
||||||
|
alert('Invoice Updating Failed, Check Input Fields');
|
||||||
|
}
|
||||||
|
}, (reason) => {
|
||||||
|
alert('Update invoice failed: ' + reason);
|
||||||
|
});
|
||||||
|
// this.refreshData();
|
||||||
|
}
|
||||||
|
updateDetailRow(event) {
|
||||||
|
const eventData = event.data;
|
||||||
|
console.log(eventData);
|
||||||
|
this.astuteClientService.updateInvoiceDetail(eventData.invoiceNumber, eventData.lineItemNum, eventData).then((data) => {
|
||||||
|
if (!data) {
|
||||||
|
this.refreshDetailsOfSelected();
|
||||||
|
alert('Detail Updating Failed, Check Input Fields');
|
||||||
|
}
|
||||||
|
}, (reason) => {
|
||||||
|
alert('Update Detail failed: ' + reason);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
setSelectedRow(event) {
|
||||||
|
if (event) {
|
||||||
|
this.chosenInv = event.data;
|
||||||
|
}
|
||||||
|
this.selectedBillAmt = this.chosenInv.billAmt;
|
||||||
|
this.selectedPODetails = this.allPODetails.filter((detail) => {
|
||||||
|
return (detail.ponum === this.chosenInv.poNum);
|
||||||
|
});
|
||||||
|
this.selectedInDetails = this.astuteClientService.getInvoiceDetail(this.chosenInv.invoiceNumber).then((data) => {
|
||||||
|
if (data) {
|
||||||
|
data.forEach((invDetail) => {
|
||||||
|
const tempPo = this.selectedPODetails.filter((po) => {
|
||||||
|
return po.lineItemNo === invDetail.poLineItemNum;
|
||||||
|
})[0];
|
||||||
|
if (tempPo) {
|
||||||
|
invDetail.remainingQty = tempPo.remainingQty;
|
||||||
|
}
|
||||||
|
|
||||||
|
invDetail.serviceTypeName = this.serviceNames[invDetail.serviceTypeId - 1];
|
||||||
|
invDetail.rateTypeName = this.rateNames[invDetail.feeTypeId - 1];
|
||||||
|
if (invDetail.poLineItemNum === -1) {
|
||||||
|
invDetail.poDetailName = 'Out of Pocket Expenses';
|
||||||
|
} else {
|
||||||
|
invDetail.poDetailName = this.selectedPODetails[invDetail.poLineItemNum - 1].serviceDesc;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
} else {
|
||||||
|
alert('get Inv detail failed!');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.pos.forEach((po) => {
|
||||||
|
if (po.ponum === this.chosenInv.poNum) {
|
||||||
|
this.selectedPO = po;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onSelectedCellChange(row: number, col: string, value) {
|
onSelectedCellChange(row: number, col: string, value) {
|
||||||
this.selectedInDetails[row][col] = value;
|
// this.selectedInDetails[row][col] = value;
|
||||||
console.log(this.selectedInDetails);
|
// console.log(this.selectedInDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
onNewCellChange(row: number, col: string, value) {
|
onNewCellChange(row: number, col: string, value) {
|
||||||
|
@ -184,15 +276,15 @@ export class InvoiceComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
pushOntoSelectedDetail(invoiceNum, lineItemNum, poLineItemNum, serviceTypeId, desc, qty, fee) {
|
pushOntoSelectedDetail(invoiceNum, lineItemNum, poLineItemNum, serviceTypeId, desc, qty, fee) {
|
||||||
this.selectedInDetails.push({
|
// this.selectedInDetails.push({
|
||||||
'invoiceNum': invoiceNum,
|
// 'invoiceNum': invoiceNum,
|
||||||
'lineItemNum': lineItemNum,
|
// 'lineItemNum': lineItemNum,
|
||||||
'poLineItemNum': poLineItemNum,
|
// 'poLineItemNum': poLineItemNum,
|
||||||
'serviceTypeId': serviceTypeId,
|
// 'serviceTypeId': serviceTypeId,
|
||||||
'desc': desc,
|
// 'desc': desc,
|
||||||
'qty': +qty,
|
// 'qty': +qty,
|
||||||
'fee': +fee
|
// 'fee': +fee
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
pushOntoNewDetail(invoiceNum, lineItemNum, poLineItemNum, feeTypeId, serviceTypeId, desc, qty, fee, remainingQty, poNum) {
|
pushOntoNewDetail(invoiceNum, lineItemNum, poLineItemNum, feeTypeId, serviceTypeId, desc, qty, fee, remainingQty, poNum) {
|
||||||
|
@ -218,65 +310,68 @@ export class InvoiceComponent implements OnInit {
|
||||||
});
|
});
|
||||||
this.newBillAmt = tot;
|
this.newBillAmt = tot;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSelectedBillAmt() {
|
updateSelectedBillAmt() {
|
||||||
let tot = 0;
|
// let tot = 0;
|
||||||
this.selectedInDetails.forEach((d) => {
|
// this.selectedInDetails.forEach((d) => {
|
||||||
tot += +d.qty * +d.fee;
|
// tot += +d.qty * +d.fee;
|
||||||
});
|
// });
|
||||||
this.selectedBillAmt = tot;
|
// this.selectedBillAmt = tot;
|
||||||
}
|
}
|
||||||
|
|
||||||
assignActity(): void {
|
|
||||||
window.open('/invoice-gen');
|
|
||||||
}
|
|
||||||
|
|
||||||
printInvoice() {
|
printInvoice() {
|
||||||
this.printService.printPDF (this.chosenInv.invoiceNumber);
|
this.printService.printPDF (this.chosenInv.invoiceNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
getSelectedRows() {
|
// getSelectedRows() {
|
||||||
const selectedNodes = this.agGrid.api.getSelectedNodes();
|
// const selectedNodes = this.gridApi.getSelectedNodes();
|
||||||
if (selectedNodes.length) {
|
// if (selectedNodes.length) {
|
||||||
this.chosenInv = selectedNodes.map(node => node.data)[0];
|
// this.chosenInv = selectedNodes.map(node => node.data)[0];
|
||||||
// console.log (this.chosenInv);
|
// // console.log (this.chosenInv);
|
||||||
this.selectedBillAmt = +(this.chosenInv.billAmt.replace(',', '').replace('$', ''));
|
// this.selectedBillAmt = +(this.chosenInv.billAmt.replace(',', '').replace('$', ''));
|
||||||
this.astuteClientService.getPODetail(this.chosenInv.poNum).then((poDetails) => {
|
// this.astuteClientService.getPODetail(this.chosenInv.poNum).then((poDetails) => {
|
||||||
if (poDetails) {
|
// if (poDetails) {
|
||||||
this.selectedPODetails = poDetails;
|
// this.selectedPODetails = poDetails;
|
||||||
this.astuteClientService.getInvoiceDetail(this.chosenInv.invoiceNumber).then((invoiceDetails) => {
|
// this.astuteClientService.getInvoiceDetail(this.chosenInv.invoiceNumber).then((invoiceDetails) => {
|
||||||
if (invoiceDetails) {
|
// if (invoiceDetails) {
|
||||||
this.selectedInDetails = invoiceDetails;
|
// this.selectedInDetails = invoiceDetails;
|
||||||
this.selectedInDetails.forEach((invDetail) => {
|
// this.selectedInDetails.forEach((invDetail) => {
|
||||||
const tempPo = this.selectedPODetails.filter((po) => {
|
// const tempPo = this.selectedPODetails.filter((po) => {
|
||||||
// console.log (po.lineItemNo + " and " + invDetail.poLineItemNum);
|
// // console.log (po.lineItemNo + " and " + invDetail.poLineItemNum);
|
||||||
return po.lineItemNo === invDetail.poLineItemNum;
|
// return po.lineItemNo === invDetail.poLineItemNum;
|
||||||
})[0];
|
// })[0];
|
||||||
if (tempPo) {
|
// if (tempPo) {
|
||||||
invDetail.remainingQty = tempPo.remainingQty;
|
// invDetail.remainingQty = tempPo.remainingQty;
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
alert("get Inv detail failed!");
|
// alert("get Inv detail failed!");
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
alert("get PO detail failed!")
|
// alert("get PO detail failed!")
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
this.pos.forEach((po) => {
|
// this.pos.forEach((po) => {
|
||||||
if (po.ponum === this.chosenInv.poNum) {
|
// if (po.ponum === this.chosenInv.poNum) {
|
||||||
this.selectedPO = po;
|
// this.selectedPO = po;
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
this.chosenInv = null;
|
// this.chosenInv = null;
|
||||||
this.selectedPODetails = [];
|
// this.selectedPODetails = [];
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
open(content, indexPO, indexINV) {
|
// open(content, indexPO, indexINV) {
|
||||||
this.setCorrespondingCustomer();
|
open(content) {
|
||||||
|
// this.setCorrespondingCustomer();
|
||||||
|
if (this.gridColumnApi) {
|
||||||
|
this.gridColumnApi.autoSizeAllColumns();
|
||||||
|
}
|
||||||
|
if (this.detailColumnApi) {
|
||||||
|
this.detailColumnApi.autoSizeAllColumns();
|
||||||
|
}
|
||||||
content.open();
|
content.open();
|
||||||
// this.detailDescription = ViewChild('detailDescription');
|
// this.detailDescription = ViewChild('detailDescription');
|
||||||
// this.detailAmount = ViewChild('detailAmount');
|
// this.detailAmount = ViewChild('detailAmount');
|
||||||
|
@ -295,7 +390,6 @@ export class InvoiceComponent implements OnInit {
|
||||||
// this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
|
// this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
close(content) {
|
close(content) {
|
||||||
content.close();
|
content.close();
|
||||||
// this.newInDetails = [];
|
// this.newInDetails = [];
|
||||||
|
@ -340,7 +434,6 @@ export class InvoiceComponent implements OnInit {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addInvoice(invoiceNumber, poNum, changeOrderNum, pmtStatus, billAmt, specialNotes, certification, status, ref) {
|
addInvoice(invoiceNumber, poNum, changeOrderNum, pmtStatus, billAmt, specialNotes, certification, status, ref) {
|
||||||
// String invoiceNumber;
|
// String invoiceNumber;
|
||||||
// Date invoiceDate;
|
// Date invoiceDate;
|
||||||
|
@ -372,61 +465,13 @@ export class InvoiceComponent implements OnInit {
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
if (data) {
|
if (data) {
|
||||||
this.refreshData();
|
this.refreshData();
|
||||||
this.addInvoiceDetail(this.newInDetails);
|
// this.addInvoiceDetail(this.newInDetails);
|
||||||
ref.close();
|
ref.close();
|
||||||
} else {
|
} else {
|
||||||
alert('Invoice Creation Failed, Check Input Fields');
|
alert('Invoice Creation Failed, Check Input Fields');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
addInvoiceDetail(details) {
|
|
||||||
if (details.length) {
|
|
||||||
// console.log(details[0]);
|
|
||||||
// if (details[0].poLineItemNum !== -1) {
|
|
||||||
this.astuteClientService.createInvoiceDetail(details[0]).then((data) => {
|
|
||||||
if (data) {
|
|
||||||
details.splice(0, 1);
|
|
||||||
this.addInvoiceDetail(details);
|
|
||||||
} else {
|
|
||||||
alert('add inv detail failed');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// } else {
|
|
||||||
// desc
|
|
||||||
// fee
|
|
||||||
// feeTypeId
|
|
||||||
// invoiceNum
|
|
||||||
// lineItemNum
|
|
||||||
// poLineItemNum
|
|
||||||
// qty
|
|
||||||
// remainingQty
|
|
||||||
// serviceTypeId
|
|
||||||
// poNum
|
|
||||||
|
|
||||||
// const data = {
|
|
||||||
// // 'lineItemNo': details[0].,
|
|
||||||
// 'poNum': details[0].poNum,
|
|
||||||
// 'serviceDesc': details[0].desc,
|
|
||||||
// 'feeTypeId': details[0].feeTypeId,
|
|
||||||
// 'serviceTypeId': details[0].serviceTypeId,
|
|
||||||
// 'qty': +details[0].qty,
|
|
||||||
// 'fee': +details[0].fee,
|
|
||||||
// 'remainingQty': +details[0].fee * +details[0].qty
|
|
||||||
// };
|
|
||||||
// this.astuteClientService.createPODetail(data).then((d) => {
|
|
||||||
// if (d) {
|
|
||||||
// console.log (d);
|
|
||||||
// } else {
|
|
||||||
// alert('create custom PO failed.');
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
} else {
|
|
||||||
this.newInDetails = [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
editInvoice(invoiceNumber, poNum, changeOrderNum, pmtStatus, billAmt, specialNotes, certification) {
|
editInvoice(invoiceNumber, poNum, changeOrderNum, pmtStatus, billAmt, specialNotes, certification) {
|
||||||
// String invoiceNumber;
|
// String invoiceNumber;
|
||||||
// Date invoiceDate;
|
// Date invoiceDate;
|
||||||
|
@ -464,7 +509,6 @@ export class InvoiceComponent implements OnInit {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
voidInvoice(invoiceNumber) {
|
voidInvoice(invoiceNumber) {
|
||||||
if (confirm('Are you sure you want to void invoice, ' + invoiceNumber)) {
|
if (confirm('Are you sure you want to void invoice, ' + invoiceNumber)) {
|
||||||
this.astuteClientService.voidInvoice(invoiceNumber).then((data) => {
|
this.astuteClientService.voidInvoice(invoiceNumber).then((data) => {
|
||||||
|
@ -476,7 +520,6 @@ export class InvoiceComponent implements OnInit {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
submitInvoice(invoiceNumber) {
|
submitInvoice(invoiceNumber) {
|
||||||
this.astuteClientService.submitInvoice(invoiceNumber).then((data) => {
|
this.astuteClientService.submitInvoice(invoiceNumber).then((data) => {
|
||||||
if (data) {
|
if (data) {
|
||||||
|
@ -487,23 +530,141 @@ export class InvoiceComponent implements OnInit {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// creates empty line item detail
|
||||||
|
addEmptyDetail(poLineItemNum) {
|
||||||
|
const emptyData = {
|
||||||
|
desc: '',
|
||||||
|
fee: 0,
|
||||||
|
feeTypeId: 1,
|
||||||
|
invoiceNum: this.chosenInv.invoiceNumber,
|
||||||
|
// lineItemNum: 1,
|
||||||
|
poLineItemNum: poLineItemNum,
|
||||||
|
qty: 1,
|
||||||
|
remainingQty: 1,
|
||||||
|
serviceTypeId: 1
|
||||||
|
};
|
||||||
|
|
||||||
|
// desc: "Design Somethign"
|
||||||
|
// fee: 2500
|
||||||
|
// feeTypeId: 1
|
||||||
|
// invoiceNum: "MDO-01_DRAFT_157"
|
||||||
|
// lineItemNum: 1
|
||||||
|
// poLineItemNum: 1
|
||||||
|
// qty: 1
|
||||||
|
// remainingQty: 0
|
||||||
|
// serviceTypeId: 2
|
||||||
|
|
||||||
|
this.astuteClientService.createInvoiceDetail(emptyData).then((data) => {
|
||||||
|
if (!data) {
|
||||||
|
this.refreshDetailsOfSelected();
|
||||||
|
alert('Creating SO detailed failed!');
|
||||||
|
}
|
||||||
|
}, (reason) => {
|
||||||
|
alert('Creating SO detailed failed: ' + reason);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// addInvoiceDetail(details) {
|
||||||
|
// if (details.length) {
|
||||||
|
// // console.log(details[0]);
|
||||||
|
// // if (details[0].poLineItemNum !== -1) {
|
||||||
|
// this.astuteClientService.createInvoiceDetail(details[0]).then((data) => {
|
||||||
|
// if (data) {
|
||||||
|
// details.splice(0, 1);
|
||||||
|
// this.addInvoiceDetail(details);
|
||||||
|
// } else {
|
||||||
|
// alert('add inv detail failed');
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// // } else {
|
||||||
|
// // desc
|
||||||
|
// // fee
|
||||||
|
// // feeTypeId
|
||||||
|
// // invoiceNum
|
||||||
|
// // lineItemNum
|
||||||
|
// // poLineItemNum
|
||||||
|
// // qty
|
||||||
|
// // remainingQty
|
||||||
|
// // serviceTypeId
|
||||||
|
// // poNum
|
||||||
|
//
|
||||||
|
// // const data = {
|
||||||
|
// // // 'lineItemNo': details[0].,
|
||||||
|
// // 'poNum': details[0].poNum,
|
||||||
|
// // 'serviceDesc': details[0].desc,
|
||||||
|
// // 'feeTypeId': details[0].feeTypeId,
|
||||||
|
// // 'serviceTypeId': details[0].serviceTypeId,
|
||||||
|
// // 'qty': +details[0].qty,
|
||||||
|
// // 'fee': +details[0].fee,
|
||||||
|
// // 'remainingQty': +details[0].fee * +details[0].qty
|
||||||
|
// // };
|
||||||
|
// // this.astuteClientService.createPODetail(data).then((d) => {
|
||||||
|
// // if (d) {
|
||||||
|
// // console.log (d);
|
||||||
|
// // } else {
|
||||||
|
// // alert('create custom PO failed.');
|
||||||
|
// // }
|
||||||
|
// // });
|
||||||
|
// // }
|
||||||
|
// } else {
|
||||||
|
// this.newInDetails = [];
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
getPerc(amt, total): number {
|
getPerc(amt, total): number {
|
||||||
return Math.floor(((amt) / total) * 100);
|
return Math.floor(((amt) / total) * 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
getRangeMax(total, num) {
|
getRangeMax(total, num) {
|
||||||
return Math.floor(total / num);
|
return Math.floor(total / num);
|
||||||
}
|
}
|
||||||
|
|
||||||
setCorrespondingPos() {
|
|
||||||
this.correspondingPos = this.pos.filter((po, index, array) => {
|
// setCorrespondingCustomer() {
|
||||||
return po.customerId === this.chosenCustomerID && !po.oneInvInDraft && po.final;
|
// this.correspondingCustomer = this.customers.filter((customer, index, array) => {
|
||||||
|
// return customer.customerId === this.chosenInv.customerId;
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
getCustomerNameFromId(customerId) {
|
||||||
|
let name = '';
|
||||||
|
this.customers.forEach((customer) => {
|
||||||
|
if (customer.customerId === customerId) {
|
||||||
|
name = customer.customerName;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
getServiceIdFromName(name) {
|
||||||
|
let id = -1;
|
||||||
|
this.serviceTypes.forEach((type) => {
|
||||||
|
console.log(type.serviceTypeDesc + ' ' + name);
|
||||||
|
if (type.serviceTypeDesc === name) {
|
||||||
|
id = type.serviceTypeId;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
getFeeIdFromName(name: any) {
|
||||||
|
let id = -1;
|
||||||
|
this.rateTypes.forEach((type) => {
|
||||||
|
if (type.feeTypeDesc === name) {
|
||||||
|
id = type.feeTypeId;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
setCorrespondingCustomer() {
|
// ag grid callbacks
|
||||||
this.correspondingCustomer = this.customers.filter((customer, index, array) => {
|
onGridReady(evt) {
|
||||||
return customer.customerId === this.chosenInv.customerId;
|
this.gridApi = evt.api;
|
||||||
});
|
this.gridColumnApi = evt.columnApi;
|
||||||
|
}
|
||||||
|
onDetailGridReady(evt) {
|
||||||
|
this.detailGridApi = evt.api;
|
||||||
|
this.detailColumnApi = evt.columnApi;
|
||||||
|
}
|
||||||
|
resizeColumns(evt) {
|
||||||
|
evt.columnApi.autoSizeAllColumns();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,16 @@ export class SalesOrderComponent implements OnInit {
|
||||||
{headerName: 'notes', field: 'notes', editable: true, cellEditor: 'agLargeTextCellEditor'}
|
{headerName: 'notes', field: 'notes', editable: true, cellEditor: 'agLargeTextCellEditor'}
|
||||||
// {headerName: 'oneInvInDraft', field: 'oneInvInDraft'}
|
// {headerName: 'oneInvInDraft', field: 'oneInvInDraft'}
|
||||||
];
|
];
|
||||||
|
gridOptions = {
|
||||||
|
rowClassRules: {
|
||||||
|
'text-danger': function (params) {
|
||||||
|
return !params.data.isFinal;
|
||||||
|
},
|
||||||
|
'text-primary': function (params) {
|
||||||
|
return params.data.isFinal;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
selected = null; // the selected SO row
|
selected = null; // the selected SO row
|
||||||
|
|
||||||
// data for SO detail grid
|
// data for SO detail grid
|
||||||
|
@ -85,13 +95,13 @@ export class SalesOrderComponent implements OnInit {
|
||||||
this.astuteClientService.getCustomers().then((customers) => {
|
this.astuteClientService.getCustomers().then((customers) => {
|
||||||
if (customers) {
|
if (customers) {
|
||||||
this.customers = customers;
|
this.customers = customers;
|
||||||
this.refreshData();
|
|
||||||
} else {
|
} else {
|
||||||
alert('Get Customers Failed!');
|
alert('Get Customers Failed!');
|
||||||
}
|
}
|
||||||
}, (reason) => {
|
}, (reason) => {
|
||||||
alert('Get Customers Failed: ' + reason);
|
alert('Get Customers Failed: ' + reason);
|
||||||
});
|
});
|
||||||
|
this.refreshData();
|
||||||
}
|
}
|
||||||
|
|
||||||
// callback for grid selection
|
// callback for grid selection
|
||||||
|
@ -109,12 +119,12 @@ export class SalesOrderComponent implements OnInit {
|
||||||
});
|
});
|
||||||
// console.log(this.selectedPODetail);
|
// console.log(this.selectedPODetail);
|
||||||
this.updateContractAmt();
|
this.updateContractAmt();
|
||||||
if (this.gridColumnApi) {
|
// if (this.gridColumnApi) {
|
||||||
this.gridColumnApi.autoSizeAllColumns();
|
// this.gridColumnApi.autoSizeAllColumns();
|
||||||
}
|
// }
|
||||||
if (this.detailColumnApi) {
|
// if (this.detailColumnApi) {
|
||||||
this.detailColumnApi.autoSizeAllColumns();
|
// this.detailColumnApi.autoSizeAllColumns();
|
||||||
}
|
// }
|
||||||
return data;
|
return data;
|
||||||
} else {
|
} else {
|
||||||
alert('Get SO detail failed!');
|
alert('Get SO detail failed!');
|
||||||
|
@ -132,8 +142,8 @@ export class SalesOrderComponent implements OnInit {
|
||||||
this.astuteClientService.updatePO(eventData.poNum, eventData).then((data) => {
|
this.astuteClientService.updatePO(eventData.poNum, eventData).then((data) => {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
alert('SO updating failed, check input fields');
|
alert('SO updating failed, check input fields');
|
||||||
|
this.refreshData();
|
||||||
}
|
}
|
||||||
this.refreshData();
|
|
||||||
}, (reason) => {
|
}, (reason) => {
|
||||||
alert('Update SO failed: ' + reason);
|
alert('Update SO failed: ' + reason);
|
||||||
});
|
});
|
||||||
|
@ -152,8 +162,8 @@ export class SalesOrderComponent implements OnInit {
|
||||||
this.astuteClientService.updatePODetail(eventData.poNum, eventData.lineItemNo, eventData).then((data) => {
|
this.astuteClientService.updatePODetail(eventData.poNum, eventData.lineItemNo, eventData).then((data) => {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
alert('SO Detail updating failed, check input fields');
|
alert('SO Detail updating failed, check input fields');
|
||||||
|
this.refreshDetailsOfSelected();
|
||||||
}
|
}
|
||||||
this.refreshDetailsOfSelected();
|
|
||||||
}, (reason) => {
|
}, (reason) => {
|
||||||
alert('Update SO Detail failed: ' + reason);
|
alert('Update SO Detail failed: ' + reason);
|
||||||
});
|
});
|
||||||
|
@ -270,8 +280,12 @@ export class SalesOrderComponent implements OnInit {
|
||||||
// open and closing modal-form components
|
// open and closing modal-form components
|
||||||
open(ref) {
|
open(ref) {
|
||||||
// this.getSelectedRows();
|
// this.getSelectedRows();
|
||||||
this.gridColumnApi.autoSizeAllColumns();
|
if (this.gridColumnApi) {
|
||||||
this.detailColumnApi.autoSizeAllColumns();
|
this.gridColumnApi.autoSizeAllColumns();
|
||||||
|
}
|
||||||
|
if (this.detailColumnApi) {
|
||||||
|
this.detailColumnApi.autoSizeAllColumns();
|
||||||
|
}
|
||||||
ref.open();
|
ref.open();
|
||||||
}
|
}
|
||||||
close(ref) {
|
close(ref) {
|
||||||
|
|
|
@ -140,7 +140,7 @@ public class SqlDAO extends DAO {
|
||||||
updateClause = updateClause + " PO_Date = STR_TO_DATE('" + PODate + "', '%Y-%m-%d')" + ",";
|
updateClause = updateClause + " PO_Date = STR_TO_DATE('" + PODate + "', '%Y-%m-%d')" + ",";
|
||||||
updateClause = updateClause + " contract_amt = " + contractAmt+ ",";
|
updateClause = updateClause + " contract_amt = " + contractAmt+ ",";
|
||||||
updateClause = updateClause + " astute_project_num = '" + astuteProjectNumber +"',";
|
updateClause = updateClause + " astute_project_num = '" + astuteProjectNumber +"',";
|
||||||
updateClause = updateClause + " title = '" + title +"'";
|
updateClause = updateClause + " title = '" + title +"',";
|
||||||
updateClause = updateClause + " notes = '" + notes +"'";
|
updateClause = updateClause + " notes = '" + notes +"'";
|
||||||
sql = sql+ updateClause + whereClause;
|
sql = sql+ updateClause + whereClause;
|
||||||
System.out.println(sql);
|
System.out.println(sql);
|
||||||
|
@ -266,7 +266,7 @@ public class SqlDAO extends DAO {
|
||||||
|
|
||||||
public void finalizePO(String PONum) throws AstuteException {
|
public void finalizePO(String PONum) throws AstuteException {
|
||||||
try {
|
try {
|
||||||
String sql = "UPDATE PO_MASTER SET final = 1 WHERE PO_Num = '" + PONum + "''";
|
String sql = "UPDATE PO SET final = 1 WHERE PO_Num = '" + PONum + "'";
|
||||||
System.out.println(sql);
|
System.out.println(sql);
|
||||||
Statement stmt = conn.createStatement();
|
Statement stmt = conn.createStatement();
|
||||||
stmt.executeUpdate(sql);
|
stmt.executeUpdate(sql);
|
||||||
|
@ -278,7 +278,7 @@ public class SqlDAO extends DAO {
|
||||||
|
|
||||||
public void deletePO(String PONum) throws AstuteException {
|
public void deletePO(String PONum) throws AstuteException {
|
||||||
try {
|
try {
|
||||||
String sql = "DELETE FROM PO_MASTER SET final = 1 WHERE PO_Num = '" + PONum + "'' AND final = 0";
|
String sql = "DELETE FROM PO SET final = 1 WHERE PO_Num = '" + PONum + "' AND final = 0";
|
||||||
System.out.println(sql);
|
System.out.println(sql);
|
||||||
Statement stmt = conn.createStatement();
|
Statement stmt = conn.createStatement();
|
||||||
stmt.executeUpdate(sql);
|
stmt.executeUpdate(sql);
|
||||||
|
@ -329,7 +329,7 @@ public class SqlDAO extends DAO {
|
||||||
public void createServiceType(String desc) throws AstuteException {
|
public void createServiceType(String desc) throws AstuteException {
|
||||||
try {
|
try {
|
||||||
Statement stmt = conn.createStatement();
|
Statement stmt = conn.createStatement();
|
||||||
String sql = "INSERT INTO service_type (service_type_id, `desc`) VALUES ((SELECT MAX(service_type_id)+1 FROM SERVICE_TYPE B), desc)";
|
String sql = "INSERT INTO service_type (service_type_id, `desc`) VALUES ((SELECT MAX(service_type_id)+1 FROM SERVICE_TYPE B), '" + desc + "')";
|
||||||
stmt.executeUpdate(sql);
|
stmt.executeUpdate(sql);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -449,7 +449,6 @@ public class SqlDAO extends DAO {
|
||||||
whereClause = whereClause + " pmt_status = "+ pmtStatus;
|
whereClause = whereClause + " pmt_status = "+ pmtStatus;
|
||||||
}
|
}
|
||||||
if (!whereClause.equals(" WHERE ")) {
|
if (!whereClause.equals(" WHERE ")) {
|
||||||
|
|
||||||
sql += whereClause;
|
sql += whereClause;
|
||||||
}
|
}
|
||||||
System.out.println(sql);
|
System.out.println(sql);
|
||||||
|
@ -986,7 +985,7 @@ public class SqlDAO extends DAO {
|
||||||
stmt.executeUpdate();
|
stmt.executeUpdate();
|
||||||
result = stmt.getString(1);
|
result = stmt.getString(1);
|
||||||
System.out.println(result);
|
System.out.println(result);
|
||||||
if (!result.equals("SUCCESS")) {
|
if (!result.equals("Success")) {
|
||||||
throw new AstuteException(DB_ERROR, result);
|
throw new AstuteException(DB_ERROR, result);
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
@ -1049,25 +1048,24 @@ public class SqlDAO extends DAO {
|
||||||
String sql = "select user_id, username, password, CONCAT(first_name, ' ', last_name) as name from user where username='" + username + "'";
|
String sql = "select user_id, username, password, CONCAT(first_name, ' ', last_name) as name from user where username='" + username + "'";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Statement stmt = conn.createStatement();
|
Statement stmt = conn.createStatement();
|
||||||
ResultSet resultSet = stmt.executeQuery(sql);
|
ResultSet resultSet = stmt.executeQuery(sql);
|
||||||
|
|
||||||
User user = null;
|
User user = null;
|
||||||
if(resultSet.next()) {
|
if(resultSet.next()) {
|
||||||
user = new User(resultSet.getInt(1),
|
user = new User(resultSet.getInt(1),
|
||||||
resultSet.getString(2),
|
resultSet.getString(2),
|
||||||
resultSet.getString(3),
|
resultSet.getString(3),
|
||||||
resultSet.getString(4),null
|
resultSet.getString(4), null
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// conn.close();
|
// conn.close();
|
||||||
|
return user;
|
||||||
return user;
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new AstuteException(DB_ERROR,e.getMessage());
|
throw new AstuteException(DB_ERROR,e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createSession(int userId, String sessionId) throws AstuteException {
|
public void createSession(int userId, String sessionId) throws AstuteException {
|
||||||
try {
|
try {
|
||||||
|
@ -1273,7 +1271,7 @@ public class SqlDAO extends DAO {
|
||||||
public User login(String username, String password) throws AstuteException{
|
public User login(String username, String password) throws AstuteException{
|
||||||
User user = getUser(username);
|
User user = getUser(username);
|
||||||
boolean check = false;
|
boolean check = false;
|
||||||
if (password.equals(user.getPassword())) {
|
if (user != null && password.equals(user.getPassword())) {
|
||||||
check = true;
|
check = true;
|
||||||
}
|
}
|
||||||
// try {
|
// try {
|
||||||
|
@ -1283,14 +1281,14 @@ public class SqlDAO extends DAO {
|
||||||
// } catch (InvalidKeySpecException e) {
|
// } catch (InvalidKeySpecException e) {
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
if(check) {
|
if (check) {
|
||||||
//create session
|
//create session
|
||||||
String sessionId = UUID.randomUUID().toString().replaceAll("-", "");
|
String sessionId = UUID.randomUUID().toString().replaceAll("-", "");
|
||||||
|
|
||||||
createSession(user.getUserId(), sessionId);
|
createSession(user.getUserId(), sessionId);
|
||||||
user.setSessionId(sessionId);
|
user.setSessionId(sessionId);
|
||||||
return user;
|
return user;
|
||||||
}else{
|
} else {
|
||||||
return null; //"Username or password was not correct";
|
return null; //"Username or password was not correct";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@ public class ServiceTypeRequest {
|
||||||
this.serviceTypeDesc = serviceTypeDesc;
|
this.serviceTypeDesc = serviceTypeDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ServiceTypeRequest() {}
|
||||||
|
|
||||||
public ServiceTypeRequest(int serviceTypeId, String desc) {
|
public ServiceTypeRequest(int serviceTypeId, String desc) {
|
||||||
this.serviceTypeId = serviceTypeId;
|
this.serviceTypeId = serviceTypeId;
|
||||||
this.serviceTypeDesc = serviceTypeDesc;
|
this.serviceTypeDesc = serviceTypeDesc;
|
||||||
|
|
|
@ -14,7 +14,7 @@ import javax.ws.rs.Produces;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
@Path("auth")
|
@Path("/auth")
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
public class AuthResource {
|
public class AuthResource {
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="JAVA_MODULE" version="4">
|
|
||||||
<component name="FacetManager">
|
|
||||||
<facet type="web" name="Web">
|
|
||||||
<configuration>
|
|
||||||
<descriptors>
|
|
||||||
<deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/webapp/WEB-INF/web.xml" />
|
|
||||||
</descriptors>
|
|
||||||
<webroots>
|
|
||||||
<root url="file://$MODULE_DIR$/webapp" relative="/" />
|
|
||||||
</webroots>
|
|
||||||
</configuration>
|
|
||||||
</facet>
|
|
||||||
</component>
|
|
||||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
||||||
<exclude-output />
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
Loading…
Reference in New Issue
Block a user