sheet changes : ps

This commit is contained in:
venbatechnologies@gmail.com 2019-02-13 20:52:42 +05:30
parent 2cf459a854
commit ff50f9ec6b
23 changed files with 697 additions and 241 deletions

Binary file not shown.

View File

@ -41,12 +41,12 @@
<div [formGroupName]="s">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:40%">
<mat-select placeholder="Property Type" formControlName="property_type" >
<mat-select placeholder="Property Type" formControlName="property_type" (selectionChange)="setRequiredValidation($event.value,detail,1)">
<mat-option *ngFor="let prop of m_propertyType" [value]="prop.id">{{ prop.name }}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="detail.get('property_type').value == 1" style="width:40%">
<input matInput placeholder="Other Property Type" formControlName="other_property_type" autocomplete="off">
<input matInput placeholder="Specify Other Property Type" formControlName="other_property_type" autocomplete="off">
</mat-form-field>
</div>
</div>
@ -122,7 +122,7 @@
<mat-hint align="start" style="font-size:90%" *ngIf="detail.get('premium_paid').value != ''">{{"&#8377;"}} {{OtherPremiumPaidInwords[s]}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width:40%">
<mat-select placeholder="Frequency" formControlName="frequency_mode" >
<mat-select placeholder="Frequency" formControlName="frequency_mode" (selectionChange)="setRequiredValidation($event.value,detail,2)">
<mat-option *ngFor="let freqn of m_freqOfPurchase" [value]="freqn.frequency_id">{{ freqn.name }}</mat-option>
</mat-select>
</mat-form-field>
@ -154,7 +154,7 @@
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:40%">
<mat-select placeholder="Type" formControlName="investments_type" >
<mat-select placeholder="Type" formControlName="investments_type" (selectionChange)="setRequiredValidation($event.value,detail,3)">
<mat-option *ngFor="let ins_type of m_investmentType" [value]="ins_type.id">{{ ins_type.name }}</mat-option>
</mat-select>
</mat-form-field>
@ -238,7 +238,7 @@
<mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name | titlecase}}</mat-option>
</mat-select> -->
<mat-select placeholder="Name of the Owner"
formControlName="name_of_the_owner" [compareWith]="compareObjects" required>
formControlName="name_of_the_owner" [compareWith]="compareObjects" required (selectionChange)="setRequiredValidation($event.value.id,sup,4)">
<mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
<mat-option *ngFor="let val of group.groupValues" [value]="val">
{{val.name}}

View File

@ -812,6 +812,38 @@ export class AssetsInfoComponent implements OnInit {
// }
// }
}
setRequiredValidation(value,item,flag) {
console.log(item);
console.log(value);
console.log(flag);
if(flag == 1){
value==1
? item.controls.other_property_type.setValidators([Validators.required])
: item.controls.other_property_type.clearValidators();
item.controls.other_property_type.updateValueAndValidity();
}
if(flag == 2){
value==1
? item.controls.other_frequency_mode.setValidators([Validators.required])
: item.controls.other_frequency_mode.clearValidators();
item.controls.other_frequency_mode.updateValueAndValidity();
}
if(flag == 3){
value==1
? item.controls.other_investments_type.setValidators([Validators.required])
: item.controls.other_investments_type.clearValidators();
item.controls.other_investments_type.updateValueAndValidity();
}
if(flag == 4){
value==0
? item.controls.other_owner.setValidators([Validators.required])
: item.controls.other_owner.clearValidators();
item.controls.other_owner.updateValueAndValidity();
}
}
/** Amount InWords */

View File

@ -95,7 +95,7 @@
</mat-panel-title>
</mat-expansion-panel-header>
<mat-form-field>
<mat-select placeholder="Account Name" formControlName="applicant_name" [compareWith]="compareObjects">
<mat-select placeholder="Account Name" formControlName="applicant_name" [compareWith]="compareObjects" (selectionChange)="setRequiredValidation($event.values.id,itemrow,1)">
<mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
<mat-option *ngFor="let val of group.groupValues" [value]="val">
{{val.name}}
@ -108,7 +108,7 @@
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Bank Name" formControlName="bank_name" >
<mat-select placeholder="Bank Name" formControlName="bank_name" (selectionChange)="setRequiredValidation($event.value,itemrow,2)">
<mat-option *ngFor="let btLen of m_btLenderList" [value]="btLen.bt_lender_list_id">{{ btLen.lender_name }}</mat-option>
</mat-select>
</mat-form-field>

View File

@ -232,6 +232,25 @@ export class BankingDetailsComponent implements OnInit {
const control = <FormArray>this.bankingForm.controls['itemRows'];
control.removeAt(index);
}
setRequiredValidation(value,item,flag) {
console.log(item);
console.log(value);
console.log(flag);
if(flag == 1){
value==0
? item.controls.other_applicant.setValidators([Validators.required])
: item.controls.other_applicant.clearValidators();
item.controls.other_applicant.updateValueAndValidity();
}
if(flag == 2){
value==1
? item.controls.other_bank.setValidators([Validators.required])
: item.controls.other_bank.clearValidators();
item.controls.other_bank.updateValueAndValidity();
}
}
setStep(index: number) {
this.step = index;

View File

@ -338,7 +338,7 @@
<mat-form-field style="width:45%" *ngIf="(sup.get('business_assets_mode').value != '' && sup.get('business_ownership_type').value == 'rented')">
<input matInput autocomplete="off" placeholder="Monthly Rent Amount" formControlName="business_monthly_rented_amt" (keypress)="keyPress($event)" (keyup)="inWords($event,i,8)">
<mat-hint align="start" style="font-size:90%" *ngIf="sup.get('business_approximate_market_value').value != ''">{{"&#8377;"}} {{RentAmtInwords[i]}} Only</mat-hint>
<mat-hint align="start" style="font-size:90%" *ngIf="sup.get('business_monthly_rented_amt').value != ''">{{"&#8377;"}} {{RentAmtInwords[i]}} Only</mat-hint>
<mat-error>Monthly Rent Amount Required</mat-error>
</mat-form-field>
</div>

View File

@ -26,7 +26,7 @@
</mat-panel-title>
</mat-expansion-panel-header>
<mat-form-field>
<mat-select placeholder="Account Name" formControlName="applicant_name" [compareWith]="compareObjects">
<mat-select placeholder="Account Name" formControlName="applicant_name" [compareWith]="compareObjects" (selectionChange)="setRequiredValidation($event.values.id,itemrow,1)">
<mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
<mat-option *ngFor="let val of group.groupValues" [value]="val">
{{val.name}}
@ -39,7 +39,7 @@
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Bank Name" formControlName="bank_name" >
<mat-select placeholder="Bank Name" formControlName="bank_name" (selectionChange)="setRequiredValidation($event.values,itemrow,2)">
<mat-option *ngFor="let btLen of m_btLenderList" [value]="btLen.bt_lender_list_id">{{ btLen.lender_name }}</mat-option>
</mat-select>
</mat-form-field>

View File

@ -340,4 +340,25 @@ export class BusinessBankingDetailsComponent implements OnInit {
}
}
setRequiredValidation(value,item,flag) {
console.log(item);
console.log(value);
console.log(flag);
if(flag == 1){
value==0
? item.controls.other_applicant.setValidators([Validators.required])
: item.controls.other_applicant.clearValidators();
item.controls.other_applicant.updateValueAndValidity();
}
if(flag == 2){
value==1
? item.controls.other_bank.setValidators([Validators.required])
: item.controls.other_bank.clearValidators();
item.controls.other_bank.updateValueAndValidity();
}
}
}

