AI changes

This commit is contained in:
gandhimathi 2019-03-13 11:19:15 +05:30
parent 42a7843ff9
commit 920727fe58
38 changed files with 282 additions and 214 deletions

View File

@ -11,22 +11,23 @@
<mat-dialog-content>
<mat-card>
<mat-card-content formArrayName="busExpense">
<div fxLayout="row wrap" *ngFor="let item of businessItemForm.controls.busExpense['controls']; let s = index;" [formGroupName]="s">
<div fxLayout="row wrap" *ngFor="let item of businessItemForm.controls.busExpense['controls']; let s = index;" [formGroupName]="s" style="margin-top: 4%;">
<div fxFlex="100">
<mat-form-field style="width: 87%">
<mat-select placeholder="Business Expense" formControlName="expense_item_id" required>
<mat-option *ngFor="let expense of businessExpenseData" [value]="expense.expense_item_id">{{expense.expense_item}}</mat-option>
</mat-select>
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeItem(s)" *ngIf="s>0"
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeItem(s)" *ngIf="businessItemForm.value.busExpense.length>1"
matTooltip="Remove Business Expense Item" matTooltipPosition="above">
<mat-icon>delete</mat-icon>
</button>
</div>
<div class="item-margin" fxFlex="100">
<mat-form-field style="width: 25%">
<input OnlyNumber type="text" matInput placeholder="Amount (Rs)" (keyup)="businessCalculation(s,item.value);inWords($event.target.value,s,1)" formControlName="expense_value" required>
<mat-hint align="start" style="font-size:90%" *ngIf="item.get('expense_value').value != ''">{{"&#8377;"}} {{Amount[s]}} Only</mat-hint>
<input OnlyNumber type="text" matInput placeholder="Amount (Rs)" (keyup)="businessCalculation(s,item.value)" formControlName="expense_value" required>
<mat-hint align="start" style="font-size:90%" *ngIf="item.value.expense_value != ''">{{"&#8377;"}} {{item.value.expense_value | numberToWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width: 25%">
<mat-select placeholder="Frequency" formControlName="fk_frequency_id" (selectionChange)="businessCalculation(s,item.value)" required>
@ -35,8 +36,15 @@
</mat-form-field>
<mat-form-field style="width: 25%">
<input matInput OnlyNumber type="text" placeholder="Annual Expenses" formControlName="annual_expenses_value" readonly>
<mat-hint align="start" style="font-size:90%" *ngIf="item.value.annual_expenses_value != ''">{{"&#8377;"}} {{item.value.annual_expenses_value | numberToWords}} Only</mat-hint>
</mat-form-field>
</div>
<div class="item-margin" fxFlex="100">
<mat-form-field style="width: 88%">
<textarea matInput type="text" placeholder="Remarks" formControlName="comments"></textarea>
</mat-form-field>
</div>
</div>
<div fxLayout="row" *ngIf="data.manage_status==1">

View File

@ -49,6 +49,7 @@ export class ManageBusinesExpenseComponent implements OnInit {
expense_value:['',Validators.compose([Validators.required])],
fk_frequency_id:['',Validators.compose([Validators.required])],
annual_expenses_value:['',Validators.compose([Validators.required])],
comments:[''],
});
}
@ -62,6 +63,7 @@ createBusinessItemWithData(values: any) {
expense_value:[values.expense_value,Validators.compose([Validators.required])],
fk_frequency_id:[values.fk_frequency_id,Validators.compose([Validators.required])],
annual_expenses_value:[values.annual_expenses_value,Validators.compose([Validators.required])],
comments:[values.comments],
});
}
@ -125,15 +127,4 @@ submitDetails(records) {
});
}
/** Amount InWords */
inWords(e,i,flag){
switch(flag){
case 1 :
this.Amount[i] = this._pd.convertNumberToWords(e);
break;
default:
break;
}
}
}

View File

@ -19,33 +19,38 @@
<mat-form-field style="width: 20%" *ngIf="data.margin_calculation_status===true">
<input matInput OnlyNumber type="text" placeholder="Magin Percetage %" formControlName="margin_per" (keyup)="salesCalculation(s,sales.value)">
</mat-form-field>
<mat-form-field style="width: 20%" *ngIf="data.margin_calculation_status===true">
<mat-form-field style="width: 25%" *ngIf="data.margin_calculation_status===true">
<input matInput OnlyNumber type="text" placeholder="Margin Value" formControlName="margin_value" readonly>
<mat-hint align="start" style="font-size:90%" *ngIf="sales.get('margin_value').value != ''">{{"&#8377;"}} {{marginAmtInwords[s]}} Only</mat-hint>
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeProducts(s)" *ngIf="(salesItemForm.controls.sales_product.value | deleteRecordsCount)>1"
<mat-hint align="start" style="font-size:90%" *ngIf="sales.value.margin_value != ''">{{"&#8377;"}} {{sales.value.margin_value | numberToWords}} Only</mat-hint>
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeProducts(s)" *ngIf="salesItemForm.value.sales_product.length>1"
matTooltip="Remove" matTooltipPosition="above">
<mat-icon>delete</mat-icon>
</button>
<mat-form-field style="width: 88%">
<textarea matInput type="text" placeholder="Remarks" formControlName="comments"></textarea>
</mat-form-field>
<div formArrayName="child">
<div class="item-margin" fxLayout="row wrap" *ngFor="let childItem of sales.get('child').controls; let c = index" [formGroupName]="c">
<div fxFlex="100" *ngIf="childItem.value.isactive===true">
<mat-form-field style="width: 25%;">
<mat-form-field style="width: 33%;">
<input matInput [max]="maxDate" [matDatepicker]="picker" formControlName="sales_date" (dateChange)="salesCalculation(s,sales.value)" placeholder="Sales Date" required>
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
<mat-form-field style="width: 25%">
<input OnlyNumber type="text" matInput placeholder="Value" (keyup)="salesCalculation(s,sales.value,sales.value.child);inWords($event.target.value,c,1)" formControlName="sales_value" required>
<mat-hint align="start" style="font-size:90%" *ngIf="childItem.get('sales_value').value != ''">{{"&#8377;"}} {{Value[c]}} Only</mat-hint>
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeDailyItems(s,c,childItem.value)" *ngIf="(sales.value.child | deleteRecordsCount)>1"
<mat-form-field style="width: 50%">
<input OnlyNumber type="text" matInput placeholder="Value" (keyup)="salesCalculation(s,sales.value,sales.value.child)" formControlName="sales_value" required>
<mat-hint align="start" style="font-size:90%" *ngIf="childItem.value.sales_value != ''">{{"&#8377;"}} {{childItem.value.sales_value | numberToWords}} Only</mat-hint>
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeDailyItems(s,c,childItem.value)" *ngIf="sales.value.child.length>1"
matTooltip="Remove" matTooltipPosition="above">
<mat-icon>delete</mat-icon>
</button>
</div>
</div>
</div>
</mat-card-content>
<mat-card-actions align="center">
<button type="button" mat-flat-button (click)="addMoreDailySales(s,sales.value)"

