diff --git a/ng6-seed/src/app/dashboard/dashboard.service.ts b/ng6-seed/src/app/dashboard/dashboard.service.ts index 545c97924..282adb26d 100644 --- a/ng6-seed/src/app/dashboard/dashboard.service.ts +++ b/ng6-seed/src/app/dashboard/dashboard.service.ts @@ -53,16 +53,12 @@ export class DashboardService { getPDDetailForDoughnut(fromdate,todate,cityarr,lenderarr): Observable { -console.log('From',fromdate); -console.log('To',todate); -console.log('Lender Arr',lenderarr); -console.log('City Arr',cityarr); - +console.log(' From : ' + fromdate + ' To : ' + todate + ' Lender Array : ' + lenderarr + ' City Array : ' + cityarr); return this._http.post(this.apiUrl+'getDashBoardMaster', { "fromdate":fromdate != '' && fromdate != null && fromdate != undefined ? fromdate : '', "todate": todate != '' && todate != null && todate != undefined ? todate : '', - "lenderarr": lenderarr,"cityarr":cityarr}) + "cityarr":cityarr,"lenderarr": lenderarr}) .pipe(catchError(this.handleError('role', [])) ) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-allocation/pd-allocation.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-allocation/pd-allocation.component.html index 09b7d660a..d7cd16fcc 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-allocation/pd-allocation.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-allocation/pd-allocation.component.html @@ -13,11 +13,11 @@
-
+
- No Image
+ No Image
{{officer.first_name}}
{{officer.mobile_no}}
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/smart-pd-allocation/smart-pd-allocation.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/smart-pd-allocation/smart-pd-allocation.component.html index 0c7f1b24d..b5711e5a9 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/smart-pd-allocation/smart-pd-allocation.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/smart-pd-allocation/smart-pd-allocation.component.html @@ -13,7 +13,7 @@
-
+
+ + + + + + + + + + + + + + Sales Calculate Items Wise + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Item{{salesItem.sales_item}} Qty/UOM{{salesItem.sales_qty }}/{{salesItem.uom_name }} Rate/Unit {{salesItem.rate_per_unit }} Frequency {{salesItem.frequency_name}} Annual Sale Value {{salesItem.annual_sale_value}}
+
+
+
+ + + + Sales Calculate Items Month Wise + + + + + + + + {{expandDetails.salesItem}} + + + +
+
+ +

{{eachItem.header}}

