Add files via upload

This commit is contained in:
gopi17701 2018-09-28 12:42:39 -04:00 committed by GitHub
parent b7d7dc48c8
commit c02f0192eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 3049 additions and 3047 deletions

View File

@ -1,38 +1,38 @@
<!--<div class="card card-stats box">--> <!--<div class="card card-stats box">-->
<!--<div class="card-header card-header-icon" style="text-align: left">--> <!--<div class="card-header card-header-icon" style="text-align: left">-->
<!--<div class="card-icon" [style.background-color]="color">--> <!--<div class="card-icon" [style.background-color]="color">-->
<!--<i class="material-icons">{{symbol}}</i>--> <!--<i class="material-icons">{{symbol}}</i>-->
<!--</div>--> <!--</div>-->
<!--<h3 class="card-title">{{name}}</h3>--> <!--<h3 class="card-title">{{name}}</h3>-->
<!--</div>--> <!--</div>-->
<!--<div class="card-footer">--> <!--<div class="card-footer">-->
<!--<div class="stats">--> <!--<div class="stats">-->
<!----> <!---->
<!--</div>--> <!--</div>-->
<!--</div>--> <!--</div>-->
<!--</div>--> <!--</div>-->
<div class="card box text-light" [style.background-color]="color"> <div class="card box text-light" [style.background-color]="color">
<div class="card-header"> <div class="card-header">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col-2 text-left"> <div class="col-2 text-left">
<i class="material-icons">{{symbol}}</i> <i class="material-icons">{{symbol}}</i>
</div> </div>
<div class="col-10 text-right"> <div class="col-10 text-right">
<h5 class="card-title">{{name}}</h5> <h5 class="card-title">{{name}}</h5>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<ng-content></ng-content> <ng-content></ng-content>
</div> </div>
</div> </div>
</div> </div>
<!--<h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>--> <!--<h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>-->
</div> </div>
</div> </div>

View File

@ -1,25 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AppBoxComponent } from './app-box.component'; import { AppBoxComponent } from './app-box.component';
describe('AppBoxComponent', () => { describe('AppBoxComponent', () => {
let component: AppBoxComponent; let component: AppBoxComponent;
let fixture: ComponentFixture<AppBoxComponent>; let fixture: ComponentFixture<AppBoxComponent>;
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ AppBoxComponent ] declarations: [ AppBoxComponent ]
}) })
.compileComponents(); .compileComponents();
})); }));
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(AppBoxComponent); fixture = TestBed.createComponent(AppBoxComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); });
it('should create', () => { it('should create', () => {
expect(component).toBeTruthy(); expect(component).toBeTruthy();
}); });
}); });

View File

@ -1,37 +1,37 @@
import { Component, OnInit, Input } from '@angular/core'; import { Component, OnInit, Input } from '@angular/core';
@Component({ @Component({
selector: 'app-app-box', selector: 'app-app-box',
templateUrl: './app-box.component.html', templateUrl: './app-box.component.html',
styleUrls: ['./app-box.component.css'] styleUrls: ['./app-box.component.css']
}) })
export class AppBoxComponent implements OnInit { export class AppBoxComponent implements OnInit {
@Input() name; @Input() name;
@Input() symbol; @Input() symbol;
@Input() description; @Input() description;
@Input() color; @Input() color;
constructor() { } constructor() { }
ngOnInit() { ngOnInit() {
this.color = this.getColor(); this.color = this.getColor();
} }
getColor() { getColor() {
if (this.color) { if (this.color) {
return this.color; return this.color;
} else { } else {
const clr = this.padStart(Math.floor((Math.random() * 16777215)).toString(16), 6, '0'); const clr = this.padStart(Math.floor((Math.random() * 16777215)).toString(16), 6, '0');
return '#' + clr; return '#' + clr;
} }
} }
padStart(str: string, l: number, append: string) { padStart(str: string, l: number, append: string) {
let len = str.length; let len = str.length;
while (len < l) { while (len < l) {
str = append + str; str = append + str;
len = str.length; len = str.length;
} }
return str; return str;
} }
} }

View File

@ -1,11 +1,11 @@
::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */ ::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
color: lightblue; color: lightblue;
} }
:-ms-input-placeholder { /* Internet Explorer 10-11 */ :-ms-input-placeholder { /* Internet Explorer 10-11 */
color: lightblue; color: lightblue;
} }
::-ms-input-placeholder { /* Microsoft Edge */ ::-ms-input-placeholder { /* Microsoft Edge */
color: lightblue; color: lightblue;
} }

View File

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

View File

@ -1,25 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CustomerComponent } from './customer.component'; import { CustomerComponent } from './customer.component';
describe('CustomerComponent', () => { describe('CustomerComponent', () => {
let component: CustomerComponent; let component: CustomerComponent;
let fixture: ComponentFixture<CustomerComponent>; let fixture: ComponentFixture<CustomerComponent>;
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ CustomerComponent ] declarations: [ CustomerComponent ]
}) })
.compileComponents(); .compileComponents();
})); }));
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(CustomerComponent); fixture = TestBed.createComponent(CustomerComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); });
it('should create', () => { it('should create', () => {
expect(component).toBeTruthy(); expect(component).toBeTruthy();
}); });
}); });

View File

