Fixed defects.

This commit is contained in:
gopi17701 2019-01-10 10:44:56 -05:00
parent 54bf16b42d
commit d76671f0ca
17 changed files with 3972 additions and 3811 deletions

View File

@ -1,5 +1,6 @@
<app-nav-bar [customerActive]="true"></app-nav-bar>
<h1 align="center">Customers</h1>
<div class="container-fluid">
<div class="row">
<div class="col-12">
@ -12,6 +13,7 @@
[rowData]="rowData | async"
[columnDefs]="columnDefs"
rowSelection="single"
rowDeselection="true"
></ag-grid-angular>
</div>
</div>
@ -139,7 +141,7 @@
<button class="btn btn-success" type="button"
[disabled]="!(inId.value && inName.value && inBillToDept.value && inAdd1.value && inCity.value && inState.value && inZIP.value && inEmail.value && inPhone.value && inFax.value)"
(click)="addCustomer(inId.value, inName.value, inBillToDept.value, inAdd1.value, inAdd2.value, inCity.value, inState.value, inZIP.value, inZIP4.value, inEmail.value, inPhone.value, inFax.value, new)">
+
Add
</button>
<button type="button" class="btn btn-danger" (click)="close(new)">Cancel</button>
</div>

View File

@ -0,0 +1 @@
/* Empty file */

View File

@ -50,8 +50,8 @@
<td style="width: 10%">
<span class="input-group-text">Payment Received*</span>
</td>
<td colspan="7">
<input type="text" class="form-control" placeholder="$00.00" #inPaymentReceived>
<td class="p-0 m-0" colspan="7">
<input type="text" class="form-control cell" [value]="0 | currency" #inPaymentReceived>
</td>
</tr>
@ -78,6 +78,15 @@
</td>
</tr>
<tr>
<td style="width: 10%">
<span class="input-group-text">Check# / ACH transaction#*</span>
</td>
<td colspan="7">
<input type="text" class="form-control" #incheckTransactionNo>
</td>
</tr>
</tbody>
</table>
</div>
@ -85,8 +94,9 @@
<div class="modal-footer">
<button class="btn btn-success" type="button"
[disabled]="!(chosenInv && inPaymentReceived.value && chosenPaymentType && inDateReceived.value)"
(click)="addInvoicePayment(chosenInv, null, chosenPaymentType, null, inDateReceived.value, inPaymentReceived.value, new)">
+
(click)="addInvoicePayment(chosenInv, null, chosenPaymentType, inDateReceived.value, inPaymentReceived.value.replace('$', '').replace(',', ''), incheckTransactionNo.value,new)">
<!--(click)="addInvoicePayment(chosenInv, null, chosenPaymentType, null, inDateReceived.value, inPaymentReceived.value, new)">-->
Add
</button>
<!--<input type="reset" (click)="close(new)">Cancel-->
<button type="reset" class="btn btn-danger" (click)="close(new)">Cancel</button>
@ -118,6 +128,21 @@
</td>
</tr>
<tr>
<td style="width: 10%">
<span class="input-group-text">Payment Type*</span>
</td>
<td>
<input type="text" class="form-control" #paymentTypeSelect [value]="paymentTypes[selected.paymentTypeId-1].paymentTypeName">
<!--<select class="custom-select" [value]={{paymentTypes[selected.paymentTypeId-1].paymentTypeName}} (change)="paymentTypeDropdownChange(paymentTypeSelect.value)"-->
<!--#paymentTypeSelect>-->
<!--<option *ngFor="let paymentType of paymentTypes; let i = index;" [value]="i">{{paymentType.paymentTypeName}}-->
<!--&lt;!&ndash;{{paymentTypes[selected.paymentTypeId-1].paymentTypeName}}}&ndash;&gt;-->
<!--</option>-->
<!--</select>-->
</td>
</tr>
<tr>
<td style="width: 10%">
<span class="input-group-text">Date Received*</span>
@ -126,13 +151,23 @@
<input type="date" class="form-control" #inDateReceived [value]="selected.paymentDate">
</td>
</tr>
<tr>
<td style="width: 10%">
<span class="input-group-text">Check# / ACH transaction#*</span>
</td>
<td colspan="7">
<input type="text" class="form-control" #incheckTransactionNo [value]="selected.checkTransactionNo">
</td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button class="btn btn-warning" type="button"
[disabled]="!(invoiceSelect.value && inPaymentReceived.value && inDateReceived.value)"
(click)="updateInvoicePayment(invoiceSelect.value, selected.invoicePaymentId, selected.paymentTypeId, selected.paymentType, inDateReceived.value, inPaymentReceived.value, edit)">
[disabled]="!(invoiceSelect.value && inPaymentReceived.value && inDateReceived.value && incheckTransactionNo)"
(click)="updateInvoicePayment(invoiceSelect.value, selected.invoicePaymentId, selected.paymentTypeId, inDateReceived.value, inPaymentReceived.value.substr(1).replace(',', ''), incheckTransactionNo.value, edit)">
Update
</button>
<button type="button" class="btn btn-danger" (click)="close(edit)">Cancel</button>

View File