View File

@ -90,13 +90,13 @@
</mat-form-field>
</div>
<div fxLayout="row nowrap" *ngIf="items.get('manufacturing_payment_type').value == 3">
<div fxLayout="row nowrap" style="padding-left: 2%;" *ngIf="items.get('manufacturing_payment_type').value == 3">
<mat-label>No of days of Credit provided to Client for payment</mat-label>
<mat-form-field style="width: 45%" >
<mat-form-field style="width: 25%" >
<input matInput placeholder="Days From" formControlName="manufacturing_credit_days_from" type="number">
</mat-form-field>
<mat-form-field style="width: 45%" >
<mat-form-field style="width: 25%" >
<input matInput placeholder="Days To" formControlName="manufacturing_credit_days_to" type="number">
</mat-form-field>
</div>
@ -205,12 +205,12 @@
<input matInput placeholder="No. of Days of Credit Given for Payment Receipt" formControlName="trade_product_credit_days">
</mat-form-field> -->
</div>
<div fxLayout="row nowrap" *ngIf="items.get('trade_product_payment_type').value == 3">
<div fxLayout="row nowrap" style="padding-left: 2%;" *ngIf="items.get('trade_product_payment_type').value == 3">
<mat-label>No of days of Credit provided to Client for payment</mat-label>
<mat-form-field style="width: 45%" >
<mat-form-field style="width: 25%" >
<input matInput placeholder="Days From" formControlName="trade_product_credit_days_from" type="number">
</mat-form-field>
<mat-form-field style="width: 45%" >
<mat-form-field style="width: 25%" >
<input matInput placeholder="Days To" formControlName="trade_product_credit_days_to" type="number">
</mat-form-field>
</div>
@ -318,12 +318,12 @@
<input matInput placeholder="No. of Days of Credit Given for Payment Receipt" formControlName="service_provider_product_credit_days">
</mat-form-field> -->
</div>
<div fxLayout="row nowrap" *ngIf="items.get('service_provider_product_payment_type').value == 3">
<div fxLayout="row nowrap" style="padding-left: 2%;" *ngIf="items.get('service_provider_product_payment_type').value == 3">
<mat-label>No of days of Credit provided to Client for payment</mat-label>
<mat-form-field style="width: 45%" >
<mat-form-field style="width: 25%" >
<input matInput placeholder="Days From" formControlName="service_provider_product_credit_days_from" type="number">
</mat-form-field>
<mat-form-field style="width: 45%" >
<mat-form-field style="width: 25%" >
<input matInput placeholder="Days To" formControlName="service_provider_product_credit_days_to" type="number">
</mat-form-field>
</div>

View File

@ -43,7 +43,7 @@
<!-- Loan type, Loan amount, Lender, Loan Taken By, Instalment Frequency, Instalment Amount, Original Tenure, Balance Tenure -->
<mat-card-content class="matcard">
<mat-form-field style="width:45%;">
<mat-select placeholder="Loan Type" formControlName="loan_type" >
<mat-select placeholder="Loan Type" formControlName="loan_type" (selectionChange)="setRequiredValidation($event.value,details,1)">
<mat-option value="{{types.existing_loan_type_id}}" *ngFor="let types of loanTypeData">{{types.loan_type_name}}</mat-option>
</mat-select>
<!-- <input matInput autocomplete="off" placeholder="Loan Type" formControlName="loan_type" > -->
@ -56,11 +56,11 @@
<mat-hint my-mat-hint align="start" style="font-size:90%" *ngIf="details.get('loan_amount').value != ''">{{"&#8377;"}} {{amtInwords[i]}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width:45%;">
<mat-select placeholder="Lender" formControlName="lender" >
<mat-select placeholder="Lender" formControlName="lender" (selectionChange)="setRequiredValidation($event.value,details,2)">
<mat-option *ngFor="let btLen of lenderData" [value]="btLen.bt_lender_list_id">{{ btLen.lender_name }}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="details.get('lender').value == 3" style="width:45%;">
<mat-form-field *ngIf="details.get('lender').value == 1" style="width:45%;">
<input matInput autocomplete="off" placeholder="Specify Lender" formControlName="others_lender" >
</mat-form-field>
<mat-form-field style="width:45%;">
@ -68,7 +68,7 @@
<mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name}}</mat-option>
<!-- <mat-option value= 0 >Others</mat-option> ->
</mat-select> -->
<mat-select placeholder="Loan Taken By" formControlName="loan_taken_by" [compareWith]="compareObjects">
<mat-select placeholder="Loan Taken By" formControlName="loan_taken_by" [compareWith]="compareObjects" (selectionChange)="setRequiredValidation($event.value.id,details,3)">
<mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
<mat-option *ngFor="let val of group.groupValues" [value]="val">
{{val.name}}
@ -83,19 +83,19 @@
</mat-form-field>
<mat-form-field style="width:45%;">
<mat-select placeholder="Instalment Frequency" (selectionChange)="selectedfrequency($event.value,i)"
<mat-select placeholder="Instalment Frequency" (selectionChange)="selectedfrequency($event.value,i);setRequiredValidation($event.value,details,4);"
formControlName="frequency" >
<mat-option *ngFor="let freq of frequencyData" value="{{freq.frequency_id}}">{{freq.name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="details.get('frequency').value == 1" style="width:45%">
<input matInput autocomplete="off" placeholder="Specify Frequency" formControlName="other_frequency">
</mat-form-field>
<mat-form-field *ngIf="details.get('frequency').value != ''" style="width:45%">
<input matInput autocomplete="off" [placeholder]="placeholderName[i] != '' ? placeholderName[i] : 'Instalment Amount' " formControlName="emi" (keypress)="keyPress($event)" (keyup)="inWords($event,i,2)">
<!-- <input matInput autocomplete="off" placeholder="details.get('loan_type').value + Instalment Amount " formControlName="emi" (keypress)="keyPress($event)" (keyup)="inWords($event,i,2)"> -->
<mat-hint my-mat-hint align="start" style="font-size:90%" *ngIf="details.get('emi').value != ''">{{"&#8377;"}} {{emiAmtInwords[i]}} Only</mat-hint>
</mat-form-field>
<mat-form-field *ngIf="details.get('frequency').value == 1">
<input matInput autocomplete="off" placeholder="Specify Frequency" formControlName="other_frequency">
</mat-form-field>
<!-- <mat-form-field>
<input matInput autocomplete="off" placeholder="Lender" formControlName="lender" >
</mat-form-field> -->

View File

@ -491,4 +491,37 @@ export class CurrentLoanComponent implements OnInit {
break;
}
}
setRequiredValidation(value,item,flag) {
console.log(item);
console.log(value);
console.log(flag);
if(flag == 1){
value==1
? item.controls.others_loan_type.setValidators([Validators.required])
: item.controls.others_loan_type.clearValidators();
item.controls.others_loan_type.updateValueAndValidity();
}
if(flag == 2){
// value==1
// ? item.controls.others_lender.setValidators([Validators.required])
// : item.controls.others_lender.clearValidators();
// item.controls.others_lender.updateValueAndValidity();
}
if(flag == 3){
value==0
? item.controls.others_loan_taken.setValidators([Validators.required])
: item.controls.others_loan_taken.clearValidators();
item.controls.others_loan_taken.updateValueAndValidity();
}
if(flag == 4){
value==1
? item.controls.other_frequency.setValidators([Validators.required])
: item.controls.other_frequency.clearValidators();
item.controls.other_frequency.updateValueAndValidity();
}
}
}

