merge : kms

This commit is contained in:
gandhimathi 2019-04-10 19:05:27 +05:30
commit fa5e372434
66 changed files with 2063 additions and 474 deletions

View File

@ -44,8 +44,8 @@
<!-- <mat-error *ngIf="pdMain.lender_contact_person.hasError('required')">Lender Contact Person Required</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 28%">
<input matInput autocomplete="off" placeholder="Lender's Mobile Number" formControlName="lender_contact_mobile" type="text" OnlyNumber 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>
<input matInput autocomplete="off" placeholder="Lender's Mobile Number" formControlName="lender_contact_mobile" type="text" OnlyNumber maxlength="10" minlength="10">
<mat-error *ngIf="pdMain.lender_contact_mobile.hasError('maxlength') || pdMain.lender_contact_mobile.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field>
<!--<mat-form-field style="width: 32%">
@ -98,6 +98,7 @@
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_customer_segment.hasError('required')">Customer Segment Required.</mat-error> -->
</mat-form-field>
<!-- {{pdMain.fk_customer_segment.value}} -->
<mat-form-field style="width: 28%">
<mat-select placeholder="PD Type" formControlName="fk_pd_type">
<mat-option>
@ -200,13 +201,14 @@
<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: 38%">
<mat-form-field style="width: 38%" *ngIf="pdMain.fk_customer_segment.value != '8'">
<input matInput autocomplete="off" placeholder="Company / Firm Name" formControlName="company_name" type="text">
</mat-form-field>
<mat-form-field style="width: 38%">
<input matInput autocomplete="off" placeholder="Mobile Number" formControlName="mobile_no" type="text" OnlyNumber maxlength="10" required>
<input matInput autocomplete="off" placeholder="Mobile Number" formControlName="mobile_no" type="text" OnlyNumber maxlength="10" minlength="10">
<mat-error *ngIf="pdMain.mobile_no.hasError('required')">Mobile No is Required . </mat-error>
<mat-error *ngIf="pdMain.mobile_no.hasError('maxlength') || pdMain.mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field>
@ -240,7 +242,7 @@
<!-- <mat-error *ngIf="pdMain.applicant_name.hasError('required')">Name is Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 38%">
<mat-form-field style="width: 38%" *ngIf="pdMain.fk_customer_segment.value != '8'">
<input matInput autocomplete="off" placeholder="Company / Firm Name" formControlName="company_name" type="text">
</mat-form-field>

View File