View File

@ -17,5 +17,6 @@
}
.item-margin {
margin-left: 2%;
}
margin-left:4%;
margin-top:2%;
}

View File

@ -10,7 +10,6 @@ import { DeleteRecordsCountPipe } from './../../../../../../../pd-pipes/delete-r
selector: 'app-manage-daily-sales',
templateUrl: './manage-daily-sales.component.html',
styleUrls: ['./manage-daily-sales.component.scss'],
providers: [DeleteRecordsCountPipe],
})
export class ManageDailySalesComponent implements OnInit {
Value: any []=[];
@ -39,12 +38,10 @@ export class ManageDailySalesComponent implements OnInit {
this.salesItemForm = this._fb.group({
sales_product: this._fb.array([this.createSalesItemWithData(this.data.editData)]),
});
this.inWords(this.data.editData.margin_value,0,2);
let control: any = <FormArray>this.salesItemForm.controls['sales_product'];
control = control.controls[0].get('child') as FormArray;
this.data.editData.values.forEach((elementVal,inx) => {
control.push(this.createDailySalesWithData(elementVal,this.data.editData.sim_id))
this.inWords(elementVal.sales_value,inx,1);
});
}
else{
@ -66,6 +63,7 @@ export class ManageDailySalesComponent implements OnInit {
child: this._fb.array([]),
margin_per: [''],
margin_value: [''],
comments: [''],
isactive:[true]
});
}
@ -76,7 +74,7 @@ createDailySalesData(sim_id: string) {
fk_sim_id: [sim_id],
sales_date: [''],
sales_value: ['', Validators.compose([Validators.required])],
isactive:[true]
isactive:[true],
})
}
@ -90,6 +88,7 @@ createSalesItemWithData(values: any) {
child: this._fb.array([]),
margin_per: [this.data.margin_calculation_status===true ? values.margin_per: ''],
margin_value: [this.data.margin_calculation_status===true ? values.margin_value: ''],
comments: [values.comments],
isactive:[true]
});
}
@ -164,7 +163,6 @@ salesCalculation(indexVal: number,values: any): void {
let getTotalValueCounts = transformData.map(val=>val.sales_value)
.reduce((sum, curr) => parseInt(sum) + parseInt(curr));
control.controls[indexVal].controls['margin_value'].setValue(parseInt(getTotalValueCounts) * (parseInt(values.margin_per)/100) * (12 / parseInt(getUniqueMonthCounts.length)));
this.inWords(parseInt(getTotalValueCounts) * (parseInt(values.margin_per)/100) * (12 / parseInt(getUniqueMonthCounts.length)),indexVal,2);
}
else{
control.controls[indexVal].controls['margin_value'].setValue('');
@ -218,16 +216,5 @@ submitDetails(records) {
}
});
}
inWords(e,c,flag){
switch(flag){
case 1 :
this.Value[c] = this._pd.convertNumberToWords(e);
break;
case 2 :
this.marginAmtInwords[c] = this._pd.convertNumberToWords(e);
break;
default : break;
}
}
}

View File

@ -11,21 +11,21 @@
<mat-dialog-content>
<mat-card>
<mat-card-content formArrayName="houseExpense">
<div fxLayout="row wrap" *ngFor="let item of houseItemForm.controls.houseExpense['controls']; let s = index;" [formGroupName]="s">
<div fxLayout="row wrap" *ngFor="let item of houseItemForm.controls.houseExpense['controls']; let s = index;" [formGroupName]="s" style="margin-top: 4%;">
<div fxFlex="100">
<mat-form-field style="width: 87%">
<input type="text" matInput placeholder="Expense Particulars" formControlName="expense_item" required>
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeItem(s)" *ngIf="s>0"
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeItem(s)" *ngIf="houseItemForm.value.houseExpense.length>1"
matTooltip="Remove House Hold Item" matTooltipPosition="above">
<mat-icon>delete</mat-icon>
</button>
</div>
<div class="item-margin" fxFlex="100">
<mat-form-field style="width: 25%">
<input OnlyNumber type="text" matInput placeholder="Amount (Rs)" (keyup)="houseCalculation(s,item.value);inWords($event.target.value,s,1)" formControlName="expense_value" required>
<mat-hint align="start" style="font-size:90%" *ngIf="item.get('expense_value').value != ''">{{"&#8377;"}} {{Amount[s]}} Only</mat-hint>
</mat-form-field>
<input OnlyNumber type="text" matInput placeholder="Amount (Rs)" (keyup)="houseCalculation(s,item.value)" formControlName="expense_value" required>
<mat-hint align="start" style="font-size:90%" *ngIf="item.value.expense_value != ''">{{"&#8377;"}} {{item.value.expense_value | numberToWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width: 25%">
<mat-select placeholder="Frequency" formControlName="fk_frequency_id" (selectionChange)="houseCalculation(s,item.value)" required>
<mat-option *ngFor="let frq of frequencyData" [value]="frq.frequency_id">{{frq.name}}</mat-option>
@ -33,8 +33,15 @@
</mat-form-field>
<mat-form-field style="width: 25%">
<input matInput OnlyNumber type="text" placeholder="Annual Expenses" formControlName="annual_expense_value" readonly>
<mat-hint align="start" style="font-size:90%" *ngIf="item.value.annual_expense_value != ''">{{"&#8377;"}} {{item.value.annual_expense_value | numberToWords}} Only</mat-hint>
</mat-form-field>
</div>
<div class="item-margin" fxFlex="100">
<mat-form-field style="width: 88%">
<textarea matInput type="text" placeholder="Remarks" formControlName="comments"></textarea>
</mat-form-field>
</div>
</div>
<div fxLayout="row" *ngIf="data.manage_status==1">

View File

@ -17,5 +17,6 @@
}
.item-margin {
margin-left: 2%;
margin-left:4%;
margin-top:2%;
}

View File

@ -45,7 +45,8 @@ export class ManageHouseHoldComponent implements OnInit {
expense_item: ['',Validators.compose([Validators.required])],
expense_value: ['',Validators.compose([Validators.required])],
fk_frequency_id: ['',Validators.compose([Validators.required])],
annual_expense_value: ['',Validators.compose([Validators.required])],
annual_expense_value: ['',Validators.compose([Validators.required])],
comments:[],
});
}
@ -58,7 +59,8 @@ createHouseholdItemWithData(values: any) {
expense_item: [values.expense_item,Validators.compose([Validators.required])],
expense_value: [values.expense_value,Validators.compose([Validators.required])],
fk_frequency_id: [values.fk_frequency_id,Validators.compose([Validators.required])],
annual_expense_value: [values.annual_expense_value,Validators.compose([Validators.required])],
annual_expense_value: [values.annual_expense_value,Validators.compose([Validators.required])],
comments:[values.comments],
});
}
@ -121,12 +123,6 @@ submitDetails(records) {
}
});
}
inWords(e,s,flag){
switch(flag){
case 1 :
this.Amount[s] = this._pd.convertNumberToWords(e);
break;
}
}
}

