diff --git a/ng6-seed/sineedge_prod_020219.zip b/ng6-seed/sineedge_prod_020219.zip deleted file mode 100644 index 063398a44..000000000 Binary files a/ng6-seed/sineedge_prod_020219.zip and /dev/null differ 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 5768d1121..bfd8fd714 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 @@ -161,7 +161,11 @@ - + + + + + @@ -227,7 +231,7 @@ {{"₹"}} {{OtherAppxMarketAmtInwords[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 bc89f1d4c..11d255889 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 @@ -44,19 +44,19 @@ export class AssetsInfoComponent implements OnInit { public m_any_asset_loan_type = [{'value': "yes",'viewValue': "Yes"}, {'value': "no",'viewValue': "No"}, {'value': "nan",'viewValue': "NA"}] - appxMarketAmtInwords : any = []; + // appxMarketAmtInwords : any = []; OtherAppxMarketAmtInwords : any = []; - emiAmtInwords : any = []; + // emiAmtInwords : any = []; OtherEmiAmtInwords : any = []; - PremiumPaidInwords : any = []; + // PremiumPaidInwords : any = []; OtherPremiumPaidInwords: any = []; - SumAssuredInwords: any = []; + // SumAssuredInwords: any = []; OtherSumAssuredInwords: any = []; - AmtInvestInwords: any = []; + // AmtInvestInwords: any = []; OtherAmtInvestInwords: any = []; - AssetValueInwords: any = []; + // AssetValueInwords: any = []; OtherAssetValueInwords: any = []; - B_emiAmtInwords: any = []; + // B_emiAmtInwords: any = []; O_emiAmtInwords: any = []; public m_propertyType = []; @@ -146,7 +146,8 @@ export class AssetsInfoComponent implements OnInit { getM_Assets_Type() { this.pdTrigerService.getAllMasterDatas('ASSETTYPE').subscribe( data => { - this.m_assets_type = data.records.filter(data => data.isactive == 1 && data.id != 4); + this.m_assets_type = data.records.filter(data => data.isactive == 1 && data.id != 5 + ); }, error => { this.notifier.notify('warning', 'No Category Records Found.!'); @@ -387,13 +388,13 @@ export class AssetsInfoComponent implements OnInit { }); } - otherBusinessAssetsDescription() { - return this._formBuilder.group({ - any_other_assets: [''], - any_other_asset_value : [''], - any_other_asset_loan : [''], - }); - } + // otherBusinessAssetsDescription() { + // return this._formBuilder.group({ + // any_other_assets: [''], + // any_other_asset_value : [''], + // any_other_asset_loan : [''], + // }); + // } loadInsuranceDescription() { return this._formBuilder.group({ @@ -411,7 +412,8 @@ export class AssetsInfoComponent implements OnInit { investments_type: [''], other_investments_type:[''], amount_of_invest: [''], - bank_name: [''] + bank_name: [''], + in_which_organisation:[''] }); } @@ -489,6 +491,7 @@ export class AssetsInfoComponent implements OnInit { investments_type: [data.investments_type], other_investments_type : [data.other_investments_type], amount_of_invest: [data.amount_of_invest], + in_which_organisation:[data.in_which_organisation], bank_name: [data.bank_name] }); } @@ -522,22 +525,22 @@ export class AssetsInfoComponent implements OnInit { }); } - initBusinessDetailsWithdata(data) { + // initBusinessDetailsWithdata(data) { - 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_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], - }); - return formGroup; - } + // 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_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], + // }); + // return formGroup; + // } loadDetails: boolean; addAssetsDetailsWithData(supp_data) { @@ -654,6 +657,7 @@ export class AssetsInfoComponent implements OnInit { this.OtherAmtInvestInwords[i] = this.pdTrigerService.convertNumberToWords(+datas.amount_of_invest); array_data = { 'investments_type': datas.investments_type, 'other_investments_type' : datas.other_investments_type, + 'in_which_organisation' : datas.in_which_organisation, 'amount_of_invest': datas.amount_of_invest, 'bank_name': datas.bank_name }; }); @@ -715,24 +719,17 @@ export class AssetsInfoComponent implements OnInit { // 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){ + if(type==1){} + else if(type==2) {} + 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) { + } + 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('') - } + } } @@ -798,14 +795,14 @@ export class AssetsInfoComponent implements OnInit { details.controls['elapsed_tenure'].setValue(ElapsedValues); } } - else if(flag == 2){ - let BusinessElapsedValues; + // else if(flag == 2){ + // let BusinessElapsedValues; - if(details.value.business_original_loan_tenure != null && details.value.business_original_loan_tenure != '' && details.value.business_balance_tenure != null && details.value.business_balance_tenure != ''){ - BusinessElapsedValues = details.value.business_original_loan_tenure - details.value.business_balance_tenure ; - details.controls['business_elapsed_tenure'].setValue(BusinessElapsedValues); - } - } + // if(details.value.business_original_loan_tenure != null && details.value.business_original_loan_tenure != '' && details.value.business_balance_tenure != null && details.value.business_balance_tenure != ''){ + // BusinessElapsedValues = details.value.business_original_loan_tenure - details.value.business_balance_tenure ; + // details.controls['business_elapsed_tenure'].setValue(BusinessElapsedValues); + // } + // } } @@ -813,43 +810,43 @@ export class AssetsInfoComponent implements OnInit { inWords(e,i,flag){ switch(flag){ case 1 : - this.appxMarketAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); + // this.appxMarketAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); break; case 2 : this.OtherAppxMarketAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); break; case 3 : - this.emiAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); + // this.emiAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); break; case 4 : this.OtherEmiAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); break; case 5 : - this.PremiumPaidInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); + // this.PremiumPaidInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); break; case 6 : this.OtherPremiumPaidInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); break; case 7 : - this.SumAssuredInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); + // this.SumAssuredInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); break; case 8 : this.OtherSumAssuredInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); break; case 9 : - this.AmtInvestInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); + // this.AmtInvestInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); break; case 10 : this.OtherAmtInvestInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); break; case 11 : - this.AssetValueInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); + // this.AssetValueInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); break; case 12 : this.OtherAssetValueInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); break; case 13: - this.B_emiAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); + // this.B_emiAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); break; case 14: this.O_emiAmtInwords[i] = this.pdTrigerService.convertNumberToWords(e.target.value); @@ -858,4 +855,20 @@ inWords(e,i,flag){ break; } } -} \ No newline at end of file +} + + + +// {id: "4", name: "Equipments and machinaries", isactive: "1", flag: "1", is_others: "0"} + +// {id: "7", name: "Investments", isactive: "1", flag: "0", is_others: "0"} + +// {id: "5", name: "Jewellery", isactive: "1", flag: "0", is_others: "0"} + +// {id: "6", name: "Life Insurance Policy", isactive: "1", flag: "0", is_others: "0"} + +// {id: "2", name: "Property", isactive: "1", flag: "1", is_others: "0"} + +// {id: "3", name: "Vehicle", isactive: "1", flag: "1", is_others: "0"} + +// {id: "1", name: "Others", isactive: "1", flag: "1", is_others: "1"} \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html index 076ad7106..8268600a8 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html @@ -49,7 +49,7 @@ formControlName="shareholding"> - + Select Yes No @@ -62,11 +62,12 @@
- - {{errorMessage[i]}} + + {{yearErrorMessage[i]}} - + + {{monthErrorMessage[i]}} - Countries Where Max Sales Done for {{manufacturing.value.main_products}} + Cities Where Max Sales Done for {{manufacturing.value.main_products}} {{MCL.city_name}} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts index b435db587..98eec7056 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts @@ -67,10 +67,13 @@ export class BusinessInfoComponent implements OnInit { generalExistEntityType_other:string; generalExistBusinessYear:Number; generalExistBusinessMonth:Number; - errorMessage: any = []; + yearErrorMessage: any = []; + monthErrorMessage: any = []; errorMessageForExistTotalWorkExperience:any = []; ExportFlag: boolean = false; appxSalaryAmtInwords: any; + isreadonlyyear:any = []; + isreadonlymonth:any = []; constructor(notifier: NotifierService, private fb: FormBuilder, @@ -89,7 +92,7 @@ export class BusinessInfoComponent implements OnInit { this.generalExistEntityType = this.pd_all_details.business_entity_type; this.generalExistEntityType_other = this.pd_all_details.business_entity_type_other; this.generalExistBusinessYear = this.pd_all_details.business_years; - + this.generalExistBusinessMonth = this.pd_all_details.business_month; } public viewerOptions: any = { navbar: false, @@ -200,6 +203,9 @@ export class BusinessInfoComponent implements OnInit { businessVal.formid = this.form_id; businessVal.company_id = this.company_id; businessVal.fk_createdby = this.pdid; + if(businessVal.employees_appx_salary){ + this.appxSalaryAmtInwords = this._pd.convertNumberToWords(businessVal.employees_appx_salary); + } //businessVal.designation = DesgnArray; businessVal.partners = PartnrArray; businessVal.documents = DocArray; @@ -1282,15 +1288,38 @@ export class BusinessInfoComponent implements OnInit { } /** To Convert Month into Year */ - ConvertMonthintoYear(itemrow,e){ + ConvertMonthintoYear(itemrow,e,i){ let year = itemrow.controls.current_business_experiance_year.value; let converted_month : number = e%12; let converted_year : number = e/12; - itemrow.controls.current_business_experiance_year.setValue(+year + +Math.floor(converted_year)); - itemrow.controls.current_business_experiance_month.setValue(Math.floor(converted_month)); + let Year = +year + +Math.floor(converted_year); + + if(Year > this.generalExistBusinessYear){ + this.yearErrorMessage[i] = "Higher than Business Vintage"; + itemrow.controls.current_business_experiance_year.setValue(''); + itemrow.controls.current_business_experiance_month.setValue(''); + + } + else{ + if(Year == this.generalExistBusinessYear && +converted_month > this.generalExistBusinessMonth) + { + this.monthErrorMessage[i] = "Higher than Business Vintage"; + itemrow.controls.current_business_experiance_year.setValue(''); + itemrow.controls.current_business_experiance_month.setValue(''); + + }else{ + this.monthErrorMessage[i] = ''; + this.yearErrorMessage[i] = ''; + itemrow.controls.current_business_experiance_year.setValue(Year); + itemrow.controls.current_business_experiance_month.setValue(Math.floor(converted_month)); + } + } + + // itemrow.controls.current_business_experiance_year.setValue(+year + +Math.floor(converted_year)); + // itemrow.controls.current_business_experiance_month.setValue(Math.floor(converted_month)); } @@ -1573,14 +1602,29 @@ export class BusinessInfoComponent implements OnInit { checkTotalEmployee(FormData){ this.businessForm.controls['employees_total'].setValue((+FormData.value.employees_permanent ||0)+(+FormData.value.employees_temporary||0)); } + + changeOfStartedBusiness(members,i,e){ + if(e == 'yes'){ + members.controls.current_business_experiance_year.setValue(this.generalExistBusinessYear); + this.isreadonlyyear[i] = this.generalExistBusinessYear != undefined ? true : false; + members.controls.current_business_experiance_month.setValue(this.generalExistBusinessMonth); + this.isreadonlymonth[i] = this.generalExistBusinessMonth != undefined ? true : false; + } + else{ + this.isreadonlyyear[i] =false; + this.isreadonlymonth[i] = false; + } + } + + checkWithExistBusinessYear(e,i,members){ if(+e > this.generalExistBusinessYear){ - this.errorMessage[i] = "Higher than Business Vintage"; + this.yearErrorMessage[i] = "Higher than Business Vintage"; members.controls.current_business_experiance_year.setValue(''); } else{ - this.errorMessage[i] = ''; + this.yearErrorMessage[i] = ''; } } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dialogue/other-applicant-details/other-applicant-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dialogue/other-applicant-details/other-applicant-details.component.html index 128a726a5..6088e72cc 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dialogue/other-applicant-details/other-applicant-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dialogue/other-applicant-details/other-applicant-details.component.html @@ -30,7 +30,7 @@ - +
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html index 114ea50f9..51370aed4 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html @@ -290,7 +290,7 @@
-
Residence Details
+
Residence Details of {{FamilyMemberAsLabel[ix]}}
@@ -361,6 +361,7 @@
+
Address Details of {{FamilyMemberAsLabel[ix]}}
@@ -373,7 +374,7 @@ - +
@@ -419,7 +420,7 @@ - + @@ -429,15 +430,15 @@
-
-
@@ -567,15 +568,23 @@ +
Remarks
+
- + +
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts index b71343363..426cc6e6c 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts @@ -297,10 +297,12 @@ import { ActivatedRoute, Router } from "@angular/router"; export class FamilyDetailsComponent implements OnInit { IncomePerMonth: any =[]; RentAmount: any = []; + FamilyMemberAsLabel: any = []; //@Input() pdid: number; pageTitle: string = "Family Details"; pdid: string; form_id: number; + isReadOnly:any = []; private notifier: NotifierService; public familyForm: FormGroup; @@ -377,6 +379,7 @@ export class FamilyDetailsComponent implements OnInit { name:element.applicant_name, relationship:element.relationship, relation_to:element.relation_to, + age:'', data_gets_from:'GeneralForm'}; }); // console.log('familyMembersGeneralForm',familyMembersGeneralForm); @@ -393,6 +396,7 @@ export class FamilyDetailsComponent implements OnInit { name:element.family_member_name, relationship:element.other_family_relationship_id, relation_to:element.relation_to_id, + age:'', data_gets_from:'BusinessForm'}; }); // console.log('familyMembersGeneralForm',familyMembersBusinessForm); @@ -623,24 +627,30 @@ export class FamilyDetailsComponent implements OnInit { addMoreApplicantFamilyDetails(e): void { e.stopPropagation(); - this.initFamilyForm('chck'); + this.initFamilyForm(null); } selectedPerson(e,inx){ - // console.log(e); - // console.log(this.apiFamilyMembers); - // return; - + + + this.FamilyMemberAsLabel[inx] = this.selectPerson.filter(item => item.pd_co_applicant_id == e)[0].applicant_name; + const control = this.familyForm.controls['family_details']['controls'][inx].controls.family_members_details; if(this.apiFamilyMembers.length>0){ let arraydata : any; let data = this.apiFamilyMembers.filter(item => item.relation_to == e); + if(data.length > 0){ - data.forEach(val => { + data.forEach((val,inx) => { + if(val.age){ + this.isReadOnly[inx] = true; + }else{ + this.isReadOnly[inx] = false; + } arraydata = { 'family_member_name' : val.name, 'family_member_relationship' : val.relationship, - 'family_member_age' : '', + 'family_member_age' : val.age, 'family_member_earning_status': '', 'earning_segment': '', 'earning_gross_income_per_month': '', @@ -654,7 +664,7 @@ export class FamilyDetailsComponent implements OnInit { } }); - control.push(this.initgenerateFamilyMembersDetailsGet(arraydata)); + control.push(this.initgenerateFamilyMembersDetailsGet(arraydata)); } else{ control.push(this.generateFamilyMembersDetailsGet()); @@ -665,15 +675,16 @@ export class FamilyDetailsComponent implements OnInit { } } -addFamilyMembers(inx) { - console.log(inx); - const control = this.familyForm.controls['family_details']['controls'][inx].controls.family_members_details; - control.push(this.generateFamilyMembersDetailsGet()); +addFamilyMembers(inx,i) { + let mainControl = this.familyForm.get('family_details') as FormArray; + let control = mainControl.controls[inx].get('family_members_details') as FormArray; + control.push(this.generateFamilyMembersDetailsGet()); } -removeFamilyMembers(index) { - const control = this.familyForm.controls['family_details']['controls'][index].controls.family_members_details; - control.removeAt(index); +removeFamilyMembers(inx,i) { + let mainControl = this.familyForm.get('family_details') as FormArray; + let control = mainControl.controls[inx].get('family_members_details') as FormArray; + control.removeAt(i); } 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 8cf81bdfd..897029a2f 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 @@ -139,8 +139,8 @@ - - + + No difference in Profit sales % in FY {{details.get('financial_year').value}} over Profit sales % in FY {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} 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 561c98fe8..8eebd8b22 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 @@ -501,7 +501,7 @@ export class FinancialInfoComponent implements OnInit { if (salary != '' && profit != '') { if(+profit>+salary){ alert("profit is greater than salary"); - detail.controls.financial_net_profit.setValue(''); + detail.controls.financial_net_profit.setValue(0); detail.controls.financial_margin_of_profit.setValue(''); detail.controls.financial_profit_to_sale_variation.setValue(''); detail.controls.financial_variation.setValue(''); @@ -521,7 +521,7 @@ export class FinancialInfoComponent implements OnInit { if (salary != '' && loss != '') { if(+loss>+salary){ alert("Loss is greater than salary"); - detail.controls.financial_net_loss.setValue(''); + detail.controls.financial_net_loss.setValue(0); detail.controls.financial_margin_of_loss.setValue(''); detail.controls.financial_profit_to_sale_variation.setValue(''); detail.controls.financial_variation.setValue(''); @@ -535,29 +535,28 @@ export class FinancialInfoComponent implements OnInit { } - if (((profit_margin != '' || profit_margin !== undefined) || (loss_margin != '' || loss_margin !== undefined) ) && index != 0) { + if ((profit_margin != '' || loss_margin != '') && index != 0) { - console.log('Current profit_margin',profit_margin); - + let array = this.financialForm.controls['date_per_financial']; let prev_profit_margin = array.value[index - 1].financial__margin_of_profit != '' ? array.value[index - 1].financial_margin_of_profit : 0; let prev_loss_margin = array.value[index - 1].financial__margin_of_loss !='' ? array.value[index - 1].financial_margin_of_loss : 0 ; + + loss_margin = loss_margin !== undefined ? loss_margin : 0; + prev_loss_margin = prev_loss_margin !== undefined ? prev_loss_margin : 0 ; - console.log('pre profit_margin',prev_profit_margin); + profit_margin = profit_margin !== undefined ? profit_margin:0; + prev_profit_margin = prev_profit_margin !== undefined ? prev_profit_margin : 0 ; + + let variation_percent : any ; + variation_percent = (((profit_margin != '' ? profit_margin : loss_margin ) - (prev_profit_margin != '' ? prev_profit_margin : prev_loss_margin ))/ (prev_profit_margin != '' ? Math.abs(prev_profit_margin) : Math.abs(prev_loss_margin))) * 100; - loss_margin = loss_margin != 0 ? loss_margin : loss_margin; - prev_loss_margin = prev_loss_margin != 0 ? prev_loss_margin : prev_loss_margin ; + // console.log((profit_margin != '' ? profit_margin : loss_margin ) - (prev_profit_margin != '' ? prev_profit_margin : prev_loss_margin )); + // console.log((((profit_margin != '' ? profit_margin : loss_margin ) - (prev_profit_margin != '' ? prev_profit_margin : prev_loss_margin ))/ (prev_profit_margin != '' ? Math.abs(prev_profit_margin) : Math.abs(prev_loss_margin)))); + // console.log((((profit_margin != '' ? profit_margin : loss_margin ) - (prev_profit_margin != '' ? prev_profit_margin : prev_loss_margin ))/ (prev_profit_margin != '' ? Math.abs(prev_profit_margin) : Math.abs(prev_loss_margin))) * 100); - console.log('Current loss_margin',loss_margin); - - console.log('pre loss_margin',prev_loss_margin); - - let variation_percent = (((profit_margin != '' ? profit_margin : loss_margin ) - (prev_profit_margin != '' ? prev_profit_margin : prev_loss_margin ))/ (prev_profit_margin != '' ? Math.abs(prev_profit_margin) : Math.abs(prev_loss_margin))) * 100; - console.log((profit_margin != '' ? profit_margin : loss_margin ) - (prev_profit_margin != '' ? prev_profit_margin : prev_loss_margin )); - console.log((((profit_margin != '' ? profit_margin : loss_margin ) - (prev_profit_margin != '' ? prev_profit_margin : prev_loss_margin ))/ (prev_profit_margin != '' ? Math.abs(prev_profit_margin) : Math.abs(prev_loss_margin)))); - console.log((((profit_margin != '' ? profit_margin : loss_margin ) - (prev_profit_margin != '' ? prev_profit_margin : prev_loss_margin ))/ (prev_profit_margin != '' ? Math.abs(prev_profit_margin) : Math.abs(prev_loss_margin))) * 100); - detail.controls.financial_profit_to_sale_variation.setValue(variation_percent.toFixed(2)); + detail.controls.financial_profit_to_sale_variation.setValue(variation_percent != Infinity ? variation_percent.toFixed(2) : 0); } } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.html index 1e9f55740..1dac6787f 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.html @@ -55,7 +55,7 @@ - + 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 4295b502b..b182a3342 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 @@ -55,8 +55,9 @@ export class StockComponent implements OnInit { public submitted = false; noRecordsFound: Boolean = false; serviceProviderForm: Boolean = false; - suppliers_raw_materials : any = []; - suppliers_trade_details : any = []; + // suppliers_raw_materials : any = []; + suppliers_retail_trade_details : any = []; + suppliers_wholesale_trade_details : any = []; suppliers_finished_goods : any =[]; suppliers_service_product : any = []; @@ -193,19 +194,19 @@ export class StockComponent implements OnInit { api.forEach(val => { if (val.type_of_activity_id == 2) { if(val.products){ - this.suppliers_raw_materials = val.products; + this.suppliers_finished_goods = val.products; this.initManufacturingDetails(null); } } if (val.type_of_activity_id == 3) { if(val.products){ - this.suppliers_finished_goods = val.products; + this.suppliers_retail_trade_details = val.products; this.initRetailDetails(null); } } if (val.type_of_activity_id == 4) { if(val.products){ - this.suppliers_trade_details = val.products; + this.suppliers_wholesale_trade_details =val.products; this.initTradingDetails(null); } } @@ -236,19 +237,19 @@ export class StockComponent implements OnInit { api.forEach(val => { if (val.type_of_activity_id == 2) { if(val.products){ - this.suppliers_raw_materials = val.products; + this.suppliers_finished_goods = val.products; this.initManufacturingDetails(null); } } if (val.type_of_activity_id == 3) { if(val.products){ - this.suppliers_finished_goods = val.products; + this.suppliers_retail_trade_details= val.products; this.initRetailDetails(null); } } if (val.type_of_activity_id == 4) { if(val.products){ - this.suppliers_trade_details = val.products; + this.suppliers_wholesale_trade_details = val.products; this.initTradingDetails(null); } } @@ -324,22 +325,22 @@ tradingFormCreation(val) { if(datas === null){ - if(this.suppliers_raw_materials.length > 0){ - this.suppliers_raw_materials.forEach(val => { - let Ref_RawMaterials : any = {'raw_name': val, - 'stock_observed':'', - 'raw_quantity': '', - 'raw_uom': '', - 'other_uom': '', - 'raw_value': '', - 'is_sufficiant_raw': '', - 'rawmaterial_remarks':''}; - rawMaterial.push(this.createRawmaterial(Ref_RawMaterials)); - }); - } - else{ + // if(this.suppliers_raw_materials.length > 0){ + // this.suppliers_raw_materials.forEach(val => { + // let Ref_RawMaterials : any = {'raw_name': val, + // 'stock_observed':'', + // 'raw_quantity': '', + // 'raw_uom': '', + // 'other_uom': '', + // 'raw_value': '', + // 'is_sufficiant_raw': '', + // 'rawmaterial_remarks':''}; + // rawMaterial.push(this.createRawmaterial(Ref_RawMaterials)); + // }); + // } + // else{ } rawMaterial.push(this.createRawmaterial(null)); - } + if(this.suppliers_finished_goods.length > 0){ // for (let val of this.suppliers_finished_goods) { this.suppliers_finished_goods.forEach(val => { @@ -428,10 +429,10 @@ tradingFormCreation(val) { if(datas === null){ - if(this.suppliers_trade_details.length > 0){ + if(this.suppliers_retail_trade_details.length > 0){ this.rawMaterialAccess = true; - this.suppliers_trade_details.forEach(val => { + this.suppliers_retail_trade_details.forEach(val => { let Ref_Trade_Goods : any = { 'traded_goods_name': val, 'traded_goods_observed': '', @@ -527,9 +528,9 @@ tradingFormCreation(val) { if(datas === null){ - if(this.suppliers_trade_details.length > 0){ + if(this.suppliers_wholesale_trade_details.length > 0){ // for (let val of this.suppliers_trade_details) { - this.suppliers_trade_details.forEach(val => { + this.suppliers_wholesale_trade_details.forEach(val => { let Ref_Trade_Goods : any = { 'traded_goods_name': val, 'traded_goods_observed': '',