issues fixes : ps

This commit is contained in:
venbatechnologies@gmail.com 2019-04-09 20:09:13 +05:30
parent be0f45f2f9
commit 5103a3e15d
15 changed files with 92 additions and 53 deletions

View File

@ -98,6 +98,7 @@
</mat-select> </mat-select>
<!-- <mat-error *ngIf="pdMain.fk_customer_segment.hasError('required')">Customer Segment Required.</mat-error> --> <!-- <mat-error *ngIf="pdMain.fk_customer_segment.hasError('required')">Customer Segment Required.</mat-error> -->
</mat-form-field> </mat-form-field>
<!-- {{pdMain.fk_customer_segment.value}} -->
<mat-form-field style="width: 28%"> <mat-form-field style="width: 28%">
<mat-select placeholder="PD Type" formControlName="fk_pd_type"> <mat-select placeholder="PD Type" formControlName="fk_pd_type">
<mat-option> <mat-option>
@ -200,8 +201,8 @@
<input matInput autocomplete="off" placeholder="Name of Individual Applicant" formControlName="applicant_name"> <input matInput autocomplete="off" placeholder="Name of Individual Applicant" formControlName="applicant_name">
<!-- <mat-error *ngIf="pdMain.applicant_name.hasError('required')">Name is Required.</mat-error> --> <!-- <mat-error *ngIf="pdMain.applicant_name.hasError('required')">Name is Required.</mat-error> -->
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 38%"> <mat-form-field style="width: 38%" *ngIf="pdMain.fk_customer_segment.value != '8'">
<input matInput autocomplete="off" placeholder="Company / Firm Name" formControlName="company_name" type="text"> <input matInput autocomplete="off" placeholder="Company / Firm Name" formControlName="company_name" type="text">
</mat-form-field> </mat-form-field>
@ -241,7 +242,7 @@
<!-- <mat-error *ngIf="pdMain.applicant_name.hasError('required')">Name is Required.</mat-error> --> <!-- <mat-error *ngIf="pdMain.applicant_name.hasError('required')">Name is Required.</mat-error> -->
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 38%"> <mat-form-field style="width: 38%" *ngIf="pdMain.fk_customer_segment.value != '8'">
<input matInput autocomplete="off" placeholder="Company / Firm Name" formControlName="company_name" type="text"> <input matInput autocomplete="off" placeholder="Company / Firm Name" formControlName="company_name" type="text">
</mat-form-field> </mat-form-field>

View File

@ -447,9 +447,11 @@ export class AddPdComponent implements OnInit, OnDestroy {
this.notifier.notify('warning', 'Either Mobile or Landline Need.!'); this.notifier.notify('warning', 'Either Mobile or Landline Need.!');
return; return;
} }
else if (formValue.mobile_no.length != 10) { else if (formValue.mobile_no != null){
if (formValue.mobile_no.length != 10){
this.notifier.notify('warning', 'Please Check Applicant Mobile Number.!'); this.notifier.notify('warning', 'Please Check Applicant Mobile Number.!');
return; return;
}
} }
else { else {
this.disableAfterSubmit = true; this.disableAfterSubmit = true;
@ -604,21 +606,21 @@ export class AddPdComponent implements OnInit, OnDestroy {
if (formValue.addtional_requirements.length > 0) { if (formValue.addtional_requirements.length > 0) {
pd_form.append("addtional_requirements", JSON.stringify(formValue.addtional_requirements)) pd_form.append("addtional_requirements", JSON.stringify(formValue.addtional_requirements))
} }
alert('commanded')
// this._pd.addPdDetails(pd_form).subscribe(result => { this._pd.addPdDetails(pd_form).subscribe(result => {
// if (result.status == 200) { if (result.status == 200) {
// this.disableAfterSubmit = false; this.disableAfterSubmit = false;
// this.notifier.notify('success', 'PD Saved.'); this.notifier.notify('success', 'PD Saved.');
// this.loadPdListCompoent(true); this.loadPdListCompoent(true);
// } }
// else { else {
// this.disableAfterSubmit = false; this.disableAfterSubmit = false;
// this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
// } }
// }, error => { }, error => {
// this.disableAfterSubmit = false; this.disableAfterSubmit = false;
// this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
// }); });
} }
} }
} }

