added some files

This commit is contained in:
Akash Shah 2018-09-15 22:23:15 -04:00
parent d06eb1008e
commit 77325a02fd
8 changed files with 608 additions and 392 deletions

View File

@ -1 +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;
}

View File

@ -100,7 +100,7 @@
<td style="width: 25%">
<div class="input-group">
<input type="number" class="form-control" placeholder="12345" #inZIP>
<input type="number" class="form-control" placeholder="6789" #inZIP4>
<input type="number" class="form-control" placeholder="(+4)" #inZIP4>
</div>
</td>
</tr>
@ -212,7 +212,7 @@
<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="6789" #inZIP4 [value]="selected.ziplast4">
<input type="number" class="form-control" placeholder="(+4)" #inZIP4 [value]="selected.ziplast4">
</div>
</td>
</tr>

View File

@ -12,3 +12,15 @@
.cell:focus {
outline: none;
}
::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;
}

View File

@ -56,30 +56,106 @@
<div class="modal-body" *ngIf="chosenInv">
<p class="h4 text-right">General</p>
<hr>
<div class="input-group mb-3">
<div class="input-group-prepend">
<table class="table table-borderless table-sm">
<tbody>
<tr>
<td style="width: 1%">
<span class="input-group-text">Customer </span>
</td>
<td>
<select class="custom-select" (change)="customerDropdownChange(customerSelec.value)"
#customerSelec disabled>
<!--[value]="chosenInv.customerName"-->
<option [value]="-1">Choose Customer...</option>
<option *ngFor="let customer of customers; let i = index;" [value]="i">{{customer.customerName}}
</option>
</select>
</td>
<td style="width: 5%"></td>
<td style="width: 10%">
<span class="input-group-text">SO Number*</span>
</td>
<td>
<input type="text" class="form-control" [value]="chosenInv.poNum" #poNumIn disabled>
<!--<select class="custom-select" (change)="poDropdownChange(poNumIn.value)"-->
<!--[value]="chosenInv.poNum" #poNumIn disabled>-->
<!--<option>Choose Sales Order...</option>-->
<!--<option *ngFor="let po of correspondingPos;" [value]="po.ponum">{{po.ponum}}</option>-->
<!--</select>-->
</td>
</tr>
<!--add1, add2, billToDept, city, customerId, customerName, email, fax, phone, state, zip, ziplast4-->
<tr>
<td colspan="2">
<p *ngIf="customerSelec.value >= 0" class="p-0 m-0 mt-2">
To, {{customers[customerSelec.value].billToDept}}
</p>
</td>
<td></td>
<td>
<span class="input-group-text">Invoice Number*</span>
</div>
<input type="text" class="form-control" #inNumIn [value]="chosenInv.invoiceNumber">
<div class="input-group-prepend">
<span class="input-group-text">PO Number*</span>
</div>
<input type="text" class="form-control" [disabled]="true" #poNumIn [value]="chosenInv.poNum">
<div class="input-group-prepend">
</td>
<td>
<input type="text" class="form-control" [value]="chosenInv.invoiceNumber" #inNumIn disabled>
</td>
</tr>
<tr>
<td colspan="2">
<p *ngIf="customerSelec.value >= 0" class="p-0 m-0 mt-2">
{{customers[customerSelec.value].add1}} {{customers[customerSelec.value].add2}}
</p>
</td>
<td></td>
<td>
<span class="input-group-text">Change Order Num</span>
</div>
<input type="text" class="form-control" #coNumIn [value]="chosenInv.changeOrderNum">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
</td>
<td>
<input type="text" class="form-control" [value]="chosenInv.changeOrderNum" #coNumIn>
</td>
</tr>
<tr>
<td colspan="2">
<p *ngIf="customerSelec.value >= 0" class="p-0 m-0 mt-2">
{{customers[customerSelec.value].city}} {{customers[customerSelec.value].state}} {{customers[customerSelec.value].zip}}-{{customers[customerSelec.value].ziplast4}}
</p>
</td>
<td></td>
<td>
<span class="input-group-text">Payment Status*</span>
</div>
</td>
<td>
<select class="custom-select" [value]="chosenInv.pmtStatus" #pmtStatusIn>
<option value=0>Not Paid</option>
<option value=1>Paid</option>
</select>
</div>
</td>
</tr>
</tbody>
</table>
<!--<div class="input-group mb-3">-->
<!--<div class="input-group-prepend">-->
<!--<span class="input-group-text">Invoice Number*</span>-->
<!--</div>-->
<!--<input type="text" class="form-control" #inNumIn [value]="chosenInv.invoiceNumber">-->
<!--<div class="input-group-prepend">-->
<!--<span class="input-group-text">PO Number*</span>-->
<!--</div>-->
<!--<input type="text" class="form-control" [disabled]="true" #poNumIn [value]="chosenInv.poNum">-->
<!--<div class="input-group-prepend">-->
<!--<span class="input-group-text">Change Order Num</span>-->
<!--</div>-->
<!--<input type="text" class="form-control" #coNumIn [value]="chosenInv.changeOrderNum">-->
<!--</div>-->
<!--<div class="input-group mb-3">-->
<!--<div class="input-group-prepend">-->
<!--<span class="input-group-text">Payment Status*</span>-->
<!--</div>-->
<!--<select class="custom-select" [value]="chosenInv.pmtStatus" #pmtStatusIn>-->
<!--<option value=0>Not Paid</option>-->
<!--<option value=1>Paid</option>-->
<!--</select>-->
<!--</div>-->
</div>
<!--Detials-->
@ -103,33 +179,66 @@
<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="inDet.lineItemNum" disabled>
</td>
<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="inDet.desc"
(change)="onNewCellChange(i, 'desc', desc.value)" #desc></td>
(change)="onSelectedCellChange(i, 'desc', desc.value)" #desc></td>
<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="feeTypes[inDet.feeTypeId - 1]"
disabled></td>
<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="inDet.fee"
(change)="onNewCellChange(i, 'fee', fee.value); updateNewBillAmt();" #fee>
(change)="onSelectedCellChange(i, 'fee', fee.value); updateSelectedBillAmt()" #fee>
</td>
<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="inDet.qty"
(change)="onNewCellChange(i, 'qty', qty.value); updateNewBillAmt();" #qty>
[step]="inDet.remainingQty / 100"
(change)="onSelectedCellChange(i, 'qty', qty.value); updateSelectedBillAmt()" #qty>
</td>
</tr>
<tr class="p-0 m-0">
<tr class="p-0 m-0" *ngIf="inDet.poLineItemNum != -1" >
<th class="align-content-center">
<p>{{getPerc(fee.value * qty.value, inDet.remainingQty)}}%</p>
<p>{{getPerc(qty.value, inDet.remainingQty)}}%</p>
</th>
<td colspan="4">
<div class="progress" style="height: 25px;">
<div class="progress-bar bg-success" role="progressbar"
[ngStyle]="{'width': getPerc(fee.value * qty.value, inDet.remainingQty) + '%'}">
${{fee.value * qty.value}}
[ngStyle]="{'width': getPerc(qty.value, inDet.remainingQty) + '%'}">
{{qty.value}}
</div>
<div class="progress-bar bg-danger" role="progressbar"
[ngStyle]="{'width': (100 - getPerc(fee.value * qty.value, inDet.remainingQty)) + '%'}">
${{inDet.remainingQty - (fee.value * qty.value)}}
[ngStyle]="{'width': (100 - getPerc(qty.value, inDet.remainingQty)) + '%'}">
{{inDet.remainingQty - (qty.value)}}
</div>
</div>
</td>
</tr>
<!--<tr class="p-0 m-0">-->
<!--&lt;!&ndash;INV Detail Items: invoiceNum, lineItemNum, poLineItemNum, serviceTypeId, desc, qty, fee&ndash;&gt;-->
<!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="inDet.lineItemNum" disabled>-->
<!--</td>-->
<!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="inDet.desc"-->
<!--(change)="onNewCellChange(i, 'desc', desc.value)" #desc></td>-->
<!--<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="feeTypes[inDet.feeTypeId - 1]"-->
<!--disabled></td>-->
<!--<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="inDet.fee"-->
<!--(change)="onNewCellChange(i, 'fee', fee.value); updateNewBillAmt();" #fee>-->
<!--</td>-->
<!--<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="inDet.qty"-->
<!--(change)="onNewCellChange(i, 'qty', qty.value); updateNewBillAmt();" #qty>-->
<!--</td>-->
<!--</tr>-->
<!--<tr class="p-0 m-0">-->
<!--<th class="align-content-center">-->
<!--<p>{{getPerc(fee.value * qty.value, inDet.remainingQty)}}%</p>-->
<!--</th>-->
<!--<td colspan="4">-->
<!--<div class="progress" style="height: 25px;">-->
<!--<div class="progress-bar bg-success" role="progressbar"-->
<!--[ngStyle]="{'width': getPerc(fee.value * qty.value, inDet.remainingQty) + '%'}">-->
<!--${{fee.value * qty.value}}-->
<!--</div>-->
<!--<div class="progress-bar bg-danger" role="progressbar"-->
<!--[ngStyle]="{'width': (100 - getPerc(fee.value * qty.value, inDet.remainingQty)) + '%'}">-->
<!--${{inDet.remainingQty - (fee.value * qty.value)}}-->
<!--</div>-->
<!--</div>-->
<!--</td>-->
<!--</tr>-->
</tbody>
<tbody>
<tr>
@ -161,7 +270,7 @@
</div>
</div>
<!--Footer-->
<!--Invoice Footer-->
<div class="modal-body" *ngIf="chosenInv">
<p class="h4 text-right">Footer</p>
<hr>
@ -185,6 +294,7 @@
<p>Choose an Invoice First!</p>
</div>
<!--Modal Footer-->
<div class="modal-footer">
<button type="button" class="btn btn-success"
(click)="editInvoice(inNumIn.value, poNumIn.value, coNumIn.value, pmtStatusIn.value, notesIn.value, certIn.value)"
@ -300,14 +410,14 @@
<td class="p-0 m-0"><input type="text" class="form-control cell" [value]="feeTypes[inDet.feeTypeId - 1]"
disabled></td>
<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="inDet.fee"
(change)="onNewCellChange(i, 'fee', fee.value); updateNewBillAmt();" #fee disabled>
(change)="onNewCellChange(i, 'fee', fee.value); updateNewBillAmt();" #fee>
</td>
<td class="p-0 m-0"><input type="number" class="form-control cell" [value]="inDet.qty"
[step]="inDet.remainingQty / 100"
(change)="onNewCellChange(i, 'qty', qty.value); updateNewBillAmt();" #qty>
</td>
</tr>
<tr class="p-0 m-0">
<tr class="p-0 m-0" *ngIf="inDet.poLineItemNum != -1">
<th class="align-content-center">
<p>{{getPerc(qty.value, inDet.remainingQty)}}%</p>
</th>
@ -331,11 +441,13 @@
<select class="custom-select"
(change)="pushOntoNewDetail(inNumIn.value, newInDetails.length + 1, poDetails[poDetSelec.value].lineItemNo,
poDetails[poDetSelec.value].feeTypeId, poDetails[poDetSelec.value].serviceTypeId,
poDetails[poDetSelec.value].serviceDesc, 0, poDetails[poDetSelec.value].fee, poDetails[poDetSelec.value].remainingQty)"
poDetails[poDetSelec.value].serviceDesc, 0, poDetails[poDetSelec.value].fee, poDetails[poDetSelec.value].remainingQty,
poNumIn.value)"
[disabled]="!poDetails.length"
#poDetSelec>
<option>Choose PO Detail...</option>
<option *ngFor="let po of poDetails; let i = index;" [value]="i">{{po.serviceDesc}}</option>
<option [value]="-1">Out of Pocket Expenses</option>
</select>
</td>
</tr>
@ -398,23 +510,22 @@
</tr>
</tbody>
</table>
</div>
<!--Invoice Footer-->
<div class="modal-body">
<p class="h4 text-right">Footer</p>
<hr>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Special Notes*</span>
<span class="input-group-text">Notes:</span>
</div>
<textarea class="form-control" #notesIn></textarea>
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Certification*</span>
<span class="input-group-text">Certification:</span>
</div>
<textarea class="form-control"
[value]="'Certified that the above items and rates are in accordance with the contractual agreement as verified by the undersigned'"
@ -423,6 +534,7 @@
</div>
</div>
<!--Modal Footer-->
<div class="modal-footer">
<button type="button" class="btn btn-success"
(click)="addInvoice(inNumIn.value, poNumIn.value, coNumIn.value, pmtStatusIn.value, newBillAmt, notesIn.value, certIn.value, 1, new)"

