AI Total fileds changes

This commit is contained in:
gandhimathi 2019-02-11 15:08:53 +05:30
parent 1aa533a552
commit f01a97005a
15 changed files with 129 additions and 8 deletions

View File

@ -11,27 +11,35 @@
</button>
</div>
</div>
<div class="example-container mat-elevation-z8">
<div class="example-container mat-elevation-z8" *ngIf="businessItemSource.data.length>0">
<table mat-table [dataSource]="businessItemSource">
<ng-container matColumnDef="buiness_expense" sticky>
<th mat-header-cell *matHeaderCellDef> Buiness Expense </th>
<td mat-cell *matCellDef="let element"> {{element.expense_item}} </td>
<td mat-footer-cell *matFooterCellDef> Total of Expense</td>
</ng-container>
<ng-container matColumnDef="expense_value">
<th mat-header-cell *matHeaderCellDef> Amount (Rs) </th>
<td mat-cell *matCellDef="let element"> {{element.expense_value}} </td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<ng-container matColumnDef="frequency">
<th mat-header-cell *matHeaderCellDef> Frequency </th>
<td mat-cell *matCellDef="let element">{{element.frequency_name}}
</td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<ng-container matColumnDef="annual_expenses">
<th mat-header-cell *matHeaderCellDef> Annual Expenses </th>
<td mat-cell *matCellDef="let element">{{element.annual_expenses_value}}
</td>
<td mat-footer-cell *matFooterCellDef> {{getTotalCost(businessItemSource.data)}} </td>
</ng-container>
<ng-container matColumnDef="action" stickyEnd>
<th mat-header-cell *matHeaderCellDef></th>
@ -43,10 +51,13 @@
<mat-icon>delete</mat-icon>
</button>
</td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky:true"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
<tr mat-footer-row *matFooterRowDef="displayedColumns; sticky:true"></tr>
</table>
</div>
</mat-card-content>

View File

@ -27,4 +27,8 @@
.mat-table-sticky:last-child {
border-left: 1px solid #e0e0e0;
}
.mat-footer-cell {
font-weight: bold;
font-size: 1.2rem !important;
}

View File

