diff --git a/AstuteClient2/src/app/customer/customer.component.html b/AstuteClient2/src/app/customer/customer.component.html index 1367394..ff46bcf 100644 --- a/AstuteClient2/src/app/customer/customer.component.html +++ b/AstuteClient2/src/app/customer/customer.component.html @@ -22,18 +22,23 @@
-
- -
-
- -
-
- -
-
- +
+
+ + + + +
+ + + + + + + + +
@@ -319,19 +324,25 @@ > -
-
- -
-
- +
+
+
+ + +
+ + + + + +
diff --git a/AstuteClient2/src/app/invoice/invoice.component.html b/AstuteClient2/src/app/invoice/invoice.component.html index c3e4260..eaedb8f 100644 --- a/AstuteClient2/src/app/invoice/invoice.component.html +++ b/AstuteClient2/src/app/invoice/invoice.component.html @@ -23,42 +23,38 @@
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- - +
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
diff --git a/AstuteClient2/src/app/invoice/invoice.component.ts b/AstuteClient2/src/app/invoice/invoice.component.ts index 4da1c7c..72c67c0 100644 --- a/AstuteClient2/src/app/invoice/invoice.component.ts +++ b/AstuteClient2/src/app/invoice/invoice.component.ts @@ -16,40 +16,6 @@ export class InvoiceComponent implements OnInit { detailGridApi; detailColumnApi; - columnDefs = [ - {headerName: 'Customer', field: 'customerId'}, - {headerName: 'Invoice Number', field: 'invoiceNumber'}, - {headerName: 'Date', field: 'invoiceDate'}, - {headerName: 'Sales Order Number', field: 'poNum'}, - {headerName: 'Change Order Number', field: 'changeOrderNum'}, - {headerName: 'Outstanding Balance', field: 'outstandingBalanceString'}, - {headerName: 'Bill Amount', field: 'billAmtString'}, - {headerName: 'Notes', field: 'specialNotes', editable: true, cellEditor: 'agLargeTextCellEditor'} - ]; - gridOptions = { - rowClassRules: { - 'text-danger': function (params) { - return params.data.invoiceStatus === 1; - }, - 'text-primary': function (params) { - return params.data.invoiceStatus === 2; - }, - 'text-warning': function (params) { - return params.data.invoiceStatus === 3; - } - } - }; - detailColumnDefs = [ - {headerName: '#', field: 'lineItemNum'}, - {headerName: 'PO Detail', field: 'poDetailName'}, - {headerName: 'Description', field: 'desc', editable: true, cellEditor: 'agLargeTextCellEditor'}, - {headerName: 'Fee Type', field: 'rateTypeName'}, - {headerName: 'Service Type', field: 'serviceTypeName'}, - {headerName: 'Qty or Hours', field: 'qty', editable: true}, - {headerName: '(/Remaining)', field: 'remainingQty'}, - {headerName: 'Fee', field: 'fee', editable: true} - ]; - chosenCustomerID: any = 0; chosenInv: any = 0; source; @@ -75,6 +41,38 @@ export class InvoiceComponent implements OnInit { // poDetails = []; + columnDefs = [ + {headerName: 'Customer', field: 'customerId'}, + {headerName: 'Invoice Number', field: 'invoiceNumber'}, + {headerName: 'Date', field: 'invoiceDate'}, + {headerName: 'Sales Order Number', field: 'poNum'}, + {headerName: 'Change Order Number', field: 'changeOrderNum'}, + {headerName: 'Outstanding Balance', field: 'outstandingBalanceString'}, + {headerName: 'Bill Amount', field: 'billAmtString'}, + {headerName: 'Notes', field: 'specialNotes', + editable: (node => node.data.invoiceStatus === 1), cellEditor: 'agLargeTextCellEditor'} + ]; + gridOptions = { + rowClassRules: { + 'text-danger': (node => node.data.invoiceStatus === 1), + 'text-primary': (node => node.data.invoiceStatus === 2), + 'text-warning': (node => node.data.invoiceStatus === 3) + } + }; + detailColumnDefs = [ + {headerName: '#', field: 'lineItemNum'}, + {headerName: 'PO Detail', field: 'poDetailName'}, + {headerName: 'Description', field: 'desc', + editable: (_ => (this.chosenInv && this.chosenInv.invoiceStatus === 1)), cellEditor: 'agLargeTextCellEditor'}, + {headerName: 'Fee Type', field: 'rateTypeName'}, + {headerName: 'Service Type', field: 'serviceTypeName'}, + {headerName: 'Qty or Hours', field: 'qty', + editable: (_ => (this.chosenInv && this.chosenInv.invoiceStatus === 1))}, + {headerName: '(/Remaining)', field: 'remainingQty'}, + {headerName: 'Fee', field: 'fee', + editable: (_ => (this.chosenInv && this.chosenInv.invoiceStatus === 1))} + ]; + constructor(protected astuteClientService: AstuteClientService, @@ -84,11 +82,10 @@ export class InvoiceComponent implements OnInit { customerDropdownChange(index) { this.chosenCustomerID = this.customers[index].customerId; this.correspondingPos = this.pos.filter((po) => { - console.log(po); + // console.log(po); return po.customerId === this.chosenCustomerID && !po.oneInvInDraft && po.isFinal; }); } - poDropdownChange(ponum) { this.pos.forEach((po) => { if (po.ponum === ponum) { @@ -155,22 +152,26 @@ export class InvoiceComponent implements OnInit { 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); + if (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); + }); }); - }); + } else { + alert ('Get PO failed'); + } }, (reason) => { alert('Get SOs Failed: ' + reason); }); @@ -191,7 +192,6 @@ export class InvoiceComponent implements OnInit { } }); } - refreshDetailsOfSelected() { this.setSelectedRow(null); } @@ -233,11 +233,15 @@ export class InvoiceComponent implements OnInit { if (event) { this.chosenInv = event.data; } + const editable = (this.chosenInv && this.chosenInv.invoiceStatus === 1); + // this.detailColumnDefs[2].editable = editable; + // this.detailColumnDefs[5].editable = editable; + // this.detailColumnDefs[6].editable = editable; + this.selectedBillAmt = this.chosenInv.billAmt; this.selectedPODetails = this.allPODetails.filter((detail) => { return (detail.ponum === this.chosenInv.poNum); }); - this.selectedInDetails = null; this.selectedInDetails = this.astuteClientService.getInvoiceDetail(this.chosenInv.invoiceNumber).then((data) => { if (data) { data.forEach((invDetail) => { @@ -539,7 +543,6 @@ export class InvoiceComponent implements OnInit { // creates empty line item detail addEmptyDetail(poLineItemNum) { - console.log(this.chosenInv.invoiceNumber); const emptyData = { desc: '', fee: 0, @@ -564,9 +567,9 @@ export class InvoiceComponent implements OnInit { this.astuteClientService.createInvoiceDetail(emptyData).then((data) => { if (!data) { - this.refreshDetailsOfSelected(); alert('Creating SO detailed failed!'); } + this.refreshDetailsOfSelected(); }, (reason) => { alert('Creating SO detailed failed: ' + reason); }); diff --git a/AstuteClient2/src/app/sales-order/sales-order.component.html b/AstuteClient2/src/app/sales-order/sales-order.component.html index 598dc4c..b39232d 100644 --- a/AstuteClient2/src/app/sales-order/sales-order.component.html +++ b/AstuteClient2/src/app/sales-order/sales-order.component.html @@ -21,21 +21,27 @@
-
- -
-
- -
-
- -
-
- -
-
- +
+
+ + + + + +
+ + + + + + + + + + + +
diff --git a/AstuteClient2/src/app/sales-order/sales-order.component.ts b/AstuteClient2/src/app/sales-order/sales-order.component.ts index 962ca39..7ed090f 100644 --- a/AstuteClient2/src/app/sales-order/sales-order.component.ts +++ b/AstuteClient2/src/app/sales-order/sales-order.component.ts @@ -24,17 +24,17 @@ export class SalesOrderComponent implements OnInit { // data for SO grid rowData: any; columnDefs = [ - {headerName: 'Project Number', field: 'astuteProjectNumber', editable: true}, + {headerName: 'Project Number', field: 'astuteProjectNumber', editable: (node => !node.data.isFinal)}, {headerName: 'SO Number', field: 'ponum'}, // {headerName: 'Customer ID', field: 'customerId'}, {headerName: 'Customer Name', field: 'customerName'}, - {headerName: 'Contract Number', field: 'contractNum', editable: true}, - {headerName: 'SO Title', field: 'title', editable: true}, + {headerName: 'Contract Number', field: 'contractNum', editable: (node => !node.data.isFinal)}, + {headerName: 'SO Title', field: 'title', editable: (node => !node.data.isFinal)}, {headerName: 'Contract Amount', field: 'contractAmtString'}, // {headerName: 'Contract Amount', field: 'contractAmt'}, - {headerName: 'SO Date', field: 'podate', editable: true}, + {headerName: 'SO Date', field: 'podate', editable: (node => !node.data.isFinal)}, {headerName: '# of Invoice', field: 'invoiceSequence'}, - {headerName: 'notes', field: 'notes', editable: true, cellEditor: 'agLargeTextCellEditor'} + {headerName: 'notes', field: 'notes', editable: (node => !node.data.isFinal), cellEditor: 'agLargeTextCellEditor'} // {headerName: 'oneInvInDraft', field: 'oneInvInDraft'} ]; gridOptions = { @@ -53,13 +53,13 @@ export class SalesOrderComponent implements OnInit { selectedPODetail; detailColumnDefs = [ {headerName: '#', field: 'lineItemNo'}, - {headerName: 'Description', field: 'serviceDesc', editable: true}, - {headerName: 'Rate Type', field: 'rateTypeName', editable: true, + {headerName: 'Description', field: 'serviceDesc', editable: (_ => (this.selected && !this.selected.isFinal))}, + {headerName: 'Rate Type', field: 'rateTypeName', editable: (_ => (this.selected && !this.selected.isFinal)), cellEditor: 'agSelectCellEditor', cellEditorParams: {values: this.rateNames}}, - {headerName: 'Service Type', field: 'serviceTypeName', editable: true, + {headerName: 'Service Type', field: 'serviceTypeName', editable: (_ => (this.selected && !this.selected.isFinal)), cellEditor: 'agSelectCellEditor', cellEditorParams: {values: this.serviceNames}}, - {headerName: 'Qty or Hours', field: 'qty', editable: true}, - {headerName: 'Rate ($)', field: 'fee', editable: true} + {headerName: 'Qty or Hours', field: 'qty', editable: (_ => (this.selected && !this.selected.isFinal))}, + {headerName: 'Rate ($)', field: 'fee', editable: (_ => (this.selected && !this.selected.isFinal))} ]; contractAmount = 0; // used to show total amount