merge : kms

This commit is contained in:
gandhimathi 2019-01-23 15:07:28 +05:30
parent 4beb721206
commit 838ea773ed
9 changed files with 235 additions and 270 deletions

View File

@ -217,15 +217,23 @@
formControlName="premises_remarks" autocomplete="off">
</mat-form-field>
</mat-card-content>
<mat-card-actions align="center">
<mat-card-actions>
<div align="center">
<button type="button" mat-flat-button (click)="addUnits($event)"
matTooltip="Add More" matTooltipPosition="left" color="primary" *ngIf="last">
<strong>Add More Additional Unit </strong>
</button>
<button type="button" mat-flat-button (click)="removeUnits(i)"
</div>
<!-- <button type="button" mat-flat-button (click)="removeUnits(i)"
matTooltip="Delete"matTooltipPosition="left" color="primary" *ngIf="!last">
<strong>Delete Additional Unit </strong>
</button>
</button> -->
<div align="right">
<button type="button" mat-raised-button mat-icon-button (click)="removeUnits(i)"
matTooltip="Delete Additional Unit" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="!last">
<mat-icon>delete</mat-icon>
</button>
</div>
</mat-card-actions>

View File

@ -314,15 +314,23 @@
</div> -->
</mat-card-content>
<mat-card-actions align="center">
<mat-card-actions>
<div align="center">
<button type="button" mat-flat-button (click)="addAssetDetails($event,1); false"
matTooltip="Add More" matTooltipPosition="left" color="primary" *ngIf="last">
<strong>Add More Other Asset </strong>
</button>
<button type="button" mat-flat-button (click)="removeAssetsDetails(i,1)"
</div>
<!-- <button type="button" mat-flat-button (click)="removeAssetsDetails(i,1)"
matTooltip="Delete"matTooltipPosition="left" color="primary" *ngIf="!last">
<strong>Delete Other Assets </strong>
</button> -->
<div align="right">
<button type="button" mat-raised-button mat-icon-button (click)="removeAssetsDetails(i,1)"
matTooltip="Delete Other Assets" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="!last" >
<mat-icon>delete</mat-icon>
</button>
</div>
</mat-card-actions>
</mat-card>
</div>

View File

@ -160,20 +160,27 @@
</div>
</div>
<mat-action-row>
<div align="center">
<button type="button" mat-button (click)="addBankdetails(i, $event)" color="accent"
matTooltip="Add More" matTooltipPosition="left" *ngIf="last">
<strong>Add More Banking Details</strong>
</button>
<button type="button" mat-button (click)="deleteBankdetails(i)" color="warn"
</div>
<!-- <button type="button" mat-button (click)="deleteBankdetails(i)" color="warn"
matTooltip="Delete"matTooltipPosition="left" *ngIf="!last">
<strong>Delete Banking Details</strong>
</button>
</button> -->
<!-- <button mat-button color="warn" (click)="prevStep()">Previous</button>
<button mat-button color="primary" (click)="nextStep()">End</button> -->
<!-- <button *ngIf="i > 0" mat-raised-button mat-icon-button matTooltip="Delete" matTooltipPosition="above" (click)="deleteBankdetails(i)">
<!-- ngIf="i > 0" -->
<div align="right">
<button mat-raised-button mat-icon-button matTooltip="Delete Banking Details" matTooltipPosition="above" (click)="deleteBankdetails(i)" *ngIf="!last">
<mat-icon>delete</mat-icon>
</button> -->
</button>
</div>
</mat-action-row>
</mat-expansion-panel>
<!-- <div style="text-align: right;" class="pt-1" *ngIf="bankingForm.controls.itemRows['controls'].length == (i+1)">

View File