@ -78,7 +78,13 @@ removeExpenseItem(value: any) : void{
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
});
}
// sum all annual expense values
getTotalCost(getItems:any) {
return getItems.map(t => t.annual_expenses_value).reduce((acc, value) => acc + Number(value), 0);
}
// detect chnges from parent
ngOnChanges(changes: SimpleChanges) {

View File

@ -11,27 +11,35 @@
</button>
</div>
</div>
<div class="example-container mat-elevation-z8">
<div class="example-container mat-elevation-z8" *ngIf="houseItemSource.data.length>0">
<table mat-table [dataSource]="houseItemSource">
<ng-container matColumnDef="buiness_particulars" sticky>
<th mat-header-cell *matHeaderCellDef> Expense Particulars </th>
<td mat-cell *matCellDef="let element"> {{element.expense_item}} </td>
<td mat-footer-cell *matFooterCellDef> Total of Expenses</td>
</ng-container>
<ng-container matColumnDef="expense_value">
<th mat-header-cell *matHeaderCellDef> Amount (Rs) </th>
<td mat-cell *matCellDef="let element"> {{element.expense_value}} </td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<ng-container matColumnDef="frequency">
<th mat-header-cell *matHeaderCellDef> Frequency </th>
<td mat-cell *matCellDef="let element">{{element.frequency_name}}
</td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<ng-container matColumnDef="annual_expenses">
<th mat-header-cell *matHeaderCellDef> Annual Expenses </th>
<td mat-cell *matCellDef="let element">{{element.annual_expense_value}}
</td>
<td mat-footer-cell *matFooterCellDef> {{getTotalCost(houseItemSource.data)}} </td>
</ng-container>
<ng-container matColumnDef="action" stickyEnd>
<th mat-header-cell *matHeaderCellDef></th>
@ -43,10 +51,14 @@
<mat-icon>delete</mat-icon>
</button>
</td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky:true"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
<tr mat-footer-row *matFooterRowDef="displayedColumns; sticky:true"></tr>
</table>
</div>
</mat-card-content>

View File

@ -27,4 +27,8 @@
.mat-table-sticky:last-child {
border-left: 1px solid #e0e0e0;
}
.mat-footer-cell {
font-weight: bold;
font-size: 1.2rem !important;
}

View File

@ -81,6 +81,11 @@ removeHouseItem(value: any) : void{
});
}
// sum all house hold values
getTotalCost(getItems:any) {
return getItems.map(t => t.annual_expense_value).reduce((acc, value) => acc + Number(value), 0);
}
// detect chnges from parent
ngOnChanges(changes: SimpleChanges) {

View File

@ -11,27 +11,35 @@
</button>
</div>
</div>
<div class="example-container mat-elevation-z8">
<div class="example-container mat-elevation-z8" *ngIf="businessIncomeItemSource.data.length>0">
<table mat-table [dataSource]="businessIncomeItemSource">
<ng-container matColumnDef="buiness_income" sticky>
<th mat-header-cell *matHeaderCellDef> Buiness Income </th>
<td mat-cell *matCellDef="let element"> {{element.business_income_item}} </td>
<td mat-footer-cell *matFooterCellDef> Total of Income</td>
</ng-container>
<ng-container matColumnDef="income_value">
<th mat-header-cell *matHeaderCellDef> Amount (Rs) </th>
<td mat-cell *matCellDef="let element"> {{element.income_value}} </td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<ng-container matColumnDef="frequency">
<th mat-header-cell *matHeaderCellDef> Frequency </th>
<td mat-cell *matCellDef="let element">{{element.frequency_name}}
</td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<ng-container matColumnDef="annual_income">
<th mat-header-cell *matHeaderCellDef> Annual Income </th>
<td mat-cell *matCellDef="let element">{{element.annual_income_value}}
</td>
<td mat-footer-cell *matFooterCellDef> {{getTotalCost(businessIncomeItemSource.data)}} </td>
</ng-container>
<ng-container matColumnDef="action" stickyEnd>
<th mat-header-cell *matHeaderCellDef></th>
@ -43,10 +51,14 @@
<mat-icon>delete</mat-icon>
</button>
</td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky:true"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
<tr mat-footer-row *matFooterRowDef="displayedColumns; sticky:true"></tr>
</table>
</div>
</mat-card-content>

View File

@ -27,4 +27,8 @@
.mat-table-sticky:last-child {
border-left: 1px solid #e0e0e0;
}
.mat-footer-cell {
font-weight: bold;
font-size: 1.2rem !important;
}

View File

@ -79,6 +79,11 @@ removeIncomeItem(value: any) : void{
});
}
// sum all annual income values
getTotalCost(getItems:any) {
return getItems.map(t => t.annual_income_value).reduce((acc, value) => acc + Number(value), 0);
}
// detect chnges from parent
ngOnChanges(changes: SimpleChanges) {
this.businessIncomeItemSource.data = changes.parentData.currentValue;

View File

@ -11,38 +11,50 @@
</button>
</div>
</div>
<div class="example-container mat-elevation-z8">
<div class="example-container mat-elevation-z8" *ngIf="purchaseItemSource.data.length>0;">
<table mat-table [dataSource]="purchaseItemSource">
<ng-container matColumnDef="raw_material" sticky>
<th mat-header-cell *matHeaderCellDef> Raw Material/Trading Item </th>
<td mat-cell *matCellDef="let element"> {{element.purchase_item}} </td>
<td mat-footer-cell *matFooterCellDef> Total of Purchase</td>
</ng-container>
<ng-container matColumnDef="purchase_quantity">
<th mat-header-cell *matHeaderCellDef> Purchase Quantity </th>
<td mat-cell *matCellDef="let element"> {{element.purchase_qty}} </td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<ng-container matColumnDef="UOM">
<th mat-header-cell *matHeaderCellDef> UOM </th>
<td mat-cell *matCellDef="let element"> {{element.uom_name}} </td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<ng-container matColumnDef="rate_per_unit_purchase">
<th mat-header-cell *matHeaderCellDef> Rate/Unit of Purchase </th>
<td mat-cell *matCellDef="let element"> {{element.rate_per_unit}} </td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<ng-container matColumnDef="frequency">
<th mat-header-cell *matHeaderCellDef> Frequency </th>
<td mat-cell *matCellDef="let element">{{element.frequency_name}}
</td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<ng-container matColumnDef="annual_purchase">
<th mat-header-cell *matHeaderCellDef> Annual Purchase </th>
<td mat-cell *matCellDef="let element">{{element.annual_purchase_value}}
</td>
<td mat-footer-cell *matFooterCellDef> {{getTotalCost(purchaseItemSource.data)}} </td>
</ng-container>
<ng-container matColumnDef="action" stickyEnd>
<th mat-header-cell *matHeaderCellDef></th>
@ -54,10 +66,14 @@
<mat-icon>delete</mat-icon>
</button>
</td>
<td mat-footer-cell *matFooterCellDef></td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky:true"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
<tr mat-footer-row *matFooterRowDef="displayedColumns; sticky:true"></tr>
</table>
</div>
</mat-card-content>

View File

@ -27,4 +27,8 @@
.mat-table-sticky:last-child {
border-left: 1px solid #e0e0e0;
}
.mat-footer-cell {
font-weight: bold;
font-size: 1.2rem !important;
}

View File

@ -79,6 +79,10 @@ removePurchaseItem(value: any) : void{
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
});
}
// sum all annual Purchase values
getTotalCost(getItems:any) {
return getItems.map(t => t.annual_purchase_value).reduce((acc, value) => acc + Number(value), 0);
}
// do check component bases
ngDoCheck() {

View File

@ -14,53 +14,70 @@
</button>
</div>
</div>
<div class="example-container mat-elevation-z8">
<div class="example-container mat-elevation-z8" *ngIf="salesItemSource.data.length>0;">
<table mat-table [dataSource]="salesItemSource">
<ng-container matColumnDef="product_services" sticky>
<th mat-header-cell *matHeaderCellDef> Product/Services </th>
<td mat-cell *matCellDef="let element"> {{element.sales_item}} </td>
<td mat-footer-cell *matFooterCellDef> Total of Sales </td>
</ng-container>
<ng-container matColumnDef="sale_quantity">
<th mat-header-cell *matHeaderCellDef> Sale Quantity </th>
<td mat-cell *matCellDef="let element"> {{element.sales_qty}} </td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<ng-container matColumnDef="UOM">
<th mat-header-cell *matHeaderCellDef> UOM </th>
<td mat-cell *matCellDef="let element"> {{element.uom_name}} </td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<ng-container matColumnDef="rate_per_unit_sale">
<th mat-header-cell *matHeaderCellDef> Rate/Unit of Sale </th>
<td mat-cell *matCellDef="let element"> {{element.rate_per_unit}} </td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<ng-container matColumnDef="frequency">
<th mat-header-cell *matHeaderCellDef> Frequency </th>
<td mat-cell *matCellDef="let element">{{element.frequency_name}}
</td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<ng-container matColumnDef="annual_sales">
<th mat-header-cell *matHeaderCellDef> Annual Sales </th>
<td mat-cell *matCellDef="let element">{{element.annual_sale_value}}
</td>
<td mat-footer-cell *matFooterCellDef> {{getTotalCost(salesItemSource.data)}} </td>
</ng-container>
<ng-container matColumnDef="margin_percentage" *ngIf="activateMariginCalculation===true">
<th mat-header-cell *matHeaderCellDef> Margin Percentage % </th>
<td mat-cell *matCellDef="let element">{{element.margin_per}}
</td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<ng-container matColumnDef="margin_amount" *ngIf="activateMariginCalculation===true">
<th mat-header-cell *matHeaderCellDef> Margin Amount </th>
<td mat-cell *matCellDef="let element">{{element.margin_per_uom}}
</td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<ng-container matColumnDef="final_value" *ngIf="activateMariginCalculation===true">
<th mat-header-cell *matHeaderCellDef> Final Value </th>
<td mat-cell *matCellDef="let element">{{element.margin_final_value}}
</td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
@ -74,12 +91,17 @@
<mat-icon>delete</mat-icon>
</button>
</td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky:true"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
<tr mat-footer-row *matFooterRowDef="displayedColumns; sticky:true"></tr>
</table>
</div>
</div>
</mat-card-content>
</mat-card>

View File

@ -27,4 +27,9 @@
.mat-table-sticky:last-child {
border-left: 1px solid #e0e0e0;
}
}
.mat-footer-cell {
font-weight: bold;
font-size: 1.2rem !important;
}

View File

@ -97,7 +97,14 @@ ngDoCheck() {
this.displayedColumns = ['product_services','sale_quantity','UOM','rate_per_unit_sale','frequency','annual_sales','action'];
}
}}
}
}
// sum all annual sale values
getTotalCost(getItems:any) {
return getItems.map(t => t.annual_sale_value).reduce((acc, value) => acc + Number(value), 0);
}
// detect chnges from parent
// ngOnChanges(changes: SimpleChanges) {