customer fin : ps

This commit is contained in:
venbatechnologies@gmail.com 2019-03-20 11:17:01 +05:30
parent 46111abd73
commit 29b5536a4b

View File

@ -1148,15 +1148,20 @@ export class FinancialInfoComponent implements OnInit {
} }
let profit_percent = (estimate_profit_range_to + estimate_profit_range_from)/2; // console.log((+estimate_profit_range_to + estimate_profit_range_from));
let Profit_Average = (profit_percent*sales_average)/100; // console.log((estimate_profit_range_to + estimate_profit_range_from)/2);
let difference = (estimate_profit_range_to - estimate_profit_range_from); // let a = estimate_profit_range_from+estimate_profit_range_to ;
// let b = a/2;
// console.log(a,b);
let consi_profit_percent = (+estimate_profit_range_to + +estimate_profit_range_from)/2;
let Profit_Average = ((+consi_profit_percent)*(+sales_average))/100;
let difference = ((+estimate_profit_range_to) - (+estimate_profit_range_from));
if(difference > 3){ if(difference > 3){
var r = confirm("Given Profit Percent Range is greater than 3"); var r = confirm("Given Profit Percent Range is greater than 3");
if (r == true) { if (r == true) {
details.controls.estimate_profit_margin.setValue(Profit_Average!= Infinity ? Math.round(Profit_Average):0); details.controls.estimate_profit_margin.setValue(Profit_Average!= Infinity ? Math.round(Profit_Average):0);
details.controls.estimate_profit_margin_percent.setValue(profit_percent!= Infinity ? profit_percent.toFixed(2):0); details.controls.estimate_profit_margin_percent.setValue(consi_profit_percent.toFixed(2));
this.AV_marginProfitAmtInwords[i] = this._pd.convertNumberToWords(Math.round(Profit_Average)); this.AV_marginProfitAmtInwords[i] = this._pd.convertNumberToWords(Math.round(Profit_Average));
}else{ }else{
details.controls.estimate_profit_range_to.setValue(''); details.controls.estimate_profit_range_to.setValue('');
@ -1167,7 +1172,7 @@ export class FinancialInfoComponent implements OnInit {
} }
details.controls.estimate_profit_margin.setValue(Profit_Average!= Infinity ? Math.round(Profit_Average):0); details.controls.estimate_profit_margin.setValue(Profit_Average!= Infinity ? Math.round(Profit_Average):0);
details.controls.estimate_profit_margin_percent.setValue(profit_percent!= Infinity ? profit_percent.toFixed(2):0); details.controls.estimate_profit_margin_percent.setValue(consi_profit_percent.toFixed(2));
this.AV_marginProfitAmtInwords[i] = this._pd.convertNumberToWords(Math.round(Profit_Average)); this.AV_marginProfitAmtInwords[i] = this._pd.convertNumberToWords(Math.round(Profit_Average));
// details.controls.estimate_profit_margin.setValue(Math.round(Profit_Average)); // details.controls.estimate_profit_margin.setValue(Math.round(Profit_Average));
// details.controls.estimate_profit_margin_percent.setValue(profit_percent.toFixed(2)); // details.controls.estimate_profit_margin_percent.setValue(profit_percent.toFixed(2));
@ -1213,8 +1218,8 @@ export class FinancialInfoComponent implements OnInit {
return; return;
} }
let C = (estimate_net_profit_to - estimate_net_profit_from) let C = (+estimate_net_profit_to - +estimate_net_profit_from)
let D = (C / estimate_net_profit_from) * 100; let D = (C / +estimate_net_profit_from) * 100;
let range1 = +estimate_net_profit_from/10; let range1 = +estimate_net_profit_from/10;
@ -1225,7 +1230,7 @@ export class FinancialInfoComponent implements OnInit {
if(D >= 20){ if(D >= 20){
var r = confirm("Given Profit Range is greater than 20%"); var r = confirm("Given Profit Range is greater than 20%");
if (r == true) { if (r == true) {
details.controls.estimate_net_profit_to.setValue(estimate_net_profit_to!= Infinity ? estimate_net_profit_to:0); details.controls.estimate_net_profit_to.setValue(estimate_net_profit_to!= Infinity ? +estimate_net_profit_to:0);
}else{ }else{
details.controls.estimate_net_profit_to.setValue(''); details.controls.estimate_net_profit_to.setValue('');
details.controls.estimate_net_profit.setValue(''); details.controls.estimate_net_profit.setValue('');
@ -1234,18 +1239,18 @@ export class FinancialInfoComponent implements OnInit {
} }
} }
else{ else{
details.controls.estimate_net_profit_to.setValue(estimate_net_profit_to!= Infinity ? estimate_net_profit_to:0); details.controls.estimate_net_profit_to.setValue(estimate_net_profit_to!= Infinity ? +estimate_net_profit_to:0);
} }
if(lower > higer){ if(lower > higer){
details.controls.estimate_net_profit.setValue(higer!= Infinity ? higer.toFixed(2):0); details.controls.estimate_net_profit.setValue(higer!= Infinity ? higer.toFixed(2):0);
let Profit_percent = (higer/sales_average)*100; let Profit_percent = (higer/+sales_average)*100;
details.controls.estimate_net_profit_percent.setValue(Profit_percent!= Infinity ? Profit_percent.toFixed(2):0); details.controls.estimate_net_profit_percent.setValue(Profit_percent!= Infinity ? Profit_percent.toFixed(2):0);
this.AV_netProfitAmtInwords[i] = this._pd.convertNumberToWords(Math.round(higer)); this.AV_netProfitAmtInwords[i] = this._pd.convertNumberToWords(Math.round(higer));
} }
else{ else{
details.controls.estimate_net_profit.setValue(lower!= Infinity ? lower.toFixed(2):0); details.controls.estimate_net_profit.setValue(lower!= Infinity ? lower.toFixed(2):0);
let Profit_percent = (lower/sales_average)*100; let Profit_percent = (lower/+sales_average)*100;
details.controls.estimate_net_profit_percent.setValue(Profit_percent!= Infinity ? Profit_percent.toFixed(2):0); details.controls.estimate_net_profit_percent.setValue(Profit_percent!= Infinity ? Profit_percent.toFixed(2):0);
this.AV_netProfitAmtInwords[i] = this._pd.convertNumberToWords(Math.round(lower)); this.AV_netProfitAmtInwords[i] = this._pd.convertNumberToWords(Math.round(lower));
} }
@ -1264,18 +1269,18 @@ export class FinancialInfoComponent implements OnInit {
} }
} }
else{ else{
details.controls.estimate_net_profit_to.setValue(estimate_net_profit_to!= Infinity ? estimate_net_profit_to:0); details.controls.estimate_net_profit_to.setValue(estimate_net_profit_to!= Infinity ? +estimate_net_profit_to:0);
} }
if(lower > higer){ if(lower > higer){
details.controls.estimate_net_profit.setValue(higer!= Infinity ? higer.toFixed(2):0); details.controls.estimate_net_profit.setValue(higer!= Infinity ? higer.toFixed(2):0);
let Profit_percent = (higer/sales_average)*100; let Profit_percent = (higer/+sales_average)*100;
details.controls.estimate_net_profit_percent.setValue(Profit_percent!= Infinity ? Profit_percent.toFixed(2):0); details.controls.estimate_net_profit_percent.setValue(Profit_percent!= Infinity ? Profit_percent.toFixed(2):0);
this.AV_netProfitAmtInwords[i] = this._pd.convertNumberToWords(Math.round(higer)); this.AV_netProfitAmtInwords[i] = this._pd.convertNumberToWords(Math.round(higer));
} }
else{ else{
details.controls.estimate_net_profit.setValue(lower!= Infinity ? lower.toFixed(2):0); details.controls.estimate_net_profit.setValue(lower!= Infinity ? lower.toFixed(2):0);
let Profit_percent = (lower/sales_average)*100; let Profit_percent = (lower/+sales_average)*100;
details.controls.estimate_net_profit_percent.setValue(Profit_percent!= Infinity ? Profit_percent.toFixed(2):0); details.controls.estimate_net_profit_percent.setValue(Profit_percent!= Infinity ? Profit_percent.toFixed(2):0);
this.AV_netProfitAmtInwords[i] = this._pd.convertNumberToWords(Math.round(lower)); this.AV_netProfitAmtInwords[i] = this._pd.convertNumberToWords(Math.round(lower));
} }
@ -1375,9 +1380,9 @@ export class FinancialInfoComponent implements OnInit {
return; return;
} }
let loss_percent = (estimate_loss_range_to + estimate_loss_range_from)/2; let consi_loss_percent = (+estimate_loss_range_to + +estimate_loss_range_from)/2;
let loss_Average = (loss_percent*sales_average)/100; let loss_Average = (+consi_loss_percent*+sales_average)/100;
let difference = (estimate_loss_range_to - estimate_loss_range_from) let difference = (+estimate_loss_range_to - +estimate_loss_range_from)
// details.controls.estimate_loss_margin.setValue(Math.round(loss_Average)); // details.controls.estimate_loss_margin.setValue(Math.round(loss_Average));
// details.controls.estimate_loss_margin_percent.setValue(loss_percent.toFixed(2)); // details.controls.estimate_loss_margin_percent.setValue(loss_percent.toFixed(2));
@ -1388,7 +1393,7 @@ export class FinancialInfoComponent implements OnInit {
var r = confirm("Given Loss Percent Range is greater than 3"); var r = confirm("Given Loss Percent Range is greater than 3");
if (r == true) { if (r == true) {
details.controls.estimate_loss_margin.setValue(loss_Average!= Infinity ? Math.round(loss_Average):0); details.controls.estimate_loss_margin.setValue(loss_Average!= Infinity ? Math.round(loss_Average):0);
details.controls.estimate_loss_margin_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0); details.controls.estimate_loss_margin_percent.setValue(consi_loss_percent.toFixed(2));
this.AV_marginLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(loss_Average)); this.AV_marginLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(loss_Average));
}else{ }else{
@ -1400,7 +1405,7 @@ export class FinancialInfoComponent implements OnInit {
} }
details.controls.estimate_loss_margin.setValue(loss_Average!= Infinity ? Math.round(loss_Average):0); details.controls.estimate_loss_margin.setValue(loss_Average!= Infinity ? Math.round(loss_Average):0);
details.controls.estimate_loss_margin_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0); details.controls.estimate_loss_margin_percent.setValue(+consi_loss_percent.toFixed(2));
this.AV_marginLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(loss_Average)); this.AV_marginLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(loss_Average));
} }
@ -1453,8 +1458,8 @@ export class FinancialInfoComponent implements OnInit {
// } // }
let C = (estimate_net_loss_to - estimate_net_loss_from) let C = (+estimate_net_loss_to - +estimate_net_loss_from)
let D = (C / estimate_net_loss_from) * 100; let D = (C / +estimate_net_loss_from) * 100;
let range1 = +estimate_net_loss_from/10; let range1 = +estimate_net_loss_from/10;
@ -1465,7 +1470,7 @@ export class FinancialInfoComponent implements OnInit {
if(D >= 20){ if(D >= 20){
var r = confirm("Given Profit Range is greater than 20%"); var r = confirm("Given Profit Range is greater than 20%");
if (r == true) { if (r == true) {
details.controls.estimate_net_loss_to.setValue(estimate_net_loss_to!= Infinity ? estimate_net_loss_to:0); details.controls.estimate_net_loss_to.setValue(estimate_net_loss_to!= Infinity ? +estimate_net_loss_to:0);
}else{ }else{
details.controls.estimate_net_loss_to.setValue(''); details.controls.estimate_net_loss_to.setValue('');
@ -1475,18 +1480,18 @@ export class FinancialInfoComponent implements OnInit {
} }
} }
else{ else{
details.controls.estimate_net_loss_to.setValue(estimate_net_loss_to!= Infinity ? estimate_net_loss_to:0); details.controls.estimate_net_loss_to.setValue(estimate_net_loss_to!= Infinity ? +estimate_net_loss_to:0);
} }
if(lower > higer){ if(lower > higer){
details.controls.estimate_net_loss.setValue(higer!= Infinity ? higer.toFixed(2):0); details.controls.estimate_net_loss.setValue(higer!= Infinity ? higer.toFixed(2):0);
let loss_percent = (higer/sales_average)*100; let loss_percent = (higer/+sales_average)*100;
details.controls.estimate_net_loss_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0); details.controls.estimate_net_loss_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0);
this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(higer)); this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(higer));
} }
else{ else{
details.controls.estimate_net_loss.setValue(lower!= Infinity ? lower.toFixed(2):0); details.controls.estimate_net_loss.setValue(lower!= Infinity ? lower.toFixed(2):0);
let loss_percent = (lower/sales_average)*100; let loss_percent = (lower/+sales_average)*100;
details.controls.estimate_net_loss_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0); details.controls.estimate_net_loss_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0);
this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(lower)); this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(lower));
} }
@ -1510,13 +1515,13 @@ export class FinancialInfoComponent implements OnInit {
if(lower > higer){ if(lower > higer){
details.controls.estimate_net_loss.setValue(higer!= Infinity ? higer.toFixed(2):0); details.controls.estimate_net_loss.setValue(higer!= Infinity ? higer.toFixed(2):0);
let loss_percent = (higer/sales_average)*100; let loss_percent = (+higer/+sales_average)*100;
details.controls.estimate_net_loss_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0); details.controls.estimate_net_loss_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0);
this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(higer)); this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(higer));
} }
else{ else{
details.controls.estimate_net_loss.setValue(lower!= Infinity ? lower.toFixed(2):0); details.controls.estimate_net_loss.setValue(lower!= Infinity ? lower.toFixed(2):0);
let loss_percent = (lower/sales_average)*100; let loss_percent = (+lower/+sales_average)*100;
details.controls.estimate_net_profit_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0); details.controls.estimate_net_profit_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0);
this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(lower)); this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(lower));
} }
@ -1539,13 +1544,13 @@ export class FinancialInfoComponent implements OnInit {
} }
if(lower > higer){ if(lower > higer){
details.controls.estimate_net_loss.setValue(higer!= Infinity ? higer.toFixed(2):0); details.controls.estimate_net_loss.setValue(higer!= Infinity ? higer.toFixed(2):0);
let loss_percent = (higer/sales_average)*100; let loss_percent = (higer/+sales_average)*100;
details.controls.estimate_net_loss_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0); details.controls.estimate_net_loss_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0);
this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(higer)); this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(higer));
} }
else{ else{
details.controls.estimate_net_loss.setValue(lower!= Infinity ? lower.toFixed(2):0); details.controls.estimate_net_loss.setValue(lower!= Infinity ? lower.toFixed(2):0);
let loss_percent = (lower/sales_average)*100; let loss_percent = (+lower/+sales_average)*100;
details.controls.estimate_net_loss_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0); details.controls.estimate_net_loss_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0);
this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(lower)); this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(lower));
} }
@ -1555,13 +1560,13 @@ export class FinancialInfoComponent implements OnInit {
details.controls.estimate_net_loss_to.setValue(estimate_net_loss_to!= Infinity ? estimate_net_loss_to:0); details.controls.estimate_net_loss_to.setValue(estimate_net_loss_to!= Infinity ? estimate_net_loss_to:0);
if(lower > higer){ if(lower > higer){
details.controls.estimate_net_loss.setValue(higer!= Infinity ? higer.toFixed(2):0); details.controls.estimate_net_loss.setValue(higer!= Infinity ? higer.toFixed(2):0);
let loss_percent = (higer/sales_average)*100; let loss_percent = (+higer/+sales_average)*100;
details.controls.estimate_net_loss_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0); details.controls.estimate_net_loss_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0);
this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(higer)); this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(higer));
} }
else{ else{
details.controls.estimate_net_loss.setValue(lower!= Infinity ? lower.toFixed(2):0); details.controls.estimate_net_loss.setValue(lower!= Infinity ? lower.toFixed(2):0);
let loss_percent = (lower/sales_average)*100; let loss_percent = (+lower/+sales_average)*100;
details.controls.estimate_net_loss_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0); details.controls.estimate_net_loss_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0);
this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(lower)); this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(lower));
} }