stock : ps
This commit is contained in:
parent
da7fff44d4
commit
6bea95b55d
@ -68,7 +68,7 @@
|
||||
</span>
|
||||
<mat-form-field *ngIf="i != 0" style="width:65%">
|
||||
<input matInput [ngClass]="{'highlight': (details.controls['financial_variation'].value > 40) || (details.controls['financial_variation'].value < -40)}" placeholder="Variation from Previous Year" formControlName="financial_variation" (keypress)="keyPress($event)">
|
||||
<mat-hint align="end" *ngIf="i != 0" [ngClass]="{'highlight': (details.controls['financial_variation'].value > 40) || (details.controls['financial_variation'].value < -40)}" >{{SalesStatement[i]}}</mat-hint>
|
||||
<!-- <mat-hint align="end" *ngIf="i != 0" [ngClass]="{'highlight': (details.controls['financial_variation'].value > 40) || (details.controls['financial_variation'].value < -40)}" >{{SalesStatement[i]}}</mat-hint> -->
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field *ngIf="customerCommentsFlag" style="width:65%">
|
||||
|
||||
@ -459,15 +459,17 @@ export class FinancialInfoComponent implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
calAmount(index, detail) {
|
||||
|
||||
calAmount(i, detail) {
|
||||
|
||||
console.log(detail);
|
||||
|
||||
let salary = detail.value.estimate_annual_sale;
|
||||
|
||||
if(detail.value.estimate_profit_or_loss == 1){
|
||||
|
||||
// let profit = detail.value.estimate_net_profit;
|
||||
let margin_profit = detail.value.estimate_margin_of_profit;
|
||||
if(detail.value.estimate_profit_or_loss == 1){
|
||||
|
||||
// let profit = detail.value.estimate_net_profit;
|
||||
let margin_profit = detail.value.estimate_margin_of_profit;
|
||||
|
||||
if (salary != '' && margin_profit != '') {
|
||||
|
||||
@ -480,7 +482,6 @@ export class FinancialInfoComponent implements OnInit {
|
||||
//detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2));
|
||||
detail.controls.estimate_net_profit.setValue(profit.toFixed(2));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
// else if (detail.value.estimate_profit_or_loss == 2){
|
||||
@ -498,7 +499,7 @@ export class FinancialInfoComponent implements OnInit {
|
||||
|
||||
}
|
||||
submitDetails() {
|
||||
console.log(this.financialForm.value.date_per_financial['financial_variation']);
|
||||
|
||||
if(this.financialForm.value.date_per_financial['finanical_profit_or_loss'] == 1){
|
||||
|
||||
this.financialForm.value.date_per_financial['financial_net_profit'].setValidators([Validators.required]);
|
||||
@ -527,9 +528,9 @@ export class FinancialInfoComponent implements OnInit {
|
||||
this.financialForm.value.date_per_financial['financial_margin_of_loss'].setValidators([Validators.required]);
|
||||
this.financialForm.value.date_per_financial['financial_margin_of_loss'].updateValueAndValidity();
|
||||
}
|
||||
if (!this.financialForm.valid) {
|
||||
return;
|
||||
}
|
||||
// if (!this.financialForm.valid) {
|
||||
// return;
|
||||
// }
|
||||
let records = this.financialForm.value;
|
||||
console.log('data', records);
|
||||
this._pd.saveForm(records).subscribe(data => {
|
||||
|
||||
@ -1,222 +1,414 @@
|
||||
<form [formGroup]="stockForm" class="address">
|
||||
<h2 mat-dialog-title class="paragraph_change">
|
||||
<h2 mat-dialog-title class="paragraph_change">
|
||||
<div fxFlex="70" align="left" style="padding: 10px !important;">
|
||||
{{pageTitle}}
|
||||
</div>
|
||||
<div fxFlex="30" align="end" style="padding: 10px !important;">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="right" mat-dialog-close><mat-icon>close</mat-icon></button>
|
||||
|
||||
</div>
|
||||
</h2>
|
||||
</h2>
|
||||
|
||||
<div *ngIf="noRecordsFound" style="max-width: 100vw !important;width: 100% !important;height: 95% !important;">
|
||||
<!-- <form [formGroup]="" class="address"> -->
|
||||
<form [formGroup]="stockForms" (submit)="submitDetails($event); false;">
|
||||
<mat-dialog-content>
|
||||
|
||||
|
||||
<mat-tab-group>
|
||||
<mat-tab label="Questions">
|
||||
<ng-template matTabContent>
|
||||
<div fxLayout="row wrap">
|
||||
<div fxFlex="100">
|
||||
<!-- start main applicant -->
|
||||
<mat-card *ngIf="rawMaterialAccess">
|
||||
<mat-card-header>
|
||||
<p>Raw Materials<p>
|
||||
</mat-card-header>
|
||||
<div formArrayName="raw_materials">
|
||||
<div *ngFor="let details of stockForm.controls.raw_materials['controls']; let i=index"
|
||||
[formGroupName]="i">
|
||||
<mat-tab-group>
|
||||
<mat-tab label="Questions">
|
||||
<ng-template matTabContent>
|
||||
<div fxLayout="row wrap">
|
||||
<div fxFlex="100">
|
||||
<mat-card *ngIf="manufacturingForm">
|
||||
<mat-card-header>
|
||||
<p> Manufacturing Details</p>
|
||||
</mat-card-header>
|
||||
<div formArrayName="manufacturing_details">
|
||||
<div *ngFor="let md of stockForms.controls.manufacturing_details['controls']; let i=index" [formGroupName]="i">
|
||||
<div formArrayName="manufacturing_raw_materials">
|
||||
<div *ngFor="let mrm of md.controls.manufacturing_raw_materials['controls']; let a=index" [formGroupName]="a">
|
||||
<mat-card-title> <p>{{a+1}} . Raw Material </p> </mat-card-title>
|
||||
<mat-card-content class="matcard">
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput placeholder="Name" formControlName="raw_name" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:30%">
|
||||
<mat-select placeholder="is the Stock is Observed ?"
|
||||
formControlName="stock_observed" required
|
||||
(selectionChange)="RawMaterialValidation($event)">
|
||||
<mat-option value="yes" >Yes</mat-option>
|
||||
<mat-option value="no" >No</mat-option>
|
||||
<mat-select placeholder="is the Stock is Observed ?" formControlName="stock_observed" required>
|
||||
<mat-option value="yes" >Yes</mat-option>
|
||||
<mat-option value="no" >No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<span *ngIf="details.get('stock_observed').value == 'no'" >
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput placeholder="Estimated Quantity" formControlName="raw_quantity" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:30%">
|
||||
<mat-select placeholder="Unit of Mearsurement"
|
||||
<span *ngIf="mrm.get('stock_observed').value == 'no'" >
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput placeholder="Estimated Quantity" formControlName="raw_quantity" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:30%">
|
||||
<mat-select placeholder="Unit of Mearsurement"
|
||||
formControlName="raw_uom" required>
|
||||
<mat-option value="{{uom.uom_id}}" *ngFor="let uom of uomData">{{uom.name}}</mat-option>
|
||||
</mat-select>
|
||||
<mat-option value="{{uom.uom_id}}" *ngFor="let uom of uomData">{{uom.name}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="mrm.get('raw_uom').value == 61" style="width:30%">
|
||||
<input matInput placeholder="Specify Other UOM" formControlName="other_uom" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:76%">
|
||||
<input matInput placeholder="Estimated Value of Stock Observed" formControlName="raw_value" (keypress)="keyPress($event)" required>
|
||||
<!-- <mat-hint align="end" *ngIf="mrm.get('raw_value').value != ''">{{"₹"}} {{rawValueInWords}} Only</mat-hint> (keyup)="inWords($event,1)" -->
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:76%">
|
||||
<input matInput placeholder="Value of raw materials as per latest financial Statements" formControlName="rawmaterial_value" (keypress)="keyPress($event)" required>
|
||||
</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" required>
|
||||
<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-label>Please comment on the stock level observed?</mat-label>
|
||||
<textarea matInput placeholder="Please comment on the stock level observed" formControlName="rawmaterial_remarks"></textarea>
|
||||
</mat-form-field>
|
||||
</span>
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="addRawMaterials(1)"
|
||||
matTooltip="Add More Raw Materials" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" *ngIf="a==0">
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="deleteRawMaterials(a,1)"
|
||||
matTooltip="Delete" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="a>0">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</mat-card-content>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div formArrayName="manufacturing_finished_goods">
|
||||
<div *ngFor="let mfg of md.controls.manufacturing_finished_goods['controls']; let b=index" [formGroupName]="b">
|
||||
<mat-card-title> <p> {{b+1}} Finished Goods </p> </mat-card-title>
|
||||
<mat-card-content class="matcard">
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput placeholder="Name" formControlName="goods_name" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="details.get('raw_uom').value == 61" style="width:30%">
|
||||
<input matInput placeholder="Specify Other UOM" formControlName="other_uom" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:76%">
|
||||
<input matInput placeholder="Estimated Value of Stock Observed" formControlName="raw_value" (keypress)="keyPress($event)" (keyup)="inWords($event,1)" required>
|
||||
<mat-hint align="end" *ngIf="details.get('raw_value').value != ''">{{"₹"}} {{rawValueInWords}} Only</mat-hint>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:76%">
|
||||
<input matInput placeholder="Value of raw materials as per latest financial Statements" formControlName="rawmaterial_value" (keypress)="keyPress($event)" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:90%">
|
||||
<!-- <input matInput placeholder="Is the stock of raw materials observed ?" formControlName="is_sufficiant_raw" required> -->
|
||||
<mat-select placeholder="Is the stock of Raw Materials observed, sufficient considering the size of operations" formControlName="is_sufficiant_raw" required>
|
||||
<mat-form-field style="width:30%">
|
||||
<mat-select placeholder="is the Goods is Observed ?" formControlName="goods_observed" required>
|
||||
<mat-option value="yes" >Yes</mat-option>
|
||||
<mat-option value="no" >No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="details.get('is_sufficiant_raw').value == 'no'" appearance="outline" style="width: 90%">
|
||||
<mat-label>Please comment on the stock level observed?</mat-label>
|
||||
<textarea matInput placeholder="Please comment on the stock level observed" formControlName="rawmaterial_remarks"></textarea>
|
||||
</mat-form-field>
|
||||
<span *ngIf="mfg.get('goods_observed').value == 'no'" >
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput placeholder="Estimated Quantity" formControlName="goods_quantity" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:76%">
|
||||
<input matInput placeholder="Estimated Value of Stock Observed" formControlName="goods_value" (keypress)="keyPress($event)" required>
|
||||
<!-- <mat-hint align="end" *ngIf="mfg.get('goods_value').value != ''">{{"₹"}} {{goodsValueInWords}} Only</mat-hint> (keyup)="inWords($event,2)" -->
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:76%">
|
||||
<input matInput placeholder="Value of finished goods as per latest financial statements" formControlName="finished_goods_value" (keypress)="keyPress($event)" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:90%">
|
||||
<mat-select placeholder="Is the stock of finished goods observed ?" formControlName="is_sufficiant_goods" required>
|
||||
<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-label>Please comment on the finished goods stock level observed?</mat-label>
|
||||
<textarea matInput placeholder="Please comment on the finished goods observed" formControlName="finishedgoods_remarks"></textarea>
|
||||
</mat-form-field>
|
||||
</span>
|
||||
|
||||
</span>
|
||||
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="addRawMaterials()"
|
||||
matTooltip="Add More Raw Materials" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" *ngIf="i==0">
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="addGoods(1)"
|
||||
matTooltip="Add More Finished Goods" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" *ngIf="b==0">
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="deleteRawMaterials(i)"
|
||||
matTooltip="Delete" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="i>0">
|
||||
<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="b>0">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</mat-card-content>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card>
|
||||
</div>
|
||||
|
||||
<!-- end main applicant -->
|
||||
</div>
|
||||
</div>
|
||||
<div fxLayout="row wrap">
|
||||
<div fxFlex="100">
|
||||
<!-- start co applicant form details -->
|
||||
<mat-card *ngIf="finishedGoodsAccess">
|
||||
<mat-card-header>
|
||||
<p>Finished Goods<p>
|
||||
</mat-card-header>
|
||||
<div formArrayName="finished_goods">
|
||||
<div *ngFor="let details of stockForm.controls.finished_goods['controls']; let i=index"
|
||||
[formGroupName]="i">
|
||||
<mat-card-content class="matcard">
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput placeholder="Name" formControlName="goods_name" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:30%">
|
||||
<mat-select placeholder="is the Goods is Observed ?"
|
||||
formControlName="goods_observed" required
|
||||
(selectionChange)="GoodsValidation($event)">
|
||||
<mat-option value="yes" >Yes</mat-option>
|
||||
<mat-option value="no" >No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<span *ngIf="details.get('goods_observed').value == 'no'" >
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput placeholder="Estimated Quantity" formControlName="goods_quantity" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:76%">
|
||||
<input matInput placeholder="Estimated Value of Stock Observed" formControlName="goods_value" (keypress)="keyPress($event)" (keyup)="inWords($event,2)" required>
|
||||
<mat-hint align="end" *ngIf="details.get('goods_value').value != ''">{{"₹"}} {{goodsValueInWords}} Only</mat-hint>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:76%">
|
||||
<input matInput placeholder="Value of finished goods as per latest financial statements" formControlName="finished_goods_value" (keypress)="keyPress($event)" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:90%">
|
||||
<!-- <input matInput placeholder="Is the stock of finished goods observed ?" formControlName="is_sufficiant_goods" required> -->
|
||||
<mat-select placeholder="Is the stock of finished goods observed ?" formControlName="is_sufficiant_goods" required>
|
||||
<mat-option value="yes" >Yes</mat-option>
|
||||
<mat-option value="no" >No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="details.get('is_sufficiant_goods').value == 'no'" appearance="outline" style="width: 90%">
|
||||
<mat-label>Please comment on the finished goods stock level observed?</mat-label>
|
||||
<textarea matInput placeholder="Please comment on the finished goods observed" formControlName="finishedgoods_remarks"></textarea>
|
||||
</mat-form-field>
|
||||
</span>
|
||||
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="addGoods()"
|
||||
matTooltip="Add More Finished Goods" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" *ngIf="i==0">
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="deleteGoods(i)"
|
||||
matTooltip="Delete" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="i>0">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</mat-card-content>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card>
|
||||
<!-- end co apllicant -->
|
||||
<div formArrayName="manufacturing_traded_goods">
|
||||
<div *ngFor="let mtg of md.controls.manufacturing_traded_goods['controls']; let c=index" [formGroupName]="c">
|
||||
<mat-card-title> <p>{{c+1}} Traded Goods </p> </mat-card-title>
|
||||
<mat-card-content class="matcard">
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput placeholder="Name" formControlName="traded_goods_name" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:30%">
|
||||
<mat-select placeholder="is the Traded Goods is Observed ?" formControlName="traded_goods_observed" required >
|
||||
<mat-option value="yes" >Yes</mat-option>
|
||||
<mat-option value="no" >No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<span *ngIf="mtg.get('traded_goods_observed').value == 'no'" >
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput placeholder="Estimated Quantity" formControlName="traded_goods_quantity" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:76%">
|
||||
<input matInput placeholder="Estimated Value of Stock Observed" formControlName="estimated_traded_goods_value" (keypress)="keyPress($event)" required>
|
||||
<!-- <mat-hint align="end" *ngIf="mtg.get('estimated_traded_goods_value').value != ''">{{"₹"}} {{tradedGoodsValueInWords}} Only</mat-hint>(keyup)="inWords($event,3)" -->
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:76%">
|
||||
<input matInput placeholder="Value of traded goods as per latest financial statements" formControlName="traded_goods_value" (keypress)="keyPress($event)" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:90%">
|
||||
<!-- <input matInput placeholder="Is the stock of finished goods observed ?" formControlName="is_sufficiant_goods" required> -->
|
||||
<mat-select placeholder="Is the stock of Traded goods observed ?" formControlName="is_sufficiant_traded_goods" required>
|
||||
<mat-option value="yes" >Yes</mat-option>
|
||||
<mat-option value="no" >No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="mtg.get('is_sufficiant_traded_goods').value == 'no'" appearance="outline" style="width: 90%">
|
||||
<mat-label>Please comment on the Traded Goods stock level observed?</mat-label>
|
||||
<textarea matInput 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(1)"
|
||||
matTooltip="Add More Traded Goods" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" *ngIf="c==0">
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="deleteTradedGoods(c,1)"
|
||||
matTooltip="Delete" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="c>0">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</mat-card-content>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card>
|
||||
|
||||
<div fxLayout="row wrap">
|
||||
<div fxFlex="100">
|
||||
<mat-card *ngIf="tradeConcernAccess">
|
||||
<mat-card-header>
|
||||
<p>Stock of Goods Traded<p>
|
||||
</mat-card-header>
|
||||
<div formArrayName="traded_goods">
|
||||
<div *ngFor="let details of stockForm.controls.traded_goods['controls']; let i=index"
|
||||
[formGroupName]="i">
|
||||
<mat-card-content class="matcard">
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput placeholder="Name" formControlName="traded_goods_name" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:30%">
|
||||
<mat-select placeholder="is the Traded Goods is Observed ?"
|
||||
formControlName="traded_goods_observed" required
|
||||
(selectionChange)="TradedGoodsValidation($event)">
|
||||
<mat-option value="yes" >Yes</mat-option>
|
||||
<mat-option value="no" >No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<span *ngIf="details.get('traded_goods_observed').value == 'no'" >
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput placeholder="Estimated Quantity" formControlName="traded_goods_quantity" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:76%">
|
||||
<input matInput placeholder="Estimated Value of Stock Observed" formControlName="estimated_traded_goods_value" (keypress)="keyPress($event)" (keyup)="inWords($event,3)" required>
|
||||
<mat-hint align="end" *ngIf="details.get('estimated_traded_goods_value').value != ''">{{"₹"}} {{tradedGoodsValueInWords}} Only</mat-hint>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:76%">
|
||||
<input matInput placeholder="Value of traded goods as per latest financial statements" formControlName="traded_goods_value" (keypress)="keyPress($event)" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:90%">
|
||||
<!-- <input matInput placeholder="Is the stock of finished goods observed ?" formControlName="is_sufficiant_goods" required> -->
|
||||
<mat-select placeholder="Is the stock of Traded goods observed ?" formControlName="is_sufficiant_traded_goods" required>
|
||||
<mat-option value="yes" >Yes</mat-option>
|
||||
<mat-option value="no" >No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="details.get('is_sufficiant_traded_goods').value == 'no'" appearance="outline" style="width: 90%">
|
||||
<mat-label>Please comment on the Traded Goods stock level observed?</mat-label>
|
||||
<textarea matInput placeholder="Please comment on the traded goods stock level observed" formControlName="traded_goods_remarks"></textarea>
|
||||
</mat-form-field>
|
||||
</span>
|
||||
<mat-card *ngIf="retailForm">
|
||||
<mat-card-header>
|
||||
<p>Retail Details</p>
|
||||
</mat-card-header>
|
||||
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="addTradedGoods()"
|
||||
matTooltip="Add More Traded Goods" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" *ngIf="i==0">
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="deleteTradedGoods(i)"
|
||||
matTooltip="Delete" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="i>0">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</mat-card-content>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card>
|
||||
<div formArrayName="retail_details">
|
||||
<div *ngFor="let rd of stockForms.controls.retail_details['controls']; let j=index" [formGroupName]="j">
|
||||
|
||||
<div formArrayName="retail_finished_goods">
|
||||
<div *ngFor="let retailfg of rd.controls.retail_finished_goods['controls']; let d=index" [formGroupName]="d">
|
||||
<mat-card-title> <p>{{d+1}} Finished Goods </p> </mat-card-title>
|
||||
<mat-card-content class="matcard">
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput placeholder="Name" formControlName="goods_name" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:30%">
|
||||
<mat-select placeholder="is the Goods is Observed ?" formControlName="goods_observed" required>
|
||||
<mat-option value="yes" >Yes</mat-option>
|
||||
<mat-option value="no" >No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<span *ngIf="retailfg.get('goods_observed').value == 'no'" >
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput placeholder="Estimated Quantity" formControlName="goods_quantity" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:76%">
|
||||
<input matInput placeholder="Estimated Value of Stock Observed" formControlName="goods_value" (keypress)="keyPress($event)" required>
|
||||
<!-- <mat-hint align="end" *ngIf="retailfg.get('goods_value').value != ''">{{"₹"}} {{goodsValueInWords}} Only</mat-hint>(keyup)="inWords($event,2)" -->
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:76%">
|
||||
<input matInput placeholder="Value of finished goods as per latest financial statements" formControlName="finished_goods_value" (keypress)="keyPress($event)" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:90%">
|
||||
|
||||
<mat-select placeholder="Is the stock of finished goods observed ?" formControlName="is_sufficiant_goods" required>
|
||||
<mat-option value="yes" >Yes</mat-option>
|
||||
<mat-option value="no" >No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="retailfg.get('is_sufficiant_goods').value == 'no'" appearance="outline" style="width: 90%">
|
||||
<mat-label>Please comment on the finished goods stock level observed?</mat-label>
|
||||
<textarea matInput placeholder="Please comment on the finished goods observed" formControlName="finishedgoods_remarks"></textarea>
|
||||
</mat-form-field>
|
||||
</span>
|
||||
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="addGoods(2)"
|
||||
matTooltip="Add More Finished Goods" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" *ngIf="d==0">
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="deleteGoods(d,2)"
|
||||
matTooltip="Delete" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="d>0">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</mat-card-content>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div formArrayName="retail_traded_goods">
|
||||
<div *ngFor="let item of rd.controls.retail_traded_goods['controls']; let e=index" [formGroupName]="e">
|
||||
<mat-card-title> <p>{{e+1}} Traded Goods </p> </mat-card-title>
|
||||
<mat-card-content class="matcard">
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput placeholder="Name" formControlName="traded_goods_name" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:30%">
|
||||
<mat-select placeholder="is the Traded Goods is Observed ?" formControlName="traded_goods_observed" required>
|
||||
<mat-option value="yes" >Yes</mat-option>
|
||||
<mat-option value="no" >No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<span *ngIf="item.get('traded_goods_observed').value == 'no'" >
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput placeholder="Estimated Quantity" formControlName="traded_goods_quantity" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:76%">
|
||||
<input matInput placeholder="Estimated Value of Stock Observed" formControlName="estimated_traded_goods_value" (keypress)="keyPress($event)" required>
|
||||
<!-- <mat-hint align="end" *ngIf="item.get('estimated_traded_goods_value').value != ''">{{"₹"}} {{tradedGoodsValueInWords}} Only</mat-hint>(keyup)="inWords($event,3)" -->
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:76%">
|
||||
<input matInput placeholder="Value of traded goods as per latest financial statements" formControlName="traded_goods_value" (keypress)="keyPress($event)" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:90%">
|
||||
|
||||
<mat-select placeholder="Is the stock of Traded goods observed ?" formControlName="is_sufficiant_traded_goods" required>
|
||||
<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-label>Please comment on the Traded Goods stock level observed?</mat-label>
|
||||
<textarea matInput 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)"
|
||||
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)"
|
||||
matTooltip="Delete" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="e>0">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</mat-card-content>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
<mat-tab label="Docs">
|
||||
</div>
|
||||
</div>
|
||||
</mat-card>
|
||||
|
||||
<mat-card *ngIf="tradingForm">
|
||||
|
||||
<mat-card-header>
|
||||
<p>Trading Details</p>
|
||||
</mat-card-header>
|
||||
|
||||
<div formArrayName="trade_details">
|
||||
<div *ngFor="let td of stockForms.controls.trade_details['controls']; let k=index" [formGroupName]="k">
|
||||
<div formArrayName="trading_finished_goods">
|
||||
<div *ngFor="let tradesubdetail of td.controls.trading_finished_goods['controls']; let f=index" [formGroupName]="f">
|
||||
<mat-card-title> <p>{{f+1}} Finished Goods </p> </mat-card-title>
|
||||
<mat-card-content class="matcard">
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput placeholder="Name" formControlName="goods_name" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:30%">
|
||||
<mat-select placeholder="is the Goods is Observed ?" formControlName="goods_observed" required >
|
||||
<mat-option value="yes" >Yes</mat-option>
|
||||
<mat-option value="no" >No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<span *ngIf="tradesubdetail.get('goods_observed').value == 'no'" >
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput placeholder="Estimated Quantity" formControlName="goods_quantity" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:76%">
|
||||
<input matInput placeholder="Estimated Value of Stock Observed" formControlName="goods_value" (keypress)="keyPress($event)" required>
|
||||
<!-- <mat-hint align="end" *ngIf="tradesubdetail.get('goods_value').value != ''">{{"₹"}} {{goodsValueInWords}} Only</mat-hint>(keyup)="inWords($event,2)" -->
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:76%">
|
||||
<input matInput placeholder="Value of finished goods as per latest financial statements" formControlName="finished_goods_value" (keypress)="keyPress($event)" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:90%">
|
||||
|
||||
<mat-select placeholder="Is the stock of finished goods observed ?" formControlName="is_sufficiant_goods" required>
|
||||
<mat-option value="yes" >Yes</mat-option>
|
||||
<mat-option value="no" >No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="tradesubdetail.get('is_sufficiant_goods').value == 'no'" appearance="outline" style="width: 90%">
|
||||
<mat-label>Please comment on the finished goods stock level observed?</mat-label>
|
||||
<textarea matInput placeholder="Please comment on the finished goods observed" formControlName="finishedgoods_remarks"></textarea>
|
||||
</mat-form-field>
|
||||
</span>
|
||||
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="addGoods(3)"
|
||||
matTooltip="Add More Finished Goods" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" *ngIf="f==0">
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="deleteGoods(f,3)"
|
||||
matTooltip="Delete" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="f>0">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</mat-card-content>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div formArrayName="trading_traded_goods">
|
||||
<div *ngFor="let tradetg of td.controls.trading_traded_goods['controls']; let g=index" [formGroupName]="g">
|
||||
<mat-card-title> <p>{{g+1}} Traded Goods </p> </mat-card-title>
|
||||
<mat-card-content class="matcard">
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput placeholder="Name" formControlName="traded_goods_name" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:30%">
|
||||
<mat-select placeholder="is the Traded Goods is Observed ?" formControlName="traded_goods_observed" required>
|
||||
<mat-option value="yes" >Yes</mat-option>
|
||||
<mat-option value="no" >No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<span *ngIf="tradetg.get('traded_goods_observed').value == 'no'" >
|
||||
<mat-form-field style="width:30%">
|
||||
<input matInput placeholder="Estimated Quantity" formControlName="traded_goods_quantity" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:76%">
|
||||
<input matInput placeholder="Estimated Value of Stock Observed" formControlName="estimated_traded_goods_value" (keypress)="keyPress($event)" required>
|
||||
<!-- <mat-hint align="end" *ngIf="tradetg.get('estimated_traded_goods_value').value != ''">{{"₹"}} {{tradedGoodsValueInWords}} Only</mat-hint> (keyup)="inWords($event,3)" -->
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:76%">
|
||||
<input matInput placeholder="Value of traded goods as per latest financial statements" formControlName="traded_goods_value" (keypress)="keyPress($event)" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:90%">
|
||||
<!-- <input matInput placeholder="Is the stock of finished goods observed ?" formControlName="is_sufficiant_goods" required> -->
|
||||
<mat-select placeholder="Is the stock of Traded goods observed ?" formControlName="is_sufficiant_traded_goods" required>
|
||||
<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-label>Please comment on the Traded Goods stock level observed?</mat-label>
|
||||
<textarea matInput 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)"
|
||||
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)"
|
||||
matTooltip="Delete" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="g>0">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</mat-card-content>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</mat-card>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
|
||||
<mat-tab label="Docs">
|
||||
<ng-template matTabContent>
|
||||
<div ngxViewer>
|
||||
<div fxLayout="row wrap" style="padding:20px;">
|
||||
<div ngxViewer>
|
||||
<div fxLayout="row wrap" style="padding:20px;">
|
||||
<div fxFlex="100">
|
||||
<div fxFlex="20" class="m-gap p-gap">
|
||||
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
|
||||
@ -246,7 +438,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div fxFlex="20" class="m-gap p-gap">
|
||||
<div fxFlex="20" class="m-gap p-gap">
|
||||
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
|
||||
<div class="p-list">
|
||||
<div class="top"><img src="https://picsum.photos/2000/1500/?random=3" alt="Image 3"></div>
|
||||
@ -283,7 +475,7 @@
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
</div>
|
||||
<div fxLayout="row" fxLayoutWrap="wrap">
|
||||
<div fxLayout="row" fxLayoutWrap="wrap">
|
||||
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25">
|
||||
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
|
||||
</div>
|
||||
@ -306,40 +498,33 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
|
||||
</mat-tab-group>
|
||||
</div>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
|
||||
</mat-tab-group>
|
||||
</mat-dialog-content>
|
||||
|
||||
<mat-dialog-actions>
|
||||
<div fxFlex="60" class="pb-0 text-sm-left" align="left">
|
||||
<mat-form-field appearance="outline" style="width: 100%">
|
||||
<mat-label>Remarks</mat-label>
|
||||
<textarea matInput placeholder="Remarks" formControlName="stock_remarks"></textarea>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div fxFlex="40" align="end">
|
||||
<button type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Submit" matTooltipPosition="above" (click)="submitDetails()"><mat-icon>save</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div fxFlex="40" align="end">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button>
|
||||
</div>
|
||||
</mat-dialog-actions>
|
||||
|
||||
</form>
|
||||
<notifier-container></notifier-container>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<notifier-container></notifier-container>
|
||||
<!-- <mat-card style="padding: 12px;">
|
||||
<p>Stock Details</p>
|
||||
<form [formGroup]="stockForm" class="address"> -->
|
||||
<form [formGroup]="stockForms" class="address"> -->
|
||||
<!-- {{uomData | json}} -->
|
||||
<!-- <mat-card>
|
||||
=======
|
||||
<!-- {{uomData | json}} -->
|
||||
<mat-card>
|
||||
|
||||
@ -35,7 +35,7 @@ export class StockComponent implements OnInit {
|
||||
pageTitle: string ="Stock Details";
|
||||
pdid: number;
|
||||
form_id: number;
|
||||
public stockForm: FormGroup;
|
||||
public stockForms: FormGroup;
|
||||
private notifier: NotifierService;
|
||||
public uomData : any = [];
|
||||
|
||||
@ -46,6 +46,8 @@ export class StockComponent implements OnInit {
|
||||
rawMaterialAccess: boolean;
|
||||
finishedGoodsAccess: boolean;
|
||||
tradeConcernAccess: boolean;
|
||||
public submitted = false;
|
||||
noRecordsFound: Boolean = false;
|
||||
|
||||
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
@ -74,154 +76,310 @@ export class StockComponent implements OnInit {
|
||||
}
|
||||
};
|
||||
ngOnInit() {
|
||||
this.initstockForm();
|
||||
this.getUOM();
|
||||
//this.setSku('data',0);
|
||||
|
||||
// this._pd.stockFormsAccess({pd_id:this.pdid}).subscribe(data => {
|
||||
// if(data.status == 200){
|
||||
// this.initstockForms(data.record.type_of_activity);
|
||||
// }
|
||||
// }, err => {
|
||||
// this.notifier.notify('warning', 'There is No Type Of Activity Please Check Bussiness Information.!');
|
||||
// })
|
||||
|
||||
this._pd.getTypeofActivityForSuppliedInfoForm(this.pdid).subscribe(data => {
|
||||
// if(data.dataStatus === undefined){
|
||||
let datas = {
|
||||
"profession_name": "Others",
|
||||
"type_of_activity": [
|
||||
{
|
||||
"type_of_activity_id": 1,
|
||||
"name": "Manufacturing Details"
|
||||
},
|
||||
{
|
||||
"type_of_activity_id": 2,
|
||||
"name": "Retail trading"
|
||||
},
|
||||
{
|
||||
"type_of_activity_id": 3,
|
||||
"name": "Trading Concern"
|
||||
},
|
||||
{
|
||||
"type_of_activity_id": 4,
|
||||
"name": "Service Provider"
|
||||
}
|
||||
]
|
||||
};
|
||||
this.initstockForms(datas.type_of_activity);
|
||||
// }else {
|
||||
// this.notifier.notify('warning', 'No Category Records Found.!');
|
||||
// this.noRecordsFound = false;
|
||||
// }
|
||||
}, err => {
|
||||
|
||||
this.notifier.notify('warning', 'There is No Type Of Activity Please Check Bussiness Information.!');
|
||||
this.noRecordsFound = false;
|
||||
})
|
||||
|
||||
this.getUOM();
|
||||
}
|
||||
|
||||
public initstockForms(record){
|
||||
|
||||
let params: any = {};
|
||||
let activityArray : any = [];
|
||||
params.pd_id = this.pdid;
|
||||
params.pd_form_id = this.form_id;
|
||||
|
||||
this._pd.stockFormAccess({pd_id:this.pdid}).subscribe(value => {
|
||||
console.log(value);
|
||||
const rawMaterial = <FormArray>this.stockForm.controls['raw_materials'];
|
||||
const finishedGoods = <FormArray>this.stockForm.controls['finished_goods'];
|
||||
const tradedGoods = <FormArray>this.stockForm.controls['traded_goods'];
|
||||
|
||||
if (value.status == 200) {
|
||||
console.log('value.records',value.records);
|
||||
value.records.type_of_activity.forEach(val => {
|
||||
//console.log(val);
|
||||
//console.log(val.type_of_activity_id);
|
||||
this.rawMaterialAccess = true;
|
||||
this.finishedGoodsAccess = true;
|
||||
this.tradeConcernAccess = true;
|
||||
if(val.type_of_activity_id == 1){
|
||||
rawMaterial.push(this.createRawmaterial());
|
||||
finishedGoods.push(this.createGoods());
|
||||
tradedGoods.push(this.createTradedGoods());
|
||||
}
|
||||
else if(val.type_of_activity_id == 2){
|
||||
rawMaterial.push(this.createRawmaterial());
|
||||
finishedGoods.push(this.createGoods());
|
||||
}
|
||||
else if(val.type_of_activity_id == 3){
|
||||
rawMaterial.push(this.createRawmaterial());
|
||||
finishedGoods.push(this.createGoods());
|
||||
}
|
||||
// else if(val.type_of_activity_id == 4){
|
||||
// }
|
||||
|
||||
});
|
||||
|
||||
this._pd.retriveForm({pd_id:this.pdid,pd_form_id:'1'}).subscribe(value => {
|
||||
//console.log('Raw material Name',value.records.main_raw_materials);
|
||||
|
||||
// const faControl = (<FormArray>this.stockForm.controls['raw_materials']).at(1);
|
||||
|
||||
//const control = (<FormArray>this.stockForm.controls['raw_materials']).at(0);
|
||||
//console.log(control);
|
||||
|
||||
// this.stockForm.controls['raw_materials'].setValue(value.records.main_raw_materials);
|
||||
// if (value.status == 200) {
|
||||
// this.rawmaterial = value.records.main_raw_materials;
|
||||
// }else{ this.rawmaterial = ''; }
|
||||
})
|
||||
|
||||
this._pd.retriveForm(params).subscribe(value => {
|
||||
//console.log('value', value);
|
||||
|
||||
if (value.status == 200) {
|
||||
console.log('data',value);
|
||||
// Raw Material Access is True means., Data have to load,
|
||||
if(this.rawMaterialAccess == true){
|
||||
let dataForm = value.records;
|
||||
|
||||
let result = Object.keys(value.records.raw_materials).map(function(key) {
|
||||
return value.records.raw_materials[key];
|
||||
});
|
||||
|
||||
if (result.length > 0) {
|
||||
|
||||
result.forEach(val => {
|
||||
|
||||
//this.RawMaterialValidation(val.stock_observed);
|
||||
rawMaterial.push(this.createRawmaterial());
|
||||
if(val.raw_value != '' && val.raw_value != null ){ this.rawValueInWords = this._pd.convertNumberToWords(val.raw_value); }
|
||||
});
|
||||
this.stockForm.controls['raw_materials'].setValue(result);
|
||||
} else {
|
||||
rawMaterial.push(this.createRawmaterial());
|
||||
}
|
||||
}
|
||||
|
||||
// Finished Goods Access is TRUE Means., data have to load.,
|
||||
if(this.finishedGoodsAccess == true){
|
||||
let result_Goods = Object.keys(value.records.finished_goods).map(function(key) {
|
||||
return value.records.finished_goods[key];
|
||||
});
|
||||
|
||||
if (result_Goods.length > 0) {
|
||||
|
||||
result_Goods.forEach(val => {
|
||||
|
||||
//this.GoodsValidation(val.goods_observed);
|
||||
finishedGoods.push(this.createGoods());
|
||||
if(val.goods_value != '' && val.goods_value != null ){ this.goodsValueInWords = this._pd.convertNumberToWords(val.goods_value); }
|
||||
});
|
||||
this.stockForm.controls['finished_goods'].setValue(result_Goods);
|
||||
} else {
|
||||
finishedGoods.push(this.createGoods());
|
||||
}
|
||||
}
|
||||
|
||||
//TradeConcern Access is TRUE Means., data have to load.,
|
||||
if(this.tradeConcernAccess == true){
|
||||
let result_Traded_Goods = Object.keys(value.records.finished_goods).map(function(key) {
|
||||
return value.records.traded_goods[key];
|
||||
if(dataForm !== undefined) {
|
||||
console.log('dtaForm',dataForm);
|
||||
this.stockForms = this.fb.group({
|
||||
pdid: [this.pdid],
|
||||
formid: [this.form_id],
|
||||
stock_remarks: [''],
|
||||
manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]),
|
||||
retail_details : this.fb.array([this.retailFormCreation(record)]),
|
||||
trade_details: this.fb.array([this.tradingFormCreation(record)]),
|
||||
});
|
||||
|
||||
if (result_Traded_Goods.length > 0) {
|
||||
|
||||
result_Traded_Goods.forEach(val => {
|
||||
|
||||
|
||||
tradedGoods.push(this.createTradedGoods());
|
||||
if(val.traded_goods_value != '' && val.traded_goods_value != null )
|
||||
{ this.tradedGoodsValueInWords = this._pd.convertNumberToWords(val.traded_goods_value); }
|
||||
});
|
||||
this.stockForm.controls['traded_goods'].setValue(result_Traded_Goods);
|
||||
} else {
|
||||
tradedGoods.push(this.createTradedGoods());
|
||||
let arr = record.filter(data => data.type_of_activity_id === 1);
|
||||
if(arr.length > 0) {
|
||||
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];
|
||||
});
|
||||
}
|
||||
if(dataForm.manufacturing_traded_goods !==undefined){
|
||||
manufacturing_traded_goods = Object.keys(dataForm.manufacturing_traded_goods).map(function (key) {
|
||||
return dataForm.manufacturing_traded_goods[key];
|
||||
});
|
||||
}
|
||||
if(dataForm.retail_finished_goods !==undefined)
|
||||
{
|
||||
retail_finished_goods = Object.keys(dataForm.retail_finished_goods).map(function(key)
|
||||
{
|
||||
return dataForm.retail_finished_goods[key];
|
||||
})
|
||||
}
|
||||
//console.log(retail_finished_goods,manufacturing_traded_goods);
|
||||
let manufacturing_temparr = [];
|
||||
manufacturing_temparr['manufacturing_traded_goods'] = manufacturing_traded_goods;manufacturing_temparr['manufacturing_finished_goods'] = manufacturing_finished_goods;manufacturing_temparr['manufacturing_raw_materials'] = manufacturing_raw_materials;
|
||||
this.initManufacturingDetails(manufacturing_temparr);
|
||||
}
|
||||
let arr1 = record.filter(data => data.type_of_activity_id === 2);
|
||||
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];
|
||||
});
|
||||
}
|
||||
if(dataForm.retail_finished_goods !==undefined)
|
||||
{
|
||||
retail_finished_goods = Object.keys(dataForm.retail_finished_goods).map(function(key)
|
||||
{
|
||||
return dataForm.retail_finished_goods[key];
|
||||
})
|
||||
}
|
||||
|
||||
let retail_temparr = [];
|
||||
retail_temparr['retail_traded_goods'] = retail_traded_goods;
|
||||
retail_temparr['retail_finished_goods'] = retail_finished_goods;
|
||||
this.initRetailDetails(retail_temparr);
|
||||
}
|
||||
let arr2 = record.filter(data => data.type_of_activity_id === 3);
|
||||
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];
|
||||
});
|
||||
}
|
||||
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'] = trading_finished_goods;
|
||||
trading_temparr['trading_traded_goods'] = trading_traded_goods;
|
||||
this.initTradingDetails(trading_temparr);
|
||||
}
|
||||
this.noRecordsFound = true;
|
||||
}
|
||||
|
||||
|
||||
this.stockForm.controls['stock_remarks'].setValue(value.records.stock_remarks);
|
||||
|
||||
} else {
|
||||
// rawMaterial.push(this.createRawmaterial());
|
||||
// finishedGoods.push(this.createGoods());
|
||||
// tradedGoods.push(this.createTradedGoods());
|
||||
else{
|
||||
console.log('dataForm',dataForm);
|
||||
this.stockForms = this.fb.group({
|
||||
pdid: [this.pdid],
|
||||
formid: [this.form_id],
|
||||
stock_remarks: [''],
|
||||
manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]),
|
||||
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);
|
||||
if(arr.length > 0) {
|
||||
this.initManufacturingDetails(null);
|
||||
}
|
||||
let arr1 = record.filter(data => data.type_of_activity_id === 2);
|
||||
if(arr1.length > 0) {
|
||||
this.initRetailDetails(null);
|
||||
}
|
||||
let arr2 = record.filter(data => data.type_of_activity_id === 3);
|
||||
if(arr2.length > 0) {
|
||||
this.initTradingDetails(null);
|
||||
}
|
||||
let arr3 = record.filter(data => data.type_of_activity_id === 4);
|
||||
if(arr3.length > 0) {
|
||||
//this.serviceProviderForm = true;
|
||||
}
|
||||
this.noRecordsFound = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.stockForms = this.fb.group({
|
||||
pdid: [this.pdid],
|
||||
formid: [this.form_id],
|
||||
stock_remarks: [''],
|
||||
manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]),
|
||||
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);
|
||||
if(arr.length > 0) {
|
||||
this.initManufacturingDetails(null);
|
||||
}
|
||||
let arr1 = record.filter(data => data.type_of_activity_id === 2);
|
||||
if(arr1.length > 0) {
|
||||
this.initRetailDetails(null);
|
||||
}
|
||||
let arr2 = record.filter(data => data.type_of_activity_id === 3);
|
||||
if(arr2.length > 0) {
|
||||
this.initTradingDetails(null);
|
||||
}
|
||||
let arr3 = record.filter(data => data.type_of_activity_id === 4);
|
||||
if(arr3.length > 0) {
|
||||
//this.serviceProviderForm = true;
|
||||
}
|
||||
this.noRecordsFound = true;
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public initstockForm(): void {
|
||||
this.stockForm = this.fb.group({
|
||||
stock_remarks: ['', Validators.compose([Validators.required])],
|
||||
raw_materials: this.fb.array([]),
|
||||
finished_goods: this.fb.array([]),
|
||||
traded_goods: this.fb.array([])
|
||||
});
|
||||
// this.stockForms = this.fb.group({
|
||||
// stock_remarks: ['', Validators.compose([Validators.required])],
|
||||
// raw_materials: this.fb.array([]),
|
||||
// finished_goods: this.fb.array([]),
|
||||
// traded_goods: this.fb.array([])
|
||||
// });
|
||||
}
|
||||
|
||||
manufacturingForm: Boolean = false;
|
||||
manufacturingFormCreation(val) {
|
||||
let arr = val.filter(data => data.type_of_activity_id === 1);
|
||||
if (arr.length > 0) {
|
||||
this.manufacturingForm = true;
|
||||
return this.fb.group({
|
||||
manufacturing_raw_materials: this.fb.array([]),
|
||||
manufacturing_finished_goods: this.fb.array([]),
|
||||
manufacturing_traded_goods: this.fb.array([])
|
||||
})
|
||||
// }
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
retailForm: Boolean = false;
|
||||
retailFormCreation(val) {
|
||||
let arr = val.filter(data => data.type_of_activity_id === 2);
|
||||
if (arr.length > 0) {
|
||||
this.retailForm = true;
|
||||
return this.fb.group({
|
||||
retail_finished_goods: this.fb.array([]),
|
||||
retail_traded_goods: this.fb.array([])
|
||||
})
|
||||
// }
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
tradingForm: Boolean = false;
|
||||
tradingFormCreation(val) {
|
||||
let arr = val.filter(data => data.type_of_activity_id === 3);
|
||||
if (arr.length > 0) {
|
||||
this.tradingForm = true;
|
||||
return this.fb.group({
|
||||
trading_finished_goods: this.fb.array([]),
|
||||
trading_traded_goods: this.fb.array([])
|
||||
});
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//setSku(sku: string, index: number) {
|
||||
// const faControl =
|
||||
// (<FormArray>this.stockForm.controls['raw_materials']).at(index);
|
||||
// (<FormArray>this.stockForms.controls['raw_materials']).at(index);
|
||||
// faControl['controls'].raw_name.setValue(sku);
|
||||
// }
|
||||
createRawmaterial() {
|
||||
|
||||
initManufacturingDetails(datas) {
|
||||
|
||||
const rawMaterial = <FormArray>this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_raw_materials'];
|
||||
const finishedGoods = <FormArray>this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods'];
|
||||
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(299,'if');
|
||||
// rawMaterial.push(this.createRawmaterial(null));
|
||||
// finishedGoods.push(this.createGoods(null));
|
||||
// tradedGoods.push(this.createTradedGoods(null));
|
||||
|
||||
} else {
|
||||
console.log(305,'else')
|
||||
for (let val of datas.manufacturing_raw_materials) {
|
||||
console.log(val);
|
||||
|
||||
rawMaterial.push(this.createRawmaterial(val));
|
||||
|
||||
}
|
||||
for (let val of datas.manufacturing_finished_goods) {
|
||||
console.log(val);
|
||||
|
||||
finishedGoods.push(this.createGoods(val));
|
||||
|
||||
}
|
||||
for (let val of datas.manufacturing_traded_goods) {
|
||||
console.log(val);
|
||||
|
||||
tradedGoods.push(this.createTradedGoods(val));
|
||||
|
||||
}
|
||||
console.log(310,rawMaterial);
|
||||
}
|
||||
}
|
||||
|
||||
createRawmaterial2() {
|
||||
return this.fb.group({
|
||||
raw_name: ['', Validators.compose([Validators.required])],
|
||||
stock_observed:['', Validators.compose([Validators.required])],
|
||||
@ -234,7 +392,67 @@ export class StockComponent implements OnInit {
|
||||
rawmaterial_remarks:['']
|
||||
});
|
||||
}
|
||||
createGoods() {
|
||||
|
||||
|
||||
createRawmaterial(records) {
|
||||
// console.log(330,'function in');
|
||||
if(records === null) {
|
||||
// console.log(331,'fif');
|
||||
return this.fb.group({
|
||||
raw_name: [''],
|
||||
stock_observed:[''],
|
||||
raw_quantity: [''],
|
||||
raw_uom: [''],
|
||||
other_uom : [''],
|
||||
raw_value: [''],
|
||||
rawmaterial_value: [''],
|
||||
is_sufficiant_raw: [''],
|
||||
rawmaterial_remarks:['']
|
||||
})
|
||||
} else {
|
||||
// console.log(343,'else');
|
||||
return this.fb.group({
|
||||
manufacturing_raw_material_name: [records.manufacturing_raw_material_name || null],
|
||||
raw_name: [records.raw_name],
|
||||
stock_observed:[records.stock_observed],
|
||||
raw_quantity: [records.raw_quantity],
|
||||
raw_uom: [records.raw_uom],
|
||||
other_uom : [records.other_uom],
|
||||
raw_value: [records.raw_value],
|
||||
rawmaterial_value: [records.rawmaterial_value],
|
||||
is_sufficiant_raw: [records.is_sufficiant_raw],
|
||||
rawmaterial_remarks:[records.rawmaterial_remarks]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
initRetailDetails(datas) {
|
||||
|
||||
const finishedGoods = <FormArray>this.stockForms.controls['retail_details']['controls'][0].controls['retail_finished_goods'];
|
||||
const tradedGoods = <FormArray>this.stockForms.controls['retail_details']['controls'][0].controls['retail_traded_goods'];
|
||||
|
||||
if(datas === null){
|
||||
|
||||
finishedGoods.push(this.createGoods(null));
|
||||
tradedGoods.push(this.createTradedGoods(null));
|
||||
|
||||
} else {
|
||||
|
||||
for (let val of datas.retail_finished_goods) {
|
||||
console.log(val);
|
||||
|
||||
finishedGoods.push(this.createGoods(val));
|
||||
|
||||
}
|
||||
for (let val of datas.retail_traded_goods) {
|
||||
console.log(val);
|
||||
tradedGoods.push(this.createTradedGoods(val));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
createGoods2() {
|
||||
return this.fb.group({
|
||||
goods_name: ['', Validators.compose([Validators.required])],
|
||||
goods_observed: ['', Validators.compose([Validators.required])],
|
||||
@ -246,7 +464,33 @@ export class StockComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
createTradedGoods() {
|
||||
createGoods(records) {
|
||||
if(records === null) {
|
||||
return this.fb.group({
|
||||
goods_name: [''],
|
||||
goods_observed: [''],
|
||||
goods_quantity: [''],
|
||||
goods_value: [''],
|
||||
finished_goods_value: [''],
|
||||
is_sufficiant_goods: [''],
|
||||
finishedgoods_remarks:['']
|
||||
});
|
||||
}
|
||||
else {
|
||||
return this.fb.group({
|
||||
goods_name: [records.goods_name],
|
||||
goods_observed: [records.goods_observed],
|
||||
goods_quantity: [records.goods_quantity],
|
||||
goods_value: [records.goods_value],
|
||||
finished_goods_value: [records.finished_goods_value],
|
||||
is_sufficiant_goods: [records.is_sufficiant_goods],
|
||||
finishedgoods_remarks:[records.finishedgoods_remarks]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
createTradedGoods2() {
|
||||
return this.fb.group({
|
||||
traded_goods_name: ['', Validators.compose([Validators.required])],
|
||||
traded_goods_observed: ['', Validators.compose([Validators.required])],
|
||||
@ -257,64 +501,231 @@ export class StockComponent implements OnInit {
|
||||
traded_goods_remarks:['']
|
||||
});
|
||||
}
|
||||
addRawMaterials() {
|
||||
const control = <FormArray>this.stockForm.controls['raw_materials'];
|
||||
control.push(this.createRawmaterial());
|
||||
}
|
||||
deleteRawMaterials(index) {
|
||||
const control = <FormArray>this.stockForm.controls['raw_materials'];
|
||||
control.removeAt(index);
|
||||
}
|
||||
addGoods() {
|
||||
const control = <FormArray>this.stockForm.controls['finished_goods'];
|
||||
control.push(this.createGoods());
|
||||
}
|
||||
deleteGoods(index) {
|
||||
const control = <FormArray>this.stockForm.controls['finished_goods'];
|
||||
control.removeAt(index);
|
||||
}
|
||||
addTradedGoods() {
|
||||
const control = <FormArray>this.stockForm.controls['traded_goods'];
|
||||
control.push(this.createTradedGoods());
|
||||
}
|
||||
deleteTradedGoods(index) {
|
||||
const control = <FormArray>this.stockForm.controls['traded_goods'];
|
||||
control.removeAt(index);
|
||||
|
||||
initTradingDetails(datas) {
|
||||
|
||||
const finishedGoods = <FormArray>this.stockForms.controls['trade_details']['controls'][0].controls['trading_finished_goods'];
|
||||
const tradedGoods = <FormArray>this.stockForms.controls['trade_details']['controls'][0].controls['trading_traded_goods'];
|
||||
|
||||
if(datas === null){
|
||||
|
||||
finishedGoods.push(this.createGoods(null));
|
||||
tradedGoods.push(this.createTradedGoods(null));
|
||||
|
||||
} else {
|
||||
// for (let val of datas) {
|
||||
|
||||
// finishedGoods.push(this.createGoods(val.trading_finished_goods));
|
||||
// tradedGoods.push(this.createTradedGoods(val.trading_traded_goods));
|
||||
|
||||
// }
|
||||
|
||||
for (let val of datas.trading_finished_goods) {
|
||||
console.log(val);
|
||||
|
||||
finishedGoods.push(this.createGoods(val));
|
||||
|
||||
}
|
||||
for (let val of datas.trading_traded_goods) {
|
||||
console.log(val);
|
||||
tradedGoods.push(this.createTradedGoods(val));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
submitDetails() {
|
||||
if (!this.stockForm.valid) {
|
||||
return;
|
||||
}
|
||||
let records: any = {};
|
||||
records.pdid = this.pdid;
|
||||
records.formid = this.form_id;
|
||||
records.fk_createdby = this.pdid;
|
||||
if(this.rawMaterialAccess == true){
|
||||
records.raw_materials = this.stockForm.controls['raw_materials'].value; }
|
||||
if(this.finishedGoodsAccess == true){
|
||||
records.finished_goods = this.stockForm.controls['finished_goods'].value;}
|
||||
if(this.tradeConcernAccess == true){
|
||||
records.traded_goods = this.stockForm.controls['traded_goods'].value; }
|
||||
records.stock_remarks = this.stockForm.controls['stock_remarks'].value;
|
||||
//console.log('data', records);
|
||||
this._pd.saveForm(records).subscribe(data => {
|
||||
//console.log('data', data);
|
||||
this.notifier.notify('success', 'Saved Successfully.');
|
||||
}, error => {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
})
|
||||
}
|
||||
validateAllFormFields(formGroup: FormGroup) {
|
||||
Object.keys(formGroup.controls).forEach(field => {
|
||||
const control = formGroup.get(field);
|
||||
if (control instanceof FormControl) {
|
||||
control.markAsTouched({onlySelf: true});
|
||||
} else if (control instanceof FormGroup) {
|
||||
this.validateAllFormFields(control);
|
||||
}
|
||||
|
||||
createTradedGoods(records) {
|
||||
if(records === null) {
|
||||
return this.fb.group({
|
||||
traded_goods_name: [''],
|
||||
traded_goods_observed: [''],
|
||||
traded_goods_quantity: [''],
|
||||
estimated_traded_goods_value: [''],
|
||||
traded_goods_value: [''],
|
||||
is_sufficiant_traded_goods: [''],
|
||||
traded_goods_remarks:['']
|
||||
});
|
||||
}
|
||||
else {
|
||||
return this.fb.group({
|
||||
traded_goods_name: [records.traded_goods_name],
|
||||
traded_goods_observed: [records.traded_goods_observed],
|
||||
traded_goods_quantity: [records.traded_goods_quantity],
|
||||
estimated_traded_goods_value: [records.estimated_traded_goods_value],
|
||||
traded_goods_value: [records.traded_goods_value],
|
||||
is_sufficiant_traded_goods: [records.is_sufficiant_traded_goods],
|
||||
traded_goods_remarks:[records.traded_goods_remarks]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
addRawMaterials(flag) {
|
||||
|
||||
if(flag==1){
|
||||
const control = <FormArray>this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_raw_materials'];
|
||||
control.push(this.createRawmaterial(null));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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: {
|
||||
const control = <FormArray>this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods'];
|
||||
control.push(this.createGoods(null));
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
const control = <FormArray>this.stockForms.controls['retail_details']['controls'][0].controls['retail_finished_goods'];
|
||||
control.push(this.createGoods(null));
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
const control = <FormArray>this.stockForms.controls['trade_details']['controls'][0].controls['trading_finished_goods'];
|
||||
control.push(this.createGoods(null));
|
||||
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: {
|
||||
const control = <FormArray>this.stockForms.controls['retail_details']['controls'][0].controls['retail_finished_goods'];
|
||||
control.removeAt(index);
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
const control = <FormArray>this.stockForms.controls['trade_details']['controls'][0].controls['trading_finished_goods'];
|
||||
control.removeAt(index);
|
||||
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'];
|
||||
}
|
||||
|
||||
addTradedGoods(flag) {
|
||||
// const control = <FormArray>this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_traded_goods'];
|
||||
// //const control = <FormArray>this.stockForms.controls['traded_goods'];
|
||||
|
||||
// control.push(this.createTradedGoods(null));
|
||||
switch(flag){
|
||||
case 1: {
|
||||
const control = <FormArray>this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_traded_goods'];
|
||||
control.push(this.createTradedGoods(null));
|
||||
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: {
|
||||
const control = <FormArray>this.stockForms.controls['trade_details']['controls'][0].controls['trading_traded_goods'];
|
||||
control.push(this.createTradedGoods(null));
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
deleteTradedGoods(index,flag) {
|
||||
switch(flag){
|
||||
case 1: {
|
||||
const control = <FormArray>this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_traded_goods'];
|
||||
control.removeAt(index);
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
const control = <FormArray>this.stockForms.controls['retail_details']['controls'][0].controls['retail_traded_goods'];
|
||||
control.removeAt(index);
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
const control = <FormArray>this.stockForms.controls['trade_details']['controls'][0].controls['trading_traded_goods'];
|
||||
control.removeAt(index);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//const control = <FormArray>this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_traded_goods'];
|
||||
//const control = <FormArray>this.stockForms.controls['traded_goods'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
/** To Save/Edited Popup Data */
|
||||
submitDetails(e) {
|
||||
this.submitted = true;
|
||||
// stop here if form is invalid
|
||||
// if (this.stockForms.invalid) {
|
||||
// return;
|
||||
// } else {
|
||||
var answerFormValues = this.stockForms.value;
|
||||
|
||||
//To Remove The "Null" With Key also
|
||||
Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]);
|
||||
|
||||
this._pd.savePDFormDetailsWithID(answerFormValues).subscribe(
|
||||
dataresult => {
|
||||
if (dataresult.status == 200) {
|
||||
|
||||
this.notifier.notify('success', 'Record Saved Successfully.!');
|
||||
|
||||
}
|
||||
else {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
|
||||
}
|
||||
}, error => {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
|
||||
});
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
// validateAllFormFields(formGroup: FormGroup) {
|
||||
// Object.keys(formGroup.controls).forEach(field => {
|
||||
// const control = formGroup.get(field);
|
||||
// if (control instanceof FormControl) {
|
||||
// control.markAsTouched({onlySelf: true});
|
||||
// } else if (control instanceof FormGroup) {
|
||||
// this.validateAllFormFields(control);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
getUOM() {
|
||||
this._pd.getAllMasterDatas('UOM').subscribe(data => {
|
||||
|
||||
@ -352,134 +763,4 @@ export class StockComponent implements OnInit {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Validation Dynamically Add And Remove
|
||||
GoodsValidation(event: any){
|
||||
// console.log('First Time',event);
|
||||
// console.log('First Time Value',event.value);
|
||||
|
||||
const control = <FormArray>this.stockForm.controls['finished_goods'];
|
||||
|
||||
if(event.value == 'no') {
|
||||
|
||||
control.controls[0].get('goods_quantity').setValidators([Validators.required]);
|
||||
control.controls[0].get('goods_quantity').updateValueAndValidity();
|
||||
|
||||
control.controls[0].get('goods_value').setValidators([Validators.required]);
|
||||
control.controls[0].get('goods_value').updateValueAndValidity();
|
||||
|
||||
control.controls[0].get('finished_goods_value').setValidators([Validators.required]);
|
||||
control.controls[0].get('finished_goods_value').updateValueAndValidity();
|
||||
|
||||
control.controls[0].get('is_sufficiant_goods').setValidators([Validators.required]);
|
||||
control.controls[0].get('is_sufficiant_goods').updateValueAndValidity();
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
if(event.value == 'yes') {
|
||||
|
||||
control.controls[0].get('goods_quantity').clearValidators();
|
||||
control.controls[0].get('goods_quantity').updateValueAndValidity();
|
||||
|
||||
control.controls[0].get('goods_value').clearValidators();
|
||||
control.controls[0].get('goods_value').updateValueAndValidity();
|
||||
|
||||
control.controls[0].get('finished_goods_value').clearValidators();
|
||||
control.controls[0].get('finished_goods_value').updateValueAndValidity();
|
||||
|
||||
control.controls[0].get('is_sufficiant_goods').clearValidators();
|
||||
control.controls[0].get('is_sufficiant_goods').updateValueAndValidity();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RawMaterialValidation(event: any){
|
||||
// console.log('First Time',event);
|
||||
// console.log('First Time Value',event.value);
|
||||
|
||||
const control = <FormArray>this.stockForm.controls['raw_materials'];
|
||||
|
||||
if(event.value == 'no') {
|
||||
|
||||
control.controls[0].get('raw_quantity').setValidators([Validators.required]);
|
||||
control.controls[0].get('raw_quantity').updateValueAndValidity();
|
||||
|
||||
control.controls[0].get('raw_uom').setValidators([Validators.required]);
|
||||
control.controls[0].get('raw_uom').updateValueAndValidity();
|
||||
|
||||
control.controls[0].get('raw_value').setValidators([Validators.required]);
|
||||
control.controls[0].get('raw_value').updateValueAndValidity();
|
||||
|
||||
control.controls[0].get('rawmaterial_value').setValidators([Validators.required]);
|
||||
control.controls[0].get('rawmaterial_value').updateValueAndValidity();
|
||||
|
||||
control.controls[0].get('is_sufficiant_raw').setValidators([Validators.required]);
|
||||
control.controls[0].get('is_sufficiant_raw').updateValueAndValidity();
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
if(event.value == 'yes') {
|
||||
|
||||
control.controls[0].get('raw_quantity').clearValidators();
|
||||
control.controls[0].get('raw_quantity').updateValueAndValidity();
|
||||
|
||||
control.controls[0].get('raw_uom').clearValidators();
|
||||
control.controls[0].get('raw_uom').updateValueAndValidity();
|
||||
|
||||
control.controls[0].get('raw_value').clearValidators();
|
||||
control.controls[0].get('raw_value').updateValueAndValidity();
|
||||
|
||||
control.controls[0].get('rawmaterial_value').clearValidators();
|
||||
control.controls[0].get('rawmaterial_value').updateValueAndValidity();
|
||||
|
||||
control.controls[0].get('is_sufficiant_raw').clearValidators();
|
||||
control.controls[0].get('is_sufficiant_raw').updateValueAndValidity();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TradedGoodsValidation(event: any){
|
||||
console.log('First Time',event);
|
||||
console.log('First Time Value',event.value);
|
||||
|
||||
const control = <FormArray>this.stockForm.controls['tradeded_goods'];
|
||||
|
||||
if(event.value == 'no') {
|
||||
|
||||
control.controls[0].get('traded_goods_quantity').setValidators([Validators.required]);
|
||||
control.controls[0].get('traded_goods_quantity').updateValueAndValidity();
|
||||
|
||||
control.controls[0].get('estimated_traded_goods_value').setValidators([Validators.required]);
|
||||
control.controls[0].get('estimated_traded_goods_value').updateValueAndValidity();
|
||||
|
||||
control.controls[0].get('traded_goods_value').setValidators([Validators.required]);
|
||||
control.controls[0].get('traded_goods_value').updateValueAndValidity();
|
||||
|
||||
control.controls[0].get('is_sufficiant_traded_goods').setValidators([Validators.required]);
|
||||
control.controls[0].get('is_sufficiant_traded_goods').updateValueAndValidity();
|
||||
}
|
||||
else
|
||||
if(event.value == 'yes') {
|
||||
|
||||
control.controls[0].get('traded_goods_quantity').clearValidators();
|
||||
control.controls[0].get('traded_goods_quantity').updateValueAndValidity();
|
||||
|
||||
control.controls[0].get('estimated_traded_goods_value').clearValidators();
|
||||
control.controls[0].get('estimated_traded_goods_value').updateValueAndValidity();
|
||||
|
||||
control.controls[0].get('traded_goods_value').clearValidators();
|
||||
control.controls[0].get('traded_goods_value').updateValueAndValidity();
|
||||
|
||||
control.controls[0].get('is_sufficiant_traded_goods').clearValidators();
|
||||
control.controls[0].get('is_sufficiant_traded_goods').updateValueAndValidity();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user