diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html index 051688668..5d708ab4e 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html @@ -44,8 +44,8 @@ - - Enter Valid Mobile Number. + + Enter Valid Mobile Number. + @@ -200,13 +201,14 @@ - - + + - + + Mobile No is Required . Enter Valid Mobile Number. @@ -240,7 +242,7 @@ - + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts index 3f951bd2d..575d2a514 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts @@ -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; diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.html index 7d861afd1..4dc179819 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.html @@ -29,7 +29,7 @@ - + @@ -66,13 +66,13 @@ - + - - Enter Valid Mobile Number. + + Enter Valid Mobile Number. - + - + !-- MixUse + Required -- + --> diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts index b08e6f03c..47d9c9068 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts @@ -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: [''], diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-busines-expense/manage-busines-expense.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-busines-expense/manage-busines-expense.component.ts index e7cecd4b2..b11ed0359 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-busines-expense/manage-busines-expense.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-busines-expense/manage-busines-expense.component.ts @@ -82,7 +82,8 @@ businessCalculation(indexVal: number,values: any): void { let control:any = 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 { diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-purchase/manage-daily-purchase.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-purchase/manage-daily-purchase.component.html new file mode 100644 index 000000000..06874d625 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-purchase/manage-daily-purchase.component.html @@ -0,0 +1,85 @@ +
+ +

+
+ {{pageTitle}} +
+
+ +
+

+ + + + + + + + Select + {{ prod }} + Others + + + + + + + +
+ +
+
+
+ + + + + + + + {{"₹"}} {{childItem.value.purchase_value | numberToWords}} Only + + +
+ +
+
+ +
+ +
+ +
+ + + + +
+
+ +
+ + + +
+ +
+ + + + + + + \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-purchase/manage-daily-purchase.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-purchase/manage-daily-purchase.component.scss new file mode 100644 index 000000000..3286c8cbe --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-purchase/manage-daily-purchase.component.scss @@ -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 +} \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-purchase/manage-daily-purchase.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-purchase/manage-daily-purchase.component.spec.ts new file mode 100644 index 000000000..44cef4cf0 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-purchase/manage-daily-purchase.component.spec.ts @@ -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; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ManageDailyPurchaseComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ManageDailyPurchaseComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-purchase/manage-daily-purchase.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-purchase/manage-daily-purchase.component.ts new file mode 100644 index 000000000..ca02f6c3f --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-purchase/manage-daily-purchase.component.ts @@ -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) { + 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 = 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 = 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 = 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 = 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 = 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 = 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 = this.purchaseItemForm.controls['purchase_product']; + calculatControlValues = calculatControlValues.controls[parentIndex]; + this.purchaseCalculation(parentIndex,calculatControlValues.value); + } + +} + +//To remove the Products +removeProducts(parentIndex:number){ + let control: any = 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 = 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); + } + }); +} + +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.html index 301abb8f8..e6ec0618b 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.html @@ -14,8 +14,16 @@ - + + + Select + {{ prod.name }} + Others + + + + + +
+ + {{types.type_name}} + +
+
- + - - + + {{uom.name}} - - + + - - +
-
- - - {{"₹"}} {{item.value.rate_per_unit | numberToWords}} Only - +
+ +
+ + + + {{"₹"}} {{item.value.rate_per_unit | numberToWords}} Only + - - - {{frq.name}} - - - - - {{"₹"}} {{item.value.annual_purchase_value | numberToWords}} Only - - + + + + {{frq.name}} + + + + + + + {{"₹"}} {{item.value.annual_purchase_value | numberToWords}} Only + + +
+ +
+ + + + {{frq.name}} + + + + + + {{"₹"}} {{item.value.rate_per_unit | numberToWords}} Only + + + + + + + {{"₹"}} {{item.value.annual_purchase_value | numberToWords}} Only + + +
@@ -78,4 +120,4 @@ - + s diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-purchase/manage-purchase.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-purchase/manage-purchase.component.scss index 49dcb4214..bb96c7726 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-purchase/manage-purchase.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-purchase/manage-purchase.component.scss @@ -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 } \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-purchase/manage-purchase.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-purchase/manage-purchase.component.ts index 6708851f2..9c2818b02 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-purchase/manage-purchase.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-purchase/manage-purchase.component.ts @@ -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) { 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 = 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 = 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 = 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) { diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.html index 217633517..153ab60bc 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-sales/manage-sales.component.html @@ -14,8 +14,16 @@
- + + + Select + {{ prod.name }} + Others + + + + +
+
+
+ +
+ + + {{expandDetails.purchaseItem == 'Others' ? expandDetails.purchaseItem + ' ( ' + expandDetails.otherPurchaseItem + ' )' : expandDetails.purchaseItem}} + + +
+ {{footer.month_message}}   {{footer.year_message}} +
+
+
+ + + + +
+ +

{{eachItem.header}}

+ + + + + + + + + + + + + + + +
Date{{itemValue.purchase_date | date:'dd-MM-yyyy'}} Total Amount{{itemValue.purchase_value}} {{getTotalCost(eachItem.value)}}
+
+ +
+
+ +
+ {{expandDetails.comments}} +
+
+ + + +
+ +
+ +
+
+ + + + + + \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-purchase-details/daily-purchase-details.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-purchase-details/daily-purchase-details.component.scss new file mode 100644 index 000000000..470c26551 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-purchase-details/daily-purchase-details.component.scss @@ -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; + } \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-purchase-details/daily-purchase-details.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-purchase-details/daily-purchase-details.component.spec.ts new file mode 100644 index 000000000..d3011c751 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-purchase-details/daily-purchase-details.component.spec.ts @@ -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; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ DailyPurchaseDetailsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(DailyPurchaseDetailsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-purchase-details/daily-purchase-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-purchase-details/daily-purchase-details.component.ts new file mode 100644 index 000000000..0d8992182 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-purchase-details/daily-purchase-details.component.ts @@ -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(); + + 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; + } + +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.html index 5d16057d5..99297c7ad 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.html @@ -6,7 +6,7 @@
- Sales Calculate Daily Wise + Sales Calculation as per Kutcha Records / Bills
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.scss index b559b3c47..332e5a872 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.scss @@ -1,3 +1,17 @@ mat-form-field { margin: 0 2%; - } \ No newline at end of file + } + + .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; + // } \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.ts index 4e8676fbe..b6bdd2019 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.ts @@ -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(); 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:[''], }) } } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/purchase-details/purchase-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/purchase-details/purchase-details.component.html index b2a2c141f..28a26b0df 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/purchase-details/purchase-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/purchase-details/purchase-details.component.html @@ -2,7 +2,8 @@
- Purchase Item + + Item-wise Purchase Calculation
-
+
- + - + @@ -86,7 +87,7 @@ - Purchase Item is Not Available.. + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/purchase-details/purchase-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/purchase-details/purchase-details.component.ts index 5af15cf6c..11d8a161e 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/purchase-details/purchase-details.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/purchase-details/purchase-details.component.ts @@ -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; } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.html index 98dd20928..4c1fcb49f 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.html @@ -10,11 +10,11 @@ {{"₹"}} {{salesCalculationForm.value.sales_declared_by_customer | numberToWords}} Only - - + + - + {{"₹"}} {{salesCalculationForm.value.margin_value | numberToWords}} Only diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.ts index 890266ccb..1968fb440 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.ts @@ -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 diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-details/sales-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-details/sales-details.component.html index 6d464b0c1..394d67c27 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-details/sales-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-details/sales-details.component.html @@ -5,7 +5,7 @@
- Sales Calculate Item Wise + Item-wise Sales Calculation
- + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.html index 8237438d9..a313c0cdc 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.html @@ -71,7 +71,7 @@
- @@ -294,7 +294,7 @@
+ style="width:45%; height: 105px !important;"> {{"₹"}} {{sup.get('approximate_market_value').value | numberToWords}} Only diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.scss index a1c689d8e..1387488cf 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.scss @@ -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; diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html index 408ab90d5..57bf1b88f 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html @@ -1510,9 +1510,10 @@
- {{"₹"}} {{businessForm.controls['employees_appx_salary'].value | numberToWords}} Only + formControlName="employees_appx_salary" required type="number"> + {{"₹"}} + {{businessForm.controls['employees_appx_salary'].value | numberToWords}} + Only - + Select {{ cl.company_name }} @@ -38,21 +38,24 @@
- + Higer than business vintage - + Higer than business vintage - + - + + Total working Experience is Lower - + @@ -185,14 +188,18 @@ formControlName="net_take_home"> --> - - {{"₹"}} {{employmentForm.controls['amount_paid_in_cash'].value | numberToWords}} Only + + {{"₹"}} {{employmentForm.controls['amount_paid_through_bank'].value | numberToWords}} Only + Given Value is More than Net Salary + Given Value is Less than Net Salary - - {{"₹"}} {{employmentForm.controls['amount_paid_through_bank'].value | numberToWords}} Only + + {{"₹"}} {{employmentForm.controls['amount_paid_in_cash'].value | numberToWords}} Only + Given Value is More than Net Salary + Given Value is Less than Net Salary @@ -210,7 +217,7 @@ - + Select Yes No diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.ts index 9a514a339..6c4950b7f 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.ts @@ -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]/; diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html index dd0c2a3e9..d5439ea7d 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html @@ -81,8 +81,8 @@ --> - - + @@ -165,7 +165,7 @@ - + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts index 8447dbfe5..45ff323c0 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts @@ -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 = []; diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html index de32ed394..c8721abcc 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html @@ -35,13 +35,13 @@
Enter year from which financials provided - - Invalid year format + Invalid year format
@@ -56,15 +56,12 @@
- {{"₹"}} {{details.get('financial_annual_sale').value | numberToWords}} Only - - + OnlyNumber type="text"> + {{"₹"}} + {{details.get('financial_annual_sale').value | numberToWords}} + Only + @@ -114,36 +111,30 @@ - {{"₹"}} {{details.get('financial_net_profit').value | numberToWords}} Only - - + OnlyNumber type="text"> + {{"₹"}} + {{details.get('financial_net_profit').value | + numberToWords}} Only + formControlName="financial_margin_of_profit" OnlyNumber + type="text" readonly> - - {{"₹"}} {{details.get('financial_net_loss').value | numberToWords}} Only - - + OnlyNumber type="text"> + {{"₹"}} + {{details.get('financial_net_loss').value | numberToWords}} + Only + + + placeholder="Variation of Profit/Loss to Sales % from Previous Year" + formControlName="financial_profit_to_sale_variation" OnlyNumber + type="text" readonly> No difference in Profit/Loss to sales % in FY {{details.get('financial_year').value}} over - Profit/Loss to sales % in FY + Profit/Loss to sales % in FY {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} @@ -204,7 +196,7 @@ class="greenhighlight"> Increase in Profit/Loss to sales % in FY {{details.get('financial_year').value}} over - Profit/Loss to sales % in FY + Profit/Loss to sales % in FY {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} {{details.get('financial_profit_to_sale_variation').value}} @@ -214,7 +206,7 @@ class="highlight"> Decrease in Profit/Loss to sales % in FY {{details.get('financial_year').value}} over - Profit/Loss to sales % in FY + Profit/Loss to sales % in FY {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} {{(details.get('financial_profit_to_sale_variation').value).replace('-', @@ -258,9 +250,11 @@ - {{"₹"}} {{details.get('estimate_sales_from').value | numberToWords}} Only + formControlName="estimate_sales_from" (change)="calculateSalesAverage(i, details);" + OnlyNumber type="text"> + {{"₹"}} + {{details.get('estimate_sales_from').value | numberToWords}} + Only - {{"₹"}} {{details.get('estimate_profit_margin').value | numberToWords}} Only + formControlName="estimate_profit_margin" readonly> + {{"₹"}} + {{details.get('estimate_profit_margin').value | + numberToWords}} Only + + + {{"₹"}} + {{details.get('estimate_net_loss_to').value | + numberToWords}} Only + + - {{"₹"}} {{details.get('estimate_net_loss').value | numberToWords}} Only - + formControlName="estimate_net_loss" OnlyNumber type="text"> + {{"₹"}} + {{details.get('estimate_net_loss').value | numberToWords}} + Only + + +
@@ -59,13 +64,17 @@ {{qual.qualification_name}} + Qualification Required + + Qualification Details Required + @@ -103,7 +112,8 @@ - Please Enter Correct Year + Please Enter Correct Year + {{entity.business_entity_type_name}}
+ Business Entity Type Required
- + Please Specify Others Required

Number of Years For Which The Business Has Been Running

- Please Enter Correct Year + Please Enter Correct Year * { + width: 100%; + } + mat-header-cell mat-cell { display:flex; justify-content:flex-end; diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts index a613f16d2..62c9dfd13 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts @@ -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; diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.html index 999773b6c..eaea8c469 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.html @@ -38,7 +38,7 @@ + (selectionChange)="onChangeSubProduct($event)"> Select {{list.name }} ( {{list.abbr}} ) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.ts index f230dc1de..1d2ad814b 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.ts @@ -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, @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() { diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.ts index 8c95e23e0..afa5e8cec 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.ts @@ -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 = 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){ diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.html index d9454d6b6..14f46964a 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.html @@ -317,7 +317,7 @@
- Name of the Tenant(s)/Lessees(s) of the Let out Property + Is Name of the Tenant(s)/Lessees(s) of the Let out Property Provided ? Yes Name(s) not provided @@ -349,17 +349,24 @@ + + + Amount Received in Bank + + {{"₹"}} {{units.value.amount_received_bank | numberToWords}} Only + Given Value Is More Than Rent Amount + Given Value Is Less Than Rent Amount + + Amount Received in Cash {{"₹"}} {{units.value.amount_received_cash | numberToWords}} Only + Given Value Is More Than Rent Amount + Given Value Is Less Than Rent Amount - - Amount Received in Bank - - {{"₹"}} {{units.value.amount_received_bank | numberToWords}} Only - + Reason for Receiving Multiple Payment Mode @@ -580,34 +587,40 @@ Mode of Payment of Rent as Validated by PD Officer with Tenant / Lessee During Visit - + {{payment.name}} + + Amount Paid in Bank + + {{"₹"}} {{units.value.amount_received_bank_per_met | numberToWords}} Only + Given Value Is More Than Rent Amount + Given Value Is Less Than Rent Amount + Amount Paid in Cash {{"₹"}} {{units.value.amount_received_cash_per_met | numberToWords}} Only + Given Value Is More Than Rent Amount + Given Value Is Less Than Rent Amount - - Amount Paid in Bank - - {{"₹"}} {{units.value.amount_received_bank_per_met | numberToWords}} Only - + Reason for Paid Multiple Payment Mode - - What is the Reason for Difference in Rent Amount or Mode of Payment +
+ + What is the Reason for Difference in Rent Amount +
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.ts index 516eabd0b..d08af73f8 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-verification/rental-verification.component.ts @@ -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 = 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 = 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 = 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 = 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 = 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+'
'; + } + + + 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+ '
'+'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; + } + }) } } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.html index 2c07308ba..afbf9659d 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.html @@ -37,7 +37,7 @@
+ (selectionChange)="checkComments($event.value,1,a);"> Select Add Stock Details No Stock Observed @@ -96,10 +96,13 @@ Select - Yes - No + + {{val.isdisplayvalue}} + + + - Stock not required to be maintained + @@ -124,7 +127,7 @@ + (selectionChange)="checkComments($event.value,2,b);"> Select Add Stock Details No Stock Observed @@ -345,9 +348,12 @@ Select - Yes + + {{val.isdisplayvalue}} + + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts index 6e7260af3..791e31808 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts @@ -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; diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html index 115cf64ff..f4ed49068 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html @@ -201,7 +201,7 @@ Applicants
- +
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts index d60a8ff48..4cd89fc23 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts @@ -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]; diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts b/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts index 57abf62a3..988b09b1e 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts @@ -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 { } diff --git a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts index d093985ef..a514933c0 100755 --- a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts +++ b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts @@ -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 { return this._http.post(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 { + + /* 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 { // { "pd_id":"104","company_id":"1"} return this._http.post(this.apiUrl + "getProductsFromBusiness", { "pd_id" : pdid , "company_id":companyid }) .pipe( diff --git a/ng6-seed/src/app/quality-check/qc-list/qc-pd-report/qc-pd-report.component.html b/ng6-seed/src/app/quality-check/qc-list/qc-pd-report/qc-pd-report.component.html index 548a0c955..77805c45e 100644 --- a/ng6-seed/src/app/quality-check/qc-list/qc-pd-report/qc-pd-report.component.html +++ b/ng6-seed/src/app/quality-check/qc-list/qc-pd-report/qc-pd-report.component.html @@ -11,6 +11,9 @@

{{ pd.doc_name }}

+

{{pd.createdby}} ({{pd.createdon}})

Raw Material/Trading Item {{element.purchase_item}} {{element.purchase_item == 'Others' ? element.purchase_item +' ( '+ element.other_purchase_item + ' )' : element.purchase_item }} Total of Purchase Purchase Quantity {{element.purchase_qty}} {{element.purchase_type=="1" ? element.purchase_qty : ''}} Product/Services {{element.sales_item}} {{element.sales_item == 'Others' ? element.sales_item + ' ( ' + element.other_sales_item + ' )' : element.sales_item }} Total of Sales