View File

@ -11,22 +11,22 @@
<mat-dialog-content>
<mat-card>
<mat-card-content formArrayName="busIncome">
<div fxLayout="row wrap" *ngFor="let item of businessIncomeItemForm.controls.busIncome['controls']; let s = index;" [formGroupName]="s">
<div fxLayout="row wrap" *ngFor="let item of businessIncomeItemForm.controls.busIncome['controls']; let s = index;" [formGroupName]="s" style="margin-top: 4%;">
<div fxFlex="100">
<mat-form-field style="width: 87%">
<mat-select placeholder="Business Income" formControlName="business_income_id" required>
<mat-option *ngFor="let income of businessIncomeData" [value]="income.business_income_id">{{income.business_income_item}}</mat-option>
</mat-select>
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeItem(s)" *ngIf="s>0"
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeItem(s)" *ngIf="businessIncomeItemForm.value.busIncome.length>1"
matTooltip="Remove Business Income Item" matTooltipPosition="above">
<mat-icon>delete</mat-icon>
</button>
</div>
<div class="item-margin" fxFlex="100">
<mat-form-field style="width: 25%">
<input OnlyNumber type="text" matInput placeholder="Amount (Rs)" (keyup)="businessCalculation(s,item.value);inWords($event.target.value,s,1)" formControlName="income_value" required>
<mat-hint align="start" style="font-size:90%" *ngIf="item.get('income_value').value != ''">{{"&#8377;"}} {{Amount[s]}} Only</mat-hint>
<input OnlyNumber type="text" matInput placeholder="Amount (Rs)" (keyup)="businessCalculation(s,item.value)" formControlName="income_value" required>
<mat-hint align="start" style="font-size:90%" *ngIf="item.value.income_value != ''">{{"&#8377;"}} {{item.value.income_value | numberToWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width: 25%">
<mat-select placeholder="Frequency" formControlName="fk_frequency_id" (selectionChange)="businessCalculation(s,item.value)" required>
@ -35,8 +35,16 @@
</mat-form-field>
<mat-form-field style="width: 25%">
<input matInput OnlyNumber type="text" placeholder="Annual Income" formControlName="annual_income_value" readonly>
<mat-hint align="start" style="font-size:90%" *ngIf="item.value.annual_income_value != ''">{{"&#8377;"}} {{item.value.annual_income_value | numberToWords}} Only</mat-hint>
</mat-form-field>
</div>
<div class="item-margin" fxFlex="100">
<mat-form-field style="width: 88%">
<textarea matInput type="text" placeholder="Remarks" formControlName="comments"></textarea>
</mat-form-field>
</div>
</div>
<div fxLayout="row" *ngIf="data.manage_status==1">

View File

@ -49,6 +49,7 @@ export class ManageOtherBusinessIncomeComponent implements OnInit {
income_value:['',Validators.compose([Validators.required])],
fk_frequency_id:['',Validators.compose([Validators.required])],
annual_income_value:['',Validators.compose([Validators.required])],
comments:[],
});
}
@ -62,6 +63,7 @@ createBusinessIncomeItemWithData(values: any) {
income_value:[values.income_value,Validators.compose([Validators.required])],
fk_frequency_id:[values.fk_frequency_id,Validators.compose([Validators.required])],
annual_income_value:[values.annual_income_value,Validators.compose([Validators.required])],
comments:[values.comments],
});
}
@ -124,14 +126,4 @@ submitDetails(records) {
}
});
}
inWords(e,s,flag){
switch(flag){
case 1 :
this.Amount[s] = this._pd.convertNumberToWords(e);
break;
}
}
}

View File

