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,271 +1,273 @@
<app-nav-bar [customerActive]="true"></app-nav-bar> <app-nav-bar [customerActive]="true"></app-nav-bar>
<h1 align="center">Customers</h1> <h1 align="center">Customers</h1>
<div class="container-fluid">
<div class="row"> <div class="container-fluid">
<div class="col-12"> <div class="row">
<ag-grid-angular <div class="col-12">
#agGrid <ag-grid-angular
style="height: 500px;" #agGrid
class="ag-theme-balham" style="height: 500px;"
[enableSorting]="true" class="ag-theme-balham"
[enableFilter]="true" [enableSorting]="true"
[rowData]="rowData | async" [enableFilter]="true"
[columnDefs]="columnDefs" [rowData]="rowData | async"
rowSelection="single" [columnDefs]="columnDefs"
></ag-grid-angular> rowSelection="single"
</div> rowDeselection="true"
</div> ></ag-grid-angular>
<div class="row justify-content-center mt-2"> </div>
<div class="col-6"> </div>
<button class="btn btn-primary" style="width: 100%" (click)="open(edit)">Edit Customer</button> <div class="row justify-content-center mt-2">
</div> <div class="col-6">
<div class="col-6"> <button class="btn btn-primary" style="width: 100%" (click)="open(edit)">Edit Customer</button>
<button class="btn btn-success" style="width: 100%" (click)="open(new)">Add Customer</button> </div>
</div> <div class="col-6">
</div> <button class="btn btn-success" style="width: 100%" (click)="open(new)">Add Customer</button>
</div> </div>
</div>
<!--MODAL: new customer--> </div>
<app-modal-form [title]="'New Customer'" #new>
<div class="modal-body"> <!--MODAL: new customer-->
<table class="table table-borderless table-sm"> <app-modal-form [title]="'New Customer'" #new>
<tbody> <div class="modal-body">
<tr> <table class="table table-borderless table-sm">
<td style="width: 10%"> <tbody>
<span class="input-group-text">ID*</span> <tr>
</td> <td style="width: 10%">
<td colspan="7"> <span class="input-group-text">ID*</span>
<input type="text" class="form-control" placeholder="johndoe" #inId> </td>
</td> <td colspan="7">
</tr> <input type="text" class="form-control" placeholder="johndoe" #inId>
</td>
<tr> </tr>
<td style="width: 10%">
<span class="input-group-text">Name*</span> <tr>
</td> <td style="width: 10%">
<td colspan="7"> <span class="input-group-text">Name*</span>
<input type="text" class="form-control" placeholder="John Doe" #inName> </td>
</td> <td colspan="7">
</tr> <input type="text" class="form-control" placeholder="John Doe" #inName>
</td>
<tr> </tr>
<td style="width: 10%">
<span class="input-group-text">Bill To Dept*</span> <tr>
</td> <td style="width: 10%">
<td colspan="7"> <span class="input-group-text">Bill To Dept*</span>
<input type="text" class="form-control" placeholder="Billing" #inBillToDept> </td>
</td> <td colspan="7">
</tr> <input type="text" class="form-control" placeholder="Billing" #inBillToDept>
</td>
<tr> </tr>
<td style="width: 10%">
<span class="input-group-text">Address 1*</span> <tr>
</td> <td style="width: 10%">
<td colspan="7"> <span class="input-group-text">Address 1*</span>
<input type="text" class="form-control" placeholder="13254 John Doe Rd." #inAdd1> </td>
</td> <td colspan="7">
</tr> <input type="text" class="form-control" placeholder="13254 John Doe Rd." #inAdd1>
</td>
<tr> </tr>
<td style="width: 1%">
<span class="input-group-text">Address 2</span> <tr>
</td> <td style="width: 1%">
<td colspan="7"> <span class="input-group-text">Address 2</span>
<input type="text" class="form-control" placeholder="Apt #, Unit, etc..." [value]="''" #inAdd2> </td>
</td> <td colspan="7">
</tr> <input type="text" class="form-control" placeholder="Apt #, Unit, etc..." [value]="''" #inAdd2>
</td>
<tr> </tr>
<td style="width: 1%">
<span class="input-group-text">City*</span> <tr>
</td> <td style="width: 1%">
<td> <span class="input-group-text">City*</span>
<input type="text" class="form-control" placeholder="New York City" #inCity> </td>
</td> <td>
<input type="text" class="form-control" placeholder="New York City" #inCity>
<td style="width: 1%"> </td>
<span class="input-group-text">State*</span>
</td> <td style="width: 1%">
<td> <span class="input-group-text">State*</span>
<select class="custom-select" #inState> </td>
<option selected>Choose...</option> <td>
<option *ngFor="let state of states" [value]="state">{{state}}</option> <select class="custom-select" #inState>
</select> <option selected>Choose...</option>
</td> <option *ngFor="let state of states" [value]="state">{{state}}</option>
</select>
</td>
<td style="width: 1%">
<span class="input-group-text">ZIP*(+4)</span>
</td> <td style="width: 1%">
<td style="width: 25%"> <span class="input-group-text">ZIP*(+4)</span>
<div class="input-group"> </td>
<input type="number" class="form-control" placeholder="12345" #inZIP> <td style="width: 25%">
<input type="number" class="form-control" placeholder="(+4)" #inZIP4> <div class="input-group">
</div> <input type="number" class="form-control" placeholder="12345" #inZIP>
</td> <input type="number" class="form-control" placeholder="(+4)" #inZIP4>
</tr> </div>
</td>
<tr> </tr>
<td style="width: 1%">
<span class="input-group-text">Email*</span> <tr>
</td> <td style="width: 1%">
<td colspan="7"> <span class="input-group-text">Email*</span>
<input type="email" class="form-control" placeholder="john@doe.com" #inEmail> </td>
</td> <td colspan="7">
</tr> <input type="email" class="form-control" placeholder="john@doe.com" #inEmail>
</td>
<tr> </tr>
<td style="width: 1%">
<span class="input-group-text">Phone*</span> <tr>
</td> <td style="width: 1%">
<td colspan="7"> <span class="input-group-text">Phone*</span>
<input type="tel" class="form-control" placeholder="(123) 456-7890" [textMask]="{mask: usPhoneMask, guide: false}" #inPhone> </td>
</td> <td colspan="7">
</tr> <input type="tel" class="form-control" placeholder="(123) 456-7890" [textMask]="{mask: usPhoneMask, guide: false}" #inPhone>
</td>
<tr> </tr>
<td style="width: 1%">
<span class="input-group-text">Fax*</span> <tr>
</td> <td style="width: 1%">
<td colspan="7"> <span class="input-group-text">Fax*</span>
<input type="tel" class="form-control" placeholder="(123) 456-7890" [value]="''" [textMask]="{mask: usPhoneMask, guide: false}" #inFax> </td>
</td> <td colspan="7">
</tr> <input type="tel" class="form-control" placeholder="(123) 456-7890" [value]="''" [textMask]="{mask: usPhoneMask, guide: false}" #inFax>
</tbody> </td>
</table> </tr>
</div> </tbody>
</table>
<div class="modal-footer"> </div>
<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)" <div class="modal-footer">
(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)"> <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)"
</button> (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)">
<button type="button" class="btn btn-danger" (click)="close(new)">Cancel</button> Add
</div> </button>
</app-modal-form> <button type="button" class="btn btn-danger" (click)="close(new)">Cancel</button>
</div>
<!--MODAL: edit customer--> </app-modal-form>
<app-modal-form [title]="'Editing'" #edit>
<div *ngIf="selected"> <!--MODAL: edit customer-->
<div class="modal-body"> <app-modal-form [title]="'Editing'" #edit>
<table class="table table-borderless table-sm"> <div *ngIf="selected">
<tbody> <div class="modal-body">
<tr> <table class="table table-borderless table-sm">
<td style="width: 10%"> <tbody>
<span class="input-group-text">Name*</span> <tr>
</td> <td style="width: 10%">
<td colspan="7"> <span class="input-group-text">Name*</span>
<input type="text" class="form-control" #inName placeholder="John Doe" [value]="selected.customerName"> </td>
</td> <td colspan="7">
</tr> <input type="text" class="form-control" #inName placeholder="John Doe" [value]="selected.customerName">
</td>
<tr> </tr>
<td style="width: 10%">
<span class="input-group-text">Bill To Dept*</span> <tr>
</td> <td style="width: 10%">
<td colspan="7"> <span class="input-group-text">Bill To Dept*</span>
<input type="text" class="form-control" placeholder="Billing" #inBillToDept [value]="selected.billToDept"> </td>
</td> <td colspan="7">
</tr> <input type="text" class="form-control" placeholder="Billing" #inBillToDept [value]="selected.billToDept">
</td>
<tr> </tr>
<td style="width: 10%">
<span class="input-group-text">Address 1*</span> <tr>
</td> <td style="width: 10%">
<td colspan="7"> <span class="input-group-text">Address 1*</span>
<input type="text" class="form-control" placeholder="13254 John Doe Rd." #inAdd1 [value]="selected.add1"> </td>
</td> <td colspan="7">
</tr> <input type="text" class="form-control" placeholder="13254 John Doe Rd." #inAdd1 [value]="selected.add1">
</td>
<tr> </tr>
<td style="width: 1%">
<span class="input-group-text">Address 2</span> <tr>
</td> <td style="width: 1%">
<td colspan="7"> <span class="input-group-text">Address 2</span>
<input type="text" class="form-control" placeholder="Apt#, Unit, etc." #inAdd2 [value]="selected.add2"> </td>
</td> <td colspan="7">
</tr> <input type="text" class="form-control" placeholder="Apt#, Unit, etc." #inAdd2 [value]="selected.add2">
</td>
<tr> </tr>
<td style="width: 1%">
<span class="input-group-text">City*</span> <tr>
</td> <td style="width: 1%">
<td> <span class="input-group-text">City*</span>
<input type="text" class="form-control" placeholder="New York City" #inCity [value]="selected.city"> </td>
</td> <td>
<input type="text" class="form-control" placeholder="New York City" #inCity [value]="selected.city">
<td style="width: 1%"> </td>
<span class="input-group-text">State*</span>
</td> <td style="width: 1%">
<td> <span class="input-group-text">State*</span>
<select class="custom-select" #inState [value]="selected.state"> </td>
<option selected>Choose...</option> <td>
<option *ngFor="let state of states" [value]="state">{{state}}</option> <select class="custom-select" #inState [value]="selected.state">
</select> <option selected>Choose...</option>
</td> <option *ngFor="let state of states" [value]="state">{{state}}</option>
</select>
</td>
<td style="width: 1%">
<span class="input-group-text">ZIP*(+4)</span>
</td> <td style="width: 1%">
<td style="width: 25%"> <span class="input-group-text">ZIP*(+4)</span>
<div class="input-group"> </td>
<input type="number" class="form-control" placeholder="12345" #inZIP [value]="selected.zip"> <td style="width: 25%">
<input type="number" class="form-control" placeholder="(+4)" #inZIP4 [value]="selected.ziplast4"> <div class="input-group">
</div> <input type="number" class="form-control" placeholder="12345" #inZIP [value]="selected.zip">
</td> <input type="number" class="form-control" placeholder="(+4)" #inZIP4 [value]="selected.ziplast4">
</tr> </div>
</td>
<tr> </tr>
<td style="width: 1%">
<span class="input-group-text">Email*</span> <tr>
</td> <td style="width: 1%">
<td colspan="7"> <span class="input-group-text">Email*</span>
<input type="email" class="form-control" placeholder="john@doe.com" #inEmail [value]="selected.email"> </td>
</td> <td colspan="7">
</tr> <input type="email" class="form-control" placeholder="john@doe.com" #inEmail [value]="selected.email">
</td>
<tr> </tr>
<td style="width: 1%">
<span class="input-group-text">Phone*</span> <tr>
</td> <td style="width: 1%">
<td colspan="7"> <span class="input-group-text">Phone*</span>
<input type="tel" class="form-control" placeholder="(123) 456-7890" [textMask]="{mask: usPhoneMask, guide: false}" #inPhone [value]="selected.phone"> </td>
</td> <td colspan="7">
</tr> <input type="tel" class="form-control" placeholder="(123) 456-7890" [textMask]="{mask: usPhoneMask, guide: false}" #inPhone [value]="selected.phone">
</td>
<tr> </tr>
<td style="width: 1%">
<span class="input-group-text">Fax</span> <tr>
</td> <td style="width: 1%">
<td colspan="7"> <span class="input-group-text">Fax</span>
<input type="tel" class="form-control" placeholder="(123) 456-7890" [textMask]="{mask: usPhoneMask, guide: false}" #inFax [value]="selected.fax"> </td>
</td> <td colspan="7">
</tr> <input type="tel" class="form-control" placeholder="(123) 456-7890" [textMask]="{mask: usPhoneMask, guide: false}" #inFax [value]="selected.fax">
</tbody> </td>
</table> </tr>
</div> </tbody>
</table>
<div class="modal-footer"> </div>
<button class="btn btn-warning" type="button"
[disabled]="!(inName.value && inBillToDept.value && inAdd1.value && inCity.value && inState.value && inZIP.value && inEmail.value && inPhone.value)" <div class="modal-footer">
(click)="editCustomer(selected.customerId ,inName.value, inBillToDept.value, inAdd1.value, inAdd2.value, inCity.value, inState.value, inZIP.value, inZIP4.value, inEmail.value, inPhone.value, inFax.value, edit)"> <button class="btn btn-warning" type="button"
Update [disabled]="!(inName.value && inBillToDept.value && inAdd1.value && inCity.value && inState.value && inZIP.value && inEmail.value && inPhone.value)"
</button> (click)="editCustomer(selected.customerId ,inName.value, inBillToDept.value, inAdd1.value, inAdd2.value, inCity.value, inState.value, inZIP.value, inZIP4.value, inEmail.value, inPhone.value, inFax.value, edit)">
<button type="button" class="btn btn-danger" (click)="close(edit)">Cancel</button> Update
</div> </button>
</div> <button type="button" class="btn btn-danger" (click)="close(edit)">Cancel</button>
<div *ngIf="!selected"> </div>
<div class="modal-body"> </div>
Choose a Customer First! <div *ngIf="!selected">
</div> <div class="modal-body">
<div class="modal-footer"> Choose a Customer First!
<button class="btn btn-warning" type="button" </div>
[disabled]="true"> <div class="modal-footer">
Update <button class="btn btn-warning" type="button"
</button> [disabled]="true">
<button type="button" class="btn btn-danger" (click)="close(edit)">Cancel</button> Update
</div> </button>
</div> <button type="button" class="btn btn-danger" (click)="close(edit)">Cancel</button>
</app-modal-form> </div>
</div>
</app-modal-form>

