-
+ -->
-
-
-
+
+
diff --git a/src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.scss b/src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.scss
index a493f42f..cfa25024 100755
--- a/src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.scss
+++ b/src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.scss
@@ -1,8 +1,21 @@
page-pd-question-rental-info {
-
- .button-md{
- padding: 0 2.9em !important;
-
+ mat-hint{
+ font-size:11px;
}
+ mat-card{
+ margin-bottom: 15px;
+ border-radius: 10px !important;
+ box-shadow: 0 16px 38px -12px rgba(0, 0, 0, 0.56), 0 4px 25px 0 rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.2) !important;
+ }
+ .mat-card-content{
+ margin-bottom: 0px !important;
+ }
+ .scroll-content{
+ background-color: #eee;
+ }
+ // .button-md{
+ // padding: 0 2.9em !important;
+
+ // }
}
diff --git a/src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.ts b/src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.ts
index 99f2b6f7..3a980ef8 100755
--- a/src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.ts
+++ b/src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.ts
@@ -4,6 +4,8 @@ import { AwsServiceProvider } from '../../../providers/aws-service/aws-service';
import { ToastProvider } from '../../../providers/common-provider/toast';
import { QuestionCategoryProvider } from '../../../providers/question-category/question-category';
import { FormGroup, FormBuilder, FormArray, Validators, FormControl } from '@angular/forms';
+import {ConstantsProvider} from '../../../providers/constants/constants';
+import {DatePipe} from '@angular/common'
/**
* Generated class for the PdQuestionRentalInfoPage page.
@@ -18,125 +20,859 @@ import { FormGroup, FormBuilder, FormArray, Validators, FormControl } from '@ang
templateUrl: 'pd-question-rental-info.html',
})
export class PdQuestionRentalInfoPage {
-
+ pipe = new DatePipe('en-US');
users: any;
pdDetails: any;
FormId: any;
rentalForms:FormGroup;
- constructor(public navCtrl: NavController, public navParams: NavParams,public aws:AwsServiceProvider,public toast:ToastProvider,public qustCat:QuestionCategoryProvider,public fb:FormBuilder) {
+ applicants: any ;
+ existCompanyList: any=[];
+ mergeCompanyApplicant: any=[];
+ personType: any=[{id:2,name:"Tenant / Lessee"},{id:3,name:"Owner of the Rented Property"},{id:4,name:"Property Caretaker"},{id:1,name:"Others (Please Specify)"}];
+ relationShipList: any=[];
+ relationToList: any=[];
+ rentAmtInwords : String;
+ paymentOptions: any=[{id:1,name:"Received in Cash"},{id:2,name:"Received through Banking Channel"},{id:3,name:"Combination of Cash & Bank"}];
+ paymentPaidOptions: any=[{id:1,name:"Paid in Cash"},{id:2,name:"Paid through Banking Channel"},{id:3,name:"Combination of Cash & Bank"}];
+ propertyNature: any=[{id:2,name:"Residential Property"},{id:3,name:"Commercial Property"},{id:4,name:"Industrial Property"},{id:1,name:"Others (Please Specify)"}];
+ unitTypeList: any=[];
+ stateList:any=[];
+ cityList:any=[];
+ pincodeList:any=[];
+ documentList: any=[{id:2,name:"Property Title Document"},{id:3,name:"Electricity Bill with name of owner mentioned therein"},{id:4,name:"Property tax Receipts"},{id:1,name:"Others (Please Specify)"}];
+ //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=[];
+
+ rent_per_unit_Inwords : any= [];
+ amount_Inwords : any=[];
+ rent_per_unit_2_Inwords: any=[];
+ floor_rent_amount_Inwords: any=[];
+ monthly_rent_amount_Inwords: any=[];
+ amount_received_cash_Inwords: any=[];
+ amount_received_bank_Inwords: any=[];
+ securtity_deposit_amount_Inwords: any=[];
+ agreement_monthly_rent_amount_Inwords: any=[];
+ agreement_security_deposit_amount_Inwords: any=[]
+ paid_monthly_rent_per_met_Inwords: any=[];
+ amount_received_cash_per_met_Inwords: any=[];
+ amount_received_bank_per_met_Inwords: any=[];
+
+ constructor(public navCtrl: NavController, public navParams: NavParams,public aws:AwsServiceProvider,public toast:ToastProvider,public qustCat:QuestionCategoryProvider,public fb:FormBuilder,public constprovider:ConstantsProvider) {
this.FormId = this.navParams.get('FormId');
this.pdDetails = this.navParams.get('pdDetails');
this.users = this.aws.getlocale();
+ this.applicants = this.pdDetails.applicat_details;
+ this.applicants=this.applicants.filter(val=>val.applicant_type==0 || val.applicant_type==1)
+ this.applicants.push({'pd_co_applicant_id':'0','applicant_name':'Others'});
+
+ this.getdropList();
+
this.rentalForms = this.fb.group(
{
- person_met:[null,Validators.compose([Validators.required])],
- property_own:[null,Validators.compose([Validators.required])],
- nature_property:[null,Validators.compose([Validators.required])],
- nature_others:[null],
- rental_home:this.fb.array([])
+ pdid: this.pdDetails.pd_id,
+ formid: this.FormId.form_id,
+ address_property:['',Validators.required],
+ state:['',Validators.required],
+ city:['',Validators.required],
+ pincode:['',Validators.required],
+ validate_visited_address:[true],
+ person_met: ['',Validators.required],
+ property_owner: ['',Validators.required],
+ property_ownership_proof_documents: ['',Validators.required],
+ nature_property: ['',Validators.required],
+ unit_type:['',Validators.required],
+ no_units:[''],
+ multistoried_building_details: this.fb.array([]),
+ property_unit_details : this.fb.array([]),
+ done_third_party_check :['',Validators.required],
+ rental_remark: [''],
})
- this.getRentalDetails();
-
-
+
+ // observe person met controls
+ this.rentalForms.controls['person_met'].valueChanges.subscribe(val => {
+ if(val && val.length>0){
+ let otherPersonMetCheck = val.filter(fVal=>fVal.id==0);
+ otherPersonMetCheck.length>0 ? this.rentalForms.addControl('other_person_met', new FormControl('', Validators.required)) : this.rentalForms.removeControl('other_person_met');
+ otherPersonMetCheck.length>0 ? this.rentalForms.addControl('other_name_person_showing_property', new FormControl('', Validators.required)) : this.rentalForms.removeControl('other_name_person_showing_property');
+ otherPersonMetCheck.length>0 ? '' : this.rentalForms.removeControl('other_name_person_type');
+
+
+ }
+ else {
+ this.rentalForms.removeControl('other_person_met');
+ this.rentalForms.removeControl('other_name_person_showing_property');
+ this.rentalForms.removeControl('other_name_person_type');
+ }
+ });
+ // observe owner of the property
+ this.rentalForms.controls['property_owner'].valueChanges.subscribe(val => {
+ if(val && val.length>0){
+ let otherOwnerCheck = val.filter(fVal=>fVal.id==0);
+ otherOwnerCheck.length>0 ? this.rentalForms.addControl('property_owner_other', new FormControl('', Validators.required)) : this.rentalForms.removeControl('property_owner_other');
+ otherOwnerCheck.length>0 ? this.rentalForms.addControl('property_owner_other_relationship', new FormControl('', Validators.required)) : this.rentalForms.removeControl('property_owner_other_relationship');
+ otherOwnerCheck.length>0 ? this.rentalForms.addControl('property_owner_other_relation_to', new FormControl('', Validators.required)) : this.rentalForms.removeControl('property_owner_other_relation_to');
+
+ }
+ else {
+ this.rentalForms.removeControl('property_owner_other');
+ this.rentalForms.removeControl('property_owner_other_relationship');
+ this.rentalForms.removeControl('other_name_person_type');
+ this.rentalForms.removeControl('property_owner_other_relation_to');
+ }
+ });
+ // observe other property type
+ this.rentalForms.controls['nature_property'].valueChanges.subscribe(val => {
+ val.id==1 ? this.rentalForms.addControl('other_nature_property', new FormControl('', Validators.required)) : this.rentalForms.removeControl('other_nature_property');
+ });
+
+ // observe unit type changes
+ this.rentalForms.controls['unit_type'].valueChanges.subscribe(val => {
+ val.id==1 ? this.rentalForms.addControl('other_unit_type', new FormControl('', Validators.required)) : this.rentalForms.removeControl('other_unit_type');
+ val.group_id==1 && val.id==6 ? this.rentalForms.removeControl('no_units') : val.group_id==2 && val.id==7 ? this.rentalForms.removeControl('no_units') : this.rentalForms.addControl('no_units', new FormControl(''));
+ val.group_id==1 && val.id==6 ? this.rentalForms.addControl('no_floor', new FormControl('',Validators.required)) : val.group_id==2 && val.id==7 ? this.rentalForms.addControl('no_floor', new FormControl('',Validators.required)) : this.rentalForms.removeControl('no_floor');
+ val.group_id==1 && val.id==6 ? this.rentalForms.addControl('multistoried_total_area', new FormControl('',Validators.required)) : val.group_id==2 && val.id==7 ? this.rentalForms.addControl('multistoried_total_area', new FormControl('',Validators.required)) : this.rentalForms.removeControl('multistoried_total_area');
+ val.group_id==1 && val.id==6 ? this.rentalForms.addControl('multistoried_uom', new FormControl('',Validators.required)) : val.group_id==2 && val.id==7 ? this.rentalForms.addControl('multistoried_uom', new FormControl('',Validators.required)) : this.rentalForms.removeControl('multistoried_uom');
+ val.group_id==1 && val.id==6 ? '' : val.group_id==2 && val.id==7 ? '' : this.rentalForms.setControl('multistoried_building_details', this.fb.array([]));
+ });
+
+ // observe visit address
+ this.rentalForms.controls['validate_visited_address'].valueChanges.subscribe(val => {
+ if(val===false){
+ this.rentalForms.addControl('other_visited_address', new FormControl('', Validators.required));
+ }
+ else {
+ this.rentalForms.removeControl('other_visited_address');
+ }
+ });
+ // get city list based on state changes
+ this.rentalForms.controls['state'].valueChanges.subscribe(val => {
+ this.qustCat.getStateWiseCities(val).subscribe(data => {
+ if (data.status == 200) {
+ this.cityList = data.records.cities;
+ this.pincodeList = data.records.pincode;
+ }
+ });
+ });
+
+ // ownership property documents during the visit
+ this.rentalForms.controls['property_ownership_proof_documents'].valueChanges.subscribe(val => {
+ val=="1" ? this.rentalForms.addControl('sighted_documents', new FormControl('', Validators.required)) : this.rentalForms.removeControl('sighted_documents');
+ val=="1" ? '' : this.rentalForms.removeControl('other_sighted_documents');
+ });
+
+ // listen third party check
+ this.rentalForms.controls['done_third_party_check'].valueChanges.subscribe(val => {
+ val=="1" ? this.rentalForms.addControl('whom_third_party_check_done', new FormControl('', Validators.required)) : this.rentalForms.removeControl('whom_third_party_check_done');
+ val=="1" ? this.rentalForms.addControl('description_third_party_check_done', new FormControl('', Validators.required)) : this.rentalForms.removeControl('description_third_party_check_done');
+ val=="1" ? this.rentalForms.addControl('rental_rates_third_party_check_done', new FormControl('', Validators.required)) : this.rentalForms.removeControl('rental_rates_third_party_check_done');
+ val=="0" ? this.rentalForms.addControl('why_third_party_check_not_done', new FormControl('', Validators.required)) : this.rentalForms.removeControl('why_third_party_check_not_done');
+ });
+
+ this.getRentalDetails();
+
+
}
ionViewDidLoad() {
console.log('ionViewDidLoad PdQuestionRentalInfoPage');
}
- createrentalHome()
+ getdropList()
{
- return this.fb.group(
- {
- complete_add:[null,Validators.compose([Validators.required])],
- area_of_property:[null,Validators.compose([Validators.required])],
- structure_property:[null,Validators.compose([Validators.required])],
- total_room:[null,Validators.compose([Validators.required])],
- is_rent:[null,Validators.compose([Validators.required])],
- date_agreement:[null,Validators.compose([Validators.required])],
- date_validity:[null,Validators.compose([Validators.required])],
- rent_agreement:[null,Validators.compose([Validators.required])],
- actual_rent:[null,Validators.compose([Validators.required])],
- photo_areegment:[null,Validators.compose([Validators.required])],
- property_photographs:[null],
- bank:[null,Validators.compose([Validators.required])],
- cash:[null,Validators.compose([Validators.required])],
- rent_each_floor:[null,Validators.compose([Validators.required])],
- total_rent:[null,Validators.compose([Validators.required])],
- related_doc_owner:[null,Validators.compose([Validators.required])],
- details_tenants:this.fb.array([]),
- third_party_check:[null,Validators.compose([Validators.required])],
- })
- }
- createTenantsDetails()
- {
- return this.fb.group(
- {
- name:[null,Validators.compose([Validators.required])],
- mobile_no:[null,Validators.compose([Validators.required])],
- tenants_seen:[null,Validators.compose([Validators.required])],
- tenants_con_owner:[null,Validators.compose([Validators.required])],
- rent_paid:[null,Validators.compose([Validators.required])],
- staying_since:[null,Validators.compose([Validators.required])],
+ 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})
+
+ }
+ // 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}];
- });
- }
+ 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}];
- addrentalHome()
- {
- const control =
this.rentalForms.get('rental_home') as FormArray;
- control.push(this.createrentalHome());
- this.addTenantsDetails(0);
- }
+ let industrialProperty = [{id:2,name:'Factory',group_id:3},{id:3,name:'Industrial Shed',group_id:3},{id:1,name:'Other (Please Specify)',group_id:3}];
+
+ this.unitTypeList.push({groupID:2,groupName:'Residential Property',groupValues:resiDentialProperty});
+ this.unitTypeList.push({groupID:3,groupName:'Commercial Property',groupValues:commercialProperty});
+ this.unitTypeList.push({groupID:4,groupName:'Industrial Property',groupValues:industrialProperty});
+
- addTenantsDetails(i)
- {
- const control = (this.rentalForms.controls['rental_home']).at(i).get('details_tenants') as FormArray;
+ //GETTING RELATIONSHIPS
+ this.qustCat.getcommondrop('RELATIONSHIPS').subscribe(res=>
+ {
+ if(res['dataStatus']==true)
+ {
+ let relationshipList: any = res['records'].filter(item => item.isactive == 1).map(element => {
+ return {id:element.relationship_id.toString(),name:element.name,group_id:1};
+ });
+ relationshipList.length > 0 ? this.relationShipList.push({groupName:'Personal',groupValues:relationshipList}):'';
+ }
+ })
- // control.controls.splice(0);
- control.push(this.createTenantsDetails());
+ //GETTING COMPANYRELATIONSHIPS;
+ this.qustCat.getcommondrop('COMPANYRELATIONSHIPS').subscribe(res=>
+ {
+ if(res['dataStatus']==true)
+ {
+ let companyRelationShipList:any = res['records'].filter(item => item.isactive == 1 && item.name != 'Others').map(element => {
+ return {id:element.company_relationship_id.toString(),name:element.name,group_id:2};
+ });
+ companyRelationShipList.length > 0 ? this.relationShipList.push({groupName:'Official',groupValues:companyRelationShipList}):'';
+ }
+ })
+
+ //GETTING STATE;
+ this.qustCat.getcommondrop('STATE').subscribe(res=>
+ {
+ if(res['dataStatus']==true)
+ {
+ this.stateList = res['records'].filter(data => data.isactive == 1);
+ }
+ })
+
+ //GETTING UOM;
+ this.qustCat.getcommondrop('UOM').subscribe(res=>
+ {
+ if(res['dataStatus']==true){
+ this.unitMeasurementList = res['records'].filter(data => data.isactive == 1 && data.is_land_uom == 1 || data.is_land_uom == 2).map(mval=>({id : mval.uom_id , name:mval.name}));
+ }
+ })
+ }
+
+// initRentalForm() {
+// return this.rentalForms = this.fb.group({
+// pdid: this.pdDetails.pd_id,
+// formid: this.FormId.form_id,
+// address_property:['',Validators.required],
+// state:['',Validators.required],
+// city:['',Validators.required],
+// pincode:['',Validators.required],
+// validate_visited_address:[true],
+// person_met: ['',Validators.required],
+// property_owner: ['',Validators.required],
+// property_ownership_proof_documents: ['',Validators.required],
+// nature_property: ['',Validators.required],
+// unit_type:['',Validators.required],
+// no_units:[''],
+// property_unit_details : this.fb.array([]),
+// done_third_party_check :['',Validators.required],
+// rental_remark: [''],
+// });
+// }
+
+ // createrentalHome()
+ // {
+ // return this.fb.group(
+ // {
+ // complete_add:[null,Validators.compose([Validators.required])],
+ // area_of_property:[null,Validators.compose([Validators.required])],
+ // structure_property:[null,Validators.compose([Validators.required])],
+ // total_room:[null,Validators.compose([Validators.required])],
+ // is_rent:[null,Validators.compose([Validators.required])],
+ // date_agreement:[null,Validators.compose([Validators.required])],
+ // date_validity:[null,Validators.compose([Validators.required])],
+ // rent_agreement:[null,Validators.compose([Validators.required])],
+ // actual_rent:[null,Validators.compose([Validators.required])],
+ // photo_areegment:[null,Validators.compose([Validators.required])],
+ // property_photographs:[null],
+ // bank:[null,Validators.compose([Validators.required])],
+ // cash:[null,Validators.compose([Validators.required])],
+ // rent_each_floor:[null,Validators.compose([Validators.required])],
+ // total_rent:[null,Validators.compose([Validators.required])],
+ // related_doc_owner:[null,Validators.compose([Validators.required])],
+ // details_tenants:this.fb.array([]),
+ // third_party_check:[null,Validators.compose([Validators.required])],
+ // })
+ // }
+
+ // other_name_person_showing_property changes
+ personShowingChanges(value: any): void {
+ if(value.length>0){
+ let otherCheck: any = value.filter(fVal=>fVal.id==1);
+ otherCheck.length >0 ? this.rentalForms.addControl('other_name_person_type', new FormControl('', Validators.required)) : this.rentalForms.removeControl('other_name_person_type');
+}
+else {
+ this.rentalForms.removeControl('other_name_person_type');
+}
+}
+
+// dynamic form control generate for other documents sighted
+getSightedDocs(value): void{
+ value.id==1 ? this.rentalForms.addControl('other_sighted_documents', new FormControl('', Validators.required)) : this.rentalForms.removeControl('other_sighted_documents');
+}
+
+// add more unit details
+addMoreUnitDetails(){
+ let control: any = this.rentalForms.controls['property_unit_details'];
+ //control.push(this.createUnitDetails(''));
+ control.push(this.createUnitDetails(''));
+}
+
+ // create unit details
+ createUnitDetails(details){
+ return this.fb.group({
+ tenant_lessees_options:['1',Validators.required],
+ name_tenant_lessees:['',Validators.required],
+ monthly_rent_amount: ['',Validators.required],
+ payment_mode: ['',Validators.required],
+ securtity_deposit_amount: ['',Validators.required],
+ property_cover_area: ['',Validators.required],
+ unit_measurement: ['',Validators.required],
+ is_rent_agreement_executed: ['',Validators.required],
+ met_tenant_lessees_options: ['',Validators.required],
+ });
+ }
+
+ // remove unit
+ removeUnit(index) {
+ let control: any = this.rentalForms.controls['property_unit_details'];
+ control.removeAt(index);
+ }
+
+ // generate payment dynamic fields
+ generatePaymentOptions(value:any,index:number,type: number){
+ if(type==1){
+ let control: any = this.rentalForms.controls['property_unit_details'];
+ 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].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].removeControl('amount_received_cash');
+ control.controls[index].removeControl('payment_received_reason');
+ }
+ else if(value && value.payment_mode.id==3){
+ 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_bank', new FormControl(value.amount_received_bank ? value.amount_received_bank : '', Validators.required));
+ control.controls[index].addControl('payment_received_reason', new FormControl(value.payment_received_reason ? value.payment_received_reason : '', Validators.required));
+ }
+ else {
+ control.controls[index].removeControl('amount_received_cash');
+ control.controls[index].removeControl('amount_received_bank');
+ control.controls[index].removeControl('payment_received_reason');
+ }
+ }
+ else if(type==2){
+ let control: any = this.rentalForms.controls['property_unit_details'];
+ 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].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].removeControl('amount_received_cash_per_met');
+ control.controls[index].removeControl('payment_received_reason_per_met');
+ }
+ else if(value && value.payment_mode_per_met.id==3){
+ 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_bank_per_met', new FormControl(value.amount_received_bank_per_met ? value.amount_received_bank_per_met : '', Validators.required));
+ control.controls[index].addControl('payment_received_reason_per_met', new FormControl(value.payment_received_reason_per_met ? value.payment_received_reason_per_met : '', Validators.required));
+ }
+ else {
+ control.controls[index].removeControl('amount_received_cash_per_met');
+ control.controls[index].removeControl('amount_received_bank_per_met');
+ control.controls[index].removeControl('payment_received_reason_per_met');
+ }
+ }
+
+ }
+
+// tenant/lessees options
+generateTenantOptions(value:any,index:number){
+ let control: any = this.rentalForms.controls['property_unit_details'];
+ if(value.tenant_lessees_options=="1"){
+ control.controls[index].addControl('name_tenant_lessees', new FormControl('', Validators.required));
+ control.controls[index].removeControl('name_tenant_lessees_reason');
+ }
+ else if(value.tenant_lessees_options=="0"){
+ control.controls[index].addControl('name_tenant_lessees_reason', new FormControl('', Validators.required));
+ control.controls[index].removeControl('name_tenant_lessees');
+ }
+ else {
+ control.controls[index].removeControl('name_tenant_lessees');
+ control.controls[index].removeControl('name_tenant_lessees_reason');
+ }
+ }
+
+ // unit of measurement generate other field
+ generateOtherunitMeasurement(value: any,index:number){
+ let control: any = this.rentalForms.controls['property_unit_details'];
+ value.unit_measurement.id=="1" ? control.controls[index].addControl('other_unit_measurement', new FormControl('', Validators.required)) : control.controls[index].removeControl('other_unit_measurement');
+
+}
+
+// generate multistoried other uom
+generateMultistoriedOtherUOM(value: any){
+ value.multistoried_uom.id=="1" ? this.rentalForms.addControl('multistoried_other_uom', new FormControl('', Validators.required)) : this.rentalForms.removeControl('multistoried_other_uom');
+}
+
+// generate Rent AgreementSeen
+generateRentAgreementSeen(value: any,index:number){
+ let control: any = this.rentalForms.controls['property_unit_details'];
+
+ if(value.is_rent_agreement_executed=="1"){
+ control.controls[index].addControl('rent_agreement_seen', new FormControl('', Validators.required))
+ }
+ else{
+ control.controls[index].removeControl('rent_agreement_seen');
+ // after no
+ control.controls[index].removeControl('rent_agreement_registered');
+ // after No
+ control.controls[index].removeControl('agreement_date');
+ control.controls[index].removeControl('agreement_no_months');
+ control.controls[index].removeControl('agreement_expiring_date');
+ control.controls[index].removeControl('rental_remaining_months');
+ control.controls[index].removeControl('agreement_monthly_rent_amount');
+ control.controls[index].removeControl('agreement_security_deposit_amount');
+ control.controls[index].removeControl('agreement_property_owners_name');
+ control.controls[index].removeControl('agreement_tenant_lessees_name');
+ control.controls[index].removeControl('differences_loanapplicant_rentagreement');
+ // remove agrement other ownres
+ control.controls[index].removeControl('agreement_property_owner_other');
+ control.controls[index].removeControl('agreement_property_owner_other_relationship');
+ control.controls[index].removeControl('agreement_property_owner_other_relation_to');
+ }
+
+}
+//genearate rent agreement registered options
+generateRegisterOptions(value: any,index:number){
+ let control: any = this.rentalForms.controls['property_unit_details'];
+ if(value.rent_agreement_seen=="1"){
+ control.controls[index].addControl('rent_agreement_registered', new FormControl('', Validators.required));
+ }
+ else{
+ control.controls[index].removeControl('rent_agreement_registered');
+ // after No
+ control.controls[index].removeControl('agreement_date');
+ control.controls[index].removeControl('agreement_no_months');
+ control.controls[index].removeControl('agreement_expiring_date');
+ control.controls[index].removeControl('rental_remaining_months');
+ control.controls[index].removeControl('agreement_monthly_rent_amount');
+ control.controls[index].removeControl('agreement_security_deposit_amount');
+ control.controls[index].removeControl('agreement_property_owners_name');
+ control.controls[index].removeControl('agreement_tenant_lessees_name');
+ control.controls[index].removeControl('differences_loanapplicant_rentagreement');
+ // remove agrement other ownres
+ control.controls[index].removeControl('agreement_property_owner_other');
+ control.controls[index].removeControl('agreement_property_owner_other_relationship');
+ control.controls[index].removeControl('agreement_property_owner_other_relation_to');
+ }
+
+}
+//genearate if rent agreement yes registered details
+generateRegisterDetails(value: any,index:number){
+ let control: any = this.rentalForms.controls['property_unit_details'];
+ if(value.rent_agreement_registered=="1"){
+ control.controls[index].addControl('agreement_date', new FormControl('', Validators.required));
+ control.controls[index].addControl('agreement_no_months', new FormControl('', Validators.required));
+ control.controls[index].addControl('agreement_expiring_date', new FormControl(''));
+ control.controls[index].addControl('rental_remaining_months', new FormControl(''));
+ control.controls[index].addControl('agreement_monthly_rent_amount', new FormControl('', Validators.required));
+ control.controls[index].addControl('agreement_security_deposit_amount', new FormControl('', Validators.required));
+ control.controls[index].addControl('agreement_security_deposit_amount', new FormControl('', Validators.required));
+ control.controls[index].addControl('agreement_property_owners_name', new FormControl('', Validators.required));
+ control.controls[index].addControl('agreement_tenant_lessees_name', new FormControl('', Validators.required));
+ control.controls[index].addControl('differences_loanapplicant_rentagreement', new FormControl(''));
+
+ }
+ else if(value.rent_agreement_registered=="0"){
+ control.controls[index].addControl('agreement_date', new FormControl('', Validators.required));
+ control.controls[index].addControl('agreement_no_months', new FormControl('', Validators.required));
+ control.controls[index].addControl('agreement_expiring_date', new FormControl(''));
+ control.controls[index].addControl('rental_remaining_months', new FormControl(''));
+ control.controls[index].addControl('agreement_monthly_rent_amount', new FormControl('', Validators.required));
+ control.controls[index].addControl('agreement_security_deposit_amount', new FormControl('', Validators.required));
+ control.controls[index].addControl('agreement_security_deposit_amount', new FormControl('', Validators.required));
+ control.controls[index].addControl('agreement_property_owners_name', new FormControl('', Validators.required));
+ control.controls[index].addControl('agreement_tenant_lessees_name', new FormControl('', Validators.required));
+ control.controls[index].addControl('differences_loanapplicant_rentagreement', new FormControl(''));
+ }
+ else{
+ control.controls[index].removeControl('agreement_date');
+ control.controls[index].removeControl('agreement_no_months');
+ control.controls[index].removeControl('agreement_expiring_date');
+ control.controls[index].removeControl('rental_remaining_months');
+ control.controls[index].removeControl('agreement_monthly_rent_amount');
+ control.controls[index].removeControl('agreement_security_deposit_amount');
+ control.controls[index].removeControl('agreement_property_owners_name');
+ control.controls[index].removeControl('agreement_tenant_lessees_name');
+ control.controls[index].removeControl('differences_loanapplicant_rentagreement');
+ // remove agrement other ownres
+ control.controls[index].removeControl('agreement_property_owner_other');
+ control.controls[index].removeControl('agreement_property_owner_other_relationship');
+ control.controls[index].removeControl('agreement_property_owner_other_relation_to');
}
- deleteTenantsDetails(rentIndex,TenantsIndex)
- {
- const control = (this.rentalForms.controls['rental_home']).at(rentIndex).get('details_tenants') as FormArray;
+}
+
+// calculate expiry date
+// calculateExpiryDate(e: any,index){
+// let control: any = this.rentalForms.controls['property_unit_details'];
+// // let getSeletedDate: any=control.value[index].agreement_date ? this.pipe.transform(control.value[index].agreement_date, 'yyyy/MM/dd'): '';
+// let getSeletedDate: any='';
+// let getEnteredMonth = control.value[index].agreement_no_months > 0 ? control.value[index].agreement_no_months : '0';
+// if(getSeletedDate && getEnteredMonth>0){
+// let modifySeletedDate:any = new Date(new Date(getSeletedDate).setMonth(new Date(getSeletedDate).getMonth() + Number(getEnteredMonth)));
+// modifySeletedDate.setDate(modifySeletedDate.getDate() - 1);
+// // let getExpiryDate=this.pipe.transform(modifySeletedDate, 'dd/MM/yyyy');
+// let getExpiryDate='';
+// control.controls[index].controls['agreement_expiring_date'].setValue(getExpiryDate);
+// // calculate remaining month
+// if(modifySeletedDate >= new Date()){
+// let currentDate:any = new Date();
+// // currentDate = this.pipe.transform(currentDate, 'yyyy/MM/dd');
+// currentDate = '';
+// let remaingMonths;
+// remaingMonths = (modifySeletedDate.getFullYear() - new Date().getFullYear()) * 12;
+// remaingMonths += modifySeletedDate.getMonth() - new Date().getMonth();
+// control.controls[index].controls['rental_remaining_months'].setValue(remaingMonths);
+// }
+// else{
+// control.controls[index].controls['rental_remaining_months'].setValue(0);
+// }
+// }
+// else {
+// control.controls[index].controls['agreement_expiring_date'].setValue('');
+// control.controls[index].controls['rental_remaining_months'].setValue('');
+
+// }
+
+// }
+
+calculateExpiryDate(e: any,index){
+ let control: any = this.rentalForms.controls['property_unit_details'];
+ let getSeletedDate: any=control.value[index].agreement_date ? this.pipe.transform(control.value[index].agreement_date, 'yyyy/MM/dd'): '';
+ let getEnteredMonth = control.value[index].agreement_no_months > 0 ? control.value[index].agreement_no_months : '0';
+ if(getSeletedDate && getEnteredMonth>0){
+ let modifySeletedDate:any = new Date(new Date(getSeletedDate).setMonth(new Date(getSeletedDate).getMonth() + Number(getEnteredMonth)));
+ modifySeletedDate.setDate(modifySeletedDate.getDate() - 1);
+ let getExpiryDate=this.pipe.transform(modifySeletedDate, 'dd/MM/yyyy');
+ console.log('getExpiryDate',getExpiryDate);
+ control.controls[index].controls['agreement_expiring_date'].setValue(getExpiryDate);
+ // calculate remaining month
+ if(modifySeletedDate >= new Date()){
+ let currentDate:any = new Date();
+ currentDate = this.pipe.transform(currentDate, 'yyyy/MM/dd');
+ let remaingMonths;
+ remaingMonths = (modifySeletedDate.getFullYear() - new Date().getFullYear()) * 12;
+ remaingMonths += modifySeletedDate.getMonth() - new Date().getMonth();
+ console.log('remaingMonths',remaingMonths);
+ control.controls[index].controls['rental_remaining_months'].setValue(remaingMonths);
+ }
+ else{
+ control.controls[index].controls['rental_remaining_months'].setValue(0);
+ }
+ }
+ else {
+ control.controls[index].controls['agreement_expiring_date'].setValue('');
+ control.controls[index].controls['rental_remaining_months'].setValue('');
+
+ }
+
+}
+
+// generate other owners as per rent agreement
+generateAgreementOtherOwners(value:any,index:number) {
+ let control: any = this.rentalForms.controls['property_unit_details'];
+ if(value && value.length>0){
+ let otherOwnerCheck = value.filter(fVal=>fVal.id==0);
+ otherOwnerCheck.length>0 ? control.controls[index].addControl('agreement_property_owner_other', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owner_other');
+ otherOwnerCheck.length>0 ? control.controls[index].addControl('agreement_property_owner_other_relationship', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owner_other_relationship');
+ otherOwnerCheck.length>0 ? control.controls[index].addControl('agreement_property_owner_other_relation_to', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owner_other_relation_to');
+
+ }
+ else {
+ control.controls[index].removeControl('agreement_property_owner_other');
+ control.controls[index].removeControl('agreement_property_owner_other_relationship');
+ control.controls[index].removeControl('agreement_property_owner_other_relation_to');
+ }
+}
+
+// validate agreement amount
+validateAgreementAmt(actualRent:number,agreementRent:number){
+ if(actualRent>0 && agreementRent>0){
+ return (actualRent >= agreementRent) ? Number(actualRent) - Number(agreementRent) : Number(agreementRent) - Number(actualRent);
+ }
+ else{
+ return "0";
+ }
+
+}
+
+// generate tenant met details
+generateTenantMetDetails(value: any, index: number){
+ let control: any = this.rentalForms.controls['property_unit_details'];
+ if(value.met_tenant_lessees_options=="1"){
+ // remove reason
+ control.controls[index].removeControl('name_tenant_lessees_reason_per_met');
+
+ control.controls[index].addControl('name_tenant_lessees_per_met', new FormControl('', Validators.required));
+ control.controls[index].addControl('property_owner_per_met', new FormControl('', Validators.required));
+ control.controls[index].addControl('paid_monthly_rent_per_met', new FormControl('', Validators.required));
+ control.controls[index].addControl('period_of_stay_per_met', new FormControl('', Validators.required));
+ control.controls[index].addControl('payment_mode_per_met', new FormControl('', Validators.required));
+ control.controls[index].addControl('payment_difference_per_met', new FormControl(''));
+
+ }
+ else{
+ control.controls[index].removeControl('name_tenant_lessees_per_met');
+ control.controls[index].removeControl('property_owner_per_met');
+ control.controls[index].removeControl('paid_monthly_rent_per_met');
+ control.controls[index].removeControl('period_of_stay_per_met');
+ control.controls[index].removeControl('payment_mode_per_met');
+ control.controls[index].removeControl('payment_difference_per_met');
+
+
+ // remove other owner details
+ control.controls[index].removeControl('property_owner_other_per_met');
+ control.controls[index].removeControl('property_owner_other_relationship_per_met');
+ control.controls[index].removeControl('property_owner_other_relation_to_per_met');
+ // remove paymnet options
+ control.controls[index].removeControl('amount_received_cash_per_met');
+ control.controls[index].removeControl('amount_received_bank_per_met');
+ control.controls[index].removeControl('payment_received_reason_per_met');
+ // add reason
+ control.controls[index].addControl('name_tenant_lessees_reason_per_met', new FormControl('', Validators.required));
+
+
+ }
+}
+
+// generate met others owner
+generateMetOtherOwners(value: any, index: number){
+ let control: any = this.rentalForms.controls['property_unit_details'];
+ if(value.property_owner_per_met.length>0){
+ let otherCheck: any = value.property_owner_per_met.filter(fVal=>fVal.id==0);
+ otherCheck.length >0 ? control.controls[index].addControl('property_owner_other_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_other_per_met');
+ otherCheck.length >0 ? control.controls[index].addControl('property_owner_other_relationship_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_other_relationship_per_met');
+ otherCheck.length >0 ? control.controls[index].addControl('property_owner_other_relation_to_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_other_relation_to_per_met');
+
+}
+else {
+ control.controls[index].removeControl('property_owner_other_per_met');
+ control.controls[index].removeControl('property_owner_other_relationship_per_met');
+ control.controls[index].removeControl('property_owner_other_relation_to_per_met');
+
+}
+
+}
+
+// generate floor rows
+generateFloor(e:any): void{
+ let control = this.rentalForms.controls['multistoried_building_details'];
+ if(e.target.value && Math.round(e.target.value)!=0){
+
+ if(Math.round(e.target.value) > this.rentalForms.value.multistoried_building_details.length){
+ let rowValue = Math.round(e.target.value)-this.rentalForms.value.multistoried_building_details.length;
+ for(let i=rowValue;i>0;i--){
+ control.push(this.createFloorDetails(''));
+ }
+ }
+ else if(Math.round(e.target.value) < this.rentalForms.value.multistoried_building_details.length){
+ let rowValue = this.rentalForms.value.multistoried_building_details.length-Math.round(e.target.value);
+ for(let i=rowValue;i>0;i--){
+ control.removeAt(this.rentalForms.value.multistoried_building_details.length-1);
+ }
+ }
+ }
+ else if(e.target.value && Math.round(e.target.value)==0){
+ control.controls = [];
+ control.setValue([]);
+ }
+ else{
+ control.controls = [];
+ control.setValue([]);
+ }
+ e.stopPropagation();
+}
+
+// create floor details
+createFloorDetails(details){
+ if(details){
+ return this.fb.group({
+ floor_level: [this.rentalForms.value.multistoried_building_details.length==0 ? 'Ground Floor' : this.rentalForms.value.multistoried_building_details.length+' Floor', Validators.compose([Validators.required])],
+ no_units_in_floor: ['', Validators.compose([Validators.required])],
+ unit_rent_difference_options : ['', Validators.compose([Validators.required])],
+ floor_unit_details : this.fb.array([]),
+ floor_rent_amount: [''],
+ });
+ }
+ else{
+ return this.fb.group({
+ floor_level: [this.rentalForms.value.multistoried_building_details.length==0 ? 'Ground Floor' : this.rentalForms.value.multistoried_building_details.length+' Floor', Validators.compose([Validators.required])],
+ no_units_in_floor: ['', Validators.compose([Validators.required])],
+ unit_rent_difference_options : ['', Validators.compose([Validators.required])],
+ floor_unit_details : this.fb.array([]),
+ floor_rent_amount: [''],
+ });
+ }
+
+}
+
+// generate floor unit details
+generateFloorUnit(values:any, index:number){
+ let control: any = this.rentalForms.controls['multistoried_building_details'];
+ control = control.controls[index];
+ control= control.controls['floor_unit_details'];
+ if(values.no_units_in_floor>0 && values.unit_rent_difference_options=="0"){
+ if(Math.round(values.no_units_in_floor) > control.value.length){
+ let rowValue = Math.round(values.no_units_in_floor)-control.value.length;
+ for(let i=rowValue;i>0;i--){
+ control.push(this.createFloorUnitDetails(2));
+ }
+ }
+ else if(Math.round(values.no_units_in_floor) < control.value.length){
+ let rowValue = control.value.length-Math.round(values.no_units_in_floor);
+ for(let i=rowValue;i>0;i--){
+ control.removeAt(control.value.length-1);
+ }
+ }
+ else if(Math.round(values.no_units_in_floor)==0){
+ control.controls = [];
+ control.setValue([]);
+ }
+ else{
+ control.controls = [];
+ control.setValue([]);
+ }
+ this.calculateFloorRentAmt(values,index);
+
+ }
+ else if(values.no_units_in_floor>0 && values.unit_rent_difference_options=="1") {
+ control.controls = [];
+ control.setValue([]);
+ control.push(this.createFloorUnitDetails(1));
+ this.calculateFloorRentAmt(values,index);
+ }
+ else {
+ control.controls = [];
+ control.setValue([]);
+ }
+
+}
+
+// create floor unit details
+createFloorUnitDetails(type:number){
+ if(type==1){
+ return this.fb.group({
+ rent_per_unit: ['', Validators.compose([Validators.required])],
+ amount: [''],
+ });
+ }
+ else if(type==2){
+ return this.fb.group({
+ rent_per_unit: ['', Validators.compose([Validators.required])],
+ });
+ }
+
+}
+// calculate floor rent amount
+calculateFloorRentAmt(values: any, index: number){
+ if(values.unit_rent_difference_options=="1"){
+ let control: any = this.rentalForms.controls['multistoried_building_details'];
+ let unitcontrol = control.controls[index];
+ unitcontrol= unitcontrol.controls['floor_unit_details'];
+ if(unitcontrol.value[unitcontrol.value.length-1].rent_per_unit>0 && values.no_units_in_floor>0){
+ unitcontrol.controls[unitcontrol.value.length-1].controls['amount'].setValue(unitcontrol.value[unitcontrol.value.length-1].rent_per_unit * values.no_units_in_floor);
+ control.controls[index].controls['floor_rent_amount'].setValue(unitcontrol.value[unitcontrol.value.length-1].rent_per_unit * values.no_units_in_floor);
+ }
+ else{
+ unitcontrol.controls[unitcontrol.value.length-1].controls['amount'].setValue('');
+ control.controls[index].controls['floor_rent_amount'].setValue('');
+
+ }
+ }
+ else if(values.unit_rent_difference_options=="0"){
+ let control: any = this.rentalForms.controls['multistoried_building_details'];
+ let unitcontrol = control.controls[index];
+ unitcontrol= unitcontrol.controls['floor_unit_details'];
+ // console.log(unitcontrol)
+ let getunitValues = unitcontrol.value.filter(val=>val.rent_per_unit!='');
+ if(getunitValues.length>0){
+ control.controls[index].controls['floor_rent_amount'].setValue(getunitValues.map(mval=>mval.rent_per_unit).reduce((acc, val) => Number(acc) + Number(val), 0));
+ }
+ else{
+ control.controls[index].controls['floor_rent_amount'].setValue('');
+
+ }
+ }
+
+}
+
+compareObjects(o1: any, o2: any) {
+ if(o1.id == o2.id && o1.group_id == o2.group_id)
+ return true;
+ else return false
+}
+compareSingleObjects(o1: any, o2: any) {
+ if(o1.id == o2.id)
+ return true;
+ else return false
+}
+ // createTenantsDetails()
+ // {
+ // return this.fb.group(
+ // {
+ // name:[null,Validators.compose([Validators.required])],
+ // mobile_no:[null,Validators.compose([Validators.required])],
+ // tenants_seen:[null,Validators.compose([Validators.required])],
+ // tenants_con_owner:[null,Validators.compose([Validators.required])],
+ // rent_paid:[null,Validators.compose([Validators.required])],
+ // staying_since:[null,Validators.compose([Validators.required])],
+
+ // });
+ // }
+
+ // addrentalHome()
+ // {
+ // const control = this.rentalForms.get('rental_home') as FormArray;
+ // control.push(this.createrentalHome());
+ // this.addTenantsDetails(0);
+ // }
+
+ // addTenantsDetails(i)
+ // {
+ // const control = (this.rentalForms.controls['rental_home']).at(i).get('details_tenants') as FormArray;
+
+ // // control.controls.splice(0);
+ // control.push(this.createTenantsDetails());
+
+ // }
+
+ // deleteTenantsDetails(rentIndex,TenantsIndex)
+ // {
+ // const control = (this.rentalForms.controls['rental_home']).at(rentIndex).get('details_tenants') as FormArray;
- control.removeAt(TenantsIndex);
- }
+ // control.removeAt(TenantsIndex);
+ // }
- deleterentalHome(i)
- {
- const control = (this.rentalForms.controls['rental_home']) as FormArray;
- if(control.length==1)
- {
- this.rentalForms.controls['rental_home'].reset();
- }else
- {
- control.removeAt(i);
- }
- }
- saveRentalDetails(answerData)
- {
- let records:any={}
-
-
-// if(this.rentalForms.valid){
- records.pdid = this.pdDetails.pd_id;
- records.formid = this.FormId.form_id;
- records.fk_createdby = this.users;
- records.person_met = answerData.person_met;
- records.property_own = answerData.property_own;
- records.nature_property = answerData.nature_property;
- if(answerData.nature_property=='others')
- {
- records.nature_others = answerData.nature_others
- }
- records.rental_home = answerData.rental_home;
- Object.keys(records.rental_home).forEach((key) => (records.rental_home[key]==null) && delete answerData[key]);
-
- this.qustCat.saveForm(records).subscribe(res=>
+ // deleterentalHome(i)
+ // {
+ // const control = (this.rentalForms.controls['rental_home']) as FormArray;
+ // if(control.length==1)
+ // {
+ // this.rentalForms.controls['rental_home'].reset();
+ // }else
+ // {
+ // control.removeAt(i);
+ // }
+ // }
+ saveRentalDetails(answerData) {
+ console.log('answerData',answerData);
+ answerData.fk_createdby = this.users;
+ console.log('answerData',answerData);
+ this.qustCat.saveForm(answerData).subscribe(res=>
{
if(res['dataStatus']==true)
{
@@ -146,85 +882,273 @@ export class PdQuestionRentalInfoPage {
},2000);
}
})
- // }else
- // {
- // this.toast.pdTriggerappmessage('Enter All Field');
- // }
}
+// s(answerData)
+// {
+// let records:any={}
+
+
+// // if(this.rentalForms.valid){
+// records.pdid = this.pdDetails.pd_id;
+// records.formid = this.FormId.form_id;
+// records.fk_createdby = this.users;
+// records.person_met = answerData.person_met;
+// records.property_own = answerData.property_own;
+// records.nature_property = answerData.nature_property;
+// if(answerData.nature_property=='others')
+// {
+// records.nature_others = answerData.nature_others
+// }
+// records.rental_home = answerData.rental_home;
+// Object.keys(records.rental_home).forEach((key) => (records.rental_home[key]==null) && delete answerData[key]);
+
+// this.qustCat.saveForm(records).subscribe(res=>
+// {
+// if(res['dataStatus']==true)
+// {
+// this.toast.pdTriggerappmessage('Record Saved Successfully.!');
+// setTimeout(()=>{
+// this.navCtrl.pop();
+// },2000);
+// }
+// })
+// // }else
+// // {
+// // this.toast.pdTriggerappmessage('Enter All Field');
+// // }
+// }
+
getRentalDetails()
{
- let records = { 'pd_id': this.pdDetails.pd_id, 'pd_form_id': this.FormId.form_id };
- this.qustCat.retiverForm(records).subscribe(res=>
- {
- if(res['dataStatus']==true)
- {
- let rentalDetails = res['records'];
- var rentalData = Object.keys(res['records'].rental_home
- ).map(function(key) {
- return res['records'].rental_home
- [key];
- });
- var tanantsData = [];
- var control = (this.rentalForms.controls['rental_home']) as FormArray;
- var tanantscontrol;
- rentalData.forEach((val,index)=>
- {
-
- // this.addrentalHome();
- // tanantsData.push(Object.keys(val.details_tenants).map(function(key)
- // {
-
-
- // return val.details_tenants[key];
- // }));
- rentalData[index].details_tenants = Object.keys(val.details_tenants).map(function(key)
- {
-
-
- return val.details_tenants[key];
- });
- control.push(this.createrentalHome());
- tanantscontrol = (this.rentalForms.controls['rental_home']).at(index).get('details_tenants') as FormArray;
-
- rentalData[index].details_tenants.forEach((val,key)=>
- {
- //rentalData[index].details_tenants = val;
-
- // rentalData[index].details_tenants = [key];
- tanantscontrol.push(this.createTenantsDetails());
- });
-
- // control[index].details_tenants =tanantscontrol;
+ let records = { 'pd_id': this.pdDetails.pd_id, 'pd_form_id': this.FormId.form_id };
+
+
+
+ this.qustCat.retiverForm(records).subscribe(res=> {
+ if(res['dataStatus']==true)
+ {
+
+ let rentalDetails = res['records'];
+ rentalDetails.pdid = this.pdDetails.pd_id,
+ rentalDetails.formid = this.FormId.form_id;
+ rentalDetails.other_name_person_type ? this.rentalForms.addControl('other_name_person_type', new FormControl('', Validators.required)): this.rentalForms.removeControl('other_name_person_type');
+ rentalDetails.other_sighted_documents ? this.rentalForms.addControl('other_sighted_documents', new FormControl('', Validators.required)) : this.rentalForms.removeControl('other_sighted_documents');
+
+ //get Multistoried Building Details
+ if(res['records'].multistoried_building_details){
+ let selectedMultistoriedBuilding = Object.keys(res['records'].multistoried_building_details).map(function (key) {
+ return res['records'].multistoried_building_details[key];
});
- this.rentalForms.controls['person_met'].setValue(rentalDetails.person_met);
- this.rentalForms.controls['property_own'].setValue(rentalDetails.property_own);
- this.rentalForms.controls['nature_property'].setValue(rentalDetails.nature_property);
- if(rentalDetails.nature_property=='others'){
- this.rentalForms.controls['nature_others'].
- setValue(rentalDetails.nature_others);
+
+ if(selectedMultistoriedBuilding.length>0){
+ let control: any = this.rentalForms.controls['multistoried_building_details'];
+ selectedMultistoriedBuilding.forEach((floorElement,floorIndex)=>{
+ control.push(this.createFloorDetails(''));
+ let unitControl = control.controls[floorIndex];
+ unitControl= unitControl.controls['floor_unit_details'];
+ floorElement.floor_unit_details.forEach((unitElement,unitIndex) => {
+ floorElement.unit_rent_difference_options=="0" ? unitControl.push(this.createFloorUnitDetails(2)) : unitControl.push(this.createFloorUnitDetails(1));
+ });
+ });
+ }
+ }
+
+ // get property unit details
+ if(rentalDetails.property_unit_details){
+ let selectedUnitDetails = Object.keys(rentalDetails.property_unit_details).map(function (key) {
+ return rentalDetails.property_unit_details[key];
+ });
+ if(selectedUnitDetails.length>0){
+ selectedUnitDetails.forEach((element,index) => {
+ let control: any = this.rentalForms.controls['property_unit_details'];
+ control.push(this.createUnitDetails(''));
+
+ (element.name_tenant_lessees && element.tenant_lessees_options=="1") ? control.controls[index].addControl('name_tenant_lessees', new FormControl('', Validators.required)) : control.controls[index].removeControl('name_tenant_lessees');
+ (element.name_tenant_lessees_reason && element.tenant_lessees_options=="0") ? control.controls[index].addControl('name_tenant_lessees_reason', new FormControl('', Validators.required)) : control.controls[index].removeControl('name_tenant_lessees_reason');
+ // for payment options
+ 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');
+
+ // 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');
+ // rent agreement seen
+ element.rent_agreement_seen ? control.controls[index].addControl('rent_agreement_seen', new FormControl('', Validators.required)) : control.controls[index].removeControl('rent_agreement_seen');
+ element.rent_agreement_registered ? control.controls[index].addControl('rent_agreement_registered', new FormControl('', Validators.required)) : control.controls[index].removeControl('rent_agreement_registered');
+ element.agreement_date ? control.controls[index].addControl('agreement_date', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_date');
+ element.agreement_no_months ? control.controls[index].addControl('agreement_no_months', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_no_months');
+ element.agreement_expiring_date ? control.controls[index].addControl('agreement_expiring_date', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_expiring_date');
+ (element.rental_remaining_months=='' || element.rental_remaining_months>=0) ? control.controls[index].addControl('rental_remaining_months', new FormControl('', Validators.required)) : control.controls[index].removeControl('rental_remaining_months');
+ element.agreement_monthly_rent_amount ? control.controls[index].addControl('agreement_monthly_rent_amount', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_monthly_rent_amount');
+ element.agreement_security_deposit_amount ? control.controls[index].addControl('agreement_security_deposit_amount', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_security_deposit_amount');
+ element.differences_loanapplicant_rentagreement ? control.controls[index].addControl('differences_loanapplicant_rentagreement', new FormControl('', Validators.required)) : control.controls[index].removeControl('differences_loanapplicant_rentagreement');
+
+ //agreement owners
+ element.agreement_property_owners_name ? control.controls[index].addControl('agreement_property_owners_name', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owners_name');
+ element.agreement_property_owner_other ? control.controls[index].addControl('agreement_property_owner_other', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owner_other');
+ element.agreement_property_owner_other_relationship ? control.controls[index].addControl('agreement_property_owner_other_relationship', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owner_other_relationship');
+ element.agreement_property_owner_other_relation_to ? control.controls[index].addControl('agreement_property_owner_other_relation_to', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_property_owner_other_relation_to');
+
+ // name of tenant/lessess as agreement
+ element.agreement_tenant_lessees_name ? control.controls[index].addControl('agreement_tenant_lessees_name', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_tenant_lessees_name');
+
+ //met tenant details
+ element.name_tenant_lessees_per_met ? control.controls[index].addControl('name_tenant_lessees_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('name_tenant_lessees_per_met');
+ element.name_tenant_lessees_reason_per_met ? control.controls[index].addControl('name_tenant_lessees_reason_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('name_tenant_lessees_reason_per_met');
+ element.property_owner_per_met ? control.controls[index].addControl('property_owner_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_per_met');
+ element.property_owner_other_per_met ? control.controls[index].addControl('property_owner_other_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_other_per_met');
+ element.property_owner_other_relationship_per_met ? control.controls[index].addControl('property_owner_other_relationship_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_other_relationship_per_met');
+ element.property_owner_other_relation_to_per_met ? control.controls[index].addControl('property_owner_other_relation_to_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('property_owner_other_relation_to_per_met');
+
+ // tennat payment
+ 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_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');
+
+ this.inWords(element.amount_received_cash != '' ? +element.amount_received_cash : '',index,6);
+ this.inWords(element.amount_received_bank != '' ? +element.amount_received_bank : '',index,7);
+ this.inWords(element.securtity_deposit_amount != '' ? +element.securtity_deposit_amount : '',index,8);
+ this.inWords(element.agreement_monthly_rent_amount != '' ? +element.agreement_monthly_rent_amount : '',index,9);
+ this.inWords(element.agreement_security_deposit != '' ? +element.agreement_security_deposit :'',index,10);
+ this.inWords(element.paid_monthly_rent_per_met != '' ? +element.paid_monthly_rent_per_met : '',index,11);
+ this.inWords(element.amount_received_cash_per_met != '' ? +element.amount_received_cash_per_met : '',index,12);
+ this.inWords(element.amount_received_bank_per_met != '' ? +element.amount_received_bank_per_met : '',index,13);
+
+ });
+ }
}
-
- this.rentalForms.controls['rental_home'].setValue(rentalData);
- }else
- {
- this.addrentalHome();
- // this.addTenantsDetails(0);
+ this.rentalForms.patchValue(rentalDetails);
}
- })
- }
- createTenantsDetailswithData(index,data)
- {
- return this.fb.group(
- {
- name:[data.name],
- mobile_no:[data.mobile_no],
- tenants_seen:[data.tenants_seen],
- tenants_con_owner:[data.tenants_con_owner],
- rent_paid:[data.rent_paid],
- staying_since:[data.staying_since]
+ else{
+ let control: any = this.rentalForms.controls['property_unit_details'];
+ control.push(this.createUnitDetails(''));
+
+ }
+
+
});
+
+ // this.qustCat.retiverForm(records).subscribe(res=>
+ // {
+ // if(res['dataStatus']==true)
+ // {
+ // let rentalDetails = res['records'];
+ // var rentalData = Object.keys(res['records'].rental_home
+ // ).map(function(key) {
+ // return res['records'].rental_home
+ // [key];
+
+ // });
+ // var tanantsData = [];
+ // var control = (this.rentalForms.controls['rental_home']) as FormArray;
+ // var tanantscontrol;
+ // rentalData.forEach((val,index)=>
+ // {
+
+ // // this.addrentalHome();
+ // // tanantsData.push(Object.keys(val.details_tenants).map(function(key)
+ // // {
+
+
+ // // return val.details_tenants[key];
+ // // }));
+ // rentalData[index].details_tenants = Object.keys(val.details_tenants).map(function(key)
+ // {
+
+
+ // return val.details_tenants[key];
+ // });
+ // // control.push(this.createrentalHome());
+ // tanantscontrol = (this.rentalForms.controls['rental_home']).at(index).get('details_tenants') as FormArray;
+
+ // rentalData[index].details_tenants.forEach((val,key)=>
+ // {
+ // //rentalData[index].details_tenants = val;
+
+ // // rentalData[index].details_tenants = [key];
+ // // tanantscontrol.push(this.createTenantsDetails());
+ // });
+
+ // // control[index].details_tenants =tanantscontrol;
+ // });
+ // this.rentalForms.controls['person_met'].setValue(rentalDetails.person_met);
+ // this.rentalForms.controls['property_own'].setValue(rentalDetails.property_own);
+ // this.rentalForms.controls['nature_property'].setValue(rentalDetails.nature_property);
+ // if(rentalDetails.nature_property=='others'){
+ // this.rentalForms.controls['nature_others'].
+ // setValue(rentalDetails.nature_others);
+ // }
+
+ // this.rentalForms.controls['rental_home'].setValue(rentalData);
+ // }else
+ // {
+ // // this.addrentalHome();
+ // // this.addTenantsDetails(0);
+ // }
+ // })
+ }
+ // createTenantsDetailswithData(index,data)
+ // {
+ // return this.fb.group(
+ // {
+ // name:[data.name],
+ // mobile_no:[data.mobile_no],
+ // tenants_seen:[data.tenants_seen],
+ // tenants_con_owner:[data.tenants_con_owner],
+ // rent_paid:[data.rent_paid],
+ // staying_since:[data.staying_since]
+ // });
+ // }
+
+ inWords(e,i,flag){
+ console.log(e,i,flag);
+ switch(flag){
+ case 1 :
+ this.rent_per_unit_Inwords[i] = this.constprovider.convertNumberToWords(e);
+ break;
+ case 2 :
+ this.amount_Inwords[i] = this.constprovider.convertNumberToWords(e);
+ break;
+ case 3 :
+ this.rent_per_unit_2_Inwords[i] = this.constprovider.convertNumberToWords(e);
+ break;
+ case 4 :
+ this.floor_rent_amount_Inwords[i] = this.constprovider.convertNumberToWords(e);
+ break;
+ case 5 :
+ this.monthly_rent_amount_Inwords[i] = this.constprovider.convertNumberToWords(e);
+ break;
+ case 6 :
+ this.amount_received_cash_Inwords[i] = this.constprovider.convertNumberToWords(e);
+ break;
+ case 7 :
+ this.amount_received_bank_Inwords[i] = this.constprovider.convertNumberToWords(e);
+ break;
+ case 8 :
+ this.securtity_deposit_amount_Inwords[i] = this.constprovider.convertNumberToWords(e);
+ break;
+ case 9 :
+ this.agreement_monthly_rent_amount_Inwords[i] = this.constprovider.convertNumberToWords(e);
+ break;
+ case 10:
+ this.agreement_security_deposit_amount_Inwords[i] = this.constprovider.convertNumberToWords(e);
+ break;
+ case 11 :
+ this.paid_monthly_rent_per_met_Inwords[i] = this.constprovider.convertNumberToWords(e);
+ break;
+ case 12 :
+ this.amount_received_cash_per_met_Inwords[i] = this.constprovider.convertNumberToWords(e);
+ break;
+ case 13 :
+ this.amount_received_bank_per_met_Inwords[i] = this.constprovider.convertNumberToWords(e);
+ break;
+ }
}
validateAllFormFields(formGroup: any) {
diff --git a/src/providers/constants/constants.ts b/src/providers/constants/constants.ts
index 5ee8364e..bacf2525 100755
--- a/src/providers/constants/constants.ts
+++ b/src/providers/constants/constants.ts
@@ -32,86 +32,150 @@ public commonimage = "http://ssa.sineedge.com/sparqapi/logo/avatar.jpg";
return CurrentDate.toString();
}
- convertNumberToWords(amount) {
- var words = new Array();
- words[0] = '';
- words[1] = 'One';
- words[2] = 'Two';
- words[3] = 'Three';
- words[4] = 'Four';
- words[5] = 'Five';
- words[6] = 'Six';
- words[7] = 'Seven';
- words[8] = 'Eight';
- words[9] = 'Nine';
- words[10] = 'Ten';
- words[11] = 'Eleven';
- words[12] = 'Twelve';
- words[13] = 'Thirteen';
- words[14] = 'Fourteen';
- words[15] = 'Fifteen';
- words[16] = 'Sixteen';
- words[17] = 'Seventeen';
- words[18] = 'Eighteen';
- words[19] = 'Nineteen';
- words[20] = 'Twenty';
- words[30] = 'Thirty';
- words[40] = 'Forty';
- words[50] = 'Fifty';
- words[60] = 'Sixty';
- words[70] = 'Seventy';
- words[80] = 'Eighty';
- words[90] = 'Ninety';
- amount = amount.toString();
- var atemp = amount.split(".");
- var number = atemp[0].split(",").join("");
- var n_length = number.length;
- let value:any = "";
- var words_string = "";
- if (n_length <= 9) {
- var n_array:any = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0);
- var received_n_array = new Array();
- for (var i = 0; i < n_length; i++) {
- received_n_array[i] = number.substr(i, 1);
- }
- for (var i = 9 - n_length, j = 0; i < 9; i++, j++) {
- n_array[i] = received_n_array[j];
- }
- for (var i = 0, j = 1; i < 9; i++, j++) {
- if (i == 0 || i == 2 || i == 4 || i == 7) {
- if (n_array[i] == 1) {
- n_array[j] = 10 + parseInt(n_array[j]);
- n_array[i] = 0;
- }
+ convertNumberToWords(price) {
+ price = price.toString();
+ let atemp = price.split(".");
+ let amount = atemp[0];
+
+ var sglDigit = ["Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"],
+ dblDigit = ["Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"],
+ tensPlace = ["", "Ten", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"],
+
+ handle_tens = function(dgt, prevDgt) {
+ return 0 == dgt ? "" : " " + (1 == dgt ? dblDigit[prevDgt] : tensPlace[dgt])
+ },
+ handle_utlc = function(dgt, nxtDgt, denom) {
+ return (0 != dgt && 1 != nxtDgt ? " " + sglDigit[dgt] : "") + (0 != nxtDgt || dgt > 0 ? " " + denom : "")
+ };
+
+ var str = "",
+ digitIdx = 0,
+ digit = 0,
+ nxtDigit = 0,
+ words = [];
+ if (amount += "", isNaN(parseInt(amount))) str = "";
+ else if (parseInt(amount) > 0 && amount.length <= 10) {
+ for (digitIdx = amount.length - 1; digitIdx >= 0; digitIdx--)
+ switch (digit = amount[digitIdx] - 0, nxtDigit = digitIdx > 0 ? amount[digitIdx - 1] - 0 : 0, amount.length - digitIdx - 1) {
+ case 0:
+ words.push(handle_utlc(digit, nxtDigit, ""));
+ break;
+ case 1:
+ words.push(handle_tens(digit, amount[digitIdx + 1]));
+ break;
+ case 2:
+ words.push(0 != digit ? " " + sglDigit[digit] + " Hundred" + (0 != amount[digitIdx + 1] && 0 != amount[digitIdx + 2] ? " and" : "") : "");
+ break;
+ case 3:
+ words.push(handle_utlc(digit, nxtDigit, "Thousand"));
+ break;
+ case 4:
+ words.push(handle_tens(digit, amount[digitIdx + 1]));
+ break;
+ case 5:
+ words.push(handle_utlc(digit, nxtDigit, "Lakh"));
+ break;
+ case 6:
+ words.push(handle_tens(digit, amount[digitIdx + 1]));
+ break;
+ case 7:
+ words.push(handle_utlc(digit, nxtDigit, "Crore"));
+ break;
+ case 8:
+ words.push(handle_tens(digit, amount[digitIdx + 1]));
+ break;
+ case 9:
+ words.push(0 != digit ? " " + sglDigit[digit] + " Hundred" + (0 != amount[digitIdx + 1] || 0 != amount[digitIdx + 2] ? " and" : " Crore") : "")
+ // break;
+ // case 10:
+ // words.push(0 != digit ? " " + sglDigit[digit] + " Lakh" + (0 != price[digitIdx + 1] || 0 != price[digitIdx + 2] ? " and" : " Hundred" + (0 != price[digitIdx + 1] || 0 != price[digitIdx + 2] || 0 != price[digitIdx + 3] ? " and" : " Crore"))
+ // : "")
+ // break;
}
- }
- value = "";
- for (var i = 0; i < 9; i++) {
- if (i == 0 || i == 2 || i == 4 || i == 7) {
- value = n_array[i] * 10;
- } else {
- value = n_array[i];
- }
- if (value != 0) {
- words_string += words[value] + " ";
- }
- if ((i == 1 && value != 0) || (i == 0 && value != 0 && n_array[i + 1] == 0)) {
- words_string += "Crores ";
- }
- if ((i == 3 && value != 0) || (i == 2 && value != 0 && n_array[i + 1] == 0)) {
- words_string += "Lakhs ";
- }
- if ((i == 5 && value != 0) || (i == 4 && value != 0 && n_array[i + 1] == 0)) {
- words_string += "Thousand ";
- }
- if (i == 6 && value != 0 && (n_array[i + 1] != 0 && n_array[i + 2] != 0)) {
- words_string += "Hundred and ";
- } else if (i == 6 && value != 0) {
- words_string += "Hundred ";
- }
- }
- words_string = words_string.split(" ").join(" ");
- }
- return words_string;
+ str = words.reverse().join("")
+ // str =(str.length > 2 && str.charAt(str.length-2)==',') ? str.slice(0, -2) : str;
+ } else str = "";
+ return str
+
+ // var words = new Array();
+ // words[0] = '';
+ // words[1] = 'One';
+ // words[2] = 'Two';
+ // words[3] = 'Three';
+ // words[4] = 'Four';
+ // words[5] = 'Five';
+ // words[6] = 'Six';
+ // words[7] = 'Seven';
+ // words[8] = 'Eight';
+ // words[9] = 'Nine';
+ // words[10] = 'Ten';
+ // words[11] = 'Eleven';
+ // words[12] = 'Twelve';
+ // words[13] = 'Thirteen';
+ // words[14] = 'Fourteen';
+ // words[15] = 'Fifteen';
+ // words[16] = 'Sixteen';
+ // words[17] = 'Seventeen';
+ // words[18] = 'Eighteen';
+ // words[19] = 'Nineteen';
+ // words[20] = 'Twenty';
+ // words[30] = 'Thirty';
+ // words[40] = 'Forty';
+ // words[50] = 'Fifty';
+ // words[60] = 'Sixty';
+ // words[70] = 'Seventy';
+ // words[80] = 'Eighty';
+ // words[90] = 'Ninety';
+ // amount = amount.toString();
+ // var atemp = amount.split(".");
+ // var number = atemp[0].split(",").join("");
+ // var n_length = number.length;
+ // let value:any = "";
+ // var words_string = "";
+ // if (n_length <= 9) {
+ // var n_array:any = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0);
+ // var received_n_array = new Array();
+ // for (var i = 0; i < n_length; i++) {
+ // received_n_array[i] = number.substr(i, 1);
+ // }
+ // for (var i = 9 - n_length, j = 0; i < 9; i++, j++) {
+ // n_array[i] = received_n_array[j];
+ // }
+ // for (var i = 0, j = 1; i < 9; i++, j++) {
+ // if (i == 0 || i == 2 || i == 4 || i == 7) {
+ // if (n_array[i] == 1) {
+ // n_array[j] = 10 + parseInt(n_array[j]);
+ // n_array[i] = 0;
+ // }
+ // }
+ // }
+ // value = "";
+ // for (var i = 0; i < 9; i++) {
+ // if (i == 0 || i == 2 || i == 4 || i == 7) {
+ // value = n_array[i] * 10;
+ // } else {
+ // value = n_array[i];
+ // }
+ // if (value != 0) {
+ // words_string += words[value] + " ";
+ // }
+ // if ((i == 1 && value != 0) || (i == 0 && value != 0 && n_array[i + 1] == 0)) {
+ // words_string += "Crores ";
+ // }
+ // if ((i == 3 && value != 0) || (i == 2 && value != 0 && n_array[i + 1] == 0)) {
+ // words_string += "Lakhs ";
+ // }
+ // if ((i == 5 && value != 0) || (i == 4 && value != 0 && n_array[i + 1] == 0)) {
+ // words_string += "Thousand ";
+ // }
+ // if (i == 6 && value != 0 && (n_array[i + 1] != 0 && n_array[i + 2] != 0)) {
+ // words_string += "Hundred and ";
+ // } else if (i == 6 && value != 0) {
+ // words_string += "Hundred ";
+ // }
+ // }
+ // words_string = words_string.split(" ").join(" ");
+ // }
+ // return words_string;
}
}