@ -1,170 +1,170 @@
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';
@Component({ @Component({
selector: 'app-customer', selector: 'app-customer',
templateUrl: './customer.component.html', templateUrl: './customer.component.html',
styleUrls: ['./customer.component.css'] styleUrls: ['./customer.component.css']
}) })
export class CustomerComponent implements OnInit { export class CustomerComponent implements OnInit {
@ViewChild('agGrid') agGrid; @ViewChild('agGrid') agGrid;
selected = null; selected = null;
customers; customers;
columnDefs = [ columnDefs = [
{headerName: 'Customer ID', field: 'customerId', checkboxSelection: true}, {headerName: 'Customer ID', field: 'customerId', checkboxSelection: true},
{headerName: 'Customer Name', field: 'customerName'}, {headerName: 'Customer Name', field: 'customerName'},
{headerName: 'Bill To Department', field: 'billToDept'}, {headerName: 'Bill To Department', field: 'billToDept'},
{headerName: 'Address 1', field: 'add1'}, {headerName: 'Address 1', field: 'add1'},
{headerName: 'Address 2', field: 'add2'}, {headerName: 'Address 2', field: 'add2'},
{headerName: 'City', field: 'city'}, {headerName: 'City', field: 'city'},
{headerName: 'Email', field: 'email'}, {headerName: 'Email', field: 'email'},
{headerName: 'Fax', field: 'fax'}, {headerName: 'Fax', field: 'fax'},
{headerName: 'Phone', field: 'phone'}, {headerName: 'Phone', field: 'phone'},
{headerName: 'State', field: 'state'}, {headerName: 'State', field: 'state'},
{headerName: 'ZIP', field: 'zip'}, {headerName: 'ZIP', field: 'zip'},
{headerName: 'ZIP-4', field: 'ziplast4'} {headerName: 'ZIP-4', field: 'ziplast4'}
]; ];
rowData: any; rowData: any;
states = [ states = [
'AL', 'AL',
'AK', 'AK',
'AR', 'AR',
'AZ', 'AZ',
'CA', 'CA',
'CO', 'CO',
'CT', 'CT',
'DC', 'DC',
'DE', 'DE',
'FL', 'FL',
'GA', 'GA',
'HI', 'HI',
'IA', 'IA',
'ID', 'ID',
'IL', 'IL',
'IN', 'IN',
'KS', 'KS',
'KY', 'KY',
'LA', 'LA',
'MA', 'MA',
'MD', 'MD',
'ME', 'ME',
'MI', 'MI',
'MN', 'MN',
'MO', 'MO',
'MS', 'MS',
'MT', 'MT',
'NC', 'NC',
'NE', 'NE',
'NH', 'NH',
'NJ', 'NJ',
'NM', 'NM',
'NV', 'NV',
'NY', 'NY',
'ND', 'ND',
'OH', 'OH',
'OK', 'OK',
'OR', 'OR',
'PA', 'PA',
'RI', 'RI',
'SC', 'SC',
'SD', 'SD',
'TN', 'TN',
'TX', 'TX',
'UT', 'UT',
'VT', 'VT',
'VA', 'VA',
'WA', 'WA',
'WI', 'WI',
'WV', 'WV',
'WY' 'WY'
]; ];
usPhoneMask = ['(', /[1-9]/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/]; usPhoneMask = ['(', /[1-9]/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/];
constructor(protected astuteClientService: AstuteClientService) { constructor(protected astuteClientService: AstuteClientService) {
} }
ngOnInit() { ngOnInit() {
this.refreshData(); this.refreshData();
} }
getSelectedRows() { getSelectedRows() {
const selectedNodes = this.agGrid.api.getSelectedNodes(); const selectedNodes = this.agGrid.api.getSelectedNodes();
if (selectedNodes.length) { if (selectedNodes.length) {
this.selected = selectedNodes.map(node => node.data)[0]; this.selected = selectedNodes.map(node => node.data)[0];
} else { } else {
this.selected = null; this.selected = null;
} }
} }
// inName.value, inBillToDept.value, inAdd1.value, inAdd2.value, inCity.value, inState.value, inZIP.value, inZIP4.value, inEmail.value, inPhone.value, inFax.value // inName.value, inBillToDept.value, inAdd1.value, inAdd2.value, inCity.value, inState.value, inZIP.value, inZIP4.value, inEmail.value, inPhone.value, inFax.value
addCustomer(customerId, name, billTo, add1, add2, city, state, zip, zip4, email, phone, fax, ref) { addCustomer(customerId, name, billTo, add1, add2, city, state, zip, zip4, email, phone, fax, ref) {
let customerData = { let customerData = {
"customerId": customerId, "customerId": customerId,
"customerName": name, "customerName": name,
"billToDept": billTo, "billToDept": billTo,
"add1": add1, "add1": add1,
"add2": add2, "add2": add2,
"city": city, "city": city,
"state": state, "state": state,
"zip": zip, "zip": zip,
"ziplast4": zip4, "ziplast4": zip4,
"email": email, "email": email,
"phone": phone, "phone": phone,
"fax": fax "fax": fax
}; };
this.astuteClientService.createCustomer(customerData).then((data) => { this.astuteClientService.createCustomer(customerData).then((data) => {
if (data) { if (data) {
this.refreshData(); this.refreshData();
ref.close(); ref.close();
} else { } else {
alert("Customer Creation Failed, Check Input Fields") alert("Customer Creation Failed, Check Input Fields")
} }
}, (reason) => { }, (reason) => {
alert("add customer failed for " + reason); alert("add customer failed for " + reason);
}); });
} }
editCustomer(id, name, billTo, add1, add2, city, state, zip, zip4, email, phone, fax, ref) { editCustomer(id, name, billTo, add1, add2, city, state, zip, zip4, email, phone, fax, ref) {
const customerData = { const customerData = {
"customerId": id, "customerId": id,
"customerName": name, "customerName": name,
"billToDept": billTo, "billToDept": billTo,
"add1": add1, "add1": add1,
"add2": add2, "add2": add2,
"city": city, "city": city,
"state": state, "state": state,
"zip": zip, "zip": zip,
"ziplast4": zip4, "ziplast4": zip4,
"email": email, "email": email,
"phone": phone, "phone": phone,
"fax": fax "fax": fax
}; };
this.astuteClientService.updateCustomer(id, customerData).then((data) => { this.astuteClientService.updateCustomer(id, customerData).then((data) => {
if (data) { if (data) {
this.refreshData(); this.refreshData();
ref.close(); ref.close();
} else { } else {
alert("Customer Updating Failed, Check Input Fields") alert("Customer Updating Failed, Check Input Fields")
} }
}, (reason) => { }, (reason) => {
alert("update customer failed for " + reason); alert("update customer failed for " + reason);
}); });
} }
open(ref) { open(ref) {
this.getSelectedRows(); this.getSelectedRows();
ref.open(); ref.open();
} }
close(ref) { close(ref) {
ref.close(); ref.close();
} }
refreshData() { refreshData() {
this.rowData = this.astuteClientService.getCustomers(); this.rowData = this.astuteClientService.getCustomers();
this.astuteClientService.getCustomers().then((data) => { this.astuteClientService.getCustomers().then((data) => {
this.customers = data; this.customers = data;
}); });
} }
} }

View File

@ -1,69 +1,69 @@
<app-nav-bar></app-nav-bar> <app-nav-bar></app-nav-bar>
<div> <div>
<div class="container"> <div class="container">
<!--welcome message and search bar--> <!--welcome message and search bar-->
<div class="row top-buffer align-items-center"> <div class="row top-buffer align-items-center">
<div class="col-lg-8"> <div class="col-lg-8">
<h1 class="display-4" *ngIf="currentUser"> <h1 class="display-4" *ngIf="currentUser">
Welcome to the Astute Internal System, {{currentUser}}! Welcome to the Astute Internal System, {{currentUser}}!
</h1> </h1>
</div> </div>
<div class="col-lg-4"> <div class="col-lg-4">
<div class="input-group mb-3 float-right"> <div class="input-group mb-3 float-right">
<input type="text" class="form-control" placeholder="Search..."> <input type="text" class="form-control" placeholder="Search...">
<div class="input-group-prepend"> <div class="input-group-prepend">
<button class="btn btn-sm btn-info btn-round"> <button class="btn btn-sm btn-info btn-round">
<i class="material-icons">search</i> <i class="material-icons">search</i>
</button> </button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!--applications--> <!--applications-->
<div> <div>
<div class="row sep-buffer"> <div class="row sep-buffer">
<div class="col-12"> <div class="col-12">
<h3> <h3>
Applications Applications
</h3> </h3>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<app-app-box class="m-3" [color]="'#00bcd4'" [name]="'Customer'" [symbol]="'supervised_user_circle'" routerLink="/customer"> <app-app-box class="m-3" [color]="'#00bcd4'" [name]="'Customer'" [symbol]="'supervised_user_circle'" routerLink="/customer">
<h6 class="card-subtitle mb-2 text-muted">Go here to add or edit customers</h6> <h6 class="card-subtitle mb-2 text-muted">Go here to add or edit customers</h6>
<!--<i class="material-icons text-info">info</i> --> <!--<i class="material-icons text-info">info</i> -->
</app-app-box> </app-app-box>
<app-app-box class="m-3" [color]="'#f44336'" [name]="'Sales Order'" [symbol]="'assignment'" routerLink="/sales-order"> <app-app-box class="m-3" [color]="'#f44336'" [name]="'Sales Order'" [symbol]="'assignment'" routerLink="/sales-order">
<h6 class="card-subtitle mb-2 text-muted">Go here to add sales orders or make change orders</h6> <h6 class="card-subtitle mb-2 text-muted">Go here to add sales orders or make change orders</h6>
<!--<i class="material-icons text-info">info</i> Medical Records Application--> <!--<i class="material-icons text-info">info</i> Medical Records Application-->
</app-app-box> </app-app-box>
<app-app-box class="m-3" [color]="'#4caf50'" [name]="'Invoice'" [symbol]="'view_headline'" routerLink="/invoice"> <app-app-box class="m-3" [color]="'#4caf50'" [name]="'Invoice'" [symbol]="'view_headline'" routerLink="/invoice">
<h6 class="card-subtitle mb-2 text-muted">Go here to interact with invoices</h6> <h6 class="card-subtitle mb-2 text-muted">Go here to interact with invoices</h6>
<!--<i class="material-icons text-danger">info</i> Not yet implemented--> <!--<i class="material-icons text-danger">info</i> Not yet implemented-->
</app-app-box> </app-app-box>
<app-app-box class="m-3" [name]="'Invoice Payment'" [symbol]="'attach_money'" routerLink="/invoice-payment"> <app-app-box class="m-3" [name]="'Invoice Payment'" [symbol]="'attach_money'" routerLink="/invoice-payment">
<h6 class="card-subtitle mb-2 text-muted">Go here to to pay an invoice</h6> <h6 class="card-subtitle mb-2 text-muted">Go here to enter payments received</h6>
<!--<i class="material-icons text-danger">info</i> Not yet implemented--> <!--<i class="material-icons text-danger">info</i> Not yet implemented-->
</app-app-box> </app-app-box>
</div> </div>
</div> </div>
<!--Some Extra Info--> <!--Some Extra Info-->
<div> <div>
<div class="row sep-buffer"> <div class="row sep-buffer">
<div class="col-12"> <div class="col-12">
<h3> <h3>
Extra info section Extra info section
</h3> </h3>
</div> </div>
</div> </div>
<div class="row top-buffer justify-content-start"> <div class="row top-buffer justify-content-start">
<h5 class="app-buffer"> <h5 class="app-buffer">
Some sort of info here, maybe about recent invoices, or upcoming payment due dates.<br> Some sort of info here, maybe about recent invoices, or upcoming payment due dates.<br>
Maybe something for each users tasks... Maybe something for each users tasks...
</h5> </h5>
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,25 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HomepageComponent } from './homepage.component'; import { HomepageComponent } from './homepage.component';
describe('HomepageComponent', () => { describe('HomepageComponent', () => {
let component: HomepageComponent; let component: HomepageComponent;
let fixture: ComponentFixture<HomepageComponent>; let fixture: ComponentFixture<HomepageComponent>;
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ HomepageComponent ] declarations: [ HomepageComponent ]
}) })
.compileComponents(); .compileComponents();
})); }));
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(HomepageComponent); fixture = TestBed.createComponent(HomepageComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); });
it('should create', () => { it('should create', () => {
expect(component).toBeTruthy(); expect(component).toBeTruthy();
}); });
}); });