@ -11,12 +11,12 @@
<mat-dialog-content>
<mat-card>
<mat-card-content formArrayName="purchase">
<div fxLayout="row wrap" *ngFor="let item of purchaseItemForm.controls.purchase['controls']; let s = index;" [formGroupName]="s">
<div fxLayout="row wrap" *ngFor="let item of purchaseItemForm.controls.purchase['controls']; let s = index;" [formGroupName]="s" style="margin-top: 4%;">
<div fxFlex="100">
<mat-form-field style="width: 87%">
<input type="text" matInput placeholder="Raw Material/Trading Item" formControlName="purchase_item" required>
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeItem(s)" *ngIf="s>0"
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeItem(s)" *ngIf="purchaseItemForm.value.purchase.length>1"
matTooltip="Remove Purchase Item" matTooltipPosition="above">
<mat-icon>delete</mat-icon>
</button>
@ -26,25 +26,37 @@
<input OnlyNumber type="text" matInput placeholder="Purchase Quantity" (keyup)="purchaseCalculation(s,item.value)" formControlName="purchase_qty" required>
</mat-form-field>
<mat-form-field style="width: 25%">
<mat-select placeholder="UOM" formControlName="fk_uom_id" required>
<mat-select placeholder="UOM" formControlName="fk_uom_id" (selectionChange)="generateOtherUOM(s,item.value)" required>
<mat-option *ngFor="let uom of UOMData" [value]="uom.uom_id">{{uom.name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 25%">
<input OnlyNumber type="text" matInput placeholder="Rate/Unit of Purchase" formControlName="rate_per_unit" (keyup)="purchaseCalculation(s,item.value);inWords($event.target.value,s,1)" required>
<mat-hint align="start" style="font-size:90%" *ngIf="item.get('rate_per_unit').value != ''">{{"&#8377;"}} {{RateUnitofPurchase[s]}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width: 30%" *ngIf="item.controls['uom_other']">
<input type="text" matInput placeholder="Other UOM" formControlName="uom_other" required>
</mat-form-field>
</div>
<div class="item-margin" fxFlex="100">
<mat-form-field style="width: 25%">
<input OnlyNumber type="text" matInput placeholder="Rate/Unit of Purchase" formControlName="rate_per_unit" (keyup)="purchaseCalculation(s,item.value)" required>
<mat-hint align="start" style="font-size:90%" *ngIf="item.value.rate_per_unit != ''">{{"&#8377;"}} {{item.value.rate_per_unit | numberToWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width: 25%">
<mat-select placeholder="Frequency" formControlName="fk_frequency_id" (selectionChange)="purchaseCalculation(s,item.value)" required>
<mat-option *ngFor="let frq of frequencyData" [value]="frq.frequency_id">{{frq.name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 25%">
<mat-form-field style="width: 30%">
<input matInput OnlyNumber type="text" placeholder="Annual Purchase" formControlName="annual_purchase_value" readonly>
</mat-form-field>
<mat-hint align="start" style="font-size:90%" *ngIf="item.value.annual_purchase_value != ''">{{"&#8377;"}} {{item.value.annual_purchase_value | numberToWords}} Only</mat-hint>
</mat-form-field>
</div>
<div class="item-margin" fxFlex="100">
<mat-form-field style="width: 88%">
<textarea matInput type="text" placeholder="Remarks" formControlName="comments"></textarea>
</mat-form-field>
</div>
</div>

View File

@ -17,5 +17,6 @@
}
.item-margin {
margin-left: 2%;
margin-left:4%;
margin-top:2%;
}

View File

@ -28,6 +28,8 @@ export class ManagePurchaseComponent implements OnInit {
this.purchaseItemForm = this._fb.group({
purchase: this._fb.array([this.createPurchaseItemWithData(this.data.editData)]),
});
let control: any = <FormArray>this.purchaseItemForm.controls['purchase'];
this.data.editData.fk_uom_id=="1" ? control.controls[0].addControl('uom_other', new FormControl(this.data.editData.uom_other ? this.data.editData.uom_other : '', Validators.required)) : control.controls[0].removeControl('uom_other');
}
else{
this.purchaseItemForm = this._fb.group({
@ -50,6 +52,8 @@ export class ManagePurchaseComponent implements OnInit {
rate_per_unit:['',Validators.compose([Validators.required])],
fk_frequency_id:['',Validators.compose([Validators.required])],
annual_purchase_value:['',Validators.compose([Validators.required])],
comments:[],
});
}
@ -65,6 +69,8 @@ createPurchaseItemWithData(values: any) {
rate_per_unit:[values.rate_per_unit,Validators.compose([Validators.required])],
fk_frequency_id:[values.fk_frequency_id,Validators.compose([Validators.required])],
annual_purchase_value:[values.annual_purchase_value,Validators.compose([Validators.required])],
comments:[values.comments],
});
}
@ -96,6 +102,11 @@ removeItem(indexVal: number) : void {
control.removeAt(indexVal);
}
// generate other UOM
generateOtherUOM(index: number, values: any): void {
let control: any = <FormArray>this.purchaseItemForm.controls['purchase'];
values.fk_uom_id=="1" ? control.controls[index].addControl('uom_other', new FormControl('', Validators.required)) : control.controls[index].removeControl('uom_other');
}
// save purchase details
submitDetails(records) {
@ -128,13 +139,4 @@ submitDetails(records) {
});
}
inWords(e,s,flag){
switch(flag){
case 1 :
this.RateUnitofPurchase[s] = this._pd.convertNumberToWords(e);
break;
}
}
}

View File

@ -11,12 +11,12 @@
<mat-dialog-content>
<mat-card>
<mat-card-content formArrayName="salesCalItemwise">
<div fxLayout="row wrap" *ngFor="let sales of salesItemForm.controls.salesCalItemwise['controls']; let s = index;" [formGroupName]="s">
<div fxLayout="row wrap" *ngFor="let sales of salesItemForm.controls.salesCalItemwise['controls']; let s = index;" [formGroupName]="s" style="margin-top: 4%;">
<div fxFlex="100">
<mat-form-field style="width: 87%">
<mat-form-field style="width: 90%">
<input type="text" matInput placeholder="Product/Services" formControlName="sales_item" required>
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeItem(s)" *ngIf="s>0"
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeItem(s)" *ngIf="salesItemForm.value.salesCalItemwise.length>1"
matTooltip="Remove Sales Item" matTooltipPosition="above">
<mat-icon>delete</mat-icon>
</button>
@ -26,25 +26,29 @@
<input OnlyNumber type="text" matInput placeholder="Sale Quantity" (keyup)="salesCalculation(s,sales.value);" formControlName="sales_qty" required>
</mat-form-field>
<mat-form-field style="width: 25%">
<mat-select placeholder="UOM" formControlName="fk_uom_id" required>
<mat-select placeholder="UOM" formControlName="fk_uom_id" required (selectionChange)="generateOtherUOM(s,sales.value)">
<mat-option *ngFor="let uom of UOMData" [value]="uom.uom_id">{{uom.name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 25%">
<input OnlyNumber type="text" matInput placeholder="Rate/Unit of Sale" formControlName="rate_per_unit" (keyup)="salesCalculation(s,sales.value)" required>
<mat-hint align="start" style="font-size:90%" *ngIf="sales.get('rate_per_unit').value != ''">{{"&#8377;"}} {{ratePerUnitAmtInwords[s]}} Only</mat-hint>
<mat-form-field style="width: 30%" *ngIf="sales.controls['uom_other']">
<input type="text" matInput placeholder="Other UOM" formControlName="uom_other" required>
</mat-form-field>
</div>
<div class="item-margin" fxFlex="100">
<mat-form-field style="width: 25%">
<input OnlyNumber type="text" matInput placeholder="Rate/Unit of Sale" formControlName="rate_per_unit" (keyup)="salesCalculation(s,sales.value)" required>
<mat-hint align="start" style="font-size:90%" *ngIf="sales.value.rate_per_unit != ''">{{"&#8377;"}} {{sales.value.rate_per_unit | numberToWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width: 25%">
<mat-select placeholder="Frequency" formControlName="fk_frequency_id" (selectionChange)="salesCalculation(s,sales.value)" required>
<mat-option *ngFor="let frq of frequencyData" [value]="frq.frequency_id">{{frq.name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 54%">
<mat-form-field style="width: 30%">
<input matInput OnlyNumber type="text" placeholder="Annual Sales" formControlName="annual_sale_value" readonly>
<mat-hint align="start" style="font-size:90%" *ngIf="sales.get('annual_sale_value').value != ''">{{"&#8377;"}} {{annualSaleAmtInwords[s]}} Only</mat-hint>
<mat-hint align="start" style="font-size:90%" *ngIf="sales.value.annual_sale_value != ''">{{"&#8377;"}} {{sales.value.annual_sale_value | numberToWords}} Only</mat-hint>
</mat-form-field>
</div>
<div class="item-margin" fxFlex="100" *ngIf="data.margin_calculation_status===true">
@ -53,11 +57,16 @@
</mat-form-field>
<mat-form-field style="width: 25%">
<input matInput OnlyNumber type="text" placeholder="Margin Per Unit" formControlName="margin_per_uom" (keyup)="salesMarginAmtCalculation(s,sales.value)">
<mat-hint align="start" style="font-size:90%" *ngIf="sales.get('margin_per_uom').value != ''">{{"&#8377;"}} {{marginAmtInwords[s]}} Only</mat-hint>
</mat-form-field>
<mat-hint align="start" style="font-size:90%" *ngIf="sales.value.margin_per_uom != ''">{{"&#8377;"}} {{sales.value.margin_per_uom | numberToWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width: 25%">
<input matInput OnlyNumber type="text" placeholder="Considered Margin Amount" formControlName="margin_final_value" readonly>
<mat-hint align="start" style="font-size:90%" *ngIf="sales.get('margin_final_value').value != ''">{{"&#8377;"}} {{marginFinalAmtInwords[s]}} Only</mat-hint>
<mat-hint align="start" style="font-size:90%" *ngIf="sales.value.margin_final_value != ''">{{"&#8377;"}} {{sales.value.margin_final_value | numberToWords}} Only</mat-hint>
</mat-form-field>
</div>
<div class="item-margin" fxFlex="100">
<mat-form-field style="width: 88%">
<textarea matInput type="text" placeholder="Remarks" formControlName="comments"></textarea>
</mat-form-field>
</div>

View File

@ -17,6 +17,7 @@
}
.item-margin {
margin-left: 2%;
margin-left:4%;
margin-top:2%;
}

View File

@ -35,19 +35,8 @@ export class ManageSalesComponent implements OnInit {
this.salesItemForm = this._fb.group({
salesCalItemwise: this._fb.array([this.createSalesItemWithData(this.data.editData)]),
});
let indexforedit = 0
this.inWords(this.data.editData.annual_sale_value,indexforedit,1);
this.inWords(this.data.editData.margin_per_uom,indexforedit,2);
this.inWords(this.data.editData.margin_final_value,indexforedit,3);
this.inWords(this.data.editData.rate_per_unit,indexforedit,4);
// this.data.editData.forEach((val,index) => {
// this.inWords(val.annual_sale_value,index,1);
// this.inWords(val.margin_per_uom,index,2);
// this.inWords(val.margin_final_value,index,3);
// this.inWords(val.rate_per_unit,index,4);
// });
let control: any = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
this.data.editData.fk_uom_id=="1" ? control.controls[0].addControl('uom_other', new FormControl(this.data.editData.uom_other ? this.data.editData.uom_other : '', Validators.required)) : control.controls[0].removeControl('uom_other');
}
else{
@ -74,6 +63,7 @@ export class ManageSalesComponent implements OnInit {
margin_per:[''],
margin_per_uom:[''],
margin_final_value:[''],
comments:[],
});
}
@ -92,6 +82,8 @@ createSalesItemWithData(values: any) {
margin_per:[this.data.margin_calculation_status===true ? values.margin_per : ''],
margin_per_uom:[this.data.margin_calculation_status===true ? values.margin_per_uom :''],
margin_final_value:[this.data.margin_calculation_status===true ? values.margin_final_value: ''],
comments:[values.comments],
});
}
@ -108,15 +100,10 @@ closeDialogue(){
salesCalculation(indexVal: number,values: any): void {
let control:any = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
if(values.rate_per_unit!=''){
this.inWords(values.rate_per_unit,indexVal,4)
}
if(values.sales_qty!='' && values.rate_per_unit!='' && values.fk_frequency_id!='') {
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id);
let AnnualSalesValue = parseInt(values.sales_qty) * parseInt(values.rate_per_unit) * parseInt(filterFrequencyValue[0].mutiple_factor)
control.controls[indexVal].controls['annual_sale_value'].setValue(parseInt(values.sales_qty) * parseInt(values.rate_per_unit) * parseInt(filterFrequencyValue[0].mutiple_factor));
this.inWords(AnnualSalesValue,indexVal,1)
}
else {
control.controls[indexVal].controls['annual_sale_value'].setValue('');
@ -130,7 +117,6 @@ salesMarginPerCalculation(indexVal: number,values: any): void {
control.controls[indexVal].controls['margin_per_uom'].setValue('');
if(values.margin_per!='' && values.annual_sale_value!='') {
control.controls[indexVal].controls['margin_final_value'].setValue(parseInt(values.annual_sale_value) * (parseInt(values.margin_per)/100));
this.inWords(parseInt(values.annual_sale_value) * (parseInt(values.margin_per)/100),indexVal,3)
}
else {
control.controls[indexVal].controls['margin_final_value'].setValue('');
@ -139,14 +125,11 @@ salesMarginPerCalculation(indexVal: number,values: any): void {
salesMarginAmtCalculation(indexVal: number,values: any): void {
let control:any = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
control.controls[indexVal].controls['margin_per'].setValue('');
if(values.margin_per_uom!=''){
this.inWords(values.margin_per_uom,indexVal,2)
}
if(values.margin_per_uom!='' && values.sales_qty!='') {
let MarginFinalValue = parseInt(values.sales_qty) * parseInt(values.margin_per_uom);
control.controls[indexVal].controls['margin_final_value'].setValue(parseInt(values.sales_qty) * parseInt(values.margin_per_uom));
this.inWords(MarginFinalValue,indexVal,3)
}
else {
control.controls[indexVal].controls['margin_final_value'].setValue('');
@ -175,6 +158,11 @@ submitDetails(records) {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
});
}
// generate other UOM
generateOtherUOM(index: number, values: any): void {
let control: any = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
values.fk_uom_id=="1" ? control.controls[index].addControl('uom_other', new FormControl('', Validators.required)) : control.controls[index].removeControl('uom_other');
}
// validate all form group and form array fields
validateAllFormFields(formGroup: any) {
@ -189,21 +177,4 @@ submitDetails(records) {
}
});
}
inWords(value,inx,flag){
switch(flag){
case 1 :
this.annualSaleAmtInwords[inx] = this._pd.convertNumberToWords(value);
break;
case 2 :
this.marginAmtInwords[inx] = this._pd.convertNumberToWords(value);
break;
case 3 :
this.marginFinalAmtInwords[inx] = this._pd.convertNumberToWords(value);
break;
case 4 :
this.ratePerUnitAmtInwords[inx] = this._pd.convertNumberToWords(value);
break;
default:break;}
}
}

View File

@ -132,7 +132,7 @@ public viewerOptions: any = {
// message: ' Yearly ' + itemElement.sales_item + ' Sales Arrived',
// value: calculateAllItemsTotal * convertYear,
// })
this.salesMonthWiseExpandedItems.push({sim_id:itemElement.sim_id,salesItem:itemElement.sales_item,margin_per:itemElement.margin_per,margin_value:itemElement.margin_value, expandElements:expandBodyContent, footerMessage: footerMessage});
this.salesMonthWiseExpandedItems.push({sim_id:itemElement.sim_id,salesItem:itemElement.sales_item,comments:itemElement.comments,margin_per:itemElement.margin_per,margin_value:itemElement.margin_value, expandElements:expandBodyContent, footerMessage: footerMessage});
});
}
if(value.records.purchase_details){

View File

@ -41,6 +41,13 @@
<td mat-footer-cell *matFooterCellDef> {{getTotalCost(businessItemSource.data)}} </td>
</ng-container>
<ng-container matColumnDef="comments">
<th mat-header-cell *matHeaderCellDef> Remarks </th>
<td mat-cell *matCellDef="let element">{{element.comments}}
</td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<ng-container matColumnDef="action" stickyEnd>
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let element">

View File

@ -9,26 +9,31 @@
width: 100%;
}
td{
padding-right: 2%;
padding-left: 2%;
white-space: nowrap;
}
th {
padding-left: 2%;
padding-right: 2%;
.mat-header-cell {
padding: 0 10px 0 10px;
white-space: nowrap;
}
.mat-cell {
padding: 0 10px 0 10px;
white-space: nowrap;
}
.mat-table-sticky:first-child {
border-right: 1px solid #e0e0e0;
}
.mat-table-sticky:last-child {
width: 5% !important;
border-left: 1px solid #e0e0e0;
padding: 10px 0 0 15px;
}
.mat-footer-cell {
font-weight: bold;
font-size: 1.2rem !important;
padding: 0 10px 0 10px;
}
td.mat-column-comments{
white-space: pre;
width: 35%;
}

View File

@ -11,7 +11,7 @@ import { NotifierService } from 'angular-notifier';
})
export class BusinessExpenseDetailsComponent implements OnInit {
displayedColumns = ['buiness_expense','expense_value','frequency','annual_expenses','action'];
displayedColumns = ['buiness_expense','expense_value','frequency','annual_expenses','comments','action'];
public businessItemSource= new MatTableDataSource();
@Input() parentData: any;
@Input() masterData: { UOMList: any; frequencyList: any;businessExpenseList:any; pdid:number,company_id:number};

View File

@ -22,7 +22,7 @@
<small class="expan_table_header" *ngIf="activateMariginCalculation===true">&nbsp;( Margin Percentage : {{expandDetails.margin_per}} % &nbsp;&nbsp;Margin Value : {{expandDetails.margin_value}} )</small>
</mat-card-title>
<mat-card-subtitle *ngFor="let footer of expandDetails.footerMessage">
<div fxFlex="100" class="subtitle_message">
{{footer.month_message}} &nbsp;&nbsp;{{footer.year_message}}
</div>
@ -54,13 +54,21 @@
</div>
</mat-card-content>
<mat-card-actions align="right">
<button class="mr-1 mb-1" mat-mini-fab matTooltip="Edit" matTooltipPosition="above" (click)="editSalesItem(expandDetails)" color="primary" type="button">
<mat-icon>edit</mat-icon>
</button>
<button class="mr-1 mb-1" mat-mini-fab matTooltip="Remove" matTooltipPosition="above" (click)="removeSalesItem(expandDetails)" color="primary" type="button">
<mat-icon>delete</mat-icon>
</button>
<mat-card-actions>
<div fxFlex="75" align="left">
{{expandDetails.comments}}
</div>
<div fxFlex="25" align="right">
<button class="mr-1 mb-1" mat-mini-fab matTooltip="Edit" matTooltipPosition="above" (click)="editSalesItem(expandDetails)" color="primary" type="button">
<mat-icon>edit</mat-icon>
</button>
<button class="mr-1 mb-1" mat-mini-fab matTooltip="Remove" matTooltipPosition="above" (click)="removeSalesItem(expandDetails)" color="primary" type="button">
<mat-icon>delete</mat-icon>
</button>
</div>
</mat-card-actions>
</mat-card>

View File

@ -59,6 +59,7 @@ editSalesItem(value:any) {
"fk_pd_id":this.masterData.pdid,
"sim_id":value.sim_id,
"salesItem":value.salesItem,
"comments":value.comments,
"margin_value":value.margin_value,
"margin_per":value.margin_per,
"values":transformData

View File

@ -41,6 +41,13 @@
<td mat-footer-cell *matFooterCellDef> {{getTotalCost(houseItemSource.data)}} </td>
</ng-container>
<ng-container matColumnDef="comments">
<th mat-header-cell *matHeaderCellDef> Remarks </th>
<td mat-cell *matCellDef="let element">{{element.comments}}
</td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<ng-container matColumnDef="action" stickyEnd>
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let element">

View File

@ -9,26 +9,31 @@
width: 100%;
}
td{
padding-right: 2%;
padding-left: 2%;
white-space: nowrap;
}
th {
padding-left: 2%;
padding-right: 2%;
.mat-header-cell {
padding: 0 10px 0 10px;
white-space: nowrap;
}
.mat-cell {
padding: 0 10px 0 10px;
white-space: nowrap;
}
.mat-table-sticky:first-child {
border-right: 1px solid #e0e0e0;
}
.mat-table-sticky:last-child {
width: 5% !important;
border-left: 1px solid #e0e0e0;
padding: 10px 0 0 15px;
}
.mat-footer-cell {
font-weight: bold;
font-size: 1.2rem !important;
padding: 0 10px 0 10px;
}
td.mat-column-comments{
white-space: pre;
width: 35%;
}

View File

@ -12,7 +12,7 @@ import { NotifierService } from 'angular-notifier';
})
export class HouseHoldDetailsComponent implements OnInit {
displayedColumns = ['buiness_particulars','expense_value','frequency','annual_expenses','action'];
displayedColumns = ['buiness_particulars','expense_value','frequency','annual_expenses','comments','action'];
public houseItemSource= new MatTableDataSource();
@Input() parentData: any;
@Input() masterData: { UOMList: any; frequencyList: any;businessExpenseList:any; pdid:number,company_id:number};

View File

@ -41,6 +41,13 @@
<td mat-footer-cell *matFooterCellDef> {{getTotalCost(businessIncomeItemSource.data)}} </td>
</ng-container>
<ng-container matColumnDef="comments">
<th mat-header-cell *matHeaderCellDef> Remarks </th>
<td mat-cell *matCellDef="let element">{{element.comments}}
</td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<ng-container matColumnDef="action" stickyEnd>
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let element">

View File

@ -9,26 +9,31 @@
width: 100%;
}
td{
padding-right: 2%;
padding-left: 2%;
white-space: nowrap;
}
th {
padding-left: 2%;
padding-right: 2%;
.mat-header-cell {
padding: 0 10px 0 10px;
white-space: nowrap;
}
.mat-cell {
padding: 0 10px 0 10px;
white-space: nowrap;
}
.mat-table-sticky:first-child {
border-right: 1px solid #e0e0e0;
}
.mat-table-sticky:last-child {
width: 5% !important;
border-left: 1px solid #e0e0e0;
padding: 10px 0 0 15px;
}
.mat-footer-cell {
font-weight: bold;
font-size: 1.2rem !important;
padding: 0 10px 0 10px;
}
td.mat-column-comments{
white-space: pre;
width: 35%;
}

View File

@ -11,7 +11,7 @@ import { NotifierService } from 'angular-notifier';
})
export class OtherBusinessIncomeDetailsComponent implements OnInit {
displayedColumns = ['buiness_income','income_value','frequency','annual_income','action'];
displayedColumns = ['buiness_income','income_value','frequency','annual_income','comments','action'];
public businessIncomeItemSource= new MatTableDataSource();
@Input() parentData: any;
@Input() masterData: { UOMList: any; frequencyList: any;businessExpenseList:any; pdid:number,company_id:number};

View File

@ -30,7 +30,7 @@
<ng-container matColumnDef="UOM">
<th mat-header-cell *matHeaderCellDef> UOM </th>
<td mat-cell *matCellDef="let element"> {{element.uom_name}} </td>
<td mat-cell *matCellDef="let element"> {{element.fk_uom_id==1 ? element.uom_other : element.uom_name}} </td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
@ -56,6 +56,14 @@
<td mat-footer-cell *matFooterCellDef> {{getTotalCost(purchaseItemSource.data)}} </td>
</ng-container>
<ng-container matColumnDef="comments">
<th mat-header-cell *matHeaderCellDef> Remarks </th>
<td mat-cell *matCellDef="let element">{{element.comments}}
</td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<ng-container matColumnDef="action" stickyEnd>
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let element">

View File

@ -9,26 +9,31 @@
width: 100%;
}
td{
padding-right: 2%;
padding-left: 2%;
white-space: nowrap;
}
th {
padding-left: 2%;
padding-right: 2%;
.mat-header-cell {
padding: 0 10px 0 10px;
white-space: nowrap;
}
.mat-cell {
padding: 0 10px 0 10px;
white-space: nowrap;
}
.mat-table-sticky:first-child {
border-right: 1px solid #e0e0e0;
}
.mat-table-sticky:last-child {
width: 5% !important;
border-left: 1px solid #e0e0e0;
padding: 10px 0 0 15px;
}
.mat-footer-cell {
font-weight: bold;
font-size: 1.2rem !important;
padding: 0 10px 0 10px;
}
td.mat-column-comments{
white-space: pre;
width: 35%;
}

View File

@ -10,7 +10,7 @@ import { NotifierService } from 'angular-notifier';
styleUrls: ['./purchase-details.component.scss']
})
export class PurchaseDetailsComponent implements OnInit, DoCheck {
displayedColumns = ['raw_material','purchase_quantity','UOM','rate_per_unit_purchase','frequency','annual_purchase','action'];
displayedColumns = ['raw_material','purchase_quantity','UOM','rate_per_unit_purchase','frequency','annual_purchase','comments','action'];
public purchaseItemSource= new MatTableDataSource();
activateMariginCalculation:boolean;
private notifier: NotifierService;

View File

@ -15,8 +15,11 @@
</mat-form-field>
<mat-form-field style="width: 40%" *ngIf="activateMariginCalculation">
<input matInput OnlyNumber type="text" placeholder="Margin Value" formControlName="margin_value" readonly>
<mat-hint align="start" style="font-size:90%" *ngIf="salesCalculationForm.value.margin_value != ''">{{"&#8377;"}} {{marginAmtInwords}} Only</mat-hint>
<mat-hint align="start" style="font-size:90%" *ngIf="salesCalculationForm.value.margin_value != ''">{{"&#8377;"}} {{salesCalculationForm.value.margin_value | numberToWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width: 82%">
<textarea matInput type="text" placeholder="Remarks" formControlName="comments"></textarea>
</mat-form-field>
<button type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Save" matTooltipPosition="above" (click)="submitDetails(salesCalculationForm.value)"><mat-icon>save</mat-icon>
</button>
</mat-card-content>

View File

@ -16,7 +16,6 @@ export class SalesCalculationComponent implements OnInit, OnChanges, DoCheck {
activateMariginCalculation: boolean;
private notifier: NotifierService;
SaleAmtInwords : any;
marginAmtInwords: any;
constructor(notifier:NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService) {
this.activateMariginCalculation=false;
this.notifier = notifier;
@ -30,7 +29,6 @@ export class SalesCalculationComponent implements OnInit, OnChanges, DoCheck {
{
this.salesCalculationForm.controls['margin_value'].setValue(values.sales_declared_by_customer * (values.margin_per/100));
this.marginAmtInwords = this._pd.convertNumberToWords(values.sales_declared_by_customer * (values.margin_per/100));
}
}
// save sales calculations details
@ -89,7 +87,6 @@ ngOnChanges(changes: SimpleChanges) {
if(changes.parentData){
if(changes.parentData.currentValue.length>0){
this.SaleAmtInwords = this._pd.convertNumberToWords(changes.parentData.currentValue[changes.parentData.currentValue.length-1].sales_declared_by_customer);
this.marginAmtInwords = this._pd.convertNumberToWords(changes.parentData.currentValue[changes.parentData.currentValue.length-1].margin_value);
this.salesCalculationForm = this._fb.group({
sdc_id:[changes.parentData.currentValue[changes.parentData.currentValue.length-1].sdc_id],
sales_declared_by_customer:[changes.parentData.currentValue[changes.parentData.currentValue.length-1].sales_declared_by_customer, Validators.compose([Validators.required])],
@ -97,6 +94,7 @@ ngOnChanges(changes: SimpleChanges) {
company_id:[this.masterData.company_id],
margin_per:[this.activateMariginCalculation===false ? '' : changes.parentData.currentValue[changes.parentData.currentValue.length-1].margin_per,this.activateMariginCalculation===true ? Validators.required: Validators.nullValidator],
margin_value:[this.activateMariginCalculation==false ? '' : changes.parentData.currentValue[changes.parentData.currentValue.length-1].margin_value],
comments:[changes.parentData.currentValue[changes.parentData.currentValue.length-1].comments]
});
}
else {
@ -107,6 +105,8 @@ ngOnChanges(changes: SimpleChanges) {
company_id:[this.masterData.company_id],
margin_per:['',this.activateMariginCalculation===true ? Validators.required: Validators.nullValidator],
margin_value:[''],
comments:['']
});
}
}

View File

@ -32,7 +32,7 @@
<ng-container matColumnDef="UOM">
<th mat-header-cell *matHeaderCellDef> UOM </th>
<td mat-cell *matCellDef="let element"> {{element.uom_name}} </td>
<td mat-cell *matCellDef="let element"> {{element.fk_uom_id==1 ? element.uom_other : element.uom_name}} </td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
@ -79,6 +79,14 @@
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<ng-container matColumnDef="comments">
<th mat-header-cell *matHeaderCellDef> Remarks </th>
<td mat-cell *matCellDef="let element">{{element.comments}}
</td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
<ng-container matColumnDef="action" stickyEnd>

View File

@ -9,27 +9,32 @@
width: 100%;
}
td{
padding-right: 2%;
padding-left: 2%;
white-space: nowrap;
}
th {
padding-left: 2%;
padding-right: 2%;
.mat-header-cell {
padding: 0 10px 0 10px;
white-space: nowrap;
}
.mat-cell {
padding: 0 10px 0 10px;
white-space: nowrap;
}
.mat-table-sticky:first-child {
border-right: 1px solid #e0e0e0;
}
.mat-table-sticky:last-child {
width: 5% !important;
border-left: 1px solid #e0e0e0;
padding: 10px 0 0 15px;
}
.mat-footer-cell {
font-weight: bold;
font-size: 1.2rem !important;
padding: 0 10px 0 10px;
}
td.mat-column-comments{
white-space: pre;
width: 35%;
}

View File

@ -10,7 +10,7 @@ import { NotifierService } from 'angular-notifier';
styleUrls: ['./sales-details.component.scss']
})
export class SalesDetailsComponent implements OnInit, DoCheck {
displayedColumns = ['product_services','sale_quantity','UOM','rate_per_unit_sale','frequency','annual_sales','action'];
displayedColumns = ['product_services','sale_quantity','UOM','rate_per_unit_sale','frequency','annual_sales','comments','action'];
public salesItemSource= new MatTableDataSource();
@Input() parentData: any;
@Input() masterData: { UOMList: any; frequencyList: any;businessExpenseList:any,businessIncomeList: any, pdid:number,company_id:number, grossProfitTypeList:any};
@ -92,10 +92,10 @@ ngDoCheck() {
if(this.masterData.grossProfitTypeList.length>0){
this.activateMariginCalculation = this.masterData.grossProfitTypeList[this.masterData.grossProfitTypeList.length-1].margin==2 && this.masterData.grossProfitTypeList[this.masterData.grossProfitTypeList.length-1].mode==2 ? true : false;
if(this.activateMariginCalculation===true){
this.displayedColumns = ['product_services','sale_quantity','UOM','rate_per_unit_sale','frequency','annual_sales','margin_percentage','margin_amount','final_value','action'];
this.displayedColumns = ['product_services','sale_quantity','UOM','rate_per_unit_sale','frequency','annual_sales','margin_percentage','margin_amount','final_value','comments','action'];
}
else {
this.displayedColumns = ['product_services','sale_quantity','UOM','rate_per_unit_sale','frequency','annual_sales','action'];
this.displayedColumns = ['product_services','sale_quantity','UOM','rate_per_unit_sale','frequency','annual_sales','comments','action'];
}
}