@ -89,7 +89,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
loan_amount: [null, Validators.compose([Validators.pattern('^[0-9]*$')])],
applicant_title_name: [''],
applicant_name: [null,Validators.compose([Validators.required])],
mobile_no: [null, Validators.compose([Validators.minLength(10), Validators.maxLength(10),Validators.required])],
mobile_no: [null, Validators.compose([Validators.maxLength(10), Validators.minLength(10)])],
// landline : [null,Validators.compose([Validators.minLength(12),Validators.maxLength(13)])],
// email: [null],
applicant_stdcode: [null, Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])],
@ -436,7 +436,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
// common function for both draft and process pd
submitPdDetails(formValue: any, status: string) {
console.log('inside the submitPdDetails data');
if (this._PDtriggerForm.invalid) {
this.validateAllFormFields(this._PDtriggerForm);
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
@ -447,6 +447,10 @@ export class AddPdComponent implements OnInit, OnDestroy {
this.notifier.notify('warning', 'Either Mobile or Landline Need.!');
return;
}
else if (formValue.mobile_no != null && formValue.mobile_no.length != 10){
this.notifier.notify('warning', 'Please Check Applicant Mobile Number.!');
return;
}
else {
this.disableAfterSubmit = true;

View File

@ -29,7 +29,7 @@
<input matInput placeholder="Name of Individual Applicant" formControlName="applicant_name" required>
</mat-form-field>
<mat-form-field style="width: 40%">
<mat-form-field style="width: 40%" *ngIf="CSAbbr != 'SE-RI'">
<input matInput placeholder="Company / Firm Name" formControlName="company_name" type="text">
</mat-form-field>
@ -66,13 +66,13 @@
<input matInput placeholder="Name of Individual Applicant" formControlName="coapplicantName" type="text" required>
</mat-form-field>
<mat-form-field style="width: 40%">
<mat-form-field style="width: 40%" *ngIf="CSAbbr != 'SE-RI'">
<input matInput placeholder="Company / Firm Name" formControlName="company_name" type="text">
</mat-form-field>
<mat-form-field style="width: 40%">
<input matInput placeholder="Mobile Number" formControlName="coapplicant_mobile_no" type="text" maxlength="10" OnlyNumber>
<mat-error *ngIf="coDetails['controls'].coapplicant_mobile_no.hasError('pattern') || coDetails['controls'].coapplicant_mobile_no.hasError('maxlength') || coDetails['controls'].coapplicant_mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
<input matInput placeholder="Mobile Number" formControlName="coapplicant_mobile_no" type="text" maxlength="10" minlength="10" OnlyNumber>
<mat-error *ngIf=" coDetails['controls'].coapplicant_mobile_no.hasError('maxlength') || coDetails['controls'].coapplicant_mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field>
<!-- <mat-form-field style="width: 40%" >

View File

@ -21,13 +21,16 @@ export class EditPdApplicantComponent implements OnInit {
emptyData:any;
relationShipList:any;
titleList: any;
CSAbbr:any;
constructor(private _fb: FormBuilder,
private _pd: PdTrigerService, notifier: NotifierService, private dialogRef: MatDialogRef<EditPdApplicantComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) {
this.notifier=notifier
}
ngOnInit() {
this.CSAbbr = this.data.SegmentAbbr != '' ? this.data.SegmentAbbr != null ? this.data.SegmentAbbr : '' :'' ;
if(this.data.records.length>0){
this.mainApplicantData= this.data.records.filter(item => item.applicant_type == 1);
this.coApplicantData= this.data.records.filter(item => item.applicant_type == 0);
@ -150,6 +153,10 @@ export class EditPdApplicantComponent implements OnInit {
this.notifier.notify('warning', 'Either Mobile or Landline Need.!');
return;
}
else if(formValue.mobile_no.length != 10){
this.notifier.notify('warning', 'Please Check Applicant Mobile Number.!');
return;
}
else{
let concat_landline1
// if(formValue.stdcode != null && formValue.landline != null){

View File

@ -76,8 +76,10 @@ export class EditPdMasterComponent implements OnInit {
data => {
if (data.status == 200) {
this.lenderList=data.records;
if(this.data.records.fk_lender_id != null){
let x = this.lenderList.filter(item => item.entity_id == this.data.records.fk_lender_id)
this.lenderBranchList = x[0]['branches'];
}
}
}, error => this.errorMessage = <any> error);
}
@ -186,13 +188,15 @@ export class EditPdMasterComponent implements OnInit {
data => {
if (data.status == 200) {
this.addressesList = data.records.filter(item => item.isactive == 1);
if (this.addressesList.length > 0) {
this.addressesList.forEach((val,index)=>{
this.addressesDeactivited[index] = true;
let obj = {
pd_address_id:val.pd_address_id,
addressline1: val.addressline1.toUpperCase(),
// addressline1: val.addressline1.toUpperCase(),
addressline1: val.addressline1 != null ? val.addressline1.toUpperCase() : val.addressline1,
fk_city: val.fk_city,
fk_state: val.fk_state,
  pincode: val.pincode_id,
@ -267,7 +271,7 @@ export class EditPdMasterComponent implements OnInit {
return this._fb.group({
fk_pd_id:[this.pdid],
pd_address_id:[data.pd_address_id],
  addressline1: [data.addressline1.toUpperCase()],
  addressline1: [data.addressline1 != null ? data.addressline1.toUpperCase() : null],
fk_city: [data.fk_city],
fk_state: [data.fk_state],
  pincode : [data.pincode],
@ -292,9 +296,7 @@ export class EditPdMasterComponent implements OnInit {
this.addressesDeactivited[index] = true;
}
// console.log('address_control',address_control);
// console.log('address_control.controls[index]',address_control.controls[index]);
// console.log('address_control.controls[index][controls]',address_control.controls[index]['controls']);
// address_control.controls[index]['controls'].showHide();
// isactive.setValue(0);
@ -308,7 +310,7 @@ export class EditPdMasterComponent implements OnInit {
// }
// address_control.controls[index].disable();
// console.log('address_control',address_control);
// address_control.removeAt(index);
}
@ -443,7 +445,7 @@ export class EditPdMasterComponent implements OnInit {
"fk_pd_type": my_array.fk_pd_type,
"fk_customer_segment": my_array.fk_customer_segment,
"loan_amount": my_array.loan_amount,
  "addressline1": filteredAddressesdata[0].addressline1.toUpperCase(),
  "addressline1": filteredAddressesdata[0].addressline1 != null ? filteredAddressesdata[0].addressline1.toUpperCase() : null,
"fk_city": filteredAddressesdata[0].fk_city,
"fk_state": filteredAddressesdata[0].fk_state,
  "pincode": filteredAddressesdata[0].pincode,

View File

@ -106,12 +106,12 @@
<!-- <mat-error *ngIf="!addressForm.controls['locality_others'].valid">Locality Required</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 46%;" *ngIf="item.get('locality').value == 5">
<!-- <mat-form-field style="width: 46%;" *ngIf="item.get('locality').value == 5">
<input matInput placeholder="Specify the MixUse *"
formControlName="locality_mixuse" autocomplete="off">
<!-- <mat-error *ngIf="!addressForm.controls['locality_mixuse'].valid">MixUse
Required</mat-error> -->
</mat-form-field>
!-- <mat-error *ngIf="!addressForm.controls['locality_mixuse'].valid">MixUse
Required</mat-error> --
</mat-form-field> -->
</div>

View File

@ -129,11 +129,14 @@ export class AddressComponent implements OnInit {
'address_type_others': datas.address_type_others,
'state': datas.state,
'city': datas.city,
'citySearch':'',
'stateSearch':'',
'pinSearch':'',
'pincode': datas.pincode,
'pincode_others': datas.pincode_others,
'locality': datas.locality,
'locality_others': datas.locality_others,
'locality_mixuse': datas.locality_mixuse,
// 'locality_mixuse': datas.locality_mixuse,
'pd_location': datas.pd_location,
'comment_locality': datas.comment_locality,
'estimated_area': datas.estimated_area,
@ -227,11 +230,14 @@ export class AddressComponent implements OnInit {
'address_type_others': '',
'state': val.fk_state,
'city': val.fk_city,
'citySearch':'',
'stateSearch':'',
'pinSearch':'',
'pincode': val.pincode_id,
'pincode_others': val.other_pincode,
'locality': '',
'locality_others': '',
'locality_mixuse': '',
// 'locality_mixuse': '',
'pd_location': '',
'comment_locality': '',
'estimated_area': '',
@ -292,11 +298,14 @@ export class AddressComponent implements OnInit {
address_type_others: [AddressDetails.address_type_others],
state: [AddressDetails.state],
city: [AddressDetails.city],
citySearch:[''],
stateSearch:[''],
pinSearch:[''],
pincode: [AddressDetails.pincode],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */
pincode_others: [AddressDetails.pincode_others, Validators.compose([Validators.minLength(6), Validators.maxLength(6)])],
locality: [AddressDetails.locality, Validators.compose([Validators.required])],
locality_others: [AddressDetails.locality_others],
locality_mixuse: [AddressDetails.locality_mixuse],
// locality_mixuse: [AddressDetails.locality_mixuse],
pd_location: [AddressDetails.pd_location, Validators.compose([Validators.required])],
comment_locality: [AddressDetails.comment_locality, Validators.compose([Validators.required])],
estimated_area: [AddressDetails.estimated_area],
@ -312,11 +321,14 @@ export class AddressComponent implements OnInit {
address_type_others: [''],
state: [''],
city: [''],
citySearch:[''],
stateSearch:[''],
pinSearch:[''],
pincode: [''],
pincode_others: ['', Validators.compose([Validators.minLength(6), Validators.maxLength(6)])],
locality: ['', Validators.compose([Validators.required])],
locality_others: [''],
locality_mixuse: [''],
// locality_mixuse: [''],
pd_location: ['', Validators.compose([Validators.required])],
comment_locality: ['', Validators.compose([Validators.required])],
estimated_area: [''],

View File

@ -82,7 +82,8 @@ businessCalculation(indexVal: number,values: any): void {
let control:any = <FormArray>this.businessItemForm.controls['busExpense'];
if(values.expense_value!='' && values.fk_frequency_id!='') {
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id);
control.controls[indexVal].controls['annual_expenses_value'].setValue(parseInt(values.expense_value) * parseInt(filterFrequencyValue[0].mutiple_factor));
let CalculatedVal = parseFloat(values.expense_value) * parseFloat(filterFrequencyValue[0].mutiple_factor);
control.controls[indexVal].controls['annual_expenses_value'].setValue(CalculatedVal.toFixed(2));
}
else {

View File

@ -0,0 +1,85 @@
<form [formGroup]="purchaseItemForm" novalidate>
<h2 mat-dialog-title class="paragraph_change">
<div fxFlex="70" align="left" style="padding: 10px !important;">
{{pageTitle}}
</div>
<div fxFlex="30" align="end" style="padding: 10px !important;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="above" (click)="closeDialogue()"><mat-icon>close</mat-icon></button>
</div>
</h2>
<mat-dialog-content>
<mat-card>
<mat-card-content formArrayName="purchase_product">
<mat-card *ngFor="let purchase of purchaseItemForm.controls.purchase_product['controls']; let s = index;" [formGroupName]="s">
<mat-card-content>
<mat-form-field style="width: 87%">
<mat-select placeholder="Raw Material/Trading Item" formControlName="purchase_item" required>
<mat-option>Select</mat-option>
<mat-option *ngFor="let prod of productListData" [value]="prod">{{ prod }}</mat-option>
<mat-option value="Others">Others</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 35%" *ngIf="purchase.get('purchase_item').value == 'Others'">
<input type="text" matInput placeholder="Other Raw Material/Trading Item" formControlName="other_purchase_item">
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeProducts(s)" *ngIf="purchaseItemForm.value.purchase_product.length>1"
matTooltip="Remove" matTooltipPosition="above">
<mat-icon>delete</mat-icon>
</button>
<!-- switch case date/frequency information section -->
<div [ngSwitch]="purchase.value.purchase_type">
<!-- date info -->
<div formArrayName="child">
<div class="item-margin" fxLayout="row wrap" *ngFor="let childItem of purchase.get('child').controls; let c = index" [formGroupName]="c">
<div fxFlex="100" *ngIf="childItem.value.isactive===true">
<mat-form-field style="width: 33%;">
<input matInput [max]="todaydate" [matDatepicker]="picker" formControlName="purchase_date" (dateChange)="purchaseCalculation(s,purchase.value)" placeholder="Purchase Date" required>
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker touchUi #picker></mat-datepicker>
</mat-form-field>
<mat-form-field style="width: 44%">
<input OnlyNumber type="text" matInput placeholder="Bill Value" (keyup)="purchaseCalculation(s,purchase.value)" formControlName="purchase_value" required>
<mat-hint align="start" style="font-size:90%" *ngIf="childItem.value.purchase_value != ''">{{"&#8377;"}} {{childItem.value.purchase_value | numberToWords}} Only</mat-hint>
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeDailyItems(s,c,childItem.value)" *ngIf="purchase.value.child.length>1"
matTooltip="Remove" matTooltipPosition="above">
<mat-icon>delete</mat-icon>
</button>
</div>
</div>
<div align="center" style="margin-top: 3%;">
<button type="button" mat-flat-button (click)="addMoreDailyPurchase(s,purchase.value)"
matTooltip="Add More" matTooltipPosition="above" color="primary">
<strong>Add More Daily Purchase</strong>
</button>
</div>
</div>
</div>
<mat-form-field style="width: 92%">
<textarea matInput type="text" placeholder="Remarks" formControlName="comments"></textarea>
</mat-form-field>
</mat-card-content>
</mat-card>
</mat-card-content>
<mat-card-actions align="center" *ngIf="data.manage_status==1">
<button type="button" mat-flat-button (click)="addMore(purchaseItemForm.controls.purchase_product.value.length)"
matTooltip="Add More" matTooltipPosition="above" color="primary">
<strong>Add More Purchase Product</strong>
</button>
</mat-card-actions>
</mat-card>
<notifier-container></notifier-container>
</mat-dialog-content>
<mat-dialog-actions align="end">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Save" matTooltipPosition="above" (click)="submitDetails(purchaseItemForm.value)"><mat-icon>save</mat-icon></button>
</mat-dialog-actions>

View File

@ -0,0 +1,34 @@
.paragraph_change {
color: #fff !important;
background-color: #e00201 !important;
}
mat-form-field {
margin: 0 2%;
}
.example-section {
height: 120px;
}
.example-margin {
margin: 0 10px;
}
::ng-deep .cdk-global-overlay-wrapper{
justify-content: center !important;
}
.item-margin {
margin-left:4%;
margin-top:2%;
}
.item-product-margin{
margin-top:2%;
}
.example-radio-group {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.example-radio-button {
margin: 0 2%;
color: #000 !important
}

View File

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

View File

@ -0,0 +1,261 @@
import { Component, OnInit, Input, Output, Inject } from '@angular/core';
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angular/material';
import { PdTrigerService } from './../../../../../../../pd-service/pd-triger.service';
import { NotifierService } from 'angular-notifier';
import { DatePipe } from '@angular/common';
import { DeleteRecordsCountPipe } from './../../../../../../../pd-pipes/delete-records-count.pipe';
@Component({
selector: 'app-manage-daily-purchase',
templateUrl: './manage-daily-purchase.component.html',
styleUrls: ['./manage-daily-purchase.component.scss']
})
export class ManageDailyPurchaseComponent implements OnInit {
Value: any []=[];
pipe = new DatePipe('en-US');
pageTitle:string;
purchaseItemForm:FormGroup;
UOMData: any[]=[];
frequencyData: any[]=[];
marginAmtInwords: any[]=[];
productListData : any[]=[];
private notifier: NotifierService;
todaydate:Date = new Date();
constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef<ManageDailyPurchaseComponent>) {
this.pageTitle = this.data.manage_status==1 ? 'Add Daily Purchase Item' : 'Update Daily Purchase Item';
this.notifier = notifier;
}
ngOnInit() {
//Business Product list for dropdown.
this._pd.getProductsFromBusinessAndSupplier(this.data.masterData.pdid, this.data.masterData.company_id).subscribe(data => {
if (data.dataStatus){
let datas = data.record;
let type2 = datas.from_business.filter(data => data.type_of_activity_id == 2);
if(type2[0].hasOwnProperty("products")){
// this.productListData.push(type2[0].products);
}
let type3 = datas.from_business.filter(data => data.type_of_activity_id == 3);
if(type3[0].hasOwnProperty("products")){
this.productListData.push(type3[0].products);
}
let type4 = datas.from_business.filter(data => data.type_of_activity_id == 4);
if(type4[0].hasOwnProperty("products")){
this.productListData.push(type4[0].products);
}
if(datas.from_supplier.hasOwnProperty("raw_material")){
this.productListData.push(datas.from_supplier.raw_material);
}
this.productListData = [].concat.apply([], this.productListData);
}
})
//manage_status '1' for Add , '2' for edit functionalities
if(this.data.manage_status==1){
this.purchaseItemForm = this._fb.group({
purchase_product: this._fb.array([this.createPurchaseItem()]),
});
let control: any = <FormArray>this.purchaseItemForm.controls['purchase_product'];
control = control.controls[0].get('child') as FormArray;
control.push(this.createDailyPurchaseData(''))
}
else if(this.data.manage_status==2){
this.purchaseItemForm = this._fb.group({
purchase_product: this._fb.array([this.createPurchaseItemWithData(this.data.editData)]),
});
let control: any = <FormArray>this.purchaseItemForm.controls['purchase_product'];
let innercontrol: any = control.controls[0].get('child') as FormArray;
this.data.editData.values.forEach((elementVal,inx) => {
innercontrol.push(this.createDailyPurchaseWithData(elementVal,this.data.editData))
});
// control.controls[control.value.length-1].controls['comments'].setValue
}
else{
this.purchaseItemForm = this._fb.group({
purchase_product: this._fb.array([]),
});
}
}
//create purchase product
createPurchaseItem():FormGroup {
return this._fb.group({
fk_pd_id: [this.data.masterData.pdid],
company_id:[this.data.masterData.company_id],
pbw_id: [''],
purchase_item: ['', Validators.compose([Validators.required])],
other_purchase_item:[''],
annual_purchase_value: [''],
child: this._fb.array([]),
comments: [''],
isactive:[true],
});
}
// create daily list empty
createDailyPurchaseData(pbw_id: string) {
return this._fb.group({
pbwc_id: [''],
fk_pbw_id: [pbw_id],
purchase_date: [''],
purchase_value: ['', Validators.compose([Validators.required])],
isactive:[true],
})
}
// create purchase product with Data
createPurchaseItemWithData(values: any) {
return this._fb.group({
fk_pd_id: [this.data.masterData.pdid],
company_id:[this.data.masterData.company_id],
pbw_id: [values.pbw_id],
purchase_item: [values.purchaseItem, Validators.compose([Validators.required])],
other_purchase_item:[values.otherPurchaseItem === null ? '' : values.otherPurchaseItem ],
annual_purchase_value: [values.annualPurchaseValue],
child: this._fb.array([]),
comments: [values.comments],
isactive:[true],
});
}
// create daily purchase product with Data
createDailyPurchaseWithData(values: any, parent: any) {
return this._fb.group({
pbwc_id: [values.pbwc_id],
fk_pbw_id: [parent.pbw_id],
purchase_date: [parent.purchase_type=='2' ? '' :new Date(this.pipe.transform(values.purchase_date, 'yyyy-MM-dd')), Validators.compose([Validators.required])],
purchase_value: [values.purchase_value, Validators.compose([Validators.required])],
isactive:[true]
})
}
// add more purchase products
addMore(parentIndex: number): void{
let control = <FormArray>this.purchaseItemForm.controls['purchase_product'];
control.push(this.createPurchaseItem());
control = control.controls[parentIndex].get('child') as FormArray;
control.push(this.createDailyPurchaseData(''))
}
// add more purchase daily products
addMoreDailyPurchase(parentIndex: number,values: any): void{
let control: any = <FormArray>this.purchaseItemForm.controls['purchase_product'];
control=control.controls[parentIndex].get('child') as FormArray;
control.push(this.createDailyPurchaseData(values.pbw_id));
}
// remove dailywise Purchase Products items
removeDailyItems(parentIndex: number,childIndex:number, childValue:any): void {
let control: any = <FormArray>this.purchaseItemForm.controls['purchase_product'];
control=control.controls[parentIndex].get('child') as FormArray;
if(childValue.pbwc_id=='' || childValue.pbwc_id==null){
control.removeAt(childIndex);
let calculatControlValues: any = <FormArray>this.purchaseItemForm.controls['purchase_product'];
calculatControlValues = calculatControlValues.controls[parentIndex];
this.purchaseCalculation(parentIndex,calculatControlValues.value);
}
else {
control.controls[childIndex].controls.isactive.setValue(false);
let calculatControlValues: any = <FormArray>this.purchaseItemForm.controls['purchase_product'];
calculatControlValues = calculatControlValues.controls[parentIndex];
this.purchaseCalculation(parentIndex,calculatControlValues.value);
}
}
//To remove the Products
removeProducts(parentIndex:number){
let control: any = <FormArray>this.purchaseItemForm.controls['purchase_product'];
control.removeAt(parentIndex);
}
// close dialogue manually
closeDialogue(){
this.dialogRef.close({update_status:false});
}
// this caculation for running total
purchaseCalculation(indexVal: number,values: any): void {
let control:any = <FormArray>this.purchaseItemForm.controls['purchase_product'];
if(values.child.length>0){
let transformData = values.child.filter(val=>val.purchase_date!='' && val.purchase_date!=null && val.purchase_date!=undefined && val.purchase_value!='' && val.isactive===true).map(mval=>{
mval.custum_date = this.pipe.transform(mval.purchase_date, 'yyyy-MM');
return mval;
});
if(transformData.length>0) {
let TotalAnnualValue = transformData.map(val=>val.purchase_value)
.reduce((sum, curr) => parseFloat(sum) + parseFloat(curr));
let Months : number = 12 / values.child.length;
// console.log('transformData.length',transformData.length);
// console.log('TotalAnnualValue',TotalAnnualValue)
// console.log('TotalAnnualValue',TotalAnnualValue*Months);
control.controls[indexVal].controls['annual_purchase_value'].setValue(TotalAnnualValue);
}
else{
control.controls[indexVal].controls['annual_purchase_value'].setValue("");
}
}
else {
let innercontrol: any = control.controls[indexVal].get('child') as FormArray;
innercontrol.controls[innercontrol.value.length-1].controls['purchase_value'].setValue("");
control.controls[indexVal].controls['annual_purchase_value'].setValue("");
}
}
// save purchase details
submitDetails(records) {
if (this.purchaseItemForm.invalid) {
this.validateAllFormFields(this.purchaseItemForm);
this.notifier.notify('warning',"Please Check All Manatory Fields..");
return;
}
// this is for remove custom date key from my array values
records.purchase_product.forEach(parVal => {
parVal.child.forEach(childVal => {
if(childVal['custum_date']){
delete childVal['custum_date'];
}
if(childVal['purchase_date'])
childVal['purchase_date']=this.pipe.transform(childVal['purchase_date'], 'yyyy-MM-dd');
});
});
this._pd.saveAssessedDetails('saveAssessedIncomePurchaseBillwise',records.purchase_product).subscribe(data => {
this.notifier.notify('success', this.data.manage_status==2 ? 'Updated Successfully.' : 'Saved Successfully.');
setTimeout(() =>{
this.dialogRef.close({update_status:true});
},3000);
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
});
}
// validate all form group and form array fields
validateAllFormFields(formGroup: any) {
Object.keys(formGroup.controls).forEach(field => {
const control = formGroup.get(field);
if (control instanceof FormControl) {
control.markAsTouched({ onlySelf: true });
} else if (control instanceof FormGroup) {
this.validateAllFormFields(control);
} else if (control instanceof FormArray) {
this.validateAllFormFields(control);
}
});
}
}

View File

@ -14,8 +14,16 @@
<mat-card *ngFor="let sales of salesItemForm.controls.sales_product['controls']; let s = index;" [formGroupName]="s">
<mat-card-content>
<mat-form-field style="width: 87%">
<input type="text" matInput placeholder="Product/Services" formControlName="sales_item" required>
<!-- <input type="text" matInput placeholder="Product/Services" formControlName="sales_item" required> -->
<mat-select placeholder="Product/Services" formControlName="sales_item" required>
<mat-option>Select</mat-option>
<mat-option *ngFor="let prod of productandservice" [value]="prod.name">{{ prod.name }}</mat-option>
<mat-option value="Others">Others</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 35%" *ngIf="sales.get('sales_item').value == 'Others'">
<input type="text" matInput placeholder="Other Product/Services" formControlName="other_sales_item">
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeProducts(s)" *ngIf="salesItemForm.value.sales_product.length>1"
matTooltip="Remove" matTooltipPosition="above">
<mat-icon>delete</mat-icon>
@ -30,9 +38,10 @@
<div class="item-margin" fxLayout="row wrap" *ngFor="let childItem of sales.get('child').controls; let c = index" [formGroupName]="c">
<div fxFlex="100" *ngIf="childItem.value.isactive===true">
<mat-form-field style="width: 33%;">
<input matInput [max]="maxDate" [matDatepicker]="picker" formControlName="sales_date" (dateChange)="salesCalculation(s,sales.value)" placeholder="Sales Date" required>
<!-- <mat-error *ngIf="childItem.controls['sales_date'].hasError('matDatepickerMax')">Date should be inferior</mat-error>[max]="todaydate" -->
<input matInput [max]="todaydate" [matDatepicker]="picker" formControlName="sales_date" (dateChange)="salesCalculation(s,sales.value)" placeholder="Sales Date" required>
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
<mat-datepicker touchUi #picker></mat-datepicker>
</mat-form-field>
<mat-form-field style="width: 44%">
<input OnlyNumber type="text" matInput placeholder="Bill Value" (keyup)="salesCalculation(s,sales.value)" formControlName="sales_value" required>
@ -82,7 +91,7 @@
</div>
<div style="margin-top:3%;margin-bottom:2%; ">
<mat-form-field style="width: 40%" *ngIf="data.margin_calculation_status===true">
<input matInput OnlyNumber type="text" placeholder="Magin Percetage %" formControlName="margin_per" (keyup)="salesCalculation(s,sales.value)">
<input matInput OnlyNumber type="text" placeholder="Gross Margin %" formControlName="margin_per" (keyup)="salesCalculation(s,sales.value)">
</mat-form-field>
<mat-form-field style="width: 47%" *ngIf="data.margin_calculation_status===true">
<input matInput OnlyNumber type="text" placeholder="Margin Value" formControlName="margin_value" readonly>

View File

@ -19,6 +19,16 @@ export class ManageDailySalesComponent implements OnInit {
UOMData: any[]=[];
frequencyData: any[]=[];
marginAmtInwords: any[]=[];
productandservice : any[]=[];
name = 'Angular';
now = new Date();
year = this.now.getFullYear();
month = this.now.getMonth();
day = this.now.getDay();
todaydate:Date = new Date();
private notifier: NotifierService;
check_type:any=[{'type_id':"1",'type_name':'Date Information'},{'type_id':"2",'type_name':'Frequency Information'}]
constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef<ManageDailySalesComponent>) {
@ -28,6 +38,46 @@ export class ManageDailySalesComponent implements OnInit {
}
ngOnInit() {
this._pd.getTypeofActivityForSuppliedInfoForm(this.data.masterData.pdid, this.data.masterData.company_id).subscribe(data => {
if (data.dataStatus) {
let datas = data.records;
let api = Object.keys(datas.type_of_activity).map(function (key) {
return datas.type_of_activity[key];
});
if (api.length > 0) {
api.forEach(val => {
if (val.type_of_activity_id == 2) {
if (val.prodcuts) {
this.productandservice.push(val.prodcuts);
}
}
if (val.type_of_activity_id == 3) {
if (val.prodcuts) {
this.productandservice.push(val.prodcuts);
}
}
if (val.type_of_activity_id == 4) {
if (val.prodcuts) {
this.productandservice.push(val.prodcuts);
}
}
if (val.type_of_activity_id == 5) {
if (val.prodcuts) {
this.productandservice.push(val.prodcuts);
}
}
});
}
this.productandservice = [].concat.apply([], this.productandservice);
}
})
if(this.data.manage_status==1){
this.salesItemForm = this._fb.group({
sales_product: this._fb.array([this.createSalesItem()]),
@ -79,6 +129,7 @@ export class ManageDailySalesComponent implements OnInit {
company_id:[this.data.masterData.company_id],
sim_id: [''],
sales_item: ['', Validators.compose([Validators.required])],
other_sales_item:[''],
child: this._fb.array([]),
margin_per: [''],
margin_value: [''],
@ -107,6 +158,7 @@ createSalesItemWithData(values: any) {
company_id:[this.data.masterData.company_id],
sim_id: [values.sim_id],
sales_item: [values.salesItem, Validators.compose([Validators.required])],
other_sales_item:[values.otherSalesItem === null ? '' : values.otherSalesItem ],
child: this._fb.array([]),
margin_per: [this.data.margin_calculation_status===true ? values.margin_per: ''],
margin_value: [this.data.margin_calculation_status===true ? values.margin_value: ''],
@ -186,8 +238,9 @@ salesCalculation(indexVal: number,values: any): void {
return fIndex === fArray.indexOf(fVal);
});
let getTotalValueCounts = transformData.map(val=>val.sales_value)
.reduce((sum, curr) => parseInt(sum) + parseInt(curr));
control.controls[indexVal].controls['margin_value'].setValue(parseInt(getTotalValueCounts) * (parseInt(values.margin_per)/100) * (12 / parseInt(getUniqueMonthCounts.length)));
.reduce((sum, curr) =>parseFloat(sum) +parseFloat(curr));
let calculatedValue =parseFloat(getTotalValueCounts) * (parseFloat(values.margin_per)/100) * (12 /parseFloat(getUniqueMonthCounts.length));
control.controls[indexVal].controls['margin_value'].setValue(calculatedValue.toFixed(2));
}
else{
control.controls[indexVal].controls['margin_value'].setValue("");
@ -205,10 +258,11 @@ salesCalculation(indexVal: number,values: any): void {
if(values.child[values.child.length-1].fk_frequency_id!='' && values.child[values.child.length-1].frequency_value!=''){
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.child[values.child.length-1].fk_frequency_id);
innercontrol.controls[innercontrol.value.length-1].controls['sales_value'].setValue(parseInt(filterFrequencyValue[0].mutiple_factor) * parseInt(values.child[values.child.length-1].frequency_value));
innercontrol.controls[innercontrol.value.length-1].controls['sales_value'].setValue(parseFloat(filterFrequencyValue[0].mutiple_factor) *parseFloat(values.child[values.child.length-1].frequency_value));
let getTotalValueCounts =parseInt(filterFrequencyValue[0].mutiple_factor) * parseInt(values.child[values.child.length-1].frequency_value)
values.margin_per!='' ? control.controls[indexVal].controls['margin_value'].setValue( getTotalValueCounts * (parseInt(values.margin_per)/100)) : '';
let getTotalValueCounts =parseFloat(filterFrequencyValue[0].mutiple_factor) *parseFloat(values.child[values.child.length-1].frequency_value)
let CalculatedVal = getTotalValueCounts * (parseFloat(values.margin_per)/100);
values.margin_per!='' ? control.controls[indexVal].controls['margin_value'].setValue( CalculatedVal.toFixed(2)) : '';
}
else {
innercontrol.controls[innercontrol.value.length-1].controls['sales_value'].setValue("");
@ -222,7 +276,8 @@ salesCalculation(indexVal: number,values: any): void {
if(values.child[values.child.length-1].fk_frequency_id!='' && values.child[values.child.length-1].frequency_value!=''){
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.child[values.child.length-1].fk_frequency_id);
innercontrol.controls[innercontrol.value.length-1].controls['sales_value'].setValue(parseInt(filterFrequencyValue[0].mutiple_factor) * parseInt(values.child[values.child.length-1].frequency_value));
let marginCalculatedValue =parseFloat(filterFrequencyValue[0].mutiple_factor) *parseFloat(values.child[values.child.length-1].frequency_value);
innercontrol.controls[innercontrol.value.length-1].controls['sales_value'].setValue(marginCalculatedValue.toFixed(2));
}
else {
innercontrol.controls[innercontrol.value.length-1].controls['sales_value'].setValue("");

View File

@ -79,7 +79,8 @@ houseCalculation(indexVal: number,values: any): void {
let control:any = <FormArray>this.houseItemForm.controls['houseExpense'];
if(values.expense_value!='' && values.fk_frequency_id!='') {
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id);
control.controls[indexVal].controls['annual_expense_value'].setValue(parseInt(values.expense_value) * parseInt(filterFrequencyValue[0].mutiple_factor));
let CalculatedValue = parseFloat(values.expense_value) * parseFloat(filterFrequencyValue[0].mutiple_factor);
control.controls[indexVal].controls['annual_expense_value'].setValue(CalculatedValue.toFixed(2));
}
else {

View File

@ -82,7 +82,8 @@ businessCalculation(indexVal: number,values: any): void {
let control:any = <FormArray>this.businessIncomeItemForm.controls['busIncome'];
if(values.income_value!='' && values.fk_frequency_id!='') {
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id);
control.controls[indexVal].controls['annual_income_value'].setValue(parseInt(values.income_value) * parseInt(filterFrequencyValue[0].mutiple_factor));
let CalculatedValue = parseFloat(values.income_value) * parseFloat(filterFrequencyValue[0].mutiple_factor);
control.controls[indexVal].controls['annual_income_value'].setValue(CalculatedValue.toFixed(2));
}
else {

View File

@ -13,45 +13,87 @@
<mat-card-content formArrayName="purchase">
<div fxLayout="row wrap" *ngFor="let item of purchaseItemForm.controls.purchase['controls']; let s = index;" [formGroupName]="s" style="margin-top: 4%;">
<div fxFlex="100">
<mat-form-field style="width: 87%">
<input type="text" matInput placeholder="Raw Material/Trading Item" formControlName="purchase_item" required>
<mat-form-field style="width: 87%">
<!-- <input type="text" matInput placeholder="Raw Material/Trading Item" formControlName="purchase_item" required> -->
<mat-select placeholder="Raw Material/Trading Item" formControlName="purchase_item" required>
<mat-option>Select</mat-option>
<mat-option *ngFor="let prod of productListData" [value]="prod">{{ prod }}</mat-option>
<mat-option value="Others">Others</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 35%" *ngIf="item.get('purchase_item').value == 'Others'">
<input type="text" matInput placeholder="Other Raw Material/Trading Item" formControlName="other_purchase_item">
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeItem(s)" *ngIf="purchaseItemForm.value.purchase.length>1"
matTooltip="Remove Purchase Item" matTooltipPosition="above">
<mat-icon>delete</mat-icon>
</button>
</button>
</div>
<div fxFlex="100">
<mat-radio-group formControlName="purchase_type" class="example-radio-group" (change)="changeOptions(s,$event)">
<mat-radio-button class="example-radio-button" color="primary" [value]="types.type_id" *ngFor="let types of check_type; let t = index">{{types.type_name}}</mat-radio-button>
</mat-radio-group>
</div>
<div class="item-margin" fxFlex="100">
<mat-form-field style="width: 25%">
<mat-form-field style="width: 25%" *ngIf="item.value.purchase_type=='1'">
<input OnlyNumber type="text" matInput placeholder="Purchase Quantity" (keyup)="purchaseCalculation(s,item.value)" formControlName="purchase_qty" required>
</mat-form-field>
<mat-form-field style="width: 25%">
</mat-form-field>
<mat-form-field style="width: 25%" *ngIf="item.value.purchase_type=='1'">
<mat-select placeholder="UOM" formControlName="fk_uom_id" (selectionChange)="generateOtherUOM(s,item.value)" required>
<mat-option *ngFor="let uom of UOMData" [value]="uom.uom_id">{{uom.name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 27%" *ngIf="item.controls['uom_other']">
</mat-form-field>
<mat-form-field style="width: 27%" *ngIf="item.controls['uom_other']">
<input type="text" matInput placeholder="Other UOM" formControlName="uom_other" required>
</mat-form-field>
</mat-form-field>
</div>
<div class="item-margin" fxFlex="100">
<mat-form-field style="width: 25%">
<input OnlyNumber type="text" matInput placeholder="Rate/Unit of Purchase" formControlName="rate_per_unit" (keyup)="purchaseCalculation(s,item.value)" required>
<mat-hint align="start" style="font-size:90%" *ngIf="item.value.rate_per_unit != ''">{{"&#8377;"}} {{item.value.rate_per_unit | numberToWords}} Only</mat-hint>
<div [ngSwitch]="item.value.purchase_type" fxFlex="100">
<!-- Case 1 -->
<div *ngSwitchCase="1" class="item-margin" fxFlex="100">
<mat-form-field style="width: 25%">
<input OnlyNumber type="text" matInput placeholder="Rate/Unit of Purchase" formControlName="rate_per_unit" (keyup)="purchaseCalculation(s,item.value)" required>
<mat-hint align="start" style="font-size:90%" *ngIf="item.value.rate_per_unit != ''">{{"&#8377;"}} {{item.value.rate_per_unit | numberToWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width: 25%">
<mat-select placeholder="Frequency" formControlName="fk_frequency_id" (selectionChange)="purchaseCalculation(s,item.value)" required>
<mat-option *ngFor="let frq of frequencyData" [value]="frq.frequency_id">{{frq.name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 27%">
<input matInput OnlyNumber type="text" placeholder="Annual Purchase" formControlName="annual_purchase_value" readonly>
<mat-hint align="start" style="font-size:90%" *ngIf="item.value.annual_purchase_value != ''">{{"&#8377;"}} {{item.value.annual_purchase_value | numberToWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width: 25%">
<mat-select placeholder="Frequency" formControlName="fk_frequency_id" (selectionChange)="purchaseCalculation(s,item.value)" required>
<mat-option *ngFor="let frq of frequencyData" [value]="frq.frequency_id">{{frq.name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 27%">
<input matInput OnlyNumber type="text" placeholder="Annual Purchase" formControlName="annual_purchase_value" readonly>
<mat-hint align="start" style="font-size:90%" *ngIf="item.value.annual_purchase_value != ''">{{"&#8377;"}} {{item.value.annual_purchase_value | numberToWords}} Only</mat-hint>
</mat-form-field>
</div>
<!-- case 2 -->
<div *ngSwitchCase="2" class="item-margin" fxFlex="100">
<mat-form-field style="width: 25%">
<mat-select placeholder="Frequency" formControlName="fk_frequency_id" (selectionChange)="purchaseCalculation(s,item.value)" required>
<mat-option *ngFor="let frq of frequencyData" [value]="frq.frequency_id">{{frq.name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 25%">
<input OnlyNumber type="text" matInput [placeholder]="item.value.fk_frequency_id=='1' ? 'Other Purchase' : item.value.fk_frequency_id=='2' ? 'Yearly Purchase' : item.value.fk_frequency_id=='3' ? 'Half Yearly Purchase' : item.value.fk_frequency_id=='4' ? 'Fortnightly Purchase' : item.value.fk_frequency_id=='5' ? 'Daily Purchase' : item.value.fk_frequency_id=='6' ? 'Quarterly Purchase' : item.value.fk_frequency_id=='7' ? 'Monthly Purchase' : ''" formControlName="rate_per_unit" (keyup)="purchaseCalculation(s,item.value)" required>
<mat-hint align="start" style="font-size:90%" *ngIf="item.value.rate_per_unit != ''">{{"&#8377;"}} {{item.value.rate_per_unit | numberToWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width: 27%">
<input matInput OnlyNumber type="text" placeholder="Annual Purchase" formControlName="annual_purchase_value" readonly>
<mat-hint align="start" style="font-size:90%" *ngIf="item.value.annual_purchase_value != ''">{{"&#8377;"}} {{item.value.annual_purchase_value | numberToWords}} Only</mat-hint>
</mat-form-field>
</div>
</div>
<div class="item-product-margin" fxFlex="100">
<mat-form-field style="width: 92%">
@ -78,4 +120,4 @@
s

View File

@ -23,4 +23,14 @@
.item-product-margin{
margin-top:2%;
}
.example-radio-group {
display: flex;
flex-direction: column;
flex-wrap: wrap;
}
.example-radio-button {
margin: 0 2%;
color: #000 !important
}

View File

@ -15,6 +15,9 @@ export class ManagePurchaseComponent implements OnInit {
purchaseItemForm:FormGroup;
UOMData: any[]=[];
frequencyData: any[]=[];
productListData: any[]=[];
check_type:any=[{'type_id':"1",'type_name':'Quantity and Rate Information'},{'type_id':"2",'type_name':'Value Information'}]
private notifier: NotifierService;
constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef<ManagePurchaseComponent>) {
this.UOMData=this.data.masterData.UOMList;
@ -24,6 +27,30 @@ export class ManagePurchaseComponent implements OnInit {
}
ngOnInit() {
this._pd.getProductsFromBusinessAndSupplier(this.data.masterData.pdid, this.data.masterData.company_id).subscribe(data => {
if (data.dataStatus){
let datas = data.record;
let type2 = datas.from_business.filter(data => data.type_of_activity_id == 2);
if(type2[0].hasOwnProperty("products")){
// this.productListData.push(type2[0].products);
}
let type3 = datas.from_business.filter(data => data.type_of_activity_id == 3);
if(type3[0].hasOwnProperty("products")){
this.productListData.push(type3[0].products);
}
let type4 = datas.from_business.filter(data => data.type_of_activity_id == 4);
if(type4[0].hasOwnProperty("products")){
this.productListData.push(type4[0].products);
}
if(datas.from_supplier.hasOwnProperty("raw_material")){
this.productListData.push(datas.from_supplier.raw_material);
}
this.productListData = [].concat.apply([], this.productListData);
}
})
if(this.data.manage_status==2){
this.purchaseItemForm = this._fb.group({
purchase: this._fb.array([this.createPurchaseItemWithData(this.data.editData)]),
@ -47,6 +74,8 @@ export class ManagePurchaseComponent implements OnInit {
fk_pd_id:[this.data.masterData.pdid],
company_id:[this.data.masterData.company_id],
purchase_item:['',Validators.compose([Validators.required])],
other_purchase_item:[''],
purchase_type:['1'],
purchase_qty:['',Validators.compose([Validators.required])],
fk_uom_id:['',Validators.compose([Validators.required])],
rate_per_unit:['',Validators.compose([Validators.required])],
@ -64,6 +93,8 @@ createPurchaseItemWithData(values: any) {
fk_pd_id:[this.data.masterData.pdid],
company_id:[this.data.masterData.company_id],
purchase_item:[values.purchase_item,Validators.compose([Validators.required])],
other_purchase_item:[values.other_purchase_item],
purchase_type:[values.purchase_type],
purchase_qty:[values.purchase_qty,Validators.compose([Validators.required])],
fk_uom_id:[values.fk_uom_id,Validators.compose([Validators.required])],
rate_per_unit:[values.rate_per_unit,Validators.compose([Validators.required])],
@ -85,12 +116,43 @@ closeDialogue(){
this.dialogRef.close({update_status:false});
}
purchaseCalculation(indexVal: number,values: any): void {
let control:any = <FormArray>this.purchaseItemForm.controls['purchase'];
if(values.purchase_qty!='' && values.rate_per_unit!='' && values.fk_frequency_id!='') {
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id);
control.controls[indexVal].controls['annual_purchase_value'].setValue(parseInt(values.purchase_qty) * parseInt(values.rate_per_unit) * parseInt(filterFrequencyValue[0].mutiple_factor));
changeOptions(indexVal: any,event: any): void{
let control: any = <FormArray>this.purchaseItemForm.controls['purchase'];
if(event.value=="1"){
control.controls[indexVal].controls['purchase_qty'].setValidators([Validators.required]);
control.controls[indexVal].controls['purchase_qty'].updateValueAndValidity();
control.controls[indexVal].controls['fk_uom_id'].setValidators([Validators.required]);
control.controls[indexVal].controls['fk_uom_id'].updateValueAndValidity();
this.purchaseCalculation(indexVal,control.controls[indexVal].value);
}
else if(event.value=="2"){
control.controls[indexVal].controls['purchase_qty'].setValue("");
control.controls[indexVal].controls['purchase_qty'].clearValidators();
control.controls[indexVal].controls['purchase_qty'].updateValueAndValidity();
control.controls[indexVal].controls['fk_uom_id'].setValue("");
control.controls[indexVal].controls['fk_uom_id'].clearValidators();
control.controls[indexVal].controls['fk_uom_id'].updateValueAndValidity();
this.purchaseCalculation(indexVal,control.controls[indexVal].value);
}
}
purchaseCalculation(indexVal: number,values: any): void {
let control:any = <FormArray>this.purchaseItemForm.controls['purchase'];
if(values.purchase_type=="1" &&values.purchase_qty!='' && values.rate_per_unit!='' && values.fk_frequency_id!='') {
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id);
let Type1CalculatedValue = parseFloat(values.purchase_qty) * parseFloat(values.rate_per_unit) * parseFloat(filterFrequencyValue[0].mutiple_factor);
control.controls[indexVal].controls['annual_purchase_value'].setValue(Type1CalculatedValue.toFixed(2));
}
else if(values.purchase_type=="2" && values.rate_per_unit!='' && values.fk_frequency_id!='') {
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id);
let Type2CaluculatedValue = parseFloat(values.rate_per_unit) * parseFloat(filterFrequencyValue[0].mutiple_factor);
control.controls[indexVal].controls['annual_purchase_value'].setValue(Type2CaluculatedValue.toFixed(2));
}
else {
control.controls[indexVal].controls['annual_purchase_value'].setValue('');
@ -108,6 +170,7 @@ generateOtherUOM(index: number, values: any): void {
values.fk_uom_id=="1" ? control.controls[index].addControl('uom_other', new FormControl('', Validators.required)) : control.controls[index].removeControl('uom_other');
}
// save purchase details
submitDetails(records) {
if (this.purchaseItemForm.invalid) {

View File

@ -14,8 +14,16 @@
<div fxLayout="row wrap" *ngFor="let sales of salesItemForm.controls.salesCalItemwise['controls']; let s = index;" [formGroupName]="s" style="margin-top: 4%;">
<div fxFlex="100">
<mat-form-field style="width: 87%">
<input type="text" matInput placeholder="Product/Services" formControlName="sales_item" required>
<!-- <input type="text" matInput placeholder="Product/Services" formControlName="sales_item" required> -->
<mat-select placeholder="Product/Services" formControlName="sales_item" required>
<mat-option>Select</mat-option>
<mat-option *ngFor="let prod of productandservice" [value]="prod.name">{{ prod.name }}</mat-option>
<mat-option value="Others">Others</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 35%" *ngIf="sales.get('sales_item').value == 'Others'">
<input type="text" matInput placeholder="Other Product/Services" formControlName="other_sales_item">
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeItem(s)" *ngIf="salesItemForm.value.salesCalItemwise.length>1"
matTooltip="Remove Sales Item" matTooltipPosition="above">
<mat-icon>delete</mat-icon>
@ -83,7 +91,7 @@
<div class="item-product-margin" fxFlex="100" *ngIf="data.margin_calculation_status===true">
<mat-form-field style="width: 25%">
<input matInput OnlyNumber type="text" placeholder="Margin Percentage %" formControlName="margin_per" (keyup)="salesMarginPerCalculation(s,sales.value)">
<input matInput OnlyNumber type="text" placeholder="Gross Margin %" formControlName="margin_per" (keyup)="salesMarginPerCalculation(s,sales.value)">
</mat-form-field>
<mat-form-field style="width: 25%" *ngIf="sales.value.sales_type=='1'">
<input matInput OnlyNumber type="text" placeholder="Margin Per Unit" formControlName="margin_per_uom" (keyup)="salesMarginAmtCalculation(s,sales.value)">

View File

@ -16,7 +16,7 @@ export class ManageSalesComponent implements OnInit {
salesItemForm:FormGroup;
UOMData: any[]=[];
frequencyData: any[]=[];
productandservice: any[]=[];
//Declaration for Amout INwords.
annualSaleAmtInwords: any[]=[];
marginAmtInwords: any[]=[];
@ -33,6 +33,47 @@ export class ManageSalesComponent implements OnInit {
}
ngOnInit() {
this._pd.getTypeofActivityForSuppliedInfoForm(this.data.masterData.pdid, this.data.masterData.company_id).subscribe(data => {
if (data.dataStatus) {
let datas = data.records;
let api = Object.keys(datas.type_of_activity).map(function (key) {
return datas.type_of_activity[key];
});
if (api.length > 0) {
api.forEach(val => {
if (val.type_of_activity_id == 2) {
if (val.prodcuts) {
this.productandservice.push(val.prodcuts);
}
}
if (val.type_of_activity_id == 3) {
if (val.prodcuts) {
this.productandservice.push(val.prodcuts);
}
}
if (val.type_of_activity_id == 4) {
if (val.prodcuts) {
this.productandservice.push(val.prodcuts);
}
}
if (val.type_of_activity_id == 5) {
if (val.prodcuts) {
this.productandservice.push(val.prodcuts);
}
}
});
}
this.productandservice = [].concat.apply([], this.productandservice);
}
})
if(this.data.manage_status==2){
this.salesItemForm = this._fb.group({
salesCalItemwise: this._fb.array([this.createSalesItemWithData(this.data.editData)]),
@ -67,6 +108,7 @@ export class ManageSalesComponent implements OnInit {
company_id:[this.data.masterData.company_id],
fk_pd_id:[this.data.masterData.pdid],
sales_item:['',Validators.compose([Validators.required])],
other_sales_item:[''],
sales_qty:['',Validators.compose([Validators.required])],
fk_uom_id:['',Validators.compose([Validators.required])],
rate_per_unit:['',Validators.compose([Validators.required])],
@ -87,6 +129,7 @@ createSalesItemWithData(values: any) {
fk_pd_id:[this.data.masterData.pdid],
company_id:[this.data.masterData.company_id],
sales_item:[values.sales_item,Validators.compose([Validators.required])],
other_sales_item:[values.other_sales_item],
sales_qty:[values.sales_qty,Validators.compose([Validators.required])],
fk_uom_id:[values.fk_uom_id,Validators.compose([Validators.required])],
rate_per_unit:[values.rate_per_unit,Validators.compose([Validators.required])],
@ -116,11 +159,13 @@ salesCalculation(indexVal: number,values: any): void {
let control:any = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
if(values.sales_type=="1" && values.sales_qty!='' && values.rate_per_unit!='' && values.fk_frequency_id!='') {
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id);
control.controls[indexVal].controls['annual_sale_value'].setValue(parseInt(values.sales_qty) * parseInt(values.rate_per_unit) * parseInt(filterFrequencyValue[0].mutiple_factor));
let Type1CalculatedValue = parseFloat(values.sales_qty) * parseFloat(values.rate_per_unit) * parseFloat(filterFrequencyValue[0].mutiple_factor);
control.controls[indexVal].controls['annual_sale_value'].setValue(Type1CalculatedValue.toFixed(2));
}
else if(values.sales_type=="2" && values.rate_per_unit!='' && values.fk_frequency_id!='') {
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id);
control.controls[indexVal].controls['annual_sale_value'].setValue(parseInt(values.rate_per_unit) * parseInt(filterFrequencyValue[0].mutiple_factor));
let Type2CalculatedValue = parseFloat(values.rate_per_unit) * parseFloat(filterFrequencyValue[0].mutiple_factor)
control.controls[indexVal].controls['annual_sale_value'].setValue(Type2CalculatedValue.toFixed(2));
}
else {
control.controls[indexVal].controls['annual_sale_value'].setValue('');
@ -133,7 +178,8 @@ salesMarginPerCalculation(indexVal: number,values: any): void {
let control:any = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
control.controls[indexVal].controls['margin_per_uom'].setValue('');
if(values.margin_per!='' && values.annual_sale_value!='') {
control.controls[indexVal].controls['margin_final_value'].setValue(parseInt(values.annual_sale_value) * (parseInt(values.margin_per)/100));
let calculatedValue = parseFloat(values.annual_sale_value) * (parseFloat(values.margin_per)/100);
control.controls[indexVal].controls['margin_final_value'].setValue(calculatedValue.toFixed(2));
}
else {
control.controls[indexVal].controls['margin_final_value'].setValue('');
@ -145,10 +191,12 @@ salesMarginAmtCalculation(indexVal: number,values: any): void {
if(values.sales_type=="1" && values.margin_per_uom!='' && values.sales_qty!='' && values.fk_frequency_id!='') {
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id);
control.controls[indexVal].controls['margin_final_value'].setValue(parseInt(values.sales_qty) * parseInt(values.margin_per_uom) * parseInt(filterFrequencyValue[0].mutiple_factor));
let Type1CalculatedValue = parseFloat(values.sales_qty) * parseFloat(values.margin_per_uom) * parseFloat(filterFrequencyValue[0].mutiple_factor);
control.controls[indexVal].controls['margin_final_value'].setValue(Type1CalculatedValue.toFixed(2));
}
else if(values.sales_type=="2" && values.margin_per_uom!='' && values.rate_per_unit!='') {
control.controls[indexVal].controls['margin_final_value'].setValue(parseInt(values.rate_per_unit) * parseInt(values.margin_per_uom));
let Type2CalculatedValue = parseFloat(values.rate_per_unit) * parseFloat(values.margin_per_uom);
control.controls[indexVal].controls['margin_final_value'].setValue(Type2CalculatedValue.toFixed(2));
}
else {
control.controls[indexVal].controls['margin_final_value'].setValue('');
@ -194,6 +242,7 @@ removeItem(indexVal: number) : void {
// save sales details
submitDetails(records) {
if (this.salesItemForm.invalid) {
this.validateAllFormFields(this.salesItemForm);
this.notifier.notify('warning',"Please Check All Manatory Fields..");

View File

@ -34,23 +34,23 @@
<th mat-header-cell *matHeaderCellDef> Summary </th>
<td mat-cell *matCellDef="let element"> {{element.sno}}{{element.label}} </td>
</ng-container>
<!-- Position1 Column -->
<ng-container matColumnDef="position_2">
<th mat-header-cell *matHeaderCellDef> Declared_by_customer</th>
<td mat-cell *matCellDef="let element;let i = index">{{ i==7 ? element.declared_by_customer : i==9 ? element.declared_by_customer : element.declared_by_customer | rupeeCurrencyFormat}} </td>
<th mat-header-cell *matHeaderCellDef> Declared by Customer</th>
<td mat-cell *matCellDef="let element;let i = index">{{ i==7 ? element.declared_by_customer : i==10 ? element.declared_by_customer : element.declared_by_customer | rupeeCurrencyFormat}} </td>
</ng-container>
<!-- Position2 Column -->
<ng-container matColumnDef="position_3">
<th mat-header-cell *matHeaderCellDef> As Derived from Item Wise Sales </th>
<td mat-cell *matCellDef="let element;let i = index">{{ i==7 ? element.derived_item_wise : i==9 ? element.derived_item_wise : element.derived_item_wise | rupeeCurrencyFormat}} </td>
<td mat-cell *matCellDef="let element;let i = index">{{ i==7 ? element.derived_item_wise : i==10 ? element.derived_item_wise : element.derived_item_wise | rupeeCurrencyFormat}} </td>
</ng-container>
<!-- Position3 Column -->
<ng-container matColumnDef="position_4">
<th mat-header-cell *matHeaderCellDef> As Derived from Kuchha Sales Book/Bills </th>
<td mat-cell *matCellDef="let element;let i = index">{{ i==7 ? element.derived_sales_book : i==9 ? element.derived_sales_book : element.derived_sales_book | rupeeCurrencyFormat}} </td>
<td mat-cell *matCellDef="let element;let i = index">{{ i==7 ? element.derived_sales_book : i==10 ? element.derived_sales_book : element.derived_sales_book | rupeeCurrencyFormat}} </td>
<!-- | rupeeCurrencyFormat -->
</ng-container>
@ -75,27 +75,35 @@
<mat-tab label="Sales">
<ng-template matTabContent>
<app-gross-profit-calculation [masterData]="getCustomValues" [parentData]="grossProfitTypeList" (loadAssessedForms)="loadAIDetails()"></app-gross-profit-calculation>
<app-sales-calculation [masterData]="getCustomValues" [parentData]="salesDeclaredCustomer" (loadAssessedForms)="loadAIDetails()"></app-sales-calculation>
<app-sales-calculation [masterData]="getCustomValues" [parentData]="salesDeclaredCustomer" (loadAssessedForms)="loadAIDetails()"></app-sales-calculation>
<app-sales-details [masterData]="getCustomValues" [parentData]="salesCaluatedItem" (loadAssessedForms)="loadAIDetails()"></app-sales-details>
<app-daily-sales-details [masterData]="getCustomValues" [parentData]="salesMonthWiseExpandedItems" (loadAssessedForms)="loadAIDetails()"></app-daily-sales-details>
</ng-template>
</mat-tab>
<mat-tab label="Purchase">
<ng-template matTabContent>
<app-gross-profit-calculation [masterData]="getCustomValues" [parentData]="grossProfitTypeList" (loadAssessedForms)="loadAIDetails()"></app-gross-profit-calculation>
<app-purchase-details [masterData]="getCustomValues" [parentData]="purchaseDetails" (loadAssessedForms)="loadAIDetails()"></app-purchase-details>
<app-gross-profit-calculation [masterData]="getCustomValues" [parentData]="grossProfitTypeList" (loadAssessedForms)="loadAIDetails()" TabLabel="Purchase"></app-gross-profit-calculation>
<div *ngIf="PurchaseComponent">
<app-purchase-details [masterData]="getCustomValues" [parentData]="purchaseDetails" (loadAssessedForms)="loadAIDetails()"></app-purchase-details>
</div>
<div *ngIf="DailyPurchaseComponent">
<app-daily-purchase-details [masterData]="getCustomValues" [parentData]="purchaseBillWiseDetails" (loadAssessedForms)="loadAIDetails()"></app-daily-purchase-details>
</div>
<div *ngIf="!PurchaseComponent && !DailyPurchaseComponent">
<p><strong>Purchase Item is Not Available.. </strong></p>
</div>
</ng-template>
</mat-tab>
<mat-tab label="Business Expense">
<ng-template matTabContent>
<app-business-expense-details [masterData]="getCustomValues" [parentData]="businessExpenses" (loadAssessedForms)="loadAIDetails()"></app-business-expense-details>
</ng-template>
</mat-tab>
<mat-tab label="House Hold">
</mat-tab>
<mat-tab label="House Hold">
<ng-template matTabContent>
<app-house-hold-details [masterData]="getCustomValues" [parentData]="houseHoldExpenses" (loadAssessedForms)="loadAIDetails()"></app-house-hold-details>
</ng-template>
</mat-tab>
</mat-tab>
<!--<mat-tab label="Other Business Income">
<ng-template matTabContent>
<app-other-business-income-details [masterData]="getCustomValues" [parentData]="otherBusinessIncome" (loadAssessedForms)="loadAIDetails()"></app-other-business-income-details>

View File

@ -14,6 +14,7 @@ import { RupeeCurrencyFormatPipe } from './../../../../../pd-pipes/rupee-currenc
providers: [RupeeCurrencyFormatPipe]
})
export class AssessedIncomeComponent implements OnInit {
displayedSummaryColumns: any =[];
summaryItemSource:any = [];
customer_segment_abbr: any;
@ -34,6 +35,7 @@ export class AssessedIncomeComponent implements OnInit {
public salesCaluatedItem:any= [];
public salesItemMonthWise:any= [];
public purchaseDetails:any= [];
public purchaseBillWise:any= [];
public businessExpenses:any= [];
public houseHoldExpenses:any= [];
public otherBusinessIncome: any=[];
@ -44,6 +46,8 @@ salesItemMonthWiseBody: any[];
salesItemMonthWiseFooter: any[];
salesMonthWiseExpandedItems: any=[]
purchaseBillWiseDetails: any=[];
public UOMList: any=[];
public frequencyList: any=[];
public businessExpenseList: any=[];
@ -51,6 +55,8 @@ public businessIncomeList: any=[];
public grossProfitTypeList: any=[];
public salesDeclaredCustomer: any=[];
public getCustomValues:any = { UOMList: this.UOMList,frequencyList: this.frequencyList,businessExpenseList: this.businessExpenseList,businessIncomeList:this.businessIncomeList,pdid:'',company_id:'',grossProfitTypeList:this.grossProfitTypeList,salesDeclaredCustomer:this.salesDeclaredCustomer};
DailyPurchaseComponent:boolean;
PurchaseComponent:boolean;
//public finalData: any;
constructor(notifier: NotifierService, private route: ActivatedRoute,
private router: Router,
@ -67,7 +73,8 @@ public getCustomValues:any = { UOMList: this.UOMList,frequencyList: this.frequen
this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id;
this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr;
this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr;
this.DailyPurchaseComponent = false;
this.PurchaseComponent = false;
}
public viewerOptions: any = {
navbar: false,
@ -98,6 +105,7 @@ public viewerOptions: any = {
// load ai details
loadAIDetails(): void{
this.salesMonthWiseExpandedItems=[]
this.purchaseBillWiseDetails=[];
let params: any = {};
params.parent_pdid = this.parent_pdid;
params.pd_id = this.pdid;
@ -140,12 +148,46 @@ public viewerOptions: any = {
// message: ' Yearly ' + itemElement.sales_item + ' Sales Arrived',
// value: calculateAllItemsTotal * convertYear,
// })
this.salesMonthWiseExpandedItems.push({sim_id:itemElement.sim_id,salesItem:itemElement.sales_item,sales_type:itemElement.sales_type,comments:itemElement.comments,margin_per:itemElement.margin_per,margin_value:itemElement.margin_value, expandElements:expandBodyContent, footerMessage: footerMessage});
this.salesMonthWiseExpandedItems.push({sim_id:itemElement.sim_id,salesItem:itemElement.sales_item,otherSalesItem:itemElement.other_sales_item,sales_type:itemElement.sales_type,comments:itemElement.comments,margin_per:itemElement.margin_per,margin_value:itemElement.margin_value, expandElements:expandBodyContent, footerMessage: footerMessage});
});
}
this.PurchaseComponent = value.records.gross_profit_calculation_type[value.records.gross_profit_calculation_type.length-1].mode==1 && value.records.gross_profit_calculation_type[value.records.gross_profit_calculation_type.length-1].purchase_type==1 ? true : false;
if(value.records.purchase_details){
this.purchaseDetails = value.records.purchase_details;
}
this.DailyPurchaseComponent = value.records.gross_profit_calculation_type[value.records.gross_profit_calculation_type.length-1].mode==1 && value.records.gross_profit_calculation_type[value.records.gross_profit_calculation_type.length-1].purchase_type==2 ? true : false;
if(value.records.purchase_billwise){
this.purchaseBillWise = value.records.purchase_billwise;
this.purchaseBillWise.forEach((billElement, itemIndex) => {
let result = Object.assign({}, ...billElement.items);
let expandBodyContent= Object.keys(result).map(key => ({ header:key, value: result[key] }));
let listItems: any=[];
expandBodyContent.forEach((expnadElement, expnadIndex) => {
let calculateItems = expnadElement.value.reduce((acc, calculate) => acc + Number(calculate.purchase_value), 0);
listItems.push({items:expnadElement, itemsTotal:calculateItems})
})
let calculateAllItemsTotal:number=listItems.reduce((racc, rcalculate) => racc + Number(rcalculate.itemsTotal), 0);
let convertYear : number = 12 / listItems.length;
let footerMessage: any=[];
footerMessage.push({
month_message: listItems.length + ' Monthly Purchase : '+ calculateAllItemsTotal,
month_value:calculateAllItemsTotal,
year_message: ' Yearly Purchase : '+ calculateAllItemsTotal * convertYear,
year_value: calculateAllItemsTotal * convertYear,
})
this.purchaseBillWiseDetails.push({pbw_id:billElement.pbw_id,purchaseItem:billElement.purchase_item,otherPurchaseItem:billElement.other_purchase_item,comments:billElement.comments,annual_purchase_value:billElement.annual_purchase_value, expandElements:expandBodyContent, footerMessage: footerMessage});
});
}
if(value.records.business_expenses){
this.businessExpenses=value.records.business_expenses;
}
@ -177,7 +219,7 @@ public viewerOptions: any = {
if(value.records.final_data.length >0 && (value.records.final_data[0].sales_declared_by_customer && value.records.final_data[0].sales_declared_by_customer.cost_of_goods_sold) || (value.records.final_data[0].sales_calculated_by_itemwise &&value.records.final_data[0].sales_calculated_by_itemwise.cost_of_goods_sold)|| (value.records.final_data[0].sales_calculated_by_monthwise &&value.records.final_data[0].sales_calculated_by_monthwise.cost_of_goods_sold) ){
let get_sumary: any=[];
// set sales and revenue
get_sumary.push({"sno":'a. ',"label":'Sales Revenue ',"declared_by_customer":(value.records.final_data[0].sales_declared_by_customer && value.records.final_data[0].sales_declared_by_customer.sales_revenue) ? value.records.final_data[0].sales_declared_by_customer.sales_revenue:0, "derived_item_wise":(value.records.final_data[0].sales_calculated_by_itemwise && value.records.final_data[0].sales_calculated_by_itemwise.sales_revenue) ? value.records.final_data[0].sales_calculated_by_itemwise.sales_revenue:0 ,"derived_sales_book":(value.records.final_data[0].sales_calculated_by_monthwise && value.records.final_data[0].sales_calculated_by_monthwise.sales_revenue) ? value.records.final_data[0].sales_calculated_by_monthwise.sales_revenue:0 });
get_sumary.push({"sno":'a. ',"label":'Sales / Revenue ',"declared_by_customer":(value.records.final_data[0].sales_declared_by_customer && value.records.final_data[0].sales_declared_by_customer.sales_revenue) ? value.records.final_data[0].sales_declared_by_customer.sales_revenue:0, "derived_item_wise":(value.records.final_data[0].sales_calculated_by_itemwise && value.records.final_data[0].sales_calculated_by_itemwise.sales_revenue) ? value.records.final_data[0].sales_calculated_by_itemwise.sales_revenue:0 ,"derived_sales_book":(value.records.final_data[0].sales_calculated_by_monthwise && value.records.final_data[0].sales_calculated_by_monthwise.sales_revenue) ? value.records.final_data[0].sales_calculated_by_monthwise.sales_revenue:0 });
//set cost of goods sold
get_sumary.push({"sno":'b. ',"label":'Cost of Goods Sold ',"declared_by_customer":(value.records.final_data[0].sales_declared_by_customer && value.records.final_data[0].sales_declared_by_customer.cost_of_goods_sold) ? value.records.final_data[0].sales_declared_by_customer.cost_of_goods_sold:0, "derived_item_wise":(value.records.final_data[0].sales_calculated_by_itemwise && value.records.final_data[0].sales_calculated_by_itemwise.cost_of_goods_sold) ? value.records.final_data[0].sales_calculated_by_itemwise.cost_of_goods_sold:0 ,"derived_sales_book":(value.records.final_data[0].sales_calculated_by_monthwise && value.records.final_data[0].sales_calculated_by_monthwise.cost_of_goods_sold) ? value.records.final_data[0].sales_calculated_by_monthwise.cost_of_goods_sold:0 });
//set gross profit
@ -202,23 +244,25 @@ public viewerOptions: any = {
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer==null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise==null) ? get_sumary.push({"sno":'',"label":'Considered Sales / Revenue ',"declared_by_customer":'', "derived_item_wise":value.records.final_data[0].consolidated_report.consolidated_sales_revenue ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer==null && value.records.final_data[0].sales_calculated_by_itemwise==null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Sales / Revenue ',"declared_by_customer":'', "derived_item_wise":'' ,"derived_sales_book":value.records.final_data[0].consolidated_report.consolidated_sales_revenue })
:'';
// get conslidate net margin details
(value.records.final_data[0].consolidated_report && value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Margin % ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nermagin +'%', "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise==null) ? get_sumary.push({"sno":'',"label":'Considered Net Margin % ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nermagin +'%', "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise==null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Margin % ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nermagin +'%', "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer==null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Margin % ',"declared_by_customer":'', "derived_item_wise":value.records.final_data[0].consolidated_report.consolidated_nermagin +'%' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise==null && value.records.final_data[0].sales_calculated_by_monthwise==null) ? get_sumary.push({"sno":'',"label":'Considered Net Margin % ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nermagin +'%', "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer==null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise==null) ? get_sumary.push({"sno":'',"label":'Considered Net Margin % ',"declared_by_customer":'', "derived_item_wise":value.records.final_data[0].consolidated_report.consolidated_nermagin +'%' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer==null && value.records.final_data[0].sales_calculated_by_itemwise==null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Margin % ',"declared_by_customer":'', "derived_item_wise":'' ,"derived_sales_book":value.records.final_data[0].consolidated_report.consolidated_nermagin +'%' })
:'';
// get conslidate net profit details
(value.records.final_data[0].consolidated_report && value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nerprofit, "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise==null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nerprofit, "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise==null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nerprofit, "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer==null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit ',"declared_by_customer":'', "derived_item_wise":value.records.final_data[0].consolidated_report.consolidated_nerprofit ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise==null && value.records.final_data[0].sales_calculated_by_monthwise==null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nerprofit, "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer==null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise==null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit ',"declared_by_customer":'', "derived_item_wise":value.records.final_data[0].consolidated_report.consolidated_nerprofit ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer==null && value.records.final_data[0].sales_calculated_by_itemwise==null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit ',"declared_by_customer":'', "derived_item_wise":'' ,"derived_sales_book":value.records.final_data[0].consolidated_report.consolidated_nerprofit })
// get conslidate net profit details
(value.records.final_data[0].consolidated_report && value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit Amount ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nerprofit, "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise==null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit Amount ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nerprofit, "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise==null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit Amount ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nerprofit, "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer==null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit Amount ',"declared_by_customer":'', "derived_item_wise":value.records.final_data[0].consolidated_report.consolidated_nerprofit ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise==null && value.records.final_data[0].sales_calculated_by_monthwise==null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit Amount ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nerprofit, "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer==null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise==null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit Amount ',"declared_by_customer":'', "derived_item_wise":value.records.final_data[0].consolidated_report.consolidated_nerprofit ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer==null && value.records.final_data[0].sales_calculated_by_itemwise==null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit Amount ',"declared_by_customer":'', "derived_item_wise":'' ,"derived_sales_book":value.records.final_data[0].consolidated_report.consolidated_nerprofit })
:'';
// get conslidate net margin details
(value.records.final_data[0].consolidated_report && value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit to Sales %',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nermagin +'%', "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise==null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit to Sales % ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nermagin +'%', "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise==null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit to Sales % ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nermagin +'%', "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer==null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit to Sales % ',"declared_by_customer":'', "derived_item_wise":value.records.final_data[0].consolidated_report.consolidated_nermagin +'%' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise==null && value.records.final_data[0].sales_calculated_by_monthwise==null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit to Sales % ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nermagin +'%', "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer==null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise==null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit to Sales % ',"declared_by_customer":'', "derived_item_wise":value.records.final_data[0].consolidated_report.consolidated_nermagin +'%' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer==null && value.records.final_data[0].sales_calculated_by_itemwise==null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit to Sales % ',"declared_by_customer":'', "derived_item_wise":'' ,"derived_sales_book":value.records.final_data[0].consolidated_report.consolidated_nermagin +'%' })
:'';
this.summaryItemSource=get_sumary;
@ -236,10 +280,11 @@ public viewerOptions: any = {
// this.sumary_details.house_hold_expense_details = value.records.final_data[0].house_hold_expense_details !='' && value.records.final_data[0].house_hold_expense_details !=null ? value.records.final_data[0].house_hold_expense_details : 0;
// this.sumary_details.net_disable_income_value = Number(this.sumary_details.net_profit) - Number(this.sumary_details.household_expenses);
}
else if(value.records.final_data.length >0 && (value.records.final_data[0].sales_declared_by_customer && value.records.final_data[0].sales_declared_by_customer.purchases) || (value.records.final_data[0].sales_calculated_by_itemwise &&value.records.final_data[0].sales_calculated_by_itemwise.purchases)|| (value.records.final_data[0].sales_calculated_by_monthwise &&value.records.final_data[0].sales_calculated_by_monthwise.purchases)){
// else if(value.records.final_data.length >0 && (value.records.final_data[0].sales_declared_by_customer && value.records.final_data[0].sales_declared_by_customer.purchases) || (value.records.final_data[0].sales_calculated_by_itemwise &&value.records.final_data[0].sales_calculated_by_itemwise.purchases)|| (value.records.final_data[0].sales_calculated_by_monthwise &&value.records.final_data[0].sales_calculated_by_monthwise.purchases)){
else if(value.records.final_data.length >0 && (value.records.final_data[0].sales_declared_by_customer && (value.records.final_data[0].sales_declared_by_customer.purchases !== null && value.records.final_data[0].sales_declared_by_customer.purchases !== undefined)) || (value.records.final_data[0].sales_calculated_by_itemwise && (value.records.final_data[0].sales_calculated_by_itemwise.purchases !== null && value.records.final_data[0].sales_calculated_by_itemwise.purchases !== undefined)) || (value.records.final_data[0].sales_calculated_by_monthwise && (value.records.final_data[0].sales_calculated_by_monthwise.purchases !== null && value.records.final_data[0].sales_calculated_by_monthwise.purchases !== undefined))){
let get_sumary: any=[];
// set sales and revenue
get_sumary.push({"sno":'a. ',"label":'Sales Revenue ',"declared_by_customer":(value.records.final_data[0].sales_declared_by_customer && value.records.final_data[0].sales_declared_by_customer.sales_revenue) ? value.records.final_data[0].sales_declared_by_customer.sales_revenue:0, "derived_item_wise":(value.records.final_data[0].sales_calculated_by_itemwise && value.records.final_data[0].sales_calculated_by_itemwise.sales_revenue) ? value.records.final_data[0].sales_calculated_by_itemwise.sales_revenue:0 ,"derived_sales_book":(value.records.final_data[0].sales_calculated_by_monthwise && value.records.final_data[0].sales_calculated_by_monthwise.sales_revenue) ? value.records.final_data[0].sales_calculated_by_monthwise.sales_revenue:0 });
get_sumary.push({"sno":'a. ',"label":'Sales / Revenue ',"declared_by_customer":(value.records.final_data[0].sales_declared_by_customer && value.records.final_data[0].sales_declared_by_customer.sales_revenue) ? value.records.final_data[0].sales_declared_by_customer.sales_revenue:0, "derived_item_wise":(value.records.final_data[0].sales_calculated_by_itemwise && value.records.final_data[0].sales_calculated_by_itemwise.sales_revenue) ? value.records.final_data[0].sales_calculated_by_itemwise.sales_revenue:0 ,"derived_sales_book":(value.records.final_data[0].sales_calculated_by_monthwise && value.records.final_data[0].sales_calculated_by_monthwise.sales_revenue) ? value.records.final_data[0].sales_calculated_by_monthwise.sales_revenue:0 });
//set purchase
get_sumary.push({"sno":'b. ',"label":'Purchases ',"declared_by_customer":(value.records.final_data[0].sales_declared_by_customer && value.records.final_data[0].sales_declared_by_customer.purchases) ? value.records.final_data[0].sales_declared_by_customer.purchases:0, "derived_item_wise":(value.records.final_data[0].sales_calculated_by_itemwise && value.records.final_data[0].sales_calculated_by_itemwise.purchases) ? value.records.final_data[0].sales_calculated_by_itemwise.purchases:0 ,"derived_sales_book":(value.records.final_data[0].sales_calculated_by_monthwise && value.records.final_data[0].sales_calculated_by_monthwise.purchases) ? value.records.final_data[0].sales_calculated_by_monthwise.purchases:0 });
//set gross profit
@ -264,7 +309,17 @@ public viewerOptions: any = {
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer==null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise==null) ? get_sumary.push({"sno":'',"label":'Considered Sales / Revenue ',"declared_by_customer":'', "derived_item_wise":value.records.final_data[0].consolidated_report.consolidated_sales_revenue ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer==null && value.records.final_data[0].sales_calculated_by_itemwise==null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Sales / Revenue ',"declared_by_customer":'', "derived_item_wise":'' ,"derived_sales_book":value.records.final_data[0].consolidated_report.consolidated_sales_revenue })
:'';
// get conslidate net margin details
// get conslidate net profit details
(value.records.final_data[0].consolidated_report && value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nerprofit, "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise==null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nerprofit, "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise==null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nerprofit, "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer==null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit ',"declared_by_customer":'', "derived_item_wise":value.records.final_data[0].consolidated_report.consolidated_nerprofit ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise==null && value.records.final_data[0].sales_calculated_by_monthwise==null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nerprofit, "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer==null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise==null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit ',"declared_by_customer":'', "derived_item_wise":value.records.final_data[0].consolidated_report.consolidated_nerprofit ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer==null && value.records.final_data[0].sales_calculated_by_itemwise==null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit ',"declared_by_customer":'', "derived_item_wise":'' ,"derived_sales_book":value.records.final_data[0].consolidated_report.consolidated_nerprofit })
:'';
(value.records.final_data[0].consolidated_report && value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Margin % ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nermagin +'%', "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise==null) ? get_sumary.push({"sno":'',"label":'Considered Net Margin % ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nermagin +'%', "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise==null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Margin % ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nermagin +'%', "derived_item_wise":'' ,"derived_sales_book":'' })
@ -273,15 +328,7 @@ public viewerOptions: any = {
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer==null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise==null) ? get_sumary.push({"sno":'',"label":'Considered Net Margin % ',"declared_by_customer":'', "derived_item_wise":value.records.final_data[0].consolidated_report.consolidated_nermagin +'%' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer==null && value.records.final_data[0].sales_calculated_by_itemwise==null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Margin % ',"declared_by_customer":'', "derived_item_wise":'' ,"derived_sales_book":value.records.final_data[0].consolidated_report.consolidated_nermagin +'%' })
:'';
// get conslidate net profit details
(value.records.final_data[0].consolidated_report && value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nerprofit, "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise==null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nerprofit, "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise==null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nerprofit, "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer==null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit ',"declared_by_customer":'', "derived_item_wise":value.records.final_data[0].consolidated_report.consolidated_nerprofit ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer!=null && value.records.final_data[0].sales_calculated_by_itemwise==null && value.records.final_data[0].sales_calculated_by_monthwise==null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit ',"declared_by_customer":value.records.final_data[0].consolidated_report.consolidated_nerprofit, "derived_item_wise":'' ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer==null && value.records.final_data[0].sales_calculated_by_itemwise!=null && value.records.final_data[0].sales_calculated_by_monthwise==null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit ',"declared_by_customer":'', "derived_item_wise":value.records.final_data[0].consolidated_report.consolidated_nerprofit ,"derived_sales_book":'' })
: (value.records.final_data[0].consolidated_report &&value.records.final_data[0].sales_declared_by_customer==null && value.records.final_data[0].sales_calculated_by_itemwise==null && value.records.final_data[0].sales_calculated_by_monthwise!=null) ? get_sumary.push({"sno":'',"label":'Considered Net Profit ',"declared_by_customer":'', "derived_item_wise":'' ,"derived_sales_book":value.records.final_data[0].consolidated_report.consolidated_nerprofit })
:'';
this.summaryItemSource=get_sumary;
}

View File

@ -0,0 +1,80 @@
<mat-card>
<mat-card-content>
<div fxLayout="row nowrap">
<div fxFlex="60" align="left">
<!-- <span>Purchase Calculate Daily Wise</span> -->
<span>Purchase Calculation as per Kutcha Records / Bills</span>
</div>
<div fxFlex="40" align="right">
<button type="button" mat-flat-button (click)="addMoreItem()" matTooltip="Add More" matTooltipPosition="above"
color="primary">
<strong>Add More Item</strong>
</button>
</div>
</div>
<div *ngIf="purchaseBillWiseDetails.length>0;else notAvilable;">
<mat-card *ngFor="let expandDetails of purchaseBillWiseDetails">
<div>
<mat-card-header>
<mat-card-title>
<small class="expan_table_header">{{expandDetails.purchaseItem == 'Others' ? expandDetails.purchaseItem + ' ( ' + expandDetails.otherPurchaseItem + ' )' : expandDetails.purchaseItem}}</small>
</mat-card-title>
<mat-card-subtitle *ngFor="let footer of expandDetails.footerMessage">
<div fxFlex="100" class="subtitle_message">
{{footer.month_message}} &nbsp;&nbsp;{{footer.year_message}}
</div>
</mat-card-subtitle>
</mat-card-header>
<mat-divider></mat-divider>
<mat-card-content style="display: flex;margin-top: -20px;">
<div fxFlex="50" *ngFor="let eachItem of expandDetails.expandElements" class="m-gap p-gap">
<h4 align="center" class="h4_font">{{eachItem.header}}</h4>
<table mat-table [dataSource]="eachItem.value" class="mat-elevation-z8">
<ng-container matColumnDef="Date">
<th mat-header-cell *matHeaderCellDef>Date</th>
<td mat-cell *matCellDef="let itemValue">{{itemValue.purchase_date | date:'dd-MM-yyyy'}} </td>
<td mat-footer-cell *matFooterCellDef> Total </td>
</ng-container>
<ng-container matColumnDef="Amount">
<th mat-header-cell *matHeaderCellDef>Amount</th>
<td mat-cell *matCellDef="let itemValue">{{itemValue.purchase_value}}</td>
<td mat-footer-cell *matFooterCellDef> {{getTotalCost(eachItem.value)}} </td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="purchaseBillWiseItemColumns; sticky: true"></tr>
<tr mat-row *matRowDef="let row; columns: purchaseBillWiseItemColumns;"></tr>
<tr mat-footer-row *matFooterRowDef="purchaseBillWiseItemColumns; sticky: true"></tr>
</table>
</div>
</mat-card-content>
</div>
<mat-card-actions>
<div fxFlex="75" align="left">
{{expandDetails.comments}}
</div>
<div fxFlex="25" align="right">
<button class="mr-1 mb-1" mat-mini-fab matTooltip="Edit" matTooltipPosition="above" (click)="editPurchaseBillWise(expandDetails)"
color="primary" type="button">
<mat-icon>edit</mat-icon>
</button>
<button class="mr-1 mb-1" mat-mini-fab matTooltip="Remove" matTooltipPosition="above" (click)="removePurchaseBillWise(expandDetails)"
color="primary" type="button">
<mat-icon>delete</mat-icon>
</button>
</div>
</mat-card-actions>
</mat-card>
</div>
<ng-template #notAvilable>
<!-- <strong>Purchase is Not Available.. </strong> -->
</ng-template>
</mat-card-content>
</mat-card>
<notifier-container></notifier-container>

View File

@ -0,0 +1,37 @@
.example-container {
max-height: 500px;
overflow: auto;
}
table {
width: 100%;
}
tr.mat-footer-row {
font-weight: bold;
}
.mat-table-sticky {
border-top: 1px solid #e0e0e0;
}
.expan_footer{
font-size: 18px;
direction: rtl;
}
.expan_table_header {
font-size: 18px;
//text-align: center;
}
.h4_font {
font-size: 18px;
}
.subtitle_message {
color:#e00201 !important;
}
.delete-margin {
margin-left: 3%;
}
.mat-footer-cell {
font-weight: bold;
font-size: 1.2rem !important;
}

View File

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

View File

@ -0,0 +1,107 @@
import { Component, OnInit, Input, Output, Inject, OnChanges,SimpleChanges, EventEmitter, DoCheck } from '@angular/core';
import { PdTrigerService } from './../../../../../../pd-service/pd-triger.service';
import {MatDialog,MatDialogRef,MAT_DIALOG_DATA, MatTableDataSource} from '@angular/material';
import { ManageDailyPurchaseComponent } from './../AI-diologue/manage-daily-purchase/manage-daily-purchase.component';
import { NotifierService } from 'angular-notifier';
@Component({
selector: 'app-daily-purchase-details',
templateUrl: './daily-purchase-details.component.html',
styleUrls: ['./daily-purchase-details.component.scss']
})
export class DailyPurchaseDetailsComponent implements OnInit , DoCheck {
public purchaseBillWiseItemColumns = ['Date','Amount'];
public purchaseBillWiseDetails: any[]=[];
@Input() parentData: any;
@Input() masterData: { UOMList: any; frequencyList: any; pdid:number,company_id:number, grossProfitTypeList:any,purchaseDeclaredCustomer: any};
@Output() loadAssessedForms = new EventEmitter<string>();
private notifier:NotifierService;
constructor(notifier:NotifierService, private _pd: PdTrigerService, private dialog: MatDialog) {
this.notifier = notifier;
}
ngOnInit() {}
getTotalCost(getItems:any) {
return getItems.map(t => t.purchase_value).reduce((acc, value) => acc + Number(value), 0);
}
// add more item details
addMoreItem():void {
let passValues: any = {
manage_status:1,
masterData: this.masterData,
}
const dialogRef = this.dialog.open(ManageDailyPurchaseComponent, {
data: passValues,
position: { right: '0'},
width:'80%',
disableClose: true
});
dialogRef.afterClosed()
.subscribe(dataresult => {
if(dataresult.update_status==true){
this.loadAssessedForms.next('1');
}
});
}
editPurchaseBillWise(value:any) {
let transformData: any = value.expandElements.map(val=>val.value);
transformData = [].concat.apply([], transformData);
let editValue: any = {
"fk_pd_id":this.masterData.pdid,
"pbw_id":value.pbw_id,
"purchaseItem":value.purchaseItem,
"otherPurchaseItem":value.otherPurchaseItem,
"comments":value.comments,
"annual_purchase_value":value.annual_purchase_value,
"values":transformData,
}
let passValues: any = {
manage_status:2,
masterData: this.masterData,
editData:editValue,
}
const dialogRef = this.dialog.open(ManageDailyPurchaseComponent, {
data: passValues,
position: { right: '0'},
width:'80%',
disableClose: true
});
dialogRef.afterClosed()
.subscribe(dataresult => {
if(dataresult.update_status==true){
this.loadAssessedForms.next('1');
}
});
}
// remove purchase item
removePurchaseBillWise(value: any) : void{
let deleteRecords: any =[{
"fk_pd_id":this.masterData.pdid,
"pbw_id":value.pbw_id,
"company_id":this.masterData.company_id,
"isactive":false,
"child":[]
}];
this._pd.saveAssessedDetails('saveAssessedIncomePurchaseBillwise',deleteRecords).subscribe(data => {
this.notifier.notify('success','Removed Successfully');
this.loadAssessedForms.next('1');
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
});
}
// do check component bases
ngDoCheck() {
this.purchaseBillWiseDetails = this.parentData;
}
}

View File

@ -6,7 +6,7 @@
<mat-card-content>
<div fxLayout="row nowrap">
<div fxFlex="60" align="left">
<span>Sales Calculate Daily Wise</span>
<span>Sales Calculation as per Kutcha Records / Bills</span>
</div>
<div fxFlex="40" align="right">
<button type="button" mat-flat-button (click)="addMoreItem()"
@ -21,7 +21,8 @@
<div *ngSwitchCase="1">
<mat-card-header>
<mat-card-title>
<small class="expan_table_header">{{expandDetails.salesItem}}</small>
<!-- <small class="expan_table_header">{{expandDetails.salesItem}}</small> -->
<small class="expan_table_header">{{expandDetails.salesItem == 'Others' ? expandDetails.salesItem +' ( '+ expandDetails.otherSalesItem +' )' : expandDetails.salesItem}}</small>
<small class="expan_table_header" *ngIf="activateMariginCalculation===true">&nbsp;( Gross Margin : {{expandDetails.margin_per}} % &nbsp;&nbsp;Gross Profit : {{expandDetails.margin_value}} )</small>
</mat-card-title>
<mat-card-subtitle *ngFor="let footer of expandDetails.footerMessage">
@ -62,7 +63,8 @@
<div *ngSwitchCase="2">
<mat-card-header>
<mat-card-title>
<small class="expan_table_header">{{expandDetails.salesItem}}</small>
<!-- <small class="expan_table_header">{{expandDetails.salesItem}}</small> -->
<small class="expan_table_header">{{expandDetails.salesItem == 'Others' ? expandDetails.salesItem +' ( '+ expandDetails.otherSalesItem +' )' : expandDetails.salesItem}}</small>
<small class="expan_table_header" *ngIf="activateMariginCalculation===true">&nbsp;( Gross Margin : {{expandDetails.margin_per}} % &nbsp;&nbsp;Gross Profit : {{expandDetails.margin_value}} )</small>
</mat-card-title>
<!-- <mat-card-subtitle *ngFor="let footer of expandDetails.footerMessage">

View File

@ -25,8 +25,7 @@ export class DailySalesDetailsComponent implements OnInit, DoCheck {
this.enableDailySalesSection = false;
}
ngOnInit() {
}
ngOnInit() {}
// get total cost
getTotalCost(getItems:any) {
@ -61,6 +60,7 @@ editSalesItem(value:any) {
"fk_pd_id":this.masterData.pdid,
"sim_id":value.sim_id,
"salesItem":value.salesItem,
"otherSalesItem":value.otherSalesItem,
"sales_type":value.sales_type,
"comments":value.comments,
"margin_value":value.margin_value,
@ -113,7 +113,6 @@ ngDoCheck() {
if(this.masterData.grossProfitTypeList.length>0){
this.activateMariginCalculation = this.masterData.grossProfitTypeList[this.masterData.grossProfitTypeList.length-1].margin==2 && this.masterData.grossProfitTypeList[this.masterData.grossProfitTypeList.length-1].mode==2 ? true : false;
this.enableDailySalesSection = this.masterData.salesDeclaredCustomer.length>0 ? true : false;
}}
// detect chnges from parent

View File

@ -15,6 +15,18 @@
<mat-option *ngFor="let getSale of check_sales_type" [value]="getSale.id">{{getSale.name}}</mat-option>
</mat-select>
</mat-form-field> -->
<div style="width: 35%" fxFlex="35" *ngIf="grossProfitForm.controls['mode'].value == 1">
<!-- <mat-radio-group formControlName="margin" class="example-radio-group">
<mat-radio-button class="example-radio-button" color="primary" [value]="types.id" *ngFor="let types of purchase_sub_type; let t = index">{{types.name}}</mat-radio-button>
</mat-radio-group> -->
<!-- <label id="example-radio-group-label">Pick Up purchase sub type</label> -->
<mat-radio-group formControlName="purchase_type" class="example-radio-group">
<mat-radio-button class="example-radio-button" color="primary" [value]="types.id" *ngFor="let types of purchase_sub_type; let t = index">{{types.name}}</mat-radio-button>
</mat-radio-group>
</div>
<button type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Save" matTooltipPosition="above" (click)="submitDetails(grossProfitForm.value)"><mat-icon>save</mat-icon>
</button>

View File

@ -1,3 +1,17 @@
mat-form-field {
margin: 0 2%;
}
}
.mat-radio-button ~ .mat-radio-button {
margin-left: 16px;
}
.example-radio-group {
display: flex;
flex-direction: row;
margin: 15px 0;
}
// .example-radio-button {
// margin: 5px;
// }

View File

@ -11,29 +11,39 @@ import { NotifierService } from 'angular-notifier';
export class GrossProfitCalculationComponent implements OnInit, OnChanges {
@Input() masterData: { UOMList: any; frequencyList: any;businessExpenseList:any; pdid:number, company_id:number};
@Input() parentData: any;
// @Input() TabLabel: any;
@Output() loadAssessedForms = new EventEmitter<string>();
public grossProfitForm: FormGroup;
check__purchse_type:any=[{'id':'1','name':'Yes'},{'id':'2','name':'No'}]
check_sales_type:any=[{'id':'1','name':'Gross Margin'},{'id':'2','name':'Net Margin'}]
purchase_sub_type:any=[{'id':'1','name':'Purchase Item Wise'},{'id':'2','name':'Purchase Bill Wise'}]
private notifier: NotifierService;
constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService) {
this.notifier = notifier;
}
ngOnInit() {
}
changeOptions(values: any){
// console.log('values',values);
this.grossProfitForm.controls['margin'].setValue('');
if(values.mode == 1){
this.grossProfitForm.controls['margin'].setValue('');
}
/** if Mode Value is 'No' -> margin value is setted as netmargin and its id - 2
* Refer => check_sales_type **/
if(values.mode == 2){
// console.log('2');
this.grossProfitForm.controls['margin'].setValue('2');
}
this.grossProfitForm.controls['purchase_type'].setValue('');
}
}
submitDetails(records: any){
// console.log(records);
// return;
if (this.grossProfitForm.invalid) {
this.validateAllFormFields(this.grossProfitForm);
this.notifier.notify('warning',"Please Check All Manatory Fields..");
@ -58,6 +68,7 @@ ngOnChanges(changes: SimpleChanges) {
company_id:[this.masterData.company_id],
mode:[changes.parentData.currentValue[0].mode,Validators.compose([Validators.required])],
margin:[changes.parentData.currentValue[0].margin],
purchase_type:[changes.parentData.currentValue[0].purchase_type],
})
}
else {
@ -68,6 +79,7 @@ ngOnChanges(changes: SimpleChanges) {
company_id:[this.masterData.company_id],
mode:['',Validators.compose([Validators.required])],
margin:[''],
purchase_type:[''],
})
}
}

View File

@ -2,7 +2,8 @@
<mat-card-content *ngIf="activateMariginCalculation;else notAvilable">
<div fxLayout="row nowrap">
<div fxFlex="60" align="left">
<span>Purchase Item</span>
<!-- <span>Purchase Item</span> -->
<span>Item-wise Purchase Calculation</span>
</div>
<div fxFlex="40" align="right">
<button type="button" mat-flat-button (click)="addMoreItem()"
@ -11,19 +12,19 @@
</button>
</div>
</div>
<div class="example-container mat-elevation-z8" *ngIf="purchaseItemSource.data.length>0;">
<div class="example-container mat-elevation-z8" *ngIf="purchaseItemSource.data.length>0;else notAvilable;">
<table mat-table [dataSource]="purchaseItemSource">
<ng-container matColumnDef="raw_material" sticky>
<th mat-header-cell *matHeaderCellDef> Raw Material/Trading Item </th>
<td mat-cell *matCellDef="let element"> {{element.purchase_item}} </td>
<td mat-cell *matCellDef="let element"> {{element.purchase_item == 'Others' ? element.purchase_item +' ( '+ element.other_purchase_item + ' )' : element.purchase_item }} </td>
<td mat-footer-cell *matFooterCellDef> Total of Purchase</td>
</ng-container>
<ng-container matColumnDef="purchase_quantity">
<th mat-header-cell *matHeaderCellDef> Purchase Quantity </th>
<td mat-cell *matCellDef="let element"> {{element.purchase_qty}} </td>
<td mat-cell *matCellDef="let element"> {{element.purchase_type=="1" ? element.purchase_qty : ''}} </td>
<td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
@ -86,7 +87,7 @@
</div>
</mat-card-content>
<ng-template #notAvilable>
<strong>Purchase Item is Not Available.. </strong>
<!-- <strong>Purchase Item is Not Available.. </strong> -->
</ng-template>
</mat-card>
<notifier-container></notifier-container>

View File

@ -88,7 +88,7 @@ getTotalCost(getItems:any) {
// do check component bases
ngDoCheck() {
if(this.masterData.grossProfitTypeList.length>0){
this.activateMariginCalculation = this.masterData.grossProfitTypeList[this.masterData.grossProfitTypeList.length-1].mode==1 ? true : false;
this.activateMariginCalculation = this.masterData.grossProfitTypeList[this.masterData.grossProfitTypeList.length-1].mode==1 && this.masterData.grossProfitTypeList[this.masterData.grossProfitTypeList.length-1].purchase_type==1 ? true : false;
}
this.purchaseItemSource.data = this.parentData;
}

View File

@ -10,11 +10,11 @@
<mat-hint align="start" style="font-size:90%" *ngIf="salesCalculationForm.value.sales_declared_by_customer != ''">{{"&#8377;"}} {{salesCalculationForm.value.sales_declared_by_customer | numberToWords}} Only</mat-hint>
</mat-form-field>
<!-- {{salesCalculationForm.value.sales_declared_by_customer}} -->
<mat-form-field style="width: 40%" *ngIf="activateMariginCalculation">
<input matInput OnlyNumber type="text" placeholder="Margin Percentage %" formControlName="margin_per" (keyup)="salesCalculation(salesCalculationForm.value)" required>
<mat-form-field style="width: 40%" *ngIf="activateMariginCalculation">
<input matInput OnlyNumber type="text" placeholder="Net Margin %" formControlName="margin_per" (keyup)="salesCalculation(salesCalculationForm.value)" required>
</mat-form-field>
<mat-form-field style="width: 41%" *ngIf="activateMariginCalculation">
<input matInput OnlyNumber type="text" placeholder="Margin Value" formControlName="margin_value" readonly>
<input matInput OnlyNumber type="text" placeholder="Net Profit Value" formControlName="margin_value" readonly>
<mat-hint align="start" style="font-size:90%" *ngIf="salesCalculationForm.value.margin_value != ''">{{"&#8377;"}} {{salesCalculationForm.value.margin_value | numberToWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width: 85%">

View File

@ -28,8 +28,8 @@ export class SalesCalculationComponent implements OnInit, OnChanges, DoCheck {
salesCalculation(values): void {
if(values.margin_per !='' && values.sales_declared_by_customer !='')
{
this.salesCalculationForm.controls['margin_value'].setValue(values.sales_declared_by_customer * (values.margin_per/100));
let caculatedVal = values.sales_declared_by_customer * (values.margin_per/100)
this.salesCalculationForm.controls['margin_value'].setValue(caculatedVal.toFixed(2));
}
}
// save sales calculations details

View File

@ -5,7 +5,7 @@
<mat-card-content>
<div fxLayout="row nowrap">
<div fxFlex="60" align="left">
<span>Sales Calculate Item Wise</span>
<span>Item-wise Sales Calculation</span>
</div>
<div fxFlex="40" align="right">
<button type="button" mat-flat-button (click)="addMoreItem()"
@ -19,7 +19,7 @@
<ng-container matColumnDef="product_services" sticky>
<th mat-header-cell *matHeaderCellDef> Product/Services </th>
<td mat-cell *matCellDef="let element"> {{element.sales_item}} </td>
<td mat-cell *matCellDef="let element"> {{element.sales_item == 'Others' ? element.sales_item + ' ( ' + element.other_sales_item + ' )' : element.sales_item }} </td>
<td mat-footer-cell *matFooterCellDef> Total of Sales </td>
</ng-container>

View File

@ -71,7 +71,7 @@
</div>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:45%">
<input matInput placeholder="Area Covered" formControlName="area_covered_by_this_property"
<input matInput placeholder="Area Covered" formControlName="area_covered_by_this_property" OnlyNumber type="text"
autocomplete="off">
</mat-form-field>
<mat-form-field style="width:45%">
@ -294,7 +294,7 @@
<!--Desction Dynamic details : END -->
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 4 || sup.get('assets_mode').value == 5"
style="width:45%">
style="width:45%; height: 105px !important;">
<input matInput placeholder="Approximate Market Value" formControlName="approximate_market_value"
OnlyNumber type="text" autocomplete="off">
<mat-hint align="start" style="font-size:90%" *ngIf="sup.get('approximate_market_value').value != ''">{{"&#8377;"}} {{sup.get('approximate_market_value').value | numberToWords}} Only</mat-hint>

View File

@ -17,10 +17,12 @@
.matcard mat-form-field {
margin: 0 2%;
height: 105px !important;
}
mat-form-field {
margin: 0 2%;
height: 105px !important;
}
$base-card-box-shadow:1.5px 2.6px 24px 0 rgba(0, 35, 136, 0.08) !important;

View File

@ -1510,9 +1510,10 @@
</div>
<mat-form-field style="width:62%">
<input matInput placeholder="Approximate total monthly salary paid to employees"
formControlName="employees_appx_salary"
required type="number">
<mat-hint align="start" style="font-size:90%" *ngIf="businessForm.controls['employees_appx_salary'].value != ''">{{"&#8377;"}} {{businessForm.controls['employees_appx_salary'].value | numberToWords}} Only</mat-hint>
formControlName="employees_appx_salary" required type="number">
<mat-hint align="start" style="font-size:90%" *ngIf="businessForm.controls['employees_appx_salary'].value != ''">{{"&#8377;"}}
{{businessForm.controls['employees_appx_salary'].value | numberToWords}}
Only</mat-hint>
<!-- <input matInput placeholder="Approximate total monthly salary paid to employees"
(keyup)="inWords($event,1)" formControlName="employees_appx_salary"

View File

@ -99,8 +99,8 @@
<mat-select placeholder="Payment Mode" formControlName="manufacturing_payment_mode">
<mat-option>Select</mat-option>
<mat-option value="Payment received in Cash.">Payment received in Cash.</mat-option>
<mat-option value="Payment received through Banking channels.">Payment
received through Banking channels.</mat-option>
<mat-option value="Payment received through Banking channels.">Payment received through Banking channels.</mat-option>
<mat-option value="Payment received in Cash and also through Banking channels.">Payment received in Cash and also through Banking channels.</mat-option>
</mat-select>
</mat-form-field>
@ -233,8 +233,8 @@
<mat-select placeholder="Payment Mode" formControlName="trade_product_payment_mode">
<mat-option>Select</mat-option>
<mat-option value="Payment received in Cash.">Payment received in Cash.</mat-option>
<mat-option value="Payment received through Banking channels.">Payment
received through Banking channels.</mat-option>
<mat-option value="Payment received through Banking channels.">Payment received through Banking channels.</mat-option>
<mat-option value="Payment received in Cash and also through Banking channels.">Payment received in Cash and also through Banking channels.</mat-option>
</mat-select>
</mat-form-field>
@ -366,8 +366,8 @@
<mat-select placeholder="Payment Mode" formControlName="service_provider_product_payment_mode">
<mat-option>Select</mat-option>
<mat-option value="Payment received in Cash.">Payment received in Cash.</mat-option>
<mat-option value="Payment received through Banking channels.">Payment
received through Banking channels.</mat-option>
<mat-option value="Payment received through Banking channels.">Payment received through Banking channels.</mat-option>
<mat-option value="Payment received in Cash and also through Banking channels.">Payment received in Cash and also through Banking channels.</mat-option>
</mat-select>
</mat-form-field>

View File

@ -60,7 +60,7 @@
<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%; height:105px;">
<input matInput autocomplete="off" placeholder="Loan Amount"
formControlName="loan_amount" OnlyNumber type="text">
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('loan_amount').value != ''">{{"&#8377;"}} {{details.get('loan_amount').value | numberToWords}} Only</mat-hint>

View File

@ -21,21 +21,26 @@
{{tl.name}}
</mat-option>
</mat-select>
<mat-error *ngIf="applicant.controls['applicant_title_name'].invalid">Title Required</mat-error>
</mat-form-field>
<mat-form-field style="width: 60%">
<input matInput placeholder="Name" formControlName="applicant_name" type="text" required>
<mat-error *ngIf="applicant.controls['applicant_name'].invalid">Name Required</mat-error>
</mat-form-field>
<mat-form-field style="width: 30%">
<input matInput placeholder="Age" formControlName="age" minlength="1" maxlength="3" OnlyNumber type="text"
autocomplete="off">
<mat-error *ngIf="applicant.controls['age'].invalid">Age Required</mat-error>
</mat-form-field>
<mat-form-field style="width: 60%">
<mat-select placeholder="Qualification" formControlName="qualification" style="width: 75%;">
<mat-option *ngFor="let qual of qualificationList" [value]="qual.qualification_id">{{qual.qualification_name}}</mat-option>
</mat-select>
<mat-error *ngIf="applicant.controls['qualification'].invalid">Qualification Required</mat-error>
</mat-form-field>
<mat-form-field style="width: 60%" [style.visibility]="applicant.get('qualification').value == '' || applicant.get('qualification').value == '4' || applicant.get('qualification').value == '6' ? 'hidden':'visible'">
<input matInput placeholder="Qualification Details" formControlName="course_name" autocomplete="off">
<mat-error *ngIf="applicant.controls['course_name'].invalid">Qualification Details Required</mat-error>
</mat-form-field>
<div fxLayout="row wrap">

View File

@ -93,7 +93,68 @@ export class OtherApplicantDetailsComponent implements OnInit {
}
// save applicant
temp: number = 0;
saveApplicant(formData: any) {
if (formData.applicant_list.length > 0) {
formData.applicant_list.forEach((val, index) => {
if (val.is_person_met == false && val.is_applicant == false) {
this.temp++;
}
});
if (this.temp == formData.applicant_list.length) {
// this.notifier.notify('warning', 'Please Choose Name of Person Met.!');
alert('Please Choose Name of Person Met (or) Name of Applicant .!');
this.temp = 0;
return;
}
let control = <FormArray>this._OtherForm.controls['applicant_list'];
let individualCtrlLength: any = control.controls.length;
if (individualCtrlLength > 0) {
let icnt = 0;
while (icnt < individualCtrlLength) {
let individualChildCtrl: any = control.controls[icnt];
individualChildCtrl.controls.age.clearValidators();
individualChildCtrl.controls.qualification.clearValidators();
individualChildCtrl.controls.course_name.clearValidators();
// if (individualChildCtrl.controls.is_person_met.value == false && individualChildCtrl.controls.is_applicant.value == false) {
// alert('Both the check boxes are empty at'+(icnt+1));
// return
// }
if (individualChildCtrl.controls.is_person_met.value == false && individualChildCtrl.controls.is_applicant.value == true) {
individualChildCtrl.controls.age.setValidators(Validators.compose([Validators.required]));
individualChildCtrl.controls.qualification.setValidators(Validators.compose([Validators.required]));
}
if (individualChildCtrl.controls.is_person_met.value == true && individualChildCtrl.controls.is_applicant.value == true) {
individualChildCtrl.controls.age.setValidators(Validators.compose([Validators.required]));
individualChildCtrl.controls.qualification.setValidators(Validators.compose([Validators.required]));
}
if(individualChildCtrl.controls.qualification.value == '' || individualChildCtrl.controls.qualification.value == '4' || individualChildCtrl.controls.qualification.value == '6')
{ individualChildCtrl.controls.course_name.setValue(''); individualChildCtrl.controls.course_name.clearValidators(); }
else{ individualChildCtrl.controls.course_name.setValidators(Validators.compose([Validators.required]));}
individualChildCtrl.controls.age.updateValueAndValidity();
individualChildCtrl.controls.qualification.updateValueAndValidity();
individualChildCtrl.controls.course_name.updateValueAndValidity();
icnt++;
}
}
}
if (this._OtherForm.invalid) {
this.validateAllFormFields(this._OtherForm);
return;

View File

@ -22,7 +22,7 @@
<mat-form-field style="width:22%">
<!-- <input matInput> -->
<mat-select placeholder="Name of Employer" formControlName="employer_name" required>
<mat-select placeholder="Name of Employer" formControlName="employer_name" (selectionChange)="checkWithExistYear($event.value)" required>
<mat-option>Select</mat-option>
<mat-option *ngFor="let cl of company_list" [value]="cl.company_order_id+'-'+cl.company_name">{{
cl.company_name }}</mat-option>
@ -38,21 +38,24 @@
<br>
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field>
<input matInput OnlyNumber type="text" autocomplete="off" placeholder="Year"
<input matInput OnlyNumber type="number" autocomplete="off" placeholder="Year"
formControlName="how_long_year" required min='0'>
<mat-error *ngIf="employmentForm.controls.how_long_year.hasError('max')">Higer than business vintage</mat-error>
</mat-form-field>
<mat-form-field>
<input matInput OnlyNumber type="text" autocomplete="off" placeholder="Month"
<input matInput OnlyNumber type="number" autocomplete="off" placeholder="Month"
formControlName="how_long_month" min='0' (change)="ConvertMonthintoYear($event.target.value)">
<mat-error *ngIf="employmentForm.controls.how_long_month.hasError('max')">Higer than business vintage</mat-error>
</mat-form-field>
<mat-form-field style="width: 22%">
<mat-form-field style="width: 30%">
<input matInput placeholder="Total Work Experience" formControlName="total_business_experience"
OnlyNumber autocomplete="off" (change)="checkWorkingExperiences()">
<mat-hint style="color: red;" *ngIf="employmentForm.controls['total_business_experience'].value !=undefined && this.workExperienceErrorFlag">
<!-- <mat-hint style="color: red;" *ngIf="employmentForm.controls['total_business_experience'].value !=undefined && this.workExperienceErrorFlag">
Total working Experience is Lower
</mat-hint>
</mat-hint> -->
<mat-error *ngIf="employmentForm.controls.total_business_experience.hasError('min')">Total working Experience is Lower</mat-error>
</mat-form-field>
<mat-form-field style="width: 34%" *ngIf="workExperienceFlag">
<mat-form-field style="width: 100%" *ngIf="workExperienceFlag">
<input matInput placeholder="Previous Work Experience Details" formControlName="total_business_previous_experience">
</mat-form-field>
@ -185,14 +188,18 @@
formControlName="net_take_home"> -->
</mat-form-field>
<mat-form-field style="width: 33%">
<input matInput placeholder="Amount paid in Cash"
formControlName="amount_paid_in_cash" OnlyNumber type="text" autocomplete="off">
<mat-hint align="start" style="font-size:90%" *ngIf="employmentForm.controls['amount_paid_in_cash'].value != ''">{{"&#8377;"}} {{employmentForm.controls['amount_paid_in_cash'].value | numberToWords}} Only</mat-hint>
<input matInput placeholder="Amount paid through Bank"
formControlName="amount_paid_through_bank" OnlyNumber type="text" autocomplete="off" (change)="ValidateNetSalary()">
<mat-hint align="start" style="font-size:90%" *ngIf="employmentForm.controls['amount_paid_through_bank'].value != ''">{{"&#8377;"}} {{employmentForm.controls['amount_paid_through_bank'].value | numberToWords}} Only</mat-hint>
<mat-error *ngIf="employmentForm.controls.amount_paid_through_bank.hasError('max')">Given Value is More than Net Salary</mat-error>
<mat-error *ngIf="employmentForm.controls.amount_paid_through_bank.hasError('min')">Given Value is Less than Net Salary</mat-error>
</mat-form-field>
<mat-form-field style="width: 33%">
<input matInput placeholder="Amount paid through Bank"
formControlName="amount_paid_through_bank" OnlyNumber type="text" autocomplete="off">
<mat-hint align="start" style="font-size:90%" *ngIf="employmentForm.controls['amount_paid_through_bank'].value != ''">{{"&#8377;"}} {{employmentForm.controls['amount_paid_through_bank'].value | numberToWords}} Only</mat-hint>
<input matInput placeholder="Amount paid in Cash"
formControlName="amount_paid_in_cash" OnlyNumber type="text" autocomplete="off" (change)="ValidateNetSalary()">
<mat-hint align="start" style="font-size:90%" *ngIf="employmentForm.controls['amount_paid_in_cash'].value != ''">{{"&#8377;"}} {{employmentForm.controls['amount_paid_in_cash'].value | numberToWords}} Only</mat-hint>
<mat-error *ngIf="employmentForm.controls.amount_paid_in_cash.hasError('max')">Given Value is More than Net Salary</mat-error>
<mat-error *ngIf="employmentForm.controls.amount_paid_in_cash.hasError('min')">Given Value is Less than Net Salary</mat-error>
</mat-form-field>
<mat-form-field style="width: 33%" *ngIf="employmentForm.controls['amount_paid_in_cash'].value != '' && employmentForm.controls['amount_paid_in_cash'].value != 0">
<mat-select placeholder="Is the Amount is Validated or Not" formControlName="check_validated">
@ -210,7 +217,7 @@
</mat-form-field>
<mat-form-field style="width: 33%">
<mat-select placeholder="Any Delays" formControlName="any_delays">
<mat-select placeholder="Is There Any Delay in Receiving the Salary" formControlName="any_delays">
<mat-option>Select</mat-option>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>

View File

@ -53,7 +53,8 @@ export class EmploymentInfoComponent implements OnInit {
public filtered_company_relationship_list: any[];
public dateonly: any = [{date:1,isdisabled:false},{date:2,isdisabled:false},{date:3,isdisabled:false},{date:4,isdisabled:false},{date:5,isdisabled:false},{date:6,isdisabled:false},{date:7,isdisabled:false},{date:8,isdisabled:false},{date:9,isdisabled:false},{date:10,isdisabled:false},{date:11,isdisabled:false},{date:12,isdisabled:false},{date:13,isdisabled:false},{date:14,isdisabled:false},{date:15,isdisabled:false},{date:16,isdisabled:false},{date:17,isdisabled:false},{date:18,isdisabled:false},{date:19,isdisabled:false},{date:20,isdisabled:false},{date:21,isdisabled:false},{date:22,isdisabled:false},{date:23,isdisabled:false},{date:24,isdisabled:false},{date:25,isdisabled:false},{date:26,isdisabled:false},{date:27,isdisabled:false},{date:28,isdisabled:false},{date:29,isdisabled:false},{date:30,isdisabled:false},{date:31,isdisabled:false}];
public todate: any[] = this.dateonly;
generalExistBusinessYear:any;
generalExistBusinessMonth:any;
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
@ -69,6 +70,8 @@ export class EmploymentInfoComponent implements OnInit {
this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id;
this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr;
this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr;
this.generalExistBusinessYear=100;
this.generalExistBusinessMonth=12;
}
@ -182,8 +185,8 @@ export class EmploymentInfoComponent implements OnInit {
this.employmentForm = this.fb.group({
employer_name: ['', Validators.compose([Validators.required])],
employer_in_brief: ['', Validators.compose([Validators.required])],
how_long_year: ['', Validators.compose([Validators.required])],
how_long_month: [''],
how_long_year: ['',Validators.compose([Validators.required,Validators.max(this.generalExistBusinessYear)])],
how_long_month: ['',Validators.compose([Validators.max(12)])],
total_business_experience: [''],
total_business_previous_experience: [''],
was_met: [this.pd_cus_segment == 'SAL-CHQ' ? 'no' : '', Validators.compose([Validators.required])],
@ -224,18 +227,115 @@ export class EmploymentInfoComponent implements OnInit {
}
}
checkWithExistYear(e) {
let data1 = this.company_list.filter(c => c.company_name == e.split('-')[1])[0];
// console.log('this.generalExistBusinessMonth',this.generalExistBusinessMonth);
// console.log('this.generalExistBusinessYear',this.generalExistBusinessYear);
if(data1.business_month != null && data1.business_month != '' && data1.business_month != undefined){
this.generalExistBusinessMonth = data1.business_month
}
if(data1.business_years){
this.generalExistBusinessYear = data1.business_years
}
this.employmentForm.controls['how_long_year'].setValidators(Validators.compose([Validators.max(this.generalExistBusinessYear)]));
this.employmentForm.controls['how_long_year'].updateValueAndValidity();
}
// ConvertMonthintoYear(e) {
// let how_long_year = this.employmentForm.controls.how_long_year.value;
// let converted_month: number = e % 12;
// let converted_year: number = e / 12;
// // if (how_long_year > this.generalExistBusinessYear) {
// // this.employmentForm.controls['how_long_year'].setValidators([Validators.max(this.generalExistBusinessYear)]);
// // this.employmentForm.controls['how_long_year'].updateValueAndValidity();
// // this.employmentForm.controls['how_long_year'].setValue('');
// // this.employmentForm.controls['how_long_month'].setValue('');
// // }
// // else {
// this.employmentForm.controls.how_long_year.setValue(+how_long_year + +Math.floor(converted_year));
// this.employmentForm.controls.how_long_month.setValue(Math.floor(converted_month));
// // }
// }
ConvertMonthintoYear(e) {
let how_long_year = this.employmentForm.controls.how_long_year.value;
this.employmentForm.controls['how_long_month'].clearValidators();
let converted_month: number = e % 12;
let converted_month: number = +e%12;
let converted_year: number = e / 12;
this.employmentForm.controls.how_long_year.setValue(+how_long_year + +Math.floor(converted_year));
this.employmentForm.controls.how_long_month.setValue(Math.floor(converted_month));
// console.log('e',e%12);
// console.log('e',e);
// console.log('e',e/12);
if (how_long_year > this.generalExistBusinessYear) {
this.employmentForm.controls['how_long_year'].setValidators(Validators.compose([Validators.max(this.generalExistBusinessYear)]));
this.employmentForm.controls['how_long_year'].setValue('');
this.employmentForm.controls['how_long_month'].setValue('');
}
else {
if (how_long_year == this.generalExistBusinessYear && +converted_month > this.generalExistBusinessMonth) {
this.employmentForm.controls['how_long_year'].setValidators(Validators.compose([Validators.max(this.generalExistBusinessYear)]));
this.employmentForm.controls['how_long_month'].setValidators(Validators.compose([Validators.max(this.generalExistBusinessMonth)]));
} else {
this.employmentForm.controls.how_long_year.setValue(+how_long_year + +Math.floor(converted_year));
this.employmentForm.controls.how_long_month.setValue(Math.floor(converted_month));
}
}
this.employmentForm.controls['how_long_year'].updateValueAndValidity();
this.employmentForm.controls['how_long_month'].updateValueAndValidity();
}
ValidateNetSalary(){
let salary = this.employmentForm.controls['net_monthly_salary'].value;
// console.log('this.employmentForm.controls[amount_paid_in_cash].value',this.employmentForm.controls['amount_paid_in_cash'].value);
if(salary != ''){
// let cash_amount = this.employmentForm.controls['amount_paid_in_cash'].value;
let bank_amount = this.employmentForm.controls['amount_paid_through_bank'].value;
this.employmentForm.controls['amount_paid_through_bank'].setValidators([Validators.max(salary),Validators.min(0)]);
this.employmentForm.controls['amount_paid_through_bank'].updateValueAndValidity();
let Remainamt = salary-bank_amount
if(Remainamt >= 0 ){
this.employmentForm.controls['amount_paid_in_cash'].setValue(Remainamt);
this.employmentForm.controls['amount_paid_in_cash'].setValidators([Validators.max(salary-bank_amount),Validators.min(salary-bank_amount)]);
}
else{
this.employmentForm.controls['amount_paid_in_cash'].setValue('0');
this.employmentForm.controls['amount_paid_in_cash'].setValidators([Validators.max(0),Validators.min(0)]);
}
this.employmentForm.controls['amount_paid_in_cash'].updateValueAndValidity();
}
else{
// this.toast.pdTriggerappmessage('Net Monthly Salary Is Empty.!');
this.notifier.notify('warning', 'Net Monthly Salary Is Empty.!');
this.employmentForm.controls['amount_paid_in_cash'].setValue('');
// this.employmentForm.controls['amount_paid_in_cash'].clearValidators();
this.employmentForm.controls['amount_paid_in_cash'].updateValueAndValidity();
this.employmentForm.controls['amount_paid_through_bank'].setValue('');
// this.employmentForm.controls['amount_paid_through_bank'].clearValidators();
this.employmentForm.controls['amount_paid_through_bank'].updateValueAndValidity();
return;
}
}
submitDetails() {
if(this.pd_cus_segment != 'SAL-CHQ'){
if(this.employmentForm.controls.was_met.value == 'no'){
@ -327,7 +427,7 @@ export class EmploymentInfoComponent implements OnInit {
if (!this.employmentForm.valid) {
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
this.notifier.notify('warning', 'Please Fill/Correct All Mandatory Fields.!');
return;
}
@ -397,20 +497,37 @@ export class EmploymentInfoComponent implements OnInit {
})
}
/** On Key Press Event For Numbers */
// checkWorkingExperiences(){
// // this.workExperienceErrorFlag = (+this.employmentForm.controls.total_business_experience.value ) <= (+this.employmentForm.controls.how_long_year.value) ? true : false;
// // this.workExperienceFlag = (+this.employmentForm.controls.total_business_experience.value ) < (+this.employmentForm.controls.how_long_year.value) ? false : true;
// if((+this.employmentForm.controls.total_business_experience.value ) < (+this.employmentForm.controls.how_long_year.value)){
// console.log(+this.employmentForm.controls.total_business_experience.value , +this.employmentForm.controls.how_long_year.value);
// this.workExperienceFlag = false;
// this.workExperienceErrorFlag = true;
// }
// else{
// this.workExperienceFlag = true;
// this.workExperienceErrorFlag = false;
// }
// }
checkWorkingExperiences(){
// this.workExperienceErrorFlag = (+this.employmentForm.controls.total_business_experience.value ) <= (+this.employmentForm.controls.how_long_year.value) ? true : false;
// this.workExperienceFlag = (+this.employmentForm.controls.total_business_experience.value ) < (+this.employmentForm.controls.how_long_year.value) ? false : true;
if((+this.employmentForm.controls.total_business_experience.value ) < (+this.employmentForm.controls.how_long_year.value)){
console.log(+this.employmentForm.controls.total_business_experience.value , +this.employmentForm.controls.how_long_year.value);
this.workExperienceFlag = false;
this.workExperienceErrorFlag = true;
this.employmentForm.controls['total_business_experience'].setValidators([Validators.min(+this.employmentForm.controls.how_long_year.value)]);
this.employmentForm.controls['total_business_experience'].updateValueAndValidity();
this.workExperienceFlag = +this.employmentForm.controls.total_business_experience.value > +this.employmentForm.controls.how_long_year.value ? true : false;
if(!this.workExperienceFlag){
this.employmentForm.controls['total_business_previous_experience'].setValue('');
this.employmentForm.controls['total_business_previous_experience'].updateValueAndValidity();
}
else{
this.workExperienceFlag = true;
this.workExperienceErrorFlag = false;
}
}
}
// keyPress(event: any) {
// const pattern = /[0-9]/;

View File

@ -81,8 +81,8 @@
<input matInput placeholder="Pin" formControlName="residence_pin" required>
</mat-form-field> -->
<mat-form-field>
<input matInput placeholder="Number of yrs" formControlName="residence_No_of_years"
<mat-form-field style="width:45%;">
<input matInput placeholder="No of years in current residence" formControlName="residence_No_of_years"
OnlyNumber type="text" required>
</mat-form-field>
@ -165,7 +165,7 @@
<input matInput placeholder="Specify Others"
formControlName="earning_if_others_segment">
</mat-form-field>
<mat-form-field style="width:45%;">
<mat-form-field style="width:45%;height: 105px !important;">
<input matInput placeholder="Income Per Month"
formControlName="earning_gross_income_per_month"
OnlyNumber type="text">

View File

@ -64,7 +64,7 @@ export class FamilyDetailsComponent implements OnInit {
this.form_id = 6;
this.notifier = notifier;
this.selectPerson = this.pd_all_details.pdapplicants_detials;
this.selectPerson = this.pd_all_details.pdapplicants_detials.filter(item => item.applicant_type != '2');
this.parent_pdid = this.pd_all_details.pdmaster_details.parent_pd_id;
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant;
@ -83,8 +83,6 @@ export class FamilyDetailsComponent implements OnInit {
this.getMasterDetails('STATE', 6);
this._pd.getFamilyDetails(this.pdid).subscribe(data => {
console.clear();
if (data.dataStatus == true) {
let Temparr: any = [];

View File

@ -35,13 +35,13 @@
<div *ngIf="isDisplay">
<mat-form-field style="width:37%">
<mat-label>Enter year from which financials provided</mat-label>
<input matInput autocomplete="off" placeholder="YYYY eg.2018" formControlName="financial_starting_year"
<input matInput autocomplete="off" placeholder="YYYY eg.2018" formControlName="financial_starting_year" (change)="dynamicalFinYear()"
OnlyNumber type="text" [readonly]="isReadOnly">
<mat-error> Invalid year format</mat-error>
<mat-error *ngIf="financialForm.controls['financial_starting_year'].hasError('minlength')"> Invalid year format</mat-error>
</mat-form-field>
<mat-form-field style="width:25%">
<input matInput autocomplete="off" placeholder="Number of Financial Years"
formControlName="financial_no_of_year" (change)="dynamicalFinYear($event)"
formControlName="financial_no_of_year" (change)="dynamicalFinYear()"
OnlyNumber type="text" [readonly]="isReadOnly">
</mat-form-field>
</div>
@ -56,15 +56,12 @@
<br>
<mat-form-field style="width:30%">
<input matInput autocomplete="off" placeholder="Annual Sale"
formControlName="financial_annual_sale" (change)="calculationForFinanicalStatement()"
OnlyNumber type="text">
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('financial_annual_sale').value != ''">{{"&#8377;"}} {{details.get('financial_annual_sale').value | numberToWords}} Only</mat-hint>
<!-- <input matInput autocomplete="off" placeholder="Annual Sale"
formControlName="financial_annual_sale" (change)="calculationForFinanicalStatement()"
OnlyNumber type="text" (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> -->
OnlyNumber type="text">
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('financial_annual_sale').value != ''">{{"&#8377;"}}
{{details.get('financial_annual_sale').value | numberToWords}}
Only</mat-hint>
</mat-form-field>
<span *ngIf="i != 0">
<mat-form-field style="width:60%">
@ -114,36 +111,30 @@
<span *ngIf="details.get('finanical_profit_or_loss').value == 1 ">
<mat-form-field style="width:28%">
<input matInput autocomplete="off" placeholder="Net Profit Amount"
formControlName="financial_net_profit" (change)="calculationForFinanicalStatement()"
OnlyNumber type="text">
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('financial_net_profit').value != ''">{{"&#8377;"}} {{details.get('financial_net_profit').value | numberToWords}} Only</mat-hint>
<!-- <input matInput autocomplete="off" placeholder="Net Profit Amount"
formControlName="financial_net_profit" (change)="calculationForFinanicalStatement()"
OnlyNumber type="text" (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> -->
OnlyNumber type="text">
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('financial_net_profit').value != ''">{{"&#8377;"}}
{{details.get('financial_net_profit').value |
numberToWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width:28%">
<input matInput autocomplete="off" placeholder="Net Profit to Sales in %"
formControlName="financial_margin_of_profit" OnlyNumber type="text"
readonly>
formControlName="financial_margin_of_profit" OnlyNumber
type="text" readonly>
</mat-form-field>
</span>
<span *ngIf="details.get('finanical_profit_or_loss').value == 2 ">
<mat-form-field style="width:28%">
<input matInput autocomplete="off" placeholder="Net Loss Amount"
formControlName="financial_net_loss" (change)="calculationForFinanicalStatement()"
OnlyNumber type="text">
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('financial_net_loss').value != ''">{{"&#8377;"}} {{details.get('financial_net_loss').value | numberToWords}} Only</mat-hint>
<!-- <input matInput autocomplete="off" placeholder="Net Loss Amount"
<input matInput autocomplete="off" placeholder="Net Loss Amount"
formControlName="financial_net_loss" (change)="calculationForFinanicalStatement()"
OnlyNumber type="text" (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> -->
OnlyNumber type="text">
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('financial_net_loss').value != ''">{{"&#8377;"}}
{{details.get('financial_net_loss').value | numberToWords}}
Only</mat-hint>
</mat-form-field>
<mat-form-field style="width:28%">
<input matInput autocomplete="off" placeholder="Net Loss to Sales in %"
@ -190,13 +181,14 @@
</mat-form-field>
<mat-form-field style="width:45%">
<input matInput autocomplete="off" [ngClass]="details.get('financial_profit_to_sale_variation').value > 0 ? 'greenhighlight' : 'highlight'"
placeholder="Variation of Profit/Loss to Sales % from Previous Year" formControlName="financial_profit_to_sale_variation"
OnlyNumber type="text" readonly>
placeholder="Variation of Profit/Loss to Sales % from Previous Year"
formControlName="financial_profit_to_sale_variation" OnlyNumber
type="text" readonly>
<mat-hint align="start" style="font-size:70%" *ngIf="i != 0 && details.get('financial_profit_to_sale_variation').value != '' ">
<span *ngIf="details.get('financial_profit_to_sale_variation').value == 0">
No difference in Profit/Loss to sales % in FY <i>
{{details.get('financial_year').value}} </i> over
Profit/Loss to sales % in FY <i>
Profit/Loss to sales % in FY <i>
{{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}}
</i>
</span>
@ -204,7 +196,7 @@
class="greenhighlight">
Increase in Profit/Loss to sales % in FY <i>
{{details.get('financial_year').value}} </i> over
Profit/Loss to sales % in FY <i>
Profit/Loss to 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}}
@ -214,7 +206,7 @@
class="highlight">
Decrease in Profit/Loss to sales % in FY <i>
{{details.get('financial_year').value}} </i> over
Profit/Loss to sales % in FY <i>
Profit/Loss to 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('-',
@ -258,9 +250,11 @@
<mat-form-field style="width:25%">
<input matInput autocomplete="off" placeholder="Annual Sales From"
formControlName="estimate_sales_from" (change)="calculateSalesAverage(i, details);"
OnlyNumber type="text">
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('estimate_sales_from').value != ''">{{"&#8377;"}} {{details.get('estimate_sales_from').value | numberToWords}} Only</mat-hint>
formControlName="estimate_sales_from" (change)="calculateSalesAverage(i, details);"
OnlyNumber type="text">
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('estimate_sales_from').value != ''">{{"&#8377;"}}
{{details.get('estimate_sales_from').value | numberToWords}}
Only</mat-hint>
<!-- <input matInput autocomplete="off" placeholder="Annual Sales From"
formControlName="estimate_sales_from" (change)="calculateSalesAverage(i, details);"
@ -271,9 +265,10 @@
<mat-form-field style="width:25%">
<input matInput autocomplete="off" placeholder="Annual Sales To"
formControlName="estimate_sales_to" (change)="confirmAlert(i, details);"
OnlyNumber type="text">
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('estimate_sales_to').value != ''">{{"&#8377;"}} {{details.get('estimate_sales_to').value | numberToWords}} Only</mat-hint>
formControlName="estimate_sales_to" (change)="confirmAlert(i, details);"
OnlyNumber type="text">
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('estimate_sales_to').value != ''">{{"&#8377;"}}
{{details.get('estimate_sales_to').value | numberToWords}} Only</mat-hint>
<!-- <input matInput autocomplete="off" placeholder="Annual Sales To"
formControlName="estimate_sales_to" (change)="confirmAlert(i, details);"
@ -283,8 +278,10 @@
</mat-form-field>
<mat-form-field style="width:25%">
<input matInput autocomplete="off" placeholder="Considered Sales Average"
formControlName="estimate_sales_average" readonly>
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('estimate_sales_average').value != ''">{{"&#8377;"}} {{details.get('estimate_sales_average').value | numberToWords}} Only</mat-hint>
formControlName="estimate_sales_average" readonly>
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('estimate_sales_average').value != ''">{{"&#8377;"}}
{{details.get('estimate_sales_average').value | numberToWords}}
Only</mat-hint>
<!-- <input matInput autocomplete="off" placeholder="Considered Sales Average"
formControlName="estimate_sales_average" readonly>
@ -310,8 +307,8 @@
<div style="width:100%" *ngIf="details.get('estimate_profit_or_loss').value == 1 && details.get('estimate_net_margin_availablity').value == 'yes' ">
<mat-form-field style="width:25%">
<input matInput autocomplete="off" placeholder="Net Profit % From"
formControlName="estimate_profit_range_from" OnlyNumber type="text"
min='0' max='100' (change)="calculateMarginProfit( i, details);">
formControlName="estimate_profit_range_from" OnlyNumber
type="text" min='0' max='100' (change)="calculateMarginProfit( i, details);">
</mat-form-field>
<mat-form-field style="width:25%">
<input matInput autocomplete="off" placeholder="Net Profit % To"
@ -320,14 +317,16 @@
</mat-form-field>
<mat-form-field style="width:25%">
<input matInput autocomplete="off" placeholder="Net Profit % Considered"
formControlName="estimate_profit_margin_percent" OnlyNumber type="text"
readonly>
formControlName="estimate_profit_margin_percent" OnlyNumber
type="text" readonly>
<!-- <mat-hint align="start" style="font-size:70%" *ngIf="details.get('estimate_profit_margin').value != ''"> {{"&#8377;"}} {{AV_marginProfitAmtInwords[i]}} Only ( {{"&#8377;"}} {{details.get('estimate_profit_margin').value}} ) </mat-hint> -->
</mat-form-field>
<mat-form-field style="width:25%">
<input matInput placeholder="Net Profit Amount Considered"
formControlName="estimate_profit_margin" readonly>
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('estimate_profit_margin').value != ''">{{"&#8377;"}} {{details.get('estimate_profit_margin').value | numberToWords}} Only</mat-hint>
formControlName="estimate_profit_margin" readonly>
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('estimate_profit_margin').value != ''">{{"&#8377;"}}
{{details.get('estimate_profit_margin').value |
numberToWords}} Only</mat-hint>
<!-- <input matInput placeholder="Net Profit Amount Considered"
formControlName="estimate_profit_margin" readonly>
@ -339,9 +338,11 @@
<div style="width:100%" *ngIf="details.get('estimate_profit_or_loss').value == 1 && details.get('estimate_net_margin_availablity').value == 'no' ">
<mat-form-field style="width:25%">
<input matInput autocomplete="off" placeholder="Net Profit Amount From"
formControlName="estimate_net_profit_from" OnlyNumber type="text"
(change)="calculateProfitAmount(i, details);">
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('estimate_net_profit_from').value != ''">{{"&#8377;"}} {{details.get('estimate_net_profit_from').value | numberToWords}} Only</mat-hint>
formControlName="estimate_net_profit_from" OnlyNumber type="text"
(change)="calculateProfitAmount(i, details);">
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('estimate_net_profit_from').value != ''">{{"&#8377;"}}
{{details.get('estimate_net_profit_from').value |
numberToWords}} Only</mat-hint>
<!-- <input matInput autocomplete="off" placeholder="Net Profit Amount From"
formControlName="estimate_net_profit_from" OnlyNumber type="text"
@ -351,9 +352,11 @@
</mat-form-field>
<mat-form-field style="width:25%">
<input matInput autocomplete="off" placeholder="Net Profit Amount To"
formControlName="estimate_net_profit_to" OnlyNumber type="text"
(change)="calculateProfitAmount(i, details);">
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('estimate_net_profit_to').value != ''">{{"&#8377;"}} {{details.get('estimate_net_profit_to').value | numberToWords}} Only</mat-hint>
formControlName="estimate_net_profit_to" OnlyNumber type="text"
(change)="calculateProfitAmount(i, details);">
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('estimate_net_profit_to').value != ''">{{"&#8377;"}}
{{details.get('estimate_net_profit_to').value |
numberToWords}} Only</mat-hint>
<!-- <input matInput autocomplete="off" placeholder="Net Profit Amount To"
formControlName="estimate_net_profit_to" OnlyNumber type="text"
@ -367,8 +370,10 @@
</mat-form-field>
<mat-form-field style="width:25%">
<input matInput placeholder="Considered Profit Amount"
formControlName="estimate_net_profit" readonly>
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('estimate_net_profit').value != ''">{{"&#8377;"}} {{details.get('estimate_net_profit').value | numberToWords}} Only</mat-hint>
formControlName="estimate_net_profit" readonly>
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('estimate_net_profit').value != ''">{{"&#8377;"}}
{{details.get('estimate_net_profit').value |
numberToWords}} Only</mat-hint>
<!-- <input matInput autocomplete="off" placeholder="Considered Profit Amount"
formControlName="estimate_net_profit" OnlyNumber type="text"
@ -390,13 +395,15 @@
</mat-form-field>
<mat-form-field style="width:25%">
<input matInput autocomplete="off" placeholder="Net Loss % Considered"
formControlName="estimate_loss_margin_percent" OnlyNumber type="text"
readonly>
formControlName="estimate_loss_margin_percent" OnlyNumber
type="text" readonly>
</mat-form-field>
<mat-form-field style="width:25%">
<input matInput placeholder="Net Loss Amount Considered"
formControlName="estimate_loss_margin" readonly>
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('estimate_loss_margin').value != ''">{{"&#8377;"}} {{details.get('estimate_loss_margin').value | numberToWords}} Only</mat-hint>
formControlName="estimate_loss_margin" readonly>
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('estimate_loss_margin').value != ''">{{"&#8377;"}}
{{details.get('estimate_loss_margin').value |
numberToWords}} Only</mat-hint>
<!-- <input matInput placeholder="Net Loss Amount Considered"
formControlName="estimate_loss_margin" readonly>
@ -406,38 +413,39 @@
</div>
<div style="width:100%" *ngIf="details.get('estimate_profit_or_loss').value == 2 && details.get('estimate_net_margin_availablity').value == 'no' ">
<mat-form-field style="width:25%">
<input matInput autocomplete="off" placeholder="Net Loss Amount From"
formControlName="estimate_net_loss_from" OnlyNumber type="text"
(change)="calculateLossAmount(i, details);">
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('financial_annual_sale').value != ''">{{"&#8377;"}} {{details.get('financial_annual_sale').value | numberToWords}} Only</mat-hint>
<input matInput autocomplete="off" placeholder="Net Loss Amount From"
formControlName="estimate_net_loss_from" OnlyNumber type="text"
(change)="calculateLossAmount(i, details);" (keyup)="inWords($event,i,9)">
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('estimate_net_loss_from').value != ''">{{"&#8377;"}}
{{AV_netLossAmtFrmInwords[i]}} Only </mat-hint>
(change)="calculateLossAmount(i, details);">
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('financial_annual_sale').value != ''">{{"&#8377;"}}
{{details.get('financial_annual_sale').value |
numberToWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width:25%">
<input matInput autocomplete="off" placeholder="Annual Sale"
formControlName="financial_annual_sale" (change)="calculationForFinanicalStatement()"
OnlyNumber type="text">
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('estimate_net_loss_to').value != ''">{{"&#8377;"}} {{details.get('estimate_net_loss_to').value | numberToWords}} Only</mat-hint>
<!-- <input matInput autocomplete="off" placeholder="Net Loss Amount To"
formControlName="estimate_net_loss_to" OnlyNumber type="text"
(change)="calculateLossAmount(i, details);" (keyup)="inWords($event,i,10)">
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('estimate_net_loss_to').value != ''">{{"&#8377;"}}
{{AV_netLossAmtToInwords[i]}} Only </mat-hint> -->
<mat-form-field style="width:25%">
<input matInput autocomplete="off" placeholder="Net Loss Amount To"
formControlName="estimate_net_loss_from" OnlyNumber type="text"
(change)="calculateLossAmount(i, details);">
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('estimate_net_loss_to').value != ''">{{"&#8377;"}}
{{details.get('estimate_net_loss_to').value |
numberToWords}} Only</mat-hint>
</mat-form-field>
<!-- <mat-form-field style="width:25%">
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('estimate_net_loss_to').value != ''">{{"&#8377;"}}
{{details.get('estimate_net_loss_to').value |
numberToWords}} Only</mat-hint>
</mat-form-field> -->
<mat-form-field style="width:25%">
<input matInput autocomplete="off" placeholder="Considered Net Loss %"
formControlName="estimate_net_loss_percent" readonly>
</mat-form-field>
<mat-form-field style="width:25%">
<input matInput autocomplete="off" placeholder="Considered Loss Amount"
formControlName="estimate_net_loss" OnlyNumber type="text">
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('estimate_net_loss').value != ''">{{"&#8377;"}} {{details.get('estimate_net_loss').value | numberToWords}} Only</mat-hint>
formControlName="estimate_net_loss" OnlyNumber type="text">
<mat-hint align="start" style="font-size:90%" *ngIf="details.get('estimate_net_loss').value != ''">{{"&#8377;"}}
{{details.get('estimate_net_loss').value | numberToWords}}
Only</mat-hint>
<!-- <input matInput autocomplete="off" placeholder="Considered Loss Amount"
formControlName="estimate_net_loss" OnlyNumber type="text" readonly>
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('estimate_net_loss').value != ''">{{"&#8377;"}}

View File

@ -48,6 +48,7 @@
mat-form-field {
margin: 0 2%;
height: 105px !important;
}
$base-card-box-shadow:1.5px 2.6px 24px 0 rgba(0, 35, 136, 0.08) !important;
$product-bg-color-hover: rgba(103, 58, 183, 0.7);

View File

@ -362,28 +362,32 @@ export class FinancialInfoComponent implements OnInit {
}
/** For Auto-generating FinYear */
dynamicalFinYear($event){
dynamicalFinYear(){
let e = $event.target.value;
if(e == 1){
this.customerCommentsFlag = false;
}
else{
this.customerCommentsFlag = true;
}
let no_of_year = this.financialForm.controls['financial_no_of_year'].value
let startingYear = this.financialForm.controls['financial_starting_year'].value;
if(no_of_year != null && no_of_year != ''){
const control = <FormArray>this.financialForm.controls['date_per_financial'];
if(no_of_year == 1){
this.customerCommentsFlag = false;
}
else{
this.customerCommentsFlag = true;
}
while (control.length !== 0) {
control.removeAt(0);
}
let startingYear = this.financialForm.controls['financial_starting_year'].value;
if(e > 0 ){
for(let i = 1 ; i<= e ; i++ ){
let Year = (+startingYear+(i-1)) +'-'+ ((+startingYear)+(+i));
control.push(this.createDate(Year));
const control = <FormArray>this.financialForm.controls['date_per_financial'];
while (control.length !== 0) {
control.removeAt(0);
}
if(no_of_year > 0 ){
for(let i = 1 ; i<= no_of_year ; i++ ){
let Year = (+startingYear+(i-1)) +'-'+ ((+startingYear)+(+i));
control.push(this.createDate(Year));
}
}
}
}

View File

@ -49,8 +49,13 @@
<ng-container matColumnDef="age">
<mat-header-cell *matHeaderCellDef> Age </mat-header-cell>
<mat-cell *matCellDef="let details;let i = index;" [formGroupName]="i">
<input matInput placeholder="Age" formControlName="age" minlength="1" maxlength="3"
OnlyNumber type="text" autocomplete="off">
<div class="example-container">
<input matInput placeholder="Age" formControlName="age" minlength="1" maxlength="3"
OnlyNumber type="text" autocomplete="off">
<mat-error style="font-size:65%" *ngIf="details.controls['age'].invalid">Age Required</mat-error>
<!-- <mat-error style="font-size:65%" *ngIf="_generalForm.controls.individuals.value[i].qualificationdetails.controls['age'].invalid">Age Required</mat-error> -->
<!-- <mat-error style="font-size:65%" *ngIf="details.controls['age'].hasError('required')">Age Required</mat-error> -->
</div>
</mat-cell>
</ng-container>
<ng-container matColumnDef="qualification">
@ -59,13 +64,17 @@
<mat-select placeholder="Qualification" formControlName="qualification" style="width: 75%;">
<mat-option *ngFor="let qual of qualificationList" [value]="qual.qualification_id">{{qual.qualification_name}}</mat-option>
</mat-select>
<mat-error style="font-size:65%" *ngIf="details.controls['qualification'].invalid">Qualification Required</mat-error>
</mat-cell>
</ng-container>
<ng-container matColumnDef="course_name">
<mat-header-cell *matHeaderCellDef> </mat-header-cell>
<mat-cell *matCellDef="let details;let i = index;" [formGroupName]="i" [style.visibility]="_generalForm.controls.individuals.value[i].qualification == '' || _generalForm.controls.individuals.value[i].qualification == '4' || _generalForm.controls.individuals.value[i].qualification == '6' ? 'hidden':'visible'">
<span class="example-container">
<input matInput placeholder="Qualification Details" formControlName="course_name"
autocomplete="off">
<mat-error style="font-size:65%" *ngIf="details.controls['course_name'].invalid">Qualification Details Required</mat-error>
</span>
</mat-cell>
</ng-container>
<ng-container matColumnDef="actions">
@ -103,7 +112,8 @@
<mat-form-field style="width: 20%;">
<input matInput placeholder="Year" formControlName="rental_income_rcv_in_years" autocomplete="off"
OnlyNumber type="text" required>
<mat-error>Please Enter Correct Year</mat-error>
<mat-error *ngIf="_generalForm.controls['rental_income_rcv_in_years'].invalid">Please Enter Correct Year</mat-error>
<!-- <mat-error>Please Enter Correct Year</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 20%;">
<input matInput type="text" placeholder="Month" formControlName="rental_income_rcv_in_month"
@ -132,18 +142,19 @@
(selectionChange)="checkEntityType(com.value.business_entity_type,c)" required>
<mat-option [value]="entity.business_entity_type_id" *ngFor="let entity of businessEntityTypeList">{{entity.business_entity_type_name}}</mat-option>
</mat-select>
<mat-error *ngIf="com.controls['business_entity_type'].invalid">Business Entity Type Required</mat-error>
</mat-form-field>
<mat-form-field style="width: 45%;" *ngIf="com.controls.business_entity_type_other">
<input matInput placeholder="Please Specify Others" formControlName="business_entity_type_other"
required>
<mat-error *ngIf="com.controls['business_entity_type_other'].invalid">Please Specify Others Required</mat-error>
</mat-form-field>
<p>Number of Years For Which The Business Has Been Running</p>
<mat-form-field style="width: 20%;">
<input matInput placeholder="Year" formControlName="business_years" autocomplete="off"
OnlyNumber type="text" required>
<mat-error>Please Enter Correct Year</mat-error>
<mat-error *ngIf="com.controls['business_years'].invalid">Please Enter Correct Year</mat-error>
</mat-form-field>
<mat-form-field style="width: 20%;">
<input matInput type="text" placeholder="Month" formControlName="business_month"

View File

@ -13,6 +13,15 @@
margin: 0 2%;
}
.example-container {
// display: flex;
flex-direction: column;
}
.example-container > * {
width: 100%;
}
mat-header-cell mat-cell {
display:flex;
justify-content:flex-end;

View File

@ -358,7 +358,7 @@ export class GeneralInfoComponent implements OnInit {
createCompanies(elementValue: any) {
return this._fb.group({
company_order_id: [elementValue.company_order_id],
company_name: [elementValue.company_name,],
company_name: [elementValue.company_name],
company_messrs_name: ['M/s'],
is_company_applicant: [elementValue.is_company_applicant],
business_entity_type: [elementValue.business_entity_type, Validators.required],
@ -603,27 +603,95 @@ export class GeneralInfoComponent implements OnInit {
// submit form details
temp: number = 0;
submitGeneralForm(formData: any) {
// console.log('formData',formData);
if (formData.individuals.length > 0) {
formData.individuals.forEach((val, index) => {
if (val.is_person_met == false) {
this.temp++;
}
});
if (this.temp == formData.individuals.length) {
this.notifier.notify('warning', 'Please Choose Name of Person Met.!');
this.temp = 0;
return;
}
let individualCtrl: any = this._generalForm.get('individuals') as FormArray;
let individualCtrlLength: any = individualCtrl.controls.length;
if (individualCtrlLength > 0) {
let icnt = 0;
while (icnt < individualCtrlLength) {
let individualChildCtrl: any = individualCtrl.controls[icnt];
individualChildCtrl.controls.age.clearValidators();
individualChildCtrl.controls.qualification.clearValidators();
individualChildCtrl.controls.course_name.clearValidators();
if (individualChildCtrl.controls.is_person_met.value == false && individualChildCtrl.controls.is_applicant.value == true) {
individualChildCtrl.controls.age.setValidators(Validators.compose([Validators.required]));
individualChildCtrl.controls.qualification.setValidators(Validators.compose([Validators.required]));
}
if (individualChildCtrl.controls.is_person_met.value == true && individualChildCtrl.controls.is_applicant.value == true) {
individualChildCtrl.controls.age.setValidators(Validators.compose([Validators.required]));
individualChildCtrl.controls.qualification.setValidators(Validators.compose([Validators.required]));
}
if(individualChildCtrl.controls.qualification.value == '' || individualChildCtrl.controls.qualification.value == '4' || individualChildCtrl.controls.qualification.value == '6')
{individualChildCtrl.controls.course_name.setValue(''); individualChildCtrl.controls.course_name.clearValidators();}else{ individualChildCtrl.controls.course_name.setValidators(Validators.compose([Validators.required]));}
individualChildCtrl.controls.age.updateValueAndValidity();
individualChildCtrl.controls.qualification.updateValueAndValidity();
individualChildCtrl.controls.course_name.updateValueAndValidity();
icnt++;
}
}
}
if (this.customer_segment_abbr != 'SE-RI') {
this._generalForm.controls['rental_income_rcv_in_years'].clearValidators();
this._generalForm.controls['rental_income_rcv_in_years'].updateValueAndValidity();
}
// 0th index of companies formArray only - required removed
// greater than zero means not applicable here
// SE-RI means Companies Control Required Removed.
if (this.customer_segment_abbr == 'SE-RI') {
let otherControl: any = this._generalForm.get('companies') as FormArray;
if (otherControl.controls.length > 0) {
otherControl = otherControl.controls[0];
// otherControl.controls.business_entity_type_other.clearValidators();
// otherControl.controls.business_entity_type_other.updateValueAndValidity();
let CompanyCtrl: any = this._generalForm.get('companies') as FormArray;
let CompanyCtrlLength: any = CompanyCtrl.controls.length;
if (CompanyCtrlLength > 0) {
let cnt = 0;
while (cnt < CompanyCtrlLength) {
otherControl.controls.business_years.clearValidators();
otherControl.controls.business_years.updateValueAndValidity();
let CompanyChildCtrl: any = CompanyCtrl.controls[cnt];
otherControl.controls.business_entity_type.clearValidators();
otherControl.controls.business_entity_type.updateValueAndValidity();
CompanyChildCtrl.controls.company_name.clearValidators();
CompanyChildCtrl.controls.company_name.updateValueAndValidity();
CompanyChildCtrl.controls.business_entity_type.clearValidators();
CompanyChildCtrl.controls.business_entity_type.updateValueAndValidity();
// CompanyChildCtrl.controls.business_entity_type_other.clearValidators();
// CompanyChildCtrl.controls.business_entity_type_other.updateValueAndValidity();
CompanyChildCtrl.controls.business_years.clearValidators();
CompanyChildCtrl.controls.business_years.updateValueAndValidity();
cnt++;
}
}
}
if (this._generalForm.invalid) {
this.disableAfterSubmit = false;
@ -632,25 +700,7 @@ export class GeneralInfoComponent implements OnInit {
return;
}
else {
if (formData.individuals.length > 0) {
formData.individuals.forEach((val, index) => {
if (val.is_person_met == false) {
this.temp++;
}
});
if (this.temp == formData.individuals.length) {
this.notifier.notify('warning', 'Please Choose Name of Person Met.!');
this.temp = 0;
return;
}
}
this.disableAfterSubmit = true;
let saveRecords: any = {}
saveRecords.parent_pdid = formData.parent_pdid;

View File

@ -38,7 +38,7 @@
</mat-form-field>
<mat-form-field style="width:64%">
<mat-select placeholder="Sub Product" formControlName="sub_product"
(selectionChange)="onChangeSubProduct($event.value)">
(selectionChange)="onChangeSubProduct($event)">
<mat-option>Select</mat-option>
<mat-option *ngFor="let list of m_endUseofLoad" [value]="list.subproduct_id">
{{list.name }} ( {{list.abbr}} ) </mat-option>

View File

@ -75,7 +75,8 @@ export class LoanDetailsComponent implements OnInit {
mergeCompanyApplicant: any = [];
existCompanyList: any = [];
companies: any = [];
typeofproperties:any = [];
generalFormApplicantList:any = [];
/** Constructor Of the Class */
constructor(notifier: NotifierService,
private fb: FormBuilder,
@ -84,7 +85,7 @@ export class LoanDetailsComponent implements OnInit {
private _pd: PdTrigerService,
private dialogRef: MatDialogRef<LoanDetailsComponent>,
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
console.log('this.pd_all_details.pdapplicants_detials',this.pd_all_details.pdapplicants_detials);
this.applicants = this.pd_all_details.pdapplicants_detials;
// this.applicants.push({'pd_co_applicant_id':'0','applicant_name':'Others'});
this.applicants = this.applicants.filter(appt => appt.applicant_type != 2)
@ -110,7 +111,6 @@ export class LoanDetailsComponent implements OnInit {
/** init Fns */
ngOnInit() {
this.initloanDetailsForm();
this.getM_EndUseofLoad();
this.getM_EndUseForLoan(this.pdid, this.pd_all_details.pdmaster_details.fk_subproduct_id);
@ -120,6 +120,11 @@ export class LoanDetailsComponent implements OnInit {
this.getM_BTLenderList();
this.getM_EndUseofTopUpList();
// note : Details of Property being Mortgaged section, In Name of the owner drop down list currently show all names (Applicants & In Person Met) need to change show Applicant names only.
let param: any = {};
param.pd_id = this.pdid;
param.pd_form_id = '18';
this._pd.getCompaniesListsForBusiness(this.pdid).subscribe(data => {
if (data.dataStatus) {
this.existCompanyList = data.records.filter(val => val.is_active === true && val.is_company_applicant === true);
@ -131,19 +136,29 @@ export class LoanDetailsComponent implements OnInit {
});
this.mergeCompanyApplicant.push({ groupName: 'COMPANIES', groupValues: modifyCompanyList })
}
this._pd.retriveForm(param).subscribe(data => {
this.generalFormApplicantList = data.records.individuals.filter(app => app.is_applicant == true && app.is_active == true);
if (data.dataStatus) {
let modifyApplicantList: any = [];
if (this.applicants.length > 0) {
modifyApplicantList = this.generalFormApplicantList.map(element => {
return { id: element.pd_co_applicant_id, name: element.applicant_name, group_id: 2 };
});
this.mergeCompanyApplicant.push({ groupName: 'APPLICANTS', groupValues: modifyApplicantList })
let modifyApplicantList: any = [];
if (this.applicants.length > 0) {
modifyApplicantList = this.applicants.map(element => {
return { id: element.pd_co_applicant_id, name: element.applicant_name, group_id: 2 };
});
this.mergeCompanyApplicant.push({ groupName: 'APPLICANTS', groupValues: modifyApplicantList })
// this.listOfLanguagues.splice(this.listOfLanguagues.indexOf(languague), 1);
}
if (this.productAbbr != 'LAP') {
this.mergeCompanyApplicant.push({ groupName: 'OTHERS', groupValues: [{ id: 0, name: 'Not Yet Finalised', group_id: 2 }] })
}
}
});
// this.listOfLanguagues.splice(this.listOfLanguagues.indexOf(languague), 1);
}
if (this.productAbbr != 'LAP') {
this.mergeCompanyApplicant.push({ groupName: 'OTHERS', groupValues: [{ id: 0, name: 'Not Yet Finalised', group_id: 2 }] })
}
})
@ -322,9 +337,10 @@ export class LoanDetailsComponent implements OnInit {
data => {
if (data.dataStatus == true) {
let that = this;
this.typeofproperties = data.records;
this.m_mortageTypeProperty = data.records.filter(
function (data) {
if (that.productAbbr != "LAP") {
if (data.group_name == that.productAbbr && data.isactive == 1) {
@ -337,14 +353,12 @@ export class LoanDetailsComponent implements OnInit {
return data;
}
else if (data.group_name == that.productAbbr && data.sub_group_name != null && data.isactive == 1) {
else if (data.group_name == that.productAbbr && data.sub_group_name == null && data.isactive == 1) {
return data;
}
}
});
this.m_mortageTypeProperty
}
});
}
@ -425,14 +439,32 @@ export class LoanDetailsComponent implements OnInit {
else {
return false;
}
}
onChangeSubProduct(e) {
this._pd.getEndUseForLoan(this.pdid, e).subscribe(
data => {
let splitted = e.source.triggerValue.split(" ( ", 2);
this._pd.getEndUseForLoan(this.pdid, e.value).subscribe(data => {
this.m_endUseForLoan = data.records.filter(data => data.isactive == 1);
});
});
if(this.mortageCardAccess == true) {
let that = this;
this.m_mortageTypeProperty = this.typeofproperties.filter(
function (data) {
if (that.productAbbr != "LAP") {
if (data.group_name == that.productAbbr && data.isactive == 1) {
return data;
}
}
else if (that.productAbbr == "LAP") {
if (data.group_name == that.productAbbr && data.sub_group_name == splitted[0] && data.isactive == 1) {
return data;
}
else if (data.group_name == that.productAbbr && (data.sub_group_name == null || data.sub_group_name == '') && data.isactive == 1) {
return data;
}
}
});
}
}
/** Enduse Changes And its Validation */
@ -560,22 +592,44 @@ export class LoanDetailsComponent implements OnInit {
}
/** Using Selected Mortage Type Set validation */
mortage_type(mortage_value) {
// mortage_type(mortage_value) {
//let mortagetypes = this.m_mortageTypeProperty.filter(mor=>mor.mortage_property_id==mortage_value)[0];
let mortagetypes = this.m_mortageTypeProperty.filter(mor => mor.mortage_property_id == mortage_value)[0];
// //let mortagetypes = this.m_mortageTypeProperty.filter(mor=>mor.mortage_property_id==mortage_value)[0];
// let mortagetypes = this.m_mortageTypeProperty.filter(mor => mor.mortage_property_id == mortage_value)[0];
if (mortagetypes.property_name == 'Others (Please Specify)') {
this.mortageAccess = true;
this.loanDetailsForm.controls['property_type_others'].setValidators([Validators.required]);
this.loanDetailsForm.controls['property_type_others'].updateValueAndValidity();
} else {
// if (mortagetypes.property_name == 'Others (Please Specify)') {
// this.mortageAccess = true;
// this.loanDetailsForm.controls['property_type_others'].setValidators([Validators.required]);
// this.loanDetailsForm.controls['property_type_others'].updateValueAndValidity();
// } else {
// this.mortageAccess = false;
// this.loanDetailsForm.controls['property_type_others'].setValue('');
// this.loanDetailsForm.controls['property_type_others'].clearValidators();
// this.loanDetailsForm.controls['property_type_others'].updateValueAndValidity();
// }
// }
mortage_type(mortage_value)
{
console.log('mortage_value',mortage_value);
console.log('this.m_mortageTypeProperty',this.m_mortageTypeProperty);
let mortagetypes = this.m_mortageTypeProperty.filter(mor => mor.mortage_property_id == mortage_value)[0];
let property_name = mortagetypes.property_name.replace(/\s/g, "").toLowerCase();
if(property_name=='others')
{
this.mortageAccess = true;
this.loanDetailsForm.controls['property_type_others'].setValidators([Validators.required]);
this.loanDetailsForm.controls['property_type_others'].updateValueAndValidity();
}else
{
this.mortageAccess = false;
this.loanDetailsForm.controls['property_type_others'].setValue('');
this.loanDetailsForm.controls['property_type_others'].clearValidators();
this.loanDetailsForm.controls['property_type_others'].updateValueAndValidity();
}
}
}
}
/** For Loan Calculation */
loanCalc() {

View File

@ -201,8 +201,8 @@ export class NeighbourHoodComponent implements OnInit {
return this._fb.group({
reference_name: [elementValue.reference_name],
mobile: [elementValue.mobile,Validators.compose([Validators.minLength(10),Validators.maxLength(10)])],
std_code: [stdcode,Validators.compose([Validators.minLength(2),Validators.maxLength(4)])],
landline: [landline,Validators.compose([Validators.minLength(6),Validators.maxLength(8)])],
std_code: [stdcode != null ? stdcode : '',Validators.compose([Validators.minLength(2),Validators.maxLength(4)])],
landline: [landline != null ? landline : '',Validators.compose([Validators.minLength(6),Validators.maxLength(8)])],
location:[elementValue.location],
relationship_with:[elementValue.relationship_with],
others: [elementValue.others],
@ -267,55 +267,56 @@ export class NeighbourHoodComponent implements OnInit {
// let resultMessage:string='';
// const referencecheckControl = <FormGroup>this._neighbourhoodForm.controls['referencecheck_list'];
const referencecheckControl = this._neighbourhoodForm.get('referencecheck_list') as FormControl;
// const referencecheckControl = this._neighbourhoodForm.get('referencecheck_list') as FormControl;
// let RefCtrlLength : any = referencecheckControl.controls.length;
const neighbourhoodControl : FormGroup = this._neighbourhoodForm.controls['neighbourhood_list'] as FormGroup;
let NbhdCtrlLength: any = neighbourhoodControl.controls.length;
if (NbhdCtrlLength > 0) {
let Ncnt = 0;
while(Ncnt < NbhdCtrlLength){
// const neighbourhoodControl : FormGroup = this._neighbourhoodForm.controls['neighbourhood_list'] as FormGroup;
// let NbhdCtrlLength: any = neighbourhoodControl.controls.length;
// if (NbhdCtrlLength > 0) {
// let Ncnt = 0;
// while(Ncnt < NbhdCtrlLength){
let nbhdChildCtrl : any = neighbourhoodControl.controls[Ncnt];
// let nbhdChildCtrl : any = neighbourhoodControl.controls[Ncnt];
nbhdChildCtrl.controls['neighbourhood_name'].setValidators([Validators.required]);
nbhdChildCtrl.controls['neighbourhood_name'].updateValueAndValidity();
// nbhdChildCtrl.controls['neighbourhood_name'].setValidators([Validators.required]);
// nbhdChildCtrl.controls['neighbourhood_name'].updateValueAndValidity();
nbhdChildCtrl.controls['do_know'].setValidators([Validators.required]);
nbhdChildCtrl.controls['do_know'].updateValueAndValidity();
// nbhdChildCtrl.controls['do_know'].setValidators([Validators.required]);
// nbhdChildCtrl.controls['do_know'].updateValueAndValidity();
if(nbhdChildCtrl.controls.did_not_know_the_business_operation.value == '' || nbhdChildCtrl.controls.did_not_know_the_business_operation.value == false){
// if(nbhdChildCtrl.controls.did_not_know_the_business_operation.value == '' || nbhdChildCtrl.controls.did_not_know_the_business_operation.value == false){
// nbhdChildCtrl.controls['how_long_do_know_in_month'].setValidators([Validators.required]);
// nbhdChildCtrl.controls['how_long_do_know_in_month'].updateValueAndValidity();
nbhdChildCtrl.controls['how_long_do_know_in_year'].setValidators([Validators.required]);
nbhdChildCtrl.controls['how_long_do_know_in_year'].updateValueAndValidity();
}
else if(nbhdChildCtrl.controls.did_not_know_the_business_operation.value == true){
// // nbhdChildCtrl.controls['how_long_do_know_in_month'].setValidators([Validators.required]);
// // nbhdChildCtrl.controls['how_long_do_know_in_month'].updateValueAndValidity();
// nbhdChildCtrl.controls['how_long_do_know_in_year'].setValidators([Validators.required]);
// nbhdChildCtrl.controls['how_long_do_know_in_year'].updateValueAndValidity();
// }
// else if(nbhdChildCtrl.controls.did_not_know_the_business_operation.value == true){
nbhdChildCtrl.controls['how_long_do_know_in_month'].setValue('');
// nbhdChildCtrl.controls['how_long_do_know_in_month'].clearValidators();
nbhdChildCtrl.controls['how_long_do_know_in_month'].updateValueAndValidity();
nbhdChildCtrl.controls['how_long_do_know_in_year'].setValue('');
nbhdChildCtrl.controls['how_long_do_know_in_year'].clearValidators();
nbhdChildCtrl.controls['how_long_do_know_in_year'].updateValueAndValidity();
}
// nbhdChildCtrl.controls['how_long_do_know_in_month'].setValue('');
// // nbhdChildCtrl.controls['how_long_do_know_in_month'].clearValidators();
// nbhdChildCtrl.controls['how_long_do_know_in_month'].updateValueAndValidity();
// nbhdChildCtrl.controls['how_long_do_know_in_year'].setValue('');
// nbhdChildCtrl.controls['how_long_do_know_in_year'].clearValidators();
// nbhdChildCtrl.controls['how_long_do_know_in_year'].updateValueAndValidity();
// }
if(nbhdChildCtrl.controls.did_not_know_the_owner.value == '' || nbhdChildCtrl.controls.did_not_know_the_owner.value == false){
nbhdChildCtrl.controls['organisation_owner'].setValidators([Validators.required]);
nbhdChildCtrl.controls['organisation_owner'].updateValueAndValidity();
}
else if(nbhdChildCtrl.controls.did_not_know_the_owner.value == true){
nbhdChildCtrl.controls['organisation_owner'].setValue('');
nbhdChildCtrl.controls['organisation_owner'].clearValidators();
nbhdChildCtrl.controls['organisation_owner'].updateValueAndValidity();
}
Ncnt++;
}
}
// if(nbhdChildCtrl.controls.did_not_know_the_owner.value == '' || nbhdChildCtrl.controls.did_not_know_the_owner.value == false){
// nbhdChildCtrl.controls['organisation_owner'].setValidators([Validators.required]);
// nbhdChildCtrl.controls['organisation_owner'].updateValueAndValidity();
// }
// else if(nbhdChildCtrl.controls.did_not_know_the_owner.value == true){
// nbhdChildCtrl.controls['organisation_owner'].setValue('');
// nbhdChildCtrl.controls['organisation_owner'].clearValidators();
// nbhdChildCtrl.controls['organisation_owner'].updateValueAndValidity();
// }
// Ncnt++;
// }
// }
this._neighbourhoodForm.controls.neighbourhood_status.setValidators([Validators.required]);
this._neighbourhoodForm.controls.neighbourhood_status.updateValueAndValidity();
this._neighbourhoodForm.controls.neighbour_reference_remark.setValidators([Validators.required]);
this._neighbourhoodForm.controls.neighbour_reference_remark.updateValueAndValidity();
// }
// if(formData.check_type==1){

View File

@ -317,7 +317,7 @@
<div fxLayout="row wrap">
<!-- start tenant/lessees -->
<mat-form-field style="width:46%" appearance="outline">
<mat-label>Name of the Tenant(s)/Lessees(s) of the Let out Property</mat-label>
<mat-label>Is Name of the Tenant(s)/Lessees(s) of the Let out Property Provided ?</mat-label>
<mat-select placeholder="" formControlName="tenant_lessees_options" (selectionChange)="generateTenantOptions(units.value,u)" required>
<mat-option value="1">Yes</mat-option>
<mat-option value="0">Name(s) not provided</mat-option>
@ -349,17 +349,24 @@
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:29%;" appearance="outline" *ngIf="units.controls['amount_received_bank']">
<mat-label>Amount Received in Bank</mat-label>
<input matInput OnlyNumber autocomplete="off" placeholder="" formControlName="amount_received_bank" (keyup)="ValidatedRentAmount(units.value,u,1)" required>
<mat-hint align="start" style="font-size:90%" *ngIf="units.value.amount_received_bank != ''">{{"&#8377;"}} {{units.value.amount_received_bank | numberToWords}} Only</mat-hint>
<mat-error *ngIf="units.controls['amount_received_bank'].hasError('max')">Given Value Is More Than Rent Amount</mat-error>
<mat-error *ngIf="units.controls['amount_received_bank'].hasError('min')">Given Value Is Less Than Rent Amount</mat-error>
</mat-form-field>
<mat-form-field style="width:29%;" appearance="outline" *ngIf="units.controls['amount_received_cash']">
<mat-label>Amount Received in Cash</mat-label>
<input matInput OnlyNumber autocomplete="off" placeholder="" formControlName="amount_received_cash" required>
<mat-hint align="start" style="font-size:90%" *ngIf="units.value.amount_received_cash != ''">{{"&#8377;"}} {{units.value.amount_received_cash | numberToWords}} Only</mat-hint>
<mat-error *ngIf="units.controls['amount_received_cash'].hasError('max')">Given Value Is More Than Rent Amount</mat-error>
<mat-error *ngIf="units.controls['amount_received_cash'].hasError('min')">Given Value Is Less Than Rent Amount</mat-error>
</mat-form-field>
<mat-form-field style="width:29%;" appearance="outline" *ngIf="units.controls['amount_received_bank']">
<mat-label>Amount Received in Bank</mat-label>
<input matInput OnlyNumber autocomplete="off" placeholder="" formControlName="amount_received_bank" required>
<mat-hint align="start" style="font-size:90%" *ngIf="units.value.amount_received_bank != ''">{{"&#8377;"}} {{units.value.amount_received_bank | numberToWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width:30%;" appearance="outline" *ngIf="units.controls['payment_received_reason']">
<mat-label>Reason for Receiving Multiple Payment Mode</mat-label>
<textarea matInput placeholder="" formControlName="payment_received_reason" required></textarea>
@ -580,34 +587,40 @@
<mat-form-field style="width:100%" appearance="outline" *ngIf="units.controls['payment_mode_per_met']">
<mat-label>Mode of Payment of Rent as Validated by PD Officer with Tenant / Lessee During Visit</mat-label>
<mat-select placeholder=""
formControlName="payment_mode_per_met" [compareWith]="compareSingleObjects" (selectionChange)="generatePaymentOptions(units.value,u,2)" required>
<mat-select placeholder="" formControlName="payment_mode_per_met" [compareWith]="compareSingleObjects" (selectionChange)="generatePaymentOptions(units.value,u,2)" required>
<mat-option *ngFor="let payment of paymentPaidOptions" [value]="payment">
{{payment.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:29%;" appearance="outline" *ngIf="units.controls['amount_received_bank_per_met']">
<mat-label>Amount Paid in Bank</mat-label>
<input matInput OnlyNumber autocomplete="off" placeholder="" formControlName="amount_received_bank_per_met" (keyup)="ValidatedRentAmount(units.value,u,2)" required>
<mat-hint align="start" style="font-size:90%" *ngIf="units.value.amount_received_bank_per_met != ''">{{"&#8377;"}} {{units.value.amount_received_bank_per_met | numberToWords}} Only</mat-hint>
<mat-error *ngIf="units.controls['amount_received_bank_per_met'].hasError('max')">Given Value Is More Than Rent Amount</mat-error>
<mat-error *ngIf="units.controls['amount_received_bank_per_met'].hasError('min')">Given Value Is Less Than Rent Amount</mat-error>
</mat-form-field>
<mat-form-field style="width:29%;" appearance="outline" *ngIf="units.controls['amount_received_cash_per_met']">
<mat-label>Amount Paid in Cash</mat-label>
<input matInput OnlyNumber autocomplete="off" placeholder="" formControlName="amount_received_cash_per_met" required>
<mat-hint align="start" style="font-size:90%" *ngIf="units.value.amount_received_cash_per_met != ''">{{"&#8377;"}} {{units.value.amount_received_cash_per_met | numberToWords}} Only</mat-hint>
<mat-error *ngIf="units.controls['amount_received_cash_per_met'].hasError('max')">Given Value Is More Than Rent Amount</mat-error>
<mat-error *ngIf="units.controls['amount_received_cash_per_met'].hasError('min')">Given Value Is Less Than Rent Amount</mat-error>
</mat-form-field>
<mat-form-field style="width:29%;" appearance="outline" *ngIf="units.controls['amount_received_bank_per_met']">
<mat-label>Amount Paid in Bank</mat-label>
<input matInput OnlyNumber autocomplete="off" placeholder="" formControlName="amount_received_bank_per_met" required>
<mat-hint align="start" style="font-size:90%" *ngIf="units.value.amount_received_bank_per_met != ''">{{"&#8377;"}} {{units.value.amount_received_bank_per_met | numberToWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width:30%;" appearance="outline" *ngIf="units.controls['payment_received_reason_per_met']">
<mat-label>Reason for Paid Multiple Payment Mode</mat-label>
<textarea matInput placeholder="" formControlName="payment_received_reason_per_met" required></textarea>
</mat-form-field>
<!-- start validate appplicant/agreement payment options -->
<mat-form-field style="width:100%" appearance="outline" *ngIf="(units.value.monthly_rent_amount>0 && units.value.paid_monthly_rent_per_met>0 && units.value.payment_mode!='' && units.value.payment_mode_per_met!='') && (units.value.monthly_rent_amount!=units.value.paid_monthly_rent_per_met || units.value.payment_mode.id!=units.value.payment_mode_per_met.id)">
<mat-label>What is the Reason for Difference in Rent Amount or Mode of Payment</mat-label>
<div *ngIf="units.controls['paid_monthly_rent_per_met'] && units.controls['payment_mode'] && units.controls['monthly_rent_amount'] && units.controls['payment_mode_per_met']">
<mat-form-field style="width:100%" appearance="outline" *ngIf="(units.value.monthly_rent_amount>0 && units.value.paid_monthly_rent_per_met>0 && units.value.payment_mode!='' && units.value.payment_mode_per_met!='') && (units.value.monthly_rent_amount!=units.value.paid_monthly_rent_per_met) || units.value.payment_mode_per_met.id != 2 "><!-- || units.value.payment_mode.id!=units.value.payment_mode_per_met.id -->
<mat-label>What is the Reason for Difference in Rent Amount</mat-label><!-- or Mode of Payment -->
<input matInput autocomplete="off" placeholder="" formControlName="payment_difference_per_met">
</mat-form-field>
</div>
<!-- end -->
<!-- end met payment -->

View File

@ -5,7 +5,8 @@ import { DatePipe } from '@angular/common';
import { Pipe, PipeTransform } from '@angular/core';
import { NotifierService } from 'angular-notifier';
import { PdTrigerService } from './../../../../../pd-service/pd-triger.service';
/**sweet alert */
import Swal from 'sweetalert2';
@Component({
selector: 'app-rental-verification',
templateUrl: './rental-verification.component.html',
@ -42,6 +43,8 @@ export class RentalVerificationComponent implements OnInit {
//floorList: any=[{id:1,name:"Ground Floor"},{id:1,name:"First Floor"},{id:1,name:"Second Floor"},{id:1,name:"Third Floor"}]
//unitMeasurementList: any=[{id:2,name:"Square Feet"},{id:3,name:"Square Yards"},{id:4,name:"Square Meters"},{id:5,name:"Acres"},{id:6,name:"Hectares"},{id:1,name:"Others (Please Specify)"}];
unitMeasurementList: any=[];
SwalButtonText: string;
SwalMessage: string;
public viewerOptions: any = {
navbar: false,
toolbar: {
@ -82,7 +85,7 @@ export class RentalVerificationComponent implements OnInit {
}
// set unit type list details
let resiDentialProperty = [{id:2,name:'Independent Flat',group_id:1},{id:3,name:'Independent Floor',group_id:1},
{id:4,name:'Independent Bungalow',group_id:1},{id:5,name:'Independent Row House',group_id:1},{id:6,name:'Multi Storey Building',group_id:1},{id:1,name:'Other (Please Specify)',group_id:1}];
{id:4,name:'Independent House',group_id:1},{id:5,name:'Independent Row House',group_id:1},{id:6,name:'Multi Storey Building',group_id:1},{id:1,name:'Other (Please Specify)',group_id:1}];
let commercialProperty = [{id:2,name:'Independent Office',group_id:2},{id:3,name:'Independent Shop',group_id:2},{id:4,name:'Warehouse/Godown',group_id:2},
{id:5,name:'Workshop',group_id:2},{id:6,name:'Independent Clinic',group_id:2},{id:7,name:'Multi Storey Building',group_id:2},{id:1,name:'Other (Please Specify)',group_id:2}];
@ -309,6 +312,26 @@ loadFormData(){
element.amount_received_cash ? control.controls[index].addControl('amount_received_cash', new FormControl('', Validators.required)) : control.controls[index].removeControl('amount_received_cash');
element.amount_received_bank ? control.controls[index].addControl('amount_received_bank', new FormControl('', Validators.required)) : control.controls[index].removeControl('amount_received_bank');
element.payment_received_reason ? control.controls[index].addControl('payment_received_reason', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_received_reason');
if(element.payment_mode){
let ChildCtrl : any = control.controls[index];
if(element.payment_mode.id == 1 && element.amount_received_cash){
ChildCtrl.controls['amount_received_cash'].setValidators([Validators.required,Validators.max(element.monthly_rent_amount),Validators.min(element.monthly_rent_amount)]);
ChildCtrl.controls['amount_received_cash'].updateValueAndValidity();
}
else if(element.payment_mode.id == 2 && element.amount_received_bank){
ChildCtrl.controls['amount_received_bank'].setValidators([Validators.required,Validators.max(element.monthly_rent_amount),Validators.min(element.monthly_rent_amount)]);
ChildCtrl.controls['amount_received_bank'].updateValueAndValidity();
}
else if(element.payment_mode.id == 3 && element.amount_received_bank && element.amount_received_cash){
this.ValidatedRentAmount(element,index,1);
}
}
// unit of other measurement
element.other_unit_measurement ? control.controls[index].addControl('other_unit_measurement', new FormControl('', Validators.required)) : control.controls[index].removeControl('other_unit_measurement');
@ -344,14 +367,36 @@ loadFormData(){
element.paid_monthly_rent_per_met ? control.controls[index].addControl('paid_monthly_rent_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('paid_monthly_rent_per_met');
element.period_of_stay_per_met ? control.controls[index].addControl('period_of_stay_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('period_of_stay_per_met');
element.payment_mode_per_met ? control.controls[index].addControl('payment_mode_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_mode_per_met');
element.amount_received_cash_per_met ? control.controls[index].addControl('amount_received_cash_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('amount_received_cash_per_met');
element.amount_received_bank_per_met ? control.controls[index].addControl('amount_received_bank_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('amount_received_bank_per_met');
element.payment_received_reason ? control.controls[index].addControl('payment_received_reason', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_received_reason');
element.amount_received_cash_per_met ? control.controls[index].addControl('amount_received_cash_per_met', new FormControl('')) : control.controls[index].removeControl('amount_received_cash_per_met');
element.amount_received_bank_per_met ? control.controls[index].addControl('amount_received_bank_per_met', new FormControl('')) : control.controls[index].removeControl('amount_received_bank_per_met');
element.payment_received_reason_per_met ? control.controls[index].addControl('payment_received_reason_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_received_reason_per_met');
element.payment_difference_per_met ? control.controls[index].addControl('payment_difference_per_met', new FormControl('')) : control.controls[index].removeControl('payment_difference_per_met');
(element.met_tenant_lessees_options=="1") ? control.controls[index].addControl('payment_difference_per_met', new FormControl('')) : control.controls[index].removeControl('payment_difference_per_met');
if(element.payment_mode_per_met){
let ChildCtrl : any = control.controls[index];
if(element.payment_mode_per_met.id == 1){
ChildCtrl.controls['amount_received_cash_per_met'].setValidators([Validators.required,Validators.max(element.paid_monthly_rent_per_met),Validators.min(element.paid_monthly_rent_per_met)]);
ChildCtrl.controls['amount_received_cash_per_met'].updateValueAndValidity();
}
else if(element.payment_mode_per_met.id == 2){
ChildCtrl.controls['amount_received_bank_per_met'].setValidators([Validators.required,Validators.max(element.paid_monthly_rent_per_met),Validators.min(element.paid_monthly_rent_per_met)]);
ChildCtrl.controls['amount_received_bank_per_met'].updateValueAndValidity();
}
else if(element.payment_mode_per_met.id == 3){
this.ValidatedRentAmount(element,index,2);
}
}
});
}
}
this._rentalForm.patchValue(rentalVal);
}
else{
let control: any = <FormArray>this._rentalForm.controls['property_unit_details'];
@ -393,15 +438,18 @@ addMoreUnitDetails(){
// generate payment dynamic fields
generatePaymentOptions(value:any,index:number,type: number){
// console.log('generatePaymentOptions',value,index,type);
if(type==1){
let control: any = <FormArray>this._rentalForm.controls['property_unit_details'];
let monthlyrentamt : number = value.monthly_rent_amount ;
if(value && value.payment_mode.id==1){
control.controls[index].addControl('amount_received_cash', new FormControl(value.amount_received_cash ? value.amount_received_cash : '', Validators.required));
control.controls[index].addControl('amount_received_cash', new FormControl(value.amount_received_cash ? value.amount_received_cash : '', [Validators.required,Validators.max(monthlyrentamt),Validators.min(monthlyrentamt)]));
control.controls[index].removeControl('amount_received_bank');
control.controls[index].removeControl('payment_received_reason');
}
else if(value && value.payment_mode.id==2){
control.controls[index].addControl('amount_received_bank', new FormControl(value.amount_received_bank ? value.amount_received_bank : '', Validators.required));
control.controls[index].addControl('amount_received_bank', new FormControl(value.amount_received_bank ? value.amount_received_bank : '', [Validators.required,Validators.max(monthlyrentamt),Validators.min(monthlyrentamt)]));
control.controls[index].removeControl('amount_received_cash');
control.controls[index].removeControl('payment_received_reason');
}
@ -418,13 +466,14 @@ addMoreUnitDetails(){
}
else if(type==2){
let control: any = <FormArray>this._rentalForm.controls['property_unit_details'];
let paidmonthlyrentamt : any = value.paid_monthly_rent_per_met ;
if(value && value.payment_mode_per_met.id==1){
control.controls[index].addControl('amount_received_cash_per_met', new FormControl(value.amount_received_cash_per_met ? value.amount_received_cash_per_met : '', Validators.required));
control.controls[index].addControl('amount_received_cash_per_met', new FormControl(value.amount_received_cash_per_met ? value.amount_received_cash_per_met : '', [Validators.required,Validators.max(paidmonthlyrentamt),Validators.min(paidmonthlyrentamt)]));
control.controls[index].removeControl('amount_received_bank_per_met');
control.controls[index].removeControl('payment_received_reason_per_met');
}
}
else if(value && value.payment_mode_per_met.id==2){
control.controls[index].addControl('amount_received_bank_per_met', new FormControl(value.amount_received_bank_per_met ? value.amount_received_bank_per_met : '', Validators.required));
control.controls[index].addControl('amount_received_bank_per_met', new FormControl(value.amount_received_bank_per_met ? value.amount_received_bank_per_met : '', [Validators.required,Validators.max(paidmonthlyrentamt),Validators.min(paidmonthlyrentamt)]));
control.controls[index].removeControl('amount_received_cash_per_met');
control.controls[index].removeControl('payment_received_reason_per_met');
}
@ -438,10 +487,83 @@ addMoreUnitDetails(){
control.controls[index].removeControl('amount_received_bank_per_met');
control.controls[index].removeControl('payment_received_reason_per_met');
}
let child = control.controls[index] as FormGroup;
if(child.controls.payment_difference_per_met){
child.controls.payment_difference_per_met.setValue('');
child.controls.payment_difference_per_met.updateValueAndValidity();
}
else{
console.log('There is NO Control');
}
}
}
ValidatedRentAmount(value:any,index:number,type: number){
let control: any = <FormArray>this._rentalForm.controls['property_unit_details'];
if(type==1){
let monthlyrentamt : any = value.monthly_rent_amount ;
if(value && value.payment_mode.id==3){
let ChildCtrl : any = control.controls[index];
ChildCtrl.controls['amount_received_bank'].clearValidators();
ChildCtrl.controls['amount_received_bank'].updateValueAndValidity();
ChildCtrl.controls['amount_received_cash'].clearValidators();;
ChildCtrl.controls['amount_received_cash'].updateValueAndValidity();
if(monthlyrentamt != ''){
let bank_amount = value.amount_received_bank;
ChildCtrl.controls['amount_received_bank'].setValidators([Validators.required,Validators.max(monthlyrentamt),Validators.min(0)]);
ChildCtrl.controls['amount_received_bank'].updateValueAndValidity();
let remainingAmt = monthlyrentamt-bank_amount
if(remainingAmt >= 0 ){
ChildCtrl.controls['amount_received_cash'].setValue(remainingAmt);
ChildCtrl.controls['amount_received_cash'].setValidators([Validators.required,Validators.max(monthlyrentamt-bank_amount),Validators.min(monthlyrentamt-bank_amount)]);
}
else{
ChildCtrl.controls['amount_received_cash'].setValue(0);
ChildCtrl.controls['amount_received_cash'].setValidators([Validators.max(0),Validators.min(0)]);
}
ChildCtrl.controls['amount_received_cash'].updateValueAndValidity();
}
}
}
if(type==2 && value.payment_mode_per_met != ''){
if(value && value.payment_mode_per_met.id==3){
let ChildCtrl : any = control.controls[index];
ChildCtrl.controls['amount_received_bank_per_met'].clearValidators();
ChildCtrl.controls['amount_received_bank_per_met'].updateValueAndValidity();
ChildCtrl.controls['amount_received_cash_per_met'].clearValidators();;
ChildCtrl.controls['amount_received_cash_per_met'].updateValueAndValidity();
let paidmonthlyrentamt : any = value.paid_monthly_rent_per_met;
if(paidmonthlyrentamt != ''){
let bank_amount = value.amount_received_bank_per_met;
ChildCtrl.controls['amount_received_bank_per_met'].setValidators([Validators.required,Validators.max(paidmonthlyrentamt),Validators.min(0)]);
ChildCtrl.controls['amount_received_bank_per_met'].updateValueAndValidity();
let remainingAmt = paidmonthlyrentamt-bank_amount
if(remainingAmt >= 0 ){
ChildCtrl.controls['amount_received_cash_per_met'].setValue(remainingAmt);
ChildCtrl.controls['amount_received_cash_per_met'].setValidators([Validators.required,Validators.max(paidmonthlyrentamt-bank_amount),Validators.min(paidmonthlyrentamt-bank_amount)]);
}
else{
ChildCtrl.controls['amount_received_cash_per_met'].setValue(0);
ChildCtrl.controls['amount_received_cash_per_met'].setValidators([Validators.max(0),Validators.min(0)]);
}
ChildCtrl.controls['amount_received_cash_per_met'].updateValueAndValidity();
}
}
}
}
// tenant/lessees options
generateTenantOptions(value:any,index:number){
let control: any = <FormArray>this._rentalForm.controls['property_unit_details'];
@ -620,7 +742,8 @@ generateAgreementOtherOwners(value:any,index:number) {
// validate agreement amount
validateAgreementAmt(actualRent:number,agreementRent:number){
if(actualRent>0 && agreementRent>0){
return (actualRent >= agreementRent) ? Number(actualRent) - Number(agreementRent) : Number(agreementRent) - Number(actualRent);
let calculatedValue = (actualRent >= agreementRent) ? Number(actualRent) - Number(agreementRent) : Number(agreementRent) - Number(actualRent)
return Math.abs(calculatedValue);
}
else{
return "0";
@ -839,15 +962,67 @@ calculateFloorRentAmt(values: any, index: number){
return true;
else return false
}
// save rental form
saveRental(formData: any) {
let ApplicantRentAmt : any ;
let TenantRentAmt : any ;
let TempArray1 : any = [];
let TempArray2 : any = [];
let textMessage : any;
if(formData.property_unit_details.length > 0){
formData.property_unit_details.forEach((data,index) => {
TempArray1[index] = data.monthly_rent_amount;
ApplicantRentAmt = TempArray1.reduce((sum, val) => sum + +val, 0);
TempArray2[index] = data.paid_monthly_rent_per_met;
TenantRentAmt = TempArray2.reduce((sum, val) => sum + +val, 0);
})
textMessage = 'Monthly Rent as Per Loan Applicant = '+ApplicantRentAmt+'<br>';
}
let FloorsTotalRentAmt : any ;
let Array : any = [];
if(formData.multistoried_building_details.length > 0){
formData.multistoried_building_details.forEach((val,index) => {
Array[index] = val.floor_rent_amount;
FloorsTotalRentAmt = Array.reduce((sum, val) => sum + +val, 0);
});
textMessage = textMessage +'Rent amount calculated = '+FloorsTotalRentAmt;
}
else{
textMessage = textMessage +'Monthly Rent amount as Per Tenant met = '+TenantRentAmt;
}
if (this._rentalForm.invalid) {
this.validateAllFormFields(this._rentalForm);
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
this.notifier.notify('warning', 'Please Fill/Correct All Mandatory Fields.!');
return;
}
else {
/** html: 'Rent as Per Tenant = '+TenantRentAmt+ '<br>'+'Rent as Per Applicant =' + ApplicantRentAmt , */
Swal({
title: 'Confirm The Rent Amount',
type: 'info',
html: textMessage,
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Confirm',
// cancelButtonText:'Cancel And Correct',
}).then((result) => {
if (result.value) {
// Swal(result.value);
// return;
this._pd.savePDFormDetailsWithID(formData).subscribe(
dataresult => {
if (dataresult.status == 200) {
@ -859,12 +1034,20 @@ saveRental(formData: any) {
}
else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
return;
// this.errorMessage = "Some Thing Wents Wrong Try Again !";
}
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
return;
// this.errorMessage = "Something Wents Wrong Try Again !";
});
}
else{
// Swal('Sorry Try Again !');
return;
}
})
}
}

View File

@ -37,7 +37,7 @@
</mat-form-field>
<mat-form-field style="width:30%">
<mat-select placeholder="Stock" formControlName="stock_observed"
(selectionChange)="checkComments($event.value,1,a)">
(selectionChange)="checkComments($event.value,1,a);">
<mat-option>Select</mat-option>
<mat-option value="yes">Add Stock Details</mat-option>
<mat-option value="no">No Stock Observed</mat-option>
@ -96,10 +96,13 @@
<mat-select placeholder="Is the stock of Raw Materials observed, sufficient considering the size of operations"
formControlName="is_sufficiant_raw">
<mat-option>Select</mat-option>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
<mat-option *ngFor="let val of RMsufficientList" [value]="val.value" [disabled]="val.disabled">
{{val.isdisplayvalue}}
</mat-option>
<!-- <mat-option value="yes">Yes</mat-option> -->
<!-- <mat-option value="no">No</mat-option> -->
<!-- <mat-option value="not applicable">Not Applicable</mat-option> -->
<mat-option value="not applicable">Stock not required to be maintained</mat-option>
<!-- <mat-option value="not applicable">Stock not required to be maintained</mat-option> -->
</mat-select>
</mat-form-field>
<mat-form-field appearance="outline" style="width: 90%" *ngIf="md.get('is_sufficiant_raw').value == 'no'">
@ -124,7 +127,7 @@
</mat-form-field>
<mat-form-field style="width:30%">
<mat-select placeholder="Stock" formControlName="goods_observed"
(selectionChange)="checkComments($event.value,2,b)">
(selectionChange)="checkComments($event.value,2,b);">
<mat-option>Select</mat-option>
<mat-option value="yes">Add Stock Details</mat-option>
<mat-option value="no">No Stock Observed</mat-option>
@ -345,9 +348,12 @@
<mat-select placeholder="Is the stock of finished / traded goods observed, sufficient considering the size of operations"
formControlName="is_sufficiant_finished_and_traded_goods">
<mat-option>Select</mat-option>
<mat-option value="yes">Yes</mat-option>
<mat-option *ngFor="let val of TGsufficientList" [value]="val.value" [disabled]="val.isdisabled">
{{val.isdisplayvalue}}
</mat-option>
<!-- <mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
<mat-option value="not applicable">Stock not required to be maintained</mat-option>
<mat-option value="not applicable">Stock not required to be maintained</mat-option> -->
<!-- <mat-option value="not applicable">Not Applicable</mat-option> -->
</mat-select>
</mat-form-field>

View File

@ -51,6 +51,9 @@ export class StockComponent implements OnInit {
suppliers_finished_goods: any = [];
// suppliers_service_product : any = [];
public RMsufficientList: any = [{value:"yes",isdisplayvalue:"Yes",disabled:false},{value:"no",isdisplayvalue:"No",disabled:false},{value:"not applicable",isdisplayvalue:"Stock not required to be maintained",disabled:false}];
public TGsufficientList: any = [{value:"yes",isdisplayvalue:"Yes",isdisabled:false},{value:"no",isdisplayvalue:"No",isdisabled:false},{value:"not applicable",isdisplayvalue:"Stock not required to be maintained",isdisabled:false}];
/** Constructor */
constructor(notifier: NotifierService,
private fb: FormBuilder,
@ -94,7 +97,7 @@ export class StockComponent implements OnInit {
ngOnInit() {
this._pd.stockFormAccess(this.pdid, this.company_id).subscribe(data => {
this._pd.getProductsFromBusinessAndSupplier(this.pdid, this.company_id).subscribe(data => {
if (data.dataStatus == true) {
this.initstockForms(data.record);
@ -761,26 +764,40 @@ export class StockComponent implements OnInit {
checkComments(value, flag, index) {
if (flag == 1) {
this.ManufacturingCounterArray[index] = value == "yes" ? 1 : 0;
this.not_stock_of_rm[index] = value == "stock not required to be maintained" ? 1 : 0;
this.ManufacturingCounterArray[index] = value != "" ? 1 : 0;
this.not_stock_of_rm[index] = value == "yes" ? 1 : 0;
let RMOverallCount = this.ManufacturingCounterArray.reduce((sum, val) => sum + +val, 0);
this.RMCommentCard = RMOverallCount > 0 ? true : false;
let not_stock1 = this.not_stock_of_rm.reduce((sum, val) => sum + +val, 0);
if(not_stock1 > 0){ this.stockForms.controls['manufacturing_details']['controls'][0].controls['is_sufficiant_raw'].setValue('not applicable') }
// if(not_stock1 > 0){ this.stockForms.controls['manufacturing_details']['controls'][0].controls['is_sufficiant_raw'].setValue('not applicable') }
if(not_stock1 > 0){
console.log('not_stock1',not_stock1);
this.RMsufficientList[0].disabled = false;
this.RMsufficientList[2].disabled = true;
// this.stockForm.controls['is_sufficiant_finished_and_traded_goods'].setValue('');
}
else if(not_stock1 == 0){
console.log('0',not_stock1);
this.RMsufficientList[0].disabled = true;
this.RMsufficientList[2].disabled = false;
// this.stockForm.controls['is_sufficiant_finished_and_traded_goods'].setValue('not applicable');
}
console.log('this.RMsufficientList',this.RMsufficientList);
}
if (flag == 2) {
this.FinishedCounterArray[index] = value == "yes" ? 1 : 0
this.not_stock_of_fg[index] = value == "stock not required to be maintained" ? 1 : 0;
if(flag == 2) {
this.FinishedCounterArray[index] = value != "" ? 1 : 0
this.not_stock_of_fg[index] = value == "yes" ? 1 : 0;
}
if (flag == 3) {
this.RetailCounterArray[index] = value == "yes" ? 1 : 0
this.not_stock_of_tg[index] = value == "stock not required to be maintained" ? 1 : 0;
this.RetailCounterArray[index] = value != "" ? 1 : 0
this.not_stock_of_tg[index] = value == "yes" ? 1 : 0;
}
if (flag == 4) {
this.WholeSaleCounterArray[index] = value == "yes" ? 1 : 0
this.not_stock_of_ws[index] = value == "stock not required to be maintained" ? 1 : 0;
this.WholeSaleCounterArray[index] = value != "" ? 1 : 0
this.not_stock_of_ws[index] = value == "yes" ? 1 : 0;
}
let FGOverallCount = this.FinishedCounterArray.reduce((sum, val) => sum + +val, 0);
let RTGOverallCount = this.RetailCounterArray.reduce((sum, val) => sum + +val, 0);
@ -788,20 +805,29 @@ export class StockComponent implements OnInit {
let TGOverallCount = FGOverallCount + RTGOverallCount + WTGOverallCount;
this.TGCommentCard = TGOverallCount > 0 ? true : false;
let not_stock_fg = this.not_stock_of_rm.reduce((sum, val) => sum + +val, 0);
let not_stock_rt = this.not_stock_of_rm.reduce((sum, val) => sum + +val, 0);
let not_stock_tg = this.not_stock_of_rm.reduce((sum, val) => sum + +val, 0);
let not_stock2 = not_stock_fg + not_stock_rt + not_stock_tg;
let not_stock_fg = this.not_stock_of_fg.reduce((sum, val) => sum + +val, 0);
let not_stock_ws = this.not_stock_of_ws.reduce((sum, val) => sum + +val, 0);
let not_stock_tg = this.not_stock_of_tg.reduce((sum, val) => sum + +val, 0);
let not_stock2 = not_stock_fg + not_stock_ws + not_stock_tg;
console.log('not_stock2',not_stock2);
if(not_stock2 > 0){
this.stockForms.controls['is_sufficiant_finished_and_traded_goods'].setValue('not applicable');
console.log('not_stock2',not_stock2);
this.TGsufficientList[0].isdisabled = false;
this.TGsufficientList[2].isdisabled = true;
// this.stockForm.controls['is_sufficiant_finished_and_traded_goods'].setValue('');
}
else if(not_stock2 == 0){
console.log('0',not_stock2);
this.TGsufficientList[0].isdisabled = true;
this.TGsufficientList[2].isdisabled = false;
// this.stockForm.controls['is_sufficiant_finished_and_traded_goods'].setValue('not applicable');
}
console.log('Data',this.TGsufficientList);
// else if(not_stock == 0){
// this.stockForms.controls['is_sufficiant_finished_and_traded_goods'].setValue('');
// }
}
// checkComments(e,flag,index){
// if(flag == 1 && e=='no'){
// this.mrmCommentFlag = true;

View File

@ -201,7 +201,7 @@
<mat-card-title>Applicants</mat-card-title>
</div>
<div fxFlex="30" align="end" style="padding: 10px !important;" *ngIf="currentPDStatus==pdStatusCheck.DRAFT || currentPDStatus==pdStatusCheck.TRIGGERED || currentPDStatus==pdStatusCheck.ALLOCATED || currentPDStatus==pdStatusCheck.SCHEDULED">
<button mat-raised-button mat-button-sm mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="editPdApplicant(pdApplicantData)"><mat-icon>edit</mat-icon></button>
<button mat-raised-button mat-button-sm mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="editPdApplicant(pdApplicantData,CustomerSegmentAbbr)"><mat-icon>edit</mat-icon></button>
</div>
</mat-card-header>

View File

@ -48,22 +48,23 @@ export class ViewPdComponent implements OnInit, OnDestroy {
{ 'backEnd_FieldName': "fk_pd_type", 'frontEnd_FieldName': "PD Type" },
{ 'backEnd_FieldName': "fk_customer_segment", 'frontEnd_FieldName': "Customer Segment" },
{ 'backEnd_FieldName': "loan_amount", 'frontEnd_FieldName': "Loan Amount" },
{ 'backEnd_FieldName': "addressline1", 'frontEnd_FieldName': "Address at which PD is to be done" },
{ 'backEnd_FieldName': "fk_city", 'frontEnd_FieldName': "City" },
{ 'backEnd_FieldName': "fk_state", 'frontEnd_FieldName': "State" },
{ 'backEnd_FieldName': "pincode", 'frontEnd_FieldName': "Pincode" },
{ 'backEnd_FieldName': "pd_contact_person", 'frontEnd_FieldName': "Lender Contact Person" },
{ 'backEnd_FieldName': "pd_contact_mobileno", 'frontEnd_FieldName': "Lender's Mobile Number" },
{ 'backEnd_FieldName': "pd_branch_id", 'frontEnd_FieldName': "Branch" },
{ 'backEnd_FieldName': "pd_contact_landline", 'frontEnd_FieldName': "Lender's Landline Number" },
{ 'backEnd_FieldName': "main_applicant", 'frontEnd_FieldName': "Applicant Master" }];
// localAddressMandortyField: any = [
// { 'backEnd_FieldName': "addressline1", 'frontEnd_FieldName': "Address at which PD is to be done" },
// { 'backEnd_FieldName': "fk_city", 'frontEnd_FieldName': "City" },
// { 'backEnd_FieldName': "fk_state", 'frontEnd_FieldName': "State" },
// { 'backEnd_FieldName': "pincode", 'frontEnd_FieldName': "Pincode" }
// ];
viewID: string;
viewParams: any;
destroyType: number = 1;
currentPDStatus: string;
enableStartPD: boolean;
CustomerSegmentAbbr:string;
// create values for status check
pdStatusCheck: any = {
"DRAFT": 'DRAFT',
@ -107,6 +108,7 @@ export class ViewPdComponent implements OnInit, OnDestroy {
this.pd_QC_Rating = Number(this.pdMasterData.qc_rating);
this.pdApplicantData = data.records.applicants_details;
this.pdApplicantData = this.pdApplicantData.filter(appt => appt.applicant_type != 2);
this.CustomerSegmentAbbr = this.pdMasterData[0].customer_segment_abbr;
this.pdDocumentsData = data.records.pd_documnets;
this.masterPdLogsData = Object.keys(data.records.pd_logs.master).map(function (key) {
return data.records.pd_logs.master[key];
@ -205,6 +207,7 @@ export class ViewPdComponent implements OnInit, OnDestroy {
.subscribe(dataresult => {
if (flag == 1) {
let ffd: any = [];
console.log('this.FilteredFieldNames',this.FilteredFieldNames);
this.FilteredFieldNames.forEach(field => {
ffd.push(field.frontEnd_FieldName);
});
@ -229,10 +232,11 @@ export class ViewPdComponent implements OnInit, OnDestroy {
this.viewPdDetails(this.viewID)
});
}
editPdApplicant(applicantData: any) {
editPdApplicant(applicantData: any,CSAbbr : any) {
let setPdDetails = {
"pdID": this.viewID,
"records": applicantData
"records": applicantData,
"SegmentAbbr":CSAbbr,
}
const dialogApplicant = this.dialog.open(EditPdApplicantComponent, {
data: setPdDetails,
@ -392,6 +396,7 @@ export class ViewPdComponent implements OnInit, OnDestroy {
let pdid = masterdetail.pd_id;
let getValues = data.filter(val => val).map(Val => Val);
console.log('getValues',getValues);
this.FilteredFieldNames = getValues.map(x => {
let findIndex = this.localMandatoryFields.map(val => val.backEnd_FieldName).indexOf(x);
return this.localMandatoryFields[findIndex];

View File

@ -116,6 +116,8 @@ import { GetAnswerableFormsPipe } from './../pd-pipes/get-answerable-forms.pipe'
import { ConfirmAiDetailsComponent } from './list-pd/start-pd/forms/assessed-income/confirm-ai-details/confirm-ai-details.component';
import { RentalVerificationComponent } from './list-pd/start-pd/forms/rental-verification/rental-verification.component';
import { InitiateAdditionalPdComponent } from './list-pd/initiate-additional-pd/initiate-additional-pd.component';
import { ManageDailyPurchaseComponent } from './list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-purchase/manage-daily-purchase.component';
import { DailyPurchaseDetailsComponent } from './list-pd/start-pd/forms/assessed-income/daily-purchase-details/daily-purchase-details.component';
/**
* Custom angular notifier options
@ -162,7 +164,7 @@ const pdCustomNotifierOptions: NotifierOptions = {
};
@NgModule({
declarations: [TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, LenderRepresentativeComponent, PdReportComponent, AssessedIncomeComponent, AllocationViewMoreComponent, PdRequirementComponent, GeneralInfoComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent, SearchRelationPipe, RupeeCurrencyFormatPipe, NumberToWordsPipe, DeleteRecordsCountPipe, BusinessAssetsInfoComponent, BusinessBankingDetailsComponent, SalesDetailsComponent, DailySalesDetailsComponent, SalesCalculationComponent, ManageSalesComponent, PurchaseDetailsComponent, BusinessExpenseDetailsComponent, HouseHoldDetailsComponent, OtherBusinessIncomeDetailsComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, GrossProfitCalculationComponent, ManageDailySalesComponent, PdStatusChangeDialogueComponent, PdLocatedMapViewDirective, ViewLocationComponent, GetAnswerableFormsPipe, ConfirmAiDetailsComponent, RentalVerificationComponent, InitiateAdditionalPdComponent],
declarations: [TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, LenderRepresentativeComponent, PdReportComponent, AssessedIncomeComponent, AllocationViewMoreComponent, PdRequirementComponent, GeneralInfoComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent, SearchRelationPipe, RupeeCurrencyFormatPipe, NumberToWordsPipe, DeleteRecordsCountPipe, BusinessAssetsInfoComponent, BusinessBankingDetailsComponent, SalesDetailsComponent, DailySalesDetailsComponent, SalesCalculationComponent, ManageSalesComponent, PurchaseDetailsComponent, BusinessExpenseDetailsComponent, HouseHoldDetailsComponent, OtherBusinessIncomeDetailsComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, GrossProfitCalculationComponent, ManageDailySalesComponent, PdStatusChangeDialogueComponent, PdLocatedMapViewDirective, ViewLocationComponent, GetAnswerableFormsPipe, ConfirmAiDetailsComponent, RentalVerificationComponent, InitiateAdditionalPdComponent ,ManageDailyPurchaseComponent, DailyPurchaseDetailsComponent],
imports: [
CommonModule,
ManagePdRoutingModule,
@ -195,14 +197,13 @@ const pdCustomNotifierOptions: NotifierOptions = {
AgmCoreModule.forRoot({apiKey: 'AIzaSyCXsHTus6hyIB8jYvt9ZEIbZve-2vWeQRg'}),OwlDateTimeModule,
OwlNativeDateTimeModule,
],
exports: [PdLocatedMapViewDirective, PdAllocationComponent, SmartPdAllocationComponent, TelePdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent, AssessedIncomeComponent, AllocationViewMoreComponent, GeneralInfoComponent, PdRequirementComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, BusinessOtherFamilyMemberComponent, BusinessInfoGroupComponent,DailySalesDetailsComponent, SalesCalculationComponent, PurchaseDetailsComponent, BusinessExpenseDetailsComponent, HouseHoldDetailsComponent, OtherBusinessIncomeDetailsComponent, ManageSalesComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, GrossProfitCalculationComponent, ManageDailySalesComponent, PdStatusChangeDialogueComponent, ViewLocationComponent, ConfirmAiDetailsComponent, RentalVerificationComponent, InitiateAdditionalPdComponent],
exports: [PdLocatedMapViewDirective, PdAllocationComponent, SmartPdAllocationComponent, TelePdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent, AssessedIncomeComponent, AllocationViewMoreComponent, GeneralInfoComponent, PdRequirementComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, BusinessOtherFamilyMemberComponent, BusinessInfoGroupComponent,DailySalesDetailsComponent, SalesCalculationComponent, PurchaseDetailsComponent, BusinessExpenseDetailsComponent, HouseHoldDetailsComponent, OtherBusinessIncomeDetailsComponent, ManageSalesComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, GrossProfitCalculationComponent, ManageDailySalesComponent, PdStatusChangeDialogueComponent, ViewLocationComponent, ConfirmAiDetailsComponent, RentalVerificationComponent, InitiateAdditionalPdComponent, DailyPurchaseDetailsComponent, ManageDailyPurchaseComponent],
providers: [PdTrigerService, GetGeometricLocationService,{provide: MAT_DATE_LOCALE, useValue: 'en-GB'},
{provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]},
{provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS}, PdLocatedMapViewDirective],
entryComponents: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, TelePdAllocationComponent, AllocationViewMoreComponent, PersonalInfoComponent,BusinessAssetsInfoComponent,
ClientInfoComponent, SupplierInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent, AssessedIncomeComponent, GeneralInfoComponent, PdRequirementComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent,BusinessBankingDetailsComponent, ManageSalesComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, ManageDailySalesComponent,PdStatusChangeDialogueComponent, ViewLocationComponent, ConfirmAiDetailsComponent, RentalVerificationComponent, InitiateAdditionalPdComponent],
ClientInfoComponent, SupplierInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent, AssessedIncomeComponent, GeneralInfoComponent, PdRequirementComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent, BusinessInfoGroupComponent,BusinessBankingDetailsComponent, ManageSalesComponent, ManagePurchaseComponent, ManageBusinesExpenseComponent, ManageHouseHoldComponent, ManageOtherBusinessIncomeComponent, ManageDailySalesComponent,PdStatusChangeDialogueComponent, ViewLocationComponent, ConfirmAiDetailsComponent, RentalVerificationComponent, InitiateAdditionalPdComponent, ManageDailyPurchaseComponent],
})
export class ManagePdModule {
}

View File

@ -363,6 +363,11 @@ export class PdTrigerService {
)
}
/* To get TypeofActivity's Product And Service From About Business,
* Used In 1) SupplierForm
* 2) ClientForm
* 3) AI - Sales Tab - Sales DailyWise & Sales ItemWise
*/
getTypeofActivityForSuppliedInfoForm(pd_id: any,company_id:any): Observable<any> {
return this._http.post<any>(this.apiUrl + "getTypeOfActivetyFromBusinessForm", { "records": { "pd_id": pd_id,"company_id":company_id } })
.pipe(
@ -496,10 +501,13 @@ export class PdTrigerService {
)
}
/** For Stock Details
* To Get The Products With TypeofActivity From Business
**/
stockFormAccess(pdid: any,companyid: any): Observable<any> {
/* To get TypeofActivity's Product From About Business,
* To get RawMaterial's From Supplier Form,
* Used In 1) StockForm
* 2) AI - Purchase Tab
*/
getProductsFromBusinessAndSupplier(pdid: any,companyid: any): Observable<any> {
// { "pd_id":"104","company_id":"1"}
return this._http.post<any>(this.apiUrl + "getProductsFromBusiness", { "pd_id" : pdid , "company_id":companyid })
.pipe(

View File

@ -11,6 +11,9 @@
<a mat-list-item *ngFor="let pd of pdReportVersionList; let itemIndex = index;" (click)="changeVersion(pd, itemIndex)">
<h4 mat-line [ngStyle]="{'color':pd.is_latest == 1 && itemIndex == selectedIndex ? '#e00201' : pd.is_latest == 1 && itemIndex != selectedIndex ? 'green' : pd.is_latest !=1 && itemIndex == selectedIndex ? '#e00201' : 'rgba(0, 0, 0, 0.87)' }">{{ pd.doc_name }}</h4>
<!-- <h4 mat-line>{{ pd.doc_name }}</h4> -->
<button mat-icon-button color="warn" aria-label="Example icon-button with a heart icon">
<a target="_blank" href = {{pd.doc_uri}}> <mat-icon>get_app</mat-icon> </a>
</button>
<p mat-line> {{pd.createdby}} ({{pd.createdon}}) </p>
</a>