View File

@ -1,22 +1,22 @@
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
@Component({ @Component({
selector: 'app-homepage', selector: 'app-homepage',
templateUrl: './homepage.component.html', templateUrl: './homepage.component.html',
styleUrls: ['./homepage.component.css'] styleUrls: ['./homepage.component.css']
}) })
export class HomepageComponent implements OnInit { export class HomepageComponent implements OnInit {
currentUser: any = {}; currentUser: any = {};
constructor() { constructor() {
} }
ngOnInit() { ngOnInit() {
this.currentUser = this.getSessionUser(); this.currentUser = this.getSessionUser();
console.log(this.currentUser); console.log(this.currentUser);
} }
private getSessionUser() { private getSessionUser() {
return localStorage.getItem('SESSION_USER'); return localStorage.getItem('SESSION_USER');
} }
} }

View File

@ -1,48 +1,48 @@
/*body {*/ /*body {*/
/*margin: 0;*/ /*margin: 0;*/
/*padding: 0;*/ /*padding: 0;*/
/*background-color: #FAFAFA;*/ /*background-color: #FAFAFA;*/
/*font: 12pt "Tahoma";*/ /*font: 12pt "Tahoma";*/
/*}*/ /*}*/
/** {*/ /** {*/
/*box-sizing: border-box;*/ /*box-sizing: border-box;*/
/*-moz-box-sizing: border-box;*/ /*-moz-box-sizing: border-box;*/
/*}*/ /*}*/
.page { .page {
width: 21cm; width: 21cm;
min-height: 29.7cm; min-height: 29.7cm;
padding: 2cm; padding: 2cm;
margin: 1cm auto; margin: 1cm auto;
border: 1px #D3D3D3 solid; border: 1px #D3D3D3 solid;
border-radius: 5px; border-radius: 5px;
background: white; background: white;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1); box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
font-size: 11pt; font-size: 11pt;
} }
/*.subpage {*/ /*.subpage {*/
/*padding: 1cm;*/ /*padding: 1cm;*/
/*border: 5px red solid;*/ /*border: 5px red solid;*/
/*height: 256mm;*/ /*height: 256mm;*/
/*outline: 2cm #FFEAEA solid;*/ /*outline: 2cm #FFEAEA solid;*/
/*}*/ /*}*/
/*@page {*/ /*@page {*/
/*size: A4;*/ /*size: A4;*/
/*margin: 0;*/ /*margin: 0;*/
/*}*/ /*}*/
/*@media print {*/ /*@media print {*/
/*html, body {*/ /*html, body {*/
/*width: 210mm;*/ /*width: 210mm;*/
/*height: 297mm;*/ /*height: 297mm;*/
/*}*/ /*}*/
/*.page {*/ /*.page {*/
/*margin: 0;*/ /*margin: 0;*/
/*border: initial;*/ /*border: initial;*/
/*border-radius: initial;*/ /*border-radius: initial;*/
/*width: initial;*/ /*width: initial;*/
/*min-height: initial;*/ /*min-height: initial;*/
/*box-shadow: initial;*/ /*box-shadow: initial;*/
/*background: initial;*/ /*background: initial;*/
/*page-break-after: always;*/ /*page-break-after: always;*/
/*}*/ /*}*/
/*}*/ /*}*/

View File

