issues fixes : ps

This commit is contained in:
venbatechnologies@gmail.com 2018-12-31 15:25:54 +05:30
parent 7fd73eda09
commit 124aafc0b3
5 changed files with 220 additions and 134 deletions

View File

@ -39,18 +39,18 @@
</mat-form-field>
<mat-form-field style="width: 32%">
<input matInput placeholder="Lender Applicant ID" formControlName="lender_applicant_id" type="text" required>
<input matInput autocomplete="off" placeholder="Lender Applicant ID" formControlName="lender_applicant_id" type="text" required>
<!-- <mat-error *ngIf="pdMain.lender_applicant_id.hasError('required')">Applicant ID Required</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 32%">
<input matInput placeholder="Lender Contact Person" formControlName="lender_contact_person" type="text" required>
<input matInput autocomplete="off" placeholder="Lender Contact Person" formControlName="lender_contact_person" type="text" required>
<!-- <mat-error *ngIf="pdMain.lender_contact_person.hasError('required')">Lender Contact Person Required</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 32%">
<input matInput placeholder="Lender Contact Number" formControlName="lender_contact_mobile" type="text" (keypress)="keyPress($event)" maxlength="10">
<input matInput autocomplete="off" placeholder="Lender Contact Number" formControlName="lender_contact_mobile" type="text" (keypress)="keyPress($event)" maxlength="10">
<mat-error *ngIf="pdMain.lender_contact_mobile.hasError('pattern') || pdMain.lender_contact_mobile.hasError('maxlength') || pdMain.lender_contact_mobile.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field>
@ -108,23 +108,23 @@
</mat-form-field>
<mat-form-field style="width: 32%">
<input matInput placeholder="Loan Amount" formControlName="loan_amount" (keypress)="keyPress($event)" (keyup)="inWords($event,1)" required autocomplete="off">
<input matInput autocomplete="off" placeholder="Loan Amount" formControlName="loan_amount" (keypress)="keyPress($event)" (keyup)="inWords($event,1)" required autocomplete="off">
<mat-hint align="end" *ngIf="pdMain.loan_amount.value">{{"&#8377;"}} {{loanAmtInWords}} Only</mat-hint>
<!-- <mat-error *ngIf="pdMain.loan_amount.hasError('required')">Amount Required.</mat-error> -->
<mat-error *ngIf="pdMain.loan_amount.hasError('pattern')">Enter valid amount. </mat-error>
</mat-form-field>
<mat-form-field style="width: 96%">
<textarea matInput placeholder="Address at which PD is to be done" formControlName="addressline1" oninput="this.value = this.value.toUpperCase()"></textarea>
<textarea matInput autocomplete="off" placeholder="Address at which PD is to be done" formControlName="addressline1" oninput="this.value = this.value.toUpperCase()"></textarea>
<!-- <mat-error *ngIf="pdMain.addressline1.hasError('required')">Address1 required.</mat-error> -->
</mat-form-field>
<!-- <mat-form-field style="width: 28%">
<textarea matInput placeholder="Address 2" formControlName="addressline2" oninput="this.value = this.value.toUpperCase()"></textarea>
<textarea matInput autocomplete="off" placeholder="Address 2" formControlName="addressline2" oninput="this.value = this.value.toUpperCase()"></textarea>
</mat-form-field>
<mat-form-field style="width: 28%">
<textarea matInput placeholder="Address 3" formControlName="addressline3" oninput="this.value = this.value.toUpperCase()"></textarea>
<textarea matInput autocomplete="off" placeholder="Address 3" formControlName="addressline3" oninput="this.value = this.value.toUpperCase()"></textarea>
</mat-form-field>-->
<mat-form-field style="width: 32%">
<mat-select placeholder="State" formControlName="fk_state" (selectionChange)="getCityList(pdMain.fk_state.value)">
@ -156,7 +156,7 @@
<mat-form-field style="width: 24%">
<input matInput placeholder="Pincode" formControlName="pincode" (keypress)="keyPress($event)">
<input matInput autocomplete="off" placeholder="Pincode" formControlName="pincode" (keypress)="keyPress($event)">
<!-- <mat-error *ngIf="pdMain.pincode.hasError('required')">Pincode Required.</mat-error> -->
<mat-error *ngIf="pdMain.pincode.hasError('maxlength') || pdMain.pincode.hasError('minlength')">Enter Valid Pincode. </mat-error>
@ -173,26 +173,26 @@
<mat-card-content>
<mat-form-field style="width: 46%">
<input matInput 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-form-field>
<mat-form-field style="width: 46%">
<input matInput 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 style="width: 46%">
<input matInput placeholder="Mobile Number" formControlName="mobile_no" type="text" (keypress)="keyPress($event)" maxlength="10">
<input matInput autocomplete="off" placeholder="Mobile Number" formControlName="mobile_no" type="text" (keypress)="keyPress($event)" maxlength="10">
<mat-error *ngIf="pdMain.mobile_no.hasError('maxlength') || pdMain.mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field>
<mat-form-field style="width: 15%">
<input matInput placeholder="STD Code" formControlName="stdcode" type="text" (keypress)="keyPress($event)">
<input matInput autocomplete="off" placeholder="STD Code" formControlName="stdcode" type="text" (keypress)="keyPress($event)">
<span matPrefix>+91</span>
<mat-error *ngIf="pdMain.stdcode.hasError('maxlength') || pdMain.stdcode.hasError('minlength')">Enter Valid STD Code Number. </mat-error>
</mat-form-field> &nbsp; - &nbsp;
<mat-form-field style="width: 20%">
<input matInput placeholder="Landline Number" formControlName="landline" type="text" (keypress)="keyPress($event)">
<input matInput autocomplete="off" placeholder="Landline Number" formControlName="landline" type="text" (keypress)="keyPress($event)">
<mat-error *ngIf="pdMain.landline.hasError('maxlength') || pdMain.landline.hasError('minlength')">Enter Valid LandLine Number. </mat-error>
</mat-form-field>
@ -207,7 +207,7 @@
<mat-card>
<mat-card-content [formGroupName]="i">
<mat-form-field style="width: 90%;">
<input matInput placeholder="Requirement" formControlName="add_requirement">
<input matInput autocomplete="off" placeholder="Requirement" formControlName="add_requirement">
</mat-form-field>
<button mat-raised-button mat-icon-button matTooltip="Delete" matTooltipPosition="above" (click)="removeRequirements(i)" type="button"><mat-icon>delete</mat-icon></button>
@ -234,7 +234,7 @@
<!-- <h3 mat-subheader>Upload Documents</h3> -->
<mat-list-item>
<mat-form-field style="width: 70%">
<input matInput placeholder="Document Name" formControlName="doc_name" type="text">
<input matInput autocomplete="off" placeholder="Document Name" formControlName="doc_name" type="text">
</mat-form-field>
@ -261,7 +261,7 @@
<div fxFlex="70" class="pb-0 text-sm-left" align="left">
<mat-form-field appearance="outline" style="width: 100%">
<!-- <mat-label>Remarks</mat-label> -->
<textarea matInput placeholder="Remarks" formControlName="remarks"></textarea>
<textarea matInput autocomplete="off" placeholder="Remarks" formControlName="remarks"></textarea>
</mat-form-field>
</div>
<div fxFlex="30" align="end">