@ -219,7 +219,7 @@
<input matInput placeholder="Specify Asset Owned Name" formControlName="business_name_of_the_other_owner" autocomplete="off">
</mat-form-field> -->
{{applicants | json}}
<!-- {{applicants | json}} -->
<!-- <mat-form-field *ngIf="sup.get('business_assets_mode').value == 2 || sup.get('business_assets_mode').value == 3 || sup.get('business_assets_mode').value == 4 || sup.get('business_assets_mode').value == 5 || sup.get('business_assets_mode').value == 6" style="width:45%"> -->
<mat-form-field *ngIf="sup.get('business_assets_mode').value == 2 || sup.get('business_assets_mode').value == 3 || sup.get('business_assets_mode').value == 4" style="width:45%">
<mat-select placeholder="Asset Owned by" formControlName="business_name_of_the_owner" required>
@ -262,15 +262,24 @@
</div>
</mat-card-content>
<mat-card-actions align="center">
<mat-card-actions>
<div align="right">
<button type="button" mat-raised-button mat-icon-button (click)="removeAssetsDetails(i)"
matTooltip="Delete Business Assets" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="!last" >
<mat-icon>delete</mat-icon>
</button>
</div>
<div align="center">
<button type="button" mat-flat-button (click)="addAssetDetails($event); false"
matTooltip="Add More" matTooltipPosition="left" color="primary" *ngIf="last">
<strong>Add More Business Asset </strong>
</button>
<button type="button" mat-flat-button (click)="removeAssetsDetails(i)"
</div>
<!-- <button type="button" mat-flat-button (click)="removeAssetsDetails(i)"
matTooltip="Delete"matTooltipPosition="left" color="primary" *ngIf="!last">
<strong>Delete Business Assets </strong>
</button>
</button> -->
</mat-card-actions>
</mat-card>
</div>

View File

@ -98,7 +98,7 @@
<input matInput autocomplete="off" placeholder="Lender" formControlName="lender" >
</mat-form-field> -->
<div style="width:100%">
<mat-form-field style="width:35%">
<mat-form-field style="width:25%">
<input matInput autocomplete="off" placeholder="Original Tenure in Months" formControlName="original_tenure" (change)="checkTenure(details);calculateTenure(details)">
</mat-form-field>
<mat-form-field style="width:35%">
@ -106,20 +106,34 @@
<mat-error>Invalid Balance Tenure.</mat-error>
<!-- //*ngIf="current_balance_tenure.hasError('min')" class="mat-text-warn" -->
</mat-form-field>
<mat-form-field>
<mat-form-field style="width:25%">
<input matInput placeholder="Elapsed Tenure in Months" formControlName="elapsed_tenure" autocomplete="off">
</mat-form-field>
</div>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Delete" matTooltipPosition="above" (click)="deleteLoanDetails(i)"
<!-- <button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Delete" matTooltipPosition="above" (click)="deleteLoanDetails(i)"
*ngIf="i>0">
<mat-icon>delete</mat-icon>
</button>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Add More Loan Details" matTooltipPosition="above" color="primary" (click)="addLoanDetails()"
*ngIf="last">
<mat-icon>add</mat-icon>
</button>
</button> -->
</mat-card-content>
<mat-card-actions>
<div align="right">
<button *ngIf="!last" type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Delete" matTooltipPosition="above" (click)="deleteLoanDetails(i)">
<mat-icon>delete</mat-icon>
</button>
</div>
<div align="center">
<button type="button" mat-flat-button (click)="addLoanDetails()"
matTooltip="Add More" matTooltipPosition="left" color="primary" *ngIf="last">
<strong>Add More Loan Details </strong>
</button>
</div>
</mat-card-actions>
</div>
</div>
</mat-card>

View File

@ -88,15 +88,19 @@
<mat-icon>add</mat-icon>
</button> -->
</mat-card-content>
<mat-card-actions align="center">
<mat-card-actions>
<div align="center">
<button type="button" mat-flat-button (click)="addIncomeDetails()"
matTooltip="Add More" matTooltipPosition="left" color="primary" *ngIf="last">
<strong>Add More Income Details </strong>
</button>
<button type="button" mat-flat-button (click)="deleteIncomeDetails(i)"
matTooltip="Delete"matTooltipPosition="left" color="primary" *ngIf="!last">
<strong>DeleteIncome Details </strong>
</div>
<div align="right">
<button type="button" matTooltip="Delete" class="mr-1 mb-1 hover-icon" matTooltipPosition="above" mat-raised-button mat-icon-button (click)="deleteIncomeDetails(i)"
*ngIf="!last">
<mat-icon>delete</mat-icon>
</button>
</div>
</mat-card-actions>
</div>
</div>