@ -1,127 +1,127 @@
<div class="page" #doc> <div class="page" #doc>
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col-6"> <div class="col-6">
<img src="AstuteLogo.gif" align="left" alt="Astute Engineering" height="75"> <img src="AstuteLogo.gif" align="left" alt="Astute Engineering" height="75">
</div> </div>
<div class="col-6"> <div class="col-6">
<p class="h1 text-right align-bottom">INVOICE</p> <p class="h1 text-right align-bottom">INVOICE</p>
</div> </div>
</div> </div>
<br/> <br/>
<div class="row"> <div class="row">
<div class="col-4"> <div class="col-4">
<p>To,</p> <p>To,</p>
<p>{{name}}</p> <p>{{name}}</p>
<p>{{email}}</p> <p>{{email}}</p>
<p>{{address}}</p> <p>{{address}}</p>
</div> </div>
<div class="col-5 text-right"> <div class="col-5 text-right">
<p>Purchase Order No.:</p> <p>Purchase Order No.:</p>
<p>Contract No.:</p> <p>Contract No.:</p>
<p>Invoice No.:</p> <p>Invoice No.:</p>
<p>Invoice Date:</p> <p>Invoice Date:</p>
</div> </div>
<div class="col text-left"> <div class="col text-left">
<p>{{poNum}}</p> <p>{{poNum}}</p>
<p>{{coNum}}</p> <p>{{coNum}}</p>
<p>{{inNum}}</p> <p>{{inNum}}</p>
<p>{{inDate}}</p> <p>{{inDate}}</p>
</div> </div>
</div> </div>
<br/> <br/>
<div class="row"> <div class="row">
<table class="table table-sm table-bordered table-light"> <table class="table table-sm table-bordered table-light">
<thead class="thead-light"> <thead class="thead-light">
<tr> <tr>
<th scope="col" style="text-align: center;">No.</th> <th scope="col" style="text-align: center;">No.</th>
<th scope="col">Description</th> <th scope="col">Description</th>
<th scope="col" style="text-align: center;">Hourly Rate</th> <th scope="col" style="text-align: center;">Hourly Rate</th>
<th scope="col" style="text-align: center;">Hours Expended</th> <th scope="col" style="text-align: center;">Hours Expended</th>
<th scope="col" style="text-align: center;">Invoice Amount</th> <th scope="col" style="text-align: center;">Invoice Amount</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let inDet of inDetails"> <tr *ngFor="let inDet of inDetails">
<th scope="row" style="text-align: center;">{{inDet.lineItemNum}}</th> <th scope="row" style="text-align: center;">{{inDet.lineItemNum}}</th>
<td>{{inDet.desc}}</td> <td>{{inDet.desc}}</td>
<td style="text-align: right;">${{inDet.anount}}.00</td> <td style="text-align: right;">${{inDet.anount}}.00</td>
<td style="text-align: center;">-</td> <td style="text-align: center;">-</td>
<td style="text-align: right;">${{inDet.anount}}.00</td> <td style="text-align: right;">${{inDet.anount}}.00</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<br/> <br/>
<div class="row"> <div class="row">
<table> <table>
<tbody> <tbody>
<tr style="height: 18px;"> <tr style="height: 18px;">
<td style="width: 251.5px; text-align: right; height: 18px;">Original Contract Amount</td> <td style="width: 251.5px; text-align: right; height: 18px;">Original Contract Amount</td>
<td style="background-color: lightgray; border-color: black; width: 137.5px; height: 18px;">{{ogCoAmt}}</td> <td style="background-color: lightgray; border-color: black; width: 137.5px; height: 18px;">{{ogCoAmt}}</td>
<td style="width: 305px; text-align: right; height: 18px;">&nbsp;</td> <td style="width: 305px; text-align: right; height: 18px;">&nbsp;</td>
<td style="background-color: lightgray; border-color: black; width: 153px; height: 18px;">&nbsp;</td> <td style="background-color: lightgray; border-color: black; width: 153px; height: 18px;">&nbsp;</td>
</tr> </tr>
<tr style="height: 17px;"> <tr style="height: 17px;">
<td style="width: 251.5px; text-align: right; height: 17px;">Net Changes by Change Orders</td> <td style="width: 251.5px; text-align: right; height: 17px;">Net Changes by Change Orders</td>
<td style="background-color: lightgray; border-color: black; width: 137.5px; height: 17px;">{{netChanges}}</td> <td style="background-color: lightgray; border-color: black; width: 137.5px; height: 17px;">{{netChanges}}</td>
<td style="width: 305px; text-align: right; height: 18px;">&nbsp;</td> <td style="width: 305px; text-align: right; height: 18px;">&nbsp;</td>
<td style="background-color: lightgray; border-color: black; width: 153px; height: 18px;">&nbsp;</td> <td style="background-color: lightgray; border-color: black; width: 153px; height: 18px;">&nbsp;</td>
</tr> </tr>
<tr style="height: 18px;"> <tr style="height: 18px;">
<td style="width: 251.5px; text-align: right; height: 18px;">Total Contract Amount</td> <td style="width: 251.5px; text-align: right; height: 18px;">Total Contract Amount</td>
<td style="background-color: lightgray; border-color: black; width: 137.5px; height: 18px;">{{totCoAmt}}</td> <td style="background-color: lightgray; border-color: black; width: 137.5px; height: 18px;">{{totCoAmt}}</td>
<td style="width: 305px; text-align: right; height: 18px;">&nbsp;</td> <td style="width: 305px; text-align: right; height: 18px;">&nbsp;</td>
<td style="background-color: lightgray; border-color: black; width: 153px; height: 18px;">&nbsp;</td> <td style="background-color: lightgray; border-color: black; width: 153px; height: 18px;">&nbsp;</td>
</tr> </tr>
<tr style="height: 18px;"> <tr style="height: 18px;">
<td style="width: 251.5px; text-align: right; height: 18px;">Previously Billed</td> <td style="width: 251.5px; text-align: right; height: 18px;">Previously Billed</td>
<td style="background-color: lightgray; border-color: black; width: 137.5px; height: 18px;">{{prevBill}}</td> <td style="background-color: lightgray; border-color: black; width: 137.5px; height: 18px;">{{prevBill}}</td>
<td style="width: 305px; text-align: right; height: 18px;">&nbsp;</td> <td style="width: 305px; text-align: right; height: 18px;">&nbsp;</td>
<td style="background-color: lightgray; border-color: black; width: 153px; height: 18px;">&nbsp;</td> <td style="background-color: lightgray; border-color: black; width: 153px; height: 18px;">&nbsp;</td>
</tr> </tr>
<tr style="height: 18px;"> <tr style="height: 18px;">
<td style="width: 251.5px; text-align: right; height: 18px;">Amount This Invoice</td> <td style="width: 251.5px; text-align: right; height: 18px;">Amount This Invoice</td>
<td style="background-color: lightgray; border-color: black; width: 137.5px; height: 18px;">{{inAmt}}</td> <td style="background-color: lightgray; border-color: black; width: 137.5px; height: 18px;">{{inAmt}}</td>
<td style="width: 305px; text-align: right; height: 18px;">&nbsp;</td> <td style="width: 305px; text-align: right; height: 18px;">&nbsp;</td>
<td style="background-color: lightgray; border-color: black; width: 153px; height: 18px;">&nbsp;</td> <td style="background-color: lightgray; border-color: black; width: 153px; height: 18px;">&nbsp;</td>
</tr> </tr>
<tr style="height: 18px;"> <tr style="height: 18px;">
<td style="width: 251.5px; text-align: right; height: 18px;">Balance to be Billed</td> <td style="width: 251.5px; text-align: right; height: 18px;">Balance to be Billed</td>
<td style="background-color: lightgray; border-color: black; width: 137.5px; height: 18px;">{{balToBeBill}}</td> <td style="background-color: lightgray; border-color: black; width: 137.5px; height: 18px;">{{balToBeBill}}</td>
<td style="width: 305px; text-align: right; height: 18px;"><b>Total Due This Invoice</b></td> <td style="width: 305px; text-align: right; height: 18px;"><b>Total Due This Invoice</b></td>
<td style="background-color: lightgray; border-color: black; width: 153px; height: 18px;">{{finTot}}</td> <td style="background-color: lightgray; border-color: black; width: 153px; height: 18px;">{{finTot}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<br/> <br/>
<div class="row"> <div class="row">
<p>Notes:</p> <p>Notes:</p>
<ol> <ol>
{{notes}} {{notes}}
</ol> </ol>
</div> </div>
<div class="row"> <div class="row">
<p>{{cert}}</p> <p>{{cert}}</p>
</div> </div>
<div class="row"> <div class="row">
<div class="col-8"> </div> <div class="col-8"> </div>
<div class="col-4"><hr></div> <div class="col-4"><hr></div>
</div> </div>
</div> </div>
</div> </div>
<div id="editor"></div> <div id="editor"></div>
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<div class="text-center"> <div class="text-center">
<button class="btn btn-lg btn-outline-primary"(click)="moreTestJsPDF()">Download PDF</button> <button class="btn btn-lg btn-outline-primary"(click)="moreTestJsPDF()">Download PDF</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<br/> <br/>
<br/> <br/>
<br/> <br/>

View File

@ -1,25 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { InvoiceGenComponent } from './invoice-gen.component'; import { InvoiceGenComponent } from './invoice-gen.component';
describe('InvoiceGenComponent', () => { describe('InvoiceGenComponent', () => {
let component: InvoiceGenComponent; let component: InvoiceGenComponent;
let fixture: ComponentFixture<InvoiceGenComponent>; let fixture: ComponentFixture<InvoiceGenComponent>;
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ InvoiceGenComponent ] declarations: [ InvoiceGenComponent ]
}) })
.compileComponents(); .compileComponents();
})); }));
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(InvoiceGenComponent); fixture = TestBed.createComponent(InvoiceGenComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); });
it('should create', () => { it('should create', () => {
expect(component).toBeTruthy(); expect(component).toBeTruthy();
}); });
}); });

View File

