From 5548887292c4e5e6ace96cc98dfbeef38ae8982b Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Sun, 30 Dec 2018 12:24:15 +0530 Subject: [PATCH 1/5] financial : ps --- .../financial-info.component.html | 170 +++++++++++------- .../financial-info.component.scss | 5 + .../financial-info.component.ts | 104 +++++++++-- 3 files changed, 201 insertions(+), 78 deletions(-) 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 4385d2676..14a32ed82 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 @@ -20,67 +20,91 @@
-

Data as Per Financial Statements

+

Data as Per Financial Statements

- - - Please provide Correct Year Format. Format Should Be (YYYY) + + Starting Financial Year + + Invalid year format + - - + + -
+
+ - - - - - - - - - - - - Net Profit - Net Loss - - - - - - - - - - - - - - - - - - - - - - - - - {{details.get('variation').value <= 0 ? 'Decreases ' : 'Increases '}} in Sales in FY Over Sales in FY is % - - - - +
+ + + + {{details.get('financial_year').value}} +
+ + + + + {{"₹"}} {{FY_annualSalesInwords2[i]}} Only + + + + + + +
+
+ + + + Net Profit + Net Loss + + + + + + {{"₹"}} {{FY_netProfitAmtInwords[i]}} Only + + + + + + + + + {{"₹"}} {{FY_netLossAmtInwords2[i]}} Only + + + + + +
+ + + + + + No differents in Profit in FY {{details.get('financial_year').value}} over sales in FY {{details.get('financial_year').value}} + + + {{details.get('financial_variation').value >= 0 ? 'Increase in Profit in FY ' : 'Decrease in Profit in FY'}} {{details.get('financial_year').value}} over Profit in FY {{details.get('financial_year').value}} {{details.get('financial_variation').value}} % + + + + + + - + @@ -104,27 +128,32 @@ -

Actual Values as per Customer

+

Actual Values as per Customer