View File

@ -183,14 +183,16 @@
<!-- <input matInput placeholder="Is Any Loan" formControlName="any_other_asset_loan" > -->
<!-- </mat-form-field> -->
<mat-form-field class="ml-xs example-full-width">
<mat-select placeholder="Is there any asset loan?" formControlName="any_other_asset_loan" >
<mat-option value="yes">Yes</mat-option>
<mat-select placeholder="Is there any asset loan?" formControlName="any_other_asset_loan" (selectionChange)="selectedAssetLoanType($event.value,2)">
<mat-option value="{{data.value}}" *ngFor="let data of m_any_asset_loan_type">{{d.viewValue}}</mat-option>
<!-- <mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
<mat-option value="nan">NA</mat-option>
<mat-option value="nan">NA</mat-option> -->
</mat-select>
</mat-form-field>
<!-- <mat-form-field class="ml-xs example-full-width" *ngIf="detail.get(any_other_asset_loan).value == 'yes'"> -->
<mat-form-field class="ml-xs example-full-width">
<mat-form-field class="ml-xs example-full-width" *ngIf="businessEmiAmtFlag">
<!-- <mat-form-field class="ml-xs example-full-width"> -->
<input matInput placeholder="What is the EMI amount ?" formControlName="other_asset_emi_amt" autocomplete="off">
<!-- <span matSuffix>.00</span> -->
</mat-form-field>
@ -267,12 +269,12 @@
</div>
<div *ngIf="sup.get('business_emi').value === 'yes'" fxFlex="33">
<mat-form-field class="ml-xs example-full-width" style="width:95%">
<input matInput placeholder="Original Loan Tenure in Months" formControlName="business_original_loan_tenure" autocomplete="off" (change)="loanCalc(sup,2)">
<input matInput placeholder="Original Loan Tenure in Months" formControlName="business_original_loan_tenure" autocomplete="off" (change)="loanTenureCalc(sup,2)">
</mat-form-field>
</div>
<div *ngIf="sup.get('business_emi').value === 'yes'" fxFlex="33" style="width:95%">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Balance Tenure in Months" formControlName="business_balance_tenure" autocomplete="off" (change)="loanCalc(sup,2)">
<input matInput placeholder="Balance Tenure in Months" formControlName="business_balance_tenure" autocomplete="off" (change)="loanTenureCalc(sup,2)">
</mat-form-field>
</div>
<div *ngIf="sup.get('business_emi').value === 'yes' && sup.get('business_original_loan_tenure').value != '' && sup.get('business_balance_tenure').value != '' " fxFlex="33" style="width:95%">
@ -288,7 +290,7 @@
<div fxLayout="row" fxLayoutGap="12px" fxLayoutAlign="start none">
<div fxFlex="20">
<span *ngIf="_assetsQuesFrom.controls.business_assets_details.controls.length > 1" (click)="removeLanguage(i,2)">
<span *ngIf="_assetsQuesFrom.controls.business_assets_details.controls.length > 1" (click)="removeAssetsDetails(i,2)">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
</span>
</div>
@ -302,7 +304,7 @@
<div class="row" style="text-align:right;">
<button mat-raised-button mat-icon-button mat-button color="primary" matTooltip="Add More Business Asset Details" matTooltipPosition="above"
class="mr-1 mb-1 hover-icon" (click)="addSupplierDetails($event,2); false"><mat-icon>add</mat-icon></button>
class="mr-1 mb-1 hover-icon" (click)="addAssetDetails($event,2); false"><mat-icon>add</mat-icon></button>
</div>
</mat-card-content>
@ -527,20 +529,19 @@
</mat-option>
</mat-select>
</mat-form-field>
</div>
</div><!---- -->
<!-- <mat-form-field class="ml-xs example-full-width"> -->
<!-- <input matInput placeholder="Is Any Loan" formControlName="any_other_asset_loan" > -->
<!-- </mat-form-field> -->
<mat-form-field class="ml-xs example-full-width">
<mat-select placeholder="Is there any asset loan?" formControlName="any_other_asset_loan" >
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
<mat-option value="nan">NA</mat-option>
<mat-select placeholder="Is there any asset loan?" formControlName="any_other_asset_loan" (selectionChange)="selectedAssetLoanType($event.value,1)">
<mat-option value="{{data.value}}" *ngFor="let data of m_any_asset_loan_type">{{d.viewValue}}</mat-option>
</mat-select>
<!-- <input matInput placeholder="What is the EMI amount ?" formControlName="any_other_asset_loan" autocomplete="off"> -->
</mat-form-field>
<!-- <mat-form-field class="ml-xs example-full-width" *ngIf="detail.get(any_other_asset_loan).value == 'yes'"> -->
<mat-form-field class="ml-xs example-full-width">
<mat-form-field class="ml-xs example-full-width" *ngIf="otherEmiamtFlag">
<!-- <mat-form-field class="ml-xs example-full-width"> -->
<input matInput placeholder="What is the EMI amount ?" formControlName="other_asset_emi_amt" autocomplete="off">
<!-- <span matSuffix>.00</span> -->
</mat-form-field>
@ -622,12 +623,12 @@
</div>
<div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33">
<mat-form-field class="ml-xs example-full-width" style="width:95%">
<input matInput placeholder="Original Loan Tenure in Months" formControlName="original_loan_tenure" (change)="loanCalc(sup,1)" autocomplete="off">
<input matInput placeholder="Original Loan Tenure in Months" formControlName="original_loan_tenure" (change)="loanTenureCalc(sup,1)" autocomplete="off">
</mat-form-field>
</div>
<div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33" style="width:95%">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Balance Tenure in Months" formControlName="balance_tenure" (change)="loanCalc(sup,1)" autocomplete="off">
<input matInput placeholder="Balance Tenure in Months" formControlName="balance_tenure" (change)="loanTenureCalc(sup,1)" autocomplete="off">
</mat-form-field>
</div>
<div *ngIf="sup.get('emi').value === 'yes' && sup.get('original_loan_tenure').value != '' && sup.get('balance_tenure').value != '' " fxFlex="33" style="width:95%">
@ -640,7 +641,7 @@
</div>
<div fxLayout="row" fxLayoutGap="12px" fxLayoutAlign="start none">
<div fxFlex="20">
<span *ngIf="_assetsQuesFrom.controls.assets_details.controls.length > 1" (click)="removeLanguage(i,1)">
<span *ngIf="_assetsQuesFrom.controls.assets_details.controls.length > 1" (click)="removeAssetsDetails(i,1)">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
</span>
</div>
@ -654,7 +655,7 @@
<div class="row" style="text-align:right;">
<button mat-raised-button mat-icon-button mat-button color="primary" matTooltip="Add More Asset Details" matTooltipPosition="above"
class="mr-1 mb-1 hover-icon" (click)="addSupplierDetails($event,1); false"><mat-icon>add</mat-icon></button>
class="mr-1 mb-1 hover-icon" (click)="addAssetDetails($event,1); false"><mat-icon>add</mat-icon></button>
</div>
</mat-card-content>