@ -1,207 +1,207 @@
import {Component, ElementRef, OnInit, ViewChild} from '@angular/core'; import {Component, ElementRef, OnInit, ViewChild} from '@angular/core';
import {AstuteClientService} from '../services/astute-client-service'; import {AstuteClientService} from '../services/astute-client-service';
declare var html2pdf: any; declare var html2pdf: any;
declare var html2canvas: any; declare var html2canvas: any;
declare var jsPDF: any; declare var jsPDF: any;
declare var $: any declare var $: any
@Component({ @Component({
selector: 'app-invoice-gen', selector: 'app-invoice-gen',
templateUrl: './invoice-gen.component.html', templateUrl: './invoice-gen.component.html',
styleUrls: ['./invoice-gen.component.css'] styleUrls: ['./invoice-gen.component.css']
}) })
export class InvoiceGenComponent implements OnInit { export class InvoiceGenComponent implements OnInit {
@ViewChild('doc') invoiceHTML: ElementRef; @ViewChild('doc') invoiceHTML: ElementRef;
gridX = []; // these are the layout grid STARTING gridX = []; // these are the layout grid STARTING
gridY = []; // from the 1 inch border (x: 25; y:23) gridY = []; // from the 1 inch border (x: 25; y:23)
name; name;
email; email;
address; address;
poNum; poNum;
coNum; coNum;
inNum; inNum;
inDate; inDate;
inDetails; // :[{lineNum:number, desc:string, rate:string, hrs:number, amount:number}]; inDetails; // :[{lineNum:number, desc:string, rate:string, hrs:number, amount:number}];
ogCoAmt; ogCoAmt;
netChanges = 0; netChanges = 0;
totCoAmt = 0; totCoAmt = 0;
prevBill; prevBill;
inAmt; inAmt;
balToBeBill; balToBeBill;
subTotal; // =inAmt subTotal; // =inAmt
milage = 0; milage = 0;
otherExp = 0; otherExp = 0;
outOf = 0; outOf = 0;
finTot; // = inAmt; finTot; // = inAmt;
notes; notes;
cert; cert;
constructor(protected astuteClientService: AstuteClientService) { constructor(protected astuteClientService: AstuteClientService) {
// console.log('********** ' + this.astuteClientService.getInvoiceGen('123').then()); // console.log('********** ' + this.astuteClientService.getInvoiceGen('123').then());
} }
ngOnInit() { ngOnInit() {
let x = 25; let x = 25;
let y = 23; let y = 23;
for (let i = 0; i < 17; i++) { for (let i = 0; i < 17; i++) {
this.gridX[i] = x; this.gridX[i] = x;
x += 10; x += 10;
} }
for (let j = 0; j < 26; j++) { for (let j = 0; j < 26; j++) {
this.gridY[j] = y; this.gridY[j] = y;
y += 10; y += 10;
} }
console.log('Layout Grid X: ' + this.gridX); console.log('Layout Grid X: ' + this.gridX);
console.log('Layout Grid Y: ' + this.gridY); console.log('Layout Grid Y: ' + this.gridY);
this.astuteClientService.getInvoiceGen('3-01_DRAFT_258').then((data) => { this.astuteClientService.getInvoiceGen('3-01_DRAFT_258').then((data) => {
this.name = data.customer.customerName; this.name = data.customer.customerName;
this.email = data.customer.email; this.email = data.customer.email;
this.address = data.customer.add1 + ' ' + data.customer.add2 + ' ' + this.address = data.customer.add1 + ' ' + data.customer.add2 + ' ' +
data.customer.city + ', ' + data.customer.state.toUpperCase() + ', ' + data.customer.city + ', ' + data.customer.state.toUpperCase() + ', ' +
data.customer.zip + '-' + data.customer.ziplast4; data.customer.zip + '-' + data.customer.ziplast4;
this.poNum = data.po.ponum; this.poNum = data.po.ponum;
this.coNum = data.po.contractNum; this.coNum = data.po.contractNum;
this.inNum = data.invoice.invoiceNumber; this.inNum = data.invoice.invoiceNumber;
this.inDate = data.invoice.invoiceDate; this.inDate = data.invoice.invoiceDate;
this.inDetails = data.invoiceDetail; this.inDetails = data.invoiceDetail;
this.ogCoAmt = data.po.contractAmt; this.ogCoAmt = data.po.contractAmt;
this.netChanges = 0; this.netChanges = 0;
this.totCoAmt = 0; this.totCoAmt = 0;
this.prevBill = data.previouslyPaidAmt; this.prevBill = data.previouslyPaidAmt;
this.inAmt = data.invoice.billAmt; this.inAmt = data.invoice.billAmt;
this.balToBeBill = data.balanceToBeBilled; this.balToBeBill = data.balanceToBeBilled;
this.subTotal = this.inAmt; this.subTotal = this.inAmt;
this.milage = 0; this.milage = 0;
this.otherExp = 0; this.otherExp = 0;
this.outOf = 0; this.outOf = 0;
this.finTot = this.inAmt; this.finTot = this.inAmt;
this.notes = data.invoice.specialNotes; this.notes = data.invoice.specialNotes;
this.cert = data.invoice.certification; this.cert = data.invoice.certification;
}); });
} }
downloadPDF() { downloadPDF() {
// new html2pdf(document.getElementById('doc')); // new html2pdf(document.getElementById('doc'));
const A4_width = 210;//425; // pixels const A4_width = 210;//425; // pixels
const A4_height = 297;//550; // pixels const A4_height = 297;//550; // pixels
const ratio = 2; const ratio = 2;
// // // //
const oldCanvas = document.createElement('canvas'); const oldCanvas = document.createElement('canvas');
oldCanvas.width = A4_width; oldCanvas.width = A4_width;
oldCanvas.height = A4_height; oldCanvas.height = A4_height;
const oldContext = oldCanvas.getContext('2d'); const oldContext = oldCanvas.getContext('2d');
const oldImg = new Image(); const oldImg = new Image();
oldImg.src = oldCanvas.toDataURL(); oldImg.src = oldCanvas.toDataURL();
oldContext.drawImage(oldImg, 0, 0, A4_width, A4_height); oldContext.drawImage(oldImg, 0, 0, A4_width, A4_height);
const newImg = new Image(); const newImg = new Image();
newImg.onload = () => { newImg.onload = () => {
html2canvas(this.invoiceHTML.nativeElement).then((newCanvas) => { html2canvas(this.invoiceHTML.nativeElement).then((newCanvas) => {
console.log(this.invoiceHTML.nativeElement); console.log(this.invoiceHTML.nativeElement);
// newCanvas.width = A4_width / 50; // newCanvas.width = A4_width / 50;
// newCanvas.height = A4_height / 50; // newCanvas.height = A4_height / 50;
const newContext = newCanvas.getContext('2d'); const newContext = newCanvas.getContext('2d');
// Scale and draw the source image to the canvas // Scale and draw the source image to the canvas
newContext.drawImage(newImg, 0, 0, A4_width * ratio, A4_height * ratio); newContext.drawImage(newImg, 0, 0, A4_width * ratio, A4_height * ratio);
newImg.src = newCanvas.toDataURL(); newImg.src = newCanvas.toDataURL();
const pdfDoc = new jsPDF({ const pdfDoc = new jsPDF({
unit: 'mm' unit: 'mm'
}); });
pdfDoc.addImage(newImg, 'png', 0, 0, 210, 297); // imageData, format, x, y, w, h pdfDoc.addImage(newImg, 'png', 0, 0, 210, 297); // imageData, format, x, y, w, h
//pdfDoc.addHTML(this.invoiceHTML.nativeElement); //pdfDoc.addHTML(this.invoiceHTML.nativeElement);
pdfDoc.save(this.inNum + '.pdf'); // save file pdfDoc.save(this.inNum + '.pdf'); // save file
newImg.onload = undefined; // kill the func newImg.onload = undefined; // kill the func
} }
); );
}; };
newImg.src = oldImg.src; newImg.src = oldImg.src;
// let pdf = new jsPDF(); // let pdf = new jsPDF();
// pdf.addHTML(this.invoiceHTML.nativeElement, (data) => { // pdf.addHTML(this.invoiceHTML.nativeElement, (data) => {
// pdf.save('testFile.pdf'); // pdf.save('testFile.pdf');
// console.log(data); // console.log(data);
// }); // });
// setTimeout(window.close, 5000); // setTimeout(window.close, 5000);
} }
testjsPDF() { testjsPDF() {
const doc = jsPDF(); const doc = jsPDF();
doc.text('INVOICE', this.gridX[13], this.gridY[0]); doc.text('INVOICE', this.gridX[13], this.gridY[0]);
doc.text('ASTUTE', this.gridX[0], this.gridY[0]); doc.text('ASTUTE', this.gridX[0], this.gridY[0]);
// No. Column (header and rows) // No. Column (header and rows)
doc.rect(this.gridX[0], this.gridY[5], 10, 10); doc.rect(this.gridX[0], this.gridY[5], 10, 10);
for (let i = 6; i < 15; i += 2) { for (let i = 6; i < 15; i += 2) {
doc.rect(this.gridX[0], this.gridY[i], 10, 20); doc.rect(this.gridX[0], this.gridY[i], 10, 20);
} }
// Description Column (header and rows) // Description Column (header and rows)
doc.rect(this.gridX[1], this.gridY[5], 70, 10); doc.rect(this.gridX[1], this.gridY[5], 70, 10);
for (let i = 6; i < 15; i += 2) { for (let i = 6; i < 15; i += 2) {
doc.rect(this.gridX[1], this.gridY[i], 70, 20); doc.rect(this.gridX[1], this.gridY[i], 70, 20);
} }
// Hourly Rate Column (header and rows) // Hourly Rate Column (header and rows)
doc.rect(this.gridX[8], this.gridY[5], 30, 10); doc.rect(this.gridX[8], this.gridY[5], 30, 10);
for (let i = 6; i < 15; i += 2) { for (let i = 6; i < 15; i += 2) {
doc.rect(this.gridX[8], this.gridY[i], 30, 20); doc.rect(this.gridX[8], this.gridY[i], 30, 20);
} }
// Hours Column (header and rows) // Hours Column (header and rows)
doc.rect(this.gridX[11], this.gridY[5], 20, 10); doc.rect(this.gridX[11], this.gridY[5], 20, 10);
for (let i = 6; i < 15; i += 2) { for (let i = 6; i < 15; i += 2) {
doc.rect(this.gridX[11], this.gridY[i], 20, 20); doc.rect(this.gridX[11], this.gridY[i], 20, 20);
} }
// Amount Column (header and rows) // Amount Column (header and rows)
doc.rect(this.gridX[13], this.gridY[5], 30, 10); doc.rect(this.gridX[13], this.gridY[5], 30, 10);
for (let i = 6; i < 15; i += 2) { for (let i = 6; i < 15; i += 2) {
doc.rect(this.gridX[13], this.gridY[i], 30, 20); doc.rect(this.gridX[13], this.gridY[i], 30, 20);
} }
doc.addPage() doc.addPage()
doc.addPage() doc.addPage()
doc.text('I am on page 3', 10, 10) doc.text('I am on page 3', 10, 10)
doc.setPage(1) doc.setPage(1)
doc.save('a4.pdf'); doc.save('a4.pdf');
} }
moreTestJsPDF() { moreTestJsPDF() {
const doc = new jsPDF(); const doc = new jsPDF();
// const specialElementHandlers = { // const specialElementHandlers = {
// '#editor': function (element, renderer) { // '#editor': function (element, renderer) {
// return true; // return true;
// } // }
// }; // };
// doc.fromHTML(this.invoiceHTML.nativeElement, 15, 15, { // doc.fromHTML(this.invoiceHTML.nativeElement, 15, 15, {
// 'width': 170, // 'width': 170,
// 'elementHandlers': specialElementHandlers // 'elementHandlers': specialElementHandlers
// }); // });
console.log (this.invoiceHTML); console.log (this.invoiceHTML);
doc.addHTML(this.invoiceHTML.nativeElement); doc.addHTML(this.invoiceHTML.nativeElement);
doc.save('sample-file.pdf'); doc.save('sample-file.pdf');
} }
// html2pdf((<HTMLInputElement>document.getElementById('doc'))); // html2pdf((<HTMLInputElement>document.getElementById('doc')));
// var data='hello'; // var data='hello';
// $.get('http://localhost/ws/service.asmx/HelloWord', function(response) { // $.get('http://localhost/ws/service.asmx/HelloWord', function(response) {
// data = response; // data = response;
// }).error(function(){ // }).error(function(){
// alert('Sorry could not proceed'); // alert('Sorry could not proceed');
// }); // });
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { InvoiceComponent } from './invoice.component'; import { InvoiceComponent } from './invoice.component';
describe('InvoiceComponent', () => { describe('InvoiceComponent', () => {
let component: InvoiceComponent; let component: InvoiceComponent;
let fixture: ComponentFixture<InvoiceComponent>; let fixture: ComponentFixture<InvoiceComponent>;
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ InvoiceComponent ] declarations: [ InvoiceComponent ]
}) })
.compileComponents(); .compileComponents();
})); }));
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(InvoiceComponent); fixture = TestBed.createComponent(InvoiceComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); });
it('should create', () => { it('should create', () => {
expect(component).toBeTruthy(); expect(component).toBeTruthy();
}); });
}); });

