Merge branch 'master' of https://bitbucket.org/sriramv18/sparqsineedge
This commit is contained in:
commit
478ab33168
@ -210,8 +210,9 @@ export class AddPdComponent implements OnInit, OnDestroy {
|
||||
data => {
|
||||
if (data.status == 200) {
|
||||
this.titleList=data.records.filter(val=>val.isactive==1);
|
||||
let index1 = this.titleList.map(data => data.name).indexOf("Master");
|
||||
this.titleList.splice(index1, 1);
|
||||
// console.log(this.titleList);
|
||||
// let index1 = this.titleList.map(data => data.name).indexOf("Master");
|
||||
// this.titleList.splice(index1, 1);
|
||||
}
|
||||
}, error => this.errorMessage = <any> error);
|
||||
|
||||
|
||||
@ -0,0 +1,55 @@
|
||||
<form [formGroup]="businessItemForm" novalidate>
|
||||
|
||||
<h2 mat-dialog-title class="paragraph_change">
|
||||
<div fxFlex="70" align="left" style="padding: 10px !important;">
|
||||
{{pageTitle}}
|
||||
</div>
|
||||
<div fxFlex="30" align="end" style="padding: 10px !important;">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="above" (click)="closeDialogue()"><mat-icon>close</mat-icon></button>
|
||||
</div>
|
||||
</h2>
|
||||
<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 fxFlex="100">
|
||||
<mat-form-field style="width: 87%">
|
||||
<mat-select placeholder="Buiness 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"
|
||||
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)" formControlName="expense_value" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 25%">
|
||||
<mat-select placeholder="Frequency" formControlName="fk_frequency_id" (selectionChange)="businessCalculation(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%">
|
||||
<input matInput OnlyNumber type="text" placeholder="Annual Expenses" formControlName="annual_expenses_value" readonly>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div fxLayout="row" *ngIf="data.manage_status==1">
|
||||
<div fxFlex="100" align="center">
|
||||
<button type="button" mat-flat-button (click)="addMore()"
|
||||
matTooltip="Add More" matTooltipPosition="above" color="primary">
|
||||
<strong>Add More Business Expense Item</strong>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<notifier-container></notifier-container>
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Save" matTooltipPosition="above" (click)="submitDetails(businessItemForm.value)"><mat-icon>save</mat-icon></button>
|
||||
</mat-dialog-actions>
|
||||
@ -0,0 +1,21 @@
|
||||
.paragraph_change {
|
||||
color: #fff !important;
|
||||
background-color: #e00201 !important;
|
||||
}
|
||||
mat-form-field {
|
||||
margin: 0 2%;
|
||||
}
|
||||
.example-section {
|
||||
height: 120px;
|
||||
}
|
||||
|
||||
.example-margin {
|
||||
margin: 0 10px;
|
||||
}
|
||||
::ng-deep .cdk-global-overlay-wrapper{
|
||||
justify-content: center !important;
|
||||
}
|
||||
|
||||
.item-margin {
|
||||
margin-left: 2%;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ManageBusinesExpenseComponent } from './manage-busines-expense.component';
|
||||
|
||||
describe('ManageBusinesExpenseComponent', () => {
|
||||
let component: ManageBusinesExpenseComponent;
|
||||
let fixture: ComponentFixture<ManageBusinesExpenseComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ManageBusinesExpenseComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ManageBusinesExpenseComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,125 @@
|
||||
import { Component, OnInit, Input, Output, Inject } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
|
||||
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angular/material';
|
||||
import { PdTrigerService } from './../../../../../../../pd-service/pd-triger.service';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
|
||||
@Component({
|
||||
selector: 'app-manage-busines-expense',
|
||||
templateUrl: './manage-busines-expense.component.html',
|
||||
styleUrls: ['./manage-busines-expense.component.scss']
|
||||
})
|
||||
export class ManageBusinesExpenseComponent implements OnInit {
|
||||
|
||||
pageTitle:string;
|
||||
businessItemForm:FormGroup;
|
||||
frequencyData: any[]=[];
|
||||
businessExpenseData: any[]=[];
|
||||
private notifier: NotifierService;
|
||||
constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef<ManageBusinesExpenseComponent>) {
|
||||
this.frequencyData=this.data.masterData.frequencyList;
|
||||
this.businessExpenseData = this.data.masterData.businessExpenseList;
|
||||
this.pageTitle = this.data.manage_status==1 ? 'Add Business Expense Item' : 'Update Business Expense Item';
|
||||
this.notifier = notifier;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if(this.data.manage_status==2){
|
||||
this.businessItemForm = this._fb.group({
|
||||
busExpense: this._fb.array([this.createBusinessItemWithData(this.data.editData)]),
|
||||
});
|
||||
}
|
||||
else{
|
||||
this.businessItemForm = this._fb.group({
|
||||
busExpense: this._fb.array([this.createBusinessItem()]),
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// add business item details
|
||||
createBusinessItem():FormGroup {
|
||||
return this._fb.group({
|
||||
pd_expense_id:[''],
|
||||
fk_pd_id:[this.data.masterData.pdid],
|
||||
expense_item_id:['',Validators.compose([Validators.required])],
|
||||
expense_value:['',Validators.compose([Validators.required])],
|
||||
fk_frequency_id:['',Validators.compose([Validators.required])],
|
||||
annual_expenses_value:['',Validators.compose([Validators.required])],
|
||||
});
|
||||
}
|
||||
|
||||
// create form with data
|
||||
createBusinessItemWithData(values: any) {
|
||||
return this._fb.group({
|
||||
pd_expense_id:[values.pd_expense_id],
|
||||
fk_pd_id:[this.data.masterData.pdid],
|
||||
expense_item_id:[values.expense_item_id,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_expenses_value:[values.annual_expenses_value,Validators.compose([Validators.required])],
|
||||
});
|
||||
}
|
||||
|
||||
// add more item
|
||||
addMore(): void{
|
||||
let control = <FormArray>this.businessItemForm.controls['busExpense'];
|
||||
control.push(this.createBusinessItem());
|
||||
}
|
||||
|
||||
// close dialogue manually
|
||||
closeDialogue(){
|
||||
this.dialogRef.close({update_status:false});
|
||||
}
|
||||
|
||||
businessCalculation(indexVal: number,values: any): void {
|
||||
let control:any = <FormArray>this.businessItemForm.controls['busExpense'];
|
||||
if(values.expense_value!='' && values.fk_frequency_id!='') {
|
||||
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id);
|
||||
control.controls[indexVal].controls['annual_expenses_value'].setValue(parseInt(values.expense_value) * parseInt(filterFrequencyValue[0].mutiple_factor));
|
||||
|
||||
}
|
||||
else {
|
||||
control.controls[indexVal].controls['annual_expenses_value'].setValue('');
|
||||
}
|
||||
}
|
||||
|
||||
removeItem(indexVal: number) : void {
|
||||
let control = <FormArray>this.businessItemForm.controls['busExpense'];
|
||||
control.removeAt(indexVal);
|
||||
|
||||
}
|
||||
|
||||
// save purchase details
|
||||
submitDetails(records) {
|
||||
if (this.businessItemForm.invalid) {
|
||||
this.validateAllFormFields(this.businessItemForm);
|
||||
this.notifier.notify('warning',"Please Check All Manatory Fields..");
|
||||
return;
|
||||
}
|
||||
this._pd.saveAssessedDetails('saveAssessedIncomeBusinessExpenses',records.busExpense).subscribe(data => {
|
||||
this.notifier.notify('success', this.data.manage_status==2 ? 'Updated Successfully.' : 'Saved Successfully.');
|
||||
setTimeout(() =>{
|
||||
this.dialogRef.close({update_status:true});
|
||||
},3000);
|
||||
}, error => {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
});
|
||||
}
|
||||
|
||||
// validate all form group and form array fields
|
||||
validateAllFormFields(formGroup: any) {
|
||||
Object.keys(formGroup.controls).forEach(field => {
|
||||
const control = formGroup.get(field);
|
||||
if (control instanceof FormControl) {
|
||||
control.markAsTouched({ onlySelf: true });
|
||||
} else if (control instanceof FormGroup) {
|
||||
this.validateAllFormFields(control);
|
||||
} else if (control instanceof FormArray) {
|
||||
this.validateAllFormFields(control);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
<form [formGroup]="salesItemForm" novalidate>
|
||||
|
||||
<h2 mat-dialog-title class="paragraph_change">
|
||||
<div fxFlex="70" align="left" style="padding: 10px !important;">
|
||||
{{pageTitle}}
|
||||
</div>
|
||||
<div fxFlex="30" align="end" style="padding: 10px !important;">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="above" (click)="closeDialogue()"><mat-icon>close</mat-icon></button>
|
||||
</div>
|
||||
</h2>
|
||||
<mat-dialog-content>
|
||||
<mat-card>
|
||||
<mat-card-content formArrayName="sales_product">
|
||||
<mat-card *ngFor="let sales of salesItemForm.controls.sales_product['controls']; let s = index;" [formGroupName]="s">
|
||||
<mat-card-content>
|
||||
<mat-form-field style="width: 35%">
|
||||
<input type="text" matInput placeholder="Product/Services" formControlName="sales_item" required>
|
||||
</mat-form-field>
|
||||
<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">
|
||||
<input matInput OnlyNumber type="text" placeholder="Margin Value" formControlName="margin_value" readonly>
|
||||
</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"
|
||||
matTooltip="Remove" matTooltipPosition="above">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
<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%;">
|
||||
<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)" formControlName="sales_value" required>
|
||||
</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"
|
||||
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)"
|
||||
matTooltip="Add More" matTooltipPosition="above" color="primary">
|
||||
<strong>Add More Daily Sales</strong>
|
||||
</button>
|
||||
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
|
||||
</mat-card-content>
|
||||
<mat-card-actions align="center" *ngIf="data.manage_status==1">
|
||||
<button type="button" mat-flat-button (click)="addMore(salesItemForm.controls.sales_product.value.length)"
|
||||
matTooltip="Add More" matTooltipPosition="above" color="primary">
|
||||
<strong>Add More Product/Services</strong>
|
||||
</button>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
<notifier-container></notifier-container>
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Save" matTooltipPosition="above" (click)="submitDetails(salesItemForm.value)"><mat-icon>save</mat-icon></button>
|
||||
</mat-dialog-actions>
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
.paragraph_change {
|
||||
color: #fff !important;
|
||||
background-color: #e00201 !important;
|
||||
}
|
||||
mat-form-field {
|
||||
margin: 0 2%;
|
||||
}
|
||||
.example-section {
|
||||
height: 120px;
|
||||
}
|
||||
|
||||
.example-margin {
|
||||
margin: 0 10px;
|
||||
}
|
||||
::ng-deep .cdk-global-overlay-wrapper{
|
||||
justify-content: center !important;
|
||||
}
|
||||
|
||||
.item-margin {
|
||||
margin-left: 2%;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ManageDailySalesComponent } from './manage-daily-sales.component';
|
||||
|
||||
describe('ManageDailySalesComponent', () => {
|
||||
let component: ManageDailySalesComponent;
|
||||
let fixture: ComponentFixture<ManageDailySalesComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ManageDailySalesComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ManageDailySalesComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,213 @@
|
||||
import { Component, OnInit, Input, Output, Inject } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
|
||||
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angular/material';
|
||||
import { PdTrigerService } from './../../../../../../../pd-service/pd-triger.service';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { DeleteRecordsCountPipe } from './../../../../../../../pd-pipes/delete-records-count.pipe';
|
||||
|
||||
@Component({
|
||||
selector: 'app-manage-daily-sales',
|
||||
templateUrl: './manage-daily-sales.component.html',
|
||||
styleUrls: ['./manage-daily-sales.component.scss'],
|
||||
providers: [DeleteRecordsCountPipe],
|
||||
})
|
||||
export class ManageDailySalesComponent implements OnInit {
|
||||
pipe = new DatePipe('en-US');
|
||||
pageTitle:string;
|
||||
salesItemForm:FormGroup;
|
||||
UOMData: any[]=[];
|
||||
frequencyData: any[]=[];
|
||||
private notifier: NotifierService;
|
||||
constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef<ManageDailySalesComponent>) {
|
||||
this.pageTitle = this.data.manage_status==1 ? 'Add Daily Sales Item' : 'Update Daily Sales Item';
|
||||
this.notifier = notifier;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if(this.data.manage_status==1){
|
||||
this.salesItemForm = this._fb.group({
|
||||
sales_product: this._fb.array([this.createSalesItem()]),
|
||||
});
|
||||
let control: any = <FormArray>this.salesItemForm.controls['sales_product'];
|
||||
control = control.controls[0].get('child') as FormArray;
|
||||
control.push(this.createDailySalesData(''))
|
||||
}
|
||||
else if(this.data.manage_status==2){
|
||||
this.salesItemForm = this._fb.group({
|
||||
sales_product: this._fb.array([this.createSalesItemWithData(this.data.editData)]),
|
||||
});
|
||||
let control: any = <FormArray>this.salesItemForm.controls['sales_product'];
|
||||
control = control.controls[0].get('child') as FormArray;
|
||||
this.data.editData.values.forEach(elementVal => {
|
||||
control.push(this.createDailySalesWithData(elementVal,this.data.editData.sim_id))
|
||||
});
|
||||
}
|
||||
else{
|
||||
this.salesItemForm = this._fb.group({
|
||||
sales_product: this._fb.array([]),
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// add sales item details
|
||||
createSalesItem():FormGroup {
|
||||
return this._fb.group({
|
||||
fk_pd_id: [this.data.masterData.pdid],
|
||||
sim_id: [''],
|
||||
sales_item: ['', Validators.compose([Validators.required])],
|
||||
child: this._fb.array([]),
|
||||
margin_per: [''],
|
||||
margin_value: [''],
|
||||
isactive:[true]
|
||||
});
|
||||
}
|
||||
// create daily list empty
|
||||
createDailySalesData(sim_id: string) {
|
||||
return this._fb.group({
|
||||
simc_id: [''],
|
||||
fk_sim_id: [sim_id],
|
||||
sales_date: [''],
|
||||
sales_value: ['', Validators.compose([Validators.required])],
|
||||
isactive:[true]
|
||||
})
|
||||
}
|
||||
|
||||
// create form with data
|
||||
createSalesItemWithData(values: any) {
|
||||
return this._fb.group({
|
||||
fk_pd_id: [this.data.masterData.pdid],
|
||||
sim_id: [values.sim_id],
|
||||
sales_item: [values.salesItem, Validators.compose([Validators.required])],
|
||||
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: ''],
|
||||
isactive:[true]
|
||||
});
|
||||
}
|
||||
// create daily list
|
||||
createDailySalesWithData(values: any, sim_id: string) {
|
||||
return this._fb.group({
|
||||
simc_id: [values.simc_id],
|
||||
fk_sim_id: [sim_id],
|
||||
sales_date: [new Date(this.pipe.transform(values.sales_date, 'yyyy-MM-dd')), Validators.compose([Validators.required])],
|
||||
sales_value: [values.sales_value, Validators.compose([Validators.required])],
|
||||
isactive:[true]
|
||||
})
|
||||
}
|
||||
|
||||
// add more item
|
||||
addMore(parentIndex: number): void{
|
||||
let control = <FormArray>this.salesItemForm.controls['sales_product'];
|
||||
control.push(this.createSalesItem());
|
||||
control = control.controls[parentIndex].get('child') as FormArray;
|
||||
control.push(this.createDailySalesData(''))
|
||||
}
|
||||
|
||||
// add more daily items
|
||||
addMoreDailySales(parentIndex: number,values: any): void{
|
||||
let control: any = <FormArray>this.salesItemForm.controls['sales_product'];
|
||||
control=control.controls[parentIndex].get('child') as FormArray;
|
||||
control.push(this.createDailySalesData(values.sim_id));
|
||||
}
|
||||
|
||||
// remove daily items
|
||||
removeDailyItems(parentIndex: number,childIndex:number, childValue:any): void {
|
||||
let control: any = <FormArray>this.salesItemForm.controls['sales_product'];
|
||||
control=control.controls[parentIndex].get('child') as FormArray;
|
||||
if(childValue.simc_id=='' || childValue.simc_id==null){
|
||||
control.removeAt(childIndex);
|
||||
let calculatControlValues: any = <FormArray>this.salesItemForm.controls['sales_product'];
|
||||
calculatControlValues = calculatControlValues.controls[parentIndex];
|
||||
this.salesCalculation(parentIndex,calculatControlValues.value);
|
||||
}
|
||||
else {
|
||||
control.controls[childIndex].controls.isactive.setValue(false);
|
||||
let calculatControlValues: any = <FormArray>this.salesItemForm.controls['sales_product'];
|
||||
calculatControlValues = calculatControlValues.controls[parentIndex];
|
||||
this.salesCalculation(parentIndex,calculatControlValues.value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
removeProducts(parentIndex:number){
|
||||
let control: any = <FormArray>this.salesItemForm.controls['sales_product'];
|
||||
control.removeAt(parentIndex);
|
||||
}
|
||||
|
||||
// close dialogue manually
|
||||
closeDialogue(){
|
||||
this.dialogRef.close({update_status:false});
|
||||
}
|
||||
|
||||
salesCalculation(indexVal: number,values: any): void {
|
||||
if(this.data.margin_calculation_status===true){
|
||||
let control:any = <FormArray>this.salesItemForm.controls['sales_product'];
|
||||
if(values.child.length>0 && values.margin_per!=''){
|
||||
let transformData = values.child.filter(val=>val.sales_date!='' && val.sales_date!=null && val.sales_date!=undefined && val.sales_value!='' && val.isactive===true).map(mval=>{
|
||||
mval.custum_date = this.pipe.transform(mval.sales_date, 'yyyy-MM');
|
||||
return mval;
|
||||
});
|
||||
if(transformData.length>0) {
|
||||
let getUniqueMonthCounts = transformData.map(val=>val.custum_date)
|
||||
.filter((fVal,fIndex,fArray)=>{
|
||||
return fIndex === fArray.indexOf(fVal);
|
||||
});
|
||||
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)));
|
||||
}
|
||||
else{
|
||||
control.controls[indexVal].controls['margin_value'].setValue('');
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
control.controls[indexVal].controls['margin_value'].setValue('');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// save sales details
|
||||
submitDetails(records) {
|
||||
if (this.salesItemForm.invalid) {
|
||||
this.validateAllFormFields(this.salesItemForm);
|
||||
this.notifier.notify('warning',"Please Check All Manatory Fields..");
|
||||
return;
|
||||
}
|
||||
// this is for remove custom date key from my array values
|
||||
records.sales_product.forEach(parVal => {
|
||||
parVal.child.forEach(childVal => {
|
||||
if(childVal['custum_date']){
|
||||
delete childVal['custum_date'] ;
|
||||
}
|
||||
});
|
||||
});
|
||||
this._pd.saveAssessedDetails('saveAssessedIncomeMonthwiseItems',records.sales_product).subscribe(data => {
|
||||
this.notifier.notify('success', this.data.manage_status==2 ? 'Updated Successfully.' : 'Saved Successfully.');
|
||||
setTimeout(() =>{
|
||||
this.dialogRef.close({update_status:true});
|
||||
},3000);
|
||||
}, error => {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
});
|
||||
}
|
||||
|
||||
// validate all form group and form array fields
|
||||
validateAllFormFields(formGroup: any) {
|
||||
Object.keys(formGroup.controls).forEach(field => {
|
||||
const control = formGroup.get(field);
|
||||
if (control instanceof FormControl) {
|
||||
control.markAsTouched({ onlySelf: true });
|
||||
} else if (control instanceof FormGroup) {
|
||||
this.validateAllFormFields(control);
|
||||
} else if (control instanceof FormArray) {
|
||||
this.validateAllFormFields(control);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
<form [formGroup]="houseItemForm" novalidate>
|
||||
|
||||
<h2 mat-dialog-title class="paragraph_change">
|
||||
<div fxFlex="70" align="left" style="padding: 10px !important;">
|
||||
{{pageTitle}}
|
||||
</div>
|
||||
<div fxFlex="30" align="end" style="padding: 10px !important;">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="above" (click)="closeDialogue()"><mat-icon>close</mat-icon></button>
|
||||
</div>
|
||||
</h2>
|
||||
<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 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"
|
||||
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)" formControlName="expense_value" required>
|
||||
</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>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 25%">
|
||||
<input matInput OnlyNumber type="text" placeholder="Annual Expenses" formControlName="annual_expense_value" readonly>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div fxLayout="row" *ngIf="data.manage_status==1">
|
||||
<div fxFlex="100" align="center">
|
||||
<button type="button" mat-flat-button (click)="addMore()"
|
||||
matTooltip="Add More" matTooltipPosition="above" color="primary">
|
||||
<strong>Add More House Hold Item</strong>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<notifier-container></notifier-container>
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Save" matTooltipPosition="above" (click)="submitDetails(houseItemForm.value)"><mat-icon>save</mat-icon></button>
|
||||
</mat-dialog-actions>
|
||||
@ -0,0 +1,21 @@
|
||||
.paragraph_change {
|
||||
color: #fff !important;
|
||||
background-color: #e00201 !important;
|
||||
}
|
||||
mat-form-field {
|
||||
margin: 0 2%;
|
||||
}
|
||||
.example-section {
|
||||
height: 120px;
|
||||
}
|
||||
|
||||
.example-margin {
|
||||
margin: 0 10px;
|
||||
}
|
||||
::ng-deep .cdk-global-overlay-wrapper{
|
||||
justify-content: center !important;
|
||||
}
|
||||
|
||||
.item-margin {
|
||||
margin-left: 2%;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ManageHouseHoldComponent } from './manage-house-hold.component';
|
||||
|
||||
describe('ManageHouseHoldComponent', () => {
|
||||
let component: ManageHouseHoldComponent;
|
||||
let fixture: ComponentFixture<ManageHouseHoldComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ManageHouseHoldComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ManageHouseHoldComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,122 @@
|
||||
import { Component, OnInit, Input, Output, Inject } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
|
||||
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angular/material';
|
||||
import { PdTrigerService } from './../../../../../../../pd-service/pd-triger.service';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
|
||||
@Component({
|
||||
selector: 'app-manage-house-hold',
|
||||
templateUrl: './manage-house-hold.component.html',
|
||||
styleUrls: ['./manage-house-hold.component.scss']
|
||||
})
|
||||
export class ManageHouseHoldComponent implements OnInit {
|
||||
pageTitle:string;
|
||||
houseItemForm:FormGroup;
|
||||
frequencyData: any[]=[];
|
||||
private notifier: NotifierService;
|
||||
constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef<ManageHouseHoldComponent>) {
|
||||
this.frequencyData=this.data.masterData.frequencyList;
|
||||
this.pageTitle = this.data.manage_status==1 ? 'Add House Hold Item' : 'Update House Hold Item';
|
||||
this.notifier = notifier;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if(this.data.manage_status==2){
|
||||
this.houseItemForm = this._fb.group({
|
||||
houseExpense: this._fb.array([this.createHouseholdItemWithData(this.data.editData)]),
|
||||
});
|
||||
}
|
||||
else{
|
||||
this.houseItemForm = this._fb.group({
|
||||
houseExpense: this._fb.array([this.createHouseholdItem()]),
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// add Household item details
|
||||
createHouseholdItem():FormGroup {
|
||||
return this._fb.group({
|
||||
household_expense_id:[''],
|
||||
fk_pd_id:[this.data.masterData.pdid] ,
|
||||
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])],
|
||||
});
|
||||
}
|
||||
|
||||
// create form with data
|
||||
createHouseholdItemWithData(values: any) {
|
||||
return this._fb.group({
|
||||
household_expense_id:[values.household_expense_id],
|
||||
fk_pd_id:[this.data.masterData.pdid] ,
|
||||
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])],
|
||||
});
|
||||
}
|
||||
|
||||
// add more item
|
||||
addMore(): void{
|
||||
let control = <FormArray>this.houseItemForm.controls['houseExpense'];
|
||||
control.push(this.createHouseholdItem());
|
||||
}
|
||||
|
||||
// close dialogue manually
|
||||
closeDialogue(){
|
||||
this.dialogRef.close({update_status:false});
|
||||
}
|
||||
|
||||
houseCalculation(indexVal: number,values: any): void {
|
||||
let control:any = <FormArray>this.houseItemForm.controls['houseExpense'];
|
||||
if(values.expense_value!='' && values.fk_frequency_id!='') {
|
||||
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id);
|
||||
control.controls[indexVal].controls['annual_expense_value'].setValue(parseInt(values.expense_value) * parseInt(filterFrequencyValue[0].mutiple_factor));
|
||||
|
||||
}
|
||||
else {
|
||||
control.controls[indexVal].controls['annual_expense_value'].setValue('');
|
||||
}
|
||||
}
|
||||
|
||||
removeItem(indexVal: number) : void {
|
||||
let control = <FormArray>this.houseItemForm.controls['houseExpense'];
|
||||
control.removeAt(indexVal);
|
||||
|
||||
}
|
||||
|
||||
// save house hold details
|
||||
submitDetails(records) {
|
||||
if (this.houseItemForm.invalid) {
|
||||
this.validateAllFormFields(this.houseItemForm);
|
||||
this.notifier.notify('warning',"Please Check All Manatory Fields..");
|
||||
return;
|
||||
}
|
||||
this._pd.saveAssessedDetails('saveAssessedIncomeHouseholdExpenses',records.houseExpense).subscribe(data => {
|
||||
this.notifier.notify('success', this.data.manage_status==2 ? 'Updated Successfully.' : 'Saved Successfully.');
|
||||
setTimeout(() =>{
|
||||
this.dialogRef.close({update_status:true});
|
||||
},3000);
|
||||
}, error => {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
});
|
||||
}
|
||||
|
||||
// validate all form group and form array fields
|
||||
validateAllFormFields(formGroup: any) {
|
||||
Object.keys(formGroup.controls).forEach(field => {
|
||||
const control = formGroup.get(field);
|
||||
if (control instanceof FormControl) {
|
||||
control.markAsTouched({ onlySelf: true });
|
||||
} else if (control instanceof FormGroup) {
|
||||
this.validateAllFormFields(control);
|
||||
} else if (control instanceof FormArray) {
|
||||
this.validateAllFormFields(control);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
<form [formGroup]="businessIncomeItemForm" novalidate>
|
||||
|
||||
<h2 mat-dialog-title class="paragraph_change">
|
||||
<div fxFlex="70" align="left" style="padding: 10px !important;">
|
||||
{{pageTitle}}
|
||||
</div>
|
||||
<div fxFlex="30" align="end" style="padding: 10px !important;">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="above" (click)="closeDialogue()"><mat-icon>close</mat-icon></button>
|
||||
</div>
|
||||
</h2>
|
||||
<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 fxFlex="100">
|
||||
<mat-form-field style="width: 87%">
|
||||
<mat-select placeholder="Buiness 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"
|
||||
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)" formControlName="income_value" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 25%">
|
||||
<mat-select placeholder="Frequency" formControlName="fk_frequency_id" (selectionChange)="businessCalculation(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%">
|
||||
<input matInput OnlyNumber type="text" placeholder="Annual Income" formControlName="annual_income_value" readonly>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div fxLayout="row" *ngIf="data.manage_status==1">
|
||||
<div fxFlex="100" align="center">
|
||||
<button type="button" mat-flat-button (click)="addMore()"
|
||||
matTooltip="Add More" matTooltipPosition="above" color="primary">
|
||||
<strong>Add More Business Income Item</strong>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<notifier-container></notifier-container>
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Save" matTooltipPosition="above" (click)="submitDetails(businessIncomeItemForm.value)"><mat-icon>save</mat-icon></button>
|
||||
</mat-dialog-actions>
|
||||
@ -0,0 +1,21 @@
|
||||
.paragraph_change {
|
||||
color: #fff !important;
|
||||
background-color: #e00201 !important;
|
||||
}
|
||||
mat-form-field {
|
||||
margin: 0 2%;
|
||||
}
|
||||
.example-section {
|
||||
height: 120px;
|
||||
}
|
||||
|
||||
.example-margin {
|
||||
margin: 0 10px;
|
||||
}
|
||||
::ng-deep .cdk-global-overlay-wrapper{
|
||||
justify-content: center !important;
|
||||
}
|
||||
|
||||
.item-margin {
|
||||
margin-left: 2%;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ManageOtherBusinessIncomeComponent } from './manage-other-business-income.component';
|
||||
|
||||
describe('ManageOtherBusinessIncomeComponent', () => {
|
||||
let component: ManageOtherBusinessIncomeComponent;
|
||||
let fixture: ComponentFixture<ManageOtherBusinessIncomeComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ManageOtherBusinessIncomeComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ManageOtherBusinessIncomeComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,125 @@
|
||||
import { Component, OnInit, Input, Output, Inject } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
|
||||
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angular/material';
|
||||
import { PdTrigerService } from './../../../../../../../pd-service/pd-triger.service';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
|
||||
@Component({
|
||||
selector: 'app-manage-other-business-income',
|
||||
templateUrl: './manage-other-business-income.component.html',
|
||||
styleUrls: ['./manage-other-business-income.component.scss']
|
||||
})
|
||||
export class ManageOtherBusinessIncomeComponent implements OnInit {
|
||||
|
||||
pageTitle:string;
|
||||
businessIncomeItemForm:FormGroup;
|
||||
frequencyData: any[]=[];
|
||||
businessIncomeData: any[]=[];
|
||||
private notifier: NotifierService;
|
||||
constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef<ManageOtherBusinessIncomeComponent>) {
|
||||
this.frequencyData=this.data.masterData.frequencyList;
|
||||
this.businessIncomeData = this.data.masterData.businessIncomeList;
|
||||
this.pageTitle = this.data.manage_status==1 ? 'Add Business Income Item' : 'Update Business Income Item';
|
||||
this.notifier = notifier;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if(this.data.manage_status==2){
|
||||
this.businessIncomeItemForm = this._fb.group({
|
||||
busIncome: this._fb.array([this.createBusinessIncomeItemWithData(this.data.editData)]),
|
||||
});
|
||||
}
|
||||
else{
|
||||
this.businessIncomeItemForm = this._fb.group({
|
||||
busIncome: this._fb.array([this.createBusinessIncomeItem()]),
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// add business Income item details
|
||||
createBusinessIncomeItem():FormGroup {
|
||||
return this._fb.group({
|
||||
pd_business_income_id:[''],
|
||||
fk_pd_id:[this.data.masterData.pdid],
|
||||
business_income_id:['',Validators.compose([Validators.required])],
|
||||
income_value:['',Validators.compose([Validators.required])],
|
||||
fk_frequency_id:['',Validators.compose([Validators.required])],
|
||||
annual_income_value:['',Validators.compose([Validators.required])],
|
||||
});
|
||||
}
|
||||
|
||||
// create form with data
|
||||
createBusinessIncomeItemWithData(values: any) {
|
||||
return this._fb.group({
|
||||
pd_business_income_id:[values.pd_business_income_id],
|
||||
fk_pd_id:[this.data.masterData.pdid],
|
||||
business_income_id:[values.business_income_id,Validators.compose([Validators.required])],
|
||||
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])],
|
||||
});
|
||||
}
|
||||
|
||||
// add more item
|
||||
addMore(): void{
|
||||
let control = <FormArray>this.businessIncomeItemForm.controls['busIncome'];
|
||||
control.push(this.createBusinessIncomeItem());
|
||||
}
|
||||
|
||||
// close dialogue manually
|
||||
closeDialogue(){
|
||||
this.dialogRef.close({update_status:false});
|
||||
}
|
||||
|
||||
businessCalculation(indexVal: number,values: any): void {
|
||||
let control:any = <FormArray>this.businessIncomeItemForm.controls['busIncome'];
|
||||
if(values.income_value!='' && values.fk_frequency_id!='') {
|
||||
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id);
|
||||
control.controls[indexVal].controls['annual_income_value'].setValue(parseInt(values.income_value) * parseInt(filterFrequencyValue[0].mutiple_factor));
|
||||
|
||||
}
|
||||
else {
|
||||
control.controls[indexVal].controls['annual_income_value'].setValue('');
|
||||
}
|
||||
}
|
||||
|
||||
removeItem(indexVal: number) : void {
|
||||
let control = <FormArray>this.businessIncomeItemForm.controls['busIncome'];
|
||||
control.removeAt(indexVal);
|
||||
|
||||
}
|
||||
|
||||
// save purchase details
|
||||
submitDetails(records) {
|
||||
if (this.businessIncomeItemForm.invalid) {
|
||||
this.validateAllFormFields(this.businessIncomeItemForm);
|
||||
this.notifier.notify('warning',"Please Check All Manatory Fields..");
|
||||
return;
|
||||
}
|
||||
this._pd.saveAssessedDetails('saveOtherBusinessIncome',records.busIncome).subscribe(data => {
|
||||
this.notifier.notify('success', this.data.manage_status==2 ? 'Updated Successfully.' : 'Saved Successfully.');
|
||||
setTimeout(() =>{
|
||||
this.dialogRef.close({update_status:true});
|
||||
},3000);
|
||||
}, error => {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
});
|
||||
}
|
||||
|
||||
// validate all form group and form array fields
|
||||
validateAllFormFields(formGroup: any) {
|
||||
Object.keys(formGroup.controls).forEach(field => {
|
||||
const control = formGroup.get(field);
|
||||
if (control instanceof FormControl) {
|
||||
control.markAsTouched({ onlySelf: true });
|
||||
} else if (control instanceof FormGroup) {
|
||||
this.validateAllFormFields(control);
|
||||
} else if (control instanceof FormArray) {
|
||||
this.validateAllFormFields(control);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
<form [formGroup]="purchaseItemForm" novalidate>
|
||||
|
||||
<h2 mat-dialog-title class="paragraph_change">
|
||||
<div fxFlex="70" align="left" style="padding: 10px !important;">
|
||||
{{pageTitle}}
|
||||
</div>
|
||||
<div fxFlex="30" align="end" style="padding: 10px !important;">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="above" (click)="closeDialogue()"><mat-icon>close</mat-icon></button>
|
||||
</div>
|
||||
</h2>
|
||||
<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 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"
|
||||
matTooltip="Remove Purchase 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="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-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)" required>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div class="item-margin" fxFlex="100">
|
||||
<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%">
|
||||
<input matInput OnlyNumber type="text" placeholder="Annual Purchase" formControlName="annual_purchase_value" readonly>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div fxLayout="row" *ngIf="data.manage_status==1">
|
||||
<div fxFlex="100" align="center">
|
||||
<button type="button" mat-flat-button (click)="addMore()"
|
||||
matTooltip="Add More" matTooltipPosition="above" color="primary">
|
||||
<strong>Add More Purchase Item</strong>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<notifier-container></notifier-container>
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Save" matTooltipPosition="above" (click)="submitDetails(purchaseItemForm.value)"><mat-icon>save</mat-icon></button>
|
||||
</mat-dialog-actions>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
.paragraph_change {
|
||||
color: #fff !important;
|
||||
background-color: #e00201 !important;
|
||||
}
|
||||
mat-form-field {
|
||||
margin: 0 2%;
|
||||
}
|
||||
.example-section {
|
||||
height: 120px;
|
||||
}
|
||||
|
||||
.example-margin {
|
||||
margin: 0 10px;
|
||||
}
|
||||
::ng-deep .cdk-global-overlay-wrapper{
|
||||
justify-content: center !important;
|
||||
}
|
||||
|
||||
.item-margin {
|
||||
margin-left: 2%;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ManagePurchaseComponent } from './manage-purchase.component';
|
||||
|
||||
describe('ManagePurchaseComponent', () => {
|
||||
let component: ManagePurchaseComponent;
|
||||
let fixture: ComponentFixture<ManagePurchaseComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ManagePurchaseComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ManagePurchaseComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,129 @@
|
||||
import { Component, OnInit, Input, Output, Inject } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
|
||||
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angular/material';
|
||||
import { PdTrigerService } from './../../../../../../../pd-service/pd-triger.service';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
|
||||
@Component({
|
||||
selector: 'app-manage-purchase',
|
||||
templateUrl: './manage-purchase.component.html',
|
||||
styleUrls: ['./manage-purchase.component.scss']
|
||||
})
|
||||
export class ManagePurchaseComponent implements OnInit {
|
||||
|
||||
pageTitle:string;
|
||||
purchaseItemForm:FormGroup;
|
||||
UOMData: any[]=[];
|
||||
frequencyData: any[]=[];
|
||||
private notifier: NotifierService;
|
||||
constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef<ManagePurchaseComponent>) {
|
||||
this.UOMData=this.data.masterData.UOMList;
|
||||
this.frequencyData=this.data.masterData.frequencyList;
|
||||
this.pageTitle = this.data.manage_status==1 ? 'Add Purchase Item' : 'Update Purchase Item';
|
||||
this.notifier = notifier;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if(this.data.manage_status==2){
|
||||
this.purchaseItemForm = this._fb.group({
|
||||
purchase: this._fb.array([this.createPurchaseItemWithData(this.data.editData)]),
|
||||
});
|
||||
}
|
||||
else{
|
||||
this.purchaseItemForm = this._fb.group({
|
||||
purchase: this._fb.array([this.createPurchaseItem()]),
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// add purchase item details
|
||||
createPurchaseItem():FormGroup {
|
||||
return this._fb.group({
|
||||
purchase_id:[''],
|
||||
fk_pd_id:[this.data.masterData.pdid],
|
||||
purchase_item:['',Validators.compose([Validators.required])],
|
||||
purchase_qty:['',Validators.compose([Validators.required])],
|
||||
fk_uom_id:['',Validators.compose([Validators.required])],
|
||||
rate_per_unit:['',Validators.compose([Validators.required])],
|
||||
fk_frequency_id:['',Validators.compose([Validators.required])],
|
||||
annual_purchase_value:['',Validators.compose([Validators.required])],
|
||||
});
|
||||
}
|
||||
|
||||
// create form with data
|
||||
createPurchaseItemWithData(values: any) {
|
||||
return this._fb.group({
|
||||
purchase_id:[values.purchase_id],
|
||||
fk_pd_id:[this.data.masterData.pdid],
|
||||
purchase_item:[values.purchase_item,Validators.compose([Validators.required])],
|
||||
purchase_qty:[values.purchase_qty,Validators.compose([Validators.required])],
|
||||
fk_uom_id:[values.fk_uom_id,Validators.compose([Validators.required])],
|
||||
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])],
|
||||
});
|
||||
}
|
||||
|
||||
// add more item
|
||||
addMore(): void{
|
||||
let control = <FormArray>this.purchaseItemForm.controls['purchase'];
|
||||
control.push(this.createPurchaseItem());
|
||||
}
|
||||
|
||||
// close dialogue manually
|
||||
closeDialogue(){
|
||||
this.dialogRef.close({update_status:false});
|
||||
}
|
||||
|
||||
purchaseCalculation(indexVal: number,values: any): void {
|
||||
let control:any = <FormArray>this.purchaseItemForm.controls['purchase'];
|
||||
if(values.purchase_qty!='' && values.rate_per_unit!='' && values.fk_frequency_id!='') {
|
||||
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id);
|
||||
control.controls[indexVal].controls['annual_purchase_value'].setValue(parseInt(values.purchase_qty) * parseInt(values.rate_per_unit) * parseInt(filterFrequencyValue[0].mutiple_factor));
|
||||
|
||||
}
|
||||
else {
|
||||
control.controls[indexVal].controls['annual_purchase_value'].setValue('');
|
||||
}
|
||||
}
|
||||
|
||||
removeItem(indexVal: number) : void {
|
||||
let control = <FormArray>this.purchaseItemForm.controls['purchase'];
|
||||
control.removeAt(indexVal);
|
||||
|
||||
}
|
||||
|
||||
// save purchase details
|
||||
submitDetails(records) {
|
||||
if (this.purchaseItemForm.invalid) {
|
||||
this.validateAllFormFields(this.purchaseItemForm);
|
||||
this.notifier.notify('warning',"Please Check All Manatory Fields..");
|
||||
return;
|
||||
}
|
||||
this._pd.saveAssessedDetails('saveAssessedIncomePurchaseDetails',records.purchase).subscribe(data => {
|
||||
this.notifier.notify('success', this.data.manage_status==2 ? 'Updated Successfully.' : 'Saved Successfully.');
|
||||
setTimeout(() =>{
|
||||
this.dialogRef.close({update_status:true});
|
||||
},3000);
|
||||
}, error => {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
});
|
||||
}
|
||||
|
||||
// validate all form group and form array fields
|
||||
validateAllFormFields(formGroup: any) {
|
||||
Object.keys(formGroup.controls).forEach(field => {
|
||||
const control = formGroup.get(field);
|
||||
if (control instanceof FormControl) {
|
||||
control.markAsTouched({ onlySelf: true });
|
||||
} else if (control instanceof FormGroup) {
|
||||
this.validateAllFormFields(control);
|
||||
} else if (control instanceof FormArray) {
|
||||
this.validateAllFormFields(control);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
<form [formGroup]="salesItemForm" novalidate>
|
||||
|
||||
<h2 mat-dialog-title class="paragraph_change">
|
||||
<div fxFlex="70" align="left" style="padding: 10px !important;">
|
||||
{{pageTitle}}
|
||||
</div>
|
||||
<div fxFlex="30" align="end" style="padding: 10px !important;">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="above" (click)="closeDialogue()"><mat-icon>close</mat-icon></button>
|
||||
</div>
|
||||
</h2>
|
||||
<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 fxFlex="100">
|
||||
<mat-form-field style="width: 87%">
|
||||
<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"
|
||||
matTooltip="Remove Sales 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="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-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-form-field>
|
||||
</div>
|
||||
|
||||
<div class="item-margin" fxFlex="100">
|
||||
<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: 25%">
|
||||
<input matInput OnlyNumber type="text" placeholder="Annual Sales" formControlName="annual_sale_value" readonly>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="item-margin" fxFlex="100" *ngIf="data.margin_calculation_status===true">
|
||||
<mat-form-field style="width: 25%">
|
||||
<input matInput OnlyNumber type="text" placeholder="Margin Percentage %" formControlName="margin_per" (keyup)="salesMarginPerCalculation(s,sales.value)">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 25%">
|
||||
<input matInput OnlyNumber type="text" placeholder="Margin Amount" formControlName="margin_per_uom" (keyup)="salesMarginAmtCalculation(s,sales.value)">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 25%">
|
||||
<input matInput OnlyNumber type="text" placeholder="Final Value" formControlName="margin_final_value" readonly>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div fxLayout="row" *ngIf="data.manage_status==1">
|
||||
<div fxFlex="100" align="center">
|
||||
<button type="button" mat-flat-button (click)="addMore()"
|
||||
matTooltip="Add More" matTooltipPosition="above" color="primary">
|
||||
<strong>Add More Sales Item</strong>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<notifier-container></notifier-container>
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Save" matTooltipPosition="above" (click)="submitDetails(salesItemForm.value)"><mat-icon>save</mat-icon></button>
|
||||
</mat-dialog-actions>
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
.paragraph_change {
|
||||
color: #fff !important;
|
||||
background-color: #e00201 !important;
|
||||
}
|
||||
mat-form-field {
|
||||
margin: 0 2%;
|
||||
}
|
||||
.example-section {
|
||||
height: 120px;
|
||||
}
|
||||
|
||||
.example-margin {
|
||||
margin: 0 10px;
|
||||
}
|
||||
::ng-deep .cdk-global-overlay-wrapper{
|
||||
justify-content: center !important;
|
||||
}
|
||||
|
||||
.item-margin {
|
||||
margin-left: 2%;
|
||||
}
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ManageSalesComponent } from './manage-sales.component';
|
||||
|
||||
describe('ManageSalesComponent', () => {
|
||||
let component: ManageSalesComponent;
|
||||
let fixture: ComponentFixture<ManageSalesComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ManageSalesComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ManageSalesComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,157 @@
|
||||
import { Component, OnInit, Input, Output, Inject } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
|
||||
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angular/material';
|
||||
import { PdTrigerService } from './../../../../../../../pd-service/pd-triger.service';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
|
||||
@Component({
|
||||
selector: 'app-manage-sales',
|
||||
templateUrl: './manage-sales.component.html',
|
||||
styleUrls: ['./manage-sales.component.scss']
|
||||
})
|
||||
export class ManageSalesComponent implements OnInit {
|
||||
pageTitle:string;
|
||||
salesItemForm:FormGroup;
|
||||
UOMData: any[]=[];
|
||||
frequencyData: any[]=[];
|
||||
private notifier: NotifierService;
|
||||
constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef<ManageSalesComponent>) {
|
||||
this.UOMData=this.data.masterData.UOMList;
|
||||
this.frequencyData=this.data.masterData.frequencyList;
|
||||
this.pageTitle = this.data.manage_status==1 ? 'Add Sales Item' : 'Update Sales Item';
|
||||
this.notifier = notifier;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if(this.data.manage_status==2){
|
||||
this.salesItemForm = this._fb.group({
|
||||
salesCalItemwise: this._fb.array([this.createSalesItemWithData(this.data.editData)]),
|
||||
});
|
||||
}
|
||||
else{
|
||||
this.salesItemForm = this._fb.group({
|
||||
salesCalItemwise: this._fb.array([this.createSalesItem()]),
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// add sales item details
|
||||
createSalesItem():FormGroup {
|
||||
return this._fb.group({
|
||||
sci_id:[],
|
||||
fk_pd_id:[this.data.masterData.pdid],
|
||||
sales_item:['',Validators.compose([Validators.required])],
|
||||
sales_qty:['',Validators.compose([Validators.required])],
|
||||
fk_uom_id:['',Validators.compose([Validators.required])],
|
||||
rate_per_unit:['',Validators.compose([Validators.required])],
|
||||
fk_frequency_id:['',Validators.compose([Validators.required])],
|
||||
annual_sale_value:[''],
|
||||
margin_per:[''],
|
||||
margin_per_uom:[''],
|
||||
margin_final_value:[''],
|
||||
});
|
||||
}
|
||||
|
||||
// create form with data
|
||||
createSalesItemWithData(values: any) {
|
||||
return this._fb.group({
|
||||
sci_id:[values.sci_id],
|
||||
fk_pd_id:[this.data.masterData.pdid],
|
||||
sales_item:[values.sales_item,Validators.compose([Validators.required])],
|
||||
sales_qty:[values.sales_qty,Validators.compose([Validators.required])],
|
||||
fk_uom_id:[values.fk_uom_id,Validators.compose([Validators.required])],
|
||||
rate_per_unit:[values.rate_per_unit,Validators.compose([Validators.required])],
|
||||
fk_frequency_id:[values.fk_frequency_id,Validators.compose([Validators.required])],
|
||||
annual_sale_value:[values.annual_sale_value],
|
||||
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: ''],
|
||||
});
|
||||
}
|
||||
|
||||
// add more item
|
||||
addMore(): void{
|
||||
let control = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
|
||||
control.push(this.createSalesItem());
|
||||
}
|
||||
|
||||
// close dialogue manually
|
||||
closeDialogue(){
|
||||
this.dialogRef.close({update_status:false});
|
||||
}
|
||||
|
||||
salesCalculation(indexVal: number,values: any): void {
|
||||
let control:any = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
|
||||
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);
|
||||
control.controls[indexVal].controls['annual_sale_value'].setValue(parseInt(values.sales_qty) * parseInt(values.rate_per_unit) * parseInt(filterFrequencyValue[0].mutiple_factor));
|
||||
|
||||
}
|
||||
else {
|
||||
control.controls[indexVal].controls['annual_sale_value'].setValue('');
|
||||
}
|
||||
if(this.data.margin_calculation_status===true) {
|
||||
values.margin_per_uom=='' && values.margin_per!='' ? this.salesMarginPerCalculation(indexVal,this.salesItemForm.value.salesCalItemwise[indexVal]): values.margin_per_uom!='' && values.margin_per=='' ? this.salesMarginAmtCalculation(indexVal,this.salesItemForm.value.salesCalItemwise[indexVal]) : values.margin_per_uom!='' && values.margin_per!='' ? this.salesMarginAmtCalculation(indexVal,this.salesItemForm.value.salesCalItemwise[indexVal]) :this.salesMarginAmtCalculation(indexVal,this.salesItemForm.value.salesCalItemwise[indexVal]);
|
||||
}
|
||||
}
|
||||
salesMarginPerCalculation(indexVal: number,values: any): void {
|
||||
let control:any = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
|
||||
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));
|
||||
}
|
||||
else {
|
||||
control.controls[indexVal].controls['margin_final_value'].setValue('');
|
||||
}
|
||||
}
|
||||
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!='' && values.sales_qty!='') {
|
||||
control.controls[indexVal].controls['margin_final_value'].setValue(parseInt(values.sales_qty) * parseInt(values.margin_per_uom));
|
||||
}
|
||||
else {
|
||||
control.controls[indexVal].controls['margin_final_value'].setValue('');
|
||||
}
|
||||
}
|
||||
|
||||
removeItem(indexVal: number) : void {
|
||||
let control = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
|
||||
control.removeAt(indexVal);
|
||||
|
||||
}
|
||||
|
||||
// save sales details
|
||||
submitDetails(records) {
|
||||
if (this.salesItemForm.invalid) {
|
||||
this.validateAllFormFields(this.salesItemForm);
|
||||
this.notifier.notify('warning',"Please Check All Manatory Fields..");
|
||||
return;
|
||||
}
|
||||
this._pd.saveAssessedDetails('saveAssessedIncomeSalesCalculatedByItemwise',records.salesCalItemwise).subscribe(data => {
|
||||
this.notifier.notify('success', this.data.manage_status==2 ? 'Updated Successfully.' : 'Saved Successfully.');
|
||||
setTimeout(() =>{
|
||||
this.dialogRef.close({update_status:true});
|
||||
},3000);
|
||||
}, error => {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
});
|
||||
}
|
||||
|
||||
// validate all form group and form array fields
|
||||
validateAllFormFields(formGroup: any) {
|
||||
Object.keys(formGroup.controls).forEach(field => {
|
||||
const control = formGroup.get(field);
|
||||
if (control instanceof FormControl) {
|
||||
control.markAsTouched({ onlySelf: true });
|
||||
} else if (control instanceof FormGroup) {
|
||||
this.validateAllFormFields(control);
|
||||
} else if (control instanceof FormArray) {
|
||||
this.validateAllFormFields(control);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,6 +1,4 @@
|
||||
<form [formGroup]="_assessedIncomeFormFrom">
|
||||
|
||||
<h2 mat-dialog-title class="paragraph_change">
|
||||
<h2 mat-dialog-title class="paragraph_change">
|
||||
<div fxFlex="70" align="left" style="padding: 10px !important;">
|
||||
{{pageTitle}}
|
||||
</div>
|
||||
@ -11,371 +9,228 @@
|
||||
</h2>
|
||||
|
||||
<mat-dialog-content>
|
||||
|
||||
|
||||
<mat-tab-group>
|
||||
<mat-tab label="Questions">
|
||||
<ng-template matTabContent>
|
||||
<div fxLayout="row wrap">
|
||||
<div fxFlex="100">
|
||||
|
||||
|
||||
|
||||
<!--start assessed income tabs control-->
|
||||
<mat-tab-group #matgroup>
|
||||
<mat-tab label="Summary">
|
||||
<ng-template matTabContent>
|
||||
<mat-card>
|
||||
<mat-card-content>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Sales Declared By Customer" formControlName="sales_declared_by_customer">
|
||||
</mat-form-field>
|
||||
<mat-accordion multi="false">
|
||||
<mat-expansion-panel>
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
<small class="expan_table_header">Sales Calculate Item Wise</small>
|
||||
</mat-panel-title>
|
||||
<mat-panel-description class="subtitle_message">
|
||||
{{salesCaluatedItem.length}} Items
|
||||
</mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
<ng-template matExpansionPanelContent>
|
||||
<div class="example-container mat-elevation-z8">
|
||||
<table mat-table [dataSource]="salesCaluatedItem">
|
||||
<!-- Item Column -->
|
||||
<ng-container matColumnDef="Item">
|
||||
<th mat-header-cell *matHeaderCellDef>Item</th>
|
||||
<td mat-cell *matCellDef="let salesItem">{{salesItem.sales_item}} </td>
|
||||
</ng-container>
|
||||
<!-- Qty/Uom Column-->
|
||||
<ng-container matColumnDef="Qty/UOM">
|
||||
<th mat-header-cell *matHeaderCellDef>Qty/UOM</th>
|
||||
<td mat-cell *matCellDef="let salesItem">{{salesItem.sales_qty }}/{{salesItem.uom_name }} </td>
|
||||
</ng-container>
|
||||
<!-- Rate/Unit Column-->
|
||||
<ng-container matColumnDef="Rate/Unit">
|
||||
<th mat-header-cell *matHeaderCellDef>Rate/Unit</th>
|
||||
<td mat-cell *matCellDef="let salesItem"> {{salesItem.rate_per_unit }} </td>
|
||||
</ng-container>
|
||||
<!-- Frequency Name Column -->
|
||||
<mat-card-content>
|
||||
<mat-nav-list>
|
||||
|
||||
<mat-list-item (click)='matgroup.selectedIndex = 1'>
|
||||
<div fxFlex.xs="70" fxFlex.sm="70" fxFlex.md="50" fxFlex.lg="40" fxFlex.xl="40">
|
||||
<p matLine> a) Cost of Goods Sold </p>
|
||||
</div>
|
||||
<div fxFlex.xs="30" fxFlex.sm="30" fxFlex.md="20" fxFlex.lg="25" fxFlex.xl="25" class="mat_list_center_div">
|
||||
<p matLine> {{sales_value}} </p>
|
||||
</div>
|
||||
|
||||
</mat-list-item>
|
||||
<mat-list-item (click)='matgroup.selectedIndex = 2'>
|
||||
<div fxFlex.xs="70" fxFlex.sm="70" fxFlex.md="50" fxFlex.lg="40" fxFlex.xl="40">
|
||||
<p matLine> b) Purchases </p>
|
||||
</div>
|
||||
<div fxFlex.xs="30" fxFlex.sm="30" fxFlex.md="20" fxFlex.lg="25" fxFlex.xl="25" class="mat_list_center_div">
|
||||
<p matLine> {{purchase_value}} </p>
|
||||
</div>
|
||||
|
||||
</mat-list-item>
|
||||
<mat-list-item>
|
||||
<div fxFlex.xs="70" fxFlex.sm="70" fxFlex.md="50" fxFlex.lg="40" fxFlex.xl="40">
|
||||
<p matLine> c) Gross Profit (a-b) </p>
|
||||
</div>
|
||||
<div fxFlex.xs="30" fxFlex.sm="30" fxFlex.md="20" fxFlex.lg="25" fxFlex.xl="25" class="mat_list_center_div">
|
||||
<p matLine> {{gross_profit_value}} </p>
|
||||
</div>
|
||||
|
||||
</mat-list-item>
|
||||
<mat-list-item (click)='matgroup.selectedIndex = 5'>
|
||||
<div fxFlex.xs="70" fxFlex.sm="70" fxFlex.md="50" fxFlex.lg="40" fxFlex.xl="40">
|
||||
<p matLine> d) Other Income </p>
|
||||
</div>
|
||||
<div fxFlex.xs="30" fxFlex.sm="30" fxFlex.md="20" fxFlex.lg="25" fxFlex.xl="25" class="mat_list_center_div">
|
||||
<p matLine> {{other_income_value}}</p>
|
||||
</div>
|
||||
|
||||
</mat-list-item>
|
||||
<mat-list-item (click)='matgroup.selectedIndex = 3'>
|
||||
<div fxFlex.xs="70" fxFlex.sm="70" fxFlex.md="50" fxFlex.lg="40" fxFlex.xl="40">
|
||||
<p matLine> e) Other Expenses </p>
|
||||
</div>
|
||||
<div fxFlex.xs="30" fxFlex.sm="30" fxFlex.md="20" fxFlex.lg="25" fxFlex.xl="25" class="mat_list_center_div">
|
||||
<p matLine> {{other_expense_value}} </p>
|
||||
</div>
|
||||
|
||||
</mat-list-item>
|
||||
<mat-list-item>
|
||||
<div fxFlex.xs="70" fxFlex.sm="70" fxFlex.md="50" fxFlex.lg="40" fxFlex.xl="40">
|
||||
<p matLine> f) Net Profit (c+d-e) </p>
|
||||
|
||||
<ng-container matColumnDef="Frequency">
|
||||
<th mat-header-cell *matHeaderCellDef>Frequency</th>
|
||||
<td mat-cell *matCellDef="let salesItem"> {{salesItem.frequency_name}} </td>
|
||||
</ng-container>
|
||||
<!-- Annual Sale Value Column-->
|
||||
<ng-container matColumnDef="Annual Sale Value">
|
||||
<th mat-header-cell *matHeaderCellDef>Annual Sale Value</th>
|
||||
<td mat-cell *matCellDef="let salesItem"> {{salesItem.annual_sale_value}} </td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="salesCaluatedItemColumns; sticky: true"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: salesCaluatedItemColumns;"></tr>
|
||||
</table>
|
||||
</div>
|
||||
</ng-template>
|
||||
</mat-expansion-panel>
|
||||
<mat-expansion-panel>
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
<small class="expan_table_header">Sales Calculate Month Wise</small>
|
||||
</mat-panel-title>
|
||||
<mat-panel-description class="subtitle_message">
|
||||
{{salesMonthWiseExpandedItems.length}} Items
|
||||
</mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
<ng-template matExpansionPanelContent>
|
||||
<!-- <mat-accordion multi="true">
|
||||
<mat-expansion-panel *ngFor="let expandDetails of salesMonthWiseExpandedItems">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
<small class="expan_table_header">{{expandDetails.salesItem}}</small>
|
||||
</mat-panel-title>
|
||||
</mat-expansion-panel-header>
|
||||
<ng-template matExpansionPanelContent>
|
||||
|
||||
|
||||
</ng-template>
|
||||
|
||||
<mat-action-row *ngFor="let footer of expandDetails.footerMessage">
|
||||
<div fxFlex="50" >
|
||||
<small class="expan_footer">{{footer.month_message}}</small>
|
||||
</div>
|
||||
<div fxFlex="50" >
|
||||
<small class="expan_footer">{{footer.year_message}}</small>
|
||||
</div>
|
||||
</mat-action-row>
|
||||
</mat-expansion-panel>
|
||||
</mat-accordion> -->
|
||||
<mat-card *ngFor="let expandDetails of salesMonthWiseExpandedItems">
|
||||
<mat-card-header>
|
||||
<mat-card-title><small class="expan_table_header">{{expandDetails.salesItem}}</small></mat-card-title>
|
||||
<mat-card-subtitle class="subtitle_message" *ngFor="let footer of expandDetails.footerMessage">
|
||||
<div fxFlex="100">
|
||||
{{footer.month_message}} {{footer.year_message}}
|
||||
</div>
|
||||
|
||||
</mat-card-subtitle>
|
||||
</mat-card-header>
|
||||
<mat-divider></mat-divider>
|
||||
<mat-card-content style="display: flex;margin-top: -20px;">
|
||||
<!-- <div fxLayout="row wrap">
|
||||
</div> -->
|
||||
<div fxFlex="50" *ngFor="let eachItem of expandDetails.expandElements" class="m-gap p-gap">
|
||||
|
||||
<h4 align="center" class="h4_font">{{eachItem.header}}</h4>
|
||||
<table mat-table [dataSource]="eachItem.value" class="mat-elevation-z8">
|
||||
<ng-container matColumnDef="Date">
|
||||
<th mat-header-cell *matHeaderCellDef>Date</th>
|
||||
<td mat-cell *matCellDef="let itemValue">{{itemValue.sales_date | date: 'dd-MM-yyyy'}} </td>
|
||||
<td mat-footer-cell *matFooterCellDef> Total </td>
|
||||
</ng-container>
|
||||
<!-- Value Column-->
|
||||
<ng-container matColumnDef="Amount">
|
||||
<th mat-header-cell *matHeaderCellDef>Amount</th>
|
||||
<td mat-cell *matCellDef="let itemValue">{{itemValue.sales_value}}</td>
|
||||
<td mat-footer-cell *matFooterCellDef> {{getTotalCost(eachItem.value)}} </td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="salesMonthItemColumns; sticky: true"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: salesMonthItemColumns;"></tr>
|
||||
<tr mat-footer-row *matFooterRowDef="salesMonthItemColumns; sticky: true"></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</mat-card-content>
|
||||
</div>
|
||||
<div fxFlex.xs="30" fxFlex.sm="30" fxFlex.md="20" fxFlex.lg="25" fxFlex.xl="25" class="mat_list_center_div">
|
||||
<p matLine> {{net_profit_value}} </p>
|
||||
</div>
|
||||
|
||||
</mat-list-item>
|
||||
<mat-list-item (click)='matgroup.selectedIndex = 4'>
|
||||
<div fxFlex.xs="70" fxFlex.sm="70" fxFlex.md="50" fxFlex.lg="40" fxFlex.xl="40">
|
||||
<p matLine> g) Household Expenses </p>
|
||||
|
||||
</div>
|
||||
<div fxFlex.xs="30" fxFlex.sm="30" fxFlex.md="20" fxFlex.lg="25" fxFlex.xl="25" class="mat_list_center_div">
|
||||
<p matLine> {{house_hold_value}} </p>
|
||||
</div>
|
||||
|
||||
</mat-list-item>
|
||||
<mat-list-item>
|
||||
<div fxFlex.xs="70" fxFlex.sm="70" fxFlex.md="50" fxFlex.lg="40" fxFlex.xl="40">
|
||||
<p matLine> h) Net Disposable Income (f-g) </p>
|
||||
|
||||
|
||||
</div>
|
||||
<div fxFlex.xs="30" fxFlex.sm="30" fxFlex.md="20" fxFlex.lg="25" fxFlex.xl="25" class="mat_list_center_div">
|
||||
<p matLine> {{net_disable_income_value}} </p>
|
||||
</div>
|
||||
|
||||
</mat-list-item>
|
||||
|
||||
|
||||
</mat-nav-list>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
<mat-tab label="Sales">
|
||||
<ng-template matTabContent>
|
||||
<app-gross-profit-calculation [masterData]="getCustomValues" [parentData]="grossProfitTypeList" (loadAssessedForms)="loadAIDetails()"></app-gross-profit-calculation>
|
||||
<app-sales-calculation [masterData]="getCustomValues" [parentData]="salesDeclaredCustomer" (loadAssessedForms)="loadAIDetails()"></app-sales-calculation>
|
||||
<app-sales-details [masterData]="getCustomValues" [parentData]="salesCaluatedItem" (loadAssessedForms)="loadAIDetails()"></app-sales-details>
|
||||
<app-daily-sales-details [masterData]="getCustomValues" [parentData]="salesMonthWiseExpandedItems" (loadAssessedForms)="loadAIDetails()"></app-daily-sales-details>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
<mat-tab label="Purchase">
|
||||
<ng-template matTabContent>
|
||||
<app-gross-profit-calculation [masterData]="getCustomValues" [parentData]="grossProfitTypeList" (loadAssessedForms)="loadAIDetails()"></app-gross-profit-calculation>
|
||||
<app-purchase-details [masterData]="getCustomValues" [parentData]="purchaseDetails" (loadAssessedForms)="loadAIDetails()"></app-purchase-details>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
<mat-tab label="Business Expense">
|
||||
<ng-template matTabContent>
|
||||
<app-business-expense-details [masterData]="getCustomValues" [parentData]="businessExpenses" (loadAssessedForms)="loadAIDetails()"></app-business-expense-details>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
<mat-tab label="House Hold">
|
||||
<ng-template matTabContent>
|
||||
<app-house-hold-details [masterData]="getCustomValues" [parentData]="houseHoldExpenses" (loadAssessedForms)="loadAIDetails()"></app-house-hold-details>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
<mat-tab label="Other Business Income">
|
||||
<ng-template matTabContent>
|
||||
<app-other-business-income-details [masterData]="getCustomValues" [parentData]="otherBusinessIncome" (loadAssessedForms)="loadAIDetails()"></app-other-business-income-details>
|
||||
|
||||
</mat-card>
|
||||
|
||||
</ng-template>
|
||||
</mat-expansion-panel>
|
||||
|
||||
<mat-expansion-panel>
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
<small class="expan_table_header">Purchase Details</small>
|
||||
</mat-panel-title>
|
||||
<mat-panel-description class="subtitle_message">
|
||||
{{purchaseDetails.length}} Items
|
||||
</mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
<ng-template matExpansionPanelContent>
|
||||
<div class="example-container mat-elevation-z8">
|
||||
<table mat-table [dataSource]="purchaseDetails">
|
||||
<!-- Item Column -->
|
||||
<ng-container matColumnDef="Item">
|
||||
<th mat-header-cell *matHeaderCellDef>Item</th>
|
||||
<td mat-cell *matCellDef="let purchaseItem">{{purchaseItem.purchase_item}} </td>
|
||||
</ng-container>
|
||||
<!-- Qty/Uom Column-->
|
||||
<ng-container matColumnDef="Qty/UOM">
|
||||
<th mat-header-cell *matHeaderCellDef>Qty/UOM</th>
|
||||
<td mat-cell *matCellDef="let purchaseItem">{{purchaseItem.purchase_qty }}/{{purchaseItem.uom_name }} </td>
|
||||
</ng-container>
|
||||
<!-- Rate/Unit Column-->
|
||||
<ng-container matColumnDef="Rate/Unit">
|
||||
<th mat-header-cell *matHeaderCellDef>Rate/Unit</th>
|
||||
<td mat-cell *matCellDef="let purchaseItem"> {{purchaseItem.rate_per_unit }} </td>
|
||||
</ng-container>
|
||||
<!-- Frequency Name Column -->
|
||||
|
||||
<ng-container matColumnDef="Frequency">
|
||||
<th mat-header-cell *matHeaderCellDef>Frequency</th>
|
||||
<td mat-cell *matCellDef="let purchaseItem"> {{purchaseItem.frequency_name}} </td>
|
||||
</ng-container>
|
||||
<!-- Annual Sale Value Column-->
|
||||
<ng-container matColumnDef="Annual Purchase Value">
|
||||
<th mat-header-cell *matHeaderCellDef>Annual Purchase Value</th>
|
||||
<td mat-cell *matCellDef="let purchaseItem"> {{purchaseItem.annual_purchase_value}} </td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="purchaseDetailsColumns; sticky: true"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: purchaseDetailsColumns;"></tr>
|
||||
</table>
|
||||
</div>
|
||||
</ng-template>
|
||||
</mat-expansion-panel>
|
||||
<mat-expansion-panel>
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
<small class="expan_table_header">Business Expenses</small>
|
||||
</mat-panel-title>
|
||||
<mat-panel-description class="subtitle_message">
|
||||
{{businessExpenses.length}} Items
|
||||
</mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
<ng-template matExpansionPanelContent>
|
||||
<div class="example-container mat-elevation-z8">
|
||||
<table mat-table [dataSource]="businessExpenses">
|
||||
<!-- Expense Item Column -->
|
||||
<ng-container matColumnDef="Item">
|
||||
<th mat-header-cell *matHeaderCellDef>Item</th>
|
||||
<td mat-cell *matCellDef="let businessEx"> {{businessEx.expense_item}} </td>
|
||||
</ng-container>
|
||||
|
||||
<!-- Expense Value Column-->
|
||||
<ng-container matColumnDef="Value">
|
||||
<th mat-header-cell *matHeaderCellDef>Value</th>
|
||||
<td mat-cell *matCellDef="let businessEx"> {{businessEx.expense_value }} </td>
|
||||
</ng-container>
|
||||
<!-- Frequency Name Column -->
|
||||
<ng-container matColumnDef="Frequency">
|
||||
<th mat-header-cell *matHeaderCellDef>Frequency</th>
|
||||
<td mat-cell *matCellDef="let businessEx"> {{businessEx.frequency_name}} </td>
|
||||
</ng-container>
|
||||
<!-- Annual Expenses Value Column-->
|
||||
<ng-container matColumnDef="Annual Expenses Value">
|
||||
<th mat-header-cell *matHeaderCellDef>Annual Expenses Value</th>
|
||||
<td mat-cell *matCellDef="let businessEx"> {{businessEx.annual_expenses_value}} </td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="businessExpensesColumns; sticky: true"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: businessExpensesColumns;"></tr>
|
||||
</table>
|
||||
</div>
|
||||
</ng-template>
|
||||
</mat-expansion-panel>
|
||||
<mat-expansion-panel>
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
<small class="expan_table_header">House Hold Expenses</small>
|
||||
</mat-panel-title>
|
||||
<mat-panel-description class="subtitle_message">
|
||||
{{houseHoldExpenses.length}} Items
|
||||
</mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
<ng-template matExpansionPanelContent>
|
||||
<div class="example-container mat-elevation-z8">
|
||||
<table mat-table [dataSource]="houseHoldExpenses">
|
||||
<!-- Item Column -->
|
||||
<ng-container matColumnDef="Item">
|
||||
<th mat-header-cell *matHeaderCellDef>Item</th>
|
||||
<td mat-cell *matCellDef="let householdItem">{{householdItem.expense_item}} </td>
|
||||
</ng-container>
|
||||
<!-- Value Column-->
|
||||
<ng-container matColumnDef="Value">
|
||||
<th mat-header-cell *matHeaderCellDef>Value</th>
|
||||
<td mat-cell *matCellDef="let householdItem">{{householdItem.expense_value }}</td>
|
||||
</ng-container>
|
||||
<!-- Frequency Name Column -->
|
||||
<ng-container matColumnDef="Frequency">
|
||||
<th mat-header-cell *matHeaderCellDef>Frequency</th>
|
||||
<td mat-cell *matCellDef="let householdItem"> {{householdItem.frequency_name}} </td>
|
||||
</ng-container>
|
||||
<!-- Annual Expense Value Column-->
|
||||
<ng-container matColumnDef="Annual Expenses Value">
|
||||
<th mat-header-cell *matHeaderCellDef>Annual Expenses Value</th>
|
||||
<td mat-cell *matCellDef="let householdItem"> {{householdItem.annual_expense_value}} </td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="houseHoldExpensesColumns; sticky: true"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: houseHoldExpensesColumns;"></tr>
|
||||
</table>
|
||||
</div>
|
||||
</ng-template>
|
||||
</mat-expansion-panel>
|
||||
</mat-accordion>
|
||||
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
<mat-tab label="Docs">
|
||||
<ng-template matTabContent>
|
||||
<div ngxViewer>
|
||||
<div fxLayout="row wrap" style="padding:20px;">
|
||||
<div fxFlex="100">
|
||||
<div fxFlex="20" class="m-gap p-gap">
|
||||
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
|
||||
<div class="p-list">
|
||||
<div class="top"> <img src="https://picsum.photos/2000/1500/?random=1" alt="Image 1"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div fxFlex="20" class="m-gap p-gap">
|
||||
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
|
||||
<div class="p-list">
|
||||
<div class="top"> <img src="https://picsum.photos/2000/1500/?random=2" alt="Image 2"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div fxFlex="20" class="m-gap p-gap">
|
||||
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
|
||||
<div class="p-list">
|
||||
<div class="top"><img src="https://picsum.photos/2000/1500/?random=3" alt="Image 3"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div fxFlex="20" class="m-gap p-gap">
|
||||
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
|
||||
<div class="p-list">
|
||||
<div class="top"> <img src="https://picsum.photos/2000/1500/?random=2" alt="Image 2"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div fxFlex="20" class="m-gap p-gap">
|
||||
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
|
||||
<div class="p-list">
|
||||
<div class="top"><img src="https://picsum.photos/2000/1500/?random=3" alt="Image 3"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div fxFlex="20" class="m-gap p-gap">
|
||||
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
|
||||
<div class="p-list">
|
||||
<div class="top"> <img src="https://picsum.photos/2000/1500/?random=1" alt="Image 1"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div fxFlex="row">
|
||||
<div fxFlex="100" class="m-gap p-gap">
|
||||
<div fxLayout="row" fxLayoutWrap="wrap">
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
<mat-tab label="Docs">
|
||||
<ng-template matTabContent>
|
||||
<div ngxViewer>
|
||||
<div fxLayout="row wrap" style="padding:20px;">
|
||||
<div fxFlex="100">
|
||||
<div fxFlex="20" class="m-gap p-gap">
|
||||
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
|
||||
<div class="p-list">
|
||||
<div class="top"> <img src="https://picsum.photos/2000/1500/?random=1" alt="Image 1"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div fxFlex="20" class="m-gap p-gap">
|
||||
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
|
||||
<div class="p-list">
|
||||
<div class="top"> <img src="https://picsum.photos/2000/1500/?random=2" alt="Image 2"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div fxFlex="20" class="m-gap p-gap">
|
||||
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
|
||||
<div class="p-list">
|
||||
<div class="top"><img src="https://picsum.photos/2000/1500/?random=3" alt="Image 3"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div fxFlex="20" class="m-gap p-gap">
|
||||
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
|
||||
<div class="p-list">
|
||||
<div class="top"> <img src="https://picsum.photos/2000/1500/?random=2" alt="Image 2"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div fxFlex="20" class="m-gap p-gap">
|
||||
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
|
||||
<div class="p-list">
|
||||
<div class="top"><img src="https://picsum.photos/2000/1500/?random=3" alt="Image 3"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div fxFlex="20" class="m-gap p-gap">
|
||||
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
|
||||
<div class="p-list">
|
||||
<div class="top"> <img src="https://picsum.photos/2000/1500/?random=1" alt="Image 1"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
</div>
|
||||
<div fxLayout="row" fxLayoutWrap="wrap">
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
|
||||
</mat-tab-group>
|
||||
<div fxFlex="row">
|
||||
<div fxFlex="100" class="m-gap p-gap">
|
||||
<div fxLayout="row" fxLayoutWrap="wrap">
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
</div>
|
||||
<div fxLayout="row" fxLayoutWrap="wrap">
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
<!-- end assessed income tabs control -->
|
||||
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions>
|
||||
@ -388,7 +243,7 @@
|
||||
<div fxFlex="40" align="end">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="submit" matTooltip="Save" matTooltipPosition="above"><mat-icon>save</mat-icon></button>
|
||||
</div> -->
|
||||
|
||||
</mat-dialog-actions>
|
||||
|
||||
</form>
|
||||
|
||||
<notifier-container></notifier-container>
|
||||
@ -3,35 +3,11 @@
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
tr.mat-footer-row {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.mat-table-sticky {
|
||||
border-top: 1px solid #e0e0e0;
|
||||
}
|
||||
|
||||
::ng-deep .cdk-global-overlay-wrapper{
|
||||
justify-content: center !important;
|
||||
}
|
||||
.mat-form-field {
|
||||
width: 100%;
|
||||
}
|
||||
.expan_footer{
|
||||
font-size: 18px;
|
||||
direction: rtl;
|
||||
}
|
||||
.expan_table_header {
|
||||
font-size: 18px;
|
||||
text-align: center;
|
||||
}
|
||||
.h4_font {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.subtitle_message {
|
||||
color:#e00201 !important;
|
||||
}
|
||||
@ -144,4 +120,21 @@ tr.mat-footer-row {
|
||||
border:1px solid rgba(0, 0, 0, 0.12);
|
||||
}
|
||||
|
||||
mat-list-item:nth-child(3) {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
mat-list-item:nth-child(6) {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
mat-list-item:nth-child(8) {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
.mat_list_right_div {
|
||||
text-align: left;
|
||||
}
|
||||
.mat_list_center_div {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import {Component,OnInit,Inject,Input, ViewChild } from '@angular/core';
|
||||
import {FormBuilder,FormGroup,Validators,FormArray, FormControl,} from '@angular/forms';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
import {
|
||||
MatDialog,
|
||||
@ -16,42 +15,65 @@ import { ActivatedRoute, Router } from "@angular/router";
|
||||
styleUrls: ['./assessed-income.component.scss']
|
||||
})
|
||||
export class AssessedIncomeComponent implements OnInit {
|
||||
public _assessedIncomeFormFrom: FormGroup;
|
||||
private notifier: NotifierService;
|
||||
pageTitle: string ="Assessed Income Details";
|
||||
// @Input() pdid: number;
|
||||
// @Input() form_id: number;
|
||||
pdid: number;
|
||||
form_id: number;
|
||||
salesCaluatedItemColumns: string[] = ['Item', 'Qty/UOM','Rate/Unit','Frequency','Annual Sale Value'];
|
||||
displayedColumns = ['sno','list','amount'];
|
||||
sales_value: number;
|
||||
purchase_value: number;
|
||||
gross_profit_value: number;
|
||||
other_income_value: number;
|
||||
other_expense_value: number;
|
||||
net_profit_value: number;
|
||||
house_hold_value: number;
|
||||
net_disable_income_value: number;
|
||||
public salesCaluatedItem:any= [];
|
||||
salesItemMonthWiseColumns: string[] = ['Item', 'Value','Frequency','Annual Expenses Value'];
|
||||
public salesItemMonthWise:any= [];
|
||||
purchaseDetailsColumns: string[] = ['Item', 'Qty/UOM','Rate/Unit','Frequency','Annual Purchase Value'];
|
||||
public purchaseDetails:any= [];
|
||||
businessExpensesColumns: string[] = ['Item', 'Value','Frequency','Annual Expenses Value'];
|
||||
public businessExpenses:any= [];
|
||||
houseHoldExpensesColumns: string[] = ['Item', 'Value','Frequency','Annual Expenses Value'];
|
||||
public houseHoldExpenses:any= [];
|
||||
|
||||
public salesMonthItemColumns = ['Date','Amount'];
|
||||
public otherBusinessIncome: any=[];
|
||||
|
||||
|
||||
// Sales Item MonthWise declare table header,body andd footer elements
|
||||
salesMonthWiseTable:any=[];
|
||||
salesItemMonthWiseBody: any[];
|
||||
salesItemMonthWiseFooter: any[];
|
||||
|
||||
salesMonthWiseExpandedItems: any=[]
|
||||
|
||||
|
||||
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
|
||||
public UOMList: any=[];
|
||||
public frequencyList: any=[];
|
||||
public businessExpenseList: any=[];
|
||||
public businessIncomeList: any=[];
|
||||
public grossProfitTypeList: any=[];
|
||||
public salesDeclaredCustomer: any=[];
|
||||
public getCustomValues:any = { UOMList: this.UOMList,frequencyList: this.frequencyList,businessExpenseList: this.businessExpenseList,businessIncomeList:this.businessIncomeList,pdid:'',grossProfitTypeList:this.grossProfitTypeList};
|
||||
//public finalData: any;
|
||||
constructor(notifier: NotifierService, private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private _pd: PdTrigerService,
|
||||
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
|
||||
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
|
||||
this.notifier = notifier;
|
||||
this.form_id = 16;
|
||||
this.loadAIDetails();
|
||||
this.getAIMaster('UOM',1);
|
||||
this.getAIMaster('FREQUENCY',2);
|
||||
this.getAIMaster('BUSINESSEXPENSES',3);
|
||||
this.getAIMaster('BUSINESSINCOME',4);
|
||||
this.getCustomValues.pdid = this.pd_all_details.pdmaster_details.pd_id;
|
||||
this.sales_value=0;
|
||||
this.purchase_value=0;
|
||||
this.gross_profit_value=0;
|
||||
this.other_income_value=0;
|
||||
this.other_expense_value=0;
|
||||
this.net_profit_value=0;
|
||||
this.house_hold_value=0;
|
||||
this.net_disable_income_value=0;
|
||||
|
||||
}
|
||||
public viewerOptions: any = {
|
||||
navbar: false,
|
||||
@ -73,19 +95,22 @@ public viewerOptions: any = {
|
||||
}
|
||||
};
|
||||
ngOnInit() {
|
||||
|
||||
this.initAssessedIncomeForm();
|
||||
|
||||
}
|
||||
// load ai details
|
||||
loadAIDetails(): void{
|
||||
this.salesMonthWiseExpandedItems=[]
|
||||
let params: any = {};
|
||||
params.pd_id = this.pdid;
|
||||
params.pd_form_id = this.form_id;
|
||||
this._pd.getAssessedIncomeFormDetails(params).subscribe(value => {
|
||||
if (value.status == 200) {
|
||||
if(value.records.sales_declared_by_customer){
|
||||
this._assessedIncomeFormFrom.controls['sales_declared_by_customer'].setValue(value.records.sales_declared_by_customer[0].sales_declared_by_customer);
|
||||
if(value.records.gross_profit_calculation_type){
|
||||
this.grossProfitTypeList = value.records.gross_profit_calculation_type;
|
||||
this.getCustomValues.grossProfitTypeList=this.grossProfitTypeList;
|
||||
}
|
||||
else{
|
||||
this._assessedIncomeFormFrom.controls['sales_declared_by_customer'].setValue('');
|
||||
|
||||
if(value.records.sales_declared_by_customer){
|
||||
this.salesDeclaredCustomer = value.records.sales_declared_by_customer;
|
||||
}
|
||||
if(value.records.sales_calculated_by_itemwise){
|
||||
this.salesCaluatedItem = value.records.sales_calculated_by_itemwise;
|
||||
@ -142,10 +167,8 @@ public viewerOptions: any = {
|
||||
// message: ' Yearly ' + itemElement.sales_item + ' Sales Arrived',
|
||||
// value: calculateAllItemsTotal * convertYear,
|
||||
// })
|
||||
this.salesMonthWiseExpandedItems.push({salesItem:itemElement.sales_item, expandElements:expandBodyContent, footerMessage: footerMessage});
|
||||
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});
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
if(value.records.purchase_details){
|
||||
this.purchaseDetails = value.records.purchase_details;
|
||||
@ -156,6 +179,22 @@ public viewerOptions: any = {
|
||||
if(value.records.house_hold_expenses){
|
||||
this.houseHoldExpenses = value.records.house_hold_expenses;
|
||||
}
|
||||
if(value.records.othre_business_income){
|
||||
this.otherBusinessIncome = value.records.othre_business_income;
|
||||
}
|
||||
|
||||
if(value.records.final_data.length >0){
|
||||
// this.finalData = value.records.final_data[0];
|
||||
|
||||
this.sales_value = value.records.final_data[0].income.sales_revenue !='' && value.records.final_data[0].income.sales_revenue !=null ? value.records.final_data[0].income.sales_revenue : 0;
|
||||
this.purchase_value = value.records.final_data[0].expense.purchase !='' && value.records.final_data[0].expense.purchase !=null ? value.records.final_data[0].expense.purchase : 0;
|
||||
this.gross_profit_value = value.records.final_data[0].gross_profit !='' && value.records.final_data[0].gross_profit !=null ? value.records.final_data[0].gross_profit : 0;
|
||||
this.other_income_value = value.records.final_data[0].income.other_business_income !='' && value.records.final_data[0].income.other_business_income !=null ? value.records.final_data[0].income.other_business_income : 0;
|
||||
this.other_expense_value = value.records.final_data[0].expense.business_expense !='' && value.records.final_data[0].expense.business_expense !=null ? value.records.final_data[0].expense.business_expense : 0;
|
||||
this.net_profit_value = value.records.final_data[0].expense.net_profit !='' && value.records.final_data[0].expense.net_profit !=null ? value.records.final_data[0].expense.net_profit : 0;
|
||||
this.house_hold_value = 0;
|
||||
this.net_disable_income_value = this.net_profit_value-this.house_hold_value;
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
@ -166,14 +205,29 @@ public viewerOptions: any = {
|
||||
return getItems.map(t => t.sales_value).reduce((acc, value) => acc + Number(value), 0);
|
||||
}
|
||||
|
||||
// get common drop down list
|
||||
getAIMaster(table:string, type:Number):void {
|
||||
this._pd.getAllMasterDatas(table).subscribe(
|
||||
data => {
|
||||
if (data.dataStatus == true) {
|
||||
if(type==1){
|
||||
this.UOMList = data.records.filter(uom=>uom.isactive==1);
|
||||
this.getCustomValues.UOMList= this.UOMList;
|
||||
}
|
||||
if(type==2){
|
||||
this.frequencyList = data.records.filter(frq=>frq.isactive==1);
|
||||
this.getCustomValues.frequencyList= this.frequencyList;
|
||||
}
|
||||
if(type==3) {
|
||||
this.businessExpenseList = data.records.filter(val=>val.isactive==1);
|
||||
this.getCustomValues.businessExpenseList= this.businessExpenseList;
|
||||
}
|
||||
if(type==4){
|
||||
this.businessIncomeList=data.records.filter(val=>val.isactive==1);
|
||||
this.getCustomValues.businessIncomeList= this.businessIncomeList;
|
||||
|
||||
// Dynamic Form field creation
|
||||
|
||||
public initAssessedIncomeForm(): void {
|
||||
this._assessedIncomeFormFrom = this.fb.group({
|
||||
sales_declared_by_customer: ['', Validators.compose([Validators.required])],
|
||||
// lender_representative_details: this.fb.array([]),
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,56 @@
|
||||
<mat-card>
|
||||
<mat-card-content>
|
||||
<div fxLayout="row nowrap">
|
||||
<div fxFlex="60" align="left">
|
||||
<span>Business Expense Items</span>
|
||||
</div>
|
||||
<div fxFlex="40" align="right">
|
||||
<button type="button" mat-flat-button (click)="addMoreItem()"
|
||||
matTooltip="Add More" matTooltipPosition="above" color="primary">
|
||||
<strong>Add More Item</strong>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="example-container mat-elevation-z8">
|
||||
<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>
|
||||
</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>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="frequency">
|
||||
<th mat-header-cell *matHeaderCellDef> Frequency </th>
|
||||
<td mat-cell *matCellDef="let element">{{element.frequency_name}}
|
||||
</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>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="action" stickyEnd>
|
||||
<th mat-header-cell *matHeaderCellDef></th>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<button mat-mini-fab matTooltip="Edit" class="mr-1 mb-1" matTooltipPosition="left" (click)="editExpenseItem(element)" color="primary">
|
||||
<mat-icon>edit</mat-icon>
|
||||
</button>
|
||||
<button class="mr-1 mb-1" mat-mini-fab matTooltip="Remove" matTooltipPosition="above" (click)="removeExpenseItem(element)" color="primary" type="button">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky:true"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
</table>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<notifier-container></notifier-container>
|
||||
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
.example-container {
|
||||
max-height: 280px;
|
||||
width: 100%;
|
||||
overflow: auto;
|
||||
margin-top: 2%;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
td{
|
||||
padding-right: 2%;
|
||||
padding-left: 2%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
th {
|
||||
padding-left: 2%;
|
||||
padding-right: 2%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.mat-table-sticky:first-child {
|
||||
border-right: 1px solid #e0e0e0;
|
||||
}
|
||||
|
||||
.mat-table-sticky:last-child {
|
||||
border-left: 1px solid #e0e0e0;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { BusinessExpenseDetailsComponent } from './business-expense-details.component';
|
||||
|
||||
describe('BusinessExpenseDetailsComponent', () => {
|
||||
let component: BusinessExpenseDetailsComponent;
|
||||
let fixture: ComponentFixture<BusinessExpenseDetailsComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ BusinessExpenseDetailsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(BusinessExpenseDetailsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,88 @@
|
||||
import { Component, OnInit, Input, Output, Inject, OnChanges,SimpleChanges, EventEmitter } from '@angular/core';
|
||||
import { PdTrigerService } from './../../../../../../pd-service/pd-triger.service';
|
||||
import {MatDialog,MatDialogRef,MAT_DIALOG_DATA, MatTableDataSource} from '@angular/material';
|
||||
import { ManageBusinesExpenseComponent } from './../AI-diologue/manage-busines-expense/manage-busines-expense.component';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
|
||||
@Component({
|
||||
selector: 'app-business-expense-details',
|
||||
templateUrl: './business-expense-details.component.html',
|
||||
styleUrls: ['./business-expense-details.component.scss']
|
||||
})
|
||||
export class BusinessExpenseDetailsComponent implements OnInit {
|
||||
|
||||
displayedColumns = ['buiness_expense','expense_value','frequency','annual_expenses','action'];
|
||||
public businessItemSource= new MatTableDataSource();
|
||||
@Input() parentData: any;
|
||||
@Input() masterData: { UOMList: any; frequencyList: any;businessExpenseList:any; pdid:number};
|
||||
@Output() loadAssessedForms = new EventEmitter<string>();
|
||||
private notifier: NotifierService;
|
||||
constructor(notifier: NotifierService,private _pd: PdTrigerService, private dialog: MatDialog) {
|
||||
this.notifier= notifier;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
// add more item details
|
||||
addMoreItem():void {
|
||||
let passValues: any = {
|
||||
manage_status:1,
|
||||
masterData: this.masterData
|
||||
}
|
||||
const dialogRef = this.dialog.open(ManageBusinesExpenseComponent, {
|
||||
data: passValues,
|
||||
position: { right: '0'},
|
||||
width:'80%',
|
||||
disableClose: true
|
||||
});
|
||||
dialogRef.afterClosed()
|
||||
.subscribe(dataresult => {
|
||||
if(dataresult.update_status==true){
|
||||
this.loadAssessedForms.next('1');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
editExpenseItem(value:any) {
|
||||
let passValues: any = {
|
||||
manage_status:2,
|
||||
masterData: this.masterData,
|
||||
editData:value
|
||||
}
|
||||
const dialogRef = this.dialog.open(ManageBusinesExpenseComponent, {
|
||||
data: passValues,
|
||||
position: { right: '0'},
|
||||
width:'80%',
|
||||
disableClose: true
|
||||
});
|
||||
dialogRef.afterClosed()
|
||||
.subscribe(dataresult => {
|
||||
if(dataresult.update_status==true){
|
||||
this.loadAssessedForms.next('1');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// remove expense item
|
||||
removeExpenseItem(value: any) : void{
|
||||
|
||||
let deleteRecords: any =[{
|
||||
"fk_pd_id":this.masterData.pdid,
|
||||
"pd_expense_id":value.pd_expense_id,
|
||||
"isactive":false,
|
||||
}];
|
||||
this._pd.saveAssessedDetails('saveAssessedIncomeBusinessExpenses',deleteRecords).subscribe(data => {
|
||||
this.notifier.notify('success','Removed Successfully');
|
||||
this.loadAssessedForms.next('1');
|
||||
}, error => {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
});
|
||||
}
|
||||
|
||||
// detect chnges from parent
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
this.businessItemSource.data = changes.parentData.currentValue;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
<mat-card>
|
||||
<!-- <mat-card-header>
|
||||
<mat-card-title>Sales Calculate Month Wise</mat-card-title>
|
||||
|
||||
</mat-card-header> -->
|
||||
<mat-card-content>
|
||||
<div fxLayout="row nowrap">
|
||||
<div fxFlex="60" align="left">
|
||||
<span>Sales Calculate Daily Wise</span>
|
||||
</div>
|
||||
<div fxFlex="40" align="right">
|
||||
<button type="button" mat-flat-button (click)="addMoreItem()"
|
||||
matTooltip="Add More" matTooltipPosition="above" color="primary">
|
||||
<strong>Add More Item</strong>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<mat-card *ngFor="let expandDetails of salesMonthWiseExpandedItems">
|
||||
<mat-card-header>
|
||||
<mat-card-title>
|
||||
<small class="expan_table_header">{{expandDetails.salesItem}}</small>
|
||||
<small class="expan_table_header" *ngIf="activateMariginCalculation===true">(Margin Percentage % : {{expandDetails.margin_per}} 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}} {{footer.year_message}}
|
||||
</div>
|
||||
</mat-card-subtitle>
|
||||
</mat-card-header>
|
||||
|
||||
<mat-divider></mat-divider>
|
||||
<mat-card-content style="display: flex;margin-top: -20px;">
|
||||
|
||||
<div fxFlex="50" *ngFor="let eachItem of expandDetails.expandElements" class="m-gap p-gap">
|
||||
|
||||
<h4 align="center" class="h4_font">{{eachItem.header}}</h4>
|
||||
<table mat-table [dataSource]="eachItem.value" class="mat-elevation-z8">
|
||||
<ng-container matColumnDef="Date">
|
||||
<th mat-header-cell *matHeaderCellDef>Date</th>
|
||||
<td mat-cell *matCellDef="let itemValue">{{itemValue.sales_date | date: 'dd-MM-yyyy'}} </td>
|
||||
<td mat-footer-cell *matFooterCellDef> Total </td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="Amount">
|
||||
<th mat-header-cell *matHeaderCellDef>Amount</th>
|
||||
<td mat-cell *matCellDef="let itemValue">{{itemValue.sales_value}}</td>
|
||||
<td mat-footer-cell *matFooterCellDef> {{getTotalCost(eachItem.value)}} </td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="salesMonthItemColumns; sticky: true"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: salesMonthItemColumns;"></tr>
|
||||
<tr mat-footer-row *matFooterRowDef="salesMonthItemColumns; sticky: true"></tr>
|
||||
</table>
|
||||
</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>
|
||||
|
||||
</mat-card>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<notifier-container></notifier-container>
|
||||
@ -0,0 +1,33 @@
|
||||
.example-container {
|
||||
max-height: 500px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
tr.mat-footer-row {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.mat-table-sticky {
|
||||
border-top: 1px solid #e0e0e0;
|
||||
}
|
||||
.expan_footer{
|
||||
font-size: 18px;
|
||||
direction: rtl;
|
||||
}
|
||||
.expan_table_header {
|
||||
font-size: 18px;
|
||||
//text-align: center;
|
||||
}
|
||||
.h4_font {
|
||||
font-size: 18px;
|
||||
}
|
||||
.subtitle_message {
|
||||
color:#e00201 !important;
|
||||
}
|
||||
.delete-margin {
|
||||
margin-left: 3%;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DailySalesDetailsComponent } from './daily-sales-details.component';
|
||||
|
||||
describe('DailySalesDetailsComponent', () => {
|
||||
let component: DailySalesDetailsComponent;
|
||||
let fixture: ComponentFixture<DailySalesDetailsComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DailySalesDetailsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DailySalesDetailsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,121 @@
|
||||
import { Component, OnInit, Input, Output, Inject, DoCheck, EventEmitter } from '@angular/core';
|
||||
import { PdTrigerService } from './../../../../../../pd-service/pd-triger.service';
|
||||
import {MatDialog,MatDialogRef,MAT_DIALOG_DATA, MatTableDataSource} from '@angular/material';
|
||||
import { ManageDailySalesComponent } from './../AI-diologue/manage-daily-sales/manage-daily-sales.component';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
import { AnyAaaaRecord } from 'dns';
|
||||
|
||||
@Component({
|
||||
selector: 'app-daily-sales-details',
|
||||
templateUrl: './daily-sales-details.component.html',
|
||||
styleUrls: ['./daily-sales-details.component.scss']
|
||||
})
|
||||
export class DailySalesDetailsComponent implements OnInit, DoCheck {
|
||||
public salesMonthItemColumns = ['Date','Amount'];
|
||||
public salesMonthWiseExpandedItems: any[]=[];
|
||||
@Input() parentData: any;
|
||||
@Input() masterData: { UOMList: any; frequencyList: any; pdid:number, grossProfitTypeList:any};
|
||||
@Output() loadAssessedForms = new EventEmitter<string>();
|
||||
activateMariginCalculation: boolean;
|
||||
private notifier:NotifierService;
|
||||
constructor(notifier:NotifierService, private _pd: PdTrigerService, private dialog: MatDialog) {
|
||||
this.activateMariginCalculation=false;
|
||||
this.notifier = notifier;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
// get total cost
|
||||
getTotalCost(getItems:any) {
|
||||
return getItems.map(t => t.sales_value).reduce((acc, value) => acc + Number(value), 0);
|
||||
}
|
||||
|
||||
// add more item details
|
||||
addMoreItem():void {
|
||||
let passValues: any = {
|
||||
manage_status:1,
|
||||
masterData: this.masterData,
|
||||
margin_calculation_status:this.activateMariginCalculation,
|
||||
}
|
||||
const dialogRef = this.dialog.open(ManageDailySalesComponent, {
|
||||
data: passValues,
|
||||
position: { right: '0'},
|
||||
width:'80%',
|
||||
disableClose: true
|
||||
});
|
||||
dialogRef.afterClosed()
|
||||
.subscribe(dataresult => {
|
||||
if(dataresult.update_status==true){
|
||||
this.loadAssessedForms.next('1');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
editSalesItem(value:any) {
|
||||
let transformData: any = value.expandElements.map(val=>val.value);
|
||||
transformData = [].concat.apply([], transformData);
|
||||
let editValue: any = {
|
||||
"fk_pd_id":this.masterData.pdid,
|
||||
"sim_id":value.sim_id,
|
||||
"salesItem":value.salesItem,
|
||||
"margin_value":value.margin_value,
|
||||
"margin_per":value.margin_per,
|
||||
"values":transformData
|
||||
}
|
||||
let passValues: any = {
|
||||
manage_status:2,
|
||||
masterData: this.masterData,
|
||||
editData:editValue,
|
||||
margin_calculation_status:this.activateMariginCalculation,
|
||||
}
|
||||
const dialogRef = this.dialog.open(ManageDailySalesComponent, {
|
||||
data: passValues,
|
||||
position: { right: '0'},
|
||||
width:'80%',
|
||||
disableClose: true
|
||||
});
|
||||
dialogRef.afterClosed()
|
||||
.subscribe(dataresult => {
|
||||
if(dataresult.update_status==true){
|
||||
this.loadAssessedForms.next('1');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// remove sales item
|
||||
removeSalesItem(value: any) : void{
|
||||
// let transformData: any = value.expandElements.map(val=>val.value);
|
||||
// transformData = [].concat.apply([], transformData);
|
||||
let deleteRecords: any =[{
|
||||
"sim_id":value.sim_id,
|
||||
"isactive":false,
|
||||
"child":[]
|
||||
}];
|
||||
this._pd.saveAssessedDetails('saveAssessedIncomeMonthwiseItems',deleteRecords).subscribe(data => {
|
||||
this.notifier.notify('success','Removed Successfully');
|
||||
this.loadAssessedForms.next('1');
|
||||
}, error => {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
});
|
||||
}
|
||||
|
||||
// do check component bases
|
||||
ngDoCheck() {
|
||||
this.salesMonthWiseExpandedItems = this.parentData;
|
||||
|
||||
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;
|
||||
}}
|
||||
|
||||
// detect chnges from parent
|
||||
// ngOnChanges(changes: SimpleChanges) {
|
||||
// this.salesMonthWiseExpandedItems = changes.parentData.currentValue;
|
||||
// if(changes.masterData){
|
||||
// if(changes.masterData.currentValue.grossProfitTypeList.length>0){
|
||||
// this.activateMariginCalculation = changes.masterData.currentValue.grossProfitTypeList[changes.masterData.currentValue.grossProfitTypeList.length-1].margin==2 && changes.masterData.currentValue.grossProfitTypeList[changes.masterData.currentValue.grossProfitTypeList.length-1].mode==2 ? true : false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
<form [formGroup]="grossProfitForm" novalidate>
|
||||
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<!-- <mat-card-title>Purchase Info</mat-card-title> -->
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<mat-form-field style="width: 45%">
|
||||
<mat-select placeholder="Purchase Detail Available" formControlName="mode" (selectionChange)="changeOptions(grossProfitForm.value)" required>
|
||||
<mat-option *ngFor="let getData of check__purchse_type" [value]="getData.id">{{getData.name}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 30%" *ngIf="grossProfitForm.controls['mode'].value == 2">
|
||||
<mat-select placeholder="Sales Type" formControlName="margin">
|
||||
<mat-option *ngFor="let getSale of check_sales_type" [value]="getSale.id">{{getSale.name}}</mat-option>
|
||||
</mat-select>
|
||||
</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(grossProfitForm.value)"><mat-icon>save</mat-icon>
|
||||
</button>
|
||||
|
||||
</mat-card-content>
|
||||
<!-- <mat-card-actions align="right">
|
||||
|
||||
</mat-card-actions> -->
|
||||
</mat-card>
|
||||
</form>
|
||||
@ -0,0 +1,3 @@
|
||||
mat-form-field {
|
||||
margin: 0 2%;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { GrossProfitCalculationComponent } from './gross-profit-calculation.component';
|
||||
|
||||
describe('GrossProfitCalculationComponent', () => {
|
||||
let component: GrossProfitCalculationComponent;
|
||||
let fixture: ComponentFixture<GrossProfitCalculationComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ GrossProfitCalculationComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(GrossProfitCalculationComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,79 @@
|
||||
import { Component, OnInit, Input, Output, Inject,EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
|
||||
import { PdTrigerService } from './../../../../../../pd-service/pd-triger.service';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
|
||||
@Component({
|
||||
selector: 'app-gross-profit-calculation',
|
||||
templateUrl: './gross-profit-calculation.component.html',
|
||||
styleUrls: ['./gross-profit-calculation.component.scss']
|
||||
})
|
||||
export class GrossProfitCalculationComponent implements OnInit, OnChanges {
|
||||
@Input() masterData: { UOMList: any; frequencyList: any;businessExpenseList:any; pdid:number};
|
||||
@Input() parentData: any;
|
||||
@Output() loadAssessedForms = new EventEmitter<string>();
|
||||
public grossProfitForm: FormGroup;
|
||||
check__purchse_type:any=[{'id':'1','name':'Yes'},{'id':'2','name':'No'}]
|
||||
check_sales_type:any=[{'id':'1','name':'Gross Margin'},{'id':'2','name':'Net Margin'}]
|
||||
private notifier: NotifierService;
|
||||
constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService) {
|
||||
this.notifier = notifier;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
}
|
||||
changeOptions(values: any){
|
||||
this.grossProfitForm.controls['margin'].setValue('');
|
||||
}
|
||||
submitDetails(records: any){
|
||||
if (this.grossProfitForm.invalid) {
|
||||
this.validateAllFormFields(this.grossProfitForm);
|
||||
this.notifier.notify('warning',"Please Check All Manatory Fields..");
|
||||
return;
|
||||
}
|
||||
this._pd.saveAssessedDetails('saveAssessedIncomeCalculateMode',records).subscribe(data => {
|
||||
this.notifier.notify('success','Saved Successfully.');
|
||||
this.loadAssessedForms.next('1');
|
||||
}, error => {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
this.loadAssessedForms.next('1');
|
||||
});
|
||||
}
|
||||
|
||||
// detect chnges from parent
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
if(changes.parentData.currentValue.length>0){
|
||||
this.grossProfitForm = this._fb.group(
|
||||
{
|
||||
calc_type_id:[changes.parentData.currentValue[0].calc_type_id],
|
||||
fk_pd_id:[this.masterData.pdid],
|
||||
mode:[changes.parentData.currentValue[0].mode,Validators.compose([Validators.required])],
|
||||
margin:[changes.parentData.currentValue[0].margin],
|
||||
})
|
||||
}
|
||||
else {
|
||||
this.grossProfitForm = this._fb.group(
|
||||
{
|
||||
calc_type_id:[''],
|
||||
fk_pd_id:[this.masterData.pdid],
|
||||
mode:['',Validators.compose([Validators.required])],
|
||||
margin:[''],
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// validate all form group and form array fields
|
||||
validateAllFormFields(formGroup: any) {
|
||||
Object.keys(formGroup.controls).forEach(field => {
|
||||
const control = formGroup.get(field);
|
||||
if (control instanceof FormControl) {
|
||||
control.markAsTouched({ onlySelf: true });
|
||||
} else if (control instanceof FormGroup) {
|
||||
this.validateAllFormFields(control);
|
||||
} else if (control instanceof FormArray) {
|
||||
this.validateAllFormFields(control);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
<mat-card>
|
||||
<mat-card-content>
|
||||
<div fxLayout="row nowrap">
|
||||
<div fxFlex="60" align="left">
|
||||
<span>House Hold Items</span>
|
||||
</div>
|
||||
<div fxFlex="40" align="right">
|
||||
<button type="button" mat-flat-button (click)="addMoreItem()"
|
||||
matTooltip="Add More" matTooltipPosition="above" color="primary">
|
||||
<strong>Add More Item</strong>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="example-container mat-elevation-z8">
|
||||
<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>
|
||||
</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>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="frequency">
|
||||
<th mat-header-cell *matHeaderCellDef> Frequency </th>
|
||||
<td mat-cell *matCellDef="let element">{{element.frequency_name}}
|
||||
</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>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="action" stickyEnd>
|
||||
<th mat-header-cell *matHeaderCellDef></th>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<button mat-mini-fab class="mr-1 mb-1" matTooltip="Edit" matTooltipPosition="left" (click)="editHouseItem(element)" color="primary">
|
||||
<mat-icon>edit</mat-icon>
|
||||
</button>
|
||||
<button class="mr-1 mb-1" mat-mini-fab matTooltip="Remove" matTooltipPosition="above" (click)="removeHouseItem(element)" color="primary" type="button">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky:true"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
</table>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<notifier-container></notifier-container>
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
.example-container {
|
||||
max-height: 280px;
|
||||
width: 100%;
|
||||
overflow: auto;
|
||||
margin-top: 2%;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
td{
|
||||
padding-right: 2%;
|
||||
padding-left: 2%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
th {
|
||||
padding-left: 2%;
|
||||
padding-right: 2%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.mat-table-sticky:first-child {
|
||||
border-right: 1px solid #e0e0e0;
|
||||
}
|
||||
|
||||
.mat-table-sticky:last-child {
|
||||
border-left: 1px solid #e0e0e0;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { HouseHoldDetailsComponent } from './house-hold-details.component';
|
||||
|
||||
describe('HouseHoldDetailsComponent', () => {
|
||||
let component: HouseHoldDetailsComponent;
|
||||
let fixture: ComponentFixture<HouseHoldDetailsComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ HouseHoldDetailsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(HouseHoldDetailsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,90 @@
|
||||
import { Component, OnInit, Input, Output, Inject, OnChanges,SimpleChanges, EventEmitter } from '@angular/core';
|
||||
import { PdTrigerService } from './../../../../../../pd-service/pd-triger.service';
|
||||
import {MatDialog,MatDialogRef,MAT_DIALOG_DATA, MatTableDataSource} from '@angular/material';
|
||||
import { ManageHouseHoldComponent } from './../AI-diologue/manage-house-hold/manage-house-hold.component';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-house-hold-details',
|
||||
templateUrl: './house-hold-details.component.html',
|
||||
styleUrls: ['./house-hold-details.component.scss']
|
||||
})
|
||||
export class HouseHoldDetailsComponent implements OnInit {
|
||||
|
||||
displayedColumns = ['buiness_particulars','expense_value','frequency','annual_expenses','action'];
|
||||
public houseItemSource= new MatTableDataSource();
|
||||
@Input() parentData: any;
|
||||
@Input() masterData: { UOMList: any; frequencyList: any;businessExpenseList:any; pdid:number};
|
||||
@Output() loadAssessedForms = new EventEmitter<string>();
|
||||
private notifier: NotifierService;
|
||||
constructor(notifier: NotifierService,private _pd: PdTrigerService, private dialog: MatDialog) {
|
||||
this.notifier= notifier;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
// add more item details
|
||||
addMoreItem():void {
|
||||
let passValues: any = {
|
||||
manage_status:1,
|
||||
masterData: this.masterData
|
||||
}
|
||||
const dialogRef = this.dialog.open(ManageHouseHoldComponent, {
|
||||
data: passValues,
|
||||
position: { right: '0'},
|
||||
width:'80%',
|
||||
disableClose: true
|
||||
});
|
||||
dialogRef.afterClosed()
|
||||
.subscribe(dataresult => {
|
||||
if(dataresult.update_status==true){
|
||||
this.loadAssessedForms.next('1');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
editHouseItem(value:any) {
|
||||
let passValues: any = {
|
||||
manage_status:2,
|
||||
masterData: this.masterData,
|
||||
editData:value
|
||||
}
|
||||
const dialogRef = this.dialog.open(ManageHouseHoldComponent, {
|
||||
data: passValues,
|
||||
position: { right: '0'},
|
||||
width:'80%',
|
||||
disableClose: true
|
||||
});
|
||||
dialogRef.afterClosed()
|
||||
.subscribe(dataresult => {
|
||||
if(dataresult.update_status==true){
|
||||
this.loadAssessedForms.next('1');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// remove house item
|
||||
removeHouseItem(value: any) : void{
|
||||
|
||||
let deleteRecords: any =[{
|
||||
"fk_pd_id":this.masterData.pdid,
|
||||
"household_expense_id":value.household_expense_id,
|
||||
"isactive":false,
|
||||
}];
|
||||
this._pd.saveAssessedDetails('saveAssessedIncomeHouseholdExpenses',deleteRecords).subscribe(data => {
|
||||
this.notifier.notify('success','Removed Successfully');
|
||||
this.loadAssessedForms.next('1');
|
||||
}, error => {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// detect chnges from parent
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
this.houseItemSource.data = changes.parentData.currentValue;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
<mat-card>
|
||||
<mat-card-content>
|
||||
<div fxLayout="row nowrap">
|
||||
<div fxFlex="60" align="left">
|
||||
<span>Other Business Income Items</span>
|
||||
</div>
|
||||
<div fxFlex="40" align="right">
|
||||
<button type="button" mat-flat-button (click)="addMoreItem()"
|
||||
matTooltip="Add More" matTooltipPosition="above" color="primary">
|
||||
<strong>Add More Item</strong>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="example-container mat-elevation-z8">
|
||||
<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>
|
||||
</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>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="frequency">
|
||||
<th mat-header-cell *matHeaderCellDef> Frequency </th>
|
||||
<td mat-cell *matCellDef="let element">{{element.frequency_name}}
|
||||
</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>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="action" stickyEnd>
|
||||
<th mat-header-cell *matHeaderCellDef></th>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<button mat-mini-fab matTooltip="Edit" class="mr-1 mb-1" matTooltipPosition="left" (click)="editIncomeItem(element)" color="primary">
|
||||
<mat-icon>edit</mat-icon>
|
||||
</button>
|
||||
<button class="mr-1 mb-1" mat-mini-fab matTooltip="Remove" matTooltipPosition="above" (click)="removeIncomeItem(element)" color="primary" type="button">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky:true"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
</table>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<notifier-container></notifier-container>
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
.example-container {
|
||||
max-height: 280px;
|
||||
width: 100%;
|
||||
overflow: auto;
|
||||
margin-top: 2%;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
td{
|
||||
padding-right: 2%;
|
||||
padding-left: 2%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
th {
|
||||
padding-left: 2%;
|
||||
padding-right: 2%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.mat-table-sticky:first-child {
|
||||
border-right: 1px solid #e0e0e0;
|
||||
}
|
||||
|
||||
.mat-table-sticky:last-child {
|
||||
border-left: 1px solid #e0e0e0;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { OtherBusinessIncomeDetailsComponent } from './other-business-income-details.component';
|
||||
|
||||
describe('OtherBusinessIncomeDetailsComponent', () => {
|
||||
let component: OtherBusinessIncomeDetailsComponent;
|
||||
let fixture: ComponentFixture<OtherBusinessIncomeDetailsComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ OtherBusinessIncomeDetailsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(OtherBusinessIncomeDetailsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,87 @@
|
||||
import { Component, OnInit, Input, Output, Inject, OnChanges,SimpleChanges, EventEmitter } from '@angular/core';
|
||||
import { PdTrigerService } from './../../../../../../pd-service/pd-triger.service';
|
||||
import {MatDialog,MatDialogRef,MAT_DIALOG_DATA, MatTableDataSource} from '@angular/material';
|
||||
import { ManageOtherBusinessIncomeComponent } from './../AI-diologue/manage-other-business-income/manage-other-business-income.component';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
|
||||
@Component({
|
||||
selector: 'app-other-business-income-details',
|
||||
templateUrl: './other-business-income-details.component.html',
|
||||
styleUrls: ['./other-business-income-details.component.scss']
|
||||
})
|
||||
export class OtherBusinessIncomeDetailsComponent implements OnInit {
|
||||
|
||||
displayedColumns = ['buiness_income','income_value','frequency','annual_income','action'];
|
||||
public businessIncomeItemSource= new MatTableDataSource();
|
||||
@Input() parentData: any;
|
||||
@Input() masterData: { UOMList: any; frequencyList: any;businessExpenseList:any; pdid:number};
|
||||
@Output() loadAssessedForms = new EventEmitter<string>();
|
||||
private notifier: NotifierService;
|
||||
constructor(notifier: NotifierService, private _pd: PdTrigerService, private dialog: MatDialog) {
|
||||
this.notifier=notifier;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
// add more item details
|
||||
addMoreItem():void {
|
||||
let passValues: any = {
|
||||
manage_status:1,
|
||||
masterData: this.masterData
|
||||
}
|
||||
const dialogRef = this.dialog.open(ManageOtherBusinessIncomeComponent, {
|
||||
data: passValues,
|
||||
position: { right: '0'},
|
||||
width:'80%',
|
||||
disableClose: true
|
||||
});
|
||||
dialogRef.afterClosed()
|
||||
.subscribe(dataresult => {
|
||||
if(dataresult.update_status==true){
|
||||
this.loadAssessedForms.next('1');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
editIncomeItem(value:any) {
|
||||
let passValues: any = {
|
||||
manage_status:2,
|
||||
masterData: this.masterData,
|
||||
editData:value
|
||||
}
|
||||
const dialogRef = this.dialog.open(ManageOtherBusinessIncomeComponent, {
|
||||
data: passValues,
|
||||
position: { right: '0'},
|
||||
width:'80%',
|
||||
disableClose: true
|
||||
});
|
||||
dialogRef.afterClosed()
|
||||
.subscribe(dataresult => {
|
||||
if(dataresult.update_status==true){
|
||||
this.loadAssessedForms.next('1');
|
||||
}
|
||||
});
|
||||
}
|
||||
// remove income item
|
||||
removeIncomeItem(value: any) : void{
|
||||
|
||||
let deleteRecords: any =[{
|
||||
"fk_pd_id":this.masterData.pdid,
|
||||
"pd_business_income_id":value.pd_business_income_id,
|
||||
"isactive":false,
|
||||
}];
|
||||
this._pd.saveAssessedDetails('saveOtherBusinessIncome',deleteRecords).subscribe(data => {
|
||||
this.notifier.notify('success','Removed Successfully');
|
||||
this.loadAssessedForms.next('1');
|
||||
}, error => {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
});
|
||||
}
|
||||
|
||||
// detect chnges from parent
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
this.businessIncomeItemSource.data = changes.parentData.currentValue;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
<mat-card >
|
||||
<mat-card-content *ngIf="activateMariginCalculation;else notAvilable">
|
||||
<div fxLayout="row nowrap">
|
||||
<div fxFlex="60" align="left">
|
||||
<span>Purchase Item</span>
|
||||
</div>
|
||||
<div fxFlex="40" align="right">
|
||||
<button type="button" mat-flat-button (click)="addMoreItem()"
|
||||
matTooltip="Add More" matTooltipPosition="above" color="primary">
|
||||
<strong>Add More Item</strong>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="example-container mat-elevation-z8">
|
||||
<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>
|
||||
</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>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="UOM">
|
||||
<th mat-header-cell *matHeaderCellDef> UOM </th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.uom_name}} </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>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="frequency">
|
||||
<th mat-header-cell *matHeaderCellDef> Frequency </th>
|
||||
<td mat-cell *matCellDef="let element">{{element.frequency_name}}
|
||||
</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>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="action" stickyEnd>
|
||||
<th mat-header-cell *matHeaderCellDef></th>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<button mat-mini-fab matTooltip="Edit" class="mr-1 mb-1" matTooltipPosition="left" (click)="editPurchaseItem(element)" color="primary">
|
||||
<mat-icon>edit</mat-icon>
|
||||
</button>
|
||||
<button class="mr-1 mb-1" mat-mini-fab matTooltip="Remove" matTooltipPosition="above" (click)="removePurchaseItem(element)" color="primary" type="button">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky:true"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
</table>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
<ng-template #notAvilable>
|
||||
<strong>Purchase Item is Not Available.. </strong>
|
||||
</ng-template>
|
||||
</mat-card>
|
||||
<notifier-container></notifier-container>
|
||||
@ -0,0 +1,30 @@
|
||||
.example-container {
|
||||
max-height: 280px;
|
||||
width: 100%;
|
||||
overflow: auto;
|
||||
margin-top: 2%;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
td{
|
||||
padding-right: 2%;
|
||||
padding-left: 2%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
th {
|
||||
padding-left: 2%;
|
||||
padding-right: 2%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.mat-table-sticky:first-child {
|
||||
border-right: 1px solid #e0e0e0;
|
||||
}
|
||||
|
||||
.mat-table-sticky:last-child {
|
||||
border-left: 1px solid #e0e0e0;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PurchaseDetailsComponent } from './purchase-details.component';
|
||||
|
||||
describe('PurchaseDetailsComponent', () => {
|
||||
let component: PurchaseDetailsComponent;
|
||||
let fixture: ComponentFixture<PurchaseDetailsComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ PurchaseDetailsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PurchaseDetailsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,100 @@
|
||||
import { Component, OnInit, Input, Output, Inject, DoCheck, EventEmitter } from '@angular/core';
|
||||
import { PdTrigerService } from './../../../../../../pd-service/pd-triger.service';
|
||||
import {MatDialog,MatDialogRef,MAT_DIALOG_DATA, MatTableDataSource} from '@angular/material';
|
||||
import { ManagePurchaseComponent } from './../AI-diologue/manage-purchase/manage-purchase.component';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
|
||||
@Component({
|
||||
selector: 'app-purchase-details',
|
||||
templateUrl: './purchase-details.component.html',
|
||||
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'];
|
||||
public purchaseItemSource= new MatTableDataSource();
|
||||
activateMariginCalculation:boolean;
|
||||
private notifier: NotifierService;
|
||||
@Input() parentData: any;
|
||||
@Input() masterData: { UOMList: any; frequencyList: any;businessExpenseList:any,businessIncomeList: any, pdid:number, grossProfitTypeList:any};
|
||||
@Output() loadAssessedForms = new EventEmitter<string>();
|
||||
constructor(notifier: NotifierService,private _pd: PdTrigerService, private dialog: MatDialog) {
|
||||
this.activateMariginCalculation=false;
|
||||
this.notifier = notifier;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
// add more item details
|
||||
addMoreItem():void {
|
||||
let passValues: any = {
|
||||
manage_status:1,
|
||||
masterData: this.masterData
|
||||
}
|
||||
const dialogRef = this.dialog.open(ManagePurchaseComponent, {
|
||||
data: passValues,
|
||||
position: { right: '0'},
|
||||
width:'80%',
|
||||
disableClose: true
|
||||
});
|
||||
dialogRef.afterClosed()
|
||||
.subscribe(dataresult => {
|
||||
if(dataresult.update_status==true){
|
||||
this.loadAssessedForms.next('1');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
editPurchaseItem(value:any) {
|
||||
let passValues: any = {
|
||||
manage_status:2,
|
||||
masterData: this.masterData,
|
||||
editData:value
|
||||
}
|
||||
const dialogRef = this.dialog.open(ManagePurchaseComponent, {
|
||||
data: passValues,
|
||||
position: { right: '0'},
|
||||
width:'80%',
|
||||
disableClose: true
|
||||
});
|
||||
dialogRef.afterClosed()
|
||||
.subscribe(dataresult => {
|
||||
if(dataresult.update_status==true){
|
||||
this.loadAssessedForms.next('1');
|
||||
}
|
||||
});
|
||||
}
|
||||
// remove purchase item
|
||||
removePurchaseItem(value: any) : void{
|
||||
|
||||
let deleteRecords: any =[{
|
||||
"fk_pd_id":this.masterData.pdid,
|
||||
"purchase_id":value.purchase_id,
|
||||
"isactive":false,
|
||||
}];
|
||||
this._pd.saveAssessedDetails('saveAssessedIncomePurchaseDetails',deleteRecords).subscribe(data => {
|
||||
this.notifier.notify('success','Removed Successfully');
|
||||
this.loadAssessedForms.next('1');
|
||||
}, error => {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
});
|
||||
}
|
||||
|
||||
// do check component bases
|
||||
ngDoCheck() {
|
||||
if(this.masterData.grossProfitTypeList.length>0){
|
||||
this.activateMariginCalculation = this.masterData.grossProfitTypeList[this.masterData.grossProfitTypeList.length-1].mode==1 ? true : false;
|
||||
}
|
||||
this.purchaseItemSource.data = this.parentData;
|
||||
}
|
||||
|
||||
// detect chnges from parent
|
||||
// ngOnChanges(changes: SimpleChanges) {
|
||||
// if(changes.masterData){
|
||||
// if(changes.masterData.currentValue.grossProfitTypeList.length>0){
|
||||
// this.activateMariginCalculation = changes.masterData.currentValue.grossProfitTypeList[changes.masterData.currentValue.grossProfitTypeList.length-1].mode==1 ? true : false;
|
||||
// }
|
||||
// }
|
||||
// this.purchaseItemSource.data = changes.parentData.currentValue;
|
||||
// }
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
<form [formGroup]="salesCalculationForm" novalidate>
|
||||
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<mat-card-title>Sales Calculation</mat-card-title>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<mat-form-field style="width: 82%">
|
||||
<input matInput OnlyNumber type="text" placeholder="Sales Declared by the Customer as the Annual Sales Actually Done" formControlName="sales_declared_by_customer" (keyup)="salesCalculation(salesCalculationForm.value)" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 40%" *ngIf="activateMariginCalculation">
|
||||
<input matInput OnlyNumber type="text" placeholder="Margin Percentage %" formControlName="margin_per" (keyup)="salesCalculation(salesCalculationForm.value)" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 40%" *ngIf="activateMariginCalculation">
|
||||
<input matInput OnlyNumber type="text" placeholder="Margin Value" formControlName="margin_value" readonly>
|
||||
</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>
|
||||
</mat-card>
|
||||
</form>
|
||||
@ -0,0 +1,3 @@
|
||||
mat-form-field {
|
||||
margin: 0 2%;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SalesCalculationComponent } from './sales-calculation.component';
|
||||
|
||||
describe('SalesCalculationComponent', () => {
|
||||
let component: SalesCalculationComponent;
|
||||
let fixture: ComponentFixture<SalesCalculationComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ SalesCalculationComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SalesCalculationComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,102 @@
|
||||
import { Component, OnInit, Input, Output, Inject, EventEmitter, DoCheck, OnChanges, SimpleChanges } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
|
||||
import { PdTrigerService } from './../../../../../../pd-service/pd-triger.service';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
|
||||
@Component({
|
||||
selector: 'app-sales-calculation',
|
||||
templateUrl: './sales-calculation.component.html',
|
||||
styleUrls: ['./sales-calculation.component.scss']
|
||||
})
|
||||
export class SalesCalculationComponent implements OnInit, OnChanges, DoCheck {
|
||||
@Input() parentData: any;
|
||||
@Input() masterData: { pdid:number,grossProfitTypeList:any};
|
||||
@Output() loadAssessedForms = new EventEmitter<string>();
|
||||
salesCalculationForm:FormGroup;
|
||||
activateMariginCalculation: boolean;
|
||||
private notifier: NotifierService;
|
||||
constructor(notifier:NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService) {
|
||||
this.activateMariginCalculation=false;
|
||||
this.notifier = notifier;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
salesCalculation(values): void {
|
||||
if(values.margin_per !='' && values.sales_declared_by_customer !='')
|
||||
{
|
||||
this.salesCalculationForm.controls['margin_value'].setValue(values.sales_declared_by_customer * (values.margin_per/100));
|
||||
}
|
||||
}
|
||||
// save sales calculations details
|
||||
submitDetails(records) {
|
||||
if (this.salesCalculationForm.invalid) {
|
||||
this.validateAllFormFields(this.salesCalculationForm);
|
||||
this.notifier.notify('warning',"Please Check All Manatory Fields..");
|
||||
return;
|
||||
}
|
||||
this._pd.saveAssessedDetails('saveAssessedIncomeSalesDeclaredByCustomer',records).subscribe(data => {
|
||||
this.notifier.notify('success', 'Saved Successfully.');
|
||||
this.loadAssessedForms.next('1');
|
||||
}, error => {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
this.loadAssessedForms.next('1');
|
||||
});
|
||||
}
|
||||
|
||||
// validate all form group and form array fields
|
||||
validateAllFormFields(formGroup: any) {
|
||||
Object.keys(formGroup.controls).forEach(field => {
|
||||
const control = formGroup.get(field);
|
||||
if (control instanceof FormControl) {
|
||||
control.markAsTouched({ onlySelf: true });
|
||||
} else if (control instanceof FormGroup) {
|
||||
this.validateAllFormFields(control);
|
||||
} else if (control instanceof FormArray) {
|
||||
this.validateAllFormFields(control);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// do check component bases
|
||||
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;
|
||||
}
|
||||
this.activateMariginCalculation===true ? this.salesCalculationForm.controls['margin_per'].setValidators([Validators.required]) : this.salesCalculationForm.controls['margin_per'].clearValidators();
|
||||
this.salesCalculationForm.controls['margin_per'].updateValueAndValidity();
|
||||
|
||||
}
|
||||
|
||||
//detect chnges from parent
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
if(changes.masterData){
|
||||
if(changes.masterData.currentValue.grossProfitTypeList.length>0){
|
||||
this.activateMariginCalculation = changes.masterData.currentValue.grossProfitTypeList[changes.masterData.currentValue.grossProfitTypeList.length-1].margin==2 && changes.masterData.currentValue.grossProfitTypeList[changes.masterData.currentValue.grossProfitTypeList.length-1].mode==2 ? true : false;
|
||||
}
|
||||
}
|
||||
if(changes.parentData){
|
||||
if(changes.parentData.currentValue.length>0){
|
||||
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])],
|
||||
fk_pd_id:[this.masterData.pdid],
|
||||
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],
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.salesCalculationForm = this._fb.group({
|
||||
sdc_id:[''],
|
||||
sales_declared_by_customer:['', Validators.required],
|
||||
fk_pd_id:[this.masterData.pdid],
|
||||
margin_per:['',this.activateMariginCalculation===true ? Validators.required: Validators.nullValidator],
|
||||
margin_value:[''],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,86 @@
|
||||
<mat-card>
|
||||
<!-- <mat-card-header>
|
||||
<mat-card-title>Sales Calculate Item Wise</mat-card-title>
|
||||
</mat-card-header> -->
|
||||
<mat-card-content>
|
||||
<div fxLayout="row nowrap">
|
||||
<div fxFlex="60" align="left">
|
||||
<span>Sales Calculate Item Wise</span>
|
||||
</div>
|
||||
<div fxFlex="40" align="right">
|
||||
<button type="button" mat-flat-button (click)="addMoreItem()"
|
||||
matTooltip="Add More" matTooltipPosition="above" color="primary">
|
||||
<strong>Add More Item</strong>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="example-container mat-elevation-z8">
|
||||
<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>
|
||||
</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>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="UOM">
|
||||
<th mat-header-cell *matHeaderCellDef> UOM </th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.uom_name}} </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>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="frequency">
|
||||
<th mat-header-cell *matHeaderCellDef> Frequency </th>
|
||||
<td mat-cell *matCellDef="let element">{{element.frequency_name}}
|
||||
</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>
|
||||
</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>
|
||||
</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>
|
||||
</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>
|
||||
</ng-container>
|
||||
|
||||
|
||||
<ng-container matColumnDef="action" stickyEnd>
|
||||
<th mat-header-cell *matHeaderCellDef></th>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<button mat-mini-fab matTooltip="Edit" class="mr-1 mb-1" matTooltipPosition="left" (click)="editSalesItem(element)" color="primary">
|
||||
<mat-icon>edit</mat-icon>
|
||||
</button>
|
||||
<button class="mr-1 mb-1" mat-mini-fab matTooltip="Remove" matTooltipPosition="right" (click)="removeSalesItem(element)" color="primary" type="button">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky:true"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
</table>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
|
||||
</mat-card>
|
||||
<notifier-container></notifier-container>
|
||||
@ -0,0 +1,30 @@
|
||||
.example-container {
|
||||
max-height: 300px;
|
||||
width: 100%;
|
||||
overflow: auto;
|
||||
margin-top: 2%;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
td{
|
||||
padding-right: 2%;
|
||||
padding-left: 2%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
th {
|
||||
padding-left: 2%;
|
||||
padding-right: 2%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.mat-table-sticky:first-child {
|
||||
border-right: 1px solid #e0e0e0;
|
||||
}
|
||||
|
||||
.mat-table-sticky:last-child {
|
||||
border-left: 1px solid #e0e0e0;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SalesDetailsComponent } from './sales-details.component';
|
||||
|
||||
describe('SalesDetailsComponent', () => {
|
||||
let component: SalesDetailsComponent;
|
||||
let fixture: ComponentFixture<SalesDetailsComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ SalesDetailsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SalesDetailsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,119 @@
|
||||
import { Component, OnInit, Input, Output, Inject, OnChanges,SimpleChanges, EventEmitter, DoCheck } from '@angular/core';
|
||||
import { PdTrigerService } from './../../../../../../pd-service/pd-triger.service';
|
||||
import {MatDialog,MatDialogRef,MAT_DIALOG_DATA, MatTableDataSource} from '@angular/material';
|
||||
import { ManageSalesComponent } from './../AI-diologue/manage-sales/manage-sales.component';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
|
||||
@Component({
|
||||
selector: 'app-sales-details',
|
||||
templateUrl: './sales-details.component.html',
|
||||
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'];
|
||||
public salesItemSource= new MatTableDataSource();
|
||||
@Input() parentData: any;
|
||||
@Input() masterData: { UOMList: any; frequencyList: any;businessExpenseList:any,businessIncomeList: any, pdid:number, grossProfitTypeList:any};
|
||||
@Output() loadAssessedForms = new EventEmitter<string>();
|
||||
activateMariginCalculation: boolean;
|
||||
private notifier :NotifierService
|
||||
constructor(notifier:NotifierService, private _pd: PdTrigerService, private dialog: MatDialog) {
|
||||
this.activateMariginCalculation=false;
|
||||
this.notifier = notifier;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
// add more item details
|
||||
addMoreItem():void {
|
||||
let passValues: any = {
|
||||
manage_status:1,
|
||||
masterData: this.masterData,
|
||||
margin_calculation_status:this.activateMariginCalculation,
|
||||
}
|
||||
const dialogRef = this.dialog.open(ManageSalesComponent, {
|
||||
data: passValues,
|
||||
position: { right: '0'},
|
||||
width:'80%',
|
||||
disableClose: true
|
||||
});
|
||||
dialogRef.afterClosed()
|
||||
.subscribe(dataresult => {
|
||||
if(dataresult.update_status==true){
|
||||
this.loadAssessedForms.next('1');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
editSalesItem(value:any) {
|
||||
let passValues: any = {
|
||||
manage_status:2,
|
||||
masterData: this.masterData,
|
||||
editData:value,
|
||||
margin_calculation_status:this.activateMariginCalculation,
|
||||
|
||||
}
|
||||
const dialogRef = this.dialog.open(ManageSalesComponent, {
|
||||
data: passValues,
|
||||
position: { right: '0'},
|
||||
width:'80%',
|
||||
disableClose: true
|
||||
});
|
||||
dialogRef.afterClosed()
|
||||
.subscribe(dataresult => {
|
||||
if(dataresult.update_status==true){
|
||||
this.loadAssessedForms.next('1');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// remove sales item
|
||||
removeSalesItem(value: any) : void{
|
||||
|
||||
let deleteRecords: any =[{
|
||||
"fk_pd_id":this.masterData.pdid,
|
||||
"sci_id":value.sci_id,
|
||||
"isactive":false,
|
||||
}];
|
||||
this._pd.saveAssessedDetails('saveAssessedIncomeSalesCalculatedByItemwise',deleteRecords).subscribe(data => {
|
||||
this.notifier.notify('success','Removed Successfully');
|
||||
this.loadAssessedForms.next('1');
|
||||
}, error => {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
});
|
||||
}
|
||||
|
||||
// do check component bases
|
||||
ngDoCheck() {
|
||||
this.salesItemSource.data = this.parentData;
|
||||
|
||||
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'];
|
||||
}
|
||||
else {
|
||||
this.displayedColumns = ['product_services','sale_quantity','UOM','rate_per_unit_sale','frequency','annual_sales','action'];
|
||||
|
||||
}
|
||||
}}
|
||||
|
||||
// detect chnges from parent
|
||||
// ngOnChanges(changes: SimpleChanges) {
|
||||
// this.salesItemSource.data = changes.parentData.currentValue;
|
||||
// if(changes.masterData){
|
||||
// if(changes.masterData.currentValue.grossProfitTypeList.length>0){
|
||||
// this.activateMariginCalculation = changes.masterData.currentValue.grossProfitTypeList[changes.masterData.currentValue.grossProfitTypeList.length-1].margin==2 && changes.masterData.currentValue.grossProfitTypeList[changes.masterData.currentValue.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'];
|
||||
// }
|
||||
// else {
|
||||
// this.displayedColumns = ['product_services','sale_quantity','UOM','rate_per_unit_sale','frequency','annual_sales','action'];
|
||||
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
@ -123,13 +123,13 @@
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field *ngIf="pd_cus_segment!='SAL'">
|
||||
<!--<mat-form-field *ngIf="pd_cus_segment!='SAL'">
|
||||
<mat-select placeholder="Is this the main business account"
|
||||
formControlName="is_main" >
|
||||
<mat-option value="Yes">Yes</mat-option>
|
||||
<mat-option value="No">No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</mat-form-field>-->
|
||||
|
||||
<div fxLayout="row" fxLayoutAlign="start none">
|
||||
<mat-form-field style="width: 35%;" *ngIf="salaryField">
|
||||
|
||||
@ -200,7 +200,7 @@ export class BankingDetailsComponent implements OnInit {
|
||||
//is_main: [''],
|
||||
//is_main: [this.pd_cus_segment == 'SAL' ? '' : ''],
|
||||
//is_main:[''],
|
||||
is_main: this.pd_cus_segment == 'SAL' ? [''] : [''],
|
||||
// is_main: this.pd_cus_segment == 'SAL' ? [''] : [''],
|
||||
vintage_year: [''],
|
||||
vintage_month: [''],
|
||||
});
|
||||
|
||||
@ -27,7 +27,7 @@ export class BusinessAssetsInfoComponent implements OnInit {
|
||||
// businessEmiAmtFlag : boolean = false;
|
||||
public m_any_asset_loan_type = [{'value': "yes",'viewValue': "Yes"},
|
||||
{'value': "no",'viewValue': "No"},
|
||||
{'value': "nan",'viewValue': "NA"}]
|
||||
]
|
||||
appxMarketAmtInwords : any = [];
|
||||
// emiAmtInwords : any = [];
|
||||
// PremiumPaidInwords : any = [];
|
||||
|
||||
@ -103,7 +103,7 @@
|
||||
</div>
|
||||
<div fxlayout="row">
|
||||
<mat-form-field style="width: 80%">
|
||||
<input matInput placeholder="% of Total Manufacturing Raw Materials Credit Values" formControlName="main_raw_materials_total_payments_percent_on_credit"
|
||||
<input matInput placeholder="What % of Total Manufacturing Raw Materials Credit Values" formControlName="main_raw_materials_total_payments_percent_on_credit"
|
||||
type="number">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
@ -34,6 +34,27 @@
|
||||
</mat-form-field>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<mat-card>
|
||||
<mat-card-content>
|
||||
<mat-form-field style="width:40%;">
|
||||
<mat-select placeholder="PD Officers Recommendation:" formControlName="pd_officers_recommendation" required>
|
||||
<mat-option value=2>Positive</mat-option>
|
||||
<mat-option value=3>Negative</mat-option>
|
||||
<mat-option value=4>Refer to Credit</mat-option>
|
||||
<mat-option value=1>Others</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:30%;" *ngIf="_finalRemarkForm.controls['pd_officers_recommendation'].value == 3">
|
||||
<input matInput autocomplete="off" placeholder="Enter reason for Negative" formControlName="enter_reason_for_negative">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:30%;" *ngIf="_finalRemarkForm.controls['pd_officers_recommendation'].value == 1">
|
||||
<input matInput autocomplete="off" placeholder="Specify Others" formControlName="others_pd_officers_recommendation">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:30%;" *ngIf="_finalRemarkForm.controls['pd_officers_recommendation'].value == 4">
|
||||
<input matInput autocomplete="off" placeholder="Enter reason for Refer to Credit" formControlName="enter_reason_for_refer_to_credit">
|
||||
</mat-form-field>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions>
|
||||
<div fxFlex="60" class="pb-0 text-sm-left" align="left">
|
||||
|
||||
@ -58,6 +58,10 @@ export class FinalRemarksComponent implements OnInit {
|
||||
final_custormer_remark_type : [],
|
||||
final_other_customer_behaviour:[],
|
||||
is_service_provided: ['', Validators.required],
|
||||
pd_officers_recommendation:['', Validators.required],
|
||||
others_pd_officers_recommendation:[''],
|
||||
enter_reason_for_negative:[''],
|
||||
enter_reason_for_refer_to_credit:[''],
|
||||
final_form_remarks: ['',Validators.required]
|
||||
});
|
||||
this.getM_Type();
|
||||
@ -88,6 +92,10 @@ export class FinalRemarksComponent implements OnInit {
|
||||
if(data.dataStatus){
|
||||
this._finalRemarkForm.controls.final_custormer_remark_type.setValue(data.records.final_custormer_remark_type);
|
||||
this._finalRemarkForm.controls.final_other_customer_behaviour.setValue(data.records.final_other_customer_behaviour);
|
||||
this._finalRemarkForm.controls.pd_officers_recommendation.setValue(data.records.pd_officers_recommendation);
|
||||
this._finalRemarkForm.controls.others_pd_officers_recommendation.setValue(data.records.others_pd_officers_recommendation);
|
||||
this._finalRemarkForm.controls.enter_reason_for_negative.setValue(data.records.enter_reason_for_negative);
|
||||
this._finalRemarkForm.controls.enter_reason_for_refer_to_credit.setValue(data.records.enter_reason_for_refer_to_credit);
|
||||
this._finalRemarkForm.controls.is_service_provided.setValue(data.records.is_service_provided);
|
||||
this._finalRemarkForm.controls.final_form_remarks.setValue(data.records.final_form_remarks);
|
||||
this.noRecordsFound = true;
|
||||
|
||||
@ -91,9 +91,23 @@ import { QcReviewComponent } from './list-pd/pd-report/qc-review/qc-review.compo
|
||||
import { SharedModule } from "app/shared/shared.module";
|
||||
import { BusinessInfoGroupComponent } from './list-pd/start-pd/forms/business-info-group/business-info-group.component';
|
||||
import { SearchRelationPipe } from './../pd-pipes/search-relation.pipe';
|
||||
import { DeleteRecordsCountPipe } from './../pd-pipes/delete-records-count.pipe';
|
||||
import { BusinessAssetsInfoComponent } from './list-pd/start-pd/forms/business-assets-info/business-assets-info.component';
|
||||
import { BusinessBankingDetailsComponent } from './list-pd/start-pd/forms/business-banking-details/business-banking-details.component';
|
||||
|
||||
import { SalesDetailsComponent } from './list-pd/start-pd/forms/assessed-income/sales-details/sales-details.component';
|
||||
import { DailySalesDetailsComponent } from './list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component';
|
||||
import { SalesCalculationComponent } from './list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component';
|
||||
import { ManageSalesComponent } from './list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component';
|
||||
import { PurchaseDetailsComponent } from './list-pd/start-pd/forms/assessed-income/purchase-details/purchase-details.component';
|
||||
import { BusinessExpenseDetailsComponent } from './list-pd/start-pd/forms/assessed-income/business-expense-details/business-expense-details.component';
|
||||
import { HouseHoldDetailsComponent } from './list-pd/start-pd/forms/assessed-income/house-hold-details/house-hold-details.component';
|
||||
import { OtherBusinessIncomeDetailsComponent } from './list-pd/start-pd/forms/assessed-income/other-business-income-details/other-business-income-details.component';
|
||||
import { ManagePurchaseComponent } from './list-pd/start-pd/forms/assessed-income/AI-diologue/manage-purchase/manage-purchase.component';
|
||||
import { ManageBusinesExpenseComponent } from './list-pd/start-pd/forms/assessed-income/AI-diologue/manage-busines-expense/manage-busines-expense.component';
|
||||
import { ManageHouseHoldComponent } from './list-pd/start-pd/forms/assessed-income/AI-diologue/manage-house-hold/manage-house-hold.component';
|
||||
import { ManageOtherBusinessIncomeComponent } from './list-pd/start-pd/forms/assessed-income/AI-diologue/manage-other-business-income/manage-other-business-income.component';
|
||||
import { GrossProfitCalculationComponent } from './list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component';
|
||||
import { ManageDailySalesComponent } from './list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component';
|
||||
/**
|
||||
* Custom angular notifier options
|
||||
*/
|
||||
@ -270,7 +284,7 @@ const pdCustomNotifierOptions: NotifierOptions = {
|
||||
// AgmCoreModule.forRoot({apiKey: 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'}), OwlDateTimeModule,
|
||||
// OwlNativeDateTimeModule,
|
||||
// ],
|
||||
declarations: [RentalInfoComponent, TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, LenderRepresentativeComponent, PdReportComponent, AssessedIncomeComponent, AllocationViewMoreComponent, PdRequirementComponent, GeneralInfoComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent, SearchRelationPipe, BusinessAssetsInfoComponent, BusinessBankingDetailsComponent],
|
||||
declarations: [RentalInfoComponent, TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, LenderRepresentativeComponent, PdReportComponent, AssessedIncomeComponent, AllocationViewMoreComponent, PdRequirementComponent, GeneralInfoComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent, SearchRelationPipe, DeleteRecordsCountPipe, BusinessAssetsInfoComponent, BusinessBankingDetailsComponent, SalesDetailsComponent, DailySalesDetailsComponent, SalesCalculationComponent, ManageSalesComponent, PurchaseDetailsComponent, BusinessExpenseDetailsComponent, HouseHoldDetailsComponent, OtherBusinessIncomeDetailsComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, GrossProfitCalculationComponent, ManageDailySalesComponent],
|
||||
|
||||
// exports: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent],
|
||||
// providers: [PdTrigerService, GetGeometricLocationService],
|
||||
@ -308,13 +322,13 @@ const pdCustomNotifierOptions: NotifierOptions = {
|
||||
OwlNativeDateTimeModule,
|
||||
],
|
||||
// declarations: [ListPdComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, AssetsInfoComponent],
|
||||
exports: [PdAllocationComponent, SmartPdAllocationComponent, TelePdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, AllocationViewMoreComponent, GeneralInfoComponent, PdRequirementComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, BusinessOtherFamilyMemberComponent, BusinessInfoGroupComponent],
|
||||
exports: [PdAllocationComponent, SmartPdAllocationComponent, TelePdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, AllocationViewMoreComponent, GeneralInfoComponent, PdRequirementComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, BusinessOtherFamilyMemberComponent, BusinessInfoGroupComponent,DailySalesDetailsComponent, SalesCalculationComponent, PurchaseDetailsComponent, BusinessExpenseDetailsComponent, HouseHoldDetailsComponent, OtherBusinessIncomeDetailsComponent, ManageSalesComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, GrossProfitCalculationComponent, ManageDailySalesComponent],
|
||||
providers: [PdTrigerService, GetGeometricLocationService,{provide: MAT_DATE_LOCALE, useValue: 'en-GB'},
|
||||
{provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]},
|
||||
{provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS}],
|
||||
|
||||
entryComponents: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, TelePdAllocationComponent, AllocationViewMoreComponent, PersonalInfoComponent,BusinessAssetsInfoComponent,
|
||||
ClientInfoComponent, SupplierInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, GeneralInfoComponent, PdRequirementComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent,BusinessBankingDetailsComponent],
|
||||
ClientInfoComponent, SupplierInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, GeneralInfoComponent, PdRequirementComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent,BusinessBankingDetailsComponent, ManageSalesComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, ManageDailySalesComponent],
|
||||
|
||||
})
|
||||
export class ManagePdModule {
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
import { DeleteRecordsCountPipe } from './delete-records-count.pipe';
|
||||
|
||||
describe('DeleteRecordsCountPipe', () => {
|
||||
it('create an instance', () => {
|
||||
const pipe = new DeleteRecordsCountPipe();
|
||||
expect(pipe).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,18 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({
|
||||
name: 'deleteRecordsCount'
|
||||
})
|
||||
export class DeleteRecordsCountPipe implements PipeTransform {
|
||||
|
||||
transform(value: any): any {
|
||||
if(value.length>0){
|
||||
let filterData = value.filter(val=>val.isactive===true);
|
||||
return filterData.length;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -557,6 +557,15 @@ export class PdTrigerService {
|
||||
catchError(this.handleError('role', []))
|
||||
)
|
||||
}
|
||||
|
||||
// save assessed sales item wise
|
||||
saveAssessedDetails(methodURl: string,saveData:any){
|
||||
//saveData.createdby = this._aws.getlocale();
|
||||
return this._http.post<any>(this.apiUrl + methodURl, { "records": saveData })
|
||||
.pipe(
|
||||
catchError(this.handleError('operation', []))
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { CKEditorModule } from 'ng2-ckeditor';
|
||||
import { PdfViewerModule } from 'ng2-pdf-viewer';
|
||||
import {
|
||||
|
||||
@ -205,7 +205,7 @@
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div fxFlex="30%">
|
||||
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button"
|
||||
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button"
|
||||
(click)="onReset()"><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button>
|
||||
</div>
|
||||
|
||||
@ -38,7 +38,7 @@ fxLayoutAlign="center">
|
||||
<div class="row" style="text-align:right;">
|
||||
<button *ngIf="isEmptyObject(_branchForm.controls['branch_id']);else editreset;" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<ng-template #editreset>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
</ng-template>
|
||||
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_branchForm.valid"><mat-icon>save</mat-icon></button>
|
||||
|
||||
@ -56,7 +56,7 @@ fxLayoutAlign="center">
|
||||
<div class="row" style="text-align:right;">
|
||||
<button *ngIf="isEmptyObject(_cityForm.controls['city_id']);else editreset;" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<ng-template #editreset>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
</ng-template>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_cityForm.valid" ><mat-icon>save</mat-icon></button>
|
||||
<!-- <button mat-button >RESET</button> -->
|
||||
|
||||
@ -41,7 +41,7 @@ fxLayoutAlign="center">
|
||||
<div class="row" style="text-align:right;">
|
||||
<button *ngIf="isEmptyObject(_CommentOnLocalityForm.controls['comments_on_locality_id']);else editreset;" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<ng-template #editreset>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
</ng-template>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_CommentOnLocalityForm.valid" ><mat-icon>save</mat-icon></button>
|
||||
<!-- <button mat-button >RESET</button> -->
|
||||
|
||||
@ -82,7 +82,7 @@
|
||||
<div class="row" style="text-align:right;">
|
||||
<button *ngIf="isEmptyObject(_companyForm.controls['company_id']);else editreset;" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<ng-template #editreset>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
</ng-template>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_companyForm.valid"><mat-icon>save</mat-icon></button>
|
||||
<!-- <button mat-button >RESET</button> -->
|
||||
|
||||
@ -45,7 +45,7 @@ fxLayoutAlign="center">
|
||||
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button> -->
|
||||
<button *ngIf="isEmptyObject(_customerBehaviourForm.controls['customer_behaviour_id']);else editreset;" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<ng-template #editreset>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onResetForEdit()"><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="onResetForEdit()"><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
</ng-template>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_customerBehaviourForm.valid"><mat-icon>save</mat-icon></button>
|
||||
<!-- <button mat-button >RESET</button> -->
|
||||
|
||||
@ -51,7 +51,7 @@ fxLayoutAlign="center">
|
||||
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button> -->
|
||||
<button *ngIf="isEmptyObject(_customerSegmentForm.controls['customer_segment_id']);else editreset;" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<ng-template #editreset>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
</ng-template>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_customerSegmentForm.valid"><mat-icon>save</mat-icon></button>
|
||||
<!-- <button mat-button >RESET</button> -->
|
||||
|
||||
@ -51,7 +51,7 @@ fxLayoutAlign="center">
|
||||
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button> -->
|
||||
<button *ngIf="isEmptyObject(_designationForm.controls['designation_id']);else editreset;" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<ng-template #editreset>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
</ng-template>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_designationForm.valid"><mat-icon>save</mat-icon></button>
|
||||
<!-- <button mat-button >RESET</button> -->
|
||||
|
||||
@ -43,7 +43,7 @@ fxLayoutAlign="center">
|
||||
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button> -->
|
||||
<button *ngIf="isEmptyObject(_frequencyForm.controls['frequency_id']);else editreset;" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" [color]="color" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<ng-template #editreset>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
</ng-template>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_frequencyForm.valid"><mat-icon>save</mat-icon></button>
|
||||
</div>
|
||||
|
||||
@ -42,7 +42,7 @@ fxLayoutAlign="center">
|
||||
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" [color]='color' matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button> -->
|
||||
<button *ngIf="isEmptyObject(_IndustryClassificationForm.controls['industry_classification_id']);else editreset;" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" [color]='color' matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<ng-template #editreset>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
</ng-template>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_IndustryClassificationForm.valid"><mat-icon>save</mat-icon></button>
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ fxLayoutAlign="center">
|
||||
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" [color]='color' matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button> -->
|
||||
<button *ngIf="isEmptyObject(_lenderHierarchyForm.controls['lender_hierarchy_id']);else editreset;" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" [color]='color' matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<ng-template #editreset>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
</ng-template>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_lenderHierarchyForm.valid"><mat-icon>save</mat-icon></button>
|
||||
</div>
|
||||
|
||||
@ -41,7 +41,7 @@ fxLayout="row">
|
||||
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" [color]='color' matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button> -->
|
||||
<button *ngIf="isEmptyObject(_occupationForm.controls['occupation_non_earning_member_id']);else editreset;" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" [color]='color' matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<ng-template #editreset>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
</ng-template>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_occupationForm.valid"><mat-icon>save</mat-icon></button>
|
||||
<!-- <button mat-button >RESET</button> -->
|
||||
|
||||
@ -44,7 +44,7 @@ fxLayoutAlign="center">
|
||||
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" [color]='color' matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button> -->
|
||||
<button *ngIf="isEmptyObject(_pdLocationApproachForm.controls['pd_location_approach_id']);else editreset;" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<ng-template #editreset>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
</ng-template>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_pdLocationApproachForm.valid"><mat-icon>save</mat-icon></button>
|
||||
<!-- <button mat-button >RESET</button> -->
|
||||
|
||||
@ -44,7 +44,7 @@ fxLayoutAlign="center">
|
||||
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" [color]='color' matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button> -->
|
||||
<button *ngIf="isEmptyObject(_pdTypeForm.controls['pd_type_id']);else editreset;" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<ng-template #editreset>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
</ng-template>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_pdTypeForm.valid"><mat-icon>save</mat-icon></button>
|
||||
<!-- <button mat-button >RESET</button> -->
|
||||
|
||||
@ -48,7 +48,7 @@ fxLayoutAlign="center">
|
||||
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" [color]='color' matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button> -->
|
||||
<button *ngIf="isEmptyObject(_productMasterForm.controls['product_id']);else editreset;" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" [color]='color' matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<ng-template #editreset>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
</ng-template>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_productMasterForm.valid"><mat-icon>save</mat-icon></button>
|
||||
</div>
|
||||
|
||||
@ -24,7 +24,7 @@ fxLayoutAlign="center">
|
||||
|
||||
<button *ngIf="isEmptyObject(_questionCategoryForm.controls['question_category_id']);else editreset;" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="ADD Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<ng-template #editreset>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onResetedited()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="onResetedited()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
</ng-template>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_questionCategoryForm.valid"><mat-icon>save</mat-icon></button>
|
||||
</div>
|
||||
|
||||
@ -44,7 +44,7 @@ fxLayoutAlign="center">
|
||||
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" [color]='color' matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button> -->
|
||||
<button *ngIf="isEmptyObject(_regionsForm.controls['region_id']);else editreset;" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<ng-template #editreset>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
</ng-template>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_regionsForm.valid"><mat-icon>save</mat-icon></button>
|
||||
<!-- <button mat-button >RESET</button> -->
|
||||
|
||||
@ -43,7 +43,7 @@ fxLayoutAlign="center">
|
||||
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" [color]='color' matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button> -->
|
||||
<button *ngIf="isEmptyObject(_relationShipForm.controls['relationship_id']);else editreset;" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" [color]='color' matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<ng-template #editreset>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
</ng-template>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_relationShipForm.valid"><mat-icon>save</mat-icon></button>
|
||||
<!-- <button mat-button >RESET</button> -->
|
||||
|
||||
@ -68,7 +68,7 @@ fxLayoutAlign="center">
|
||||
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" [color]='color' matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button> -->
|
||||
<button *ngIf="isEmptyObject(_statesForm.controls['state_id']);else editreset;" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" [color]='color' matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<ng-template #editreset>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
</ng-template>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_statesForm.valid"><mat-icon>save</mat-icon></button>
|
||||
<!-- <button mat-button >RESET</button> -->
|
||||
|
||||
@ -75,7 +75,7 @@ fxLayoutAlign="center">
|
||||
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" [color]='color' matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button> -->
|
||||
<button *ngIf="isEmptyObject(_subProductMasterForm.controls['subproduct_id']);else editreset;" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<ng-template #editreset>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
</ng-template>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_subProductMasterForm.valid"><mat-icon>save</mat-icon></button>
|
||||
</div>
|
||||
|
||||
@ -42,7 +42,7 @@ fxLayoutAlign="center">
|
||||
<div class="row" style="text-align:right;">
|
||||
<button *ngIf="isEmptyObject(_titleForm.controls['title_id']);else editreset;" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<ng-template #editreset>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
</ng-template>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_titleForm.valid"><mat-icon>save</mat-icon></button>
|
||||
<!-- <button mat-button >RESET</button> -->
|
||||
|
||||
@ -43,7 +43,7 @@ fxLayoutAlign="center">
|
||||
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" [color]='color' matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button> -->
|
||||
<button *ngIf="isEmptyObject(_activityMasterForm.controls['type_of_activity_id']);else editreset;" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<ng-template #editreset>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
</ng-template>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_activityMasterForm.valid"><mat-icon>save</mat-icon></button>
|
||||
<!-- <button mat-button >RESET</button> -->
|
||||
|
||||
@ -41,7 +41,7 @@ fxLayoutAlign="center">
|
||||
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" ><mat-icon>settings_backup_restore</mat-icon></button> -->
|
||||
<button *ngIf="isEmptyObject(_uomForm.controls['uom_id']);else editreset;" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset" [color]="color"><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<ng-template #editreset>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
</ng-template>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_uomForm.valid"><mat-icon>save</mat-icon></button>
|
||||
<!-- <button mat-button >RESET</button> -->
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
import { Directive, ElementRef, HostListener, Input } from '@angular/core';
|
||||
|
||||
@Directive({
|
||||
selector: '[OnlyNumber]'
|
||||
})
|
||||
export class NumbersOnlyDirective {
|
||||
|
||||
// Allow decimal numbers. The \. is only allowed once to occur
|
||||
private regex: RegExp = new RegExp(/^[0-9]+(\.[0-9]*){0,1}$/g);
|
||||
|
||||
// Allow key codes for special events. Reflect :
|
||||
// Backspace, tab, end, home
|
||||
private specialKeys: Array<string> = [ 'Backspace', 'Tab', 'End', 'Home' ];
|
||||
|
||||
constructor(private el: ElementRef) {
|
||||
}
|
||||
|
||||
@HostListener('keydown', [ '$event' ])
|
||||
onKeyDown(event: KeyboardEvent) {
|
||||
// Allow Backspace, tab, end, and home keys
|
||||
if (this.specialKeys.indexOf(event.key) !== -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
let current: string = this.el.nativeElement.value;
|
||||
let next: string = current.concat(event.key);
|
||||
if (next && !String(next).match(this.regex)) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5,6 +5,7 @@ import { HorizontalMenuItems } from './menu-items/horizontal-menu-items';
|
||||
import { AccordionAnchorDirective, AccordionLinkDirective, AccordionDirective } from './accordion';
|
||||
import { ToggleFullscreenDirective } from './fullscreen/toggle-fullscreen.directive';
|
||||
import { RatingComponent} from './rating/rating.component';
|
||||
import { NumbersOnlyDirective } from './numbers-only/numbers-only.directive';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
@ -12,14 +13,16 @@ import { RatingComponent} from './rating/rating.component';
|
||||
AccordionLinkDirective,
|
||||
AccordionDirective,
|
||||
ToggleFullscreenDirective,
|
||||
RatingComponent
|
||||
RatingComponent,
|
||||
NumbersOnlyDirective
|
||||
],
|
||||
exports: [
|
||||
AccordionAnchorDirective,
|
||||
AccordionLinkDirective,
|
||||
AccordionDirective,
|
||||
ToggleFullscreenDirective,
|
||||
RatingComponent
|
||||
RatingComponent,
|
||||
NumbersOnlyDirective
|
||||
],
|
||||
providers: [ MenuItems, HorizontalMenuItems ]
|
||||
})
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
<div class="row" style="text-align:right;">
|
||||
<button mat-raised-button mat-icon-button color="primary" class="mr-1 mb-1 hover-icon" matTooltip="Add More Category" matTooltipPosition="above" (click)="addLanguage(null, $event); false"><mat-icon>add</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="reset()"><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="reset()"><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button>
|
||||
</div>
|
||||
</form>
|
||||
@ -48,7 +48,7 @@
|
||||
<div class="row" style="text-align:right;">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" color="primary" matTooltip="Add More Lender Details" matTooltipPosition="above" (click)="addLanguage(null, $event); false"><mat-icon>add</mat-icon></button>
|
||||
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="reset()"><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="reset()"><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button>
|
||||
</div>
|
||||
</form>
|
||||
Loading…
Reference in New Issue
Block a user