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 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
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 @@