View File

@ -1,486 +1,486 @@
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';
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: 'Paid', field: 'pmtStatus'},
{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.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; this.selectedBillAmt = +this.chosenInv.billAmt;
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();
} }
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) => { this.astuteClientService.voidInvoice(invoiceNumber).then((data) => {
if (data) { if (data) {
this.refreshData(); this.refreshData();
} else { } else {
alert('void invoice failed.'); alert('void invoice failed.');
} }
}); });
} }
submitInvoice(invoiceNumber) { submitInvoice(invoiceNumber) {
this.astuteClientService.submitInvoice(invoiceNumber).then((data) => { this.astuteClientService.submitInvoice(invoiceNumber).then((data) => {
if (data) { if (data) {
this.refreshData(); this.refreshData();
} else { } else {
alert('submit invoice failed.'); alert('submit invoice failed.');
} }
}); });
} }
getPerc(amt, total): number { getPerc(amt, total): number {
return Math.floor(((amt) / total) * 100); return Math.floor(((amt) / total) * 100);
} }
getRangeMax(total, num) { getRangeMax(total, num) {
return Math.floor(total / num); return Math.floor(total / num);
} }
setCorrespondingPos() { setCorrespondingPos() {
this.correspondingPos = this.pos.filter((po, index, array) => { this.correspondingPos = this.pos.filter((po, index, array) => {
return po.customerId === this.chosenCustomerID; return po.customerId === this.chosenCustomerID;
}); });
} }
} }

View File

@ -1,12 +1,12 @@
<ng-template #content let-c="close" let-d="dismiss"> <ng-template #content let-c="close" let-d="dismiss">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title">{{title}}</h4> <h4 class="modal-title">{{title}}</h4>
<button type="button" class="close" aria-label="Close" (click)="d('Cross click')"> <button type="button" class="close" aria-label="Close" (click)="d('Cross click')">
<span aria-hidden="true">&oline;</span> <span aria-hidden="true">&oline;</span>
</button> </button>
</div> </div>
<ng-content></ng-content> <ng-content></ng-content>
<!--<div class="modal-footer">--> <!--<div class="modal-footer">-->
<!--<button type="button" class="btn btn-outline-dark" (click)="c('Close click')">Close</button>--> <!--<button type="button" class="btn btn-outline-dark" (click)="c('Close click')">Close</button>-->
<!--</div>--> <!--</div>-->
</ng-template> </ng-template>

View File

@ -1,25 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ModalFormComponent } from './modal-form.component'; import { ModalFormComponent } from './modal-form.component';
describe('ModalFormComponent', () => { describe('ModalFormComponent', () => {
let component: ModalFormComponent; let component: ModalFormComponent;
let fixture: ComponentFixture<ModalFormComponent>; let fixture: ComponentFixture<ModalFormComponent>;
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ ModalFormComponent ] declarations: [ ModalFormComponent ]
}) })
.compileComponents(); .compileComponents();
})); }));
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(ModalFormComponent); fixture = TestBed.createComponent(ModalFormComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); });
it('should create', () => { it('should create', () => {
expect(component).toBeTruthy(); expect(component).toBeTruthy();
}); });
}); });

View File

@ -1,40 +1,40 @@
import {Component, Input, OnInit, ViewChild} from '@angular/core'; import {Component, Input, OnInit, ViewChild} from '@angular/core';
import {NgbModal, ModalDismissReasons, NgbActiveModal} from '@ng-bootstrap/ng-bootstrap'; import {NgbModal, ModalDismissReasons, NgbActiveModal} from '@ng-bootstrap/ng-bootstrap';
@Component({ @Component({
selector: 'app-modal-form', selector: 'app-modal-form',
templateUrl: './modal-form.component.html', templateUrl: './modal-form.component.html',
styleUrls: ['./modal-form.component.css'] styleUrls: ['./modal-form.component.css']
}) })
export class ModalFormComponent implements OnInit { export class ModalFormComponent implements OnInit {
closeResult: string; closeResult: string;
@Input() title: string; @Input() title: string;
@ViewChild('content') content; @ViewChild('content') content;
activeModal; activeModal;
constructor(private modalService: NgbModal) {} constructor(private modalService: NgbModal) {}
ngOnInit() { ngOnInit() {
} }
open() { open() {
this.activeModal = this.modalService.open(this.content, { size: 'lg' }); this.activeModal = this.modalService.open(this.content, { size: 'lg' });
this.activeModal.result.then((result) => { this.activeModal.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 () { close () {
this.activeModal.close(); this.activeModal.close();
} }
private getDismissReason(reason: any): string { private getDismissReason(reason: any): string {
if (reason === ModalDismissReasons.ESC) { if (reason === ModalDismissReasons.ESC) {
return 'by pressing ESC'; return 'by pressing ESC';
} else if (reason === ModalDismissReasons.BACKDROP_CLICK) { } else if (reason === ModalDismissReasons.BACKDROP_CLICK) {
return 'by clicking on a backdrop'; return 'by clicking on a backdrop';
} else { } else {
return `with: ${reason}`; return `with: ${reason}`;
} }
} }
} }

View File

@ -1,33 +1,34 @@
<nav class="navbar navbar-expand-lg navbar-dark navbar-lightblue"> <nav class="navbar navbar-expand-lg navbar-dark navbar-lightblue">
<a class="navbar-brand" routerLink="/">Astute Internal System</a> <a class="navbar-brand" routerLink="/">Astute Internal System</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup"> <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav"> <div class="navbar-nav">
<a class="nav-link" [ngClass]="customerActive ? 'active' : ''" routerLink="/customer" routerLinkActive="active">Customer</a> <a class="nav-link" [ngClass]="customerActive ? 'active' : ''" routerLink="/customer" routerLinkActive="active">Customer</a>
<a class="nav-link" [ngClass]="salesOrderActive ? 'active' : ''"routerLink="/sales-order" routerLinkActive="active">Sales Order</a> <a class="nav-link" [ngClass]="salesOrderActive ? 'active' : ''"routerLink="/sales-order" routerLinkActive="active">Sales Order</a>
<a class="nav-link" [ngClass]="invoiceActive ? 'active' : ''"routerLink="/invoice" routerLinkActive="active">Invoice</a> <a class="nav-link" [ngClass]="invoiceActive ? 'active' : ''"routerLink="/invoice" routerLinkActive="active">Invoice</a>
</div> <a class="nav-link" [ngClass]="invoicePaymentActive ? 'active' : ''"routerLink="/invoice-payment" routerLinkActive="active">Invoice Payment</a>
</div> </div>
</nav> </div>
</nav>
<!--<div class="card text-center">-->
<!--<div class="card-header">--> <!--<div class="card text-center">-->
<!--<a class="navbar-brand" href="#">Astute Internal System</a>--> <!--<div class="card-header">-->
<!--<ul class="nav nav-pills card-header-pills">--> <!--<a class="navbar-brand" href="#">Astute Internal System</a>-->
<!--<li class="nav-item">--> <!--<ul class="nav nav-pills card-header-pills">-->
<!--<a class="nav-link" [ngClass]="customerActive ? 'active' : ''" routerLink="/customer" routerLinkActive="active">Customer</a>--> <!--<li class="nav-item">-->
<!--</li>--> <!--<a class="nav-link" [ngClass]="customerActive ? 'active' : ''" routerLink="/customer" routerLinkActive="active">Customer</a>-->
<!--<li class="nav-item">--> <!--</li>-->
<!--<a class="nav-link" [ngClass]="salesOrderActive ? 'active' : ''"routerLink="/sales-order" routerLinkActive="active">Sales Order</a>--> <!--<li class="nav-item">-->
<!--</li>--> <!--<a class="nav-link" [ngClass]="salesOrderActive ? 'active' : ''"routerLink="/sales-order" routerLinkActive="active">Sales Order</a>-->
<!--<li class="nav-item">--> <!--</li>-->
<!--<a class="nav-link" [ngClass]="invoiceActive ? 'active' : ''"routerLink="/invoice" routerLinkActive="active">Invoice</a>--> <!--<li class="nav-item">-->
<!--</li>--> <!--<a class="nav-link" [ngClass]="invoiceActive ? 'active' : ''"routerLink="/invoice" routerLinkActive="active">Invoice</a>-->
<!--</ul>--> <!--</li>-->
<!--</div>--> <!--</ul>-->
<!--<div class="card-body">--> <!--</div>-->
<!--<app-homepage></app-homepage>--> <!--<div class="card-body">-->
<!--</div>--> <!--<app-homepage></app-homepage>-->
<!--</div>--> <!--</div>-->
<!--</div>-->

View File

@ -1,25 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NavBarComponent } from './nav-bar.component'; import { NavBarComponent } from './nav-bar.component';
describe('NavBarComponent', () => { describe('NavBarComponent', () => {
let component: NavBarComponent; let component: NavBarComponent;
let fixture: ComponentFixture<NavBarComponent>; let fixture: ComponentFixture<NavBarComponent>;
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ NavBarComponent ] declarations: [ NavBarComponent ]
}) })
.compileComponents(); .compileComponents();
})); }));
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(NavBarComponent); fixture = TestBed.createComponent(NavBarComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); });
it('should create', () => { it('should create', () => {
expect(component).toBeTruthy(); expect(component).toBeTruthy();
}); });
}); });

