mirror of
https://github.com/dyiop/astute.git
synced 2025-04-08 14:20:20 -04:00
Add files via upload
This commit is contained in:
parent
b7d7dc48c8
commit
c02f0192eb
AstuteClient2/src/app
app-box
customer
homepage
invoice-gen
invoice-gen.component.cssinvoice-gen.component.htmlinvoice-gen.component.spec.tsinvoice-gen.component.ts
invoice
modal-form
nav-bar
sales-order
|
@ -1,38 +1,38 @@
|
|||
<!--<div class="card card-stats box">-->
|
||||
<!--<div class="card-header card-header-icon" style="text-align: left">-->
|
||||
<!--<div class="card-icon" [style.background-color]="color">-->
|
||||
<!--<i class="material-icons">{{symbol}}</i>-->
|
||||
<!--</div>-->
|
||||
<!--<h3 class="card-title">{{name}}</h3>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="card-footer">-->
|
||||
<!--<div class="stats">-->
|
||||
<!---->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
|
||||
<div class="card box text-light" [style.background-color]="color">
|
||||
<div class="card-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-2 text-left">
|
||||
<i class="material-icons">{{symbol}}</i>
|
||||
</div>
|
||||
<div class="col-10 text-right">
|
||||
<h5 class="card-title">{{name}}</h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<ng-content></ng-content>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--<h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>-->
|
||||
</div>
|
||||
</div>
|
||||
<!--<div class="card card-stats box">-->
|
||||
<!--<div class="card-header card-header-icon" style="text-align: left">-->
|
||||
<!--<div class="card-icon" [style.background-color]="color">-->
|
||||
<!--<i class="material-icons">{{symbol}}</i>-->
|
||||
<!--</div>-->
|
||||
<!--<h3 class="card-title">{{name}}</h3>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="card-footer">-->
|
||||
<!--<div class="stats">-->
|
||||
<!---->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
|
||||
<div class="card box text-light" [style.background-color]="color">
|
||||
<div class="card-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-2 text-left">
|
||||
<i class="material-icons">{{symbol}}</i>
|
||||
</div>
|
||||
<div class="col-10 text-right">
|
||||
<h5 class="card-title">{{name}}</h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<ng-content></ng-content>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--<h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>-->
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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<AppBoxComponent>;
|
||||
|
||||
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<AppBoxComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AppBoxComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AppBoxComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -1,271 +1,271 @@
|
|||
<app-nav-bar [customerActive]="true"></app-nav-bar>
|
||||
<h1 align="center">Customers</h1>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<ag-grid-angular
|
||||
#agGrid
|
||||
style="height: 500px;"
|
||||
class="ag-theme-balham"
|
||||
[enableSorting]="true"
|
||||
[enableFilter]="true"
|
||||
[rowData]="rowData | async"
|
||||
[columnDefs]="columnDefs"
|
||||
rowSelection="single"
|
||||
></ag-grid-angular>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-center mt-2">
|
||||
<div class="col-6">
|
||||
<button class="btn btn-primary" style="width: 100%" (click)="open(edit)">Edit Customer</button>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<button class="btn btn-success" style="width: 100%" (click)="open(new)">Add Customer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--MODAL: new customer-->
|
||||
<app-modal-form [title]="'New Customer'" #new>
|
||||
<div class="modal-body">
|
||||
<table class="table table-borderless table-sm">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 10%">
|
||||
<span class="input-group-text">ID*</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="text" class="form-control" placeholder="johndoe" #inId>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 10%">
|
||||
<span class="input-group-text">Name*</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="text" class="form-control" placeholder="John Doe" #inName>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 10%">
|
||||
<span class="input-group-text">Bill To Dept*</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="text" class="form-control" placeholder="Billing" #inBillToDept>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 10%">
|
||||
<span class="input-group-text">Address 1*</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="text" class="form-control" placeholder="13254 John Doe Rd." #inAdd1>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">Address 2</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="text" class="form-control" placeholder="Apt #, Unit, etc..." [value]="''" #inAdd2>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">City*</span>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" class="form-control" placeholder="New York City" #inCity>
|
||||
</td>
|
||||
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">State*</span>
|
||||
</td>
|
||||
<td>
|
||||
<select class="custom-select" #inState>
|
||||
<option selected>Choose...</option>
|
||||
<option *ngFor="let state of states" [value]="state">{{state}}</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">ZIP*(+4)</span>
|
||||
</td>
|
||||
<td style="width: 25%">
|
||||
<div class="input-group">
|
||||
<input type="number" class="form-control" placeholder="12345" #inZIP>
|
||||
<input type="number" class="form-control" placeholder="(+4)" #inZIP4>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">Email*</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="email" class="form-control" placeholder="john@doe.com" #inEmail>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">Phone*</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="tel" class="form-control" placeholder="(123) 456-7890" [textMask]="{mask: usPhoneMask, guide: false}" #inPhone>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">Fax</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="tel" class="form-control" placeholder="(123) 456-7890" [value]="''" [textMask]="{mask: usPhoneMask, guide: false}" #inFax>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<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)"
|
||||
(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 type="button" class="btn btn-danger" (click)="close(new)">Cancel</button>
|
||||
</div>
|
||||
</app-modal-form>
|
||||
|
||||
<!--MODAL: edit customer-->
|
||||
<app-modal-form [title]="'Editing'" #edit>
|
||||
<div *ngIf="selected">
|
||||
<div class="modal-body">
|
||||
<table class="table table-borderless table-sm">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 10%">
|
||||
<span class="input-group-text">Name*</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="text" class="form-control" #inName placeholder="John Doe" [value]="selected.customerName">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 10%">
|
||||
<span class="input-group-text">Bill To Dept*</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="text" class="form-control" placeholder="Billing" #inBillToDept [value]="selected.billToDept">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 10%">
|
||||
<span class="input-group-text">Address 1*</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="text" class="form-control" placeholder="13254 John Doe Rd." #inAdd1 [value]="selected.add1">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">Address 2</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="text" class="form-control" placeholder="Apt#, Unit, etc." #inAdd2 [value]="selected.add2">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">City*</span>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" class="form-control" placeholder="New York City" #inCity [value]="selected.city">
|
||||
</td>
|
||||
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">State*</span>
|
||||
</td>
|
||||
<td>
|
||||
<select class="custom-select" #inState [value]="selected.state">
|
||||
<option selected>Choose...</option>
|
||||
<option *ngFor="let state of states" [value]="state">{{state}}</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">ZIP*(+4)</span>
|
||||
</td>
|
||||
<td style="width: 25%">
|
||||
<div class="input-group">
|
||||
<input type="number" class="form-control" placeholder="12345" #inZIP [value]="selected.zip">
|
||||
<input type="number" class="form-control" placeholder="(+4)" #inZIP4 [value]="selected.ziplast4">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">Email*</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="email" class="form-control" placeholder="john@doe.com" #inEmail [value]="selected.email">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">Phone*</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="tel" class="form-control" placeholder="(123) 456-7890" [textMask]="{mask: usPhoneMask, guide: false}" #inPhone [value]="selected.phone">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">Fax</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="tel" class="form-control" placeholder="(123) 456-7890" [textMask]="{mask: usPhoneMask, guide: false}" #inFax [value]="selected.fax">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-warning" type="button"
|
||||
[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)">
|
||||
Update
|
||||
</button>
|
||||
<button type="button" class="btn btn-danger" (click)="close(edit)">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="!selected">
|
||||
<div class="modal-body">
|
||||
Choose a Customer First!
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-warning" type="button"
|
||||
[disabled]="true">
|
||||
Update
|
||||
</button>
|
||||
<button type="button" class="btn btn-danger" (click)="close(edit)">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</app-modal-form>
|
||||
<app-nav-bar [customerActive]="true"></app-nav-bar>
|
||||
<h1 align="center">Customers</h1>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<ag-grid-angular
|
||||
#agGrid
|
||||
style="height: 500px;"
|
||||
class="ag-theme-balham"
|
||||
[enableSorting]="true"
|
||||
[enableFilter]="true"
|
||||
[rowData]="rowData | async"
|
||||
[columnDefs]="columnDefs"
|
||||
rowSelection="single"
|
||||
></ag-grid-angular>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-center mt-2">
|
||||
<div class="col-6">
|
||||
<button class="btn btn-primary" style="width: 100%" (click)="open(edit)">Edit Customer</button>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<button class="btn btn-success" style="width: 100%" (click)="open(new)">Add Customer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--MODAL: new customer-->
|
||||
<app-modal-form [title]="'New Customer'" #new>
|
||||
<div class="modal-body">
|
||||
<table class="table table-borderless table-sm">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 10%">
|
||||
<span class="input-group-text">ID*</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="text" class="form-control" placeholder="johndoe" #inId>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 10%">
|
||||
<span class="input-group-text">Name*</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="text" class="form-control" placeholder="John Doe" #inName>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 10%">
|
||||
<span class="input-group-text">Bill To Dept*</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="text" class="form-control" placeholder="Billing" #inBillToDept>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 10%">
|
||||
<span class="input-group-text">Address 1*</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="text" class="form-control" placeholder="13254 John Doe Rd." #inAdd1>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">Address 2</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="text" class="form-control" placeholder="Apt #, Unit, etc..." [value]="''" #inAdd2>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">City*</span>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" class="form-control" placeholder="New York City" #inCity>
|
||||
</td>
|
||||
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">State*</span>
|
||||
</td>
|
||||
<td>
|
||||
<select class="custom-select" #inState>
|
||||
<option selected>Choose...</option>
|
||||
<option *ngFor="let state of states" [value]="state">{{state}}</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">ZIP*(+4)</span>
|
||||
</td>
|
||||
<td style="width: 25%">
|
||||
<div class="input-group">
|
||||
<input type="number" class="form-control" placeholder="12345" #inZIP>
|
||||
<input type="number" class="form-control" placeholder="(+4)" #inZIP4>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">Email*</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="email" class="form-control" placeholder="john@doe.com" #inEmail>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">Phone*</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="tel" class="form-control" placeholder="(123) 456-7890" [textMask]="{mask: usPhoneMask, guide: false}" #inPhone>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">Fax</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="tel" class="form-control" placeholder="(123) 456-7890" [value]="''" [textMask]="{mask: usPhoneMask, guide: false}" #inFax>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<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)"
|
||||
(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 type="button" class="btn btn-danger" (click)="close(new)">Cancel</button>
|
||||
</div>
|
||||
</app-modal-form>
|
||||
|
||||
<!--MODAL: edit customer-->
|
||||
<app-modal-form [title]="'Editing'" #edit>
|
||||
<div *ngIf="selected">
|
||||
<div class="modal-body">
|
||||
<table class="table table-borderless table-sm">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 10%">
|
||||
<span class="input-group-text">Name*</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="text" class="form-control" #inName placeholder="John Doe" [value]="selected.customerName">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 10%">
|
||||
<span class="input-group-text">Bill To Dept*</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="text" class="form-control" placeholder="Billing" #inBillToDept [value]="selected.billToDept">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 10%">
|
||||
<span class="input-group-text">Address 1*</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="text" class="form-control" placeholder="13254 John Doe Rd." #inAdd1 [value]="selected.add1">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">Address 2</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="text" class="form-control" placeholder="Apt#, Unit, etc." #inAdd2 [value]="selected.add2">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">City*</span>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" class="form-control" placeholder="New York City" #inCity [value]="selected.city">
|
||||
</td>
|
||||
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">State*</span>
|
||||
</td>
|
||||
<td>
|
||||
<select class="custom-select" #inState [value]="selected.state">
|
||||
<option selected>Choose...</option>
|
||||
<option *ngFor="let state of states" [value]="state">{{state}}</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">ZIP*(+4)</span>
|
||||
</td>
|
||||
<td style="width: 25%">
|
||||
<div class="input-group">
|
||||
<input type="number" class="form-control" placeholder="12345" #inZIP [value]="selected.zip">
|
||||
<input type="number" class="form-control" placeholder="(+4)" #inZIP4 [value]="selected.ziplast4">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">Email*</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="email" class="form-control" placeholder="john@doe.com" #inEmail [value]="selected.email">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">Phone*</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="tel" class="form-control" placeholder="(123) 456-7890" [textMask]="{mask: usPhoneMask, guide: false}" #inPhone [value]="selected.phone">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">Fax</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="tel" class="form-control" placeholder="(123) 456-7890" [textMask]="{mask: usPhoneMask, guide: false}" #inFax [value]="selected.fax">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-warning" type="button"
|
||||
[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)">
|
||||
Update
|
||||
</button>
|
||||
<button type="button" class="btn btn-danger" (click)="close(edit)">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="!selected">
|
||||
<div class="modal-body">
|
||||
Choose a Customer First!
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-warning" type="button"
|
||||
[disabled]="true">
|
||||
Update
|
||||
</button>
|
||||
<button type="button" class="btn btn-danger" (click)="close(edit)">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</app-modal-form>
|
||||
|
|
|
@ -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<CustomerComponent>;
|
||||
|
||||
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<CustomerComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CustomerComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CustomerComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,69 +1,69 @@
|
|||
<app-nav-bar></app-nav-bar>
|
||||
<div>
|
||||
<div class="container">
|
||||
<!--welcome message and search bar-->
|
||||
<div class="row top-buffer align-items-center">
|
||||
<div class="col-lg-8">
|
||||
<h1 class="display-4" *ngIf="currentUser">
|
||||
Welcome to the Astute Internal System, {{currentUser}}!
|
||||
</h1>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<div class="input-group mb-3 float-right">
|
||||
<input type="text" class="form-control" placeholder="Search...">
|
||||
<div class="input-group-prepend">
|
||||
<button class="btn btn-sm btn-info btn-round">
|
||||
<i class="material-icons">search</i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--applications-->
|
||||
<div>
|
||||
<div class="row sep-buffer">
|
||||
<div class="col-12">
|
||||
<h3>
|
||||
Applications
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<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>
|
||||
<!--<i class="material-icons text-info">info</i> -->
|
||||
</app-app-box>
|
||||
<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>
|
||||
<!--<i class="material-icons text-info">info</i> Medical Records Application-->
|
||||
</app-app-box>
|
||||
<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>
|
||||
<!--<i class="material-icons text-danger">info</i> Not yet implemented-->
|
||||
</app-app-box>
|
||||
<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>
|
||||
<!--<i class="material-icons text-danger">info</i> Not yet implemented-->
|
||||
</app-app-box>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--Some Extra Info-->
|
||||
<div>
|
||||
<div class="row sep-buffer">
|
||||
<div class="col-12">
|
||||
<h3>
|
||||
Extra info section
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row top-buffer justify-content-start">
|
||||
<h5 class="app-buffer">
|
||||
Some sort of info here, maybe about recent invoices, or upcoming payment due dates.<br>
|
||||
Maybe something for each users tasks...
|
||||
</h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<app-nav-bar></app-nav-bar>
|
||||
<div>
|
||||
<div class="container">
|
||||
<!--welcome message and search bar-->
|
||||
<div class="row top-buffer align-items-center">
|
||||
<div class="col-lg-8">
|
||||
<h1 class="display-4" *ngIf="currentUser">
|
||||
Welcome to the Astute Internal System, {{currentUser}}!
|
||||
</h1>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<div class="input-group mb-3 float-right">
|
||||
<input type="text" class="form-control" placeholder="Search...">
|
||||
<div class="input-group-prepend">
|
||||
<button class="btn btn-sm btn-info btn-round">
|
||||
<i class="material-icons">search</i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--applications-->
|
||||
<div>
|
||||
<div class="row sep-buffer">
|
||||
<div class="col-12">
|
||||
<h3>
|
||||
Applications
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<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>
|
||||
<!--<i class="material-icons text-info">info</i> -->
|
||||
</app-app-box>
|
||||
<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>
|
||||
<!--<i class="material-icons text-info">info</i> Medical Records Application-->
|
||||
</app-app-box>
|
||||
<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>
|
||||
<!--<i class="material-icons text-danger">info</i> Not yet implemented-->
|
||||
</app-app-box>
|
||||
<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 enter payments received</h6>
|
||||
<!--<i class="material-icons text-danger">info</i> Not yet implemented-->
|
||||
</app-app-box>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--Some Extra Info-->
|
||||
<div>
|
||||
<div class="row sep-buffer">
|
||||
<div class="col-12">
|
||||
<h3>
|
||||
Extra info section
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row top-buffer justify-content-start">
|
||||
<h5 class="app-buffer">
|
||||
Some sort of info here, maybe about recent invoices, or upcoming payment due dates.<br>
|
||||
Maybe something for each users tasks...
|
||||
</h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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<HomepageComponent>;
|
||||
|
||||
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<HomepageComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ HomepageComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(HomepageComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;*/
|
||||
/*}*/
|
||||
/*}*/
|
||||
|
|
|
@ -1,127 +1,127 @@
|
|||
<div class="page" #doc>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<img src="AstuteLogo.gif" align="left" alt="Astute Engineering" height="75">
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<p class="h1 text-right align-bottom">INVOICE</p>
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<p>To,</p>
|
||||
<p>{{name}}</p>
|
||||
<p>{{email}}</p>
|
||||
<p>{{address}}</p>
|
||||
</div>
|
||||
<div class="col-5 text-right">
|
||||
<p>Purchase Order No.:</p>
|
||||
<p>Contract No.:</p>
|
||||
<p>Invoice No.:</p>
|
||||
<p>Invoice Date:</p>
|
||||
</div>
|
||||
<div class="col text-left">
|
||||
<p>{{poNum}}</p>
|
||||
<p>{{coNum}}</p>
|
||||
<p>{{inNum}}</p>
|
||||
<p>{{inDate}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="row">
|
||||
<table class="table table-sm table-bordered table-light">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th scope="col" style="text-align: center;">No.</th>
|
||||
<th scope="col">Description</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;">Invoice Amount</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let inDet of inDetails">
|
||||
<th scope="row" style="text-align: center;">{{inDet.lineItemNum}}</th>
|
||||
<td>{{inDet.desc}}</td>
|
||||
<td style="text-align: right;">${{inDet.anount}}.00</td>
|
||||
<td style="text-align: center;">-</td>
|
||||
<td style="text-align: right;">${{inDet.anount}}.00</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="row">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr style="height: 18px;">
|
||||
<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="width: 305px; text-align: right; height: 18px;"> </td>
|
||||
<td style="background-color: lightgray; border-color: black; width: 153px; height: 18px;"> </td>
|
||||
</tr>
|
||||
<tr style="height: 17px;">
|
||||
<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="width: 305px; text-align: right; height: 18px;"> </td>
|
||||
<td style="background-color: lightgray; border-color: black; width: 153px; height: 18px;"> </td>
|
||||
</tr>
|
||||
<tr style="height: 18px;">
|
||||
<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="width: 305px; text-align: right; height: 18px;"> </td>
|
||||
<td style="background-color: lightgray; border-color: black; width: 153px; height: 18px;"> </td>
|
||||
</tr>
|
||||
<tr style="height: 18px;">
|
||||
<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="width: 305px; text-align: right; height: 18px;"> </td>
|
||||
<td style="background-color: lightgray; border-color: black; width: 153px; height: 18px;"> </td>
|
||||
</tr>
|
||||
<tr style="height: 18px;">
|
||||
<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="width: 305px; text-align: right; height: 18px;"> </td>
|
||||
<td style="background-color: lightgray; border-color: black; width: 153px; height: 18px;"> </td>
|
||||
</tr>
|
||||
<tr style="height: 18px;">
|
||||
<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="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>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="row">
|
||||
<p>Notes:</p>
|
||||
<ol>
|
||||
{{notes}}
|
||||
</ol>
|
||||
</div>
|
||||
<div class="row">
|
||||
<p>{{cert}}</p>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"> </div>
|
||||
<div class="col-4"><hr></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="editor"></div>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="text-center">
|
||||
<button class="btn btn-lg btn-outline-primary"(click)="moreTestJsPDF()">Download PDF</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
<div class="page" #doc>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<img src="AstuteLogo.gif" align="left" alt="Astute Engineering" height="75">
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<p class="h1 text-right align-bottom">INVOICE</p>
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<p>To,</p>
|
||||
<p>{{name}}</p>
|
||||
<p>{{email}}</p>
|
||||
<p>{{address}}</p>
|
||||
</div>
|
||||
<div class="col-5 text-right">
|
||||
<p>Purchase Order No.:</p>
|
||||
<p>Contract No.:</p>
|
||||
<p>Invoice No.:</p>
|
||||
<p>Invoice Date:</p>
|
||||
</div>
|
||||
<div class="col text-left">
|
||||
<p>{{poNum}}</p>
|
||||
<p>{{coNum}}</p>
|
||||
<p>{{inNum}}</p>
|
||||
<p>{{inDate}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="row">
|
||||
<table class="table table-sm table-bordered table-light">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th scope="col" style="text-align: center;">No.</th>
|
||||
<th scope="col">Description</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;">Invoice Amount</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let inDet of inDetails">
|
||||
<th scope="row" style="text-align: center;">{{inDet.lineItemNum}}</th>
|
||||
<td>{{inDet.desc}}</td>
|
||||
<td style="text-align: right;">${{inDet.anount}}.00</td>
|
||||
<td style="text-align: center;">-</td>
|
||||
<td style="text-align: right;">${{inDet.anount}}.00</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="row">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr style="height: 18px;">
|
||||
<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="width: 305px; text-align: right; height: 18px;"> </td>
|
||||
<td style="background-color: lightgray; border-color: black; width: 153px; height: 18px;"> </td>
|
||||
</tr>
|
||||
<tr style="height: 17px;">
|
||||
<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="width: 305px; text-align: right; height: 18px;"> </td>
|
||||
<td style="background-color: lightgray; border-color: black; width: 153px; height: 18px;"> </td>
|
||||
</tr>
|
||||
<tr style="height: 18px;">
|
||||
<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="width: 305px; text-align: right; height: 18px;"> </td>
|
||||
<td style="background-color: lightgray; border-color: black; width: 153px; height: 18px;"> </td>
|
||||
</tr>
|
||||
<tr style="height: 18px;">
|
||||
<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="width: 305px; text-align: right; height: 18px;"> </td>
|
||||
<td style="background-color: lightgray; border-color: black; width: 153px; height: 18px;"> </td>
|
||||
</tr>
|
||||
<tr style="height: 18px;">
|
||||
<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="width: 305px; text-align: right; height: 18px;"> </td>
|
||||
<td style="background-color: lightgray; border-color: black; width: 153px; height: 18px;"> </td>
|
||||
</tr>
|
||||
<tr style="height: 18px;">
|
||||
<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="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>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="row">
|
||||
<p>Notes:</p>
|
||||
<ol>
|
||||
{{notes}}
|
||||
</ol>
|
||||
</div>
|
||||
<div class="row">
|
||||
<p>{{cert}}</p>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"> </div>
|
||||
<div class="col-4"><hr></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="editor"></div>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="text-center">
|
||||
<button class="btn btn-lg btn-outline-primary"(click)="moreTestJsPDF()">Download PDF</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
|
@ -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<InvoiceGenComponent>;
|
||||
|
||||
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<InvoiceGenComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ InvoiceGenComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(InvoiceGenComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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((<HTMLInputElement>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((<HTMLInputElement>document.getElementById('doc')));
|
||||
// var data='hello';
|
||||
// $.get('http://localhost/ws/service.asmx/HelloWord', function(response) {
|
||||
// data = response;
|
||||
// }).error(function(){
|
||||
// alert('Sorry could not proceed');
|
||||
// });
|
||||
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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<InvoiceComponent>;
|
||||
|
||||
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<InvoiceComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ InvoiceComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(InvoiceComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<ng-template #content let-c="close" let-d="dismiss">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">{{title}}</h4>
|
||||
<button type="button" class="close" aria-label="Close" (click)="d('Cross click')">
|
||||
<span aria-hidden="true">‾</span>
|
||||
</button>
|
||||
</div>
|
||||
<ng-content></ng-content>
|
||||
<!--<div class="modal-footer">-->
|
||||
<!--<button type="button" class="btn btn-outline-dark" (click)="c('Close click')">Close</button>-->
|
||||
<!--</div>-->
|
||||
</ng-template>
|
||||
<ng-template #content let-c="close" let-d="dismiss">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">{{title}}</h4>
|
||||
<button type="button" class="close" aria-label="Close" (click)="d('Cross click')">
|
||||
<span aria-hidden="true">‾</span>
|
||||
</button>
|
||||
</div>
|
||||
<ng-content></ng-content>
|
||||
<!--<div class="modal-footer">-->
|
||||
<!--<button type="button" class="btn btn-outline-dark" (click)="c('Close click')">Close</button>-->
|
||||
<!--</div>-->
|
||||
</ng-template>
|
||||
|
|
|
@ -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<ModalFormComponent>;
|
||||
|
||||
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<ModalFormComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ModalFormComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ModalFormComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,33 +1,34 @@
|
|||
<nav class="navbar navbar-expand-lg navbar-dark navbar-lightblue">
|
||||
<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">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
|
||||
<div class="navbar-nav">
|
||||
<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]="invoiceActive ? 'active' : ''"routerLink="/invoice" routerLinkActive="active">Invoice</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!--<div class="card text-center">-->
|
||||
<!--<div class="card-header">-->
|
||||
<!--<a class="navbar-brand" href="#">Astute Internal System</a>-->
|
||||
<!--<ul class="nav nav-pills card-header-pills">-->
|
||||
<!--<li class="nav-item">-->
|
||||
<!--<a class="nav-link" [ngClass]="customerActive ? 'active' : ''" routerLink="/customer" routerLinkActive="active">Customer</a>-->
|
||||
<!--</li>-->
|
||||
<!--<li class="nav-item">-->
|
||||
<!--<a class="nav-link" [ngClass]="salesOrderActive ? 'active' : ''"routerLink="/sales-order" routerLinkActive="active">Sales Order</a>-->
|
||||
<!--</li>-->
|
||||
<!--<li class="nav-item">-->
|
||||
<!--<a class="nav-link" [ngClass]="invoiceActive ? 'active' : ''"routerLink="/invoice" routerLinkActive="active">Invoice</a>-->
|
||||
<!--</li>-->
|
||||
<!--</ul>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="card-body">-->
|
||||
<!--<app-homepage></app-homepage>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<nav class="navbar navbar-expand-lg navbar-dark navbar-lightblue">
|
||||
<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">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
|
||||
<div class="navbar-nav">
|
||||
<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]="invoiceActive ? 'active' : ''"routerLink="/invoice" routerLinkActive="active">Invoice</a>
|
||||
<a class="nav-link" [ngClass]="invoicePaymentActive ? 'active' : ''"routerLink="/invoice-payment" routerLinkActive="active">Invoice Payment</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!--<div class="card text-center">-->
|
||||
<!--<div class="card-header">-->
|
||||
<!--<a class="navbar-brand" href="#">Astute Internal System</a>-->
|
||||
<!--<ul class="nav nav-pills card-header-pills">-->
|
||||
<!--<li class="nav-item">-->
|
||||
<!--<a class="nav-link" [ngClass]="customerActive ? 'active' : ''" routerLink="/customer" routerLinkActive="active">Customer</a>-->
|
||||
<!--</li>-->
|
||||
<!--<li class="nav-item">-->
|
||||
<!--<a class="nav-link" [ngClass]="salesOrderActive ? 'active' : ''"routerLink="/sales-order" routerLinkActive="active">Sales Order</a>-->
|
||||
<!--</li>-->
|
||||
<!--<li class="nav-item">-->
|
||||
<!--<a class="nav-link" [ngClass]="invoiceActive ? 'active' : ''"routerLink="/invoice" routerLinkActive="active">Invoice</a>-->
|
||||
<!--</li>-->
|
||||
<!--</ul>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="card-body">-->
|
||||
<!--<app-homepage></app-homepage>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
|
|
|
@ -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<NavBarComponent>;
|
||||
|
||||
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<NavBarComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ NavBarComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(NavBarComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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() {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,382 +1,382 @@
|
|||
<app-nav-bar [salesOrderActive]="true"></app-nav-bar>
|
||||
<h1 align="center">Sales Orders</h1>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<ag-grid-angular
|
||||
#agGrid
|
||||
style="height: 500px;"
|
||||
class="ag-theme-balham"
|
||||
[enableSorting]="true"
|
||||
[enableFilter]="true"
|
||||
[rowData]="rowData"
|
||||
[columnDefs]="columnDefs"
|
||||
rowSelection="single"
|
||||
></ag-grid-angular>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-center mt-2">
|
||||
<div class="col-6">
|
||||
<button class="btn btn-primary" style="width: 100%" (click)="open(edit)">Edit Sales Order</button>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<button class="btn btn-success" style="width: 100%" (click)="open(new)">Add Sales Order</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--MODAL: new po-->
|
||||
<app-modal-form [title]="'New Sales Order'" #new>
|
||||
<div class="modal-body">
|
||||
<p class="h4 text-right">General</p>
|
||||
<hr>
|
||||
<table class="table table-borderless table-sm">
|
||||
<tbody>
|
||||
<tr>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class="input-group-text">Customer</span></td>
|
||||
<td colspan="3">
|
||||
<select class="form-control" #customerid>
|
||||
<option [value]="-1">Choose Customer...</option>
|
||||
<option *ngFor="let customer of customers" [value]="customer.customerId">{{customer.customerName}}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<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: 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>
|
||||
</tr>
|
||||
<tr>
|
||||
<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: 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>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!--fee-->
|
||||
<!--feeTypeId-->
|
||||
<!--lineItemNo-->
|
||||
<!--ponum-->
|
||||
<!--qty-->
|
||||
<!--remainingQty-->
|
||||
<!--serviceDesc-->
|
||||
<!--serviceTypeId-->
|
||||
|
||||
<!--Detail-->
|
||||
<div class="modal-body">
|
||||
<p class="h4 text-right">Detail</p>
|
||||
<hr>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"></th>
|
||||
<th scope="col" style="width: 50px">#</th>
|
||||
<th scope="col">Description</th>
|
||||
<th scope="col">Rate Type</th>
|
||||
<th scope="col">Service Type</th>
|
||||
<th scope="col" style="width: 75px">Qty</th>
|
||||
<th scope="col" style="width: 100px">Rate</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody *ngFor="let poDetail of newPODetail; let i = index">
|
||||
<tr class="p-0 m-0">
|
||||
<td class="p-1 m-0">
|
||||
<button class="btn btn-outline-danger" type="button" (click)="newPODetail.splice(i, 1);">
|
||||
-
|
||||
</button>
|
||||
</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">
|
||||
<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>-->
|
||||
</td>
|
||||
<td class="p-0 m-0">
|
||||
<select class="form-control cell" [value]="poDetail.feeTypeId" (change)="onNewCellChange(i, 'feeTypeId', feeTypeId.value)" #feeTypeId>
|
||||
<option value="1">Fixed Fee</option>
|
||||
<option value="2">Hourly</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="p-0 m-0">
|
||||
<select class="form-control cell" [value]="poDetail.serviceTypeId" (change)="onNewCellChange(i, 'serviceTypeId', serviceTypeId.value)" #serviceTypeId>
|
||||
<option value="1">Study</option>
|
||||
<option value="2">Design</option>
|
||||
<option value="3">Peer Review</option>
|
||||
<option value="4">Cost Estimation</option>
|
||||
<option value="5">Forensic Investigation</option>
|
||||
</select>
|
||||
</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="text" class="form-control cell" [value]="poDetail.remainingQty" [id]="'remainingQty' + i"></td>-->
|
||||
</tr>
|
||||
</tbody>
|
||||
<tr class="p-0 m-0">
|
||||
<td class="p-1 m-0">
|
||||
<button class="btn btn-success" type="button"
|
||||
[disabled]="!ponum.value"
|
||||
(click)="pushOntoNewDetail(newPODetail.length + 1, ponum.value, '', '1', '1', 1, 0, 0)">
|
||||
<!--(click)="pushOntoNewDetail((lineItemNo) ? lineItemNo.value + 1: 1, ponum.value, serviceDesc.value,-->
|
||||
<!--feeTypeId.value, serviceTypeId.value, qty.value, fee.value, 0)">-->
|
||||
+</button>
|
||||
</td>
|
||||
<!--<td class="p-0 m-0">-->
|
||||
<!--<input type="number" class="form-control cell" [value]="(selectedPODetail.length) ? selectedPODetail[selectedPODetail.length-1].lineItemNo + 1: 1" #lineItemNo>-->
|
||||
<!--</td>-->
|
||||
<!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="''" #serviceDesc></td>-->
|
||||
<!--<td class="p-0 m-0">-->
|
||||
<!--<select class="form-control cell" [value]="1" #feeTypeId>-->
|
||||
<!--<option value="1">Fixed Fee</option>-->
|
||||
<!--<option value="2">Hourly</option>-->
|
||||
<!--</select>-->
|
||||
<!--</td>-->
|
||||
<!--<td class="p-0 m-0">-->
|
||||
<!--<select class="form-control cell" [value]="1" #serviceTypeId>-->
|
||||
<!--<option value="1">Study</option>-->
|
||||
<!--<option value="2">Design</option>-->
|
||||
<!--<option value="3">Peer Review</option>-->
|
||||
<!--<option value="4">Cost Estimation</option>-->
|
||||
<!--<option value="5">Forensic Investigation</option>-->
|
||||
<!--</select>-->
|
||||
<!--</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" #remainingQty></td>–>-->
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-success" type="button"
|
||||
[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)"
|
||||
>
|
||||
Add
|
||||
</button>
|
||||
<button class="btn btn-outline-danger" (click)="close(new)">Cancel</button>
|
||||
</div>
|
||||
</app-modal-form>
|
||||
|
||||
<!--MODAL: edit po-->
|
||||
<app-modal-form [title]="'Edit Sales Order'" #edit>
|
||||
<div *ngIf="selected">
|
||||
<div class="modal-body">
|
||||
<p class="h4 text-right">General</p>
|
||||
<hr>
|
||||
<table class="table table-borderless table-sm">
|
||||
<tbody>
|
||||
<tr>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class="input-group-text">Customer</span></td>
|
||||
<td colspan="3">
|
||||
<select class="form-control" [value]="selected.customerId" disabled="true" #customerid>
|
||||
<option [value]="-1">No Customer</option>
|
||||
<option *ngFor="let customer of customers" [value]="customer.customerId">{{customer.customerName}}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<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: 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>
|
||||
</tr>
|
||||
<tr>
|
||||
<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: 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>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<!--<form>-->
|
||||
<!--<div class="form-group row">-->
|
||||
<!--<label class="col-sm-2 col-form-label">Astute Project Number</label>-->
|
||||
<!--<div class="col-sm-10">-->
|
||||
<!--<input type="text" class="form-control" placeholder="Project Number" [value]="selected.astuteProjectNumber" #projNum>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="form-group row">-->
|
||||
<!--<label class="col-sm-2 col-form-label">Customer Name</label>-->
|
||||
<!--<div class="col-sm-10">-->
|
||||
<!--<select class="form-control" [value]="selected.customerId" #customerid disabled>-->
|
||||
<!--<option *ngFor="let customer of customers" [value]="customer.customerId">{{customer.customerName}}-->
|
||||
<!--</option>-->
|
||||
<!--</select>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="form-group row">-->
|
||||
<!--<label class="col-sm-2 col-form-label">SO Title</label>-->
|
||||
<!--<div class="col-sm-10">-->
|
||||
<!--<input type="text" class="form-control" [value]="selected.title" #title>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="form-group row">-->
|
||||
<!--<label class="col-sm-2 col-form-label">SO Number</label>-->
|
||||
<!--<div class="col-sm-10">-->
|
||||
<!--<input type="text" class="form-control" placeholder="SO Number" [value]="selected.ponum" #ponum disabled>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="form-group row">-->
|
||||
<!--<label class="col-sm-2 col-form-label">SO Date</label>-->
|
||||
<!--<div class="col-sm-10">-->
|
||||
<!--<input type="date" class="form-control" [value]="selected.podate" #podate>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="form-group row">-->
|
||||
<!--<label class="col-sm-2 col-form-label">Contract Number</label>-->
|
||||
<!--<div class="col-sm-10">-->
|
||||
<!--<input type="text" class="form-control" placeholder="Contract Number" [value]="selected.contractNum"-->
|
||||
<!--#contractnum>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="form-group row">-->
|
||||
<!--<label class="col-sm-2 col-form-label">Contract Amount</label>-->
|
||||
<!--<div class="col-sm-10">-->
|
||||
<!--<input type="text" class="form-control" placeholder="Contract Amount" [value]="selected.contractAmt"-->
|
||||
<!--#contractamt>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--</form>-->
|
||||
</div>
|
||||
|
||||
|
||||
<!--fee-->
|
||||
<!--feeTypeId-->
|
||||
<!--lineItemNo-->
|
||||
<!--ponum-->
|
||||
<!--qty-->
|
||||
<!--remainingQty-->
|
||||
<!--serviceDesc-->
|
||||
<!--serviceTypeId-->
|
||||
|
||||
<!--Detail-->
|
||||
<div class="modal-body" *ngIf="selectedPODetail">
|
||||
<p class="h4 text-right">Detail</p>
|
||||
<hr>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" style="width: 50px">#</th>
|
||||
<!--<th scope="col">Purchase Order Number</th>-->
|
||||
<th scope="col">Description</th>
|
||||
<th scope="col">Rate Type</th>
|
||||
<th scope="col">Service Type</th>
|
||||
<th scope="col" style="width: 75px">Qty</th>
|
||||
<th scope="col" style="width: 100px">Rate</th>
|
||||
<!--<th scope="col">Remaining Quantity</th>-->
|
||||
</tr>
|
||||
</thead>
|
||||
<!--<tbody>-->
|
||||
<tbody *ngFor="let poDetail of selectedPODetail; let i = index">
|
||||
<tr 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>-->
|
||||
<!--</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 m-0">
|
||||
<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>-->
|
||||
</td>
|
||||
<td class="p-0 m-0">
|
||||
<select class="form-control cell" [value]="poDetail.feeTypeId" (change)="onSelectedCellChange(i, 'feeTypeId', feeTypeId.value)" #feeTypeId>
|
||||
<option value="1">Fixed Fee</option>
|
||||
<option value="2">Hourly</option>
|
||||
</select>
|
||||
<!--<input type="number" class="form-control cell" [value]="poDetail.feeTypeId">-->
|
||||
</td>
|
||||
<td class="p-0 m-0">
|
||||
<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="">Study</option>-->
|
||||
<!--<option value="2">Design</option>-->
|
||||
<!--<option value="3">Peer Review</option>-->
|
||||
<!--<option value="4">Cost Estimation</option>-->
|
||||
<!--<option value="5">Forensic Investigation</option>-->
|
||||
</select>
|
||||
<!--<input type="number" class="form-control cell" [value]="poDetail.serviceTypeId" #serviceTypeId>-->
|
||||
</td>
|
||||
<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="+poDetail.qty" (change)="onSelectedCellChange(i, 'qty', qty.value); onSelectedCellChange(i, 'remainingQty', qty.value * fee.value); updateEditContractAmt();" #qty></td>
|
||||
<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="+poDetail.fee" (change)="onSelectedCellChange(i, 'fee', fee.value); onSelectedCellChange(i, 'remainingQty', qty.value * fee.value); updateEditContractAmt();" #fee></td>
|
||||
<!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="poDetail.remainingQty" [id]="'remainingQty' + i"></td>-->
|
||||
</tr>
|
||||
</tbody>
|
||||
<tr class="p-0 m-0">
|
||||
<td class="p-1 m-0">
|
||||
<button class="btn btn-success" type="button"
|
||||
(click)="pushOntoSelectedDetail(selectedPODetail.length + 1, ponum.value, '', '1', '1', 1, 0, 0)">
|
||||
<!--(click)="pushOntoSelectedDetail(selectedPODetail[selectedPODetail.length-1].lineItemNo + 1, selected.ponum, serviceDesc.value,-->
|
||||
<!--feeTypeId.value, serviceTypeId.value, qty.value, fee.value, 0)">-->
|
||||
+</button>
|
||||
</td>
|
||||
<!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="''" #serviceDesc></td>-->
|
||||
<!--<td class="p-0 m-0">-->
|
||||
<!--<select class="form-control cell" [value]="1" #feeTypeId>-->
|
||||
<!--<option value="1">Fixed Fee</option>-->
|
||||
<!--<option value="2">Hourly</option>-->
|
||||
<!--</select>-->
|
||||
<!--</td>-->
|
||||
<!--<td class="p-0 m-0">-->
|
||||
<!--<select class="form-control cell" [value]="1" #serviceTypeId>-->
|
||||
<!--<option value="1">Study</option>-->
|
||||
<!--<option value="2">Design</option>-->
|
||||
<!--<option value="3">Peer Review</option>-->
|
||||
<!--<option value="4">Cost Estimation</option>-->
|
||||
<!--<option value="5">Forensic Investigation</option>-->
|
||||
<!--</select>-->
|
||||
<!--</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>-->
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-success" type="button"
|
||||
[disabled]="!(ponum.value && podate.value && contractnum.value && contractamt.value)"
|
||||
(click)="editPo(projNum.value, ponum.value, podate.value, contractnum.value, contractamt.value, title.value, edit)"
|
||||
>
|
||||
Update
|
||||
</button>
|
||||
<button class="btn btn-outline-danger" (click)="close(edit)">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="!selected">
|
||||
<div class="modal-body">
|
||||
Choose a Sales Order First!
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-success" type="button"
|
||||
[disabled]="true"
|
||||
>
|
||||
Update
|
||||
</button>
|
||||
<button class="btn btn-outline-danger" (click)="close(edit)">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</app-modal-form>
|
||||
<app-nav-bar [salesOrderActive]="true"></app-nav-bar>
|
||||
<h1 align="center">Sales Orders</h1>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<ag-grid-angular
|
||||
#agGrid
|
||||
style="height: 500px;"
|
||||
class="ag-theme-balham"
|
||||
[enableSorting]="true"
|
||||
[enableFilter]="true"
|
||||
[rowData]="rowData"
|
||||
[columnDefs]="columnDefs"
|
||||
rowSelection="single"
|
||||
></ag-grid-angular>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-center mt-2">
|
||||
<div class="col-6">
|
||||
<button class="btn btn-primary" style="width: 100%" (click)="open(edit)">Edit Sales Order</button>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<button class="btn btn-success" style="width: 100%" (click)="open(new)">Add Sales Order</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--MODAL: new po-->
|
||||
<app-modal-form [title]="'New Sales Order'" #new>
|
||||
<div class="modal-body">
|
||||
<p class="h4 text-right">General</p>
|
||||
<hr>
|
||||
<table class="table table-borderless table-sm">
|
||||
<tbody>
|
||||
<tr>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class="input-group-text">Customer</span></td>
|
||||
<td colspan="3">
|
||||
<select class="form-control" #customerid>
|
||||
<option [value]="-1">Choose Customer...</option>
|
||||
<option *ngFor="let customer of customers" [value]="customer.customerId">{{customer.customerName}}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<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: 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>
|
||||
</tr>
|
||||
<tr>
|
||||
<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: 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>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!--fee-->
|
||||
<!--feeTypeId-->
|
||||
<!--lineItemNo-->
|
||||
<!--ponum-->
|
||||
<!--qty-->
|
||||
<!--remainingQty-->
|
||||
<!--serviceDesc-->
|
||||
<!--serviceTypeId-->
|
||||
|
||||
<!--Detail-->
|
||||
<div class="modal-body">
|
||||
<p class="h4 text-right">Detail</p>
|
||||
<hr>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"></th>
|
||||
<th scope="col" style="width: 50px">#</th>
|
||||
<th scope="col">Description</th>
|
||||
<th scope="col">Rate Type</th>
|
||||
<th scope="col">Service Type</th>
|
||||
<th scope="col" style="width: 75px">Qty</th>
|
||||
<th scope="col" style="width: 100px">Rate</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody *ngFor="let poDetail of newPODetail; let i = index">
|
||||
<tr class="p-0 m-0">
|
||||
<td class="p-1 m-0">
|
||||
<button class="btn btn-outline-danger" type="button" (click)="newPODetail.splice(i, 1);">
|
||||
-
|
||||
</button>
|
||||
</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">
|
||||
<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>-->
|
||||
</td>
|
||||
<td class="p-0 m-0">
|
||||
<select class="form-control cell" [value]="poDetail.feeTypeId" (change)="onNewCellChange(i, 'feeTypeId', feeTypeId.value)" #feeTypeId>
|
||||
<option value="1">Fixed Fee</option>
|
||||
<option value="2">Hourly</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="p-0 m-0">
|
||||
<select class="form-control cell" [value]="poDetail.serviceTypeId" (change)="onNewCellChange(i, 'serviceTypeId', serviceTypeId.value)" #serviceTypeId>
|
||||
<option value="1">Study</option>
|
||||
<option value="2">Design</option>
|
||||
<option value="3">Peer Review</option>
|
||||
<option value="4">Cost Estimation</option>
|
||||
<option value="5">Forensic Investigation</option>
|
||||
</select>
|
||||
</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="text" class="form-control cell" [value]="poDetail.remainingQty" [id]="'remainingQty' + i"></td>-->
|
||||
</tr>
|
||||
</tbody>
|
||||
<tr class="p-0 m-0">
|
||||
<td class="p-1 m-0">
|
||||
<button class="btn btn-success" type="button"
|
||||
[disabled]="!ponum.value"
|
||||
(click)="pushOntoNewDetail(newPODetail.length + 1, ponum.value, '', '1', '1', 1, 0, 0)">
|
||||
<!--(click)="pushOntoNewDetail((lineItemNo) ? lineItemNo.value + 1: 1, ponum.value, serviceDesc.value,-->
|
||||
<!--feeTypeId.value, serviceTypeId.value, qty.value, fee.value, 0)">-->
|
||||
+</button>
|
||||
</td>
|
||||
<!--<td class="p-0 m-0">-->
|
||||
<!--<input type="number" class="form-control cell" [value]="(selectedPODetail.length) ? selectedPODetail[selectedPODetail.length-1].lineItemNo + 1: 1" #lineItemNo>-->
|
||||
<!--</td>-->
|
||||
<!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="''" #serviceDesc></td>-->
|
||||
<!--<td class="p-0 m-0">-->
|
||||
<!--<select class="form-control cell" [value]="1" #feeTypeId>-->
|
||||
<!--<option value="1">Fixed Fee</option>-->
|
||||
<!--<option value="2">Hourly</option>-->
|
||||
<!--</select>-->
|
||||
<!--</td>-->
|
||||
<!--<td class="p-0 m-0">-->
|
||||
<!--<select class="form-control cell" [value]="1" #serviceTypeId>-->
|
||||
<!--<option value="1">Study</option>-->
|
||||
<!--<option value="2">Design</option>-->
|
||||
<!--<option value="3">Peer Review</option>-->
|
||||
<!--<option value="4">Cost Estimation</option>-->
|
||||
<!--<option value="5">Forensic Investigation</option>-->
|
||||
<!--</select>-->
|
||||
<!--</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" #remainingQty></td>–>-->
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-success" type="button"
|
||||
[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)"
|
||||
>
|
||||
Add
|
||||
</button>
|
||||
<button class="btn btn-outline-danger" (click)="close(new)">Cancel</button>
|
||||
</div>
|
||||
</app-modal-form>
|
||||
|
||||
<!--MODAL: edit po-->
|
||||
<app-modal-form [title]="'Edit Sales Order'" #edit>
|
||||
<div *ngIf="selected">
|
||||
<div class="modal-body">
|
||||
<p class="h4 text-right">General</p>
|
||||
<hr>
|
||||
<table class="table table-borderless table-sm">
|
||||
<tbody>
|
||||
<tr>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class="input-group-text">Customer</span></td>
|
||||
<td colspan="3">
|
||||
<select class="form-control" [value]="selected.customerId" disabled="true" #customerid>
|
||||
<option [value]="-1">No Customer</option>
|
||||
<option *ngFor="let customer of customers" [value]="customer.customerId">{{customer.customerName}}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<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: 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>
|
||||
</tr>
|
||||
<tr>
|
||||
<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: 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>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<!--<form>-->
|
||||
<!--<div class="form-group row">-->
|
||||
<!--<label class="col-sm-2 col-form-label">Astute Project Number</label>-->
|
||||
<!--<div class="col-sm-10">-->
|
||||
<!--<input type="text" class="form-control" placeholder="Project Number" [value]="selected.astuteProjectNumber" #projNum>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="form-group row">-->
|
||||
<!--<label class="col-sm-2 col-form-label">Customer Name</label>-->
|
||||
<!--<div class="col-sm-10">-->
|
||||
<!--<select class="form-control" [value]="selected.customerId" #customerid disabled>-->
|
||||
<!--<option *ngFor="let customer of customers" [value]="customer.customerId">{{customer.customerName}}-->
|
||||
<!--</option>-->
|
||||
<!--</select>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="form-group row">-->
|
||||
<!--<label class="col-sm-2 col-form-label">SO Title</label>-->
|
||||
<!--<div class="col-sm-10">-->
|
||||
<!--<input type="text" class="form-control" [value]="selected.title" #title>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="form-group row">-->
|
||||
<!--<label class="col-sm-2 col-form-label">SO Number</label>-->
|
||||
<!--<div class="col-sm-10">-->
|
||||
<!--<input type="text" class="form-control" placeholder="SO Number" [value]="selected.ponum" #ponum disabled>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="form-group row">-->
|
||||
<!--<label class="col-sm-2 col-form-label">SO Date</label>-->
|
||||
<!--<div class="col-sm-10">-->
|
||||
<!--<input type="date" class="form-control" [value]="selected.podate" #podate>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="form-group row">-->
|
||||
<!--<label class="col-sm-2 col-form-label">Contract Number</label>-->
|
||||
<!--<div class="col-sm-10">-->
|
||||
<!--<input type="text" class="form-control" placeholder="Contract Number" [value]="selected.contractNum"-->
|
||||
<!--#contractnum>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="form-group row">-->
|
||||
<!--<label class="col-sm-2 col-form-label">Contract Amount</label>-->
|
||||
<!--<div class="col-sm-10">-->
|
||||
<!--<input type="text" class="form-control" placeholder="Contract Amount" [value]="selected.contractAmt"-->
|
||||
<!--#contractamt>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--</form>-->
|
||||
</div>
|
||||
|
||||
|
||||
<!--fee-->
|
||||
<!--feeTypeId-->
|
||||
<!--lineItemNo-->
|
||||
<!--ponum-->
|
||||
<!--qty-->
|
||||
<!--remainingQty-->
|
||||
<!--serviceDesc-->
|
||||
<!--serviceTypeId-->
|
||||
|
||||
<!--Detail-->
|
||||
<div class="modal-body" *ngIf="selectedPODetail">
|
||||
<p class="h4 text-right">Detail</p>
|
||||
<hr>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" style="width: 50px">#</th>
|
||||
<!--<th scope="col">Purchase Order Number</th>-->
|
||||
<th scope="col">Description</th>
|
||||
<th scope="col">Rate Type</th>
|
||||
<th scope="col">Service Type</th>
|
||||
<th scope="col" style="width: 75px">Qty</th>
|
||||
<th scope="col" style="width: 100px">Rate</th>
|
||||
<!--<th scope="col">Remaining Quantity</th>-->
|
||||
</tr>
|
||||
</thead>
|
||||
<!--<tbody>-->
|
||||
<tbody *ngFor="let poDetail of selectedPODetail; let i = index">
|
||||
<tr 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>-->
|
||||
<!--</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 m-0">
|
||||
<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>-->
|
||||
</td>
|
||||
<td class="p-0 m-0">
|
||||
<select class="form-control cell" [value]="poDetail.feeTypeId" (change)="onSelectedCellChange(i, 'feeTypeId', feeTypeId.value)" #feeTypeId>
|
||||
<option value="1">Fixed Fee</option>
|
||||
<option value="2">Hourly</option>
|
||||
</select>
|
||||
<!--<input type="number" class="form-control cell" [value]="poDetail.feeTypeId">-->
|
||||
</td>
|
||||
<td class="p-0 m-0">
|
||||
<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="">Study</option>-->
|
||||
<!--<option value="2">Design</option>-->
|
||||
<!--<option value="3">Peer Review</option>-->
|
||||
<!--<option value="4">Cost Estimation</option>-->
|
||||
<!--<option value="5">Forensic Investigation</option>-->
|
||||
</select>
|
||||
<!--<input type="number" class="form-control cell" [value]="poDetail.serviceTypeId" #serviceTypeId>-->
|
||||
</td>
|
||||
<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="+poDetail.qty" (change)="onSelectedCellChange(i, 'qty', qty.value); onSelectedCellChange(i, 'remainingQty', qty.value * fee.value); updateEditContractAmt();" #qty></td>
|
||||
<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="+poDetail.fee" (change)="onSelectedCellChange(i, 'fee', fee.value); onSelectedCellChange(i, 'remainingQty', qty.value * fee.value); updateEditContractAmt();" #fee></td>
|
||||
<!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="poDetail.remainingQty" [id]="'remainingQty' + i"></td>-->
|
||||
</tr>
|
||||
</tbody>
|
||||
<tr class="p-0 m-0">
|
||||
<td class="p-1 m-0">
|
||||
<button class="btn btn-success" type="button"
|
||||
(click)="pushOntoSelectedDetail(selectedPODetail.length + 1, ponum.value, '', '1', '1', 1, 0, 0)">
|
||||
<!--(click)="pushOntoSelectedDetail(selectedPODetail[selectedPODetail.length-1].lineItemNo + 1, selected.ponum, serviceDesc.value,-->
|
||||
<!--feeTypeId.value, serviceTypeId.value, qty.value, fee.value, 0)">-->
|
||||
+</button>
|
||||
</td>
|
||||
<!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="''" #serviceDesc></td>-->
|
||||
<!--<td class="p-0 m-0">-->
|
||||
<!--<select class="form-control cell" [value]="1" #feeTypeId>-->
|
||||
<!--<option value="1">Fixed Fee</option>-->
|
||||
<!--<option value="2">Hourly</option>-->
|
||||
<!--</select>-->
|
||||
<!--</td>-->
|
||||
<!--<td class="p-0 m-0">-->
|
||||
<!--<select class="form-control cell" [value]="1" #serviceTypeId>-->
|
||||
<!--<option value="1">Study</option>-->
|
||||
<!--<option value="2">Design</option>-->
|
||||
<!--<option value="3">Peer Review</option>-->
|
||||
<!--<option value="4">Cost Estimation</option>-->
|
||||
<!--<option value="5">Forensic Investigation</option>-->
|
||||
<!--</select>-->
|
||||
<!--</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>-->
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-success" type="button"
|
||||
[disabled]="!(ponum.value && podate.value && contractnum.value && contractamt.value)"
|
||||
(click)="editPo(projNum.value, ponum.value, podate.value, contractnum.value, contractamt.value, title.value, edit)"
|
||||
>
|
||||
Update
|
||||
</button>
|
||||
<button class="btn btn-outline-danger" (click)="close(edit)">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="!selected">
|
||||
<div class="modal-body">
|
||||
Choose a Sales Order First!
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-success" type="button"
|
||||
[disabled]="true"
|
||||
>
|
||||
Update
|
||||
</button>
|
||||
<button class="btn btn-outline-danger" (click)="close(edit)">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</app-modal-form>
|
||||
|
|
|
@ -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<SalesOrderComponent>;
|
||||
|
||||
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<SalesOrderComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ SalesOrderComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SalesOrderComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user