View File

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

View File

@ -50,8 +50,8 @@
<td style="width: 10%"> <td style="width: 10%">
<span class="input-group-text">Payment Received*</span> <span class="input-group-text">Payment Received*</span>
</td> </td>
<td colspan="7"> <td class="p-0 m-0" colspan="7">
<input type="text" class="form-control" placeholder="$00.00" #inPaymentReceived> <input type="text" class="form-control cell" [value]="0 | currency" #inPaymentReceived>
</td> </td>
</tr> </tr>
@ -78,6 +78,15 @@
</td> </td>
</tr> </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> </tbody>
</table> </table>
</div> </div>
@ -85,8 +94,9 @@
<div class="modal-footer"> <div class="modal-footer">
<button class="btn btn-success" type="button" <button class="btn btn-success" type="button"
[disabled]="!(chosenInv && inPaymentReceived.value && chosenPaymentType && inDateReceived.value)" [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> </button>
<!--<input type="reset" (click)="close(new)">Cancel--> <!--<input type="reset" (click)="close(new)">Cancel-->
<button type="reset" class="btn btn-danger" (click)="close(new)">Cancel</button> <button type="reset" class="btn btn-danger" (click)="close(new)">Cancel</button>
@ -118,6 +128,21 @@
</td> </td>
</tr> </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> <tr>
<td style="width: 10%"> <td style="width: 10%">
<span class="input-group-text">Date Received*</span> <span class="input-group-text">Date Received*</span>
@ -126,13 +151,23 @@
<input type="date" class="form-control" #inDateReceived [value]="selected.paymentDate"> <input type="date" class="form-control" #inDateReceived [value]="selected.paymentDate">
</td> </td>
</tr> </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> </tbody>
</table> </table>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button class="btn btn-warning" type="button" <button class="btn btn-warning" type="button"
[disabled]="!(invoiceSelect.value && inPaymentReceived.value && inDateReceived.value)" [disabled]="!(invoiceSelect.value && inPaymentReceived.value && inDateReceived.value && incheckTransactionNo)"
(click)="updateInvoicePayment(invoiceSelect.value, selected.invoicePaymentId, selected.paymentTypeId, selected.paymentType, inDateReceived.value, inPaymentReceived.value, edit)"> (click)="updateInvoicePayment(invoiceSelect.value, selected.invoicePaymentId, selected.paymentTypeId, inDateReceived.value, inPaymentReceived.value.substr(1).replace(',', ''), incheckTransactionNo.value, edit)">
Update Update
</button> </button>
<button type="button" class="btn btn-danger" (click)="close(edit)">Cancel</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: 'Invoice Number', field: 'invoiceNum'},
{headerName: 'Payment Received', field: 'invoiceAmount'}, {headerName: 'Payment Received', field: 'invoiceAmount'},
{headerName: 'Date Received', field: 'paymentDate'}, {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) { 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 = { let invoicePaymentData = {
"invoiceNum": invoiceNum, "invoiceNum": invoiceNum,
"invoicePaymentId":invoicePaymentId, "invoicePaymentId":invoicePaymentId,
"paymentTypeId":paymentTypeId, "paymentTypeId":paymentTypeId,
"paymentType": paymentType,
"paymentDate": paymentDate, "paymentDate": paymentDate,
"invoiceAmount": paymentReceived "invoiceAmount": paymentReceived,
"checkTransactionNo": checkTransactionNo
}; };
this.astuteClientService.addInvoicePayment(invoicePaymentData).then((data) => { this.astuteClientService.addInvoicePayment(invoicePaymentData).then((data) => {
if (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 = { const invoicePaymentData = {
"invoiceNum": invoiceNum, "invoiceNum": invoiceNum,
"invoicePaymentId": invoicePaymentId, "invoicePaymentId": invoicePaymentId,
"paymentTypeId": paymentTypeId, "paymentTypeId": paymentTypeId,
"paymentType": paymentType,
"paymentDate": dateReceived, "paymentDate": dateReceived,
"invoiceAmount": paymentReceived "invoiceAmount": paymentReceived,
"checkTransactionNo": checkTransactionNo
}; };
this.astuteClientService.updateInvoicePayment(invoiceNum, invoicePaymentId, invoicePaymentData).then((data) => { this.astuteClientService.updateInvoicePayment(invoiceNum, invoicePaymentId, invoicePaymentData).then((data) => {

File diff suppressed because it is too large Load Diff

View File

@ -1,490 +1,492 @@
import {Component, OnInit, ViewChild} from '@angular/core'; import {Component, OnInit, ViewChild} from '@angular/core';
import {AstuteClientService} from '../services/astute-client-service'; import {AstuteClientService} from '../services/astute-client-service';
import {formatCurrency} from "@angular/common"; import {formatCurrency} from "@angular/common";
declare var $: any; declare var $: any;
@Component({ @Component({
selector: 'app-invoice', selector: 'app-invoice',
templateUrl: './invoice.component.html', templateUrl: './invoice.component.html',
styleUrls: ['./invoice.component.css'] styleUrls: ['./invoice.component.css']
}) })
export class InvoiceComponent implements OnInit { export class InvoiceComponent implements OnInit {
@ViewChild('agGrid') agGrid; @ViewChild('agGrid') agGrid;
chosenCustomerID: any = 0; chosenCustomerID: any = 0;
chosenInv: any = 0; chosenInv: any = 0;
source; source;
customers; customers;
pos = []; pos = [];
chosenPo; chosenPo;
correspondingPos = []; correspondingPos = [];
generatedInvoiceNumber = ''; generatedInvoiceNumber = '';
feeTypes = ['Fixed Fee', 'Hourly']; feeTypes = ['Fixed Fee', 'Hourly'];
serviceTypes = ['Study', 'Design', 'Peer Review', 'Cost Investigation', 'Forensic Investigation']; serviceTypes = ['Study', 'Design', 'Peer Review', 'Cost Investigation', 'Forensic Investigation'];
columnDefs = [ columnDefs = [
{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: 'Paid', field: 'pmtStatus'}, {headerName: 'Payment', field: 'pmtStatusDesc'},
{headerName: 'Bll Amount', field: 'billAmt'} {headerName: 'Bll Amount', field: 'billAmt'}
]; ];
newInDetails = []; newInDetails = [];
newBillAmt = 0; newBillAmt = 0;
selectedInDetails = []; selectedInDetails = [];
selectedPO; selectedPO;
selectedBillAmt = 0; selectedBillAmt = 0;
poDetails = []; poDetails = [];
selectedPODetails = []; selectedPODetails = [];
gridOptions = { gridOptions = {
// PROPERTIES - object properties, myRowData and myColDefs are created somewhere in your application // PROPERTIES - object properties, myRowData and myColDefs are created somewhere in your application
rowData: this.source, rowData: this.source,
columnDefs: this.columnDefs, columnDefs: this.columnDefs,
// PROPERTIES - simple boolean / string / number properties // PROPERTIES - simple boolean / string / number properties
enableColResize: true, enableColResize: true,
rowSelection: 'single', rowSelection: 'single',
// EVENTS - add event callback handlers // EVENTS - add event callback handlers
onRowClicked: (event) => { onRowClicked: (event) => {
this.getSelectedRows(); this.getSelectedRows();
}, },
onColumnResized: function (event) { onColumnResized: function (event) {
console.log('a column was resized'); console.log('a column was resized');
}, },
onGridReady: (event) => { onGridReady: (event) => {
}, },
// this.agGrid.sizeColumnsToFit(); // this.agGrid.sizeColumnsToFit();
// 1: draft // 1: draft
// 2: submitted // 2: submitted
// 3: void // 3: void
// getRowStyle: function(params) { // getRowStyle: function(params) {
// if (params.data.invoiceStatus === 1) { // if (params.data.invoiceStatus === 1) {
// return { 'color': 'red' } // return { 'color': 'red' }
// } else if (params.data.invoiceStatus === 3) { // } else if (params.data.invoiceStatus === 3) {
// return { 'text-decoration': 'line-through'} // return { 'text-decoration': 'line-through'}
// } // }
// } // }
rowClassRules: { rowClassRules: {
// apply green to 2008 // apply green to 2008
// 'bg-red': true, // 'bg-red': true,
// apply amber 2004 // apply amber 2004
'text-danger': function (params) { 'text-danger': function (params) {
return params.data.invoiceStatus === 1; return params.data.invoiceStatus === 1;
}, },
'text-primary': function (params) { 'text-primary': function (params) {
return params.data.invoiceStatus === 2; return params.data.invoiceStatus === 2;
}, },
'text-warning': function (params) { 'text-warning': function (params) {
return params.data.invoiceStatus === 3; return params.data.invoiceStatus === 3;
}, },
// apply red to 2000 // apply red to 2000
// 'rag-red-outer': function(params) { return params.data.year === 2000} // 'rag-red-outer': function(params) { return params.data.year === 2000}
} }
} }
constructor(protected astuteClientService: AstuteClientService) { constructor(protected astuteClientService: AstuteClientService) {
} }
customerDropdownChange(index) { customerDropdownChange(index) {
this.chosenCustomerID = this.customers[index].customerId; this.chosenCustomerID = this.customers[index].customerId;
this.setCorrespondingPos(); this.setCorrespondingPos();
} }
poDropdownChange(ponum) { poDropdownChange(ponum) {
this.pos.forEach((po) => { this.pos.forEach((po) => {
if (po.ponum === ponum) { if (po.ponum === ponum) {
this.chosenPo = po; this.chosenPo = po;
} }
}) })
this.astuteClientService.getPODetail(ponum).then((data) => { this.astuteClientService.getPODetail(ponum).then((data) => {
if (data) { if (data) {
// fee // fee
// feeTypeId // feeTypeId
// lineItemNo // lineItemNo
// ponum // ponum
// qty // qty
// remainingQty // remainingQty
// serviceDesc // serviceDesc
// serviceTypeId // serviceTypeId
// lineItemNo, feeTypeId, serviceTypeId, serviceDesc, fee, remainingQty // lineItemNo, feeTypeId, serviceTypeId, serviceDesc, fee, remainingQty
this.poDetails = data; this.poDetails = data;
this.poDetails[-1] = { this.poDetails[-1] = {
'lineItemNo': -1, 'lineItemNo': -1,
'feeTypeId': 1, 'feeTypeId': 1,
'serviceTypeId': 1, 'serviceTypeId': 1,
'serviceDesc': 'Out of Pocket Expenses', 'serviceDesc': 'Out of Pocket Expenses',
'fee': 0, 'fee': 0,
'remainingQty': 0 'remainingQty': 0
}; };
} else { } else {
alert("get PO detail failed!"); 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;
} else { } else {
alert('gen inv num failed!'); alert('gen inv num failed!');
} }
}); });
} }
ngOnInit() { ngOnInit() {
this.refreshData(); this.refreshData();
} }
refreshData() { refreshData() {
this.astuteClientService.getInvoices().then((data) => { this.astuteClientService.getInvoices().then((data) => {
this.source = data; this.source = data;
this.source.forEach((row) => { this.source.forEach((row) => {
row.billAmt = formatCurrency(row.billAmt, 'en-US', '$', 'USD'); row.billAmt = formatCurrency(row.billAmt, 'en-US', '$', 'USD');
}); });
}); });
this.astuteClientService.getCustomers().then((data) => { this.astuteClientService.getCustomers().then((data) => {
this.customers = data; this.customers = data;
}); });
this.astuteClientService.getPOs().then((data) => { this.astuteClientService.getPOs().then((data) => {
this.pos = data; this.pos = data;
}); });
} }
getPODetails(poIndex) { getPODetails(poIndex) {
let ponum = this.pos[poIndex].ponum; let ponum = this.pos[poIndex].ponum;
this.astuteClientService.getPODetail(ponum).then((data) => { this.astuteClientService.getPODetail(ponum).then((data) => {
this.selectedInDetails = data; this.selectedInDetails = data;
console.log("inDetails:"); console.log("inDetails:");
console.log(this.selectedInDetails); console.log(this.selectedInDetails);
}); });
} }
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) {
this.newInDetails[row][col] = value; this.newInDetails[row][col] = value;
console.log(this.newInDetails); console.log(this.newInDetails);
} }
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) {
this.newInDetails.push({ this.newInDetails.push({
'invoiceNum': invoiceNum, 'invoiceNum': invoiceNum,
'lineItemNum': lineItemNum, 'lineItemNum': lineItemNum,
'poLineItemNum': poLineItemNum, 'poLineItemNum': poLineItemNum,
'feeTypeId': feeTypeId, 'feeTypeId': feeTypeId,
'serviceTypeId': serviceTypeId, 'serviceTypeId': serviceTypeId,
'desc': desc, 'desc': desc,
'qty': +qty, 'qty': +qty,
'fee': +fee, 'fee': +fee,
'remainingQty': +remainingQty, 'remainingQty': +remainingQty,
'poNum': poNum 'poNum': poNum
}); });
console.log(this.newInDetails); console.log(this.newInDetails);
} }
updateNewBillAmt() { updateNewBillAmt() {
let tot = 0; let tot = 0;
this.newInDetails.forEach((d) => { this.newInDetails.forEach((d) => {
tot += +d.qty * +d.fee; tot += +d.qty * +d.fee;
}); });
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 { assignActity(): void {
window.open('/invoice-gen'); window.open('/invoice-gen');
} }
getSelectedRows() { getSelectedRows() {
const selectedNodes = this.agGrid.api.getSelectedNodes(); const selectedNodes = this.agGrid.api.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) {
content.open(); content.open();
// this.detailDescription = ViewChild('detailDescription'); // this.detailDescription = ViewChild('detailDescription');
// this.detailAmount = ViewChild('detailAmount'); // this.detailAmount = ViewChild('detailAmount');
// this.detailRate = ViewChild('detailRate'); // this.detailRate = ViewChild('detailRate');
// this.detailTotal = ViewChild('detailTotal'); // this.detailTotal = ViewChild('detailTotal');
// if (indexINV) { // if (indexINV) {
// this.chosenInv = indexINV; // this.chosenInv = indexINV;
// } // }
// if (indexPO) { // if (indexPO) {
// this.chosenPo = indexPO; // this.chosenPo = indexPO;
// this.getPODetails(this.chosenPo); // this.getPODetails(this.chosenPo);
// } // }
// this.modalService.open(content, { size: 'lg' }).result.then((result) => { // this.modalService.open(content, { size: 'lg' }).result.then((result) => {
// this.closeResult = `Closed with: ${result}`; // this.closeResult = `Closed with: ${result}`;
// }, (reason) => { // }, (reason) => {
// this.closeResult = `Dismissed ${this.getDismissReason(reason)}`; // this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
// }); // });
} }
close(content) { close(content) {
content.close(); content.close();
// this.newInDetails = []; // this.newInDetails = [];
} }
getCurrDate() { getCurrDate() {
let d = new Date(), let d = new Date(),
month = '' + (d.getMonth() + 1), month = '' + (d.getMonth() + 1),
day = '' + d.getDate(), day = '' + d.getDate(),
year = d.getFullYear(); year = d.getFullYear();
if (month.length < 2) month = '0' + month; if (month.length < 2) month = '0' + month;
if (day.length < 2) day = '0' + day; if (day.length < 2) day = '0' + day;
return [year, month, day].join('-'); return [year, month, day].join('-');
} }
formatDate(d: Date) { formatDate(d: Date) {
let month = '' + (d.getMonth() + 1), let month = '' + (d.getMonth() + 1),
day = '' + d.getDate(), day = '' + d.getDate(),
year = d.getFullYear(); year = d.getFullYear();
if (month.length < 2) { if (month.length < 2) {
month = '0' + month; month = '0' + month;
} }
if (day.length < 2) { if (day.length < 2) {
day = '0' + day; day = '0' + day;
} }
return [year, month, day].join('-'); return [year, month, day].join('-');
} }
deleteInvoice (invoiceNum) { deleteInvoice (invoiceNum) {
if (confirm('Are you sure you want to delete invoice, ' + invoiceNum)) { if (confirm('Are you sure you want to delete invoice, ' + invoiceNum)) {
this.astuteClientService.deleteInvoice(invoiceNum).then((data) => { this.astuteClientService.deleteInvoice(invoiceNum).then((data) => {
if (data) { if (data) {
console.log('Invoice, ' + invoiceNum + ' successfully deleted'); console.log('Invoice, ' + invoiceNum + ' successfully deleted');
this.refreshData(); this.refreshData();
} else { } else {
alert ('Error in deleting; Invoice, ' + invoiceNum + ' has not been deleted'); alert ('Error in deleting; Invoice, ' + invoiceNum + ' has not been deleted');
} }
}); });
} }
} }
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;
// String poNum; // String poNum;
// String changeOrderNum; // String changeOrderNum;
// int pmtStatus; // int pmtStatus;
// Double billAmt; // Double billAmt;
// String specialNotes; // String specialNotes;
// String certification; // String certification;
// Date pmtReceivedDate; // Date pmtReceivedDate;
const invData = { const invData = {
"invoiceNumber": invoiceNumber, "invoiceNumber": invoiceNumber,
"invoiceDate": this.formatDate(new Date()), "invoiceDate": this.formatDate(new Date()),
"poNum": poNum, "poNum": poNum,
"changeOrderNum": changeOrderNum, "changeOrderNum": changeOrderNum,
"pmtStatus": +pmtStatus, "pmtStatus": +pmtStatus,
"billAmt": +billAmt, "billAmt": +billAmt,
"specialNotes": specialNotes, "specialNotes": specialNotes,
"certification": certification, "certification": certification,
"pmtReceivedDate": this.formatDate(new Date()), "pmtReceivedDate": this.formatDate(new Date()),
'invoiceStatus': status 'invoiceStatus': status
}; };
console.log(invData); console.log(invData);
this.astuteClientService.createInvoice(invData) this.astuteClientService.createInvoice(invData)
.catch((response) => { .catch((response) => {
console.log("rejected: " + response); console.log("rejected: " + response);
}) })
.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) { addInvoiceDetail(details) {
if (details.length) { if (details.length) {
// console.log(details[0]); // console.log(details[0]);
// if (details[0].poLineItemNum !== -1) { // if (details[0].poLineItemNum !== -1) {
this.astuteClientService.createInvoiceDetail(details[0]).then((data) => { this.astuteClientService.createInvoiceDetail(details[0]).then((data) => {
if (data) { if (data) {
details.splice(0, 1); details.splice(0, 1);
this.addInvoiceDetail(details); this.addInvoiceDetail(details);
} else { } else {
alert('add inv detail failed'); alert('add inv detail failed');
} }
}); });
// } else { // } else {
// desc // desc
// fee // fee
// feeTypeId // feeTypeId
// invoiceNum // invoiceNum
// lineItemNum // lineItemNum
// poLineItemNum // poLineItemNum
// qty // qty
// remainingQty // remainingQty
// serviceTypeId // serviceTypeId
// poNum // poNum
// const data = { // const data = {
// // 'lineItemNo': details[0]., // // 'lineItemNo': details[0].,
// 'poNum': details[0].poNum, // 'poNum': details[0].poNum,
// 'serviceDesc': details[0].desc, // 'serviceDesc': details[0].desc,
// 'feeTypeId': details[0].feeTypeId, // 'feeTypeId': details[0].feeTypeId,
// 'serviceTypeId': details[0].serviceTypeId, // 'serviceTypeId': details[0].serviceTypeId,
// 'qty': +details[0].qty, // 'qty': +details[0].qty,
// 'fee': +details[0].fee, // 'fee': +details[0].fee,
// 'remainingQty': +details[0].fee * +details[0].qty // 'remainingQty': +details[0].fee * +details[0].qty
// }; // };
// this.astuteClientService.createPODetail(data).then((d) => { // this.astuteClientService.createPODetail(data).then((d) => {
// if (d) { // if (d) {
// console.log (d); // console.log (d);
// } else { // } else {
// alert('create custom PO failed.'); // alert('create custom PO failed.');
// } // }
// }); // });
// } // }
} else { } else {
this.newInDetails = []; 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;
// String poNum; // String poNum;
// String changeOrderNum; // String changeOrderNum;
// int pmtStatus; // int pmtStatus;
// Double billAmt; // Double billAmt;
// String specialNotes; // String specialNotes;
// String certification; // String certification;
// Date pmtReceivedDate; // Date pmtReceivedDate;
const invData = { const invData = {
"invoiceNumber": invoiceNumber, "invoiceNumber": invoiceNumber,
"invoiceDate": new Date(), "invoiceDate": new Date(),
"poNum": poNum, "poNum": poNum,
"changeOrderNum": changeOrderNum, "changeOrderNum": changeOrderNum,
"pmtStatus": +pmtStatus, "pmtStatus": +pmtStatus,
"billAmt": +billAmt, "billAmt": +billAmt,
"specialNotes": specialNotes, "specialNotes": specialNotes,
"certification": certification, "certification": certification,
"pmtReceivedDate": new Date() "pmtReceivedDate": new Date()
}; };
this.astuteClientService.updateInvoice(invoiceNumber, invData) this.astuteClientService.updateInvoice(invoiceNumber, invData)
.catch((response) => { .catch((response) => {
console.log("rejected: " + response); console.log("rejected: " + response);
}) })
.then((data) => { .then((data) => {
if (data) { if (data) {
alert("invoice " + invoiceNumber + " updated!"); alert("invoice " + invoiceNumber + " updated!");
console.log("fulfilled: " + data); console.log("fulfilled: " + data);
// this.source[this.chosenInv] = invData; // this.source[this.chosenInv] = invData;
this.refreshData(); this.refreshData();
} else { } else {
alert("Invoice Update Failed, Check Input Fields") alert("Invoice Update Failed, Check Input Fields")
} }
}); });
} }
voidInvoice(invoiceNumber) { voidInvoice(invoiceNumber) {
this.astuteClientService.voidInvoice(invoiceNumber).then((data) => { if (confirm('Are you sure you want to void invoice, ' + invoiceNumber)) {
if (data) { this.astuteClientService.voidInvoice(invoiceNumber).then((data) => {
this.refreshData(); if (data) {
} else { this.refreshData();
alert('void invoice failed.'); } else {
} alert('void invoice failed.');
}); }
} });
}
submitInvoice(invoiceNumber) { }
this.astuteClientService.submitInvoice(invoiceNumber).then((data) => {
if (data) { submitInvoice(invoiceNumber) {
this.refreshData(); this.astuteClientService.submitInvoice(invoiceNumber).then((data) => {
} else { if (data) {
alert('submit invoice failed.'); this.refreshData();
} } else {
}); alert('submit invoice failed.');
} }
});
getPerc(amt, total): number { }
return Math.floor(((amt) / total) * 100);
} getPerc(amt, total): number {
return Math.floor(((amt) / total) * 100);
getRangeMax(total, num) { }
return Math.floor(total / num);
} getRangeMax(total, num) {
return Math.floor(total / num);
setCorrespondingPos() { }
this.correspondingPos = this.pos.filter((po, index, array) => {
return po.customerId === this.chosenCustomerID; setCorrespondingPos() {
}); this.correspondingPos = this.pos.filter((po, index, array) => {
} return po.customerId === this.chosenCustomerID;
} });
}
}

View File

@ -1,382 +1,382 @@
<app-nav-bar [salesOrderActive]="true"></app-nav-bar> <app-nav-bar [salesOrderActive]="true"></app-nav-bar>
<h1 align="center">Sales Orders</h1> <h1 align="center">Sales Orders</h1>
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<ag-grid-angular <ag-grid-angular
#agGrid #agGrid
style="height: 500px;" style="height: 500px;"
class="ag-theme-balham" class="ag-theme-balham"
[enableSorting]="true" [enableSorting]="true"
[enableFilter]="true" [enableFilter]="true"
[rowData]="rowData" [rowData]="rowData"
[columnDefs]="columnDefs" [columnDefs]="columnDefs"
rowSelection="single" rowSelection="single"
></ag-grid-angular> ></ag-grid-angular>
</div> </div>
</div> </div>
<div class="row justify-content-center mt-2"> <div class="row justify-content-center mt-2">
<div class="col-6"> <div class="col-6">
<button class="btn btn-primary" style="width: 100%" (click)="open(edit)">Edit Sales Order</button> <button class="btn btn-primary" style="width: 100%" (click)="open(edit)">Edit Sales Order</button>
</div> </div>
<div class="col-6"> <div class="col-6">
<button class="btn btn-success" style="width: 100%" (click)="open(new)">Add Sales Order</button> <button class="btn btn-success" style="width: 100%" (click)="open(new)">Add Sales Order</button>
</div> </div>
</div> </div>
</div> </div>
<!--MODAL: new po--> <!--MODAL: new po-->
<app-modal-form [title]="'New Sales Order'" #new> <app-modal-form [title]="'New Sales Order'" #new>
<div class="modal-body"> <div class="modal-body">
<p class="h4 text-right">General</p> <p class="h4 text-right">General</p>
<hr> <hr>
<table class="table table-borderless table-sm"> <table class="table table-borderless table-sm">
<tbody> <tbody>
<tr> <tr>
<td><span class="input-group-text">Astute Proj. No.</span></td> <td><span class="input-group-text">Astute Proj. No.</span></td>
<td colspan="3"><input type="text" class="form-control" placeholder="Internal Project Number" #projNum></td> <td colspan="3"><input type="text" class="form-control" placeholder="Internal Project Number" #projNum></td>
</tr> </tr>
<tr> <tr>
<td><span class="input-group-text">Customer</span></td> <td><span class="input-group-text">Customer</span></td>
<td colspan="3"> <td colspan="3">
<select class="form-control" #customerid> <select class="form-control" #customerid>
<option [value]="-1">Choose Customer...</option> <option [value]="-1">Choose Customer...</option>
<option *ngFor="let customer of customers" [value]="customer.customerId">{{customer.customerName}}</option> <option *ngFor="let customer of customers" [value]="customer.customerId">{{customer.customerName}}</option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><span class="input-group-text">SO Title</span></td> <td><span class="input-group-text">SO Title</span></td>
<td colspan="3"><input type="text" class="form-control" placeholder="Distinctive title, will be use to identify later" #title></td> <td colspan="3"><input type="text" class="form-control" placeholder="Distinctive title, will be use to identify later" #title></td>
</tr> </tr>
<tr> <tr>
<td style="width: 20%"><span class="input-group-text">SO Number</span></td> <td style="width: 20%"><span class="input-group-text">SO Number</span></td>
<td style="width: 30%"><input type="text" class="form-control" placeholder="Internal SO Number" maxlength="40" #ponum></td> <td style="width: 30%"><input type="text" class="form-control" placeholder="Internal SO Number" maxlength="40" #ponum></td>
<td style="width: 20%"><span class="input-group-text">SO Date</span></td> <td style="width: 20%"><span class="input-group-text">SO Date</span></td>
<td style="width: 30%"><input type="date" class="form-control" [value]="getCurrDate()" (change)="printValue(podate.value)" #podate></td> <td style="width: 30%"><input type="date" class="form-control" [value]="getCurrDate()" (change)="printValue(podate.value)" #podate></td>
</tr> </tr>
<tr> <tr>
<td style="width: 20%"><span class="input-group-text">Contract Number</span></td> <td style="width: 20%"><span class="input-group-text">Contract Number</span></td>
<td style="width: 30%"><input type="text" class="form-control" placeholder="External Contract Number" #contractnum></td> <td style="width: 30%"><input type="text" class="form-control" placeholder="External Contract Number" #contractnum></td>
<td style="width: 20%"><span class="input-group-text">Contract Amount</span></td> <td style="width: 20%"><span class="input-group-text">Contract Amount</span></td>
<td style="width: 30%"><input type="text" class="form-control" placeholder="Derived From Details" [value]="newContractAmount | currency" #contractamt disabled></td> <td style="width: 30%"><input type="text" class="form-control" placeholder="Derived From Details" [value]="newContractAmount | currency" #contractamt disabled></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<!--fee--> <!--fee-->
<!--feeTypeId--> <!--feeTypeId-->
<!--lineItemNo--> <!--lineItemNo-->
<!--ponum--> <!--ponum-->
<!--qty--> <!--qty-->
<!--remainingQty--> <!--remainingQty-->
<!--serviceDesc--> <!--serviceDesc-->
<!--serviceTypeId--> <!--serviceTypeId-->
<!--Detail--> <!--Detail-->
<div class="modal-body"> <div class="modal-body">
<p class="h4 text-right">Detail</p> <p class="h4 text-right">Detail</p>
<hr> <hr>
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th scope="col"></th> <th scope="col"></th>
<th scope="col" style="width: 50px">#</th> <th scope="col" style="width: 50px">#</th>
<th scope="col">Description</th> <th scope="col">Description</th>
<th scope="col">Rate Type</th> <th scope="col">Rate Type</th>
<th scope="col">Service Type</th> <th scope="col">Service Type</th>
<th scope="col" style="width: 75px">Qty(#)</th> <th scope="col" style="width: 75px">Qty(#)</th>
<th scope="col" style="width: 100px">Rate($)</th> <th scope="col" style="width: 100px">Rate($)</th>
</tr> </tr>
</thead> </thead>
<tbody *ngFor="let poDetail of newPODetail; let i = index"> <tbody *ngFor="let poDetail of newPODetail; let i = index">
<tr class="p-0 m-0"> <tr class="p-0 m-0">
<td class="p-1 m-0"> <td class="p-1 m-0">
<button class="btn btn-outline-danger" type="button" (click)="newPODetail.splice(i, 1);"> <button class="btn btn-outline-danger" type="button" (click)="newPODetail.splice(i, 1);">
- -
</button> </button>
</td> </td>
<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="poDetail.lineItemNo" (change)="onNewCellChange(i, 'lineItemNo', lineItemNo.value)" #lineItemNo></td> <td class="p-0 m-0"><input type="number" class="form-control cell" [value]="poDetail.lineItemNo" (change)="onNewCellChange(i, 'lineItemNo', lineItemNo.value)" #lineItemNo></td>
<td class="p-0 m-0"> <td class="p-0 m-0">
<textarea style="height: 36px" class="form-control cell" [value]="poDetail.serviceDesc" (change)="onNewCellChange(i, 'serviceDesc', serviceDesc.value)" #serviceDesc></textarea> <textarea style="height: 36px" class="form-control cell" [value]="poDetail.serviceDesc" (change)="onNewCellChange(i, 'serviceDesc', serviceDesc.value)" #serviceDesc></textarea>
<!--<input type="text" class="form-control cell" [value]="poDetail.serviceDesc" (change)="onNewCellChange(i, 'serviceDesc', serviceDesc.value)" #serviceDesc>--> <!--<input type="text" class="form-control cell" [value]="poDetail.serviceDesc" (change)="onNewCellChange(i, 'serviceDesc', serviceDesc.value)" #serviceDesc>-->
</td> </td>
<td class="p-0 m-0"> <td class="p-0 m-0">
<select class="form-control cell" [value]="poDetail.feeTypeId" (change)="onNewCellChange(i, 'feeTypeId', feeTypeId.value)" #feeTypeId> <select class="form-control cell" [value]="poDetail.feeTypeId" (change)="onNewCellChange(i, 'feeTypeId', feeTypeId.value)" #feeTypeId>
<option value="1">Fixed Fee</option> <option value="1">Fixed Fee</option>
<option value="2">Hourly</option> <option value="2">Hourly</option>
</select> </select>
</td> </td>
<td class="p-0 m-0"> <td class="p-0 m-0">
<select class="form-control cell" [value]="poDetail.serviceTypeId" (change)="onNewCellChange(i, 'serviceTypeId', serviceTypeId.value)" #serviceTypeId> <select class="form-control cell" [value]="poDetail.serviceTypeId" (change)="onNewCellChange(i, 'serviceTypeId', serviceTypeId.value)" #serviceTypeId>
<option value="1">Study</option> <option value="1">Study</option>
<option value="2">Design</option> <option value="2">Design</option>
<option value="3">Peer Review</option> <option value="3">Peer Review</option>
<option value="4">Cost Estimation</option> <option value="4">Cost Estimation</option>
<option value="5">Forensic Investigation</option> <option value="5">Forensic Investigation</option>
</select> </select>
</td> </td>
<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="+poDetail.qty" (change)="onNewCellChange(i, 'qty', qty.value); onNewCellChange(i, 'remainingQty', qty.value * fee.value); updateNewContractAmt();" #qty></td> <td class="p-0 m-0"><input type="number" class="form-control cell" [value]="+poDetail.qty" (change)="onNewCellChange(i, 'qty', qty.value); onNewCellChange(i, 'remainingQty', qty.value * fee.value); updateNewContractAmt();" #qty></td>
<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="+poDetail.fee" (change)="onNewCellChange(i, 'fee', fee.value); onNewCellChange(i, 'remainingQty', qty.value * fee.value); updateNewContractAmt();" #fee></td> <td class="p-0 m-0"><input type="number" class="form-control cell" [value]="+poDetail.fee" (change)="onNewCellChange(i, 'fee', fee.value); onNewCellChange(i, 'remainingQty', qty.value * fee.value); updateNewContractAmt();" #fee></td>
<!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="poDetail.remainingQty" [id]="'remainingQty' + i"></td>--> <!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="poDetail.remainingQty" [id]="'remainingQty' + i"></td>-->
</tr> </tr>
</tbody> </tbody>
<tr class="p-0 m-0"> <tr class="p-0 m-0">
<td class="p-1 m-0"> <td class="p-1 m-0">
<button class="btn btn-success" type="button" <button class="btn btn-success" type="button"
[disabled]="!ponum.value" [disabled]="!ponum.value"
(click)="pushOntoNewDetail(newPODetail.length + 1, ponum.value, '', '1', '1', 1, 0, 0)"> (click)="pushOntoNewDetail(newPODetail.length + 1, ponum.value, '', '1', '1', 1, 0, 0)">
<!--(click)="pushOntoNewDetail((lineItemNo) ? lineItemNo.value + 1: 1, ponum.value, serviceDesc.value,--> <!--(click)="pushOntoNewDetail((lineItemNo) ? lineItemNo.value + 1: 1, ponum.value, serviceDesc.value,-->
<!--feeTypeId.value, serviceTypeId.value, qty.value, fee.value, 0)">--> <!--feeTypeId.value, serviceTypeId.value, qty.value, fee.value, 0)">-->
+</button> +</button>
</td> </td>
<!--<td class="p-0 m-0">--> <!--<td class="p-0 m-0">-->
<!--<input type="number" class="form-control cell" [value]="(selectedPODetail.length) ? selectedPODetail[selectedPODetail.length-1].lineItemNo + 1: 1" #lineItemNo>--> <!--<input type="number" class="form-control cell" [value]="(selectedPODetail.length) ? selectedPODetail[selectedPODetail.length-1].lineItemNo + 1: 1" #lineItemNo>-->
<!--</td>--> <!--</td>-->
<!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="''" #serviceDesc></td>--> <!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="''" #serviceDesc></td>-->
<!--<td class="p-0 m-0">--> <!--<td class="p-0 m-0">-->
<!--<select class="form-control cell" [value]="1" #feeTypeId>--> <!--<select class="form-control cell" [value]="1" #feeTypeId>-->
<!--<option value="1">Fixed Fee</option>--> <!--<option value="1">Fixed Fee</option>-->
<!--<option value="2">Hourly</option>--> <!--<option value="2">Hourly</option>-->
<!--</select>--> <!--</select>-->
<!--</td>--> <!--</td>-->
<!--<td class="p-0 m-0">--> <!--<td class="p-0 m-0">-->
<!--<select class="form-control cell" [value]="1" #serviceTypeId>--> <!--<select class="form-control cell" [value]="1" #serviceTypeId>-->
<!--<option value="1">Study</option>--> <!--<option value="1">Study</option>-->
<!--<option value="2">Design</option>--> <!--<option value="2">Design</option>-->
<!--<option value="3">Peer Review</option>--> <!--<option value="3">Peer Review</option>-->
<!--<option value="4">Cost Estimation</option>--> <!--<option value="4">Cost Estimation</option>-->
<!--<option value="5">Forensic Investigation</option>--> <!--<option value="5">Forensic Investigation</option>-->
<!--</select>--> <!--</select>-->
<!--</td>--> <!--</td>-->
<!--<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="1" #qty></td>--> <!--<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="1" #qty></td>-->
<!--<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="0" #fee></td>--> <!--<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="0" #fee></td>-->
<!--&lt;!&ndash;<td class="p-0 m-0"><input type="number" class="form-control cell" #remainingQty></td>&ndash;&gt;--> <!--&lt;!&ndash;<td class="p-0 m-0"><input type="number" class="form-control cell" #remainingQty></td>&ndash;&gt;-->
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button class="btn btn-success" type="button" <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)" (click)="addPo(projNum.value, ponum.value, podate.value, customerid.value, contractnum.value, contractamt.value.replace('$', '').replace(',', ''), title.value, new)"
> >
Add Add
</button> </button>
<button class="btn btn-outline-danger" (click)="close(new)">Cancel</button> <button class="btn btn-outline-danger" (click)="close(new)">Cancel</button>
</div> </div>
</app-modal-form> </app-modal-form>
<!--MODAL: edit po--> <!--MODAL: edit po-->
<app-modal-form [title]="'Edit Sales Order'" #edit> <app-modal-form [title]="'Edit Sales Order'" #edit>
<div *ngIf="selected"> <div *ngIf="selected">
<div class="modal-body"> <div class="modal-body">
<p class="h4 text-right">General</p> <p class="h4 text-right">General</p>
<hr> <hr>
<table class="table table-borderless table-sm"> <table class="table table-borderless table-sm">
<tbody> <tbody>
<tr> <tr>
<td><span class="input-group-text">Astute Proj. No.</span></td> <td><span class="input-group-text">Astute Proj. No.</span></td>
<td colspan="3"><input type="text" class="form-control" placeholder="Project Number" [value]="selected.astuteProjectNumber" #projNum></td> <td colspan="3"><input type="text" class="form-control" placeholder="Project Number" [value]="selected.astuteProjectNumber" #projNum></td>
</tr> </tr>
<tr> <tr>
<td><span class="input-group-text">Customer</span></td> <td><span class="input-group-text">Customer</span></td>
<td colspan="3"> <td colspan="3">
<select class="form-control" [value]="selected.customerId" disabled="true" #customerid> <select class="form-control" [value]="selected.customerId" disabled="true" #customerid>
<option [value]="-1">No Customer</option> <option [value]="-1">No Customer</option>
<option *ngFor="let customer of customers" [value]="customer.customerId">{{customer.customerName}}</option> <option *ngFor="let customer of customers" [value]="customer.customerId">{{customer.customerName}}</option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><span class="input-group-text">SO Title</span></td> <td><span class="input-group-text">SO Title</span></td>
<td colspan="3"><input type="text" class="form-control" placeholder="SO Title" [value]="selected.title" #title></td> <td colspan="3"><input type="text" class="form-control" placeholder="SO Title" [value]="selected.title" #title></td>
</tr> </tr>
<tr> <tr>
<td style="width: 20%"><span class="input-group-text">SO Number</span></td> <td style="width: 20%"><span class="input-group-text">SO Number</span></td>
<td style="width: 30%"><input type="text" class="form-control" placeholder="SO Number" maxlength="40" [value]="selected.ponum" #ponum disabled></td> <td style="width: 30%"><input type="text" class="form-control" placeholder="SO Number" maxlength="40" [value]="selected.ponum" #ponum disabled></td>
<td style="width: 20%"><span class="input-group-text">SO Date</span></td> <td style="width: 20%"><span class="input-group-text">SO Date</span></td>
<td style="width: 30%"><input type="date" class="form-control" [value]="selected.podate" #podate></td> <td style="width: 30%"><input type="date" class="form-control" [value]="selected.podate" #podate></td>
</tr> </tr>
<tr> <tr>
<td style="width: 20%"><span class="input-group-text">Contract Number</span></td> <td style="width: 20%"><span class="input-group-text">Contract Number</span></td>
<td style="width: 30%"><input type="text" class="form-control" placeholder="Contract Number" [value]="selected.contractNum" #contractnum></td> <td style="width: 30%"><input type="text" class="form-control" placeholder="Contract Number" [value]="selected.contractNum" #contractnum></td>
<td style="width: 20%"><span class="input-group-text">Contract Amount</span></td> <td style="width: 20%"><span class="input-group-text">Contract Amount</span></td>
<td style="width: 30%"><input type="text" class="form-control" placeholder="Contract Amount" [value]="editContractAmount | currency" #contractamt disabled></td> <td style="width: 30%"><input type="text" class="form-control" placeholder="Contract Amount" [value]="editContractAmount | currency" #contractamt disabled></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<!--<form>--> <!--<form>-->
<!--<div class="form-group row">--> <!--<div class="form-group row">-->
<!--<label class="col-sm-2 col-form-label">Astute Project Number</label>--> <!--<label class="col-sm-2 col-form-label">Astute Project Number</label>-->
<!--<div class="col-sm-10">--> <!--<div class="col-sm-10">-->
<!--<input type="text" class="form-control" placeholder="Project Number" [value]="selected.astuteProjectNumber" #projNum>--> <!--<input type="text" class="form-control" placeholder="Project Number" [value]="selected.astuteProjectNumber" #projNum>-->
<!--</div>--> <!--</div>-->
<!--</div>--> <!--</div>-->
<!--<div class="form-group row">--> <!--<div class="form-group row">-->
<!--<label class="col-sm-2 col-form-label">Customer Name</label>--> <!--<label class="col-sm-2 col-form-label">Customer Name</label>-->
<!--<div class="col-sm-10">--> <!--<div class="col-sm-10">-->
<!--<select class="form-control" [value]="selected.customerId" #customerid disabled>--> <!--<select class="form-control" [value]="selected.customerId" #customerid disabled>-->
<!--<option *ngFor="let customer of customers" [value]="customer.customerId">{{customer.customerName}}--> <!--<option *ngFor="let customer of customers" [value]="customer.customerId">{{customer.customerName}}-->
<!--</option>--> <!--</option>-->
<!--</select>--> <!--</select>-->
<!--</div>--> <!--</div>-->
<!--</div>--> <!--</div>-->
<!--<div class="form-group row">--> <!--<div class="form-group row">-->
<!--<label class="col-sm-2 col-form-label">SO Title</label>--> <!--<label class="col-sm-2 col-form-label">SO Title</label>-->
<!--<div class="col-sm-10">--> <!--<div class="col-sm-10">-->
<!--<input type="text" class="form-control" [value]="selected.title" #title>--> <!--<input type="text" class="form-control" [value]="selected.title" #title>-->
<!--</div>--> <!--</div>-->
<!--</div>--> <!--</div>-->
<!--<div class="form-group row">--> <!--<div class="form-group row">-->
<!--<label class="col-sm-2 col-form-label">SO Number</label>--> <!--<label class="col-sm-2 col-form-label">SO Number</label>-->
<!--<div class="col-sm-10">--> <!--<div class="col-sm-10">-->
<!--<input type="text" class="form-control" placeholder="SO Number" [value]="selected.ponum" #ponum disabled>--> <!--<input type="text" class="form-control" placeholder="SO Number" [value]="selected.ponum" #ponum disabled>-->
<!--</div>--> <!--</div>-->
<!--</div>--> <!--</div>-->
<!--<div class="form-group row">--> <!--<div class="form-group row">-->
<!--<label class="col-sm-2 col-form-label">SO Date</label>--> <!--<label class="col-sm-2 col-form-label">SO Date</label>-->
<!--<div class="col-sm-10">--> <!--<div class="col-sm-10">-->
<!--<input type="date" class="form-control" [value]="selected.podate" #podate>--> <!--<input type="date" class="form-control" [value]="selected.podate" #podate>-->
<!--</div>--> <!--</div>-->
<!--</div>--> <!--</div>-->
<!--<div class="form-group row">--> <!--<div class="form-group row">-->
<!--<label class="col-sm-2 col-form-label">Contract Number</label>--> <!--<label class="col-sm-2 col-form-label">Contract Number</label>-->
<!--<div class="col-sm-10">--> <!--<div class="col-sm-10">-->
<!--<input type="text" class="form-control" placeholder="Contract Number" [value]="selected.contractNum"--> <!--<input type="text" class="form-control" placeholder="Contract Number" [value]="selected.contractNum"-->
<!--#contractnum>--> <!--#contractnum>-->
<!--</div>--> <!--</div>-->
<!--</div>--> <!--</div>-->
<!--<div class="form-group row">--> <!--<div class="form-group row">-->
<!--<label class="col-sm-2 col-form-label">Contract Amount</label>--> <!--<label class="col-sm-2 col-form-label">Contract Amount</label>-->
<!--<div class="col-sm-10">--> <!--<div class="col-sm-10">-->
<!--<input type="text" class="form-control" placeholder="Contract Amount" [value]="selected.contractAmt"--> <!--<input type="text" class="form-control" placeholder="Contract Amount" [value]="selected.contractAmt"-->
<!--#contractamt>--> <!--#contractamt>-->
<!--</div>--> <!--</div>-->
<!--</div>--> <!--</div>-->
<!--</form>--> <!--</form>-->
</div> </div>
<!--fee--> <!--fee-->
<!--feeTypeId--> <!--feeTypeId-->
<!--lineItemNo--> <!--lineItemNo-->
<!--ponum--> <!--ponum-->
<!--qty--> <!--qty-->
<!--remainingQty--> <!--remainingQty-->
<!--serviceDesc--> <!--serviceDesc-->
<!--serviceTypeId--> <!--serviceTypeId-->
<!--Detail--> <!--Detail-->
<div class="modal-body" *ngIf="selectedPODetail"> <div class="modal-body" *ngIf="selectedPODetail">
<p class="h4 text-right">Detail</p> <p class="h4 text-right">Detail</p>
<hr> <hr>
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th scope="col" style="width: 50px">#</th> <th scope="col" style="width: 50px">#</th>
<!--<th scope="col">Purchase Order Number</th>--> <!--<th scope="col">Purchase Order Number</th>-->
<th scope="col">Description</th> <th scope="col">Description</th>
<th scope="col">Rate Type</th> <th scope="col">Rate Type</th>
<th scope="col">Service Type</th> <th scope="col">Service Type</th>
<th scope="col" style="width: 75px">Qty(#)</th> <th scope="col" style="width: 75px">Quantity</th>
<th scope="col" style="width: 100px">Rate($)</th> <th scope="col" style="width: 100px">Rate</th>
<!--<th scope="col">Remaining Quantity</th>--> <!--<th scope="col">Remaining Quantity</th>-->
</tr> </tr>
</thead> </thead>
<!--<tbody>--> <!--<tbody>-->
<tbody *ngFor="let poDetail of selectedPODetail; let i = index"> <tbody *ngFor="let poDetail of selectedPODetail; let i = index">
<tr class="p-0 m-0"> <tr class="p-0 m-0">
<!--<td class="p-0 m-0">--> <!--<td class="p-0 m-0">-->
<!--<button class="btn btn-outline-danger" type="button" (click)="selectedPODetail.splice(i, 1);">--> <!--<button class="btn btn-outline-danger" type="button" (click)="selectedPODetail.splice(i, 1);">-->
<!-- - --> <!-- - -->
<!--</button>--> <!--</button>-->
<!--</td>--> <!--</td>-->
<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="poDetail.lineItemNo" (change)="onSelectedCellChange(i, 'lineItemNo', lineItemNo.value)" #lineItemNo></td> <td class="p-0 m-0"><input type="number" class="form-control cell" [value]="poDetail.lineItemNo" (change)="onSelectedCellChange(i, 'lineItemNo', lineItemNo.value)" #lineItemNo></td>
<!--<td class="p-0"><input type="text" class="form-control cell" [value]="poDetail.ponum"></td>--> <!--<td class="p-0"><input type="text" class="form-control cell" [value]="poDetail.ponum"></td>-->
<td class="p-0 m-0"> <td class="p-0 m-0">
<textarea style="height: 36px" class="form-control cell" [value]="poDetail.serviceDesc" (change)="onSelectedCellChange(i, 'serviceDesc', serviceDesc.value)" #serviceDesc></textarea> <textarea style="height: 36px" class="form-control cell" [value]="poDetail.serviceDesc" (change)="onSelectedCellChange(i, 'serviceDesc', serviceDesc.value)" #serviceDesc></textarea>
<!--<input type="text" class="form-control cell" [value]="poDetail.serviceDesc" (change)="onSelectedCellChange(i, 'serviceDesc', serviceDesc.value)" #serviceDesc>--> <!--<input type="text" class="form-control cell" [value]="poDetail.serviceDesc" (change)="onSelectedCellChange(i, 'serviceDesc', serviceDesc.value)" #serviceDesc>-->
</td> </td>
<td class="p-0 m-0"> <td class="p-0 m-0">
<select class="form-control cell" [value]="poDetail.feeTypeId" (change)="onSelectedCellChange(i, 'feeTypeId', feeTypeId.value)" #feeTypeId> <select class="form-control cell" [value]="poDetail.feeTypeId" (change)="onSelectedCellChange(i, 'feeTypeId', feeTypeId.value)" #feeTypeId>
<option value="1">Fixed Fee</option> <option value="1">Fixed Fee</option>
<option value="2">Hourly</option> <option value="2">Hourly</option>
</select> </select>
<!--<input type="number" class="form-control cell" [value]="poDetail.feeTypeId">--> <!--<input type="number" class="form-control cell" [value]="poDetail.feeTypeId">-->
</td> </td>
<td class="p-0 m-0"> <td class="p-0 m-0">
<select class="form-control cell" [value]="poDetail.serviceTypeId" (change)="onSelectedCellChange(i, 'serviceTypeId', serviceTypeId.value)" #serviceTypeId> <select class="form-control cell" [value]="poDetail.serviceTypeId" (change)="onSelectedCellChange(i, 'serviceTypeId', serviceTypeId.value)" #serviceTypeId>
<option [value]="serviceType.serviceTypeId" *ngFor="let serviceType of serviceTypes">{{serviceType.desc}}</option> <option [value]="serviceType.serviceTypeId" *ngFor="let serviceType of serviceTypes">{{serviceType.desc}}</option>
<!--<option value="">Study</option>--> <!--<option value="">Study</option>-->
<!--<option value="2">Design</option>--> <!--<option value="2">Design</option>-->
<!--<option value="3">Peer Review</option>--> <!--<option value="3">Peer Review</option>-->
<!--<option value="4">Cost Estimation</option>--> <!--<option value="4">Cost Estimation</option>-->
<!--<option value="5">Forensic Investigation</option>--> <!--<option value="5">Forensic Investigation</option>-->
</select> </select>
<!--<input type="number" class="form-control cell" [value]="poDetail.serviceTypeId" #serviceTypeId>--> <!--<input type="number" class="form-control cell" [value]="poDetail.serviceTypeId" #serviceTypeId>-->
</td> </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.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>--> <!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="poDetail.remainingQty" [id]="'remainingQty' + i"></td>-->
</tr> </tr>
</tbody> </tbody>
<tr class="p-0 m-0"> <tr class="p-0 m-0">
<td class="p-1 m-0"> <td class="p-1 m-0">
<button class="btn btn-success" type="button" <button class="btn btn-success" type="button"
(click)="pushOntoSelectedDetail(selectedPODetail.length + 1, ponum.value, '', '1', '1', 1, 0, 0)"> (click)="pushOntoSelectedDetail(selectedPODetail.length + 1, ponum.value, '', '1', '1', 1, 0, 0)">
<!--(click)="pushOntoSelectedDetail(selectedPODetail[selectedPODetail.length-1].lineItemNo + 1, selected.ponum, serviceDesc.value,--> <!--(click)="pushOntoSelectedDetail(selectedPODetail[selectedPODetail.length-1].lineItemNo + 1, selected.ponum, serviceDesc.value,-->
<!--feeTypeId.value, serviceTypeId.value, qty.value, fee.value, 0)">--> <!--feeTypeId.value, serviceTypeId.value, qty.value, fee.value, 0)">-->
+</button> +</button>
</td> </td>
<!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="''" #serviceDesc></td>--> <!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="''" #serviceDesc></td>-->
<!--<td class="p-0 m-0">--> <!--<td class="p-0 m-0">-->
<!--<select class="form-control cell" [value]="1" #feeTypeId>--> <!--<select class="form-control cell" [value]="1" #feeTypeId>-->
<!--<option value="1">Fixed Fee</option>--> <!--<option value="1">Fixed Fee</option>-->
<!--<option value="2">Hourly</option>--> <!--<option value="2">Hourly</option>-->
<!--</select>--> <!--</select>-->
<!--</td>--> <!--</td>-->
<!--<td class="p-0 m-0">--> <!--<td class="p-0 m-0">-->
<!--<select class="form-control cell" [value]="1" #serviceTypeId>--> <!--<select class="form-control cell" [value]="1" #serviceTypeId>-->
<!--<option value="1">Study</option>--> <!--<option value="1">Study</option>-->
<!--<option value="2">Design</option>--> <!--<option value="2">Design</option>-->
<!--<option value="3">Peer Review</option>--> <!--<option value="3">Peer Review</option>-->
<!--<option value="4">Cost Estimation</option>--> <!--<option value="4">Cost Estimation</option>-->
<!--<option value="5">Forensic Investigation</option>--> <!--<option value="5">Forensic Investigation</option>-->
<!--</select>--> <!--</select>-->
<!--</td>--> <!--</td>-->
<!--<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="0" #qty></td>--> <!--<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="0" #qty></td>-->
<!--<td class="p-0 m-0"><input type="number" class="form-control cell" #remainingQty></td>--> <!--<td class="p-0 m-0"><input type="number" class="form-control cell" #remainingQty></td>-->
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button class="btn btn-success" type="button" <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)" (click)="editPo(projNum.value, ponum.value, podate.value, contractnum.value, contractamt.value.replace(',', '').replace('$', ''), title.value, edit)"
> >
Update Update
</button> </button>
<button class="btn btn-outline-danger" (click)="close(edit)">Cancel</button> <button class="btn btn-outline-danger" (click)="close(edit)">Cancel</button>
</div> </div>
</div> </div>
<div *ngIf="!selected"> <div *ngIf="!selected">
<div class="modal-body"> <div class="modal-body">
Choose a Sales Order First! Choose a Sales Order First!
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button class="btn btn-success" type="button" <button class="btn btn-success" type="button"
[disabled]="true" [disabled]="true"
> >
Update Update
</button> </button>
<button class="btn btn-outline-danger" (click)="close(edit)">Cancel</button> <button class="btn btn-outline-danger" (click)="close(edit)">Cancel</button>
</div> </div>
</div> </div>
</app-modal-form> </app-modal-form>

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -46,13 +46,7 @@ public abstract class DAO {
* @throws AstuteException * @throws AstuteException
*/ */
public static void init() throws AstuteException { public static void init() throws AstuteException {
try { // 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);
// Properties props = new Properties(); // Properties props = new Properties();
// InputStream input = new FileInputStream("db.config"); // InputStream input = new FileInputStream("db.config");
@ -60,12 +54,18 @@ public abstract class DAO {
// props.load(input); // props.load(input);
//get properties //get properties
database = props.getProperty("database"); // database = props.getProperty("database");
host = props.getProperty("host"); // host = props.getProperty("host");
port = Integer.parseInt(props.getProperty("port")); // port = Integer.parseInt(props.getProperty("port"));
schema = props.getProperty("schema"); // schema = props.getProperty("schema");
username = props.getProperty("username"); // username = props.getProperty("username");
password = props.getProperty("password"); // password = props.getProperty("password");
database = "sql";
host = "localhost";
port = 3306;
schema = "astute";
username = "root";
password = "password";
System.out.println("============================================="); System.out.println("=============================================");
System.out.println("host is " + host); System.out.println("host is " + host);
System.out.println("port is " + port); System.out.println("port is " + port);
@ -74,9 +74,9 @@ public abstract class DAO {
System.out.println("password is " + password); System.out.println("password is " + password);
System.out.println("============================================="); System.out.println("=============================================");
dao = new SqlDAO(); dao = new SqlDAO();
} catch (IOException e) { // } catch (IOException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
} }
public Connection conn; public Connection conn;
@ -166,9 +166,9 @@ public abstract class DAO {
public abstract List<InvoicePayment> getInvoicePayments(String invoiceNum) throws AstuteException; 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; public abstract List<PaymentType> getPaymentTypes() throws AstuteException;
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,99 +1,117 @@
package com.astute.model; package com.astute.model;
import java.util.Date; public class Invoice {
String invoiceNumber;
public class Invoice { String invoiceDate;
String invoiceNumber; String poNum;
String invoiceDate; String changeOrderNum;
String poNum; String pmtStatusDesc;
String changeOrderNum; int pmtStatus;
int pmtStatus; Double billAmt;
Double billAmt; String specialNotes;
String specialNotes; String certification;
String certification; int invoiceStatus;
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.invoiceNumber = invoiceNumber;
this.invoiceDate = invoiceDate; this.invoiceDate = invoiceDate;
this.poNum = poNum; this.poNum = poNum;
this.pmtStatus = pmtStatus; this.pmtStatus = pmtStatus;
this.billAmt = billAmt; this.billAmt = billAmt;
this.specialNotes = specialNotes; this.specialNotes = specialNotes;
this.certification = certification; this.certification = certification;
this.invoiceStatus = invoiceStatus; this.invoiceStatus = invoiceStatus;
} this.pmtStatusDesc = pmtStatusDesc;
this.customerId = customerId;
public String getInvoiceNumber() { }
return invoiceNumber; public String getInvoiceNumber() {
}
return invoiceNumber;
public void setInvoiceNumber(String invoiceNumber) { }
this.invoiceNumber = invoiceNumber;
} public void setInvoiceNumber(String invoiceNumber) {
this.invoiceNumber = invoiceNumber;
public String getInvoiceDate() { }
return invoiceDate;
} public String getInvoiceDate() {
return invoiceDate;
public void setInvoiceDate(String invoiceDate) { }
this.invoiceDate = invoiceDate;
} public void setInvoiceDate(String invoiceDate) {
this.invoiceDate = invoiceDate;
public String getPoNum() { }
return poNum;
} public String getPoNum() {
return poNum;
public void setPoNum(String poNum) { }
this.poNum = poNum;
} public void setPoNum(String poNum) {
this.poNum = poNum;
public String getChangeOrderNum() { }
return changeOrderNum;
} public String getChangeOrderNum() {
return changeOrderNum;
public void setChangeOrderNum(String changeOrderNum) { }
this.changeOrderNum = changeOrderNum;
} public void setChangeOrderNum(String changeOrderNum) {
this.changeOrderNum = changeOrderNum;
public int getPmtStatus() { }
return pmtStatus;
} public String getPmtStatusDesc() {
return pmtStatusDesc;
public void setPmtStatus(int pmtStatus) { }
this.pmtStatus = pmtStatus;
} public void setPmtStatusDesc(String pmtStatusDesc) {
this.pmtStatusDesc = pmtStatusDesc;
public Double getBillAmt() { }
return billAmt;
} public int getPmtStatus() {
return pmtStatus;
public void setBillAmt(Double billAmt) { }
this.billAmt = billAmt;
} public void setPmtStatus(int pmtStatus) {
this.pmtStatus = pmtStatus;
public String getSpecialNotes() { }
return specialNotes;
} public Double getBillAmt() {
return billAmt;
public void setSpecialNotes(String specialNotes) { }
this.specialNotes = specialNotes;
} public void setBillAmt(Double billAmt) {
this.billAmt = billAmt;
public String getCertification() { }
return certification;
} public String getSpecialNotes() {
return specialNotes;
public void setCertification(String certification) { }
this.certification = certification;
} public void setSpecialNotes(String specialNotes) {
this.specialNotes = specialNotes;
public int getInvoiceStatus() { }
return invoiceStatus;
} public String getCertification() {
return certification;
public void setInvoiceStatus(int invoiceStatus) { }
this.invoiceStatus = invoiceStatus;
} public void setCertification(String certification) {
} this.certification = certification;
}
public int getInvoiceStatus() {
return invoiceStatus;
}
public void setInvoiceStatus(int invoiceStatus) {
this.invoiceStatus = invoiceStatus;
}
public String getCustomerId() {
return customerId;
}
public void setCustomerId(String customerId) {
this.customerId = customerId;
}
}

View File

@ -1,69 +1,78 @@
package com.astute.model; package com.astute.model;
import java.sql.Date; import java.sql.Date;
public class InvoicePayment { public class InvoicePayment {
String invoiceNum; String invoiceNum;
int invoicePaymentId; int invoicePaymentId;
int paymentTypeId; int paymentTypeId;
String paymentType; String paymentType;
Date paymentDate; Date paymentDate;
Double invoiceAmount; Double invoiceAmount;
String checkTransactionNo;
public InvoicePayment(String invoiceNum, int invoicePaymentId, int paymentTypeId, String paymentType, Date paymentDate, Double invoiceAmount) { public InvoicePayment(String invoiceNum, int invoicePaymentId, int paymentTypeId, String paymentType, Date paymentDate, Double invoiceAmount, String checkTransactionNo) {
this.invoiceNum = invoiceNum; this.invoiceNum = invoiceNum;
this.invoicePaymentId = invoicePaymentId; this.invoicePaymentId = invoicePaymentId;
this.paymentTypeId = paymentTypeId; this.paymentTypeId = paymentTypeId;
this.paymentType = paymentType; this.paymentType = paymentType;
this.paymentDate = paymentDate; this.paymentDate = paymentDate;
this.invoiceAmount = invoiceAmount; this.invoiceAmount = invoiceAmount;
} this.checkTransactionNo = checkTransactionNo;
}
public String getInvoiceNum() {
return invoiceNum; public String getInvoiceNum() {
} return invoiceNum;
}
public void setInvoiceNum(String invoiceNum) {
this.invoiceNum = invoiceNum; public void setInvoiceNum(String invoiceNum) {
} this.invoiceNum = invoiceNum;
}
public int getInvoicePaymentId() {
return invoicePaymentId; public int getInvoicePaymentId() {
} return invoicePaymentId;
}
public void setInvoicePaymentId(int invoicePaymentId) {
this.invoicePaymentId = invoicePaymentId; public void setInvoicePaymentId(int invoicePaymentId) {
} this.invoicePaymentId = invoicePaymentId;
}
public int getPaymentTypeId() {
return paymentTypeId; public int getPaymentTypeId() {
} return paymentTypeId;
}
public void setPaymentTypeId(int paymentTypeId) {
this.paymentTypeId = paymentTypeId; public void setPaymentTypeId(int paymentTypeId) {
} this.paymentTypeId = paymentTypeId;
}
public String getPaymentType() {
return paymentType; public String getPaymentType() {
} return paymentType;
}
public void setPaymentType(String paymentType) {
this.paymentType = paymentType; public void setPaymentType(String paymentType) {
} this.paymentType = paymentType;
}
public Date getPaymentDate() {
return paymentDate; public Date getPaymentDate() {
} return paymentDate;
}
public void setPaymentDate(Date paymentDate) {
this.paymentDate = paymentDate; public void setPaymentDate(Date paymentDate) {
} this.paymentDate = paymentDate;
}
public Double getInvoiceAmount() {
return invoiceAmount; public Double getInvoiceAmount() {
} return invoiceAmount;
}
public void setInvoiceAmount(Double invoiceAmount) {
this.invoiceAmount = invoiceAmount; public void setInvoiceAmount(Double invoiceAmount) {
} this.invoiceAmount = invoiceAmount;
} }
public String getCheckTransactionNo() {
return checkTransactionNo;
}
public void setCheckTransactionNo(String checkTransactionNo) {
this.checkTransactionNo = checkTransactionNo;
}
}

View File

@ -1,72 +1,82 @@
package com.astute.requests; package com.astute.requests;
public class InvoicePaymentRequest { public class InvoicePaymentRequest {
String invoiceNum; String invoiceNum;
int invoicePaymentId; int invoicePaymentId;
int paymentTypeId; int paymentTypeId;
String paymentType; String paymentType;
String paymentDate; String paymentDate;
Double invoiceAmount; Double invoiceAmount;
String checkTransactionNo;
public InvoicePaymentRequest(String invoiceNum, int invoicePaymentId, int paymentTypeId, String paymentType, String paymentDate, Double invoiceAmount) {
this.invoiceNum = invoiceNum; public InvoicePaymentRequest(String invoiceNum, int invoicePaymentId, int paymentTypeId, String paymentType, String paymentDate, Double invoiceAmount, String checkTransactionNo) {
this.invoicePaymentId = invoicePaymentId; this.invoiceNum = invoiceNum;
this.paymentTypeId = paymentTypeId; this.invoicePaymentId = invoicePaymentId;
this.paymentType = paymentType; this.paymentTypeId = paymentTypeId;
this.paymentDate = paymentDate; this.paymentType = paymentType;
this.invoiceAmount = invoiceAmount; this.paymentDate = paymentDate;
} this.invoiceAmount = invoiceAmount;
this.checkTransactionNo = checkTransactionNo;
public InvoicePaymentRequest() { }
} public InvoicePaymentRequest() {
public String getInvoiceNum() { }
return invoiceNum;
} public String getInvoiceNum() {
return invoiceNum;
public void setInvoiceNum(String invoiceNum) { }
this.invoiceNum = invoiceNum;
} public void setInvoiceNum(String invoiceNum) {
this.invoiceNum = invoiceNum;
public int getInvoicePaymentId() { }
return invoicePaymentId;
} public int getInvoicePaymentId() {
return invoicePaymentId;
public void setInvoicePaymentId(int invoicePaymentId) { }
this.invoicePaymentId = invoicePaymentId;
} public void setInvoicePaymentId(int invoicePaymentId) {
this.invoicePaymentId = invoicePaymentId;
public int getPaymentTypeId() { }
return paymentTypeId;
} public int getPaymentTypeId() {
return paymentTypeId;
public void setPaymentTypeId(int paymentTypeId) { }
this.paymentTypeId = paymentTypeId;
} public void setPaymentTypeId(int paymentTypeId) {
this.paymentTypeId = paymentTypeId;
public String getPaymentType() { }
return paymentType;
} public String getPaymentType() {
return paymentType;
public void setPaymentType(String paymentType) { }
this.paymentType = paymentType;
} public void setPaymentType(String paymentType) {
this.paymentType = paymentType;
public String getPaymentDate() { }
return paymentDate;
} public String getPaymentDate() {
return paymentDate;
public void setPaymentDate(String paymentDate) { }
this.paymentDate = paymentDate;
} public void setPaymentDate(String paymentDate) {
this.paymentDate = paymentDate;
public Double getInvoiceAmount() { }
return invoiceAmount;
} public Double getInvoiceAmount() {
return invoiceAmount;
public void setInvoiceAmount(Double invoiceAmount) { }
this.invoiceAmount = invoiceAmount;
} public void setInvoiceAmount(Double invoiceAmount) {
} this.invoiceAmount = invoiceAmount;
}
public String getCheckTransactionNo() {
return checkTransactionNo;
}
public void setCheckTransactionNo(String checkTransactionNo) {
this.checkTransactionNo = checkTransactionNo;
}
}

View File

@ -1,59 +1,59 @@
package com.astute.resources; package com.astute.resources;
import com.astute.exceptions.AstuteException; import com.astute.exceptions.AstuteException;
import com.astute.requests.InvoicePaymentRequest; import com.astute.requests.InvoicePaymentRequest;
import com.astute.response.ApiResponse; import com.astute.response.ApiResponse;
import com.astute.service.InvoicePaymentService; import com.astute.service.InvoicePaymentService;
import javax.ws.rs.*; import javax.ws.rs.*;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import java.sql.Date; import java.sql.Date;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@Path("/invoicePayment") @Path("/invoicePayment")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public class InvoicePaymentResource { public class InvoicePaymentResource {
private com.astute.service.InvoicePaymentService service = new InvoicePaymentService(); private com.astute.service.InvoicePaymentService service = new InvoicePaymentService();
public InvoicePaymentResource() { public InvoicePaymentResource() {
} }
@GET @GET
public Response getInvoicePayments(@QueryParam("invoiceNum") String invoiceNum) public Response getInvoicePayments(@QueryParam("invoiceNum") String invoiceNum)
throws AstuteException { throws AstuteException {
return new ApiResponse(service.getInvoicePayments(invoiceNum)).toResponse(); return new ApiResponse(service.getInvoicePayments(invoiceNum)).toResponse();
} }
@Path("/{invoiceNum}/{invoicePaymentId}") @Path("/{invoiceNum}/{invoicePaymentId}")
@PUT @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 { throws AstuteException, ParseException {
String dateStr = request.getPaymentDate(); String dateStr = request.getPaymentDate();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Date date = new java.sql.Date(df.parse(dateStr).getTime()); 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(); return new ApiResponse(ApiResponse.UPDATE_ACCESS_SUCESS).toResponse();
} }
@POST @POST
public Response createInvoicePayment(InvoicePaymentRequest request) public Response createInvoicePayment(InvoicePaymentRequest request)
throws AstuteException, ParseException { throws AstuteException, ParseException {
String dateStr = request.getPaymentDate(); String dateStr = request.getPaymentDate();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Date date = new java.sql.Date(df.parse(dateStr).getTime()); 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(); return new ApiResponse(ApiResponse.UPDATE_ACCESS_SUCESS).toResponse();
} }
@GET @GET
@Path("/paymentTypes") @Path("/paymentTypes")
public Response getInvoicePaymentTypes() throws AstuteException { public Response getInvoicePaymentTypes() throws AstuteException {
return new ApiResponse(service.getPaymentTypes()).toResponse(); return new ApiResponse(service.getPaymentTypes()).toResponse();
} }
} }

View File

@ -1,36 +1,36 @@
package com.astute.service; package com.astute.service;
import com.astute.exceptions.AstuteException; import com.astute.exceptions.AstuteException;
import com.astute.model.InvoicePayment; import com.astute.model.InvoicePayment;
import com.astute.model.PaymentType; import com.astute.model.PaymentType;
import java.sql.Date; import java.sql.Date;
import java.util.List; import java.util.List;
import static com.astute.dao.DAO.getDao; import static com.astute.dao.DAO.getDao;
public class InvoicePaymentService extends Service{ public class InvoicePaymentService extends Service{
public InvoicePaymentService(){ public InvoicePaymentService(){
super(); super();
} }
public List<InvoicePayment> getInvoicePayments(String invoiceNum) public List<InvoicePayment> getInvoicePayments(String invoiceNum)
throws AstuteException { throws AstuteException {
return getDao().getInvoicePayments(invoiceNum); 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 { 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 { throws AstuteException {
getDao().createInvoicePayment(invoiceNum, invoicePaymentTypeId, paymentAmount, paymentDate); getDao().createInvoicePayment(invoiceNum, invoicePaymentTypeId, paymentAmount, paymentDate, checkTransactionNo);
} }
public List<PaymentType> getPaymentTypes() throws AstuteException { public List<PaymentType> getPaymentTypes() throws AstuteException {
return getDao().getPaymentTypes(); return getDao().getPaymentTypes();
} }
} }