all forms autoclose : ps
This commit is contained in:
parent
edef9f89be
commit
3ea3ca5a4a
@ -191,6 +191,7 @@ public m_investmentType = [];
|
|||||||
notifier: NotifierService,
|
notifier: NotifierService,
|
||||||
private _formBuilder: FormBuilder,
|
private _formBuilder: FormBuilder,
|
||||||
private pdTrigerService: PdTrigerService,
|
private pdTrigerService: PdTrigerService,
|
||||||
|
private dialogRef: MatDialogRef<AssetsInfoComponent>,
|
||||||
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
|
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
|
||||||
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
|
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
|
||||||
this.applicants = this.pd_all_details.pdapplicants_detials;
|
this.applicants = this.pd_all_details.pdapplicants_detials;
|
||||||
@ -1025,6 +1026,7 @@ public m_investmentType = [];
|
|||||||
|
|
||||||
// stop here if form is invalid
|
// stop here if form is invalid
|
||||||
if (this._assetsQuesFrom.invalid) {
|
if (this._assetsQuesFrom.invalid) {
|
||||||
|
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
var answerFormValues = this._assetsQuesFrom.value;
|
var answerFormValues = this._assetsQuesFrom.value;
|
||||||
@ -1034,14 +1036,15 @@ public m_investmentType = [];
|
|||||||
// Save the data with help of Service
|
// Save the data with help of Service
|
||||||
this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe(
|
this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe(
|
||||||
dataresult => {
|
dataresult => {
|
||||||
if (dataresult.status == 200) {
|
if(dataresult.status == 200) {
|
||||||
this.notifier.notify('success', 'Record Saved Successfully.!');
|
this.notifier.notify('success', 'Saved Successfully.');
|
||||||
// this.dialogRef.close();
|
setTimeout(() =>{
|
||||||
// alert("sample alert for Saving");
|
this.dialogRef.close();
|
||||||
}
|
},3000);
|
||||||
else {
|
}
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
else {
|
||||||
}
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
|
}
|
||||||
}, error => {
|
}, error => {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
// this.dialogRef.close();
|
// this.dialogRef.close();
|
||||||
|
|||||||
@ -49,6 +49,7 @@ export class BankingDetailsComponent implements OnInit {
|
|||||||
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
|
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private _pd: PdTrigerService,
|
private _pd: PdTrigerService,
|
||||||
|
private dialogRef: MatDialogRef<BankingDetailsComponent>,
|
||||||
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
|
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
|
||||||
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
|
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
|
||||||
this.pd_cus_segment = this.pd_all_details.pdmaster_details.customer_segment_abbr.toUpperCase();
|
this.pd_cus_segment = this.pd_all_details.pdmaster_details.customer_segment_abbr.toUpperCase();
|
||||||
@ -164,7 +165,7 @@ export class BankingDetailsComponent implements OnInit {
|
|||||||
getM_BTLenderList(){
|
getM_BTLenderList(){
|
||||||
this._pd.getAllMasterDatas('BTLENDERLIST').subscribe(
|
this._pd.getAllMasterDatas('BTLENDERLIST').subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.m_btLenderList = data.records.filter(data => data.isactive == 1);
|
this.m_btLenderList = data.records.filter(data => data.isactive == 1 && data.lender_type == 1);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,8 +227,16 @@ export class BankingDetailsComponent implements OnInit {
|
|||||||
records.banking_details = this.bankingForm.controls['itemRows'].value;
|
records.banking_details = this.bankingForm.controls['itemRows'].value;
|
||||||
// console.log('data', records);
|
// console.log('data', records);
|
||||||
this._pd.saveForm(records).subscribe(data => {
|
this._pd.saveForm(records).subscribe(data => {
|
||||||
// console.log('data', data);
|
if(data.status == 200) {
|
||||||
this.notifier.notify('success', 'Saved Successfully.');
|
this.notifier.notify('success', 'Saved Successfully.');
|
||||||
|
// this.dialogRef.close();
|
||||||
|
setTimeout(() =>{
|
||||||
|
this.dialogRef.close();
|
||||||
|
},3000);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
|
}
|
||||||
}, error => {
|
}, error => {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
});
|
});
|
||||||
|
|||||||
@ -36,52 +36,23 @@
|
|||||||
<div *ngFor="let details of currentLoanForm.get('loan_details').controls; let i=index; let last=last"
|
<div *ngFor="let details of currentLoanForm.get('loan_details').controls; let i=index; let last=last"
|
||||||
[formGroupName]="i">
|
[formGroupName]="i">
|
||||||
<!-- {{frequencyData | json}} -->
|
<!-- {{frequencyData | json}} -->
|
||||||
|
<!--
|
||||||
|
Loan type, Loan amount, Lender, Loan Taken By, Instalment Frequency, Instalment Amount, Original Tenure, Balance Tenure
|
||||||
|
-->
|
||||||
<mat-card-content class="matcard">
|
<mat-card-content class="matcard">
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-select placeholder="Loan Type" formControlName="loan_type" >
|
||||||
|
<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" > -->
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field *ngIf="details.get('loan_type').value == 1 ">
|
||||||
|
<input matInput autocomplete="off" placeholder="Specify Loan Type" formControlName="others_loan_type">
|
||||||
|
</mat-form-field>
|
||||||
<mat-form-field style="width:45%;">
|
<mat-form-field style="width:45%;">
|
||||||
<input matInput autocomplete="off" placeholder="Loan Amount" formControlName="loan_amount" (keypress)="keyPress($event)" (keyup)="inWords($event,i,1)">
|
<input matInput autocomplete="off" placeholder="Loan Amount" formControlName="loan_amount" (keypress)="keyPress($event)" (keyup)="inWords($event,i,1)">
|
||||||
<mat-hint my-mat-hint align="start" style="font-size:90%" *ngIf="details.get('loan_amount').value != ''">{{"₹"}} {{amtInwords[i]}} Only</mat-hint>
|
<mat-hint my-mat-hint align="start" style="font-size:90%" *ngIf="details.get('loan_amount').value != ''">{{"₹"}} {{amtInwords[i]}} Only</mat-hint>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width:45%;">
|
|
||||||
<mat-select placeholder="Frequency" (selectionChange)="selectedfrequency($event.value,i)"
|
|
||||||
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 == 7">
|
|
||||||
<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 != ''">{{"₹"}} {{emiAmtInwords[i]}} Only</mat-hint>
|
|
||||||
</mat-form-field>
|
|
||||||
<mat-form-field>
|
|
||||||
<mat-select placeholder="Loan Type" formControlName="loan_type" >
|
|
||||||
<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" > -->
|
|
||||||
</mat-form-field>
|
|
||||||
<mat-form-field *ngIf="details.get('loan_type').value == 9 ">
|
|
||||||
<input matInput autocomplete="off" placeholder="Specify Loan Type" formControlName="others_loan_type">
|
|
||||||
</mat-form-field>
|
|
||||||
<mat-form-field>
|
|
||||||
<!-- <mat-select placeholder="Loan Taken By" formControlName="loan_taken_by" (selectionChange)="selectedBorrower($event.value,i)">
|
|
||||||
<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-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
|
|
||||||
<mat-option *ngFor="let val of group.groupValues" [value]="val">
|
|
||||||
{{val.name}}
|
|
||||||
</mat-option>
|
|
||||||
</mat-optgroup>
|
|
||||||
</mat-select>
|
|
||||||
</mat-form-field>
|
|
||||||
<!-- {{details.get('loan_taken_by').value}} -->
|
|
||||||
<!-- <mat-form-field *ngIf="details.get('loan_taken_by').value == 0"> -->
|
|
||||||
<mat-form-field *ngIf="checkOthers(details.get('loan_taken_by').value)===true" style="width:45%">
|
|
||||||
<input matInput autocomplete="off" placeholder="Specify Borrower" formControlName="others_loan_taken">
|
|
||||||
</mat-form-field>
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select placeholder="Lender" formControlName="lender" >
|
<mat-select placeholder="Lender" formControlName="lender" >
|
||||||
<mat-option *ngFor="let btLen of lenderData" [value]="btLen.bt_lender_list_id">{{ btLen.lender_name }}</mat-option>
|
<mat-option *ngFor="let btLen of lenderData" [value]="btLen.bt_lender_list_id">{{ btLen.lender_name }}</mat-option>
|
||||||
@ -90,18 +61,54 @@
|
|||||||
<mat-form-field *ngIf="details.get('lender').value == 3">
|
<mat-form-field *ngIf="details.get('lender').value == 3">
|
||||||
<input matInput autocomplete="off" placeholder="Specify Lender" formControlName="others_lender" >
|
<input matInput autocomplete="off" placeholder="Specify Lender" formControlName="others_lender" >
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
<mat-form-field>
|
||||||
|
<!-- <mat-select placeholder="Loan Taken By" formControlName="loan_taken_by" (selectionChange)="selectedBorrower($event.value,i)">
|
||||||
|
<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-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
|
||||||
|
<mat-option *ngFor="let val of group.groupValues" [value]="val">
|
||||||
|
{{val.name}}
|
||||||
|
</mat-option>
|
||||||
|
</mat-optgroup>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<!-- {{details.get('loan_taken_by').value}} -->
|
||||||
|
<!-- <mat-form-field *ngIf="details.get('loan_taken_by').value == 0"> -->
|
||||||
|
<mat-form-field *ngIf="checkOthers(details.get('loan_taken_by').value)===true" style="width:45%">
|
||||||
|
<input matInput autocomplete="off" placeholder="Specify Borrower" formControlName="others_loan_taken">
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field style="width:45%;">
|
||||||
|
<mat-select placeholder="Frequency" (selectionChange)="selectedfrequency($event.value,i)"
|
||||||
|
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 != ''" 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 != ''">{{"₹"}} {{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>
|
<!-- <mat-form-field>
|
||||||
<input matInput autocomplete="off" placeholder="Lender" formControlName="lender" >
|
<input matInput autocomplete="off" placeholder="Lender" formControlName="lender" >
|
||||||
</mat-form-field> -->
|
</mat-form-field> -->
|
||||||
<div style="width:100%">
|
<div style="width:100%">
|
||||||
<mat-form-field style="width:35%">
|
<mat-form-field style="width:35%">
|
||||||
<input matInput autocomplete="off" placeholder="Original Tenure in Months" formControlName="original_tenure" (change)="checkTenure(details)">
|
<input matInput autocomplete="off" placeholder="Original Tenure in Months" formControlName="original_tenure" (change)="checkTenure(details);calculateTenure(details)">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width:35%">
|
<mat-form-field style="width:35%">
|
||||||
<input matInput autocomplete="off" placeholder="Current Balance Tenure in Months" formControlName="current_balance_tenure">
|
<input matInput autocomplete="off" placeholder="Current Balance Tenure in Months" formControlName="current_balance_tenure" (change)="calculateTenure(details)">
|
||||||
<mat-error>Invalid Balance Tenure.</mat-error>
|
<mat-error>Invalid Balance Tenure.</mat-error>
|
||||||
<!-- //*ngIf="current_balance_tenure.hasError('min')" class="mat-text-warn" -->
|
<!-- //*ngIf="current_balance_tenure.hasError('min')" class="mat-text-warn" -->
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
<mat-form-field>
|
||||||
|
<input matInput placeholder="Elapsed Tenure in Months" formControlName="elapsed_tenure" autocomplete="off">
|
||||||
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Delete" matTooltipPosition="above" (click)="deleteLoanDetails(i)"
|
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Delete" matTooltipPosition="above" (click)="deleteLoanDetails(i)"
|
||||||
|
|||||||
@ -54,6 +54,7 @@ export class CurrentLoanComponent implements OnInit {
|
|||||||
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
|
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private _pd: PdTrigerService,
|
private _pd: PdTrigerService,
|
||||||
|
private dialogRef: MatDialogRef<CurrentLoanComponent>,
|
||||||
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
|
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
|
||||||
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
|
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
|
||||||
this.form_id = 8;
|
this.form_id = 8;
|
||||||
@ -204,12 +205,13 @@ export class CurrentLoanComponent implements OnInit {
|
|||||||
selectedfrequency(e,i){
|
selectedfrequency(e,i){
|
||||||
|
|
||||||
switch(+e){
|
switch(+e){
|
||||||
case 1: this.placeholderName[i] = 'Monthly Instalment Amount'; break;
|
case 1: this.placeholderName[i] = 'Instalment Amount'; break;
|
||||||
case 2: this.placeholderName[i] = 'Annual Instalment Amount'; break;
|
case 2: this.placeholderName[i] = 'Monthly Instalment Amount'; break;
|
||||||
case 3: this.placeholderName[i] = 'Halfyearly Instalment Amount'; break;
|
case 3: this.placeholderName[i] = 'Annual Instalment Amount'; break;
|
||||||
case 4: this.placeholderName[i] = 'Fortnightly Instalment Amount'; break;
|
case 4: this.placeholderName[i] = 'Halfyearly Instalment Amount'; break;
|
||||||
case 5: this.placeholderName[i] = 'Daily Instalment Amount'; break;
|
case 5: this.placeholderName[i] = 'Fortnightly Instalment Amount'; break;
|
||||||
case 6: this.placeholderName[i] = 'Quarterly Instalment Amount'; break;
|
case 6: this.placeholderName[i] = 'Daily Instalment Amount'; break;
|
||||||
|
case 7: this.placeholderName[i] = 'Quarterly Instalment Amount'; break;
|
||||||
default: this.placeholderName[i] = 'Instalment Amount'; break;
|
default: this.placeholderName[i] = 'Instalment Amount'; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -228,6 +230,7 @@ export class CurrentLoanComponent implements OnInit {
|
|||||||
others_lender:[''],
|
others_lender:[''],
|
||||||
original_tenure: [''],
|
original_tenure: [''],
|
||||||
current_balance_tenure: [''],
|
current_balance_tenure: [''],
|
||||||
|
elapsed_tenure:['']
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,9 +261,21 @@ export class CurrentLoanComponent implements OnInit {
|
|||||||
const control = <FormArray>this.currentLoanForm.controls['loan_details'];
|
const control = <FormArray>this.currentLoanForm.controls['loan_details'];
|
||||||
control.removeAt(index);
|
control.removeAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
calculateTenure(details)
|
||||||
|
{
|
||||||
|
let ElapsedValues;
|
||||||
|
|
||||||
|
if(details.value.original_tenure != null && details.value.original_tenure != '' && details.value.current_balance_tenure != null && details.value.current_balance_tenure != ''){
|
||||||
|
ElapsedValues = details.value.original_tenure - details.value.current_balance_tenure ;
|
||||||
|
details.controls['elapsed_tenure'].setValue(ElapsedValues);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
submitCurrentloan() {
|
submitCurrentloan() {
|
||||||
if (!this.currentLoanForm.valid) {
|
if (!this.currentLoanForm.valid) {
|
||||||
// console.log("data invalid")
|
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let records: any = {};
|
let records: any = {};
|
||||||
@ -274,8 +289,15 @@ export class CurrentLoanComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
// console.log('data', records);
|
// console.log('data', records);
|
||||||
this._pd.saveForm(records).subscribe(data => {
|
this._pd.saveForm(records).subscribe(data => {
|
||||||
// console.log('data', data);
|
if(data.status == 200) {
|
||||||
this.notifier.notify('success', 'Saved Successfully.');
|
this.notifier.notify('success', 'Saved Successfully.');
|
||||||
|
setTimeout(() =>{
|
||||||
|
this.dialogRef.close();
|
||||||
|
},3000);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
|
}
|
||||||
}, error => {
|
}, error => {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
})
|
})
|
||||||
|
|||||||
@ -43,6 +43,7 @@ export class EmploymentInfoComponent implements OnInit {
|
|||||||
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
|
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private _pd: PdTrigerService,
|
private _pd: PdTrigerService,
|
||||||
|
private dialogRef: MatDialogRef<EmploymentInfoComponent>,
|
||||||
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
|
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
|
||||||
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
|
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
|
||||||
this.form_id = 12;
|
this.form_id = 12;
|
||||||
@ -137,6 +138,7 @@ export class EmploymentInfoComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
submitDetails() {
|
submitDetails() {
|
||||||
if (!this.employmentForm.valid) {
|
if (!this.employmentForm.valid) {
|
||||||
|
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let records: any = {};
|
let records: any = {};
|
||||||
@ -168,8 +170,18 @@ export class EmploymentInfoComponent implements OnInit {
|
|||||||
records.employment_remarks = this.employmentForm.controls['employment_remarks'].value;
|
records.employment_remarks = this.employmentForm.controls['employment_remarks'].value;
|
||||||
console.log('data', records);
|
console.log('data', records);
|
||||||
this._pd.saveForm(records).subscribe(data => {
|
this._pd.saveForm(records).subscribe(data => {
|
||||||
console.log('data', data);
|
// console.log('data', data);
|
||||||
this.notifier.notify('success', 'Saved Successfully.');
|
// this.notifier.notify('success', 'Saved Successfully.');
|
||||||
|
if(data.status == 200) {
|
||||||
|
this.notifier.notify('success', 'Saved Successfully.');
|
||||||
|
// this.dialogRef.close();
|
||||||
|
setTimeout(() =>{
|
||||||
|
this.dialogRef.close();
|
||||||
|
},3000);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
|
}
|
||||||
}, error => {
|
}, error => {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
})
|
})
|
||||||
|
|||||||
@ -385,11 +385,15 @@
|
|||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field *ngIf="item.get('non_earning_occupation').value==9">
|
<mat-form-field *ngIf="item.get('non_earning_occupation').value==1">
|
||||||
<input matInput placeholder="Specify Others" formControlName="non_earning_if_others" required>
|
<input matInput placeholder="Specify Others" formControlName="non_earning_if_others" required>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
<mat-form-field *ngIf="item.get('non_earning_occupation').value==2">
|
||||||
|
<input matInput placeholder="Specify School/College Name" formControlName="non_earning_if_schoolorcollege" required>
|
||||||
|
</mat-form-field>
|
||||||
<mat-form-field *ngIf="item.get('non_earning_occupation').value==3">
|
<mat-form-field *ngIf="item.get('non_earning_occupation').value==3">
|
||||||
<input matInput placeholder="Retired From" formControlName="non_earning_if_retired_from" type="date" required>
|
<!-- <input matInput placeholder="Retired From" formControlName="non_earning_if_retired_from" type="date" required> -->
|
||||||
|
<input matInput placeholder="Retired From" formControlName="non_earning_if_retired_from" required>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
|
|||||||
@ -330,6 +330,7 @@ export class FamilyDetailsComponent implements OnInit {
|
|||||||
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
|
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private _pd: PdTrigerService,
|
private _pd: PdTrigerService,
|
||||||
|
private dialogRef: MatDialogRef<FamilyDetailsComponent>,
|
||||||
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
|
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
|
||||||
console.log(pd_all_details);
|
console.log(pd_all_details);
|
||||||
this.selectPerson = this.pd_all_details.pdapplicants_detials;
|
this.selectPerson = this.pd_all_details.pdapplicants_detials;
|
||||||
@ -385,6 +386,7 @@ export class FamilyDetailsComponent implements OnInit {
|
|||||||
non_earning_occupation: [val.non_earning_occupation, Validators.compose([])],
|
non_earning_occupation: [val.non_earning_occupation, Validators.compose([])],
|
||||||
non_earning_if_others: [val.non_earning_if_others, Validators.compose([])],
|
non_earning_if_others: [val.non_earning_if_others, Validators.compose([])],
|
||||||
non_earning_if_retired_from: [val.non_earning_if_retired_from, Validators.compose([])],
|
non_earning_if_retired_from: [val.non_earning_if_retired_from, Validators.compose([])],
|
||||||
|
non_earning_if_schoolorcollege: [val.non_earning_if_schoolorcollege],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -540,6 +542,7 @@ export class FamilyDetailsComponent implements OnInit {
|
|||||||
non_earning_occupation: [vals.non_earning_occupation || null, Validators.compose([])],
|
non_earning_occupation: [vals.non_earning_occupation || null, Validators.compose([])],
|
||||||
non_earning_if_others: [vals.non_earning_if_others || null, Validators.compose([])],
|
non_earning_if_others: [vals.non_earning_if_others || null, Validators.compose([])],
|
||||||
non_earning_if_retired_from: [vals.non_earning_if_retired_from || null, Validators.compose([])],
|
non_earning_if_retired_from: [vals.non_earning_if_retired_from || null, Validators.compose([])],
|
||||||
|
non_earning_if_schoolorcollege: [val.non_earning_if_schoolorcollege || null],
|
||||||
});
|
});
|
||||||
control.push(datas);
|
control.push(datas);
|
||||||
}
|
}
|
||||||
@ -592,6 +595,7 @@ export class FamilyDetailsComponent implements OnInit {
|
|||||||
non_earning_occupation: ['', Validators.compose([])],
|
non_earning_occupation: ['', Validators.compose([])],
|
||||||
non_earning_if_others: ['', Validators.compose([])],
|
non_earning_if_others: ['', Validators.compose([])],
|
||||||
non_earning_if_retired_from: ['', Validators.compose([])],
|
non_earning_if_retired_from: ['', Validators.compose([])],
|
||||||
|
non_earning_if_schoolorcollege: [''],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -622,6 +626,7 @@ export class FamilyDetailsComponent implements OnInit {
|
|||||||
|
|
||||||
submitFamily() {
|
submitFamily() {
|
||||||
if (!this.familyForm.valid) {
|
if (!this.familyForm.valid) {
|
||||||
|
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var records = this.familyForm.value;
|
var records = this.familyForm.value;
|
||||||
@ -633,7 +638,16 @@ export class FamilyDetailsComponent implements OnInit {
|
|||||||
// records.fk_createdby = '251';
|
// records.fk_createdby = '251';
|
||||||
console.log(JSON.stringify(records));
|
console.log(JSON.stringify(records));
|
||||||
this._pd.saveForm(records).subscribe(data => {
|
this._pd.saveForm(records).subscribe(data => {
|
||||||
this.notifier.notify('success', 'Saved Successfully.');
|
// this.notifier.notify('success', 'Saved Successfully.');
|
||||||
|
if(data.status == 200) {
|
||||||
|
this.notifier.notify('success', 'Saved Successfully.');
|
||||||
|
setTimeout(() =>{
|
||||||
|
this.dialogRef.close();
|
||||||
|
},3000);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
|
}
|
||||||
}, error => {
|
}, error => {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
});
|
});
|
||||||
|
|||||||
@ -47,6 +47,7 @@ export class FinalRemarksComponent implements OnInit {
|
|||||||
notifier: NotifierService,
|
notifier: NotifierService,
|
||||||
private _formBuilder: FormBuilder,
|
private _formBuilder: FormBuilder,
|
||||||
private pdTrigerService: PdTrigerService,
|
private pdTrigerService: PdTrigerService,
|
||||||
|
private dialogRef: MatDialogRef<FinalRemarksComponent>,
|
||||||
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
|
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
|
||||||
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
|
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
|
||||||
this.form_id = 20;
|
this.form_id = 20;
|
||||||
@ -114,6 +115,7 @@ export class FinalRemarksComponent implements OnInit {
|
|||||||
this.submitted = true;
|
this.submitted = true;
|
||||||
// stop here if form is invalid
|
// stop here if form is invalid
|
||||||
if (this._finalRemarkForm.invalid) {
|
if (this._finalRemarkForm.invalid) {
|
||||||
|
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
var answerFormValues = this._finalRemarkForm.value;
|
var answerFormValues = this._finalRemarkForm.value;
|
||||||
@ -125,14 +127,13 @@ export class FinalRemarksComponent implements OnInit {
|
|||||||
this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe(
|
this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe(
|
||||||
dataresult => {
|
dataresult => {
|
||||||
if (dataresult.status == 200) {
|
if (dataresult.status == 200) {
|
||||||
// console.log(dataresult);
|
this.notifier.notify('success', 'Saved Successfully.');
|
||||||
this.notifier.notify('success', 'Record Saved Successfully.!');
|
setTimeout(() =>{
|
||||||
// this.dialogRef.close();
|
this.dialogRef.close();
|
||||||
// alert("sample alert for Saving");
|
},3000);
|
||||||
}
|
}
|
||||||
else {
|
else{
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
// this.errorMessage = "Some Thing Wents Wrong Try Again !";
|
|
||||||
}
|
}
|
||||||
}, error => {
|
}, error => {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<!-- <form [formGroup]="_personalForm" (submit)="submitPersonalForm(_personalForm.value)" novalidate> -->
|
|
||||||
<form [formGroup]="financialForm" class="address">
|
<form [formGroup]="financialForm" class="address">
|
||||||
|
|
||||||
<h2 mat-dialog-title class="paragraph_change">
|
<h2 mat-dialog-title class="paragraph_change">
|
||||||
<div fxFlex="70" align="left" style="padding: 10px !important;">
|
<div fxFlex="70" align="left" style="padding: 10px !important;">
|
||||||
@ -20,32 +20,46 @@
|
|||||||
<div fxFlex="100">
|
<div fxFlex="100">
|
||||||
<mat-card>
|
<mat-card>
|
||||||
<mat-card-header>
|
<mat-card-header>
|
||||||
<mat-card-title><p> Data as Per Financial Statements</p></mat-card-title>
|
<mat-card-title>
|
||||||
|
<!-- <p> Financial as per Statements</p> -->
|
||||||
|
<p>Data as Per Financial Statements</p>
|
||||||
|
</mat-card-title>
|
||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
|
|
||||||
<div style="width:100%">
|
<div style="width:100%">
|
||||||
<mat-form-field style="width:35%">
|
<mat-form-field style="width:25%">
|
||||||
|
|
||||||
|
<mat-select placeholder="Financial Statements ?" formControlName="is_financial_statements" (selectionChange)="selectedStatement($event)">
|
||||||
|
<mat-option value="yes">Yes</mat-option>
|
||||||
|
<mat-option value="no">No</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<span *ngIf="isDisplay">
|
||||||
|
<mat-form-field style="width:37%">
|
||||||
<mat-label>Enter year from which financials provided</mat-label>
|
<mat-label>Enter year from which financials provided</mat-label>
|
||||||
<input matInput autocomplete="off" placeholder="YYYY eg.2018" formControlName="staring_financial_year" (keypress)="keyPress($event)" [readonly]="isReadOnly">
|
<input matInput autocomplete="off" placeholder="YYYY eg.2018" formControlName="financial_starting_year" (keypress)="keyPress($event)" [readonly]="isReadOnly">
|
||||||
<mat-error> Invalid year format</mat-error>
|
<mat-error> Invalid year format</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<!-- <mat-form-field hintLabel="Max 10 characters">
|
<!-- <mat-form-field hintLabel="Max 10 characters">
|
||||||
<input matInput #input maxlength="10" placeholder="Enter some input">
|
<input matInput #input maxlength="10" placeholder="Enter some input">
|
||||||
<mat-hint align="start" style="font-size:70%">{{input.value?.length || 0}}/10</mat-hint>
|
<mat-hint align="start" style="font-size:70%">{{input.value?.length || 0}}/10</mat-hint>
|
||||||
</mat-form-field> -->
|
</mat-form-field> -->
|
||||||
|
|
||||||
<mat-form-field style="width:35%">
|
<mat-form-field style="width:25%">
|
||||||
<input matInput autocomplete="off" placeholder="Number of Financial Years" formControlName="total_financial_year" (change)="dynamicalFinYear($event)" (keypress)="keyPress($event)" [readonly]="isReadOnly">
|
<input matInput autocomplete="off" placeholder="Number of Financial Years" formControlName="financial_no_of_year" (change)="dynamicalFinYear($event)" (keypress)="keyPress($event)" [readonly]="isReadOnly">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="total_financial_year != ''" formArrayName="date_per_financial">
|
<div *ngIf="financial_no_of_year != ''" formArrayName="date_per_financial">
|
||||||
<!-- <div formArrayName="date_per_financial"> -->
|
<!-- <div formArrayName="date_per_financial"> -->
|
||||||
<div *ngFor="let details of financialForm.controls.date_per_financial['controls']; let i=index" [formGroupName]="i">
|
<div *ngFor="let details of financialForm.controls.date_per_financial['controls']; let i=index" [formGroupName]="i">
|
||||||
|
|
||||||
<mat-card-content class="matcard">
|
<mat-card-content class="matcard">
|
||||||
<mat-label class="highlight"> <i>Financial Year : {{details.get('financial_year').value}} </i> </mat-label>
|
<mat-label class="highlight"> <i>Financial Year : {{details.get('financial_year').value}} </i> </mat-label>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div style="width:100%">
|
<div style="width:100%">
|
||||||
<br>
|
<br>
|
||||||
@ -61,7 +75,7 @@
|
|||||||
<input matInput autocomplete="off" placeholder="Sale Variation from Previous Year in %" formControlName="financial_annualsales_variation" (keypress)="keyPress($event)">
|
<input matInput autocomplete="off" placeholder="Sale Variation from Previous Year in %" formControlName="financial_annualsales_variation" (keypress)="keyPress($event)">
|
||||||
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('financial_annualsales_variation').value != '' " >
|
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('financial_annualsales_variation').value != '' " >
|
||||||
<span *ngIf="details.get('financial_annualsales_variation').value == 0">
|
<span *ngIf="details.get('financial_annualsales_variation').value == 0">
|
||||||
No differents in Sales in FY <i> {{details.get('financial_year').value}} </i> over Sales in FY <i> {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} </i>
|
No difference in Sales in FY <i> {{details.get('financial_year').value}} </i> over Sales in FY <i> {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} </i>
|
||||||
</span>
|
</span>
|
||||||
<span *ngIf="details.get('financial_annualsales_variation').value > 0" class="greenhighlight">
|
<span *ngIf="details.get('financial_annualsales_variation').value > 0" class="greenhighlight">
|
||||||
Increase in Sales in FY <i> {{details.get('financial_year').value}} </i> over Sales in FY <i> {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} </i> <b> {{details.get('financial_annualsales_variation').value}} % </b>
|
Increase in Sales in FY <i> {{details.get('financial_year').value}} </i> over Sales in FY <i> {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} </i> <b> {{details.get('financial_annualsales_variation').value}} % </b>
|
||||||
@ -107,11 +121,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span *ngIf="i != 0">
|
<span *ngIf="i != 0">
|
||||||
<mat-form-field style="width:65%">
|
<mat-form-field style="width:45%">
|
||||||
<input matInput autocomplete="off" [ngClass]="{'highlight': (details.controls['financial_variation'].value > 40) || (details.controls['financial_variation'].value < -40)}" placeholder="Profit Variation from Previous Year in %" formControlName="financial_variation" (keypress)="keyPress($event)">
|
<input matInput autocomplete="off" [ngClass]="{'highlight': (details.controls['financial_variation'].value > 40) || (details.controls['financial_variation'].value < -40)}" placeholder="Profit Variation from Previous Year in %" formControlName="financial_variation" (keypress)="keyPress($event)">
|
||||||
<mat-hint align="start" style="font-size:70%" *ngIf="i != 0 && details.get('financial_variation').value != '' " [ngClass]="{'highlight': (details.controls['financial_variation'].value > 40) || (details.controls['financial_variation'].value < -40)}" >
|
<mat-hint align="start" style="font-size:70%" *ngIf="i != 0 && details.get('financial_variation').value != '' " [ngClass]="{'highlight': (details.controls['financial_variation'].value > 40) || (details.controls['financial_variation'].value < -40)}" >
|
||||||
<span *ngIf="details.get('financial_variation').value == 0">
|
<span *ngIf="details.get('financial_variation').value == 0">
|
||||||
No differents in Profit in FY <i> {{details.get('financial_year').value}} </i> over Profit in FY <i> {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} </i>
|
No difference in Profit in FY <i> {{details.get('financial_year').value}} </i> over Profit in FY <i> {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} </i>
|
||||||
</span>
|
</span>
|
||||||
<span *ngIf="details.get('financial_variation').value > 0" class="greenhighlight">
|
<span *ngIf="details.get('financial_variation').value > 0" class="greenhighlight">
|
||||||
Increase in Profit in FY <i> {{details.get('financial_year').value}} </i> over Profit in FY <i> {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} </i> <b> {{details.get('financial_variation').value}} % </b>
|
Increase in Profit in FY <i> {{details.get('financial_year').value}} </i> over Profit in FY <i> {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} </i> <b> {{details.get('financial_variation').value}} % </b>
|
||||||
@ -123,40 +137,46 @@
|
|||||||
<!-- “Increase in Sales in FY 2017-2018 over sales in FY 2016-2017 is 11.11%” -->
|
<!-- “Increase in Sales in FY 2017-2018 over sales in FY 2016-2017 is 11.11%” -->
|
||||||
<!-- <mat-hint align="start" style="font-size:70%" *ngIf="i != 0" [ngClass]="{'highlight': (details.controls['financial_variation'].value > 40) || (details.controls['financial_variation'].value < -40)}" >{{SalesStatement[i]}}</mat-hint> -->
|
<!-- <mat-hint align="start" style="font-size:70%" *ngIf="i != 0" [ngClass]="{'highlight': (details.controls['financial_variation'].value > 40) || (details.controls['financial_variation'].value < -40)}" >{{SalesStatement[i]}}</mat-hint> -->
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</span>
|
|
||||||
|
|
||||||
|
<mat-form-field style="width:45%">
|
||||||
|
<input matInput autocomplete="off" [ngClass]="{'highlight': (details.controls['financial_profit_to_sale_variation'].value > 40) || (details.controls['financial_profit_to_sale_variation'].value < -40)}" placeholder="Variation of Profit % over sales" formControlName="financial_profit_to_sale_variation" (keypress)="keyPress($event)">
|
||||||
|
<mat-hint align="start" style="font-size:70%" *ngIf="i != 0 && details.get('financial_profit_to_sale_variation').value != '' " [ngClass]="{'highlight': (details.controls['financial_profit_to_sale_variation'].value > 40) || (details.controls['financial_profit_to_sale_variation'].value < -40)}" >
|
||||||
|
<span *ngIf="details.get('financial_profit_to_sale_variation').value == 0">
|
||||||
|
No difference in Profit sales % in FY <i> {{details.get('financial_year').value}} </i> over Profit sales % in FY <i> {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} </i>
|
||||||
|
</span>
|
||||||
|
<span *ngIf="details.get('financial_profit_to_sale_variation').value > 0" class="greenhighlight">
|
||||||
|
Increase in Profit sales % in FY <i> {{details.get('financial_year').value}} </i> over Profit sales % in FY <i> {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} </i> <b> {{details.get('financial_profit_to_sale_variation').value}} % </b>
|
||||||
|
</span>
|
||||||
|
<span *ngIf="details.get('financial_profit_to_sale_variation').value < 0" class="highlight">
|
||||||
|
Decrease in Profit sales % in FY <i> {{details.get('financial_year').value}} </i> over Profit sales % in FY <i> {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} </i> <b> {{(details.get('financial_profit_to_sale_variation').value).replace('-', '')}} % </b>
|
||||||
|
</span>
|
||||||
|
</mat-hint>
|
||||||
|
|
||||||
|
</mat-form-field>
|
||||||
<!-- <button type="button" mat-raised-button mat-icon-button (click)="addDate()"
|
</span>
|
||||||
matTooltip="Add More Financial Statements" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" *ngIf="i==0">
|
|
||||||
<mat-icon>add</mat-icon>
|
|
||||||
</button> -->
|
|
||||||
<!-- <button align="end" type="button" mat-raised-button mat-icon-button (click)="deleteDate(i)"
|
|
||||||
matTooltip="Delete" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="i>0">
|
|
||||||
<mat-icon>delete</mat-icon>
|
|
||||||
</button> -->
|
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<mat-form-field *ngIf="total_financial_year != '' && customerCommentsFlag" style="width:100%">
|
<span *ngIf="isDisplay">
|
||||||
<!-- <input matInput autocomplete="off" placeholder="Reason For Major Difference" formControlName="financial_reason" > -->
|
<mat-form-field *ngIf="financial_no_of_year != '' && customerCommentsFlag" style="width:90%">
|
||||||
<input matInput autocomplete="off" placeholder="Customer Comments on Financials" formControlName="financial_reason" >
|
<input matInput autocomplete="off" placeholder="Customer Comments on Financials" formControlName="financial_reason" >
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
</span>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div fxLayout="row wrap">
|
<div fxLayout="row wrap">
|
||||||
<div fxFlex="100">
|
<div fxFlex="100">
|
||||||
<!-- start co applicant form details -->
|
|
||||||
<mat-card>
|
<mat-card>
|
||||||
<mat-card-header>
|
<mat-card-header>
|
||||||
<mat-card-title><p> Financial as per Customer</p></mat-card-title>
|
<mat-card-title><p> Financial as per Customer</p></mat-card-title>
|
||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
|
|
||||||
<mat-form-field *ngIf="total_financial_year != ''" style="width:35%">
|
<mat-form-field *ngIf="isDisplay" style="width:35%">
|
||||||
<mat-select placeholder="Same as Financial Statements?" formControlName="same_as_financial_statements" (selectionChange)="selectedType($event)">
|
<mat-select placeholder="Same as Financial Statements?" formControlName="is_financial_customer" (selectionChange)="selectedFinancialCustomer($event)">
|
||||||
<mat-option value="yes">Yes</mat-option>
|
<mat-option value="yes">Yes</mat-option>
|
||||||
<mat-option value="no">No</mat-option>
|
<mat-option value="no">No</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
@ -165,39 +185,31 @@
|
|||||||
<div formArrayName="estimated_value">
|
<div formArrayName="estimated_value">
|
||||||
<div *ngFor="let details of financialForm.controls.estimated_value['controls']; let i=index"
|
<div *ngFor="let details of financialForm.controls.estimated_value['controls']; let i=index"
|
||||||
[formGroupName]="i">
|
[formGroupName]="i">
|
||||||
|
|
||||||
<mat-card-content class="matcard">
|
<mat-card-content class="matcard">
|
||||||
<mat-label class="highlight"> <i>Financial Year : {{details.get('estimate_year').value}} </i> </mat-label>
|
<!-- <mat-label class="highlight"> <i>Financial Year : {{details.get('estimate_year').value}} </i> </mat-label>
|
||||||
<hr>
|
<hr> -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <div fxLayout="row"> -->
|
||||||
<div style="width:100%">
|
<div style="width:100%">
|
||||||
<br>
|
<!-- <br> -->
|
||||||
<!-- <mat-form-field style="width:25%">
|
<!-- <span style="width:10%;padding-left:2%"><p>Sales</p></span> -->
|
||||||
<!-- <input matInput autocomplete="off" placeholder="Year (format: 2015-16)" formControlName="estimate_year" > ->
|
<mat-form-field style="width:25%">
|
||||||
<input matInput autocomplete="off" placeholder="Year" formControlName="estimate_year" >
|
<input matInput autocomplete="off" placeholder="Sales From" formControlName="estimate_sales_from" (change)="calculateSalesAverage(i, details);">
|
||||||
</mat-form-field> -->
|
</mat-form-field>
|
||||||
<mat-form-field style="width:30%">
|
<!-- <span style="width:10%;padding-left:2%"><p>to</p></span> -->
|
||||||
|
<mat-form-field style="width:25%">
|
||||||
<input matInput autocomplete="off" placeholder="Annual Sale" formControlName="estimate_annual_sale" (change)="calMarginVal( i, details)" (keypress)="keyPress($event)" (keyup)="inWords($event,i,4)" (change)="calculateEstimationAnnualSale(i, details);">
|
<input matInput autocomplete="off" placeholder="Sales To" formControlName="estimate_sales_to" (change)="confirmAlert(i, details);">
|
||||||
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('estimate_annual_sale').value != ''">{{"₹"}} {{AV_annualSalesInwords[i]}} Only</mat-hint>
|
</mat-form-field>
|
||||||
|
<!-- <span style="width:10%;padding-left:2%"><p>Average</p></span> -->
|
||||||
|
<mat-form-field style="width:25%">
|
||||||
|
<input matInput autocomplete="off" placeholder="Considered Sales Average" formControlName="estimate_sales_average">
|
||||||
|
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('estimate_sales_average').value != ''">{{"₹"}} {{AV_SalesInwords[i]}} Only</mat-hint>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<span *ngIf="i != 0">
|
|
||||||
<mat-form-field style="width:60%">
|
|
||||||
<input matInput autocomplete="off" placeholder="Sale Variation from Previous Year in %" formControlName="estimate_annualsales_variation" (keypress)="keyPress($event)">
|
|
||||||
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('estimate_annualsales_variation').value != '' " >
|
|
||||||
<span *ngIf="details.get('estimate_annualsales_variation').value == 0">
|
|
||||||
No differents in Sales in FY <i> {{details.get('estimate_year').value}} </i> over Sales in FY <i> {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} </i>
|
|
||||||
</span>
|
|
||||||
<span *ngIf="details.get('estimate_annualsales_variation').value > 0" class="greenhighlight">
|
|
||||||
Increase in Sales in FY <i> {{details.get('estimate_year').value}} </i> over Sales in FY <i> {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} </i><b> {{details.get('estimate_annualsales_variation').value}} % </b>
|
|
||||||
</span>
|
|
||||||
<span *ngIf="details.get('estimate_annualsales_variation').value < 0" class="highlight">
|
|
||||||
Decrease in Sales in FY <i> {{details.get('estimate_year').value}} </i> over Sales in FY <i> {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} </i><b> {{(details.get('estimate_annualsales_variation').value).replace('-', '')}} % </b>
|
|
||||||
</span>
|
|
||||||
</mat-hint>
|
|
||||||
</mat-form-field>
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- </div> -->
|
||||||
|
|
||||||
<div style="width:100%">
|
<div style="width:100%">
|
||||||
<mat-form-field style="width:30%">
|
<mat-form-field style="width:30%">
|
||||||
<!-- <input matInput autocomplete="off" placeholder="Net Profit / Loss" formControlName="financial_net_profit" (change)="calMargin( i, details); calYearVariation( i, details)" type="number" > -->
|
<!-- <input matInput autocomplete="off" placeholder="Net Profit / Loss" formControlName="financial_net_profit" (change)="calMargin( i, details); calYearVariation( i, details)" type="number" > -->
|
||||||
@ -208,29 +220,81 @@
|
|||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<span *ngIf="details.get('estimate_profit_or_loss').value == 1 ">
|
<span *ngIf="details.get('estimate_profit_or_loss').value == 1 ">
|
||||||
<mat-form-field style="width:28%">
|
|
||||||
|
<!-- <mat-form-field style="width:28%">
|
||||||
<input matInput autocomplete="off" placeholder="Net Profit Amount" formControlName="estimate_net_profit" (change)="calMarginVal( i, details); calVariation( i, details)" (keyup)="inWords($event,i,5)">
|
<input matInput autocomplete="off" placeholder="Net Profit Amount" formControlName="estimate_net_profit" (change)="calMarginVal( i, details); calVariation( i, details)" (keyup)="inWords($event,i,5)">
|
||||||
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('estimate_net_profit').value != ''">{{"₹"}} {{AV_netProfitAmtInwords[i]}} Only</mat-hint>
|
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('estimate_net_profit').value != ''">{{"₹"}} {{AV_netProfitAmtInwords[i]}} Only</mat-hint>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width:28%">
|
<mat-form-field style="width:28%">
|
||||||
<input matInput autocomplete="off" placeholder="Net Profit to Sales in %" formControlName="estimate_margin_of_profit" (change)="calProfitAndLossVal(i,details); calVariation( i, details)" (keypress)="keyPress($event)" >
|
<input matInput autocomplete="off" placeholder="Net Profit to Sales in %" formControlName="estimate_margin_of_profit" (change)="calProfitAndLossVal(i,details); calVariation( i, details)" (keypress)="keyPress($event)" >
|
||||||
</mat-form-field>
|
</mat-form-field> -->
|
||||||
|
<div style="width:100%">
|
||||||
|
<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);">
|
||||||
|
</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);">
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field style="width:25%">
|
||||||
|
<input matInput autocomplete="off" placeholder="Considered Margin Profit %" formControlName="estimate_profit_margin_percent" type="number">
|
||||||
|
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('estimate_profit_margin').value != ''">{{"₹"}} {{details.get('estimate_profit_margin').value}} ( {{AV_marginProfitAmtInwords[i]}} Only ) </mat-hint>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
<div style="width:100%">
|
||||||
|
<mat-form-field style="width:25%">
|
||||||
|
<input matInput autocomplete="off" placeholder="Net Profit Amount From" formControlName="estimate_net_profit_from" type="number" (change)="calculateProfitAmount(i, details);">
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field style="width:25%">
|
||||||
|
<input matInput autocomplete="off" placeholder="Net Profit Amount To" formControlName="estimate_net_profit_to" type="number" (change)="calculateProfitAmount(i, details);">
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field style="width:25%">
|
||||||
|
<input matInput autocomplete="off" placeholder="Considered Profit Amount" formControlName="estimate_net_profit" type="number">
|
||||||
|
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('estimate_net_profit').value != ''">{{"₹"}} {{AV_netProfitAmtInwords[i]}} Only ( {{details.get('estimate_net_profit_percent').value }} % )</mat-hint>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
|
||||||
<span *ngIf="details.get('estimate_profit_or_loss').value == 2 ">
|
<span *ngIf="details.get('estimate_profit_or_loss').value == 2 ">
|
||||||
<mat-form-field style="width:28%">
|
<div style="width:100%">
|
||||||
|
<mat-form-field style="width:25%">
|
||||||
|
<input matInput autocomplete="off" placeholder="Net Loss From" formControlName="estimate_loss_range_from" type="number" (change)="calculateLossProfit( 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)="calculateLossProfit( 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">
|
||||||
|
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('estimate_loss_margin').value != ''">{{"₹"}} {{details.get('estimate_Loss_margin').value}} ( {{AV_marginLossAmtInwords[i]}} Only ) </mat-hint>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
<div style="width:100%">
|
||||||
|
<mat-form-field style="width:25%">
|
||||||
|
<input matInput autocomplete="off" placeholder="Net Loss Amount From" formControlName="estimate_net_loss_from" type="number" (change)="calculateLossAmount(i, details);">
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field style="width:25%">
|
||||||
|
<input matInput autocomplete="off" placeholder="Net Loss Amount To" formControlName="estimate_net_loss_to" type="number" (change)="calculateLossAmount(i, details);">
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field style="width:25%">
|
||||||
|
<input matInput autocomplete="off" placeholder="Considered Loss Amount" formControlName="estimate_net_loss" type="number">
|
||||||
|
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('estimate_net_loss').value != ''">{{"₹"}} {{AV_netLossAmtInwords[i]}} Only ( {{details.get('estimate_net_loss_percent').value }} % )</mat-hint>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- <mat-form-field style="width:28%">
|
||||||
<input matInput autocomplete="off" placeholder="Net Loss" formControlName="estimate_net_loss" (change)="calMarginVal( i, details); calVariation( i, details)" (keyup)="inWords($event,i,6)">
|
<input matInput autocomplete="off" placeholder="Net Loss" formControlName="estimate_net_loss" (change)="calMarginVal( i, details); calVariation( i, details)" (keyup)="inWords($event,i,6)">
|
||||||
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('estimate_net_loss').value != ''">{{"₹"}} {{AV_netLossAmtInwords[i]}} Only</mat-hint>
|
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('estimate_net_loss').value != ''">{{"₹"}} {{AV_netLossAmtInwords[i]}} Only</mat-hint>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width:28%">
|
<mat-form-field style="width:28%">
|
||||||
<input matInput autocomplete="off" placeholder="Net Loss to Sales" formControlName="estimate_margin_of_loss" (keypress)="keyPress($event)" (change)="calProfitAndLossVal(i,details); calVariation( i, details)" >
|
<input matInput autocomplete="off" placeholder="Net Loss to Sales" formControlName="estimate_margin_of_loss" (keypress)="keyPress($event)" (change)="calProfitAndLossVal(i,details); calVariation( i, details)" >
|
||||||
</mat-form-field>
|
</mat-form-field> -->
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<mat-form-field *ngIf="i != 0" style="width:65%">
|
<!-- <mat-form-field *ngIf="i != 0" style="width:65%">
|
||||||
<input matInput autocomplete="off" [ngClass]="{'highlight': details.controls['estimate_variation'].value >= 40 || details.controls['estimate_variation'].value >= -40}" placeholder="Variation from Previous Year in %" formControlName="estimate_variation" (keypress)="keyPress($event)">
|
<input matInput autocomplete="off" [ngClass]="{'highlight': details.controls['estimate_variation'].value >= 40 || details.controls['estimate_variation'].value >= -40}" placeholder="Variation from Previous Year in %" formControlName="estimate_variation" (keypress)="keyPress($event)">
|
||||||
<mat-hint align="start" style="font-size:70%" [ngClass]="{'highlight': (details.controls['estimate_variation'].value >= 40) || (details.controls['estimate_variation'].value < -40)}" >
|
<mat-hint align="start" style="font-size:70%" [ngClass]="{'highlight': (details.controls['estimate_variation'].value >= 40) || (details.controls['estimate_variation'].value < -40)}" >
|
||||||
<span *ngIf="details.get('estimate_variation').value == 0">
|
<span *ngIf="details.get('estimate_variation').value == 0">
|
||||||
No differents in Profit in FY <i> {{details.get('estimate_year').value}} </i> over Profit in FY <i> {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} </i>
|
No difference in Profit in FY <i> {{details.get('estimate_year').value}} </i> over Profit in FY <i> {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} </i>
|
||||||
</span>
|
</span>
|
||||||
<span *ngIf="details.get('estimate_variation').value > 0" class="greenhighlight">
|
<span *ngIf="details.get('estimate_variation').value > 0" class="greenhighlight">
|
||||||
Increase in Profit in FY <i> {{details.get('estimate_year').value}} </i> over Profit in FY<i> {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} </i> <b> {{details.get('estimate_variation').value}} % </b>
|
Increase in Profit in FY <i> {{details.get('estimate_year').value}} </i> over Profit in FY<i> {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} </i> <b> {{details.get('estimate_variation').value}} % </b>
|
||||||
@ -240,8 +304,8 @@
|
|||||||
</span>
|
</span>
|
||||||
<!-- {{details.controls[''].value}} {{details.controls[''].value}} -->
|
<!-- {{details.controls[''].value}} {{details.controls[''].value}} -->
|
||||||
<!-- 'details.controls['estimate_variation'].value <= 0' ? 'Decreases ' : 'Increases ' + 'in Sales in FY ' + curr_year + ' Over Sales in FY '+ prev_year + ' is ' + {{details.controls['estimate_variation'].value}} + '%'; -->
|
<!-- 'details.controls['estimate_variation'].value <= 0' ? 'Decreases ' : 'Increases ' + 'in Sales in FY ' + curr_year + ' Over Sales in FY '+ prev_year + ' is ' + {{details.controls['estimate_variation'].value}} + '%'; -->
|
||||||
</mat-hint>
|
<!--</mat-hint>
|
||||||
</mat-form-field>
|
</mat-form-field> -->
|
||||||
<!--<mat-form-field>
|
<!--<mat-form-field>
|
||||||
<input matInput autocomplete="off" placeholder="Reason For Major Difference" formControlName="estimate_reason" >
|
<input matInput autocomplete="off" placeholder="Reason For Major Difference" formControlName="estimate_reason" >
|
||||||
</mat-form-field>-->
|
</mat-form-field>-->
|
||||||
@ -258,7 +322,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
<!-- end co apllicant -->
|
<!-- end co apllicant -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|||||||
@ -30,24 +30,36 @@ import {ActivatedRoute, Router} from '@angular/router';
|
|||||||
styleUrls: ['./financial-info.component.scss']
|
styleUrls: ['./financial-info.component.scss']
|
||||||
})
|
})
|
||||||
export class FinancialInfoComponent implements OnInit {
|
export class FinancialInfoComponent implements OnInit {
|
||||||
|
//Common Declaration
|
||||||
pageTitle: string ="Financial Information";
|
pageTitle: string ="Financial Information";
|
||||||
pdid: string;
|
pdid: string;
|
||||||
form_id: number;
|
form_id: number;
|
||||||
company_id: string;
|
company_id: string;
|
||||||
|
|
||||||
public financialForm: FormGroup;
|
public financialForm: FormGroup;
|
||||||
private notifier: NotifierService;
|
private notifier: NotifierService;
|
||||||
SalesStatement : any = [];
|
|
||||||
marginVal: any = [] ;
|
// SalesStatement : any = [];
|
||||||
placeholderName : any = [];
|
// marginVal: any = [] ;
|
||||||
setmargin: AbstractControl;
|
// placeholderName : any = [];
|
||||||
|
// setmargin: AbstractControl;
|
||||||
|
|
||||||
customerCommentsFlag :boolean;
|
customerCommentsFlag :boolean;
|
||||||
|
|
||||||
|
//Array for Amount Inwords
|
||||||
FY_annualSalesInwords : any = [];
|
FY_annualSalesInwords : any = [];
|
||||||
FY_netProfitAmtInwords : any = [];
|
FY_netProfitAmtInwords : any = [];
|
||||||
FY_netLossAmtInwords : any = [];
|
FY_netLossAmtInwords : any = [];
|
||||||
|
AV_SalesInwords : any = [];
|
||||||
AV_annualSalesInwords : any = [];
|
AV_annualSalesInwords : any = [];
|
||||||
|
AV_marginProfitAmtInwords : any = [];
|
||||||
AV_netProfitAmtInwords : any = [];
|
AV_netProfitAmtInwords : any = [];
|
||||||
|
AV_marginLossAmtInwords : any = [];
|
||||||
AV_netLossAmtInwords : any = [];
|
AV_netLossAmtInwords : any = [];
|
||||||
|
|
||||||
|
//isreadonly for edit(no of year Fields and Starting Years )
|
||||||
isReadOnly : boolean = false;
|
isReadOnly : boolean = false;
|
||||||
|
isDisplay : boolean ;
|
||||||
|
|
||||||
constructor(notifier: NotifierService,
|
constructor(notifier: NotifierService,
|
||||||
private fb: FormBuilder,
|
private fb: FormBuilder,
|
||||||
@ -61,25 +73,29 @@ export class FinancialInfoComponent implements OnInit {
|
|||||||
this.company_id =this.pd_all_details.company_id;
|
this.company_id =this.pd_all_details.company_id;
|
||||||
this.notifier = notifier;
|
this.notifier = notifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ViewerOption For Docs Display
|
||||||
public viewerOptions: any = {
|
public viewerOptions: any = {
|
||||||
navbar: false,
|
navbar: false,
|
||||||
toolbar: {
|
toolbar: {
|
||||||
zoomIn: 4,
|
zoomIn: 4,
|
||||||
zoomOut: 4,
|
zoomOut: 4,
|
||||||
oneToOne: 4,
|
oneToOne: 4,
|
||||||
reset: 4,
|
reset: 4,
|
||||||
prev: 4,
|
prev: 4,
|
||||||
play: {
|
play: {
|
||||||
show: 4,
|
show: 4,
|
||||||
size: 'large',
|
size: 'large',
|
||||||
},
|
},
|
||||||
next: 4,
|
next: 4,
|
||||||
rotateLeft: 4,
|
rotateLeft: 4,
|
||||||
rotateRight: 4,
|
rotateRight: 4,
|
||||||
flipHorizontal: 4,
|
flipHorizontal: 4,
|
||||||
flipVertical: 4,
|
flipVertical: 4,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
||||||
this.initstockForm();
|
this.initstockForm();
|
||||||
@ -87,45 +103,57 @@ export class FinancialInfoComponent implements OnInit {
|
|||||||
params.pd_id = this.pdid;
|
params.pd_id = this.pdid;
|
||||||
params.pd_form_id = this.form_id;
|
params.pd_form_id = this.form_id;
|
||||||
params.company_id = this.company_id;
|
params.company_id = this.company_id;
|
||||||
|
|
||||||
this._pd.retriveForm(params).subscribe(value => {
|
this._pd.retriveForm(params).subscribe(value => {
|
||||||
const financial_date = <FormArray>this.financialForm.controls['date_per_financial'];
|
const financial_date = <FormArray>this.financialForm.controls['date_per_financial'];
|
||||||
const estimated_val = <FormArray>this.financialForm.controls['estimated_value'];
|
const estimated_val = <FormArray>this.financialForm.controls['estimated_value'];
|
||||||
|
|
||||||
if (value.status == 200) {
|
if (value.status == 200) {
|
||||||
let retriveData = value.records;
|
let retriveData = value.records;
|
||||||
this.isReadOnly = true;
|
// this.isReadOnly = true;
|
||||||
|
|
||||||
|
/** Backend Data of Asper Statement */
|
||||||
let result = Object.keys(value.records.date_per_financial).map(function(key) {
|
let result = Object.keys(value.records.date_per_financial).map(function(key) {
|
||||||
return value.records.date_per_financial[key];
|
return value.records.date_per_financial[key];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (result.length > 0) {
|
||||||
|
this.customerCommentsFlag = result.length == 1 ? false : true;
|
||||||
|
result.forEach((val,index) => {
|
||||||
|
//financial_date.push(this.createDate());
|
||||||
|
this.FY_annualSalesInwords[index] = this._pd.convertNumberToWords(val.financial_annual_sale);
|
||||||
|
this.FY_netProfitAmtInwords[index] = this._pd.convertNumberToWords(val.financial_net_profit);
|
||||||
|
this.FY_netLossAmtInwords[index] = this._pd.convertNumberToWords(val.financial_net_loss);
|
||||||
|
financial_date.push(this.createDate(''));
|
||||||
|
});
|
||||||
|
retriveData.date_per_financial = result;
|
||||||
|
} else {
|
||||||
|
//financial_date.push(this.createDate());
|
||||||
|
financial_date.push(this.createDate(''));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Backend Data of Asper Customer */
|
||||||
let result_val = Object.keys(value.records.estimated_value).map(function(key) {
|
let result_val = Object.keys(value.records.estimated_value).map(function(key) {
|
||||||
return value.records.estimated_value[key];
|
return value.records.estimated_value[key];
|
||||||
});
|
});
|
||||||
if (result.length > 0) {
|
|
||||||
this.customerCommentsFlag = result.length == 1 ? false : true;
|
if (result_val.length > 0) {
|
||||||
result.forEach((val,index) => {
|
result_val.forEach((val,index) => {
|
||||||
//financial_date.push(this.createDate());
|
//console.log('dedrf',val.estimate_annual_sale);
|
||||||
this.FY_annualSalesInwords[index] = this._pd.convertNumberToWords(val.financial_annual_sale);
|
// this.AV_annualSalesInwords[index] = this._pd.convertNumberToWords(val.estimate_annual_sale);
|
||||||
this.FY_netProfitAmtInwords[index] = this._pd.convertNumberToWords(val.financial_net_profit);
|
// this.AV_netProfitAmtInwords[index] = this._pd.convertNumberToWords(val.estimate_net_profit);
|
||||||
this.FY_netLossAmtInwords[index] = this._pd.convertNumberToWords(val.financial_net_loss);
|
// this.AV_netLossAmtInwords[index] = this._pd.convertNumberToWords(val.estimate_net_loss);
|
||||||
financial_date.push(this.createDate(''));
|
this.AV_SalesInwords = this._pd.convertNumberToWords(val.estimate_sales_average);
|
||||||
});
|
this.AV_marginProfitAmtInwords = this._pd.convertNumberToWords(val.estimate_profit_margin);
|
||||||
retriveData.date_per_financial = result;
|
this.AV_netProfitAmtInwords = this._pd.convertNumberToWords(val.estimate_net_profit);
|
||||||
} else {
|
this.AV_marginLossAmtInwords = this._pd.convertNumberToWords(val.estimate_loss_margin);
|
||||||
//financial_date.push(this.createDate());
|
this.AV_netLossAmtInwords = this._pd.convertNumberToWords(val.estimate_net_loss);
|
||||||
financial_date.push(this.createDate(''));
|
estimated_val.push(this.createValue(''));
|
||||||
}
|
});
|
||||||
if (result_val.length > 0) {
|
retriveData.estimated_value = result_val;
|
||||||
result_val.forEach((val,index) => {
|
} else {
|
||||||
//console.log('dedrf',val.estimate_annual_sale);
|
estimated_val.push(this.createValue(''));
|
||||||
this.AV_annualSalesInwords[index] = this._pd.convertNumberToWords(val.estimate_annual_sale);
|
}
|
||||||
this.AV_netProfitAmtInwords[index] = this._pd.convertNumberToWords(val.estimate_net_profit);
|
|
||||||
this.AV_netLossAmtInwords[index] = this._pd.convertNumberToWords(val.estimate_net_loss);
|
|
||||||
estimated_val.push(this.createValue(''));
|
|
||||||
});
|
|
||||||
retriveData.estimated_value = result_val;
|
|
||||||
} else {
|
|
||||||
estimated_val.push(this.createValue(''));
|
|
||||||
}
|
|
||||||
retriveData.pdid = this.pdid;
|
retriveData.pdid = this.pdid;
|
||||||
retriveData.formid = this.form_id;
|
retriveData.formid = this.form_id;
|
||||||
retriveData.company_id = this.company_id;
|
retriveData.company_id = this.company_id;
|
||||||
@ -133,10 +161,12 @@ export class FinancialInfoComponent implements OnInit {
|
|||||||
this.financialForm.setValue(retriveData);
|
this.financialForm.setValue(retriveData);
|
||||||
} else {
|
} else {
|
||||||
//financial_date.push(this.createDate());
|
//financial_date.push(this.createDate());
|
||||||
//estimated_val.push(this.createValue(''));
|
//estimated_val.push(this.createValue(''));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** financial Form Controls */
|
||||||
public initstockForm(): void {
|
public initstockForm(): void {
|
||||||
this.financialForm = this.fb.group({
|
this.financialForm = this.fb.group({
|
||||||
pdid: this.pdid,
|
pdid: this.pdid,
|
||||||
@ -144,14 +174,19 @@ export class FinancialInfoComponent implements OnInit {
|
|||||||
company_id: this.company_id,
|
company_id: this.company_id,
|
||||||
fk_createdby: this.pdid,
|
fk_createdby: this.pdid,
|
||||||
financial_remarks: [''],
|
financial_remarks: [''],
|
||||||
staring_financial_year : ['',Validators.compose([Validators.minLength(4),Validators.maxLength(4)])],
|
is_financial_statements:[''],
|
||||||
total_financial_year : [''],
|
is_financial_customer:[''],
|
||||||
|
financial_starting_year : ['',Validators.compose([Validators.minLength(4),Validators.maxLength(4)])],
|
||||||
|
financial_no_of_year : [''],
|
||||||
financial_reason: [''],
|
financial_reason: [''],
|
||||||
same_as_financial_statements:[''],
|
financial_customer:[''],
|
||||||
|
// same_as_financial_statements:[''],
|
||||||
date_per_financial: this.fb.array([]),
|
date_per_financial: this.fb.array([]),
|
||||||
estimated_value: this.fb.array([])
|
estimated_value: this.fb.array([])
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Old code For CREATING financial Statement */
|
||||||
// createDate() {
|
// createDate() {
|
||||||
// return this.fb.group({
|
// return this.fb.group({
|
||||||
// financial_year: ['', Validators.compose([ Validators.pattern(/^[0-9]{4}-[0-9]{2}$/)])],
|
// financial_year: ['', Validators.compose([ Validators.pattern(/^[0-9]{4}-[0-9]{2}$/)])],
|
||||||
@ -162,6 +197,9 @@ export class FinancialInfoComponent implements OnInit {
|
|||||||
// financial_reason: [''],
|
// financial_reason: [''],
|
||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
/** CREATING financial Statement ( financial_year AutoGenerate ) */
|
||||||
createDate(date) {
|
createDate(date) {
|
||||||
return this.fb.group({
|
return this.fb.group({
|
||||||
financial_year: [date, Validators.compose([Validators.pattern(/^[0-9]{4}-[0-9]{2}$/)])],
|
financial_year: [date, Validators.compose([Validators.pattern(/^[0-9]{4}-[0-9]{2}$/)])],
|
||||||
@ -172,38 +210,99 @@ export class FinancialInfoComponent implements OnInit {
|
|||||||
financial_margin_of_profit: [''],
|
financial_margin_of_profit: [''],
|
||||||
financial_margin_of_loss: [''],
|
financial_margin_of_loss: [''],
|
||||||
financial_variation: [''],
|
financial_variation: [''],
|
||||||
|
financial_profit_to_sale_variation:[''],
|
||||||
financial_annualsales_variation : [''],
|
financial_annualsales_variation : [''],
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** CREATING financial Customer ( financial_year AutoGenerate ) */
|
||||||
createValue(date) {
|
createValue(date) {
|
||||||
return this.fb.group({
|
return this.fb.group({
|
||||||
estimate_year: [date, Validators.compose([Validators.pattern(/^[0-9]{4}-[0-9]{2}$/)])],
|
// estimate_year: [date, Validators.compose([Validators.pattern(/^[0-9]{4}-[0-9]{2}$/)])],
|
||||||
estimate_annual_sale: ['', Validators.compose([Validators.pattern(/^[0-9\(\)]+$/)])],
|
// estimate_annual_sale: ['', Validators.compose([Validators.pattern(/^[0-9\(\)]+$/)])],
|
||||||
|
// estimate_sales_from: [''],
|
||||||
|
// estimate_sales_to: [''],
|
||||||
|
// estimate_sales_average: [''],
|
||||||
|
// estimate_profit_or_loss:[''],
|
||||||
|
// estimate_net_profit: ['', Validators.compose([Validators.pattern(/^-?[1-9]\d*|0$/)])],
|
||||||
|
// estimate_net_loss: ['', Validators.compose([Validators.pattern(/^-?[1-9]\d*|0$/)])],
|
||||||
|
// //estimate_margin: [''],
|
||||||
|
// estimate_margin_of_profit: [''],
|
||||||
|
// estimate_margin_of_loss: [''],
|
||||||
|
// estimate_variation: [''],
|
||||||
|
// estimate_annualsales_variation : [''],
|
||||||
|
// estimate_reason: [''],
|
||||||
|
|
||||||
|
// estimate_year: ['', Validators.compose([Validators.pattern(/^[0-9]{4}-[0-9]{2}$/)])],
|
||||||
|
estimate_sales_from: [''],
|
||||||
|
estimate_sales_to: [''],
|
||||||
|
estimate_sales_average: [''],
|
||||||
estimate_profit_or_loss:[''],
|
estimate_profit_or_loss:[''],
|
||||||
estimate_net_profit: ['', Validators.compose([Validators.pattern(/^-?[1-9]\d*|0$/)])],
|
estimate_profit_range_from:[''],
|
||||||
estimate_net_loss: ['', Validators.compose([Validators.pattern(/^-?[1-9]\d*|0$/)])],
|
estimate_profit_range_to:[''],
|
||||||
//estimate_margin: [''],
|
estimate_profit_margin_percent:[''],
|
||||||
estimate_margin_of_profit: [''],
|
estimate_profit_margin:[''],
|
||||||
estimate_margin_of_loss: [''],
|
estimate_net_profit_from:[''],
|
||||||
estimate_variation: [''],
|
estimate_net_profit_to:[''],
|
||||||
estimate_annualsales_variation : [''],
|
estimate_net_profit_percent:[''],
|
||||||
|
estimate_net_profit:[''],
|
||||||
|
estimate_loss_range_from:[''],
|
||||||
|
estimate_loss_range_to:[''],
|
||||||
|
estimate_loss_margin_percent:[''],
|
||||||
|
estimate_loss_margin:[''],
|
||||||
|
estimate_net_loss_from:[''],
|
||||||
|
estimate_net_loss_to:[''],
|
||||||
|
estimate_net_loss_percent:[''],
|
||||||
|
estimate_net_loss:[''],
|
||||||
|
|
||||||
|
// estimate_net_profit: ['', Validators.compose([Validators.pattern(/^-?[1-9]\d*|0$/)])],
|
||||||
|
// estimate_net_loss: ['', Validators.compose([Validators.pattern(/^-?[1-9]\d*|0$/)])],
|
||||||
|
// estimate_margin: [''],
|
||||||
|
// estimate_margin_of_profit: [''],
|
||||||
|
// estimate_margin_of_loss: [''],
|
||||||
|
// estimate_variation: [''],
|
||||||
|
// estimate_annualsales_variation : [''],
|
||||||
// estimate_reason: [''],
|
// estimate_reason: [''],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Feteching financial Customer */
|
||||||
createValuewithData(value) {
|
createValuewithData(value) {
|
||||||
return this.fb.group({
|
return this.fb.group({
|
||||||
estimate_year: [value.estimate_year, Validators.compose([ Validators.pattern(/^[0-9]{4}-[0-9]{2}$/)])],
|
// estimate_year: [value.estimate_year, Validators.compose([ Validators.pattern(/^[0-9]{4}-[0-9]{2}$/)])],
|
||||||
estimate_annual_sale: [value.estimate_annual_sale, Validators.compose([ Validators.pattern(/^[0-9\(\)]+$/)])],
|
// estimate_year: [date, Validators.compose([Validators.pattern(/^[0-9]{4}-[0-9]{2}$/)])],
|
||||||
|
estimate_sales_from: [value.estimate_sales_from],
|
||||||
|
estimate_sales_to: [value.estimate_sales_to],
|
||||||
|
estimate_sales_average: [value.estimate_sales_average],
|
||||||
estimate_profit_or_loss:[value.estimate_profit_or_loss],
|
estimate_profit_or_loss:[value.estimate_profit_or_loss],
|
||||||
estimate_net_loss: [value.estimate_net_loss, Validators.compose([Validators.pattern(/^-?[1-9]\d*|0$/)])],
|
estimate_profit_range_from:[value.estimate_profit_range_from],
|
||||||
estimate_net_profit: [value.estimate_net_profit, Validators.compose([ Validators.pattern(/^-?[1-9]\d*|0$/)])],
|
estimate_profit_range_to:[value.estimate_profit_range_to],
|
||||||
//estimate_margin: [value.],
|
estimate_profit_margin_percent:[value.estimate_profit_margin_percent],
|
||||||
estimate_margin_of_profit: [value.estimate_margin_of_profit],
|
estimate_profit_margin:[value.estimate_profit_margin],
|
||||||
estimate_margin_of_loss: [value.estimate_margin_of_loss],
|
estimate_net_profit_from:[value.estimate_net_profit_from],
|
||||||
estimate_variation: [value.estimate_variation],
|
estimate_net_profit_to:[value.estimate_net_profit_to],
|
||||||
estimate_annualsales_variation : [value.estimate_annualsales_variation],
|
estimate_net_profit_percent:[value.estimate_net_profit_percent],
|
||||||
|
estimate_net_profit:[value.estimate_net_profit],
|
||||||
|
estimate_loss_range_from:[value.estimate_loss_range_from],
|
||||||
|
estimate_loss_range_to:[value.estimate_loss_range_to],
|
||||||
|
estimate_loss_margin_percent:[value.estimate_loss_margin_percent],
|
||||||
|
estimate_loss_margin:[value.estimate_loss_margin],
|
||||||
|
estimate_net_loss_from:[value.estimate_net_loss_from],
|
||||||
|
estimate_net_loss_to:[value.estimate_net_loss_to],
|
||||||
|
estimate_net_loss_percent:[value.estimate_net_loss_percent],
|
||||||
|
estimate_net_loss:[value.estimate_net_loss],
|
||||||
|
// estimate_annual_sale: [value.estimate_annual_sale, Validators.compose([ Validators.pattern(/^[0-9\(\)]+$/)])],
|
||||||
|
// estimate_sales_from: [''],
|
||||||
|
// estimate_sales_to: [''],
|
||||||
|
// estimate_sales_average: [''],
|
||||||
|
// estimate_profit_or_loss:[value.estimate_profit_or_loss],
|
||||||
|
// estimate_net_loss: [value.estimate_net_loss, Validators.compose([Validators.pattern(/^-?[1-9]\d*|0$/)])],
|
||||||
|
// estimate_net_profit: [value.estimate_net_profit, Validators.compose([ Validators.pattern(/^-?[1-9]\d*|0$/)])],
|
||||||
|
// //estimate_margin: [value.],
|
||||||
|
// estimate_margin_of_profit: [value.estimate_margin_of_profit],
|
||||||
|
// estimate_margin_of_loss: [value.estimate_margin_of_loss],
|
||||||
|
// estimate_variation: [value.estimate_variation],
|
||||||
|
// estimate_annualsales_variation : [value.estimate_annualsales_variation],
|
||||||
// estimate_reason: [''],
|
// estimate_reason: [''],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -216,6 +315,7 @@ export class FinancialInfoComponent implements OnInit {
|
|||||||
const control = <FormArray>this.financialForm.controls['date_per_financial'];
|
const control = <FormArray>this.financialForm.controls['date_per_financial'];
|
||||||
control.removeAt(index);
|
control.removeAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
addGoods() {
|
addGoods() {
|
||||||
const control = <FormArray>this.financialForm.controls['estimated_value'];
|
const control = <FormArray>this.financialForm.controls['estimated_value'];
|
||||||
//control.push(this.createValue());
|
//control.push(this.createValue());
|
||||||
@ -224,9 +324,11 @@ export class FinancialInfoComponent implements OnInit {
|
|||||||
const control = <FormArray>this.financialForm.controls['estimated_value'];
|
const control = <FormArray>this.financialForm.controls['estimated_value'];
|
||||||
control.removeAt(index);
|
control.removeAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** For Auto-generating FinYear */
|
||||||
dynamicalFinYear($event){
|
dynamicalFinYear($event){
|
||||||
|
|
||||||
//console.log(this.financialForm.controls['total_financial_year'].value);
|
//console.log(this.financialForm.controls['financial_no_of_year'].value);
|
||||||
//console.log('data',$event.target.value);
|
//console.log('data',$event.target.value);
|
||||||
let e = $event.target.value;
|
let e = $event.target.value;
|
||||||
if(e == 1){
|
if(e == 1){
|
||||||
@ -236,7 +338,7 @@ export class FinancialInfoComponent implements OnInit {
|
|||||||
this.customerCommentsFlag = true;
|
this.customerCommentsFlag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
let startingYear = this.financialForm.controls['staring_financial_year'].value;
|
let startingYear = this.financialForm.controls['financial_starting_year'].value;
|
||||||
|
|
||||||
const control = <FormArray>this.financialForm.controls['date_per_financial'];
|
const control = <FormArray>this.financialForm.controls['date_per_financial'];
|
||||||
|
|
||||||
@ -248,59 +350,29 @@ export class FinancialInfoComponent implements OnInit {
|
|||||||
for(let i = 1 ; i<= e ; i++ ){
|
for(let i = 1 ; i<= e ; i++ ){
|
||||||
let Year = (+startingYear+(i-1)) +'-'+ ((+startingYear)+(+i));
|
let Year = (+startingYear+(i-1)) +'-'+ ((+startingYear)+(+i));
|
||||||
control.push(this.createDate(Year));
|
control.push(this.createDate(Year));
|
||||||
//console.log(this.financialForm.controls['staring_financial_year'].value);
|
//console.log(this.financialForm.controls['financial_starting_year'].value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedType(e: any): void {
|
selectedStatement(e :any):void{
|
||||||
if(e.value == 'yes'){
|
|
||||||
let startingYear = this.financialForm.controls['staring_financial_year'].value;
|
|
||||||
let totalFinYear = this.financialForm.controls['total_financial_year'].value;
|
|
||||||
//let YearParam = (+startingYear) +'-'+ ((+startingYear+1));
|
|
||||||
let array = <FormArray>this.financialForm.controls['date_per_financial'];
|
|
||||||
const control = <FormArray>this.financialForm.controls['estimated_value'];
|
|
||||||
|
|
||||||
|
if(e.value == 'yes'){
|
||||||
|
|
||||||
|
this.isDisplay = true;
|
||||||
|
this.financialForm.controls['is_financial_customer'].setValue('');
|
||||||
|
const control = <FormArray>this.financialForm.controls['estimated_value'];
|
||||||
while (control.length !== 0) {
|
while (control.length !== 0) {
|
||||||
control.removeAt(0);
|
control.removeAt(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(array.length > 0 ){
|
|
||||||
|
|
||||||
array.value.forEach((val,index)=>{
|
|
||||||
let vals = {
|
|
||||||
estimate_year: val.financial_year,
|
|
||||||
estimate_annual_sale: val.financial_annual_sale,
|
|
||||||
estimate_profit_or_loss:val.finanical_profit_or_loss,
|
|
||||||
estimate_net_loss: val.financial_net_loss,
|
|
||||||
estimate_net_profit: val.financial_net_profit,
|
|
||||||
estimate_margin_of_profit: val.financial_margin_of_profit,
|
|
||||||
estimate_margin_of_loss: val.financial_margin_of_loss,
|
|
||||||
estimate_variation: val.financial_variation,
|
|
||||||
estimate_annualsales_variation : val.financial_annualsales_variation,
|
|
||||||
};
|
|
||||||
this.AV_annualSalesInwords[index] = this._pd.convertNumberToWords(val.financial_annual_sale);
|
|
||||||
this.AV_netProfitAmtInwords[index] = this._pd.convertNumberToWords(val.financial_net_profit);
|
|
||||||
this.AV_netLossAmtInwords[index] = this._pd.convertNumberToWords(val.financial_net_loss);
|
|
||||||
control.push(this.createValuewithData(vals));
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//control.controls[0].get('raw_quantity').setValidators([Validators.required]);
|
|
||||||
|
|
||||||
// for(let i = 1 ; i<= totalFinYear ; i++ ){
|
|
||||||
// let Year = (+startingYear+(i-1)) +'-'+ ((+startingYear)+(+i));
|
|
||||||
// control.push(this.createValue(Year));
|
|
||||||
// }
|
|
||||||
|
|
||||||
//control.push(this.createValue(YearParam));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (e.value == 'no'){
|
else if (e.value == 'no'){
|
||||||
|
|
||||||
let startingYear = this.financialForm.controls['staring_financial_year'].value;
|
this.isDisplay = false;
|
||||||
let totalFinYear = this.financialForm.controls['total_financial_year'].value;
|
// let startingYear = this.financialForm.controls['financial_starting_year'].value;
|
||||||
|
// let totalFinYear = this.financialForm.controls['financial_no_of_year'].value;
|
||||||
|
|
||||||
const control = <FormArray>this.financialForm.controls['estimated_value'];
|
const control = <FormArray>this.financialForm.controls['estimated_value'];
|
||||||
|
|
||||||
@ -308,13 +380,118 @@ export class FinancialInfoComponent implements OnInit {
|
|||||||
control.removeAt(0);
|
control.removeAt(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(totalFinYear > 0 ){
|
const statementControl = <FormArray>this.financialForm.controls['date_per_financial'];
|
||||||
for(let i = 1 ; i<= totalFinYear ; i++ ){
|
|
||||||
let Year = (+startingYear+(i-1)) +'-'+ ((+startingYear)+(+i));
|
while (statementControl.length !== 0) {
|
||||||
control.push(this.createValue(Year));
|
statementControl.removeAt(0);
|
||||||
//console.log(this.financialForm.controls['staring_financial_year'].value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.financialForm.controls['financial_starting_year'].setValue('');
|
||||||
|
this.financialForm.controls['financial_no_of_year'].setValue('');
|
||||||
|
|
||||||
|
|
||||||
|
// alert((new Date()).getFullYear());
|
||||||
|
let year1 = (new Date()).getFullYear();
|
||||||
|
let year2 = ((new Date()).getFullYear() + 1);
|
||||||
|
|
||||||
|
let Year = year1 +'-'+ year2;
|
||||||
|
control.push(this.createValue(''));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/** fin customer data from Fin statement*/
|
||||||
|
selectedFinancialCustomer(e: any): void {
|
||||||
|
if(e.value == 'yes'){
|
||||||
|
const control = <FormArray>this.financialForm.controls['estimated_value'];
|
||||||
|
|
||||||
|
while (control.length !== 0) {
|
||||||
|
control.removeAt(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if(e.value == 'yes'){
|
||||||
|
// let startingYear = this.financialForm.controls['financial_starting_year'].value;
|
||||||
|
|
||||||
|
// const control = <FormArray>this.financialForm.controls['date_per_financial'];
|
||||||
|
|
||||||
|
// while (control.length !== 0) {
|
||||||
|
// control.removeAt(0);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if(e > 0 ){
|
||||||
|
// for(let i = 1 ; i<= e ; i++ ){
|
||||||
|
// let Year = (+startingYear+(i-1)) +'-'+ ((+startingYear)+(+i));
|
||||||
|
// control.push(this.createDate(Year));
|
||||||
|
// //console.log(this.financialForm.controls['financial_starting_year'].value);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if(e.value == 'yes'){
|
||||||
|
// let startingYear = this.financialForm.controls['financial_starting_year'].value;
|
||||||
|
// let totalFinYear = this.financialForm.controls['financial_no_of_year'].value;
|
||||||
|
|
||||||
|
// const control = <FormArray>this.financialForm.controls['estimated_value'];
|
||||||
|
|
||||||
|
// while (control.length !== 0) {
|
||||||
|
// control.removeAt(0);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if(totalFinYear > 0 ){
|
||||||
|
// for(let i = 1 ; i<= totalFinYear ; i++ ){
|
||||||
|
// let Year = (+startingYear+(i-1)) +'-'+ ((+startingYear)+(+i));
|
||||||
|
// control.push(this.createValue(Year));
|
||||||
|
// //console.log(this.financialForm.controls['financial_starting_year'].value);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if(array.length > 0 ){
|
||||||
|
|
||||||
|
// array.value.forEach((val,index)=>{
|
||||||
|
// let vals = {
|
||||||
|
// estimate_year: val.financial_year,
|
||||||
|
// estimate_sales_from: '',
|
||||||
|
// estimate_sales_to: '',
|
||||||
|
// estimate_sales_average: '',
|
||||||
|
// // estimate_annual_sale: val.financial_annual_sale,
|
||||||
|
// estimate_profit_or_loss:val.finanical_profit_or_loss,
|
||||||
|
// estimate_net_loss: val.financial_net_loss,
|
||||||
|
// estimate_net_profit: val.financial_net_profit,
|
||||||
|
// estimate_margin_of_profit: val.financial_margin_of_profit,
|
||||||
|
// estimate_margin_of_loss: val.financial_margin_of_loss,
|
||||||
|
// estimate_variation: val.financial_variation,
|
||||||
|
// estimate_annualsales_variation : val.financial_annualsales_variation,
|
||||||
|
// };
|
||||||
|
// this.AV_annualSalesInwords[index] = this._pd.convertNumberToWords(val.financial_annual_sale);
|
||||||
|
// this.AV_netProfitAmtInwords[index] = this._pd.convertNumberToWords(val.financial_net_profit);
|
||||||
|
// this.AV_netLossAmtInwords[index] = this._pd.convertNumberToWords(val.financial_net_loss);
|
||||||
|
// control.push(this.createValuewithData(vals));
|
||||||
|
// });
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
//control.controls[0].get('raw_quantity').setValidators([Validators.required]);
|
||||||
|
//control.push(this.createValue(YearParam));
|
||||||
|
|
||||||
|
// }
|
||||||
|
else if (e.value == 'no'){
|
||||||
|
|
||||||
|
// let startingYear = this.financialForm.controls['financial_starting_year'].value;
|
||||||
|
// let totalFinYear = this.financialForm.controls['financial_no_of_year'].value;
|
||||||
|
|
||||||
|
const control = <FormArray>this.financialForm.controls['estimated_value'];
|
||||||
|
|
||||||
|
while (control.length !== 0) {
|
||||||
|
control.removeAt(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
alert((new Date()).getFullYear());
|
||||||
|
let year1 = (new Date()).getFullYear();
|
||||||
|
let year2 = ((new Date()).getFullYear() - 1);
|
||||||
|
|
||||||
|
let Year = year2 +'-'+ year1;
|
||||||
|
alert(Year);
|
||||||
|
control.push(this.createValue(Year));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,6 +506,8 @@ export class FinancialInfoComponent implements OnInit {
|
|||||||
// // detail.controls.financial_variation.disable()
|
// // detail.controls.financial_variation.disable()
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
/**calculating Annual Sale for financial Statement */
|
||||||
calFinAnnualSale(index,detail){
|
calFinAnnualSale(index,detail){
|
||||||
let annual_sale = detail.value.financial_annual_sale;
|
let annual_sale = detail.value.financial_annual_sale;
|
||||||
if (index != 0) {
|
if (index != 0) {
|
||||||
@ -339,8 +518,8 @@ export class FinancialInfoComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
calculateEstimationAnnualSale(index,detail){
|
/** calculating Annual Sale for financial Customer */
|
||||||
//alert('Function Inside');
|
calculateEstimationAnnualSale(index,detail){
|
||||||
let annual_sale = detail.value.estimate_annual_sale;
|
let annual_sale = detail.value.estimate_annual_sale;
|
||||||
if (index != 0) {
|
if (index != 0) {
|
||||||
let array = <FormArray>this.financialForm.controls['estimated_value'];
|
let array = <FormArray>this.financialForm.controls['estimated_value'];
|
||||||
@ -350,6 +529,8 @@ export class FinancialInfoComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** calculating Yearwise Variation for financial statement */
|
||||||
calYearVariation(index, detail) {
|
calYearVariation(index, detail) {
|
||||||
|
|
||||||
let profit = detail.value.financial_net_profit;
|
let profit = detail.value.financial_net_profit;
|
||||||
@ -361,56 +542,18 @@ export class FinancialInfoComponent implements OnInit {
|
|||||||
|
|
||||||
let prev_profit = array.value[index - 1].financial_net_profit != '' ? array.value[index - 1].financial_net_profit : 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 ;
|
let prev_loss = array.value[index - 1].financial_net_loss !='' ? array.value[index - 1].financial_net_loss : 0 ;
|
||||||
let prev_year = array.value[index - 1].financial_year;
|
|
||||||
let prev_annual_sale = array.value[index-1].financial_annual_sale;
|
|
||||||
loss = loss != 0 ? loss * (-1) : loss;
|
loss = loss != 0 ? loss * (-1) : loss;
|
||||||
prev_loss = prev_loss != 0 ? prev_loss * (-1) : prev_loss ;
|
prev_loss = prev_loss != 0 ? prev_loss * (-1) : prev_loss ;
|
||||||
//let variation2 = ((()))
|
|
||||||
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;
|
||||||
//console.log('console.log(Math.abs(profit));',Math.abs(variation));
|
|
||||||
// let variation ;
|
|
||||||
// if(profit != ''){
|
|
||||||
// variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? prev_profit : prev_loss)) * 100 * (profit != '' ? (1) : (-1)) ;
|
|
||||||
// }
|
|
||||||
// else if(loss != ''){
|
|
||||||
// variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? prev_profit : prev_loss)) * 100 * (profit != '' ? (1) : (-1));
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// let annual_sale_variation = (annual_sale - prev_annual_sale) * 100 ;
|
|
||||||
|
|
||||||
detail.controls.financial_variation.setValue(variation.toFixed(2));
|
detail.controls.financial_variation.setValue(variation.toFixed(2));
|
||||||
|
|
||||||
//Increase in Sales in FY 2017-18 over sales in FY 2016-17 is 11.11%
|
|
||||||
|
|
||||||
// this.SalesStatement[index] = ( variation <= 0 ? 'Decreases ' : 'Increases ' ) + 'in Sales in FY ' + curr_year + ' Over Sales in FY '+ prev_year + ' is ' + variation.toFixed(2) + '%';
|
|
||||||
// console.log('this.SlesStatement',this.SalesStatement);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if(detail.value.finanical_profit_or_loss == 1){
|
/** old code == calculating Sale PERCENTAGE for financial statement */
|
||||||
// let profit = detail.value.financial_net_profit;
|
|
||||||
|
|
||||||
// if ( profit != '' && index != 0) {
|
|
||||||
|
|
||||||
// let array = <FormArray>this.financialForm.controls['date_per_financial']
|
|
||||||
// let prev_profit = array.value[index - 1].financial_net_profit;
|
|
||||||
// let variation = ((profit - prev_profit)/ prev_profit) * 100;
|
|
||||||
// detail.controls.financial_variation.setValue(variation.toFixed(2))
|
|
||||||
// }
|
|
||||||
// }else if (detail.value.finanical_profit_or_loss == 2){
|
|
||||||
// let loss = detail.value.financial_net_loss;
|
|
||||||
|
|
||||||
// if ( loss != '' && index != 0) {
|
|
||||||
|
|
||||||
// let array = <FormArray>this.financialForm.controls['date_per_financial']
|
|
||||||
// let prev_loss = array.value[index - 1].financial_net_loss;
|
|
||||||
// let variation = ((loss - prev_loss)/ prev_loss) * 100;
|
|
||||||
// detail.controls.financial_variation.setValue(variation.toFixed(2))
|
|
||||||
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
// calMargin(index, detail) {
|
// calMargin(index, detail) {
|
||||||
// console.log('detail', detail);
|
// console.log('detail', detail);
|
||||||
// let salary = detail.value.financial_annual_sale;
|
// let salary = detail.value.financial_annual_sale;
|
||||||
@ -422,12 +565,17 @@ export class FinancialInfoComponent implements OnInit {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
/** For Financial Statement
|
||||||
|
* Calculating Sale percentage based on profit and loss
|
||||||
|
* And calculating Variation over sales
|
||||||
|
*/
|
||||||
calMargin(index, detail) {
|
calMargin(index, detail) {
|
||||||
// let array = <FormArray>this.financialForm.controls['date_per_financial'];
|
|
||||||
let salary = detail.value.financial_annual_sale;
|
|
||||||
// let prev_annual_sale = array.value[index-1].financial_annual_sale;
|
|
||||||
// let annual_sale_variation = ((prev_annual_sale - salary)/salary ) * 100 ;
|
|
||||||
|
|
||||||
|
let salary = detail.value.financial_annual_sale;
|
||||||
|
let profit_margin;
|
||||||
|
let loss_margin;
|
||||||
|
// let prev_annual_sale = array.value[index-1].financial_annual_sale;
|
||||||
|
// let annual_sale_variation = ((prev_annual_sale - salary)/salary ) * 100 ;
|
||||||
|
|
||||||
if(detail.value.finanical_profit_or_loss == 1){
|
if(detail.value.finanical_profit_or_loss == 1){
|
||||||
|
|
||||||
@ -435,18 +583,12 @@ export class FinancialInfoComponent implements OnInit {
|
|||||||
|
|
||||||
if (salary != '' && profit != '') {
|
if (salary != '' && profit != '') {
|
||||||
// if(salary < profit){
|
// if(salary < profit){
|
||||||
// alert('if condition salary = '+salary);
|
|
||||||
// alert('if condition Profit = '+profit);
|
|
||||||
// detail.controls.financial_margin_of_profit.setValue('');
|
// detail.controls.financial_margin_of_profit.setValue('');
|
||||||
// }
|
// }
|
||||||
// else{
|
// else{
|
||||||
// alert('else condition salary = '+salary);
|
profit_margin = (profit / salary) * 100;
|
||||||
// alert('else condition Profit = '+profit);
|
detail.controls.financial_margin_of_profit.setValue(profit_margin.toFixed(2));
|
||||||
let margin = (profit / salary) * 100;
|
|
||||||
// alert(' '+margin);
|
|
||||||
detail.controls.financial_margin_of_profit.setValue(margin.toFixed(2));
|
|
||||||
// }
|
// }
|
||||||
// detail.controls.financial_margin.disable()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -454,16 +596,44 @@ export class FinancialInfoComponent implements OnInit {
|
|||||||
|
|
||||||
let loss = detail.value.financial_net_loss;
|
let loss = detail.value.financial_net_loss;
|
||||||
|
|
||||||
if (salary != '' && loss != '') {
|
if (salary != '' && loss != '') {
|
||||||
// alert('if condition salary = '+salary);
|
|
||||||
// alert('if condition loss = '+loss);
|
loss_margin = (loss / salary) * 100 * (-1);
|
||||||
let margin = (loss / salary) * 100 * (-1);
|
detail.controls.financial_margin_of_loss.setValue(loss_margin.toFixed(2));
|
||||||
detail.controls.financial_margin_of_loss.setValue(margin.toFixed(2));
|
|
||||||
// detail.controls.financial_margin.disable()
|
// detail.controls.financial_margin.disable()
|
||||||
}
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ((profit_margin != '' || loss_margin != '') && index != 0) {
|
||||||
|
|
||||||
|
// console.log('profit_margin',profit_margin);
|
||||||
|
// console.log('loss_margin',loss_margin);
|
||||||
|
// console.log('index',index);
|
||||||
|
|
||||||
|
let array = <FormArray>this.financialForm.controls['date_per_financial'];
|
||||||
|
// console.log('array',array);
|
||||||
|
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 ;
|
||||||
|
|
||||||
|
// console.log('preprofit_margin',prev_profit_margin);
|
||||||
|
// console.log('preloss_margin',prev_profit_margin);
|
||||||
|
|
||||||
|
loss_margin = loss_margin != 0 ? loss_margin * (-1) : loss_margin;
|
||||||
|
prev_loss_margin = prev_loss_margin != 0 ? prev_loss_margin * (-1) : prev_loss_margin ;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
detail.controls.financial_profit_to_sale_variation.setValue(variation_percent.toFixed(2));
|
||||||
|
|
||||||
}
|
}
|
||||||
//detail.controls.financial_annualsales_variation.setValue(annual_sale_variation.toFixed(2));
|
//detail.controls.financial_annualsales_variation.setValue(annual_sale_variation.toFixed(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** For Financial Customer
|
||||||
|
* Calculating Yearwise Variation
|
||||||
|
*/
|
||||||
calVariation(index, detail) {
|
calVariation(index, detail) {
|
||||||
// console.log('CalVar In');
|
// console.log('CalVar In');
|
||||||
// let profit = detail.value.estimate_net_profit;
|
// let profit = detail.value.estimate_net_profit;
|
||||||
@ -487,7 +657,7 @@ export class FinancialInfoComponent implements OnInit {
|
|||||||
|
|
||||||
let prev_profit = array.value[index - 1].estimate_net_profit != '' ? array.value[index - 1].estimate_net_profit : 1;
|
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_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;
|
// let prev_year = array.value[index - 1].estimate_year;
|
||||||
loss = loss != 0 ? loss * (-1) : loss;
|
loss = loss != 0 ? loss * (-1) : loss;
|
||||||
prev_loss = prev_loss != 0 ? prev_loss * (-1) : prev_loss ;
|
prev_loss = prev_loss != 0 ? prev_loss * (-1) : prev_loss ;
|
||||||
|
|
||||||
@ -504,6 +674,9 @@ export class FinancialInfoComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** For Financial Customer
|
||||||
|
* Calculating AnnualSales Variation
|
||||||
|
*/
|
||||||
calMarginVal(index, detail) {
|
calMarginVal(index, detail) {
|
||||||
let salary = detail.value.estimate_annual_sale;
|
let salary = detail.value.estimate_annual_sale;
|
||||||
|
|
||||||
@ -622,6 +795,181 @@ export class FinancialInfoComponent implements OnInit {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
confirmAlert(i, details){
|
||||||
|
|
||||||
|
let estimate_sales_from = +details.value.estimate_sales_from;
|
||||||
|
let estimate_sales_to = +details.value.estimate_sales_to;
|
||||||
|
|
||||||
|
if (estimate_sales_from != null && estimate_sales_to != null){
|
||||||
|
|
||||||
|
let C = (estimate_sales_to - estimate_sales_from)
|
||||||
|
let D = (C / estimate_sales_from) * 100;
|
||||||
|
// % Decrease = Decrease ÷ Original Number × 100
|
||||||
|
|
||||||
|
if(D >= 30){
|
||||||
|
var r = confirm("Given Sales Range is greater than 30%");
|
||||||
|
if (r == true) {
|
||||||
|
details.controls.estimate_sales_to.setValue(estimate_sales_to);
|
||||||
|
}else{
|
||||||
|
details.controls.estimate_sales_to.setValue('');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
details.controls.estimate_sales_to.setValue(estimate_sales_to);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.calculateSalesAverage(i, details);
|
||||||
|
}
|
||||||
|
|
||||||
|
calculateSalesAverage(i, details){
|
||||||
|
|
||||||
|
let estimate_sales_from = details.value.estimate_sales_from;
|
||||||
|
let estimate_sales_to = details.value.estimate_sales_to;
|
||||||
|
|
||||||
|
if(estimate_sales_from != '' && estimate_sales_to != ''){
|
||||||
|
|
||||||
|
let range1 = +estimate_sales_from/10;
|
||||||
|
|
||||||
|
// console.log('range1',range1);
|
||||||
|
|
||||||
|
let lower = (+estimate_sales_from)+range1;
|
||||||
|
let higer = ((+estimate_sales_to + +estimate_sales_from) / 2);
|
||||||
|
// console.log(lower);
|
||||||
|
// console.log(higer);
|
||||||
|
|
||||||
|
if(lower > higer){
|
||||||
|
details.controls.estimate_sales_average.setValue(higer.toFixed(2));
|
||||||
|
this.AV_SalesInwords[i] = this._pd.convertNumberToWords(higer);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
details.controls.estimate_sales_average.setValue(lower.toFixed(2));
|
||||||
|
this.AV_SalesInwords[i] = this._pd.convertNumberToWords(lower);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
// alert('Check Both Sales Range Fields');
|
||||||
|
details.controls.estimate_sales_average.setValue('');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
calculateMarginProfit( i, details){
|
||||||
|
|
||||||
|
let sales_average = details.value.estimate_sales_average;
|
||||||
|
let estimate_profit_range_from = details.value.estimate_profit_range_from;
|
||||||
|
let estimate_profit_range_to = details.value.estimate_profit_range_to;
|
||||||
|
|
||||||
|
if (sales_average != '' && estimate_profit_range_from != '' && estimate_profit_range_to != ''){
|
||||||
|
|
||||||
|
let profit_percent = (estimate_profit_range_to + estimate_profit_range_from)/2;
|
||||||
|
let Profit_Average = (profit_percent*sales_average)/100;
|
||||||
|
|
||||||
|
details.controls.estimate_profit_margin.setValue(Math.round(Profit_Average));
|
||||||
|
details.controls.estimate_profit_margin_percent.setValue(profit_percent);
|
||||||
|
|
||||||
|
this.AV_marginProfitAmtInwords[i] = this._pd.convertNumberToWords(Math.round(Profit_Average));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
calculateProfitAmount( i, details){
|
||||||
|
|
||||||
|
let sales_average = details.value.estimate_sales_average;
|
||||||
|
|
||||||
|
let estimate_net_profit_from = details.value.estimate_net_profit_from;
|
||||||
|
let estimate_net_profit_to = details.value.estimate_net_profit_to;
|
||||||
|
|
||||||
|
if (sales_average != '' && estimate_net_profit_from != '' && estimate_net_profit_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 profit_amount = (estimate_net_profit_to + estimate_net_profit_from)/2;
|
||||||
|
let Profit_percent = (profit_amount/sales_average)*100;
|
||||||
|
|
||||||
|
details.controls.estimate_net_profit.setValue(Math.round(profit_amount));
|
||||||
|
details.controls.estimate_net_profit_percent.setValue(Profit_percent);
|
||||||
|
|
||||||
|
this.AV_netProfitAmtInwords[i] = this._pd.convertNumberToWords(Math.round(profit_amount));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
calculateMarginLoss( i, details){
|
||||||
|
|
||||||
|
let sales_average = details.value.estimate_sales_average;
|
||||||
|
let estimate_loss_range_from = details.value.estimate_loss_range_from;
|
||||||
|
let estimate_loss_range_to = details.value.estimate_loss_range_to;
|
||||||
|
|
||||||
|
if (sales_average != '' && estimate_loss_range_from != '' && estimate_loss_range_to != ''){
|
||||||
|
|
||||||
|
let loss_percent = (estimate_loss_range_to + estimate_loss_range_from)/2;
|
||||||
|
let loss_Average = (loss_percent*sales_average)/100;
|
||||||
|
|
||||||
|
details.controls.estimate_loss_margin.setValue(Math.round(loss_Average));
|
||||||
|
details.controls.estimate_loss_margin_percent.setValue(loss_percent);
|
||||||
|
|
||||||
|
this.AV_marginLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(loss_Average));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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_profit.setValue(Math.round(loss_amount));
|
||||||
|
details.controls.estimate_net_profit_percent.setValue(loss_percent);
|
||||||
|
|
||||||
|
this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(Math.round(loss_amount));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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() {
|
submitDetails() {
|
||||||
|
|
||||||
if(this.financialForm.value.date_per_financial['finanical_profit_or_loss'] == 1){
|
if(this.financialForm.value.date_per_financial['finanical_profit_or_loss'] == 1){
|
||||||
@ -653,16 +1001,27 @@ export class FinancialInfoComponent implements OnInit {
|
|||||||
this.financialForm.value.date_per_financial['financial_margin_of_loss'].updateValueAndValidity();
|
this.financialForm.value.date_per_financial['financial_margin_of_loss'].updateValueAndValidity();
|
||||||
}
|
}
|
||||||
// if (!this.financialForm.valid) {
|
// if (!this.financialForm.valid) {
|
||||||
|
// this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
let records = this.financialForm.value;
|
let records = this.financialForm.value;
|
||||||
this._pd.saveForm(records).subscribe(data => {
|
this._pd.saveForm(records).subscribe(data => {
|
||||||
this.notifier.notify('success', 'Saved Successfully.');
|
if(data.status == 200) {
|
||||||
|
this.notifier.notify('success', 'Saved Successfully.');
|
||||||
|
// this.dialogRef.close();
|
||||||
|
setTimeout(() =>{
|
||||||
|
this.dialogRef.close();
|
||||||
|
},3000);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
|
}
|
||||||
//this.dialogRef.close();
|
//this.dialogRef.close();
|
||||||
}, error => {
|
}, error => {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
validateAllFormFields(formGroup: FormGroup) {
|
validateAllFormFields(formGroup: FormGroup) {
|
||||||
Object.keys(formGroup.controls).forEach(field => {
|
Object.keys(formGroup.controls).forEach(field => {
|
||||||
const control = formGroup.get(field);
|
const control = formGroup.get(field);
|
||||||
|
|||||||
@ -26,7 +26,7 @@ export class NeighbourHoodComponent implements OnInit {
|
|||||||
{'id': 2,'name': "Negative"},
|
{'id': 2,'name': "Negative"},
|
||||||
{'id': 3,'name': "Insufficient information provided"}];
|
{'id': 3,'name': "Insufficient information provided"}];
|
||||||
amtInwords : any = [];
|
amtInwords : any = [];
|
||||||
constructor(notifier: NotifierService, private _pd: PdTrigerService ,private _fb: FormBuilder, @Inject(MAT_DIALOG_DATA) public data: 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.pdid = this.data.pdmaster_details.pd_id;
|
||||||
this.notifier = notifier;
|
this.notifier = notifier;
|
||||||
this.form_id = 19;
|
this.form_id = 19;
|
||||||
@ -209,6 +209,7 @@ export class NeighbourHoodComponent implements OnInit {
|
|||||||
let resultMessage:string='';
|
let resultMessage:string='';
|
||||||
if (this._neighbourhoodForm.invalid) {
|
if (this._neighbourhoodForm.invalid) {
|
||||||
this.validateAllFormFields(this._neighbourhoodForm);
|
this.validateAllFormFields(this._neighbourhoodForm);
|
||||||
|
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -260,13 +261,15 @@ export class NeighbourHoodComponent implements OnInit {
|
|||||||
saveRecords.neighbour_reference_remark=formData.neighbour_reference_remark;
|
saveRecords.neighbour_reference_remark=formData.neighbour_reference_remark;
|
||||||
this._pd.savePDFormDetailsWithID(saveRecords).subscribe(
|
this._pd.savePDFormDetailsWithID(saveRecords).subscribe(
|
||||||
dataresult => {
|
dataresult => {
|
||||||
|
// this.notifier.notify('success', resultMessage);
|
||||||
if (dataresult.status == 200) {
|
if (dataresult.status == 200) {
|
||||||
this.notifier.notify('success', resultMessage);
|
this.notifier.notify('success', 'Saved Successfully.');
|
||||||
|
setTimeout(() =>{
|
||||||
|
this.dialogRef.close();
|
||||||
|
},3000);
|
||||||
}
|
}
|
||||||
else {
|
else{
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
// this.errorMessage = "Some Thing Wents Wrong Try Again !";
|
|
||||||
}
|
}
|
||||||
}, error => {
|
}, error => {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
|
|||||||
@ -50,6 +50,7 @@ export class OtherIncomeComponent implements OnInit {
|
|||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private _pd: PdTrigerService,
|
private _pd: PdTrigerService,
|
||||||
|
private dialogRef: MatDialogRef<OtherIncomeComponent>,
|
||||||
@Inject(MAT_DIALOG_DATA) public pd_all_details: any)
|
@Inject(MAT_DIALOG_DATA) public pd_all_details: any)
|
||||||
{
|
{
|
||||||
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
|
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
|
||||||
@ -169,6 +170,7 @@ public viewerOptions: any = {
|
|||||||
}
|
}
|
||||||
submitCurrentDetails() {
|
submitCurrentDetails() {
|
||||||
if (!this.otherIncomeForm.valid) {
|
if (!this.otherIncomeForm.valid) {
|
||||||
|
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let records: any = {};
|
let records: any = {};
|
||||||
@ -184,8 +186,15 @@ public viewerOptions: any = {
|
|||||||
|
|
||||||
// console.log('data', records);
|
// console.log('data', records);
|
||||||
this._pd.saveForm(records).subscribe(data => {
|
this._pd.saveForm(records).subscribe(data => {
|
||||||
// console.log('data', data);
|
if(data.status == 200) {
|
||||||
this.notifier.notify('success', 'Saved Successfully.');
|
this.notifier.notify('success', 'Saved Successfully.');
|
||||||
|
setTimeout(() =>{
|
||||||
|
this.dialogRef.close();
|
||||||
|
},3000);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
|
}
|
||||||
}, error => {
|
}, error => {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
})
|
})
|
||||||
|
|||||||
@ -31,6 +31,7 @@ export class RentalInfoComponent implements OnInit {
|
|||||||
private _fb: FormBuilder,
|
private _fb: FormBuilder,
|
||||||
private _pd: PdTrigerService,
|
private _pd: PdTrigerService,
|
||||||
private _aws:AwsService,
|
private _aws:AwsService,
|
||||||
|
private dialogRef: MatDialogRef<RentalInfoComponent>,
|
||||||
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
|
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
|
||||||
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
|
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
|
||||||
this.notifier = notifier;
|
this.notifier = notifier;
|
||||||
@ -180,13 +181,21 @@ export class RentalInfoComponent implements OnInit {
|
|||||||
|
|
||||||
rentalSubmit() {
|
rentalSubmit() {
|
||||||
if (!this.rentalForm.valid) {
|
if (!this.rentalForm.valid) {
|
||||||
|
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log('form', this.rentalForm.value);
|
// console.log('form', this.rentalForm.value);
|
||||||
let records = this.rentalForm.value;
|
let records = this.rentalForm.value;
|
||||||
this._pd.saveForm(records).subscribe(data => {
|
this._pd.saveForm(records).subscribe(data => {
|
||||||
console.log('data', data);
|
if (data.status == 200) {
|
||||||
this.notifier.notify('success', 'Saved Successfully.');
|
this.notifier.notify('success', 'Saved Successfully.');
|
||||||
|
setTimeout(() =>{
|
||||||
|
this.dialogRef.close();
|
||||||
|
},3000);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
|
}
|
||||||
}, error => {
|
}, error => {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user