somethings

This commit is contained in:
Akash Shah 2019-06-20 17:51:21 -04:00
parent 91e41b501e
commit ae681d0a8d
5 changed files with 152 additions and 136 deletions

View File

@ -22,18 +22,23 @@
</div>
</div>
<div class="row justify-content-center mt-2">
<div class="col-3">
<button class="btn btn-success" style="width: 100%" (click)="open(new)">Add Customer</button>
</div>
<div class="col-3">
<button class="btn btn-info" style="width: 100%" (click)="open(edit)" [disabled]="!selected">Edit Customer</button>
</div>
<div class="col-3">
<button class="btn btn-primary" style="width: 100%" (click)="open(contacts)" [disabled]="!selected">Contact Book</button>
</div>
<div class="col-3">
<button class="btn btn-danger" style="width: 100%" (click)="deleteCustomer(selected.customerId)" [disabled]="!selected">Delete Customer</button>
<div class="col">
<div class="btn-group w-100">
<button class="btn btn-success" style="width: 100%" (click)="open(new)">Add Customer</button>
<button class="btn btn-info" style="width: 100%" (click)="open(edit)" [disabled]="!selected">Edit Customer</button>
<button class="btn btn-primary" style="width: 100%" (click)="open(contacts)" [disabled]="!selected">Contact Book</button>
<button class="btn btn-danger" style="width: 100%" (click)="deleteCustomer(selected.customerId)" [disabled]="!selected">Delete Customer</button>
</div>
</div>
<!--<div class="col">-->
<!--<button class="btn btn-info" style="width: 100%" (click)="open(edit)" [disabled]="!selected">Edit Customer</button>-->
<!--</div>-->
<!--<div class="col">-->
<!--<button class="btn btn-primary" style="width: 100%" (click)="open(contacts)" [disabled]="!selected">Contact Book</button>-->
<!--</div>-->
<!--<div class="col-3">-->
<!--<button class="btn btn-danger" style="width: 100%" (click)="deleteCustomer(selected.customerId)" [disabled]="!selected">Delete Customer</button>-->
<!--</div>-->
</div>
</div>
@ -319,19 +324,25 @@
></ag-grid-angular>
</div>
</div>
<div class="row">
<div class="col-6">
<button class="btn btn-primary btn-sm w-100 mt-2 mb-2" type="button"
(click)="createEmptyContact()">
Add Contact
</button>
</div>
<div class="col-6">
<button class="btn btn-danger btn-sm w-100 mt-2 mb-2" type="button"
(click)="deleteContact()">
Delete Contact
</button>
<div class="row justify-content-center mt-2">
<div class="col">
<div class="btn-group w-100">
<button class="btn btn-success btn-sm w-100 mt-2 mb-2" type="button"
(click)="createEmptyContact()">
Add
</button>
<button class="btn btn-danger btn-sm w-100 mt-2 mb-2" type="button"
(click)="deleteContact()">
Delete
</button>
</div>
</div>
<!--<div class="col">-->
<!--<button class="btn btn-danger btn-sm w-100 mt-2 mb-2" type="button"-->
<!--(click)="deleteContact()">-->
<!--Delete-->
<!--</button>-->
<!--</div>-->
</div>
</div>

View File