View File

@ -29,7 +29,7 @@
<input matInput placeholder="Name of Individual Applicant" formControlName="applicant_name" required> <input matInput placeholder="Name of Individual Applicant" formControlName="applicant_name" required>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 40%"> <mat-form-field style="width: 40%" *ngIf="CSAbbr != 'SE-RI'">
<input matInput placeholder="Company / Firm Name" formControlName="company_name" type="text"> <input matInput placeholder="Company / Firm Name" formControlName="company_name" type="text">
</mat-form-field> </mat-form-field>

View File

@ -21,13 +21,16 @@ export class EditPdApplicantComponent implements OnInit {
emptyData:any; emptyData:any;
relationShipList:any; relationShipList:any;
titleList: any; titleList: any;
CSAbbr:any;
constructor(private _fb: FormBuilder, constructor(private _fb: FormBuilder,
private _pd: PdTrigerService, notifier: NotifierService, private dialogRef: MatDialogRef<EditPdApplicantComponent>, private _pd: PdTrigerService, notifier: NotifierService, private dialogRef: MatDialogRef<EditPdApplicantComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) { @Inject(MAT_DIALOG_DATA) public data: any) {
console.log('Dialog Data',data);
this.notifier=notifier this.notifier=notifier
} }
ngOnInit() { ngOnInit() {
this.CSAbbr = this.data.SegmentAbbr != '' ? this.data.SegmentAbbr != null ? this.data.SegmentAbbr : '' :'' ;
if(this.data.records.length>0){ if(this.data.records.length>0){
this.mainApplicantData= this.data.records.filter(item => item.applicant_type == 1); this.mainApplicantData= this.data.records.filter(item => item.applicant_type == 1);
this.coApplicantData= this.data.records.filter(item => item.applicant_type == 0); this.coApplicantData= this.data.records.filter(item => item.applicant_type == 0);

View File

@ -76,8 +76,11 @@ export class EditPdMasterComponent implements OnInit {
data => { data => {
if (data.status == 200) { if (data.status == 200) {
this.lenderList=data.records; this.lenderList=data.records;
console.log('this.data.records.fk_lender_id',this.data.records.fk_lender_id);
if(this.data.records.fk_lender_id != null){
let x = this.lenderList.filter(item => item.entity_id == this.data.records.fk_lender_id) let x = this.lenderList.filter(item => item.entity_id == this.data.records.fk_lender_id)
this.lenderBranchList = x[0]['branches']; this.lenderBranchList = x[0]['branches'];
}
} }
}, error => this.errorMessage = <any> error); }, error => this.errorMessage = <any> error);
} }
@ -186,13 +189,15 @@ export class EditPdMasterComponent implements OnInit {
data => { data => {
if (data.status == 200) { if (data.status == 200) {
this.addressesList = data.records.filter(item => item.isactive == 1); this.addressesList = data.records.filter(item => item.isactive == 1);
console.log('this.addressesList',this.addressesList);
if (this.addressesList.length > 0) { if (this.addressesList.length > 0) {
this.addressesList.forEach((val,index)=>{ this.addressesList.forEach((val,index)=>{
this.addressesDeactivited[index] = true; this.addressesDeactivited[index] = true;
let obj = { let obj = {
pd_address_id:val.pd_address_id, pd_address_id:val.pd_address_id,
addressline1: val.addressline1.toUpperCase(), // addressline1: val.addressline1.toUpperCase(),
addressline1: val.addressline1 != null ? val.addressline1.toUpperCase() : val.addressline1,
fk_city: val.fk_city, fk_city: val.fk_city,
fk_state: val.fk_state, fk_state: val.fk_state,
  pincode: val.pincode_id,   pincode: val.pincode_id,
@ -267,7 +272,7 @@ export class EditPdMasterComponent implements OnInit {
return this._fb.group({ return this._fb.group({
fk_pd_id:[this.pdid], fk_pd_id:[this.pdid],
pd_address_id:[data.pd_address_id], pd_address_id:[data.pd_address_id],
  addressline1: [data.addressline1.toUpperCase()],   addressline1: [data.addressline1 != null ? data.addressline1.toUpperCase() : null],
fk_city: [data.fk_city], fk_city: [data.fk_city],
fk_state: [data.fk_state], fk_state: [data.fk_state],
  pincode : [data.pincode],   pincode : [data.pincode],
@ -443,7 +448,7 @@ export class EditPdMasterComponent implements OnInit {
"fk_pd_type": my_array.fk_pd_type, "fk_pd_type": my_array.fk_pd_type,
"fk_customer_segment": my_array.fk_customer_segment, "fk_customer_segment": my_array.fk_customer_segment,
"loan_amount": my_array.loan_amount, "loan_amount": my_array.loan_amount,
  "addressline1": filteredAddressesdata[0].addressline1.toUpperCase(),   "addressline1": filteredAddressesdata[0].addressline1 != null ? filteredAddressesdata[0].addressline1.toUpperCase() : null,
"fk_city": filteredAddressesdata[0].fk_city, "fk_city": filteredAddressesdata[0].fk_city,
"fk_state": filteredAddressesdata[0].fk_state, "fk_state": filteredAddressesdata[0].fk_state,
  "pincode": filteredAddressesdata[0].pincode,   "pincode": filteredAddressesdata[0].pincode,

View File

@ -82,7 +82,8 @@ businessCalculation(indexVal: number,values: any): void {
let control:any = <FormArray>this.businessItemForm.controls['busExpense']; let control:any = <FormArray>this.businessItemForm.controls['busExpense'];
if(values.expense_value!='' && values.fk_frequency_id!='') { if(values.expense_value!='' && values.fk_frequency_id!='') {
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id); let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id);
control.controls[indexVal].controls['annual_expenses_value'].setValue(parseInt(values.expense_value) * parseInt(filterFrequencyValue[0].mutiple_factor)); let CalculatedVal = parseFloat(values.expense_value) * parseFloat(filterFrequencyValue[0].mutiple_factor);
control.controls[indexVal].controls['annual_expenses_value'].setValue(CalculatedVal.toFixed(2));
} }
else { else {

View File

@ -60,7 +60,7 @@
</div> </div>
<mat-form-field style="width: 92%"> <mat-form-field style="width: 92%">
<textarea matInput type="text" placeholder="Remarks" formControlName="comments" required></textarea> <textarea matInput type="text" placeholder="Remarks" formControlName="comments"></textarea>
</mat-form-field> </mat-form-field>
</mat-card-content> </mat-card-content>

View File

@ -74,8 +74,8 @@ export class ManageDailyPurchaseComponent implements OnInit {
}); });
// control.controls[control.value.length-1].controls['comments'].setValidators([Validators.required]); // control.controls[control.value.length-1].controls['comments'].setValue
// control.controls[control.value.length-1].controls['comments'].updateValueAndValidity();
} }
else{ else{
this.purchaseItemForm = this._fb.group({ this.purchaseItemForm = this._fb.group({
@ -96,7 +96,7 @@ export class ManageDailyPurchaseComponent implements OnInit {
other_purchase_item:[''], other_purchase_item:[''],
annual_purchase_value: [''], annual_purchase_value: [''],
child: this._fb.array([]), child: this._fb.array([]),
comments: ['', Validators.compose([Validators.required])], comments: [''],
isactive:[true], isactive:[true],
}); });
} }
@ -122,7 +122,7 @@ createPurchaseItemWithData(values: any) {
other_purchase_item:[values.otherPurchaseItem === null ? '' : values.otherPurchaseItem ], other_purchase_item:[values.otherPurchaseItem === null ? '' : values.otherPurchaseItem ],
annual_purchase_value: [values.annualPurchaseValue], annual_purchase_value: [values.annualPurchaseValue],
child: this._fb.array([]), child: this._fb.array([]),
comments: [values.comments, Validators.compose([Validators.required])], comments: [values.comments],
isactive:[true], isactive:[true],
}); });
} }
@ -192,7 +192,21 @@ purchaseCalculation(indexVal: number,values: any): void {
mval.custum_date = this.pipe.transform(mval.purchase_date, 'yyyy-MM'); mval.custum_date = this.pipe.transform(mval.purchase_date, 'yyyy-MM');
return mval; return mval;
}); });
// expandBodyContent.forEach((expnadElement, expnadIndex) => {
// let calculateItems = expnadElement.value.reduce((acc, calculate) => acc + Number(calculate.sales_value), 0);
// listItems.push({items:expnadElement, itemsTotal:calculateItems})
// })
// let calculateAllItemsTotal:number=listItems.reduce((racc, rcalculate) => racc + Number(rcalculate.itemsTotal), 0);
// let convertYear : number = 12 / listItems.length;
// let footerMessage: any=[];
// footerMessage.push({
// month_message: listItems.length + ' Month Sales : '+ calculateAllItemsTotal,
// month_value:calculateAllItemsTotal,
// year_message: ' Yearly Sales Arrived : '+ calculateAllItemsTotal * convertYear,
// year_value: calculateAllItemsTotal * convertYear,
// })
if(transformData.length>0) { if(transformData.length>0) {
// let getUniqueMonthCounts = transformData.map(val=>val.custum_date) // let getUniqueMonthCounts = transformData.map(val=>val.custum_date)
// .filter((fVal,fIndex,fArray)=>{ // .filter((fVal,fIndex,fArray)=>{

View File

@ -238,8 +238,8 @@ salesCalculation(indexVal: number,values: any): void {
return fIndex === fArray.indexOf(fVal); return fIndex === fArray.indexOf(fVal);
}); });
let getTotalValueCounts = transformData.map(val=>val.sales_value) let getTotalValueCounts = transformData.map(val=>val.sales_value)
.reduce((sum, curr) => parseInt(sum) + parseInt(curr)); .reduce((sum, curr) =>parseFloat(sum) +parseFloat(curr));
let calculatedValue = parseInt(getTotalValueCounts) * (parseInt(values.margin_per)/100) * (12 / parseInt(getUniqueMonthCounts.length)); let calculatedValue =parseFloat(getTotalValueCounts) * (parseFloat(values.margin_per)/100) * (12 /parseFloat(getUniqueMonthCounts.length));
control.controls[indexVal].controls['margin_value'].setValue(calculatedValue.toFixed(2)); control.controls[indexVal].controls['margin_value'].setValue(calculatedValue.toFixed(2));
} }
else{ else{
@ -258,10 +258,10 @@ salesCalculation(indexVal: number,values: any): void {
if(values.child[values.child.length-1].fk_frequency_id!='' && values.child[values.child.length-1].frequency_value!=''){ if(values.child[values.child.length-1].fk_frequency_id!='' && values.child[values.child.length-1].frequency_value!=''){
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.child[values.child.length-1].fk_frequency_id); let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.child[values.child.length-1].fk_frequency_id);
innercontrol.controls[innercontrol.value.length-1].controls['sales_value'].setValue(parseInt(filterFrequencyValue[0].mutiple_factor) * parseInt(values.child[values.child.length-1].frequency_value)); innercontrol.controls[innercontrol.value.length-1].controls['sales_value'].setValue(parseFloat(filterFrequencyValue[0].mutiple_factor) *parseFloat(values.child[values.child.length-1].frequency_value));
let getTotalValueCounts =parseInt(filterFrequencyValue[0].mutiple_factor) * parseInt(values.child[values.child.length-1].frequency_value) let getTotalValueCounts =parseFloat(filterFrequencyValue[0].mutiple_factor) *parseFloat(values.child[values.child.length-1].frequency_value)
let CalculatedVal = getTotalValueCounts * (parseInt(values.margin_per)/100); let CalculatedVal = getTotalValueCounts * (parseFloat(values.margin_per)/100);
values.margin_per!='' ? control.controls[indexVal].controls['margin_value'].setValue( CalculatedVal.toFixed(2)) : ''; values.margin_per!='' ? control.controls[indexVal].controls['margin_value'].setValue( CalculatedVal.toFixed(2)) : '';
} }
else { else {
@ -276,7 +276,7 @@ salesCalculation(indexVal: number,values: any): void {
if(values.child[values.child.length-1].fk_frequency_id!='' && values.child[values.child.length-1].frequency_value!=''){ if(values.child[values.child.length-1].fk_frequency_id!='' && values.child[values.child.length-1].frequency_value!=''){
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.child[values.child.length-1].fk_frequency_id); let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.child[values.child.length-1].fk_frequency_id);
let marginCalculatedValue = parseInt(filterFrequencyValue[0].mutiple_factor) * parseInt(values.child[values.child.length-1].frequency_value); let marginCalculatedValue =parseFloat(filterFrequencyValue[0].mutiple_factor) *parseFloat(values.child[values.child.length-1].frequency_value);
innercontrol.controls[innercontrol.value.length-1].controls['sales_value'].setValue(marginCalculatedValue.toFixed(2)); innercontrol.controls[innercontrol.value.length-1].controls['sales_value'].setValue(marginCalculatedValue.toFixed(2));
} }
else { else {

View File

@ -79,7 +79,8 @@ houseCalculation(indexVal: number,values: any): void {
let control:any = <FormArray>this.houseItemForm.controls['houseExpense']; let control:any = <FormArray>this.houseItemForm.controls['houseExpense'];
if(values.expense_value!='' && values.fk_frequency_id!='') { if(values.expense_value!='' && values.fk_frequency_id!='') {
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id); let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id);
control.controls[indexVal].controls['annual_expense_value'].setValue(parseInt(values.expense_value) * parseInt(filterFrequencyValue[0].mutiple_factor)); let CalculatedValue = parseFloat(values.expense_value) * parseFloat(filterFrequencyValue[0].mutiple_factor);
control.controls[indexVal].controls['annual_expense_value'].setValue(CalculatedValue.toFixed(2));
} }
else { else {

View File

@ -82,7 +82,8 @@ businessCalculation(indexVal: number,values: any): void {
let control:any = <FormArray>this.businessIncomeItemForm.controls['busIncome']; let control:any = <FormArray>this.businessIncomeItemForm.controls['busIncome'];
if(values.income_value!='' && values.fk_frequency_id!='') { if(values.income_value!='' && values.fk_frequency_id!='') {
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id); let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id);
control.controls[indexVal].controls['annual_income_value'].setValue(parseInt(values.income_value) * parseInt(filterFrequencyValue[0].mutiple_factor)); let CalculatedValue = parseFloat(values.income_value) * parseFloat(filterFrequencyValue[0].mutiple_factor);
control.controls[indexVal].controls['annual_income_value'].setValue(CalculatedValue.toFixed(2));
} }
else { else {

View File

@ -145,12 +145,14 @@ purchaseCalculation(indexVal: number,values: any): void {
if(values.purchase_type=="1" &&values.purchase_qty!='' && values.rate_per_unit!='' && values.fk_frequency_id!='') { if(values.purchase_type=="1" &&values.purchase_qty!='' && values.rate_per_unit!='' && values.fk_frequency_id!='') {
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id); let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id);
control.controls[indexVal].controls['annual_purchase_value'].setValue(parseInt(values.purchase_qty) * parseInt(values.rate_per_unit) * parseInt(filterFrequencyValue[0].mutiple_factor)); let Type1CalculatedValue = parseFloat(values.purchase_qty) * parseFloat(values.rate_per_unit) * parseFloat(filterFrequencyValue[0].mutiple_factor);
control.controls[indexVal].controls['annual_purchase_value'].setValue(Type1CalculatedValue.toFixed(2));
} }
else if(values.purchase_type=="2" && values.rate_per_unit!='' && values.fk_frequency_id!='') { else if(values.purchase_type=="2" && values.rate_per_unit!='' && values.fk_frequency_id!='') {
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id); let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id);
control.controls[indexVal].controls['annual_purchase_value'].setValue(parseInt(values.rate_per_unit) * parseInt(filterFrequencyValue[0].mutiple_factor)); let Type2CaluculatedValue = parseFloat(values.rate_per_unit) * parseFloat(filterFrequencyValue[0].mutiple_factor);
control.controls[indexVal].controls['annual_purchase_value'].setValue(Type2CaluculatedValue.toFixed(2));
} }
else { else {
control.controls[indexVal].controls['annual_purchase_value'].setValue(''); control.controls[indexVal].controls['annual_purchase_value'].setValue('');

View File

@ -159,11 +159,13 @@ salesCalculation(indexVal: number,values: any): void {
let control:any = <FormArray>this.salesItemForm.controls['salesCalItemwise']; let control:any = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
if(values.sales_type=="1" && values.sales_qty!='' && values.rate_per_unit!='' && values.fk_frequency_id!='') { if(values.sales_type=="1" && values.sales_qty!='' && values.rate_per_unit!='' && values.fk_frequency_id!='') {
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id); let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id);
control.controls[indexVal].controls['annual_sale_value'].setValue(parseInt(values.sales_qty) * parseInt(values.rate_per_unit) * parseInt(filterFrequencyValue[0].mutiple_factor)); let Type1CalculatedValue = parseFloat(values.sales_qty) * parseFloat(values.rate_per_unit) * parseFloat(filterFrequencyValue[0].mutiple_factor);
control.controls[indexVal].controls['annual_sale_value'].setValue(Type1CalculatedValue.toFixed(2));
} }
else if(values.sales_type=="2" && values.rate_per_unit!='' && values.fk_frequency_id!='') { else if(values.sales_type=="2" && values.rate_per_unit!='' && values.fk_frequency_id!='') {
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id); let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id);
control.controls[indexVal].controls['annual_sale_value'].setValue(parseInt(values.rate_per_unit) * parseInt(filterFrequencyValue[0].mutiple_factor)); let Type2CalculatedValue = parseFloat(values.rate_per_unit) * parseFloat(filterFrequencyValue[0].mutiple_factor)
control.controls[indexVal].controls['annual_sale_value'].setValue(Type2CalculatedValue.toFixed(2));
} }
else { else {
control.controls[indexVal].controls['annual_sale_value'].setValue(''); control.controls[indexVal].controls['annual_sale_value'].setValue('');
@ -176,7 +178,7 @@ salesMarginPerCalculation(indexVal: number,values: any): void {
let control:any = <FormArray>this.salesItemForm.controls['salesCalItemwise']; let control:any = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
control.controls[indexVal].controls['margin_per_uom'].setValue(''); control.controls[indexVal].controls['margin_per_uom'].setValue('');
if(values.margin_per!='' && values.annual_sale_value!='') { if(values.margin_per!='' && values.annual_sale_value!='') {
let calculatedValue = parseInt(values.annual_sale_value) * (parseInt(values.margin_per)/100); let calculatedValue = parseFloat(values.annual_sale_value) * (parseFloat(values.margin_per)/100);
control.controls[indexVal].controls['margin_final_value'].setValue(calculatedValue.toFixed(2)); control.controls[indexVal].controls['margin_final_value'].setValue(calculatedValue.toFixed(2));
} }
else { else {
@ -189,10 +191,12 @@ salesMarginAmtCalculation(indexVal: number,values: any): void {
if(values.sales_type=="1" && values.margin_per_uom!='' && values.sales_qty!='' && values.fk_frequency_id!='') { if(values.sales_type=="1" && values.margin_per_uom!='' && values.sales_qty!='' && values.fk_frequency_id!='') {
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id); let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id);
control.controls[indexVal].controls['margin_final_value'].setValue(parseInt(values.sales_qty) * parseInt(values.margin_per_uom) * parseInt(filterFrequencyValue[0].mutiple_factor)); let Type1CalculatedValue = parseFloat(values.sales_qty) * parseFloat(values.margin_per_uom) * parseFloat(filterFrequencyValue[0].mutiple_factor);
control.controls[indexVal].controls['margin_final_value'].setValue(Type1CalculatedValue.toFixed(2));
} }
else if(values.sales_type=="2" && values.margin_per_uom!='' && values.rate_per_unit!='') { else if(values.sales_type=="2" && values.margin_per_uom!='' && values.rate_per_unit!='') {
control.controls[indexVal].controls['margin_final_value'].setValue(parseInt(values.rate_per_unit) * parseInt(values.margin_per_uom)); let Type2CalculatedValue = parseFloat(values.rate_per_unit) * parseFloat(values.margin_per_uom);
control.controls[indexVal].controls['margin_final_value'].setValue(Type2CalculatedValue.toFixed(2));
} }
else { else {
control.controls[indexVal].controls['margin_final_value'].setValue(''); control.controls[indexVal].controls['margin_final_value'].setValue('');

View File

@ -177,7 +177,7 @@
<mat-card-title>Applicants</mat-card-title> <mat-card-title>Applicants</mat-card-title>
</div> </div>
<div fxFlex="30" align="end" style="padding: 10px !important;" *ngIf="currentPDStatus==pdStatusCheck.DRAFT || currentPDStatus==pdStatusCheck.TRIGGERED || currentPDStatus==pdStatusCheck.ALLOCATED || currentPDStatus==pdStatusCheck.SCHEDULED"> <div fxFlex="30" align="end" style="padding: 10px !important;" *ngIf="currentPDStatus==pdStatusCheck.DRAFT || currentPDStatus==pdStatusCheck.TRIGGERED || currentPDStatus==pdStatusCheck.ALLOCATED || currentPDStatus==pdStatusCheck.SCHEDULED">
<button mat-raised-button mat-button-sm mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="editPdApplicant(pdApplicantData)"><mat-icon>edit</mat-icon></button> <button mat-raised-button mat-button-sm mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="editPdApplicant(pdApplicantData,CustomerSegmentAbbr)"><mat-icon>edit</mat-icon></button>
</div> </div>
</mat-card-header> </mat-card-header>

View File

@ -47,22 +47,23 @@ export class ViewPdComponent implements OnInit, OnDestroy {
{ 'backEnd_FieldName': "fk_pd_type", 'frontEnd_FieldName': "PD Type" }, { 'backEnd_FieldName': "fk_pd_type", 'frontEnd_FieldName': "PD Type" },
{ 'backEnd_FieldName': "fk_customer_segment", 'frontEnd_FieldName': "Customer Segment" }, { 'backEnd_FieldName': "fk_customer_segment", 'frontEnd_FieldName': "Customer Segment" },
{ 'backEnd_FieldName': "loan_amount", 'frontEnd_FieldName': "Loan Amount" }, { 'backEnd_FieldName': "loan_amount", 'frontEnd_FieldName': "Loan Amount" },
{ 'backEnd_FieldName': "addressline1", 'frontEnd_FieldName': "Address at which PD is to be done" },
{ 'backEnd_FieldName': "fk_city", 'frontEnd_FieldName': "City" },
{ 'backEnd_FieldName': "fk_state", 'frontEnd_FieldName': "State" },
{ 'backEnd_FieldName': "pincode", 'frontEnd_FieldName': "Pincode" },
{ 'backEnd_FieldName': "pd_contact_person", 'frontEnd_FieldName': "Lender Contact Person" }, { 'backEnd_FieldName': "pd_contact_person", 'frontEnd_FieldName': "Lender Contact Person" },
{ 'backEnd_FieldName': "pd_contact_mobileno", 'frontEnd_FieldName': "Lender's Mobile Number" }, { 'backEnd_FieldName': "pd_contact_mobileno", 'frontEnd_FieldName': "Lender's Mobile Number" },
{ 'backEnd_FieldName': "pd_branch_id", 'frontEnd_FieldName': "Branch" }, { 'backEnd_FieldName': "pd_branch_id", 'frontEnd_FieldName': "Branch" },
{ 'backEnd_FieldName': "pd_contact_landline", 'frontEnd_FieldName': "Lender's Landline Number" }, { 'backEnd_FieldName': "pd_contact_landline", 'frontEnd_FieldName': "Lender's Landline Number" },
{ 'backEnd_FieldName': "main_applicant", 'frontEnd_FieldName': "Applicant Master" }]; { 'backEnd_FieldName': "main_applicant", 'frontEnd_FieldName': "Applicant Master" }];
// localAddressMandortyField: any = [
// { 'backEnd_FieldName': "addressline1", 'frontEnd_FieldName': "Address at which PD is to be done" },
// { 'backEnd_FieldName': "fk_city", 'frontEnd_FieldName': "City" },
// { 'backEnd_FieldName': "fk_state", 'frontEnd_FieldName': "State" },
// { 'backEnd_FieldName': "pincode", 'frontEnd_FieldName': "Pincode" }
// ];
viewID: string; viewID: string;
viewParams: any; viewParams: any;
destroyType: number = 1; destroyType: number = 1;
currentPDStatus: string; currentPDStatus: string;
enableStartPD: boolean; enableStartPD: boolean;
CustomerSegmentAbbr:string;
// create values for status check // create values for status check
pdStatusCheck: any = { pdStatusCheck: any = {
"DRAFT": 'DRAFT', "DRAFT": 'DRAFT',
@ -105,6 +106,7 @@ export class ViewPdComponent implements OnInit, OnDestroy {
this.pd_QC_Rating = Number(this.pdMasterData.qc_rating); this.pd_QC_Rating = Number(this.pdMasterData.qc_rating);
this.pdApplicantData = data.records.applicants_details; this.pdApplicantData = data.records.applicants_details;
this.pdApplicantData = this.pdApplicantData.filter(appt => appt.applicant_type != 2); this.pdApplicantData = this.pdApplicantData.filter(appt => appt.applicant_type != 2);
this.CustomerSegmentAbbr = this.pdMasterData[0].customer_segment_abbr;
this.pdDocumentsData = data.records.pd_documnets; this.pdDocumentsData = data.records.pd_documnets;
this.masterPdLogsData = Object.keys(data.records.pd_logs.master).map(function (key) { this.masterPdLogsData = Object.keys(data.records.pd_logs.master).map(function (key) {
return data.records.pd_logs.master[key]; return data.records.pd_logs.master[key];
@ -203,6 +205,7 @@ export class ViewPdComponent implements OnInit, OnDestroy {
.subscribe(dataresult => { .subscribe(dataresult => {
if (flag == 1) { if (flag == 1) {
let ffd: any = []; let ffd: any = [];
console.log('this.FilteredFieldNames',this.FilteredFieldNames);
this.FilteredFieldNames.forEach(field => { this.FilteredFieldNames.forEach(field => {
ffd.push(field.frontEnd_FieldName); ffd.push(field.frontEnd_FieldName);
}); });
@ -227,10 +230,11 @@ export class ViewPdComponent implements OnInit, OnDestroy {
this.viewPdDetails(this.viewID) this.viewPdDetails(this.viewID)
}); });
} }
editPdApplicant(applicantData: any) { editPdApplicant(applicantData: any,CSAbbr : any) {
let setPdDetails = { let setPdDetails = {
"pdID": this.viewID, "pdID": this.viewID,
"records": applicantData "records": applicantData,
"SegmentAbbr":CSAbbr,
} }
const dialogApplicant = this.dialog.open(EditPdApplicantComponent, { const dialogApplicant = this.dialog.open(EditPdApplicantComponent, {
data: setPdDetails, data: setPdDetails,
@ -389,6 +393,7 @@ export class ViewPdComponent implements OnInit, OnDestroy {
let pdid = masterdetail.pd_id; let pdid = masterdetail.pd_id;
let getValues = data.filter(val => val).map(Val => Val); let getValues = data.filter(val => val).map(Val => Val);
console.log('getValues',getValues);
this.FilteredFieldNames = getValues.map(x => { this.FilteredFieldNames = getValues.map(x => {
let findIndex = this.localMandatoryFields.map(val => val.backEnd_FieldName).indexOf(x); let findIndex = this.localMandatoryFields.map(val => val.backEnd_FieldName).indexOf(x);
return this.localMandatoryFields[findIndex]; return this.localMandatoryFields[findIndex];