sheet changes : ps
This commit is contained in:
parent
e2c34445e5
commit
5d61a8e04e
@ -61,6 +61,7 @@
|
||||
<div *ngIf="addressForm.controls.locality.value == 1" fxFlex="33">
|
||||
<mat-form-field style="width: 85%;">
|
||||
<input matInput placeholder="Specify Locality *" formControlName="locality_others" autocomplete="off">
|
||||
<!-- autofocus -->
|
||||
<mat-error *ngIf="!addressForm.controls['locality_others'].valid">Locality Required</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
</mat-panel-title>
|
||||
</mat-expansion-panel-header>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Account Name" formControlName="applicant_name" [compareWith]="compareObjects" (selectionChange)="setRequiredValidation($event.values.id,itemrow,1)">
|
||||
<mat-select placeholder="Account Name" formControlName="applicant_name" [compareWith]="compareObjects" (selectionChange)="setRequiredValidation($event.value,itemrow,1)">
|
||||
<mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
|
||||
<mat-option *ngFor="let val of group.groupValues" [value]="val">
|
||||
{{val.name}}
|
||||
|
||||
@ -53,20 +53,20 @@
|
||||
<input matInput autocomplete="off" placeholder="Specify UOM" formControlName="other_uom" >
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:90%">
|
||||
<input matInput autocomplete="off" placeholder="Estimated Value of Stock Observed" formControlName="raw_value" (keypress)="keyPress($event)" (keyup)="inWords($event,1,a)" >
|
||||
<input matInput autocomplete="off" placeholder="Estimated Value of Stock Observed" formControlName="raw_value" (keypress)="keyPress($event)" (keyup)="inWords($event.target.value,1,a)" >
|
||||
<mat-hint align="start" style="font-size:70%" *ngIf="mrm.get('raw_value').value != ''">{{"₹"}} {{M_rawValueInWords[a]}} Only</mat-hint>
|
||||
</mat-form-field>
|
||||
<!-- <mat-form-field style="width:76%">
|
||||
<input matInput autocomplete="off" placeholder="Value of raw materials as per latest financial Statements" formControlName="rawmaterial_value" (keypress)="keyPress($event)" (keyup)="inWords($event,8,a)">
|
||||
<mat-hint align="start" style="font-size:70%" *ngIf="mrm.get('rawmaterial_value').value != ''">{{"₹"}} {{M_financialRawValueInWords[a]}} Only</mat-hint>
|
||||
<input matInput autocomplete="off" placeholder="Value of raw materials as per latest financial Statements" formControlName="rawmaterial_value" (keypress)="keyPress($event)">
|
||||
</mat-form-field> -->
|
||||
<mat-form-field style="width:90%">
|
||||
<mat-select placeholder="Is the stock of Raw Materials observed, sufficient considering the size of operations" formControlName="is_sufficiant_raw" >
|
||||
<mat-select placeholder="Is the stock of Raw Materials observed, sufficient considering the size of operations" formControlName="is_sufficiant_raw" (selectionChange)="checkComments($event.value,1,a)">
|
||||
<mat-option value="yes" >Yes</mat-option>
|
||||
<mat-option value="no" >No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="mrm.get('is_sufficiant_raw').value == 'no'" appearance="outline" style="width: 90%">
|
||||
<mat-form-field *ngIf="mrmCommentFlag[a]" appearance="outline" style="width: 90%">
|
||||
<!-- *ngIf="mrm.get('is_sufficiant_raw').value == 'no'" -->
|
||||
<mat-label> <i>Please comment on the stock level observed?</i> </mat-label>
|
||||
<textarea matInput autocomplete="off" placeholder="Please comment on the stock level observed" formControlName="rawmaterial_remarks"></textarea>
|
||||
</mat-form-field>
|
||||
@ -120,20 +120,20 @@
|
||||
<input matInput autocomplete="off" placeholder="Specify UOM" formControlName="goods_other_uom" >
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:90%">
|
||||
<input matInput autocomplete="off" placeholder="Estimated Value of Stock Observed" formControlName="goods_value" (keypress)="keyPress($event)" (keyup)="inWords($event,2,b)" >
|
||||
<input matInput autocomplete="off" placeholder="Estimated Value of Stock Observed" formControlName="goods_value" (keypress)="keyPress($event)" (keyup)="inWords($event.target.value,2,b)" >
|
||||
<mat-hint align="start" style="font-size:70%" *ngIf="mfg.get('goods_value').value != ''">{{"₹"}} {{M_goodsValueInWords[b]}} Only</mat-hint>
|
||||
</mat-form-field>
|
||||
<!-- <mat-form-field style="width:76%">
|
||||
<input matInput autocomplete="off" placeholder="Value of finished goods as per latest financial statements" formControlName="finished_goods_value" (keypress)="keyPress($event)" (keyup)="inWords($event,9,b)">
|
||||
<mat-hint align="start" style="font-size:70%" *ngIf="mfg.get('finished_goods_value').value != ''">{{"₹"}} {{M_financialGoodsValueInWords[b]}} Only</mat-hint>
|
||||
<input matInput autocomplete="off" placeholder="Value of finished goods as per latest financial statements" formControlName="finished_goods_value" (keypress)="keyPress($event)">
|
||||
</mat-form-field> -->
|
||||
<mat-form-field style="width:90%">
|
||||
<mat-select placeholder="Is the stock of Finished Goods Observed sufficient considering the size of operations?" formControlName="is_sufficiant_goods" >
|
||||
<mat-select placeholder="Is the stock of Finished Goods Observed sufficient considering the size of operations?" formControlName="is_sufficiant_goods" (selectionChange)="checkComments($event.value,2,b)">
|
||||
<mat-option value="yes" >Yes</mat-option>
|
||||
<mat-option value="no" >No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="mfg.get('is_sufficiant_goods').value == 'no'" appearance="outline" style="width: 90%">
|
||||
<mat-form-field *ngIf="mfgCommentFlag[b]" appearance="outline" style="width: 90%">
|
||||
<!-- *ngIf="mfg.get('is_sufficiant_goods').value == 'no'" -->
|
||||
<mat-label class="highlight"> <i>Please comment on the finished goods stock level observed?</i> </mat-label>
|
||||
<textarea matInput autocomplete="off" placeholder="Please comment on the finished goods observed" formControlName="finishedgoods_remarks"></textarea>
|
||||
</mat-form-field>
|
||||
@ -214,31 +214,31 @@
|
||||
<input matInput autocomplete="off" placeholder="Specify UOM" formControlName="traded_goods_other_uom" >
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:90%">
|
||||
<input matInput autocomplete="off" placeholder="Estimated Value of Stock Observed" formControlName="estimated_traded_goods_value" (keypress)="keyPress($event)" (keyup)="inWords($event,5,e)" >
|
||||
<input matInput autocomplete="off" placeholder="Estimated Value of Stock Observed" formControlName="estimated_traded_goods_value" (keypress)="keyPress($event)" (keyup)="inWords($event.target.value,3,e)" >
|
||||
<mat-hint align="start" style="font-size:70%" *ngIf="item.get('estimated_traded_goods_value').value != ''">{{"₹"}} {{R_tradedGoodsValueInWords[e]}} Only</mat-hint>
|
||||
</mat-form-field>
|
||||
<!-- <mat-form-field style="width:76%">
|
||||
<input matInput autocomplete="off" placeholder="Value of traded goods as per latest financial statements" formControlName="traded_goods_value" (keypress)="keyPress($event)" (keyup)="inWords($event,12,e)">
|
||||
<mat-hint align="start" style="font-size:70%" *ngIf="item.get('traded_goods_value').value != ''">{{"₹"}} {{R_financialTradedGoodsValueInWords[e]}} Only</mat-hint>
|
||||
<input matInput autocomplete="off" placeholder="Value of traded goods as per latest financial statements" formControlName="traded_goods_value" (keypress)="keyPress($event)">
|
||||
</mat-form-field> -->
|
||||
<mat-form-field style="width:90%">
|
||||
|
||||
<mat-select placeholder="Is the stock of Traded goods observed ?" formControlName="is_sufficiant_traded_goods" >
|
||||
<mat-select placeholder="Is the stock of Traded goods observed ?" formControlName="is_sufficiant_traded_goods" (selectionChange)="checkComments($event.value,3,e)">
|
||||
<mat-option value="yes" >Yes</mat-option>
|
||||
<mat-option value="no" >No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="item.get('is_sufficiant_traded_goods').value == 'no'" appearance="outline" style="width: 90%">
|
||||
<mat-form-field *ngIf="rtrdCommentFlag[e]" appearance="outline" style="width: 90%">
|
||||
<!-- *ngIf="item.get('is_sufficiant_traded_goods').value == 'no'" -->
|
||||
<mat-label> <i>Please comment on the Traded Goods stock level observed?</i> </mat-label>
|
||||
<textarea matInput autocomplete="off" placeholder="Please comment on the traded goods stock level observed" formControlName="traded_goods_remarks"></textarea>
|
||||
</mat-form-field>
|
||||
</span>
|
||||
|
||||
<!-- <button type="button" mat-raised-button mat-icon-button (click)="addTradedGoods(2)"
|
||||
<!-- <button type="button" mat-raised-button mat-icon-button (click)=""
|
||||
matTooltip="Add More Traded Goods" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" *ngIf="e==0">
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="deleteTradedGoods(e,2)"
|
||||
<button type="button" mat-raised-button mat-icon-button (click)=""
|
||||
matTooltip="Delete" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="e>0">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button> -->
|
||||
@ -246,13 +246,13 @@
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
<div align="right">
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="deleteTradedGoods(e,2)"
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="deleteTradedGoods(e,1)"
|
||||
matTooltip="Delete Traded Goods" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="rd.controls.retail_traded_goods.controls.length>1">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
<div align="center">
|
||||
<button type="button" mat-flat-button (click)="addTradedGoods(2)"
|
||||
<button type="button" mat-flat-button (click)="addTradedGoods(1)"
|
||||
matTooltip="Add More" matTooltipPosition="left" color="primary" *ngIf="last">
|
||||
<strong>Add More Traded Goods </strong>
|
||||
</button>
|
||||
@ -304,31 +304,31 @@
|
||||
<input matInput autocomplete="off" placeholder="Specify UOM" formControlName="traded_goods_other_uom" >
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:90%">
|
||||
<input matInput autocomplete="off" placeholder="Estimated Value of Stock Observed" formControlName="estimated_traded_goods_value" (keypress)="keyPress($event)" (keyup)="inWords($event,7,g)">
|
||||
<input matInput autocomplete="off" placeholder="Estimated Value of Stock Observed" formControlName="estimated_traded_goods_value" (keypress)="keyPress($event)" (keyup)="inWords($event.target.value,4,g)">
|
||||
<mat-hint align="start" style="font-size:70%" *ngIf="tradetg.get('estimated_traded_goods_value').value != ''">{{"₹"}} {{T_tradedGoodsValueInWords[g]}} Only</mat-hint>
|
||||
</mat-form-field>
|
||||
<!-- <mat-form-field style="width:76%">
|
||||
<input matInput autocomplete="off" placeholder="Value of traded goods as per latest financial statements" formControlName="traded_goods_value" (keypress)="keyPress($event)" (keyup)="inWords($event,14,g)">
|
||||
<mat-hint align="start" style="font-size:70%" *ngIf="tradetg.get('traded_goods_value').value != ''">{{"₹"}} {{T_financialTradedGoodsValueInWords[g]}} Only</mat-hint>
|
||||
<input matInput autocomplete="off" placeholder="Value of traded goods as per latest financial statements" formControlName="traded_goods_value" (keypress)="keyPress($event)">
|
||||
</mat-form-field> -->
|
||||
<mat-form-field style="width:90%">
|
||||
<!-- <input matInput autocomplete="off" placeholder="Is the stock of finished goods observed ?" formControlName="is_sufficiant_goods" > -->
|
||||
<mat-select placeholder="Is the stock of Traded goods observed ?" formControlName="is_sufficiant_traded_goods" >
|
||||
<mat-select placeholder="Is the stock of Traded goods observed ?" formControlName="is_sufficiant_traded_goods" (selectionChange)="checkComments($event.value,4,g)">
|
||||
<mat-option value="yes" >Yes</mat-option>
|
||||
<mat-option value="no" >No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="tradetg.get('is_sufficiant_traded_goods').value == 'no'" appearance="outline" style="width: 90%">
|
||||
<mat-form-field *ngIf="wtrdCommentFlag[g]" appearance="outline" style="width: 90%">
|
||||
<!-- //*ngIf="tradetg.get('is_sufficiant_traded_goods').value == 'no'" -->
|
||||
<mat-label> <i>Please comment on the Traded Goods stock level observed?</i> </mat-label>
|
||||
<textarea matInput autocomplete="off" placeholder="Please comment on the traded goods stock level observed" formControlName="traded_goods_remarks"></textarea>
|
||||
</mat-form-field>
|
||||
</span>
|
||||
|
||||
<!-- <button type="button" mat-raised-button mat-icon-button (click)="addTradedGoods(3)"
|
||||
<!-- <button type="button" mat-raised-button mat-icon-button (click)=""
|
||||
matTooltip="Add More Traded Goods" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" *ngIf="g==0">
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="deleteTradedGoods(g,3)"
|
||||
<button type="button" mat-raised-button mat-icon-button (click)=""
|
||||
matTooltip="Delete" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="g>0">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button> -->
|
||||
@ -336,13 +336,13 @@
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
<div align="center">
|
||||
<button type="button" mat-flat-button (click)="addTradedGoods(3)"
|
||||
<button type="button" mat-flat-button (click)="addTradedGoods(2)"
|
||||
matTooltip="Add More" matTooltipPosition="left" color="primary" *ngIf="last">
|
||||
<strong>Add More Traded Goods </strong>
|
||||
</button>
|
||||
</div>
|
||||
<div align="right">
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="deleteTradedGoods(g,3)"
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="deleteTradedGoods(g,2)"
|
||||
matTooltip="Delete Traded Goods" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="td.controls.trading_traded_goods.controls.length>1">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
@ -483,8 +483,11 @@
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div *ngIf="!noRecordsFound"> <i> Loading... </i> </div>
|
||||
{{ errorMessage }}
|
||||
<!-- <div *ngIf="!noRecordsFound"> <i> {{ errorMessage }} </i> </div> -->
|
||||
<div *ngIf="!noRecordsFound" align="center"> <i> Fill Business Form First! / No Company Found at this ID {{company_id}}! .... </i> </div>
|
||||
<notifier-container></notifier-container>
|
||||
|
||||
<!-- <mat-card style="padding: 12px;">
|
||||
<p>Stock Details</p>
|
||||
<form [formGroup]="stockForms" class="address"> -->
|
||||
|
||||
@ -18,68 +18,74 @@ import { analyzeAndValidateNgModules } from '@angular/compiler';
|
||||
})
|
||||
|
||||
export class StockComponent implements OnInit {
|
||||
|
||||
pageTitle: string ="Stock Details";
|
||||
|
||||
private notifier: NotifierService;
|
||||
|
||||
public stockForms: FormGroup;
|
||||
|
||||
public uomData : any = [];
|
||||
|
||||
public submitted = false;
|
||||
|
||||
noRecordsFound: Boolean;
|
||||
errorMessage: any = '';
|
||||
|
||||
customer_segment_abbr: any;
|
||||
subproduct_abbr: any;
|
||||
lender_applicant_id: any;
|
||||
main_applicant: any;
|
||||
|
||||
pageTitle: string ="Stock Details";
|
||||
pdid: number;
|
||||
form_id: number;
|
||||
company_id: string;
|
||||
public stockForms: FormGroup;
|
||||
private notifier: NotifierService;
|
||||
public uomData : any = [];
|
||||
|
||||
rawmaterial : any;
|
||||
|
||||
M_rawValueInWords : any = [];
|
||||
// M_financialRawValueInWords : any = [];
|
||||
|
||||
M_goodsValueInWords : any = [];
|
||||
R_goodsValueInWords : any = [];
|
||||
T_goodsValueInWords : any = [];
|
||||
|
||||
// M_financialGoodsValueInWords : any = [];
|
||||
// R_financialGoodsValueInWords : any = [];
|
||||
// T_financialGoodsValueInWords : any = [];
|
||||
// rawmaterial : any;
|
||||
|
||||
M_tradedGoodsValueInWords : any = [];
|
||||
M_rawValueInWords : any = [];
|
||||
M_goodsValueInWords : any = [];
|
||||
R_tradedGoodsValueInWords : any = [];
|
||||
T_tradedGoodsValueInWords : any = [];
|
||||
|
||||
// M_financialTradedGoodsValueInWords : any = [];
|
||||
// R_financialTradedGoodsValueInWords : any = [];
|
||||
// T_financialTradedGoodsValueInWords : any = [];
|
||||
|
||||
rawMaterialAccess: Boolean = false;
|
||||
finishedGoodsAccess: Boolean = false;
|
||||
tradeConcernAccess: Boolean = false;
|
||||
serviceAccess: Boolean = false;
|
||||
public submitted = false;
|
||||
noRecordsFound: Boolean = false;
|
||||
// rawMaterialAccess: Boolean = false;
|
||||
// finishedGoodsAccess: Boolean = false;
|
||||
// tradeConcernAccess: Boolean = false;
|
||||
// serviceAccess: Boolean = false;
|
||||
|
||||
mrmCommentFlag:any=[];
|
||||
mfgCommentFlag:any=[];
|
||||
rtrdCommentFlag:any=[];
|
||||
wtrdCommentFlag:any=[];
|
||||
|
||||
serviceProviderForm: Boolean = false;
|
||||
suppliers_raw_materials : any = [];
|
||||
suppliers_retail_trade_details : any = [];
|
||||
suppliers_wholesale_trade_details : any = [];
|
||||
suppliers_finished_goods : any =[];
|
||||
suppliers_service_product : any = [];
|
||||
// suppliers_service_product : any = [];
|
||||
|
||||
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
|
||||
/** Constructor */
|
||||
constructor(notifier: NotifierService,
|
||||
private fb: FormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dialogRef: MatDialogRef<StockComponent>,
|
||||
private _pd: PdTrigerService,@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
|
||||
private _pd: PdTrigerService,@Inject(MAT_DIALOG_DATA)
|
||||
public pd_all_details: any) {
|
||||
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
|
||||
this.form_id = 11;
|
||||
this.company_id = this.pd_all_details.company_id;
|
||||
this.notifier = notifier;
|
||||
this.pageTitle = this.pd_all_details.company_name + ' - ' +this.pageTitle ;
|
||||
this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant;
|
||||
this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id;
|
||||
this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr;
|
||||
this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr;
|
||||
this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id;
|
||||
this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr;
|
||||
this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr;
|
||||
}
|
||||
|
||||
/** CSS For Docs Testing */
|
||||
public viewerOptions: any = {
|
||||
navbar: false,
|
||||
toolbar: {
|
||||
@ -103,36 +109,39 @@ export class StockComponent implements OnInit {
|
||||
ngOnInit() {
|
||||
|
||||
this._pd.stockFormAccess(this.pdid,this.company_id).subscribe(data => {
|
||||
console.log(data);
|
||||
if(data.dataStatus == true){
|
||||
console.log(data.record);
|
||||
this.initstockForms(data.record);
|
||||
}
|
||||
else if(data.dataStatus == false)
|
||||
{
|
||||
this.notifier.notify('warning', 'Fill Business Form First! / No Company Found at this ID '+ this.company_id );
|
||||
this.noRecordsFound = false;
|
||||
this.errorMessage = 'Fill Business Form First! / No Company Found at this ID' + this.company_id +'! ....';
|
||||
return;
|
||||
}
|
||||
else{
|
||||
this.notifier.notify('warning', 'Fill Business Form First! / No Company Found at this ID '+ this.company_id );
|
||||
this.noRecordsFound = false;
|
||||
this.errorMessage = 'Fill Business Form First! / No Company Found at this ID' + this.company_id +'! ....';
|
||||
return;
|
||||
}
|
||||
}, err => {
|
||||
this.notifier.notify('warning', 'Business Type Of Activity Not Available Please Check Business Information.!');
|
||||
this.noRecordsFound = false;
|
||||
this.errorMessage = 'No Records Found , Something went Wrong!';
|
||||
})
|
||||
|
||||
this.getUOM();
|
||||
this.getUOM();
|
||||
|
||||
}
|
||||
|
||||
public initstockForms(record){
|
||||
console.log(record);
|
||||
|
||||
let api = Object.keys(record.from_business).map(function (key) {
|
||||
return record.from_business[key];
|
||||
});
|
||||
let rm_api = record.from_supplier;
|
||||
console.log('rm_api',rm_api.length);
|
||||
|
||||
let params: any = {};
|
||||
params.pd_id = this.pdid;
|
||||
@ -142,52 +151,47 @@ export class StockComponent implements OnInit {
|
||||
if (value.status == 200) {
|
||||
let dataForm = value.records;
|
||||
if(dataForm !== undefined) {
|
||||
this.stockForms = this.fb.group({
|
||||
pdid: [this.pdid],
|
||||
formid: [this.form_id],
|
||||
company_id: [this.company_id],
|
||||
stock_remarks: [''],
|
||||
manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]),
|
||||
retail_details : this.fb.array([this.retailFormCreation(api)]),
|
||||
trade_details: this.fb.array([this.tradingFormCreation(api)]),
|
||||
});
|
||||
|
||||
|
||||
if(api.length > 0){
|
||||
api.forEach(val => {
|
||||
if (val.type_of_activity_id == 2) {
|
||||
// if(){}
|
||||
if(val.products){
|
||||
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;
|
||||
this.initManufacturingDetails(manufacturing_temparr);
|
||||
}
|
||||
}
|
||||
if (val.type_of_activity_id == 3) {
|
||||
if(val.products){
|
||||
let retail_temparr = [];
|
||||
retail_temparr['retail_traded_goods'] = dataForm.retail_details[0].retail_traded_goods;
|
||||
this.initRetailDetails(retail_temparr);
|
||||
}
|
||||
}
|
||||
if (val.type_of_activity_id == 4) {
|
||||
if(val.products){
|
||||
let trading_temparr = [];
|
||||
trading_temparr['trading_traded_goods'] = dataForm.trade_details[0].trading_traded_goods;
|
||||
this.initTradingDetails(trading_temparr);
|
||||
}
|
||||
}
|
||||
if (val.type_of_activity_id == 5) {
|
||||
if(val.products){
|
||||
this.serviceProviderForm = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
this.stockForms = this.fb.group({
|
||||
pdid: [this.pdid],
|
||||
formid: [this.form_id],
|
||||
company_id: [this.company_id],
|
||||
stock_remarks: [''],
|
||||
manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]),
|
||||
retail_details : this.fb.array([this.retailFormCreation(api)]),
|
||||
trade_details: this.fb.array([this.tradingFormCreation(api)]),
|
||||
});
|
||||
if(api.length > 0){
|
||||
api.forEach(val => {
|
||||
if (val.type_of_activity_id == 2) {
|
||||
if(val.products){
|
||||
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;
|
||||
this.initManufacturingDetails(manufacturing_temparr);
|
||||
}
|
||||
}
|
||||
if (val.type_of_activity_id == 3) {
|
||||
if(val.products){
|
||||
let retail_temparr = [];
|
||||
retail_temparr['retail_traded_goods'] = dataForm.retail_details[0].retail_traded_goods;
|
||||
this.initRetailDetails(retail_temparr);
|
||||
}
|
||||
}
|
||||
if (val.type_of_activity_id == 4) {
|
||||
if(val.products){
|
||||
let trading_temparr = [];
|
||||
trading_temparr['trading_traded_goods'] = dataForm.trade_details[0].trading_traded_goods;
|
||||
this.initTradingDetails(trading_temparr);
|
||||
}
|
||||
}
|
||||
if (val.type_of_activity_id == 5) {
|
||||
if(val.products){
|
||||
this.serviceProviderForm = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
this.noRecordsFound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
||||
@ -223,7 +227,7 @@ export class StockComponent implements OnInit {
|
||||
}
|
||||
if (val.type_of_activity_id == 5) {
|
||||
if(val.products){
|
||||
this.suppliers_service_product = val.products;
|
||||
// this.suppliers_service_product = val.products;
|
||||
this.serviceProviderForm = true;
|
||||
}
|
||||
|
||||
@ -267,28 +271,22 @@ export class StockComponent implements OnInit {
|
||||
}
|
||||
if (val.type_of_activity_id == 5) {
|
||||
if(val.products){
|
||||
this.suppliers_service_product = val.products;
|
||||
// this.suppliers_service_product = val.products;
|
||||
this.serviceProviderForm = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
this.noRecordsFound = true;
|
||||
}
|
||||
this.noRecordsFound = true;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
manufacturingForm: Boolean = false;
|
||||
manufacturingFormCreation(record) {
|
||||
console.log('record',record);
|
||||
|
||||
let arr = record.from_business.filter(data => data.type_of_activity_id == 2);
|
||||
let rm_arr = record.from_supplier;
|
||||
console.log(rm_arr);
|
||||
console.log(rm_arr.length);
|
||||
|
||||
if (arr.length > 0) {
|
||||
this.manufacturingForm = true;
|
||||
@ -303,7 +301,7 @@ export class StockComponent implements OnInit {
|
||||
|
||||
retailForm: Boolean = false;
|
||||
retailFormCreation(val) {
|
||||
console.log(val,'val');
|
||||
|
||||
let arr = val.filter(data => data.type_of_activity_id == 3);
|
||||
if (arr.length > 0) {
|
||||
this.retailForm = true;
|
||||
@ -329,11 +327,6 @@ tradingFormCreation(val) {
|
||||
}
|
||||
}
|
||||
|
||||
//setSku(sku: string, index: number) {
|
||||
// const faControl =
|
||||
// (<FormArray>this.stockForms.controls['raw_materials']).at(index);
|
||||
// faControl['controls'].raw_name.setValue(sku);
|
||||
// }
|
||||
|
||||
initManufacturingDetails(datas) {
|
||||
|
||||
@ -384,11 +377,10 @@ tradingFormCreation(val) {
|
||||
if(datas.manufacturing_raw_materials != undefined){
|
||||
// for (let val of datas.manufacturing_raw_materials) {
|
||||
datas.manufacturing_raw_materials.forEach((val,index) => {
|
||||
|
||||
if(val.raw_value){
|
||||
this.M_rawValueInWords[index] = this._pd.convertNumberToWords(val.raw_value);
|
||||
// this.M_financialRawValueInWords = this._pd.convertNumberToWords(val.rawmaterial_value);
|
||||
this.inWords(val.raw_value,1,index);
|
||||
}
|
||||
this.checkComments(val.is_sufficiant_raw,1,index);
|
||||
rawMaterial.push(this.createRawmaterial(val));
|
||||
});
|
||||
}
|
||||
@ -400,9 +392,9 @@ tradingFormCreation(val) {
|
||||
datas.manufacturing_finished_goods.forEach((val,index) => {
|
||||
|
||||
if(val.goods_value){
|
||||
this.M_goodsValueInWords[index] = this._pd.convertNumberToWords(val.goods_value);
|
||||
// this.M_financialGoodsValueInWords = this._pd.convertNumberToWords(val.finished_goods_value);
|
||||
this.inWords(val.goods_value,2,index);
|
||||
}
|
||||
this.checkComments(val.is_sufficiant_goods,2,index);
|
||||
finishedGoods.push(this.createGoods(val));
|
||||
|
||||
});
|
||||
@ -452,7 +444,7 @@ tradingFormCreation(val) {
|
||||
if(datas === null){
|
||||
|
||||
if(this.suppliers_retail_trade_details.length > 0){
|
||||
this.rawMaterialAccess = true;
|
||||
// this.rawMaterialAccess = true;
|
||||
|
||||
this.suppliers_retail_trade_details.forEach(val => {
|
||||
let Ref_Trade_Goods : any = {
|
||||
@ -477,9 +469,9 @@ tradingFormCreation(val) {
|
||||
datas.retail_traded_goods.forEach((val,index) => {
|
||||
|
||||
if(val.estimated_traded_goods_value){
|
||||
this.R_tradedGoodsValueInWords[index] = this._pd.convertNumberToWords(val.estimated_traded_goods_value);
|
||||
// this.R_financialTradedGoodsValueInWords =this._pd.convertNumberToWords(val.traded_goods_value);
|
||||
this.inWords(val.estimated_traded_goods_value,3,index);
|
||||
}
|
||||
this.checkComments(val.is_sufficiant_traded_goods,3,index);
|
||||
tradedGoods.push(this.createTradedGoods(val));
|
||||
|
||||
});
|
||||
@ -490,17 +482,17 @@ tradingFormCreation(val) {
|
||||
}
|
||||
}
|
||||
|
||||
createGoods2() {
|
||||
return this.fb.group({
|
||||
goods_name: [''],
|
||||
goods_observed: [''],
|
||||
goods_quantity: [''],
|
||||
goods_value: [''],
|
||||
finished_goods_value: [''],
|
||||
is_sufficiant_goods: [''],
|
||||
finishedgoods_remarks:['']
|
||||
});
|
||||
}
|
||||
// createGoods2() {
|
||||
// return this.fb.group({
|
||||
// goods_name: [''],
|
||||
// goods_observed: [''],
|
||||
// goods_quantity: [''],
|
||||
// goods_value: [''],
|
||||
// finished_goods_value: [''],
|
||||
// is_sufficiant_goods: [''],
|
||||
// finishedgoods_remarks:['']
|
||||
// });
|
||||
// }
|
||||
|
||||
createGoods(records) {
|
||||
if(records === null) {
|
||||
@ -532,19 +524,19 @@ tradingFormCreation(val) {
|
||||
}
|
||||
|
||||
|
||||
createTradedGoods2() {
|
||||
return this.fb.group({
|
||||
traded_goods_name: [''],
|
||||
traded_goods_observed: [''],
|
||||
traded_goods_quantity: [''],
|
||||
traded_goods_uom: [''],
|
||||
traded_goods_other_uom: [''],
|
||||
estimated_traded_goods_value: [''],
|
||||
// traded_goods_value: [''],
|
||||
is_sufficiant_traded_goods: [''],
|
||||
traded_goods_remarks:['']
|
||||
});
|
||||
}
|
||||
// createTradedGoods2() {
|
||||
// return this.fb.group({
|
||||
// traded_goods_name: [''],
|
||||
// traded_goods_observed: [''],
|
||||
// traded_goods_quantity: [''],
|
||||
// traded_goods_uom: [''],
|
||||
// traded_goods_other_uom: [''],
|
||||
// estimated_traded_goods_value: [''],
|
||||
// // traded_goods_value: [''],
|
||||
// is_sufficiant_traded_goods: [''],
|
||||
// traded_goods_remarks:['']
|
||||
// });
|
||||
// }
|
||||
|
||||
initTradingDetails(datas) {
|
||||
const tradedGoods = <FormArray>this.stockForms.controls['trade_details']['controls'][0].controls['trading_traded_goods'];
|
||||
@ -577,9 +569,9 @@ tradingFormCreation(val) {
|
||||
datas.trading_traded_goods.forEach((val,index) => {
|
||||
|
||||
if(val.estimated_traded_goods_value){
|
||||
this.T_tradedGoodsValueInWords[index] = this._pd.convertNumberToWords(val.estimated_traded_goods_value);
|
||||
// this.T_financialTradedGoodsValueInWords =this._pd.convertNumberToWords(val.traded_goods_value);
|
||||
this.inWords(val.estimated_traded_goods_value,4,index);
|
||||
}
|
||||
this.checkComments(val.is_sufficiant_traded_goods,4,index);
|
||||
tradedGoods.push(this.createTradedGoods(val));
|
||||
});
|
||||
}
|
||||
@ -619,78 +611,52 @@ tradingFormCreation(val) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
addRawMaterials(flag) {
|
||||
|
||||
/** Manufacturing -> To Add More Raw Material Details */
|
||||
addRawMaterials(flag) {
|
||||
if(flag==1){
|
||||
const control = <FormArray>this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_raw_materials'];
|
||||
control.push(this.createRawmaterial(null));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Manufacturing -> To Remove Raw Material Details */
|
||||
deleteRawMaterials(index,flag) {
|
||||
if(flag==1){
|
||||
const control = <FormArray>this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_raw_materials'];
|
||||
// const control = <FormArray>this.stockForms.controls['raw_materials'];
|
||||
control.removeAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
/** Manufacturing -> To Add More Finished Goods */
|
||||
addGoods(flag) {
|
||||
//const control = <FormArray>this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods'];
|
||||
//const control = <FormArray>this.stockForms.controls['finished_goods'];
|
||||
//control.push(this.createGoods(null));
|
||||
switch(flag){
|
||||
case 1: {
|
||||
if(flag == 1){
|
||||
const control = <FormArray>this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods'];
|
||||
control.push(this.createGoods(null));
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
deleteGoods(index,flag) {
|
||||
switch(flag){
|
||||
case 1: {
|
||||
const control = <FormArray>this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods'];
|
||||
control.removeAt(index);
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
//const control = <FormArray>this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods'];
|
||||
//const control = <FormArray>this.stockForms.controls['finished_goods'];
|
||||
}
|
||||
|
||||
/** Manufacturing -> To Remove Finished Goods */
|
||||
deleteGoods(index,flag) {
|
||||
if(flag == 1){
|
||||
const control = <FormArray>this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods'];
|
||||
control.removeAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Case 1 Retail Traded -> To Add More trade Goods
|
||||
* Case 2 wholesale Traded -> To Add More trade Goods
|
||||
*/
|
||||
addTradedGoods(flag) {
|
||||
switch(flag){
|
||||
|
||||
case 1: {
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
const control = <FormArray>this.stockForms.controls['retail_details']['controls'][0].controls['retail_traded_goods'];
|
||||
control.push(this.createTradedGoods(null));
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
case 2: {
|
||||
const control = <FormArray>this.stockForms.controls['trade_details']['controls'][0].controls['trading_traded_goods'];
|
||||
control.push(this.createTradedGoods(null));
|
||||
break;
|
||||
@ -700,17 +666,19 @@ tradingFormCreation(val) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Case 1 Retail Traded -> To remove trade Goods
|
||||
* Case 2 wholesale Traded -> To remove trade Goods
|
||||
*/
|
||||
deleteTradedGoods(index,flag) {
|
||||
switch(flag){
|
||||
case 1:{
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
case 1: {
|
||||
const control = <FormArray>this.stockForms.controls['retail_details']['controls'][0].controls['retail_traded_goods'];
|
||||
control.removeAt(index);
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
case 2: {
|
||||
const control = <FormArray>this.stockForms.controls['trade_details']['controls'][0].controls['trading_traded_goods'];
|
||||
control.removeAt(index);
|
||||
break;
|
||||
@ -729,10 +697,10 @@ tradingFormCreation(val) {
|
||||
submitDetails(e) {
|
||||
this.submitted = true;
|
||||
// stop here if form is invalid
|
||||
// if (this.stockForms.invalid) {
|
||||
// this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
|
||||
// return;
|
||||
// } else {
|
||||
if (this.stockForms.invalid) {
|
||||
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
|
||||
return;
|
||||
} else {
|
||||
var answerFormValues = this.stockForms.value;
|
||||
|
||||
//To Remove The "Null" With Key also
|
||||
@ -755,7 +723,7 @@ tradingFormCreation(val) {
|
||||
|
||||
});
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
// validateAllFormFields(formGroup: FormGroup) {
|
||||
@ -795,49 +763,50 @@ tradingFormCreation(val) {
|
||||
|
||||
switch(flag){
|
||||
case 1 :
|
||||
this.M_rawValueInWords[i] = this._pd.convertNumberToWords(e.target.value);
|
||||
this.M_rawValueInWords[i] = this._pd.convertNumberToWords(e);
|
||||
break;
|
||||
case 2 :
|
||||
this.M_goodsValueInWords[i] = this._pd.convertNumberToWords(e.target.value);
|
||||
this.M_goodsValueInWords[i] = this._pd.convertNumberToWords(e);
|
||||
break;
|
||||
case 3 :
|
||||
this.M_tradedGoodsValueInWords[i] = this._pd.convertNumberToWords(e.target.value);
|
||||
this.R_tradedGoodsValueInWords[i] = this._pd.convertNumberToWords(e);
|
||||
break;
|
||||
case 4 :
|
||||
this.R_goodsValueInWords[i] = this._pd.convertNumberToWords(e.target.value);
|
||||
this.T_tradedGoodsValueInWords[i] = this._pd.convertNumberToWords(e);
|
||||
break;
|
||||
case 5 :
|
||||
this.R_tradedGoodsValueInWords[i] = this._pd.convertNumberToWords(e.target.value);
|
||||
break;
|
||||
case 6 :
|
||||
this.T_goodsValueInWords[i] = this._pd.convertNumberToWords(e.target.value);
|
||||
break;
|
||||
case 7 :
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
checkComments(e,flag,index){
|
||||
// console.log(e);
|
||||
// console.log(flag);
|
||||
// console.log(index);
|
||||
if(flag == 1 && e=='no'){
|
||||
this.mrmCommentFlag[index] = true;
|
||||
}
|
||||
else if(flag == 1 && e!='no'){
|
||||
this.mrmCommentFlag[index] = false;
|
||||
}
|
||||
if(flag == 2 && e=='no'){
|
||||
this.mfgCommentFlag[index] = true;
|
||||
}
|
||||
else if(flag == 2 && e!='no'){
|
||||
this.mfgCommentFlag[index] = false;
|
||||
}
|
||||
if(flag == 3 && e=='no'){
|
||||
this.rtrdCommentFlag[index] = true;
|
||||
}
|
||||
else if(flag == 3 && e!='no'){
|
||||
this.rtrdCommentFlag[index] = false;
|
||||
}
|
||||
if(flag == 4 && e=='no'){
|
||||
this.wtrdCommentFlag[index] = true;
|
||||
}
|
||||
else if(flag == 4 && e!='no'){
|
||||
this.wtrdCommentFlag[index] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -89,6 +89,7 @@ export class SupplierInfoComponent implements OnInit {
|
||||
errorMessage: any = '';
|
||||
ngOnInit() {
|
||||
this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid, this.company_id).subscribe(data => {
|
||||
console.log(data);
|
||||
if(data.dataStatus){
|
||||
// let datas = {
|
||||
// "profession_name": "Others",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user