View File

@ -38,7 +38,11 @@ export class AssetsInfoComponent implements OnInit {
public m_assets_type = [];
public m_relation = [];
public applicants: any;
otherEmiamtFlag : boolean = false;
businessEmiAmtFlag : boolean = false;
public m_any_asset_loan_type = [{'value': "yes",'viewValue': "Yes"},
{'value': "no",'viewValue': "No"},
{'value': "nan",'viewValue': "NA"}]
// public m_assets_type = [
// {
// 'id': "1",
@ -623,6 +627,7 @@ public m_investmentType = [];
elapsed_tenure: [data.elapsed_tenure || '']
});
}
initBusinessDetailsWithdata(data) {
return this._formBuilder.group({
business_assets_mode: [data.business_assets_mode],
@ -640,6 +645,7 @@ public m_investmentType = [];
business_elapsed_tenure: [data.business_elapsed_tenure || '']
});
}
loadDetails: boolean;
addAssetsDetailsWithData(supp_data) {
console.log(supp_data);
@ -693,13 +699,14 @@ public m_investmentType = [];
business_elapsed_tenure: val.business_elapsed_tenure,
business_balance_tenure: val.business_balance_tenure
};
// const control = <FormArray>this._assetsQuesFrom.controls['assets_details'];
// control.push(this.initDetailsWithdata(vals));
// this.setAssetsDetailsWithData(vals.business_assets_mode, val.details, control.length - 1)
const control = <FormArray>this._assetsQuesFrom.controls['business_assets_details'];
control.push(this.initBusinessDetailsWithdata(vals));
this.setAssetsDetailsWithData2(vals.business_assets_mode, val.business_details, control.length - 1)
this.setBusinessAssetsDetailsWithData(vals.business_assets_mode, val.business_details, control.length - 1)
}
}
//this.loadDetails = true;
@ -762,7 +769,7 @@ public m_investmentType = [];
}
}
setAssetsDetailsWithData2(assets_details_mode: any, datas: any, i: any): void {
setBusinessAssetsDetailsWithData(assets_details_mode: any, datas: any, i: any): void {
let val = i;
let data = datas;
const arr = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
@ -813,9 +820,10 @@ public m_investmentType = [];
}
}
addSupplierDetails(e,flag) {
console.log(flag);
console.log(e);
/** Add More Asset using Flag Both "Other Asset" And "Business Asset" */
addAssetDetails(e,flag) {
// console.log(flag);
// console.log(e);
if(flag == 1){
const control = <FormArray>this._assetsQuesFrom.controls['assets_details'];
control.push(this.initDetails());
@ -824,7 +832,9 @@ public m_investmentType = [];
control.push(this.initBusinessDetails(this.businessProfessionName));
}
}
removeLanguage(i: number,flag) {
/** To remove The Added Asset using Flag Both "Other Asset" And "Business Asset" */
removeAssetsDetails(i: number,flag) {
if(flag == 1){
const control = <FormArray>this._assetsQuesFrom.controls['assets_details'];
control.removeAt(i);
@ -845,10 +855,22 @@ public m_investmentType = [];
this.freqPurchaseTextBox = e.value;
}
/** Show/hide EMI amount Field using Flag Both "other Asset" and "business"
* REF = "Other Asset type at last Field"
**/
selectedAssetLoanType(e: any,flag): void {
if(flag == 1){
this.otherEmiamtFlag = (e == 'yes') ? true : false;
}
else if(flag == 2){
this.businessEmiAmtFlag = (e == 'yes') ? true : false;
}
}
/** To Save/Edited Popup Data */
onSubmit() {
this.submitted = true;
// stop here if form is invalid
if (this._assetsQuesFrom.invalid) {
return;
@ -876,22 +898,19 @@ public m_investmentType = [];
}
});
// Add BRANCH data with help Service File
// Save the data with help of Service
this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe(
dataresult => {
if (dataresult.status == 200) {
// console.log(dataresult);
this.notifier.notify('success', 'Record Saved Successfully.!');
// this.dialogRef.close();
// alert("sample alert for Saving");
}
else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
// this.errorMessage = "Some Thing Wents Wrong Try Again !";
}
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
// this.errorMessage = "Something Wents Wrong Try Again !";
// this.dialogRef.close();
});
//After Saving the BRANCH data then popup close
@ -905,7 +924,8 @@ public m_investmentType = [];
arr.controls.splice(0);
this.getPdSupplierFormDetails();
}
/** On Key Press Event For Mobile Number */
/** On Key Press Event For Number only Accepting */
keyPress(event: any) {
const pattern = /[0-9\-\.\ ]/;
@ -915,7 +935,8 @@ public m_investmentType = [];
}
}
loanCalc(details ,flag)
/** To calculating Loan Elapsed Tenure both "Other Asset" And "Business Asset" using Flag */
loanTenureCalc(details ,flag)
{
if(flag == 1){
//console.log(details.value);

View File

@ -59,7 +59,7 @@
<span *ngIf="i != 0">
<mat-form-field style="width:60%">
<input matInput autocomplete="off" placeholder="Sale Variation from Previous Year in %" formControlName="financial_annualsales_variation" (keypress)="keyPress($event)" (change)="calFinAnnualSale( i, details);">
<input matInput autocomplete="off" placeholder="Sale Variation from Previous Year in %" formControlName="financial_annualsales_variation" (keypress)="keyPress($event)">
<mat-hint align="end" *ngIf="details.get('financial_annualsales_variation').value != '' " >
<span *ngIf="details.get('financial_annualsales_variation').value == 0">
No differents in Sales in FY <i> {{details.get('financial_year').value}} </i> over Sales in FY <i> {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} </i>
@ -68,7 +68,7 @@
Increase in Sales in FY <i> {{details.get('financial_year').value}} </i> over Sales in FY <i> {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} </i> <b> {{details.get('financial_annualsales_variation').value}} % </b>
</span>
<span *ngIf="details.get('financial_annualsales_variation').value < 0" class="highlight">
Decrease in Sales in FY <i> {{details.get('financial_year').value}} </i> over Sales in FY <i>{{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}}</i> <b>{{details.get('financial_annualsales_variation').value}} % </b>
Decrease in Sales in FY <i> {{details.get('financial_year').value}} </i> over Sales in FY <i>{{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} </i> <b> {{(details.get('financial_annualsales_variation').value).replace('-', '')}} % </b>
</span>
</mat-hint>
</mat-form-field>
@ -80,10 +80,12 @@
<mat-form-field style="width:30%">
<!-- <input matInput autocomplete="off" placeholder="Net Profit / Loss" formControlName="financial_net_profit" (change)="calMargin( i, details); calYearVariation( i, details)" type="number" > -->
<mat-select placeholder="Is there Net Profit or Net Loss?" formControlName="finanical_profit_or_loss" >
<!-- (selectionChange)="selectedProfitOrLossType($event,1)> -->
<mat-option value="1" >Net Profit</mat-option>
<mat-option value="2" >Net Loss</mat-option>
</mat-select>
</mat-form-field>
<span *ngIf="details.get('finanical_profit_or_loss').value == 1 ">
<mat-form-field style="width:28%">
<input matInput autocomplete="off" placeholder="Net Profit Amount" formControlName="financial_net_profit" (change)="calMargin( i, details); calYearVariation( i, details)" (keypress)="keyPress($event)" (keyup)="inWords($event,i,2)">
@ -115,7 +117,7 @@
Increase in Profit in FY <i> {{details.get('financial_year').value}} </i> over Profit in FY <i> {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} </i> <b> {{details.get('financial_variation').value}} % </b>
</span>
<span *ngIf="details.get('financial_variation').value < 0" class="highlight">
Decrease in Profit in FY <i> {{details.get('financial_year').value}} </i> over Profit in FY <i> {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} </i> <b> {{details.get('financial_variation').value}} % </b>
Decrease in Profit in FY <i> {{details.get('financial_year').value}} </i> over Profit in FY <i> {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} </i> <b> {{(details.get('financial_variation').value).replace('-', '')}} % </b>
</span>
</mat-hint>
<!-- “Increase in Sales in FY 2017-2018 over sales in FY 2016-2017 is 11.11%” -->
@ -172,12 +174,13 @@
<input matInput autocomplete="off" placeholder="Year" formControlName="estimate_year" >
</mat-form-field> -->
<mat-form-field style="width:30%">
<input matInput autocomplete="off" placeholder="Annual Sale" formControlName="estimate_annual_sale" (change)="calMarginVal( i, details)" (keypress)="keyPress($event)" (keyup)="inWords($event,i,4)" >
<input matInput autocomplete="off" placeholder="Annual Sale" formControlName="estimate_annual_sale" (change)="calMarginVal( i, details)" (keypress)="keyPress($event)" (keyup)="inWords($event,i,4)" (change)="calculateEstimationAnnualSale(i, details);">
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('estimate_annual_sale').value != ''">{{"&#8377;"}} {{AV_annualSalesInwords[i]}} Only</mat-hint>
</mat-form-field>
<span *ngIf="i != 0">
<mat-form-field style="width:60%">
<input matInput autocomplete="off" placeholder="Sale Variation from Previous Year in %" formControlName="estimate_annualsales_variation" (keypress)="keyPress($event)" (change)="calEstAnnualSale( i,details);">
<input matInput autocomplete="off" placeholder="Sale Variation from Previous Year in %" formControlName="estimate_annualsales_variation" (keypress)="keyPress($event)">
<mat-hint align="end" *ngIf="details.get('estimate_annualsales_variation').value != '' " >
<span *ngIf="details.get('estimate_annualsales_variation').value == 0">
No differents in Sales in FY <i> {{details.get('estimate_year').value}} </i> over Sales in FY <i> {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} </i>
@ -186,7 +189,7 @@
Increase in Sales in FY <i> {{details.get('estimate_year').value}} </i> over Sales in FY <i> {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} </i><b> {{details.get('estimate_annualsales_variation').value}} % </b>
</span>
<span *ngIf="details.get('estimate_annualsales_variation').value < 0" class="highlight">
Decrease in Sales in FY <i> {{details.get('estimate_year').value}} </i> over Sales in FY <i> {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} </i><b> {{details.get('estimate_annualsales_variation').value}} % </b>
Decrease in Sales in FY <i> {{details.get('estimate_year').value}} </i> over Sales in FY <i> {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} </i><b> {{(details.get('estimate_annualsales_variation').value).replace('-', '')}} % </b>
</span>
</mat-hint>
</mat-form-field>
@ -196,6 +199,7 @@
<mat-form-field style="width:30%">
<!-- <input matInput autocomplete="off" placeholder="Net Profit / Loss" formControlName="financial_net_profit" (change)="calMargin( i, details); calYearVariation( i, details)" type="number" > -->
<mat-select placeholder="Is there Net Profit or Net Loss?" formControlName="estimate_profit_or_loss" >
<!-- (selectionChange)="selectedProfitOrLossType($event.value,2)"> -->
<mat-option value="1" >Net Profit</mat-option>
<mat-option value="2" >Net Loss</mat-option>
</mat-select>
@ -229,7 +233,7 @@
Increase in Profit in FY <i> {{details.get('estimate_year').value}} </i> over Profit in FY<i> {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} </i> <b> {{details.get('estimate_variation').value}} % </b>
</span>
<span *ngIf="details.get('estimate_variation').value < 0" class="highlight">
Decrease in Profit in FY <i> {{details.get('estimate_year').value}} </i>over Profit in FY <i> {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} </i> <b>{{details.get('estimate_variation').value}} % </b>
Decrease in Profit in FY <i> {{details.get('estimate_year').value}} </i>over Profit in FY <i> {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} </i> <b> {{(details.get('estimate_variation').value).replace('-', '')}} % </b>
</span>
<!-- {{details.controls[''].value}} {{details.controls[''].value}} -->
<!-- 'details.controls['estimate_variation'].value <= 0' ? 'Decreases ' : 'Increases ' + 'in Sales in FY ' + curr_year + ' Over Sales in FY '+ prev_year + ' is ' + {{details.controls['estimate_variation'].value}} + '%'; -->

View File

@ -325,6 +325,9 @@ export class FinancialInfoComponent implements OnInit {
// }
// }
calFinAnnualSale(index,detail){
//alert('FIn Annual Sales Data');
console.log(index);
console.log()
let annual_sale = detail.value.financial_annual_sale;
if (index != 0) {
let array = <FormArray>this.financialForm.controls['date_per_financial'];
@ -335,9 +338,13 @@ export class FinancialInfoComponent implements OnInit {
}
}
calEstAnnualSale(index,detail){
calculateEstimationAnnualSale(index,detail){
//alert('Function Inside');
console.log(detail);
let annual_sale = detail.value.estimate_annual_sale;
console.log(annual_sale);
console.log(index);
// console.log(annual_sale);
if (index != 0) {
let array = <FormArray>this.financialForm.controls['estimated_value'];
let prev_annual_sale = array.value[index-1].estimate_annual_sale;
@ -349,24 +356,40 @@ export class FinancialInfoComponent implements OnInit {
calYearVariation(index, detail) {
let annual_sale = detail.value.financial_annual_sale;
let profit = detail.value.financial_net_profit;
let loss = detail.value.financial_net_loss;
this.SalesStatement[0] = 0.00;
if ( (profit != '' || loss != '') && index != 0) {
let array = <FormArray>this.financialForm.controls['date_per_financial'];
console.log(array.value[index - 1].financial_net_profit);
console.log('Profit',profit);
console.log(Math.abs(profit));
let prev_profit = array.value[index - 1].financial_net_profit != '' ? array.value[index - 1].financial_net_profit : 0;
console.log('Profitpre',prev_profit);
let prev_loss = array.value[index - 1].financial_net_loss !='' ? array.value[index - 1].financial_net_loss : 0 ;
let prev_year = array.value[index - 1].financial_year;
let prev_annual_sale = array.value[index-1].financial_annual_sale;
console.log('loss',loss);
loss = loss != 0 ? loss * (-1) : loss;
console.log('-1 loss',loss);
console.log('pre_loss',prev_loss);
prev_loss = prev_loss != 0 ? prev_loss * (-1) : prev_loss ;
console.log('-1 pre loss',prev_loss);
console.log(Math.abs(profit));
//let variation2 = ((()))
let variation = (((profit != '' ? profit : loss ) - (prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? Math.abs(prev_profit) : Math.abs(prev_loss))) * 100;
//console.log('console.log(Math.abs(profit));',Math.abs(variation));
console.log(variation);
// let variation ;
// if(profit != ''){
// variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? prev_profit : prev_loss)) * 100 * (profit != '' ? (1) : (-1)) ;
// }
// else if(loss != ''){
// variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? prev_profit : prev_loss)) * 100 * (profit != '' ? (1) : (-1));
// }
let variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? prev_profit : prev_loss)) * 100;
// let annual_sale_variation = (annual_sale - prev_annual_sale) * 100 ;
detail.controls.financial_variation.setValue(variation.toFixed(2));
@ -436,7 +459,7 @@ export class FinancialInfoComponent implements OnInit {
// alert('else condition Profit = '+profit);
let margin = (profit / salary) * 100;
// alert(' '+margin);
detail.controls.financial_margin_of_profit.setValue(margin.toFixed(2)+'%')
detail.controls.financial_margin_of_profit.setValue(margin.toFixed(2));
// }
// detail.controls.financial_margin.disable()
@ -449,7 +472,7 @@ export class FinancialInfoComponent implements OnInit {
if (salary != '' && loss != '') {
// alert('if condition salary = '+salary);
// alert('if condition loss = '+loss);
let margin = (loss / salary) * 100;
let margin = (loss / salary) * 100 * (-1);
detail.controls.financial_margin_of_loss.setValue(margin.toFixed(2));
// detail.controls.financial_margin.disable()
}
@ -478,11 +501,20 @@ export class FinancialInfoComponent implements OnInit {
let array = <FormArray>this.financialForm.controls['estimated_value'];
console.log(array.value[index - 1].financial_net_profit);
let prev_profit = array.value[index - 1].estimate_net_profit != '' ? array.value[index - 1].estimate_net_profit : 0;
let prev_loss = array.value[index - 1].estimate_net_loss !='' ? array.value[index - 1].estimate_net_loss : 0 ;
let prev_profit = array.value[index - 1].estimate_net_profit != '' ? array.value[index - 1].estimate_net_profit : 1;
let prev_loss = array.value[index - 1].estimate_net_loss !='' ? array.value[index - 1].estimate_net_loss : 1;
let prev_year = array.value[index - 1].estimate_year;
loss = loss != 0 ? loss * (-1) : loss;
prev_loss = prev_loss != 0 ? prev_loss * (-1) : prev_loss ;
let variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? prev_profit : prev_loss)) * 100;
let variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? Math.abs(prev_profit) : Math.abs(prev_loss))) * 100;
// let variation ;
// if(profit != ''){
// variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? prev_profit : prev_loss)) * 100 ;
// }
// else if(loss != ''){
// variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? prev_profit : prev_loss)) * 100 * (profit != '' ? (1) : (-1));
// }
detail.controls.estimate_variation.setValue(variation.toFixed(2));
}
@ -514,12 +546,12 @@ export class FinancialInfoComponent implements OnInit {
}
else if (detail.value.estimate_profit_or_loss == 2){
let loss = detail.value.estimate_net_profit;
let loss = detail.value.estimate_net_loss;
console.log('else if Margin loss',loss);
if (salary != '' && loss != '') {
console.log('elseif if Margin Estimate salary',salary);
console.log('alseif if Margin loss',loss);
let margin = (loss / salary) * 100;
let margin = (loss / salary) * 100 * (-1);
detail.controls.estimate_margin_of_loss.setValue(margin.toFixed(2));
}
@ -527,6 +559,34 @@ export class FinancialInfoComponent implements OnInit {
}
// selectedProfitOrLossType($event,index,flag){
// if(flag == 1){
// let array = <FormArray>this.financialForm.controls['date_per_financial'];
// if($event == 1){
// detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2));
// detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2));
// }
// else if($event == 2){
// detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2));
// detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2));
// }
// }
// else if(flag == 2){
// let array = <FormArray>this.financialForm.controls['estimated_value'];
// if($event == 1){
// detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2));
// detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2));
// }
// else if($event == 2){
// detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2));
// detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2));
// }
// }
// }
calProfitAndLossVal( i, detail) {
console.log(detail);
let salary = detail.value.estimate_annual_sale;
@ -542,7 +602,7 @@ export class FinancialInfoComponent implements OnInit {
else if(detail.value.estimate_profit_or_loss == 2){
let margin_loss = detail.value.estimate_margin_of_loss;
if (salary != '' && margin_loss != '') {
let loss = (margin_loss/100)*salary;
let loss = (margin_loss/100)*salary*(-1);
detail.controls.estimate_net_loss.setValue(loss.toFixed(2));
this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(loss);
}