stock:ps
This commit is contained in:
parent
403e8866fb
commit
22c4d8f04d
@ -102,11 +102,13 @@
|
||||
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<mat-form-field>
|
||||
<input matInput autocomplete="off" placeholder="Year(s)"
|
||||
formControlName="vintage_year" OnlyNumber type="text">
|
||||
formControlName="vintage_year" OnlyNumber type="text" (change)="checkWithExistBusinessYear(itemrow,$event.target.value,i)">
|
||||
<mat-hint style="color: red;">{{yearErrorMessage[i]}}</mat-hint>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput autocomplete="off" placeholder="Month(s)"
|
||||
formControlName="vintage_month" OnlyNumber type="text" (change)="ConvertMonthintoYear(itemrow,$event.target.value)">
|
||||
formControlName="vintage_month" OnlyNumber type="text" (change)="ConvertMonthintoYear(itemrow,$event.target.value,i)">
|
||||
<mat-hint style="color: red;">{{monthErrorMessage[i]}}</mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -52,6 +52,12 @@ export class BusinessBankingDetailsComponent implements OnInit {
|
||||
existCompanyList: any = [];
|
||||
mergeCompanyApplicant: any = [];
|
||||
company_id: String;
|
||||
|
||||
generalExistBusinessYear: Number;
|
||||
generalExistBusinessMonth: Number;
|
||||
yearErrorMessage: any = [];
|
||||
monthErrorMessage: any = [];
|
||||
|
||||
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private _pd: PdTrigerService,
|
||||
@ -70,6 +76,8 @@ export class BusinessBankingDetailsComponent implements OnInit {
|
||||
this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id;
|
||||
this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr;
|
||||
this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr;
|
||||
this.generalExistBusinessYear = this.pd_all_details.business_years;
|
||||
this.generalExistBusinessMonth = this.pd_all_details.business_month;
|
||||
}
|
||||
|
||||
public viewerOptions: any = {
|
||||
@ -122,33 +130,6 @@ export class BusinessBankingDetailsComponent implements OnInit {
|
||||
|
||||
this.salaryField = this.pd_cus_segment.substring(0, 2) == 'SE' ? false : true;
|
||||
|
||||
this._pd.retriveForm({'pd_id':this.pdid,'pd_form_id':13,'company_id':this.company_id}).subscribe(data => {
|
||||
// let businessVal = data.records;
|
||||
// console.log('businessVal',businessVal,data.records.partners);
|
||||
if (data.status == 200) {
|
||||
let PartnrArray = Object.keys(data.records.partners).map(function (key) {
|
||||
return data.records.partners[key];
|
||||
});
|
||||
console.log(PartnrArray);
|
||||
console.log(data.records.partners);
|
||||
PartnrArray.forEach((datas,index) => {
|
||||
let sum1 = PartnrArray.map(officer => officer.Current_business_experiance_month).reduce((sum, val) => sum + +val, 0);
|
||||
// console.log('SumOfYear',SumOfYear);
|
||||
// console.log('SumOfMonth',SumOfMonth);
|
||||
});
|
||||
|
||||
// let SumOfYear = PartnrArray[index].Current_business_experiance_month.reduce((sum, val) => sum + +val, 0);
|
||||
// let SumOfMonth = PartnrArray[index].Current_business_experiance_year.reduce((sum, val) => sum + +val, 0);
|
||||
|
||||
// let SumOfYear = month.reduce((sum, val) => sum + +val, 0);
|
||||
// let SumOfMonth = year.reduce((sum, val) => sum + +val, 0);
|
||||
|
||||
let sum1 = PartnrArray.map(arr => arr.map(data => data.Current_business_experiance_month).reduce((sum, val) => sum + +val, 0))
|
||||
console.log('sum1',sum1);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
let params: any = {};
|
||||
params.pd_id = this.pdid;
|
||||
params.pd_form_id = '21';
|
||||
@ -330,17 +311,48 @@ export class BusinessBankingDetailsComponent implements OnInit {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
checkWithExistBusinessYear(itemrow,e, i) {
|
||||
|
||||
if (+e > this.generalExistBusinessYear) {
|
||||
this.yearErrorMessage[i] = "Higher than Business Vintage";
|
||||
itemrow.controls.vintage_year.setValue('');
|
||||
}
|
||||
else {
|
||||
this.yearErrorMessage[i] = '';
|
||||
}
|
||||
}
|
||||
|
||||
/** To Convert Month into Year */
|
||||
ConvertMonthintoYear(itemrow, e) {
|
||||
ConvertMonthintoYear(itemrow, e,i) {
|
||||
|
||||
|
||||
let year = itemrow.controls.vintage_year.value;
|
||||
|
||||
let converted_month: number = e % 12;
|
||||
let converted_year: number = e / 12;
|
||||
let Year = +year + +Math.floor(converted_year);
|
||||
|
||||
if (Year > this.generalExistBusinessYear) {
|
||||
this.yearErrorMessage[i] = "Higher than Business Vintage";
|
||||
itemrow.controls.vintage_year.setValue('');
|
||||
itemrow.controls.vintage_month.setValue('');
|
||||
|
||||
}
|
||||
else {
|
||||
if (Year == this.generalExistBusinessYear && +converted_month > this.generalExistBusinessMonth) {
|
||||
this.monthErrorMessage[i] = "Higher than Business Vintage";
|
||||
itemrow.controls.vintage_year.setValue('');
|
||||
itemrow.controls.vintage_month.setValue('');
|
||||
|
||||
} else {
|
||||
this.monthErrorMessage[i] = '';
|
||||
this.yearErrorMessage[i] = '';
|
||||
itemrow.controls.vintage_year.setValue(Year);
|
||||
itemrow.controls.vintage_month.setValue(Math.floor(converted_month));
|
||||
}
|
||||
}
|
||||
|
||||
itemrow.controls.vintage_year.setValue(+year + +Math.floor(converted_year));
|
||||
itemrow.controls.vintage_month.setValue(Math.floor(converted_month));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -41,6 +41,7 @@
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option value="yes">Add Stock Details</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-form-field>
|
||||
<span *ngIf="mrm.get('stock_observed').value == 'yes'">
|
||||
@ -97,6 +98,7 @@
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option value="yes">Yes</mat-option>
|
||||
<mat-option value="no">No</mat-option>
|
||||
<mat-option value="not applicable">Not Applicable</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" style="width: 90%" *ngIf="md.get('is_sufficiant_raw').value == 'no'">
|
||||
@ -125,6 +127,7 @@
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option value="yes">Add Stock Details</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-form-field>
|
||||
<span *ngIf="mfg.get('goods_observed').value == 'yes'">
|
||||
@ -200,6 +203,7 @@
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option value="yes">Add Stock Details</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-form-field>
|
||||
<span *ngIf="item.get('traded_goods_observed').value == 'yes'">
|
||||
@ -278,6 +282,7 @@
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option value="yes">Add Stock Details</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-form-field>
|
||||
<span *ngIf="tradetg.get('traded_goods_observed').value == 'yes'">
|
||||
@ -341,6 +346,7 @@
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option value="yes">Yes</mat-option>
|
||||
<mat-option value="no">No</mat-option>
|
||||
<mat-option value="not applicable">Not Applicable</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" style="width: 90%" *ngIf="this.stockForms.controls.is_sufficiant_finished_and_traded_goods.value == 'no'">
|
||||
|
||||
@ -144,6 +144,7 @@ export class StockComponent implements OnInit {
|
||||
this._pd.retriveForm(params).subscribe(value => {
|
||||
if (value.status == 200) {
|
||||
let dataForm = value.records;
|
||||
console.log(value.records);
|
||||
if (dataForm !== undefined) {
|
||||
this.stockForms = this.fb.group({
|
||||
pdid: [this.pdid],
|
||||
@ -747,27 +748,55 @@ export class StockComponent implements OnInit {
|
||||
RetailCounterArray: 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) {
|
||||
|
||||
|
||||
|
||||
if (flag == 1) {
|
||||
this.ManufacturingCounterArray[index] = value == "yes" ? 1 : 0
|
||||
this.ManufacturingCounterArray[index] = value == "yes" ? 1 : 0;
|
||||
this.not_stock_of_rm[index] = value == "stock not required to be maintained" ? 1 : 0;
|
||||
|
||||
let RMOverallCount = this.ManufacturingCounterArray.reduce((sum, val) => sum + +val, 0);
|
||||
this.RMCommentCard = RMOverallCount > 0 ? true : false;
|
||||
|
||||
let not_stock1 = this.not_stock_of_rm.reduce((sum, val) => sum + +val, 0);
|
||||
if(not_stock1 > 0){ this.stockForms.controls['manufacturing_details']['controls'][0].controls['is_sufficiant_raw'].setValue('not applicable') }
|
||||
}
|
||||
if (flag == 2) {
|
||||
this.FinishedCounterArray[index] = value == "yes" ? 1 : 0
|
||||
this.not_stock_of_fg[index] = value == "stock not required to be maintained" ? 1 : 0;
|
||||
}
|
||||
if (flag == 3) {
|
||||
this.RetailCounterArray[index] = value == "yes" ? 1 : 0
|
||||
this.not_stock_of_tg[index] = value == "stock not required to be maintained" ? 1 : 0;
|
||||
}
|
||||
if (flag == 4) {
|
||||
this.WholeSaleCounterArray[index] = value == "yes" ? 1 : 0
|
||||
this.not_stock_of_ws[index] = value == "stock not required to be maintained" ? 1 : 0;
|
||||
}
|
||||
let FGOverallCount = this.FinishedCounterArray.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 TGOverallCount = FGOverallCount + RTGOverallCount + WTGOverallCount;
|
||||
this.TGCommentCard = TGOverallCount > 0 ? true : false;
|
||||
|
||||
let not_stock_fg = this.not_stock_of_rm.reduce((sum, val) => sum + +val, 0);
|
||||
let not_stock_rt = this.not_stock_of_rm.reduce((sum, val) => sum + +val, 0);
|
||||
let not_stock_tg = this.not_stock_of_rm.reduce((sum, val) => sum + +val, 0);
|
||||
let not_stock2 = not_stock_fg + not_stock_rt + not_stock_tg;
|
||||
|
||||
if(not_stock2 > 0){
|
||||
this.stockForms.controls['is_sufficiant_finished_and_traded_goods'].setValue('not applicable');
|
||||
}
|
||||
// else if(not_stock == 0){
|
||||
// this.stockForms.controls['is_sufficiant_finished_and_traded_goods'].setValue('');
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
// checkComments(e,flag,index){
|
||||
|
||||
Loading…
Reference in New Issue
Block a user