+ + + + + + + + + + + + + + + + +
Date{{itemValue.sales_date | date: 'dd-MM-yyyy'}} Total Amount{{itemValue.sales_value}} {{getTotalCost(eachItem.value)}}
+
+ + +
+ +
+ + +
+ {{footer.month_message}} +
+
+ {{footer.year_message}} +
+
+
+
+
+
+ + + + + Purchase Details + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Item{{purchaseItem.purchase_item}} Qty/UOM{{purchaseItem.purchase_qty }}/{{purchaseItem.uom_name }} Rate/Unit {{purchaseItem.rate_per_unit }} Frequency {{purchaseItem.frequency_name}} Annual Purchase Value {{purchaseItem.annual_purchase_value}}
+
+
+
+ + + + Business Expenses + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Item {{businessEx.expense_item}} Value {{businessEx.expense_value }} Frequency {{businessEx.frequency_name}} Annual Expenses Value {{businessEx.annual_expenses_value}}
+
+
+
+ + + + House Hold Expenses + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
Item{{householdItem.expense_item}} Value{{householdItem.expense_value }}Frequency {{householdItem.frequency_name}} Annual Expenses Value {{householdItem.annual_expense_value}}
+
+
+
+
+ + +
+
+ + + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.scss new file mode 100644 index 000000000..1ca16c276 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.scss @@ -0,0 +1,46 @@ +.example-container { + max-height: 300px; + overflow: auto; +} + +table { + width: 100%; +} + +tr.mat-footer-row { + font-weight: bold; +} + +.mat-table-sticky { + border-top: 1px solid #e0e0e0; +} + + .mat-form-field { + width: 100%; + } + .expan_footer{ + font-size: 18px; + direction: rtl; + } + .expan_table_header { + font-size: 18px; + text-align: center; + } + .h4_font { + font-size: 18px; + } + +// table, th, td { +// border: 1px solid rgba(0, 0, 0, 0.12); +// border-collapse: collapse; +// } +// td { +// padding: 5px; +// text-align: left; +// } +// th { +// padding: 5px; +// text-align: center; +// } + + \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.spec.ts new file mode 100644 index 000000000..0e5f1ba73 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AssessedIncomeComponent } from './assessed-income.component'; + +describe('AssessedIncomeComponent', () => { + let component: AssessedIncomeComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AssessedIncomeComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AssessedIncomeComponent); + 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/assessed-income.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.ts new file mode 100644 index 000000000..e2aebdb6b --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.ts @@ -0,0 +1,150 @@ +import {Component,OnInit,Inject,Input, ViewChild } from '@angular/core'; +import {FormBuilder,FormGroup,Validators,FormArray, FormControl,} from '@angular/forms'; +import { NotifierService } from 'angular-notifier'; +/** Service */ +import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; +import { ActivatedRoute, Router } from "@angular/router"; + +@Component({ + selector: 'app-assessed-income', + templateUrl: './assessed-income.component.html', + styleUrls: ['./assessed-income.component.scss'] +}) +export class AssessedIncomeComponent implements OnInit { + public _assessedIncomeFormFrom: FormGroup; + private notifier: NotifierService; + @Input() pdid: number; + @Input() form_id: number; + salesCaluatedItemColumns: string[] = ['Item', 'Qty/UOM','Rate/Unit','Frequency','Annual Sale Value']; + public salesCaluatedItem:any= []; + salesItemMonthWiseColumns: string[] = ['Item', 'Value','Frequency','Annual Expenses Value']; + public salesItemMonthWise:any= []; + purchaseDetailsColumns: string[] = ['Item', 'Qty/UOM','Rate/Unit','Frequency','Annual Purchase Value']; + public purchaseDetails:any= []; + businessExpensesColumns: string[] = ['Item', 'Value','Frequency','Annual Expenses Value']; + public businessExpenses:any= []; + houseHoldExpensesColumns: string[] = ['Item', 'Value','Frequency','Annual Expenses Value']; + public houseHoldExpenses:any= []; + + public salesMonthItemColumns = ['Date','Amount']; + + +// Sales Item MonthWise declare table header,body andd footer elements +salesMonthWiseTable:any=[]; +salesItemMonthWiseBody: any[]; +salesItemMonthWiseFooter: any[]; + +salesMonthWiseExpandedItems: any=[] + + + constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, + private router: Router, + private _pd: PdTrigerService) { + + } + + ngOnInit() { + + this.initAssessedIncomeForm(); + let params: any = {}; + params.pd_id = this.pdid; + params.pd_form_id = this.form_id; + this._pd.getAssessedIncomeFormDetails(params).subscribe(value => { + if (value.status == 200) { + if(value.records.sales_declared_by_customer){ + this._assessedIncomeFormFrom.controls['sales_declared_by_customer'].setValue(value.records.sales_declared_by_customer[0].sales_declared_by_customer); + } + else{ + this._assessedIncomeFormFrom.controls['sales_declared_by_customer'].setValue(''); + + } + if(value.records.sales_calculated_by_itemwise){ + this.salesCaluatedItem = value.records.sales_calculated_by_itemwise; + } + if(value.records.sales_items_by_monthwise){ + this.salesItemMonthWise = value.records.sales_items_by_monthwise; + // hide table format start + + // this.salesItemMonthWise.forEach((itemElement, itemIndex) => { + // this.salesItemMonthWiseBody= Object.keys(itemElement.items).map(key => ({ header:key, value: itemElement.items[key] })); + // let combineTableColumn = Object.keys(itemElement.items).map(key => (itemElement.items[key])); + // let sumItems: any=[]; + // combineTableColumn.forEach((sumValue, sumIndex) => { + // let calculateItems = sumValue.reduce((acc, calculate) => acc + Number(calculate.sales_value), 0); + // sumItems.push({bodyElement:sumValue, bodyElementTotal:calculateItems}); + // }) + // let calculateAllItemsTotal:number=sumItems.reduce((racc, rcalculate) => racc + Number(rcalculate.bodyElementTotal), 0); + // let convertYear : number = 12 / sumItems.length; + // let tableFooterMessage: any=[]; + // tableFooterMessage.push({ + // message: sumItems.length + ' Months ' + itemElement.sales_item + ' Sales ', + // value:calculateAllItemsTotal, + // cols_span_length:sumItems.length * 2 -1, + // }) + // tableFooterMessage.push({ + // message: ' Yearly ' + itemElement.sales_item + ' Sales Arrived', + // value: calculateAllItemsTotal * convertYear, + // cols_span_length:sumItems.length * 2 -1 , + // }) + // this.salesMonthWiseTable.push({salesItem:itemElement.sales_item,headerElement:this.salesItemMonthWiseBody, bodyElements:sumItems, parentTableFooter:tableFooterMessage}); + // //console.log(this.salesMonthWiseTable) + // }); + // hide table format end + + + this.salesItemMonthWise.forEach((itemElement, itemIndex) => { + let expandBodyContent= Object.keys(itemElement.items).map(key => ({ header:key, value: itemElement.items[key] })); + let listItems: any=[]; + expandBodyContent.forEach((expnadElement, expnadIndex) => { + let calculateItems = expnadElement.value.reduce((acc, calculate) => acc + Number(calculate.sales_value), 0); + listItems.push({items:expnadElement, itemsTotal:calculateItems}) + }) + let calculateAllItemsTotal:number=listItems.reduce((racc, rcalculate) => racc + Number(rcalculate.itemsTotal), 0); + + let convertYear : number = 12 / listItems.length; + let footerMessage: any=[]; + footerMessage.push({ + month_message: listItems.length + ' Months ' + itemElement.sales_item + ' Sales : '+ calculateAllItemsTotal, + month_value:calculateAllItemsTotal, + year_message: ' Yearly ' + itemElement.sales_item + ' Sales Arrived : '+ calculateAllItemsTotal * convertYear, + year_value: calculateAllItemsTotal * convertYear, + }) + // footerMessage.push({ + // message: ' Yearly ' + itemElement.sales_item + ' Sales Arrived', + // value: calculateAllItemsTotal * convertYear, + // }) + this.salesMonthWiseExpandedItems.push({salesItem:itemElement.sales_item, expandElements:expandBodyContent, footerMessage: footerMessage}); + }); + + + } + if(value.records.purchase_details){ + this.purchaseDetails = value.records.purchase_details; + } + if(value.records.business_expenses){ + this.businessExpenses=value.records.business_expenses; + } + if(value.records.house_hold_expenses){ + this.houseHoldExpenses = value.records.house_hold_expenses; + } + } + + }) + } + + // get total cost + getTotalCost(getItems:any) { + return getItems.map(t => t.sales_value).reduce((acc, value) => acc + Number(value), 0); + } + + + // Dynamic Form field creation + + public initAssessedIncomeForm(): void { + this._assessedIncomeFormFrom = this.fb.group({ + sales_declared_by_customer: ['', Validators.compose([Validators.required])], + // lender_representative_details: this.fb.array([]), + }); +} + +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html index b426f5d57..d843ac592 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html @@ -436,6 +436,9 @@ + + + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/tele-pd-allocation/tele-pd-allocation.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/tele-pd-allocation/tele-pd-allocation.component.html index 125066e83..fc8ef5769 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/tele-pd-allocation/tele-pd-allocation.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/tele-pd-allocation/tele-pd-allocation.component.html @@ -13,11 +13,11 @@
-
+
- No Image
+ No Image
{{officer.first_name}}
{{officer.mobile_no}}
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 7c88cf7cc..1e1259666 100644 --- 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 @@ -60,7 +60,7 @@ import {EmploymentInfoComponent} from "./list-pd/start-pd/forms/employment-info/ import {BusinessInfoComponent} from "./list-pd/start-pd/forms/business-info/business-info.component"; import {FinancialInfoComponent} from "./list-pd/start-pd/forms/financial-info/financial-info.component"; import { LenderRepresentativeComponent } from './list-pd/start-pd/forms/lender-representative/lender-representative.component'; - +import { AssessedIncomeComponent } from './list-pd/start-pd/forms/assessed-income/assessed-income.component'; import { TelePdAllocationComponent } from './list-pd/tele-pd-allocation/tele-pd-allocation.component'; import { PdReportComponent } from './list-pd/pd-report/pd-report.component'; @@ -140,7 +140,7 @@ const pdCustomNotifierOptions: NotifierOptions = { // AgmCoreModule.forRoot({apiKey: 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'}), OwlDateTimeModule, // OwlNativeDateTimeModule, // ], - declarations: [RentalInfoComponent, 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], + declarations: [RentalInfoComponent, 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], // exports: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent], // providers: [PdTrigerService, GetGeometricLocationService], @@ -172,7 +172,7 @@ const pdCustomNotifierOptions: NotifierOptions = { OwlNativeDateTimeModule, ], // declarations: [ListPdComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, AssetsInfoComponent], - exports: [PdAllocationComponent, SmartPdAllocationComponent, TelePdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent], + exports: [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], providers: [PdTrigerService, GetGeometricLocationService], entryComponents: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, TelePdAllocationComponent] }) 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 8828b9706..97ab9f238 100644 --- 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 @@ -233,6 +233,13 @@ export class PdTrigerService { // catchError(this.handleError('operation', [])) // ) // } + // get assessed income form details + getAssessedIncomeFormDetails(formDetails):Observable { + return this._http.post(this.apiUrl+"getAssessedIncome",formDetails) + .pipe( + catchError(this.handleError('operation', [])) + ) + } private handleError(operation = 'operation', result?: T) { return (error: any): Observable => { diff --git a/ng6-seed/src/app/quality-check/qc-list/qc-start/qc-start.component.html b/ng6-seed/src/app/quality-check/qc-list/qc-start/qc-start.component.html index 441604b3f..585b19bad 100644 --- a/ng6-seed/src/app/quality-check/qc-list/qc-start/qc-start.component.html +++ b/ng6-seed/src/app/quality-check/qc-list/qc-start/qc-start.component.html @@ -429,6 +429,9 @@ + + +