changes:ps
This commit is contained in:
parent
478ab33168
commit
1a91860749
@ -58,11 +58,18 @@
|
||||
|
||||
<div *ngIf="addressForm.controls.locality.value == 1" fxFlex="33">
|
||||
<mat-form-field style="width: 80%;">
|
||||
<input matInput placeholder="Specify Locality"
|
||||
formControlName="locality_others" autocomplete="off">
|
||||
<input matInput placeholder="Specify Locality" formControlName="locality_others" autocomplete="off">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div *ngIf="addressForm.controls.locality.value == 5" fxFlex="33">
|
||||
<mat-form-field style="width: 80%;">
|
||||
<input matInput placeholder="Specify the MixUse"
|
||||
formControlName="locality_mixuse" autocomplete="off">
|
||||
<mat-error>requried</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div fxFlex="33">
|
||||
<mat-form-field style="width: 80%;">
|
||||
<mat-select placeholder="Approach to PD Location" formControlName="pd_location" required>
|
||||
|
||||
@ -224,6 +224,7 @@ export class AddressComponent implements OnInit {
|
||||
address_type_others: [''],
|
||||
locality: ['', Validators.compose([Validators.required])],
|
||||
locality_others: [''],
|
||||
locality_mixuse:[''],
|
||||
pd_location: ['', Validators.compose([Validators.required])],
|
||||
comment_locality: ['', Validators.compose([Validators.required])],
|
||||
other_comment_locality : [''],
|
||||
@ -368,6 +369,19 @@ export class AddressComponent implements OnInit {
|
||||
|
||||
onSubmit() {
|
||||
|
||||
if (this.addressForm.controls.address_type.value == 1) {
|
||||
this.addressForm.controls['address_type_others'].setValidators([Validators.required]);
|
||||
this.addressForm.controls['address_type_others'].updateValueAndValidity();
|
||||
}
|
||||
if (this.addressForm.controls.locality.value == 1) {
|
||||
this.addressForm.controls['locality_others'].setValidators([Validators.required]);
|
||||
this.addressForm.controls['locality_others'].updateValueAndValidity();
|
||||
}
|
||||
if (this.addressForm.controls.locality.value == 5) {
|
||||
this.addressForm.controls['locality_mixuse'].setValidators([Validators.required]);
|
||||
this.addressForm.controls['locality_mixuse'].updateValueAndValidity();
|
||||
}
|
||||
|
||||
if (!this.addressForm.valid) {
|
||||
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
|
||||
return;
|
||||
@ -389,6 +403,9 @@ export class AddressComponent implements OnInit {
|
||||
if (this.locality.value == 1) {
|
||||
records.locality_others = this.addressForm.controls.locality_others.value;
|
||||
}
|
||||
if(this.locality.value == 5){
|
||||
records.locality_mixuse = this.addressForm.controls.locality_mixuse.value;
|
||||
}
|
||||
records.pd_location = this.pdLocation.value;
|
||||
records.comment_locality = this.commentlocality.value;
|
||||
records.other_comment_locality = this.other_comment_locality.value;
|
||||
@ -446,6 +463,8 @@ export class AddressComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
ConvertMonthintoYear(e){
|
||||
|
||||
let business_year = this.addressForm.controls.business_years.value;
|
||||
|
||||
@ -176,7 +176,8 @@
|
||||
|
||||
</div>
|
||||
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<mat-form-field style="width:40%">
|
||||
|
||||
<mat-form-field style="width:40%" *ngIf="detail.get('investments_type').value == 1 || detail.get('investments_type').value == 2 || detail.get('investments_type').value == 3">
|
||||
<input matInput placeholder="Bank Name" formControlName="bank_name" autocomplete="off">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Add More" matTooltipPosition="above" (click)="addMoreApplicant()" *ngIf="!EditFlag" ><mat-icon>add</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Add More" matTooltipPosition="above" (click)="addMoreApplicant()"><mat-icon>add</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Save" matTooltipPosition="above" (click)="saveApplicant(_OtherForm.value)"><mat-icon>save</mat-icon></button>
|
||||
</mat-dialog-actions>
|
||||
|
||||
|
||||
@ -15,30 +15,22 @@ export class OtherApplicantDetailsComponent implements OnInit {
|
||||
applicantInfo:any={'pd_co_applicant_id':"0",'applicant_name':'','is_applicant':false,'is_person_met':false, applicant_title_name:'',age:'', qualification:'',course_name:''};
|
||||
titleList: any=[];
|
||||
qualificationList: any=[];
|
||||
EditGeneralFormData: any=[];
|
||||
EditFlag: boolean = false;
|
||||
//EditGeneralFormData: any=[];
|
||||
//EditFlag: boolean = false;
|
||||
|
||||
constructor(private _fb: FormBuilder,
|
||||
private _pd: PdTrigerService,
|
||||
@Inject(MAT_DIALOG_DATA) public generalFormData : any,
|
||||
private dialogRef: MatDialogRef<OtherApplicantDetailsComponent>) {
|
||||
if(generalFormData != ''){
|
||||
this.EditGeneralFormData = generalFormData.value;
|
||||
this.EditFlag = true;
|
||||
}
|
||||
console.log(this.EditGeneralFormData);
|
||||
// if(generalFormData != ''){
|
||||
// this.EditGeneralFormData = generalFormData.value;
|
||||
// this.EditFlag = true;
|
||||
// }
|
||||
// console.log(this.EditGeneralFormData);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
if(!this.EditFlag){
|
||||
console.log('init if',this.EditGeneralFormData);
|
||||
this.initFormDetails(null);
|
||||
}
|
||||
else{
|
||||
console.log('init else',this.EditGeneralFormData);
|
||||
this.initFormDetails(this.EditGeneralFormData);
|
||||
}
|
||||
this.initFormDetails(null);
|
||||
this.getMasterDetails('TITLES',1);
|
||||
this.getMasterDetails('EDUQUALIFICATION',2);
|
||||
}
|
||||
@ -60,24 +52,15 @@ export class OtherApplicantDetailsComponent implements OnInit {
|
||||
|
||||
// init form
|
||||
initFormDetails(data : any) {
|
||||
console.log('data',data);
|
||||
if(data == null){
|
||||
console.log('if data',data);
|
||||
this._OtherForm = this._fb.group({
|
||||
applicant_list: this._fb.array([this.createApplicant(this.applicantInfo)]),
|
||||
});
|
||||
}
|
||||
else{
|
||||
console.log('else data',data);
|
||||
this._OtherForm = this._fb.group({
|
||||
applicant_list: this._fb.array([this.updateApplicant(this.EditGeneralFormData)]),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// create applicant form array
|
||||
createApplicant(elementValue:any){
|
||||
console.log("create applicants",elementValue);
|
||||
return this._fb.group({
|
||||
pd_co_applicant_id: [elementValue.pd_co_applicant_id],
|
||||
applicant_title_name: [elementValue.applicant_title_name, Validators.required],
|
||||
@ -90,20 +73,6 @@ createApplicant(elementValue:any){
|
||||
});
|
||||
}
|
||||
|
||||
updateApplicant(elementValue:any){
|
||||
console.log("update applicants",elementValue);
|
||||
return this._fb.group({
|
||||
pd_co_applicant_id: [elementValue.pd_co_applicant_id],
|
||||
applicant_title_name: [elementValue.applicant_title_name, Validators.required],
|
||||
applicant_name:[elementValue.applicant_name,Validators.required],
|
||||
is_applicant:[elementValue.is_applicant ? true : false],
|
||||
is_person_met:[elementValue.is_person_met ? true : false],
|
||||
age:[elementValue.age || ''],
|
||||
qualification: [elementValue.qualification || ''],
|
||||
course_name:[elementValue.course_name || '']
|
||||
});
|
||||
}
|
||||
|
||||
// add more
|
||||
addMoreApplicant(){
|
||||
if (this._OtherForm.invalid) {
|
||||
|
||||
@ -361,7 +361,7 @@
|
||||
<div formArrayName="family_members_details">
|
||||
<div *ngFor="let item of sup.controls.family_members_details['controls']; let i=index; let last=last " [formGroupName]="i">
|
||||
<mat-card>
|
||||
<h5>Address Details of {{FamilyMemberAsLabel[ix]}}</h5>
|
||||
<h5>Family Details of {{FamilyMemberAsLabel[ix]}}</h5>
|
||||
<div>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Name" formControlName="family_member_name" required>
|
||||
|
||||
@ -241,10 +241,10 @@
|
||||
</mat-form-field> -->
|
||||
<div style="width:100%" *ngIf="details.get('estimate_profit_or_loss').value == 1 && details.get('estimate_net_margin_availablity').value == 'yes' ">
|
||||
<mat-form-field style="width:25%">
|
||||
<input matInput autocomplete="off" placeholder="Net Profit From" formControlName="estimate_profit_range_from" type="number" (change)="calculateMarginProfit( i, details);" readonly>
|
||||
<input matInput autocomplete="off" placeholder="Net Profit % From" formControlName="estimate_profit_range_from" type="number" min='0' max='100' (change)="calculateMarginProfit( i, details);">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:25%">
|
||||
<input matInput autocomplete="off" placeholder="Net Profit To" formControlName="estimate_profit_range_to" type="number" (change)="calculateMarginProfit( i, details);" readonly>
|
||||
<input matInput autocomplete="off" placeholder="Net Profit % To" formControlName="estimate_profit_range_to" type="number" min='0' max='100' (change)="calculateMarginProfit( i, details);">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:25%">
|
||||
<input matInput autocomplete="off" placeholder="Considered Margin Profit %" formControlName="estimate_profit_margin_percent" type="number" readonly>
|
||||
@ -272,10 +272,10 @@
|
||||
<!-- <span *ngIf="details.get('estimate_profit_or_loss').value == 2 "> -->
|
||||
<div style="width:100%" *ngIf="details.get('estimate_profit_or_loss').value == 2 && details.get('estimate_net_margin_availablity').value == 'yes' ">
|
||||
<mat-form-field style="width:25%">
|
||||
<input matInput autocomplete="off" placeholder="Net Loss From" formControlName="estimate_loss_range_from" type="number" (change)="calculateMarginLoss( i, details);">
|
||||
<input matInput autocomplete="off" placeholder="Net Loss % From" formControlName="estimate_loss_range_from" min='0' max='100' type="number" (change)="calculateMarginLoss( i, details);">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:25%">
|
||||
<input matInput autocomplete="off" placeholder="Net Loss To" formControlName="estimate_loss_range_to" type="number" (change)="calculateMarginLoss( i, details);">
|
||||
<input matInput autocomplete="off" placeholder="Net Loss % To" formControlName="estimate_loss_range_to" min='0' max='100' type="number" (change)="calculateMarginLoss( i, details);">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:25%">
|
||||
<input matInput autocomplete="off" placeholder="Considered Margin Loss %" formControlName="estimate_loss_margin_percent" type="number" readonly>
|
||||
|
||||
@ -205,9 +205,6 @@ export class FinancialInfoComponent implements OnInit {
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** CREATING financial Statement ( financial_year AutoGenerate ) */
|
||||
createDate(date) {
|
||||
return this.fb.group({
|
||||
@ -418,7 +415,7 @@ export class FinancialInfoComponent implements OnInit {
|
||||
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.toFixed(2));
|
||||
detail.controls.financial_annualsales_variation.setValue(annual_sale_variation!= Infinity ? annual_sale_variation.toFixed(2):0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -429,7 +426,7 @@ export class FinancialInfoComponent implements OnInit {
|
||||
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.toFixed(2));
|
||||
detail.controls.estimate_annualsales_variation.setValue(annual_sale_variation!= Infinity ? annual_sale_variation.toFixed(2):0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -464,7 +461,7 @@ export class FinancialInfoComponent implements OnInit {
|
||||
|
||||
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.toFixed(2));
|
||||
detail.controls.financial_variation.setValue(variation!= Infinity ? variation.toFixed(2):0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -508,7 +505,7 @@ export class FinancialInfoComponent implements OnInit {
|
||||
}
|
||||
else{
|
||||
profit_margin = (profit / salary) * 100;
|
||||
detail.controls.financial_margin_of_profit.setValue(profit_margin.toFixed(2));
|
||||
detail.controls.financial_margin_of_profit.setValue(profit_margin!= Infinity ? profit_margin.toFixed(2):0);
|
||||
}
|
||||
|
||||
}
|
||||
@ -528,7 +525,7 @@ export class FinancialInfoComponent implements OnInit {
|
||||
}
|
||||
else{
|
||||
loss_margin = (loss / salary) * 100 * (-1);
|
||||
detail.controls.financial_margin_of_loss.setValue(loss_margin.toFixed(2));
|
||||
detail.controls.financial_margin_of_loss.setValue(loss_margin != Infinity ? loss_margin.toFixed(2): 0);
|
||||
// detail.controls.financial_margin.disable()
|
||||
}
|
||||
}
|
||||
@ -582,7 +579,7 @@ export class FinancialInfoComponent implements OnInit {
|
||||
|
||||
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.toFixed(2));
|
||||
detail.controls.estimate_variation.setValue(variation!= Infinity ? variation.toFixed(2) : 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -598,7 +595,7 @@ export class FinancialInfoComponent implements OnInit {
|
||||
|
||||
if (salary != '' && profit != '') {
|
||||
let margin = profit / salary * 100;
|
||||
detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2));
|
||||
detail.controls.estimate_margin_of_profit.setValue(margin!= Infinity ? margin.toFixed(2):0);
|
||||
}
|
||||
}
|
||||
else if (detail.value.estimate_profit_or_loss == 2){
|
||||
@ -606,7 +603,7 @@ export class FinancialInfoComponent implements OnInit {
|
||||
let loss = detail.value.estimate_net_loss;
|
||||
if (salary != '' && loss != '') {
|
||||
let margin = (loss / salary) * 100 * (-1);
|
||||
detail.controls.estimate_margin_of_loss.setValue(margin.toFixed(2));
|
||||
detail.controls.estimate_margin_of_loss.setValue(margin!= Infinity ? margin.toFixed(2):0);
|
||||
|
||||
}
|
||||
}
|
||||
@ -619,7 +616,7 @@ export class FinancialInfoComponent implements OnInit {
|
||||
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.toFixed(2));
|
||||
detail.controls.estimate_net_profit.setValue(profit!= Infinity ? profit.toFixed(2):0);
|
||||
this.AV_netProfitAmtInwords[i] = this._pd.convertNumberToWords(profit);
|
||||
|
||||
}
|
||||
@ -628,7 +625,7 @@ export class FinancialInfoComponent implements OnInit {
|
||||
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.toFixed(2));
|
||||
detail.controls.estimate_net_loss.setValue(loss!= Infinity ? loss.toFixed(2):0);
|
||||
this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(loss);
|
||||
}
|
||||
}
|
||||
@ -641,6 +638,13 @@ export class FinancialInfoComponent implements OnInit {
|
||||
|
||||
if (estimate_sales_from != null && estimate_sales_to != null){
|
||||
|
||||
if(+estimate_sales_from>+estimate_sales_to){
|
||||
alert("Given To value is lower than From Value");
|
||||
details.controls.estimate_sales_to.setValue('');
|
||||
details.controls.estimate_sales_average.setValue('');
|
||||
return;
|
||||
}
|
||||
|
||||
let C = (estimate_sales_to - estimate_sales_from)
|
||||
let D = (C / estimate_sales_from) * 100;
|
||||
|
||||
@ -648,46 +652,46 @@ export class FinancialInfoComponent implements OnInit {
|
||||
if(D >= 20){
|
||||
var r = confirm("Given Sales Range is greater than 20%");
|
||||
if (r == true) {
|
||||
details.controls.estimate_sales_to.setValue(estimate_sales_to);
|
||||
details.controls.estimate_sales_to.setValue(estimate_sales_to!= Infinity ? estimate_sales_to:0);
|
||||
}else{
|
||||
details.controls.estimate_sales_to.setValue('');
|
||||
return;
|
||||
}
|
||||
}
|
||||
else{
|
||||
details.controls.estimate_sales_to.setValue(estimate_sales_to);
|
||||
details.controls.estimate_sales_to.setValue(estimate_sales_to!= Infinity ? estimate_sales_to:0);
|
||||
}
|
||||
}
|
||||
else if(estimate_sales_from > 5000000 || estimate_sales_from <= 10000000){
|
||||
if(D >= 15){
|
||||
var r = confirm("Given Sales Range is greater than 15%");
|
||||
if (r == true) {
|
||||
details.controls.estimate_sales_to.setValue(estimate_sales_to);
|
||||
details.controls.estimate_sales_to.setValue(estimate_sales_to!= Infinity ? estimate_sales_to:0);
|
||||
}else{
|
||||
details.controls.estimate_sales_to.setValue('');
|
||||
return;
|
||||
}
|
||||
}
|
||||
else{
|
||||
details.controls.estimate_sales_to.setValue(estimate_sales_to);
|
||||
details.controls.estimate_sales_to.setValue(estimate_sales_to!= Infinity ? estimate_sales_to:0);
|
||||
}
|
||||
}
|
||||
else if(estimate_sales_from > 10000000){
|
||||
if(D >= 10){
|
||||
var r = confirm("Given Sales Range is greater than 10%");
|
||||
if (r == true) {
|
||||
details.controls.estimate_sales_to.setValue(estimate_sales_to);
|
||||
details.controls.estimate_sales_to.setValue(estimate_sales_to!= Infinity ? estimate_sales_to:0);
|
||||
}else{
|
||||
details.controls.estimate_sales_to.setValue('');
|
||||
return;
|
||||
}
|
||||
}
|
||||
else{
|
||||
details.controls.estimate_sales_to.setValue(estimate_sales_to);
|
||||
details.controls.estimate_sales_to.setValue(estimate_sales_to!= Infinity ? estimate_sales_to:0);
|
||||
}
|
||||
}
|
||||
else{
|
||||
details.controls.estimate_sales_to.setValue(estimate_sales_to);
|
||||
details.controls.estimate_sales_to.setValue(estimate_sales_to!= Infinity ? estimate_sales_to:0);
|
||||
}
|
||||
|
||||
// if(D >= 30){
|
||||
@ -719,11 +723,11 @@ export class FinancialInfoComponent implements OnInit {
|
||||
let higer = ((+estimate_sales_to + +estimate_sales_from) / 2);
|
||||
|
||||
if(lower > higer){
|
||||
details.controls.estimate_sales_average.setValue(higer.toFixed(2));
|
||||
details.controls.estimate_sales_average.setValue(higer!= Infinity ? higer.toFixed(2):0);
|
||||
this.AV_SalesInwords[i] = this._pd.convertNumberToWords(Math.round(higer));
|
||||
}
|
||||
else{
|
||||
details.controls.estimate_sales_average.setValue(lower.toFixed(2));
|
||||
details.controls.estimate_sales_average.setValue(lower!= Infinity ? lower.toFixed(2):0);
|
||||
this.AV_SalesInwords[i] = this._pd.convertNumberToWords(Math.round(lower));
|
||||
}
|
||||
|
||||
@ -737,19 +741,55 @@ export class FinancialInfoComponent implements OnInit {
|
||||
calculateMarginProfit( i, details){
|
||||
|
||||
let sales_average = details.value.estimate_sales_average;
|
||||
if(sales_average == ''){
|
||||
alert("Considered Sales Average is Empty");
|
||||
details.controls.estimate_profit_range_from.setValue('');
|
||||
details.controls.estimate_profit_range_to.setValue('');
|
||||
details.controls.estimate_profit_margin.setValue('');
|
||||
details.controls.estimate_profit_margin_percent.setValue('');
|
||||
return;
|
||||
}
|
||||
let estimate_profit_range_from = details.value.estimate_profit_range_from;
|
||||
if(+estimate_profit_range_from > 100){
|
||||
alert('Given Profit percent is More Than 100');
|
||||
details.controls.estimate_profit_range_from.setValue('');
|
||||
details.controls.estimate_profit_range_to.setValue('');
|
||||
details.controls.estimate_profit_margin.setValue('');
|
||||
details.controls.estimate_profit_margin_percent.setValue('');
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
let estimate_profit_range_to = details.value.estimate_profit_range_to;
|
||||
|
||||
if(+estimate_profit_range_to > 100){
|
||||
alert('Given Profit percent is More Than 100');
|
||||
details.controls.estimate_profit_range_to.setValue('');
|
||||
details.controls.estimate_profit_margin.setValue('');
|
||||
details.controls.estimate_profit_margin_percent.setValue('');
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (sales_average != '' && estimate_profit_range_from != '' && estimate_profit_range_to != ''){
|
||||
if(+estimate_profit_range_from>+estimate_profit_range_to){
|
||||
alert("Given To value is lower than From Value");
|
||||
details.controls.estimate_profit_range_to.setValue('');
|
||||
details.controls.estimate_profit_margin.setValue('');
|
||||
details.controls.estimate_profit_margin_percent.setValue('');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
let profit_percent = (estimate_profit_range_to + estimate_profit_range_from)/2;
|
||||
let Profit_Average = (profit_percent*sales_average)/100;
|
||||
let difference = (estimate_profit_range_to - estimate_profit_range_from);
|
||||
|
||||
if(Profit_Average >= 3){
|
||||
var r = confirm("Given Profit Range is greater than 3%");
|
||||
if(difference > 3){
|
||||
var r = confirm("Given Profit Percent Range is greater than 3");
|
||||
if (r == true) {
|
||||
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.setValue(Profit_Average!= Infinity ? Math.round(Profit_Average):0);
|
||||
details.controls.estimate_profit_margin_percent.setValue(profit_percent!= Infinity ? profit_percent.toFixed(2):0);
|
||||
this.AV_marginProfitAmtInwords[i] = this._pd.convertNumberToWords(Math.round(Profit_Average));
|
||||
}else{
|
||||
details.controls.estimate_profit_range_to.setValue('');
|
||||
@ -758,10 +798,10 @@ export class FinancialInfoComponent implements OnInit {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else{
|
||||
alert('else part');
|
||||
}
|
||||
|
||||
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);
|
||||
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_percent.setValue(profit_percent.toFixed(2));
|
||||
|
||||
@ -774,38 +814,149 @@ export class FinancialInfoComponent implements OnInit {
|
||||
calculateProfitAmount( i, details){
|
||||
|
||||
let sales_average = details.value.estimate_sales_average;
|
||||
if(sales_average == ''){
|
||||
alert("Considered Sales Average is Empty");
|
||||
details.controls.estimate_net_profit_from.setValue('');
|
||||
details.controls.estimate_net_profit_to.setValue('');
|
||||
details.controls.estimate_net_profit.setValue('');
|
||||
details.controls.estimate_net_profit_percent.setValue('');
|
||||
return;
|
||||
}
|
||||
|
||||
let estimate_net_profit_from = details.value.estimate_net_profit_from;
|
||||
let estimate_net_profit_to = details.value.estimate_net_profit_to;
|
||||
|
||||
if(+estimate_net_profit_to>+sales_average){
|
||||
|
||||
alert("Given Profit is Greater than Sales");
|
||||
details.controls.estimate_net_profit_from.setValue('');
|
||||
details.controls.estimate_net_profit_to.setValue('');
|
||||
details.controls.estimate_net_profit.setValue('');
|
||||
details.controls.estimate_net_profit_percent.setValue('');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (sales_average != '' && estimate_net_profit_from != '' && estimate_net_profit_to != ''){
|
||||
if(+estimate_net_profit_from>+estimate_net_profit_to){
|
||||
alert("Given To value is lower than From Value");
|
||||
details.controls.estimate_net_profit_to.setValue('');
|
||||
details.controls.estimate_net_profit.setValue('');
|
||||
details.controls.estimate_net_profit_percent.setValue('');
|
||||
return;
|
||||
}
|
||||
|
||||
let profit_amount = (estimate_net_profit_to + estimate_net_profit_from)/2;
|
||||
let Profit_percent = (profit_amount/sales_average)*100;
|
||||
let C = (estimate_net_profit_to - estimate_net_profit_from)
|
||||
let D = (C / estimate_net_profit_from) * 100;
|
||||
|
||||
// details.controls.estimate_net_profit.setValue(Math.round(profit_amount));
|
||||
// details.controls.estimate_net_profit_percent.setValue(Profit_percent.toFixed(2));
|
||||
let range1 = +estimate_net_profit_from/10;
|
||||
|
||||
// this.AV_netProfitAmtInwords[i] = this._pd.convertNumberToWords(Math.round(profit_amount));
|
||||
if(Profit_percent >= 3){
|
||||
var r = confirm("Given Profit Percentage is greater than 3%");
|
||||
let lower = (+estimate_net_profit_from)+range1;
|
||||
let higer = ((+estimate_net_profit_to + +estimate_net_profit_from) / 2);
|
||||
|
||||
if(estimate_net_profit_from <= 5000000){
|
||||
if(D >= 20){
|
||||
var r = confirm("Given Profit Range is greater than 20%");
|
||||
if (r == true) {
|
||||
|
||||
details.controls.estimate_net_profit.setValue(Math.round(profit_amount));
|
||||
details.controls.estimate_net_profit_percent.setValue(Profit_percent.toFixed(2));
|
||||
this.AV_netProfitAmtInwords[i] = this._pd.convertNumberToWords(Math.round(profit_amount));
|
||||
|
||||
details.controls.estimate_net_profit_to.setValue(estimate_net_profit_to!= Infinity ? estimate_net_profit_to:0);
|
||||
}else{
|
||||
|
||||
details.controls.estimate_net_profit_to.setValue('');
|
||||
details.controls.estimate_net_profit.setValue('');
|
||||
details.controls.estimate_net_profit_percent.setValue('');
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
details.controls.estimate_net_profit_to.setValue(estimate_net_profit_to!= Infinity ? estimate_net_profit_to:0);
|
||||
}
|
||||
|
||||
if(lower > higer){
|
||||
details.controls.estimate_net_profit.setValue(higer!= Infinity ? higer.toFixed(2):0);
|
||||
let Profit_percent = (higer/sales_average)*100;
|
||||
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));
|
||||
}
|
||||
else{
|
||||
details.controls.estimate_net_profit.setValue(lower!= Infinity ? lower.toFixed(2):0);
|
||||
let Profit_percent = (lower/sales_average)*100;
|
||||
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));
|
||||
}
|
||||
}
|
||||
else if(estimate_net_profit_from > 5000000 || estimate_net_profit_from <= 10000000){
|
||||
if(D >= 15){
|
||||
var r = confirm("Given Sales Range is greater than 15%");
|
||||
if (r == true) {
|
||||
details.controls.estimate_net_profit_to.setValue(estimate_net_profit_to!= Infinity ? estimate_net_profit_to:0);
|
||||
|
||||
}else{
|
||||
details.controls.estimate_net_profit_to.setValue('');
|
||||
details.controls.estimate_net_profit.setValue('');
|
||||
details.controls.estimate_net_profit_percent.setValue('');
|
||||
return;
|
||||
}
|
||||
}
|
||||
else{
|
||||
details.controls.estimate_net_profit_to.setValue(estimate_net_profit_to!= Infinity ? estimate_net_profit_to:0);
|
||||
}
|
||||
|
||||
if(lower > higer){
|
||||
details.controls.estimate_net_profit.setValue(higer!= Infinity ? higer.toFixed(2):0);
|
||||
let Profit_percent = (higer/sales_average)*100;
|
||||
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));
|
||||
}
|
||||
else{
|
||||
details.controls.estimate_net_profit.setValue(lower!= Infinity ? lower.toFixed(2):0);
|
||||
let Profit_percent = (lower/sales_average)*100;
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
else if(estimate_net_profit_from > 10000000){
|
||||
if(D >= 10){
|
||||
var r = confirm("Given Sales Range is greater than 10%");
|
||||
if (r == true) {
|
||||
details.controls.estimate_net_profit_to.setValue(estimate_net_profit_to!= Infinity ? estimate_net_profit_to:0);
|
||||
}else{
|
||||
details.controls.estimate_net_profit_to.setValue('');
|
||||
details.controls.estimate_net_profit.setValue('');
|
||||
details.controls.estimate_net_profit_percent.setValue('');
|
||||
return;
|
||||
}
|
||||
}
|
||||
else{
|
||||
details.controls.estimate_net_profit_to.setValue(estimate_net_profit_to!= Infinity ? estimate_net_profit_to:0);
|
||||
}
|
||||
|
||||
if(lower > higer){
|
||||
details.controls.estimate_net_profit.setValue(higer!= Infinity ? higer.toFixed(2):0);
|
||||
let Profit_percent = (higer/sales_average)*100;
|
||||
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));
|
||||
}
|
||||
else{
|
||||
details.controls.estimate_net_profit.setValue(lower!= Infinity ? lower.toFixed(2):0);
|
||||
let Profit_percent = (lower/sales_average)*100;
|
||||
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));
|
||||
}
|
||||
}
|
||||
else{
|
||||
alert('else part');
|
||||
details.controls.estimate_net_profit_to.setValue(estimate_net_profit_to!= Infinity ? estimate_net_profit_to:0);
|
||||
if(lower > higer){
|
||||
details.controls.estimate_net_profit.setValue(higer!= Infinity ? higer.toFixed(2):0);
|
||||
let Profit_percent = (higer/sales_average)*100;
|
||||
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));
|
||||
}
|
||||
else{
|
||||
details.controls.estimate_net_profit.setValue(lower!= Infinity ? lower.toFixed(2):0);
|
||||
let Profit_percent = (lower/sales_average)*100;
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -815,24 +966,62 @@ export class FinancialInfoComponent implements OnInit {
|
||||
calculateMarginLoss( i, details){
|
||||
|
||||
let sales_average = details.value.estimate_sales_average;
|
||||
if(sales_average == ''){
|
||||
alert("Considered Sales Average is Empty");
|
||||
details.controls.estimate_loss_range_from.setValue('');
|
||||
details.controls.estimate_loss_range_to.setValue('');
|
||||
details.controls.estimate_loss_margin.setValue('');
|
||||
details.controls.estimate_loss_margin_percent.setValue('');
|
||||
return;
|
||||
}
|
||||
// else{
|
||||
let estimate_loss_range_from = details.value.estimate_loss_range_from;
|
||||
if(+estimate_loss_range_from > 100){
|
||||
alert('Given Loss Percent is more than 100');
|
||||
details.controls.estimate_loss_range_from.setValue('');
|
||||
details.controls.estimate_loss_range_to.setValue('');
|
||||
details.controls.estimate_loss_margin.setValue('');
|
||||
details.controls.estimate_loss_margin_percent.setValue('');
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
let estimate_loss_range_to = details.value.estimate_loss_range_to;
|
||||
if(+estimate_loss_range_to > 100){
|
||||
alert('Given Loss Percent is more than 100');
|
||||
details.controls.estimate_loss_range_from.setValue('');
|
||||
details.controls.estimate_loss_range_to.setValue('');
|
||||
details.controls.estimate_loss_margin.setValue('');
|
||||
details.controls.estimate_loss_margin_percent.setValue('');
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (sales_average != '' && estimate_loss_range_from != '' && estimate_loss_range_to != ''){
|
||||
|
||||
if(+estimate_loss_range_from>+estimate_loss_range_to){
|
||||
alert("Given To value is lower than From Value");
|
||||
details.controls.estimate_loss_range_to.setValue('');
|
||||
details.controls.estimate_loss_margin.setValue('');
|
||||
details.controls.estimate_loss_margin_percent.setValue('');
|
||||
return;
|
||||
}
|
||||
|
||||
let loss_percent = (estimate_loss_range_to + estimate_loss_range_from)/2;
|
||||
let loss_Average = (loss_percent*sales_average)/100;
|
||||
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_percent.setValue(loss_percent.toFixed(2));
|
||||
|
||||
// this.AV_marginLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(loss_Average));
|
||||
|
||||
if(loss_Average >= 3){
|
||||
var r = confirm("Given Profit Range is greater than 3%");
|
||||
if(difference > 3){
|
||||
var r = confirm("Given Loss Percent Range is greater than 3");
|
||||
if (r == true) {
|
||||
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.setValue(loss_Average!= Infinity ? Math.round(loss_Average):0);
|
||||
details.controls.estimate_loss_margin_percent.setValue(loss_percent!= Infinity ? loss_percent.toFixed(2):0);
|
||||
|
||||
this.AV_marginLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(loss_Average));
|
||||
}else{
|
||||
@ -842,70 +1031,234 @@ export class FinancialInfoComponent implements OnInit {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else{
|
||||
alert('else part');
|
||||
}
|
||||
|
||||
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);
|
||||
this.AV_marginLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(loss_Average));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
calculateLossAmount( i, details){
|
||||
|
||||
let sales_average = details.value.estimate_sales_average;
|
||||
if(sales_average == ''){
|
||||
alert("Considered Sales Average is Empty");
|
||||
details.controls.estimate_net_loss_from.setValue('');
|
||||
details.controls.estimate_net_loss_to.setValue('');
|
||||
details.controls.estimate_net_loss.setValue('');
|
||||
details.controls.estimate_net_loss_percent.setValue('');
|
||||
return;
|
||||
}
|
||||
|
||||
let estimate_net_loss_from = details.value.estimate_net_loss_from;
|
||||
let estimate_net_loss_to = details.value.estimate_net_loss_to;
|
||||
|
||||
if(+estimate_net_loss_to > +sales_average){
|
||||
|
||||
alert("Given Loss is Greater than Sales");
|
||||
details.controls.estimate_net_loss_from.setValue('');
|
||||
details.controls.estimate_net_loss_to.setValue('');
|
||||
details.controls.estimate_net_loss.setValue('');
|
||||
details.controls.estimate_net_loss_percent.setValue('');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (sales_average != '' && estimate_net_loss_from != '' && estimate_net_loss_to != ''){
|
||||
if(+estimate_net_loss_from > +estimate_net_loss_to){
|
||||
alert("Given To value is Lower than From Value");
|
||||
details.controls.estimate_net_loss_to.setValue('');
|
||||
details.controls.estimate_net_loss.setValue('');
|
||||
details.controls.estimate_net_loss_percent.setValue('');
|
||||
return;
|
||||
}
|
||||
|
||||
// let profit_percent = (estimate_net_profit_to - estimate_net_profit_from)/estimate_net_profit_from * 100;
|
||||
// let Profit_Average = (profit_percent*sales_average)/100;
|
||||
let loss_amount = (estimate_net_loss_to + estimate_net_loss_from)/2;
|
||||
let loss_percent = (loss_amount/sales_average)*100;
|
||||
|
||||
// details.controls.estimate_net_loss.setValue(Math.round(loss_amount));
|
||||
// details.controls.estimate_net_loss_percent.setValue(loss_percent.toFixed(2));
|
||||
|
||||
// this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(loss_amount));
|
||||
if(loss_percent >= 3){
|
||||
var r = confirm("Given Loss Percentage is greater than 3%");
|
||||
// if(+estimate_net_loss_to > +estimate_net_loss_from){
|
||||
// alert("loss is greater than sales");
|
||||
// details.controls.estimate_net_loss_to.setValue('');
|
||||
// details.controls.estimate_net_loss.setValue('');
|
||||
// details.controls.estimate_net_loss_percent.setValue('');
|
||||
// return;
|
||||
// }
|
||||
|
||||
|
||||
let C = (estimate_net_loss_to - estimate_net_loss_from)
|
||||
let D = (C / estimate_net_loss_from) * 100;
|
||||
|
||||
let range1 = +estimate_net_loss_from/10;
|
||||
|
||||
let lower = (+estimate_net_loss_from)+range1;
|
||||
let higer = ((+estimate_net_loss_to + +estimate_net_loss_from) / 2);
|
||||
|
||||
if(estimate_net_loss_from <= 5000000){
|
||||
if(D >= 20){
|
||||
var r = confirm("Given Profit Range is greater than 20%");
|
||||
if (r == true) {
|
||||
|
||||
details.controls.estimate_net_loss.setValue(Math.round(loss_amount));
|
||||
details.controls.estimate_net_loss_percent.setValue(loss_percent.toFixed(2));
|
||||
|
||||
this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(loss_amount));
|
||||
details.controls.estimate_net_loss_to.setValue(estimate_net_loss_to!= Infinity ? estimate_net_loss_to:0);
|
||||
|
||||
}else{
|
||||
|
||||
details.controls.estimate_net_loss_to.setValue('');
|
||||
details.controls.estimate_net_loss.setValue('');
|
||||
details.controls.estimate_net_loss_percent.setValue('');
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
details.controls.estimate_net_loss_to.setValue(estimate_net_loss_to!= Infinity ? estimate_net_loss_to:0);
|
||||
}
|
||||
|
||||
if(lower > higer){
|
||||
details.controls.estimate_net_loss.setValue(higer!= Infinity ? higer.toFixed(2):0);
|
||||
let loss_percent = (higer/sales_average)*100;
|
||||
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));
|
||||
}
|
||||
else{
|
||||
details.controls.estimate_net_loss.setValue(lower!= Infinity ? lower.toFixed(2):0);
|
||||
let loss_percent = (lower/sales_average)*100;
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
else if(estimate_net_loss_from > 5000000 || estimate_net_loss_from <= 10000000){
|
||||
if(D >= 15){
|
||||
var r = confirm("Given Sales Range is greater than 15%");
|
||||
if (r == true) {
|
||||
details.controls.estimate_net_loss_to.setValue(estimate_net_loss_to!= Infinity ? estimate_net_loss_to:0);
|
||||
}else{
|
||||
details.controls.estimate_net_loss_to.setValue('');
|
||||
details.controls.estimate_net_loss.setValue('');
|
||||
details.controls.estimate_net_loss_percent.setValue('');
|
||||
return;
|
||||
}
|
||||
}
|
||||
else{
|
||||
details.controls.estimate_net_loss_to.setValue(estimate_net_loss_to!= Infinity ? estimate_net_loss_to:0);
|
||||
}
|
||||
|
||||
if(lower > higer){
|
||||
details.controls.estimate_net_loss.setValue(higer!= Infinity ? higer.toFixed(2):0);
|
||||
let loss_percent = (higer/sales_average)*100;
|
||||
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));
|
||||
}
|
||||
else{
|
||||
details.controls.estimate_net_loss.setValue(lower!= Infinity ? lower.toFixed(2):0);
|
||||
let loss_percent = (lower/sales_average)*100;
|
||||
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));
|
||||
}
|
||||
}
|
||||
else if(estimate_net_loss_from > 10000000){
|
||||
if(D >= 10){
|
||||
var r = confirm("Given Sales Range is greater than 10%");
|
||||
if (r == true) {
|
||||
details.controls.estimate_net_loss_to.setValue(estimate_net_loss_to!= Infinity ? estimate_net_loss_to:0);
|
||||
}else{
|
||||
details.controls.estimate_net_loss_to.setValue('');
|
||||
details.controls.estimate_net_loss.setValue('');
|
||||
details.controls.estimate_net_loss_percent.setValue('');
|
||||
return;
|
||||
}
|
||||
}
|
||||
else{
|
||||
details.controls.estimate_net_loss_to.setValue(estimate_net_loss_to!= Infinity ? estimate_net_loss_to:0);
|
||||
|
||||
}
|
||||
if(lower > higer){
|
||||
details.controls.estimate_net_loss.setValue(higer!= Infinity ? higer.toFixed(2):0);
|
||||
let loss_percent = (higer/sales_average)*100;
|
||||
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));
|
||||
}
|
||||
else{
|
||||
details.controls.estimate_net_loss.setValue(lower!= Infinity ? lower.toFixed(2):0);
|
||||
let loss_percent = (lower/sales_average)*100;
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
alert('else part');
|
||||
details.controls.estimate_net_loss_to.setValue(estimate_net_loss_to!= Infinity ? estimate_net_loss_to:0);
|
||||
if(lower > higer){
|
||||
details.controls.estimate_net_loss.setValue(higer!= Infinity ? higer.toFixed(2):0);
|
||||
let loss_percent = (higer/sales_average)*100;
|
||||
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));
|
||||
}
|
||||
else{
|
||||
details.controls.estimate_net_loss.setValue(lower!= Infinity ? lower.toFixed(2):0);
|
||||
let loss_percent = (lower/sales_average)*100;
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// let estimate_net_profit_from = details.value.estimate_net_profit_from;
|
||||
// let estimate_net_profit_to = details.value.estimate_net_profit_to;
|
||||
|
||||
// if (estimate_net_profit_from != '' && estimate_net_profit_to != ''){
|
||||
// let AB = (estimate_net_profit_to + estimate_net_profit_from)/2;
|
||||
// let C = (estimate_net_profit_to - estimate_net_profit_from);
|
||||
// let D = (C / estimate_net_profit_from);
|
||||
// let E = D*100;
|
||||
|
||||
// details.controls.estimate_net_profit_percent.setValue(E);
|
||||
// details.controls.estimate_net_profit.setValue(AB);
|
||||
|
||||
// }
|
||||
}
|
||||
// calculateLossAmount( i, details){
|
||||
|
||||
// let sales_average = details.value.estimate_sales_average;
|
||||
|
||||
// let estimate_net_loss_from = details.value.estimate_net_loss_from;
|
||||
// let estimate_net_loss_to = details.value.estimate_net_loss_to;
|
||||
|
||||
// if (sales_average != '' && estimate_net_loss_from != '' && estimate_net_loss_to != ''){
|
||||
|
||||
// // let profit_percent = (estimate_net_profit_to - estimate_net_profit_from)/estimate_net_profit_from * 100;
|
||||
// // let Profit_Average = (profit_percent*sales_average)/100;
|
||||
// let loss_amount = (estimate_net_loss_to + estimate_net_loss_from)/2;
|
||||
// let loss_percent = (loss_amount/sales_average)*100;
|
||||
|
||||
// // details.controls.estimate_net_loss.setValue(Math.round(loss_amount));
|
||||
// // details.controls.estimate_net_loss_percent.setValue(loss_percent.toFixed(2));
|
||||
|
||||
// // this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(loss_amount));
|
||||
// if(loss_percent >= 3){
|
||||
// var r = confirm("Given Loss Percentage is greater than 3%");
|
||||
// if (r == true) {
|
||||
|
||||
// details.controls.estimate_net_loss.setValue(loss_amount!= Infinity ? Math.round(loss_amount):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(loss_amount));
|
||||
|
||||
// }else{
|
||||
|
||||
// details.controls.estimate_net_loss_to.setValue('');
|
||||
// details.controls.estimate_net_loss.setValue('');
|
||||
// details.controls.estimate_net_loss_percent.setValue('');
|
||||
// return;
|
||||
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// alert('else part');
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// // let estimate_net_profit_from = details.value.estimate_net_profit_from;
|
||||
// // let estimate_net_profit_to = details.value.estimate_net_profit_to;
|
||||
|
||||
// // if (estimate_net_profit_from != '' && estimate_net_profit_to != ''){
|
||||
// // let AB = (estimate_net_profit_to + estimate_net_profit_from)/2;
|
||||
// // let C = (estimate_net_profit_to - estimate_net_profit_from);
|
||||
// // let D = (C / estimate_net_profit_from);
|
||||
// // let E = D*100;
|
||||
|
||||
// // details.controls.estimate_net_profit_percent.setValue(E);
|
||||
// // details.controls.estimate_net_profit.setValue(AB);
|
||||
|
||||
// // }
|
||||
// }
|
||||
|
||||
submitDetails() {
|
||||
|
||||
|
||||
@ -19,7 +19,8 @@
|
||||
<ng-container matColumnDef="applicant_name">
|
||||
<mat-header-cell *matHeaderCellDef> Name </mat-header-cell>
|
||||
<mat-cell *matCellDef="let details;let i = index;" [formGroupName]="i">
|
||||
{{details.value.applicant_name | titlecase}}
|
||||
<input matInput placeholder="ApplicantName" formControlName="applicant_name" autocomplete="off">
|
||||
<!-- {{details.value.applicant_name | titlecase}} -->
|
||||
</mat-cell>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="is_person_met">
|
||||
@ -61,11 +62,11 @@
|
||||
<ng-container matColumnDef="actions">
|
||||
<mat-header-cell *matHeaderCellDef> </mat-header-cell>
|
||||
<mat-cell *matCellDef="let details;let i =index;">
|
||||
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="editIndividuals(details)"
|
||||
<!-- <button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="editIndividuals(details)"
|
||||
matTooltip="Edit " matTooltipPosition="below">
|
||||
<mat-icon>edit</mat-icon>
|
||||
</button>
|
||||
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeIndividuals(i)"
|
||||
</button> -->
|
||||
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeIndividuals(i,details)"
|
||||
matTooltip="Remove Individuals" matTooltipPosition="below">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
@ -257,7 +258,8 @@
|
||||
<mat-card-actions align="center">
|
||||
<button type="button" mat-flat-button (click)="addCompanyRelationshipDialogue()"
|
||||
matTooltip="Add More" matTooltipPosition="left" color="primary">
|
||||
<strong>Add Company Relationship</strong>
|
||||
<span *ngIf="_generalForm.controls.company_with_relationships['controls'].length>0"><strong>Add Company Relationship</strong></span>
|
||||
<span *ngIf="_generalForm.controls.company_with_relationships['controls'].length>1"><strong>Add More Company Relationship</strong></span>
|
||||
</button>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
|
||||
@ -455,26 +455,24 @@ export class GeneralInfoComponent implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
/** Popup for EDIT Individuals */
|
||||
editIndividuals(arr) {
|
||||
// remove individuals
|
||||
// removeIndividuals(findex){
|
||||
// let control = <FormArray>this._generalForm.controls['individuals'];
|
||||
// control.removeAt(findex);
|
||||
// }
|
||||
|
||||
console.log(arr);
|
||||
|
||||
const dialogRef = this.dialog.open(OtherApplicantDetailsComponent, {
|
||||
data: arr,
|
||||
width:'40%',
|
||||
disableClose: true
|
||||
});
|
||||
|
||||
dialogRef.afterClosed()
|
||||
.subscribe(dataresult => {
|
||||
});
|
||||
}
|
||||
|
||||
// remove individuals
|
||||
removeIndividuals(findex){
|
||||
let control = <FormArray>this._generalForm.controls['individuals'];
|
||||
control.removeAt(findex);
|
||||
removeIndividuals(findex,details){
|
||||
|
||||
let control = <FormArray>this._generalForm.controls['individuals'];
|
||||
control.removeAt(findex);
|
||||
|
||||
let controls = <FormArray>this._generalForm.controls['persons_with_relationships'];
|
||||
let name = details.value.applicant_name;
|
||||
let index1 = controls.value.map(data => data.applicant_name).indexOf(name);
|
||||
controls.removeAt(index1);
|
||||
|
||||
}
|
||||
|
||||
// update personal relation
|
||||
|
||||
@ -138,7 +138,6 @@ export class LoanDetailsComponent implements OnInit {
|
||||
return {id:element.company_order_id.toString(),name:element.company_name,group_id:1};
|
||||
});
|
||||
this.mergeCompanyApplicant.push({groupName:'COMPANIES',groupValues:modifyCompanyList})
|
||||
this.mergeCompanyApplicant.push({groupName:'COMPANIES',groupValues:[{id:0,name:'Not Yet Finalised',group_id:2}]})
|
||||
}
|
||||
|
||||
let modifyApplicantList: any=[];
|
||||
@ -150,6 +149,7 @@ export class LoanDetailsComponent implements OnInit {
|
||||
|
||||
// this.listOfLanguagues.splice(this.listOfLanguagues.indexOf(languague), 1);
|
||||
}
|
||||
this.mergeCompanyApplicant.push({groupName:'OTHERS',groupValues:[{id:0,name:'Not Yet Finalised',group_id:2}]})
|
||||
})
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user