Fairoj Assessed income sales page completed
This commit is contained in:
parent
cdf380c4c7
commit
e3702409e5
File diff suppressed because one or more lines are too long
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "Ionic3AngularMaterial",
|
"name": "pdofficer",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "Ionic3AngularMaterial",
|
"name": "pdofficer",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"author": "Ionic Framework",
|
"author": "Ionic Framework",
|
||||||
"homepage": "http://ionicframework.com/",
|
"homepage": "http://ionicframework.com/",
|
||||||
|
|||||||
@ -41,11 +41,14 @@ export class OtpPage {
|
|||||||
constructor(public navCtrl: NavController, public navParams: NavParams,public pddetails:PdtriggerProvider,public toast:ToastProvider,public Menu:MenuController,public commonconstant:ConstantsProvider,public aws:AwsServiceProvider,public alertCtrl:AlertController,public qustCat:QuestionCategoryProvider,public fb:FormBuilder,public geolocation:Geolocation,public androidPermissions:AndroidPermissions) {
|
constructor(public navCtrl: NavController, public navParams: NavParams,public pddetails:PdtriggerProvider,public toast:ToastProvider,public Menu:MenuController,public commonconstant:ConstantsProvider,public aws:AwsServiceProvider,public alertCtrl:AlertController,public qustCat:QuestionCategoryProvider,public fb:FormBuilder,public geolocation:Geolocation,public androidPermissions:AndroidPermissions) {
|
||||||
this.commonImage = this.commonconstant.commonimage;
|
this.commonImage = this.commonconstant.commonimage;
|
||||||
this.applicatentDetails = this.navParams.get('pdDetails');
|
this.applicatentDetails = this.navParams.get('pdDetails');
|
||||||
|
this.users = this.aws.getlocale();
|
||||||
|
console.log("user",this.users)
|
||||||
this.reasonForm = this.fb.group(
|
this.reasonForm = this.fb.group(
|
||||||
{
|
{
|
||||||
reason:[null,Validators.compose([Validators.required])],
|
reason:[null,Validators.compose([Validators.required])],
|
||||||
others_reason:[null],
|
others_reason:[null],
|
||||||
})
|
})
|
||||||
|
|
||||||
this.getDropdown();
|
this.getDropdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,10 +96,11 @@ export class OtpPage {
|
|||||||
}
|
}
|
||||||
checkotp(otp)
|
checkotp(otp)
|
||||||
{
|
{
|
||||||
|
//console.log("Otp",otp)
|
||||||
let data = {'pd_id':this.applicatentDetails.pd_id,'OTP':otp,'fk_updatedby':this.users};
|
let data = {'pd_id':this.applicatentDetails.pd_id,'OTP':otp,'fk_updatedby':this.users};
|
||||||
this.pddetails.checkotp(data).subscribe(res=>
|
this.pddetails.checkotp(data).subscribe(res=>
|
||||||
{
|
{
|
||||||
console.log("Otp",res)
|
//console.log("Otp",res)
|
||||||
this.otpStatus = res;
|
this.otpStatus = res;
|
||||||
if(this.otpStatus.dataStatus == true)
|
if(this.otpStatus.dataStatus == true)
|
||||||
{
|
{
|
||||||
@ -132,7 +136,7 @@ export class OtpPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Do timeout stuff here
|
// Do timeout stuff here
|
||||||
this.users = this.aws.getlocale();
|
|
||||||
let data:any;
|
let data:any;
|
||||||
let alert = this.alertCtrl.create({
|
let alert = this.alertCtrl.create({
|
||||||
title: 'OTP Expired ',
|
title: 'OTP Expired ',
|
||||||
|
|||||||
@ -24,10 +24,10 @@
|
|||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field >
|
</mat-form-field >
|
||||||
<mat-form-field style="width: 100%">
|
<mat-form-field style="width: 100%">
|
||||||
<input matInput placeholder="Amount (Rs)" type="number" name="expense_value" formControlName="expense_value">
|
<input matInput placeholder="Amount (Rs)" type="number" name="expense_value" formControlName="expense_value" (keyup)="businessCalculation(i,item.value)">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width: 100%">
|
<mat-form-field style="width: 100%">
|
||||||
<mat-select placeholder="frequency" formControlName="fk_frequency_id" (selectionChange)="busExpensecalculat(i,item)">
|
<mat-select placeholder="Frequency" formControlName="fk_frequency_id" (selectionChange)="businessCalculation(i,item.value)">
|
||||||
<mat-option *ngFor="let frq of m_freqOfPurchase" [value]="frq.frequency_id
|
<mat-option *ngFor="let frq of m_freqOfPurchase" [value]="frq.frequency_id
|
||||||
">{{frq.name}}</mat-option>
|
">{{frq.name}}</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
|
|||||||
@ -84,6 +84,19 @@ export class PdQuestionAssessedBusinessPage {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
businessCalculation(indexVal: number,values: any): void {
|
||||||
|
let control:any = <FormArray>this.BuissnessForm.controls['busExpense'];
|
||||||
|
if(values.expense_value!='' && values.fk_frequency_id!='' && values.expense_value!=null && values.fk_frequency_id!=null) {
|
||||||
|
let filterFrequencyValue: any = this.m_freqOfPurchase.filter(val =>val.frequency_id==values.fk_frequency_id);
|
||||||
|
control.controls[indexVal].controls['annual_expenses_value'].setValue(parseInt(values.expense_value) * parseInt(filterFrequencyValue[0].mutiple_factor));
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
control.controls[indexVal].controls['annual_expenses_value'].setValue('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
addBusinessDetails()
|
addBusinessDetails()
|
||||||
{
|
{
|
||||||
const control = <FormArray>this.BuissnessForm.controls['busExpense'] as FormArray;
|
const control = <FormArray>this.BuissnessForm.controls['busExpense'] as FormArray;
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
<button ion-button menuToggle>
|
<button ion-button menuToggle>
|
||||||
<ion-icon name="menu"></ion-icon>
|
<ion-icon name="menu"></ion-icon>
|
||||||
</button>
|
</button>
|
||||||
<ion-title *ngIf="!viewchange">Assessed Daily Sales Details</ion-title>
|
<ion-title *ngIf="!viewchange">Add Daily Sales Item</ion-title>
|
||||||
|
|
||||||
|
|
||||||
</ion-navbar>
|
</ion-navbar>
|
||||||
@ -19,14 +19,15 @@
|
|||||||
[formGroupName]="sale_i">
|
[formGroupName]="sale_i">
|
||||||
<mat-card>
|
<mat-card>
|
||||||
<mat-form-field style="width: 100%">
|
<mat-form-field style="width: 100%">
|
||||||
<input matInput type="text" placeholder="Sales Item" formControlName="sales_item" name="sales_item">
|
<input matInput type="text" placeholder="Product / Service" formControlName="sales_item" name="sales_item">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<div *ngIf="grossprofitCalc.mode ==2">
|
<div *ngIf="margin_calculation_status">
|
||||||
<mat-form-field style="width: 100%">
|
<mat-form-field style="width: 100%">
|
||||||
<input matInput type="text" placeholder="Magin Percetage %" formControlName="margin_per" name="margin_per">
|
<input matInput type="text" placeholder="Magin Percetage %" formControlName="margin_per" name="margin_per" (keyup)="salesCalculation(sale_i,item.value)">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width: 100%">
|
<mat-form-field style="width: 100%">
|
||||||
<input matInput type="text" placeholder="Margin Value" formControlName="margin_value" name="margin_value" readonly>
|
<input matInput type="text" placeholder="Margin Value" formControlName="margin_value" name="margin_value" readonly>
|
||||||
|
<mat-hint align="end" style="font-size:12px" *ngIf="item.get('margin_value').value != ''">{{"₹"}} {{marginAmtInwords[sale_i]}} Only</mat-hint>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
@ -35,10 +36,11 @@
|
|||||||
<div formArrayName="child">
|
<div formArrayName="child">
|
||||||
<div *ngFor="let tenants of item['controls'].child['controls']; let i =index;let dailylast = last" [formGroupName]="i">
|
<div *ngFor="let tenants of item['controls'].child['controls']; let i =index;let dailylast = last" [formGroupName]="i">
|
||||||
<mat-form-field style="width: 100%">
|
<mat-form-field style="width: 100%">
|
||||||
<input matInput type="date" max="{{currentDate}}" placeholder="Sales Date" formControlName="sales_date" name="sales_date">
|
<input matInput type="date" max="maxDate" [matDatepicker]="picker" placeholder="Sales Date" (dateChange)="salesCalculation(sale_i,item.value)" formControlName="sales_date" name="sales_date">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width: 100%">
|
<mat-form-field style="width: 100%">
|
||||||
<input matInput type="number" (blur)="getSalesCalc(tenants,item,sale_i)" placeholder="Value" formControlName="sales_value" name="sales_value">
|
<input matInput type="number" (blur)="getSalesCalc(tenants,item,sale_i)" placeholder="Value" (keyup)="salesCalculation(sale_i,item.value,item.value.child);inWords($event.target.value,i,1)" formControlName="sales_value" name="sales_value">
|
||||||
|
<mat-hint align="end" style="font-size:12px" *ngIf="tenants.get('sales_value').value != ''">{{"₹"}} {{Value[i]}} Only</mat-hint>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<ion-buttons>
|
<ion-buttons>
|
||||||
<ion-row>
|
<ion-row>
|
||||||
@ -49,7 +51,7 @@
|
|||||||
</ion-col>
|
</ion-col>
|
||||||
<ion-col offset-8 col-3 text-right>
|
<ion-col offset-8 col-3 text-right>
|
||||||
<a (click)="adddailyChildSaleProduct(sale_i)" *ngIf="dailylast">
|
<a (click)="adddailyChildSaleProduct(sale_i)" *ngIf="dailylast">
|
||||||
<ion-icon name="md-add" color="optblue" style="font-size: 22px;"></ion-icon>
|
<ion-icon name="add-circle" color="optblue" style="font-size: 24px;"></ion-icon>
|
||||||
</a>
|
</a>
|
||||||
</ion-col>
|
</ion-col>
|
||||||
</ion-row>
|
</ion-row>
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import { FormGroup, FormBuilder, Validators, FormArray } from '@angular/forms';
|
|||||||
import { QuestionCategoryProvider } from '../../../providers/question-category/question-category';
|
import { QuestionCategoryProvider } from '../../../providers/question-category/question-category';
|
||||||
import { ToastProvider } from '../../../providers/common-provider/toast';
|
import { ToastProvider } from '../../../providers/common-provider/toast';
|
||||||
import { ConstantsProvider } from '../../../providers/constants/constants';
|
import { ConstantsProvider } from '../../../providers/constants/constants';
|
||||||
|
import {DatePipe} from '@angular/common'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated class for the PdQuestionAssessedDailySalesPage page.
|
* Generated class for the PdQuestionAssessedDailySalesPage page.
|
||||||
@ -19,6 +20,7 @@ import { ConstantsProvider } from '../../../providers/constants/constants';
|
|||||||
templateUrl: 'pd-question-assessed-daily-sales.html',
|
templateUrl: 'pd-question-assessed-daily-sales.html',
|
||||||
})
|
})
|
||||||
export class PdQuestionAssessedDailySalesPage {
|
export class PdQuestionAssessedDailySalesPage {
|
||||||
|
pipe = new DatePipe('en-US');
|
||||||
|
|
||||||
currentDate: string;
|
currentDate: string;
|
||||||
grossprofitCalc: any;
|
grossprofitCalc: any;
|
||||||
@ -27,11 +29,15 @@ export class PdQuestionAssessedDailySalesPage {
|
|||||||
FormId: any;
|
FormId: any;
|
||||||
pdDetails: any;
|
pdDetails: any;
|
||||||
salesDailyForm: FormGroup;
|
salesDailyForm: FormGroup;
|
||||||
|
margin_calculation_status:any
|
||||||
|
Value: any=[];
|
||||||
|
marginAmtInwords: any=[];
|
||||||
constructor(public navCtrl: NavController, public navParams: NavParams, public aws: AwsServiceProvider, public qustCat: QuestionCategoryProvider, public toast: ToastProvider, public fb: FormBuilder,public constant:ConstantsProvider) {
|
constructor(public navCtrl: NavController, public navParams: NavParams, public aws: AwsServiceProvider, public qustCat: QuestionCategoryProvider, public toast: ToastProvider, public fb: FormBuilder,public constant:ConstantsProvider) {
|
||||||
this.pdDetails = this.navParams.get('pdDetails');
|
this.pdDetails = this.navParams.get('pdDetails');
|
||||||
this.FormId = this.navParams.get('FormId');
|
this.FormId = this.navParams.get('FormId');
|
||||||
this.salesDaily = this.navParams.get('salesDaily');
|
this.salesDaily = this.navParams.get('salesDaily');
|
||||||
this.grossprofitCalc = this.navParams.get('grossprofit');
|
// this.grossprofitCalc = this.navParams.get('grossprofit');
|
||||||
|
this.margin_calculation_status=this.navParams.get('margin_calculation_status');
|
||||||
this.users = this.aws.getlocale();
|
this.users = this.aws.getlocale();
|
||||||
this.currentDate = constant.getcurrentDate().replace("T00:00",'');
|
this.currentDate = constant.getcurrentDate().replace("T00:00",'');
|
||||||
|
|
||||||
@ -125,6 +131,51 @@ export class PdQuestionAssessedDailySalesPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
salesCalculation(indexVal: number,values: any): void {
|
||||||
|
console.log("Date check",values)
|
||||||
|
if(this.margin_calculation_status===true){
|
||||||
|
let control:any = <FormArray>this.salesDailyForm.controls['sales_product'];
|
||||||
|
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');
|
||||||
|
console.log(mval);
|
||||||
|
return mval;
|
||||||
|
});
|
||||||
|
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) => parseInt(sum) + parseInt(curr));
|
||||||
|
control.controls[indexVal].controls['margin_value'].setValue(parseInt(getTotalValueCounts) * (parseInt(values.margin_per)/100) * (12 / parseInt(getUniqueMonthCounts.length)));
|
||||||
|
this.inWords(parseInt(getTotalValueCounts) * (parseInt(values.margin_per)/100) * (12 / parseInt(getUniqueMonthCounts.length)),indexVal,2);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
control.controls[indexVal].controls['margin_value'].setValue('');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
control.controls[indexVal].controls['margin_value'].setValue('');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
inWords(e,c,flag){
|
||||||
|
switch(flag){
|
||||||
|
case 1 :
|
||||||
|
this.Value[c] = this.constant.convertNumberToWords(e);
|
||||||
|
break;
|
||||||
|
case 2 :
|
||||||
|
this.marginAmtInwords[c] = this.constant.convertNumberToWords(e);
|
||||||
|
break;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
adddailySalaesProduct() {
|
adddailySalaesProduct() {
|
||||||
this.tempdate = [];
|
this.tempdate = [];
|
||||||
if (this.salesDailyForm.valid) {
|
if (this.salesDailyForm.valid) {
|
||||||
|
|||||||
@ -38,7 +38,7 @@ export class PdQuestionAssessedDashPage {
|
|||||||
assessedForm:FormGroup;
|
assessedForm:FormGroup;
|
||||||
constructor(public navCtrl: NavController, public navParams: NavParams,public aws:AwsServiceProvider,public fb:FormBuilder,public qustCat:QuestionCategoryProvider,public toast:ToastProvider) {
|
constructor(public navCtrl: NavController, public navParams: NavParams,public aws:AwsServiceProvider,public fb:FormBuilder,public qustCat:QuestionCategoryProvider,public toast:ToastProvider) {
|
||||||
this.pdDetails = this.navParams.get('pdDetails');
|
this.pdDetails = this.navParams.get('pdDetails');
|
||||||
this.FormId = this.navParams.get('FormId');
|
this.FormId = this.navParams.get('formDetails');
|
||||||
this.users = this.aws.getlocale();
|
this.users = this.aws.getlocale();
|
||||||
this.assessedForm = this.fb.group(
|
this.assessedForm = this.fb.group(
|
||||||
{
|
{
|
||||||
|
|||||||
@ -13,48 +13,70 @@
|
|||||||
|
|
||||||
|
|
||||||
<ion-content padding>
|
<ion-content padding>
|
||||||
|
<form [formGroup]="grossProfitForm">
|
||||||
|
<mat-card>
|
||||||
|
|
||||||
|
<mat-card-content>
|
||||||
|
<mat-form-field style="width:100%">
|
||||||
|
<mat-select placeholder="Purchase Detail Available" formControlName="mode" (selectionChange)="changeOptions(grossProfitForm.value)" required>
|
||||||
|
<mat-option *ngFor="let getData of check__purchse_type" [value]="getData.id">{{getData.name}}</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
</mat-card-content>
|
||||||
|
<button align="end" ion-button color="optblue" (click)="submitDetails(grossProfitForm.value)">Save</button>
|
||||||
|
</mat-card>
|
||||||
|
</form>
|
||||||
<div *ngIf="pageId==1">
|
<div *ngIf="pageId==1">
|
||||||
<mat-accordion>
|
|
||||||
<mat-expansion-panel [expanded]="true">
|
<!-- <mat-expansion-panel [expanded]="true">
|
||||||
<mat-expansion-panel-header>
|
<mat-expansion-panel-header>
|
||||||
<mat-panel-title>
|
<mat-panel-title>
|
||||||
Sales Calculation
|
Sales Calculation
|
||||||
</mat-panel-title>
|
</mat-panel-title>
|
||||||
</mat-expansion-panel-header>
|
</mat-expansion-panel-header> -->
|
||||||
|
|
||||||
<form [formGroup]="assessedForm">
|
<form [formGroup]="assessedForm">
|
||||||
<p>Sales declared by the customer as the annual sales actually done.</p>
|
<mat-card>
|
||||||
|
<mat-card-header>
|
||||||
|
<mat-card-title><h6>Sales Calculation</h6></mat-card-title>
|
||||||
|
</mat-card-header>
|
||||||
|
<mat-card-content>
|
||||||
|
<!-- <p>Sales declared by the customer as the annual sales actually done.</p> -->
|
||||||
<mat-form-field style="width: 100%">
|
<mat-form-field style="width: 100%">
|
||||||
<textarea matInput type="text" placeholder="" formControlName="sales_declared_by_customer" (blur)="getMarginCalc()" name="sales_declared_by_customer"></textarea>
|
<mat-placeholder>Sales Declared by the Customer as the Annual Sales Actually Done</mat-placeholder>
|
||||||
|
<input matInput autocomplete="off" type="number" formControlName="sales_declared_by_customer" name="sales_declared_by_customer" (keyup)="salesCalculation(assessedForm.value)">
|
||||||
|
<mat-hint align="end" style="font-size: 12px" *ngIf="assessedForm.value.sales_declared_by_customer != ''">{{"₹"}} {{SaleAmtInwords}} Only</mat-hint>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<div *ngIf="mode==2">
|
<div *ngIf="activateMarginCalculation">
|
||||||
<mat-form-field style="width: 100%">
|
<mat-form-field style="width: 100%">
|
||||||
<input matInput type="number" placeholder="Margin percentage %" formControlName="margin_per" name="margin_per" (blur)="getMarginCalc()">
|
<input matInput type="number" placeholder="Margin percentage %" formControlName="margin_per" name="margin_per" (keyup)="salesCalculation(assessedForm.value)">
|
||||||
|
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width: 100%">
|
<mat-form-field style="width: 100%">
|
||||||
<input matInput type="number" placeholder="Value" formControlName="margin_value" name="margin_value">
|
<input matInput type="number" placeholder="Margin Value" formControlName="margin_value" name="margin_value" readonly>
|
||||||
|
<mat-hint align="end" style="font-size: 12px" *ngIf="assessedForm.get('sales_declared_by_customer').value != ''">{{"₹"}} {{marginAmtInwords}} Only</mat-hint>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<ion-row>
|
<ion-row>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
|
||||||
<!-- <ion-buttons >
|
<!-- <ion-buttons >
|
||||||
<ion-button color="optblue" full[disabled]="!pdforms.valid" mat-raised-button style="width:100%" (click)="savepdDetails(pdforms.value)">Save <ion-icon name="md-disc"></ion-icon></ion-button> -->
|
<ion-button color="optblue" full[disabled]="!pdforms.valid" mat-raised-button style="width:100%" (click)="savepdDetails(pdforms.value)">Save <ion-icon name="md-disc"></ion-icon></ion-button> -->
|
||||||
<button ion-button full color="optblue" (click)="saveData(assessedForm.value)"> Save</button>
|
<button ion-button full round color="optblue" (click)="saveData(assessedForm.value)"> Save</button>
|
||||||
<!-- </ion-buttons> -->
|
<!-- </ion-buttons> -->
|
||||||
|
|
||||||
</ion-row>
|
</ion-row>
|
||||||
<br/>
|
</mat-card-content>
|
||||||
|
</mat-card>
|
||||||
</form>
|
</form>
|
||||||
</mat-expansion-panel>
|
|
||||||
|
<!-- </mat-expansion-panel> -->
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<!-- <mat-card style="padding:16px;" class="mat-card-custom"> -->
|
<!-- <mat-card style="padding:16px;" class="mat-card-custom"> -->
|
||||||
|
<mat-accordion>
|
||||||
<mat-expansion-panel>
|
<mat-expansion-panel>
|
||||||
<mat-expansion-panel-header>
|
<mat-expansion-panel-header>
|
||||||
<mat-panel-title>
|
<mat-panel-title>
|
||||||
|
|||||||
@ -25,8 +25,17 @@ page-pd-question-assessed-info {
|
|||||||
width:100%;
|
width:100%;
|
||||||
height:200px;
|
height:200px;
|
||||||
}
|
}
|
||||||
span{
|
// span{
|
||||||
font-size: 12px;
|
// // font-size: 12px;
|
||||||
|
// }
|
||||||
|
.mat-form-field-label {
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
textarea.mat-input-element {
|
||||||
|
padding: 0px 0;
|
||||||
|
margin: 5px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,8 @@ import { PdQuestionAssessedBusinessPage } from '../pd-question-assessed-business
|
|||||||
import { PdQuestionAssessedHouseholdPage } from '../pd-question-assessed-household/pd-question-assessed-household';
|
import { PdQuestionAssessedHouseholdPage } from '../pd-question-assessed-household/pd-question-assessed-household';
|
||||||
import { PdQuestionAssessedBusinessIncomePage } from '../pd-question-assessed-business-income/pd-question-assessed-business-income';
|
import { PdQuestionAssessedBusinessIncomePage } from '../pd-question-assessed-business-income/pd-question-assessed-business-income';
|
||||||
|
|
||||||
|
import {ConstantsProvider} from '../../../providers/constants/constants'
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated class for the PdQuestionAssessedInfoPage page.
|
* Generated class for the PdQuestionAssessedInfoPage page.
|
||||||
@ -27,6 +29,8 @@ import { PdQuestionAssessedBusinessIncomePage } from '../pd-question-assessed-bu
|
|||||||
})
|
})
|
||||||
export class PdQuestionAssessedInfoPage {
|
export class PdQuestionAssessedInfoPage {
|
||||||
|
|
||||||
|
grossProfitForm:FormGroup
|
||||||
|
check__purchse_type:any=[{'id':'1','name':'Yes'},{'id':'2','name':'No'}]
|
||||||
busissnessIncome: any;
|
busissnessIncome: any;
|
||||||
mode: any;
|
mode: any;
|
||||||
grossprofitCalc: any;
|
grossprofitCalc: any;
|
||||||
@ -54,7 +58,10 @@ export class PdQuestionAssessedInfoPage {
|
|||||||
rawMaterialForm:FormGroup;
|
rawMaterialForm:FormGroup;
|
||||||
BuissnessForm:FormGroup;
|
BuissnessForm:FormGroup;
|
||||||
houseHoldForm:FormGroup;
|
houseHoldForm:FormGroup;
|
||||||
constructor(public navCtrl: NavController, public navParams: NavParams,public aws:AwsServiceProvider,public qustCat:QuestionCategoryProvider,public toast:ToastProvider,public fb:FormBuilder) {
|
activateMarginCalculation:boolean=false
|
||||||
|
SaleAmtInwords: any=[];
|
||||||
|
marginAmtInwords: any=[];
|
||||||
|
constructor(public navCtrl: NavController, public navParams: NavParams,public aws:AwsServiceProvider,public qustCat:QuestionCategoryProvider,public toast:ToastProvider,public fb:FormBuilder,public cons:ConstantsProvider) {
|
||||||
this.pdDetails = this.navParams.get('pdDetails');
|
this.pdDetails = this.navParams.get('pdDetails');
|
||||||
this.pageId = this.navParams.get('pageId');
|
this.pageId = this.navParams.get('pageId');
|
||||||
|
|
||||||
@ -88,6 +95,13 @@ export class PdQuestionAssessedInfoPage {
|
|||||||
fk_createdby:[this.users],
|
fk_createdby:[this.users],
|
||||||
|
|
||||||
});
|
});
|
||||||
|
this.grossProfitForm=this.fb.group({
|
||||||
|
calc_type_id:[''],
|
||||||
|
fk_pd_id:[this.pdDetails.pd_id],
|
||||||
|
company_id:[this.pdDetails.company_id],
|
||||||
|
mode:['',Validators.compose([Validators.required])],
|
||||||
|
margin:[''],
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -117,12 +131,38 @@ export class PdQuestionAssessedInfoPage {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
changeOptions(values: any){
|
||||||
|
// console.log('values',values);
|
||||||
|
this.grossProfitForm.controls['margin'].setValue('');
|
||||||
|
/** if Mode Value is 'No' -> margin value is setted as netmargin and its id - 2
|
||||||
|
* Refer => check_sales_type **/
|
||||||
|
if(values.mode == 2){
|
||||||
|
// console.log('2');
|
||||||
|
this.grossProfitForm.controls['margin'].setValue('2');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
submitDetails(records: any){
|
||||||
|
if (this.grossProfitForm.invalid) {
|
||||||
|
|
||||||
|
this.toast.pdTriggerappmessage("Please Check All Manatory Fields..");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log(records);
|
||||||
|
this.qustCat.saveassessedForms('saveAssessedIncomeCalculateMode',records).subscribe(data => {
|
||||||
|
this.toast.pdTriggerappmessage('Saved Successfully.');
|
||||||
|
//this.loadAssessedForms.next('1');
|
||||||
|
}, error => {
|
||||||
|
this.toast.pdTriggerappmessage('Something Wents Wrong Try Again.!');
|
||||||
|
// this.loadAssessedForms.next('1');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
getMarginCalc()
|
getMarginCalc()
|
||||||
{
|
{
|
||||||
|
|
||||||
let margin_per = this.assessedForm.controls['margin_per'].value;
|
let margin_per = this.assessedForm.controls['margin_per'].value;
|
||||||
|
console.log("Margin Per",margin_per)
|
||||||
let sales_declared_by_customer = this.assessedForm.controls['sales_declared_by_customer'].value;
|
let sales_declared_by_customer = this.assessedForm.controls['sales_declared_by_customer'].value;
|
||||||
if(margin_per !=null && sales_declared_by_customer !=null)
|
if(margin_per !=null && sales_declared_by_customer !=null)
|
||||||
{
|
{
|
||||||
@ -147,6 +187,15 @@ export class PdQuestionAssessedInfoPage {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
salesCalculation(values): void {
|
||||||
|
if(values.sales_declared_by_customer !=''){this.SaleAmtInwords = this.cons.convertNumberToWords(values.sales_declared_by_customer);}
|
||||||
|
if(values.margin_per !='' && values.sales_declared_by_customer !='')
|
||||||
|
{
|
||||||
|
|
||||||
|
this.assessedForm.controls['margin_value'].setValue(values.sales_declared_by_customer * (values.margin_per/100));
|
||||||
|
this.marginAmtInwords = this.cons.convertNumberToWords(values.sales_declared_by_customer * (values.margin_per/100));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
getAssessedDetails()
|
getAssessedDetails()
|
||||||
{
|
{
|
||||||
@ -162,9 +211,13 @@ export class PdQuestionAssessedInfoPage {
|
|||||||
this.sales_item_value = res['records'].sales_calculated_by_itemwise;
|
this.sales_item_value = res['records'].sales_calculated_by_itemwise;
|
||||||
this.sales_item_month_value = res['records'].sales_items_by_monthwise;
|
this.sales_item_month_value = res['records'].sales_items_by_monthwise;
|
||||||
this.purchse_details = res['records'].purchase_details;
|
this.purchse_details = res['records'].purchase_details;
|
||||||
this.grossprofitCalc = res['records'].gross_profit_calculation_type[0];
|
this.grossprofitCalc = res['records'].gross_profit_calculation_type[0]
|
||||||
this.mode = this.grossprofitCalc.mode;
|
this.mode = this.grossprofitCalc.mode;
|
||||||
console.log(this.grossprofitCalc);
|
|
||||||
|
var lenOfGrossProfit=res['records'].gross_profit_calculation_type.length
|
||||||
|
console.log("len",lenOfGrossProfit)
|
||||||
|
this.activateMarginCalculation=res['records'].gross_profit_calculation_type[lenOfGrossProfit-1].margin==2 && res['records'].gross_profit_calculation_type[lenOfGrossProfit-1].mode ==2 ?true : false
|
||||||
|
console.log(this.activateMarginCalculation);
|
||||||
var result = this.purchse_details.reduce(function(p, c) {
|
var result = this.purchse_details.reduce(function(p, c) {
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
@ -227,7 +280,7 @@ export class PdQuestionAssessedInfoPage {
|
|||||||
|
|
||||||
AddAssessedForm()
|
AddAssessedForm()
|
||||||
{
|
{
|
||||||
this.navCtrl.push(PdQuestionAssessedSalesPage,{'pdDetails':this.pdDetails,'sales':null,'grossprofit':this.grossprofitCalc});
|
this.navCtrl.push(PdQuestionAssessedSalesPage,{'pdDetails':this.pdDetails,'sales':null,'margin_calculation_status':this.activateMarginCalculation});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,7 +300,7 @@ export class PdQuestionAssessedInfoPage {
|
|||||||
|
|
||||||
AddAssessedDailyForm()
|
AddAssessedDailyForm()
|
||||||
{
|
{
|
||||||
this.navCtrl.push(PdQuestionAssessedDailySalesPage,{'pdDetails':this.pdDetails,'salesDaily':null,'grossprofit':this.grossprofitCalc})
|
this.navCtrl.push(PdQuestionAssessedDailySalesPage,{'pdDetails':this.pdDetails,'salesDaily':null,'margin_calculation_status':this.activateMarginCalculation})
|
||||||
}
|
}
|
||||||
editAssessedDailyForm(simId)
|
editAssessedDailyForm(simId)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
<button ion-button menuToggle>
|
<button ion-button menuToggle>
|
||||||
<ion-icon name="menu"></ion-icon>
|
<ion-icon name="menu"></ion-icon>
|
||||||
</button>
|
</button>
|
||||||
<ion-title *ngIf="!viewchange">Item Salas Details</ion-title>
|
<ion-title *ngIf="!viewchange">Add Sales Item </ion-title>
|
||||||
|
|
||||||
|
|
||||||
</ion-navbar>
|
</ion-navbar>
|
||||||
@ -19,10 +19,10 @@
|
|||||||
<mat-card>
|
<mat-card>
|
||||||
<h3>Itemwise</h3>
|
<h3>Itemwise</h3>
|
||||||
<mat-form-field style="width: 100%">
|
<mat-form-field style="width: 100%">
|
||||||
<input type="text" matInput placeholder="Product/Services" formControlName="sales_item" (blur)="salecalculat(i,item)" name="sales_item">
|
<input type="text" matInput placeholder="Product/Services" formControlName="sales_item" (keyup)="salecalculat(i,item.value)" name="sales_item">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width: 100%">
|
<mat-form-field style="width: 100%">
|
||||||
<input type="number" matInput placeholder="Sale Quantity" (blur)="salecalculat(i,item)" formControlName="sales_qty" name="sales_qty">
|
<input type="number" matInput placeholder="Sale Quantity" (keyup)="salecalculat(i,item.value)" formControlName="sales_qty" name="sales_qty">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width: 100%">
|
<mat-form-field style="width: 100%">
|
||||||
<mat-select placeholder="UOM" name="fk_uom_id" formControlName="fk_uom_id" >
|
<mat-select placeholder="UOM" name="fk_uom_id" formControlName="fk_uom_id" >
|
||||||
@ -30,26 +30,30 @@
|
|||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width: 100%">
|
<mat-form-field style="width: 100%">
|
||||||
<input type="number" matInput placeholder="Rate per unit of sale" formControlName="rate_per_unit" name="rate_per_unit">
|
<input type="number" matInput placeholder="Rate/unit of sale" formControlName="rate_per_unit" name="rate_per_unit" (keyup)="inWords($event.target.value,i,4)">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
<mat-label align="end" style="font-size: 12px" *ngIf="item.get('rate_per_unit').value != ''">{{"₹"}} {{ratePerUnitAmtInwords[i]}} Only</mat-label>
|
||||||
<mat-form-field style="width: 100%">
|
<mat-form-field style="width: 100%">
|
||||||
<mat-select placeholder="frequency" formControlName="fk_frequency_id" (selectionChange)="salecalculat(i,item)">
|
<mat-select placeholder="Frequency" formControlName="fk_frequency_id" (selectionChange)="salecalculat(i,item.value)">
|
||||||
<mat-option *ngFor="let frq of m_freqOfPurchase" [value]="frq.frequency_id
|
<mat-option *ngFor="let frq of m_freqOfPurchase" [value]="frq.frequency_id
|
||||||
">{{frq.name}}</mat-option>
|
">{{frq.name}}</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width: 100%">
|
<mat-form-field style="width: 100%">
|
||||||
<input matInput type="number" placeholder="Annual Sales" formControlName="annual_sale_value" name="annual_sale_value" readonly>
|
<input matInput type="number" placeholder="Annual Sales" formControlName="annual_sale_value" name="annual_sale_value" readonly>
|
||||||
|
<mat-hint align="end" style="font-size: 12px" *ngIf="item.get('rate_per_unit').value != ''">{{"₹"}} {{annualSaleAmtInwords[i]}} Only</mat-hint>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<div *ngIf="grossprofitCalc.mode==2">
|
<div *ngIf="margin_calculation_status===true">
|
||||||
<mat-form-field style="width: 100%">
|
<mat-form-field style="width: 100%">
|
||||||
<input matInput type="number" placeholder="Margin percentage %" (blur)="getSalesCalc(item)" formControlName="margin_per" name="margin_per" >
|
<input matInput type="number" placeholder="Margin percentage %" (keyup)="salesMarginPerCalculation(i,item.value)" formControlName="margin_per" name="margin_per" >
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width: 100%">
|
<mat-form-field style="width: 100%">
|
||||||
<input matInput type="number" placeholder="Margin Amount" (blur)="getSalesCalc(item)" formControlName="margin_per_uom" name="margin_per_uom">
|
<input matInput type="number" placeholder="Margin Amount" (keyup)="salesMarginAmtCalculation(i,item.value)" formControlName="margin_per_uom" name="margin_per_uom">
|
||||||
|
<mat-hint align="end" style="font-size: 12px" *ngIf="item.get('rate_per_unit').value != ''">{{"₹"}} {{marginAmtInwords[i]}} Only</mat-hint>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width: 100%">
|
<mat-form-field style="width: 100%">
|
||||||
<input matInput type="number" placeholder="Final Value" formControlName="margin_final_value" name="margin_final_value" readonly>
|
<input matInput type="number" placeholder="Considered Margin Amount" formControlName="margin_final_value" name="margin_final_value" readonly>
|
||||||
|
<mat-hint align="end" style="font-size: 12px" *ngIf="item.get('rate_per_unit').value != ''">{{"₹"}} {{marginFinalAmtInwords[i]}} Only</mat-hint>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<ion-buttons>
|
<ion-buttons>
|
||||||
@ -64,7 +68,7 @@
|
|||||||
</ion-col>
|
</ion-col>
|
||||||
</ion-row>
|
</ion-row>
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<h3 *ngIf="last">Grand Total : <span item-rigth>{{grandTotal}}</span></h3>
|
<!-- <h3 *ngIf="last">Grand Total : <span item-rigth>{{grandTotal}}</span></h3> -->
|
||||||
|
|
||||||
</mat-card>
|
</mat-card>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { AwsServiceProvider } from '../../../providers/aws-service/aws-service';
|
|||||||
import { FormGroup, FormBuilder, Validators, FormArray } from '@angular/forms';
|
import { FormGroup, FormBuilder, Validators, FormArray } from '@angular/forms';
|
||||||
import { QuestionCategoryProvider } from '../../../providers/question-category/question-category';
|
import { QuestionCategoryProvider } from '../../../providers/question-category/question-category';
|
||||||
import { ToastProvider } from '../../../providers/common-provider/toast';
|
import { ToastProvider } from '../../../providers/common-provider/toast';
|
||||||
|
import {ConstantsProvider} from '../../../providers/constants/constants'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated class for the PdQuestionAssessedSalesPage page.
|
* Generated class for the PdQuestionAssessedSalesPage page.
|
||||||
@ -29,10 +30,16 @@ export class PdQuestionAssessedSalesPage {
|
|||||||
users: any;
|
users: any;
|
||||||
FormId: any;
|
FormId: any;
|
||||||
pdDetails: any;
|
pdDetails: any;
|
||||||
constructor(public navCtrl: NavController, public navParams: NavParams,public aws:AwsServiceProvider,public fb:FormBuilder,public qustCat:QuestionCategoryProvider,public toast:ToastProvider) {
|
annualSaleAmtInwords: any=[];
|
||||||
|
marginAmtInwords: any=[];
|
||||||
|
marginFinalAmtInwords:any =[];
|
||||||
|
ratePerUnitAmtInwords: any=[];
|
||||||
|
margin_calculation_status:any=[]
|
||||||
|
constructor(public navCtrl: NavController, public navParams: NavParams,public aws:AwsServiceProvider,public fb:FormBuilder,public qustCat:QuestionCategoryProvider,public toast:ToastProvider,public cons:ConstantsProvider) {
|
||||||
this.pdDetails = this.navParams.get('pdDetails');
|
this.pdDetails = this.navParams.get('pdDetails');
|
||||||
this.FormId = this.navParams.get('FormId');
|
this.FormId = this.navParams.get('FormId');
|
||||||
this.grossprofitCalc = this.navParams.get('grossprofit');
|
//this.grossprofitCalc = this.navParams.get('grossprofit');
|
||||||
|
this.margin_calculation_status=this.navParams.get('margin_calculation_status');
|
||||||
this.users = this.aws.getlocale();
|
this.users = this.aws.getlocale();
|
||||||
this.assessedForm = this.fb.group(
|
this.assessedForm = this.fb.group(
|
||||||
{
|
{
|
||||||
@ -129,84 +136,158 @@ export class PdQuestionAssessedSalesPage {
|
|||||||
* 7.none
|
* 7.none
|
||||||
* 8.none
|
* 8.none
|
||||||
*/
|
*/
|
||||||
salecalculat(index,details)
|
salecalculat(indexVal,values)
|
||||||
{
|
|
||||||
// console.log(details,index);
|
|
||||||
let frequencyId = details.value.fk_frequency_id;
|
|
||||||
let salesQty = details.value.sales_qty;
|
|
||||||
let UOM = details.value.rate_per_unit;
|
|
||||||
// console.log(frequencyId,salesQty,UOM,index);
|
|
||||||
// console.log(frequencyId);
|
|
||||||
let annual
|
|
||||||
if(salesQty!=null && UOM!=null){
|
|
||||||
if(frequencyId==1)
|
|
||||||
{
|
{
|
||||||
|
// console.log("Det",details);
|
||||||
|
// let frequencyId = details.value.fk_frequency_id;
|
||||||
|
// let salesQty = details.value.sales_qty;
|
||||||
|
// let UOM = details.value.rate_per_unit;
|
||||||
|
// // console.log(frequencyId,salesQty,UOM,index);
|
||||||
|
// // console.log(frequencyId);
|
||||||
|
// let annual
|
||||||
|
// if(salesQty!=null && UOM!=null){
|
||||||
|
// if(frequencyId==1)
|
||||||
|
// {
|
||||||
|
|
||||||
}else if(frequencyId==2)
|
// }else if(frequencyId==2)
|
||||||
{
|
// {
|
||||||
annual = (salesQty*UOM*250);
|
// annual = (salesQty*UOM*250);
|
||||||
this.annual[index] = annual;
|
// this.annual[index] = annual;
|
||||||
details.controls['annual_sale_value'].setValue(annual);
|
// details.controls['annual_sale_value'].setValue(annual);
|
||||||
}else if(frequencyId==3)
|
// }else if(frequencyId==3)
|
||||||
{
|
// {
|
||||||
annual = (salesQty*UOM);
|
// annual = (salesQty*UOM);
|
||||||
this.annual[index] = annual;
|
// this.annual[index] = annual;
|
||||||
details.controls['annual_sale_value'].setValue(annual);
|
// details.controls['annual_sale_value'].setValue(annual);
|
||||||
}else if(frequencyId==4)
|
// }else if(frequencyId==4)
|
||||||
{
|
// {
|
||||||
|
|
||||||
}else if(frequencyId==5)
|
// }else if(frequencyId==5)
|
||||||
{
|
// {
|
||||||
annual = (salesQty*UOM*12);
|
// annual = (salesQty*UOM*12);
|
||||||
this.annual[index] = annual;
|
// this.annual[index] = annual;
|
||||||
details.controls['annual_sale_value'].setValue(annual);
|
// details.controls['annual_sale_value'].setValue(annual);
|
||||||
}else if(frequencyId==6)
|
// }else if(frequencyId==6)
|
||||||
{
|
// {
|
||||||
|
|
||||||
}else if(frequencyId==7)
|
// }else if(frequencyId==7)
|
||||||
{
|
// {
|
||||||
|
|
||||||
}else if(frequencyId==8)
|
// }else if(frequencyId==8)
|
||||||
{
|
// {
|
||||||
|
|
||||||
}else
|
// }else
|
||||||
{
|
// {
|
||||||
|
|
||||||
}
|
// }
|
||||||
this.grandTotal = this.annual.reduce((a,b)=> a+b,0);
|
// this.grandTotal = this.annual.reduce((a,b)=> a+b,0);
|
||||||
}else
|
// }else
|
||||||
{
|
// {
|
||||||
// this.toast.pdTriggerappmessage('Enter the Sales Quantity and UOM');
|
// // this.toast.pdTriggerappmessage('Enter the Sales Quantity and UOM');
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// console.log(this.annual);
|
||||||
|
|
||||||
|
let control:any = <FormArray>this.assessedForm.controls['salesCalItemwise'];
|
||||||
|
if(values.rate_per_unit!=''&& values.rate_per_unit != null ){
|
||||||
|
console.log("Rate Per value",values.rate_per_unit);
|
||||||
|
this.inWords(values.rate_per_unit,indexVal,4)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(values.sales_qty!='' && values.rate_per_unit!='' && values.fk_frequency_id!='' && values.fk_frequency_id != null) {
|
||||||
|
console.log("Frequency",values.fk_frequency_id);
|
||||||
|
let filterFrequencyValue: any = this.m_freqOfPurchase.filter(val =>val.frequency_id==values.fk_frequency_id);
|
||||||
|
let AnnualSalesValue = parseInt(values.sales_qty) * parseInt(values.rate_per_unit) * parseInt(filterFrequencyValue[0].mutiple_factor)
|
||||||
|
control.controls[indexVal].controls['annual_sale_value'].setValue(parseInt(values.sales_qty) * parseInt(values.rate_per_unit) * parseInt(filterFrequencyValue[0].mutiple_factor));
|
||||||
|
this.inWords(AnnualSalesValue,indexVal,1)
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
console.log(this.annual);
|
control.controls[indexVal].controls['annual_sale_value'].setValue('');
|
||||||
|
}
|
||||||
|
if(this.margin_calculation_status===true) {
|
||||||
|
values.margin_per_uom=='' && values.margin_per!='' ? this.salesMarginPerCalculation(indexVal,this.assessedForm.value.salesCalItemwise[indexVal]): values.margin_per_uom!='' && values.margin_per=='' ? this.salesMarginAmtCalculation(indexVal,this.assessedForm.value.salesCalItemwise[indexVal]) : values.margin_per_uom!='' && values.margin_per!='' ? this.salesMarginAmtCalculation(indexVal,this.assessedForm.value.salesCalItemwise[indexVal]) :this.salesMarginAmtCalculation(indexVal,this.assessedForm.value.salesCalItemwise[indexVal]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
salesMarginPerCalculation(indexVal: number,values: any): void {
|
||||||
|
let control:any = <FormArray>this.assessedForm.controls['salesCalItemwise'];
|
||||||
|
control.controls[indexVal].controls['margin_per_uom'].setValue('');
|
||||||
|
if(values.margin_per!='' && values.annual_sale_value!='' && values.margin_per!=null && values.annual_sale_value!=null) {
|
||||||
|
control.controls[indexVal].controls['margin_final_value'].setValue(parseInt(values.annual_sale_value) * (parseInt(values.margin_per)/100));
|
||||||
|
this.inWords(parseInt(values.annual_sale_value) * (parseInt(values.margin_per)/100),indexVal,3)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
control.controls[indexVal].controls['margin_final_value'].setValue('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
salesMarginAmtCalculation(indexVal: number,values: any): void {
|
||||||
|
let control:any = <FormArray>this.assessedForm.controls['salesCalItemwise'];
|
||||||
|
control.controls[indexVal].controls['margin_per'].setValue('');
|
||||||
|
if(values.margin_per_uom!='' && values.margin_per_uom != null){
|
||||||
|
this.inWords(values.margin_per_uom,indexVal,2)
|
||||||
}
|
}
|
||||||
|
|
||||||
getSalesCalc(details)
|
if(values.margin_per_uom!='' && values.sales_qty!='' && values.margin_per_uom!=null && values.sales_qty!=null) {
|
||||||
{
|
let MarginFinalValue = parseInt(values.sales_qty) * parseInt(values.margin_per_uom);
|
||||||
// console.log(details);
|
control.controls[indexVal].controls['margin_final_value'].setValue(parseInt(values.sales_qty) * parseInt(values.margin_per_uom));
|
||||||
let margin_per = details.value.margin_per;
|
this.inWords(MarginFinalValue,indexVal,3)
|
||||||
let margin_amount = details.value.margin_per_uom;
|
|
||||||
let annual_sale_value = details.value.annual_sale_value;
|
|
||||||
let sales_qty = details.value.sales_qty;
|
|
||||||
// console.log(sales_qty,margin_amount);
|
|
||||||
let value:any = '';
|
|
||||||
if(margin_per !=null || margin_amount !=null){
|
|
||||||
if(margin_per !=null)
|
|
||||||
{
|
|
||||||
value = +annual_sale_value * (+margin_per/100);
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
console.log('else');
|
|
||||||
value = +sales_qty* +margin_amount;
|
|
||||||
}
|
}
|
||||||
console.log(value);
|
else {
|
||||||
details.controls['margin_final_value'].setValue(value);
|
control.controls[indexVal].controls['margin_final_value'].setValue('');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
getSalesCalc(indexVal,values)
|
||||||
|
{
|
||||||
|
// // console.log(details);
|
||||||
|
// let margin_per = details.value.margin_per;
|
||||||
|
// let margin_amount = details.value.margin_per_uom;
|
||||||
|
// let annual_sale_value = details.value.annual_sale_value;
|
||||||
|
// let sales_qty = details.value.sales_qty;
|
||||||
|
// // console.log(sales_qty,margin_amount);
|
||||||
|
// let value:any = '';
|
||||||
|
// if(margin_per !=null || margin_amount !=null){
|
||||||
|
// if(margin_per !=null)
|
||||||
|
// {
|
||||||
|
// value = +annual_sale_value * (+margin_per/100);
|
||||||
|
// }else
|
||||||
|
// {
|
||||||
|
// console.log('else');
|
||||||
|
// value = +sales_qty* +margin_amount;
|
||||||
|
// }
|
||||||
|
// console.log(value);
|
||||||
|
// details.controls['margin_final_value'].setValue(value);
|
||||||
|
// }
|
||||||
|
let control:any = <FormArray>this.assessedForm.controls['salesCalItemwise'];
|
||||||
|
control.controls[indexVal].controls['margin_per_uom'].setValue('');
|
||||||
|
if(values.margin_per!='' && values.annual_sale_value!='' && values.margin_per!=null && values.annual_sale_value!=null) {
|
||||||
|
control.controls[indexVal].controls['margin_final_value'].setValue(parseInt(values.annual_sale_value) * (parseInt(values.margin_per)/100));
|
||||||
|
this.inWords(parseInt(values.annual_sale_value) * (parseInt(values.margin_per)/100),indexVal,3)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
control.controls[indexVal].controls['margin_final_value'].setValue('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inWords(value,inx,flag){
|
||||||
|
switch(flag){
|
||||||
|
case 1 :
|
||||||
|
this.annualSaleAmtInwords[inx] = this.cons.convertNumberToWords(value);
|
||||||
|
break;
|
||||||
|
case 2 :
|
||||||
|
this.marginAmtInwords[inx] = this.cons.convertNumberToWords(value);
|
||||||
|
break;
|
||||||
|
case 3 :
|
||||||
|
this.marginFinalAmtInwords[inx] = this.cons.convertNumberToWords(value);
|
||||||
|
break;
|
||||||
|
case 4 :
|
||||||
|
console.log("Rate",value);
|
||||||
|
this.ratePerUnitAmtInwords[inx] = this.cons.convertNumberToWords(value);
|
||||||
|
break;
|
||||||
|
default:break;}
|
||||||
|
}
|
||||||
saveData(answerData)
|
saveData(answerData)
|
||||||
{
|
{
|
||||||
let records = {'records':answerData.salesCalItemwise};
|
let records = {'records':answerData.salesCalItemwise};
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import { PdQuestionBusinessInfoPage } from '../../../pages/pd-question/pd-questi
|
|||||||
import { PdQuestionBusinessAssetsPage } from '../../../pages/pd-question/pd-question-business-group/pd-question-business-assets/pd-question-business-assets'
|
import { PdQuestionBusinessAssetsPage } from '../../../pages/pd-question/pd-question-business-group/pd-question-business-assets/pd-question-business-assets'
|
||||||
import {PdQuestionBusinessBankingPage} from '../../../pages/pd-question/pd-question-business-group/pd-question-business-banking/pd-question-business-banking'
|
import {PdQuestionBusinessBankingPage} from '../../../pages/pd-question/pd-question-business-group/pd-question-business-banking/pd-question-business-banking'
|
||||||
import {PdQuestionFinancialInfoPage} from '../../../pages/pd-question/pd-question-business-group/pd-question-financial-info/pd-question-financial-info'
|
import {PdQuestionFinancialInfoPage} from '../../../pages/pd-question/pd-question-business-group/pd-question-financial-info/pd-question-financial-info'
|
||||||
|
import {PdQuestionAssessedDashPage} from '../../../pages/pd-question/pd-question-assessed-dash/pd-question-assessed-dash'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated class for the PdQuestionBusinessGroupPage page.
|
* Generated class for the PdQuestionBusinessGroupPage page.
|
||||||
@ -61,6 +62,7 @@ export class PdQuestionBusinessGroupPage {
|
|||||||
this.pdDetails.business_entity_type_other = company.business_entity_type_other;
|
this.pdDetails.business_entity_type_other = company.business_entity_type_other;
|
||||||
this.pdDetails.business_years = company.business_years;
|
this.pdDetails.business_years = company.business_years;
|
||||||
this.pdDetails.business_month = company.business_month;
|
this.pdDetails.business_month = company.business_month;
|
||||||
|
console.log(details.form_id);
|
||||||
|
|
||||||
if(details.form_id==1){
|
if(details.form_id==1){
|
||||||
this.navCtrl.push(PdQuestionSupplierInfoPage,{'formDetails':details,'pdDetails':this.pdDetails});
|
this.navCtrl.push(PdQuestionSupplierInfoPage,{'formDetails':details,'pdDetails':this.pdDetails});
|
||||||
@ -93,6 +95,9 @@ export class PdQuestionBusinessGroupPage {
|
|||||||
this.navCtrl.push(PdQuestionBusinessAssetsPage,{'formDetails':details,'pdDetails':this.pdDetails});
|
this.navCtrl.push(PdQuestionBusinessAssetsPage,{'formDetails':details,'pdDetails':this.pdDetails});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if(details.form_id==16){
|
||||||
|
this.navCtrl.push(PdQuestionAssessedDashPage,{'formDetails':details,'pdDetails':this.pdDetails});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -208,6 +208,7 @@
|
|||||||
<!-- <mat-form-field style="width: 45%" *ngIf="items.get('trade_product_payment_type').value == 3">
|
<!-- <mat-form-field style="width: 45%" *ngIf="items.get('trade_product_payment_type').value == 3">
|
||||||
<input matInput placeholder="No. of Days of Credit Given for Payment Receipt" formControlName="trade_product_credit_days">
|
<input matInput placeholder="No. of Days of Credit Given for Payment Receipt" formControlName="trade_product_credit_days">
|
||||||
</mat-form-field> -->
|
</mat-form-field> -->
|
||||||
|
<div *ngIf="items.get('trade_product_payment_type').value == 3">
|
||||||
<mat-label>No of days of Credit provided to Client for payment</mat-label>
|
<mat-label>No of days of Credit provided to Client for payment</mat-label>
|
||||||
<mat-form-field style="width: 100%">
|
<mat-form-field style="width: 100%">
|
||||||
<input matInput placeholder="Days From" formControlName="trade_product_credit_days_from"
|
<input matInput placeholder="Days From" formControlName="trade_product_credit_days_from"
|
||||||
@ -218,6 +219,7 @@
|
|||||||
type="number">
|
type="number">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<ion-buttons end>
|
<ion-buttons end>
|
||||||
<ion-col col-3 offset-3>
|
<ion-col col-3 offset-3>
|
||||||
<a *ngIf="item.controls.trading_products.controls.length > 1" (click)="removeTradingProduct(l)">
|
<a *ngIf="item.controls.trading_products.controls.length > 1" (click)="removeTradingProduct(l)">
|
||||||
|
|||||||
@ -382,7 +382,7 @@ export class PdQuestionSupplierInfoPage {
|
|||||||
|
|
||||||
this.qustCat.getcommondrop('COMPANYRELATIONSHIPS').subscribe(
|
this.qustCat.getcommondrop('COMPANYRELATIONSHIPS').subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.m_companyRelationShipList = data['records'].filter(data => data.isactive == 1);
|
this.m_companyRelationShipList = data['records']
|
||||||
});
|
});
|
||||||
|
|
||||||
this.qustCat.getcommondrop('TITLES').subscribe(
|
this.qustCat.getcommondrop('TITLES').subscribe(
|
||||||
|
|||||||
@ -63,7 +63,7 @@
|
|||||||
<input matInput autocomplete="off" formControlName="reason_for_positive">
|
<input matInput autocomplete="off" formControlName="reason_for_positive">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<ion-buttons end>
|
<ion-buttons end>
|
||||||
<ion-col col-3 offset-3 *ngIf="i>0">
|
<ion-col col-3 offset-3 *ngIf="_finalRemarkForm.get('recommendation_positive').controls.length > 1">
|
||||||
<button ion-button clear color="optblue" (click)="removeRecomendationPositive(i)"><ion-icon name="md-trash" style="font-size: 22px;"></ion-icon></button>
|
<button ion-button clear color="optblue" (click)="removeRecomendationPositive(i)"><ion-icon name="md-trash" style="font-size: 22px;"></ion-icon></button>
|
||||||
</ion-col>
|
</ion-col>
|
||||||
<ion-col col-2 offset-1 *ngIf="l">
|
<ion-col col-2 offset-1 *ngIf="l">
|
||||||
@ -81,7 +81,7 @@
|
|||||||
<input matInput autocomplete="off" formControlName="reason_for_negative">
|
<input matInput autocomplete="off" formControlName="reason_for_negative">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<ion-buttons end>
|
<ion-buttons end>
|
||||||
<ion-col col-3 offset-3 *ngIf="i>0">
|
<ion-col col-3 offset-3 *ngIf="_finalRemarkForm.get('recommendation_negative').controls.length > 1">
|
||||||
<button ion-button clear color="optblue" (click)="removeRecomendationNegative(i)"><ion-icon name="md-trash" style="font-size: 22px;"></ion-icon></button>
|
<button ion-button clear color="optblue" (click)="removeRecomendationNegative(i)"><ion-icon name="md-trash" style="font-size: 22px;"></ion-icon></button>
|
||||||
</ion-col>
|
</ion-col>
|
||||||
<ion-col col-2 offset-1 *ngIf="l">
|
<ion-col col-2 offset-1 *ngIf="l">
|
||||||
@ -99,7 +99,7 @@
|
|||||||
<input matInput autocomplete="off" formControlName="reason_for_refer_to_credit">
|
<input matInput autocomplete="off" formControlName="reason_for_refer_to_credit">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<ion-buttons end>
|
<ion-buttons end>
|
||||||
<ion-col col-3 offset-3 *ngIf="i>0">
|
<ion-col col-3 offset-3 *ngIf="_finalRemarkForm.get('recommendation_refer_to_credit').controls.length > 1">
|
||||||
<button ion-button clear color="optblue" (click)="removeRecomendationCreditRefer(i)"><ion-icon name="md-trash" style="font-size: 22px;"></ion-icon></button>
|
<button ion-button clear color="optblue" (click)="removeRecomendationCreditRefer(i)"><ion-icon name="md-trash" style="font-size: 22px;"></ion-icon></button>
|
||||||
</ion-col>
|
</ion-col>
|
||||||
<ion-col col-2 offset-1 *ngIf="l">
|
<ion-col col-2 offset-1 *ngIf="l">
|
||||||
|
|||||||
@ -325,7 +325,7 @@ RecommendationChange(e) {
|
|||||||
recommendationNegativeCtrl.push(this.createRecomendationNegative(obj))
|
recommendationNegativeCtrl.push(this.createRecomendationNegative(obj))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if(data['records'].recommendation_refer_to_credit.length>1){
|
if(data['records'].recommendation_refer_to_credit.length>0){
|
||||||
let recommendationReferToCredit: any = this._finalRemarkForm.get('recommendation_refer_to_credit') as FormArray;
|
let recommendationReferToCredit: any = this._finalRemarkForm.get('recommendation_refer_to_credit') as FormArray;
|
||||||
data['records'].recommendation_refer_to_credit.forEach(val=>{
|
data['records'].recommendation_refer_to_credit.forEach(val=>{
|
||||||
let obj={'reason_for_refer_to_credit':val.reason_for_refer_to_credit};
|
let obj={'reason_for_refer_to_credit':val.reason_for_refer_to_credit};
|
||||||
|
|||||||
@ -49,7 +49,9 @@ export class PdtriggerProvider {
|
|||||||
|
|
||||||
checkotp(otpDetails)
|
checkotp(otpDetails)
|
||||||
{
|
{
|
||||||
|
|
||||||
let records = {'records':otpDetails};
|
let records = {'records':otpDetails};
|
||||||
|
|
||||||
return this.http.post(this.apiurl+'checkOTP',records);
|
return this.http.post(this.apiurl+'checkOTP',records);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -29166,8 +29166,13 @@ page-pd-question-assessed-info ion-scroll.scroll-y .scroll-content {
|
|||||||
height: 200px;
|
height: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
page-pd-question-assessed-info span {
|
page-pd-question-assessed-info .mat-form-field-label {
|
||||||
font-size: 12px;
|
white-space: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
page-pd-question-assessed-info textarea.mat-input-element {
|
||||||
|
padding: 0px 0;
|
||||||
|
margin: 5px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
page-pd-question-assests .scroll-content {
|
page-pd-question-assests .scroll-content {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user