AI Changes and OTP on PD page
This commit is contained in:
parent
eca2f5a079
commit
9875e35642
@ -80,6 +80,14 @@
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.stage.ts"
|
||||
}]
|
||||
},
|
||||
"test":
|
||||
{
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.stage.ts"
|
||||
}]
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -91,6 +99,9 @@
|
||||
"configurations": {
|
||||
"production": {
|
||||
"browserTarget": "optima:build:production"
|
||||
},
|
||||
"test":{
|
||||
"browserTarget": "optima:build:test"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
10
ng6-seed/package-lock.json
generated
10
ng6-seed/package-lock.json
generated
@ -882,7 +882,7 @@
|
||||
},
|
||||
"@types/pdfjs-dist": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "http://registry.npmjs.org/@types/pdfjs-dist/-/pdfjs-dist-0.1.2.tgz",
|
||||
"resolved": "https://registry.npmjs.org/@types/pdfjs-dist/-/pdfjs-dist-0.1.2.tgz",
|
||||
"integrity": "sha512-BvRLWz6RCI8FMKbgfdTCadVwimUv8920gLsnBEAkECjtqIy95jtt+G1ebNQE2b8PTnLjJICPpmBOGhgkSsiPKA=="
|
||||
},
|
||||
"@types/q": {
|
||||
@ -1285,6 +1285,14 @@
|
||||
"resolved": "https://registry.npmjs.org/angular-sortablejs/-/angular-sortablejs-2.6.0.tgz",
|
||||
"integrity": "sha512-f/W5WUeySMLhMqUHpAqzHCi3+yj6uwPcwr5FcKRRF+o5nzuYR5ppW1GJJk/Px1Q0HhL2//z9O3QZpEVMlvHf5w=="
|
||||
},
|
||||
"angular-split": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/angular-split/-/angular-split-3.0.2.tgz",
|
||||
"integrity": "sha512-km59k1kEgVlplo2t4t5Ob43Vx16qVXWXsl5gbsdQtqrOW7341So4CFUmCjcZgfk1swu9RBaCdSQEqzNWOe/89w==",
|
||||
"requires": {
|
||||
"tslib": "^1.9.0"
|
||||
}
|
||||
},
|
||||
"angular-tree-component": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/angular-tree-component/-/angular-tree-component-6.1.0.tgz",
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
"angular-calendar": "0.23.3",
|
||||
"angular-notifier": "^4.1.1",
|
||||
"angular-sortablejs": "^2.0.6",
|
||||
"angular-split": "^3.0.2",
|
||||
"angular-tree-component": "6.1.0",
|
||||
"chart.js": "2.6.0",
|
||||
"core-js": "^2.5.5",
|
||||
@ -57,7 +58,7 @@
|
||||
"ng2-ckeditor": "^1.2.2",
|
||||
"ng2-dragula": "1.3.1",
|
||||
"ng2-file-upload": "1.2.1",
|
||||
"ng2-pdf-viewer": "^5.2.3",
|
||||
"ng2-pdf-viewer": "5.2.3",
|
||||
"ng2-toastr": "^4.1.2",
|
||||
"ng2-validation": "4.2.0",
|
||||
"ngx-color-picker": "^4.0.3",
|
||||
|
||||
@ -55,6 +55,7 @@ import { MessagingService } from './shared/messaging.service';
|
||||
import { environment } from '../environments/environment';
|
||||
import { AsyncPipe } from '../../node_modules/@angular/common';
|
||||
|
||||
|
||||
export function HttpLoaderFactory(http: HttpClient) {
|
||||
return new TranslateHttpLoader(http);
|
||||
}
|
||||
@ -72,7 +73,7 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
|
||||
AppComponent,
|
||||
AdminLayoutComponent,
|
||||
AuthLayoutComponent,
|
||||
NewPasswordDialog,ForgotPass,ChangePasswordDialog, RoleMenuItemsPipe,
|
||||
NewPasswordDialog,ForgotPass,ChangePasswordDialog, RoleMenuItemsPipe,
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
</button>
|
||||
</div>
|
||||
<div fxFlex="100">
|
||||
<mat-radio-group formControlName="purchase_type" class="example-radio-group" (change)="changeOptions(s,$event)">
|
||||
<mat-radio-group formControlName="purchase_type" class="example-radio-group" (change)="changeOptions(s,$event,item.value)">
|
||||
<mat-radio-button class="example-radio-button" color="primary" [value]="types.type_id" *ngFor="let types of check_type; let t = index">{{types.type_name}}</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
</div>
|
||||
@ -94,14 +94,45 @@
|
||||
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<!-- Case 3 Kutcha Records -->
|
||||
<div *ngSwitchCase="3" class="item-margin" fxFlex="100">
|
||||
<div formArrayName="child">
|
||||
<div *ngFor="let childItem of item.get('child').controls; let c = index" [formGroupName]="c">
|
||||
<div *ngIf="childItem.value.isactive===true">
|
||||
<mat-form-field style="width: 40%;">
|
||||
<input matInput [max]="todaydate" [matDatepicker]="picker" formControlName="purchase_date" (dateChange)="purchaseCalculation_kutchaRecords(s,item.value)" placeholder="Purchase Date" >
|
||||
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
|
||||
<mat-datepicker touchUi #picker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 44%">
|
||||
<input OnlyNumber type="text" matInput placeholder="Bill Value" (keyup)="purchaseCalculation_kutchaRecords(s,item.value)" formControlName="purchase_value" >
|
||||
<mat-hint align="start" style="font-size:90%" *ngIf="childItem.value.purchase_value != ''">{{"₹"}} {{childItem.value.purchase_value | numberToWords}} Only</mat-hint>
|
||||
</mat-form-field>
|
||||
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeDailyItems(s,c,childItem.value)" *ngIf="item.value.child.length>1"
|
||||
matTooltip="Remove" matTooltipPosition="above">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div align="center" style="margin-top: 3%;">
|
||||
<button type="button" mat-flat-button (click)="addMoreDailyPurchase(s,item.value)"
|
||||
matTooltip="Add More" matTooltipPosition="above" color="primary">
|
||||
<strong>Add More Daily Purchase</strong>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-product-margin" fxFlex="100">
|
||||
<mat-form-field style="width: 92%">
|
||||
<textarea matInput type="text" placeholder="Remarks" formControlName="comments"></textarea>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div fxLayout="row" *ngIf="data.manage_status==1">
|
||||
<div fxFlex="100" align="center">
|
||||
<button type="button" mat-flat-button (click)="addMore()"
|
||||
@ -110,6 +141,7 @@
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<notifier-container></notifier-container>
|
||||
@ -120,4 +152,4 @@
|
||||
|
||||
|
||||
|
||||
s
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
.example-radio-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.example-radio-button {
|
||||
|
||||
@ -3,6 +3,7 @@ import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@ang
|
||||
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'
|
||||
|
||||
@Component({
|
||||
selector: 'app-manage-purchase',
|
||||
@ -10,13 +11,16 @@ import { NotifierService } from 'angular-notifier';
|
||||
styleUrls: ['./manage-purchase.component.scss']
|
||||
})
|
||||
export class ManagePurchaseComponent implements OnInit {
|
||||
pipe=new DatePipe('en-US');
|
||||
todaydate:Date=new Date;
|
||||
RateUnitofPurchase: any[]=[];
|
||||
pageTitle: string;
|
||||
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'}]
|
||||
check_type:any=[{'type_id':"1",'type_name':'Quantity and Rate Information'},{'type_id':"2",'type_name':'Value Information'},
|
||||
{'type_id':"3",'type_name':'Kutcha Records/Bills'}]
|
||||
|
||||
private notifier: NotifierService;
|
||||
constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef<ManagePurchaseComponent>) {
|
||||
@ -57,6 +61,17 @@ export class ManagePurchaseComponent implements OnInit {
|
||||
});
|
||||
let control: any = <FormArray>this.purchaseItemForm.controls['purchase'];
|
||||
this.data.editData.fk_uom_id=="1" ? control.controls[0].addControl('uom_other', new FormControl(this.data.editData.uom_other ? this.data.editData.uom_other : '', Validators.required)) : control.controls[0].removeControl('uom_other');
|
||||
if(this.data.editData.purchase_type =="3"){
|
||||
// let control:any=<FormArray>this.purchaseItemForm.controls['purchase']
|
||||
control.controls[0].addControl('child',this._fb.array([]))
|
||||
let innercontrol:any= control.controls[0].controls['child'] as FormArray
|
||||
if(this.data.editData.values.length >0){
|
||||
this.data.editData.values.forEach(result=>{
|
||||
innercontrol.push(this.createDailyPurchaseWithData(result,this.data.editData))
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
this.purchaseItemForm = this._fb.group({
|
||||
@ -88,6 +103,7 @@ export class ManagePurchaseComponent implements OnInit {
|
||||
|
||||
// create form with data
|
||||
createPurchaseItemWithData(values: any) {
|
||||
|
||||
return this._fb.group({
|
||||
purchase_id:[values.purchase_id],
|
||||
fk_pd_id:[this.data.masterData.pdid],
|
||||
@ -101,8 +117,8 @@ createPurchaseItemWithData(values: any) {
|
||||
fk_frequency_id:[values.fk_frequency_id,Validators.compose([Validators.required])],
|
||||
annual_purchase_value:[values.annual_purchase_value,Validators.compose([Validators.required])],
|
||||
comments:[values.comments],
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// add more item
|
||||
@ -116,7 +132,7 @@ closeDialogue(){
|
||||
this.dialogRef.close({update_status:false});
|
||||
}
|
||||
|
||||
changeOptions(indexVal: any,event: any): void{
|
||||
changeOptions(indexVal: any,event: any,parent_value): void{
|
||||
|
||||
let control: any = <FormArray>this.purchaseItemForm.controls['purchase'];
|
||||
if(event.value=="1"){
|
||||
@ -126,6 +142,7 @@ changeOptions(indexVal: any,event: any): void{
|
||||
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);
|
||||
this.deleteAllDailyPurchase(indexVal)
|
||||
}
|
||||
else if(event.value=="2"){
|
||||
control.controls[indexVal].controls['purchase_qty'].setValue("");
|
||||
@ -136,6 +153,33 @@ changeOptions(indexVal: any,event: any): void{
|
||||
control.controls[indexVal].controls['fk_uom_id'].clearValidators();
|
||||
control.controls[indexVal].controls['fk_uom_id'].updateValueAndValidity();
|
||||
this.purchaseCalculation(indexVal,control.controls[indexVal].value);
|
||||
this.deleteAllDailyPurchase(indexVal)
|
||||
}
|
||||
else if(event.value == "3"){
|
||||
this.purchaseCalculation_kutchaRecords(indexVal,control.controls[indexVal].value);
|
||||
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();
|
||||
|
||||
control.controls[indexVal].controls['fk_frequency_id'].setValue("");
|
||||
control.controls[indexVal].controls['fk_frequency_id'].clearValidators();
|
||||
control.controls[indexVal].controls['fk_frequency_id'].updateValueAndValidity();
|
||||
|
||||
control.controls[indexVal].controls['rate_per_unit'].setValue("");
|
||||
control.controls[indexVal].controls['rate_per_unit'].clearValidators();
|
||||
control.controls[indexVal].controls['rate_per_unit'].updateValueAndValidity();
|
||||
|
||||
|
||||
control.controls[indexVal].addControl('child',this._fb.array([this.createDailyPurchaseData(parent_value.purchase_id)]))
|
||||
|
||||
let childControl: any = <FormArray>this.purchaseItemForm.controls['purchase'];
|
||||
childControl=control.controls[indexVal].controls['child']
|
||||
childControl.controls[0].controls.purchase_date.setValidators(Validators.compose([Validators.required]))
|
||||
childControl.controls[0].controls.purchase_value.setValidators(Validators.compose([Validators.required]))
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,6 +222,20 @@ submitDetails(records) {
|
||||
this.notifier.notify('warning',"Please Check All Manatory Fields..");
|
||||
return;
|
||||
}
|
||||
|
||||
records.purchase.forEach(parVal => {
|
||||
if(parVal.child){
|
||||
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');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// console.log(records.purchase);
|
||||
this._pd.saveAssessedDetails('saveAssessedIncomePurchaseDetails',records.purchase).subscribe(data => {
|
||||
this.notifier.notify('success', this.data.manage_status==2 ? 'Updated Successfully.' : 'Saved Successfully.');
|
||||
setTimeout(() =>{
|
||||
@ -202,4 +260,111 @@ submitDetails(records) {
|
||||
});
|
||||
}
|
||||
|
||||
// Kutcha Records case3
|
||||
|
||||
// add more purchase daily products
|
||||
addMoreDailyPurchase(parentIndex: number,values: any): void{
|
||||
let control: any = <FormArray>this.purchaseItemForm.controls['purchase'];
|
||||
control=control.controls[parentIndex].get('child') as FormArray;
|
||||
control.push(this.createDailyPurchaseData(values.purchase_id));
|
||||
}
|
||||
|
||||
// remove dailywise Purchase Products items
|
||||
removeDailyItems(parentIndex: number,childIndex:number, childValue:any): void {
|
||||
let control: any = <FormArray>this.purchaseItemForm.controls['purchase'];
|
||||
control=control.controls[parentIndex].get('child') as FormArray;
|
||||
if(childValue.pbwc_id=='' || childValue.pbwc_id==null){
|
||||
control.removeAt(childIndex);
|
||||
let calculatControlValues: any = <FormArray>this.purchaseItemForm.controls['purchase'];
|
||||
calculatControlValues = calculatControlValues.controls[parentIndex];
|
||||
this.purchaseCalculation_kutchaRecords(parentIndex,calculatControlValues.value);
|
||||
}
|
||||
else {
|
||||
control.controls[childIndex].controls.isactive.setValue(false);
|
||||
let calculatControlValues: any = <FormArray>this.purchaseItemForm.controls['purchase'];
|
||||
calculatControlValues = calculatControlValues.controls[parentIndex];
|
||||
this.purchaseCalculation_kutchaRecords(parentIndex,calculatControlValues.value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// create daily list empty
|
||||
createDailyPurchaseData(purchase_id: string) {
|
||||
return this._fb.group({
|
||||
pbwc_id: [''],
|
||||
fk_purchase_id: [purchase_id || ''],
|
||||
purchase_date: [''],
|
||||
purchase_value: ['', Validators.compose([Validators.required])],
|
||||
isactive:[true],
|
||||
})
|
||||
|
||||
}
|
||||
// create daily purchase product with Data
|
||||
createDailyPurchaseWithData(values: any, parent: any) {
|
||||
return this._fb.group({
|
||||
pbwc_id: [values.pbwc_id],
|
||||
fk_purchase_id: [parent.purchase_id || null],
|
||||
purchase_date: [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]
|
||||
})
|
||||
}
|
||||
|
||||
deleteAllDailyPurchase(index){
|
||||
let control: any = <FormArray>this.purchaseItemForm.controls['purchase'];
|
||||
// console.log(control);
|
||||
if(control.controls[index].controls['child']){
|
||||
control=control.controls[index].controls['child']
|
||||
// console.log(control.length);
|
||||
while(control.controls.length !=1){
|
||||
control.removeAt(0);
|
||||
}
|
||||
control.controls[0].controls.purchase_date.setValue('');
|
||||
control.controls[0].controls.purchase_date.clearValidators()
|
||||
control.controls[0].controls.purchase_date.updateValueAndValidity();
|
||||
control.controls[0].controls.purchase_value.setValue('')
|
||||
control.controls[0].controls.purchase_value.clearValidators();
|
||||
control.controls[0].controls.purchase_value.updateValueAndValidity();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// this caculation for running total
|
||||
purchaseCalculation_kutchaRecords(indexVal: number,values: any): void {
|
||||
let control:any = <FormArray>this.purchaseItemForm.controls['purchase'];
|
||||
if(values.child){
|
||||
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 getUniqueMonthCounts = transformData.map(val=>val.custum_date)
|
||||
.filter((fVal,fIndex,fArray)=>{
|
||||
return fIndex === fArray.indexOf(fVal);
|
||||
});
|
||||
let tot_month:number=parseInt(getUniqueMonthCounts.length)
|
||||
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(((12/tot_month)*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("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
</div>
|
||||
|
||||
<div fxFlex="100">
|
||||
<mat-radio-group formControlName="sales_type" class="example-radio-group" (change)="changeOptions(s,$event)">
|
||||
<mat-radio-group formControlName="sales_type" class="example-radio-group" (change)="changeOptions(s,$event,sales.value.sci_id)">
|
||||
<mat-radio-button class="example-radio-button" color="primary" [value]="types.type_id" *ngFor="let types of check_type; let t = index">{{types.type_name}}</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
</div>
|
||||
@ -84,6 +84,37 @@
|
||||
<mat-hint align="start" style="font-size:90%" *ngIf="sales.value.annual_sale_value != ''">{{"₹"}} {{sales.value.annual_sale_value | numberToWords}} Only</mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<!-- Case 3 for kutcha records -->
|
||||
<div *ngSwitchCase="3" class="item-margin" fxFlex="100">
|
||||
<div formArrayName="child">
|
||||
<div *ngFor="let childItem of sales.get('child').controls; let c = index" [formGroupName]="c">
|
||||
<!-- <div fxLayout="row wrap"> -->
|
||||
<div *ngIf="childItem.value.isactive===true">
|
||||
<mat-form-field style="width: 40%;">
|
||||
<!-- <mat-error *ngIf="childItem.controls['sales_date'].hasError('matDatepickerMax')">Date should be inferior</mat-error>[max]="todaydate" -->
|
||||
<input matInput [max]="todaydate" [matDatepicker]="picker" formControlName="sales_date" (dateChange)="salesCalculation_kutchaRecords(s,sales.value)" placeholder="Sales Date" >
|
||||
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
|
||||
<mat-datepicker touchUi #picker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 44%">
|
||||
<input OnlyNumber type="text" matInput placeholder="Bill Value" (keyup)="salesCalculation_kutchaRecords(s,sales.value)" formControlName="sales_value" >
|
||||
<mat-hint align="start" style="font-size:90%" *ngIf="childItem.value.sales_value != ''">{{"₹"}} {{childItem.value.sales_value | numberToWords}} Only</mat-hint>
|
||||
</mat-form-field>
|
||||
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeDailyItems(s,c,childItem.value)" *ngIf="sales.value.child.length>1"
|
||||
matTooltip="Remove" matTooltipPosition="above">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
<div align="center" style="margin-top: 3%;">
|
||||
<button type="button" mat-flat-button (click)="addMoreDailySales(s,sales.value)"
|
||||
matTooltip="Add More" matTooltipPosition="above" color="primary">
|
||||
<strong>Add More Daily Sales</strong>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
||||
@ -91,7 +122,7 @@
|
||||
|
||||
<div class="item-product-margin" fxFlex="100" *ngIf="data.margin_calculation_status===true">
|
||||
<mat-form-field style="width: 25%">
|
||||
<input matInput OnlyNumber type="text" placeholder="Gross Margin %" formControlName="margin_per" (keyup)="salesMarginPerCalculation(s,sales.value)">
|
||||
<input matInput OnlyNumber type="text" placeholder="Gross Margin %" formControlName="margin_per" (keyup)="salesMarginPerCalculation(s,sales.value);salesCalculation_kutchaRecords(s,sales.value)">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 25%" *ngIf="sales.value.sales_type=='1'">
|
||||
<input matInput OnlyNumber type="text" placeholder="Margin Per Unit" formControlName="margin_per_uom" (keyup)="salesMarginAmtCalculation(s,sales.value)">
|
||||
|
||||
@ -4,6 +4,7 @@ import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angul
|
||||
import { PdTrigerService } from './../../../../../../../pd-service/pd-triger.service';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
import { AnyAaaaRecord } from 'dns';
|
||||
import {DatePipe} from '@angular/common'
|
||||
|
||||
@Component({
|
||||
selector: 'app-manage-sales',
|
||||
@ -11,7 +12,7 @@ import { AnyAaaaRecord } from 'dns';
|
||||
styleUrls: ['./manage-sales.component.scss']
|
||||
})
|
||||
export class ManageSalesComponent implements OnInit {
|
||||
|
||||
pipe=new DatePipe('en-US')
|
||||
pageTitle: string;
|
||||
salesItemForm:FormGroup;
|
||||
UOMData: any[]=[];
|
||||
@ -22,7 +23,13 @@ export class ManageSalesComponent implements OnInit {
|
||||
marginAmtInwords: any[]=[];
|
||||
marginFinalAmtInwords: any[]=[];
|
||||
ratePerUnitAmtInwords: any[]=[];
|
||||
check_type:any=[{'type_id':"1",'type_name':'Quantity and Rate Information'},{'type_id':"2",'type_name':'Value Information'}]
|
||||
todaydate:Date=new Date
|
||||
check_type:any=[{'type_id':"1",'type_name':'Quantity and Rate Information'},
|
||||
{'type_id':"2",'type_name':'Value Information'},
|
||||
{
|
||||
'type_id': "3",
|
||||
'type_name':'Kutcha Records/Bills'
|
||||
}]
|
||||
|
||||
private notifier: NotifierService;
|
||||
constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef<ManageSalesComponent>) {
|
||||
@ -80,7 +87,7 @@ export class ManageSalesComponent implements OnInit {
|
||||
});
|
||||
let control: any = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
|
||||
this.data.editData.fk_uom_id=="1" ? control.controls[0].addControl('uom_other', new FormControl(this.data.editData.uom_other ? this.data.editData.uom_other : '', Validators.required)) : control.controls[0].removeControl('uom_other');
|
||||
if(this.data.editData.sales_type && this.data.editData.sales_type=="2"){
|
||||
if(this.data.editData.sales_type && this.data.editData.sales_type=="2" || this.data.editData.sales_type=="3"){
|
||||
control.controls[0].controls['sales_qty'].setValue("");
|
||||
control.controls[0].controls['sales_qty'].clearValidators();
|
||||
control.controls[0].controls['sales_qty'].updateValueAndValidity();
|
||||
@ -91,6 +98,23 @@ export class ManageSalesComponent implements OnInit {
|
||||
control.controls[0].controls['margin_per_uom'].setValue("");
|
||||
|
||||
}
|
||||
if(this.data.editData.sales_type =="3"){
|
||||
// console.log(this.data.editData)
|
||||
// console.log(this.salesItemForm.controls['salesCalItemwise'])
|
||||
let control: any = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
|
||||
control.controls[0].addControl('child',this._fb.array([]))
|
||||
// console.log("control after",control);
|
||||
let innercontrol:any= control.controls[0].controls['child'] as FormArray
|
||||
// console.log("innercontrol",innercontrol);
|
||||
if(this.data.editData.values.length >0){
|
||||
// console.log("dd",this.data.editData.items_for_dispaly);
|
||||
this.data.editData.values.forEach(result=>{
|
||||
// console.log("result",result)
|
||||
innercontrol.push(this.createDailySalesWithData(result,this.data.editData))
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
this.salesItemForm = this._fb.group({
|
||||
@ -124,6 +148,8 @@ export class ManageSalesComponent implements OnInit {
|
||||
|
||||
// create form with data
|
||||
createSalesItemWithData(values: any) {
|
||||
|
||||
|
||||
return this._fb.group({
|
||||
sci_id:[values.sci_id],
|
||||
fk_pd_id:[this.data.masterData.pdid],
|
||||
@ -221,17 +247,20 @@ generateOtherUOM(index: number, values: any): void {
|
||||
}
|
||||
|
||||
// change options for either Quantity and Rate Information / Value Information
|
||||
changeOptions(indexVal: any,event: any): void{
|
||||
changeOptions(indexVal: any,event: any,sci_id): void{
|
||||
let control: any = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
|
||||
if(event.value=="1"){
|
||||
// control.controls[indexVal].controls.removeControl('child',this._fb.array([]))
|
||||
control.controls[indexVal].controls['sales_qty'].setValidators([Validators.required]);
|
||||
control.controls[indexVal].controls['sales_qty'].updateValueAndValidity();
|
||||
|
||||
control.controls[indexVal].controls['fk_uom_id'].setValidators([Validators.required]);
|
||||
control.controls[indexVal].controls['fk_uom_id'].updateValueAndValidity();
|
||||
this.salesCalculation(indexVal,control.controls[indexVal].value);
|
||||
this.deleteAllDailySales(indexVal);
|
||||
}
|
||||
else if(event.value=="2"){
|
||||
// control.controls[indexVal].controls.removeControl('child')
|
||||
control.controls[indexVal].controls['sales_qty'].setValue("");
|
||||
control.controls[indexVal].controls['sales_qty'].clearValidators();
|
||||
control.controls[indexVal].controls['sales_qty'].updateValueAndValidity();
|
||||
@ -243,6 +272,36 @@ let control: any = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
|
||||
control.controls[indexVal].controls['margin_per_uom'].setValue("");
|
||||
|
||||
this.salesCalculation(indexVal,control.controls[indexVal].value);
|
||||
this.deleteAllDailySales(indexVal);
|
||||
}
|
||||
else if( event.value == "3"){
|
||||
this.salesCalculation_kutchaRecords(indexVal,control.controls[indexVal].value)
|
||||
control.controls[indexVal].controls['fk_frequency_id'].setValue("");
|
||||
control.controls[indexVal].controls['fk_frequency_id'].clearValidators();
|
||||
control.controls[indexVal].controls['fk_frequency_id'].updateValueAndValidity();
|
||||
|
||||
control.controls[indexVal].controls['rate_per_unit'].setValue("")
|
||||
control.controls[indexVal].controls['rate_per_unit'].clearValidators();
|
||||
control.controls[indexVal].controls['rate_per_unit'].updateValueAndValidity();
|
||||
|
||||
|
||||
control.controls[indexVal].controls['sales_qty'].setValue("");
|
||||
control.controls[indexVal].controls['sales_qty'].clearValidators();
|
||||
control.controls[indexVal].controls['sales_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();
|
||||
|
||||
control.controls[indexVal].controls['margin_per_uom'].setValue("");
|
||||
this.salesCalculation_kutchaRecords(indexVal,control.controls[indexVal].value)
|
||||
|
||||
control.controls[indexVal].addControl('child',this._fb.array([this.createDailySalesData(sci_id)]))
|
||||
|
||||
let childControl: any = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
|
||||
childControl=control.controls[indexVal].controls['child']
|
||||
childControl.controls[0].controls.sales_date.setValidators(Validators.compose([Validators.required]))
|
||||
childControl.controls[0].controls.sales_value.setValidators(Validators.compose([Validators.required]))
|
||||
}
|
||||
}
|
||||
|
||||
@ -260,6 +319,38 @@ submitDetails(records) {
|
||||
this.notifier.notify('warning',"Please Check All Manatory Fields..");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
records.salesCalItemwise.forEach(parVal => {
|
||||
if(parVal.child){
|
||||
let transformData = parVal.child.filter(val=>val.sales_date!='' && val.sales_date!=null && val.sales_date!=undefined && val.sales_value!='' && val.isactive===true).map(mval=>{
|
||||
mval.custum_date = this.pipe.transform(mval.sales_date, 'yyyy-MM');
|
||||
return mval;
|
||||
});
|
||||
// console.log("entered",transformData);
|
||||
// console.log("transform_data",transformData);
|
||||
if(transformData.length>0) {
|
||||
let getUniqueMonthCounts = transformData.map(val=>val.custum_date)
|
||||
.filter((fVal,fIndex,fArray)=>{
|
||||
return fIndex === fArray.indexOf(fVal);
|
||||
});
|
||||
let tot_month:number=parseInt(getUniqueMonthCounts.length)
|
||||
let getTotalValueCounts:number = transformData.map(val=>val.sales_value)
|
||||
.reduce((sum, curr) =>parseFloat(sum) +parseFloat(curr));
|
||||
// console.log("getUniqueMonthCounts",getUniqueMonthCounts);
|
||||
// console.log("getTotalValueCounts",getTotalValueCounts);
|
||||
parVal.annual_sale_value=((12/tot_month)*getTotalValueCounts)
|
||||
}
|
||||
parVal.child.forEach(childVal => {
|
||||
if(childVal['custum_date']){
|
||||
delete childVal['custum_date'];
|
||||
}
|
||||
if(childVal['sales_date'])
|
||||
childVal['sales_date']=this.pipe.transform(childVal['sales_date'], 'yyyy-MM-dd');
|
||||
});
|
||||
}
|
||||
});
|
||||
// console.log(records.salesCalItemwise);
|
||||
this._pd.saveAssessedDetails('saveAssessedIncomeSalesCalculatedByItemwise',records.salesCalItemwise).subscribe(data => {
|
||||
this.notifier.notify('success', this.data.manage_status==2 ? 'Updated Successfully.' : 'Saved Successfully.');
|
||||
setTimeout(() =>{
|
||||
@ -284,4 +375,110 @@ submitDetails(records) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//For Kutcha Records
|
||||
|
||||
// remove daily items
|
||||
removeDailyItems(parentIndex: number,childIndex:number, childValue:any): void {
|
||||
let control: any = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
|
||||
control=control.controls[parentIndex].get('child') as FormArray;
|
||||
if(childValue.simc_id=='' || childValue.simc_id==null){
|
||||
control.removeAt(childIndex);
|
||||
let calculatControlValues: any = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
|
||||
calculatControlValues = calculatControlValues.controls[parentIndex];
|
||||
this.salesCalculation_kutchaRecords(parentIndex,calculatControlValues.value);
|
||||
}
|
||||
else {
|
||||
control.controls[childIndex].controls.isactive.setValue(false);
|
||||
let calculatControlValues: any = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
|
||||
calculatControlValues = calculatControlValues.controls[parentIndex];
|
||||
this.salesCalculation_kutchaRecords(parentIndex,calculatControlValues.value);
|
||||
}
|
||||
|
||||
}
|
||||
deleteAllDailySales(index){
|
||||
let control: any = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
|
||||
// console.log(control);
|
||||
if(control.controls[index].controls['child']){
|
||||
control=control.controls[index].controls['child']
|
||||
// console.log(control.length);
|
||||
while(control.controls.length !=1){
|
||||
control.removeAt(0);
|
||||
}
|
||||
control.controls[0].controls.sales_date.setValue('');
|
||||
control.controls[0].controls.sales_date.clearValidators()
|
||||
control.controls[0].controls.sales_date.updateValueAndValidity();
|
||||
|
||||
control.controls[0].controls.sales_value.setValue('')
|
||||
control.controls[0].controls.sales_value.clearValidators();
|
||||
control.controls[0].controls.sales_value.updateValueAndValidity();
|
||||
}
|
||||
}
|
||||
|
||||
// add more daily items
|
||||
addMoreDailySales(parentIndex: number,values: any): void{
|
||||
let control: any = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
|
||||
control=control.controls[parentIndex].get('child') as FormArray;
|
||||
control.push(this.createDailySalesData(values.sci_id));
|
||||
}
|
||||
|
||||
// create daily list
|
||||
createDailySalesWithData(values: any, parent: any) {
|
||||
return this._fb.group({
|
||||
simc_id: [values.simc_id],
|
||||
fk_sci_id: [parent.sci_id],
|
||||
sales_date: [new Date(this.pipe.transform(values.sales_date, 'yyyy-MM-dd')), Validators.compose([Validators.required])],
|
||||
sales_value: [values.sales_value, Validators.compose([Validators.required])],
|
||||
// fk_frequency_id:[values.fk_frequency_id],
|
||||
// frequency_value:[values.frequency_value],
|
||||
isactive:[true]
|
||||
})
|
||||
}
|
||||
// create daily list empty
|
||||
createDailySalesData(sci_id: string) {
|
||||
return this._fb.group({
|
||||
simc_id: [''],
|
||||
fk_sci_id: [sci_id],
|
||||
sales_date: ['',Validators.compose([Validators.required])],
|
||||
sales_value: ['', Validators.compose([Validators.required])],
|
||||
// fk_frequency_id:[''],
|
||||
// frequency_value:[''],
|
||||
isactive:[true],
|
||||
})
|
||||
}
|
||||
salesCalculation_kutchaRecords(indexVal: number,values: any): void {
|
||||
// console.log("margin_calc",this.data.margin_calculation_status)
|
||||
let control:any = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
|
||||
if(this.data.margin_calculation_status===true && values.sales_type=="3"){
|
||||
if(values.child){
|
||||
if(values.child.length>0 && values.margin_per!=''){
|
||||
let transformData = values.child.filter(val=>val.sales_date!='' && val.sales_date!=null && val.sales_date!=undefined && val.sales_value!='' && val.isactive===true).map(mval=>{
|
||||
mval.custum_date = this.pipe.transform(mval.sales_date, 'yyyy-MM');
|
||||
return mval;
|
||||
});
|
||||
// console.log("entered",transformData);
|
||||
if(transformData.length>0) {
|
||||
let getUniqueMonthCounts = transformData.map(val=>val.custum_date)
|
||||
.filter((fVal,fIndex,fArray)=>{
|
||||
return fIndex === fArray.indexOf(fVal);
|
||||
});
|
||||
let getTotalValueCounts = transformData.map(val=>val.sales_value)
|
||||
.reduce((sum, curr) =>parseFloat(sum) +parseFloat(curr));
|
||||
let calculatedValue =parseFloat(getTotalValueCounts) * (parseFloat(values.margin_per)/100) * (12 /parseFloat(getUniqueMonthCounts.length));
|
||||
control.controls[indexVal].controls['margin_final_value'].setValue(calculatedValue.toFixed(2));
|
||||
}
|
||||
else{
|
||||
control.controls[indexVal].controls['margin_final_value'].setValue("");
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
control.controls[indexVal].controls['margin_final_value'].setValue('');
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// console.log("margin",control.controls[indexVal])
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -46,12 +46,13 @@
|
||||
<th mat-header-cell *matHeaderCellDef> As Derived from Item Wise Sales </th>
|
||||
<td mat-cell *matCellDef="let element;let i = index">{{ i==7 ? element.derived_item_wise : i==10 ? element.derived_item_wise : element.derived_item_wise | rupeeCurrencyFormat}} </td>
|
||||
</ng-container>
|
||||
|
||||
|
||||
<!-- | rupeeCurrencyFormat -->
|
||||
|
||||
<!-- Position3 Column -->
|
||||
<ng-container matColumnDef="position_4">
|
||||
<th mat-header-cell *matHeaderCellDef> As Derived from Kuchha Sales Book/Bills </th>
|
||||
<td mat-cell *matCellDef="let element;let i = index">{{ i==7 ? element.derived_sales_book : i==10 ? element.derived_sales_book : element.derived_sales_book | rupeeCurrencyFormat}} </td>
|
||||
<!-- | rupeeCurrencyFormat -->
|
||||
</ng-container>
|
||||
|
||||
<!-- action Column -->
|
||||
@ -76,19 +77,20 @@
|
||||
<ng-template matTabContent>
|
||||
<app-gross-profit-calculation [masterData]="getCustomValues" [parentData]="grossProfitTypeList" (loadAssessedForms)="loadAIDetails()"></app-gross-profit-calculation>
|
||||
<app-sales-calculation [masterData]="getCustomValues" [parentData]="salesDeclaredCustomer" (loadAssessedForms)="loadAIDetails()"></app-sales-calculation>
|
||||
<app-sales-details [masterData]="getCustomValues" [parentData]="salesCaluatedItem" (loadAssessedForms)="loadAIDetails()"></app-sales-details>
|
||||
<app-daily-sales-details [masterData]="getCustomValues" [parentData]="salesMonthWiseExpandedItems" (loadAssessedForms)="loadAIDetails()"></app-daily-sales-details>
|
||||
<app-sales-details [masterData]="getCustomValues" [parentData]="salesMonthWiseExpandedItems" (loadAssessedForms)="loadAIDetails()"></app-sales-details>
|
||||
<!-- <app-daily-sales-details [masterData]="getCustomValues" [parentData]="salesMonthWiseExpandedItems" (loadAssessedForms)="loadAIDetails()"></app-daily-sales-details> -->
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
<mat-tab label="Purchase">
|
||||
<ng-template matTabContent>
|
||||
<app-gross-profit-calculation [masterData]="getCustomValues" [parentData]="grossProfitTypeList" (loadAssessedForms)="loadAIDetails()" TabLabel="Purchase"></app-gross-profit-calculation>
|
||||
<app-purchase-calculation [masterData]="getCustomValues" [parentData]="purchaseDeclaredCustomer" (loadAssessedForms)="loadAIDetails()"></app-purchase-calculation>
|
||||
<div *ngIf="PurchaseComponent">
|
||||
<app-purchase-details [masterData]="getCustomValues" [parentData]="purchaseDetails" (loadAssessedForms)="loadAIDetails()"></app-purchase-details>
|
||||
<app-purchase-details [masterData]="getCustomValues" [parentData]="purchaseBillWiseDetails" (loadAssessedForms)="loadAIDetails()"></app-purchase-details>
|
||||
</div>
|
||||
<div *ngIf="DailyPurchaseComponent">
|
||||
<!-- <div *ngIf="DailyPurchaseComponent">
|
||||
<app-daily-purchase-details [masterData]="getCustomValues" [parentData]="purchaseBillWiseDetails" (loadAssessedForms)="loadAIDetails()"></app-daily-purchase-details>
|
||||
</div>
|
||||
</div> -->
|
||||
<div *ngIf="!PurchaseComponent && !DailyPurchaseComponent">
|
||||
<p><strong>Purchase Item is Not Available.. </strong></p>
|
||||
</div>
|
||||
|
||||
@ -55,6 +55,7 @@ public businessExpenseList: any=[];
|
||||
public businessIncomeList: any=[];
|
||||
public grossProfitTypeList: any=[];
|
||||
public salesDeclaredCustomer: any=[];
|
||||
public purchaseDeclaredCustomer:any=[];
|
||||
public getCustomValues:any = { UOMList: this.UOMList,frequencyList: this.frequencyList,businessExpenseList: this.businessExpenseList,businessIncomeList:this.businessIncomeList,pdid:'',company_id:'',grossProfitTypeList:this.grossProfitTypeList,salesDeclaredCustomer:this.salesDeclaredCustomer};
|
||||
DailyPurchaseComponent:boolean;
|
||||
PurchaseComponent:boolean;
|
||||
@ -125,12 +126,15 @@ public viewerOptions: any = {
|
||||
this.getCustomValues.salesDeclaredCustomer=this.salesDeclaredCustomer;
|
||||
|
||||
}
|
||||
if(value.records.purchase_declared_by_customer){
|
||||
this.purchaseDeclaredCustomer=value.records.purchase_declared_by_customer
|
||||
this.getCustomValues.purchaseDeclaredCustomer=this.purchaseDeclaredCustomer
|
||||
}
|
||||
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;
|
||||
this.salesItemMonthWise.forEach((itemElement, itemIndex) => {
|
||||
// this.salesItemMonthWise = value.records.sales_items_by_monthwise;
|
||||
this.salesCaluatedItem.forEach((itemElement, itemIndex) => {
|
||||
if(itemElement.sales_type == "3"){
|
||||
let expandBodyContent= Object.keys(itemElement.items).map(key => ({ header:key, value: itemElement.items[key] }));
|
||||
let listItems: any=[];
|
||||
expandBodyContent.forEach((expnadElement, expnadIndex) => {
|
||||
@ -151,20 +155,49 @@ public viewerOptions: any = {
|
||||
// message: ' Yearly ' + itemElement.sales_item + ' Sales Arrived',
|
||||
// value: calculateAllItemsTotal * convertYear,
|
||||
// })
|
||||
this.salesMonthWiseExpandedItems.push({sim_id:itemElement.sim_id,salesItem:itemElement.sales_item,otherSalesItem:itemElement.other_sales_item,sales_type:itemElement.sales_type,comments:itemElement.comments,margin_per:itemElement.margin_per,margin_value:itemElement.margin_value, expandElements:expandBodyContent, footerMessage: footerMessage});
|
||||
this.salesMonthWiseExpandedItems.push({sci_id:itemElement.sci_id,sales_item:itemElement.sales_item,other_sales_item:itemElement.other_sales_item,sales_type:itemElement.sales_type,comments:itemElement.comments,margin_per:itemElement.margin_per,margin_per_uom:itemElement.margin_per_uom,rate_per_unit:itemElement.rate_per_unit,sales_qty:itemElement.sales_qty,uom_name:itemElement.uom_name,uom_other:itemElement.uom_other,margin_final_value:itemElement.margin_final_value,annual_sale_value:itemElement.annual_sale_value,fk_frequency_id:itemElement.fk_frequency_id,fk_uom_id:itemElement.fk_uom_id,frequency_name:itemElement.frequency_name, expandElements:expandBodyContent, footerMessage: footerMessage});
|
||||
}
|
||||
else{
|
||||
this.salesMonthWiseExpandedItems.push(itemElement)
|
||||
}
|
||||
// console.log("salesmonthwiseExpanded",this.salesMonthWiseExpandedItems);
|
||||
});
|
||||
|
||||
}
|
||||
// if(value.records.sales_items_by_monthwise){
|
||||
// this.salesItemMonthWise = value.records.sales_items_by_monthwise;
|
||||
// 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 + ' Month Sales : '+ calculateAllItemsTotal,
|
||||
// month_value:calculateAllItemsTotal,
|
||||
// year_message: ' Yearly Sales Arrived : '+ calculateAllItemsTotal * convertYear,
|
||||
// year_value: calculateAllItemsTotal * convertYear,
|
||||
// })
|
||||
// // footerMessage.push({
|
||||
// // message: ' Yearly ' + itemElement.sales_item + ' Sales Arrived',
|
||||
// // value: calculateAllItemsTotal * convertYear,
|
||||
// // })
|
||||
// this.salesMonthWiseExpandedItems.push({sim_id:itemElement.sim_id,salesItem:itemElement.sales_item,otherSalesItem:itemElement.other_sales_item,sales_type:itemElement.sales_type,comments:itemElement.comments,margin_per:itemElement.margin_per,margin_value:itemElement.margin_value, expandElements:expandBodyContent, footerMessage: footerMessage});
|
||||
// });
|
||||
// }
|
||||
this.PurchaseComponent = value.records.gross_profit_calculation_type[value.records.gross_profit_calculation_type.length-1].mode==1 && value.records.gross_profit_calculation_type[value.records.gross_profit_calculation_type.length-1].purchase_type==1 ? true : false;
|
||||
|
||||
if(value.records.purchase_details){
|
||||
this.purchaseDetails = value.records.purchase_details;
|
||||
}
|
||||
this.DailyPurchaseComponent = value.records.gross_profit_calculation_type[value.records.gross_profit_calculation_type.length-1].mode==1 && value.records.gross_profit_calculation_type[value.records.gross_profit_calculation_type.length-1].purchase_type==2 ? true : false;
|
||||
|
||||
if(value.records.purchase_billwise){
|
||||
this.purchaseBillWise = value.records.purchase_billwise;
|
||||
// this.purchaseBillWise = value.records.purchase_billwise;
|
||||
|
||||
this.purchaseBillWise.forEach((billElement, itemIndex) => {
|
||||
this.purchaseDetails.forEach((billElement, itemIndex) => {
|
||||
if(billElement.purchase_type == "3"){
|
||||
|
||||
let result = Object.assign({}, ...billElement.items);
|
||||
let expandBodyContent= Object.keys(result).map(key => ({ header:key, value: result[key] }));
|
||||
@ -187,9 +220,58 @@ public viewerOptions: any = {
|
||||
year_value: calculateAllItemsTotal * convertYear,
|
||||
})
|
||||
|
||||
this.purchaseBillWiseDetails.push({pbw_id:billElement.pbw_id,purchaseItem:billElement.purchase_item,otherPurchaseItem:billElement.other_purchase_item,comments:billElement.comments,annual_purchase_value:billElement.annual_purchase_value, expandElements:expandBodyContent, footerMessage: footerMessage});
|
||||
// this.purchaseBillWiseDetails.push({purchase_id:billElement.purchase_id,purchaseItem:billElement.purchase_item,otherPurchaseItem:billElement.other_purchase_item,comments:billElement.comments,annual_purchase_value:billElement.annual_purchase_value, expandElements:expandBodyContent, footerMessage: footerMessage});
|
||||
this.purchaseBillWiseDetails.push({
|
||||
"purchase_id":billElement.purchase_id,
|
||||
"purchase_item":billElement.purchase_item,
|
||||
"other_purchase_item":billElement.other_purchase_item,
|
||||
"comments":billElement.comments,
|
||||
"annual_purchase_value":billElement.annual_purchase_value,
|
||||
"fk_frequency_id":billElement.fk_frequency_id,
|
||||
"fk_uom_id":billElement.fk_uom_id,
|
||||
"purchase_qty":billElement.purchase_qty,
|
||||
"purchase_type":billElement.purchase_type,
|
||||
"rate_per_unit":billElement.rate_per_unit,
|
||||
"expandElements":expandBodyContent,
|
||||
"footerMessage": footerMessage
|
||||
})
|
||||
}
|
||||
else{
|
||||
this.purchaseBillWiseDetails.push(billElement)
|
||||
}
|
||||
});
|
||||
}
|
||||
this.DailyPurchaseComponent = value.records.gross_profit_calculation_type[value.records.gross_profit_calculation_type.length-1].mode==1 && value.records.gross_profit_calculation_type[value.records.gross_profit_calculation_type.length-1].purchase_type==2 ? true : false;
|
||||
|
||||
// if(value.records.purchase_billwise){
|
||||
// this.purchaseBillWise = value.records.purchase_billwise;
|
||||
|
||||
// this.purchaseBillWise.forEach((billElement, itemIndex) => {
|
||||
|
||||
// let result = Object.assign({}, ...billElement.items);
|
||||
// let expandBodyContent= Object.keys(result).map(key => ({ header:key, value: result[key] }));
|
||||
|
||||
// let listItems: any=[];
|
||||
|
||||
// expandBodyContent.forEach((expnadElement, expnadIndex) => {
|
||||
// let calculateItems = expnadElement.value.reduce((acc, calculate) => acc + Number(calculate.purchase_value), 0);
|
||||
// listItems.push({items:expnadElement, itemsTotal:calculateItems})
|
||||
// })
|
||||
|
||||
// let calculateAllItemsTotal:number=listItems.reduce((racc, rcalculate) => racc + Number(rcalculate.itemsTotal), 0);
|
||||
|
||||
// let convertYear : number = 12 / listItems.length;
|
||||
// let footerMessage: any=[];
|
||||
// footerMessage.push({
|
||||
// month_message: listItems.length + ' Monthly Purchase : '+ calculateAllItemsTotal,
|
||||
// month_value:calculateAllItemsTotal,
|
||||
// year_message: ' Yearly Purchase : '+ calculateAllItemsTotal * convertYear,
|
||||
// year_value: calculateAllItemsTotal * convertYear,
|
||||
// })
|
||||
|
||||
// this.purchaseBillWiseDetails.push({pbw_id:billElement.pbw_id,purchaseItem:billElement.purchase_item,otherPurchaseItem:billElement.other_purchase_item,comments:billElement.comments,annual_purchase_value:billElement.annual_purchase_value, expandElements:expandBodyContent, footerMessage: footerMessage});
|
||||
// });
|
||||
// }
|
||||
|
||||
if(value.records.business_expenses){
|
||||
this.businessExpenses=value.records.business_expenses;
|
||||
@ -335,6 +417,8 @@ public viewerOptions: any = {
|
||||
this.summaryItemSource=get_sumary;
|
||||
|
||||
}
|
||||
// console.log("salesItemMonthWise",this.salesItemMonthWise);
|
||||
// console.log("salesCaluatedItem",this.salesCaluatedItem);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
@ -25,7 +25,9 @@ export class DailySalesDetailsComponent implements OnInit, DoCheck {
|
||||
this.enableDailySalesSection = false;
|
||||
}
|
||||
|
||||
ngOnInit() {}
|
||||
ngOnInit() {
|
||||
console.log("master data",this.masterData);
|
||||
}
|
||||
|
||||
// get total cost
|
||||
getTotalCost(getItems:any) {
|
||||
|
||||
@ -15,16 +15,16 @@
|
||||
<mat-option *ngFor="let getSale of check_sales_type" [value]="getSale.id">{{getSale.name}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field> -->
|
||||
<div style="width: 35%" fxFlex="35" *ngIf="grossProfitForm.controls['mode'].value == 1">
|
||||
<!-- <div style="width: 35%" fxFlex="35" *ngIf="grossProfitForm.controls['mode'].value == 1"> -->
|
||||
|
||||
<!-- <mat-radio-group formControlName="margin" class="example-radio-group">
|
||||
<mat-radio-button class="example-radio-button" color="primary" [value]="types.id" *ngFor="let types of purchase_sub_type; let t = index">{{types.name}}</mat-radio-button>
|
||||
</mat-radio-group> -->
|
||||
<!-- <label id="example-radio-group-label">Pick Up purchase sub type</label> -->
|
||||
<mat-radio-group formControlName="purchase_type" class="example-radio-group">
|
||||
<!-- <mat-radio-group formControlName="purchase_type" class="example-radio-group">
|
||||
<mat-radio-button class="example-radio-button" color="primary" [value]="types.id" *ngFor="let types of purchase_sub_type; let t = index">{{types.name}}</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
|
||||
<button type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Save" matTooltipPosition="above" (click)="submitDetails(grossProfitForm.value)"><mat-icon>save</mat-icon>
|
||||
|
||||
@ -28,7 +28,8 @@ export class GrossProfitCalculationComponent implements OnInit, OnChanges {
|
||||
// console.log('values',values);
|
||||
|
||||
if(values.mode == 1){
|
||||
this.grossProfitForm.controls['margin'].setValue('');
|
||||
this.grossProfitForm.controls['margin'].setValue('');
|
||||
this.grossProfitForm.controls['purchase_type'].setValue('1');
|
||||
}
|
||||
|
||||
/** if Mode Value is 'No' -> margin value is setted as netmargin and its id - 2
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
<form [formGroup]="purchaseCalculationForm" novalidate *ngIf="activateMariginCalculation">
|
||||
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<mat-card-title>Purchase Calculation</mat-card-title>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<mat-form-field style="width: 85%">
|
||||
<input matInput OnlyNumber type="text" placeholder="Purchase Declared by the Customer as the Annual Sales Actually Done" formControlName="purchase_declared_by_customer" required>
|
||||
<mat-hint align="start" style="font-size:90%" *ngIf="purchaseCalculationForm.value.purchase_declared_by_customer != ''">{{"₹"}} {{purchaseCalculationForm.value.purchase_declared_by_customer | numberToWords}} Only</mat-hint>
|
||||
</mat-form-field>
|
||||
<!-- {{purchaseCalculationForm.value.sales_declared_by_customer}} -->
|
||||
<!-- <mat-form-field style="width: 40%" *ngIf="activateMariginCalculation">
|
||||
<input matInput OnlyNumber type="text" placeholder="Net Margin %" formControlName="margin_per" (keyup)="salesCalculation(salesCalculationForm.value)" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 41%" *ngIf="activateMariginCalculation">
|
||||
<input matInput OnlyNumber type="text" placeholder="Net Profit Value" formControlName="margin_value" readonly>
|
||||
<mat-hint align="start" style="font-size:90%" *ngIf="purchaseCalculationForm.value.margin_value != ''">{{"₹"}} {{salesCalculationForm.value.margin_value | numberToWords}} Only</mat-hint>
|
||||
</mat-form-field> -->
|
||||
<mat-form-field style="width: 85%">
|
||||
<textarea matInput type="text" placeholder="Remarks" formControlName="comments"></textarea>
|
||||
</mat-form-field>
|
||||
<button type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Save" matTooltipPosition="above" (click)="submitDetails(purchaseCalculationForm.value)"><mat-icon>save</mat-icon>
|
||||
</button>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</form>
|
||||
@ -0,0 +1,3 @@
|
||||
mat-form-field {
|
||||
margin: 0 2%;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PurchaseCalculationComponent } from './purchase-calculation.component';
|
||||
|
||||
describe('PurchaseCalculationComponent', () => {
|
||||
let component: PurchaseCalculationComponent;
|
||||
let fixture: ComponentFixture<PurchaseCalculationComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ PurchaseCalculationComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PurchaseCalculationComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,112 @@
|
||||
import { Component, OnInit, Input, Output, EventEmitter, SimpleChanges } from '@angular/core';
|
||||
import { FormGroup,FormArray,FormBuilder, FormControl, Validators} from '@angular/forms'
|
||||
import {NotifierService} from 'angular-notifier'
|
||||
import { PdTrigerService } from './../../../../../../pd-service/pd-triger.service';
|
||||
import { AwsService } from '../../../../../../../AwsService/aws.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-purchase-calculation',
|
||||
templateUrl: './purchase-calculation.component.html',
|
||||
styleUrls: ['./purchase-calculation.component.scss']
|
||||
})
|
||||
export class PurchaseCalculationComponent implements OnInit {
|
||||
@Input() parentData: any;
|
||||
@Input() masterData: { pdid:number,company_id:number,grossProfitTypeList:any};
|
||||
@Output() loadAssessedForms = new EventEmitter<string>();
|
||||
purchaseCalculationForm:FormGroup;
|
||||
activateMariginCalculation: boolean;
|
||||
enableCalculationSection: boolean=false;
|
||||
// private notifier: NotifierService;
|
||||
constructor(private notifier:NotifierService,private _pd:PdTrigerService, private _fb:FormBuilder,private _aws:AwsService) { }
|
||||
|
||||
ngOnInit() {
|
||||
// console.log("parent data",this.parentData);
|
||||
// console.log("masterdata",this.masterData)
|
||||
}
|
||||
|
||||
submitDetails(records) {
|
||||
if (this.purchaseCalculationForm.invalid) {
|
||||
this.validateAllFormFields(this.purchaseCalculationForm);
|
||||
this.notifier.notify('warning',"Please Check All Manatory Fields..");
|
||||
return;
|
||||
}
|
||||
if(records.pdc_id !='' && records.pdc_id != null){
|
||||
records.fk_updatedby=this._aws.getlocale();
|
||||
}
|
||||
else{
|
||||
records.fk_createdby=this._aws.getlocale();
|
||||
records.fk_updatedby=""
|
||||
}
|
||||
console.log(records)
|
||||
this._pd.saveAssessedIncomePurchaseDeclaredByCustomer(records).subscribe(data => {
|
||||
this.notifier.notify('success', 'Saved Successfully.');
|
||||
this.loadAssessedForms.next('1');
|
||||
}, error => {
|
||||
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||
this.loadAssessedForms.next('1');
|
||||
});
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
});
|
||||
}
|
||||
// do check component bases
|
||||
ngDoCheck() {
|
||||
if(this.masterData.grossProfitTypeList.length>0){
|
||||
// this.activateMariginCalculation = this.masterData.grossProfitTypeList[this.masterData.grossProfitTypeList.length-1].margin==2 && this.masterData.grossProfitTypeList[this.masterData.grossProfitTypeList.length-1].mode==2 ? true : false;
|
||||
this.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.enableCalculationSection=true;
|
||||
}
|
||||
// this.activateMariginCalculation===true ? this.salesCalculationForm.controls['margin_per'].setValidators([Validators.required]) : this.salesCalculationForm.controls['margin_per'].clearValidators();
|
||||
// this.salesCalculationForm.controls['margin_per'].updateValueAndValidity();
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
console.log("change ngOn");
|
||||
// console.log('ngDoCheck this.activateMariginCalculation',this.activateMariginCalculation);
|
||||
// console.log('ngDoCheck this.masterData.grossProfitTypeList',changes.masterData);
|
||||
// console.log('82',changes.masterData.currentValue.grossProfitTypeList[changes.masterData.currentValue.grossProfitTypeList.length-1].mode);
|
||||
if(changes.masterData){
|
||||
if(changes.masterData.currentValue.grossProfitTypeList.length>0){
|
||||
this.activateMariginCalculation = changes.masterData.currentValue.grossProfitTypeList[changes.masterData.currentValue.grossProfitTypeList.length-1].margin==2 && changes.masterData.currentValue.grossProfitTypeList[changes.masterData.currentValue.grossProfitTypeList.length-1].mode==2 ? true : false;
|
||||
}
|
||||
}
|
||||
if(changes.parentData){
|
||||
if(changes.parentData.currentValue.length>0){
|
||||
this.purchaseCalculationForm = this._fb.group({
|
||||
pdc_id:[changes.parentData.currentValue[changes.parentData.currentValue.length-1].pdc_id],
|
||||
purchase_declared_by_customer:[changes.parentData.currentValue[changes.parentData.currentValue.length-1].purchase_declared_by_customer, Validators.compose([Validators.required])],
|
||||
fk_pd_id:[this.masterData.pdid],
|
||||
company_id:[this.masterData.company_id],
|
||||
// margin_per:[this.activateMariginCalculation===false ? '' : changes.parentData.currentValue[changes.parentData.currentValue.length-1].margin_per,this.activateMariginCalculation===true ? Validators.required: Validators.nullValidator],
|
||||
// margin_value:[this.activateMariginCalculation==false ? '' : changes.parentData.currentValue[changes.parentData.currentValue.length-1].margin_value],
|
||||
comments:[changes.parentData.currentValue[changes.parentData.currentValue.length-1].comments]
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.purchaseCalculationForm = this._fb.group({
|
||||
pdc_id:[''],
|
||||
purchase_declared_by_customer:['', Validators.required],
|
||||
fk_pd_id:[this.masterData.pdid],
|
||||
company_id:[this.masterData.company_id],
|
||||
// margin_per:['',this.activateMariginCalculation===true ? Validators.required: Validators.nullValidator],
|
||||
// margin_value:[''],
|
||||
comments:['']
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
<mat-card >
|
||||
<mat-card-content *ngIf="activateMariginCalculation;else notAvilable">
|
||||
<mat-card *ngIf="activateMariginCalculation;else notAvilable">
|
||||
<mat-card-content *ngIf="enablePurchaseItemSection">
|
||||
<div fxLayout="row nowrap">
|
||||
<div fxFlex="60" align="left">
|
||||
<!-- <span>Purchase Item</span> -->
|
||||
@ -86,8 +86,8 @@
|
||||
</table>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<ng-template #notAvilable>
|
||||
<!-- <strong>Purchase Item is Not Available.. </strong> -->
|
||||
</ng-template>
|
||||
</mat-card>
|
||||
<notifier-container></notifier-container>
|
||||
|
||||
@ -15,8 +15,9 @@ export class PurchaseDetailsComponent implements OnInit, DoCheck {
|
||||
activateMariginCalculation:boolean;
|
||||
private notifier: NotifierService;
|
||||
@Input() parentData: any;
|
||||
@Input() masterData: { UOMList: any; frequencyList: any;businessExpenseList:any,businessIncomeList: any, pdid:number,company_id:number, grossProfitTypeList:any};
|
||||
@Input() masterData: { UOMList: any; frequencyList: any;businessExpenseList:any,businessIncomeList: any, pdid:number,company_id:number, grossProfitTypeList:any,purchaseDeclaredCustomer:any};
|
||||
@Output() loadAssessedForms = new EventEmitter<string>();
|
||||
enablePurchaseItemSection: boolean;
|
||||
constructor(notifier: NotifierService,private _pd: PdTrigerService, private dialog: MatDialog) {
|
||||
this.activateMariginCalculation=false;
|
||||
this.notifier = notifier;
|
||||
@ -46,10 +47,33 @@ export class PurchaseDetailsComponent implements OnInit, DoCheck {
|
||||
|
||||
}
|
||||
editPurchaseItem(value:any) {
|
||||
let editValue:any;
|
||||
if(value.purchase_type =="3"){
|
||||
let transformData: any = value.expandElements.map(val=>val.value);
|
||||
transformData = [].concat.apply([], transformData);
|
||||
editValue = {
|
||||
"fk_pd_id":this.masterData.pdid,
|
||||
"purchase_id":value.purchase_id,
|
||||
"purchase_item":value.purchase_item,
|
||||
"other_purchase_item":value.other_purchase_item,
|
||||
"comments":value.comments,
|
||||
"annual_purchase_value":value.annual_purchase_value,
|
||||
"fk_frequency_id":value.fk_frequency_id,
|
||||
"fk_uom_id":value.fk_uom_id,
|
||||
"purchase_qty":value.purchase_qty,
|
||||
"purchase_type":value.purchase_type,
|
||||
"rate_per_unit":value.rate_per_unit,
|
||||
"values":transformData,
|
||||
}
|
||||
}
|
||||
else{
|
||||
editValue=value
|
||||
}
|
||||
// console.log("editValue",editValue);
|
||||
let passValues: any = {
|
||||
manage_status:2,
|
||||
masterData: this.masterData,
|
||||
editData:value
|
||||
editData:editValue
|
||||
}
|
||||
const dialogRef = this.dialog.open(ManagePurchaseComponent, {
|
||||
data: passValues,
|
||||
@ -90,6 +114,7 @@ ngDoCheck() {
|
||||
if(this.masterData.grossProfitTypeList.length>0){
|
||||
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.enablePurchaseItemSection = this.masterData.purchaseDeclaredCustomer.length>0 ? true : false;
|
||||
this.purchaseItemSource.data = this.parentData;
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ import { Component, OnInit, Input, Output, Inject, EventEmitter, DoCheck, OnChan
|
||||
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
|
||||
import { PdTrigerService } from './../../../../../../pd-service/pd-triger.service';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
import { AwsService } from 'app/AwsService/aws.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-sales-calculation',
|
||||
@ -16,7 +17,7 @@ export class SalesCalculationComponent implements OnInit, OnChanges, DoCheck {
|
||||
activateMariginCalculation: boolean;
|
||||
private notifier: NotifierService;
|
||||
enableCalculationSection: boolean;
|
||||
constructor(notifier:NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService) {
|
||||
constructor(notifier:NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService,private _aws:AwsService) {
|
||||
this.activateMariginCalculation=false;
|
||||
this.notifier = notifier;
|
||||
this.enableCalculationSection=false;
|
||||
@ -39,6 +40,7 @@ submitDetails(records) {
|
||||
this.notifier.notify('warning',"Please Check All Manatory Fields..");
|
||||
return;
|
||||
}
|
||||
records.fk_createdby=this._aws.getlocale();
|
||||
this._pd.saveAssessedDetails('saveAssessedIncomeSalesDeclaredByCustomer',records).subscribe(data => {
|
||||
this.notifier.notify('success', 'Saved Successfully.');
|
||||
this.loadAssessedForms.next('1');
|
||||
|
||||
@ -25,6 +25,8 @@ export class SalesDetailsComponent implements OnInit, DoCheck {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
// console.log("parent data",this.parentData);
|
||||
|
||||
}
|
||||
|
||||
// add more item details
|
||||
@ -49,10 +51,33 @@ addMoreItem():void {
|
||||
|
||||
}
|
||||
editSalesItem(value:any) {
|
||||
let editValue: any
|
||||
if(value.sales_type == "3"){
|
||||
let transformData: any = value.expandElements.map(val=>val.value);
|
||||
transformData = [].concat.apply([], transformData);
|
||||
editValue = {
|
||||
sci_id:value.sci_id,sales_item:value.sales_item,other_sales_item:value.other_sales_item,sales_type:value.sales_type,comments:value.comments,margin_per:value.margin_per,margin_per_uom:value.margin_per_uom,rate_per_unit:value.rate_per_unit,sales_qty:value.sales_qty,uom_name:value.uom_name,uom_other:value.uom_other,margin_final_value:value.margin_final_value,annual_sale_value:value.annual_sale_value,fk_frequency_id:value.fk_frequency_id,fk_uom_id:value.fk_uom_id,frequency_name:value.frequency_name,
|
||||
// "fk_pd_id":this.masterData.pdid,
|
||||
// "sci_id":value.sci_id,
|
||||
// "sales_item":value.sales_item,
|
||||
// "other_sales_item":value.other_sales_item,
|
||||
// "sales_type":value.sales_type,
|
||||
// "comments":value.comments,
|
||||
// "margin_final_value":value.margin_final_value,
|
||||
// "margin_per":value.margin_per,
|
||||
// margin_per_uom:value.margin_per_uom,
|
||||
// annual_sale_value:value.annual_sale_value,
|
||||
"values":transformData,
|
||||
}
|
||||
}
|
||||
else{
|
||||
editValue=value
|
||||
}
|
||||
// console.log("edit data",editValue);
|
||||
let passValues: any = {
|
||||
manage_status:2,
|
||||
masterData: this.masterData,
|
||||
editData:value,
|
||||
editData:editValue,
|
||||
margin_calculation_status:this.activateMariginCalculation,
|
||||
|
||||
}
|
||||
@ -89,6 +114,12 @@ removeSalesItem(value: any) : void{
|
||||
|
||||
// do check component bases
|
||||
ngDoCheck() {
|
||||
// this.parentData.forEach(itemElement=>{
|
||||
// if(itemElement.sales_type == "3"){
|
||||
// itemElement.annual_sale_value=itemElement.footerMessage[0].year_value
|
||||
// }
|
||||
// })
|
||||
// console.log(this.parentData)
|
||||
this.salesItemSource.data = this.parentData;
|
||||
|
||||
if(this.masterData.grossProfitTypeList.length>0){
|
||||
|
||||
@ -81,9 +81,18 @@
|
||||
<input matInput placeholder="Pin" formControlName="residence_pin" required>
|
||||
</mat-form-field> -->
|
||||
|
||||
<mat-form-field style="width:45%;">
|
||||
<!-- <mat-form-field style="width:45%;">
|
||||
<input matInput placeholder="No of years in current residence" formControlName="residence_No_of_years"
|
||||
OnlyNumber type="text" required>
|
||||
</mat-form-field> -->
|
||||
<br/> <h5>No of years in current residence</h5><br/>
|
||||
<mat-form-field >
|
||||
<input matInput placeholder="Year" formControlName="residence_No_of_years"
|
||||
OnlyNumber type="text" required>
|
||||
</mat-form-field>
|
||||
<mat-form-field >
|
||||
<input matInput placeholder="Month" formControlName="residence_No_of_months"
|
||||
OnlyNumber type="text" required>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
|
||||
@ -294,6 +294,7 @@ export class FamilyDetailsComponent implements OnInit {
|
||||
residence_pin: ['', Validators.compose([])],
|
||||
residence_other_pincode: [''],
|
||||
residence_No_of_years: ['', Validators.compose([])],
|
||||
residence_No_of_months:['',Validators.compose([])],
|
||||
residence_ownership: ['', Validators.compose([])],
|
||||
ownershipOther: [''],
|
||||
rent: [''],
|
||||
@ -320,6 +321,7 @@ export class FamilyDetailsComponent implements OnInit {
|
||||
residence_pin: [val.residence_pin, Validators.compose([])],
|
||||
residence_other_pincode: [val.residence_other_pincode],
|
||||
residence_No_of_years: [val.residence_No_of_years, Validators.compose([])],
|
||||
residence_No_of_months:[val.residence_No_of_months || ''],
|
||||
residence_ownership: [val.residence_ownership, Validators.compose([])],
|
||||
ownershipOther: [val.ownershipOther || null],
|
||||
rent: [val.rent || null],
|
||||
|
||||
@ -193,6 +193,8 @@ export class FinancialInfoComponent implements OnInit {
|
||||
}
|
||||
if (val.exist_status == 1 && val.id == 3) {
|
||||
this.financialForm.addControl('cash_credit_limit', new FormControl(''));
|
||||
console.log("retrivedata",retriveData)
|
||||
!retriveData.hasOwnProperty('cash_credit_limit')? retriveData.cash_credit_limit='' : retriveData.cash_credit_limit
|
||||
}
|
||||
if (val.exist_status == 1 && val.id == 4) {
|
||||
this.financialForm.addControl('factoring', new FormControl(''));
|
||||
@ -202,6 +204,7 @@ export class FinancialInfoComponent implements OnInit {
|
||||
}
|
||||
if (val.exist_status == 1 && val.id == 6) {
|
||||
this.financialForm.addControl('letter_of_credit', new FormControl(''));
|
||||
|
||||
}
|
||||
if (val.exist_status == 1 && val.id == 7) {
|
||||
this.financialForm.addControl('od_limit', new FormControl(''));
|
||||
|
||||
@ -194,7 +194,7 @@
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width:46%;">
|
||||
<mat-select multiple placeholder="Name of the proposed owner" formControlName="owner_name"
|
||||
<mat-select multiple [placeholder]="Owner_placeholder" formControlName="owner_name"
|
||||
[compareWith]="compareObjects">
|
||||
<mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
|
||||
<mat-option *ngFor="let val of group.groupValues" [value]="val">
|
||||
@ -250,7 +250,7 @@
|
||||
|
||||
<mat-form-field style="width:96%;">
|
||||
<input matInput
|
||||
placeholder="Address"
|
||||
[placeholder]="address_placeholder"
|
||||
formControlName="address"
|
||||
required autocomplete="off">
|
||||
</mat-form-field>
|
||||
|
||||
@ -82,6 +82,8 @@ export class LoanDetailsComponent implements OnInit {
|
||||
companies: any = [];
|
||||
typeofproperties:any = [];
|
||||
generalFormApplicantList:any = [];
|
||||
Owner_placeholder:string;
|
||||
address_placeholder: string;
|
||||
/** Constructor Of the Class */
|
||||
constructor(notifier: NotifierService,
|
||||
private fb: FormBuilder,
|
||||
@ -114,6 +116,14 @@ export class LoanDetailsComponent implements OnInit {
|
||||
if (this.productAbbr == 'PL' || this.productAbbr == 'BL' || this.productAbbr == 'LAP') {
|
||||
this.isContribution = true;
|
||||
}
|
||||
if(this.productAbbr == 'HL' || this.productAbbr == 'NRPL' || this.productAbbr == 'LL'){
|
||||
this.Owner_placeholder="Name of the proposed owner"
|
||||
this.address_placeholder="Address of the proposed property"
|
||||
}
|
||||
else{
|
||||
this.Owner_placeholder='Name of Owner'
|
||||
this.address_placeholder="Address of Property"
|
||||
}
|
||||
|
||||
}
|
||||
documentsAndFilesList: any = [];
|
||||
|
||||
@ -680,8 +680,11 @@ export class ManageRentalVerificationComponent implements OnInit {
|
||||
|
||||
// calculate expiry date
|
||||
calculateExpiryDate(e: any,index){
|
||||
|
||||
let control: any = <FormArray>this._rentalForm.controls['property_unit_details'];
|
||||
console.log("data",this._rentalForm.value);
|
||||
let getSeletedDate: any=control.value[index].agreement_date ? this.pipe.transform(control.value[index].agreement_date, 'yyyy/MM/dd'): '';
|
||||
console.log(getSeletedDate)
|
||||
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)));
|
||||
@ -706,6 +709,7 @@ export class ManageRentalVerificationComponent implements OnInit {
|
||||
control.controls[index].controls['rental_remaining_months'].setValue('');
|
||||
|
||||
}
|
||||
console.log("end",this._rentalForm.value)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
</h2>
|
||||
|
||||
<div *ngIf="noRecordsFound" style="max-width: 100vw !important;width: 100% !important;height: 95% !important;">
|
||||
<form [formGroup]="stockForms" (submit)="submitDetails($event); false;">
|
||||
<form [formGroup]="stockForms" (submit)="submitDetails($event.value); ">
|
||||
<mat-dialog-content style="border-bottom: 2px solid #e2412f8f;">
|
||||
<mat-tab-group>
|
||||
<mat-tab label="Questions">
|
||||
|
||||
@ -13,6 +13,7 @@ import { analyzeAndValidateNgModules } from '@angular/compiler';
|
||||
import { ImageCropComponent } from '../dialogue/image-crop/image-crop.component';
|
||||
|
||||
@Component({
|
||||
// changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
selector: 'app-stock',
|
||||
templateUrl: './stock.component.html',
|
||||
styleUrls: ['./stock.component.scss']
|
||||
@ -205,7 +206,7 @@ export class StockComponent implements OnInit {
|
||||
if (val.products) {
|
||||
// this.serviceProviderForm = true;
|
||||
let servicing_temparr = [];
|
||||
if(dataForm.hasOwnProperty('service_provider')){
|
||||
if(dataForm.hasOwnProperty('servicing_details')){
|
||||
servicing_temparr['service_provider'] = dataForm.servicing_details[0].service_provider;
|
||||
this.initServicingDetails(servicing_temparr);
|
||||
}
|
||||
@ -646,7 +647,7 @@ export class StockComponent implements OnInit {
|
||||
|
||||
|
||||
initServicingDetails(datas) {
|
||||
|
||||
console.log("initservicing details entered")
|
||||
const service = <FormArray>this.stockForms.controls['servicing_details']['controls'][0].controls['service_provider'];
|
||||
if (datas === null) {
|
||||
|
||||
@ -671,6 +672,7 @@ export class StockComponent implements OnInit {
|
||||
|
||||
} else {
|
||||
if (datas.service_provider !== undefined) {
|
||||
console.log("servicing details",datas)
|
||||
|
||||
datas.service_provider.forEach((val, index) => {
|
||||
this.checkComments(val.service_provider_observed, 5, index);
|
||||
@ -720,6 +722,16 @@ export class StockComponent implements OnInit {
|
||||
control.push(this.createRawmaterial(null));
|
||||
}
|
||||
}
|
||||
addServiceProvider(flag){
|
||||
if(flag == 2){
|
||||
const control=<FormArray>this.stockForms.controls['servicing_details']['controls'][0].controls['service_provider'];
|
||||
control.push(this.createServiceProvider(null))
|
||||
}
|
||||
}
|
||||
deleteServiceProvider(index,flag){
|
||||
const control=<FormArray>this.stockForms.controls['servicing_details']['controls'][0].controls['service_provider'];
|
||||
control.removeAt(index)
|
||||
}
|
||||
|
||||
/** Manufacturing -> To Remove Raw Material Details */
|
||||
deleteRawMaterials(index, flag) {
|
||||
|
||||
@ -373,12 +373,19 @@
|
||||
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
|
||||
<mat-form-field style="width: 45%">
|
||||
<mat-select placeholder="Service Provide Name"
|
||||
<!-- <mat-select placeholder="Service Provide Name"
|
||||
formControlName="service_provider_name">
|
||||
<mat-option *ngFor="let sp of m_serviceProvider"
|
||||
[value]="sp.name">{{
|
||||
sp.name }}</mat-option>
|
||||
</mat-select>
|
||||
</mat-select> -->
|
||||
<input matInput placeholder="Service Name" formControlName="service_provider_name"
|
||||
[matAutocomplete]="serviceName_auto">
|
||||
<mat-autocomplete #serviceName_auto="matAutocomplete">
|
||||
<mat-option *ngFor="let sp of m_serviceProvider"
|
||||
[value]="sp.name">
|
||||
{{sp.name }}</mat-option>
|
||||
</mat-autocomplete>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 45%">
|
||||
<input matInput placeholder="Supplier Name"
|
||||
|
||||
@ -208,10 +208,24 @@
|
||||
<span *ngIf="addresses.state_name" class="hover-icon"> {{addresses.addressline1}},<br> {{addresses.city_name}},<br>{{addresses.state_name}}-{{addresses.pincode_id == 1 ? addresses.other_pincode : addresses.pincode }} </span>
|
||||
</div>
|
||||
</div>
|
||||
<div fxLayout="row nowrap" *ngIf="addresses.addtional_pd_data.length>0" style="color: #e00201">
|
||||
<div fxLayout="row nowrap" style="color: #e00201" *ngIf="addresses.addtional_pd_data.length>0" >
|
||||
<span fxFlex="10" ><mat-icon>people</mat-icon></span>
|
||||
<span fxFlex="90" *ngIf="addresses.addtional_pd_data[0].customer_segment_abbr"> {{addresses.addtional_pd_data[0].customer_segment_abbr}} </span>
|
||||
<span fxFlex="50" *ngIf="addresses.addtional_pd_data[0].customer_segment_abbr"> {{addresses.addtional_pd_data[0].customer_segment_abbr}} </span>
|
||||
<div fxFlex="40" align="right" style="color: #e00201" *ngIf="addresses.addtional_pd_data && addresses.addtional_pd_data[0].is_otp_done">
|
||||
<div *ngIf="addresses.addtional_pd_data[0].is_otp_done == '1'">
|
||||
<span >OTP Done:</span> <span ><mat-icon style="color:green">check_circle</mat-icon> </span>
|
||||
</div>
|
||||
<div *ngIf="addresses.addtional_pd_data[0].is_otp_done == '0'">
|
||||
<span > OTP Done:<mat-icon style="color:#e00201">cancel</mat-icon> </span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div fxLayout="row nowrap" *ngIf="addresses.addtional_pd_data.length>0" >
|
||||
<div align="left" *ngIf="addresses.addtional_pd_data[0].is_otp_done == '0' && addresses.addtional_pd_data[0].rejection_reason != null">
|
||||
<mat-label><span style="color: #e00201">OTP Reject Reason: </span> <span>{{addresses.addtional_pd_data[0].rejection_reason != 'Others' ? addresses.addtional_pd_data[0].rejection_reason : addresses.addtional_pd_data[0].otp_reject_other_reason}}</span></mat-label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</mat-card-content>
|
||||
<!-- <mat-divider></mat-divider> -->
|
||||
|
||||
@ -337,7 +351,7 @@
|
||||
<button mat-icon-button matTooltip="Save" matTooltipPosition="above" (click)="saveNotes()">
|
||||
<mat-icon style="color:#e00201;font-size:30px;">send</mat-icon>
|
||||
</button>
|
||||
<div *ngIf="masterPdLogsData.length>0; else nohistory">
|
||||
<div *ngIf="display_new_notes.length>0; else nohistory">
|
||||
<div *ngFor="let master of display_new_notes;let even=even;let odd=odd">
|
||||
<mat-list class="m-gap p-gap" [ngClass]="{odd:odd,even:even}">
|
||||
<!-- <mat-card > -->
|
||||
@ -358,7 +372,7 @@
|
||||
</div>
|
||||
<ng-template #nohistory>
|
||||
<mat-card-content>
|
||||
<p>No History</p>
|
||||
<p>No Notes Available</p>
|
||||
</mat-card-content>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
|
||||
@ -89,6 +89,7 @@ export class ViewPdComponent implements OnInit, OnDestroy {
|
||||
// @Input() childData: string;
|
||||
// @Output() loadParent = new EventEmitter<string>();
|
||||
public _EditPDtriggerForm: FormGroup;
|
||||
// no_qc_remarks: boolean;
|
||||
constructor(notifier: NotifierService, private dialog: MatDialog, private _fb: FormBuilder,
|
||||
private _pd: PdTrigerService, private route: ActivatedRoute, private router: Router, private ListPdComponent: ListPdComponent) {
|
||||
this.notifier = notifier;
|
||||
@ -484,15 +485,21 @@ export class ViewPdComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
getAllNotes(){ //for getting the value of Notes Tab
|
||||
this._pd.getQCReportFinalReviewDetails(this.viewID,'ALL_REMARKS').subscribe(result=>{
|
||||
if(result.dataStatus == true){
|
||||
this.display_new_notes=result['records']
|
||||
let value=this.display_new_notes;
|
||||
this.display_new_notes=[]
|
||||
for(let i=value.length-1;i>=0;i--){
|
||||
console.log("value",value[i]);
|
||||
// console.log("value",value[i]);
|
||||
this.display_new_notes.push(value[i])
|
||||
}
|
||||
console.log("dis",this.display_new_notes)
|
||||
// console.log("dis",this.display_new_notes)
|
||||
}
|
||||
else{
|
||||
// this.no_qc_remarks=true
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
saveNotes(){
|
||||
console.log(this.newNotes);
|
||||
|
||||
@ -122,6 +122,7 @@ import { DailyPurchaseDetailsComponent } from './list-pd/start-pd/forms/assessed
|
||||
import { ManageRentalVerificationComponent } from './list-pd/start-pd/forms/rental-verification/manage-rental-verification/manage-rental-verification.component';
|
||||
import { FuturePlansAndBusinessEnvironmentComponent } from './list-pd/start-pd/forms/future-plans-and-business-environment/future-plans-and-business-environment.component';
|
||||
import { ImageCropComponent } from './list-pd/start-pd/forms/dialogue/image-crop/image-crop.component';
|
||||
import {PurchaseCalculationComponent} from './list-pd/start-pd/forms/assessed-income/purchase-calculation/purchase-calculation.component'
|
||||
|
||||
/**
|
||||
* Custom angular notifier options
|
||||
@ -168,7 +169,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 ,ManageDailyPurchaseComponent, DailyPurchaseDetailsComponent, ManageRentalVerificationComponent, FuturePlansAndBusinessEnvironmentComponent, ImageCropComponent],
|
||||
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, ManageRentalVerificationComponent, FuturePlansAndBusinessEnvironmentComponent, ImageCropComponent,PurchaseCalculationComponent],
|
||||
imports: [
|
||||
CommonModule,
|
||||
ManagePdRoutingModule,
|
||||
@ -201,7 +202,7 @@ 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, DailyPurchaseDetailsComponent, ManageDailyPurchaseComponent,ManageRentalVerificationComponent,ImageCropComponent],
|
||||
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,ManageRentalVerificationComponent,ImageCropComponent,PurchaseCalculationComponent],
|
||||
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],
|
||||
|
||||
@ -748,5 +748,10 @@ export class PdTrigerService {
|
||||
return this._http.post(this.apiUrl+'savePDRemark',values)
|
||||
.pipe(catchError(this.handleError('role',[])))
|
||||
}
|
||||
saveAssessedIncomePurchaseDeclaredByCustomer(values){
|
||||
return this._http.post(this.apiUrl+'saveAssessedIncomePurchaseDeclaredByCustomer',{records:values})
|
||||
.pipe(catchError(this.handleError('role',[])))
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -65,14 +65,33 @@
|
||||
<div style="margin: 12px;">
|
||||
|
||||
|
||||
<div *ngIf="reGenerateBtn">
|
||||
<div *ngIf="reGenerateBtn" style="width: 1200px; height: 450px;">
|
||||
<!-- <pdf-viewer [src]="latestPDDetails.doc_uri" [original-size]="false" [page]="1">
|
||||
</pdf-viewer> -->
|
||||
<iframe width="100%" frameBorder="0" [src]="urlSafe" #IFrameContent id="iframeId" style="height: -webkit-fill-available;" seamless></iframe>
|
||||
|
||||
<!-- <iframe width="100%" frameBorder="0" [src]="urlSafe" #IFrameContent id="iframeId" style="height: -webkit-fill-available;" seamless></iframe> -->
|
||||
<as-split direction="horizontal">
|
||||
<as-split-area [size]="pdf_src=='' ? 1500 : 100">
|
||||
<as-split direction="vertical">
|
||||
<as-split-area >
|
||||
|
||||
<p #dataContainer> </p>
|
||||
|
||||
</as-split-area>
|
||||
</as-split>
|
||||
</as-split-area>
|
||||
<as-split-area style="background-color:grey;" size="50" *ngIf="pdf_src !=''">
|
||||
<as-split direction="vertical">
|
||||
<as-split-area>
|
||||
<pdf-viewer [src]="pdf_src" [zoom]="0.8"></pdf-viewer>
|
||||
|
||||
</as-split-area>
|
||||
</as-split>
|
||||
</as-split-area>
|
||||
</as-split>
|
||||
<button style="position:absolute;z-index:2;bottom:3px;" type="button" mat-raised-button mat-icon-button class="mr-1 ml-1 hover-icon" matTooltip="Preview" matTooltipPosition="above" (click)="getPDreportPDF()" ><mat-icon>remove_red_eye</mat-icon></button>
|
||||
<!-- latestPDDetails.doc_uri -->
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { DomSanitizer, SafeResourceUrl, SafeUrl } from '@angular/platform-browser';
|
||||
import { Component, ViewChild, OnInit, ViewEncapsulation, OnDestroy, Inject } from '@angular/core';
|
||||
import { Component, ViewChild, OnInit, ViewEncapsulation, OnDestroy, Inject, ElementRef } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators, FormControl, FormArray, AbstractControl } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
@ -20,16 +20,18 @@ import { HttpResponse } from "@angular/common/http";
|
||||
import { environment } from 'environments/environment';
|
||||
import { QcNewComponent } from './qc-new/qc-new.component';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-qc-pd-report',
|
||||
templateUrl: './qc-pd-report.component.html',
|
||||
styleUrls: ['./qc-pd-report.component.scss']
|
||||
})
|
||||
export class QcPdReportComponent implements OnInit {
|
||||
|
||||
@ViewChild('dataContainer',{read: ElementRef}) dataContainer: ElementRef;
|
||||
@ViewChild('sidenav') sidenav: MatSidenav;
|
||||
|
||||
reason = '';
|
||||
loadComponent: boolean=false;
|
||||
|
||||
close(reason: string) {
|
||||
this.reason = reason;
|
||||
@ -61,6 +63,7 @@ export class QcPdReportComponent implements OnInit {
|
||||
apiUrl:string = environment.apiEndpoint;
|
||||
reportRandomString : string;
|
||||
arra:any;
|
||||
pdf_src:any='';
|
||||
|
||||
private notifier: NotifierService;
|
||||
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
|
||||
@ -69,6 +72,8 @@ export class QcPdReportComponent implements OnInit {
|
||||
this.startPD = this.route.snapshot.params['pdid'];
|
||||
let encryptReportRandomString = atob(this.route.snapshot.params['string']);
|
||||
this.reportRandomString = this.apiUrl+'getPDReportHTML/'+encryptReportRandomString+'/'+this.startPD;
|
||||
|
||||
console.log("report string",this.reportRandomString);
|
||||
this.notifier = notifier;
|
||||
// this.src = 'https://lender7.s3.ap-south-1.amazonaws.com/pd1/pd_report_original_version.pdf?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ3QDSPT3LDSWRYUQ%2F20181210%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20181210T073026Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=35aa183cbbfc835f96719a5e9aa552c79b3a1b7d8bca043f7d738d730755dcbb';
|
||||
// this.src = this.sanitizer.bypassSecurityTrustResourceUrl("https://lender7.s3.ap-south-1.amazonaws.com/pd1/pd_report_original_version.pdf?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ3QDSPT3LDSWRYUQ%2F20181210%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20181210T053116Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=6e25703a1e339dd5f081fa8aca5b8b2d81ba161d8cfd708759de899abf72146b");
|
||||
@ -78,7 +83,16 @@ export class QcPdReportComponent implements OnInit {
|
||||
// url: { url: 'https://lender7.s3.ap-south-1.amazonaws.com/pd1/pd_report_original_version.pdf?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ3QDSPT3LDSWRYUQ%2F20181210%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20181210T053116Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=6e25703a1e339dd5f081fa8aca5b8b2d81ba161d8cfd708759de899abf72146b', withCredentials: true } };
|
||||
// this.Url = this.sanitizer.bypassSecurityTrustResourceUrl("https://lender7.s3.ap-south-1.amazonaws.com/pd1/pd_report_original_version.pdf?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ3QDSPT3LDSWRYUQ%2F20181207%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20181207T122031Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=fac718f35d195ecb45d1dc7049fbaf0fa3158f237deeedac3bae60f8ec22e822");
|
||||
}
|
||||
|
||||
ngAfterViewInit(){
|
||||
let encryptReportRandomString = atob(this.route.snapshot.params['string']);
|
||||
this.pdTrigerService.getPDReportHTML(encryptReportRandomString,this.startPD).subscribe(response=>{
|
||||
|
||||
this.dataContainer.nativeElement.innerHTML = response
|
||||
console.log("data",this.dataContainer)
|
||||
this.loadComponent=true
|
||||
})
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.listPDComponent.showListView(false);
|
||||
this.getPdReportDetails();
|
||||
@ -431,6 +445,23 @@ export class QcPdReportComponent implements OnInit {
|
||||
// alert(err.html_format);
|
||||
});
|
||||
}
|
||||
ngOnDestroy():void{
|
||||
this.listPDComponent.showListView(true);
|
||||
}
|
||||
getPDreportPDF(){
|
||||
let modifiedHtml=this.dataContainer.nativeElement.outerHTML;
|
||||
// console.log(this.dataContainer.nativeElement.outerHTML);
|
||||
let encryptReportRandomString = atob(this.route.snapshot.params['string']);
|
||||
this.pdTrigerService.getPDReportPDFpreview(encryptReportRandomString,this.startPD,modifiedHtml).subscribe(response=>{
|
||||
if(response['dataStatus']){
|
||||
this.pdf_src=response['link']
|
||||
}
|
||||
})
|
||||
}
|
||||
// OnDestroy():void{
|
||||
// console.log("onDestroy called");
|
||||
// this.listPDComponent.showListView(true);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -621,4 +621,10 @@ export class QcService {
|
||||
getPDScore(pdid:any):Observable<any>{
|
||||
return this._http.post<any>(this.apiUrl+'getPDScore',{'pd_id':pdid})
|
||||
}
|
||||
getPDReportHTML(random_string,pd_id):Observable<any>{
|
||||
return this._http.get(this.apiUrl+'getPDReportHTML/'+random_string+'/'+pd_id,{responseType: 'text'})
|
||||
}
|
||||
getPDReportPDFpreview(random_string,pd_id,htmlData){
|
||||
return this._http.post(this.apiUrl+'getPDReportPDFpreview/'+random_string+'/'+pd_id,{records:{"pdid":pd_id,"myData":htmlData}},{responseType:'json'})
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,6 +103,9 @@ import { PdRequirementComponent } from 'app/personal-discussion/manage-pd/list-p
|
||||
import { FuturePlansAndBusinessEnvironmentComponent } from 'app/personal-discussion/manage-pd/list-pd/start-pd/forms/future-plans-and-business-environment/future-plans-and-business-environment.component';
|
||||
import { QcNewComponent } from './qc-list/qc-pd-report/qc-new/qc-new.component';
|
||||
|
||||
import {AngularSplitModule} from 'angular-split'
|
||||
// import { PdfViewerModule } from 'ng2-pdf-viewer';
|
||||
|
||||
|
||||
/**
|
||||
* Custom angular notifier options
|
||||
@ -173,6 +176,8 @@ const customNotifierOptions: NotifierOptions = {
|
||||
CKEditorModule,
|
||||
PdfViewerModule,
|
||||
ManagePdModule,
|
||||
AngularSplitModule.forRoot(),
|
||||
|
||||
],
|
||||
declarations: [QualityCheckComponent,QcListComponent, QcViewComponent, QcStartComponent, QcPdReportComponent,DialogChangeCurrentVenrsion, QcReviewComponent, ModelEditPdReportComponent, NumberToWordsPipe, QcNewComponent],
|
||||
entryComponents: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent,DialogChangeCurrentVenrsion, QcReviewComponent, ModelEditPdReportComponent, InitiateAdditionalPdComponent,QcNewComponent,
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<div fxLayout="row" fxLayoutAlign="start center" class="mb-1">
|
||||
<div class="ml-xs mr-xs" style="width: 100%;">
|
||||
<mat-card-title><span> PD MIS Report </span>
|
||||
<button class="btn_export" mat-raised-button color="primary" (click)="exportAsExcel()" [disabled]="dataLength == 0 ? true : false" >Export CSV</button>
|
||||
<button class="btn_export" mat-raised-button color="primary" (click)="exportAsExcel()" [disabled]="dataLength == 0 ? true : false || dataLength == -1 ? true : false" >Export CSV</button>
|
||||
<!-- (click)="ExportTOExcel()" -->
|
||||
</mat-card-title>
|
||||
</div>
|
||||
@ -53,7 +53,7 @@
|
||||
<mat-form-field class="ml-xs mr-xs" style="width:30%">
|
||||
<input matInput [matDatepicker]="picker1" [min]="minDate" [max]="maxDate" formControlName="to_date" placeholder="To Date">
|
||||
<mat-datepicker-toggle matSuffix [for]="picker1"></mat-datepicker-toggle>
|
||||
<mat-datepicker #picker1></mat-datepicker>
|
||||
<mat-datepicker #picker1 ></mat-datepicker>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;">
|
||||
@ -82,7 +82,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="report-table-container mat-elevation-z8 " #TABLE>
|
||||
<div *ngIf="dataLength != 0">
|
||||
<div *ngIf="dataLength != 0 && dataLength != -1">
|
||||
<table mat-table #table [dataSource]="dataSource" matSort>
|
||||
|
||||
<ng-container matColumnDef="serialno" sticky>
|
||||
|
||||
@ -21,11 +21,11 @@ export class PdMisComponent implements OnInit {
|
||||
api_data:any=[];
|
||||
filtered_data:any=[];
|
||||
|
||||
public Loading: boolean = true;
|
||||
public Loading: boolean;
|
||||
|
||||
public reportform: FormGroup;
|
||||
|
||||
public dataLength: number;
|
||||
public dataLength:number=-1;
|
||||
public pageSize : number;
|
||||
public dataSource = new MatTableDataSource();
|
||||
error:any=[];
|
||||
@ -50,7 +50,7 @@ export class PdMisComponent implements OnInit {
|
||||
'agency_name',
|
||||
'officer_name',
|
||||
'pd_status'];
|
||||
expandStatus: boolean;
|
||||
expandStatus: boolean=true;
|
||||
|
||||
|
||||
|
||||
@ -60,7 +60,7 @@ export class PdMisComponent implements OnInit {
|
||||
|
||||
ngOnInit(){
|
||||
this.maxDate = new Date();
|
||||
this.getMISDailyReport();
|
||||
// this.getMISDailyReport();
|
||||
}
|
||||
|
||||
getMISDailyReport() {
|
||||
@ -173,6 +173,7 @@ export class PdMisComponent implements OnInit {
|
||||
// );
|
||||
// }
|
||||
searchPanel(){
|
||||
this.Loading=true;
|
||||
this.reportform.value.from_date=this.pipe.transform(this.reportform.value.from_date,'yyyy-MM-dd')
|
||||
this.reportform.value.to_date=this.pipe.transform(this.reportform.value.to_date,'yyyy-MM-dd')
|
||||
this.reportsService.retirveDataForMISDailyReport(this.reportform.value).subscribe(res=>{
|
||||
@ -193,6 +194,7 @@ export class PdMisComponent implements OnInit {
|
||||
this.dataSource.data = [];
|
||||
this.dataLength=0
|
||||
}
|
||||
this.Loading=false
|
||||
},error => {
|
||||
//this.errorMessage.push(error);
|
||||
this.error.push(error)
|
||||
@ -205,10 +207,11 @@ export class PdMisComponent implements OnInit {
|
||||
}
|
||||
onReset(){
|
||||
// if(this.reportform.value.filter(val=>val.))
|
||||
this.Loading=true
|
||||
// this.Loading=true
|
||||
this.reportform.reset();
|
||||
this.getMISDailyReport()
|
||||
this.expandStatus=false
|
||||
this.dataLength = -1;
|
||||
// this.getMISDailyReport()
|
||||
// this.expandStatus=false
|
||||
}
|
||||
filterForApplicantID(arrayData: any, Values: any) {
|
||||
Values = Values.toLowerCase();
|
||||
|
||||
@ -47,7 +47,9 @@ export class MessagingService {
|
||||
})
|
||||
let params = {"records":{ "fk_user_id":userId,"token":token,"client":"WEB"}};
|
||||
this.updateNotificationToken(params).subscribe(
|
||||
(data) => { console.log('success',data);},
|
||||
(data) => {
|
||||
// console.log('success',data);
|
||||
},
|
||||
(err) => { console.error('Something Went wrong on update notify.', err);
|
||||
});
|
||||
}
|
||||
@ -66,7 +68,7 @@ export class MessagingService {
|
||||
// console.log("user id in request permission method",userId)
|
||||
this.angularFireMessaging.requestToken.subscribe(
|
||||
(token) => {
|
||||
console.log(token);
|
||||
// console.log(token);
|
||||
// this.router.navigate(['./personal_discussion'])
|
||||
this.updateToken(userId, token);
|
||||
},
|
||||
|
||||
@ -16,5 +16,8 @@
|
||||
"es2016",
|
||||
"dom"
|
||||
]
|
||||
}
|
||||
},
|
||||
"angularCompilerOptions":{
|
||||
"preserveWhitespaces":false
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user