From 87acb19edf7bc9be3449c68e43a7b12bac05b11d Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Wed, 20 Mar 2019 19:32:17 +0530 Subject: [PATCH 1/2] Ai changes --- .../manage-daily-sales.component.html | 91 +++++++++---- .../manage-daily-sales.component.scss | 9 ++ .../manage-daily-sales.component.ts | 125 ++++++++++++++++-- .../manage-sales/manage-sales.component.html | 70 +++++++--- .../manage-sales/manage-sales.component.scss | 10 ++ .../manage-sales/manage-sales.component.ts | 69 ++++++++-- .../assessed-income.component.ts | 19 ++- .../daily-sales-details.component.html | 125 ++++++++++++------ .../daily-sales-details.component.ts | 9 +- .../sales-calculation.component.html | 10 +- .../sales-calculation.component.ts | 11 +- .../sales-details.component.html | 8 +- .../sales-details/sales-details.component.ts | 6 +- .../pd-pipes/number-to-words.pipe.ts | 7 +- 14 files changed, 435 insertions(+), 134 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.html index ad769393e..6e4636b35 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.html @@ -13,52 +13,95 @@ - + - - - - - - {{"₹"}} {{sales.value.margin_value | numberToWords}} Only - - - - -
+ + {{types.type_name}} + + +
+ +
+
+ + + + + + + + {{"₹"}} {{childItem.value.sales_value | numberToWords}} Only + + +
+ +
+
+ +
+ +
+ + +
+
- - - - + + + {{frq.name}} + - - + + + {{"₹"}} {{childItem.value.frequency_value | numberToWords}} Only + + + {{"₹"}} {{childItem.value.sales_value | numberToWords}} Only - + -->
-
+ +
+
+
+
+ + + + + + {{"₹"}} {{sales.value.margin_value | numberToWords}} Only +
- + + + +
- +
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.scss index 2db8a5604..b884adf57 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.scss @@ -20,3 +20,12 @@ margin-left:4%; margin-top:2%; } +.example-radio-group { + display: flex; + flex-direction: row; + flex-wrap: wrap; +} +.example-radio-button { + margin: 0 2%; + color: #000 !important +} \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.ts index e28592ca3..abcc2c7f8 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.ts @@ -20,9 +20,11 @@ export class ManageDailySalesComponent implements OnInit { frequencyData: any[]=[]; marginAmtInwords: any[]=[]; private notifier: NotifierService; + check_type:any=[{'type_id':"1",'type_name':'Date Information'},{'type_id':"2",'type_name':'Frequency Information'}] constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef) { this.pageTitle = this.data.manage_status==1 ? 'Add Daily Sales Item' : 'Update Daily Sales Item'; this.notifier = notifier; + this.frequencyData=this.data.masterData.frequencyList; } ngOnInit() { @@ -39,10 +41,27 @@ export class ManageDailySalesComponent implements OnInit { sales_product: this._fb.array([this.createSalesItemWithData(this.data.editData)]), }); let control: any = this.salesItemForm.controls['sales_product']; - control = control.controls[0].get('child') as FormArray; + let innercontrol: any = control.controls[0].get('child') as FormArray; this.data.editData.values.forEach((elementVal,inx) => { - control.push(this.createDailySalesWithData(elementVal,this.data.editData.sim_id)) - }); + innercontrol.push(this.createDailySalesWithData(elementVal,this.data.editData)) + }); + + if(this.data.editData.sales_type=="2"){ + innercontrol.controls[innercontrol.value.length-1].controls['sales_date'].setValue(""); + innercontrol.controls[innercontrol.value.length-1].controls['sales_date'].clearValidators(); + innercontrol.controls[innercontrol.value.length-1].controls['sales_date'].updateValueAndValidity(); + + innercontrol.controls[innercontrol.value.length-1].controls['fk_frequency_id'].setValidators([Validators.required]); + innercontrol.controls[innercontrol.value.length-1].controls['fk_frequency_id'].updateValueAndValidity(); + + innercontrol.controls[innercontrol.value.length-1].controls['frequency_value'].setValidators([Validators.required]); + innercontrol.controls[innercontrol.value.length-1].controls['frequency_value'].updateValueAndValidity(); + + control.controls[control.value.length-1].controls['comments'].setValidators([Validators.required]); + control.controls[control.value.length-1].controls['comments'].updateValueAndValidity(); + + } + } else{ this.salesItemForm = this._fb.group({ @@ -64,7 +83,8 @@ export class ManageDailySalesComponent implements OnInit { margin_per: [''], margin_value: [''], comments: [''], - isactive:[true] + sales_type:["1"], + isactive:[true], }); } // create daily list empty @@ -74,6 +94,8 @@ createDailySalesData(sim_id: string) { fk_sim_id: [sim_id], sales_date: [''], sales_value: ['', Validators.compose([Validators.required])], + fk_frequency_id:[''], + frequency_value:[''], isactive:[true], }) } @@ -89,16 +111,19 @@ createSalesItemWithData(values: any) { margin_per: [this.data.margin_calculation_status===true ? values.margin_per: ''], margin_value: [this.data.margin_calculation_status===true ? values.margin_value: ''], comments: [values.comments], - isactive:[true] + sales_type:[values.sales_type], + isactive:[true], }); } // create daily list -createDailySalesWithData(values: any, sim_id: string) { +createDailySalesWithData(values: any, parent: any) { 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])], + fk_sim_id: [parent.sim_id], + sales_date: [parent.sales_type=='2' ? '' :new Date(this.pipe.transform(values.sales_date, 'yyyy-MM-dd')), Validators.compose([Validators.required])], sales_value: [values.sales_value, Validators.compose([Validators.required])], + fk_frequency_id:[values.fk_frequency_id], + frequency_value:[values.frequency_value], isactive:[true] }) } @@ -148,7 +173,7 @@ closeDialogue(){ } salesCalculation(indexVal: number,values: any): void { - if(this.data.margin_calculation_status===true){ + if(this.data.margin_calculation_status===true && values.sales_type=="1"){ let control:any = 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=>{ @@ -165,7 +190,7 @@ salesCalculation(indexVal: number,values: any): void { 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(''); + control.controls[indexVal].controls['margin_value'].setValue(""); } } @@ -174,8 +199,88 @@ salesCalculation(indexVal: number,values: any): void { } } + else if(this.data.margin_calculation_status===true && values.sales_type=="2"){ + let control:any = this.salesItemForm.controls['sales_product']; + let innercontrol: any = control.controls[indexVal].get('child') as FormArray; + + if(values.child[values.child.length-1].fk_frequency_id!='' && values.child[values.child.length-1].frequency_value!=''){ + let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.child[values.child.length-1].fk_frequency_id); + innercontrol.controls[innercontrol.value.length-1].controls['sales_value'].setValue(parseInt(filterFrequencyValue[0].mutiple_factor) * parseInt(values.child[values.child.length-1].frequency_value)); + + let getTotalValueCounts =parseInt(filterFrequencyValue[0].mutiple_factor) * parseInt(values.child[values.child.length-1].frequency_value) + values.margin_per!='' ? control.controls[indexVal].controls['margin_value'].setValue( getTotalValueCounts * (parseInt(values.margin_per)/100)) : ''; + } + else { + innercontrol.controls[innercontrol.value.length-1].controls['sales_value'].setValue(""); + control.controls[indexVal].controls['margin_value'].setValue(""); + + } + } + else if(this.data.margin_calculation_status===false && values.sales_type=="2"){ + let control:any = this.salesItemForm.controls['sales_product']; + let innercontrol: any = control.controls[indexVal].get('child') as FormArray; + + if(values.child[values.child.length-1].fk_frequency_id!='' && values.child[values.child.length-1].frequency_value!=''){ + let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.child[values.child.length-1].fk_frequency_id); + innercontrol.controls[innercontrol.value.length-1].controls['sales_value'].setValue(parseInt(filterFrequencyValue[0].mutiple_factor) * parseInt(values.child[values.child.length-1].frequency_value)); + } + else { + innercontrol.controls[innercontrol.value.length-1].controls['sales_value'].setValue(""); + } + } } + +// change options for either Date/Frequency Information +changeOptions(indexVal: any,event: any): void{ + let control: any = this.salesItemForm.controls['sales_product']; + let innercontrol: any = control.controls[indexVal].get('child') as FormArray; + if(event.value==1){ + for (let i = 0; i < innercontrol.value.length-1; i++) { + innercontrol.removeAt(i); + } + innercontrol.controls[innercontrol.value.length-1].controls['sales_date'].setValidators([Validators.required]); + innercontrol.controls[innercontrol.value.length-1].controls['sales_date'].updateValueAndValidity(); + + innercontrol.controls[innercontrol.value.length-1].controls['fk_frequency_id'].setValue(""); + innercontrol.controls[innercontrol.value.length-1].controls['fk_frequency_id'].clearValidators(); + innercontrol.controls[innercontrol.value.length-1].controls['fk_frequency_id'].updateValueAndValidity(); + + innercontrol.controls[innercontrol.value.length-1].controls['frequency_value'].setValue(""); + innercontrol.controls[innercontrol.value.length-1].controls['frequency_value'].clearValidators(); + innercontrol.controls[innercontrol.value.length-1].controls['frequency_value'].updateValueAndValidity(); + + innercontrol.controls[innercontrol.value.length-1].controls['sales_value'].setValue(""); + + control.controls[indexVal].controls['comments'].setValue(""); + control.controls[indexVal].controls['comments'].clearValidators(); + control.controls[indexVal].controls['comments'].updateValueAndValidity(); + } + else if(event.value==2){ + for (let i = 0; i < innercontrol.value.length-1; i++) { + innercontrol.removeAt(i); + } + innercontrol.controls[innercontrol.value.length-1].controls['sales_date'].setValue(""); + innercontrol.controls[innercontrol.value.length-1].controls['sales_date'].clearValidators(); + innercontrol.controls[innercontrol.value.length-1].controls['sales_date'].updateValueAndValidity(); + + innercontrol.controls[innercontrol.value.length-1].controls['fk_frequency_id'].setValidators([Validators.required]); + innercontrol.controls[innercontrol.value.length-1].controls['fk_frequency_id'].updateValueAndValidity(); + + innercontrol.controls[innercontrol.value.length-1].controls['frequency_value'].setValidators([Validators.required]); + innercontrol.controls[innercontrol.value.length-1].controls['frequency_value'].updateValueAndValidity(); + + innercontrol.controls[innercontrol.value.length-1].controls['sales_value'].setValue(""); + + control.controls[indexVal].controls['comments'].setValue(""); + control.controls[indexVal].controls['comments'].setValidators([Validators.required]); + control.controls[indexVal].controls['comments'].updateValueAndValidity(); + + } + control.controls[indexVal].controls['margin_per'].setValue(""); + control.controls[indexVal].controls['margin_value'].setValue(""); + + } // save sales details submitDetails(records) { if (this.salesItemForm.invalid) { diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.html index 185eaa1e8..29d385f15 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.html @@ -13,7 +13,7 @@
- +
-
+ +
+ + {{types.type_name}} + +
+
- + {{uom.name}} @@ -35,31 +41,55 @@
+ +
+ +
+ + + {{"₹"}} {{sales.value.rate_per_unit | numberToWords}} Only + + + + {{frq.name}} + + + + + {{"₹"}} {{sales.value.annual_sale_value | numberToWords}} Only + +
+ +
+ + + {{frq.name}} + + + + + {{"₹"}} {{sales.value.rate_per_unit | numberToWords}} Only + + + + + {{"₹"}} {{sales.value.annual_sale_value | numberToWords}} Only + +
+
+ + -
- - - {{"₹"}} {{sales.value.rate_per_unit | numberToWords}} Only - - - - {{frq.name}} - - - - - {{"₹"}} {{sales.value.annual_sale_value | numberToWords}} Only - -
+
- + {{"₹"}} {{sales.value.margin_per_uom | numberToWords}} Only - + {{"₹"}} {{sales.value.margin_final_value | numberToWords}} Only diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.scss index 76e439914..dfbb6890a 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.scss @@ -21,3 +21,13 @@ margin-top:2%; } +.example-radio-group { + display: flex; + flex-direction: row; + flex-wrap: wrap; +} +.example-radio-button { + margin: 0 2%; + color: #000 !important +} + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.ts index 0c98ea39d..4f186fcf0 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.ts @@ -3,6 +3,7 @@ import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@ang import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angular/material'; import { PdTrigerService } from './../../../../../../../pd-service/pd-triger.service'; import { NotifierService } from 'angular-notifier'; +import { AnyAaaaRecord } from 'dns'; @Component({ selector: 'app-manage-sales', @@ -21,6 +22,7 @@ export class ManageSalesComponent implements OnInit { marginAmtInwords: any[]=[]; marginFinalAmtInwords: any[]=[]; ratePerUnitAmtInwords: any[]=[]; + check_type:any=[{'type_id':"1",'type_name':'Quantity and Rate Information'},{'type_id':"2",'type_name':'Value Information'}] private notifier: NotifierService; constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef) { @@ -37,7 +39,17 @@ export class ManageSalesComponent implements OnInit { }); let control: any = this.salesItemForm.controls['salesCalItemwise']; this.data.editData.fk_uom_id=="1" ? control.controls[0].addControl('uom_other', new FormControl(this.data.editData.uom_other ? this.data.editData.uom_other : '', Validators.required)) : control.controls[0].removeControl('uom_other'); - + if(this.data.editData.sales_type && this.data.editData.sales_type=="2"){ + control.controls[0].controls['sales_qty'].setValue(""); + control.controls[0].controls['sales_qty'].clearValidators(); + control.controls[0].controls['sales_qty'].updateValueAndValidity(); + + control.controls[0].controls['fk_uom_id'].setValue(""); + control.controls[0].controls['fk_uom_id'].clearValidators(); + control.controls[0].controls['fk_uom_id'].updateValueAndValidity(); + control.controls[0].controls['margin_per_uom'].setValue(""); + + } } else{ this.salesItemForm = this._fb.group({ @@ -64,6 +76,7 @@ export class ManageSalesComponent implements OnInit { margin_per_uom:[''], margin_final_value:[''], comments:[], + sales_type:["1"] }); } @@ -83,6 +96,7 @@ createSalesItemWithData(values: any) { margin_per_uom:[this.data.margin_calculation_status===true ? values.margin_per_uom :''], margin_final_value:[this.data.margin_calculation_status===true ? values.margin_final_value: ''], comments:[values.comments], + sales_type:[values.sales_type] }); } @@ -100,11 +114,14 @@ closeDialogue(){ salesCalculation(indexVal: number,values: any): void { let control:any = this.salesItemForm.controls['salesCalItemwise']; - if(values.sales_qty!='' && values.rate_per_unit!='' && values.fk_frequency_id!='') { + if(values.sales_type=="1" && values.sales_qty!='' && values.rate_per_unit!='' && values.fk_frequency_id!='') { let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id); - let AnnualSalesValue = parseInt(values.sales_qty) * parseInt(values.rate_per_unit) * parseInt(filterFrequencyValue[0].mutiple_factor) control.controls[indexVal].controls['annual_sale_value'].setValue(parseInt(values.sales_qty) * parseInt(values.rate_per_unit) * parseInt(filterFrequencyValue[0].mutiple_factor)); } + else if(values.sales_type=="2" && 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.rate_per_unit) * parseInt(filterFrequencyValue[0].mutiple_factor)); + } else { control.controls[indexVal].controls['annual_sale_value'].setValue(''); } @@ -125,16 +142,48 @@ salesMarginPerCalculation(indexVal: number,values: any): void { salesMarginAmtCalculation(indexVal: number,values: any): void { let control:any = this.salesItemForm.controls['salesCalItemwise']; control.controls[indexVal].controls['margin_per'].setValue(''); - - - if(values.margin_per_uom!='' && values.sales_qty!='') { - let MarginFinalValue = parseInt(values.sales_qty) * parseInt(values.margin_per_uom); + + if(values.sales_type=="1" && 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 if(values.sales_type=="2" && values.margin_per_uom!='' && values.rate_per_unit!='') { + control.controls[indexVal].controls['margin_final_value'].setValue(parseInt(values.rate_per_unit) * parseInt(values.margin_per_uom)); + } else { control.controls[indexVal].controls['margin_final_value'].setValue(''); } } +// generate other UOM +generateOtherUOM(index: number, values: any): void { + let control: any = this.salesItemForm.controls['salesCalItemwise']; + values.fk_uom_id=="1" ? control.controls[index].addControl('uom_other', new FormControl('', Validators.required)) : control.controls[index].removeControl('uom_other'); +} + +// change options for either Quantity and Rate Information / Value Information +changeOptions(indexVal: any,event: any): void{ +let control: any = this.salesItemForm.controls['salesCalItemwise']; + if(event.value==1){ + control.controls[indexVal].controls['sales_qty'].setValidators([Validators.required]); + control.controls[indexVal].controls['sales_qty'].updateValueAndValidity(); + + control.controls[indexVal].controls['fk_uom_id'].setValidators([Validators.required]); + control.controls[indexVal].controls['fk_uom_id'].updateValueAndValidity(); + this.salesCalculation(indexVal,control.controls[indexVal].value); + } + else if(event.value==2){ + control.controls[indexVal].controls['sales_qty'].setValue(""); + control.controls[indexVal].controls['sales_qty'].clearValidators(); + control.controls[indexVal].controls['sales_qty'].updateValueAndValidity(); + + control.controls[indexVal].controls['fk_uom_id'].setValue(""); + control.controls[indexVal].controls['fk_uom_id'].clearValidators(); + control.controls[indexVal].controls['fk_uom_id'].updateValueAndValidity(); + + control.controls[indexVal].controls['margin_per_uom'].setValue(""); + + this.salesCalculation(indexVal,control.controls[indexVal].value); + } +} removeItem(indexVal: number) : void { let control = this.salesItemForm.controls['salesCalItemwise']; @@ -158,11 +207,7 @@ submitDetails(records) { this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); }); } -// generate other UOM -generateOtherUOM(index: number, values: any): void { - let control: any = this.salesItemForm.controls['salesCalItemwise']; - values.fk_uom_id=="1" ? control.controls[index].addControl('uom_other', new FormControl('', Validators.required)) : control.controls[index].removeControl('uom_other'); -} + // validate all form group and form array fields validateAllFormFields(formGroup: any) { diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.ts index 49b95e006..0efb55fac 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.ts @@ -46,12 +46,12 @@ 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:'',company_id:'',grossProfitTypeList:this.grossProfitTypeList}; +public getCustomValues:any = { UOMList: this.UOMList,frequencyList: this.frequencyList,businessExpenseList: this.businessExpenseList,businessIncomeList:this.businessIncomeList,pdid:'',company_id:'',grossProfitTypeList:this.grossProfitTypeList,salesDeclaredCustomer:this.salesDeclaredCustomer}; //public finalData: any; constructor(notifier: NotifierService, private route: ActivatedRoute, private router: Router, private _pd: PdTrigerService, private dialog: MatDialog, - @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { + @Inject(MAT_DIALOG_DATA) public pd_all_details: any, private dialogRef: MatDialogRef,) { this.pdid = this.pd_all_details.pdmaster_details.pd_id; this.company_id = this.pd_all_details.company_id; this.notifier = notifier; @@ -105,6 +105,8 @@ public viewerOptions: any = { } if(value.records.sales_declared_by_customer){ this.salesDeclaredCustomer = value.records.sales_declared_by_customer; + this.getCustomValues.salesDeclaredCustomer=this.salesDeclaredCustomer; + } if(value.records.sales_calculated_by_itemwise){ this.salesCaluatedItem = value.records.sales_calculated_by_itemwise; @@ -119,7 +121,7 @@ public viewerOptions: any = { listItems.push({items:expnadElement, itemsTotal:calculateItems}) }) let calculateAllItemsTotal:number=listItems.reduce((racc, rcalculate) => racc + Number(rcalculate.itemsTotal), 0); - + let convertYear : number = 12 / listItems.length; let footerMessage: any=[]; footerMessage.push({ @@ -132,7 +134,7 @@ public viewerOptions: any = { // message: ' Yearly ' + itemElement.sales_item + ' Sales Arrived', // value: calculateAllItemsTotal * convertYear, // }) - this.salesMonthWiseExpandedItems.push({sim_id:itemElement.sim_id,salesItem:itemElement.sales_item,comments:itemElement.comments,margin_per:itemElement.margin_per,margin_value:itemElement.margin_value, expandElements:expandBodyContent, footerMessage: footerMessage}); + this.salesMonthWiseExpandedItems.push({sim_id:itemElement.sim_id,salesItem:itemElement.sales_item,sales_type:itemElement.sales_type,comments:itemElement.comments,margin_per:itemElement.margin_per,margin_value:itemElement.margin_value, expandElements:expandBodyContent, footerMessage: footerMessage}); }); } if(value.records.purchase_details){ @@ -310,16 +312,19 @@ public viewerOptions: any = { // complete AI detailscomplete AI details completeAI(): void{ - const dialogRef = this.dialog.open(ConfirmAiDetailsComponent, { + const completeDialogRef = this.dialog.open(ConfirmAiDetailsComponent, { data: { pdid: this.pdid, company_id: this.company_id ,calc_type_id:this.grossProfitTypeList.length > 0 ? this.grossProfitTypeList[0].calc_type_id : ''}, disableClose: true, minWidth:'30%', maxWidth:'40%', }); - dialogRef.afterClosed() + completeDialogRef.afterClosed() .subscribe(dataresult => { if(dataresult.update_status==true){ - this.loadAIDetails(); + // this.loadAIDetails(); + setTimeout(() =>{ + this.dialogRef.close(); + },3000); } }); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.html index 12dc5ca30..2a4025e4c 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.html @@ -1,4 +1,4 @@ - + +
+ + + {{expandDetails.salesItem}} +  ( Margin Percentage : {{expandDetails.margin_per}} %   Margin Value : {{expandDetails.margin_value}} ) + + + +
+ {{footer.month_message}}   {{footer.year_message}} +
+
+
+ + + + +
+ +

{{eachItem.header}}

+ + + + + + + + + + + + + + + +
Date{{itemValue.sales_date | date: 'dd-MM-yyyy'}} Total Amount{{itemValue.sales_value}} {{getTotalCost(eachItem.value)}}
+
+ +
+
+ +
+ + + {{expandDetails.salesItem}} +  ( Margin Percentage : {{expandDetails.margin_per}} %   Margin Value : {{expandDetails.margin_value}} ) + + + + + + + +
+ + + + + + + + + + + + + + + + + +
Frequency{{itemValue.frequency_name ? itemValue.frequency_name : '' }} Total Amount{{itemValue.frequency_value}} {{getTotalCost(eachItem.value)}}
+
+ +
+
+
+
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.ts index 861744e94..eda055aad 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.ts @@ -14,13 +14,15 @@ export class DailySalesDetailsComponent implements OnInit, DoCheck { public salesMonthItemColumns = ['Date','Amount']; public salesMonthWiseExpandedItems: any[]=[]; @Input() parentData: any; - @Input() masterData: { UOMList: any; frequencyList: any; pdid:number,company_id:number, grossProfitTypeList:any}; + @Input() masterData: { UOMList: any; frequencyList: any; pdid:number,company_id:number, grossProfitTypeList:any,salesDeclaredCustomer: any}; @Output() loadAssessedForms = new EventEmitter(); activateMariginCalculation: boolean; private notifier:NotifierService; + enableDailySalesSection: boolean; constructor(notifier:NotifierService, private _pd: PdTrigerService, private dialog: MatDialog) { this.activateMariginCalculation=false; this.notifier = notifier; + this.enableDailySalesSection = false; } ngOnInit() { @@ -59,10 +61,11 @@ editSalesItem(value:any) { "fk_pd_id":this.masterData.pdid, "sim_id":value.sim_id, "salesItem":value.salesItem, + "sales_type":value.sales_type, "comments":value.comments, "margin_value":value.margin_value, "margin_per":value.margin_per, - "values":transformData + "values":transformData, } let passValues: any = { manage_status:2, @@ -109,6 +112,8 @@ 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.enableDailySalesSection = this.masterData.salesDeclaredCustomer.length>0 ? true : false; + }} // detect chnges from parent diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.html index e260c2766..98dd20928 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.html @@ -1,23 +1,23 @@ -
+ Sales Calculation - + - {{"₹"}} {{SaleAmtInwords}} Only + {{"₹"}} {{salesCalculationForm.value.sales_declared_by_customer | numberToWords}} Only - + {{"₹"}} {{salesCalculationForm.value.margin_value | numberToWords}} Only - +
- diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts index e805a57f3..ca1f903a8 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts @@ -53,7 +53,11 @@ export class BusinessAssetsInfoComponent implements OnInit { public m_propertyType = []; public m_address_type = []; public m_vehicle_type = []; - + public m_state_for_address = []; + public m_city_for_address = []; + public m_pincode_for_address = []; + public cityArr: any = []; + public pinArr: any = []; PropertyOwnedType: any = []; existCompanyList: any = []; mergeCompanyApplicant: any = []; @@ -89,7 +93,7 @@ export class BusinessAssetsInfoComponent implements OnInit { /** init Function */ ngOnInit() { - +console.clear(); // this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid,'').subscribe(data => { // this.businessProfessionName = (data.status == 200) ? data.records.profession_name : '' ; // }); @@ -115,12 +119,22 @@ export class BusinessAssetsInfoComponent implements OnInit { } }) - + this.getM_State_For_Address(); this.getPdSupplierFormDetails(); this.getM_Assets_Type(); this.getM_PropertyType(); this.getM_Address_Type(); this.getM_Vehicle_Type(); + this.getM_Address_Type(); + + + } + + getM_State_For_Address(){ + this.pdTrigerService.getAllMasterDatas('STATE').subscribe( + data => { + this.m_state_for_address = data.records.filter(data => data.isactive == 1); + }) } /** Assets Type For Dropdown List */ @@ -164,7 +178,7 @@ export class BusinessAssetsInfoComponent implements OnInit { this.m_vehicle_type = data.records.filter(data => data.is_active == 1); }) } - + //Get Data Based on PDID and FORMID apiLoadFinish: boolean = false; getPdSupplierFormDetails() { @@ -197,39 +211,54 @@ export class BusinessAssetsInfoComponent implements OnInit { let dataOfAddress = data.records.addresses.filter(item => item.isactive == 1); // // const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; - + if (data.records.addresses.length > 0) { - data.records.addresses.forEach((data, inx) => { - + data.records.addresses.forEach((dataValue, inx) => { this.addressLabel[inx] = ''; - - let selectedAddressType = this.m_address_type.filter(element => element.address_type_id == data.address_type)[0]; - let address = data.address; - let addressType = data.address_type != 1 ? selectedAddressType.address_type : data.address_type_others; - - this.placeholderName[inx] = 'Was any business activity seen at the ' + addressType + ' during PD visit?'; - let addressLabel = address + ' / ' + addressType; - - let vals = { - address_label: addressLabel, - business_years: '', - business_month: '', - business_address_availability: '', - business_is_pd_visited: '', - business_pd_visited_remark: '', - business_approximate_market_value: '', - business_ownership_type: '', - business_monthly_rented_amt: '', - business_name_of_the_owner: '', - business_name_of_the_other_owner: '', - business_vintage: '', - business_purchase_year: '', - business_emi: '' - } - - const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; - control.push(this.initBusinessAddressDetailsWithdata(vals)); + this.pdTrigerService.getStateWiseCities(dataValue.state).subscribe(data => { + if (data.status == 200) { + // console.log(data.records); + this.cityArr = data.records.cities; + this.pinArr = data.records.pincode; + // console.log('cityArr',this.cityArr); + // console.log('pinArr',this.pinArr); + // console.log('flag',flag); + console.log('this.m_state_for_address',this.m_state_for_address); + let selectedAddressType = this.m_address_type.filter(element => element.address_type_id == dataValue.address_type)[0]; + let selectedState = this.m_state_for_address.filter(element => element.state_id == dataValue.state)[0]; + let selectedCity = this.cityArr.filter(element => element.city_id == dataValue.city)[0]; + let selectedPincode = this.pinArr.filter(element => element.pincode_id == dataValue.pincode)[0]; + // console.log(selectedCity); + // console.log(selectedPincode); + // console.log(selectedCity[0].city_name); + // console.log(selectedPincode[0].pincode); + console.log('selectedState',selectedState); + let addressType = dataValue.address_type != 1 ? selectedAddressType.address_type : dataValue.address_type_others; + let address = dataValue.address + ' , ' + selectedCity.city_name + ','+selectedState.name +'-' + (dataValue.pincode == 1 ? dataValue.pincode_others : selectedPincode.pincode); + + this.placeholderName[inx] = 'Was any business activity seen at the ' + addressType + ' during PD visit?'; + let addressLabel = address + ' / ' + addressType; + let vals = { + address_label: addressLabel, + business_years: '', + business_month: '', + business_address_availability: '', + business_is_pd_visited: '', + business_pd_visited_remark: '', + business_approximate_market_value: '', + business_ownership_type: '', + business_monthly_rented_amt: '', + business_name_of_the_owner: '', + business_name_of_the_other_owner: '', + business_vintage: '', + business_purchase_year: '', + business_emi: '' + } + const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; + control.push(this.initBusinessAddressDetailsWithdata(vals)); + } + }); }); } else { @@ -568,7 +597,14 @@ export class BusinessAssetsInfoComponent implements OnInit { }); - for (let val of result) { + // for (let val of result) { + result.forEach((val, index) => { + + var splitted_label = val.address_label.split("/", 2); + // console.log(splitted_label) + // console.log(splitted_label[0],splitted_label[1]); + let addressType = splitted_label[1] != '' ? splitted_label[1] : 'Address Type'; + this.placeholderName[index] = 'Was any business activity seen at the ' + addressType + ' during PD visit?'; let vals = { address_label: val.address_label, business_years: val.business_years, @@ -584,11 +620,11 @@ export class BusinessAssetsInfoComponent implements OnInit { business_vintage: val.business_vintage, business_purchase_year: val.business_purchase_year, business_emi: val.business_emi - }; + } const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; control.push(this.initBusinessAddressDetailsWithdata(vals)); // this.initBusinessDetailsWithdata(vals) - } + }); } else { const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; control.push(this.initBusinessAddressDetails()); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-banking-details/business-banking-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-banking-details/business-banking-details.component.html index 186f95c51..df33a08dc 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-banking-details/business-banking-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-banking-details/business-banking-details.component.html @@ -96,7 +96,8 @@
- + +
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-banking-details/business-banking-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-banking-details/business-banking-details.component.ts index 55b7d005b..bc6dc9f84 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-banking-details/business-banking-details.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-banking-details/business-banking-details.component.ts @@ -121,6 +121,34 @@ export class BusinessBankingDetailsComponent implements OnInit { this.getM_BTLenderList(); this.salaryField = this.pd_cus_segment.substring(0, 2) == 'SE' ? false : true; + + this._pd.retriveForm({'pd_id':this.pdid,'pd_form_id':13,'company_id':this.company_id}).subscribe(data => { + // let businessVal = data.records; + // console.log('businessVal',businessVal,data.records.partners); + if (data.status == 200) { + let PartnrArray = Object.keys(data.records.partners).map(function (key) { + return data.records.partners[key]; + }); + console.log(PartnrArray); + console.log(data.records.partners); + PartnrArray.forEach((datas,index) => { + let sum1 = PartnrArray.map(officer => officer.Current_business_experiance_month).reduce((sum, val) => sum + +val, 0); + // console.log('SumOfYear',SumOfYear); + // console.log('SumOfMonth',SumOfMonth); + }); + + // let SumOfYear = PartnrArray[index].Current_business_experiance_month.reduce((sum, val) => sum + +val, 0); + // let SumOfMonth = PartnrArray[index].Current_business_experiance_year.reduce((sum, val) => sum + +val, 0); + + // let SumOfYear = month.reduce((sum, val) => sum + +val, 0); + // let SumOfMonth = year.reduce((sum, val) => sum + +val, 0); + + let sum1 = PartnrArray.map(arr => arr.map(data => data.Current_business_experiance_month).reduce((sum, val) => sum + +val, 0)) + console.log('sum1',sum1); + + } + }); + let params: any = {}; params.pd_id = this.pdid; params.pd_form_id = '21'; diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.html index 17b672ebe..979d64022 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.html @@ -126,18 +126,17 @@ -->
- - - Invalid Balance Tenure. + Invalid Balance Tenture. - +
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.html index 9fdec2f52..9d9f50047 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.html @@ -20,7 +20,7 @@
- + Select @@ -28,6 +28,11 @@ cl.company_name }} + + + + +

@@ -40,6 +45,17 @@ + + + + Total working Experience is Lower + + + + + +
@@ -49,8 +65,8 @@ No -
- +
+ @@ -60,7 +76,7 @@ - + - - - - +
- - - - - +
+

Date of Salary

+ + + Select + + {{date.date}} + + + + + + Select + + {{date.date}} + + + +
+ + + + OnlyNumber type="text" autocomplete="off" required> {{"₹"}} {{employmentForm.controls['gross_monthly_salary'].value | numberToWords}} Only + OnlyNumber type="text" autocomplete="off" required> {{"₹"}} {{employmentForm.controls['net_monthly_salary'].value | numberToWords}} Only - - {{"₹"}} {{employmentForm.controls['bonus_incentive'].value | numberToWords}} Only + + {{"₹"}} {{employmentForm.controls['amount_paid_in_cash'].value | numberToWords}} Only - - + + {{"₹"}} {{employmentForm.controls['amount_paid_through_bank'].value | numberToWords}} Only + + + Select Validated Not Validated - + - + - - - - - - Select - {{ - fd.name }} - - - - - Select - Fixed - Variable - depending on performance - Others - - - - - Select @@ -197,6 +218,35 @@ + + + + {{"₹"}} {{employmentForm.controls['bonus_incentive'].value | numberToWords}} Only + + + + + Select + {{ + fd.name }} + + + + + + Select + Fixed + Variable + depending on performance + Others + + + + + + +
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.ts index f410d58eb..c185314f2 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.ts @@ -38,6 +38,8 @@ export class EmploymentInfoComponent implements OnInit { pdid: number; form_id: number; //pd_all_details:any; + workExperienceFlag: boolean = false; + workExperienceErrorFlag:boolean = false; public employmentForm: FormGroup; private notifier: NotifierService; @@ -48,6 +50,10 @@ export class EmploymentInfoComponent implements OnInit { public company_related_applicants_list: any[]; public company_relationship_list: any[]; public filtered_company_relationship_list: any[]; + public dateonly: any = [{date:1,isdisabled:false},{date:2,isdisabled:false},{date:3,isdisabled:false},{date:4,isdisabled:false},{date:5,isdisabled:false},{date:6,isdisabled:false},{date:7,isdisabled:false},{date:8,isdisabled:false},{date:9,isdisabled:false},{date:10,isdisabled:false},{date:11,isdisabled:false},{date:12,isdisabled:false},{date:13,isdisabled:false},{date:14,isdisabled:false},{date:15,isdisabled:false},{date:16,isdisabled:false},{date:17,isdisabled:false},{date:18,isdisabled:false},{date:19,isdisabled:false},{date:20,isdisabled:false},{date:21,isdisabled:false},{date:22,isdisabled:false},{date:23,isdisabled:false},{date:24,isdisabled:false},{date:25,isdisabled:false},{date:26,isdisabled:false},{date:27,isdisabled:false},{date:28,isdisabled:false},{date:29,isdisabled:false},{date:30,isdisabled:false},{date:31,isdisabled:false}]; + public todate: any[] = this.dateonly; + + constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, private router: Router, @@ -62,6 +68,7 @@ export class EmploymentInfoComponent implements OnInit { this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; + } public viewerOptions: any = { navbar: false, @@ -106,8 +113,11 @@ export class EmploymentInfoComponent implements OnInit { this._pd.retriveForm(params).subscribe(value => { if (value.status == 200) { this.employmentForm.controls['employer_name'].setValue(value.records.employer_name); + this.employmentForm.controls['employer_in_brief'].setValue(value.records.employer_in_brief); this.employmentForm.controls['how_long_year'].setValue(value.records.how_long_year); this.employmentForm.controls['how_long_month'].setValue(value.records.how_long_month); + this.employmentForm.controls['total_business_experience'].setValue(value.records.total_business_experience); + this.employmentForm.controls['total_business_previous_experience'].setValue(value.records.total_business_previous_experience); this.employmentForm.controls['was_met'].setValue(value.records.was_met); if (value.records.name_person_met) { this.employmentForm.controls['name_person_met'].setValue(value.records.name_person_met); @@ -117,28 +127,34 @@ export class EmploymentInfoComponent implements OnInit { } this.employmentForm.controls['confirm_salary'].setValue(value.records.confirm_salary); if (value.records.confirm_salary_amount) { - this.employmentForm.controls['confirm_salary_amount'].setValue(value.records.confirm_salary_amount); - // this.employmentForm.controls['salary_from_date'].setValue(value.records.salary_from_date); - // this.employmentForm.controls['salary_to_date'].setValue(value.records.salary_to_date); - this.employmentForm.controls['total_business_experience'].setValue(value.records.total_business_experience); - this.employmentForm.controls['total_business_previous_experience'].setValue(value.records.total_business_previous_experience); + this.employmentForm.controls['confirm_salary_amount'].setValue(value.records.confirm_salary_amount); } this.employmentForm.controls['attendance_seen'].setValue(value.records.attendance_seen); this.employmentForm.controls['sal_reg_seen'].setValue(value.records.sal_reg_seen); this.employmentForm.controls['from_date_the_salary_is_rcv'].setValue(value.records.from_date_the_salary_is_rcv); + if(value.records.from_date_the_salary_is_rcv){ + this.formDate(value.records.from_date_the_salary_is_rcv); + } this.employmentForm.controls['to_date_the_salary_is_rcv'].setValue(value.records.to_date_the_salary_is_rcv); this.employmentForm.controls['gross_monthly_salary'].setValue(value.records.gross_monthly_salary); this.employmentForm.controls['net_monthly_salary'].setValue(value.records.net_monthly_salary); - this.employmentForm.controls['bonus_incentive'].setValue(value.records.bonus_incentive); this.employmentForm.controls['amount_paid_in_cash'].setValue(value.records.amount_paid_in_cash); + this.employmentForm.controls['amount_paid_through_bank'].setValue(value.records.amount_paid_through_bank); + this.employmentForm.controls['check_validated'].setValue(value.records.check_validated); this.employmentForm.controls['how_was_it_validated'].setValue(value.records.how_was_it_validated); this.employmentForm.controls['why_was_it_not_validated'].setValue(value.records.why_was_it_not_validated); - this.employmentForm.controls['amount_paid_through_bank'].setValue(value.records.amount_paid_through_bank); + this.employmentForm.controls['any_delays'].setValue(value.records.any_delays); + this.employmentForm.controls['bonus_incentive'].setValue(value.records.bonus_incentive); this.employmentForm.controls['bonus_frequency'].setValue(value.records.bonus_frequency); this.employmentForm.controls['bonus_type'].setValue(value.records.bonus_type); this.employmentForm.controls['bonus_type_other'].setValue(value.records.bonus_type_other); - this.employmentForm.controls['any_delays'].setValue(value.records.any_delays); + this.employmentForm.controls['employment_remarks'].setValue(value.records.employment_remarks); + + if(value.records.total_business_experience != ''){ + this.checkWorkingExperiences(); + // this.workExperienceFlag = (+value.records.total_business_previous_experience) < (+value.records.how_long_year) ? true : false; + } } }) /** For Bonus Frequency Dropdown */ @@ -163,30 +179,32 @@ export class EmploymentInfoComponent implements OnInit { public initemploymentForm(): void { this.employmentForm = this.fb.group({ employer_name: ['', Validators.compose([Validators.required])], + employer_in_brief: ['', Validators.compose([Validators.required])], how_long_year: ['', Validators.compose([Validators.required])], how_long_month: [''], - was_met: [this.pd_cus_segment == 'SAL-CHQ' ? 'No' : '', Validators.compose([Validators.required])], - name_person_met: [''], - designation_person_met: [''], - confirm_salary: [this.pd_cus_segment == 'SAL-CHQ' ? 'No' : '', Validators.compose([Validators.required])], - confirm_salary_amount: [''], total_business_experience: [''], total_business_previous_experience: [''], - attendance_seen: [this.pd_cus_segment == 'SAL-CHQ' ? 'No' : '', Validators.compose([Validators.required])], - sal_reg_seen: [this.pd_cus_segment == 'SAL-CHQ' ? 'No' : '', Validators.compose([Validators.required])], - from_date_the_salary_is_rcv: [''], - to_date_the_salary_is_rcv: [''], + was_met: [this.pd_cus_segment == 'SAL-CHQ' ? 'no' : '', Validators.compose([Validators.required])], + name_person_met: [''], + designation_person_met: [''], + confirm_salary: [this.pd_cus_segment == 'SAL-CHQ' ? 'no' : '', Validators.compose([Validators.required])], + confirm_salary_amount: [''], + attendance_seen: [this.pd_cus_segment == 'SAL-CHQ' ? 'no' : '', Validators.compose([Validators.required])], + sal_reg_seen: [this.pd_cus_segment == 'SAL-CHQ' ? 'no' : '', Validators.compose([Validators.required])], + from_date_the_salary_is_rcv: ['',Validators.compose([Validators.max(31), Validators.min(0)])], + to_date_the_salary_is_rcv: ['',Validators.compose([Validators.max(31), Validators.min(0)])], gross_monthly_salary: ['', Validators.compose([Validators.required])], net_monthly_salary: ['', Validators.compose([Validators.required])], - bonus_incentive: ['', Validators.compose([Validators.required])], amount_paid_in_cash: [''], + amount_paid_through_bank: [''], + check_validated:[''], how_was_it_validated: [''], why_was_it_not_validated: [''], - amount_paid_through_bank: [''], + any_delays: ['', Validators.compose([Validators.required])], + bonus_incentive: ['', Validators.compose([Validators.required])], bonus_frequency: [''], bonus_type: [''], bonus_type_other: [''], - any_delays: ['', Validators.compose([Validators.required])], // employment_details: this.fb.array([]), employment_remarks: [''], }); @@ -217,15 +235,112 @@ export class EmploymentInfoComponent implements OnInit { } submitDetails() { + if(this.pd_cus_segment != 'SAL-CHQ'){ + if(this.employmentForm.controls.was_met.value == 'no'){ + + this.employmentForm.controls.name_person_met.setValue(''); + this.employmentForm.controls.name_person_met.clearValidators(); + this.employmentForm.controls.name_person_met.updateValueAndValidity(); + + this.employmentForm.controls.designation_person_met.setValue(''); + this.employmentForm.controls.designation_person_met.clearValidators(); + this.employmentForm.controls.designation_person_met.updateValueAndValidity(); + + } + + if(this.employmentForm.controls.confirm_salary.value == 'no'){ + + this.employmentForm.controls.confirm_salary_amount.setValue(''); + this.employmentForm.controls.confirm_salary_amount.clearValidators(); + this.employmentForm.controls.confirm_salary_amount.updateValueAndValidity(); + } + + } + else if(this.pd_cus_segment == 'SAL-CHQ'){ + this.employmentForm.controls.was_met.clearValidators(); + this.employmentForm.controls.was_met.updateValueAndValidity(); + + this.employmentForm.controls.name_person_met.clearValidators(); + this.employmentForm.controls.name_person_met.updateValueAndValidity(); + + this.employmentForm.controls.designation_person_met.clearValidators(); + this.employmentForm.controls.designation_person_met.updateValueAndValidity(); + + this.employmentForm.controls.confirm_salary.clearValidators(); + this.employmentForm.controls.confirm_salary.updateValueAndValidity(); + + this.employmentForm.controls.confirm_salary.clearValidators(); + this.employmentForm.controls.confirm_salary.updateValueAndValidity(); + + this.employmentForm.controls.confirm_salary_amount.clearValidators(); + this.employmentForm.controls.confirm_salary_amount.updateValueAndValidity(); + + this.employmentForm.controls.attendance_seen.clearValidators(); + this.employmentForm.controls.attendance_seen.updateValueAndValidity(); + + this.employmentForm.controls.sal_reg_seen.clearValidators(); + this.employmentForm.controls.sal_reg_seen.updateValueAndValidity(); + } + + if(this.employmentForm.controls.amount_paid_in_cash.value != 0 && this.employmentForm.controls.amount_paid_in_cash.value != '' ){ + + if(this.employmentForm.controls.check_validated.value == 'validated'){ + this.employmentForm.controls.why_was_it_not_validated.setValue(''); + } + else if(this.employmentForm.controls.check_validated.value != 'validated'){ + this.employmentForm.controls.how_was_it_validated.setValue(''); + } + } + else{ + this.employmentForm.controls.check_validated.setValue('') + this.employmentForm.controls.how_was_it_validated.setValue('') + this.employmentForm.controls.why_was_it_not_validated.setValue('') + } + + this.employmentForm.controls.check_validated.updateValueAndValidity(); + this.employmentForm.controls.how_was_it_validated.updateValueAndValidity(); + this.employmentForm.controls.why_was_it_not_validated.updateValueAndValidity(); + + if(this.employmentForm.controls.bonus_incentive.value == 0){ + this.employmentForm.controls.bonus_frequency.setValue(''); + this.employmentForm.controls.bonus_frequency.updateValueAndValidity(); + + this.employmentForm.controls.bonus_type.setValue(''); + this.employmentForm.controls.bonus_type.updateValueAndValidity(); + + this.employmentForm.controls.bonus_type_other.setValue(''); + this.employmentForm.controls.bonus_type_other.updateValueAndValidity(); + } + else{ + if(this.employmentForm.controls.bonus_type.value == 'others'){ + this.employmentForm.controls.bonus_type_other.setValidators([Validators.required]); + this.employmentForm.controls.bonus_type_other.updateValueAndValidity(); + } + else if(this.employmentForm.controls.bonus_type.value != 'others'){ + this.employmentForm.controls.bonus_type_other.setValue(''); + this.employmentForm.controls.bonus_type_other.clearValidators(); + this.employmentForm.controls.bonus_type_other.updateValueAndValidity(); + } + } + + if (!this.employmentForm.valid) { this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!'); return; } + + if(+this.employmentForm.controls.total_business_experience.value < +this.employmentForm.controls.how_long_year.value){ + this.notifier.notify('warning', 'Total working Experience is Lower.!'); + return; + } + + let records: any = {}; records.pdid = this.pdid; records.formid = this.form_id; records.fk_createdby = this.pdid; records.employer_name = this.employmentForm.controls['employer_name'].value; + records.employer_in_brief = this.employmentForm.controls['employer_in_brief'].value; records.how_long_year = this.employmentForm.controls['how_long_year'].value; records.how_long_month = this.employmentForm.controls['how_long_month'].value; records.was_met = this.employmentForm.controls['was_met'].value; @@ -245,15 +360,20 @@ export class EmploymentInfoComponent implements OnInit { records.to_date_the_salary_is_rcv = this.employmentForm.controls['to_date_the_salary_is_rcv'].value; records.gross_monthly_salary = this.employmentForm.controls['gross_monthly_salary'].value; records.net_monthly_salary = this.employmentForm.controls['net_monthly_salary'].value; - records.bonus_incentive = this.employmentForm.controls['bonus_incentive'].value; + records.amount_paid_in_cash = this.employmentForm.controls['amount_paid_in_cash'].value; + records.amount_paid_through_bank = this.employmentForm.controls['amount_paid_through_bank'].value; + records.check_validated = this.employmentForm.controls['check_validated'].value; records.how_was_it_validated = this.employmentForm.controls['how_was_it_validated'].value; records.why_was_it_not_validated = this.employmentForm.controls['why_was_it_not_validated'].value; - records.amount_paid_through_bank = this.employmentForm.controls['amount_paid_through_bank'].value; + + records.any_delays = this.employmentForm.controls['any_delays'].value; + + records.bonus_incentive = this.employmentForm.controls['bonus_incentive'].value; records.bonus_frequency = this.employmentForm.controls['bonus_frequency'].value; records.bonus_type = this.employmentForm.controls['bonus_type'].value; records.bonus_type_other = this.employmentForm.controls['bonus_type_other'].value; - records.any_delays = this.employmentForm.controls['any_delays'].value; + records.employment_remarks = this.employmentForm.controls['employment_remarks'].value; this._pd.saveForm(records).subscribe(data => { @@ -274,13 +394,48 @@ export class EmploymentInfoComponent implements OnInit { }) } /** On Key Press Event For Numbers */ - keyPress(event: any) { - const pattern = /[0-9]/; - - let inputChar = String.fromCharCode(event.charCode); - if (event.keyCode != 8 && !pattern.test(inputChar)) { - event.preventDefault(); + checkWorkingExperiences(){ + // this.workExperienceErrorFlag = (+this.employmentForm.controls.total_business_experience.value ) <= (+this.employmentForm.controls.how_long_year.value) ? true : false; + // this.workExperienceFlag = (+this.employmentForm.controls.total_business_experience.value ) < (+this.employmentForm.controls.how_long_year.value) ? false : true; + if((+this.employmentForm.controls.total_business_experience.value ) < (+this.employmentForm.controls.how_long_year.value)){ + console.log(+this.employmentForm.controls.total_business_experience.value , +this.employmentForm.controls.how_long_year.value); + this.workExperienceFlag = false; + this.workExperienceErrorFlag = true; + } + else{ + this.workExperienceFlag = true; + this.workExperienceErrorFlag = false; } } + + // keyPress(event: any) { + // const pattern = /[0-9]/; + + // let inputChar = String.fromCharCode(event.charCode); + // if (event.keyCode != 8 && !pattern.test(inputChar)) { + // event.preventDefault(); + // } + // } + + formDate(value){ + // console.log('to',this.todate) + // console.log(value); + // console.log('to length',this.todate.length); + // console.log('index',value-1); + // console.log('this.todate',this.todate[11]); + // console.log('this.todate',this.todate[11].isdisabled); + this.employmentForm.controls['to_date_the_salary_is_rcv'].setValue(''); + this.todate = [{date:1,isdisabled:false},{date:2,isdisabled:false},{date:3,isdisabled:false},{date:4,isdisabled:false},{date:5,isdisabled:false},{date:6,isdisabled:false},{date:7,isdisabled:false},{date:8,isdisabled:false},{date:9,isdisabled:false},{date:10,isdisabled:false},{date:11,isdisabled:false},{date:12,isdisabled:false},{date:13,isdisabled:false},{date:14,isdisabled:false},{date:15,isdisabled:false},{date:16,isdisabled:false},{date:17,isdisabled:false},{date:18,isdisabled:false},{date:19,isdisabled:false},{date:20,isdisabled:false},{date:21,isdisabled:false},{date:22,isdisabled:false},{date:23,isdisabled:false},{date:24,isdisabled:false},{date:25,isdisabled:false},{date:26,isdisabled:false},{date:27,isdisabled:false},{date:28,isdisabled:false},{date:29,isdisabled:false},{date:30,isdisabled:false},{date:31,isdisabled:false}]; + var i ; + + if(value != 0 && value != '') + for(i=0;i<=value-1;i++){ + this.todate[i].isdisabled = true; + if(value == 31){ + this.todate[30].isdisabled = false; + } + } + + } } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.html index b94e775d8..1007ed80f 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.html @@ -17,8 +17,7 @@ Select - {{ - pm.description }} + {{pm.customer_behaviour_id == 1 ? 'Other Negative Behaviour': pm.description }} @@ -31,7 +30,7 @@ Select - Well Suited. + Well Suited Fairly Suited Not Suited diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html index 0841a8fe4..d0b6eb93e 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html @@ -177,17 +177,17 @@ OnlyNumber type="text" readonly> - No difference in Profit sales % in FY + No difference in Profit/Loss to sales % in FY {{details.get('financial_year').value}} over - Profit sales % in FY + Profit/Loss to sales % in FY {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} - Increase in Profit sales % in FY + Increase in Profit/Loss to sales % in FY {{details.get('financial_year').value}} over - Profit sales % in FY + Profit/Loss to sales % in FY {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} {{details.get('financial_profit_to_sale_variation').value}} @@ -195,9 +195,9 @@ - Decrease in Profit sales % in FY + Decrease in Profit/Loss to sales % in FY {{details.get('financial_year').value}} over - Profit sales % in FY + Profit/Loss to sales % in FY {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} {{(details.get('financial_profit_to_sale_variation').value).replace('-', diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.ts index 06152ef32..7bf734f8a 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.ts @@ -1146,17 +1146,22 @@ export class FinancialInfoComponent implements OnInit { details.controls.estimate_profit_margin_percent.setValue(''); return; } - - let profit_percent = (estimate_profit_range_to + estimate_profit_range_from)/2; - let Profit_Average = (profit_percent*sales_average)/100; - let difference = (estimate_profit_range_to - estimate_profit_range_from); + + // console.log((+estimate_profit_range_to + estimate_profit_range_from)); + // console.log((estimate_profit_range_to + estimate_profit_range_from)/2); + // let a = estimate_profit_range_from+estimate_profit_range_to ; + // let b = a/2; + // console.log(a,b); + let consi_profit_percent = (+estimate_profit_range_to + +estimate_profit_range_from)/2; + let Profit_Average = ((+consi_profit_percent)*(+sales_average))/100; + let difference = ((+estimate_profit_range_to) - (+estimate_profit_range_from)); if(difference > 3){ var r = confirm("Given Profit Percent Range is greater than 3"); if (r == true) { details.controls.estimate_profit_margin.setValue(Profit_Average!= Infinity ? Math.round(Profit_Average):0); - details.controls.estimate_profit_margin_percent.setValue(profit_percent!= Infinity ? profit_percent.toFixed(2):0); + details.controls.estimate_profit_margin_percent.setValue(consi_profit_percent.toFixed(2)); this.AV_marginProfitAmtInwords[i] = this._pd.convertNumberToWords(Math.round(Profit_Average)); }else{ details.controls.estimate_profit_range_to.setValue(''); @@ -1167,7 +1172,7 @@ export class FinancialInfoComponent implements OnInit { } details.controls.estimate_profit_margin.setValue(Profit_Average!= Infinity ? Math.round(Profit_Average):0); - details.controls.estimate_profit_margin_percent.setValue(profit_percent!= Infinity ? profit_percent.toFixed(2):0); + details.controls.estimate_profit_margin_percent.setValue(consi_profit_percent.toFixed(2)); this.AV_marginProfitAmtInwords[i] = this._pd.convertNumberToWords(Math.round(Profit_Average)); // details.controls.estimate_profit_margin.setValue(Math.round(Profit_Average)); // details.controls.estimate_profit_margin_percent.setValue(profit_percent.toFixed(2)); @@ -1213,8 +1218,8 @@ export class FinancialInfoComponent implements OnInit { return; } - let C = (estimate_net_profit_to - estimate_net_profit_from) - let D = (C / estimate_net_profit_from) * 100; + let C = (+estimate_net_profit_to - +estimate_net_profit_from) + let D = (C / +estimate_net_profit_from) * 100; let range1 = +estimate_net_profit_from/10; @@ -1225,7 +1230,7 @@ export class FinancialInfoComponent implements OnInit { if(D >= 20){ var r = confirm("Given Profit Range is greater than 20%"); if (r == true) { - details.controls.estimate_net_profit_to.setValue(estimate_net_profit_to!= Infinity ? estimate_net_profit_to:0); + details.controls.estimate_net_profit_to.setValue(estimate_net_profit_to!= Infinity ? +estimate_net_profit_to:0); }else{ details.controls.estimate_net_profit_to.setValue(''); details.controls.estimate_net_profit.setValue(''); @@ -1234,18 +1239,18 @@ export class FinancialInfoComponent implements OnInit { } } else{ - details.controls.estimate_net_profit_to.setValue(estimate_net_profit_to!= Infinity ? estimate_net_profit_to:0); + details.controls.estimate_net_profit_to.setValue(estimate_net_profit_to!= Infinity ? +estimate_net_profit_to:0); } if(lower > higer){ details.controls.estimate_net_profit.setValue(higer!= Infinity ? higer.toFixed(2):0); - let Profit_percent = (higer/sales_average)*100; + let Profit_percent = (higer/+sales_average)*100; details.controls.estimate_net_profit_percent.setValue(Profit_percent!= Infinity ? Profit_percent.toFixed(2):0); this.AV_netProfitAmtInwords[i] = this._pd.convertNumberToWords(Math.round(higer)); } else{ details.controls.estimate_net_profit.setValue(lower!= Infinity ? lower.toFixed(2):0); - let Profit_percent = (lower/sales_average)*100; + let Profit_percent = (lower/+sales_average)*100; details.controls.estimate_net_profit_percent.setValue(Profit_percent!= Infinity ? Profit_percent.toFixed(2):0); this.AV_netProfitAmtInwords[i] = this._pd.convertNumberToWords(Math.round(lower)); } @@ -1264,18 +1269,18 @@ export class FinancialInfoComponent implements OnInit { } } else{ - details.controls.estimate_net_profit_to.setValue(estimate_net_profit_to!= Infinity ? estimate_net_profit_to:0); + details.controls.estimate_net_profit_to.setValue(estimate_net_profit_to!= Infinity ? +estimate_net_profit_to:0); } if(lower > higer){ details.controls.estimate_net_profit.setValue(higer!= Infinity ? higer.toFixed(2):0); - let Profit_percent = (higer/sales_average)*100; + let Profit_percent = (higer/+sales_average)*100; details.controls.estimate_net_profit_percent.setValue(Profit_percent!= Infinity ? Profit_percent.toFixed(2):0); this.AV_netProfitAmtInwords[i] = this._pd.convertNumberToWords(Math.round(higer)); } else{ details.controls.estimate_net_profit.setValue(lower!= Infinity ? lower.toFixed(2):0); - let Profit_percent = (lower/sales_average)*100; + let Profit_percent = (lower/+sales_average)*100; details.controls.estimate_net_profit_percent.setValue(Profit_percent!= Infinity ? Profit_percent.toFixed(2):0); this.AV_netProfitAmtInwords[i] = this._pd.convertNumberToWords(Math.round(lower)); } @@ -1375,9 +1380,9 @@ export class FinancialInfoComponent implements OnInit { return; } - let loss_percent = (estimate_loss_range_to + estimate_loss_range_from)/2; - let loss_Average = (loss_percent*sales_average)/100; - let difference = (estimate_loss_range_to - estimate_loss_range_from) + let consi_loss_percent = (+estimate_loss_range_to + +estimate_loss_range_from)/2; + let loss_Average = (+consi_loss_percent*+sales_average)/100; + let difference = (+estimate_loss_range_to - +estimate_loss_range_from) // details.controls.estimate_loss_margin.setValue(Math.round(loss_Average)); // details.controls.estimate_loss_margin_percent.setValue(loss_percent.toFixed(2)); @@ -1388,7 +1393,7 @@ export class FinancialInfoComponent implements OnInit { var r = confirm("Given Loss Percent Range is greater than 3"); if (r == true) { details.controls.estimate_loss_margin.setValue(loss_Average!= Infinity ? Math.round(loss_Average):0); - details.controls.estimate_loss_margin_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0); + details.controls.estimate_loss_margin_percent.setValue(consi_loss_percent.toFixed(2)); this.AV_marginLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(loss_Average)); }else{ @@ -1400,7 +1405,7 @@ export class FinancialInfoComponent implements OnInit { } details.controls.estimate_loss_margin.setValue(loss_Average!= Infinity ? Math.round(loss_Average):0); - details.controls.estimate_loss_margin_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0); + details.controls.estimate_loss_margin_percent.setValue(+consi_loss_percent.toFixed(2)); this.AV_marginLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(loss_Average)); } @@ -1453,8 +1458,8 @@ export class FinancialInfoComponent implements OnInit { // } - let C = (estimate_net_loss_to - estimate_net_loss_from) - let D = (C / estimate_net_loss_from) * 100; + let C = (+estimate_net_loss_to - +estimate_net_loss_from) + let D = (C / +estimate_net_loss_from) * 100; let range1 = +estimate_net_loss_from/10; @@ -1465,7 +1470,7 @@ export class FinancialInfoComponent implements OnInit { if(D >= 20){ var r = confirm("Given Profit Range is greater than 20%"); if (r == true) { - details.controls.estimate_net_loss_to.setValue(estimate_net_loss_to!= Infinity ? estimate_net_loss_to:0); + details.controls.estimate_net_loss_to.setValue(estimate_net_loss_to!= Infinity ? +estimate_net_loss_to:0); }else{ details.controls.estimate_net_loss_to.setValue(''); @@ -1475,18 +1480,18 @@ export class FinancialInfoComponent implements OnInit { } } else{ - details.controls.estimate_net_loss_to.setValue(estimate_net_loss_to!= Infinity ? estimate_net_loss_to:0); + details.controls.estimate_net_loss_to.setValue(estimate_net_loss_to!= Infinity ? +estimate_net_loss_to:0); } if(lower > higer){ details.controls.estimate_net_loss.setValue(higer!= Infinity ? higer.toFixed(2):0); - let loss_percent = (higer/sales_average)*100; + let loss_percent = (higer/+sales_average)*100; details.controls.estimate_net_loss_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0); this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(higer)); } else{ details.controls.estimate_net_loss.setValue(lower!= Infinity ? lower.toFixed(2):0); - let loss_percent = (lower/sales_average)*100; + let loss_percent = (lower/+sales_average)*100; details.controls.estimate_net_loss_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0); this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(lower)); } @@ -1510,13 +1515,13 @@ export class FinancialInfoComponent implements OnInit { if(lower > higer){ details.controls.estimate_net_loss.setValue(higer!= Infinity ? higer.toFixed(2):0); - let loss_percent = (higer/sales_average)*100; + let loss_percent = (+higer/+sales_average)*100; details.controls.estimate_net_loss_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0); this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(higer)); } else{ details.controls.estimate_net_loss.setValue(lower!= Infinity ? lower.toFixed(2):0); - let loss_percent = (lower/sales_average)*100; + let loss_percent = (+lower/+sales_average)*100; details.controls.estimate_net_profit_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0); this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(lower)); } @@ -1539,13 +1544,13 @@ export class FinancialInfoComponent implements OnInit { } if(lower > higer){ details.controls.estimate_net_loss.setValue(higer!= Infinity ? higer.toFixed(2):0); - let loss_percent = (higer/sales_average)*100; + let loss_percent = (higer/+sales_average)*100; details.controls.estimate_net_loss_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0); this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(higer)); } else{ details.controls.estimate_net_loss.setValue(lower!= Infinity ? lower.toFixed(2):0); - let loss_percent = (lower/sales_average)*100; + let loss_percent = (+lower/+sales_average)*100; details.controls.estimate_net_loss_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0); this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(lower)); } @@ -1555,13 +1560,13 @@ export class FinancialInfoComponent implements OnInit { details.controls.estimate_net_loss_to.setValue(estimate_net_loss_to!= Infinity ? estimate_net_loss_to:0); if(lower > higer){ details.controls.estimate_net_loss.setValue(higer!= Infinity ? higer.toFixed(2):0); - let loss_percent = (higer/sales_average)*100; + let loss_percent = (+higer/+sales_average)*100; details.controls.estimate_net_loss_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0); this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(higer)); } else{ details.controls.estimate_net_loss.setValue(lower!= Infinity ? lower.toFixed(2):0); - let loss_percent = (lower/sales_average)*100; + let loss_percent = (+lower/+sales_average)*100; details.controls.estimate_net_loss_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0); this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(lower)); } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.html index 8f6ac1460..a26b8f0b3 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.html @@ -30,7 +30,7 @@ {{loanAmtInWords}} Only - Loan Tenure applied for? + Loan Tenture applied for? diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.html index 0e272530a..0823ed11a 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.html @@ -111,6 +111,7 @@ Select Positive Negative + Could not verify
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.ts index 090d17c51..e95cf5cf5 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.ts @@ -34,7 +34,7 @@ export class NeighbourHoodComponent implements OnInit { errorMessage:any; finalRemarksList : any = [{'id': 1,'name': "Positive"}, {'id': 2,'name': "Negative"}, - {'id': 3,'name': "Insufficient information provided"}]; + {'id': 3,'name': "Could not verify"}]; existCompanyList: any =[]; mergeCompanyApplicant: any=[]; isOrganisationOwner: any=[]; @@ -281,15 +281,15 @@ export class NeighbourHoodComponent implements OnInit { if(nbhdChildCtrl.controls.did_not_know_the_business_operation.value == '' || nbhdChildCtrl.controls.did_not_know_the_business_operation.value == false){ - nbhdChildCtrl.controls['how_long_do_know_in_month'].setValidators([Validators.required]); - nbhdChildCtrl.controls['how_long_do_know_in_month'].updateValueAndValidity(); + // nbhdChildCtrl.controls['how_long_do_know_in_month'].setValidators([Validators.required]); + // nbhdChildCtrl.controls['how_long_do_know_in_month'].updateValueAndValidity(); nbhdChildCtrl.controls['how_long_do_know_in_year'].setValidators([Validators.required]); nbhdChildCtrl.controls['how_long_do_know_in_year'].updateValueAndValidity(); } else if(nbhdChildCtrl.controls.did_not_know_the_business_operation.value == true){ nbhdChildCtrl.controls['how_long_do_know_in_month'].setValue(''); - nbhdChildCtrl.controls['how_long_do_know_in_month'].clearValidators(); + // nbhdChildCtrl.controls['how_long_do_know_in_month'].clearValidators(); nbhdChildCtrl.controls['how_long_do_know_in_month'].updateValueAndValidity(); nbhdChildCtrl.controls['how_long_do_know_in_year'].setValue(''); nbhdChildCtrl.controls['how_long_do_know_in_year'].clearValidators(); @@ -387,7 +387,7 @@ export class NeighbourHoodComponent implements OnInit { // saveRecords.check_type=formData.check_type; saveRecords.pdid=formData.pdid; saveRecords.formid=formData.formid; - saveRecords.neighbourhood_status = formData.check_type == 0 ? formData.neighbourhood_status : ''; + saveRecords.neighbourhood_status = formData.neighbourhood_status!='' ? formData.neighbourhood_status : ''; saveRecords.neighbour_reference_remark=formData.neighbour_reference_remark; this._pd.savePDFormDetailsWithID(saveRecords).subscribe( dataresult => { diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts index 6d416d0ad..ca8550641 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts @@ -134,7 +134,8 @@ export class StockComponent implements OnInit { let type4 = record.from_business.filter(data => data.type_of_activity_id == 4); let type4length = type4[0].hasOwnProperty("products") ? type4[0].products.length : 0; - let rm_api = record.from_supplier; + let rm_api = record.from_supplier.hasOwnProperty("raw_material") ? record.from_supplier.raw_material : []; + console.log(rm_api); let params: any = {}; params.pd_id = this.pdid;