+
-
-
- Purchase Year
-
- Invalid year format
-
-
+
+
+
+ Vintage
+
+
+
+
+
+
+ Purchase Year
+
+
+
+
-
+
Yes
No
-
-
-
- {{"₹"}} {{OtherEmiAmtInwords[i]}} Only
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.ts
index 6a788532c..9ed282974 100755
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.ts
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.ts
@@ -37,7 +37,7 @@ export class AssetsInfoComponent implements OnInit {
public _assetsQuesFrom: FormGroup;
public submitted = false;
public m_assets_type = [];
- public m_relation = [];
+ //public m_relation = [];
public applicants: any;
otherEmiamtFlag : boolean = false;
businessEmiAmtFlag : boolean = false;
@@ -186,7 +186,7 @@ public m_investmentType = [];
private notifier: NotifierService;
existCompanyList: any =[];
mergeCompanyApplicant: any=[];
-
+ currentYear:any=new Date().getFullYear();
constructor(
notifier: NotifierService,
private _formBuilder: FormBuilder,
@@ -252,7 +252,7 @@ public m_investmentType = [];
this.getM_PropertyType();
this.getM_InvestmentType();
this.getM_FreqOfPurchase();
- this.getM_Relation();
+ //this.getM_Relation();
//this.getM_InsuranceType();
}
@@ -295,16 +295,16 @@ public m_investmentType = [];
)
}
- getM_Relation() {
- this.pdTrigerService.getAllMasterDatas('RELATIONSHIPS').subscribe(
- data => {
- this.m_relation = data.records.filter(data => data.isactive == 1);
- },
- error => {
- this.notifier.notify('warning', 'No Category Records Found.!');
- }
- )
- }
+ // getM_Relation() {
+ // this.pdTrigerService.getAllMasterDatas('RELATIONSHIPS').subscribe(
+ // data => {
+ // this.m_relation = data.records.filter(data => data.isactive == 1);
+ // },
+ // error => {
+ // this.notifier.notify('warning', 'No Category Records Found.!');
+ // }
+ // )
+ // }
getM_FreqOfPurchase() {
this.pdTrigerService.getAllMasterDatas('FREQUENCY').subscribe(
@@ -395,14 +395,11 @@ public m_investmentType = [];
approximate_market_value: [''],
name_of_the_owner: [''],
other_owner:[''],
- relation: [''],
- purchase_year: ['',Validators.compose([Validators.minLength(4),Validators.maxLength(4)])],
+ // relation: [''],
+ vintage_personal : [''],
+ purchase_year: ['',Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])],
//purchase_month: [''],
emi: [''],
- emi_paid: [''],
- original_loan_tenure: [''],
- balance_tenure: [''],
- elapsed_tenure: [''],
});
}
@@ -415,13 +412,10 @@ public m_investmentType = [];
business_name_of_the_other_owner: [],
//other_owner:[''],
//relation:[''],
- business_purchase_year: ['',Validators.compose([Validators.minLength(4),Validators.maxLength(4)])],
+ business_vintage: [''],
+ business_purchase_year: ['',Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])],
//purchase_month: [''],
business_emi: [''],
- business_emi_paid: [''],
- business_original_loan_tenure: [''],
- business_balance_tenure: [''],
- business_elapsed_tenure: [''],
});
}
@@ -523,10 +517,9 @@ public m_investmentType = [];
any_other_assets: [''],
name_of_the_owner:[''],
other_owner:[''],
- relation:[''],
+ //relation:[''],
any_other_asset_value : [''],
any_other_asset_loan : [''],
- other_asset_emi_amt : ['']
});
}
@@ -535,9 +528,7 @@ public m_investmentType = [];
return this._formBuilder.group({
any_other_assets: [''],
any_other_asset_value : [''],
- any_other_asset_loan : [''],
- other_asset_emi_amt : ['']
-
+ any_other_asset_loan : [''],
});
}
@@ -598,10 +589,9 @@ public m_investmentType = [];
any_other_assets: [data.any_other_assets],
name_of_the_owner:[data.name_of_the_owner],
other_owner:[data.other_owner],
- relation:[data.relation],
+ // relation:[data.relation],
any_other_asset_value : [data.any_other_asset_value],
any_other_asset_loan : [data.any_other_asset_loan],
- other_asset_emi_amt : [data.other_asset_emi_amt]
});
}
@@ -610,7 +600,6 @@ public m_investmentType = [];
any_other_assets: [data.any_other_assets],
any_other_asset_value : [data.any_other_asset_value],
any_other_asset_loan : [data.any_other_asset_loan],
- other_asset_emi_amt : [data.other_asset_emi_amt]
});
}
@@ -657,34 +646,29 @@ public m_investmentType = [];
approximate_market_value: [data.approximate_market_value],
name_of_the_owner: [data.name_of_the_owner],
other_owner:[data.other_owner || ''],
- relation: [data.relation || ''],
- purchase_year: [data.purchase_year],
+ //relation: [data.relation || ''],
+ vintage_personal : [data. vintage_personal],
+ purchase_year: [data. purchase_year,Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])],
// purchase_month: [data.purchase_month],
emi: [data.emi || 0],
- emi_paid: [data.emi_paid || ''],
- original_loan_tenure: [data.original_loan_tenure || ''],
- balance_tenure: [data.balance_tenure || ''],
- elapsed_tenure: [data.elapsed_tenure || '']
});
}
initBusinessDetailsWithdata(data) {
- return this._formBuilder.group({
+ let formGroup= this._formBuilder.group({
business_assets_mode: [data.business_assets_mode],
business_details: this._formBuilder.array([]),
business_approximate_market_value: [data.business_approximate_market_value],
business_name_of_the_owner: [data.business_name_of_the_owner],
business_name_of_the_other_owner:[data.business_name_of_the_other_owner || ''],
// relation: [data.relation || ''],
- business_purchase_year: [data. business_purchase_year],
+ business_vintage: [data. business_vintage],
+ business_purchase_year: [data. business_purchase_year,Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])],
// purchase_month: [data.purchase_month],
business_emi: [data.business_emi || 0],
- business_emi_paid: [data.business_emi_paid || ''],
- business_original_loan_tenure: [data.business_original_loan_tenure || ''],
- business_balance_tenure: [data.business_balance_tenure || ''],
- business_elapsed_tenure: [data.business_elapsed_tenure || '']
});
+ return formGroup;
}
loadDetails: boolean;
@@ -695,7 +679,6 @@ public m_investmentType = [];
result.forEach((datas,index) => {
this.OtherAppxMarketAmtInwords[index] = this.pdTrigerService.convertNumberToWords(+datas.approximate_market_value);
- this.OtherEmiAmtInwords[index] = this.pdTrigerService.convertNumberToWords(+datas.emi_paid);
});
if (result.length > 0) {
@@ -705,14 +688,11 @@ public m_investmentType = [];
approximate_market_value: val.approximate_market_value,
name_of_the_owner: val.name_of_the_owner,
other_owner:val.other_owner,
- relation: val.relation,
+ // relation: val.relation,
+ vintage_personal: val.vintage_personal,
purchase_year: val.purchase_year,
// purchase_month: val.purchase_month,
emi: val.emi,
- emi_paid: val.emi_paid,
- original_loan_tenure: val.original_loan_tenure,
- elapsed_tenure: val.elapsed_tenure,
- balance_tenure: val.balance_tenure
};
const control = this._assetsQuesFrom.controls['assets_details'];
control.push(this.initDetailsWithdata(vals));
@@ -731,7 +711,6 @@ public m_investmentType = [];
if (result.length > 0) {
result.forEach((datas,index) => {
this.appxMarketAmtInwords[index] = this.pdTrigerService.convertNumberToWords(+datas.business_approximate_market_value);
- this.emiAmtInwords[index] = this.pdTrigerService.convertNumberToWords(+datas.business_emi_paid);
});
for (let val of result) {
@@ -742,12 +721,9 @@ public m_investmentType = [];
business_name_of_the_other_owner: val.business_name_of_the_other_owner,
// relation : val.relation,
business_purchase_year: val. business_purchase_year,
+ business_vintage : val.business_vintage,
// purchase_month: val.purchase_month,
business_emi: val.business_emi,
- business_emi_paid: val.business_emi_paid,
- business_original_loan_tenure: val.business_original_loan_tenure,
- business_elapsed_tenure: val.business_elapsed_tenure,
- business_balance_tenure: val.business_balance_tenure
};
const control = this._assetsQuesFrom.controls['business_assets_details'];
@@ -847,13 +823,11 @@ public m_investmentType = [];
array_data = { 'any_other_assets': datas.any_other_assets,
'name_of_the_owner':datas.name_of_the_owner,
'other_owner':datas.other_owner,
- 'relation':datas.relation,
+ //'relation':datas.relation,
'any_other_asset_value' : datas.any_other_asset_value,
'any_other_asset_loan' : datas.any_other_asset_loan,
- 'other_asset_emi_amt' : datas.other_asset_emi_amt
};
this.OtherAssetValueInwords[i] = this.pdTrigerService.convertNumberToWords(+datas.any_other_asset_value);
- this.O_emiAmtInwords[i] = this.pdTrigerService.convertNumberToWords(+datas.other_asset_emi_amt);
});
const control = (this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
control.push(this.otherAssetsDescriptionWithData(array_data));
@@ -947,12 +921,10 @@ public m_investmentType = [];
let array_datas : any;
data.forEach((datas,i) => {
this.AssetValueInwords[i] = this.pdTrigerService.convertNumberToWords(+data.any_other_asset_value);
- this.B_emiAmtInwords[i] = this.pdTrigerService.convertNumberToWords(+datas.other_asset_emi_amt);
array_datas = {
'any_other_assets': datas.any_other_assets,
'any_other_asset_value' : datas.any_other_asset_value,
'any_other_asset_loan' : datas.any_other_asset_loan,
- 'other_asset_emi_amt' : datas.other_asset_emi_amt
};
});
const control = (this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
@@ -997,19 +969,6 @@ public m_investmentType = [];
selectedFreqPurchase(e) {
this.freqPurchaseTextBox = e.value;
}
-
- /** Show/hide EMI amount Field using Flag Both "other Asset" and "business"
- * REF = "Other Asset type at last Field"
- **/
- selectedAssetLoanType(e: any,flag): void {
- if(flag == 1){
- this.otherEmiamtFlag = (e == 'yes') ? true : false;
- }
- else if(flag == 2){
- this.businessEmiAmtFlag = (e == 'yes') ? true : false;
- }
- }
-
// compare objects for merge two master table details
compareObjects(o1: any, o2: any) {
if(o1.id == o2.id && o1.group_id == o2.group_id)
@@ -1028,6 +987,29 @@ public m_investmentType = [];
}
+ // calculate vintage and purchase {}
+ calculateVintagePurchase(value: any, controlKey: any,type: number){
+ if(type==1){
+ let control: any = this._assetsQuesFrom.controls['business_assets_details'];
+ control.controls[controlKey].controls['business_purchase_year'].setValue(value!='' ? parseInt(this.currentYear)-parseInt(value) : '');
+ }
+ else if(type==2) {
+ let control: any = this._assetsQuesFrom.controls['business_assets_details'];
+ value!='' && value<=this.currentYear ? control.controls[controlKey].controls['business_purchase_year'].setValue(value) : control.controls[controlKey].controls['business_purchase_year'].setValue('');
+ value!='' && value<=this.currentYear ? control.controls[controlKey].controls['business_vintage'].setValue(parseInt(this.currentYear)-parseInt(value)) : control.controls[controlKey].controls['business_vintage'].setValue('')
+ }
+ else if(type==3){
+ let control: any = this._assetsQuesFrom.controls['assets_details'];
+ control.controls[controlKey].controls['purchase_year'].setValue(value!='' ? parseInt(this.currentYear)-parseInt(value) : '');
+ }
+ else if(type==4) {
+ let control: any = this._assetsQuesFrom.controls['assets_details'];
+ value!='' && value<=this.currentYear ? control.controls[controlKey].controls['purchase_year'].setValue(value) : control.controls[controlKey].controls['purchase_year'].setValue('');
+ value!='' && value<=this.currentYear ? control.controls[controlKey].controls['vintage_personal'].setValue(parseInt(this.currentYear)-parseInt(value)) : control.controls[controlKey].controls['vintage_personal'].setValue('')
+ }
+
+ }
+
/** To Save/Edited Popup Data */
onSubmit() {
this.submitted = true;
@@ -1040,24 +1022,6 @@ public m_investmentType = [];
//To Remove The "Null" With Key also
Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]);
- answerFormValues.assets_details.map(val => {
- if (val.emi == '0') {
- val.emi_paid = '';
- val.original_loan_tenure = '';
- val.balance_tenure = '';
- val.elapsed_tenure = '';
- }
- });
-
- //To Remove The "Null" With Key also
- answerFormValues.business_assets_details.map(val => {
- if (val.business_emi == '0') {
- val.business_emi_paid = '';
- val.business_original_loan_tenure = '';
- val.business_balance_tenure = '';
- val.business_elapsed_tenure = '';
- }
- });
// Save the data with help of Service
this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe(
dataresult => {