View File

@ -1,18 +1,19 @@
import {Component, Input, OnInit} from '@angular/core'; import {Component, Input, OnInit} from '@angular/core';
@Component({ @Component({
selector: 'app-nav-bar', selector: 'app-nav-bar',
templateUrl: './nav-bar.component.html', templateUrl: './nav-bar.component.html',
styleUrls: ['./nav-bar.component.css'] styleUrls: ['./nav-bar.component.css']
}) })
export class NavBarComponent implements OnInit { export class NavBarComponent implements OnInit {
@Input() customerActive: boolean; @Input() customerActive: boolean;
@Input() salesOrderActive: boolean; @Input() salesOrderActive: boolean;
@Input() invoiceActive: boolean; @Input() invoiceActive: boolean;
@Input() invoicePaymentActive: boolean;
constructor() { }
constructor() { }
ngOnInit() {
} ngOnInit() {
}
}
}

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="number" class="form-control" placeholder="Derived From Details" [value]="newContractAmount" #contractamt disabled></td> <td style="width: 30%"><input type="number" class="form-control" placeholder="Derived From Details" [value]="newContractAmount" #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)"
(click)="addPo(projNum.value, ponum.value, podate.value, customerid.value, contractnum.value, contractamt.value, title.value, new)" (click)="addPo(projNum.value, ponum.value, podate.value, customerid.value, contractnum.value, contractamt.value, 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="number" class="form-control" placeholder="Contract Amount" [value]="editContractAmount" #contractamt></td> <td style="width: 30%"><input type="number" class="form-control" placeholder="Contract Amount" [value]="editContractAmount" #contractamt></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">Qty</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="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.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)"
(click)="editPo(projNum.value, ponum.value, podate.value, contractnum.value, contractamt.value, title.value, edit)" (click)="editPo(projNum.value, ponum.value, podate.value, contractnum.value, contractamt.value, 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

@ -1,25 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SalesOrderComponent } from './sales-order.component'; import { SalesOrderComponent } from './sales-order.component';
describe('SalesOrderComponent', () => { describe('SalesOrderComponent', () => {
let component: SalesOrderComponent; let component: SalesOrderComponent;
let fixture: ComponentFixture<SalesOrderComponent>; let fixture: ComponentFixture<SalesOrderComponent>;
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ SalesOrderComponent ] declarations: [ SalesOrderComponent ]
}) })
.compileComponents(); .compileComponents();
})); }));
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(SalesOrderComponent); fixture = TestBed.createComponent(SalesOrderComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); });
it('should create', () => { it('should create', () => {
expect(component).toBeTruthy(); expect(component).toBeTruthy();
}); });
}); });

View File