- + + Yes No +
- - +
+ - - + + + {{"₹"}} {{AV_annualSalesInwords2[i]}} Only - +
+
+ Net Profit @@ -132,21 +161,30 @@ - - + + + {{"₹"}} {{AV_netProfitAmtInwords2[i]}} Only - - + + + - - + + + {{"₹"}} {{AV_netLossAmtInwords2[i]}} Only - - + + + +
+ + + + {{details.controls['estimate_variation'].value}} {{details.controls['estimate_year'].value}} @@ -313,7 +351,7 @@ - + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.scss index 2205220f8..17598312d 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.scss @@ -17,6 +17,11 @@ // background: #62B013; // color: white; // } + +.underline input { + border: none; +} + .highlight { color: red; } 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 515fb19be..04973a09e 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 @@ -22,6 +22,7 @@ import { /** Service */ import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; import {ActivatedRoute, Router} from '@angular/router'; +import { Alert } from 'selenium-webdriver'; @Component({ selector: 'app-financial-info', @@ -39,6 +40,13 @@ export class FinancialInfoComponent implements OnInit { placeholderName : any = []; setmargin: AbstractControl; customerCommentsFlag :boolean; + FY_annualSalesInwords2 : any = []; + FY_netProfitAmtInwords : any = []; + FY_netLossAmtInwords2 : any = []; + AV_annualSalesInwords2 : any = []; + AV_netProfitAmtInwords2 : any = []; + AV_netLossAmtInwords2 : any = []; + constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, @@ -147,6 +155,7 @@ export class FinancialInfoComponent implements OnInit { financial_margin_of_profit: [''], financial_margin_of_loss: [''], financial_variation: [''], + financial_annualsales_variation : [''], financial_reason: [''], }); } @@ -161,6 +170,7 @@ export class FinancialInfoComponent implements OnInit { estimate_margin_of_profit: [''], estimate_margin_of_loss: [''], estimate_variation: [''], + estimate_annualsales_variation : [''], // estimate_reason: [''], }); } @@ -176,6 +186,7 @@ export class FinancialInfoComponent implements OnInit { estimate_margin_of_profit: [value.estimate_margin_of_profit], estimate_margin_of_loss: [value.estimate_margin_of_loss], estimate_variation: [value.estimate_variation], + estimate_annualsales_variation : [value.estimate_annualsales_variation], // estimate_reason: [''], }); } @@ -251,6 +262,7 @@ export class FinancialInfoComponent implements OnInit { estimate_margin_of_profit: val.financial_margin_of_profit, estimate_margin_of_loss: val.financial_margin_of_loss, estimate_variation: val.financial_variation, + estimate_annualsales_variation : val.financial_annualsales_variation }; control.push(this.createValuewithData(vals)); } @@ -299,31 +311,46 @@ export class FinancialInfoComponent implements OnInit { // // detail.controls.financial_variation.disable() // } // } + calFinAnnualSale(index,detail){ + let annual_sale = detail.value.financial_annual_sale; + if (index != 0) { + let array = this.financialForm.controls['date_per_financial']; + let prev_annual_sale = array.value[index-1].financial_annual_sale; + let annual_sale_variation = (( annual_sale - prev_annual_sale)/prev_annual_sale) * 100 ; + detail.controls.financial_annualsales_variation.setValue(annual_sale_variation.toFixed(2)+'%'); + console.log('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; - let curr_year = detail.value.financial_year; + 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); let prev_profit = array.value[index - 1].financial_net_profit != '' ? array.value[index - 1].financial_net_profit : 0; 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; +// let annual_sale_variation = (annual_sale - prev_annual_sale) * 100 ; detail.controls.financial_variation.setValue(variation.toFixed(2)); - + //Increase in Sales in FY 2017-18 over sales in FY 2016-17 is 11.11% - console.log('variation',variation); - this.SalesStatement[index] = ( variation <= 0 ? 'Decreases ' : 'Increases ' ) + 'in Sales in FY ' + curr_year + ' Over Sales in FY '+ prev_year + ' is ' + variation.toFixed(2) + '%'; - console.log('this.SlesStatement',this.SalesStatement); + console.log('variation in %',variation); + + // this.SalesStatement[index] = ( variation <= 0 ? 'Decreases ' : 'Increases ' ) + 'in Sales in FY ' + curr_year + ' Over Sales in FY '+ prev_year + ' is ' + variation.toFixed(2) + '%'; + // console.log('this.SlesStatement',this.SalesStatement); } @@ -360,17 +387,32 @@ export class FinancialInfoComponent implements OnInit { // // detail.controls.financial_margin.disable() // } // } + calMargin(index, detail) { console.log('detail', detail); +// let array = this.financialForm.controls['date_per_financial']; let salary = detail.value.financial_annual_sale; + // let prev_annual_sale = array.value[index-1].financial_annual_sale; + // let annual_sale_variation = ((prev_annual_sale - salary)/salary ) * 100 ; + if(detail.value.finanical_profit_or_loss == 1){ - let profit = detail.value.financial_net_profit; + let profit = detail.value.financial_net_profit; if (salary != '' && profit != '') { - let margin = (profit / salary) * 100; - detail.controls.financial_margin_of_profit.setValue(margin.toFixed(2)) + if(salary < profit){ + alert('if condition salary = '+salary); + alert('if condition Profit = '+profit); + detail.controls.financial_margin_of_profit.setValue(''); + } + else{ + alert('else condition salary = '+salary); + 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.disable() } @@ -380,11 +422,14 @@ export class FinancialInfoComponent implements OnInit { let loss = detail.value.financial_net_loss; if (salary != '' && loss != '') { + alert('if condition salary = '+salary); + alert('if condition loss = '+loss); let margin = (loss / salary) * 100; detail.controls.financial_margin_of_loss.setValue(margin.toFixed(2)); // detail.controls.financial_margin.disable() } } + //detail.controls.financial_annualsales_variation.setValue(annual_sale_variation.toFixed(2)); } calVariation(index, detail) { // console.log('CalVar In'); @@ -401,7 +446,7 @@ export class FinancialInfoComponent implements OnInit { let profit = detail.value.estimate_net_profit; let loss = detail.value.estimate_net_loss; - let curr_year = detail.value.estimate_year; + //let curr_year = detail.value.estimate_year; if ( (profit != '' || loss != '') && index != 0) { @@ -554,11 +599,46 @@ export class FinancialInfoComponent implements OnInit { /** On Key Press Event For Input Field */ keyPress(event: any) { - const pattern = /[0-9\-\.\ ]/; + const pattern = /[0-9]/; let inputChar = String.fromCharCode(event.charCode); if (event.keyCode != 8 && !pattern.test(inputChar)) { event.preventDefault(); } } + + /** To Convert Amount into Words */ + inWords(e,i,flag:number){ + + // console.log(e); + // console.log(i); + // console.log(flag); + + switch(flag){ + case 1 : + this.FY_annualSalesInwords2[i] = this._pd.convertNumberToWords(e.target.value); + // this.placeholderName[i] = 'Weekly Instalment Amount'; break; + break; + case 2 : + this.FY_netProfitAmtInwords[i] = this._pd.convertNumberToWords(e.target.value); + //alert('Fin net Profit'+this.FY_netProfitAmtInwords[i]); + break; + case 3 : + this.FY_netLossAmtInwords2[i] = this._pd.convertNumberToWords(e.target.value); + // alert('Fin net Loss'+this.FY_netLossAmtInwords2[i]); + break; + case 4 : + this.AV_annualSalesInwords2[i] = this._pd.convertNumberToWords(e.target.value); + break; + case 5 : + this.AV_netProfitAmtInwords2[i] = this._pd.convertNumberToWords(e.target.value); + break; + case 6 : + this.AV_netLossAmtInwords2[i] = this._pd.convertNumberToWords(e.target.value); + break; + default: + break; + } +} + } From 7fd73eda09dd09849049a9c708860566b927c420 Mon Sep 17 00:00:00 2001 From: venbaSriram Date: Sun, 30 Dec 2018 17:05:45 +0530 Subject: [PATCH 2/5] Finanical : ps --- .../financial-info.component.html | 244 +++++++++++------- .../financial-info.component.scss | 4 + .../financial-info.component.ts | 158 ++++++++---- 3 files changed, 250 insertions(+), 156 deletions(-) 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 14a32ed82..5711f7309 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 @@ -22,47 +22,62 @@