View File

@ -343,7 +343,7 @@
</mat-form-field>
<mat-form-field *ngIf="sup.get('residence_ownership').value == 1">
<input matInput placeholder="Please specify" formControlName="ownershipOther">
<input matInput placeholder="Specify Ownership" formControlName="ownershipOther">
</mat-form-field>
<mat-form-field *ngIf="sup.get('residence_ownership').value == 3" style="width:43%;">

View File

@ -68,7 +68,7 @@
<mat-form-field style="width:30%">
<!-- <input matInput autocomplete="off" placeholder="Annual Sale" formControlName="financial_annual_sale" (change)="calMargin(i, details)" type="number" > -->
<input matInput autocomplete="off" placeholder="Annual Sale" formControlName="financial_annual_sale" (change)="calFinAnnualSale(i, details)" (keypress)="keyPress($event)" (keyup)="inWords($event,i,1)">
<input matInput autocomplete="off" placeholder="Annual Sale" formControlName="financial_annual_sale" (change)="calculationForFinanicalStatement()" (keypress)="keyPress($event)" (keyup)="inWords($event,i,1)">
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('financial_annual_sale').value != ''">{{"&#8377;"}} {{FY_annualSalesInwords[i]}} Only</mat-hint>
</mat-form-field>
@ -102,7 +102,7 @@
<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)">
<input matInput autocomplete="off" placeholder="Net Profit Amount" formControlName="financial_net_profit" (change)="calculationForFinanicalStatement()" (keypress)="keyPress($event)" (keyup)="inWords($event,i,2)">
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('financial_net_profit').value != ''">{{"&#8377;"}} {{FY_netProfitAmtInwords[i]}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width:28%">
@ -112,7 +112,7 @@
<span *ngIf="details.get('finanical_profit_or_loss').value == 2 ">
<mat-form-field style="width:28%">
<input matInput autocomplete="off" placeholder="Net Loss Amount" formControlName="financial_net_loss" (change)="calMargin( i, details); calYearVariation( i, details)" (keypress)="keyPress($event)" (keyup)="inWords($event,i,3)">
<input matInput autocomplete="off" placeholder="Net Loss Amount" formControlName="financial_net_loss" (change)="calculationForFinanicalStatement()" (keypress)="keyPress($event)" (keyup)="inWords($event,i,3)">
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('financial_net_loss').value != ''">{{"&#8377;"}} {{FY_netLossAmtInwords[i]}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width:28%">

View File