@ -21,7 +21,9 @@ export class InvoicePaymentComponent implements OnInit {
{headerName: 'Invoice Number', field: 'invoiceNum'},
{headerName: 'Payment Received', field: 'invoiceAmount'},
{headerName: 'Date Received', field: 'paymentDate'},
{headerName: 'Payment Type', field: 'paymentType'}
{headerName: 'Payment Type', field: 'paymentType'},
{headerName: 'Check / ACH Transaction #', field: 'checkTransactionNo'}
];
constructor(protected astuteClientService: AstuteClientService) {
@ -48,14 +50,14 @@ export class InvoicePaymentComponent implements OnInit {
}
}
addInvoicePayment(invoiceNum, invoicePaymentId, paymentTypeId, paymentType, paymentDate, paymentReceived, ref) {
addInvoicePayment(invoiceNum, invoicePaymentId, paymentTypeId, paymentDate, paymentReceived, checkTransactionNo, ref) {
let invoicePaymentData = {
"invoiceNum": invoiceNum,
"invoicePaymentId":invoicePaymentId,
"paymentTypeId":paymentTypeId,
"paymentType": paymentType,
"paymentDate": paymentDate,
"invoiceAmount": paymentReceived
"invoiceAmount": paymentReceived,
"checkTransactionNo": checkTransactionNo
};
this.astuteClientService.addInvoicePayment(invoicePaymentData).then((data) => {
if (data) {
@ -69,14 +71,14 @@ export class InvoicePaymentComponent implements OnInit {
});
}
updateInvoicePayment(invoiceNum, invoicePaymentId, paymentTypeId, paymentType, dateReceived, paymentReceived, ref) {
updateInvoicePayment(invoiceNum, invoicePaymentId, paymentTypeId, dateReceived, paymentReceived, checkTransactionNo, ref) {
const invoicePaymentData = {
"invoiceNum": invoiceNum,
"invoicePaymentId": invoicePaymentId,
"paymentTypeId": paymentTypeId,
"paymentType": paymentType,
"paymentDate": dateReceived,
"invoiceAmount": paymentReceived
"invoiceAmount": paymentReceived,
"checkTransactionNo": checkTransactionNo
};
this.astuteClientService.updateInvoicePayment(invoiceNum, invoicePaymentId, invoicePaymentData).then((data) => {

View File

@ -21,11 +21,6 @@
<!--Buttons-->
<div class="row justify-content-center mt-2">
<div class="col-2">
<button class="btn btn-light" style="width: 100%" (click)="assignActity()" [disabled]="!chosenInv">
Print
</button>
</div>
<div class="col-2">
<button class="btn btn-primary" style="width: 100%" (click)="submitInvoice(chosenInv.invoiceNumber)" [disabled]="!(chosenInv && chosenInv.invoiceStatus === 1)">
Submit
@ -42,15 +37,21 @@
</button>
</div>
<div class="col-2">
<button class="btn btn-info" style="width: 100%" (click)="open(edit)" [disabled]="!chosenInv">
<button class="btn btn-info" style="width: 100%" (click)="open(edit,null,null)" [disabled]="!chosenInv">
Edit
</button>
</div>
<div class="col-2">
<button class="btn btn-success" style="width: 100%" (click)="open(new)">
<button class="btn btn-success" style="width: 100%" (click)="open(new,null,null)">
Add
</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)="assignActity()" disabled>
Print
</button>
</div>
</div>
</div>
@ -67,13 +68,14 @@
<span class="input-group-text">Customer </span>
</td>
<td>
<select class="custom-select" (change)="customerDropdownChange(customerSelec.value)"
#customerSelec disabled>
<!--[value]="chosenInv.customerName"-->
<option [value]="-1">Choose Customer...</option>
<option *ngFor="let customer of customers; let i = index;" [value]="i">{{customer.customerName}}
</option>
</select>
<input type="text" class="form-control" [value]=chosenInv.customerId disabled>
<!--<select class="custom-select" (change)="customerDropdownChange(chosenInv.customerId)"-->
<!--#customerSelec disabled>-->
<!--[value]="chosenInv.customerId"-->
<!--<option [value]="-1">Choose Customer...</option>-->
<!--<option *ngFor="let customer of customers; let i = index;" [value]="i">{{customer.customerName}}-->
<!--</option>-->
<!--</select>-->
</td>
<td style="width: 5%"></td>
<td style="width: 10%">
@ -128,10 +130,11 @@
<span class="input-group-text">Payment Status*</span>
</td>
<td>
<select class="custom-select" [value]="chosenInv.pmtStatus" #pmtStatusIn>
<option value=0>Not Paid</option>
<option value=1>Paid</option>
</select>
<input type="text" class="form-control" [value]=chosenInv.pmtStatusDesc disabled>
<!--<select class="custom-select" [value]="chosenInv.pmtStatus" #pmtStatusIn disabled>-->
<!--<option value="Outstanding">"Outstanding"</option>-->
<!--<option value="Paid">"Paid"</option>-->
<!--</select>-->
</td>
</tr>
</tbody>
@ -156,7 +159,7 @@
<!--<span class="input-group-text">Payment Status*</span>-->
<!--</div>-->
<!--<select class="custom-select" [value]="chosenInv.pmtStatus" #pmtStatusIn>-->
<!--<option value=0>Not Paid</option>-->
<!--<option value=0>Outstanding</option>-->
<!--<option value=1>Paid</option>-->
<!--</select>-->
<!--</div>-->
@ -189,31 +192,31 @@
</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>
<!--(change)="onSelectedCellChange(i, 'fee', fee.value); updateSelectedBillAmt()" -->
<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" *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">-->
<!--&lt;!&ndash;INV Detail Items: invoiceNum, lineItemNum, poLineItemNum, serviceTypeId, desc, qty, fee&ndash;&gt;-->
<!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="inDet.lineItemNum" disabled>-->
@ -246,22 +249,42 @@
<!--</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">
<select class="custom-select"
(change)="pushOntoSelectedDetail(inNumIn.value, newInDetails.length + 1, selectedPODetails[poDetSelec.value].lineItemNo,
selectedPODetails[poDetSelec.value].feeTypeId, selectedPODetails[poDetSelec.value].serviceTypeId,
selectedPODetails[poDetSelec.value].serviceDesc, 1, 0, selectedPODetails[poDetSelec.value].remainingQty)"
[disabled]="!selectedPODetails.length && chosenInv.invoiceStatus !== 1"
#poDetSelec>
<option>Choose PO Detail...</option>
<option *ngFor="let po of selectedPODetails; let i = index;" [value]="i">{{po.serviceDesc}}
</option>
</select>
</td>
</tr>
<!--<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].serviceTypeId,-->
<!--selectedPODetails[poDetSelec.value].serviceDesc, 1, 0, selectedPODetails[poDetSelec.value].remainingQty)"-->
<!--[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">
@ -357,13 +380,17 @@
</div>
<!--Modal Footer-->
<div class="modal-footer">
<div class="modal-footer" >
<p *ngIf="chosenInv.invoiceStatus == 1">
<button type="button" class="btn btn-success"
(click)="editInvoice(inNumIn.value, poNumIn.value, coNumIn.value, pmtStatusIn.value, notesIn.value, certIn.value)"
[disabled]="!(inNumIn.value && poNumIn.value && pmtStatusIn.value && notesIn.value && certIn.value)">
(click)="editInvoice(inNumIn.value, poNumIn.value, coNumIn.value, pmtStatusIn.value, notesIn.value, certIn.value)">
<!--[disabled]="(chosenInv.invoiceStatus !== 1)">-->
Confirm
</button>
</p>
<p>
<button type="button" class="btn btn-danger" (click)="close(edit)">Cancel</button>
</p>
</div>
</app-modal-form>
@ -403,7 +430,7 @@
<tr>
<td colspan="2">
<p *ngIf="customerSelec.value >= 0" class="p-0 m-0 mt-2">
To, {{customers[customerSelec.value].billToDept}}
{{customers[customerSelec.value].billToDept}}
</p>
</td>
<td></td>
@ -431,7 +458,8 @@
<tr>
<td colspan="2">
<p *ngIf="customerSelec.value >= 0" class="p-0 m-0 mt-2">
{{customers[customerSelec.value].city}} {{customers[customerSelec.value].state}} {{customers[customerSelec.value].zip}}-{{customers[customerSelec.value].ziplast4}}
{{customers[customerSelec.value].city}} {{customers[customerSelec.value].state}} {{customers[customerSelec.value].zip}}
<!-- -{{customers[customerSelec.value].ziplast4}}-->
</p>
</td>
<td></td>
@ -439,9 +467,11 @@
<span class="input-group-text">Payment Status*</span>
</td>
<td>
<select class="custom-select" #pmtStatusIn>
<option value=0>Not Paid</option>
<option value=1>Paid</option>
<!--<input type="text" value="Outstanding" class="form-control" #pmtStatusIn disabled>-->
<select class="custom-select" #pmtStatusIn disabled>
<option value="1">Outstanding</option>
<!--&lt;!&ndash;<option value=2>Paid</option>&ndash;&gt;-->
</select>
</td>
</tr>
@ -479,15 +509,15 @@
</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>
<!--(change)="onNewCellChange(i, 'fee', fee.value.substr(1)); updateNewBillAmt();" -->
<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">
<tr class="p-0 m-0" *ngIf="inDet.poLineItemNum !== -1">
<th class="align-content-center">
<p>{{getPerc(qty.value, inDet.remainingQty)}}%</p>
</th>
@ -495,15 +525,20 @@
<div class="progress" style="height: 25px;">
<div class="progress-bar bg-success" role="progressbar"
[ngStyle]="{'width': getPerc(qty.value, inDet.remainingQty) + '%'}">
{{qty.value}}
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)) + '%'}">
{{inDet.remainingQty - (qty.value)}}
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>
@ -515,12 +550,28 @@
poNumIn.value)"
[disabled]="!poDetails.length"
#poDetSelec>
<option>Choose PO Detail...</option>
<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>
@ -606,7 +657,7 @@
<div class="modal-footer">
<button type="button" class="btn btn-success"
(click)="addInvoice(inNumIn.value, poNumIn.value, coNumIn.value, pmtStatusIn.value, newBillAmt, notesIn.value, certIn.value, 1, new)"
[disabled]="!(inNumIn.value && poNumIn.value && pmtStatusIn.value && newBillAmt && notesIn.value && certIn.value)">
[disabled]="!(inNumIn.value && poNumIn.value && newBillAmt && notesIn.value && certIn.value)">
Confirm
</button>
<button type="reset" class="btn btn-danger" (click)="close(new)">Cancel</button>