View File

@ -1,5 +1,6 @@
import {Component, OnInit, ViewChild} from '@angular/core';
import {AstuteClientService} from '../services/astute-client-service';
declare var $: any;
@Component({
@ -30,7 +31,7 @@ export class InvoiceComponent implements OnInit {
newInDetails = [];
newBillAmt = 0;
selectedInDetails = [];
selectedBillAmt;
selectedBillAmt = 0;
poDetails = [];
selectedPODetails = [];
@ -45,9 +46,14 @@ export class InvoiceComponent implements OnInit {
rowSelection: 'single',
// EVENTS - add event callback handlers
onRowClicked: (event) => { this.getSelectedRows() },
onColumnResized: function(event) { console.log('a column was resized'); },
onGridReady: (event) => {},
onRowClicked: (event) => {
this.getSelectedRows()
},
onColumnResized: function (event) {
console.log('a column was resized');
},
onGridReady: (event) => {
},
// this.agGrid.sizeColumnsToFit();
// 1: draft
// 2: submitted
@ -66,9 +72,15 @@ export class InvoiceComponent implements OnInit {
// '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},
'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}
@ -99,7 +111,17 @@ export class InvoiceComponent implements OnInit {
// 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!");
}
@ -140,8 +162,6 @@ export class InvoiceComponent implements OnInit {
});
}
onSelectedCellChange(row: number, col: string, value) {
this.selectedInDetails[row][col] = value;
console.log(this.selectedInDetails);
@ -159,12 +179,12 @@ export class InvoiceComponent implements OnInit {
'poLineItemNum': poLineItemNum,
'serviceTypeId': serviceTypeId,
'desc': desc,
'qty': qty,
'fee': fee,
'qty': +qty,
'fee': +fee
});
}
pushOntoNewDetail(invoiceNum, lineItemNum, poLineItemNum, feeTypeId, serviceTypeId, desc, qty, fee, remainingQty) {
pushOntoNewDetail(invoiceNum, lineItemNum, poLineItemNum, feeTypeId, serviceTypeId, desc, qty, fee, remainingQty, poNum) {
this.newInDetails.push({
'invoiceNum': invoiceNum,
'lineItemNum': lineItemNum,
@ -174,7 +194,8 @@ export class InvoiceComponent implements OnInit {
'desc': desc,
'qty': +qty,
'fee': +fee,
'remainingQty' : +remainingQty
'remainingQty': +remainingQty,
'poNum': poNum
});
console.log(this.newInDetails);
}
@ -187,6 +208,15 @@ export class InvoiceComponent implements OnInit {
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');
}
@ -196,12 +226,22 @@ export class InvoiceComponent implements OnInit {
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!");
}
@ -301,22 +341,53 @@ export class InvoiceComponent implements OnInit {
this.addInvoiceDetail(this.newInDetails);
ref.close();
} else {
alert ("Invoice Creation Failed, Check Input Fields")
alert('Invoice Creation Failed, Check Input Fields');
}
});
}
addInvoiceDetail(details) {
if (details.length) {
console.log(details[0]);
// 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");
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 = [];
}

View File

@ -12,3 +12,15 @@
.cell:focus {
outline: none;
}
::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;
}

View File

@ -158,7 +158,7 @@
<div class="modal-footer">
<button class="btn btn-success" type="button"
[disabled]="!(ponum.value && podate.value && customerid.value >= 0 && contractnum.value && contractamt.value)"
[disabled]="!(ponum.value && podate.value && customerid.value && contractnum.value && contractamt.value)"
(click)="addPo(projNum.value, ponum.value, podate.value, customerid.value, contractnum.value, contractamt.value, title.value, new)"
>
Add
@ -182,7 +182,7 @@
<tr>
<td><span class="input-group-text">Customer</span></td>
<td colspan="3">
<select class="form-control" [value]="+selected.customerId" disabled="true" #customerid>
<select class="form-control" [value]="selected.customerId" disabled="true" #customerid>
<option [value]="-1">No Customer</option>
<option *ngFor="let customer of customers" [value]="customer.customerId">{{customer.customerName}}</option>
</select>