merge : kms

This commit is contained in:
gandhimathi 2018-12-31 18:51:23 +05:30
parent c6ea021dca
commit 5125209c6e
17 changed files with 731 additions and 285 deletions

View File

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

View File

@ -13,9 +13,10 @@
</div>
<mat-tab-group>
<mat-tab label="PD Data">
<div>
Export
<button (click)="export()">Export Excel</button>
<div align="end" style="padding: 12px;">
<button matTooltip="Export Excel" matTooltipPosition="above" color="primary" mat-icon-button mat-raised-button (click)="export()">
<mat-icon style="color: white;">cloud_download</mat-icon>
</button>
</div>
<div>
<div>

View File

@ -266,7 +266,7 @@ export class PdReportComponent implements OnInit {
console.log(blob);
let datass = blob.headers.get('content-disposition');
let fileName = datass.split(/"/)[1];
this.notifier.notify('success', 'Your Changes Updated.!');
// this.notifier.notify('success', 'Your Changes Updated.!');
const blobs = new Blob([blob.body],
{ type: 'application/vnd.ms-excel' });
const file = new File([blobs], fileName,

View File

@ -322,17 +322,17 @@ export class AddressComponent implements OnInit {
records.bussiness_address_type_others = this.addressForm.controls.bussiness_address_type_others.value;
}
}
console.log('this.addressForm.controls.additional_premises.value',this.addressForm.controls.additional_premises.value);
this.addressForm.controls.additional_premises.value.forEach((val,index)=>
{
console.log('val.premises_city',val.premises_city);
if(val.premises_city != '' && val.premises_city != null){
this.formPremisesCityArray = [];
val.premises_city.forEach(option => {
this.formPremisesCityArray.push({additional_premises_city: option});
this.addressForm.controls.additional_premises.value[index].premises_city = this.formPremisesCityArray;
});
this.addressForm.controls.additional_premises.value[index].premises_city = this.formPremisesCityArray;
}
else{
this.formPremisesCityArray = [];
@ -348,6 +348,7 @@ export class AddressComponent implements OnInit {
records.formid = '5';
// records.fk_createdby = '250';
console.log(JSON.stringify(records));
this._pd.saveForm(records).subscribe(data => {

View File

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

View File

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

View File

@ -20,67 +20,112 @@
<div fxFlex="100">
<mat-card>
<mat-card-header>
<p>Data as Per Financial Statements<p>
<mat-card-title><p> Data as Per Financial Statements</p></mat-card-title>
</mat-card-header>
<mat-form-field>
<input matInput autocomplete="off" placeholder="Starting Year Of Financial" formControlName="staring_financial_year" >
<mat-error> Please provide Correct Year Format. Format Should Be (YYYY)</mat-error>
</mat-form-field>
<mat-form-field>
<input matInput autocomplete="off" placeholder="Number of Year in Financial" formControlName="total_financial_year" (change)="dynamicalFinYear($event)">
<div style="width:100%">
<mat-form-field style="width:35%">
<mat-label>Starting Financial Year</mat-label>
<input matInput autocomplete="off" placeholder="YYYY eg.2018" formControlName="staring_financial_year" (keypress)="keyPress($event)">
<mat-error> Invalid year format</mat-error>
</mat-form-field>
<!-- <mat-form-field hintLabel="Max 10 characters">
<input matInput #input maxlength="10" placeholder="Enter some input">
<mat-hint align="end">{{input.value?.length || 0}}/10</mat-hint>
</mat-form-field> -->
<mat-form-field style="width:35%">
<input matInput autocomplete="off" placeholder="Number of Financial Years" formControlName="total_financial_year" (change)="dynamicalFinYear($event)" (keypress)="keyPress($event)" [readonly]="isReadOnly">
</mat-form-field>
</div>
<div *ngIf="total_financial_year != ''" 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">
<mat-card-content class="matcard">
<mat-form-field>
<!-- <input matInput autocomplete="off" placeholder="Year (format: 2015-16)" formControlName="financial_year" > -->
<input matInput autocomplete="off" placeholder="Latest Financial Year" formControlName="financial_year" >
</mat-form-field>
<mat-form-field>
<mat-label class="highlight"> <i>Financial Year : {{details.get('financial_year').value}} </i> </mat-label>
<hr>
<div style="width:100%">
<br>
<mat-form-field style="width:30%">
<!-- <input matInput autocomplete="off" placeholder="Annual Sale" formControlName="financial_annual_sale" (change)="calMargin(i, details)" type="number" > -->
<input matInput autocomplete="off" placeholder="Annual Sale" formControlName="financial_annual_sale" (change)="calMargin(i, details)" (keypress)="keyPress($event)" >
<input matInput autocomplete="off" placeholder="Annual Sale" formControlName="financial_annual_sale" (change)="calFinAnnualSale(i, details)" (keypress)="keyPress($event)" (keyup)="inWords($event,i,1)">
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('financial_annual_sale').value != ''">{{"&#8377;"}} {{FY_annualSalesInwords[i]}} Only</mat-hint>
</mat-form-field>
<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="financial_annualsales_variation" (keypress)="keyPress($event)">
<mat-hint align="end" *ngIf="details.get('financial_annualsales_variation').value != '' " >
<span *ngIf="details.get('financial_annualsales_variation').value == 0">
No differents in Sales in FY <i> {{details.get('financial_year').value}} </i> over Sales in FY <i> {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} </i>
</span>
<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>
</span>
<span *ngIf="details.get('financial_annualsales_variation').value < 0" class="highlight">
Decrease in Sales in FY <i> {{details.get('financial_year').value}} </i> over Sales in FY <i>{{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} </i> <b> {{(details.get('financial_annualsales_variation').value).replace('-', '')}} % </b>
</span>
</mat-hint>
</mat-form-field>
</span>
</div>
<div style="width:100%">
<mat-form-field style="width:30%">
<!-- <input matInput autocomplete="off" placeholder="Net Profit / Loss" formControlName="financial_net_profit" (change)="calMargin( i, details); calYearVariation( i, details)" type="number" > -->
<mat-select placeholder="Is there Net Profit or Net Loss?" formControlName="finanical_profit_or_loss" >
<!-- (selectionChange)="selectedProfitOrLossType($event,1)> -->
<mat-option value="1" >Net Profit</mat-option>
<mat-option value="2" >Net Loss</mat-option>
</mat-select>
</mat-form-field>
<span *ngIf="details.get('finanical_profit_or_loss').value == 1 ">
<mat-form-field>
<!-- <input matInput autocomplete="off" placeholder="Net Profit to Sales %" formControlName="financial_margin" (keypress)="keyPress($event)" > -->
<input matInput autocomplete="off" placeholder="Net Profit Amount" formControlName="financial_net_profit" (change)="calMargin( i, details); calYearVariation( i, details)" (keypress)="keyPress($event)" >
<mat-form-field style="width:28%">
<input matInput autocomplete="off" placeholder="Net Profit Amount" formControlName="financial_net_profit" (change)="calMargin( i, details); calYearVariation( i, details)" (keypress)="keyPress($event)" (keyup)="inWords($event,i,2)">
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('financial_net_profit').value != ''">{{"&#8377;"}} {{FY_netProfitAmtInwords[i]}} Only</mat-hint>
</mat-form-field>
<mat-form-field>
<input matInput autocomplete="off" placeholder="Net Profit to Sales %" formControlName="financial_margin_of_profit" (keypress)="keyPress($event)" >
<mat-form-field style="width:28%">
<input matInput autocomplete="off" placeholder="Net Profit to Sales in %" formControlName="financial_margin_of_profit" (keypress)="keyPress($event)" >
</mat-form-field>
</span>
<span *ngIf="details.get('finanical_profit_or_loss').value == 2 ">
<mat-form-field>
<input matInput autocomplete="off" placeholder="Net Loss Amount" formControlName="financial_net_loss" (change)="calMargin( i, details); calYearVariation( i, details)" (keypress)="keyPress($event)" >
<mat-form-field style="width:28%">
<input matInput autocomplete="off" placeholder="Net Loss Amount" formControlName="financial_net_loss" (change)="calMargin( i, details); calYearVariation( i, details)" (keypress)="keyPress($event)" (keyup)="inWords($event,i,3)">
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('financial_net_loss').value != ''">{{"&#8377;"}} {{FY_netLossAmtInwords[i]}} Only</mat-hint>
</mat-form-field>
<mat-form-field>
<input matInput autocomplete="off" placeholder="Net Loss to Sales %" formControlName="financial_margin_of_loss" (keypress)="keyPress($event)" >
<mat-form-field style="width:28%">
<input matInput autocomplete="off" placeholder="Net Loss to Sales in %" formControlName="financial_margin_of_loss" (keypress)="keyPress($event)">
</mat-form-field>
</span>
<mat-form-field *ngIf="i != 0" style="width:65%">
<input matInput autocomplete="off" [ngClass]="{'highlight': (details.controls['financial_variation'].value > 40) || (details.controls['financial_variation'].value < -40)}" placeholder="Variation from Previous Year" formControlName="financial_variation" (keypress)="keyPress($event)">
<!-- <mat-hint align="end" *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">
</div>
{{details.get('variation').value <= 0 ? 'Decreases ' : 'Increases '}} in Sales in FY Over Sales in FY is % <!-- variation <= 0 ? ) + 'in Sales in FY ' + curr_year + ' Over Sales in FY '+ prev_year + ' is ' + variation.toFixed(2) + '%'; -->
<!-- {{details.get('variation').value <= 0 ? 'Decreases ' : 'Increases '}} in Sales in FY {{details.get('financial_year').value}} Over Sales in FY' {{details.get('financial_year').value}} 'is' {{details.get('variation').value}} % <!-- variation <= 0 ? ) + 'in Sales in FY ' + curr_year + ' Over Sales in FY '+ prev_year + ' is ' + variation.toFixed(2) + '%'; -->
<span *ngIf="i != 0">
<mat-form-field style="width:65%">
<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="end" *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">
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>
</span>
<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>
</span>
<span *ngIf="details.get('financial_variation').value < 0" class="highlight">
Decrease in Profit in FY <i> {{details.get('financial_year').value}} </i> over Profit in FY <i> {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} </i> <b> {{(details.get('financial_variation').value).replace('-', '')}} % </b>
</span>
</mat-hint>
<!-- this.SalesStatement[index] = ( variation <= 0 ? 'Decreases ' : 'Increases ' ) + 'in Sales in FY ' + curr_year + ' Over Sales in FY '+ prev_year + ' is ' + variation.toFixed(2) + '%'; -->
<!-- “Increase in Sales in FY 2017-2018 over sales in FY 2016-2017 is 11.11%” -->
<!-- <mat-hint align="end" *ngIf="i != 0" [ngClass]="{'highlight': (details.controls['financial_variation'].value > 40) || (details.controls['financial_variation'].value < -40)}" >{{SalesStatement[i]}}</mat-hint> -->
</mat-form-field>
</span>
<mat-form-field *ngIf="customerCommentsFlag" style="width:65%">
<mat-form-field *ngIf="i != 0 && customerCommentsFlag" style="width:65%">
<!-- <input matInput autocomplete="off" placeholder="Reason For Major Difference" formControlName="financial_reason" > -->
<input matInput autocomplete="off" placeholder="Customer Comments on variances in Financials" formControlName="financial_reason" >
</mat-form-field>
@ -89,10 +134,10 @@
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 type="button" mat-raised-button mat-icon-button (click)="deleteDate(i)"
<!-- <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>
</button> -->
</mat-card-content>
</div>
</div>
@ -104,52 +149,93 @@
<!-- start co applicant form details -->
<mat-card>
<mat-card-header>
<p>Actual Values as per Customer<p>
<mat-card-title><p> Actual Values as per Customer</p></mat-card-title>
</mat-card-header>
<mat-form-field *ngIf="total_financial_year != ''">
<mat-form-field *ngIf="total_financial_year != ''" style="width:35%">
<mat-select placeholder="Same as Financial Statements?" formControlName="same_as_financial_statements" (selectionChange)="selectedType($event)">
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
</mat-form-field>
<div formArrayName="estimated_value">
<div *ngFor="let details of financialForm.controls.estimated_value['controls']; let i=index"
[formGroupName]="i">
<mat-card-content class="matcard">
<mat-label class="highlight"> <i>Financial Year : {{details.get('estimate_year').value}} </i> </mat-label>
<hr>
<mat-form-field>
<!-- <input matInput autocomplete="off" placeholder="Year (format: 2015-16)" formControlName="estimate_year" > -->
<div style="width:100%">
<br>
<!-- <mat-form-field style="width:25%">
<!-- <input matInput autocomplete="off" placeholder="Year (format: 2015-16)" formControlName="estimate_year" > ->
<input matInput autocomplete="off" placeholder="Year" formControlName="estimate_year" >
</mat-form-field> -->
<mat-form-field style="width:30%">
<input matInput autocomplete="off" placeholder="Annual Sale" formControlName="estimate_annual_sale" (change)="calMarginVal( i, details)" (keypress)="keyPress($event)" (keyup)="inWords($event,i,4)" (change)="calculateEstimationAnnualSale(i, details);">
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('estimate_annual_sale').value != ''">{{"&#8377;"}} {{AV_annualSalesInwords[i]}} Only</mat-hint>
</mat-form-field>
<mat-form-field>
<input matInput autocomplete="off" placeholder="Annual Sale" formControlName="estimate_annual_sale" (change)="calMarginVal( i, details)" (keypress)="keyPress($event)" >
<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="end" *ngIf="details.get('estimate_annualsales_variation').value != '' " >
<span *ngIf="details.get('estimate_annualsales_variation').value == 0">
No differents in Sales in FY <i> {{details.get('estimate_year').value}} </i> over Sales in FY <i> {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} </i>
</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>
<mat-form-field>
</span>
</div>
<div style="width:100%">
<mat-form-field style="width:30%">
<!-- <input matInput autocomplete="off" placeholder="Net Profit / Loss" formControlName="financial_net_profit" (change)="calMargin( i, details); calYearVariation( i, details)" type="number" > -->
<mat-select placeholder="Is there Net Profit or Net Loss?" formControlName="estimate_profit_or_loss" >
<!-- (selectionChange)="selectedProfitOrLossType($event.value,2)"> -->
<mat-option value="1" >Net Profit</mat-option>
<mat-option value="2" >Net Loss</mat-option>
</mat-select>
</mat-form-field>
<span *ngIf="details.get('estimate_profit_or_loss').value == 1 ">
<mat-form-field>
<input matInput autocomplete="off" placeholder="Net Profit Amount" formControlName="estimate_net_profit" (change)="calMarginVal( i, details); calVariation( i, details)" >
<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)">
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('estimate_net_profit').value != ''">{{"&#8377;"}} {{AV_netProfitAmtInwords[i]}} Only</mat-hint>
</mat-form-field>
<mat-form-field>
<input matInput autocomplete="off" disabled placeholder="Margin" formControlName="estimate_margin_of_profit" (keypress)="keyPress($event)" >
<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)" >
</mat-form-field>
</span>
<span *ngIf="details.get('estimate_profit_or_loss').value == 2 ">
<mat-form-field>
<input matInput autocomplete="off" placeholder="Net Loss" formControlName="estimate_net_loss" (change)="calMarginVal( i, details); calVariation( i, details)" >
<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)">
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('estimate_net_loss').value != ''">{{"&#8377;"}} {{AV_netLossAmtInwords[i]}} Only</mat-hint>
</mat-form-field>
<mat-form-field>
<input matInput autocomplete="off" disabled placeholder="Margin" formControlName="estimate_margin_of_loss" (keypress)="keyPress($event)" (change)="calAmount(i, details); calVariation( i, details)" >
<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)" >
</mat-form-field>
</span>
</div>
<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" formControlName="estimate_variation" (keypress)="keyPress($event)">
<mat-hint align="end" [ngClass]="{'highlight': (details.controls['estimate_variation'].value >= 40) || (details.controls['estimate_variation'].value < -40)}" > {{details.controls['estimate_variation'].value}} {{details.controls['estimate_year'].value}}
<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="end" [ngClass]="{'highlight': (details.controls['estimate_variation'].value >= 40) || (details.controls['estimate_variation'].value < -40)}" >
<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>
</span>
<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>
</span>
<span *ngIf="details.get('estimate_variation').value < 0" class="highlight">
Decrease in Profit in FY <i> {{details.get('estimate_year').value}} </i>over Profit in FY <i> {{financialForm.controls.estimated_value['controls'][i-1].get('estimate_year').value}} </i> <b> {{(details.get('estimate_variation').value).replace('-', '')}} % </b>
</span>
<!-- {{details.controls[''].value}} {{details.controls[''].value}} -->
<!-- 'details.controls['estimate_variation'].value <= 0' ? 'Decreases ' : 'Increases ' + 'in Sales in FY ' + curr_year + ' Over Sales in FY '+ prev_year + ' is ' + {{details.controls['estimate_variation'].value}} + '%'; -->
</mat-hint>
</mat-form-field>
@ -160,10 +246,10 @@
matTooltip="Add More Estimated Value" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" *ngIf="i==0">
<mat-icon>add</mat-icon>
</button> -->
<button type="button" mat-raised-button mat-icon-button (click)="deleteGoods(i)"
<!-- <button type="button" mat-raised-button mat-icon-button (click)="deleteGoods(i)"
matTooltip="Delete" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" *ngIf="i>0">
<mat-icon>delete</mat-icon>
</button>
</button> -->
</mat-card-content>
</div>
</div>
@ -313,10 +399,10 @@
<input matInput autocomplete="off" placeholder="Net Profit / Loss" formControlName="financial_net_profit" (change)="calMargin( i, details); calYearVariation( i, details)" type="number" >
</mat-form-field>
<mat-form-field>
<input matInput autocomplete="off" placeholder="Net Profit to Sales %" formControlName="financial_margin" (keypress)="keyPress($event)" >
<input matInput autocomplete="off" placeholder="Net Profit to Sales" formControlName="financial_margin" (keypress)="keyPress($event)" >
</mat-form-field>
<mat-form-field *ngIf="i != 0">
<input matInput autocomplete="off" [ngClass]="{'highlight': (details.controls['financial_variation'].value > 40) || (details.controls['financial_variation'].value < -40)}" placeholder="Variation from Previous Year" 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="Variation from Previous Year in %" formControlName="financial_variation" (keypress)="keyPress($event)">
</mat-form-field>
<mat-form-field>
<input matInput autocomplete="off" placeholder="Reason For Major Difference" formControlName="financial_reason" >
@ -355,7 +441,7 @@
<input matInput autocomplete="off" disabled placeholder="Margin" formControlName="estimate_margin" (keypress)="keyPress($event)" >
</mat-form-field>
<mat-form-field *ngIf="i != 0">
<input matInput autocomplete="off" [ngClass]="{'highlight': details.controls['estimate_variation'].value >= 40 || details.controls['estimate_variation'].value >= -40}" placeholder="Variation from Previous Year" 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-form-field>
<!--<mat-form-field>
<input matInput autocomplete="off" placeholder="Reason For Major Difference" formControlName="estimate_reason" >

View File

@ -17,6 +17,15 @@
// background: #62B013;
// color: white;
// }
.underline input {
border: none;
}
.greenhighlight {
color: green;
}
.highlight {
color: red;
}

View File

@ -22,6 +22,7 @@ import {
/** Service */
import { PdTrigerService } from '../../../../../pd-service/pd-triger.service';
import {ActivatedRoute, Router} from '@angular/router';
//import { Alert } from 'selenium-webdriver';
@Component({
selector: 'app-financial-info',
@ -39,6 +40,14 @@ export class FinancialInfoComponent implements OnInit {
placeholderName : any = [];
setmargin: AbstractControl;
customerCommentsFlag :boolean;
FY_annualSalesInwords : any = [];
FY_netProfitAmtInwords : any = [];
FY_netLossAmtInwords : any = [];
AV_annualSalesInwords : any = [];
AV_netProfitAmtInwords : any = [];
AV_netLossAmtInwords : any = [];
isReadOnly : boolean = false;
constructor(notifier: NotifierService,
private fb: FormBuilder,
private route: ActivatedRoute,
@ -80,6 +89,7 @@ export class FinancialInfoComponent implements OnInit {
const estimated_val = <FormArray>this.financialForm.controls['estimated_value'];
if (value.status == 200) {
let retriveData = value.records;
this.isReadOnly = true;
let result = Object.keys(value.records.date_per_financial).map(function(key) {
return value.records.date_per_financial[key];
});
@ -87,8 +97,11 @@ export class FinancialInfoComponent implements OnInit {
return value.records.estimated_value[key];
});
if (result.length > 0) {
result.forEach(val => {
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;
@ -97,7 +110,12 @@ export class FinancialInfoComponent implements OnInit {
financial_date.push(this.createDate(''));
}
if (result_val.length > 0) {
result_val.forEach(val => {
console.log(result_val);
result_val.forEach((val,index) => {
//console.log('dedrf',val.estimate_annual_sale);
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;
@ -147,6 +165,7 @@ export class FinancialInfoComponent implements OnInit {
financial_margin_of_profit: [''],
financial_margin_of_loss: [''],
financial_variation: [''],
financial_annualsales_variation : [''],
financial_reason: [''],
});
}
@ -161,6 +180,7 @@ export class FinancialInfoComponent implements OnInit {
estimate_margin_of_profit: [''],
estimate_margin_of_loss: [''],
estimate_variation: [''],
estimate_annualsales_variation : [''],
// estimate_reason: [''],
});
}
@ -176,6 +196,7 @@ export class FinancialInfoComponent implements OnInit {
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: [''],
});
}
@ -241,7 +262,7 @@ export class FinancialInfoComponent implements OnInit {
if(array.length > 0 ){
console.log(array.length);
for (let val of array.value) {
array.value.forEach((val,index)=>{
let vals = {
estimate_year: val.financial_year,
estimate_annual_sale: val.financial_annual_sale,
@ -251,9 +272,13 @@ export class FinancialInfoComponent implements OnInit {
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));
}
});
}
@ -299,31 +324,81 @@ export class FinancialInfoComponent implements OnInit {
// // detail.controls.financial_variation.disable()
// }
// }
calFinAnnualSale(index,detail){
//alert('FIn Annual Sales Data');
console.log(index);
console.log()
let annual_sale = detail.value.financial_annual_sale;
if (index != 0) {
let array = <FormArray>this.financialForm.controls['date_per_financial'];
let prev_annual_sale = array.value[index-1].financial_annual_sale;
let annual_sale_variation = (( annual_sale - prev_annual_sale)/prev_annual_sale) * 100 ;
detail.controls.financial_annualsales_variation.setValue(annual_sale_variation.toFixed(2));
console.log('annual sales variation in %',annual_sale_variation);
}
}
calculateEstimationAnnualSale(index,detail){
//alert('Function Inside');
console.log(detail);
let annual_sale = detail.value.estimate_annual_sale;
console.log(annual_sale);
console.log(index);
// console.log(annual_sale);
if (index != 0) {
let array = <FormArray>this.financialForm.controls['estimated_value'];
let prev_annual_sale = array.value[index-1].estimate_annual_sale;
let annual_sale_variation = (( annual_sale - prev_annual_sale)/prev_annual_sale) * 100 ;
detail.controls.estimate_annualsales_variation.setValue(annual_sale_variation.toFixed(2));
console.log('estimate annual sales variation in %',annual_sale_variation);
}
}
calYearVariation(index, detail) {
let profit = detail.value.financial_net_profit;
let loss = detail.value.financial_net_loss;
let curr_year = detail.value.financial_year;
this.SalesStatement[0] = 0.00;
if ( (profit != '' || loss != '') && index != 0) {
let array = <FormArray>this.financialForm.controls['date_per_financial'];
console.log(array.value[index - 1].financial_net_profit);
console.log('Profit',profit);
console.log(Math.abs(profit));
let prev_profit = array.value[index - 1].financial_net_profit != '' ? array.value[index - 1].financial_net_profit : 0;
console.log('Profitpre',prev_profit);
let prev_loss = array.value[index - 1].financial_net_loss !='' ? array.value[index - 1].financial_net_loss : 0 ;
let prev_year = array.value[index - 1].financial_year;
let prev_annual_sale = array.value[index-1].financial_annual_sale;
console.log('loss',loss);
loss = loss != 0 ? loss * (-1) : loss;
console.log('-1 loss',loss);
console.log('pre_loss',prev_loss);
prev_loss = prev_loss != 0 ? prev_loss * (-1) : prev_loss ;
console.log('-1 pre loss',prev_loss);
console.log(Math.abs(profit));
//let variation2 = ((()))
let variation = (((profit != '' ? profit : loss ) - (prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? Math.abs(prev_profit) : Math.abs(prev_loss))) * 100;
//console.log('console.log(Math.abs(profit));',Math.abs(variation));
console.log(variation);
// let variation ;
// if(profit != ''){
// variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? prev_profit : prev_loss)) * 100 * (profit != '' ? (1) : (-1)) ;
// }
// else if(loss != ''){
// variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? prev_profit : prev_loss)) * 100 * (profit != '' ? (1) : (-1));
// }
let variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? prev_profit : prev_loss)) * 100;
// let annual_sale_variation = (annual_sale - prev_annual_sale) * 100 ;
detail.controls.financial_variation.setValue(variation.toFixed(2));
//Increase in Sales in FY 2017-18 over sales in FY 2016-17 is 11.11%
console.log('variation',variation);
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);
console.log('variation in %',variation);
// 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);
}
@ -360,17 +435,32 @@ export class FinancialInfoComponent implements OnInit {
// // detail.controls.financial_margin.disable()
// }
// }
calMargin(index, detail) {
console.log('detail', 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 ;
if(detail.value.finanical_profit_or_loss == 1){
let profit = detail.value.financial_net_profit;
if (salary != '' && profit != '') {
// if(salary < profit){
// alert('if condition salary = '+salary);
// alert('if condition Profit = '+profit);
// detail.controls.financial_margin_of_profit.setValue('');
// }
// else{
// alert('else condition salary = '+salary);
// alert('else condition Profit = '+profit);
let margin = (profit / salary) * 100;
detail.controls.financial_margin_of_profit.setValue(margin.toFixed(2))
// alert(' '+margin);
detail.controls.financial_margin_of_profit.setValue(margin.toFixed(2));
// }
// detail.controls.financial_margin.disable()
}
@ -380,11 +470,14 @@ export class FinancialInfoComponent implements OnInit {
let loss = detail.value.financial_net_loss;
if (salary != '' && loss != '') {
let margin = (loss / salary) * 100;
// alert('if condition salary = '+salary);
// alert('if condition loss = '+loss);
let margin = (loss / salary) * 100 * (-1);
detail.controls.financial_margin_of_loss.setValue(margin.toFixed(2));
// detail.controls.financial_margin.disable()
}
}
//detail.controls.financial_annualsales_variation.setValue(annual_sale_variation.toFixed(2));
}
calVariation(index, detail) {
// console.log('CalVar In');
@ -401,18 +494,27 @@ export class FinancialInfoComponent implements OnInit {
let profit = detail.value.estimate_net_profit;
let loss = detail.value.estimate_net_loss;
let curr_year = detail.value.estimate_year;
//let curr_year = detail.value.estimate_year;
if ( (profit != '' || loss != '') && index != 0) {
let array = <FormArray>this.financialForm.controls['estimated_value'];
console.log(array.value[index - 1].financial_net_profit);
let prev_profit = array.value[index - 1].estimate_net_profit != '' ? array.value[index - 1].estimate_net_profit : 0;
let prev_loss = array.value[index - 1].estimate_net_loss !='' ? array.value[index - 1].estimate_net_loss : 0 ;
let prev_profit = array.value[index - 1].estimate_net_profit != '' ? array.value[index - 1].estimate_net_profit : 1;
let prev_loss = array.value[index - 1].estimate_net_loss !='' ? array.value[index - 1].estimate_net_loss : 1;
let prev_year = array.value[index - 1].estimate_year;
loss = loss != 0 ? loss * (-1) : loss;
prev_loss = prev_loss != 0 ? prev_loss * (-1) : prev_loss ;
let variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? prev_profit : prev_loss)) * 100;
let variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? Math.abs(prev_profit) : Math.abs(prev_loss))) * 100;
// let variation ;
// if(profit != ''){
// variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? prev_profit : prev_loss)) * 100 ;
// }
// else if(loss != ''){
// variation = (((profit != '' ? profit : loss ) - ( prev_profit != '' ? prev_profit : prev_loss ))/ (prev_profit != '' ? prev_profit : prev_loss)) * 100 * (profit != '' ? (1) : (-1));
// }
detail.controls.estimate_variation.setValue(variation.toFixed(2));
}
@ -440,18 +542,16 @@ export class FinancialInfoComponent implements OnInit {
let margin = profit / salary * 100;
console.log('margin',margin);
detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2));
}
}
else if (detail.value.estimate_profit_or_loss == 2){
let loss = detail.value.estimate_net_profit;
let loss = detail.value.estimate_net_loss;
console.log('else if Margin loss',loss);
if (salary != '' && loss != '') {
console.log('elseif if Margin Estimate salary',salary);
console.log('alseif if Margin loss',loss);
let margin = (loss / salary) * 100;
let margin = (loss / salary) * 100 * (-1);
detail.controls.estimate_margin_of_loss.setValue(margin.toFixed(2));
}
@ -459,31 +559,81 @@ export class FinancialInfoComponent implements OnInit {
}
// selectedProfitOrLossType($event,index,flag){
// if(flag == 1){
// let array = <FormArray>this.financialForm.controls['date_per_financial'];
calAmount(i, detail) {
// if($event == 1){
// detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2));
// detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2));
// }
// else if($event == 2){
// detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2));
// detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2));
// }
// }
// else if(flag == 2){
// let array = <FormArray>this.financialForm.controls['estimated_value'];
// if($event == 1){
// detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2));
// detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2));
// }
// else if($event == 2){
// detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2));
// detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2));
// }
// }
// }
calProfitAndLossVal( i, detail) {
console.log(detail);
let salary = detail.value.estimate_annual_sale;
if(detail.value.estimate_profit_or_loss == 1){
// let profit = detail.value.estimate_net_profit;
let margin_profit = detail.value.estimate_margin_of_profit;
if (salary != '' && margin_profit != '') {
//let margin = profit / salary * 100;
let profit = margin_profit / salary * 100;
console.log('margin',margin_profit);
console.log('profit',profit);
//detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2));
let profit = (margin_profit/100)*salary;
detail.controls.estimate_net_profit.setValue(profit.toFixed(2));
this.AV_netProfitAmtInwords[i] = this._pd.convertNumberToWords(profit);
}
}
else if(detail.value.estimate_profit_or_loss == 2){
let margin_loss = detail.value.estimate_margin_of_loss;
if (salary != '' && margin_loss != '') {
let loss = (margin_loss/100)*salary*(-1);
detail.controls.estimate_net_loss.setValue(loss.toFixed(2));
this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(loss);
}
}
}
// calAmount(i, detail) {
// console.log(detail);
// let salary = detail.value.estimate_annual_sale;
// if(detail.value.estimate_profit_or_loss == 1){
// // let profit = detail.value.estimate_net_profit;
// let margin_profit = detail.value.estimate_margin_of_profit;
// if (salary != '' && margin_profit != '') {
// //let margin = profit / salary * 100;
// let profit = margin_profit / salary * 100;
// console.log('margin',margin_profit);
// console.log('profit',profit);
// //detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2));
// detail.controls.estimate_net_profit.setValue(profit.toFixed(2));
// }
// }
// else if (detail.value.estimate_profit_or_loss == 2){
// let loss = detail.value.estimate_net_profit;
@ -497,7 +647,7 @@ export class FinancialInfoComponent implements OnInit {
// }
// }
}
//}
submitDetails() {
if(this.financialForm.value.date_per_financial['finanical_profit_or_loss'] == 1){
@ -554,11 +704,47 @@ export class FinancialInfoComponent implements OnInit {
/** On Key Press Event For Input Field */
keyPress(event: any) {
const pattern = /[0-9\-\.\ ]/;
//const pattern = /[0-9\-\.\ ]/;
const pattern = /[0-9\.]/;
let inputChar = String.fromCharCode(event.charCode);
if (event.keyCode != 8 && !pattern.test(inputChar)) {
event.preventDefault();
}
}
/** To Convert Amount into Words */
inWords(e,i,flag:number){
// console.log(e);
// console.log(i);
// console.log(flag);
switch(flag){
case 1 :
this.FY_annualSalesInwords[i] = this._pd.convertNumberToWords(e.target.value);
// this.placeholderName[i] = 'Weekly Instalment Amount'; break;
break;
case 2 :
this.FY_netProfitAmtInwords[i] = this._pd.convertNumberToWords(e.target.value);
//alert('Fin net Profit'+this.FY_netProfitAmtInwords[i]);
break;
case 3 :
this.FY_netLossAmtInwords[i] = this._pd.convertNumberToWords(e.target.value);
// alert('Fin net Loss'+this.FY_netLossAmtInwords[i]);
break;
case 4 :
this.AV_annualSalesInwords[i] = this._pd.convertNumberToWords(e.target.value);
break;
case 5 :
this.AV_netProfitAmtInwords[i] = this._pd.convertNumberToWords(e.target.value);
break;
case 6 :
this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(e.target.value);
break;
default:
break;
}
}
}

View File

@ -19,8 +19,8 @@
mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Discussion" matTooltipPosition="above"
(click)="getPDStart(viewID)"><mat-icon>question_answer</mat-icon></button>
<button *ngIf="master.pd_type_name && (currentPDStatus===pdStatusCheck.QC_COMPLETED || currentPDStatus===pdStatusCheck.COMPLETED)" mat-raised-button
mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="PD Report" matTooltipPosition="above"
<button *ngIf="master.pd_type_name && (currentPDStatus===pdStatusCheck.QC_COMPLETED || currentPDStatus===pdStatusCheck.COMPLETED)"
mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="PD Report" matTooltipPosition="above"
(click)="getPDIDReport(viewID)"><mat-icon>ballot</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="above"
@ -191,8 +191,7 @@
</ng-template>
</div>
<div class="m-gap p-gap" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50"
fxFlex.lg="50" fxFlex.xl="50">
<div class="m-gap p-gap" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50">
<mat-card>
<div style="color:red !important;">
<h6>QC Notes</h6>
@ -204,13 +203,16 @@
</div>
<div *ngIf="pdMasterData[0]?.pd_status === 'QC_COMPLETED'" class="m-gap p-gap" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50"
fxFlex.lg="50" fxFlex.xl="50">
<mat-card>
<div style="color:red !important;">
<h6>QC Remarks</h6>
</div>
<div>
<div>
<div style="display: inline-flex">
<div style="margin: 12px; font-size: 21px;">
{{ pdMasterData[0]?.qc_rating}}
<div>
</div>
<div style="display: inline-block">
<app-rating [rating]="pd_QC_Rating"></app-rating>
</div>
</div>
@ -219,6 +221,7 @@
<div style="display: inline-block;">
{{ pdMasterData[0]?.qc_feedback}}
</div>
</mat-card>
</div>
</div>
</mat-card-content>

View File

@ -146,5 +146,17 @@ export class TemplatesService {
return this._http.post<any[]>(this.apiUrl + "getPDReportTemplate", { "records": {"fk_template_id": template_id }});
}
// selected Template forms details
getTemplateSelectedForms(template_id: any): Observable<any> {
const options = {
params: new HttpParams().set('template_id', template_id)
};
return this._http.get<any[]>(this.apiUrl + "getTemplateForms", options);
}
saveTemplateFormsList(Records: any): Observable<any> {
// Records.fk_createdby = this._aws.getlocale();//to get user id for who is created the Record
// Records.createdon = currentdate;//to get Current date and Time for when the Record is created
return this._http.post<any[]>(this.apiUrl + "saveTemplateForms", {'records': Records });
}
}

View File

@ -0,0 +1,9 @@
<mat-selection-list #list [(ngModel)]="selectedOptions" (ngModelChange)="onNgModelChange($event)" class="flexlist">
<mat-list-option *ngFor="let tta of masterFormsList" [value]="tta.form_id">
{{tta.pd_form_name}}
</mat-list-option>
</mat-selection-list>
<div align="end">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="restore()"><mat-icon>settings_backup_restore</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" (click)="myClick()"><mat-icon>save</mat-icon></button>
</div>

View File

@ -0,0 +1,7 @@
.flexlist{
display: flex;
flex-wrap: wrap;
}
.flexlist > * {
flex: 0 50%;
}

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TemplateFormsComponent } from './template-forms.component';
describe('TemplateFormsComponent', () => {
let component: TemplateFormsComponent;
let fixture: ComponentFixture<TemplateFormsComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TemplateFormsComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TemplateFormsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,77 @@
import { Component, OnInit, ViewChild , Input} from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { TemplatesService } from './../../../../service/templates/templates.service';
import { MastersService } from './../../../../service/masters/masters.service';
import { NotifierService } from "angular-notifier";
@Component({
selector: 'app-template-forms',
templateUrl: './template-forms.component.html',
styleUrls: ['./template-forms.component.scss']
})
export class TemplateFormsComponent implements OnInit {
masterFormsList = [] ;
selectedOptions = [];
@Input() questionId: number;
/**
* Notifier service
*/
private notifier: NotifierService;
constructor(private mastersService : MastersService,
private templatesService: TemplatesService,
notifier: NotifierService) {
this.notifier = notifier;
}
ngOnInit() {
this.mastersService.getAllMasterData("PDFORMS").subscribe(data => {
this.masterFormsList = data.records.sort((a ,b)=>{ return a.pd_form_order - b.pd_form_order;});
// this.selectedOptions = ["1"];
this.getSelectedFormDetails();
});
}
restore(): void {
this.getSelectedFormDetails();
}
getSelectedFormDetails() {
this.templatesService.getTemplateSelectedForms(this.questionId).subscribe(data=>{
if(data.dataStatus){
this.selectedOptions = data.records;
} else {
}
})
}
myClick(){
if(this.selectedOptions.length > 0){
let records = {
"template_id":this.questionId,
"forms": this.selectedOptions
}
this.templatesService.saveTemplateFormsList(records).subscribe(data => {
if(data.dataStatus){
this.notifier.notify('success', 'Your Changes Updated.!');
}else{
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
}, err => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
})
} else {
alert("should select the forms in list !!!");
}
}
onNgModelChange(e){
console.log("event " + e);
}
}

View File

@ -51,6 +51,12 @@
</app-report-template>
</ng-template>
</mat-tab>
<mat-tab label="Forms">
<ng-template matTabContent>
<app-template-forms [questionId]="question_id">
</app-template-forms>
</ng-template>
</mat-tab>
</mat-tab-group>
</mat-card>
</mat-card>

View File

@ -37,6 +37,7 @@ import { CategoryQuestionAnswerComponent } from './templates-list/edit/edit-ques
import { DialogOverviewExampleDialog } from './templates-list/edit/edit-question-answer/category-question-answer/category-question-answer.component';
import { TemplatesAddComponent } from './templates-list/templates-add/templates-add.component';
import { ReportTemplateComponent } from './templates-list/edit/report-template/report-template.component';
import { TemplateFormsComponent } from './templates-list/edit/template-forms/template-forms.component';
/*
* Question Master Module details
@ -119,7 +120,8 @@ const customNotifierOptions: NotifierOptions = {
CategoryQuestionAnswerComponent,
DialogOverviewExampleDialog,
TemplatesAddComponent,
ReportTemplateComponent
ReportTemplateComponent,
TemplateFormsComponent
],
entryComponents: [
DialogOverviewExampleDialog,