View File

@ -26,7 +26,7 @@ export class InvoiceComponent implements OnInit {
{headerName: 'Date', field: 'invoiceDate'},
{headerName: 'Sales Order Number', field: 'poNum'},
{headerName: 'Change Order Number', field: 'changeOrderNum'},
{headerName: 'Paid', field: 'pmtStatus'},
{headerName: 'Payment', field: 'pmtStatusDesc'},
{headerName: 'Bll Amount', field: 'billAmt'}
];
newInDetails = [];
@ -455,6 +455,7 @@ export class InvoiceComponent implements OnInit {
}
voidInvoice(invoiceNumber) {
if (confirm('Are you sure you want to void invoice, ' + invoiceNumber)) {
this.astuteClientService.voidInvoice(invoiceNumber).then((data) => {
if (data) {
this.refreshData();
@ -463,6 +464,7 @@ export class InvoiceComponent implements OnInit {
}
});
}
}
submitInvoice(invoiceNumber) {
this.astuteClientService.submitInvoice(invoiceNumber).then((data) => {

View File

@ -161,7 +161,7 @@
<div class="modal-footer">
<button class="btn btn-success" type="button"
[disabled]="!(ponum.value && podate.value && customerid.value && contractnum.value && contractamt.value)"
[disabled]="!(ponum.value && podate.value && customerid.value && contractnum.value && contractamt.value && projNum.value)"
(click)="addPo(projNum.value, ponum.value, podate.value, customerid.value, contractnum.value, contractamt.value.replace('$', '').replace(',', ''), title.value, new)"
>
Add
@ -282,8 +282,8 @@
<th scope="col">Description</th>
<th scope="col">Rate Type</th>
<th scope="col">Service Type</th>
<th scope="col" style="width: 75px">Qty(#)</th>
<th scope="col" style="width: 100px">Rate($)</th>
<th scope="col" style="width: 75px">Quantity</th>
<th scope="col" style="width: 100px">Rate</th>
<!--<th scope="col">Remaining Quantity</th>-->
</tr>
</thead>
@ -320,7 +320,7 @@
<!--<input type="number" class="form-control cell" [value]="poDetail.serviceTypeId" #serviceTypeId>-->
</td>
<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="+poDetail.qty" (change)="onSelectedCellChange(i, 'qty', qty.value); onSelectedCellChange(i, 'remainingQty', qty.value * fee.value); updateEditContractAmt();" #qty></td>
<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="+poDetail.fee" (change)="onSelectedCellChange(i, 'fee', fee.value); onSelectedCellChange(i, 'remainingQty', qty.value * fee.value); updateEditContractAmt();" #fee></td>
<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="+poDetail.fee | currency" (change)="onSelectedCellChange(i, 'fee', fee.value); onSelectedCellChange(i, 'remainingQty', qty.value * fee.value); updateEditContractAmt();" #fee></td>
<!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="poDetail.remainingQty" [id]="'remainingQty' + i"></td>-->
</tr>
</tbody>
@ -357,7 +357,7 @@
<div class="modal-footer">
<button class="btn btn-success" type="button"
[disabled]="!(ponum.value && podate.value && contractnum.value && contractamt.value)"
[disabled]="!(ponum.value && podate.value && contractnum.value && contractamt.value && projNum.value)"
(click)="editPo(projNum.value, ponum.value, podate.value, contractnum.value, contractamt.value.replace(',', '').replace('$', ''), title.value, edit)"
>
Update

View File

@ -17,7 +17,6 @@
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />

View File

@ -1,6 +0,0 @@
database=sql
host=localhost
port=3306
username=root
password=password
schema=astute

View File

@ -2,7 +2,7 @@
-- Host: 127.0.0.1
-- Server version: 5.7.12-log - MySQL Community Server (GPL)
-- Server OS: Win64
-- HeidiSQL Version: 9.4.0.5125
-- HeidiSQL Version: 9.5.0.5196
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
@ -49,7 +49,7 @@ DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `create_invoice`(invNo varchar(20),invDate date,PONo varchar(20),paymentStatus int,billAmt double,specialNotes varchar(500), certClause Varchar(500), invoiceStatus int)
BEGIN
INSERT INTO invoice (inv_no,inv_date,PO_num,pmt_status,bill_amt,special_notes,certification,inv_status)
VALUES (invNo, invDate, PONo, paymentStatus, billAmt, specialNotes, certClause, invoiceStatus);
VALUES (invNo, invDate, PONo, 1, billAmt, specialNotes, certClause, invoiceStatus);
END//
DELIMITER ;
@ -99,9 +99,10 @@ CREATE TABLE IF NOT EXISTS `customer` (
PRIMARY KEY (`customer_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping data for table astute.customer: ~0 rows (approximately)
-- Dumping data for table astute.customer: ~1 rows (approximately)
/*!40000 ALTER TABLE `customer` DISABLE KEYS */;
INSERT INTO `customer` (`customer_id`, `customer_name`, `bill_to_dept`, `add1`, `add2`, `city`, `state`, `zip`, `zip_last_4`, `email`, `phone`, `fax`) VALUES
('MDOT', 'Maryland Department of Transportation', 'Billing Department', '123123 Test Drive', '104', 'Germantown', 'MD', 20874, 0, 'Test@MDOT.gov', '(123) 123-1233', '(121) 231-233'),
('VDOT', 'Virginia Depart of Transportation', 'Billing Department', '13134 Saturn Drive', 'Unit 100', 'McLean', 'VA', 22043, 0, 'Billing@vdot.gov', '(703) 122-1234', '(703) 122-1212');
/*!40000 ALTER TABLE `customer` ENABLE KEYS */;
@ -180,7 +181,7 @@ INSERT INTO `fee_type` (`fee_type_id`, `fee_type_desc`) VALUES
DELIMITER //
CREATE DEFINER=`root`@`localhost` FUNCTION `generate_final_inv_number`(po_num_in varchar(20)) RETURNS varchar(40) CHARSET utf8
BEGIN
DECLARE customer_id_in int;
DECLARE customer_id_in varchar(10);
DECLARE customer_code varchar(4);
DECLARE po_count int;
DECLARE inv_count int;
@ -191,10 +192,7 @@ BEGIN
FROM po
WHERE po.po_num = po_num_in;
SELECT substr(customer.customer_id, 1, 3)
INTO customer_code
FROM customer
WHERE customer_id = customer_id_in;
SELECT substr(customer_id_in, 1, 3) INTO customer_code;
SELECT po_id
INTO po_count
@ -248,6 +246,26 @@ BEGIN
END//
DELIMITER ;
-- Dumping structure for function astute.get_customer_from_po
DELIMITER //
CREATE DEFINER=`root`@`localhost` FUNCTION `get_customer_from_po`(ponum varchar(20)) RETURNS varchar(20) CHARSET utf8
BEGIN
declare customer_id_out varchar(20);
SELECT customer_id INTO customer_id_out FROM po WHERE po_num = ponum;
return customer_id_out;
END//
DELIMITER ;
-- Dumping structure for function astute.get_payment_status_name
DELIMITER //
CREATE DEFINER=`root`@`localhost` FUNCTION `get_payment_status_name`(pmt_status int) RETURNS varchar(20) CHARSET utf8
BEGIN
declare payment_status_name VARCHAR(20);
SELECT payment_status_desc INTO payment_status_name FROM payment_status WHERE payment_status_id = pmt_status;
return payment_status_name;
END//
DELIMITER ;
-- Dumping structure for function astute.get_payment_type
DELIMITER //
CREATE DEFINER=`root`@`localhost` FUNCTION `get_payment_type`(pmt_type int) RETURNS varchar(20) CHARSET utf8
@ -263,7 +281,7 @@ DELIMITER //
CREATE DEFINER=`root`@`localhost` FUNCTION `get_previously_billed_amt`(po_no varchar(20)) RETURNS double(10,2)
BEGIN
declare billed_amt double(10,2);
SELECT sum(bill_amt) INTO billed_amt FROM invoice WHERE invoice.PO_num = po_no;
SELECT sum(bill_amt) INTO billed_amt FROM invoice WHERE invoice.PO_num = po_no and inv_status <> 3;
return billed_amt;
END//
DELIMITER ;
@ -283,11 +301,12 @@ CREATE TABLE IF NOT EXISTS `invoice` (
CONSTRAINT `fk_InvMaster_POnum` FOREIGN KEY (`PO_num`) REFERENCES `po` (`PO_num`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping data for table astute.invoice: ~2 rows (approximately)
-- Dumping data for table astute.invoice: ~3 rows (approximately)
/*!40000 ALTER TABLE `invoice` DISABLE KEYS */;
INSERT INTO `invoice` (`inv_no`, `inv_date`, `PO_num`, `bill_amt`, `special_notes`, `certification`, `inv_status`, `pmt_status`) VALUES
('VDO-01_0927_1', '2018-09-23', 'VDOT-54321', 5000, 'First invoice', 'Certified that the above items and rates are in accordance with the contractual agreement as verified by the undersigned', 2, 0),
('VDO-02_DRAFT_392', '2018-09-23', 'ABC-123', 500, 'First Invoice', 'Certified that the above items and rates are in accordance with the contractual agreement as verified by the undersigned', 1, 0);
('MDO-01_0108_1', '2019-01-08', 'MDOT-123', 30250, 'Test', 'Certified that the above items and rates are in accordance with the contractual agreement as verified by the undersigned', 3, 1),
('VDO-02_0107_2', '2019-01-07', 'ABC-123', 1450, 'Test', 'Certified that the above items and rates are in accordance with the contractual agreement as verified by the undersigned', 3, 1),
('VDO-02_0108_3', '2019-01-08', 'ABC-123', 5250, 'Test', 'Certified that the above items and rates are in accordance with the contractual agreement as verified by the undersigned', 2, 1);
/*!40000 ALTER TABLE `invoice` ENABLE KEYS */;
-- Dumping structure for table astute.invoice_detail
@ -306,13 +325,19 @@ CREATE TABLE IF NOT EXISTS `invoice_detail` (
CONSTRAINT `fk_InvDetail_InvNum` FOREIGN KEY (`inv_num`) REFERENCES `invoice` (`inv_no`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping data for table astute.invoice_detail: ~4 rows (approximately)
-- Dumping data for table astute.invoice_detail: ~10 rows (approximately)
/*!40000 ALTER TABLE `invoice_detail` DISABLE KEYS */;
INSERT INTO `invoice_detail` (`inv_num`, `line_item_num`, `PO_line_item_num`, `service_type_id`, `description`, `qty`, `fee`, `fee_type_id`) VALUES
('VDO-01_0927_1', 1, 1, 1, 'Study existing designs', 0, 1000, 1),
('VDO-01_0927_1', 2, 4, 3, 'Peer Review', 50, 100, 2),
('VDO-02_DRAFT_392', 1, 1, 2, 'Design', 0, 5000, 1),
('VDO-02_DRAFT_392', 2, -1, 1, 'Out of Pocket Expenses', 50, 10, 1);
('MDO-01_0108_1', 1, 1, 2, 'Design', 0.5, 2500, 1),
('MDO-01_0108_1', 2, 2, 1, 'Study', 5, 100, 2),
('MDO-01_0108_1', 3, 3, 3, 'Peer Review', 50, 250, 2),
('MDO-01_0108_1', 4, 4, 4, 'Cost Estimation', 50, 250, 2),
('MDO-01_0108_1', 5, 5, 5, 'Forensic Investigation', 0.5, 5000, 1),
('MDO-01_0108_1', 6, -1, 1, 'Out of Pocket Expenses - gas', 50, 20, 1),
('VDO-02_0107_2', 1, 1, 2, 'Design', 0.25, 5000, 1),
('VDO-02_0107_2', 2, -1, 1, 'Out of Pocket Expenses', 20, 10, 1),
('VDO-02_0108_3', 1, 1, 2, 'Design', 0.25, 5000, 1),
('VDO-02_0108_3', 2, 3, 1, 'Study', 200, 20, 1);
/*!40000 ALTER TABLE `invoice_detail` ENABLE KEYS */;
-- Dumping structure for table astute.invoice_notes
@ -334,23 +359,20 @@ CREATE TABLE IF NOT EXISTS `invoice_payment` (
`invoice_amount` double NOT NULL,
`payment_date` date NOT NULL,
`invoice_payment_id` int(11) NOT NULL AUTO_INCREMENT,
`description` varchar(50) DEFAULT NULL,
`check_transaction_no` varchar(50) NOT NULL,
`void_payment_status` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`invoice_payment_id`),
KEY `fk_inv_pmt_inv_no` (`inv_no`),
KEY `fk_pinv_pmt_type` (`invoice_payment_type`),
CONSTRAINT `fk_inv_pmt_inv_no` FOREIGN KEY (`inv_no`) REFERENCES `invoice` (`inv_no`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `fk_pinv_pmt_type` FOREIGN KEY (`invoice_payment_type`) REFERENCES `payment_type` (`payment_type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8;
-- Dumping data for table astute.invoice_payment: ~6 rows (approximately)
-- Dumping data for table astute.invoice_payment: ~1 rows (approximately)
/*!40000 ALTER TABLE `invoice_payment` DISABLE KEYS */;
INSERT INTO `invoice_payment` (`inv_no`, `invoice_payment_type`, `invoice_amount`, `payment_date`, `invoice_payment_id`, `description`) VALUES
('VDO-01_0927_1', 2, 900, '2018-09-29', 1, 'VDO-01_0927_1 FIrst Payment'),
('VDO-01_0927_1', 2, 980, '2018-09-27', 2, NULL),
('VDO-01_0927_1', 2, 1000, '2018-09-27', 3, NULL),
('VDO-01_0927_1', 2, 1000, '2018-09-27', 4, NULL),
('VDO-01_0927_1', 2, 1000, '2018-09-27', 5, NULL),
('VDO-01_0927_1', 2, 200, '2018-09-28', 12, NULL);
INSERT INTO `invoice_payment` (`inv_no`, `invoice_payment_type`, `invoice_amount`, `payment_date`, `invoice_payment_id`, `check_transaction_no`, `void_payment_status`) VALUES
('VDO-02_0107_2', 2, 5000, '2019-01-09', 13, '123456', 0),
('VDO-02_0107_2', 2, 5000, '2019-01-08', 15, '123123', 0);
/*!40000 ALTER TABLE `invoice_payment` ENABLE KEYS */;
-- Dumping structure for table astute.invoice_status
@ -390,12 +412,13 @@ CREATE TABLE IF NOT EXISTS `payment_type` (
PRIMARY KEY (`payment_type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping data for table astute.payment_type: ~3 rows (approximately)
-- Dumping data for table astute.payment_type: ~4 rows (approximately)
/*!40000 ALTER TABLE `payment_type` DISABLE KEYS */;
INSERT INTO `payment_type` (`payment_type_id`, `payment_type_name`) VALUES
(1, 'Credit Card'),
(2, 'Check'),
(3, 'ACH');
(3, 'ACH'),
(4, 'Wire Transfer');
/*!40000 ALTER TABLE `payment_type` ENABLE KEYS */;
-- Dumping structure for table astute.po
@ -416,10 +439,11 @@ CREATE TABLE IF NOT EXISTS `po` (
CONSTRAINT `po_customer_id_fk` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`customer_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping data for table astute.po: ~2 rows (approximately)
-- Dumping data for table astute.po: ~3 rows (approximately)
/*!40000 ALTER TABLE `po` DISABLE KEYS */;
INSERT INTO `po` (`PO_num`, `contract_num`, `PO_date`, `contract_amt`, `customer_id`, `astute_project_num`, `po_id`, `title`, `inv_seq`) VALUES
('ABC-123', 'ABC-123', '2018-09-23', 5000.00, 'VDOT', 'ABC-123', 2, 'ABC-123', 0),
('ABC-123', 'ABC-123', '2018-09-23', 27000.00, 'VDOT', 'ABC-123', 2, 'ABC-123', 3),
('MDOT-123', 'MDOT-123 ContractNo', '2019-01-08', 58500.00, 'MDOT', 'MDOT-123 ProjNo', 1, 'MDOT-123 SO Title', 1),
('VDOT-54321', 'VDOT-54321', '2018-09-22', 10000.00, 'VDOT', 'VDOTProj', 1, 'Supervisor', 1);
/*!40000 ALTER TABLE `po` ENABLE KEYS */;
@ -439,14 +463,21 @@ CREATE TABLE IF NOT EXISTS `po_detail` (
CONSTRAINT `fk_PODetail_ServType` FOREIGN KEY (`service_type_id`) REFERENCES `service_type` (`service_type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping data for table astute.po_detail: ~5 rows (approximately)
-- Dumping data for table astute.po_detail: ~12 rows (approximately)
/*!40000 ALTER TABLE `po_detail` DISABLE KEYS */;
INSERT INTO `po_detail` (`PO_num`, `line_item_no`, `service_desc`, `fee_type_id`, `qty`, `service_type_id`, `fee`, `remaining_qty`) VALUES
('ABC-123', 1, 'Design', 1, 1, 2, 5000, 1),
('ABC-123', 1, 'Design', 1, 1, 2, 5000, 0.75),
('ABC-123', 2, 'Out of Expense', 1, 100, 6, 20, 100),
('ABC-123', 3, 'Study', 1, 1000, 1, 20, 800),
('MDOT-123', 1, 'Design', 1, 1, 2, 2500, 1),
('MDOT-123', 2, 'Study', 2, 10, 1, 100, 10),
('MDOT-123', 3, 'Peer Review', 2, 100, 3, 250, 100),
('MDOT-123', 4, 'Cost Estimation', 2, 100, 4, 250, 100),
('MDOT-123', 5, 'Forensic Investigation', 1, 1, 5, 5000, 1),
('VDOT-54321', 1, 'Study existing designs', 1, 1, 1, 1000, 1),
('VDOT-54321', 2, 'Modify design', 1, 1, 2, 2000, 1),
('VDOT-54321', 3, 'Cost estimation', 1, 1, 4, 1000, 1),
('VDOT-54321', 4, 'Peer Review', 2, 100, 3, 100, 50);
('VDOT-54321', 4, 'Peer Review', 2, 100, 3, 100, 100);
/*!40000 ALTER TABLE `po_detail` ENABLE KEYS */;
-- Dumping structure for table astute.service_type
@ -456,7 +487,7 @@ CREATE TABLE IF NOT EXISTS `service_type` (
PRIMARY KEY (`service_type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping data for table astute.service_type: ~5 rows (approximately)
-- Dumping data for table astute.service_type: ~6 rows (approximately)
/*!40000 ALTER TABLE `service_type` DISABLE KEYS */;
INSERT INTO `service_type` (`service_type_id`, `desc`) VALUES
(1, 'Study'),
@ -478,18 +509,24 @@ CREATE TABLE IF NOT EXISTS `session` (
CONSTRAINT `fk_session_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping data for table astute.session: ~10 rows (approximately)
-- Dumping data for table astute.session: ~16 rows (approximately)
/*!40000 ALTER TABLE `session` DISABLE KEYS */;
INSERT INTO `session` (`session_id`, `user_id`, `session_start_date`, `session_end_date`) VALUES
('042ef08346f84d52b98a22dab48c7b1c', 1, NULL, NULL),
('058cdb87447645da9ec265e566af834c', 1, NULL, NULL),
('46d91a474f4544a2ab60002f799383a7', 1, NULL, NULL),
('4f48b60481ab4729a26b809c077fc7c0', 1, NULL, NULL),
('5df808bb502044ccb6e9da1bce0c63d4', 2, NULL, NULL),
('66ed2bccbaf34b1e96b2b81393996cf9', 1, NULL, NULL),
('8f8991185a174b87adb7d0b1b40c1475', 1, NULL, NULL),
('92cd1d01085c4ead892a1c7c137631dd', 1, NULL, NULL),
('9c0a7444f67f4de5a789014413445458', 1, NULL, NULL),
('abeefc05fe8e48e5bac7ffab65c85ca6', 1, NULL, NULL),
('b356aab1dbe84d4f9eea9c1cd965c9a4', 1, NULL, NULL),
('d6387d93d84341fc91a0c4a5cbf266db', 1, NULL, NULL),
('d98f7e0c9a934afaa89f0f0545c1c81c', 1, NULL, NULL),
('dcb4b261f925464bb69ff685c1c6134d', 1, NULL, NULL),
('f6546dbfa5454a339f2093b2ac1f3b54', 1, NULL, NULL),
('fea623a6ff3148899214750707f4f52e', 1, NULL, NULL);
/*!40000 ALTER TABLE `session` ENABLE KEYS */;

View File

@ -46,13 +46,7 @@ public abstract class DAO {
* @throws AstuteException
*/
public static void init() throws AstuteException {
try {
File configDir = new File(System.getProperty("catalina.base"), "conf");
File configFile = new File(configDir, "db.config");
InputStream stream = new FileInputStream(configFile);
Properties props = new Properties();
props.load(stream);
// try {
// Properties props = new Properties();
// InputStream input = new FileInputStream("db.config");
@ -60,12 +54,18 @@ public abstract class DAO {
// props.load(input);
//get properties
database = props.getProperty("database");
host = props.getProperty("host");
port = Integer.parseInt(props.getProperty("port"));
schema = props.getProperty("schema");
username = props.getProperty("username");
password = props.getProperty("password");
// database = props.getProperty("database");
// host = props.getProperty("host");
// port = Integer.parseInt(props.getProperty("port"));
// schema = props.getProperty("schema");
// username = props.getProperty("username");
// password = props.getProperty("password");
database = "sql";
host = "localhost";
port = 3306;
schema = "astute";
username = "root";
password = "password";
System.out.println("=============================================");
System.out.println("host is " + host);
System.out.println("port is " + port);
@ -74,9 +74,9 @@ public abstract class DAO {
System.out.println("password is " + password);
System.out.println("=============================================");
dao = new SqlDAO();
} catch (IOException e) {
e.printStackTrace();
}
// } catch (IOException e) {
// e.printStackTrace();
// }
}
public Connection conn;
@ -166,9 +166,9 @@ public abstract class DAO {
public abstract List<InvoicePayment> getInvoicePayments(String invoiceNum) throws AstuteException;
public abstract void updateInvoicePayment(String invoiceNum, int invoicePaymentId, Double paymentAmount, Date paymentDate) throws AstuteException;
public abstract void updateInvoicePayment(String invoiceNum, int invoicePaymentId, int InvoicePaymentTypeId, Double paymentAmount, Date paymentDate, String checkTransactionNo) throws AstuteException;
public abstract void createInvoicePayment(String invoiceNum, int invoicePaymentTypeId, Double paymentAmount, Date paymentDate) throws AstuteException;
public abstract void createInvoicePayment(String invoiceNum, int invoicePaymentTypeId, Double paymentAmount, Date paymentDate, String checkTransactionNo) throws AstuteException;
public abstract List<PaymentType> getPaymentTypes() throws AstuteException;
}

View File

@ -339,7 +339,7 @@ public class SqlDAO extends DAO {
Statement stmt = conn.createStatement();
String whereClause = " WHERE ";
boolean whereClauseIndicator = false;
String sql = "SELECT inv_no, inv_date, PO_num, pmt_status, bill_amt, special_notes, certification, inv_status FROM INVOICE ";
String sql = "SELECT inv_no, inv_date, PO_num, pmt_status, bill_amt, special_notes, certification, inv_status, get_payment_status_name(pmt_status), get_customer_from_po(PO_num) FROM INVOICE ";
if (invoiceNumber != null && !invoiceNumber.isEmpty()) {
whereClause = whereClause + " UPPER(inv_no) = '"+ invoiceNumber.toUpperCase() +"'";
whereClauseIndicator = true;
@ -365,8 +365,9 @@ public class SqlDAO extends DAO {
String specialNotes = rs.getString(6);
String certification = rs.getString(7);
int invoiceStatus = rs.getInt(8);
Invoice invoice = new Invoice(invNo, invdDate, PONo, paymentStatus, billAmt, specialNotes, certification, invoiceStatus);
String paymentStatusDesc = rs.getString(9);
String customerId = rs.getString(10);
Invoice invoice = new Invoice(invNo, invdDate, PONo, paymentStatus, billAmt, specialNotes, certification, invoiceStatus, paymentStatusDesc, customerId);
invoices.add(invoice);
}
return invoices;
@ -428,7 +429,6 @@ public class SqlDAO extends DAO {
}
updateClause = updateClause + " inv_date = STR_TO_DATE('" + invoiceDate + "', '%Y-%m-%d')" + ",";
updateClause = updateClause + " PO_num = '" + PONum + "',";
updateClause = updateClause + " pmt_status = " + pmtStatus + ",";
updateClause = updateClause + " bill_amt = " + billAmt + ",";
updateClause = updateClause + " special_notes = '" + specialNotes + "',";
updateClause = updateClause + " certification = '" + certification + "',";
@ -630,7 +630,7 @@ public class SqlDAO extends DAO {
while (resultSet.next()) {
invoiceNumber = resultSet.getString(1);
invoice = new Invoice(invoiceNumber,null,null,0,null,null,null,0);
invoice = new Invoice(invoiceNumber,null,null,1,null,null,null,0, "Outstanding","");
invoices.add(invoice);
}
} catch (SQLException e) {
@ -920,7 +920,7 @@ public class SqlDAO extends DAO {
try {
List<InvoicePayment> invoicePayments = new ArrayList<InvoicePayment>();
Statement stmt = conn.createStatement();
String sql = "SELECT invoice_payment_id, invoice_payment_type, get_payment_type(invoice_payment_type), invoice_amount, payment_date, inv_no FROM invoice_payment ";
String sql = "SELECT invoice_payment_id, invoice_payment_type, get_payment_type(invoice_payment_type), invoice_amount, payment_date, inv_no, check_transaction_no FROM invoice_payment ";
if (invoiceNum != null) {
sql += " WHERE inv_no = '" + invoiceNum + "'";
}
@ -932,7 +932,8 @@ public class SqlDAO extends DAO {
Double paymentAmount = rs.getDouble(4);
Date paymentDate = rs.getDate(5);
String invNo = rs.getString(6);
InvoicePayment invoicePayment = new InvoicePayment(invNo, invoicePaymentId, invoicePaymentTypeId, invoicePaymentType, paymentDate, paymentAmount);
String checkTransactionNo = rs.getString(7);
InvoicePayment invoicePayment = new InvoicePayment(invNo, invoicePaymentId, invoicePaymentTypeId, invoicePaymentType, paymentDate, paymentAmount, checkTransactionNo);
invoicePayments.add(invoicePayment);
}
return invoicePayments;
@ -942,7 +943,7 @@ public class SqlDAO extends DAO {
}
};
public void updateInvoicePayment(String invoiceNum, int invoicePaymentId, Double paymentAmount, Date paymentDate) throws AstuteException {
public void updateInvoicePayment(String invoiceNum, int invoicePaymentId, int invoicePaymentTypeId, Double paymentAmount, Date paymentDate, String checkTransactionNo) throws AstuteException {
try {
String sql = "UPDATE INVOICE_PAYMENT ";
String updateClause = " SET ";
@ -952,7 +953,7 @@ public class SqlDAO extends DAO {
}
updateClause = updateClause + " invoice_amount = " + paymentAmount ;
updateClause = updateClause + " invoice_payment_type = " + invoicePaymentTypeId + ", invoice_amount = " + paymentAmount + ", check_Transaction_No = '" + checkTransactionNo + "'";
// if (paymentDate != null) {
updateClause = updateClause + ", payment_date = STR_TO_DATE('" + paymentDate + "', '%Y-%m-%d')";
// }
@ -969,10 +970,10 @@ public class SqlDAO extends DAO {
}
public void createInvoicePayment(String invoiceNum, int invoicePaymentTypeId, Double paymentAmount, Date paymentDate) throws AstuteException{
public void createInvoicePayment(String invoiceNum, int invoicePaymentTypeId, Double paymentAmount, Date paymentDate, String checkTransactionNo) throws AstuteException{
try {
String dateString = "STR_TO_DATE('" + paymentDate + "', '%Y-%m-%d')";
String sql = "insert into invoice_payment (inv_no, invoice_payment_type, invoice_amount, payment_date) values ('" + invoiceNum + "', " + invoicePaymentTypeId + ", " + paymentAmount + ", " + dateString + ")";
String sql = "insert into invoice_payment (inv_no, invoice_payment_type, invoice_amount, payment_date, check_transaction_no) values ('" + invoiceNum + "', " + invoicePaymentTypeId + ", " + paymentAmount + ", " + dateString + ", " + checkTransactionNo +")";
Statement stmt = conn.createStatement();
System.out.println(sql);
stmt.execute(sql);

View File

@ -1,19 +1,19 @@
package com.astute.model;
import java.util.Date;
public class Invoice {
String invoiceNumber;
String invoiceDate;
String poNum;
String changeOrderNum;
String pmtStatusDesc;
int pmtStatus;
Double billAmt;
String specialNotes;
String certification;
int invoiceStatus;
String customerId;
public Invoice(String invoiceNumber, String invoiceDate, String poNum, int pmtStatus, Double billAmt, String specialNotes, String certification, int invoiceStatus) {
public Invoice(String invoiceNumber, String invoiceDate, String poNum, int pmtStatus, Double billAmt, String specialNotes, String certification, int invoiceStatus, String pmtStatusDesc, String customerId) {
this.invoiceNumber = invoiceNumber;
this.invoiceDate = invoiceDate;
this.poNum = poNum;
@ -22,6 +22,8 @@ public class Invoice {
this.specialNotes = specialNotes;
this.certification = certification;
this.invoiceStatus = invoiceStatus;
this.pmtStatusDesc = pmtStatusDesc;
this.customerId = customerId;
}
public String getInvoiceNumber() {
@ -57,6 +59,14 @@ public class Invoice {
this.changeOrderNum = changeOrderNum;
}
public String getPmtStatusDesc() {
return pmtStatusDesc;
}
public void setPmtStatusDesc(String pmtStatusDesc) {
this.pmtStatusDesc = pmtStatusDesc;
}
public int getPmtStatus() {
return pmtStatus;
}
@ -96,4 +106,12 @@ public class Invoice {
public void setInvoiceStatus(int invoiceStatus) {
this.invoiceStatus = invoiceStatus;
}
public String getCustomerId() {
return customerId;
}
public void setCustomerId(String customerId) {
this.customerId = customerId;
}
}

View File

@ -9,14 +9,15 @@ public class InvoicePayment {
String paymentType;
Date paymentDate;
Double invoiceAmount;
public InvoicePayment(String invoiceNum, int invoicePaymentId, int paymentTypeId, String paymentType, Date paymentDate, Double invoiceAmount) {
String checkTransactionNo;
public InvoicePayment(String invoiceNum, int invoicePaymentId, int paymentTypeId, String paymentType, Date paymentDate, Double invoiceAmount, String checkTransactionNo) {
this.invoiceNum = invoiceNum;
this.invoicePaymentId = invoicePaymentId;
this.paymentTypeId = paymentTypeId;
this.paymentType = paymentType;
this.paymentDate = paymentDate;
this.invoiceAmount = invoiceAmount;
this.checkTransactionNo = checkTransactionNo;
}
public String getInvoiceNum() {
@ -66,4 +67,12 @@ public class InvoicePayment {
public void setInvoiceAmount(Double invoiceAmount) {
this.invoiceAmount = invoiceAmount;
}
public String getCheckTransactionNo() {
return checkTransactionNo;
}
public void setCheckTransactionNo(String checkTransactionNo) {
this.checkTransactionNo = checkTransactionNo;
}
}

View File

@ -8,14 +8,16 @@ public class InvoicePaymentRequest {
String paymentType;
String paymentDate;
Double invoiceAmount;
String checkTransactionNo;
public InvoicePaymentRequest(String invoiceNum, int invoicePaymentId, int paymentTypeId, String paymentType, String paymentDate, Double invoiceAmount) {
public InvoicePaymentRequest(String invoiceNum, int invoicePaymentId, int paymentTypeId, String paymentType, String paymentDate, Double invoiceAmount, String checkTransactionNo) {
this.invoiceNum = invoiceNum;
this.invoicePaymentId = invoicePaymentId;
this.paymentTypeId = paymentTypeId;
this.paymentType = paymentType;
this.paymentDate = paymentDate;
this.invoiceAmount = invoiceAmount;
this.checkTransactionNo = checkTransactionNo;
}
public InvoicePaymentRequest() {
@ -69,4 +71,12 @@ public class InvoicePaymentRequest {
public void setInvoiceAmount(Double invoiceAmount) {
this.invoiceAmount = invoiceAmount;
}
public String getCheckTransactionNo() {
return checkTransactionNo;
}
public void setCheckTransactionNo(String checkTransactionNo) {
this.checkTransactionNo = checkTransactionNo;
}
}

View File

@ -30,13 +30,13 @@ public class InvoicePaymentResource {
@Path("/{invoiceNum}/{invoicePaymentId}")
@PUT
public Response updateInvoicePayment(InvoicePaymentRequest request, @PathParam("invoiceNum") String invoiceNum, @PathParam("invoicePaymentId") int invoicePaymentId)
public Response updateInvoicePayment(InvoicePaymentRequest request, @PathParam("invoiceNum") String invoiceNum, @PathParam("invoicePaymentId") int invoicePaymentId, @PathParam("checkTransactionNo")String checkTransactionNo)
throws AstuteException, ParseException {
String dateStr = request.getPaymentDate();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Date date = new java.sql.Date(df.parse(dateStr).getTime());
service.updateInvoicePayment(invoiceNum,invoicePaymentId, request.getInvoiceAmount(), date);
service.updateInvoicePayment(invoiceNum,invoicePaymentId, request.getPaymentTypeId(), request.getInvoiceAmount(), date, request.getCheckTransactionNo());
return new ApiResponse(ApiResponse.UPDATE_ACCESS_SUCESS).toResponse();
}
@ -46,7 +46,7 @@ public class InvoicePaymentResource {
String dateStr = request.getPaymentDate();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Date date = new java.sql.Date(df.parse(dateStr).getTime());
service.createInvoicePayment(request.getInvoiceNum(), request.getPaymentTypeId(), request.getInvoiceAmount(),date);
service.createInvoicePayment(request.getInvoiceNum(), request.getPaymentTypeId(), request.getInvoiceAmount(),date,request.getCheckTransactionNo());
return new ApiResponse(ApiResponse.UPDATE_ACCESS_SUCESS).toResponse();
}

View File

@ -19,15 +19,15 @@ public class InvoicePaymentService extends Service{
return getDao().getInvoicePayments(invoiceNum);
}
public void updateInvoicePayment(String invoiceNum, int invoicePaymentId, Double paymentAmount, Date paymentDate)
public void updateInvoicePayment(String invoiceNum, int invoicePaymentId, int InvoicePaymentTypeId, Double paymentAmount, Date paymentDate, String checkTransactionNo)
throws AstuteException {
getDao().updateInvoicePayment(invoiceNum, invoicePaymentId, paymentAmount, paymentDate);
getDao().updateInvoicePayment(invoiceNum, invoicePaymentId, InvoicePaymentTypeId, paymentAmount, paymentDate, checkTransactionNo);
}
public void createInvoicePayment(String invoiceNum, int invoicePaymentTypeId, Double paymentAmount, Date paymentDate)
public void createInvoicePayment(String invoiceNum, int invoicePaymentTypeId, Double paymentAmount, Date paymentDate, String checkTransactionNo)
throws AstuteException {
getDao().createInvoicePayment(invoiceNum, invoicePaymentTypeId, paymentAmount, paymentDate);
getDao().createInvoicePayment(invoiceNum, invoicePaymentTypeId, paymentAmount, paymentDate, checkTransactionNo);
}
public List<PaymentType> getPaymentTypes() throws AstuteException {