@ -23,42 +23,38 @@
<!--Buttons-->
<div class="row justify-content-center mt-2">
<div class="col-2">
<button class="btn btn-success" style="width: 100%" (click)="open(new)">
Add
</button>
</div>
<div class="col-2">
<button class="btn btn-info" style="width: 100%" (click)="open(edit)" [disabled]="!chosenInv">
Edit
</button>
</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">
<button class="btn btn-primary" style="width: 100%" (click)="submitInvoice(chosenInv.invoiceNumber)" [disabled]="!(chosenInv && chosenInv.invoiceStatus === 1)">
Submit
</button>
</div>
<div class="col-2">
<button class="btn btn-danger" style="width: 100%" (click)="deleteInvoice(chosenInv.invoiceNumber)" [disabled]="!(chosenInv && chosenInv.invoiceStatus === 1)">
Delete
</button>
</div>
<div class="col-2">
<button class="btn btn-warning" style="width: 100%" (click)="voidInvoice(chosenInv.invoiceNumber)" [disabled]="!(chosenInv && chosenInv.invoiceStatus === 2)">
Void
</button>
</div>
<div class="col-2">
<!--<button class="btn btn-light" style="width: 100%" (click)="assignActity()" [disabled]="!chosenInv">-->
<button class="btn btn-light" style="width: 100%" (click)="printInvoice()" [disabled]="!(chosenInv)">
Print
</button>
<div class="col">
<div class="btn-group w-100">
<button class="btn btn-success" style="width: 100%" (click)="open(new)">Add</button>
<button class="btn btn-info" style="width: 100%" (click)="open(edit)" [disabled]="!chosenInv || chosenInv.invoiceStatus !== 1">Edit</button>
<button class="btn btn-secondary" style="width: 100%" (click)="open(details)" [disabled]="!chosenInv">Details</button>
<button class="btn btn-primary" style="width: 100%" (click)="submitInvoice(chosenInv.invoiceNumber)" [disabled]="!(chosenInv && chosenInv.invoiceStatus === 1)">Submit</button>
<button class="btn btn-warning" style="width: 100%" (click)="voidInvoice(chosenInv.invoiceNumber)" [disabled]="!(chosenInv && chosenInv.invoiceStatus === 2)">Void</button>
<button class="btn btn-danger" style="width: 100%" (click)="deleteInvoice(chosenInv.invoiceNumber)" [disabled]="!(chosenInv && chosenInv.invoiceStatus === 1)">Delete</button>
<button class="btn btn-light" style="width: 100%" (click)="printInvoice()" [disabled]="!(chosenInv)">Print</button>
</div>
</div>
<!--<div class="col">-->
<!--<button class="btn btn-success" style="width: 100%" (click)="open(new)">Add</button>-->
<!--</div>-->
<!--<div class="col">-->
<!--<button class="btn btn-info" style="width: 100%" (click)="open(edit)" [disabled]="!chosenInv">Edit</button>-->
<!--</div>-->
<!--<div class="col">-->
<!--<button class="btn btn-secondary" style="width: 100%" (click)="open(details)" [disabled]="!chosenInv">Details</button>-->
<!--</div>-->
<!--<div class="col">-->
<!--<button class="btn btn-primary" style="width: 100%" (click)="submitInvoice(chosenInv.invoiceNumber)" [disabled]="!(chosenInv && chosenInv.invoiceStatus === 1)">Submit</button>-->
<!--</div>-->
<!--<div class="col">-->
<!--<button class="btn btn-danger" style="width: 100%" (click)="deleteInvoice(chosenInv.invoiceNumber)" [disabled]="!(chosenInv && chosenInv.invoiceStatus === 1)">Delete</button>-->
<!--</div>-->
<!--<div class="col">-->
<!--<button class="btn btn-warning" style="width: 100%" (click)="voidInvoice(chosenInv.invoiceNumber)" [disabled]="!(chosenInv && chosenInv.invoiceStatus === 2)">Void</button>-->
<!--</div>-->
<!--<div class="col">-->
<!--<button class="btn btn-light" style="width: 100%" (click)="printInvoice()" [disabled]="!(chosenInv)">Print</button>-->
<!--</div>-->
</div>
</div>

View File

@ -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);
});

View File

@ -21,21 +21,27 @@
</div>
</div>
<div class="row justify-content-center mt-2">
<div class="col-2">
<button class="btn btn-success" style="width: 100%" (click)="open(new)">Add</button>
</div>
<div class="col-2">
<button class="btn btn-info" style="width: 100%" (click)="open(edit)">Edit</button>
</div>
<div class="col-2">
<button class="btn btn-primary" style="width: 100%" (click)="open(editDetails)" [disabled]="!selected">Details</button>
</div>
<div class="col-2">
<button class="btn btn-success" style="width: 100%" (click)="finalizePO(selected.ponum)" [disabled]="!selected?true:selected.final === 1">Finalize</button>
</div>
<div class="col-2">
<button class="btn btn-danger" style="width: 100%" (click)="deletePO(selected.ponum)" [disabled]="!selected?true:selected.final === 0">Delete</button>
<div class="col">
<div class="btn-group w-100">
<button class="btn btn-success" style="width: 100%" (click)="open(new)">Add</button>
<button class="btn btn-info" style="width: 100%" (click)="open(edit)" [disabled]="!selected || selected.isFinal">Edit</button>
<button class="btn btn-secondary" style="width: 100%" (click)="open(editDetails)" [disabled]="!selected">Details</button>
<button class="btn btn-primary" style="width: 100%" (click)="finalizePO(selected.ponum)" [disabled]="!selected || selected.isFinal">Finalize</button>
<button class="btn btn-danger" style="width: 100%" (click)="deletePO(selected.ponum)" [disabled]="!selected || selected.invoiceSequence > 0">Delete</button>
</div>
</div>
<!--<div class="col">-->
<!--<button class="btn btn-info" style="width: 100%" (click)="open(edit)">Edit</button>-->
<!--</div>-->
<!--<div class="col">-->
<!--<button class="btn btn-secondary" style="width: 100%" (click)="open(editDetails)" [disabled]="!selected">Details</button>-->
<!--</div>-->
<!--<div class="col">-->
<!--<button class="btn btn-primary" style="width: 100%" (click)="finalizePO(selected.ponum)" [disabled]="!selected?true:selected.final === 1">Finalize</button>-->
<!--</div>-->
<!--<div class="col">-->
<!--<button class="btn btn-danger" style="width: 100%" (click)="deletePO(selected.ponum)" [disabled]="!selected?true:selected.final === 0">Delete</button>-->
<!--</div>-->
</div>
</div>

View File

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