From 124aafc0b38b4817aa8c7206b15cc8c4aacfb7b6 Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Mon, 31 Dec 2018 15:25:54 +0530 Subject: [PATCH] issues fixes : ps --- .../list-pd/add-pd/add-pd.component.html | 34 ++-- .../assets-info/assets-info.component.html | 39 ++--- .../assets-info/assets-info.component.ts | 161 ++++++++++-------- .../financial-info.component.html | 22 ++- .../financial-info.component.ts | 98 ++++++++--- 5 files changed, 220 insertions(+), 134 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html index 4188d4851..19ad95809 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html @@ -39,18 +39,18 @@ - + - + - + Enter Valid Mobile Number. @@ -108,23 +108,23 @@ - + {{"₹"}} {{loanAmtInWords}} Only Enter valid amount. - + @@ -156,7 +156,7 @@ - + Enter Valid Pincode. @@ -173,26 +173,26 @@ - + - + - + - + Enter Valid Mobile Number. - + +91 Enter Valid STD Code Number.   -   - + Enter Valid LandLine Number. @@ -207,7 +207,7 @@ - + @@ -234,7 +234,7 @@ - + @@ -261,7 +261,7 @@
- +
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.html index a52057c6b..ac5031bb1 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.html @@ -183,14 +183,16 @@ - - Yes + + {{d.viewValue}} + - + + @@ -267,12 +269,12 @@
- +
- +
@@ -288,7 +290,7 @@
- +
@@ -302,7 +304,7 @@
+ class="mr-1 mb-1 hover-icon" (click)="addAssetDetails($event,2); false">add
@@ -527,20 +529,19 @@ -
+
- - Yes - No - NA + + {{d.viewValue}} - +
- + + @@ -622,12 +623,12 @@
- +
- +
@@ -640,7 +641,7 @@
- +
@@ -654,7 +655,7 @@
+ class="mr-1 mb-1 hover-icon" (click)="addAssetDetails($event,1); false">add
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 90c350611..f1cd2ec9d 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 @@ -38,7 +38,11 @@ export class AssetsInfoComponent implements OnInit { public m_assets_type = []; public m_relation = []; public applicants: any; - + otherEmiamtFlag : boolean = false; + businessEmiAmtFlag : boolean = false; + public m_any_asset_loan_type = [{'value': "yes",'viewValue': "Yes"}, + {'value': "no",'viewValue': "No"}, + {'value': "nan",'viewValue': "NA"}] // public m_assets_type = [ // { // 'id': "1", @@ -177,38 +181,38 @@ public m_investmentType = []; } public viewerOptions: any = { - navbar: false, - toolbar: { - zoomIn: 4, - zoomOut: 4, - oneToOne: 4, - reset: 4, - prev: 4, - play: { - show: 4, - size: 'large', - }, - next: 4, - rotateLeft: 4, - rotateRight: 4, - flipHorizontal: 4, - flipVertical: 4, - } -}; + navbar: false, + toolbar: { + zoomIn: 4, + zoomOut: 4, + oneToOne: 4, + reset: 4, + prev: 4, + play: { + show: 4, + size: 'large', + }, + next: 4, + rotateLeft: 4, + rotateRight: 4, + flipHorizontal: 4, + flipVertical: 4, + } + }; ngOnInit() { - this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid).subscribe(data => { - this.businessProfessionName = (data.status == 200) ? data.records.profession_name : '' ; - }); + this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid).subscribe(data => { + this.businessProfessionName = (data.status == 200) ? data.records.profession_name : '' ; + }); - this.getPdSupplierFormDetails(); - this.getM_Assets_Type(); - this.getM_PropertyType(); - this.getM_InvestmentType(); - this.getM_FreqOfPurchase(); - this.getM_Relation(); - //this.getM_InsuranceType(); + this.getPdSupplierFormDetails(); + this.getM_Assets_Type(); + this.getM_PropertyType(); + this.getM_InvestmentType(); + this.getM_FreqOfPurchase(); + this.getM_Relation(); + //this.getM_InsuranceType(); } // ====================== @@ -351,7 +355,7 @@ public m_investmentType = []; name_of_the_owner: [''], other_owner:[''], relation: [''], - // purchase_year: [''], + //purchase_year: [''], //purchase_month: [''], emi: [''], emi_paid: [''], @@ -367,9 +371,9 @@ public m_investmentType = []; business_details: this._formBuilder.array([]), business_approximate_market_value: [''], business_name_of_the_owner: [data], - // other_owner:[''], - // relation:[''], - // purchase_year: [''], + //other_owner:[''], + //relation:[''], + //purchase_year: [''], //purchase_month: [''], business_emi: [''], business_emi_paid: [''], @@ -614,8 +618,8 @@ public m_investmentType = []; name_of_the_owner: [data.name_of_the_owner], other_owner:[data.other_owner || ''], relation: [data.relation || ''], - // purchase_year: [data.purchase_year], - // purchase_month: [data.purchase_month], + // purchase_year: [data.purchase_year], + // purchase_month: [data.purchase_month], emi: [data.emi || 0], emi_paid: [data.emi_paid || ''], original_loan_tenure: [data.original_loan_tenure || ''], @@ -623,6 +627,7 @@ public m_investmentType = []; elapsed_tenure: [data.elapsed_tenure || ''] }); } + initBusinessDetailsWithdata(data) { return this._formBuilder.group({ business_assets_mode: [data.business_assets_mode], @@ -631,15 +636,16 @@ public m_investmentType = []; business_name_of_the_owner: [data.business_name_of_the_owner], // other_owner:[data.other_owner || ''], // relation: [data.relation || ''], - // purchase_year: [data.purchase_year], - // 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 || ''] + // purchase_year: [data.purchase_year], + // 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 || ''] }); } + loadDetails: boolean; addAssetsDetailsWithData(supp_data) { console.log(supp_data); @@ -654,8 +660,8 @@ public m_investmentType = []; name_of_the_owner: val.name_of_the_owner, other_owner:val.other_owner, relation: val.relation, - // purchase_year: val.purchase_year, - // purchase_month: val.purchase_month, + // 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, @@ -685,21 +691,22 @@ public m_investmentType = []; business_name_of_the_owner: val.business_name_of_the_owner, // other_owner: val.other_owner, // relation : val.relation, - // purchase_year: val.purchase_year, - // 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 + // purchase_year: val.purchase_year, + // 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['assets_details']; // control.push(this.initDetailsWithdata(vals)); // this.setAssetsDetailsWithData(vals.business_assets_mode, val.details, control.length - 1) const control = this._assetsQuesFrom.controls['business_assets_details']; control.push(this.initBusinessDetailsWithdata(vals)); - this.setAssetsDetailsWithData2(vals.business_assets_mode, val.business_details, control.length - 1) + this.setBusinessAssetsDetailsWithData(vals.business_assets_mode, val.business_details, control.length - 1) } } //this.loadDetails = true; @@ -762,7 +769,7 @@ public m_investmentType = []; } } - setAssetsDetailsWithData2(assets_details_mode: any, datas: any, i: any): void { + setBusinessAssetsDetailsWithData(assets_details_mode: any, datas: any, i: any): void { let val = i; let data = datas; const arr = (this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ; @@ -813,9 +820,10 @@ public m_investmentType = []; } } - addSupplierDetails(e,flag) { - console.log(flag); - console.log(e); + /** Add More Asset using Flag Both "Other Asset" And "Business Asset" */ + addAssetDetails(e,flag) { + // console.log(flag); + // console.log(e); if(flag == 1){ const control = this._assetsQuesFrom.controls['assets_details']; control.push(this.initDetails()); @@ -824,14 +832,16 @@ public m_investmentType = []; control.push(this.initBusinessDetails(this.businessProfessionName)); } } - removeLanguage(i: number,flag) { - if(flag == 1){ - const control = this._assetsQuesFrom.controls['assets_details']; - control.removeAt(i); - }else if(flag == 2){ - const control = this._assetsQuesFrom.controls['business_assets_details']; - control.removeAt(i); - } + + /** To remove The Added Asset using Flag Both "Other Asset" And "Business Asset" */ + removeAssetsDetails(i: number,flag) { + if(flag == 1){ + const control = this._assetsQuesFrom.controls['assets_details']; + control.removeAt(i); + }else if(flag == 2){ + const control = this._assetsQuesFrom.controls['business_assets_details']; + control.removeAt(i); + } } public paymentModeTextBox: number; @@ -845,10 +855,22 @@ public m_investmentType = []; 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; + } + } /** To Save/Edited Popup Data */ onSubmit() { this.submitted = true; + // stop here if form is invalid if (this._assetsQuesFrom.invalid) { return; @@ -876,22 +898,19 @@ public m_investmentType = []; } }); - // Add BRANCH data with help Service File + // Save the data with help of Service this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe( dataresult => { if (dataresult.status == 200) { - // console.log(dataresult); this.notifier.notify('success', 'Record Saved Successfully.!'); // this.dialogRef.close(); // alert("sample alert for Saving"); } else { this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - // this.errorMessage = "Some Thing Wents Wrong Try Again !"; } }, error => { this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - // this.errorMessage = "Something Wents Wrong Try Again !"; // this.dialogRef.close(); }); //After Saving the BRANCH data then popup close @@ -905,7 +924,8 @@ public m_investmentType = []; arr.controls.splice(0); this.getPdSupplierFormDetails(); } - /** On Key Press Event For Mobile Number */ + + /** On Key Press Event For Number only Accepting */ keyPress(event: any) { const pattern = /[0-9\-\.\ ]/; @@ -915,7 +935,8 @@ public m_investmentType = []; } } - loanCalc(details ,flag) + /** To calculating Loan Elapsed Tenure both "Other Asset" And "Business Asset" using Flag */ + loanTenureCalc(details ,flag) { if(flag == 1){ //console.log(details.value); 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 5711f7309..ef48af123 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 @@ -59,16 +59,16 @@ - + No differents in Sales in FY {{details.get('financial_year').value}} over Sales in FY {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} - Increase in Sales in FY {{details.get('financial_year').value}} over Sales in FY {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} {{details.get('financial_annualsales_variation').value}} % + Increase in Sales in FY {{details.get('financial_year').value}} over Sales in FY {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} {{details.get('financial_annualsales_variation').value}} % - Decrease in Sales in FY {{details.get('financial_year').value}} over Sales in FY {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} {{details.get('financial_annualsales_variation').value}} % + Decrease in Sales in FY {{details.get('financial_year').value}} over Sales in FY {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} {{(details.get('financial_annualsales_variation').value).replace('-', '')}} % @@ -80,10 +80,12 @@ + Net Profit Net Loss + @@ -115,7 +117,7 @@ Increase in Profit in FY {{details.get('financial_year').value}} over Profit in FY {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} {{details.get('financial_variation').value}} % - Decrease in Profit in FY {{details.get('financial_year').value}} over Profit in FY {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} {{details.get('financial_variation').value}} % + Decrease in Profit in FY {{details.get('financial_year').value}} over Profit in FY {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} {{(details.get('financial_variation').value).replace('-', '')}} % @@ -172,12 +174,13 @@ --> - + + {{"₹"}} {{AV_annualSalesInwords[i]}} Only - + No differents in Sales in FY {{details.get('estimate_year').value}} over Sales in FY {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} @@ -186,7 +189,7 @@ Increase in Sales in FY {{details.get('estimate_year').value}} over Sales in FY {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} {{details.get('estimate_annualsales_variation').value}} % - Decrease in Sales in FY {{details.get('estimate_year').value}} over Sales in FY {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} {{details.get('estimate_annualsales_variation').value}} % + Decrease in Sales in FY {{details.get('estimate_year').value}} over Sales in FY {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} {{(details.get('estimate_annualsales_variation').value).replace('-', '')}} % @@ -196,6 +199,7 @@ + Net Profit Net Loss @@ -226,10 +230,10 @@ No differents in Profit in FY {{details.get('estimate_year').value}} over Profit in FY {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} - Increase in Profit in FY {{details.get('estimate_year').value}} over Profit in FY {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} {{details.get('estimate_variation').value}} % + Increase in Profit in FY {{details.get('estimate_year').value}} over Profit in FY {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} {{details.get('estimate_variation').value}} % - Decrease in Profit in FY {{details.get('estimate_year').value}} over Profit in FY {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} {{details.get('estimate_variation').value}} % + Decrease in Profit in FY {{details.get('estimate_year').value}} over Profit in FY {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} {{(details.get('estimate_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 7af9e3047..11e24e847 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 @@ -325,6 +325,9 @@ export class FinancialInfoComponent implements OnInit { // } // } calFinAnnualSale(index,detail){ + //alert('FIn Annual Sales Data'); + console.log(index); + console.log() let annual_sale = detail.value.financial_annual_sale; if (index != 0) { let array = this.financialForm.controls['date_per_financial']; @@ -335,9 +338,13 @@ export class FinancialInfoComponent implements OnInit { } } - - calEstAnnualSale(index,detail){ + calculateEstimationAnnualSale(index,detail){ + //alert('Function Inside'); + console.log(detail); let annual_sale = detail.value.estimate_annual_sale; + console.log(annual_sale); + console.log(index); + // console.log(annual_sale); if (index != 0) { let array = this.financialForm.controls['estimated_value']; let prev_annual_sale = array.value[index-1].estimate_annual_sale; @@ -345,28 +352,44 @@ export class FinancialInfoComponent implements OnInit { detail.controls.estimate_annualsales_variation.setValue(annual_sale_variation.toFixed(2)); console.log('estimate annual sales variation in %',annual_sale_variation); } - } + } calYearVariation(index, detail) { - let annual_sale = detail.value.financial_annual_sale; let profit = detail.value.financial_net_profit; let loss = detail.value.financial_net_loss; - this.SalesStatement[0] = 0.00; - if ( (profit != '' || loss != '') && index != 0) { let array = this.financialForm.controls['date_per_financial']; - console.log(array.value[index - 1].financial_net_profit); - + console.log('Profit',profit); + console.log(Math.abs(profit)); let prev_profit = array.value[index - 1].financial_net_profit != '' ? array.value[index - 1].financial_net_profit : 0; + console.log('Profitpre',prev_profit); let prev_loss = array.value[index - 1].financial_net_loss !='' ? array.value[index - 1].financial_net_loss : 0 ; let prev_year = array.value[index - 1].financial_year; let prev_annual_sale = array.value[index-1].financial_annual_sale; - - let variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? prev_profit : prev_loss)) * 100; + console.log('loss',loss); + loss = loss != 0 ? loss * (-1) : loss; + console.log('-1 loss',loss); + console.log('pre_loss',prev_loss); + prev_loss = prev_loss != 0 ? prev_loss * (-1) : prev_loss ; + console.log('-1 pre loss',prev_loss); + console.log(Math.abs(profit)); + //let variation2 = ((())) + let variation = (((profit != '' ? profit : loss ) - (prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? Math.abs(prev_profit) : Math.abs(prev_loss))) * 100; + //console.log('console.log(Math.abs(profit));',Math.abs(variation)); + console.log(variation); + // let variation ; + // if(profit != ''){ + // variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? prev_profit : prev_loss)) * 100 * (profit != '' ? (1) : (-1)) ; + // } + // else if(loss != ''){ + // variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? prev_profit : prev_loss)) * 100 * (profit != '' ? (1) : (-1)); + // } + + // let annual_sale_variation = (annual_sale - prev_annual_sale) * 100 ; detail.controls.financial_variation.setValue(variation.toFixed(2)); @@ -436,7 +459,7 @@ export class FinancialInfoComponent implements OnInit { // alert('else condition Profit = '+profit); let margin = (profit / salary) * 100; // alert(' '+margin); - detail.controls.financial_margin_of_profit.setValue(margin.toFixed(2)+'%') + detail.controls.financial_margin_of_profit.setValue(margin.toFixed(2)); // } // detail.controls.financial_margin.disable() @@ -449,7 +472,7 @@ export class FinancialInfoComponent implements OnInit { if (salary != '' && loss != '') { // alert('if condition salary = '+salary); // alert('if condition loss = '+loss); - let margin = (loss / salary) * 100; + let margin = (loss / salary) * 100 * (-1); detail.controls.financial_margin_of_loss.setValue(margin.toFixed(2)); // detail.controls.financial_margin.disable() } @@ -478,11 +501,20 @@ export class FinancialInfoComponent implements OnInit { let array = this.financialForm.controls['estimated_value']; console.log(array.value[index - 1].financial_net_profit); - let prev_profit = array.value[index - 1].estimate_net_profit != '' ? array.value[index - 1].estimate_net_profit : 0; - let prev_loss = array.value[index - 1].estimate_net_loss !='' ? array.value[index - 1].estimate_net_loss : 0 ; - let prev_year = array.value[index - 1].estimate_year; + let prev_profit = array.value[index - 1].estimate_net_profit != '' ? array.value[index - 1].estimate_net_profit : 1; + let prev_loss = array.value[index - 1].estimate_net_loss !='' ? array.value[index - 1].estimate_net_loss : 1; + let prev_year = array.value[index - 1].estimate_year; + loss = loss != 0 ? loss * (-1) : loss; + prev_loss = prev_loss != 0 ? prev_loss * (-1) : prev_loss ; - let variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? prev_profit : prev_loss)) * 100; + let variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? Math.abs(prev_profit) : Math.abs(prev_loss))) * 100; + // let variation ; + // if(profit != ''){ + // variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? prev_profit : prev_loss)) * 100 ; + // } + // else if(loss != ''){ + // variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? prev_profit : prev_loss)) * 100 * (profit != '' ? (1) : (-1)); + // } detail.controls.estimate_variation.setValue(variation.toFixed(2)); } @@ -514,12 +546,12 @@ export class FinancialInfoComponent implements OnInit { } else if (detail.value.estimate_profit_or_loss == 2){ - let loss = detail.value.estimate_net_profit; + let loss = detail.value.estimate_net_loss; console.log('else if Margin loss',loss); if (salary != '' && loss != '') { console.log('elseif if Margin Estimate salary',salary); console.log('alseif if Margin loss',loss); - let margin = (loss / salary) * 100; + let margin = (loss / salary) * 100 * (-1); detail.controls.estimate_margin_of_loss.setValue(margin.toFixed(2)); } @@ -527,6 +559,34 @@ export class FinancialInfoComponent implements OnInit { } + // selectedProfitOrLossType($event,index,flag){ + // if(flag == 1){ + // let array = this.financialForm.controls['date_per_financial']; + + // if($event == 1){ + // detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2)); + // detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2)); + // } + // else if($event == 2){ + // detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2)); + // detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2)); + // } + // } + // else if(flag == 2){ + + // let array = this.financialForm.controls['estimated_value']; + + // if($event == 1){ + // detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2)); + // detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2)); + // } + // else if($event == 2){ + // detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2)); + // detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2)); + // } + // } + // } + calProfitAndLossVal( i, detail) { console.log(detail); let salary = detail.value.estimate_annual_sale; @@ -542,7 +602,7 @@ export class FinancialInfoComponent implements OnInit { else if(detail.value.estimate_profit_or_loss == 2){ let margin_loss = detail.value.estimate_margin_of_loss; if (salary != '' && margin_loss != '') { - let loss = (margin_loss/100)*salary; + let loss = (margin_loss/100)*salary*(-1); detail.controls.estimate_net_loss.setValue(loss.toFixed(2)); this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(loss); }