View File

@ -143,14 +143,18 @@
</button> -->
</mat-card-content>
<mat-card-actions align="center">
<mat-card-actions>
<button type="button" mat-flat-button (click)="addGoods(1)"
matTooltip="Add More" matTooltipPosition="left" color="primary" *ngIf="last">
matTooltip="Add More" matTooltipPosition="left" color="primary" *ngIf="last" align="center">
<strong>Add More Finished Goods </strong>
</button>
<button type="button" mat-flat-button (click)="deleteGoods(b,1)"
matTooltip="Delete"matTooltipPosition="left" color="primary" *ngIf="!last">
<!-- <button type="button" mat-flat-button (click)="deleteGoods(b,1)"
matTooltip="Delete"matTooltipPosition="left" color="primary" *ngIf="!last" align="center">
<strong>Delete Finished Goods </strong>
</button> -->
<button type="button" mat-raised-button mat-icon-button (click)="deleteGoods(b,1)"
matTooltip="Delete" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="!last" align="right">
<mat-icon>delete</mat-icon>
</button>
</mat-card-actions>
</mat-card>

View File

@ -51,12 +51,14 @@ export class StockComponent implements OnInit {
rawMaterialAccess: boolean;
finishedGoodsAccess: boolean;
tradeConcernAccess: boolean;
public submitted = false;
noRecordsFound: Boolean = false;
serviceProviderForm: Boolean = false;
suppliers_raw_materials : any = [];
suppliers_trade_details : any = [];
suppliers_finished_goods : any =[];
suppliers_service_product : any = [];
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
private router: Router,
@ -97,15 +99,66 @@ export class StockComponent implements OnInit {
// }, err => {
// this.notifier.notify('warning', 'There is No Type Of Activity Please Check Bussiness Information.!');
// })
// "Manufacturing"
// products
// :
// (2) ["Rwas1", "123"]
// type_of_activity_id
// :
// 2
//this._pd.getTypeofActivityForSuppliedInfoForm(this.pdid).subscribe(
// console.log(this.pdid);
// console.log(this.company_id);
this._pd.stockFormAccess(this.pdid,this.company_id).subscribe(data => {
console.log(data);
// console.log(data);
// console.log(data.record);
// return;
if(data.dataStatus == true){
let datas = data.records;
if(datas.type_of_activity != undefined){
this.initstockForms(datas.type_of_activity)
let tempcount = 0;
let datas = data.record;
let api = Object.keys(datas).map(function (key) {
return datas[key];
});
if(api.length > 0){
// for(let val of api){
// if (val.type_of_activity_id == 2) {
// let suppliers = datas.products;
// console.log(suppliers);
// }
// }
api.forEach(val => {
if (val.type_of_activity_id == 2) {
this.suppliers_raw_materials = val.products;
console.log(this.suppliers_raw_materials);
}
if (val.type_of_activity_id == 3) {
this.suppliers_finished_goods = val.products;
console.log(this.suppliers_finished_goods);
}
if (val.type_of_activity_id == 4) {
this.suppliers_trade_details = val.products;
console.log(this.suppliers_trade_details);
}
if (val.type_of_activity_id == 5) {
this.suppliers_service_product = val.products;
console.log(this.suppliers_service_product);
}
tempcount++;
});
console.log('tempcount',tempcount);
if(tempcount>0){
this.initstockForms(datas);
}
else{
this.notifier.notify('warning', 'Business Type Of Activity Not Available Please Check Business Information.!');
}
}
else{
this.notifier.notify('warning', 'Business Type Of Activity Not Available Please Check Business Information.!');
@ -127,6 +180,20 @@ export class StockComponent implements OnInit {
}
public initstockForms(record){
// console.log(record);
// {: 2, name: "Manufacturing", products: Array(2)}
// 1
// :
// {type_of_activity_id: 3, name: "Retail trading", products: Array(1)}
// 2
// :
// {type_of_activity_id: 4, name: "Wholesale Trade", products: Array(1)}
// 3
// :
// {type_of_activity_id: 5, name: "Service Provider", products: Array(1)}
let params: any = {};
params.pd_id = this.pdid;
params.pd_form_id = this.form_id;
@ -147,168 +214,27 @@ export class StockComponent implements OnInit {
let arr = record.filter(data => data.type_of_activity_id == 2);
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);
// console.log(3,dataForm.retail_details[0]);
// console.log(4,dataForm.retail_details[0].retail_finished_goods);
// console.log(5,dataForm.retail_details[0].retail_traded_goods);
//let retail_finished_goods;
// let manufacturing_raw_materials;
// let manufacturing_finished_goods;
// let manufacturing_traded_goods;
// if(dataForm.manufacturing_raw_materials !==undefined){
// manufacturing_raw_materials = Object.keys(dataForm.manufacturing_raw_materials).map(function (key) {
// return dataForm.manufacturing_raw_materials[key];
// });
// }
// if(dataForm.manufacturing_finished_goods !==undefined){
// manufacturing_finished_goods = Object.keys(dataForm.manufacturing_finished_goods).map(function (key) {
// return dataForm.manufacturing_finished_goods[key];
// });
// }
// else{
// manufacturing_finished_goods = null;
// }
// if(dataForm.manufacturing_traded_goods !==undefined){
// manufacturing_traded_goods = Object.keys(dataForm.manufacturing_traded_goods).map(function (key) {
// return dataForm.manufacturing_traded_goods[key];
// });
// }
// else{
// manufacturing_traded_goods = null;
// }
//console.log(retail_finished_goods,manufacturing_traded_goods);
// 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);
//this.initManufacturingDetails(dataForm);
}
let arr1 = record.filter(data => data.type_of_activity_id == 3);
if(arr1.length > 0) {
// let retail_finished_goods;
// let retail_traded_goods;
// if(dataForm.retail_traded_goods !==undefined){
// retail_traded_goods = Object.keys(dataForm.retail_traded_goods).map(function (key) {
// return dataForm.retail_traded_goods[key];
// });
// }
// else{
// retail_traded_goods = null;
// }
// if(dataForm.retail_finished_goods !==undefined)
// {
// retail_finished_goods = Object.keys(dataForm.retail_finished_goods).map(function(key)
// {
// return dataForm.retail_finished_goods[key];
// })
// }
// else{
// retail_finished_goods = null;
// }
// console.log(dataForm.retail_finished_goods);
// console.log(dataForm.retail_traded_goods);
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;
this.suppliers_finished_goods = value.records.trade_details[0].trading_products;
// this.suppliers_trade_details = value.records.trade_details[0].trading_products;
let retail_temparr = [];
retail_temparr['retail_traded_goods'] = dataForm.retail_details[0].retail_traded_goods;
retail_temparr['retail_finished_goods'] = dataForm.retail_details[0].retail_finished_goods;
this.initRetailDetails(retail_temparr);
}
else{
let retail_temparr = [];
retail_temparr['retail_traded_goods'] = dataForm.retail_details[0].retail_traded_goods;
retail_temparr['retail_finished_goods'] = dataForm.retail_details[0].retail_finished_goods;
this.initRetailDetails(retail_temparr);
}
});
// let retail_temparr = [];
// retail_temparr['retail_traded_goods'] = dataForm.retail_details[0].retail_traded_goods;
// retail_temparr['retail_finished_goods'] = dataForm.retail_details[0].retail_finished_goods;
// this.initRetailDetails(retail_temparr);
//this.initRetailDetails(dataForm);
//this.initRetailDetails(null);
}
let arr2 = record.filter(data => data.type_of_activity_id == 4);
if(arr2.length > 0) {
// let trading_finished_goods;
// let trading_traded_goods;
// if(dataForm.trading_finished_goods !==undefined){
// trading_finished_goods = Object.keys(dataForm.trading_finished_goods).map(function (key) {
// return dataForm.trading_finished_goods[key];
// });
// }
// else{
// trading_finished_goods = null;
// }
// if(dataForm.trading_traded_goods !==undefined)
// {
// trading_traded_goods = Object.keys(dataForm.trading_traded_goods).map(function(key)
// {
// return dataForm.trading_traded_goods[key];
// })
// }
// let trading_temparr = [];
// trading_temparr['trading_finished_goods'] = dataForm.trade_details[0].trading_finished_goods;
// trading_temparr['trading_traded_goods'] = dataForm.trade_details[0].trading_traded_goods;
// //this.initTradingDetails(trading_temparr);
// this.initTradingDetails(trading_temparr);
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;
this.suppliers_trade_details = value.records.trade_details[0].trading_products;
let trading_temparr = [];
trading_temparr['trading_finished_goods'] = dataForm.trade_details[0].trading_finished_goods;
trading_temparr['trading_traded_goods'] = dataForm.trade_details[0].trading_traded_goods;
this.initTradingDetails(trading_temparr);
}
else{
let trading_temparr = [];
trading_temparr['trading_finished_goods'] = dataForm.trade_details[0].trading_finished_goods;
trading_temparr['trading_traded_goods'] = dataForm.trade_details[0].trading_traded_goods;
//this.initTradingDetails(trading_temparr);
this.initTradingDetails(trading_temparr);
}
});
}
let arr3 = record.filter(data => data.type_of_activity_id == 5);
if(arr3.length > 0) {
@ -327,52 +253,30 @@ export class StockComponent implements OnInit {
retail_details : this.fb.array([this.retailFormCreation(record)]),
trade_details: this.fb.array([this.tradingFormCreation(record)]),
});
let arr = record.filter(data => data.type_of_activity_id == 1);
let arr = record.filter(data => data.type_of_activity_id == 2);
if(arr.length > 0) {
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);
let arr1 = record.filter(data => data.type_of_activity_id == 3);
if(arr1.length > 0) {
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.suppliers_finished_goods = value.records.trade_details[0].trading_products;
//trade_product_name;
this.initRetailDetails(null);
}
else{
this.initRetailDetails(null);
}
});
}
let arr2 = record.filter(data => data.type_of_activity_id == 3);
let arr2 = record.filter(data => data.type_of_activity_id == 4);
if(arr2.length > 0) {
// this.initTradingDetails(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.suppliers_finished_goods
this.suppliers_trade_details = value.records.trade_details[0].trading_products;
this.initTradingDetails(null);
}
else{
this.initTradingDetails(null);
}
});
this.initTradingDetails(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.suppliers_finished_goods
// this.suppliers_trade_details = value.records.trade_details[0].trading_products;
// this.initTradingDetails(null);
// }
// else{
// this.initTradingDetails(null);
// }
// });
}
let arr3 = record.filter(data => data.type_of_activity_id == 4);
let arr3 = record.filter(data => data.type_of_activity_id == 5);
if(arr3.length > 0) {
this.serviceProviderForm = true;
}
@ -388,46 +292,46 @@ export class StockComponent implements OnInit {
retail_details : this.fb.array([this.retailFormCreation(record)]),
trade_details: this.fb.array([this.tradingFormCreation(record)]),
});
let arr = record.filter(data => data.type_of_activity_id == 1);
let arr = record.filter(data => data.type_of_activity_id == 2);
if(arr.length > 0) {
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._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);
let arr1 = record.filter(data => data.type_of_activity_id == 3);
if(arr1.length > 0) {
this._pd.retriveForm({pd_id:this.pdid,pd_form_id:1}).subscribe(value => {
if(value.status == 200){
this.suppliers_finished_goods = value.records.trade_details[0].trading_products;
// value.records.manufacturing_details[0].main_raw_materials;
this.initRetailDetails(null);
}
else{
// this._pd.retriveForm({pd_id:this.pdid,pd_form_id:1}).subscribe(value => {
// if(value.status == 200){
// this.suppliers_finished_goods = value.records.trade_details[0].trading_products;
// // value.records.manufacturing_details[0].main_raw_materials;
// this.initRetailDetails(null);
// }
// else{
this.initRetailDetails(null);
}
});
// }
// });
}
let arr2 = record.filter(data => data.type_of_activity_id == 3);
let arr2 = record.filter(data => data.type_of_activity_id == 4);
if(arr2.length > 0) {
this._pd.retriveForm({pd_id:this.pdid,pd_form_id:1}).subscribe(value => {
if(value.status == 200){
this.suppliers_trade_details = value.records.trade_details[0].trading_products;
this.initTradingDetails(null);
}
else{
// this._pd.retriveForm({pd_id:this.pdid,pd_form_id:1}).subscribe(value => {
// if(value.status == 200){
// this.suppliers_trade_details = value.records.trade_details[0].trading_products;
// }
// else{
this.initTradingDetails(null);
}
});
// }
// this.initTradingDetails(null);
}
let arr3 = record.filter(data => data.type_of_activity_id == 4);
let arr3 = record.filter(data => data.type_of_activity_id == 5);
if(arr3.length > 0) {
this.serviceProviderForm = true;
}
@ -445,7 +349,7 @@ export class StockComponent implements OnInit {
manufacturingForm: Boolean = false;
manufacturingFormCreation(record) {
let arr = record.filter(data => data.type_of_activity_id == 1);
let arr = record.filter(data => data.type_of_activity_id == 2);
if (arr.length > 0) {
this.manufacturingForm = true;
return this.fb.group({
@ -462,7 +366,7 @@ export class StockComponent implements OnInit {
retailForm: Boolean = false;
retailFormCreation(val) {
let arr = val.filter(data => data.type_of_activity_id == 2);
let arr = val.filter(data => data.type_of_activity_id == 3);
if (arr.length > 0) {
this.retailForm = true;
return this.fb.group({
@ -477,7 +381,7 @@ retailFormCreation(val) {
tradingForm: Boolean = false;
tradingFormCreation(val) {
let arr = val.filter(data => data.type_of_activity_id == 3);
let arr = val.filter(data => data.type_of_activity_id == 4);
if (arr.length > 0) {
this.tradingForm = true;
return this.fb.group({
@ -502,9 +406,11 @@ tradingFormCreation(val) {
const tradedGoods = <FormArray>this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_traded_goods'];
const control = <FormArray>this.stockForms.controls['manufacturing_details']['controls'][0].controls['main_raw_materials'];
if(datas === null){
console.log('sdzsgfasdfasddfasdf');
console.log(this.suppliers_raw_materials);
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,
this.suppliers_raw_materials.forEach(val => {
let Ref_RawMaterials : any = {'raw_name': val,
'stock_observed':'',
'raw_quantity': '',
'raw_uom': '',
@ -513,14 +419,15 @@ tradingFormCreation(val) {
'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) {
let Ref_Finished_Goods : any = {'goods_name': val.trade_product_name,
// for (let val of this.suppliers_finished_goods) {
this.suppliers_finished_goods.forEach(val => {
let Ref_Finished_Goods : any = {'goods_name': val,
'goods_observed': '',
'goods_quantity': '',
'goods_uom': '',
@ -530,16 +437,16 @@ tradingFormCreation(val) {
'finishedgoods_remarks':''};
finishedGoods.push(this.createGoods(Ref_Finished_Goods));
// finishedGoods.push(this.createGoods(null));
}
});
}
else{
finishedGoods.push(this.createGoods(null));
}
if(this.suppliers_trade_details.length > 0){
for (let val of this.suppliers_trade_details) {
this.suppliers_trade_details.forEach(val => {
let Ref_Trade_Goods : any = {
'traded_goods_name': val.trade_product_name,
'traded_goods_name': val,
'traded_goods_observed': '',
'traded_goods_quantity': '',
'traded_goods_uom': '',
@ -548,7 +455,7 @@ tradingFormCreation(val) {
'is_sufficiant_traded_goods': '',
'traded_goods_remarks':''};
tradedGoods.push(this.createTradedGoods(Ref_Trade_Goods));
}
});
}
else{
tradedGoods.push(this.createTradedGoods(null));
@ -560,6 +467,7 @@ tradingFormCreation(val) {
// console.log(datas.manufacturing_raw_materials);
if(datas.manufacturing_raw_materials != undefined){
for (let val of datas.manufacturing_raw_materials) {
// console.log(val);
if(val.raw_value){
this.M_rawValueInWords = this._pd.convertNumberToWords(val.raw_value);
@ -644,8 +552,9 @@ tradingFormCreation(val) {
// finishedGoods.push(this.createGoods(null));
if(this.suppliers_finished_goods.length > 0){
for (let val of this.suppliers_finished_goods) {
let Ref_Finished_Goods : any = {'goods_name': val.trade_product_name,
// for (let val of this.suppliers_finished_goods) {
this.suppliers_finished_goods.forEach(val => {
let Ref_Finished_Goods : any = {'goods_name': val,
'goods_observed': '',
'goods_quantity': '',
'goods_uom': '',
@ -654,7 +563,7 @@ tradingFormCreation(val) {
'is_sufficiant_goods': '',
'finishedgoods_remarks':''};
finishedGoods.push(this.createGoods(Ref_Finished_Goods));
}
});
}
else{
finishedGoods.push(this.createGoods(null));
@ -662,9 +571,9 @@ tradingFormCreation(val) {
if(this.suppliers_trade_details.length > 0){
console.log(this.suppliers_trade_details);
for (let val of this.suppliers_trade_details) {
this.suppliers_trade_details.forEach(val => {
let Ref_Trade_Goods : any = {
'traded_goods_name': val.trade_product_name,
'traded_goods_name': val,
'traded_goods_observed': '',
'traded_goods_quantity': '',
'traded_goods_uom': '',
@ -673,7 +582,7 @@ tradingFormCreation(val) {
'is_sufficiant_traded_goods': '',
'traded_goods_remarks':''};
tradedGoods.push(this.createTradedGoods(Ref_Trade_Goods));
}
});
}
else{
tradedGoods.push(this.createTradedGoods(null));
@ -781,8 +690,9 @@ tradingFormCreation(val) {
// finishedGoods.push(this.createGoods(null));
// tradedGoods.push(this.createTradedGoods(null));
if(this.suppliers_finished_goods.length > 0){
for (let val of this.suppliers_finished_goods) {
let Ref_Finished_Goods : any = {'goods_name': val.trade_product_name,
// for (let val of this.suppliers_finished_goods) {
this.suppliers_finished_goods.forEach(val => {
let Ref_Finished_Goods : any = {'goods_name': val,
'goods_observed': '',
'goods_quantity': '',
'goods_uom': '',
@ -791,16 +701,17 @@ tradingFormCreation(val) {
'is_sufficiant_goods': '',
'finishedgoods_remarks':''};
finishedGoods.push(this.createGoods(Ref_Finished_Goods));
}
});
}
else{
finishedGoods.push(this.createGoods(null));
}
if(this.suppliers_trade_details.length > 0){
for (let val of this.suppliers_trade_details) {
// for (let val of this.suppliers_trade_details) {
this.suppliers_trade_details.forEach(val => {
let Ref_Trade_Goods : any = {
'traded_goods_name': val.trade_product_name,
'traded_goods_name': val,
'traded_goods_observed': '',
'traded_goods_quantity': '',
'traded_goods_uom': '',
@ -809,7 +720,7 @@ tradingFormCreation(val) {
'is_sufficiant_traded_goods': '',
'traded_goods_remarks':''};
tradedGoods.push(this.createTradedGoods(Ref_Trade_Goods));
}
});
}
else{
tradedGoods.push(this.createTradedGoods(null));

View File

@ -465,8 +465,8 @@ export class PdTrigerService {
* To Get The Products With TypeofActivity From Business
**/
stockFormAccess(pdid: any,companyid: any): Observable<any> {
// - { "pd_id":"104","company_id":"1"}
return this._http.post<any>(this.apiUrl + "getProductsWithTypeofActivityFromBusiness", { "records": { "pd_id" : pdid , "company_id":companyid} })
// { "pd_id":"104","company_id":"1"}
return this._http.post<any>(this.apiUrl + "getProductsFromBusiness", { "pd_id" : pdid , "company_id":companyid })
.pipe(
catchError(this.handleError('operation', []))
)