fixes : ps
This commit is contained in:
parent
460ae97a86
commit
a418fb42c0
File diff suppressed because one or more lines are too long
2042
package-lock.json
generated
2042
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -27,7 +27,6 @@
|
|||||||
<mat-select placeholder="Financial Statements Available ?" formControlName="is_financial_statements" (selectionChange)="selectedStatement($event.value)">
|
<mat-select placeholder="Financial Statements Available ?" formControlName="is_financial_statements" (selectionChange)="selectedStatement($event.value)">
|
||||||
<mat-option value="yes">Yes</mat-option>
|
<mat-option value="yes">Yes</mat-option>
|
||||||
<mat-option value="no">No</mat-option>
|
<mat-option value="no">No</mat-option>
|
||||||
|
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<div *ngIf="isDisplay">
|
<div *ngIf="isDisplay">
|
||||||
@ -51,7 +50,8 @@
|
|||||||
<div *ngIf="i>0">
|
<div *ngIf="i>0">
|
||||||
<!-- <mat-label>Sale Variation from Previous Year in %</mat-label> - -->
|
<!-- <mat-label>Sale Variation from Previous Year in %</mat-label> - -->
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<input matInput placeholder="Sale Variation from Previous Year in %" formControlName="financial_annualsales_variation" (keypress)="keyPress($event)" readonly>
|
<input matInput placeholder="Sale Variation from Previous Year in %" formControlName="financial_annualsales_variation" [ngClass]="details.get('financial_annualsales_variation').value > 0 ? 'greenhighlight' : 'highlight'"
|
||||||
|
(keypress)="keyPress($event)" readonly>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<p class="info" *ngIf="details.get('financial_annualsales_variation').value != '' " >
|
<p class="info" *ngIf="details.get('financial_annualsales_variation').value != '' " >
|
||||||
<span *ngIf="details.get('financial_annualsales_variation').value == 0">
|
<span *ngIf="details.get('financial_annualsales_variation').value == 0">
|
||||||
|
|||||||
@ -389,7 +389,8 @@ submitDetails(){
|
|||||||
annual_sale = val.financial_annual_sale;
|
annual_sale = val.financial_annual_sale;
|
||||||
|
|
||||||
/** Calculating Sale Variation Based on Prev.Year ( Datas returns in percentage )
|
/** Calculating Sale Variation Based on Prev.Year ( Datas returns in percentage )
|
||||||
* Label name = " Sale Variation from Previous Year in % "
|
* Explaination : Comparing Curr.Year annual sales and Prev.year annual sales
|
||||||
|
* Label name : " Sale Variation from Previous Year in % "
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (index != 0) {
|
if (index != 0) {
|
||||||
@ -412,7 +413,8 @@ submitDetails(){
|
|||||||
loss_amt = val.financial_net_loss;
|
loss_amt = val.financial_net_loss;
|
||||||
|
|
||||||
/** Calculating Profit's Variation - STARTS HERE
|
/** Calculating Profit's Variation - STARTS HERE
|
||||||
* Label name = "Profit Variation from Previous Year in %"
|
* Explaination : Comparing Curr.Year Net Profit (or) Loss Amount With Prev.year Net Profit (or) Loss Amount
|
||||||
|
* Label name : "Profit Variation from Previous Year in %"
|
||||||
*/
|
*/
|
||||||
if((profit_amt != '' || loss_amt != '') && index != 0) {
|
if((profit_amt != '' || loss_amt != '') && index != 0) {
|
||||||
if(+profit_amt > +annual_sale){
|
if(+profit_amt > +annual_sale){
|
||||||
@ -433,7 +435,8 @@ submitDetails(){
|
|||||||
/********************************* Calculating Profit's Variation - ENDS HERE **************************************************************/
|
/********************************* Calculating Profit's Variation - ENDS HERE **************************************************************/
|
||||||
|
|
||||||
/** Calculating Net Profit (or) Net Loss (and) Sales's Profit Variation
|
/** Calculating Net Profit (or) Net Loss (and) Sales's Profit Variation
|
||||||
* Label name = "Net Profit to Sales in % (or) Net Loss to Sales in %
|
* Explaination : Comparing Curr.Year Net Profit Amount With Curr.year Annual Sales Amount ( like wise loss )
|
||||||
|
* Label name : "Net Profit to Sales in % (or) Net Loss to Sales in %
|
||||||
**/
|
**/
|
||||||
let SelectedlossOrProfit = val.finanical_profit_or_loss;
|
let SelectedlossOrProfit = val.finanical_profit_or_loss;
|
||||||
|
|
||||||
@ -444,8 +447,7 @@ submitDetails(){
|
|||||||
|
|
||||||
if (annual_sale != '' && val.financial_net_profit != '') {
|
if (annual_sale != '' && val.financial_net_profit != '') {
|
||||||
if(+profit_amt>+annual_sale){
|
if(+profit_amt>+annual_sale){
|
||||||
// alert("profit is greater than Annual Sale ");
|
alert("profit is greater than Annual Sale ");
|
||||||
this.toast.pdTriggerappmessage("profit is greater than Annual Sale ")
|
|
||||||
childArray.controls.financial_net_profit.setValue(0);
|
childArray.controls.financial_net_profit.setValue(0);
|
||||||
childArray.controls.financial_margin_of_profit.setValue('');
|
childArray.controls.financial_margin_of_profit.setValue('');
|
||||||
childArray.controls.financial_profit_to_sale_variation.setValue('');
|
childArray.controls.financial_profit_to_sale_variation.setValue('');
|
||||||
@ -464,8 +466,7 @@ submitDetails(){
|
|||||||
|
|
||||||
if (annual_sale != '' && val.financial_net_loss != '') {
|
if (annual_sale != '' && val.financial_net_loss != '') {
|
||||||
if(+val.financial_net_loss>+annual_sale){
|
if(+val.financial_net_loss>+annual_sale){
|
||||||
// alert("Loss is greater than Annual Sale ");
|
alert("Loss is greater than Annual Sale ");
|
||||||
this.toast.pdTriggerappmessage("Loss is greater than Annual Sale ")
|
|
||||||
childArray.controls.financial_net_loss.setValue(0);
|
childArray.controls.financial_net_loss.setValue(0);
|
||||||
childArray.controls.financial_margin_of_loss.setValue('');
|
childArray.controls.financial_margin_of_loss.setValue('');
|
||||||
childArray.controls.financial_profit_to_sale_variation.setValue('');
|
childArray.controls.financial_profit_to_sale_variation.setValue('');
|
||||||
@ -488,9 +489,14 @@ submitDetails(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// console.log('val.financial_margin_of_profit',val.financial_margin_of_profit);
|
||||||
|
// console.log('profit_margin',profit_margin);
|
||||||
|
// console.log('childArray.controls.financial_margin_of_loss',childArray.controls.financial_margin_of_loss.value);
|
||||||
|
// prev_profit_margin[index] = val.financial_margin_of_profit != '' ? val.financial_margin_of_profit: 0;
|
||||||
|
// prev_loss_margin[index] = val.financial_margin_of_loss !='' ? val.financial_margin_of_loss : 0 ;
|
||||||
|
prev_profit_margin[index] = profit_margin != '' ? profit_margin : 0;
|
||||||
|
prev_loss_margin[index] = loss_margin !='' ? loss_margin : 0 ;
|
||||||
|
|
||||||
prev_profit_margin[index] = val.financial_margin_of_profit != '' ? val.financial_margin_of_profit: 0;
|
|
||||||
prev_loss_margin[index] = val.financial_margin_of_loss !='' ? val.financial_margin_of_loss : 0 ;
|
|
||||||
|
|
||||||
// if(index != 0 ){
|
// if(index != 0 ){
|
||||||
|
|
||||||
@ -511,11 +517,21 @@ submitDetails(){
|
|||||||
if ((profit_margin != '' || loss_margin != '') && index != 0) {
|
if ((profit_margin != '' || loss_margin != '') && index != 0) {
|
||||||
|
|
||||||
|
|
||||||
|
// console.log('temp_prev_losses',prev_loss_margin);
|
||||||
|
// console.log('temp_prev_profits',prev_profit_margin);
|
||||||
|
|
||||||
|
// console.log('curr index',index);
|
||||||
|
|
||||||
loss_margin = loss_margin !== undefined ? loss_margin : 0;
|
loss_margin = loss_margin !== undefined ? loss_margin : 0;
|
||||||
profit_margin = profit_margin !== undefined ? profit_margin:0;
|
profit_margin = profit_margin !== undefined ? profit_margin:0;
|
||||||
let temp_prev_loss_margin = prev_loss_margin[index-1] !== undefined ? prev_loss_margin[index-1] : 0 ;
|
let temp_prev_loss_margin = prev_loss_margin[index-1] !== undefined ? prev_loss_margin[index-1] : 0 ;
|
||||||
let temp_prev_profit_margin = prev_profit_margin[index-1] !== undefined ? prev_profit_margin[index-1] : 0 ;
|
let temp_prev_profit_margin = prev_profit_margin[index-1] !== undefined ? prev_profit_margin[index-1] : 0 ;
|
||||||
|
|
||||||
|
// console.log('profit_margin',profit_margin);
|
||||||
|
// console.log('pre year loss_margin',temp_prev_loss_margin);
|
||||||
|
// console.log('loss_margin',loss_margin);
|
||||||
|
// console.log('pre year profit_margin',temp_prev_profit_margin);
|
||||||
|
|
||||||
|
|
||||||
if(annual_sale != ''){
|
if(annual_sale != ''){
|
||||||
|
|
||||||
@ -535,6 +551,7 @@ submitDetails(){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
confirmAlert(i, details){
|
confirmAlert(i, details){
|
||||||
|
|
||||||
let estimate_sales_from = +details.value.estimate_sales_from;
|
let estimate_sales_from = +details.value.estimate_sales_from;
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
<mat-select placeholder="Stock" formControlName="stock_observed" (selectionChange)="checkComments($event.value,1,a)">
|
<mat-select placeholder="Stock" formControlName="stock_observed" (selectionChange)="checkComments($event.value,1,a)">
|
||||||
<mat-option value="yes">Add Stock Details</mat-option>
|
<mat-option value="yes">Add Stock Details</mat-option>
|
||||||
<mat-option value="no">No Stock Observed</mat-option>
|
<mat-option value="no">No Stock Observed</mat-option>
|
||||||
<mat-option value="stock not required to be maintained">Stock not required to be maintained</mat-option>
|
<!-- <mat-option value="stock not required to be maintained">Stock not required to be maintained</mat-option> -->
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<span *ngIf="mrm.get('stock_observed').value == 'yes'">
|
<span *ngIf="mrm.get('stock_observed').value == 'yes'">
|
||||||
@ -77,8 +77,12 @@
|
|||||||
<mat-placeholder>Is the stock of Raw Materials observed, sufficient considering the size of operations</mat-placeholder><br/>
|
<mat-placeholder>Is the stock of Raw Materials observed, sufficient considering the size of operations</mat-placeholder><br/>
|
||||||
<mat-select
|
<mat-select
|
||||||
formControlName="is_sufficiant_raw"><!-- (selectionChange)="checkComments($event.value,1,a)" -->
|
formControlName="is_sufficiant_raw"><!-- (selectionChange)="checkComments($event.value,1,a)" -->
|
||||||
<mat-option value="yes">Yes</mat-option>
|
<mat-option *ngFor="let val of RMsufficientList" [value]="val.value" [disabled]="val.disabled">
|
||||||
|
{{val.isdisplayvalue}}
|
||||||
|
</mat-option>
|
||||||
|
<!-- <mat-option value="yes">Yes</mat-option>
|
||||||
<mat-option value="no">No</mat-option>
|
<mat-option value="no">No</mat-option>
|
||||||
|
<mat-option value="not applicable">Stock not required to be maintained</mat-option> -->
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field *ngIf="md.get('is_sufficiant_raw').value == 'no'" appearance="outline" style="width: 100%">
|
<mat-form-field *ngIf="md.get('is_sufficiant_raw').value == 'no'" appearance="outline" style="width: 100%">
|
||||||
@ -101,7 +105,6 @@
|
|||||||
<mat-select placeholder="Stock" formControlName="goods_observed" (selectionChange)="checkComments($event.value,2,b)">
|
<mat-select placeholder="Stock" formControlName="goods_observed" (selectionChange)="checkComments($event.value,2,b)">
|
||||||
<mat-option value="yes">Add Stock Details</mat-option>
|
<mat-option value="yes">Add Stock Details</mat-option>
|
||||||
<mat-option value="no">No Stock Observed</mat-option>
|
<mat-option value="no">No Stock Observed</mat-option>
|
||||||
<mat-option value="stock not required to be maintained">Stock not required to be maintained</mat-option>
|
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<span *ngIf="mfg.get('goods_observed').value == 'yes'">
|
<span *ngIf="mfg.get('goods_observed').value == 'yes'">
|
||||||
@ -175,7 +178,6 @@
|
|||||||
<mat-select placeholder="Stock" formControlName="traded_goods_observed" (selectionChange)="checkComments($event.value,3,e)">
|
<mat-select placeholder="Stock" formControlName="traded_goods_observed" (selectionChange)="checkComments($event.value,3,e)">
|
||||||
<mat-option value="yes">Add Stock Details</mat-option>
|
<mat-option value="yes">Add Stock Details</mat-option>
|
||||||
<mat-option value="no">No Stock Observed</mat-option>
|
<mat-option value="no">No Stock Observed</mat-option>
|
||||||
<mat-option value="stock not required to be maintained">Stock not required to be maintained</mat-option>
|
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<span *ngIf="item.get('traded_goods_observed').value == 'yes'">
|
<span *ngIf="item.get('traded_goods_observed').value == 'yes'">
|
||||||
@ -315,8 +317,12 @@
|
|||||||
<mat-placeholder>Is the stock of finished / traded goods observed, sufficient considering the size of operations</mat-placeholder><br/>
|
<mat-placeholder>Is the stock of finished / traded goods observed, sufficient considering the size of operations</mat-placeholder><br/>
|
||||||
<mat-select formControlName="is_sufficiant_finished_and_traded_goods">
|
<mat-select formControlName="is_sufficiant_finished_and_traded_goods">
|
||||||
<mat-option>Select</mat-option>
|
<mat-option>Select</mat-option>
|
||||||
<mat-option value="yes" >Yes</mat-option>
|
<mat-option *ngFor="let val of TGsufficientList" [value]="val.value" [disabled]="val.isdisabled">
|
||||||
|
{{val.isdisplayvalue}}
|
||||||
|
</mat-option>
|
||||||
|
<!-- <mat-option value="yes" >Yes</mat-option>
|
||||||
<mat-option value="no" >No</mat-option>
|
<mat-option value="no" >No</mat-option>
|
||||||
|
<mat-option value="not applicable">Stock not required to be maintained</mat-option> -->
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field appearance="outline" style="width: 100%" *ngIf="this.stockForm.controls.is_sufficiant_finished_and_traded_goods.value == 'no'">
|
<mat-form-field appearance="outline" style="width: 100%" *ngIf="this.stockForm.controls.is_sufficiant_finished_and_traded_goods.value == 'no'">
|
||||||
|
|||||||
@ -25,49 +25,50 @@ export class PdQuestionStockInfoPage {
|
|||||||
users: any;
|
users: any;
|
||||||
formDetails: any;
|
formDetails: any;
|
||||||
pdDetails: any;
|
pdDetails: any;
|
||||||
company_id : any;
|
company_id: any;
|
||||||
pdid:any;
|
pdid: any;
|
||||||
stockForm: FormGroup;
|
stockForm: FormGroup;
|
||||||
noRecordsFound: Boolean;
|
noRecordsFound: Boolean;
|
||||||
errorMessage: any = '';
|
errorMessage: any = '';
|
||||||
M_rawValueInWords : any = [];
|
M_rawValueInWords: any = [];
|
||||||
M_goodsValueInWords : any = [];
|
M_goodsValueInWords: any = [];
|
||||||
R_tradedGoodsValueInWords : any = [];
|
R_tradedGoodsValueInWords: any = [];
|
||||||
T_tradedGoodsValueInWords : any = [];
|
T_tradedGoodsValueInWords: any = [];
|
||||||
mrmCommentFlag:any=[];
|
mrmCommentFlag: any = [];
|
||||||
mfgCommentFlag:any=[];
|
mfgCommentFlag: any = [];
|
||||||
rtrdCommentFlag:any=[];
|
rtrdCommentFlag: any = [];
|
||||||
wtrdCommentFlag:any=[];
|
wtrdCommentFlag: any = [];
|
||||||
serviceProviderForm: Boolean = false;
|
serviceProviderForm: Boolean = false;
|
||||||
suppliers_raw_materials : any = [];
|
suppliers_raw_materials: any = [];
|
||||||
suppliers_retail_trade_details : any = [];
|
suppliers_retail_trade_details: any = [];
|
||||||
suppliers_wholesale_trade_details : any = [];
|
suppliers_wholesale_trade_details: any = [];
|
||||||
suppliers_finished_goods : any =[];
|
suppliers_finished_goods: any = [];
|
||||||
|
|
||||||
RMCommentCard: boolean = false;
|
RMCommentCard: boolean = false;
|
||||||
TGCommentCard: boolean = false
|
TGCommentCard: boolean = false
|
||||||
|
public RMsufficientList: any = [{value:"yes",isdisplayvalue:"Yes",disabled:false},{value:"no",isdisplayvalue:"No",disabled:false},{value:"not applicable",isdisplayvalue:"Stock not required to be maintained",disabled:false}];
|
||||||
|
public TGsufficientList: any = [{value:"yes",isdisplayvalue:"Yes",isdisabled:false},{value:"no",isdisplayvalue:"No",isdisabled:false},{value:"not applicable",isdisplayvalue:"Stock not required to be maintained",isdisabled:false}];
|
||||||
|
|
||||||
constructor(public navCtrl: NavController, public navParams: NavParams, public qustCat: QuestionCategoryProvider, public aws: AwsServiceProvider, public toast: ToastProvider, public fb: FormBuilder,public constant:ConstantsProvider) {
|
constructor(public navCtrl: NavController, public navParams: NavParams, public qustCat: QuestionCategoryProvider, public aws: AwsServiceProvider, public toast: ToastProvider, public fb: FormBuilder, public constant: ConstantsProvider) {
|
||||||
this.pdDetails = this.navParams.get('pdDetails');
|
this.pdDetails = this.navParams.get('pdDetails');
|
||||||
this.formDetails=this.navParams.get('formDetails');
|
this.formDetails = this.navParams.get('formDetails');
|
||||||
this.users = this.aws.getlocale();
|
this.users = this.aws.getlocale();
|
||||||
this.company_id=this.pdDetails.company_id;
|
this.company_id = this.pdDetails.company_id;
|
||||||
this.pdid=this.pdDetails.pd_id;
|
this.pdid = this.pdDetails.pd_id;
|
||||||
this.qustCat.stockFormAccess(this.pdid,this.company_id).subscribe(data => {
|
this.qustCat.stockFormAccess(this.pdid, this.company_id).subscribe(data => {
|
||||||
if(data.dataStatus == true){
|
if (data.dataStatus == true) {
|
||||||
this.initstockForm(data.record);
|
this.initstockForm(data.record);
|
||||||
}
|
}
|
||||||
else if(data.dataStatus == false)
|
else if (data.dataStatus == false) {
|
||||||
{
|
this.toast.pdTriggerappmessage('Fill Business Form First! / No Company Found at this ID ' + this.company_id);
|
||||||
this.toast.pdTriggerappmessage('Fill Business Form First! / No Company Found at this ID '+ this.company_id );
|
|
||||||
this.noRecordsFound = false;
|
this.noRecordsFound = false;
|
||||||
this.errorMessage = 'Fill Business Form First! / No Company Found at this ID' + this.company_id +'! ....';
|
this.errorMessage = 'Fill Business Form First! / No Company Found at this ID' + this.company_id + '! ....';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
this.toast.pdTriggerappmessage('Fill Business Form First! / No Company Found at this ID '+ this.company_id );
|
this.toast.pdTriggerappmessage('Fill Business Form First! / No Company Found at this ID ' + this.company_id);
|
||||||
this.noRecordsFound = false;
|
this.noRecordsFound = false;
|
||||||
this.errorMessage = 'Fill Business Form First! / No Company Found at this ID' + this.company_id +'! ....';
|
this.errorMessage = 'Fill Business Form First! / No Company Found at this ID' + this.company_id + '! ....';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}, err => {
|
}, err => {
|
||||||
@ -78,11 +79,13 @@ export class PdQuestionStockInfoPage {
|
|||||||
this.getdropdown();
|
this.getdropdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public initstockForm(record){
|
public initstockForm(record) {
|
||||||
let api = Object.keys(record.from_business).map(function (key) {
|
let api = Object.keys(record.from_business).map(function (key) {
|
||||||
return record.from_business[key];
|
return record.from_business[key];
|
||||||
});
|
});
|
||||||
if(record.from_business.length>0){
|
if (record.from_business.length > 0) {
|
||||||
|
let type2 = record.from_business.filter(data => data.type_of_activity_id == 2);
|
||||||
|
let type2length = type2[0].hasOwnProperty("products") ? type2[0].products.length : 0;
|
||||||
let type3 = record.from_business.filter(data => data.type_of_activity_id == 3);
|
let type3 = record.from_business.filter(data => data.type_of_activity_id == 3);
|
||||||
let type3length = type3[0].hasOwnProperty("products") ? type3[0].products.length : 0;
|
let type3length = type3[0].hasOwnProperty("products") ? type3[0].products.length : 0;
|
||||||
let type4 = record.from_business.filter(data => data.type_of_activity_id == 4);
|
let type4 = record.from_business.filter(data => data.type_of_activity_id == 4);
|
||||||
@ -98,27 +101,27 @@ if(record.from_business.length>0){
|
|||||||
this.qustCat.retiverForm(params).subscribe(value => {
|
this.qustCat.retiverForm(params).subscribe(value => {
|
||||||
if (value['status'] == 200) {
|
if (value['status'] == 200) {
|
||||||
let dataForm = value['records'];
|
let dataForm = value['records'];
|
||||||
if(dataForm !== undefined) {
|
if (dataForm !== undefined) {
|
||||||
this.stockForm = this.fb.group({
|
this.stockForm = this.fb.group({
|
||||||
pdid: [this.pdid],
|
pdid: [this.pdid],
|
||||||
formid: [this.formDetails.form_id],
|
formid: [this.formDetails.form_id],
|
||||||
company_id: [this.company_id],
|
company_id: [this.company_id],
|
||||||
fk_createdby:[this.users],
|
fk_createdby: [this.users],
|
||||||
stock_remarks: [dataForm.stock_remarks],
|
stock_remarks: [dataForm.stock_remarks],
|
||||||
|
|
||||||
// is_sufficiant_raw:[dataForm.is_sufficiant_raw],
|
// is_sufficiant_raw:[dataForm.is_sufficiant_raw],
|
||||||
// rawmaterial_remarks:[dataForm.rawmaterial_remarks],
|
// rawmaterial_remarks:[dataForm.rawmaterial_remarks],
|
||||||
is_sufficiant_finished_and_traded_goods:[dataForm.is_sufficiant_finished_and_traded_goods],
|
is_sufficiant_finished_and_traded_goods: [dataForm.is_sufficiant_finished_and_traded_goods],
|
||||||
finished_and_traded_goods_remarks:[dataForm.finished_and_traded_goods_remarks],
|
finished_and_traded_goods_remarks: [dataForm.finished_and_traded_goods_remarks],
|
||||||
|
|
||||||
manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]),
|
manufacturing_details: this.fb.array([this.manufacturingFormCreation(record,type2length)]),
|
||||||
retail_details : this.fb.array([this.retailFormCreation(type3length)]),
|
retail_details: this.fb.array([this.retailFormCreation(type3length)]),
|
||||||
trade_details: this.fb.array([this.tradingFormCreation(type4length)]),
|
trade_details: this.fb.array([this.tradingFormCreation(type4length)]),
|
||||||
});
|
});
|
||||||
if(api.length > 0){
|
if (api.length > 0) {
|
||||||
api.forEach(val => {
|
api.forEach(val => {
|
||||||
if (val.type_of_activity_id == 2) {
|
if (val.type_of_activity_id == 2) {
|
||||||
if(val.products){
|
if (val.products) {
|
||||||
// if(dataForm.manufacturing_details[0].manufacturing_finished_goods ){this.finishedAndTradedGoodsCommentCard = true;}
|
// if(dataForm.manufacturing_details[0].manufacturing_finished_goods ){this.finishedAndTradedGoodsCommentCard = true;}
|
||||||
let manufacturing_temparr = [];
|
let manufacturing_temparr = [];
|
||||||
manufacturing_temparr['manufacturing_raw_materials'] = dataForm.manufacturing_details[0].manufacturing_raw_materials;
|
manufacturing_temparr['manufacturing_raw_materials'] = dataForm.manufacturing_details[0].manufacturing_raw_materials;
|
||||||
@ -129,7 +132,7 @@ if(record.from_business.length>0){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (val.type_of_activity_id == 3) {
|
if (val.type_of_activity_id == 3) {
|
||||||
if(val.products){
|
if (val.products) {
|
||||||
// this.finishedAndTradedGoodsCommentCard = true;
|
// this.finishedAndTradedGoodsCommentCard = true;
|
||||||
let retail_temparr = [];
|
let retail_temparr = [];
|
||||||
retail_temparr['retail_traded_goods'] = dataForm.retail_details[0].retail_traded_goods;
|
retail_temparr['retail_traded_goods'] = dataForm.retail_details[0].retail_traded_goods;
|
||||||
@ -138,16 +141,16 @@ if(record.from_business.length>0){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (val.type_of_activity_id == 4) {
|
if (val.type_of_activity_id == 4) {
|
||||||
if(val.products){
|
if (val.products) {
|
||||||
// this.finishedAndTradedGoodsCommentCard = true;
|
// this.finishedAndTradedGoodsCommentCard = true;
|
||||||
let trading_temparr = [];
|
let trading_temparr = [];
|
||||||
trading_temparr['trading_traded_goods'] = dataForm.trade_details[0].trading_traded_goods;
|
trading_temparr['trading_traded_goods'] = dataForm.trade_details[0].trading_traded_goods;
|
||||||
console.log("Trade",trading_temparr)
|
console.log("Trade", trading_temparr)
|
||||||
this.initTradingDetails(trading_temparr);
|
this.initTradingDetails(trading_temparr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (val.type_of_activity_id == 5) {
|
if (val.type_of_activity_id == 5) {
|
||||||
if(val.products){
|
if (val.products) {
|
||||||
this.serviceProviderForm = true;
|
this.serviceProviderForm = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,25 +158,25 @@ if(record.from_business.length>0){
|
|||||||
this.noRecordsFound = true;
|
this.noRecordsFound = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
this.stockForm = this.fb.group({
|
this.stockForm = this.fb.group({
|
||||||
pdid: [this.pdid],
|
pdid: [this.pdid],
|
||||||
formid: [this.formDetails.form_id],
|
formid: [this.formDetails.form_id],
|
||||||
company_id: [this.company_id],
|
company_id: [this.company_id],
|
||||||
fk_createdby:[this.users],
|
fk_createdby: [this.users],
|
||||||
stock_remarks: [''],
|
stock_remarks: [''],
|
||||||
// is_sufficiant_raw:[''],
|
// is_sufficiant_raw:[''],
|
||||||
// rawmaterial_remarks:[''],
|
// rawmaterial_remarks:[''],
|
||||||
is_sufficiant_finished_and_traded_goods:[''],
|
is_sufficiant_finished_and_traded_goods: [''],
|
||||||
finished_and_traded_goods_remarks:[''],
|
finished_and_traded_goods_remarks: [''],
|
||||||
manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]),
|
manufacturing_details: this.fb.array([this.manufacturingFormCreation(record,type2length)]),
|
||||||
retail_details : this.fb.array([this.retailFormCreation(type3length)]),
|
retail_details: this.fb.array([this.retailFormCreation(type3length)]),
|
||||||
trade_details: this.fb.array([this.tradingFormCreation(type4length)]),
|
trade_details: this.fb.array([this.tradingFormCreation(type4length)]),
|
||||||
});
|
});
|
||||||
if(api.length > 0){
|
if (api.length > 0) {
|
||||||
api.forEach(val => {
|
api.forEach(val => {
|
||||||
if (val.type_of_activity_id == 2) {
|
if (val.type_of_activity_id == 2) {
|
||||||
if(val.products){
|
if (val.products) {
|
||||||
// this.finishedAndTradedGoodsCommentCard = true;
|
// this.finishedAndTradedGoodsCommentCard = true;
|
||||||
this.suppliers_finished_goods = val.products;
|
this.suppliers_finished_goods = val.products;
|
||||||
this.initManufacturingDetails(null);
|
this.initManufacturingDetails(null);
|
||||||
@ -182,21 +185,21 @@ if(record.from_business.length>0){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (val.type_of_activity_id == 3) {
|
if (val.type_of_activity_id == 3) {
|
||||||
if(val.products){
|
if (val.products) {
|
||||||
// this.finishedAndTradedGoodsCommentCard = true;
|
// this.finishedAndTradedGoodsCommentCard = true;
|
||||||
this.suppliers_retail_trade_details = val.products;
|
this.suppliers_retail_trade_details = val.products;
|
||||||
this.initRetailDetails(null);
|
this.initRetailDetails(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (val.type_of_activity_id == 4) {
|
if (val.type_of_activity_id == 4) {
|
||||||
if(val.products){
|
if (val.products) {
|
||||||
// this.finishedAndTradedGoodsCommentCard = true;
|
// this.finishedAndTradedGoodsCommentCard = true;
|
||||||
this.suppliers_wholesale_trade_details =val.products;
|
this.suppliers_wholesale_trade_details = val.products;
|
||||||
this.initTradingDetails(null);
|
this.initTradingDetails(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (val.type_of_activity_id == 5) {
|
if (val.type_of_activity_id == 5) {
|
||||||
if(val.products){
|
if (val.products) {
|
||||||
// this.suppliers_service_product = val.products;
|
// this.suppliers_service_product = val.products;
|
||||||
this.serviceProviderForm = true;
|
this.serviceProviderForm = true;
|
||||||
}
|
}
|
||||||
@ -207,28 +210,28 @@ if(record.from_business.length>0){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log("Record",record)
|
console.log("Record", record)
|
||||||
this.stockForm = this.fb.group({
|
this.stockForm = this.fb.group({
|
||||||
pdid: [this.pdid],
|
pdid: [this.pdid],
|
||||||
formid: [this.formDetails.form_id],
|
formid: [this.formDetails.form_id],
|
||||||
company_id: [this.company_id],
|
company_id: [this.company_id],
|
||||||
fk_createdby:[this.users],
|
fk_createdby: [this.users],
|
||||||
stock_remarks: [''],
|
stock_remarks: [''],
|
||||||
|
|
||||||
// is_sufficiant_raw:[''],
|
// is_sufficiant_raw:[''],
|
||||||
// rawmaterial_remarks:[''],
|
// rawmaterial_remarks:[''],
|
||||||
is_sufficiant_finished_and_traded_goods:[''],
|
is_sufficiant_finished_and_traded_goods: [''],
|
||||||
finished_and_traded_goods_remarks:[''],
|
finished_and_traded_goods_remarks: [''],
|
||||||
|
|
||||||
manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]),
|
manufacturing_details: this.fb.array([this.manufacturingFormCreation(record,type2length)]),
|
||||||
retail_details : this.fb.array([this.retailFormCreation(type3length)]),
|
retail_details: this.fb.array([this.retailFormCreation(type3length)]),
|
||||||
|
|
||||||
trade_details: this.fb.array([this.tradingFormCreation(type4length)]),
|
trade_details: this.fb.array([this.tradingFormCreation(type4length)]),
|
||||||
});
|
});
|
||||||
if(api.length > 0){
|
if (api.length > 0) {
|
||||||
api.forEach(val => {
|
api.forEach(val => {
|
||||||
if (val.type_of_activity_id == 2) {
|
if (val.type_of_activity_id == 2) {
|
||||||
if(val.products){
|
if (val.products) {
|
||||||
// this.finishedAndTradedGoodsCommentCard = true;
|
// this.finishedAndTradedGoodsCommentCard = true;
|
||||||
this.suppliers_finished_goods = val.products;
|
this.suppliers_finished_goods = val.products;
|
||||||
this.suppliers_raw_materials = rm_api;
|
this.suppliers_raw_materials = rm_api;
|
||||||
@ -238,21 +241,21 @@ if(record.from_business.length>0){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (val.type_of_activity_id == 3) {
|
if (val.type_of_activity_id == 3) {
|
||||||
if(val.products){
|
if (val.products) {
|
||||||
// this.finishedAndTradedGoodsCommentCard = true;
|
// this.finishedAndTradedGoodsCommentCard = true;
|
||||||
this.suppliers_retail_trade_details= val.products;
|
this.suppliers_retail_trade_details = val.products;
|
||||||
this.initRetailDetails(null);
|
this.initRetailDetails(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (val.type_of_activity_id == 4) {
|
if (val.type_of_activity_id == 4) {
|
||||||
if(val.products){
|
if (val.products) {
|
||||||
// this.finishedAndTradedGoodsCommentCard = true;
|
// this.finishedAndTradedGoodsCommentCard = true;
|
||||||
this.suppliers_wholesale_trade_details = val.products;
|
this.suppliers_wholesale_trade_details = val.products;
|
||||||
this.initTradingDetails(null);
|
this.initTradingDetails(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (val.type_of_activity_id == 5) {
|
if (val.type_of_activity_id == 5) {
|
||||||
if(val.products){
|
if (val.products) {
|
||||||
// this.suppliers_service_product = val.products;
|
// this.suppliers_service_product = val.products;
|
||||||
this.serviceProviderForm = true;
|
this.serviceProviderForm = true;
|
||||||
}
|
}
|
||||||
@ -263,10 +266,10 @@ if(record.from_business.length>0){
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
this.toast.pdTriggerappmessage('Fill Business Form First! / No Company Found at this ID '+ this.company_id );
|
this.toast.pdTriggerappmessage('Fill Business Form First! / No Company Found at this ID ' + this.company_id);
|
||||||
this.noRecordsFound = false;
|
this.noRecordsFound = false;
|
||||||
this.errorMessage = 'Fill Business Form First! / No Company Found at this ID' + this.company_id +'! ....';
|
this.errorMessage = 'Fill Business Form First! / No Company Found at this ID' + this.company_id + '! ....';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -276,38 +279,44 @@ if(record.from_business.length>0){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getdropdown()
|
getdropdown() {
|
||||||
{
|
|
||||||
this.qustCat.getcommondrop('UOM').subscribe(data => {
|
this.qustCat.getcommondrop('UOM').subscribe(data => {
|
||||||
if(data['dataStatus']==true){
|
if (data['dataStatus'] == true) {
|
||||||
this.uomData = data['records'].filter(uom=>uom.isactive==1 && uom.is_land_uom == 0 || uom.is_land_uom == 2);
|
this.uomData = data['records'].filter(uom => uom.isactive == 1 && uom.is_land_uom == 0 || uom.is_land_uom == 2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
manufacturingForm: Boolean = false;
|
manufacturingForm: Boolean = false;
|
||||||
manufacturingFormCreation(record) {
|
manufacturingFormCreation(record,length) {
|
||||||
let arr = record.from_business.filter(data => data.type_of_activity_id == 2);
|
let arr = record.from_business.filter(data => data.type_of_activity_id == 2);
|
||||||
let rm_arr = record.from_supplier.hasOwnProperty("raw_material") ? record.from_supplier.raw_material : [];
|
let rm_arr = record.from_supplier.hasOwnProperty("raw_material") ? record.from_supplier.raw_material : [];
|
||||||
//console.log("Manufacturing ",arr);
|
//console.log("Manufacturing ",arr);
|
||||||
if (arr.length > 0) {
|
//console.log("rm_arr",rm_arr);
|
||||||
|
if (length > 0) {
|
||||||
this.manufacturingForm = true;
|
this.manufacturingForm = true;
|
||||||
return this.fb.group({
|
return this.fb.group({
|
||||||
is_sufficiant_raw: [],
|
is_sufficiant_raw: [],
|
||||||
rawmaterial_remarks:[],
|
rawmaterial_remarks: [],
|
||||||
manufacturing_raw_materials: this.fb.array([]),
|
manufacturing_raw_materials: this.fb.array([]),
|
||||||
manufacturing_finished_goods: this.fb.array([]),
|
manufacturing_finished_goods: this.fb.array([]),
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
return;
|
return this.fb.group({
|
||||||
|
is_sufficiant_raw: [],
|
||||||
|
rawmaterial_remarks: [],
|
||||||
|
manufacturing_raw_materials: this.fb.array([]),
|
||||||
|
manufacturing_finished_goods: this.fb.array([]),
|
||||||
|
})
|
||||||
|
// return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
retailForm: Boolean = false;
|
retailForm: Boolean = false;
|
||||||
retailFormCreation(val) {
|
retailFormCreation(val) {
|
||||||
//let arr = val.filter(data => data.type_of_activity_id == 3);
|
//let arr = val.filter(data => data.type_of_activity_id == 3);
|
||||||
let arr=val
|
let arr = val
|
||||||
console.log("retail Form ",arr);
|
// console.log("retail Form ", arr);
|
||||||
if (arr > 0) {
|
if (arr > 0) {
|
||||||
// if(arr.products != undefined){
|
// if(arr.products != undefined){
|
||||||
this.retailForm = true;
|
this.retailForm = true;
|
||||||
@ -328,7 +337,7 @@ if(record.from_business.length>0){
|
|||||||
|
|
||||||
tradingForm: Boolean = false;
|
tradingForm: Boolean = false;
|
||||||
tradingFormCreation(val) {
|
tradingFormCreation(val) {
|
||||||
let arr=val
|
let arr = val
|
||||||
//let arr = val.filter(data => data.type_of_activity_id == 4);
|
//let arr = val.filter(data => data.type_of_activity_id == 4);
|
||||||
|
|
||||||
if (arr > 0) {
|
if (arr > 0) {
|
||||||
@ -354,57 +363,61 @@ if(record.from_business.length>0){
|
|||||||
const rawMaterial = <FormArray>this.stockForm.controls['manufacturing_details']['controls'][0].controls['manufacturing_raw_materials'];
|
const rawMaterial = <FormArray>this.stockForm.controls['manufacturing_details']['controls'][0].controls['manufacturing_raw_materials'];
|
||||||
const finishedGoods = <FormArray>this.stockForm.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods'];
|
const finishedGoods = <FormArray>this.stockForm.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods'];
|
||||||
const control = <FormArray>this.stockForm.controls['manufacturing_details']['controls'][0].controls['main_raw_materials'];
|
const control = <FormArray>this.stockForm.controls['manufacturing_details']['controls'][0].controls['main_raw_materials'];
|
||||||
if(datas === null){
|
if (datas === null) {
|
||||||
if(this.suppliers_raw_materials.length > 0){
|
if (this.suppliers_raw_materials.length > 0) {
|
||||||
this.suppliers_raw_materials.forEach(val => {
|
this.suppliers_raw_materials.forEach(val => {
|
||||||
let Ref_RawMaterials : any = {'raw_name': val,
|
let Ref_RawMaterials: any = {
|
||||||
'stock_observed':'',
|
'raw_name': val,
|
||||||
|
'stock_observed': '',
|
||||||
'raw_quantity': '',
|
'raw_quantity': '',
|
||||||
'raw_uom': '',
|
'raw_uom': '',
|
||||||
'other_uom': '',
|
'other_uom': '',
|
||||||
'raw_value': '',
|
'raw_value': '',
|
||||||
'is_sufficiant_raw': '',
|
'is_sufficiant_raw': '',
|
||||||
'rawmaterial_remarks':''};
|
'rawmaterial_remarks': ''
|
||||||
|
};
|
||||||
rawMaterial.push(this.createRawmaterial(Ref_RawMaterials));
|
rawMaterial.push(this.createRawmaterial(Ref_RawMaterials));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
rawMaterial.push(this.createRawmaterial(null));
|
rawMaterial.push(this.createRawmaterial(null));
|
||||||
}
|
}
|
||||||
if(this.suppliers_finished_goods.length > 0){
|
if (this.suppliers_finished_goods.length > 0) {
|
||||||
this.suppliers_finished_goods.forEach(val => {
|
this.suppliers_finished_goods.forEach(val => {
|
||||||
let Ref_Finished_Goods : any = {'goods_name': val,
|
let Ref_Finished_Goods: any = {
|
||||||
|
'goods_name': val,
|
||||||
'goods_observed': '',
|
'goods_observed': '',
|
||||||
'goods_quantity': '',
|
'goods_quantity': '',
|
||||||
'goods_uom': '',
|
'goods_uom': '',
|
||||||
'goods_other_uom': '',
|
'goods_other_uom': '',
|
||||||
'goods_value': '',
|
'goods_value': '',
|
||||||
'is_sufficiant_goods': '',
|
'is_sufficiant_goods': '',
|
||||||
'finishedgoods_remarks':''};
|
'finishedgoods_remarks': ''
|
||||||
|
};
|
||||||
finishedGoods.push(this.createGoods(Ref_Finished_Goods));
|
finishedGoods.push(this.createGoods(Ref_Finished_Goods));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
finishedGoods.push(this.createGoods(null));
|
finishedGoods.push(this.createGoods(null));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(datas.manufacturing_raw_materials != undefined){
|
if (datas.manufacturing_raw_materials != undefined) {
|
||||||
datas.manufacturing_raw_materials.forEach((val,index) => {
|
datas.manufacturing_raw_materials.forEach((val, index) => {
|
||||||
if(val.raw_value){
|
if (val.raw_value) {
|
||||||
this.inWords(val.raw_value,1,index);
|
this.inWords(val.raw_value, 1, index);
|
||||||
}
|
}
|
||||||
// this.checkComments(val.is_sufficiant_raw,1,index);
|
// this.checkComments(val.is_sufficiant_raw,1,index);
|
||||||
this.checkComments(val.stock_observed, 1, index);
|
this.checkComments(val.stock_observed, 1, index);
|
||||||
rawMaterial.push(this.createRawmaterial(val));
|
rawMaterial.push(this.createRawmaterial(val));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
rawMaterial.push(this.createRawmaterial(null));
|
rawMaterial.push(this.createRawmaterial(null));
|
||||||
}
|
}
|
||||||
if(datas.manufacturing_finished_goods != undefined){
|
if (datas.manufacturing_finished_goods != undefined) {
|
||||||
datas.manufacturing_finished_goods.forEach((val,index) => {
|
datas.manufacturing_finished_goods.forEach((val, index) => {
|
||||||
if(val.goods_value){
|
if (val.goods_value) {
|
||||||
this.inWords(val.goods_value,2,index);
|
this.inWords(val.goods_value, 2, index);
|
||||||
}
|
}
|
||||||
// this.checkComments(val.is_sufficiant_goods,2,index);
|
// this.checkComments(val.is_sufficiant_goods,2,index);
|
||||||
this.checkComments(val.goods_observed, 2, index);
|
this.checkComments(val.goods_observed, 2, index);
|
||||||
@ -412,45 +425,45 @@ if(record.from_business.length>0){
|
|||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
finishedGoods.push(this.createGoods(null));
|
finishedGoods.push(this.createGoods(null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
createRawmaterial(records) {
|
createRawmaterial(records) {
|
||||||
if(records === null) {
|
if (records === null) {
|
||||||
return this.fb.group({
|
return this.fb.group({
|
||||||
raw_name: [''],
|
raw_name: [''],
|
||||||
stock_observed:[''],
|
stock_observed: [''],
|
||||||
raw_quantity: [''],
|
raw_quantity: [''],
|
||||||
raw_uom: [''],
|
raw_uom: [''],
|
||||||
other_uom : [''],
|
other_uom: [''],
|
||||||
raw_value: [''],
|
raw_value: [''],
|
||||||
is_sufficiant_raw: [''],
|
is_sufficiant_raw: [''],
|
||||||
rawmaterial_remarks:['']
|
rawmaterial_remarks: ['']
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
return this.fb.group({
|
return this.fb.group({
|
||||||
raw_name: [records.raw_name],
|
raw_name: [records.raw_name],
|
||||||
stock_observed:[records.stock_observed],
|
stock_observed: [records.stock_observed],
|
||||||
raw_quantity: [records.raw_quantity],
|
raw_quantity: [records.raw_quantity],
|
||||||
raw_uom: [records.raw_uom],
|
raw_uom: [records.raw_uom],
|
||||||
other_uom : [records.other_uom],
|
other_uom: [records.other_uom],
|
||||||
raw_value: [records.raw_value],
|
raw_value: [records.raw_value],
|
||||||
is_sufficiant_raw: [records.is_sufficiant_raw],
|
is_sufficiant_raw: [records.is_sufficiant_raw],
|
||||||
rawmaterial_remarks:[records.rawmaterial_remarks]
|
rawmaterial_remarks: [records.rawmaterial_remarks]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initRetailDetails(datas) {
|
initRetailDetails(datas) {
|
||||||
const tradedGoods = <FormArray>this.stockForm.controls['retail_details']['controls'][0].controls['retail_traded_goods'];
|
const tradedGoods = <FormArray>this.stockForm.controls['retail_details']['controls'][0].controls['retail_traded_goods'];
|
||||||
if(datas === null){
|
if (datas === null) {
|
||||||
if(this.suppliers_retail_trade_details.length > 0){
|
if (this.suppliers_retail_trade_details.length > 0) {
|
||||||
// this.rawMaterialAccess = true;
|
// this.rawMaterialAccess = true;
|
||||||
this.suppliers_retail_trade_details.forEach(val => {
|
this.suppliers_retail_trade_details.forEach(val => {
|
||||||
let Ref_Trade_Goods : any = {
|
let Ref_Trade_Goods: any = {
|
||||||
'traded_goods_name': val,
|
'traded_goods_name': val,
|
||||||
'traded_goods_observed': '',
|
'traded_goods_observed': '',
|
||||||
'traded_goods_quantity': '',
|
'traded_goods_quantity': '',
|
||||||
@ -458,25 +471,26 @@ if(record.from_business.length>0){
|
|||||||
'traded_goods_other_uom': '',
|
'traded_goods_other_uom': '',
|
||||||
'estimated_traded_goods_value': '',
|
'estimated_traded_goods_value': '',
|
||||||
'is_sufficiant_traded_goods': '',
|
'is_sufficiant_traded_goods': '',
|
||||||
'traded_goods_remarks':''};
|
'traded_goods_remarks': ''
|
||||||
|
};
|
||||||
tradedGoods.push(this.createTradedGoods(Ref_Trade_Goods));
|
tradedGoods.push(this.createTradedGoods(Ref_Trade_Goods));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
tradedGoods.push(this.createTradedGoods(null));
|
tradedGoods.push(this.createTradedGoods(null));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(datas.retail_traded_goods !== undefined){
|
if (datas.retail_traded_goods !== undefined) {
|
||||||
datas.retail_traded_goods.forEach((val,index) => {
|
datas.retail_traded_goods.forEach((val, index) => {
|
||||||
if(val.estimated_traded_goods_value){
|
if (val.estimated_traded_goods_value) {
|
||||||
this.inWords(val.estimated_traded_goods_value,3,index);
|
this.inWords(val.estimated_traded_goods_value, 3, index);
|
||||||
}
|
}
|
||||||
// this.checkComments(val.is_sufficiant_traded_goods,3,index);
|
// this.checkComments(val.is_sufficiant_traded_goods,3,index);
|
||||||
this.checkComments(val.traded_goods_observed, 3, index);
|
this.checkComments(val.traded_goods_observed, 3, index);
|
||||||
tradedGoods.push(this.createTradedGoods(val));
|
tradedGoods.push(this.createTradedGoods(val));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
tradedGoods.push(this.createTradedGoods(null));
|
tradedGoods.push(this.createTradedGoods(null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -484,7 +498,7 @@ if(record.from_business.length>0){
|
|||||||
|
|
||||||
|
|
||||||
createGoods(records) {
|
createGoods(records) {
|
||||||
if(records === null) {
|
if (records === null) {
|
||||||
return this.fb.group({
|
return this.fb.group({
|
||||||
goods_name: [''],
|
goods_name: [''],
|
||||||
goods_observed: [''],
|
goods_observed: [''],
|
||||||
@ -493,7 +507,7 @@ if(record.from_business.length>0){
|
|||||||
goods_other_uom: [''],
|
goods_other_uom: [''],
|
||||||
goods_value: [''],
|
goods_value: [''],
|
||||||
is_sufficiant_goods: [''],
|
is_sufficiant_goods: [''],
|
||||||
finishedgoods_remarks:['']
|
finishedgoods_remarks: ['']
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -505,17 +519,17 @@ if(record.from_business.length>0){
|
|||||||
goods_other_uom: [records.goods_other_uom],
|
goods_other_uom: [records.goods_other_uom],
|
||||||
goods_value: [records.goods_value],
|
goods_value: [records.goods_value],
|
||||||
is_sufficiant_goods: [records.is_sufficiant_goods],
|
is_sufficiant_goods: [records.is_sufficiant_goods],
|
||||||
finishedgoods_remarks:[records.finishedgoods_remarks]
|
finishedgoods_remarks: [records.finishedgoods_remarks]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initTradingDetails(datas) {
|
initTradingDetails(datas) {
|
||||||
const tradedGoods = <FormArray>this.stockForm.controls['trade_details']['controls'][0].controls['trading_traded_goods'];
|
const tradedGoods = <FormArray>this.stockForm.controls['trade_details']['controls'][0].controls['trading_traded_goods'];
|
||||||
if(datas === null){
|
if (datas === null) {
|
||||||
if(this.suppliers_wholesale_trade_details.length > 0){
|
if (this.suppliers_wholesale_trade_details.length > 0) {
|
||||||
this.suppliers_wholesale_trade_details.forEach(val => {
|
this.suppliers_wholesale_trade_details.forEach(val => {
|
||||||
let Ref_Trade_Goods : any = {
|
let Ref_Trade_Goods: any = {
|
||||||
'traded_goods_name': val,
|
'traded_goods_name': val,
|
||||||
'traded_goods_observed': '',
|
'traded_goods_observed': '',
|
||||||
'traded_goods_quantity': '',
|
'traded_goods_quantity': '',
|
||||||
@ -523,34 +537,34 @@ if(record.from_business.length>0){
|
|||||||
'traded_goods_other_uom': '',
|
'traded_goods_other_uom': '',
|
||||||
'estimated_traded_goods_value': '',
|
'estimated_traded_goods_value': '',
|
||||||
'is_sufficiant_traded_goods': '',
|
'is_sufficiant_traded_goods': '',
|
||||||
'traded_goods_remarks':''};
|
'traded_goods_remarks': ''
|
||||||
|
};
|
||||||
tradedGoods.push(this.createTradedGoods(Ref_Trade_Goods));
|
tradedGoods.push(this.createTradedGoods(Ref_Trade_Goods));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
tradedGoods.push(this.createTradedGoods(null));
|
tradedGoods.push(this.createTradedGoods(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if(datas.trading_traded_goods !==undefined)
|
if (datas.trading_traded_goods !== undefined) {
|
||||||
{
|
datas.trading_traded_goods.forEach((val, index) => {
|
||||||
datas.trading_traded_goods.forEach((val,index) => {
|
if (val.estimated_traded_goods_value) {
|
||||||
if(val.estimated_traded_goods_value){
|
this.inWords(val.estimated_traded_goods_value, 4, index);
|
||||||
this.inWords(val.estimated_traded_goods_value,4,index);
|
|
||||||
}
|
}
|
||||||
// this.checkComments(val.is_sufficiant_traded_goods,4,index);
|
// this.checkComments(val.is_sufficiant_traded_goods,4,index);
|
||||||
this.checkComments(val.traded_goods_observed, 4, index);
|
this.checkComments(val.traded_goods_observed, 4, index);
|
||||||
tradedGoods.push(this.createTradedGoods(val));
|
tradedGoods.push(this.createTradedGoods(val));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
tradedGoods.push(this.createTradedGoods(null));
|
tradedGoods.push(this.createTradedGoods(null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
createTradedGoods(records) {
|
createTradedGoods(records) {
|
||||||
if(records === null) {
|
if (records === null) {
|
||||||
return this.fb.group({
|
return this.fb.group({
|
||||||
traded_goods_name: [''],
|
traded_goods_name: [''],
|
||||||
traded_goods_observed: [''],
|
traded_goods_observed: [''],
|
||||||
@ -559,7 +573,7 @@ if(record.from_business.length>0){
|
|||||||
traded_goods_other_uom: [''],
|
traded_goods_other_uom: [''],
|
||||||
estimated_traded_goods_value: [''],
|
estimated_traded_goods_value: [''],
|
||||||
is_sufficiant_traded_goods: [''],
|
is_sufficiant_traded_goods: [''],
|
||||||
traded_goods_remarks:['']
|
traded_goods_remarks: ['']
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -571,22 +585,22 @@ if(record.from_business.length>0){
|
|||||||
traded_goods_other_uom: [records.traded_goods_other_uom],
|
traded_goods_other_uom: [records.traded_goods_other_uom],
|
||||||
estimated_traded_goods_value: [records.estimated_traded_goods_value],
|
estimated_traded_goods_value: [records.estimated_traded_goods_value],
|
||||||
is_sufficiant_traded_goods: [records.is_sufficiant_traded_goods],
|
is_sufficiant_traded_goods: [records.is_sufficiant_traded_goods],
|
||||||
traded_goods_remarks:[records.traded_goods_remarks]
|
traded_goods_remarks: [records.traded_goods_remarks]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Manufacturing -> To Add More Raw Material Details */
|
/** Manufacturing -> To Add More Raw Material Details */
|
||||||
addRawMaterials(flag) {
|
addRawMaterials(flag) {
|
||||||
if(flag==1){
|
if (flag == 1) {
|
||||||
const control = <FormArray>this.stockForm.controls['manufacturing_details']['controls'][0].controls['manufacturing_raw_materials'];
|
const control = <FormArray>this.stockForm.controls['manufacturing_details']['controls'][0].controls['manufacturing_raw_materials'];
|
||||||
control.push(this.createRawmaterial(null));
|
control.push(this.createRawmaterial(null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Manufacturing -> To Remove Raw Material Details */
|
/** Manufacturing -> To Remove Raw Material Details */
|
||||||
deleteRawMaterials(index,flag) {
|
deleteRawMaterials(index, flag) {
|
||||||
if(flag==1){
|
if (flag == 1) {
|
||||||
const control = <FormArray>this.stockForm.controls['manufacturing_details']['controls'][0].controls['manufacturing_raw_materials'];
|
const control = <FormArray>this.stockForm.controls['manufacturing_details']['controls'][0].controls['manufacturing_raw_materials'];
|
||||||
control.removeAt(index);
|
control.removeAt(index);
|
||||||
}
|
}
|
||||||
@ -594,15 +608,15 @@ if(record.from_business.length>0){
|
|||||||
|
|
||||||
/** Manufacturing -> To Add More Finished Goods */
|
/** Manufacturing -> To Add More Finished Goods */
|
||||||
addGoods(flag) {
|
addGoods(flag) {
|
||||||
if(flag == 1){
|
if (flag == 1) {
|
||||||
const control = <FormArray>this.stockForm.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods'];
|
const control = <FormArray>this.stockForm.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods'];
|
||||||
control.push(this.createGoods(null));
|
control.push(this.createGoods(null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Manufacturing -> To Remove Finished Goods */
|
/** Manufacturing -> To Remove Finished Goods */
|
||||||
deleteGoods(index,flag) {
|
deleteGoods(index, flag) {
|
||||||
if(flag == 1){
|
if (flag == 1) {
|
||||||
const control = <FormArray>this.stockForm.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods'];
|
const control = <FormArray>this.stockForm.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods'];
|
||||||
control.removeAt(index);
|
control.removeAt(index);
|
||||||
}
|
}
|
||||||
@ -613,7 +627,7 @@ if(record.from_business.length>0){
|
|||||||
* Case 2 wholesale Traded -> To Add More trade Goods
|
* Case 2 wholesale Traded -> To Add More trade Goods
|
||||||
*/
|
*/
|
||||||
addTradedGoods(flag) {
|
addTradedGoods(flag) {
|
||||||
switch(flag){
|
switch (flag) {
|
||||||
case 1: {
|
case 1: {
|
||||||
const control = <FormArray>this.stockForm.controls['retail_details']['controls'][0].controls['retail_traded_goods'];
|
const control = <FormArray>this.stockForm.controls['retail_details']['controls'][0].controls['retail_traded_goods'];
|
||||||
control.push(this.createTradedGoods(null));
|
control.push(this.createTradedGoods(null));
|
||||||
@ -634,8 +648,8 @@ if(record.from_business.length>0){
|
|||||||
* Case 1 Retail Traded -> To remove trade Goods
|
* Case 1 Retail Traded -> To remove trade Goods
|
||||||
* Case 2 wholesale Traded -> To remove trade Goods
|
* Case 2 wholesale Traded -> To remove trade Goods
|
||||||
*/
|
*/
|
||||||
deleteTradedGoods(index,flag) {
|
deleteTradedGoods(index, flag) {
|
||||||
switch(flag){
|
switch (flag) {
|
||||||
case 1: {
|
case 1: {
|
||||||
const control = <FormArray>this.stockForm.controls['retail_details']['controls'][0].controls['retail_traded_goods'];
|
const control = <FormArray>this.stockForm.controls['retail_details']['controls'][0].controls['retail_traded_goods'];
|
||||||
control.removeAt(index);
|
control.removeAt(index);
|
||||||
@ -660,65 +674,116 @@ if(record.from_business.length>0){
|
|||||||
RetailCounterArray: any = [];
|
RetailCounterArray: any = [];
|
||||||
WholeSaleCounterArray: any = [];
|
WholeSaleCounterArray: any = [];
|
||||||
|
|
||||||
|
not_stock_of_rm: any = [];
|
||||||
|
not_stock_of_fg: any = [];
|
||||||
|
not_stock_of_tg: any = [];
|
||||||
|
not_stock_of_ws: any = [];
|
||||||
checkComments(value, flag, index) {
|
checkComments(value, flag, index) {
|
||||||
let count:number
|
|
||||||
console.log(this.stockForm);
|
console.log(value, flag, index);
|
||||||
if (flag == 1) {
|
if (flag == 1) {
|
||||||
this.ManufacturingCounterArray[index] = value == "yes" ? 1 : 0
|
|
||||||
|
this.ManufacturingCounterArray[index] = value != "" ? 1 : 0;
|
||||||
|
this.not_stock_of_rm[index] = value == "yes" ? 1 : 0;
|
||||||
|
|
||||||
let RMOverallCount = this.ManufacturingCounterArray.reduce((sum, val) => sum + +val, 0);
|
let RMOverallCount = this.ManufacturingCounterArray.reduce((sum, val) => sum + +val, 0);
|
||||||
this.RMCommentCard = RMOverallCount > 0 ? true : false;
|
this.RMCommentCard = RMOverallCount > 0 ? true : false;
|
||||||
|
|
||||||
|
let not_stock1 = this.not_stock_of_rm.reduce((sum, val) => sum + +val, 0);
|
||||||
|
console.log('value',value);
|
||||||
|
console.log('not_stock1',not_stock1);
|
||||||
|
if(not_stock1 > 0){
|
||||||
|
console.log('not_stock1',not_stock1);
|
||||||
|
this.RMsufficientList[0].disabled = false;
|
||||||
|
this.RMsufficientList[2].disabled = true;
|
||||||
|
// this.stockForm.controls['is_sufficiant_finished_and_traded_goods'].setValue('');
|
||||||
}
|
}
|
||||||
if (flag == 2) {
|
else if(not_stock1 == 0){
|
||||||
this.FinishedCounterArray[index] = value == "yes" ? 1 : 0
|
console.log('0',not_stock1);
|
||||||
|
this.RMsufficientList[0].disabled = true;
|
||||||
|
this.RMsufficientList[2].disabled = false;
|
||||||
|
// this.stockForm.controls['is_sufficiant_finished_and_traded_goods'].setValue('not applicable');
|
||||||
}
|
}
|
||||||
if (flag == 3) {
|
console.log('this.RMsufficientList',this.RMsufficientList);
|
||||||
this.RetailCounterArray[index] = value == "yes" ? 1 : 0
|
|
||||||
}
|
|
||||||
if (flag == 4) {
|
|
||||||
this.WholeSaleCounterArray[index] = value == "yes" ? 1 : 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(flag == 2) {
|
||||||
|
this.FinishedCounterArray[index] = value != "" ? 1 : 0
|
||||||
|
this.not_stock_of_fg[index] = value == "yes" ? 1 : 0;
|
||||||
|
}
|
||||||
|
if (flag == 3) {
|
||||||
|
this.RetailCounterArray[index] = value != "" ? 1 : 0
|
||||||
|
this.not_stock_of_tg[index] = value == "yes" ? 1 : 0;
|
||||||
|
}
|
||||||
|
if (flag == 4) {
|
||||||
|
this.WholeSaleCounterArray[index] = value != "" ? 1 : 0
|
||||||
|
this.not_stock_of_ws[index] = value == "yes" ? 1 : 0;
|
||||||
|
}
|
||||||
let FGOverallCount = this.FinishedCounterArray.reduce((sum, val) => sum + +val, 0);
|
let FGOverallCount = this.FinishedCounterArray.reduce((sum, val) => sum + +val, 0);
|
||||||
let RTGOverallCount = this.RetailCounterArray.reduce((sum, val) => sum + +val, 0);
|
let RTGOverallCount = this.RetailCounterArray.reduce((sum, val) => sum + +val, 0);
|
||||||
let WTGOverallCount = this.WholeSaleCounterArray.reduce((sum, val) => sum + +val, 0);
|
let WTGOverallCount = this.WholeSaleCounterArray.reduce((sum, val) => sum + +val, 0);
|
||||||
let TGOverallCount = FGOverallCount + RTGOverallCount + WTGOverallCount;
|
let TGOverallCount = FGOverallCount + RTGOverallCount + WTGOverallCount;
|
||||||
this.TGCommentCard = TGOverallCount > 0 ? true : false;
|
this.TGCommentCard = TGOverallCount > 0 ? true : false;
|
||||||
|
|
||||||
|
let not_stock_fg = this.not_stock_of_fg.reduce((sum, val) => sum + +val, 0);
|
||||||
|
let not_stock_ws = this.not_stock_of_ws.reduce((sum, val) => sum + +val, 0);
|
||||||
|
let not_stock_tg = this.not_stock_of_tg.reduce((sum, val) => sum + +val, 0);
|
||||||
|
let not_stock2 = not_stock_fg + not_stock_ws + not_stock_tg;
|
||||||
|
console.log('not_stock2',not_stock2);
|
||||||
|
if(not_stock2 > 0){
|
||||||
|
console.log('not_stock2',not_stock2);
|
||||||
|
this.TGsufficientList[0].isdisabled = false;
|
||||||
|
this.TGsufficientList[2].isdisabled = true;
|
||||||
|
// this.stockForm.controls['is_sufficiant_finished_and_traded_goods'].setValue('');
|
||||||
}
|
}
|
||||||
|
else if(not_stock2 == 0){
|
||||||
|
console.log('0',not_stock2);
|
||||||
|
this.TGsufficientList[0].isdisabled = true;
|
||||||
|
this.TGsufficientList[2].isdisabled = false;
|
||||||
|
// this.stockForm.controls['is_sufficiant_finished_and_traded_goods'].setValue('not applicable');
|
||||||
|
}
|
||||||
|
console.log('Data',this.TGsufficientList);
|
||||||
|
// else if(not_stock == 0){
|
||||||
|
// this.stockForms.controls['is_sufficiant_finished_and_traded_goods'].setValue('');
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** To Save/Edited Popup Data */
|
/** To Save/Edited Popup Data */
|
||||||
saveStockInfo(answerFormValues) {
|
saveStockInfo(answerFormValues) {
|
||||||
//To Remove The "Null" With Key also
|
//To Remove The "Null" With Key also
|
||||||
Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]);
|
Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]);
|
||||||
this.qustCat.saveForm(answerFormValues).subscribe(responsed => {
|
this.qustCat.saveForm(answerFormValues).subscribe(responsed => {
|
||||||
if(responsed['status'] == 200) {
|
if (responsed['status'] == 200) {
|
||||||
|
|
||||||
this.toast.pdTriggerappmessage('Record Saved Successfully.!');
|
this.toast.pdTriggerappmessage('Record Saved Successfully.!');
|
||||||
setTimeout(()=>{
|
setTimeout(() => {
|
||||||
this.navCtrl.pop();
|
this.navCtrl.pop();
|
||||||
},2000);
|
}, 2000);
|
||||||
}else{
|
} else {
|
||||||
this.toast.pdTriggerappmessage('Something Wents Wrong Try Again.!');
|
this.toast.pdTriggerappmessage('Something Wents Wrong Try Again.!');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
inWords(e,flag:number,i){
|
inWords(e, flag: number, i) {
|
||||||
switch(flag){
|
switch (flag) {
|
||||||
case 1 :
|
case 1:
|
||||||
this.M_rawValueInWords[i] = this.constant.convertNumberToWords(e);
|
this.M_rawValueInWords[i] = this.constant.convertNumberToWords(e);
|
||||||
break;
|
break;
|
||||||
case 2 :
|
case 2:
|
||||||
this.M_goodsValueInWords[i] = this.constant.convertNumberToWords(e);
|
this.M_goodsValueInWords[i] = this.constant.convertNumberToWords(e);
|
||||||
break;
|
break;
|
||||||
case 3 :
|
case 3:
|
||||||
this.R_tradedGoodsValueInWords[i] = this.constant.convertNumberToWords(e);
|
this.R_tradedGoodsValueInWords[i] = this.constant.convertNumberToWords(e);
|
||||||
break;
|
break;
|
||||||
case 4 :
|
case 4:
|
||||||
this.T_tradedGoodsValueInWords[i] = this.constant.convertNumberToWords(e);
|
this.T_tradedGoodsValueInWords[i] = this.constant.convertNumberToWords(e);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -123,13 +123,13 @@ export class PdQuestionSupplierInfoPage {
|
|||||||
// let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) {
|
// let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) {
|
||||||
// return dataForm.main_raw_materials[key];
|
// return dataForm.main_raw_materials[key];
|
||||||
// });
|
// });
|
||||||
if(dataForm.manufacturing_details[0] != null){
|
if (dataForm.manufacturing_details[0] != null) {
|
||||||
let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials;
|
let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials;
|
||||||
|
|
||||||
this.initManufacturingProductsDetails(api_main_raw_materials);
|
this.initManufacturingProductsDetails(api_main_raw_materials);
|
||||||
this.supplierInfoForm.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(dataForm.manufacturing_details[0].main_raw_materials_total_payments_percent_on_credit || null);
|
this.supplierInfoForm.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(dataForm.manufacturing_details[0].main_raw_materials_total_payments_percent_on_credit || null);
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
this.initManufacturingProductsDetails(null);
|
this.initManufacturingProductsDetails(null);
|
||||||
this.supplierInfoForm.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null)
|
this.supplierInfoForm.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null)
|
||||||
}
|
}
|
||||||
@ -139,16 +139,20 @@ export class PdQuestionSupplierInfoPage {
|
|||||||
// let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) {
|
// let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) {
|
||||||
// return dataForm.trading_products[key];
|
// return dataForm.trading_products[key];
|
||||||
// });
|
// });
|
||||||
if(dataForm.trade_details[0] != null){
|
if (dataForm.trade_details[0] != null) {
|
||||||
let api_trading_products = dataForm.trade_details[0].trading_products;
|
let api_trading_products = dataForm.trade_details[0].trading_products;
|
||||||
this.initTradingProductsDetails(api_trading_products);
|
this.initTradingProductsDetails(api_trading_products);
|
||||||
this.supplierInfoForm.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trade_details[0].trading_products_total_payments_percent_on_credit || null);
|
this.supplierInfoForm.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trade_details[0].trading_products_total_payments_percent_on_credit || null);
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
this.initTradingProductsDetails(null);
|
this.initTradingProductsDetails(null);
|
||||||
this.supplierInfoForm.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(null);
|
this.supplierInfoForm.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let arr2 = record.filter(data => data.type_of_activity_id == 5);
|
||||||
|
if (arr2.length > 0) {
|
||||||
|
this.serviceProviderForm = true;
|
||||||
|
}
|
||||||
this.noRecordsFound = true;
|
this.noRecordsFound = true;
|
||||||
} else {
|
} else {
|
||||||
this.supplierInfoForm = this.fb.group({
|
this.supplierInfoForm = this.fb.group({
|
||||||
@ -409,9 +413,9 @@ export class PdQuestionSupplierInfoPage {
|
|||||||
if (responsed['status'] == 200) {
|
if (responsed['status'] == 200) {
|
||||||
|
|
||||||
this.toast.pdTriggerappmessage('Record Saved Successfully.!');
|
this.toast.pdTriggerappmessage('Record Saved Successfully.!');
|
||||||
setTimeout(()=>{
|
setTimeout(() => {
|
||||||
this.navCtrl.pop();
|
this.navCtrl.pop();
|
||||||
},2000);
|
}, 2000);
|
||||||
} else {
|
} else {
|
||||||
this.toast.pdTriggerappmessage('Something Wents Wrong Try Again.!');
|
this.toast.pdTriggerappmessage('Something Wents Wrong Try Again.!');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -262,13 +262,13 @@
|
|||||||
<div fxLayout="row wrap" class="align-margin" *ngFor="let fUnits of floor.controls.floor_unit_details['controls']; let fu=index;" [formGroupName]="fu">
|
<div fxLayout="row wrap" class="align-margin" *ngFor="let fUnits of floor.controls.floor_unit_details['controls']; let fu=index;" [formGroupName]="fu">
|
||||||
<mat-form-field style="width:100%;">
|
<mat-form-field style="width:100%;">
|
||||||
<mat-label>Rent per Unit</mat-label>
|
<mat-label>Rent per Unit</mat-label>
|
||||||
<input type="number" matInput autocomplete="off" placeholder="" formControlName="rent_per_unit" (keyup)="calculateFloorRentAmt(floor.value,f)" required (keyup)="inWords($event.target.value,fu,1)">
|
<input type="number" matInput autocomplete="off" placeholder="" formControlName="rent_per_unit" (keyup)="calculateFloorRentAmt(floor.value,f);" required>
|
||||||
<mat-hint align="end" style="font-size:12px" *ngIf="fUnits.value.rent_per_unit != ''">{{"₹"}} {{rent_per_unit_Inwords[f]}} Only</mat-hint>
|
<mat-hint align="end" style="font-size:12px" *ngIf="fUnits.value.rent_per_unit != ''">{{"₹"}} {{rent_per_unit_Inwords[f]}} Only</mat-hint>
|
||||||
|
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width:100%;">
|
<mat-form-field style="width:100%;">
|
||||||
<mat-label>Amount</mat-label>
|
<mat-label>Amount</mat-label>
|
||||||
<input type="number" matInput autocomplete="off" placeholder="" formControlName="amount" readonly (keyup)="inWords($event.target.value,fu,2)">
|
<input type="number" matInput autocomplete="off" placeholder="" formControlName="amount" readonly>
|
||||||
<mat-hint align="end" style="font-size:12px" *ngIf="fUnits.value.amount != ''">{{"₹"}} {{amount_Inwords[f] }} Only</mat-hint>
|
<mat-hint align="end" style="font-size:12px" *ngIf="fUnits.value.amount != ''">{{"₹"}} {{amount_Inwords[f] }} Only</mat-hint>
|
||||||
|
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
@ -281,7 +281,7 @@
|
|||||||
<div class="rent-unit" fxFlex.xs="100" fxFlex.sm="45" fxFlex.md="45" fxFlex.lg="45" fxFlex.xl="45" *ngFor="let fUnits of floor.controls.floor_unit_details['controls']; let fu=index;" [formGroupName]="fu">
|
<div class="rent-unit" fxFlex.xs="100" fxFlex.sm="45" fxFlex.md="45" fxFlex.lg="45" fxFlex.xl="45" *ngFor="let fUnits of floor.controls.floor_unit_details['controls']; let fu=index;" [formGroupName]="fu">
|
||||||
<mat-form-field style="width:100%" appearance="outline">
|
<mat-form-field style="width:100%" appearance="outline">
|
||||||
<mat-label>Rent Unit {{fu+1}} </mat-label>
|
<mat-label>Rent Unit {{fu+1}} </mat-label>
|
||||||
<input type="number" matInput autocomplete="off" placeholder="" formControlName="rent_per_unit" (keyup)="calculateFloorRentAmt(floor.value,f)" required (keyup)="inWords($event.target.value,fu,3)">
|
<input type="number" matInput autocomplete="off" placeholder="" formControlName="rent_per_unit" (keyup)="calculateFloorRentAmt(floor.value,f);" required>
|
||||||
<mat-hint align="end" style="font-size:12px" *ngIf="fUnits.value.rent_per_unit != ''">{{"₹"}} {{rent_per_unit_2_Inwords[f]}} Only</mat-hint>
|
<mat-hint align="end" style="font-size:12px" *ngIf="fUnits.value.rent_per_unit != ''">{{"₹"}} {{rent_per_unit_2_Inwords[f]}} Only</mat-hint>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<mat-form-field style="width:100%">
|
<mat-form-field style="width:100%">
|
||||||
<mat-label>Total Rent Amount</mat-label>
|
<mat-label>Total Rent Amount</mat-label>
|
||||||
<input type="number" matInput autocomplete="off" placeholder="" formControlName="floor_rent_amount" readonly>
|
<input type="number" matInput autocomplete="off" placeholder="" formControlName="floor_rent_amount" readonly>
|
||||||
<!-- <mat-hint align="end" style="font-size:12px" *ngIf="floor.value.floor_rent_amount != ''">{{"₹"}} {{floor_rent_amount_Inwords[f]}} Only</mat-hint> -->
|
<mat-hint align="end" style="font-size:12px" *ngIf="floor.value.floor_rent_amount != ''">{{"₹"}} {{floor_rent_amount_Inwords[f]}} Only</mat-hint>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
</mat-card-actions>
|
</mat-card-actions>
|
||||||
@ -339,7 +339,7 @@
|
|||||||
<input matInput autocomplete="off" placeholder="" formControlName="monthly_rent_amount"
|
<input matInput autocomplete="off" placeholder="" formControlName="monthly_rent_amount"
|
||||||
required (keyup)="inWords($event.target.value,u,5)" type="number">
|
required (keyup)="inWords($event.target.value,u,5)" type="number">
|
||||||
<!-- (keyup)="inWords($event,1)" -->
|
<!-- (keyup)="inWords($event,1)" -->
|
||||||
<!-- <mat-hint align="end" style="font-size:12px" *ngIf="units.value.monthly_rent_amount != ''">{{"₹"}} {{monthly_rent_amount_Inwords[u]}} Only</mat-hint> -->
|
<mat-hint align="end" style="font-size:12px" *ngIf="units.value.monthly_rent_amount != ''">{{"₹"}} {{monthly_rent_amount_Inwords[u]}} Only</mat-hint>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width:100%">
|
<mat-form-field style="width:100%">
|
||||||
<mat-label>Mode of Payment of Rent as per Loan Applicant</mat-label>
|
<mat-label>Mode of Payment of Rent as per Loan Applicant</mat-label>
|
||||||
|
|||||||
@ -779,13 +779,16 @@ createFloorUnitDetails(type:number){
|
|||||||
}
|
}
|
||||||
// calculate floor rent amount
|
// calculate floor rent amount
|
||||||
calculateFloorRentAmt(values: any, index: number){
|
calculateFloorRentAmt(values: any, index: number){
|
||||||
|
// this.inWords(values,index,1);
|
||||||
if(values.unit_rent_difference_options=="1"){
|
if(values.unit_rent_difference_options=="1"){
|
||||||
let control: any = <FormArray>this.rentalForms.controls['multistoried_building_details'];
|
let control: any = <FormArray>this.rentalForms.controls['multistoried_building_details'];
|
||||||
let unitcontrol = control.controls[index];
|
let unitcontrol = control.controls[index];
|
||||||
unitcontrol= <FormArray> unitcontrol.controls['floor_unit_details'];
|
unitcontrol= <FormArray> unitcontrol.controls['floor_unit_details'];
|
||||||
if(unitcontrol.value[unitcontrol.value.length-1].rent_per_unit>0 && values.no_units_in_floor>0){
|
if(unitcontrol.value[unitcontrol.value.length-1].rent_per_unit>0 && values.no_units_in_floor>0){
|
||||||
unitcontrol.controls[unitcontrol.value.length-1].controls['amount'].setValue(unitcontrol.value[unitcontrol.value.length-1].rent_per_unit * values.no_units_in_floor);
|
unitcontrol.controls[unitcontrol.value.length-1].controls['amount'].setValue(unitcontrol.value[unitcontrol.value.length-1].rent_per_unit * values.no_units_in_floor);
|
||||||
|
// this.inWords(unitcontrol.value[unitcontrol.value.length-1].rent_per_unit * values.no_units_in_floor,index,2);
|
||||||
control.controls[index].controls['floor_rent_amount'].setValue(unitcontrol.value[unitcontrol.value.length-1].rent_per_unit * values.no_units_in_floor);
|
control.controls[index].controls['floor_rent_amount'].setValue(unitcontrol.value[unitcontrol.value.length-1].rent_per_unit * values.no_units_in_floor);
|
||||||
|
// this.inWords(unitcontrol.value[unitcontrol.value.length-1].rent_per_unit * values.no_units_in_floor,index,3);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
unitcontrol.controls[unitcontrol.value.length-1].controls['amount'].setValue('');
|
unitcontrol.controls[unitcontrol.value.length-1].controls['amount'].setValue('');
|
||||||
@ -801,6 +804,7 @@ calculateFloorRentAmt(values: any, index: number){
|
|||||||
let getunitValues = unitcontrol.value.filter(val=>val.rent_per_unit!='');
|
let getunitValues = unitcontrol.value.filter(val=>val.rent_per_unit!='');
|
||||||
if(getunitValues.length>0){
|
if(getunitValues.length>0){
|
||||||
control.controls[index].controls['floor_rent_amount'].setValue(getunitValues.map(mval=>mval.rent_per_unit).reduce((acc, val) => Number(acc) + Number(val), 0));
|
control.controls[index].controls['floor_rent_amount'].setValue(getunitValues.map(mval=>mval.rent_per_unit).reduce((acc, val) => Number(acc) + Number(val), 0));
|
||||||
|
// this.inWords(getunitValues.map(mval=>mval.rent_per_unit).reduce((acc, val) => Number(acc) + Number(val)),index,3);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
control.controls[index].controls['floor_rent_amount'].setValue('');
|
control.controls[index].controls['floor_rent_amount'].setValue('');
|
||||||
@ -1010,12 +1014,12 @@ compareSingleObjects(o1: any, o2: any) {
|
|||||||
element.amount_received_bank_per_met ? control.controls[index].addControl('amount_received_bank_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('amount_received_bank_per_met');
|
element.amount_received_bank_per_met ? control.controls[index].addControl('amount_received_bank_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('amount_received_bank_per_met');
|
||||||
element.payment_received_reason_per_met ? control.controls[index].addControl('payment_received_reason_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_received_reason_per_met');
|
element.payment_received_reason_per_met ? control.controls[index].addControl('payment_received_reason_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_received_reason_per_met');
|
||||||
element.payment_difference_per_met ? control.controls[index].addControl('payment_difference_per_met', new FormControl('')) : control.controls[index].removeControl('payment_difference_per_met');
|
element.payment_difference_per_met ? control.controls[index].addControl('payment_difference_per_met', new FormControl('')) : control.controls[index].removeControl('payment_difference_per_met');
|
||||||
|
this.inWords(element.monthly_rent_amount != '' ? +element.monthly_rent_amount : '',index,5);
|
||||||
this.inWords(element.amount_received_cash != '' ? +element.amount_received_cash : '',index,6);
|
this.inWords(element.amount_received_cash != '' ? +element.amount_received_cash : '',index,6);
|
||||||
this.inWords(element.amount_received_bank != '' ? +element.amount_received_bank : '',index,7);
|
this.inWords(element.amount_received_bank != '' ? +element.amount_received_bank : '',index,7);
|
||||||
this.inWords(element.securtity_deposit_amount != '' ? +element.securtity_deposit_amount : '',index,8);
|
this.inWords(element.securtity_deposit_amount != '' ? +element.securtity_deposit_amount : '',index,8);
|
||||||
this.inWords(element.agreement_monthly_rent_amount != '' ? +element.agreement_monthly_rent_amount : '',index,9);
|
this.inWords(element.agreement_monthly_rent_amount != '' ? +element.agreement_monthly_rent_amount : '',index,9);
|
||||||
this.inWords(element.agreement_security_deposit != '' ? +element.agreement_security_deposit :'',index,10);
|
this.inWords(element.agreement_security_deposit_amount != '' ? +element.agreement_security_deposit_amount :'',index,10);
|
||||||
this.inWords(element.paid_monthly_rent_per_met != '' ? +element.paid_monthly_rent_per_met : '',index,11);
|
this.inWords(element.paid_monthly_rent_per_met != '' ? +element.paid_monthly_rent_per_met : '',index,11);
|
||||||
this.inWords(element.amount_received_cash_per_met != '' ? +element.amount_received_cash_per_met : '',index,12);
|
this.inWords(element.amount_received_cash_per_met != '' ? +element.amount_received_cash_per_met : '',index,12);
|
||||||
this.inWords(element.amount_received_bank_per_met != '' ? +element.amount_received_bank_per_met : '',index,13);
|
this.inWords(element.amount_received_bank_per_met != '' ? +element.amount_received_bank_per_met : '',index,13);
|
||||||
@ -1107,7 +1111,7 @@ compareSingleObjects(o1: any, o2: any) {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
inWords(e,i,flag){
|
inWords(e,i,flag){
|
||||||
console.log(e,i,flag);
|
// console.log(e,i,flag);
|
||||||
switch(flag){
|
switch(flag){
|
||||||
case 1 :
|
case 1 :
|
||||||
this.rent_per_unit_Inwords[i] = this.constprovider.convertNumberToWords(e);
|
this.rent_per_unit_Inwords[i] = this.constprovider.convertNumberToWords(e);
|
||||||
|
|||||||
@ -19,7 +19,7 @@ public commonimage = "http://ssa.sineedge.com/sparqapi/logo/avatar.jpg";
|
|||||||
let testapiurl = 'http://ssa.sineedge.com/sparqtest/api/';
|
let testapiurl = 'http://ssa.sineedge.com/sparqtest/api/';
|
||||||
let devapiurl = 'http://ssa.sineedge.com/sparqapi/api/';
|
let devapiurl = 'http://ssa.sineedge.com/sparqapi/api/';
|
||||||
let localapiurl = 'http://192.168.0.9/sparqapi/api/';
|
let localapiurl = 'http://192.168.0.9/sparqapi/api/';
|
||||||
return testapiurl;
|
return devapiurl;
|
||||||
}
|
}
|
||||||
|
|
||||||
getcurrentDate()
|
getcurrentDate()
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user