From 683777c7e14625eb17cd7e23fa73d92172637b4d Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Thu, 3 Jan 2019 23:41:38 +0530 Subject: [PATCH] Stock Changes : ps --- .../financial-info.component.html | 12 +- .../loan-details/loan-details.component.html | 14 +- .../start-pd/forms/stock/stock.component.html | 71 ++++---- .../start-pd/forms/stock/stock.component.ts | 158 ++++++++++++------ 4 files changed, 161 insertions(+), 94 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 0baee09c0..3da828bb1 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 @@ -31,7 +31,7 @@ @@ -60,7 +60,7 @@ - + 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}} @@ -109,7 +109,7 @@ - + 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}} @@ -121,7 +121,7 @@ - + @@ -181,7 +181,7 @@ - + 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}} @@ -225,7 +225,7 @@ - + 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}} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.html index a2ba31c75..6002270aa 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.html @@ -21,7 +21,7 @@
- {{"₹"}} {{loanAmtInWords}} Only + {{"₹"}} {{loanAmtInWords}} Only
@@ -66,7 +66,7 @@
- {{"₹"}} {{balTxrfAmtInWords}} Only + {{"₹"}} {{balTxrfAmtInWords}} Only - {{"₹"}} {{topUpAmtInWords}} Only + {{"₹"}} {{topUpAmtInWords}} Only @@ -99,7 +99,7 @@ - {{"₹"}} {{ownContributionInWords}} Only + {{"₹"}} {{ownContributionInWords}} Only @@ -135,7 +135,7 @@ - {{"₹"}} {{emiAmtInWords}} Only + {{"₹"}} {{emiAmtInWords}} Only @@ -200,12 +200,12 @@ - {{"₹"}} {{emvAmtInWords}} Only + {{"₹"}} {{emvAmtInWords}} Only diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.html index 4ab5d6981..66c5663c8 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.html @@ -52,11 +52,12 @@ - - {{"₹"}} {{M_rawValueInWords}} Only + + {{"₹"}} {{M_rawValueInWords[a]}} Only - + + {{"₹"}} {{M_financialRawValueInWords[a]}} Only @@ -69,7 +70,6 @@ -
-
@@ -104,11 +103,12 @@ - - {{"₹"}} {{M_goodsValueInWords}} Only + + {{"₹"}} {{M_goodsValueInWords[b]}} Only - + + {{"₹"}} {{M_financialGoodsValueInWords[b]}} Only @@ -121,7 +121,7 @@ -
+ -
+
@@ -155,11 +155,12 @@
- - {{"₹"}} {{M_tradedGoodsValueInWords}} Only + + {{"₹"}} {{M_tradedGoodsValueInWords[c]}} Only - + + {{"₹"}} {{M_financialTradedGoodsValueInWords[c]}} Only @@ -173,7 +174,7 @@
-
+ -
+ @@ -219,11 +220,12 @@
- - {{"₹"}} {{R_goodsValueInWords}} Only + + {{"₹"}} {{R_goodsValueInWords[d]}} Only - + + {{"₹"}} {{R_financialGoodsValueInWords[d]}} Only @@ -271,11 +273,12 @@ - - {{"₹"}} {{R_tradedGoodsValueInWords}} Only + + {{"₹"}} {{R_tradedGoodsValueInWords[e]}} Only - + + {{"₹"}} {{R_financialTradedGoodsValueInWords[e]}} Only @@ -289,7 +292,7 @@ -
+ -
+ @@ -336,11 +339,12 @@ - - {{"₹"}} {{T_goodsValueInWords}} Only + + {{"₹"}} {{T_goodsValueInWords[f]}} Only - + + {{"₹"}} {{T_financialGoodsValueInWords[f]}} Only @@ -355,7 +359,7 @@ -
+ -
+ @@ -390,11 +394,12 @@ - - {{"₹"}} {{T_tradedGoodsValueInWords}} Only + + {{"₹"}} {{T_tradedGoodsValueInWords[g]}} Only - + + {{"₹"}} {{T_financialTradedGoodsValueInWords[g]}} Only @@ -408,7 +413,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 e6660afc0..cab80971e 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 @@ -28,15 +28,24 @@ export class StockComponent implements OnInit { rawmaterial : any; - M_rawValueInWords : any; - - M_goodsValueInWords : any; - R_goodsValueInWords : any; - T_goodsValueInWords : any; + M_rawValueInWords : any = []; + M_financialRawValueInWords : any = []; - M_tradedGoodsValueInWords : any; - R_tradedGoodsValueInWords : any; - T_tradedGoodsValueInWords : any; + M_goodsValueInWords : any = []; + R_goodsValueInWords : any = []; + T_goodsValueInWords : any = []; + + M_financialGoodsValueInWords : any = []; + R_financialGoodsValueInWords : any = []; + T_financialGoodsValueInWords : any = []; + + M_tradedGoodsValueInWords : any = []; + R_tradedGoodsValueInWords : any = []; + T_tradedGoodsValueInWords : any = []; + + M_financialTradedGoodsValueInWords : any = []; + R_financialTradedGoodsValueInWords : any = []; + T_financialTradedGoodsValueInWords : any = []; rawMaterialAccess: boolean; finishedGoodsAccess: boolean; @@ -44,6 +53,7 @@ export class StockComponent implements OnInit { public submitted = false; noRecordsFound: Boolean = false; serviceProviderForm: Boolean = false; + suppliers_raw_materials : any = []; constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, private router: Router, @@ -113,12 +123,9 @@ export class StockComponent implements OnInit { let params: any = {}; params.pd_id = this.pdid; params.pd_form_id = this.form_id; - this._pd.retriveForm(params).subscribe(value => { if (value.status == 200) { - let dataForm = value.records; - - + let dataForm = value.records; if(dataForm !== undefined) { console.log(dataForm); this.stockForms = this.fb.group({ @@ -133,6 +140,24 @@ export class StockComponent implements OnInit { let arr = record.filter(data => data.type_of_activity_id == 1); console.log(133,arr.length); if(arr.length > 0) { + this._pd.retriveForm({pd_id:this.pdid,pd_form_id:1}).subscribe(value => { + console.log('136',value); + if(value.status == 200){ + this.suppliers_raw_materials = value.records.manufacturing_details[0].main_raw_materials; + let manufacturing_temparr = []; + manufacturing_temparr['manufacturing_raw_materials'] = dataForm.manufacturing_details[0].manufacturing_raw_materials; + manufacturing_temparr['manufacturing_finished_goods'] = dataForm.manufacturing_details[0].manufacturing_finished_goods; + manufacturing_temparr['manufacturing_traded_goods'] = dataForm.manufacturing_details[0].manufacturing_traded_goods; + this.initManufacturingDetails(manufacturing_temparr); + } + else{ + let manufacturing_temparr = []; + manufacturing_temparr['manufacturing_raw_materials'] = dataForm.manufacturing_details[0].manufacturing_raw_materials; + manufacturing_temparr['manufacturing_finished_goods'] = dataForm.manufacturing_details[0].manufacturing_finished_goods; + manufacturing_temparr['manufacturing_traded_goods'] = dataForm.manufacturing_details[0].manufacturing_traded_goods; + this.initManufacturingDetails(manufacturing_temparr); + } + }); // console.log(1,dataForm); // console.log(164,dataForm.manufacturing_details); // console.log(2,dataForm.retail_details); @@ -169,14 +194,7 @@ export class StockComponent implements OnInit { // console.log(163,dataForm.manufacturing_details.manufacturing_raw_materials); // console.log(164,dataForm.manufacturing_details[0]); // console.log(164,dataForm.manufacturing_details[0].manufacturing_raw_materials); - - let manufacturing_temparr = []; - - manufacturing_temparr['manufacturing_raw_materials'] = dataForm.manufacturing_details[0].manufacturing_raw_materials; - manufacturing_temparr['manufacturing_finished_goods'] = dataForm.manufacturing_details[0].manufacturing_finished_goods; - manufacturing_temparr['manufacturing_traded_goods'] = dataForm.manufacturing_details[0].manufacturing_traded_goods; - this.initManufacturingDetails(manufacturing_temparr); //this.initManufacturingDetails(dataForm); } @@ -264,7 +282,16 @@ export class StockComponent implements OnInit { }); let arr = record.filter(data => data.type_of_activity_id == 1); if(arr.length > 0) { - this.initManufacturingDetails(null); + this._pd.retriveForm({pd_id:this.pdid,pd_form_id:1}).subscribe(value => { + if(value.status == 200){ + this.suppliers_raw_materials = value.records.manufacturing_details[0].main_raw_materials; + this.initManufacturingDetails(null); + } + else{ + this.initManufacturingDetails(null); + } + }); + // this.initManufacturingDetails(null); } let arr1 = record.filter(data => data.type_of_activity_id == 2); if(arr1.length > 0) { @@ -292,7 +319,16 @@ export class StockComponent implements OnInit { }); let arr = record.filter(data => data.type_of_activity_id == 1); if(arr.length > 0) { - this.initManufacturingDetails(null); + this._pd.retriveForm({pd_id:this.pdid,pd_form_id:1}).subscribe(value => { + if(value.status == 200){ + this.suppliers_raw_materials = value.records.manufacturing_details[0].main_raw_materials; + this.initManufacturingDetails(null); + } + else{ + this.initManufacturingDetails(null); + } + }); + } let arr1 = record.filter(data => data.type_of_activity_id == 2); if(arr1.length > 0) { @@ -378,14 +414,27 @@ tradingFormCreation(val) { const rawMaterial = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_raw_materials']; const finishedGoods = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods']; const tradedGoods = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_traded_goods']; - const control = this.stockForms.controls['manufacturing_details']['controls'][0].controls['main_raw_materials']; - + const control = this.stockForms.controls['manufacturing_details']['controls'][0].controls['main_raw_materials']; if(datas === null){ - // console.log(299,'if'); + if(this.suppliers_raw_materials.length > 0){ + for (let val of this.suppliers_raw_materials) { + let Ref_RawMaterials : any = {'raw_name': val.manufacturing_raw_material_name, + 'stock_observed':'', + 'raw_quantity': '', + 'raw_uom': '', + 'other_uom': '', + 'raw_value': '', + 'rawmaterial_value': '', + 'is_sufficiant_raw': '', + 'rawmaterial_remarks':''}; + rawMaterial.push(this.createRawmaterial(Ref_RawMaterials)); + } + } + else{ rawMaterial.push(this.createRawmaterial(null)); + } finishedGoods.push(this.createGoods(null)); tradedGoods.push(this.createTradedGoods(null)); - } else { // console.log(305,'else') // console.log(377,datas); @@ -395,6 +444,7 @@ tradingFormCreation(val) { // console.log(val); if(val.raw_value){ this.M_rawValueInWords = this._pd.convertNumberToWords(val.raw_value); + this.M_financialRawValueInWords = this._pd.convertNumberToWords(val.rawmaterial_value); } rawMaterial.push(this.createRawmaterial(val)); } @@ -407,6 +457,7 @@ tradingFormCreation(val) { // console.log(val); if(val.goods_value){ this.M_goodsValueInWords = this._pd.convertNumberToWords(val.goods_value); + this.M_financialGoodsValueInWords = this._pd.convertNumberToWords(val.finished_goods_value); } finishedGoods.push(this.createGoods(val)); @@ -420,6 +471,7 @@ tradingFormCreation(val) { // console.log(val); if(val.estimated_traded_goods_value){ this.M_tradedGoodsValueInWords = this._pd.convertNumberToWords(val.estimated_traded_goods_value); + this.M_financialTradedGoodsValueInWords = this._pd.convertNumberToWords(val.traded_goods_value); } tradedGoods.push(this.createTradedGoods(val)); @@ -432,21 +484,6 @@ tradingFormCreation(val) { } } - createRawmaterial2() { - return this.fb.group({ - raw_name: ['', Validators.compose([Validators.required])], - stock_observed:['', Validators.compose([Validators.required])], - raw_quantity: [''], - raw_uom: [''], - other_uom : [''], - raw_value: [''], - rawmaterial_value: [''], - is_sufficiant_raw: [''], - rawmaterial_remarks:[''] - }); - } - - createRawmaterial(records) { // console.log(330,'function in'); if(records === null) { @@ -497,6 +534,7 @@ tradingFormCreation(val) { if(val.goods_value){ this.R_goodsValueInWords = this._pd.convertNumberToWords(val.goods_value); + this.R_financialGoodsValueInWords =this._pd.convertNumberToWords(val.finished_goods_value); } finishedGoods.push(this.createGoods(val)); @@ -512,6 +550,7 @@ tradingFormCreation(val) { // console.log(val); if(val.estimated_traded_goods_value){ this.R_tradedGoodsValueInWords = this._pd.convertNumberToWords(val.estimated_traded_goods_value); + this.R_financialTradedGoodsValueInWords =this._pd.convertNumberToWords(val.traded_goods_value); } tradedGoods.push(this.createTradedGoods(val)); @@ -596,6 +635,7 @@ tradingFormCreation(val) { // console.log(val); if(val.goods_value){ this.T_goodsValueInWords = this._pd.convertNumberToWords(val.goods_value); + this.T_financialGoodsValueInWords = this._pd.convertNumberToWords(val.finished_goods_value); } finishedGoods.push(this.createGoods(val)); @@ -610,6 +650,7 @@ tradingFormCreation(val) { // console.log(val); if(val.estimated_traded_goods_value){ this.T_tradedGoodsValueInWords = this._pd.convertNumberToWords(val.estimated_traded_goods_value); + this.T_financialTradedGoodsValueInWords =this._pd.convertNumberToWords(val.traded_goods_value); } tradedGoods.push(this.createTradedGoods(val)); } @@ -833,29 +874,50 @@ tradingFormCreation(val) { } /** To Convert Amount into Words */ - inWords(e,flag:number){ + inWords(e,flag:number,i){ switch(flag){ case 1 : - this.M_rawValueInWords = this._pd.convertNumberToWords(e.target.value); + this.M_rawValueInWords[i] = this._pd.convertNumberToWords(e.target.value); break; case 2 : - this.M_goodsValueInWords = this._pd.convertNumberToWords(e.target.value); + this.M_goodsValueInWords[i] = this._pd.convertNumberToWords(e.target.value); break; case 3 : - this.M_tradedGoodsValueInWords = this._pd.convertNumberToWords(e.target.value); + this.M_tradedGoodsValueInWords[i] = this._pd.convertNumberToWords(e.target.value); break; case 4 : - this.R_goodsValueInWords = this._pd.convertNumberToWords(e.target.value); + this.R_goodsValueInWords[i] = this._pd.convertNumberToWords(e.target.value); break; case 5 : - this.R_tradedGoodsValueInWords = this._pd.convertNumberToWords(e.target.value); + this.R_tradedGoodsValueInWords[i] = this._pd.convertNumberToWords(e.target.value); break; case 6 : - this.T_goodsValueInWords = this._pd.convertNumberToWords(e.target.value); + this.T_goodsValueInWords[i] = this._pd.convertNumberToWords(e.target.value); break; case 7 : - this.T_tradedGoodsValueInWords = this._pd.convertNumberToWords(e.target.value); + this.T_tradedGoodsValueInWords[i] = this._pd.convertNumberToWords(e.target.value); + break; + case 8 : + this.M_financialRawValueInWords[i] = this._pd.convertNumberToWords(e.target.value); + break; + case 9 : + this.M_financialGoodsValueInWords[i] = this._pd.convertNumberToWords(e.target.value); + break; + case 10 : + this.M_financialTradedGoodsValueInWords[i] = this._pd.convertNumberToWords(e.target.value); + break; + case 11 : + this.R_financialGoodsValueInWords[i] = this._pd.convertNumberToWords(e.target.value); + break; + case 12 : + this.R_financialTradedGoodsValueInWords[i] = this._pd.convertNumberToWords(e.target.value); + break; + case 13 : + this.T_financialGoodsValueInWords[i] = this._pd.convertNumberToWords(e.target.value); + break; + case 14 : + this.T_financialTradedGoodsValueInWords[i] = this._pd.convertNumberToWords(e.target.value); break; default: break;