@ -1,261 +1,261 @@
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';
@Component({ @Component({
selector: 'app-sales-order', selector: 'app-sales-order',
templateUrl: './sales-order.component.html', templateUrl: './sales-order.component.html',
styleUrls: ['./sales-order.component.css'] styleUrls: ['./sales-order.component.css']
}) })
export class SalesOrderComponent implements OnInit { export class SalesOrderComponent implements OnInit {
@ViewChild('agGrid') agGrid; @ViewChild('agGrid') agGrid;
selected = null; selected = null;
selectedPODetail = []; selectedPODetail = [];
newPODetail = []; newPODetail = [];
newContractAmount = 0; newContractAmount = 0;
editContractAmount = 0; editContractAmount = 0;
customers; customers;
pos; pos;
serviceTypes; serviceTypes;
columnDefs = [ columnDefs = [
{headerName: 'Project Number', field: 'astuteProjectNumber'}, {headerName: 'Project Number', field: 'astuteProjectNumber'},
{headerName: 'SO Number', field: 'ponum'}, {headerName: 'SO Number', field: 'ponum'},
// {headerName: 'Customer ID', field: 'customerId'}, // {headerName: 'Customer ID', field: 'customerId'},
{headerName: 'Customer Name', field: 'customerName'}, {headerName: 'Customer Name', field: 'customerName'},
{headerName: 'Contract Number', field: 'contractNum'}, {headerName: 'Contract Number', field: 'contractNum'},
{headerName: 'SO Title', field: 'title'}, {headerName: 'SO Title', field: 'title'},
{headerName: 'Contract Amount', field: 'contractAmt'}, {headerName: 'Contract Amount', field: 'contractAmt'},
{headerName: 'SO Date', field: 'podate'}, {headerName: 'SO Date', field: 'podate'},
{headerName: '# of Invoice', field: 'invoiceSequence'} {headerName: '# of Invoice', field: 'invoiceSequence'}
]; ];
rowData: any; rowData: any;
constructor(private astuteClientService: AstuteClientService) { constructor(private astuteClientService: AstuteClientService) {
} }
ngOnInit() { ngOnInit() {
this.refreshData(); this.refreshData();
this.astuteClientService.getServiceTypes().then((d) => { this.astuteClientService.getServiceTypes().then((d) => {
if (d) { if (d) {
this.serviceTypes = d; this.serviceTypes = d;
} else { } else {
alert ('get service types failed'); alert ('get service types failed');
} }
}) })
} }
printValue(val) { printValue(val) {
console.log(val); console.log(val);
} }
addPo(projNum, ponum, podate, customerid, contractnum, contractamt, title, ref) { addPo(projNum, ponum, podate, customerid, contractnum, contractamt, title, ref) {
const poData = { const poData = {
"astuteProjectNumber": projNum, "astuteProjectNumber": projNum,
"poNum": ponum, "poNum": ponum,
"podate": podate, "podate": podate,
"customerId": customerid, "customerId": customerid,
"contractNum": contractnum, "contractNum": contractnum,
"contractAmt": contractamt, "contractAmt": contractamt,
"title": title, "title": title,
} }
console.log(poData); console.log(poData);
this.astuteClientService.createPO(poData).then((data) => { this.astuteClientService.createPO(poData).then((data) => {
if (data) { if (data) {
this.refreshData(); this.refreshData();
this.addPODetail(this.newPODetail); this.addPODetail(this.newPODetail);
ref.close(); ref.close();
} else { } else {
alert("PO Creation failed, check input fields"); alert("PO Creation failed, check input fields");
} }
}, (reason) => { }, (reason) => {
alert("add po failed for " + reason); alert("add po failed for " + reason);
}); });
} }
addPODetail(details) { addPODetail(details) {
if (details.length) { if (details.length) {
console.log(details[0]); console.log(details[0]);
this.astuteClientService.createPODetail(details[0]).then((data) => { this.astuteClientService.createPODetail(details[0]).then((data) => {
if (data) { if (data) {
details.splice(0, 1); details.splice(0, 1);
this.addPODetail(details); this.addPODetail(details);
} else { } else {
alert("add detail failed"); alert("add detail failed");
} }
}); });
} else { } else {
this.newPODetail = []; this.newPODetail = [];
} }
} }
editPo(projNum, ponum, podate, contractnum, contractamt, title, ref) { editPo(projNum, ponum, podate, contractnum, contractamt, title, ref) {
const poData = { const poData = {
"astuteProjectNumber": projNum, "astuteProjectNumber": projNum,
"poNum": ponum, "poNum": ponum,
"podate": podate, "podate": podate,
"contractNum": contractnum, "contractNum": contractnum,
"contractAmt": contractamt, "contractAmt": contractamt,
"title": title, "title": title,
} }
console.log(poData); console.log(poData);
this.astuteClientService.updatePO(ponum, poData).then((data) => { this.astuteClientService.updatePO(ponum, poData).then((data) => {
if (data) { if (data) {
this.refreshData(); this.refreshData();
this.editPODetail(this.selectedPODetail); this.editPODetail(this.selectedPODetail);
ref.close(); ref.close();
} else { } else {
alert("PO updating failed, check input fields"); alert("PO updating failed, check input fields");
} }
}, (reason) => { }, (reason) => {
alert("update po failed for " + reason); alert("update po failed for " + reason);
}); });
} }
editPODetail(details) { editPODetail(details) {
if (details.length) { if (details.length) {
console.log(details[0]); console.log(details[0]);
this.astuteClientService.updatePODetail(details[0].ponum, details[0].lineItemNo, details[0]).then((data) => { this.astuteClientService.updatePODetail(details[0].ponum, details[0].lineItemNo, details[0]).then((data) => {
if (data) { if (data) {
details.splice(0, 1); details.splice(0, 1);
this.editPODetail(details); this.editPODetail(details);
} else { } else {
alert("add detail failed") alert("add detail failed")
} }
}); });
} else { } else {
this.newPODetail = []; this.newPODetail = [];
} }
} }
pushOntoSelectedDetail(lineItemNo: number, ponum, serviceDesc, feeTypeId, serviceTypeId, qty, fee, remainingQty) { pushOntoSelectedDetail(lineItemNo: number, ponum, serviceDesc, feeTypeId, serviceTypeId, qty, fee, remainingQty) {
this.selectedPODetail.push({ this.selectedPODetail.push({
'lineItemNo': lineItemNo, 'lineItemNo': lineItemNo,
'ponum': ponum, 'ponum': ponum,
'serviceDesc': serviceDesc, 'serviceDesc': serviceDesc,
'feeTypeId': feeTypeId, 'feeTypeId': feeTypeId,
'serviceTypeId': serviceTypeId, 'serviceTypeId': serviceTypeId,
'qty': qty, 'qty': qty,
'fee': fee, 'fee': fee,
'remainingQty': remainingQty 'remainingQty': remainingQty
}); });
} }
pushOntoNewDetail(lineItemNo: number, ponum, serviceDesc, feeTypeId, serviceTypeId, qty, fee, remainingQty) { pushOntoNewDetail(lineItemNo: number, ponum, serviceDesc, feeTypeId, serviceTypeId, qty, fee, remainingQty) {
this.newPODetail.push({ this.newPODetail.push({
'lineItemNo': lineItemNo, 'lineItemNo': lineItemNo,
'poNum': ponum, 'poNum': ponum,
'serviceDesc': serviceDesc, 'serviceDesc': serviceDesc,
'feeTypeId': feeTypeId, 'feeTypeId': feeTypeId,
'serviceTypeId': serviceTypeId, 'serviceTypeId': serviceTypeId,
'qty': qty, 'qty': qty,
'fee': fee, 'fee': fee,
'remainingQty': remainingQty 'remainingQty': remainingQty
}); });
} }
updateNewContractAmt() { updateNewContractAmt() {
let tot = 0; let tot = 0;
this.newPODetail.forEach((d) => { this.newPODetail.forEach((d) => {
tot += +d.qty * +d.fee; tot += +d.qty * +d.fee;
}); });
this.newContractAmount = tot; this.newContractAmount = tot;
} }
updateEditContractAmt() { updateEditContractAmt() {
let tot = 0; let tot = 0;
this.selectedPODetail.forEach((d) => { this.selectedPODetail.forEach((d) => {
tot += +d.qty * +d.fee; tot += +d.qty * +d.fee;
}); });
this.editContractAmount = tot; this.editContractAmount = tot;
} }
open(ref) { open(ref) {
this.getSelectedRows(); this.getSelectedRows();
ref.open(); ref.open();
} }
close(ref) { close(ref) {
this.newPODetail = []; this.newPODetail = [];
this.selectedPODetail = []; this.selectedPODetail = [];
ref.close(); ref.close();
} }
onSelectedCellChange(row: number, col: string, value) { onSelectedCellChange(row: number, col: string, value) {
this.selectedPODetail[row][col] = value; this.selectedPODetail[row][col] = value;
console.log(this.selectedPODetail); console.log(this.selectedPODetail);
} }
onNewCellChange(row: number, col: string, value) { onNewCellChange(row: number, col: string, value) {
this.newPODetail[row][col] = value; this.newPODetail[row][col] = value;
console.log(this.newPODetail); console.log(this.newPODetail);
} }
getCurrDate() { getCurrDate() {
const d = new Date(); const d = new Date();
return this.formatDate(d); return this.formatDate(d);
} }
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('-');
} }
getSelectedRows() { getSelectedRows() {
const selectedNodes = this.agGrid.api.getSelectedNodes(); const selectedNodes = this.agGrid.api.getSelectedNodes();
if (selectedNodes.length) { if (selectedNodes.length) {
this.selected = selectedNodes.map(node => node.data)[0]; this.selected = selectedNodes.map(node => node.data)[0];
this.editContractAmount = +this.selected.contractAmt; this.editContractAmount = +this.selected.contractAmt;
this.astuteClientService.getPODetail(this.selected.ponum).then((data) => { this.astuteClientService.getPODetail(this.selected.ponum).then((data) => {
if (data) { if (data) {
this.selectedPODetail = data; this.selectedPODetail = data;
console.log(this.selectedPODetail); console.log(this.selectedPODetail);
} else { } else {
alert("get PO detail failed!") alert("get PO detail failed!")
} }
}); });
} else { } else {
this.selected = null; this.selected = null;
this.selectedPODetail = []; this.selectedPODetail = [];
} }
} }
refreshData() { refreshData() {
this.astuteClientService.getCustomers().then((customers) => { this.astuteClientService.getCustomers().then((customers) => {
if (customers) { if (customers) {
this.customers = customers; this.customers = customers;
this.astuteClientService.getPOs().then((data) => { this.astuteClientService.getPOs().then((data) => {
if (data) { if (data) {
this.pos = data; this.pos = data;
this.rowData = data; this.rowData = data;
this.rowData.forEach((row) => { this.rowData.forEach((row) => {
row.customerName = this.getCustomerName(row.customerId); row.customerName = this.getCustomerName(row.customerId);
}); });
} }
}); });
} else { } else {
alert("get Customers Failed!"); alert("get Customers Failed!");
} }
}); });
// this.rowData = this.astuteClientService.getPOs(); // this.rowData = this.astuteClientService.getPOs();
} }
getCustomerName(customerId) { getCustomerName(customerId) {
let name = ""; let name = "";
this.customers.forEach((customer) => { this.customers.forEach((customer) => {
if (customer.customerId === customerId) { if (customer.customerId === customerId) {
name = customer.customerName; name = customer.customerName;
} }
}); });
return name; return name;
} }
} }