Data as Per Financial Statements

- - Starting Financial Year - - Invalid year format - - - - - +
+ + Starting Financial Year + + Invalid year format + + + + + + +
+
- - - + + Financial Year : {{details.get('financial_year').value}} +
+
- - - - {{details.get('financial_year').value}} -
- - +
+ + - {{"₹"}} {{FY_annualSalesInwords2[i]}} Only + {{"₹"}} {{FY_annualSalesInwords[i]}} Only + - - + + + + + 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}} % + + + 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}} % + + +
+
- + Net Profit @@ -70,33 +85,37 @@ - + - {{"₹"}} {{FY_netProfitAmtInwords[i]}} Only + {{"₹"}} {{FY_netProfitAmtInwords[i]}} Only - - + + - + - {{"₹"}} {{FY_netLossAmtInwords2[i]}} Only + {{"₹"}} {{FY_netLossAmtInwords[i]}} Only - - + +
+ - + - No differents in Profit in FY {{details.get('financial_year').value}} over sales in FY {{details.get('financial_year').value}} + No differents 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 >= 0 ? 'Increase in Profit in FY ' : 'Decrease in Profit in FY'}} {{details.get('financial_year').value}} over Profit in FY {{details.get('financial_year').value}} {{details.get('financial_variation').value}} % + + 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}} % @@ -113,10 +132,10 @@ matTooltip="Add More Financial Statements" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" *ngIf="i==0"> add --> - + -->
@@ -142,66 +161,91 @@
-
- - - - - - - {{"₹"}} {{AV_annualSalesInwords2[i]}} Only - -
-
- - - - Net Profit - Net Loss - - - - - - {{"₹"}} {{AV_netProfitAmtInwords2[i]}} Only - - - - - - - - - - {{"₹"}} {{AV_netLossAmtInwords2[i]}} Only - - - - - - -
- - - - - - - {{details.controls['estimate_variation'].value}} {{details.controls['estimate_year'].value}} - - - - - -
@@ -354,7 +398,7 @@ - + @@ -393,7 +437,7 @@ - + - + {{"₹"}} {{loanAmtInWords}} Only Enter valid amount. diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/pd-report.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/pd-report.component.html index 7e165291b..34ebafa73 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/pd-report.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/pd-report.component.html @@ -13,9 +13,10 @@
-
- Export - +
+
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/pd-report.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/pd-report.component.ts index 70a079cce..33e15c2d0 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/pd-report.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-report/pd-report.component.ts @@ -266,7 +266,7 @@ export class PdReportComponent implements OnInit { console.log(blob); let datass = blob.headers.get('content-disposition'); let fileName = datass.split(/"/)[1]; - this.notifier.notify('success', 'Your Changes Updated.!'); + // this.notifier.notify('success', 'Your Changes Updated.!'); const blobs = new Blob([blob.body], { type: 'application/vnd.ms-excel' }); const file = new File([blobs], fileName, diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html index 2319f8db0..6d119d0ed 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html @@ -19,8 +19,8 @@ mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Discussion" matTooltipPosition="above" (click)="getPDStart(viewID)">question_answer -
-
+
QC Notes

{{ pdMasterData[0]?.qc_remarks}}

- +
-
+
QC Remarks
-
- {{ pdMasterData[0]?.qc_rating}} -
+
+
+ {{ pdMasterData[0]?.qc_rating}} +
+
@@ -218,8 +220,9 @@
{{ pdMasterData[0]?.qc_feedback}} -
-
+
+ +
diff --git a/ng6-seed/src/app/template/service/templates/templates.service.ts b/ng6-seed/src/app/template/service/templates/templates.service.ts index 124d4f9cb..6b4d1884e 100755 --- a/ng6-seed/src/app/template/service/templates/templates.service.ts +++ b/ng6-seed/src/app/template/service/templates/templates.service.ts @@ -146,5 +146,17 @@ export class TemplatesService { return this._http.post(this.apiUrl + "getPDReportTemplate", { "records": {"fk_template_id": template_id }}); } + // selected Template forms details + getTemplateSelectedForms(template_id: any): Observable { + const options = { + params: new HttpParams().set('template_id', template_id) + }; + return this._http.get(this.apiUrl + "getTemplateForms", options); + } -} + saveTemplateFormsList(Records: any): Observable { + // Records.fk_createdby = this._aws.getlocale();//to get user id for who is created the Record + // Records.createdon = currentdate;//to get Current date and Time for when the Record is created + return this._http.post(this.apiUrl + "saveTemplateForms", {'records': Records }); + } +} \ No newline at end of file diff --git a/ng6-seed/src/app/template/templates/templates-list/edit/template-forms/template-forms.component.html b/ng6-seed/src/app/template/templates/templates-list/edit/template-forms/template-forms.component.html new file mode 100644 index 000000000..19f1ed5dc --- /dev/null +++ b/ng6-seed/src/app/template/templates/templates-list/edit/template-forms/template-forms.component.html @@ -0,0 +1,9 @@ + + + {{tta.pd_form_name}} + + +
+ + +
\ No newline at end of file diff --git a/ng6-seed/src/app/template/templates/templates-list/edit/template-forms/template-forms.component.scss b/ng6-seed/src/app/template/templates/templates-list/edit/template-forms/template-forms.component.scss new file mode 100644 index 000000000..fc6e786ec --- /dev/null +++ b/ng6-seed/src/app/template/templates/templates-list/edit/template-forms/template-forms.component.scss @@ -0,0 +1,7 @@ +.flexlist{ + display: flex; + flex-wrap: wrap; +} +.flexlist > * { + flex: 0 50%; +} \ No newline at end of file diff --git a/ng6-seed/src/app/template/templates/templates-list/edit/template-forms/template-forms.component.spec.ts b/ng6-seed/src/app/template/templates/templates-list/edit/template-forms/template-forms.component.spec.ts new file mode 100644 index 000000000..337cf7b97 --- /dev/null +++ b/ng6-seed/src/app/template/templates/templates-list/edit/template-forms/template-forms.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TemplateFormsComponent } from './template-forms.component'; + +describe('TemplateFormsComponent', () => { + let component: TemplateFormsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ TemplateFormsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TemplateFormsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/template/templates/templates-list/edit/template-forms/template-forms.component.ts b/ng6-seed/src/app/template/templates/templates-list/edit/template-forms/template-forms.component.ts new file mode 100644 index 000000000..fd3194e03 --- /dev/null +++ b/ng6-seed/src/app/template/templates/templates-list/edit/template-forms/template-forms.component.ts @@ -0,0 +1,77 @@ +import { Component, OnInit, ViewChild , Input} from '@angular/core'; +import { FormGroup, FormBuilder, Validators } from '@angular/forms'; +import { TemplatesService } from './../../../../service/templates/templates.service'; +import { MastersService } from './../../../../service/masters/masters.service'; +import { NotifierService } from "angular-notifier"; + +@Component({ + selector: 'app-template-forms', + templateUrl: './template-forms.component.html', + styleUrls: ['./template-forms.component.scss'] +}) +export class TemplateFormsComponent implements OnInit { + + masterFormsList = [] ; + selectedOptions = []; + @Input() questionId: number; + /** + * Notifier service + */ + private notifier: NotifierService; + + constructor(private mastersService : MastersService, + private templatesService: TemplatesService, + notifier: NotifierService) { + this.notifier = notifier; + } + + ngOnInit() { + this.mastersService.getAllMasterData("PDFORMS").subscribe(data => { + this.masterFormsList = data.records.sort((a ,b)=>{ return a.pd_form_order - b.pd_form_order;}); + // this.selectedOptions = ["1"]; + this.getSelectedFormDetails(); + }); + + } + + restore(): void { + this.getSelectedFormDetails(); + } + + getSelectedFormDetails() { + this.templatesService.getTemplateSelectedForms(this.questionId).subscribe(data=>{ + if(data.dataStatus){ + this.selectedOptions = data.records; + } else { + } + }) + } + + myClick(){ + if(this.selectedOptions.length > 0){ + let records = { + "template_id":this.questionId, + "forms": this.selectedOptions + } + this.templatesService.saveTemplateFormsList(records).subscribe(data => { + if(data.dataStatus){ + this.notifier.notify('success', 'Your Changes Updated.!'); + }else{ + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + } + }, err => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + }) + } else { + alert("should select the forms in list !!!"); + } + } + + onNgModelChange(e){ + console.log("event " + e); + } + + + + +} diff --git a/ng6-seed/src/app/template/templates/templates-list/edit/templates.edit.component.html b/ng6-seed/src/app/template/templates/templates-list/edit/templates.edit.component.html index efab22127..c741ee0da 100755 --- a/ng6-seed/src/app/template/templates/templates-list/edit/templates.edit.component.html +++ b/ng6-seed/src/app/template/templates/templates-list/edit/templates.edit.component.html @@ -51,6 +51,12 @@ + + + + + + diff --git a/ng6-seed/src/app/template/templates/templates.module.ts b/ng6-seed/src/app/template/templates/templates.module.ts index 90ef6bb38..ad40e65d3 100755 --- a/ng6-seed/src/app/template/templates/templates.module.ts +++ b/ng6-seed/src/app/template/templates/templates.module.ts @@ -37,6 +37,7 @@ import { CategoryQuestionAnswerComponent } from './templates-list/edit/edit-ques import { DialogOverviewExampleDialog } from './templates-list/edit/edit-question-answer/category-question-answer/category-question-answer.component'; import { TemplatesAddComponent } from './templates-list/templates-add/templates-add.component'; import { ReportTemplateComponent } from './templates-list/edit/report-template/report-template.component'; +import { TemplateFormsComponent } from './templates-list/edit/template-forms/template-forms.component'; /* * Question Master Module details @@ -119,7 +120,8 @@ const customNotifierOptions: NotifierOptions = { CategoryQuestionAnswerComponent, DialogOverviewExampleDialog, TemplatesAddComponent, - ReportTemplateComponent + ReportTemplateComponent, + TemplateFormsComponent ], entryComponents: [ DialogOverviewExampleDialog, From 124aafc0b38b4817aa8c7206b15cc8c4aacfb7b6 Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Mon, 31 Dec 2018 15:25:54 +0530 Subject: [PATCH 4/5] 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); } From 39ca9c5d020195ddb05949bfe641292a8ba12b6c Mon Sep 17 00:00:00 2001 From: dineshkumarkannan Date: Mon, 31 Dec 2018 16:21:05 +0530 Subject: [PATCH 5/5] address form select box changes : kdk --- .../list-pd/start-pd/forms/address/address.component.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts index 82368e70c..3800fb290 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts @@ -322,17 +322,17 @@ export class AddressComponent implements OnInit { records.bussiness_address_type_others = this.addressForm.controls.bussiness_address_type_others.value; } } + console.log('this.addressForm.controls.additional_premises.value',this.addressForm.controls.additional_premises.value); + this.addressForm.controls.additional_premises.value.forEach((val,index)=> { - - console.log('val.premises_city',val.premises_city); if(val.premises_city != '' && val.premises_city != null){ this.formPremisesCityArray = []; val.premises_city.forEach(option => { this.formPremisesCityArray.push({additional_premises_city: option}); - this.addressForm.controls.additional_premises.value[index].premises_city = this.formPremisesCityArray; }); + this.addressForm.controls.additional_premises.value[index].premises_city = this.formPremisesCityArray; } else{ this.formPremisesCityArray = []; @@ -343,11 +343,12 @@ export class AddressComponent implements OnInit { }); records.additional_premises = this.addressForm.controls.additional_premises.value; - + records.pdid = this.pdid; records.formid = '5'; // records.fk_createdby = '250'; + console.log(JSON.stringify(records)); this._pd.saveForm(records).subscribe(data => {