diff --git a/AstuteClient2/src/app/app-box/app-box.component.html b/AstuteClient2/src/app/app-box/app-box.component.html index dd27baa..13302b6 100644 --- a/AstuteClient2/src/app/app-box/app-box.component.html +++ b/AstuteClient2/src/app/app-box/app-box.component.html @@ -1,38 +1,38 @@ - - - - - - - - - - - - - - -
-
-
-
-
- {{symbol}} -
-
-
{{name}}
-
-
-
-
-
-
-
-
- -
-
-
- -
-
+ + + + + + + + + + + + + + +
+
+
+
+
+ {{symbol}} +
+
+
{{name}}
+
+
+
+
+
+
+
+
+ +
+
+
+ +
+
diff --git a/AstuteClient2/src/app/app-box/app-box.component.spec.ts b/AstuteClient2/src/app/app-box/app-box.component.spec.ts index 19059ae..7561555 100644 --- a/AstuteClient2/src/app/app-box/app-box.component.spec.ts +++ b/AstuteClient2/src/app/app-box/app-box.component.spec.ts @@ -1,25 +1,25 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { AppBoxComponent } from './app-box.component'; - -describe('AppBoxComponent', () => { - let component: AppBoxComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ AppBoxComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(AppBoxComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AppBoxComponent } from './app-box.component'; + +describe('AppBoxComponent', () => { + let component: AppBoxComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AppBoxComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AppBoxComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/AstuteClient2/src/app/app-box/app-box.component.ts b/AstuteClient2/src/app/app-box/app-box.component.ts index 284bf18..db65c33 100644 --- a/AstuteClient2/src/app/app-box/app-box.component.ts +++ b/AstuteClient2/src/app/app-box/app-box.component.ts @@ -1,37 +1,37 @@ -import { Component, OnInit, Input } from '@angular/core'; - -@Component({ - selector: 'app-app-box', - templateUrl: './app-box.component.html', - styleUrls: ['./app-box.component.css'] -}) -export class AppBoxComponent implements OnInit { - @Input() name; - @Input() symbol; - @Input() description; - @Input() color; - - constructor() { } - - ngOnInit() { - this.color = this.getColor(); - } - - getColor() { - if (this.color) { - return this.color; - } else { - const clr = this.padStart(Math.floor((Math.random() * 16777215)).toString(16), 6, '0'); - return '#' + clr; - } - } - - padStart(str: string, l: number, append: string) { - let len = str.length; - while (len < l) { - str = append + str; - len = str.length; - } - return str; - } -} +import { Component, OnInit, Input } from '@angular/core'; + +@Component({ + selector: 'app-app-box', + templateUrl: './app-box.component.html', + styleUrls: ['./app-box.component.css'] +}) +export class AppBoxComponent implements OnInit { + @Input() name; + @Input() symbol; + @Input() description; + @Input() color; + + constructor() { } + + ngOnInit() { + this.color = this.getColor(); + } + + getColor() { + if (this.color) { + return this.color; + } else { + const clr = this.padStart(Math.floor((Math.random() * 16777215)).toString(16), 6, '0'); + return '#' + clr; + } + } + + padStart(str: string, l: number, append: string) { + let len = str.length; + while (len < l) { + str = append + str; + len = str.length; + } + return str; + } +} diff --git a/AstuteClient2/src/app/customer/customer.component.css b/AstuteClient2/src/app/customer/customer.component.css index 8fe4dc3..b3aaa87 100644 --- a/AstuteClient2/src/app/customer/customer.component.css +++ b/AstuteClient2/src/app/customer/customer.component.css @@ -1,11 +1,11 @@ -::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */ - color: lightblue; -} - -:-ms-input-placeholder { /* Internet Explorer 10-11 */ - color: lightblue; -} - -::-ms-input-placeholder { /* Microsoft Edge */ - color: lightblue; +::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */ + color: lightblue; +} + +:-ms-input-placeholder { /* Internet Explorer 10-11 */ + color: lightblue; +} + +::-ms-input-placeholder { /* Microsoft Edge */ + color: lightblue; } \ No newline at end of file diff --git a/AstuteClient2/src/app/customer/customer.component.html b/AstuteClient2/src/app/customer/customer.component.html index aec027a..712e442 100644 --- a/AstuteClient2/src/app/customer/customer.component.html +++ b/AstuteClient2/src/app/customer/customer.component.html @@ -1,271 +1,271 @@ - -

Customers

-
-
-
- -
-
-
-
- -
-
- -
-
-
- - - - - - - - - - -
- - - -
-
- - -
-
+ +

Customers

+
+
+
+ +
+
+
+
+ +
+
+ +
+
+
+ + + + + + + + + + +
+ + + +
+
+ + +
+
diff --git a/AstuteClient2/src/app/customer/customer.component.spec.ts b/AstuteClient2/src/app/customer/customer.component.spec.ts index f185e7a..caf4d6d 100644 --- a/AstuteClient2/src/app/customer/customer.component.spec.ts +++ b/AstuteClient2/src/app/customer/customer.component.spec.ts @@ -1,25 +1,25 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { CustomerComponent } from './customer.component'; - -describe('CustomerComponent', () => { - let component: CustomerComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ CustomerComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(CustomerComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CustomerComponent } from './customer.component'; + +describe('CustomerComponent', () => { + let component: CustomerComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ CustomerComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CustomerComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/AstuteClient2/src/app/customer/customer.component.ts b/AstuteClient2/src/app/customer/customer.component.ts index 8456c5b..93c45d6 100644 --- a/AstuteClient2/src/app/customer/customer.component.ts +++ b/AstuteClient2/src/app/customer/customer.component.ts @@ -1,170 +1,170 @@ -import {Component, OnInit, ViewChild} from '@angular/core'; -import {AstuteClientService} from '../services/astute-client-service'; - -@Component({ - selector: 'app-customer', - templateUrl: './customer.component.html', - styleUrls: ['./customer.component.css'] -}) -export class CustomerComponent implements OnInit { - @ViewChild('agGrid') agGrid; - selected = null; - customers; - columnDefs = [ - {headerName: 'Customer ID', field: 'customerId', checkboxSelection: true}, - {headerName: 'Customer Name', field: 'customerName'}, - {headerName: 'Bill To Department', field: 'billToDept'}, - {headerName: 'Address 1', field: 'add1'}, - {headerName: 'Address 2', field: 'add2'}, - {headerName: 'City', field: 'city'}, - {headerName: 'Email', field: 'email'}, - {headerName: 'Fax', field: 'fax'}, - {headerName: 'Phone', field: 'phone'}, - {headerName: 'State', field: 'state'}, - {headerName: 'ZIP', field: 'zip'}, - {headerName: 'ZIP-4', field: 'ziplast4'} - ]; - rowData: any; - states = [ - 'AL', - 'AK', - 'AR', - 'AZ', - 'CA', - 'CO', - 'CT', - 'DC', - 'DE', - 'FL', - 'GA', - 'HI', - 'IA', - 'ID', - 'IL', - 'IN', - 'KS', - 'KY', - 'LA', - 'MA', - 'MD', - 'ME', - 'MI', - 'MN', - 'MO', - 'MS', - 'MT', - 'NC', - 'NE', - 'NH', - 'NJ', - 'NM', - 'NV', - 'NY', - 'ND', - 'OH', - 'OK', - 'OR', - 'PA', - 'RI', - 'SC', - 'SD', - 'TN', - 'TX', - 'UT', - 'VT', - 'VA', - 'WA', - 'WI', - 'WV', - 'WY' - ]; - usPhoneMask = ['(', /[1-9]/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/]; - - constructor(protected astuteClientService: AstuteClientService) { - } - - ngOnInit() { - this.refreshData(); - } - - getSelectedRows() { - const selectedNodes = this.agGrid.api.getSelectedNodes(); - if (selectedNodes.length) { - this.selected = selectedNodes.map(node => node.data)[0]; - } else { - 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 - addCustomer(customerId, name, billTo, add1, add2, city, state, zip, zip4, email, phone, fax, ref) { - let customerData = { - "customerId": customerId, - "customerName": name, - "billToDept": billTo, - "add1": add1, - "add2": add2, - "city": city, - "state": state, - "zip": zip, - "ziplast4": zip4, - "email": email, - "phone": phone, - "fax": fax - }; - this.astuteClientService.createCustomer(customerData).then((data) => { - if (data) { - this.refreshData(); - ref.close(); - } else { - alert("Customer Creation Failed, Check Input Fields") - } - }, (reason) => { - alert("add customer failed for " + reason); - }); - } - - - editCustomer(id, name, billTo, add1, add2, city, state, zip, zip4, email, phone, fax, ref) { - const customerData = { - "customerId": id, - "customerName": name, - "billToDept": billTo, - "add1": add1, - "add2": add2, - "city": city, - "state": state, - "zip": zip, - "ziplast4": zip4, - "email": email, - "phone": phone, - "fax": fax - }; - this.astuteClientService.updateCustomer(id, customerData).then((data) => { - if (data) { - this.refreshData(); - ref.close(); - } else { - alert("Customer Updating Failed, Check Input Fields") - } - }, (reason) => { - alert("update customer failed for " + reason); - }); - } - - open(ref) { - this.getSelectedRows(); - ref.open(); - } - - close(ref) { - ref.close(); - } - - refreshData() { - this.rowData = this.astuteClientService.getCustomers(); - this.astuteClientService.getCustomers().then((data) => { - this.customers = data; - }); - } -} +import {Component, OnInit, ViewChild} from '@angular/core'; +import {AstuteClientService} from '../services/astute-client-service'; + +@Component({ + selector: 'app-customer', + templateUrl: './customer.component.html', + styleUrls: ['./customer.component.css'] +}) +export class CustomerComponent implements OnInit { + @ViewChild('agGrid') agGrid; + selected = null; + customers; + columnDefs = [ + {headerName: 'Customer ID', field: 'customerId', checkboxSelection: true}, + {headerName: 'Customer Name', field: 'customerName'}, + {headerName: 'Bill To Department', field: 'billToDept'}, + {headerName: 'Address 1', field: 'add1'}, + {headerName: 'Address 2', field: 'add2'}, + {headerName: 'City', field: 'city'}, + {headerName: 'Email', field: 'email'}, + {headerName: 'Fax', field: 'fax'}, + {headerName: 'Phone', field: 'phone'}, + {headerName: 'State', field: 'state'}, + {headerName: 'ZIP', field: 'zip'}, + {headerName: 'ZIP-4', field: 'ziplast4'} + ]; + rowData: any; + states = [ + 'AL', + 'AK', + 'AR', + 'AZ', + 'CA', + 'CO', + 'CT', + 'DC', + 'DE', + 'FL', + 'GA', + 'HI', + 'IA', + 'ID', + 'IL', + 'IN', + 'KS', + 'KY', + 'LA', + 'MA', + 'MD', + 'ME', + 'MI', + 'MN', + 'MO', + 'MS', + 'MT', + 'NC', + 'NE', + 'NH', + 'NJ', + 'NM', + 'NV', + 'NY', + 'ND', + 'OH', + 'OK', + 'OR', + 'PA', + 'RI', + 'SC', + 'SD', + 'TN', + 'TX', + 'UT', + 'VT', + 'VA', + 'WA', + 'WI', + 'WV', + 'WY' + ]; + usPhoneMask = ['(', /[1-9]/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/]; + + constructor(protected astuteClientService: AstuteClientService) { + } + + ngOnInit() { + this.refreshData(); + } + + getSelectedRows() { + const selectedNodes = this.agGrid.api.getSelectedNodes(); + if (selectedNodes.length) { + this.selected = selectedNodes.map(node => node.data)[0]; + } else { + 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 + addCustomer(customerId, name, billTo, add1, add2, city, state, zip, zip4, email, phone, fax, ref) { + let customerData = { + "customerId": customerId, + "customerName": name, + "billToDept": billTo, + "add1": add1, + "add2": add2, + "city": city, + "state": state, + "zip": zip, + "ziplast4": zip4, + "email": email, + "phone": phone, + "fax": fax + }; + this.astuteClientService.createCustomer(customerData).then((data) => { + if (data) { + this.refreshData(); + ref.close(); + } else { + alert("Customer Creation Failed, Check Input Fields") + } + }, (reason) => { + alert("add customer failed for " + reason); + }); + } + + + editCustomer(id, name, billTo, add1, add2, city, state, zip, zip4, email, phone, fax, ref) { + const customerData = { + "customerId": id, + "customerName": name, + "billToDept": billTo, + "add1": add1, + "add2": add2, + "city": city, + "state": state, + "zip": zip, + "ziplast4": zip4, + "email": email, + "phone": phone, + "fax": fax + }; + this.astuteClientService.updateCustomer(id, customerData).then((data) => { + if (data) { + this.refreshData(); + ref.close(); + } else { + alert("Customer Updating Failed, Check Input Fields") + } + }, (reason) => { + alert("update customer failed for " + reason); + }); + } + + open(ref) { + this.getSelectedRows(); + ref.open(); + } + + close(ref) { + ref.close(); + } + + refreshData() { + this.rowData = this.astuteClientService.getCustomers(); + this.astuteClientService.getCustomers().then((data) => { + this.customers = data; + }); + } +} diff --git a/AstuteClient2/src/app/homepage/homepage.component.html b/AstuteClient2/src/app/homepage/homepage.component.html index 38abb5b..5a31e36 100644 --- a/AstuteClient2/src/app/homepage/homepage.component.html +++ b/AstuteClient2/src/app/homepage/homepage.component.html @@ -1,69 +1,69 @@ - -
-
- -
-
-

- Welcome to the Astute Internal System, {{currentUser}}! -

-
-
-
- -
- -
-
-
-
- - -
-
-
-

- Applications -

-
-
-
- -
Go here to add or edit customers
- -
- -
Go here to add sales orders or make change orders
- -
- -
Go here to interact with invoices
- -
- -
Go here to to pay an invoice
- -
-
-
- - -
-
-
-

- Extra info section -

-
-
-
-
- Some sort of info here, maybe about recent invoices, or upcoming payment due dates.
- Maybe something for each users tasks... -
-
-
-
-
+ +
+
+ +
+
+

+ Welcome to the Astute Internal System, {{currentUser}}! +

+
+
+
+ +
+ +
+
+
+
+ + +
+
+
+

+ Applications +

+
+
+
+ +
Go here to add or edit customers
+ +
+ +
Go here to add sales orders or make change orders
+ +
+ +
Go here to interact with invoices
+ +
+ +
Go here to enter payments received
+ +
+
+
+ + +
+
+
+

+ Extra info section +

+
+
+
+
+ Some sort of info here, maybe about recent invoices, or upcoming payment due dates.
+ Maybe something for each users tasks... +
+
+
+
+
diff --git a/AstuteClient2/src/app/homepage/homepage.component.spec.ts b/AstuteClient2/src/app/homepage/homepage.component.spec.ts index 8d1d3bb..30000e3 100644 --- a/AstuteClient2/src/app/homepage/homepage.component.spec.ts +++ b/AstuteClient2/src/app/homepage/homepage.component.spec.ts @@ -1,25 +1,25 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { HomepageComponent } from './homepage.component'; - -describe('HomepageComponent', () => { - let component: HomepageComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ HomepageComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(HomepageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { HomepageComponent } from './homepage.component'; + +describe('HomepageComponent', () => { + let component: HomepageComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ HomepageComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(HomepageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/AstuteClient2/src/app/homepage/homepage.component.ts b/AstuteClient2/src/app/homepage/homepage.component.ts index 5bb2564..741f582 100644 --- a/AstuteClient2/src/app/homepage/homepage.component.ts +++ b/AstuteClient2/src/app/homepage/homepage.component.ts @@ -1,22 +1,22 @@ -import {Component, OnInit} from '@angular/core'; - -@Component({ - selector: 'app-homepage', - templateUrl: './homepage.component.html', - styleUrls: ['./homepage.component.css'] -}) -export class HomepageComponent implements OnInit { - currentUser: any = {}; - - constructor() { - } - - ngOnInit() { - this.currentUser = this.getSessionUser(); - console.log(this.currentUser); - } - - private getSessionUser() { - return localStorage.getItem('SESSION_USER'); - } -} +import {Component, OnInit} from '@angular/core'; + +@Component({ + selector: 'app-homepage', + templateUrl: './homepage.component.html', + styleUrls: ['./homepage.component.css'] +}) +export class HomepageComponent implements OnInit { + currentUser: any = {}; + + constructor() { + } + + ngOnInit() { + this.currentUser = this.getSessionUser(); + console.log(this.currentUser); + } + + private getSessionUser() { + return localStorage.getItem('SESSION_USER'); + } +} diff --git a/AstuteClient2/src/app/invoice-gen/invoice-gen.component.css b/AstuteClient2/src/app/invoice-gen/invoice-gen.component.css index 6570e0b..dedc174 100644 --- a/AstuteClient2/src/app/invoice-gen/invoice-gen.component.css +++ b/AstuteClient2/src/app/invoice-gen/invoice-gen.component.css @@ -1,48 +1,48 @@ -/*body {*/ -/*margin: 0;*/ -/*padding: 0;*/ -/*background-color: #FAFAFA;*/ -/*font: 12pt "Tahoma";*/ -/*}*/ -/** {*/ -/*box-sizing: border-box;*/ -/*-moz-box-sizing: border-box;*/ -/*}*/ -.page { - width: 21cm; - min-height: 29.7cm; - padding: 2cm; - margin: 1cm auto; - border: 1px #D3D3D3 solid; - border-radius: 5px; - background: white; - box-shadow: 0 0 5px rgba(0, 0, 0, 0.1); - font-size: 11pt; -} -/*.subpage {*/ -/*padding: 1cm;*/ -/*border: 5px red solid;*/ -/*height: 256mm;*/ -/*outline: 2cm #FFEAEA solid;*/ -/*}*/ - -/*@page {*/ -/*size: A4;*/ -/*margin: 0;*/ -/*}*/ -/*@media print {*/ -/*html, body {*/ -/*width: 210mm;*/ -/*height: 297mm;*/ -/*}*/ -/*.page {*/ -/*margin: 0;*/ -/*border: initial;*/ -/*border-radius: initial;*/ -/*width: initial;*/ -/*min-height: initial;*/ -/*box-shadow: initial;*/ -/*background: initial;*/ -/*page-break-after: always;*/ -/*}*/ -/*}*/ +/*body {*/ +/*margin: 0;*/ +/*padding: 0;*/ +/*background-color: #FAFAFA;*/ +/*font: 12pt "Tahoma";*/ +/*}*/ +/** {*/ +/*box-sizing: border-box;*/ +/*-moz-box-sizing: border-box;*/ +/*}*/ +.page { + width: 21cm; + min-height: 29.7cm; + padding: 2cm; + margin: 1cm auto; + border: 1px #D3D3D3 solid; + border-radius: 5px; + background: white; + box-shadow: 0 0 5px rgba(0, 0, 0, 0.1); + font-size: 11pt; +} +/*.subpage {*/ +/*padding: 1cm;*/ +/*border: 5px red solid;*/ +/*height: 256mm;*/ +/*outline: 2cm #FFEAEA solid;*/ +/*}*/ + +/*@page {*/ +/*size: A4;*/ +/*margin: 0;*/ +/*}*/ +/*@media print {*/ +/*html, body {*/ +/*width: 210mm;*/ +/*height: 297mm;*/ +/*}*/ +/*.page {*/ +/*margin: 0;*/ +/*border: initial;*/ +/*border-radius: initial;*/ +/*width: initial;*/ +/*min-height: initial;*/ +/*box-shadow: initial;*/ +/*background: initial;*/ +/*page-break-after: always;*/ +/*}*/ +/*}*/ diff --git a/AstuteClient2/src/app/invoice-gen/invoice-gen.component.html b/AstuteClient2/src/app/invoice-gen/invoice-gen.component.html index 6285030..51e76a3 100644 --- a/AstuteClient2/src/app/invoice-gen/invoice-gen.component.html +++ b/AstuteClient2/src/app/invoice-gen/invoice-gen.component.html @@ -1,127 +1,127 @@ -
-
-
-
- Astute Engineering -
-
-

INVOICE

-
-
-
-
-
-

To,

-

{{name}}

-

{{email}}

-

{{address}}

-
-
-

Purchase Order No.:

-

Contract No.:

-

Invoice No.:

-

Invoice Date:

-
-
-

{{poNum}}

-

{{coNum}}

-

{{inNum}}

-

{{inDate}}

-
-
-
-
- - - - - - - - - - - - - - - - - - - -
No.DescriptionHourly RateHours ExpendedInvoice Amount
{{inDet.lineItemNum}}{{inDet.desc}}${{inDet.anount}}.00-${{inDet.anount}}.00
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Original Contract Amount{{ogCoAmt}}  
Net Changes by Change Orders{{netChanges}}  
Total Contract Amount{{totCoAmt}}  
Previously Billed{{prevBill}}  
Amount This Invoice{{inAmt}}  
Balance to be Billed{{balToBeBill}}Total Due This Invoice{{finTot}}
-
-
-
-

Notes:

-
    - {{notes}} -
-
-
-

{{cert}}

-
-
-
-

-
-
-
-
-
-
-
-
- -
-
-
-
- -
-
+
+
+
+
+ Astute Engineering +
+
+

INVOICE

+
+
+
+
+
+

To,

+

{{name}}

+

{{email}}

+

{{address}}

+
+
+

Purchase Order No.:

+

Contract No.:

+

Invoice No.:

+

Invoice Date:

+
+
+

{{poNum}}

+

{{coNum}}

+

{{inNum}}

+

{{inDate}}

+
+
+
+
+ + + + + + + + + + + + + + + + + + + +
No.DescriptionHourly RateHours ExpendedInvoice Amount
{{inDet.lineItemNum}}{{inDet.desc}}${{inDet.anount}}.00-${{inDet.anount}}.00
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Original Contract Amount{{ogCoAmt}}  
Net Changes by Change Orders{{netChanges}}  
Total Contract Amount{{totCoAmt}}  
Previously Billed{{prevBill}}  
Amount This Invoice{{inAmt}}  
Balance to be Billed{{balToBeBill}}Total Due This Invoice{{finTot}}
+
+
+
+

Notes:

+
    + {{notes}} +
+
+
+

{{cert}}

+
+
+
+

+
+
+
+
+
+
+
+
+ +
+
+
+
+ +
+

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

Invoices

-
- -
-
- -
-
- - -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +

Invoices

+
+ +
+
+ +
+
+ + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AstuteClient2/src/app/invoice/invoice.component.spec.ts b/AstuteClient2/src/app/invoice/invoice.component.spec.ts index e3cdfcd..86b101d 100644 --- a/AstuteClient2/src/app/invoice/invoice.component.spec.ts +++ b/AstuteClient2/src/app/invoice/invoice.component.spec.ts @@ -1,25 +1,25 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { InvoiceComponent } from './invoice.component'; - -describe('InvoiceComponent', () => { - let component: InvoiceComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ InvoiceComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(InvoiceComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { InvoiceComponent } from './invoice.component'; + +describe('InvoiceComponent', () => { + let component: InvoiceComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ InvoiceComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(InvoiceComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/AstuteClient2/src/app/invoice/invoice.component.ts b/AstuteClient2/src/app/invoice/invoice.component.ts index 5f82e1b..ceb28b0 100644 --- a/AstuteClient2/src/app/invoice/invoice.component.ts +++ b/AstuteClient2/src/app/invoice/invoice.component.ts @@ -1,486 +1,486 @@ -import {Component, OnInit, ViewChild} from '@angular/core'; -import {AstuteClientService} from '../services/astute-client-service'; - -declare var $: any; - -@Component({ - selector: 'app-invoice', - templateUrl: './invoice.component.html', - styleUrls: ['./invoice.component.css'] -}) -export class InvoiceComponent implements OnInit { - @ViewChild('agGrid') agGrid; - chosenCustomerID: any = 0; - chosenInv: any = 0; - source; - customers; - pos = []; - chosenPo; - correspondingPos = []; - generatedInvoiceNumber = ''; - feeTypes = ['Fixed Fee', 'Hourly']; - serviceTypes = ['Study', 'Design', 'Peer Review', 'Cost Investigation', 'Forensic Investigation']; - columnDefs = [ - {headerName: 'Invoice Number', field: 'invoiceNumber'}, - {headerName: 'Date', field: 'invoiceDate'}, - {headerName: 'Sales Order Number', field: 'poNum'}, - {headerName: 'Change Order Number', field: 'changeOrderNum'}, - {headerName: 'Paid', field: 'pmtStatus'}, - {headerName: 'Bll Amount', field: 'billAmt'} - ]; - newInDetails = []; - newBillAmt = 0; - selectedInDetails = []; - selectedPO; - selectedBillAmt = 0; - poDetails = []; - selectedPODetails = []; - - gridOptions = { - - // PROPERTIES - object properties, myRowData and myColDefs are created somewhere in your application - rowData: this.source, - columnDefs: this.columnDefs, - - // PROPERTIES - simple boolean / string / number properties - enableColResize: true, - rowSelection: 'single', - - // EVENTS - add event callback handlers - onRowClicked: (event) => { - this.getSelectedRows() - }, - onColumnResized: function (event) { - console.log('a column was resized'); - }, - onGridReady: (event) => { - }, - // this.agGrid.sizeColumnsToFit(); - // 1: draft - // 2: submitted - // 3: void - - // getRowStyle: function(params) { - // if (params.data.invoiceStatus === 1) { - // return { 'color': 'red' } - // } else if (params.data.invoiceStatus === 3) { - // return { 'text-decoration': 'line-through'} - // } - // } - - rowClassRules: { - // apply green to 2008 - // 'bg-red': true, - - // apply amber 2004 - 'text-danger': function (params) { - return params.data.invoiceStatus === 1; - }, - 'text-primary': function (params) { - return params.data.invoiceStatus === 2; - }, - 'text-warning': function (params) { - return params.data.invoiceStatus === 3; - }, - - // apply red to 2000 - // 'rag-red-outer': function(params) { return params.data.year === 2000} - } - } - - constructor(protected astuteClientService: AstuteClientService) { - } - - customerDropdownChange(index) { - this.chosenCustomerID = this.customers[index].customerId; - this.setCorrespondingPos(); - } - - poDropdownChange(ponum) { - this.pos.forEach((po) => { - if (po.ponum === ponum) { - this.chosenPo = po; - } - }) - this.astuteClientService.getPODetail(ponum).then((data) => { - if (data) { - // fee - // feeTypeId - // lineItemNo - // ponum - // qty - // remainingQty - // serviceDesc - // serviceTypeId - - // lineItemNo, feeTypeId, serviceTypeId, serviceDesc, fee, remainingQty - this.poDetails = data; - this.poDetails[-1] = { - 'lineItemNo': -1, - 'feeTypeId': 1, - 'serviceTypeId': 1, - 'serviceDesc': 'Out of Pocket Expenses', - 'fee': 0, - 'remainingQty': 0 - }; - } else { - alert("get PO detail failed!"); - } - }); - this.astuteClientService.generateInvoiceNumber(ponum).then((data) => { - if (data) { - this.generatedInvoiceNumber = data; - } else { - alert('gen inv num failed!'); - } - }); - } - - ngOnInit() { - this.refreshData(); - } - - refreshData() { - this.astuteClientService.getInvoices().then((data) => { - this.source = data; - }); - - this.astuteClientService.getCustomers().then((data) => { - this.customers = data; - }); - - this.astuteClientService.getPOs().then((data) => { - this.pos = data; - }); - } - - getPODetails(poIndex) { - let ponum = this.pos[poIndex].ponum; - this.astuteClientService.getPODetail(ponum).then((data) => { - this.selectedInDetails = data; - console.log("inDetails:"); - console.log(this.selectedInDetails); - }); - } - - onSelectedCellChange(row: number, col: string, value) { - this.selectedInDetails[row][col] = value; - console.log(this.selectedInDetails); - } - - onNewCellChange(row: number, col: string, value) { - this.newInDetails[row][col] = value; - console.log(this.newInDetails); - } - - pushOntoSelectedDetail(invoiceNum, lineItemNum, poLineItemNum, serviceTypeId, desc, qty, fee) { - this.selectedInDetails.push({ - 'invoiceNum': invoiceNum, - 'lineItemNum': lineItemNum, - 'poLineItemNum': poLineItemNum, - 'serviceTypeId': serviceTypeId, - 'desc': desc, - 'qty': +qty, - 'fee': +fee - }); - } - - pushOntoNewDetail(invoiceNum, lineItemNum, poLineItemNum, feeTypeId, serviceTypeId, desc, qty, fee, remainingQty, poNum) { - this.newInDetails.push({ - 'invoiceNum': invoiceNum, - 'lineItemNum': lineItemNum, - 'poLineItemNum': poLineItemNum, - 'feeTypeId': feeTypeId, - 'serviceTypeId': serviceTypeId, - 'desc': desc, - 'qty': +qty, - 'fee': +fee, - 'remainingQty': +remainingQty, - 'poNum': poNum - }); - console.log(this.newInDetails); - } - - updateNewBillAmt() { - let tot = 0; - this.newInDetails.forEach((d) => { - tot += +d.qty * +d.fee; - }); - this.newBillAmt = tot; - } - - updateSelectedBillAmt() { - let tot = 0; - this.selectedInDetails.forEach((d) => { - tot += +d.qty * +d.fee; - }); - this.selectedBillAmt = tot; - } - - - assignActity(): void { - window.open('/invoice-gen'); - } - - getSelectedRows() { - const selectedNodes = this.agGrid.api.getSelectedNodes(); - if (selectedNodes.length) { - this.chosenInv = selectedNodes.map(node => node.data)[0]; - // console.log (this.chosenInv); - this.selectedBillAmt = +this.chosenInv.billAmt; - this.astuteClientService.getPODetail(this.chosenInv.poNum).then((poDetails) => { - if (poDetails) { - this.selectedPODetails = poDetails; - this.astuteClientService.getInvoiceDetail(this.chosenInv.invoiceNumber).then((invoiceDetails) => { - if (invoiceDetails) { - this.selectedInDetails = invoiceDetails; - this.selectedInDetails.forEach((invDetail) => { - const tempPo = this.selectedPODetails.filter((po) => { - // console.log (po.lineItemNo + " and " + invDetail.poLineItemNum); - return po.lineItemNo === invDetail.poLineItemNum; - })[0]; - if (tempPo) { - invDetail.remainingQty = tempPo.remainingQty; - } - }); - } else { - alert("get Inv detail failed!"); - } - }); - } else { - alert("get PO detail failed!") - } - }); - this.pos.forEach((po) => { - if (po.ponum === this.chosenInv.poNum) { - this.selectedPO = po; - } - }); - } else { - this.chosenInv = null; - this.selectedPODetails = []; - } - } - - open(content, indexPO, indexINV) { - content.open(); - // this.detailDescription = ViewChild('detailDescription'); - // this.detailAmount = ViewChild('detailAmount'); - // this.detailRate = ViewChild('detailRate'); - // this.detailTotal = ViewChild('detailTotal'); - // if (indexINV) { - // this.chosenInv = indexINV; - // } - // if (indexPO) { - // this.chosenPo = indexPO; - // this.getPODetails(this.chosenPo); - // } - // this.modalService.open(content, { size: 'lg' }).result.then((result) => { - // this.closeResult = `Closed with: ${result}`; - // }, (reason) => { - // this.closeResult = `Dismissed ${this.getDismissReason(reason)}`; - // }); - } - - close(content) { - content.close(); - } - - getCurrDate() { - let d = new Date(), - month = '' + (d.getMonth() + 1), - day = '' + d.getDate(), - year = d.getFullYear(); - - if (month.length < 2) month = '0' + month; - if (day.length < 2) day = '0' + day; - - - return [year, month, day].join('-'); - } - - formatDate(d: Date) { - let month = '' + (d.getMonth() + 1), - day = '' + d.getDate(), - year = d.getFullYear(); - - if (month.length < 2) { - month = '0' + month; - } - if (day.length < 2) { - day = '0' + day; - } - return [year, month, day].join('-'); - } - - deleteInvoice (invoiceNum) { - if (confirm('Are you sure you want to delete invoice, ' + invoiceNum)) { - this.astuteClientService.deleteInvoice(invoiceNum).then((data) => { - if (data) { - console.log('Invoice, ' + invoiceNum + ' successfully deleted'); - this.refreshData(); - } else { - alert ('Error in deleting; Invoice, ' + invoiceNum + ' has not been deleted'); - } - }); - } - } - - addInvoice(invoiceNumber, poNum, changeOrderNum, pmtStatus, billAmt, specialNotes, certification, status, ref) { - // String invoiceNumber; - // Date invoiceDate; - // String poNum; - // String changeOrderNum; - // int pmtStatus; - // Double billAmt; - // String specialNotes; - // String certification; - // Date pmtReceivedDate; - const invData = { - "invoiceNumber": invoiceNumber, - "invoiceDate": this.formatDate(new Date()), - "poNum": poNum, - "changeOrderNum": changeOrderNum, - "pmtStatus": +pmtStatus, - "billAmt": +billAmt, - "specialNotes": specialNotes, - "certification": certification, - "pmtReceivedDate": this.formatDate(new Date()), - 'invoiceStatus': status - }; - console.log(invData); - - this.astuteClientService.createInvoice(invData) - .catch((response) => { - console.log("rejected: " + response); - }) - .then((data) => { - if (data) { - this.refreshData(); - this.addInvoiceDetail(this.newInDetails); - ref.close(); - } else { - alert('Invoice Creation Failed, Check Input Fields'); - } - }); - } - - addInvoiceDetail(details) { - if (details.length) { - // console.log(details[0]); - // if (details[0].poLineItemNum !== -1) { - this.astuteClientService.createInvoiceDetail(details[0]).then((data) => { - if (data) { - details.splice(0, 1); - this.addInvoiceDetail(details); - } else { - alert('add inv detail failed'); - } - }); - // } else { - // desc - // fee - // feeTypeId - // invoiceNum - // lineItemNum - // poLineItemNum - // qty - // remainingQty - // serviceTypeId - // poNum - - // const data = { - // // 'lineItemNo': details[0]., - // 'poNum': details[0].poNum, - // 'serviceDesc': details[0].desc, - // 'feeTypeId': details[0].feeTypeId, - // 'serviceTypeId': details[0].serviceTypeId, - // 'qty': +details[0].qty, - // 'fee': +details[0].fee, - // 'remainingQty': +details[0].fee * +details[0].qty - // }; - // this.astuteClientService.createPODetail(data).then((d) => { - // if (d) { - // console.log (d); - // } else { - // alert('create custom PO failed.'); - // } - // }); - // } - } else { - this.newInDetails = []; - } - } - - editInvoice(invoiceNumber, poNum, changeOrderNum, pmtStatus, billAmt, specialNotes, certification) { - // String invoiceNumber; - // Date invoiceDate; - // String poNum; - // String changeOrderNum; - // int pmtStatus; - // Double billAmt; - // String specialNotes; - // String certification; - // Date pmtReceivedDate; - const invData = { - "invoiceNumber": invoiceNumber, - "invoiceDate": new Date(), - "poNum": poNum, - "changeOrderNum": changeOrderNum, - "pmtStatus": +pmtStatus, - "billAmt": +billAmt, - "specialNotes": specialNotes, - "certification": certification, - "pmtReceivedDate": new Date() - }; - - this.astuteClientService.updateInvoice(invoiceNumber, invData) - .catch((response) => { - console.log("rejected: " + response); - }) - .then((data) => { - if (data) { - alert("invoice " + invoiceNumber + " updated!"); - console.log("fulfilled: " + data); - // this.source[this.chosenInv] = invData; - this.refreshData(); - } else { - alert("Invoice Update Failed, Check Input Fields") - } - }); - } - - voidInvoice(invoiceNumber) { - this.astuteClientService.voidInvoice(invoiceNumber).then((data) => { - if (data) { - this.refreshData(); - } else { - alert('void invoice failed.'); - } - }); - } - - submitInvoice(invoiceNumber) { - this.astuteClientService.submitInvoice(invoiceNumber).then((data) => { - if (data) { - this.refreshData(); - } else { - alert('submit invoice failed.'); - } - }); - } - - getPerc(amt, total): number { - return Math.floor(((amt) / total) * 100); - } - - getRangeMax(total, num) { - return Math.floor(total / num); - } - - setCorrespondingPos() { - this.correspondingPos = this.pos.filter((po, index, array) => { - return po.customerId === this.chosenCustomerID; - }); - } -} +import {Component, OnInit, ViewChild} from '@angular/core'; +import {AstuteClientService} from '../services/astute-client-service'; + +declare var $: any; + +@Component({ + selector: 'app-invoice', + templateUrl: './invoice.component.html', + styleUrls: ['./invoice.component.css'] +}) +export class InvoiceComponent implements OnInit { + @ViewChild('agGrid') agGrid; + chosenCustomerID: any = 0; + chosenInv: any = 0; + source; + customers; + pos = []; + chosenPo; + correspondingPos = []; + generatedInvoiceNumber = ''; + feeTypes = ['Fixed Fee', 'Hourly']; + serviceTypes = ['Study', 'Design', 'Peer Review', 'Cost Investigation', 'Forensic Investigation']; + columnDefs = [ + {headerName: 'Invoice Number', field: 'invoiceNumber'}, + {headerName: 'Date', field: 'invoiceDate'}, + {headerName: 'Sales Order Number', field: 'poNum'}, + {headerName: 'Change Order Number', field: 'changeOrderNum'}, + {headerName: 'Paid', field: 'pmtStatus'}, + {headerName: 'Bll Amount', field: 'billAmt'} + ]; + newInDetails = []; + newBillAmt = 0; + selectedInDetails = []; + selectedPO; + selectedBillAmt = 0; + poDetails = []; + selectedPODetails = []; + + gridOptions = { + + // PROPERTIES - object properties, myRowData and myColDefs are created somewhere in your application + rowData: this.source, + columnDefs: this.columnDefs, + + // PROPERTIES - simple boolean / string / number properties + enableColResize: true, + rowSelection: 'single', + + // EVENTS - add event callback handlers + onRowClicked: (event) => { + this.getSelectedRows() + }, + onColumnResized: function (event) { + console.log('a column was resized'); + }, + onGridReady: (event) => { + }, + // this.agGrid.sizeColumnsToFit(); + // 1: draft + // 2: submitted + // 3: void + + // getRowStyle: function(params) { + // if (params.data.invoiceStatus === 1) { + // return { 'color': 'red' } + // } else if (params.data.invoiceStatus === 3) { + // return { 'text-decoration': 'line-through'} + // } + // } + + rowClassRules: { + // apply green to 2008 + // 'bg-red': true, + + // apply amber 2004 + 'text-danger': function (params) { + return params.data.invoiceStatus === 1; + }, + 'text-primary': function (params) { + return params.data.invoiceStatus === 2; + }, + 'text-warning': function (params) { + return params.data.invoiceStatus === 3; + }, + + // apply red to 2000 + // 'rag-red-outer': function(params) { return params.data.year === 2000} + } + } + + constructor(protected astuteClientService: AstuteClientService) { + } + + customerDropdownChange(index) { + this.chosenCustomerID = this.customers[index].customerId; + this.setCorrespondingPos(); + } + + poDropdownChange(ponum) { + this.pos.forEach((po) => { + if (po.ponum === ponum) { + this.chosenPo = po; + } + }) + this.astuteClientService.getPODetail(ponum).then((data) => { + if (data) { + // fee + // feeTypeId + // lineItemNo + // ponum + // qty + // remainingQty + // serviceDesc + // serviceTypeId + + // lineItemNo, feeTypeId, serviceTypeId, serviceDesc, fee, remainingQty + this.poDetails = data; + this.poDetails[-1] = { + 'lineItemNo': -1, + 'feeTypeId': 1, + 'serviceTypeId': 1, + 'serviceDesc': 'Out of Pocket Expenses', + 'fee': 0, + 'remainingQty': 0 + }; + } else { + alert("get PO detail failed!"); + } + }); + this.astuteClientService.generateInvoiceNumber(ponum).then((data) => { + if (data) { + this.generatedInvoiceNumber = data; + } else { + alert('gen inv num failed!'); + } + }); + } + + ngOnInit() { + this.refreshData(); + } + + refreshData() { + this.astuteClientService.getInvoices().then((data) => { + this.source = data; + }); + + this.astuteClientService.getCustomers().then((data) => { + this.customers = data; + }); + + this.astuteClientService.getPOs().then((data) => { + this.pos = data; + }); + } + + getPODetails(poIndex) { + let ponum = this.pos[poIndex].ponum; + this.astuteClientService.getPODetail(ponum).then((data) => { + this.selectedInDetails = data; + console.log("inDetails:"); + console.log(this.selectedInDetails); + }); + } + + onSelectedCellChange(row: number, col: string, value) { + this.selectedInDetails[row][col] = value; + console.log(this.selectedInDetails); + } + + onNewCellChange(row: number, col: string, value) { + this.newInDetails[row][col] = value; + console.log(this.newInDetails); + } + + pushOntoSelectedDetail(invoiceNum, lineItemNum, poLineItemNum, serviceTypeId, desc, qty, fee) { + this.selectedInDetails.push({ + 'invoiceNum': invoiceNum, + 'lineItemNum': lineItemNum, + 'poLineItemNum': poLineItemNum, + 'serviceTypeId': serviceTypeId, + 'desc': desc, + 'qty': +qty, + 'fee': +fee + }); + } + + pushOntoNewDetail(invoiceNum, lineItemNum, poLineItemNum, feeTypeId, serviceTypeId, desc, qty, fee, remainingQty, poNum) { + this.newInDetails.push({ + 'invoiceNum': invoiceNum, + 'lineItemNum': lineItemNum, + 'poLineItemNum': poLineItemNum, + 'feeTypeId': feeTypeId, + 'serviceTypeId': serviceTypeId, + 'desc': desc, + 'qty': +qty, + 'fee': +fee, + 'remainingQty': +remainingQty, + 'poNum': poNum + }); + console.log(this.newInDetails); + } + + updateNewBillAmt() { + let tot = 0; + this.newInDetails.forEach((d) => { + tot += +d.qty * +d.fee; + }); + this.newBillAmt = tot; + } + + updateSelectedBillAmt() { + let tot = 0; + this.selectedInDetails.forEach((d) => { + tot += +d.qty * +d.fee; + }); + this.selectedBillAmt = tot; + } + + + assignActity(): void { + window.open('/invoice-gen'); + } + + getSelectedRows() { + const selectedNodes = this.agGrid.api.getSelectedNodes(); + if (selectedNodes.length) { + this.chosenInv = selectedNodes.map(node => node.data)[0]; + // console.log (this.chosenInv); + this.selectedBillAmt = +this.chosenInv.billAmt; + this.astuteClientService.getPODetail(this.chosenInv.poNum).then((poDetails) => { + if (poDetails) { + this.selectedPODetails = poDetails; + this.astuteClientService.getInvoiceDetail(this.chosenInv.invoiceNumber).then((invoiceDetails) => { + if (invoiceDetails) { + this.selectedInDetails = invoiceDetails; + this.selectedInDetails.forEach((invDetail) => { + const tempPo = this.selectedPODetails.filter((po) => { + // console.log (po.lineItemNo + " and " + invDetail.poLineItemNum); + return po.lineItemNo === invDetail.poLineItemNum; + })[0]; + if (tempPo) { + invDetail.remainingQty = tempPo.remainingQty; + } + }); + } else { + alert("get Inv detail failed!"); + } + }); + } else { + alert("get PO detail failed!") + } + }); + this.pos.forEach((po) => { + if (po.ponum === this.chosenInv.poNum) { + this.selectedPO = po; + } + }); + } else { + this.chosenInv = null; + this.selectedPODetails = []; + } + } + + open(content, indexPO, indexINV) { + content.open(); + // this.detailDescription = ViewChild('detailDescription'); + // this.detailAmount = ViewChild('detailAmount'); + // this.detailRate = ViewChild('detailRate'); + // this.detailTotal = ViewChild('detailTotal'); + // if (indexINV) { + // this.chosenInv = indexINV; + // } + // if (indexPO) { + // this.chosenPo = indexPO; + // this.getPODetails(this.chosenPo); + // } + // this.modalService.open(content, { size: 'lg' }).result.then((result) => { + // this.closeResult = `Closed with: ${result}`; + // }, (reason) => { + // this.closeResult = `Dismissed ${this.getDismissReason(reason)}`; + // }); + } + + close(content) { + content.close(); + } + + getCurrDate() { + let d = new Date(), + month = '' + (d.getMonth() + 1), + day = '' + d.getDate(), + year = d.getFullYear(); + + if (month.length < 2) month = '0' + month; + if (day.length < 2) day = '0' + day; + + + return [year, month, day].join('-'); + } + + formatDate(d: Date) { + let month = '' + (d.getMonth() + 1), + day = '' + d.getDate(), + year = d.getFullYear(); + + if (month.length < 2) { + month = '0' + month; + } + if (day.length < 2) { + day = '0' + day; + } + return [year, month, day].join('-'); + } + + deleteInvoice (invoiceNum) { + if (confirm('Are you sure you want to delete invoice, ' + invoiceNum)) { + this.astuteClientService.deleteInvoice(invoiceNum).then((data) => { + if (data) { + console.log('Invoice, ' + invoiceNum + ' successfully deleted'); + this.refreshData(); + } else { + alert ('Error in deleting; Invoice, ' + invoiceNum + ' has not been deleted'); + } + }); + } + } + + addInvoice(invoiceNumber, poNum, changeOrderNum, pmtStatus, billAmt, specialNotes, certification, status, ref) { + // String invoiceNumber; + // Date invoiceDate; + // String poNum; + // String changeOrderNum; + // int pmtStatus; + // Double billAmt; + // String specialNotes; + // String certification; + // Date pmtReceivedDate; + const invData = { + "invoiceNumber": invoiceNumber, + "invoiceDate": this.formatDate(new Date()), + "poNum": poNum, + "changeOrderNum": changeOrderNum, + "pmtStatus": +pmtStatus, + "billAmt": +billAmt, + "specialNotes": specialNotes, + "certification": certification, + "pmtReceivedDate": this.formatDate(new Date()), + 'invoiceStatus': status + }; + console.log(invData); + + this.astuteClientService.createInvoice(invData) + .catch((response) => { + console.log("rejected: " + response); + }) + .then((data) => { + if (data) { + this.refreshData(); + this.addInvoiceDetail(this.newInDetails); + ref.close(); + } else { + alert('Invoice Creation Failed, Check Input Fields'); + } + }); + } + + addInvoiceDetail(details) { + if (details.length) { + // console.log(details[0]); + // if (details[0].poLineItemNum !== -1) { + this.astuteClientService.createInvoiceDetail(details[0]).then((data) => { + if (data) { + details.splice(0, 1); + this.addInvoiceDetail(details); + } else { + alert('add inv detail failed'); + } + }); + // } else { + // desc + // fee + // feeTypeId + // invoiceNum + // lineItemNum + // poLineItemNum + // qty + // remainingQty + // serviceTypeId + // poNum + + // const data = { + // // 'lineItemNo': details[0]., + // 'poNum': details[0].poNum, + // 'serviceDesc': details[0].desc, + // 'feeTypeId': details[0].feeTypeId, + // 'serviceTypeId': details[0].serviceTypeId, + // 'qty': +details[0].qty, + // 'fee': +details[0].fee, + // 'remainingQty': +details[0].fee * +details[0].qty + // }; + // this.astuteClientService.createPODetail(data).then((d) => { + // if (d) { + // console.log (d); + // } else { + // alert('create custom PO failed.'); + // } + // }); + // } + } else { + this.newInDetails = []; + } + } + + editInvoice(invoiceNumber, poNum, changeOrderNum, pmtStatus, billAmt, specialNotes, certification) { + // String invoiceNumber; + // Date invoiceDate; + // String poNum; + // String changeOrderNum; + // int pmtStatus; + // Double billAmt; + // String specialNotes; + // String certification; + // Date pmtReceivedDate; + const invData = { + "invoiceNumber": invoiceNumber, + "invoiceDate": new Date(), + "poNum": poNum, + "changeOrderNum": changeOrderNum, + "pmtStatus": +pmtStatus, + "billAmt": +billAmt, + "specialNotes": specialNotes, + "certification": certification, + "pmtReceivedDate": new Date() + }; + + this.astuteClientService.updateInvoice(invoiceNumber, invData) + .catch((response) => { + console.log("rejected: " + response); + }) + .then((data) => { + if (data) { + alert("invoice " + invoiceNumber + " updated!"); + console.log("fulfilled: " + data); + // this.source[this.chosenInv] = invData; + this.refreshData(); + } else { + alert("Invoice Update Failed, Check Input Fields") + } + }); + } + + voidInvoice(invoiceNumber) { + this.astuteClientService.voidInvoice(invoiceNumber).then((data) => { + if (data) { + this.refreshData(); + } else { + alert('void invoice failed.'); + } + }); + } + + submitInvoice(invoiceNumber) { + this.astuteClientService.submitInvoice(invoiceNumber).then((data) => { + if (data) { + this.refreshData(); + } else { + alert('submit invoice failed.'); + } + }); + } + + getPerc(amt, total): number { + return Math.floor(((amt) / total) * 100); + } + + getRangeMax(total, num) { + return Math.floor(total / num); + } + + setCorrespondingPos() { + this.correspondingPos = this.pos.filter((po, index, array) => { + return po.customerId === this.chosenCustomerID; + }); + } +} diff --git a/AstuteClient2/src/app/modal-form/modal-form.component.html b/AstuteClient2/src/app/modal-form/modal-form.component.html index 35961fe..b77adbf 100644 --- a/AstuteClient2/src/app/modal-form/modal-form.component.html +++ b/AstuteClient2/src/app/modal-form/modal-form.component.html @@ -1,12 +1,12 @@ - - - - - - - + + + + + + + diff --git a/AstuteClient2/src/app/modal-form/modal-form.component.spec.ts b/AstuteClient2/src/app/modal-form/modal-form.component.spec.ts index b4c9402..529b904 100644 --- a/AstuteClient2/src/app/modal-form/modal-form.component.spec.ts +++ b/AstuteClient2/src/app/modal-form/modal-form.component.spec.ts @@ -1,25 +1,25 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { ModalFormComponent } from './modal-form.component'; - -describe('ModalFormComponent', () => { - let component: ModalFormComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ModalFormComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ModalFormComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ModalFormComponent } from './modal-form.component'; + +describe('ModalFormComponent', () => { + let component: ModalFormComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ModalFormComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ModalFormComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/AstuteClient2/src/app/modal-form/modal-form.component.ts b/AstuteClient2/src/app/modal-form/modal-form.component.ts index b6d78c2..b865949 100644 --- a/AstuteClient2/src/app/modal-form/modal-form.component.ts +++ b/AstuteClient2/src/app/modal-form/modal-form.component.ts @@ -1,40 +1,40 @@ -import {Component, Input, OnInit, ViewChild} from '@angular/core'; -import {NgbModal, ModalDismissReasons, NgbActiveModal} from '@ng-bootstrap/ng-bootstrap'; - -@Component({ - selector: 'app-modal-form', - templateUrl: './modal-form.component.html', - styleUrls: ['./modal-form.component.css'] -}) -export class ModalFormComponent implements OnInit { - closeResult: string; - @Input() title: string; - @ViewChild('content') content; - activeModal; - constructor(private modalService: NgbModal) {} - - ngOnInit() { - } - - open() { - this.activeModal = this.modalService.open(this.content, { size: 'lg' }); - this.activeModal.result.then((result) => { - this.closeResult = `Closed with: ${result}`; - }, (reason) => { - this.closeResult = `Dismissed ${this.getDismissReason(reason)}`; - }); - } - close () { - this.activeModal.close(); - } - - private getDismissReason(reason: any): string { - if (reason === ModalDismissReasons.ESC) { - return 'by pressing ESC'; - } else if (reason === ModalDismissReasons.BACKDROP_CLICK) { - return 'by clicking on a backdrop'; - } else { - return `with: ${reason}`; - } - } -} +import {Component, Input, OnInit, ViewChild} from '@angular/core'; +import {NgbModal, ModalDismissReasons, NgbActiveModal} from '@ng-bootstrap/ng-bootstrap'; + +@Component({ + selector: 'app-modal-form', + templateUrl: './modal-form.component.html', + styleUrls: ['./modal-form.component.css'] +}) +export class ModalFormComponent implements OnInit { + closeResult: string; + @Input() title: string; + @ViewChild('content') content; + activeModal; + constructor(private modalService: NgbModal) {} + + ngOnInit() { + } + + open() { + this.activeModal = this.modalService.open(this.content, { size: 'lg' }); + this.activeModal.result.then((result) => { + this.closeResult = `Closed with: ${result}`; + }, (reason) => { + this.closeResult = `Dismissed ${this.getDismissReason(reason)}`; + }); + } + close () { + this.activeModal.close(); + } + + private getDismissReason(reason: any): string { + if (reason === ModalDismissReasons.ESC) { + return 'by pressing ESC'; + } else if (reason === ModalDismissReasons.BACKDROP_CLICK) { + return 'by clicking on a backdrop'; + } else { + return `with: ${reason}`; + } + } +} diff --git a/AstuteClient2/src/app/nav-bar/nav-bar.component.html b/AstuteClient2/src/app/nav-bar/nav-bar.component.html index 855ad2b..42b86e1 100644 --- a/AstuteClient2/src/app/nav-bar/nav-bar.component.html +++ b/AstuteClient2/src/app/nav-bar/nav-bar.component.html @@ -1,33 +1,34 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/AstuteClient2/src/app/nav-bar/nav-bar.component.spec.ts b/AstuteClient2/src/app/nav-bar/nav-bar.component.spec.ts index 0d21a39..371b818 100644 --- a/AstuteClient2/src/app/nav-bar/nav-bar.component.spec.ts +++ b/AstuteClient2/src/app/nav-bar/nav-bar.component.spec.ts @@ -1,25 +1,25 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { NavBarComponent } from './nav-bar.component'; - -describe('NavBarComponent', () => { - let component: NavBarComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ NavBarComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(NavBarComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { NavBarComponent } from './nav-bar.component'; + +describe('NavBarComponent', () => { + let component: NavBarComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ NavBarComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(NavBarComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/AstuteClient2/src/app/nav-bar/nav-bar.component.ts b/AstuteClient2/src/app/nav-bar/nav-bar.component.ts index b11a39f..cf97637 100644 --- a/AstuteClient2/src/app/nav-bar/nav-bar.component.ts +++ b/AstuteClient2/src/app/nav-bar/nav-bar.component.ts @@ -1,18 +1,19 @@ -import {Component, Input, OnInit} from '@angular/core'; - -@Component({ - selector: 'app-nav-bar', - templateUrl: './nav-bar.component.html', - styleUrls: ['./nav-bar.component.css'] -}) -export class NavBarComponent implements OnInit { - @Input() customerActive: boolean; - @Input() salesOrderActive: boolean; - @Input() invoiceActive: boolean; - - constructor() { } - - ngOnInit() { - } - -} +import {Component, Input, OnInit} from '@angular/core'; + +@Component({ + selector: 'app-nav-bar', + templateUrl: './nav-bar.component.html', + styleUrls: ['./nav-bar.component.css'] +}) +export class NavBarComponent implements OnInit { + @Input() customerActive: boolean; + @Input() salesOrderActive: boolean; + @Input() invoiceActive: boolean; + @Input() invoicePaymentActive: boolean; + + constructor() { } + + ngOnInit() { + } + +} diff --git a/AstuteClient2/src/app/sales-order/sales-order.component.html b/AstuteClient2/src/app/sales-order/sales-order.component.html index 5ee7809..4f313ef 100644 --- a/AstuteClient2/src/app/sales-order/sales-order.component.html +++ b/AstuteClient2/src/app/sales-order/sales-order.component.html @@ -1,382 +1,382 @@ - -

Sales Orders

-
-
-
- -
-
-
-
- -
-
- -
-
-
- - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -
-
- - - -
-
+ +

Sales Orders

+
+
+
+ +
+
+
+
+ +
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+
+ + + +
+
diff --git a/AstuteClient2/src/app/sales-order/sales-order.component.spec.ts b/AstuteClient2/src/app/sales-order/sales-order.component.spec.ts index 2ec78b5..067a190 100644 --- a/AstuteClient2/src/app/sales-order/sales-order.component.spec.ts +++ b/AstuteClient2/src/app/sales-order/sales-order.component.spec.ts @@ -1,25 +1,25 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { SalesOrderComponent } from './sales-order.component'; - -describe('SalesOrderComponent', () => { - let component: SalesOrderComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ SalesOrderComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(SalesOrderComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SalesOrderComponent } from './sales-order.component'; + +describe('SalesOrderComponent', () => { + let component: SalesOrderComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SalesOrderComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SalesOrderComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/AstuteClient2/src/app/sales-order/sales-order.component.ts b/AstuteClient2/src/app/sales-order/sales-order.component.ts index 3fda1fd..4b026ba 100644 --- a/AstuteClient2/src/app/sales-order/sales-order.component.ts +++ b/AstuteClient2/src/app/sales-order/sales-order.component.ts @@ -1,261 +1,261 @@ -import {Component, OnInit, ViewChild} from '@angular/core'; -import {AstuteClientService} from '../services/astute-client-service'; - -@Component({ - selector: 'app-sales-order', - templateUrl: './sales-order.component.html', - styleUrls: ['./sales-order.component.css'] -}) -export class SalesOrderComponent implements OnInit { - @ViewChild('agGrid') agGrid; - selected = null; - selectedPODetail = []; - newPODetail = []; - newContractAmount = 0; - editContractAmount = 0; - customers; - pos; - serviceTypes; - columnDefs = [ - {headerName: 'Project Number', field: 'astuteProjectNumber'}, - {headerName: 'SO Number', field: 'ponum'}, - // {headerName: 'Customer ID', field: 'customerId'}, - {headerName: 'Customer Name', field: 'customerName'}, - {headerName: 'Contract Number', field: 'contractNum'}, - {headerName: 'SO Title', field: 'title'}, - {headerName: 'Contract Amount', field: 'contractAmt'}, - {headerName: 'SO Date', field: 'podate'}, - {headerName: '# of Invoice', field: 'invoiceSequence'} - ]; - rowData: any; - - constructor(private astuteClientService: AstuteClientService) { - } - - ngOnInit() { - this.refreshData(); - this.astuteClientService.getServiceTypes().then((d) => { - if (d) { - this.serviceTypes = d; - } else { - alert ('get service types failed'); - } - }) - } - - printValue(val) { - console.log(val); - } - - addPo(projNum, ponum, podate, customerid, contractnum, contractamt, title, ref) { - const poData = { - "astuteProjectNumber": projNum, - "poNum": ponum, - "podate": podate, - "customerId": customerid, - "contractNum": contractnum, - "contractAmt": contractamt, - "title": title, - } - console.log(poData); - this.astuteClientService.createPO(poData).then((data) => { - if (data) { - this.refreshData(); - this.addPODetail(this.newPODetail); - ref.close(); - } else { - alert("PO Creation failed, check input fields"); - } - }, (reason) => { - alert("add po failed for " + reason); - }); - } - - addPODetail(details) { - if (details.length) { - console.log(details[0]); - this.astuteClientService.createPODetail(details[0]).then((data) => { - if (data) { - details.splice(0, 1); - this.addPODetail(details); - } else { - alert("add detail failed"); - } - }); - } else { - this.newPODetail = []; - } - } - - editPo(projNum, ponum, podate, contractnum, contractamt, title, ref) { - const poData = { - "astuteProjectNumber": projNum, - "poNum": ponum, - "podate": podate, - "contractNum": contractnum, - "contractAmt": contractamt, - "title": title, - } - console.log(poData); - this.astuteClientService.updatePO(ponum, poData).then((data) => { - if (data) { - this.refreshData(); - this.editPODetail(this.selectedPODetail); - ref.close(); - } else { - alert("PO updating failed, check input fields"); - } - }, (reason) => { - alert("update po failed for " + reason); - }); - } - - editPODetail(details) { - if (details.length) { - console.log(details[0]); - this.astuteClientService.updatePODetail(details[0].ponum, details[0].lineItemNo, details[0]).then((data) => { - if (data) { - details.splice(0, 1); - this.editPODetail(details); - } else { - alert("add detail failed") - } - }); - } else { - this.newPODetail = []; - } - } - - pushOntoSelectedDetail(lineItemNo: number, ponum, serviceDesc, feeTypeId, serviceTypeId, qty, fee, remainingQty) { - this.selectedPODetail.push({ - 'lineItemNo': lineItemNo, - 'ponum': ponum, - 'serviceDesc': serviceDesc, - 'feeTypeId': feeTypeId, - 'serviceTypeId': serviceTypeId, - 'qty': qty, - 'fee': fee, - 'remainingQty': remainingQty - }); - } - - pushOntoNewDetail(lineItemNo: number, ponum, serviceDesc, feeTypeId, serviceTypeId, qty, fee, remainingQty) { - this.newPODetail.push({ - 'lineItemNo': lineItemNo, - 'poNum': ponum, - 'serviceDesc': serviceDesc, - 'feeTypeId': feeTypeId, - 'serviceTypeId': serviceTypeId, - 'qty': qty, - 'fee': fee, - 'remainingQty': remainingQty - }); - } - - updateNewContractAmt() { - let tot = 0; - this.newPODetail.forEach((d) => { - tot += +d.qty * +d.fee; - }); - this.newContractAmount = tot; - } - - updateEditContractAmt() { - let tot = 0; - this.selectedPODetail.forEach((d) => { - tot += +d.qty * +d.fee; - }); - this.editContractAmount = tot; - } - - open(ref) { - this.getSelectedRows(); - ref.open(); - } - - close(ref) { - this.newPODetail = []; - this.selectedPODetail = []; - - ref.close(); - } - - onSelectedCellChange(row: number, col: string, value) { - this.selectedPODetail[row][col] = value; - console.log(this.selectedPODetail); - } - - onNewCellChange(row: number, col: string, value) { - this.newPODetail[row][col] = value; - console.log(this.newPODetail); - } - - getCurrDate() { - const d = new Date(); - return this.formatDate(d); - } - - formatDate(d: Date) { - let month = '' + (d.getMonth() + 1), - day = '' + d.getDate(), - year = d.getFullYear(); - - if (month.length < 2) { - month = '0' + month; - } - if (day.length < 2) { - day = '0' + day; - } - return [year, month, day].join('-'); - } - - getSelectedRows() { - const selectedNodes = this.agGrid.api.getSelectedNodes(); - if (selectedNodes.length) { - this.selected = selectedNodes.map(node => node.data)[0]; - this.editContractAmount = +this.selected.contractAmt; - this.astuteClientService.getPODetail(this.selected.ponum).then((data) => { - if (data) { - this.selectedPODetail = data; - console.log(this.selectedPODetail); - } else { - alert("get PO detail failed!") - } - }); - } else { - this.selected = null; - this.selectedPODetail = []; - } - } - - refreshData() { - this.astuteClientService.getCustomers().then((customers) => { - if (customers) { - this.customers = customers; - this.astuteClientService.getPOs().then((data) => { - if (data) { - this.pos = data; - this.rowData = data; - this.rowData.forEach((row) => { - row.customerName = this.getCustomerName(row.customerId); - }); - } - }); - } else { - alert("get Customers Failed!"); - } - }); - // this.rowData = this.astuteClientService.getPOs(); - - } - - getCustomerName(customerId) { - let name = ""; - this.customers.forEach((customer) => { - if (customer.customerId === customerId) { - name = customer.customerName; - } - }); - return name; - } -} +import {Component, OnInit, ViewChild} from '@angular/core'; +import {AstuteClientService} from '../services/astute-client-service'; + +@Component({ + selector: 'app-sales-order', + templateUrl: './sales-order.component.html', + styleUrls: ['./sales-order.component.css'] +}) +export class SalesOrderComponent implements OnInit { + @ViewChild('agGrid') agGrid; + selected = null; + selectedPODetail = []; + newPODetail = []; + newContractAmount = 0; + editContractAmount = 0; + customers; + pos; + serviceTypes; + columnDefs = [ + {headerName: 'Project Number', field: 'astuteProjectNumber'}, + {headerName: 'SO Number', field: 'ponum'}, + // {headerName: 'Customer ID', field: 'customerId'}, + {headerName: 'Customer Name', field: 'customerName'}, + {headerName: 'Contract Number', field: 'contractNum'}, + {headerName: 'SO Title', field: 'title'}, + {headerName: 'Contract Amount', field: 'contractAmt'}, + {headerName: 'SO Date', field: 'podate'}, + {headerName: '# of Invoice', field: 'invoiceSequence'} + ]; + rowData: any; + + constructor(private astuteClientService: AstuteClientService) { + } + + ngOnInit() { + this.refreshData(); + this.astuteClientService.getServiceTypes().then((d) => { + if (d) { + this.serviceTypes = d; + } else { + alert ('get service types failed'); + } + }) + } + + printValue(val) { + console.log(val); + } + + addPo(projNum, ponum, podate, customerid, contractnum, contractamt, title, ref) { + const poData = { + "astuteProjectNumber": projNum, + "poNum": ponum, + "podate": podate, + "customerId": customerid, + "contractNum": contractnum, + "contractAmt": contractamt, + "title": title, + } + console.log(poData); + this.astuteClientService.createPO(poData).then((data) => { + if (data) { + this.refreshData(); + this.addPODetail(this.newPODetail); + ref.close(); + } else { + alert("PO Creation failed, check input fields"); + } + }, (reason) => { + alert("add po failed for " + reason); + }); + } + + addPODetail(details) { + if (details.length) { + console.log(details[0]); + this.astuteClientService.createPODetail(details[0]).then((data) => { + if (data) { + details.splice(0, 1); + this.addPODetail(details); + } else { + alert("add detail failed"); + } + }); + } else { + this.newPODetail = []; + } + } + + editPo(projNum, ponum, podate, contractnum, contractamt, title, ref) { + const poData = { + "astuteProjectNumber": projNum, + "poNum": ponum, + "podate": podate, + "contractNum": contractnum, + "contractAmt": contractamt, + "title": title, + } + console.log(poData); + this.astuteClientService.updatePO(ponum, poData).then((data) => { + if (data) { + this.refreshData(); + this.editPODetail(this.selectedPODetail); + ref.close(); + } else { + alert("PO updating failed, check input fields"); + } + }, (reason) => { + alert("update po failed for " + reason); + }); + } + + editPODetail(details) { + if (details.length) { + console.log(details[0]); + this.astuteClientService.updatePODetail(details[0].ponum, details[0].lineItemNo, details[0]).then((data) => { + if (data) { + details.splice(0, 1); + this.editPODetail(details); + } else { + alert("add detail failed") + } + }); + } else { + this.newPODetail = []; + } + } + + pushOntoSelectedDetail(lineItemNo: number, ponum, serviceDesc, feeTypeId, serviceTypeId, qty, fee, remainingQty) { + this.selectedPODetail.push({ + 'lineItemNo': lineItemNo, + 'ponum': ponum, + 'serviceDesc': serviceDesc, + 'feeTypeId': feeTypeId, + 'serviceTypeId': serviceTypeId, + 'qty': qty, + 'fee': fee, + 'remainingQty': remainingQty + }); + } + + pushOntoNewDetail(lineItemNo: number, ponum, serviceDesc, feeTypeId, serviceTypeId, qty, fee, remainingQty) { + this.newPODetail.push({ + 'lineItemNo': lineItemNo, + 'poNum': ponum, + 'serviceDesc': serviceDesc, + 'feeTypeId': feeTypeId, + 'serviceTypeId': serviceTypeId, + 'qty': qty, + 'fee': fee, + 'remainingQty': remainingQty + }); + } + + updateNewContractAmt() { + let tot = 0; + this.newPODetail.forEach((d) => { + tot += +d.qty * +d.fee; + }); + this.newContractAmount = tot; + } + + updateEditContractAmt() { + let tot = 0; + this.selectedPODetail.forEach((d) => { + tot += +d.qty * +d.fee; + }); + this.editContractAmount = tot; + } + + open(ref) { + this.getSelectedRows(); + ref.open(); + } + + close(ref) { + this.newPODetail = []; + this.selectedPODetail = []; + + ref.close(); + } + + onSelectedCellChange(row: number, col: string, value) { + this.selectedPODetail[row][col] = value; + console.log(this.selectedPODetail); + } + + onNewCellChange(row: number, col: string, value) { + this.newPODetail[row][col] = value; + console.log(this.newPODetail); + } + + getCurrDate() { + const d = new Date(); + return this.formatDate(d); + } + + formatDate(d: Date) { + let month = '' + (d.getMonth() + 1), + day = '' + d.getDate(), + year = d.getFullYear(); + + if (month.length < 2) { + month = '0' + month; + } + if (day.length < 2) { + day = '0' + day; + } + return [year, month, day].join('-'); + } + + getSelectedRows() { + const selectedNodes = this.agGrid.api.getSelectedNodes(); + if (selectedNodes.length) { + this.selected = selectedNodes.map(node => node.data)[0]; + this.editContractAmount = +this.selected.contractAmt; + this.astuteClientService.getPODetail(this.selected.ponum).then((data) => { + if (data) { + this.selectedPODetail = data; + console.log(this.selectedPODetail); + } else { + alert("get PO detail failed!") + } + }); + } else { + this.selected = null; + this.selectedPODetail = []; + } + } + + refreshData() { + this.astuteClientService.getCustomers().then((customers) => { + if (customers) { + this.customers = customers; + this.astuteClientService.getPOs().then((data) => { + if (data) { + this.pos = data; + this.rowData = data; + this.rowData.forEach((row) => { + row.customerName = this.getCustomerName(row.customerId); + }); + } + }); + } else { + alert("get Customers Failed!"); + } + }); + // this.rowData = this.astuteClientService.getPOs(); + + } + + getCustomerName(customerId) { + let name = ""; + this.customers.forEach((customer) => { + if (customer.customerId === customerId) { + name = customer.customerName; + } + }); + return name; + } +}