@ -416,65 +416,142 @@ export class FinancialInfoComponent implements OnInit {
}
}
/**calculating Annual Sale for financial Statement */
calFinAnnualSale(index,detail){
let annual_sale = detail.value.financial_annual_sale;
if (index != 0) {
let array = <FormArray>this.financialForm.controls['date_per_financial'];
let prev_annual_sale = array.value[index-1].financial_annual_sale;
let annual_sale_variation = (( annual_sale - prev_annual_sale)/prev_annual_sale) * 100 ;
detail.controls.financial_annualsales_variation.setValue(annual_sale_variation!= Infinity ? annual_sale_variation.toFixed(2):0);
}
}
/** old code Without foreach loop
* calculating Annual Sale for financial Statement
**/
// calFinAnnualSale(index,detail){
// let annual_sale = detail.value.financial_annual_sale;
// if (index != 0) {
// let array = <FormArray>this.financialForm.controls['date_per_financial'];
// let prev_annual_sale = array.value[index-1].financial_annual_sale;
// let annual_sale_variation = (( annual_sale - prev_annual_sale)/prev_annual_sale) * 100 ;
// detail.controls.financial_annualsales_variation.setValue(annual_sale_variation!= Infinity ? annual_sale_variation.toFixed(2):0);
// }
// }
/** calculating Annual Sale for financial Customer */
calculateEstimationAnnualSale(index,detail){
let annual_sale = detail.value.estimate_annual_sale;
if (index != 0) {
let array = <FormArray>this.financialForm.controls['estimated_value'];
let prev_annual_sale = array.value[index-1].estimate_annual_sale;
let annual_sale_variation = (( annual_sale - prev_annual_sale)/prev_annual_sale) * 100 ;
detail.controls.estimate_annualsales_variation.setValue(annual_sale_variation!= Infinity ? annual_sale_variation.toFixed(2):0);
}
}
/** New Code => With for loop
* Financial as per Statements - Calculating Sale Variation Based on Prev.Year ( Datas returns in percentage )
* Label name = " Sale Variation from Previous Year in % "
*/
// calFinAnnualSale(inx,detail){
// let parentArray = <FormArray>this.financialForm.controls['date_per_financial'];
// let prev_annual_sale : any = null;
// parentArray.value.forEach((val,index) => {
// let annual_sale = val.financial_annual_sale;
// // console.log('Current Anual Sales',array.value[index].financial_annual_sale);
// // console.log('Current Index',index);
// // console.log('prev_annual_sale',prev_annual_sale);
// if (index != 0) {
// let childArray : any = <FormArray>parentArray.controls[index];
// // console.log('INX',index);
// // console.log('SALE',annual_sale);
// let annual_sale_variation = (( annual_sale - prev_annual_sale)/prev_annual_sale) * 100 ;
// // console.log('annual_sale_variation',annual_sale_variation);
// childArray.controls.financial_annualsales_variation.setValue(
// annual_sale_variation!= Infinity ? !(Number.isNaN(annual_sale_variation)) ? annual_sale_variation.toFixed(2)
// : 0
// : 0);
// }
// prev_annual_sale = annual_sale;
// });
// }
/** old code without forloop
* calculating Annual Sale for financial Customer */
// calculateEstimationAnnualSale(index,detail){
// let annual_sale = detail.value.estimate_annual_sale;
// if (index != 0) {
// let array = <FormArray>this.financialForm.controls['estimated_value'];
// let prev_annual_sale = array.value[index-1].estimate_annual_sale;
// let annual_sale_variation = (( annual_sale - prev_annual_sale)/prev_annual_sale) * 100 ;
// detail.controls.estimate_annualsales_variation.setValue(annual_sale_variation!= Infinity ? annual_sale_variation.toFixed(2):0);
// }
// }
/** calculating Yearwise Variation for financial statement */
calYearVariation(index, detail) {
/** old code without forloop
* calculating Yearwise Variation for financial statement */
// calYearVariation(index, detail) {
let profit = detail.value.financial_net_profit;
let loss = detail.value.financial_net_loss;
let salary = detail.value.financial_annual_sale;
// console.log('current profit',profit);
// console.log('current loss',loss);
if ( (profit != '' || loss != '') && index != 0) {
if(+profit > +salary){
// let profit = detail.value.financial_net_profit;
// let loss = detail.value.financial_net_loss;
// let salary = detail.value.financial_annual_sale;
// // console.log('current profit',profit);
// // console.log('current loss',loss);
// if ( (profit != '' || loss != '') && index != 0) {
// if(+profit > +salary){
detail.controls.financial_margin_of_profit.setValue('');
}
else{
// detail.controls.financial_margin_of_profit.setValue('');
// }
// else{
let array = <FormArray>this.financialForm.controls['date_per_financial'];
// let array = <FormArray>this.financialForm.controls['date_per_financial'];
let prev_profit = array.value[index - 1].financial_net_profit != '' ? array.value[index - 1].financial_net_profit : 0;
let prev_loss = array.value[index - 1].financial_net_loss !='' ? array.value[index - 1].financial_net_loss : 0 ;
// let prev_profit = array.value[index - 1].financial_net_profit != '' ? array.value[index - 1].financial_net_profit : 0;
// let prev_loss = array.value[index - 1].financial_net_loss !='' ? array.value[index - 1].financial_net_loss : 0 ;
// console.log('prev_profit',prev_profit);
// console.log('prev_loss',prev_loss);
// // console.log('prev_profit',prev_profit);
// // console.log('prev_loss',prev_loss);
loss = loss != 0 ? loss * (-1) : loss;
// console.log('-1',loss);
prev_loss = prev_loss != 0 ? prev_loss * (-1) : prev_loss ;
// console.log('prev_loss',prev_loss);
// loss = loss != 0 ? loss * (-1) : loss;
// // console.log('-1',loss);
// prev_loss = prev_loss != 0 ? prev_loss * (-1) : prev_loss ;
// // console.log('prev_loss',prev_loss);
let variation = (((profit != '' ? profit : loss ) - (prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? Math.abs(prev_profit) : Math.abs(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;
detail.controls.financial_variation.setValue(variation!= Infinity ? variation.toFixed(2):0);
}
}
}
// detail.controls.financial_variation.setValue(variation!= Infinity ? variation.toFixed(2):0);
// }
// }
// }
/** old code == calculating Sale PERCENTAGE for financial statement */
/**
* New Code = with for loop
* Financial as per Statements - Calculating Profit Variation Based on Prev.Year ( Datas returns in percentage )
* Label name = "Profit Variation from Previous Year in %"
**/
// calYearVariation(index, detail) {
// let parentArray = <FormArray>this.financialForm.controls['date_per_financial'];
// let prev_profit : any = 0;
// let prev_loss : any = 0;
// parentArray.value.forEach((val,index) => {
// let profit = val.financial_net_profit;
// let loss = val.value.financial_net_loss;
// let annual_sale = val.financial_annual_sale;
// let childArray : any = <FormArray>parentArray.controls[index];
// if ( (profit != '' || loss != '') && index != 0) {
// detail.controls.financial_margin_of_profit.setValue('');
// }
// else{
// 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 != '' ? Math.abs(prev_profit) : Math.abs(prev_loss))) * 100;
// childArray.controls.financial_variation.setValue(
// variation!= Infinity ? !(Number.isNaN(variation)) ? variation.toFixed(2)
// : 0
// : 0);
// }
// prev_profit = val.financial_net_profit != '' ? val.financial_net_profit : 0;
// prev_loss = val.value.financial_net_loss !='' ? val.value.financial_net_loss : 0 ;
// });
// }
/** old code - calculating Sale PERCENTAGE for financial statement */
// calMargin(index, detail) {
// console.log('detail', detail);
// let salary = detail.value.financial_annual_sale;
@ -486,158 +563,411 @@ export class FinancialInfoComponent implements OnInit {
// }
// }
/** For Financial Statement
/** old code without forloop for financial statement
* Calculating Sale percentage based on profit and loss
* And calculating Variation over sales
*/
calMargin(index, detail) {
// In financial details section please add the following validation: Net profit/loss can not be > sales.
let salary = detail.value.financial_annual_sale;
let profit_margin;
let loss_margin;
// calMargin(index, detail) {
// // In financial details section please add the following validation: Net profit/loss can not be > sales.
// let salary = detail.value.financial_annual_sale;
// let profit_margin;
// let loss_margin;
if(detail.value.finanical_profit_or_loss == 1){
// if(detail.value.finanical_profit_or_loss == 1){
// loss_margin = '';
// detail.controls.financial_margin_of_loss.setValue('');
// let profit = detail.value.financial_net_profit;
// if (salary != '' && profit != '') {
// if(+profit>+salary){
// alert("profit is greater than Annual Sale ");
// detail.controls.financial_net_profit.setValue(0);
// detail.controls.financial_margin_of_profit.setValue('');
// detail.controls.financial_profit_to_sale_variation.setValue('');
// detail.controls.financial_variation.setValue('');
// }
// else{
// profit_margin = (profit / salary) * 100;
// detail.controls.financial_margin_of_profit.setValue(profit_margin!= Infinity ? profit_margin.toFixed(2):0);
// }
// }
// }
// else if (detail.value.finanical_profit_or_loss == 2){
// profit_margin = '';
// detail.controls.financial_margin_of_profit.setValue('');
// let loss = detail.value.financial_net_loss;
// if (salary != '' && loss != '') {
// if(+loss>+salary){
// alert("Loss is greater than Annual Sale ");
// detail.controls.financial_net_loss.setValue(0);
// detail.controls.financial_margin_of_loss.setValue('');
// detail.controls.financial_profit_to_sale_variation.setValue('');
// detail.controls.financial_variation.setValue('');
// }
// else{
// loss_margin = (loss / salary) * 100 * (-1);
// detail.controls.financial_margin_of_loss.setValue(loss_margin != Infinity ? loss_margin.toFixed(2): 0);
// // detail.controls.financial_margin.disable()
// }
// }
// }
// if ((profit_margin != '' || loss_margin != '') && index != 0) {
// let array = <FormArray>this.financialForm.controls['date_per_financial'];
// let prev_profit_margin = array.value[index - 1].financial_margin_of_profit != '' ? array.value[index - 1].financial_margin_of_profit : 0;
// let prev_loss_margin = array.value[index - 1].financial_margin_of_loss !='' ? array.value[index - 1].financial_margin_of_loss : 0 ;
// loss_margin = loss_margin !== undefined ? loss_margin : 0;
// prev_loss_margin = prev_loss_margin !== undefined ? prev_loss_margin : 0 ;
// profit_margin = profit_margin !== undefined ? profit_margin:0;
// prev_profit_margin = prev_profit_margin !== undefined ? prev_profit_margin : 0 ;
// let variation_percent : any ;
// variation_percent = (((profit_margin != '' ? profit_margin : loss_margin ) - (prev_profit_margin != '' ? prev_profit_margin : prev_loss_margin ))/ (prev_profit_margin != '' ? Math.abs(prev_profit_margin) : Math.abs(prev_loss_margin))) * 100;
// // console.log((profit_margin != '' ? profit_margin : loss_margin ) - (prev_profit_margin != '' ? prev_profit_margin : prev_loss_margin ));
// // console.log((((profit_margin != '' ? profit_margin : loss_margin ) - (prev_profit_margin != '' ? prev_profit_margin : prev_loss_margin ))/ (prev_profit_margin != '' ? Math.abs(prev_profit_margin) : Math.abs(prev_loss_margin))));
// // console.log((((profit_margin != '' ? profit_margin : loss_margin ) - (prev_profit_margin != '' ? prev_profit_margin : prev_loss_margin ))/ (prev_profit_margin != '' ? Math.abs(prev_profit_margin) : Math.abs(prev_loss_margin))) * 100);
// detail.controls.financial_profit_to_sale_variation.setValue(variation_percent != Infinity ? variation_percent.toFixed(2) : 0);
// }
// }
/** new code = with forloop
* Financial as per Statements - Calculating Profit,Loss And Variation of Profit Based On CurrentAnnualSales( Datas returns in percentage )
* Label name = "Net Profit to Sales in % (or) Net Loss to Sales in % and Variation of Profit % over sales"
**/
// calMargin(index, detail) {
// let parentArray = <FormArray>this.financialForm.controls['date_per_financial'];
// let prev_profit_margin : any = '';
// let prev_loss_margin : any = '';
// parentArray.value.forEach((val,index) => {
// let annual_sale = val.financial_annual_sale;
// let profit_margin : any = '';
// let loss_margin : any = '';
// let childArray : any = <FormArray>parentArray.controls[index];
// let SelectedlossOrProfit = val.finanical_profit_or_loss;
// if(SelectedlossOrProfit == 1){
// loss_margin = '';
// childArray.controls.financial_margin_of_loss.setValue('');
// let profit = val.financial_net_profit;
// if (annual_sale != '' && profit != '') {
// if(+profit>+annual_sale){
// alert("profit is greater than Annual Sale ");
// childArray.controls.financial_net_profit.setValue(0);
// childArray.controls.financial_margin_of_profit.setValue('');
// childArray.controls.financial_profit_to_sale_variation.setValue('');
// childArray.controls.financial_variation.setValue('');
// }
// else{
// profit_margin = (profit / annual_sale) * 100;
// childArray.controls.financial_margin_of_profit.setValue(profit_margin!= Infinity ? !(Number.isNaN(profit_margin)) ? profit_margin.toFixed(2):0:0);
// }
// }
// }
// else if(SelectedlossOrProfit == 2){
// profit_margin = '';
// childArray.controls.financial_margin_of_profit.setValue('');
// let loss = val.financial_net_loss;
// if (annual_sale != '' && loss != '') {
// if(+loss>+annual_sale){
// alert("Loss is greater than Annual Sale ");
// childArray.controls.financial_net_loss.setValue(0);
// childArray.controls.financial_margin_of_loss.setValue('');
// childArray.controls.financial_profit_to_sale_variation.setValue('');
// childArray.controls.financial_variation.setValue('');
// }
// else{
// loss_margin = (loss / annual_sale) * 100 * (-1);
// childArray.controls.financial_margin_of_loss.setValue(loss_margin != Infinity ? !(Number.isNaN(loss_margin)) ? loss_margin.toFixed(2) : 0 : 0);
// // detail.controls.financial_margin.disable()
// }
// }
// }
// prev_profit_margin = val.financial_margin_of_profit != '' ? val.financial_margin_of_profit : 0;
// prev_loss_margin = val.financial_margin_of_loss !='' ? val.financial_margin_of_loss : 0 ;
// if ((profit_margin != '' || loss_margin != '') && index != 0) {
// loss_margin = loss_margin !== undefined ? loss_margin : 0;
// prev_loss_margin = prev_loss_margin !== undefined ? prev_loss_margin : 0 ;
// profit_margin = profit_margin !== undefined ? profit_margin:0;
// prev_profit_margin = prev_profit_margin !== undefined ? prev_profit_margin : 0 ;
// let variation_percent : any ;
// variation_percent = (((profit_margin != '' ? profit_margin : loss_margin ) - (prev_profit_margin != '' ? prev_profit_margin : prev_loss_margin ))/ (prev_profit_margin != '' ? Math.abs(prev_profit_margin) : Math.abs(prev_loss_margin))) * 100;
// childArray.controls.financial_profit_to_sale_variation.setValue(variation_percent != Infinity ? !(Number.isNaN(variation_percent)) ? variation_percent.toFixed(2) :0: 0);
// }
// });
// }
/** old code without forloop For Financial Customer
* Calculating Yearwise Variation
*/
// calVariation(index, detail) {
// let profit = detail.value.estimate_net_profit;
// let loss = detail.value.estimate_net_loss;
// //let curr_year = detail.value.estimate_year;
// if ( (profit != '' || loss != '') && index != 0) {
// let array = <FormArray>this.financialForm.controls['estimated_value'];
// 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 != '' ? Math.abs(prev_profit) : Math.abs(prev_loss))) * 100;
// detail.controls.estimate_variation.setValue(variation!= Infinity ? variation.toFixed(2) : 0);
// }
// }
/** old code without forloop For Financial Customer
* Calculating AnnualSales Variation
*/
// calMarginVal(index, detail) {
// let salary = detail.value.estimate_annual_sale;
// if(detail.value.estimate_profit_or_loss == 1){
// let profit = detail.value.estimate_net_profit;
// if (salary != '' && profit != '') {
// let margin = profit / salary * 100;
// detail.controls.estimate_margin_of_profit.setValue(margin!= Infinity ? margin.toFixed(2):0);
// }
// }
// else if (detail.value.estimate_profit_or_loss == 2){
// let loss = detail.value.estimate_net_loss;
// if (salary != '' && loss != '') {
// let margin = (loss / salary) * 100 * (-1);
// detail.controls.estimate_margin_of_loss.setValue(margin!= Infinity ? margin.toFixed(2):0);
// }
// }
// }
// calProfitAndLossVal( i, detail) {
// let salary = detail.value.estimate_annual_sale;
// if(detail.value.estimate_profit_or_loss == 1){
// let margin_profit = detail.value.estimate_margin_of_profit;
// if (salary != '' && margin_profit != '') {
// let profit = (margin_profit/100)*salary;
// detail.controls.estimate_net_profit.setValue(profit!= Infinity ? profit.toFixed(2):0);
// this.AV_netProfitAmtInwords[i] = this._pd.convertNumberToWords(profit);
// }
// }
// 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*(-1);
// detail.controls.estimate_net_loss.setValue(loss!= Infinity ? loss.toFixed(2):0);
// this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(loss);
// }
// }
// }
/**
* New Calculation for Finanical Statement
**/
calculationForFinanicalStatement(){
let parentArray = <FormArray>this.financialForm.controls['date_per_financial'];
// let prev_annual_sale : any = '';
// let prev_profit_margin : any = '';
// let prev_loss_margin : any = '';
// let prev_profit_amt : any = '';
// let prev_loss_amt : any = '';
// let profit_margin : any = '';
// let loss_margin : any = '';
// let annual_sale : any = '';
// let profit_amt : any = '';
// let loss_amt : any = '';
let prev_annual_sale : any = '';
let prev_profit_margin : any = [];
let prev_loss_margin : any = [];
let prev_profit_amt : any = '';
let prev_loss_amt : any = '';
let profit_margin : any = '';
let loss_margin : any = '';
let annual_sale : any = '';
let profit_amt : any = '';
let loss_amt : any = '';
parentArray.value.forEach((val,index) => {
let childArray : any = <FormArray>parentArray.controls[index];
annual_sale = val.financial_annual_sale;
/** Calculating Sale Variation Based on Prev.Year ( Datas returns in percentage )
* Label name = " Sale Variation from Previous Year in % "
*/
if (val.annual_sale != ''){
if (index != 0) {
let annual_sale_variation = (( annual_sale - prev_annual_sale)/prev_annual_sale) * 100 ;
let final_annual_sale_variation = (annual_sale_variation!= Infinity) ? !(Number.isNaN(annual_sale_variation)) ? annual_sale_variation.toFixed(2): 0.00 : 0.00;
childArray.controls.financial_annualsales_variation.setValue(final_annual_sale_variation);
}
}
else if(val.annual_sale == ''){
childArray.controls.financial_annualsales_variation.setValue(0.00);
}
prev_annual_sale = annual_sale;
/******************************************** Calculation Sale Variation ends Here ******************************************************************************************************/
profit_amt = val.financial_net_profit;
loss_amt = val.financial_net_loss;
/** Calculating Profit's Variation - STARTS HERE
* Label name = "Profit Variation from Previous Year in %"
*/
if((profit_amt != '' || loss_amt != '') && index != 0) {
if(+profit_amt > +annual_sale){
childArray.controls.financial_margin_of_profit.setValue('');
}
else{
loss_amt = loss_amt != 0 ? loss_amt * (-1) : loss_amt;
prev_loss_amt = prev_loss_amt != 0 ? prev_loss_amt * (-1) : prev_loss_amt ;
let variation = (((profit_amt != '' ? profit_amt : loss_amt ) - (prev_profit_amt != '' ? prev_profit_amt : prev_loss_amt ))/ (prev_profit_amt != '' ? Math.abs(prev_profit_amt) : Math.abs(prev_loss_amt))) * 100;
let final_variation = variation!= Infinity ? !(Number.isNaN(variation)) ? variation.toFixed(2) : 0.00 : 0.00 ;
childArray.controls.financial_variation.setValue(final_variation);
}
}
prev_profit_amt = val.financial_net_profit != '' ? val.financial_net_profit : 0;
prev_loss_amt = val.financial_net_loss !='' ? val.financial_net_loss : 0 ;
/********************************* Calculating Profit's Variation - ENDS HERE **************************************************************/
/** Calculating Net Profit (or) Net Loss (and) Sales's Profit Variation
* Label name = "Net Profit to Sales in % (or) Net Loss to Sales in %
**/
let SelectedlossOrProfit = val.finanical_profit_or_loss;
if(SelectedlossOrProfit == 1){
loss_margin = '';
detail.controls.financial_margin_of_loss.setValue('');
childArray.controls.financial_margin_of_loss.setValue('');
let profit = detail.value.financial_net_profit;
if (salary != '' && profit != '') {
if(+profit>+salary){
if (annual_sale != '' && val.financial_net_profit != '') {
if(+profit_amt>+annual_sale){
alert("profit is greater than Annual Sale ");
detail.controls.financial_net_profit.setValue(0);
detail.controls.financial_margin_of_profit.setValue('');
detail.controls.financial_profit_to_sale_variation.setValue('');
detail.controls.financial_variation.setValue('');
childArray.controls.financial_net_profit.setValue(0);
childArray.controls.financial_margin_of_profit.setValue('');
childArray.controls.financial_profit_to_sale_variation.setValue('');
childArray.controls.financial_variation.setValue('');
}
else{
profit_margin = (profit / salary) * 100;
detail.controls.financial_margin_of_profit.setValue(profit_margin!= Infinity ? profit_margin.toFixed(2):0);
}
profit_margin = (profit_amt / annual_sale) * 100;
childArray.controls.financial_margin_of_profit.setValue(profit_margin!= Infinity ? !(Number.isNaN(profit_margin)) ? profit_margin.toFixed(2):0:0);
}
}
else if (detail.value.finanical_profit_or_loss == 2){
}
else if(SelectedlossOrProfit == 2){
profit_margin = '';
detail.controls.financial_margin_of_profit.setValue('');
let loss = detail.value.financial_net_loss;
childArray.controls.financial_margin_of_profit.setValue('');
if (salary != '' && loss != '') {
if(+loss>+salary){
if (annual_sale != '' && val.financial_net_loss != '') {
if(+val.financial_net_loss>+annual_sale){
alert("Loss is greater than Annual Sale ");
detail.controls.financial_net_loss.setValue(0);
detail.controls.financial_margin_of_loss.setValue('');
detail.controls.financial_profit_to_sale_variation.setValue('');
detail.controls.financial_variation.setValue('');
childArray.controls.financial_net_loss.setValue(0);
childArray.controls.financial_margin_of_loss.setValue('');
childArray.controls.financial_profit_to_sale_variation.setValue('');
childArray.controls.financial_variation.setValue('');
}
if(+loss_amt>+annual_sale){
childArray.controls.financial_net_loss.setValue(0);
childArray.controls.financial_margin_of_loss.setValue('');
childArray.controls.financial_profit_to_sale_variation.setValue('');
childArray.controls.financial_variation.setValue('');
}
else{
loss_margin = (loss / salary) * 100 * (-1);
detail.controls.financial_margin_of_loss.setValue(loss_margin != Infinity ? loss_margin.toFixed(2): 0);
// detail.controls.financial_margin.disable()
loss_margin = (loss_amt/annual_sale) * 100 * (-1);
childArray.controls.financial_margin_of_loss.setValue(loss_margin != Infinity ? !(Number.isNaN(loss_margin)) ? loss_margin.toFixed(2) : 0 : 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 ){
// let variation_percent = (((profit_margin != '' ? profit_margin : loss_margin ) - (prev_profit_margin != '' ? prev_profit_margin : prev_loss_margin ))/ (prev_profit_margin != '' ? Math.abs(prev_profit_margin) : Math.abs(prev_loss_margin))) * 100;
// let final_variation_percent = variation_percent != Infinity ? !(Number.isNaN(variation_percent)) ? variation_percent.toFixed(2) :0: 0;
// childArray.controls.financial_profit_to_sale_variation.setValue(final_variation_percent);
// }
/**************************** Calculating Net Profit (or) Net Loss - ENDS HERE **************************************************************/
/** Calculating Sales's Profit Variation
* Label name = "Variation of Profit % over sales"
**/
if ((profit_margin != '' || loss_margin != '') && index != 0) {
let array = <FormArray>this.financialForm.controls['date_per_financial'];
let prev_profit_margin = array.value[index - 1].financial_margin_of_profit != '' ? array.value[index - 1].financial_margin_of_profit : 0;
let prev_loss_margin = array.value[index - 1].financial_margin_of_loss !='' ? array.value[index - 1].financial_margin_of_loss : 0 ;
loss_margin = loss_margin !== undefined ? loss_margin : 0;
prev_loss_margin = prev_loss_margin !== undefined ? prev_loss_margin : 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 ;
profit_margin = profit_margin !== undefined ? profit_margin:0;
prev_profit_margin = prev_profit_margin !== undefined ? prev_profit_margin : 0 ;
let variation_percent : any ;
variation_percent = (((profit_margin != '' ? profit_margin : loss_margin ) - (prev_profit_margin != '' ? prev_profit_margin : prev_loss_margin ))/ (prev_profit_margin != '' ? Math.abs(prev_profit_margin) : Math.abs(prev_loss_margin))) * 100;
// console.log((profit_margin != '' ? profit_margin : loss_margin ) - (prev_profit_margin != '' ? prev_profit_margin : prev_loss_margin ));
// console.log((((profit_margin != '' ? profit_margin : loss_margin ) - (prev_profit_margin != '' ? prev_profit_margin : prev_loss_margin ))/ (prev_profit_margin != '' ? Math.abs(prev_profit_margin) : Math.abs(prev_loss_margin))));
// console.log((((profit_margin != '' ? profit_margin : loss_margin ) - (prev_profit_margin != '' ? prev_profit_margin : prev_loss_margin ))/ (prev_profit_margin != '' ? Math.abs(prev_profit_margin) : Math.abs(prev_loss_margin))) * 100);
detail.controls.financial_profit_to_sale_variation.setValue(variation_percent != Infinity ? variation_percent.toFixed(2) : 0);
variation_percent = (((profit_margin != '' ? profit_margin : loss_margin ) - (temp_prev_profit_margin != 0 ? temp_prev_profit_margin : temp_prev_loss_margin ))/ (temp_prev_profit_margin != 0 ? Math.abs(temp_prev_profit_margin) : Math.abs(temp_prev_loss_margin))) * 100;
let final_percent = variation_percent != Infinity ? !(Number.isNaN(variation_percent)) ? variation_percent.toFixed(2) :0: 0;
childArray.controls.financial_profit_to_sale_variation.setValue(final_percent);
}
/**************************** Calculating Sales's Profit Variation - ENDS HERE **************************************************************/
});
}
/** For Financial Customer
* Calculating Yearwise Variation
*/
calVariation(index, detail) {
let profit = detail.value.estimate_net_profit;
let loss = detail.value.estimate_net_loss;
//let curr_year = detail.value.estimate_year;
if ( (profit != '' || loss != '') && index != 0) {
let array = <FormArray>this.financialForm.controls['estimated_value'];
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 != '' ? Math.abs(prev_profit) : Math.abs(prev_loss))) * 100;
detail.controls.estimate_variation.setValue(variation!= Infinity ? variation.toFixed(2) : 0);
}
}
/** For Financial Customer
* Calculating AnnualSales Variation
*/
calMarginVal(index, detail) {
let salary = detail.value.estimate_annual_sale;
if(detail.value.estimate_profit_or_loss == 1){
let profit = detail.value.estimate_net_profit;
if (salary != '' && profit != '') {
let margin = profit / salary * 100;
detail.controls.estimate_margin_of_profit.setValue(margin!= Infinity ? margin.toFixed(2):0);
}
}
else if (detail.value.estimate_profit_or_loss == 2){
let loss = detail.value.estimate_net_loss;
if (salary != '' && loss != '') {
let margin = (loss / salary) * 100 * (-1);
detail.controls.estimate_margin_of_loss.setValue(margin!= Infinity ? margin.toFixed(2):0);
}
}
}
calProfitAndLossVal( i, detail) {
let salary = detail.value.estimate_annual_sale;
if(detail.value.estimate_profit_or_loss == 1){
let margin_profit = detail.value.estimate_margin_of_profit;
if (salary != '' && margin_profit != '') {
let profit = (margin_profit/100)*salary;
detail.controls.estimate_net_profit.setValue(profit!= Infinity ? profit.toFixed(2):0);
this.AV_netProfitAmtInwords[i] = this._pd.convertNumberToWords(profit);
}
}
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*(-1);
detail.controls.estimate_net_loss.setValue(loss!= Infinity ? loss.toFixed(2):0);
this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(loss);
}
}
}
confirmAlert(i, details){

View File

@ -81,23 +81,21 @@
<div fxLayout="row wrap" *ngIf="neighbourhood.controls.do_know.value!=''">
<div fxFlex="60" *ngIf="neighbourhood.controls.do_know.value!='' && !isDisplay2[n]">
<mat-form-field style="width: 95%">
<mat-select placeholder="Who is the owner of the organisation?" formControlName="organisation_owner" (selectionChange)="selectedApplicants(neighbourhood,$event.value,n)">
<div fxFlex="60">
<mat-form-field style="width: 95%" *ngIf="neighbourhood.controls.do_know.value!='' && !isDisplay2[n] ; else OtherCondition;">
<mat-select placeholder="Who is the owner of the organisation?" formControlName="organisation_owner">
<mat-option *ngFor="let list of applicants" [value]="list.pd_co_applicant_id">{{list.applicant_name}}</mat-option>
</mat-select>
</mat-form-field>
<ng-template #OtherCondition>
<label>Who is the owner of the organisation?</label>
</ng-template>
</div>
<div fxFlex="20" *ngIf="isOtherApplicant && !isDisplay2[n]">
<mat-form-field style="width: 95%">
<div fxFlex="20">
<mat-form-field style="width: 95%" *ngIf="checkOthers(neighbourhood.controls.organisation_owner.value)===true">
<input matInput autocomplete="off" placeholder="Specify Owner name" formControlName="other_organisation_owner" type="text">
</mat-form-field>
</div>
<div fxFlex="80" *ngIf="neighbourhood.controls.do_know.value!='' && isDisplay2[n]">
<label>Who is the owner of the organisation?</label>
</div>
<div fxFlex="10" style="text-align: center;">
<label>Do not know</label>
<div>

View File

@ -34,7 +34,7 @@ export class NeighbourHoodComponent implements OnInit {
{'id': 2,'name': "Negative"},
{'id': 3,'name': "Insufficient information provided"}];
amtInwords : any = [];
isOtherApplicant: boolean;
// isOtherApplicant: any = [];
constructor(notifier: NotifierService, private _pd: PdTrigerService ,private _fb: FormBuilder, @Inject(MAT_DIALOG_DATA) public data: any,private dialogRef: MatDialogRef<NeighbourHoodComponent>) {
this.pdid = this.data.pdmaster_details.pd_id;
this.notifier = notifier;
@ -111,7 +111,7 @@ export class NeighbourHoodComponent implements OnInit {
exist_neighbourhood_details.forEach((element,index) => {
this.toggleVisibility(element.did_not_know_the_business_operation,index,1);
this.toggleVisibility(element.did_not_know_the_owner,index,2);
this.selectedApplicants(referencecheckControl,element.organisation_owner);
// this.selectedApplicants(referencecheckControl,element.organisation_owner,index);
neighbourhoodControl.push(this.createNeighbourhood(element));
});
}
@ -346,7 +346,7 @@ validateAllFormFields(formGroup: any) {
}
toggleVisibility(e,index,flag){
// console.log(e,index);
console.log(e,index);
if(flag == 1){
this.isDisplay[index] = e;
}
@ -355,19 +355,29 @@ toggleVisibility(e,index,flag){
}
}
selectedApplicants(items,e){
if(e != 0){
this.isOtherApplicant = false;
items.controls['other_organisation_owner'].setValue('');
items.controls['other_organisation_owner'].clearValidators();
}else{
this.isOtherApplicant = true;
items.controls['other_organisation_owner'].setValidators([Validators.required]);
checkOthers(values){
if(values!=null) {
return values.id==0 ? true : false;
}
else {
return false;
}
items.controls['other_organisation_owner'].updateValueAndValidity();
}
// selectedApplicants(items,e,i){
// if(e != 0){
// this.isOtherApplicant[i] = false;
// // items.controls['other_organisation_owner'].setValue('');
// // items.controls['other_organisation_owner'].clearValidators();
// // items.controls['other_organisation_owner'].updateValueAndValidity();
// }else{
// this.isOtherApplicant[i] = true;
// // items.controls['other_organisation_owner'].setValidators([Validators.required]);
// // items.controls['other_organisation_owner'].updateValueAndValidity();
// }
// }
/** Amount InWords */
inWords(e,i){

View File

@ -382,27 +382,30 @@ tradingFormCreation(val) {
} else {
if(datas.manufacturing_raw_materials != undefined){
for (let val of datas.manufacturing_raw_materials) {
// for (let val of datas.manufacturing_raw_materials) {
datas.manufacturing_raw_materials.forEach((val,index) => {
if(val.raw_value){
this.M_rawValueInWords = this._pd.convertNumberToWords(val.raw_value);
this.M_rawValueInWords[index] = this._pd.convertNumberToWords(val.raw_value);
// this.M_financialRawValueInWords = this._pd.convertNumberToWords(val.rawmaterial_value);
}
rawMaterial.push(this.createRawmaterial(val));
}
});
}
else{
rawMaterial.push(this.createRawmaterial(null));
}
if(datas.manufacturing_finished_goods != undefined){
for (let val of datas.manufacturing_finished_goods) {
// for (let val of datas.manufacturing_finished_goods) {
datas.manufacturing_finished_goods.forEach((val,index) => {
if(val.goods_value){
this.M_goodsValueInWords = this._pd.convertNumberToWords(val.goods_value);
this.M_goodsValueInWords[index] = this._pd.convertNumberToWords(val.goods_value);
// this.M_financialGoodsValueInWords = this._pd.convertNumberToWords(val.finished_goods_value);
}
finishedGoods.push(this.createGoods(val));
}
});
}
else{
finishedGoods.push(this.createGoods(null));
@ -470,15 +473,16 @@ tradingFormCreation(val) {
} else {
if(datas.retail_traded_goods !== undefined){
for (let val of datas.retail_traded_goods) {
// for (let val of datas.retail_traded_goods) {
datas.retail_traded_goods.forEach((val,index) => {
if(val.estimated_traded_goods_value){
this.R_tradedGoodsValueInWords = this._pd.convertNumberToWords(val.estimated_traded_goods_value);
this.R_tradedGoodsValueInWords[index] = this._pd.convertNumberToWords(val.estimated_traded_goods_value);
// this.R_financialTradedGoodsValueInWords =this._pd.convertNumberToWords(val.traded_goods_value);
}
tradedGoods.push(this.createTradedGoods(val));
}
});
}
else{
tradedGoods.push(this.createTradedGoods(null));
@ -569,14 +573,15 @@ tradingFormCreation(val) {
} else {
if(datas.trading_traded_goods !==undefined)
{
for (let val of datas.trading_traded_goods) {
// for (let val of datas.trading_traded_goods) {
datas.trading_traded_goods.forEach((val,index) => {
if(val.estimated_traded_goods_value){
this.T_tradedGoodsValueInWords = this._pd.convertNumberToWords(val.estimated_traded_goods_value);
this.T_tradedGoodsValueInWords[index] = this._pd.convertNumberToWords(val.estimated_traded_goods_value);
// this.T_financialTradedGoodsValueInWords =this._pd.convertNumberToWords(val.traded_goods_value);
}
tradedGoods.push(this.createTradedGoods(val));
}
});
}
else{
tradedGoods.push(this.createTradedGoods(null));

View File

@ -87,12 +87,12 @@
</mat-form-field>
</div>
<div fxLayout="row nowrap" *ngIf="items.get('manufacturing_payment_type').value == 3">
<div fxLayout="row nowrap" style="padding-left: 2%;" *ngIf="items.get('manufacturing_payment_type').value == 3">
<mat-label>No.of days of Credit Provided by Supplier </mat-label>
<mat-form-field style="width: 45%" >
<mat-form-field style="width: 25%" >
<input matInput placeholder="Days From" formControlName="manufacturing_credit_days_from" type="number">
</mat-form-field>
<mat-form-field style="width: 45%" >
<mat-form-field style="width: 25%" >
<input matInput placeholder="Days To" formControlName="manufacturing_credit_days_to" type="number">
</mat-form-field>
</div>
@ -196,12 +196,12 @@
<!-- <mat-form-field style="width: 45%" *ngIf="items.get('trade_product_payment_type').value == 3">
<input matInput placeholder="No.of Days of Credit Provided by Supplier" autocomplete="off" formControlName="trade_product_credit_days" (keypress)="keyPress($event)">
</mat-form-field> -->
<div fxLayout="row nowrap" *ngIf="items.get('trade_product_payment_type').value == 3">
<div fxLayout="row nowrap" style="padding-left: 2%;display: none !important;" *ngIf="items.get('trade_product_payment_type').value == 3">
<mat-label>No.of days of Credit Provided by Supplier </mat-label>
<mat-form-field style="width: 45%" >
<mat-form-field style="width: 25%" >
<input matInput placeholder="Days From" formControlName="trade_product_credit_days_from" type="number">
</mat-form-field>
<mat-form-field style="width: 45%" >
<mat-form-field style="width: 25%" >
<input matInput placeholder="Days To" formControlName="trade_product_credit_days_to" type="number">
</mat-form-field>
</div>

View File

@ -87,7 +87,8 @@
</div>
<div class="row" style="text-align:right;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button"(click)="onReset()"><mat-icon>settings_backup_restore</mat-icon></button>
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button"(click)="onReset()"><mat-icon>settings_backup_restore</mat-icon></button> -->
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" [matTooltip]="_editEntityBillingInfoFrom.controls['billing_name'].value == '' ? 'Reset' : 'Clear Changes' " matTooltipPosition="above" type="button"(click)="onReset()"><mat-icon>settings_backup_restore</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button>
</div>
</form>

View File

@ -39,7 +39,7 @@ import { EntityEditBillingInfoComponent } from './entity-edit/entity-edit-billin
import { DialogAddEditBillingInfo } from './entity-edit/entity-edit-billing-info/entity-edit-billing-info.component';
import { EntityEditVendorCityInfoComponent } from './entity-edit/entity-edit-vendor-city-info/entity-edit-vendor-city-info.component';
import { EntityBranchAddComponent } from './entity-edit/entity-branch-add/entity-branch-add.component';
// import { MatTooltipModule } from '@angular/material/tooltip';
import { MatTooltipModule } from '@angular/material/tooltip';
/**
* Custom angular notifier options
*/
@ -97,7 +97,7 @@ const customNotifierOptions: NotifierOptions = {
MatProgressBarModule,MatDialogModule, MatSortModule,
MatToolbarModule,MatSelectModule,MatListModule, MatMenuModule,
MatCheckboxModule,
// MatTooltipModule,
MatTooltipModule,
MatTabsModule,
MatChipsModule,
MatExpansionModule,

View File

@ -86,7 +86,7 @@
</div>
<div class="row" style="text-align:right;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="reset"><mat-icon>settings_backup_restore</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset"><mat-icon>settings_backup_restore</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_pdTeamForm.valid"><mat-icon>save</mat-icon></button>
</div>
</mat-card>

View File

@ -157,7 +157,11 @@
<hr>
<mat-card-actions style="text-align:right;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="reset"><mat-icon>settings_backup_restore</mat-icon></button>
<button *ngIf = "this.regForm.controls['userid'].value == null ; else editreset;" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset"><mat-icon>settings_backup_restore</mat-icon></button>
<ng-template #editreset>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="button" (click)="onResetForEdit()" ><mat-icon>settings_backup_restore</mat-icon></button>
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Clear Changes" matTooltipPosition="above" type="reset"><mat-icon>settings_backup_restore</mat-icon></button> -->
</ng-template>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Submit" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button>

View File

@ -386,6 +386,9 @@ this.loader = true;
}
}
onResetForEdit(){
this.userupdate();
}
checktype(e){
// console.log(e);