Fairoj: indusland changes and queries page implemented
This commit is contained in:
parent
edb8106288
commit
7438fdd57f
@ -1 +1 @@
|
||||
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
||||
{"version":3,"sources":["../../@angular/common/http (ignored)"],"names":[],"mappings":";;;;;AAAA,e","file":"0.js","sourcesContent":["/* (ignored) */\n\n\n//////////////////\n// WEBPACK FOOTER\n// @angular/common/http (ignored)\n// module id = 717\n// module chunks = 0"],"sourceRoot":""}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,5 +1,5 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<widget id="com.sineedge.pdgenie" version="0.0.10" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
||||
<widget id="com.sineedge.pdgenie" version="0.0.11" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
||||
<name>PD Genie Officer </name>
|
||||
<description>info@pdgenie.com</description>
|
||||
<author email="info@pdgenie.com" href="https://pdgenie.com">PD Genie</author>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -5,7 +5,7 @@ password: pdgenieofficer
|
||||
|
||||
commands:
|
||||
|
||||
GENERATE A KEY
|
||||
GENERATE A KEY(One Time Generation only)
|
||||
------------
|
||||
|
||||
keytool -genkey -v -keystore lender.jks -keyalg RSA -keysize 2048 -validity 10000 -alias my-alias (One time only)
|
||||
@ -24,3 +24,7 @@ VERIFY THE SIGNED APK
|
||||
---------------------
|
||||
|
||||
apksigner verify pd_genie_officer.apk
|
||||
|
||||
|
||||
password:
|
||||
pdgenieofficer
|
||||
Binary file not shown.
@ -139,6 +139,8 @@ import {Push} from '@ionic-native/push'
|
||||
import {AppVersion} from '@ionic-native/app-version'
|
||||
// import { OfficerNotesModalPageModule } from '../pages/officer-notes-modal/officer-notes-modal.module';
|
||||
import { OfficerNotesModalPage } from '../pages/officer-notes-modal/officer-notes-modal';
|
||||
import {ComponentsQueriesDocsComponent} from '../components/components-queries-docs/components-queries-docs'
|
||||
import { QueriesDocsPage } from '../pages/queries-docs/queries-docs';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
@ -197,8 +199,10 @@ import { OfficerNotesModalPage } from '../pages/officer-notes-modal/officer-note
|
||||
PdQuestionRentalDashPage,
|
||||
MapAddressPage,
|
||||
FormCompleteCheckModalPage,
|
||||
OfficerNotesModalPage
|
||||
// PipesModule
|
||||
OfficerNotesModalPage,
|
||||
// PipesModule,
|
||||
ComponentsQueriesDocsComponent,
|
||||
QueriesDocsPage
|
||||
|
||||
],
|
||||
imports: [
|
||||
@ -297,7 +301,9 @@ import { OfficerNotesModalPage } from '../pages/officer-notes-modal/officer-note
|
||||
PdQuestionRentalDashPage,
|
||||
MapAddressPage,
|
||||
FormCompleteCheckModalPage,
|
||||
OfficerNotesModalPage
|
||||
OfficerNotesModalPage,
|
||||
ComponentsQueriesDocsComponent,
|
||||
QueriesDocsPage
|
||||
|
||||
|
||||
],
|
||||
|
||||
@ -0,0 +1,35 @@
|
||||
<!-- Generated template for the ComponentsQueriesDocsComponent component -->
|
||||
<div [formGroup]="docsCollectedForm">
|
||||
<mat-card *ngIf="queries_docs_array.queries.length !=0">
|
||||
<mat-card-header>
|
||||
<mat-card-title>
|
||||
<h5>Credit Manager’s Specific Queries</h5>
|
||||
</mat-card-title>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
|
||||
<div *ngFor="let item of queries_docs_array.queries">
|
||||
<mat-form-field>
|
||||
<input matInput type="text" [formControlName]="item.add_req_id" [placeholder]="item.add_requirement">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<!-- <mat-card *ngIf="queries_docs_array.docs.length !=0">
|
||||
<mat-card-header>
|
||||
<mat-card-title>
|
||||
<h5>Documents to be collected</h5>
|
||||
</mat-card-title>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
|
||||
<div *ngFor="let item of array">
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput type="text" [formControlName]="item.add_req_id" [placeholder]="add_requirement">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
</mat-card-content>
|
||||
</mat-card> -->
|
||||
</div>
|
||||
@ -0,0 +1,3 @@
|
||||
components-queries-docs {
|
||||
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
import { Component,Input } from '@angular/core';
|
||||
import { FormGroup, FormControl, Validators } from '@angular/forms';
|
||||
|
||||
/**
|
||||
* Generated class for the ComponentsQueriesDocsComponent component.
|
||||
*
|
||||
* See https://angular.io/api/core/Component for more info on Angular
|
||||
* Components.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'components-queries-docs',
|
||||
templateUrl: 'components-queries-docs.html'
|
||||
})
|
||||
export class ComponentsQueriesDocsComponent {
|
||||
@Input () queries_doc_data
|
||||
text: string;
|
||||
docsCollectedForm:FormGroup
|
||||
|
||||
constructor() {
|
||||
console.log('Hello ComponentsQueriesDocsComponent Component');
|
||||
this.text = 'Hello World';
|
||||
console.log("Component",this.queries_doc_data);
|
||||
if(this.queries_doc_data.queries.length != 0){
|
||||
this.queries_doc_data.queries.forEach(res=>{
|
||||
this.docsCollectedForm.addControl(res.add_req_id,new FormControl(Validators.compose([Validators.required])));
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
8
src/components/components.module.ts
Normal file
8
src/components/components.module.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { ComponentsQueriesDocsComponent } from './components-queries-docs/components-queries-docs';
|
||||
@NgModule({
|
||||
declarations: [ComponentsQueriesDocsComponent],
|
||||
imports: [],
|
||||
exports: [ComponentsQueriesDocsComponent]
|
||||
})
|
||||
export class ComponentsModule {}
|
||||
@ -184,9 +184,9 @@
|
||||
</mat-card-content>
|
||||
</mat-card><br/>
|
||||
|
||||
<mat-card *ngIf="!requirement_hide">
|
||||
<mat-card *ngIf="!requirement_hide" style="border-radius:10px">
|
||||
<mat-card-header>
|
||||
<mat-card-title><h5>Additional Requirements</h5></mat-card-title>
|
||||
<mat-card-title><h5>Credit Manager’s Specific Queries</h5></mat-card-title>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<div *ngFor="let req of add_requirements; let i=index">
|
||||
|
||||
@ -36,6 +36,7 @@ import { PdQuestionFuturePlansAndBusinessEnvironmentPage } from '../pd-question/
|
||||
import {FormCompleteCheckModalPage} from '../form-complete-check-modal/form-complete-check-modal'
|
||||
import {ConstantsProvider} from '../../providers/constants/constants'
|
||||
import { StorageProvider } from '../../providers/storage/storage';
|
||||
import { QueriesDocsPage } from '../queries-docs/queries-docs';
|
||||
|
||||
|
||||
/**
|
||||
@ -324,8 +325,13 @@ searchitem:any;
|
||||
}
|
||||
else if(categroyId==20)
|
||||
{
|
||||
// console.log(this.pdinfo);
|
||||
this.navCtrl.push(PdQuestionFinalRemarkPage,{'FormId':formName,'pdDetails':this.pdinfo});
|
||||
}
|
||||
else if(categroyId==24)
|
||||
{
|
||||
this.navCtrl.push(QueriesDocsPage,{'FormId':formName,'pdDetails':this.pdinfo});
|
||||
}
|
||||
}
|
||||
filter(view){
|
||||
if(!view){
|
||||
|
||||
@ -25,9 +25,9 @@
|
||||
<mat-list style="width: 100%">
|
||||
<p>Purchase Detail Available</p>
|
||||
<mat-radio-group formControlName="purchase_type" class="radio">
|
||||
<mat-radio-button class="radio" value="1">Purchase Item Wise</mat-radio-button><br/>
|
||||
<mat-radio-button class="radio" value="2">Purchase Bill Wise</mat-radio-button><br/>
|
||||
<mat-radio-button class="radio" value="0">Not Available</mat-radio-button>
|
||||
<mat-radio-button class="radio" value="1">Yes</mat-radio-button><br/>
|
||||
<!-- <mat-radio-button class="radio" value="2">Purchase Bill Wise</mat-radio-button><br/> -->
|
||||
<mat-radio-button class="radio" value="0">No</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
</mat-list>
|
||||
<!-- <mat-list style="width: 100%" *ngIf="assessedForm.get('mode').value==2">
|
||||
|
||||
@ -166,11 +166,13 @@ else{
|
||||
if(res['records'].purchase_details.length !=0)
|
||||
{
|
||||
this.purchaseData = true;
|
||||
this.purchaseBillData=true;
|
||||
}
|
||||
if(res['records'].purchase_billwise.length != 0){
|
||||
this.purchaseBillData=true;
|
||||
}
|
||||
if(res['records'].sales_items_by_monthwise.length !=0 || res['records'].sales_declared_by_customer.length !=0 || res['records'].sales_calculated_by_itemwise.length !=0)
|
||||
// if(res['records'].purchase_billwise.length != 0){
|
||||
//
|
||||
// }
|
||||
// res['records'].sales_items_by_monthwise.length !=0
|
||||
if( res['records'].sales_declared_by_customer.length !=0 || res['records'].sales_calculated_by_itemwise.length !=0)
|
||||
{
|
||||
this.salesData = true;
|
||||
}
|
||||
|
||||
@ -94,11 +94,11 @@
|
||||
<mat-card-header><h4>Sales Details</h4></mat-card-header>
|
||||
<ion-row>
|
||||
|
||||
<ion-col col-3 *ngIf="sales_item_value != ''">
|
||||
<a (click)="editAllDetails(sales_item_value)">
|
||||
<!-- <ion-col col-3 *ngIf="sales_item_value != ''">
|
||||
<a (click)="editAllDetails(sales_month_wise_data)">
|
||||
<h2>{{"✎"}}</h2>
|
||||
</a>
|
||||
</ion-col>
|
||||
</ion-col> -->
|
||||
<ion-col offset-6 col-3 text-right>
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
|
||||
<ion-list *ngFor="let salesItem of sales_item_value">
|
||||
<ion-list *ngFor="let salesItem of sales_month_wise_data">
|
||||
<ion-item (click)="editDetails(salesItem.sci_id)">
|
||||
<ion-row>
|
||||
<ion-col col-6 text-wrap>
|
||||
@ -136,7 +136,7 @@
|
||||
|
||||
<br/>
|
||||
|
||||
<mat-expansion-panel>
|
||||
<!-- <mat-expansion-panel>
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
Sales Calculation as per Kutcha Records / Bills
|
||||
@ -186,13 +186,7 @@
|
||||
</div>
|
||||
</ion-col>
|
||||
|
||||
<!-- <ion-col col-6>
|
||||
<mat-card-title>Oct</mat-card-title>
|
||||
<mat-card-subtitle text-right>06-05-2018 $5000</mat-card-subtitle>
|
||||
</ion-col> -->
|
||||
<!-- <ion-row >
|
||||
Annual Sale : {{monthwise.footerMessage[0].month_value}}
|
||||
</ion-row> -->
|
||||
|
||||
|
||||
<ion-row *ngIf="sales_type[i] == '2'">
|
||||
<b>Annual Sale : </b> {{ monthwise.footerMessage[0].month_value}}
|
||||
@ -206,42 +200,19 @@
|
||||
|
||||
</ion-row>
|
||||
|
||||
<!-- </ion-item> -->
|
||||
|
||||
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<!-- <ion-row>
|
||||
|
||||
</ion-row> -->
|
||||
<!-- <ion-list *ngFor="let monthSalesItem of sales_month_wise_data">
|
||||
<ion-item (click)="editAssessedDailyForm(monthSalesItem.simId)">
|
||||
<ion-row>
|
||||
<ion-col offset-3 col-6 text-center>
|
||||
<h3>{{monthSalesItem.salesItem}}</h3>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row *ngFor="let monthwise of monthSalesItem.expandElements">
|
||||
<h6>{{monthwise.header}}</h6>
|
||||
<ion-col col-6>
|
||||
{{monthwise.value[0].sales_date | date:'dd-mm-yyyy'}}
|
||||
</ion-col>
|
||||
<ion-col text-right col-6>
|
||||
{{"₹"}} {{monthwise.value[0].sales_value}}
|
||||
</ion-col>
|
||||
|
||||
</ion-row>
|
||||
|
||||
|
||||
</ion-item>
|
||||
|
||||
</ion-list> -->
|
||||
|
||||
|
||||
</mat-expansion-panel>
|
||||
</mat-expansion-panel> -->
|
||||
</mat-accordion>
|
||||
|
||||
</div>
|
||||
<div *ngIf="pageId==2">
|
||||
|
||||
<!--PURCHASE DETAILS ALREADY IN DASH PAGE-->
|
||||
<!-- <form [formGroup]="grossProfitForm">
|
||||
<mat-card>
|
||||
@ -258,18 +229,49 @@
|
||||
</ion-buttons>
|
||||
</mat-card>
|
||||
</form> -->
|
||||
|
||||
<form [formGroup]="purchaseCalculationForm">
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<mat-card-title><h6>Purchase 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-placeholder style="font-size: 14px">Purchase Declared by the Customer as the Annual purchase Actually Done</mat-placeholder>
|
||||
<input matInput autocomplete="off" type="number" formControlName="purchase_declared_by_customer" name="Purchase_declared_by_customer" (keyup)="setNumtoWord()">
|
||||
<mat-hint align="end" style="font-size: 12px" *ngIf="purchaseCalculationForm.value.sales_declared_by_customer != ''">{{"₹"}} {{PurchaseAmtInwords}} Only</mat-hint>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%">
|
||||
<textarea matInput type="text" placeholder="Remarks" formControlName="comments" autocomplete="off"></textarea>
|
||||
</mat-form-field>
|
||||
<ion-row>
|
||||
<br/><br/>
|
||||
|
||||
|
||||
<!-- <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> -->
|
||||
<button ion-button full round color="optblue" (click)="savePurchaseCalc(purchaseCalculationForm.value)"> Save</button>
|
||||
<!-- </ion-buttons> -->
|
||||
|
||||
</ion-row>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</form>
|
||||
|
||||
<br/>
|
||||
|
||||
<mat-card *ngIf="purchase_type == '1'">
|
||||
<mat-card-header><h4>Item-wise Purchase Calculation</h4></mat-card-header>
|
||||
<ion-row>
|
||||
<ion-col col-3 *ngIf="purchse_details !='' "><a (click)="editPurchaseAllDetails(purchse_details)"><h2>{{"✎"}}</h2></a></ion-col>
|
||||
<!-- <ion-col col-3 *ngIf="purchse_details !='' "><a (click)="editPurchaseAllDetails(purchase_bill_wise_data)"><h2>{{"✎"}}</h2></a></ion-col> -->
|
||||
<ion-col offset-9 col-3 text-right>
|
||||
<a (click)="AddPurchaseForm()">
|
||||
<ion-icon name="add-circle" color="optblue" style="font-size: 24px;"></ion-icon>
|
||||
</a>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-list *ngFor="let purchase of purchse_details">
|
||||
<ion-list *ngFor="let purchase of purchase_bill_wise_data">
|
||||
<ion-item (click)="editPurchaseDetails(purchase.purchase_id)">
|
||||
<ion-row>
|
||||
<ion-col col-6 text-wrap>
|
||||
@ -291,7 +293,7 @@
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</mat-card>
|
||||
|
||||
<!--
|
||||
<mat-card *ngIf="purchase_type == '2'">
|
||||
<mat-card-header><h4>Purchase Calculation as per Kutcha Records / Bills</h4></mat-card-header>
|
||||
<ion-row>
|
||||
@ -315,7 +317,7 @@
|
||||
<ion-col col-12 *ngFor="let eachItem of purchase.expandElements">
|
||||
<mat-card-title>
|
||||
<span *ngIf="eachItem.header != 'Jan-1970';else freqtitle;">{{eachItem.header | titlecase}}</span>
|
||||
<!-- <ng-template #freqtitle>YearWise Purchase</ng-template> -->
|
||||
|
||||
</mat-card-title>
|
||||
<div *ngFor="let eachmonthItem of eachItem.value">
|
||||
<mat-card-subtitle >
|
||||
@ -324,13 +326,13 @@
|
||||
<span *ngIf="eachmonthItem.purchase_date !== '0000-00-00 00:00:00';else freqname;">
|
||||
{{eachmonthItem.purchase_date | date:'dd-MM-yyyy'}}
|
||||
</span>
|
||||
<!-- <ng-template #freqname>{{eachmonthItem.frequency_name}}</ng-template> -->
|
||||
|
||||
</ion-col>
|
||||
<ion-col col-6 text-right>
|
||||
<span *ngIf="eachmonthItem.purchase_date !== '0000-00-00 00:00:00';else freqvalue;">
|
||||
{{"₹"}} {{eachmonthItem.purchase_value}}
|
||||
</span>
|
||||
<!-- <ng-template #freqvalue>{{"₹"}} {{eachmonthItem.frequency_value}}</ng-template> -->
|
||||
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</mat-card-subtitle>
|
||||
@ -346,7 +348,7 @@
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
</mat-card>
|
||||
</mat-card> -->
|
||||
</div>
|
||||
|
||||
<!-- <ion-row>
|
||||
|
||||
@ -56,6 +56,7 @@ export class PdQuestionAssessedInfoPage {
|
||||
pageId: any;
|
||||
pdDetails: any;
|
||||
assessedForm:FormGroup;
|
||||
purchaseCalculationForm:FormGroup
|
||||
FormName:any;
|
||||
annual:any = [];
|
||||
rawMaterialForm:FormGroup;
|
||||
@ -72,6 +73,7 @@ export class PdQuestionAssessedInfoPage {
|
||||
totalAnnualBusiness_details: any;
|
||||
totalAnnual_House_hold_details: any;
|
||||
sales_type: any=[];
|
||||
PurchaseAmtInwords: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.pageId = this.navParams.get('pageId');
|
||||
@ -83,6 +85,16 @@ export class PdQuestionAssessedInfoPage {
|
||||
break;
|
||||
case 2:
|
||||
this.FormName = "Purchase Page";
|
||||
this.purchaseCalculationForm=this.fb.group({
|
||||
purchase_declared_by_customer:[''],
|
||||
comments:[''],
|
||||
pdc_id:[''],
|
||||
fk_pd_id:[this.pdDetails.pd_id],
|
||||
company_id:[this.pdDetails.company_id],
|
||||
isactive:[true],
|
||||
fk_createdby:[''],
|
||||
fk_updatedby:['']
|
||||
})
|
||||
break;
|
||||
case 3:
|
||||
this.FormName = "Business Expenses Page";
|
||||
@ -231,11 +243,12 @@ export class PdQuestionAssessedInfoPage {
|
||||
if(res['dataStatus']==true)
|
||||
{
|
||||
let sales_value = res['records'].sales_declared_by_customer[0];
|
||||
let purchaseCalc=res['records'].purchase_declared_by_customer[0]
|
||||
this.sales_item_value = res['records'].sales_calculated_by_itemwise;
|
||||
//SALE ANNUAL TOTAL
|
||||
this.totalAnnualSale_Item_wise=this.sales_item_value.map(val=>val.annual_sale_value).reduce((original,value)=>original + Number(value),0)
|
||||
console.log("this.sales_item",this.totalAnnualSale_Item_wise);
|
||||
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;
|
||||
//PURCHASE ANNUAL TOTAL
|
||||
this.totalAnnualpurchase_Item_wise=this.purchse_details.map(val=>val.annual_purchase_value).reduce((original,value)=>original+Number(value),0)
|
||||
@ -275,34 +288,62 @@ export class PdQuestionAssessedInfoPage {
|
||||
// this.grossProfitForm.controls['calc_type_id'].setValue(res['records'].gross_profit_calculation_type.calc_type_id)
|
||||
|
||||
|
||||
this.sales_item_value.forEach((itemElement, itemIndex) => {
|
||||
this.sales_type[itemIndex]=itemElement.sales_type
|
||||
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) => {
|
||||
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,
|
||||
})
|
||||
this.sales_month_wise_data.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,values:expandBodyContent[0].value});
|
||||
}
|
||||
else{
|
||||
this.sales_month_wise_data.push(itemElement)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.sales_item_month_value.forEach((itemElement, itemIndex) => {
|
||||
this.sales_type[itemIndex]=itemElement.sales_type
|
||||
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,
|
||||
})
|
||||
this.sales_month_wise_data.push({salesItem:itemElement.sales_item, expandElements:expandBodyContent, footerMessage: footerMessage,simId:itemElement.sim_id,otherSaleItem:itemElement.other_sales_item});
|
||||
});
|
||||
this.purchase_bill_wise.forEach((itemElement,itemIndex)=>{
|
||||
console.log("0index",itemElement.items[0]);
|
||||
|
||||
// this.sales_item_month_value.forEach((itemElement, itemIndex) => {
|
||||
// this.sales_type[itemIndex]=itemElement.sales_type
|
||||
// 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,
|
||||
// })
|
||||
// this.sales_month_wise_data.push({salesItem:itemElement.sales_item, expandElements:expandBodyContent, footerMessage: footerMessage,simId:itemElement.sim_id,otherSaleItem:itemElement.other_sales_item});
|
||||
// });
|
||||
this.purchse_details.forEach((itemElement,itemIndex)=>{
|
||||
if(itemElement.purchase_type == "3"){
|
||||
// console.log("0index",itemElement.items[0]);
|
||||
let result=Object.assign({},...itemElement.items);
|
||||
console.log("result",result)
|
||||
// console.log("result",result)
|
||||
let expandBodyContent=Object.keys(result).map(key=>({header:key,value:result[key]}));
|
||||
console.log("expanBody",expandBodyContent);
|
||||
// console.log("expanBody",expandBodyContent);
|
||||
let listItems:any=[];
|
||||
expandBodyContent.forEach((expandElement,expandIndex)=>{
|
||||
let calculateItems=expandElement.value.reduce((acc,calculate)=>acc + Number(calculate.purchase_value),0)
|
||||
@ -317,7 +358,24 @@ export class PdQuestionAssessedInfoPage {
|
||||
year_message: ' Yearly Sales Arrived : '+ calculateAllItemsTotal * convertYear,
|
||||
year_value: calculateAllItemsTotal * convertYear,
|
||||
})
|
||||
this.purchase_bill_wise_data.push({purchaseItem:itemElement.purchase_item,expandElements:expandBodyContent,footerMessage:footerMessage,pbw_id:itemElement.pbw_id,otherPurchaseItem:itemElement.other_purchase_item});
|
||||
this.purchase_bill_wise_data.push({
|
||||
"purchase_id":itemElement.purchase_id,
|
||||
"purchase_item":itemElement.purchase_item,
|
||||
"other_purchase_item":itemElement.other_purchase_item,
|
||||
"comments":itemElement.comments,
|
||||
"annual_purchase_value":itemElement.annual_purchase_value,
|
||||
"fk_frequency_id":itemElement.fk_frequency_id,
|
||||
"fk_uom_id":itemElement.fk_uom_id,
|
||||
"purchase_qty":itemElement.purchase_qty,
|
||||
"purchase_type":itemElement.purchase_type,
|
||||
"rate_per_unit":itemElement.rate_per_unit,
|
||||
"expandElements":expandBodyContent,
|
||||
"footerMessage": footerMessage,
|
||||
"values":expandBodyContent[0].value});
|
||||
}
|
||||
else{
|
||||
this.purchase_bill_wise_data.push(itemElement)
|
||||
}
|
||||
})
|
||||
console.log("val purchase0",this.purchase_bill_wise_data)
|
||||
|
||||
@ -329,6 +387,7 @@ export class PdQuestionAssessedInfoPage {
|
||||
this.assessedForm.controls['margin_value'].setValue(sales_value.margin_value);
|
||||
this.assessedForm.controls['comments'].setValue(sales_value.comments)
|
||||
this.assessedForm.controls['margin_per'].setValue(sales_value.margin_per);
|
||||
|
||||
if(sales_value.sales_declared_by_customer != null){
|
||||
this.SaleAmtInwords=this.cons.convertNumberToWords(sales_value.sales_declared_by_customer)
|
||||
}
|
||||
@ -337,6 +396,19 @@ export class PdQuestionAssessedInfoPage {
|
||||
}
|
||||
|
||||
}
|
||||
if(this.pageId == "2"){
|
||||
if(purchaseCalc != ''){
|
||||
let puForm=this.purchaseCalculationForm.controls
|
||||
puForm['pdc_id'].setValue(purchaseCalc.pdc_id)
|
||||
puForm['purchase_declared_by_customer'].setValue(purchaseCalc.purchase_declared_by_customer);
|
||||
puForm['fk_pd_id'].setValue(purchaseCalc.fk_pd_id);
|
||||
puForm['company_id'].setValue(purchaseCalc.company_id);
|
||||
puForm['isactive'].setValue(purchaseCalc.isactive);
|
||||
puForm['fk_createdby'].setValue(purchaseCalc.fk_createdby);
|
||||
puForm['comments'].setValue(purchaseCalc.comments);
|
||||
puForm['fk_updatedby'].setValue(purchaseCalc.fk_updatedby);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
@ -363,7 +435,7 @@ export class PdQuestionAssessedInfoPage {
|
||||
|
||||
editDetails(salesCal)
|
||||
{
|
||||
let salesData = this.sales_item_value.filter(sal=>sal.sci_id==salesCal);
|
||||
let salesData = this.sales_month_wise_data.filter(sal=>sal.sci_id==salesCal);
|
||||
console.log(salesData);
|
||||
// this.navCtrl.push(PdQuestionAssessedSalesPage,{'pdDetails':this.pdDetails,'sales':salesData,'grossprofit':this.grossprofitCalc});
|
||||
this.navCtrl.push(PdQuestionAssessedSalesPage,{'pdDetails':this.pdDetails,'sales':salesData,'margin_calculation_status':this.activateMarginCalculation});
|
||||
@ -371,6 +443,7 @@ export class PdQuestionAssessedInfoPage {
|
||||
}
|
||||
editAllDetails(AllsalesData)
|
||||
{
|
||||
|
||||
this.navCtrl.push(PdQuestionAssessedSalesPage,{'pdDetails':this.pdDetails,'sales':AllsalesData,'margin_calculation_status':this.activateMarginCalculation});
|
||||
}
|
||||
|
||||
@ -400,7 +473,7 @@ export class PdQuestionAssessedInfoPage {
|
||||
|
||||
editPurchaseDetails(purchaseCal)
|
||||
{
|
||||
let salesData = this.purchse_details.filter(sal=>sal.purchase_id==purchaseCal);
|
||||
let salesData = this.purchase_bill_wise_data.filter(sal=>sal.purchase_id==purchaseCal);
|
||||
console.log(salesData);
|
||||
this.navCtrl.push(PdQuestionAssessedPurchasePage,{'pdDetails':this.pdDetails,'purchase':salesData});
|
||||
|
||||
@ -481,5 +554,26 @@ export class PdQuestionAssessedInfoPage {
|
||||
{
|
||||
this.navCtrl.push(PdQuestionAssessedBusinessIncomePage,{'pdDetails':this.pdDetails,'income':AllexpenseData});
|
||||
}
|
||||
setNumtoWord(){
|
||||
this.PurchaseAmtInwords=this.cons.convertNumberToWords(this.purchaseCalculationForm.value.purchase_declared_by_customer)
|
||||
}
|
||||
savePurchaseCalc(value){
|
||||
value.pdc_id != ''?
|
||||
value.fk_updatedby=this.users
|
||||
:
|
||||
value.fk_updatedby=''
|
||||
value.fk_createdby=this.users
|
||||
this.qustCat.saveAssessedIncomePurchaseDeclaredByCustomer(value).subscribe(res=>{
|
||||
if(res['dataStatus'] == true){
|
||||
this.toast.pdTriggerappmessage("Record Saved Successfully");
|
||||
}
|
||||
else{
|
||||
this.toast.pdTriggerappmessage("Something Went Wrong");
|
||||
}
|
||||
},err=>{
|
||||
console.log("error",err)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -130,6 +130,34 @@
|
||||
<mat-hint align="end" style="font-size:12px" *ngIf="item.get('annual_purchase_value').value != null"> {{"₹"}} {{AnnualPurchase[i]}} Only</mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div *ngIf="item.value.purchase_type=='3'">
|
||||
<div formArrayName="child">
|
||||
<div *ngFor="let childItem of item.get('child').controls; let c=index;let l=last" [formGroupName]="c">
|
||||
<div *ngIf="childItem.value.isactive == true">
|
||||
<mat-form-field style="width:100%">
|
||||
<input matInput type="date" [max]="maxDate" formControlName="purchase_date" placeholder="Purchase Date" (dateChange)="purchaseCalculation_kutchaRecords(i,item.value)">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:100%">
|
||||
<input matInput type="number" autocomplete="off" placeholder="Bill Value" formControlName="purchase_value" (keyup)="purchaseCalculation_kutchaRecords(i,item.value)">
|
||||
</mat-form-field>
|
||||
<!-- <mat-label float-right style="color:gray;font-size:12px" *ngIf="childItem.value.purchase_value!= ''">{{"₹"}} {{purchaseAmtInWords[c]}} Only</mat-label> -->
|
||||
<ion-buttons end>
|
||||
<ion-col col-3 offset-3 *ngIf="item.value.child.length>1">
|
||||
<button ion-button clear color="optblue" (click)="removeChild(i,c,childItem.value)">
|
||||
<ion-icon name="md-trash" style="font-size: 22px"></ion-icon>
|
||||
</button>
|
||||
</ion-col>
|
||||
<ion-col col-2 offset-1 *ngIf="l">
|
||||
<button ion-button clear color="optblue" (click)="addChild(i)">
|
||||
<ion-icon name="add-circle" style="font-size: 24px"></ion-icon>
|
||||
</button>
|
||||
</ion-col>
|
||||
</ion-buttons>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<mat-form-field style="width: 100%">
|
||||
<textarea matInput autocomplete="off" formControlName="comments" placeholder="Remarks"></textarea>
|
||||
</mat-form-field>
|
||||
|
||||
@ -7,6 +7,7 @@ import { AwsServiceProvider } from '../../../providers/aws-service/aws-service';
|
||||
import { ConstantsProvider } from '../../../providers/constants/constants'
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { Subject } from 'rxjs';
|
||||
import {DatePipe} from '@angular/common'
|
||||
/**
|
||||
* Generated class for the PdQuestionAssessedPurchasePage page.
|
||||
*
|
||||
@ -20,6 +21,8 @@ import { Subject } from 'rxjs';
|
||||
templateUrl: 'pd-question-assessed-purchase.html',
|
||||
})
|
||||
export class PdQuestionAssessedPurchasePage {
|
||||
maxDate:Date=new Date
|
||||
pipe=new DatePipe("en-US");
|
||||
purchaseDetails: any;
|
||||
users: any;
|
||||
pdDetails: any;
|
||||
@ -33,11 +36,15 @@ export class PdQuestionAssessedPurchasePage {
|
||||
AnnualPurchase: any=[];
|
||||
productListData:any=[];
|
||||
UOMData: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'
|
||||
}]
|
||||
complete_status: boolean = false;
|
||||
spinner_access:boolean=false;
|
||||
|
||||
protected _onDestroy = new Subject<void>();
|
||||
purchaseAmtInWords: any=[];
|
||||
|
||||
constructor(public navCtrl: NavController, public fb:FormBuilder,public navParams: NavParams,public qustCat:QuestionCategoryProvider,public toast:ToastProvider,public aws:AwsServiceProvider,public cons:ConstantsProvider) {
|
||||
this.pdDetails = this.navParams.get('pdDetails');
|
||||
@ -265,6 +272,17 @@ export class PdQuestionAssessedPurchasePage {
|
||||
delete parVal.uomSearch
|
||||
})
|
||||
this.spinner_access=true;
|
||||
answerData.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');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
let records = {'records':answerData.purchase};
|
||||
console.log('data',records);
|
||||
@ -318,6 +336,30 @@ export class PdQuestionAssessedPurchasePage {
|
||||
if(val.annual_purchase_value != null){
|
||||
this.AnnualPurchase[index]=this.cons.convertNumberToWords(val.annual_purchase_value)
|
||||
}
|
||||
if(val.purchase_type =="3"){
|
||||
console.log(val)
|
||||
// console.log(this.salesItemForm.controls['salesCalItemwise'])
|
||||
let control: any = <FormArray>this.rawMaterialForm.controls['purchase'];
|
||||
control.controls[index].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(val.values.length >0){
|
||||
// console.log("dd",sale.items_for_dispaly);
|
||||
val.values.forEach(result=>{
|
||||
let saleDate = new Date(result.purchase_date);
|
||||
let date=saleDate.getDate()< 10 ? ("0"+(saleDate.getDate())) : saleDate.getDate()
|
||||
let month=saleDate.getMonth() < 10 ? ("0"+(saleDate.getMonth()+1)) : (saleDate.getMonth()+1)
|
||||
|
||||
// item.sales_date = saleDate.getFullYear() + '-' + ("0" + (saleDate.getMonth() + 1)).slice(-2) + '-' + ("0" + (saleDate.getDay()+1 )).slice(-2);
|
||||
console.log("sale Day",saleDate.getDay())
|
||||
result.purchase_date = saleDate.getFullYear() + '-' + month+ '-' + date;
|
||||
console.log("result",result)
|
||||
innercontrol.push(this.createDailyPurchaseWithData(result,val))
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
this.grandpurchaseTotal = this.annual.reduce((a,b)=>(+a + +b),0);
|
||||
}
|
||||
@ -351,14 +393,20 @@ export class PdQuestionAssessedPurchasePage {
|
||||
console.log('event',event)
|
||||
let control: any = <FormArray>this.rawMaterialForm.controls['purchase'];
|
||||
if(event.value=="1"){
|
||||
this.deleteAllDailyPurchase(indexVal);
|
||||
control.controls[indexVal].controls['purchase_qty'].setValidators([Validators.required]);
|
||||
control.controls[indexVal].controls['purchase_qty'].updateValueAndValidity();
|
||||
|
||||
control.controls[indexVal].controls['fk_uom_id'].setValidators([Validators.required]);
|
||||
control.controls[indexVal].controls['fk_uom_id'].updateValueAndValidity();
|
||||
|
||||
// control.controls[indexVal].controls['annual_sale_value'].setValue("");
|
||||
// control.controls[indexVal].controls['annual_sale_value'].clearValidators();
|
||||
// control.controls[indexVal].controls['annual_sale_value'].updateValueAndValidity();
|
||||
this.purchaseCalculation(indexVal,control.controls[indexVal].value);
|
||||
}
|
||||
else if(event.value=="2"){
|
||||
this.deleteAllDailyPurchase(indexVal);
|
||||
control.controls[indexVal].controls['purchase_qty'].setValue("");
|
||||
control.controls[indexVal].controls['purchase_qty'].clearValidators();
|
||||
control.controls[indexVal].controls['purchase_qty'].updateValueAndValidity();
|
||||
@ -366,8 +414,42 @@ export class PdQuestionAssessedPurchasePage {
|
||||
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['annual_sale_value'].setValue("");
|
||||
// control.controls[indexVal].controls['annual_sale_value'].clearValidators();
|
||||
// control.controls[indexVal].controls['annual_sale_value'].updateValueAndValidity();
|
||||
this.purchaseCalculation(indexVal,control.controls[indexVal].value);
|
||||
}
|
||||
else if(event.value == "3"){
|
||||
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['annual_sale_value'].setValue("");
|
||||
// control.controls[indexVal].controls['annual_sale_value'].clearValidators();
|
||||
// control.controls[indexVal].controls['annual_sale_value'].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['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['margin_per_uom'].setValue("");
|
||||
|
||||
control.controls[indexVal].addControl('child',this.fb.array([this.createDailyPurchaseChild('')]))
|
||||
|
||||
let childControl: any = <FormArray>this.rawMaterialForm.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]))
|
||||
}
|
||||
}
|
||||
|
||||
searchUOM(control:any,i:number){
|
||||
@ -399,7 +481,113 @@ export class PdQuestionAssessedPurchasePage {
|
||||
case 2 :
|
||||
this.AnnualPurchase[c] = this.cons.convertNumberToWords(e);
|
||||
break;
|
||||
case 5:
|
||||
this.purchaseAmtInWords[c]=this.cons.convertNumberToWords(e);
|
||||
default : break;
|
||||
}
|
||||
}
|
||||
|
||||
//Kutcha Records function starts
|
||||
|
||||
addDailyPurchaseChild(index)
|
||||
{
|
||||
const control=(<FormArray>this.rawMaterialForm.get('purchase')).at(index).get('child') as FormArray;
|
||||
control.push(this.createDailyPurchaseChild(''))
|
||||
}
|
||||
createDailyPurchaseChild(value){
|
||||
return this.fb.group({
|
||||
pbwc_id: [''],
|
||||
fk_purchase_id: [value],
|
||||
purchase_date: [''],
|
||||
purchase_value: ['', Validators.compose([Validators.required])],
|
||||
isactive:[true],
|
||||
})
|
||||
}
|
||||
// create daily purchase product with Data
|
||||
createDailyPurchaseWithData(values: any, parent: any) {
|
||||
console.log("dd",new Date(this.pipe.transform(values.purchase_date, 'yyyy-MM-dd')))
|
||||
return this.fb.group({
|
||||
pbwc_id: [values.pbwc_id],
|
||||
fk_purchase_id: [parent.purchase_id],
|
||||
// purchase_date: [parent.purchase_date=='' ? '' :new Date(this.pipe.transform(values.purchase_date, 'yyyy-MM-dd')), Validators.compose([Validators.required])],
|
||||
purchase_date:[values.purchase_date, Validators.compose([Validators.required])],
|
||||
purchase_value: [values.purchase_value, Validators.compose([Validators.required])],
|
||||
isactive:[true]
|
||||
})
|
||||
}
|
||||
removeChild(parentIndex,childIndex,childValue){
|
||||
let control: any = <FormArray>this.rawMaterialForm.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.rawMaterialForm.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.rawMaterialForm.controls['purchase'];
|
||||
calculatControlValues = calculatControlValues.controls[parentIndex];
|
||||
this.purchaseCalculation_kutchaRecords(parentIndex,calculatControlValues.value);
|
||||
}
|
||||
}
|
||||
deleteAllDailyPurchase(index){
|
||||
let control: any = <FormArray>this.rawMaterialForm.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.rawMaterialForm.controls['purchase'];
|
||||
if(values.purchase_type == "3"){
|
||||
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) => parseInt(sum) + parseInt(curr));
|
||||
// let months:number=12/values.child.length;
|
||||
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("");
|
||||
}
|
||||
}
|
||||
}
|
||||
addChild(parentIndex,values){
|
||||
// let control: any = <FormArray>this.rawMaterialForm.controls['purchase'];
|
||||
// console.log(control);
|
||||
// // control=control.controls[parentIndex].controls.child ;
|
||||
// control=control.controls[parentIndex].get('child') as FormArray;
|
||||
const control=(<FormArray>this.rawMaterialForm.get('purchase')).at(parentIndex).get('child') as FormArray;
|
||||
control.push(this.createDailyPurchaseChild(''));
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,11 +106,46 @@
|
||||
<mat-hint align="end" style="font-size: 12px" *ngIf="item.get('rate_per_unit').value != null">{{"₹"}} {{annualSaleAmtInwords[i]}} Only</mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<!-- Case 3 Kutcha records -->
|
||||
<div *ngSwitchCase="3">
|
||||
<mat-card-header><h2>{{item.get('sales_item').value | titlecase}}</h2></mat-card-header>
|
||||
<div formArrayName="child">
|
||||
<div *ngFor="let tenants of item['controls'].child['controls']; let child_i =index; let l=last" [formGroupName]="child_i">
|
||||
<div *ngIf="tenants.value.isactive == true">
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput type="date" [max]="maxDate" placeholder="Sales Date" (dateChange)="salesCalculation_kutchaRecords(i,item.value)" formControlName="sales_date" name="sales_date">
|
||||
<mat-error align="end" style="font-size: 12px">Sales Date is Required</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput type="number" placeholder="Bill Value" (keyup)="salesCalculation_kutchaRecords(i,item.value)" formControlName="sales_value" name="sales_value">
|
||||
<!-- <mat-hint align="end" style="font-size:12px" *ngIf="tenants.get('sales_value').value != ''">{{"₹"}} {{Sales_Value[i]}} Only</mat-hint> -->
|
||||
</mat-form-field>
|
||||
<ion-buttons>
|
||||
<ion-row>
|
||||
<ion-col col-1>
|
||||
<a (click)="deletedailyChildSaleProduct(i,child_i,tenants)">
|
||||
<ion-icon name="md-trash" color="optblue" style="font-size: 22px;"></ion-icon>
|
||||
</a>
|
||||
</ion-col>
|
||||
|
||||
</ion-row>
|
||||
</ion-buttons>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ion-buttons end>
|
||||
<ion-col offset-8 col-3 text-right>
|
||||
<a (click)="adddailyChildSaleProduct(i)">
|
||||
<ion-icon name="add-circle" color="optblue" style="font-size: 24px;"></ion-icon>
|
||||
</a>
|
||||
</ion-col>
|
||||
</ion-buttons>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div *ngIf="margin_calculation_status===true">
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput type="number" placeholder="Gross Margin %" (keyup)="salesMarginPerCalculation(i,item.value)" formControlName="margin_per" name="margin_per" >
|
||||
<input matInput type="number" placeholder="Gross Margin %" (keyup)="salesMarginPerCalculation(i,item.value);salesCalculation_kutchaRecords(i,item.value)" formControlName="margin_per" name="margin_per" >
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%" *ngIf="item.value.sales_type=='1'">
|
||||
<input matInput type="number" placeholder="Margin Per Unit" (keyup)="salesMarginAmtCalculation(i,item.value)" formControlName="margin_per_uom" name="margin_per_uom">
|
||||
|
||||
@ -7,6 +7,7 @@ import { ToastProvider } from '../../../providers/common-provider/toast';
|
||||
import {ConstantsProvider} from '../../../providers/constants/constants';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { Subject } from 'rxjs';
|
||||
import {DatePipe} from '@angular/common'
|
||||
|
||||
/**
|
||||
* Generated class for the PdQuestionAssessedSalesPage page.
|
||||
@ -21,7 +22,7 @@ import { Subject } from 'rxjs';
|
||||
templateUrl: 'pd-question-assessed-sales.html',
|
||||
})
|
||||
export class PdQuestionAssessedSalesPage {
|
||||
|
||||
pipe=new DatePipe('en-US')
|
||||
grossprofitCalc: any;
|
||||
salesData: any =[];
|
||||
annual: any=[];
|
||||
@ -37,12 +38,19 @@ export class PdQuestionAssessedSalesPage {
|
||||
marginFinalAmtInwords:any =[];
|
||||
ratePerUnitAmtInwords: any=[];
|
||||
margin_calculation_status: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'
|
||||
}]
|
||||
product_and_services: any=[];
|
||||
complete_status: boolean = false;
|
||||
UOMData:any=[]
|
||||
spinner_access:boolean=false;
|
||||
todaydate:Date=new Date
|
||||
protected _onDestroy = new Subject<void>();
|
||||
value: any;
|
||||
Sales_Value: 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.FormId = this.navParams.get('FormId');
|
||||
@ -401,9 +409,11 @@ export class PdQuestionAssessedSalesPage {
|
||||
this.marginFinalAmtInwords[inx] = this.cons.convertNumberToWords(value);
|
||||
break;
|
||||
case 4 :
|
||||
console.log("Rate",value);
|
||||
this.ratePerUnitAmtInwords[inx] = this.cons.convertNumberToWords(value);
|
||||
break;
|
||||
case 5 :
|
||||
this.Sales_Value[inx] = this.cons.convertNumberToWords(value);
|
||||
break;
|
||||
default:break;}
|
||||
}
|
||||
saveData(answerData)
|
||||
@ -414,7 +424,37 @@ export class PdQuestionAssessedSalesPage {
|
||||
delete parVal.uomSearch
|
||||
});
|
||||
this.spinner_access=true
|
||||
let records = {'records':answerData.salesCalItemwise};
|
||||
answerData.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);
|
||||
let records = {'records':answerData.salesCalItemwise};
|
||||
console.log(records);
|
||||
this.qustCat.saveassessedForms('saveAssessedIncomeSalesCalculatedByItemwise',records).subscribe(res=>
|
||||
{
|
||||
@ -463,7 +503,34 @@ else{
|
||||
if(sale.margin_final_value != null){
|
||||
this.marginFinalAmtInwords[index]=this.cons.convertNumberToWords(sale.margin_final_value)
|
||||
}
|
||||
this.changeOptions(index,sale.sales_type)
|
||||
if(sale.Sales_Value != null && sale.Sales_Value != ''){
|
||||
this.marginFinalAmtInwords[index]=this.cons.convertNumberToWords(sale.margin_final_value)
|
||||
}
|
||||
// this.changeOptions(index,sale.sales_type)
|
||||
if(sale.sales_type =="3"){
|
||||
console.log(sale)
|
||||
// console.log(this.salesItemForm.controls['salesCalItemwise'])
|
||||
let control: any = <FormArray>this.assessedForm.controls['salesCalItemwise'];
|
||||
control.controls[index].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(sale.values.length >0){
|
||||
// console.log("dd",sale.items_for_dispaly);
|
||||
sale.values.forEach(result=>{
|
||||
let saleDate = new Date(result.sales_date);
|
||||
let date=saleDate.getDate()< 10 ? ("0"+(saleDate.getDate())) : saleDate.getDate()
|
||||
let month=saleDate.getMonth() < 10 ? ("0"+(saleDate.getMonth()+1)) : (saleDate.getMonth()+1)
|
||||
|
||||
// item.sales_date = saleDate.getFullYear() + '-' + ("0" + (saleDate.getMonth() + 1)).slice(-2) + '-' + ("0" + (saleDate.getDay()+1 )).slice(-2);
|
||||
console.log("sale Day",saleDate.getDay())
|
||||
result.sales_date = saleDate.getFullYear() + '-' + month+ '-' + date;
|
||||
// console.log("result",result)
|
||||
innercontrol.push(this.dailySalesChildWithData(result,sale.sci_id,sale.sales_type))
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
// this.assessedForm.controls['salesCalItemwise'].setValue(salesData);
|
||||
// console.log(control);
|
||||
@ -473,6 +540,7 @@ else{
|
||||
console.log("ai")
|
||||
let control: any = <FormArray>this.assessedForm.controls['salesCalItemwise'];
|
||||
if(event.value=="1"){
|
||||
this.deleteAllDailySales(indexVal)
|
||||
control.controls[indexVal].controls['fk_frequency_id'].setValue("");
|
||||
control.controls[indexVal].controls['fk_frequency_id'].clearValidators();
|
||||
control.controls[indexVal].controls['fk_frequency_id'].updateValueAndValidity();
|
||||
@ -493,6 +561,7 @@ else{
|
||||
this.salesCalculation(indexVal,control.controls[indexVal].value);
|
||||
}
|
||||
else if(event.value=="2"){
|
||||
this.deleteAllDailySales(indexVal)
|
||||
control.controls[indexVal].controls['sales_qty'].setValue("");
|
||||
control.controls[indexVal].controls['sales_qty'].clearValidators();
|
||||
control.controls[indexVal].controls['sales_qty'].updateValueAndValidity();
|
||||
@ -505,6 +574,36 @@ else{
|
||||
|
||||
this.salesCalculation(indexVal,control.controls[indexVal].value);
|
||||
}
|
||||
else if(event.value == "3"){
|
||||
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['annual_sale_value'].setValue("");
|
||||
control.controls[indexVal].controls['annual_sale_value'].clearValidators();
|
||||
control.controls[indexVal].controls['annual_sale_value'].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("");
|
||||
|
||||
control.controls[indexVal].addControl('child',this.fb.array([this.createdailyChildSaleProduct()]))
|
||||
|
||||
let childControl: any = <FormArray>this.assessedForm.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]))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -553,5 +652,119 @@ else{
|
||||
this.UOMData=this.UOM.filter(res => res.name.toLowerCase().indexOf(searchVal) > -1)
|
||||
})
|
||||
}
|
||||
|
||||
// For Kutcha Records
|
||||
|
||||
deletedailyChildSaleProduct(saleIndex, saleChildIndex,childVal) {
|
||||
let control = <FormArray> this.assessedForm.controls['salesCalItemwise'];
|
||||
control=control.controls[saleIndex].get('child') as FormArray
|
||||
if(childVal == '' || childVal == null){
|
||||
control.removeAt(saleChildIndex)
|
||||
}
|
||||
else{
|
||||
console.log("control",control.controls[saleChildIndex])
|
||||
control.controls[saleChildIndex].get('isactive').setValue(false);
|
||||
control.controls[saleChildIndex].get('sales_date').clearValidators()
|
||||
control.controls[saleChildIndex].get('sales_date').updateValueAndValidity()
|
||||
}
|
||||
|
||||
// this.tempdate = [];
|
||||
// const control = (<FormArray>this.salesDailyForm.controls['sales_product']).at(saleIndex).get('child') as FormArray;
|
||||
// if(control.length==1)
|
||||
// {
|
||||
// control.removeAt(saleChildIndex);
|
||||
// this.adddailyChildSaleProduct(saleIndex);
|
||||
// }else{
|
||||
// control.removeAt(saleChildIndex);
|
||||
// }
|
||||
}
|
||||
|
||||
deleteAllDailySales(index){
|
||||
let control: any = <FormArray>this.assessedForm.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();
|
||||
}
|
||||
}
|
||||
adddailyChildSaleProduct(index) {
|
||||
// if(this.salesDailyForm.valid){
|
||||
const control = (<FormArray>this.assessedForm.get('salesCalItemwise')).at(index).get('child') as FormArray;
|
||||
|
||||
control.push(this.createdailyChildSaleProduct());
|
||||
// }
|
||||
}
|
||||
createdailyChildSaleProduct() {
|
||||
return this.fb.group({
|
||||
simc_id: [null],
|
||||
fk_sci_id: [null],
|
||||
sales_date: [null, Validators.compose([Validators.required])],
|
||||
sales_value: [null],
|
||||
fk_frequency_id:[null],
|
||||
frequency_value:[null],
|
||||
isactive: [true],
|
||||
})
|
||||
}
|
||||
dailySalesChildWithData(data, fk_id,salesType) {
|
||||
|
||||
console.log("Sales type",salesType)
|
||||
return this.fb.group(
|
||||
{
|
||||
simc_id: [data.simc_id],
|
||||
fk_sci_id: [fk_id],
|
||||
// sales_date: [data.sales_date, Validators.compose([Validators.required])],
|
||||
sales_date:[data.sales_date,Validators.compose([Validators.required])],
|
||||
// sales_date: [new Date(this.pipe.transform(data.sales_date, 'dd-MM-yyyy')), Validators.compose([Validators.required])],
|
||||
sales_value: [data.sales_value,Validators.compose([Validators.required])],
|
||||
// fk_frequency_id:[data.fk_frequency_id],
|
||||
// frequency_value:[data.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.assessedForm.controls['salesCalItemwise'];
|
||||
if(this.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('');
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -356,8 +356,49 @@
|
||||
</mat-card-content>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div> <br/>
|
||||
<div *ngIf="financialForm.value.is_financial_customer == 'no' && financialForm.controls['kuccha_records_shown']">
|
||||
<div>
|
||||
<mat-radio-group formControlName="kuccha_records_shown" (change)="kucchaChangeFun()">
|
||||
<mat-label>Were the Kuccha records shown to the PD officer</mat-label><br/>
|
||||
<mat-radio-button value ="yes">Yes</mat-radio-button>
|
||||
<mat-radio-button value ="no">No</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
</div><br/>
|
||||
|
||||
<div>
|
||||
<mat-radio-group formControlName="kuccha_bill_allowed" *ngIf="financialForm.value.kuccha_records_shown == 'yes'">
|
||||
<mat-label>Photograph of Kuchha bills allowed</mat-label><br/>
|
||||
<mat-radio-button value ="yes">Yes</mat-radio-button>
|
||||
<mat-radio-button value ="no">No</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
<!-- <button *ngIf="financialForm.value.kuccha_bill_allowed == 'yes'" ion-button slot="end" float-right clear (click)="capture()"><ion-icon style="color: orangered" name="md-camera"></ion-icon></button> -->
|
||||
<button *ngIf="financialForm.value.kuccha_bill_allowed == 'yes'" mini ion-fab color="optblue" float-right slot="end" (click)="capture()"><ion-icon name="md-camera" style="font-size: 22px"></ion-icon></button>
|
||||
</div><br/>
|
||||
|
||||
<div>
|
||||
<mat-radio-group formControlName="customer_declared_turnover">
|
||||
<mat-label>Does the Number of Kuccha Bills and Values therein, justify the customer declared turnover?</mat-label><br/>
|
||||
<mat-radio-button value ="yes">Yes</mat-radio-button>
|
||||
<mat-radio-button value ="no">No</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
</div><br/>
|
||||
</div>
|
||||
</mat-card>
|
||||
<mat-card *ngIf="financialForm.controls['tot_business_FY']">
|
||||
<div >
|
||||
<mat-form-field>
|
||||
<input matInput class="large" type="number" placeholder="Approximate Total Business / Sales Done for Current FY as on date" (keyup)="inWords($event.target.value,'',14)" formControlName="tot_business_FY">
|
||||
<mat-hint align="end" style="font-size: 12px;color:grey" *ngIf="financialForm.value.tot_business_FY != ''">{{"₹"}}{{tot_business_FY_inWords}}</mat-hint>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-label>Remarks</mat-label>
|
||||
<input matInput type="text" placeholder="Specific remarks on the business done" formControlName="remarks_tot_business_FY">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput class="large" type="text" placeholder="Orders in Hand to be executed in Current FY " formControlName="orders_hand_FY">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</mat-card>
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
|
||||
@ -88,4 +88,16 @@ page-pd-question-financial-info {
|
||||
.element:-o-input-placeholder {
|
||||
font-weight: bold;
|
||||
}
|
||||
::ng-deep .mat-radio-button.mat-accent .mat-radio-ripple .mat-ripple-element {
|
||||
opacity: 0.5 !important; /*click effect color change*/
|
||||
background-color: #E00201 !important;
|
||||
}
|
||||
|
||||
::ng-deep .mat-radio-button.mat-accent .mat-radio-inner-circle {
|
||||
background-color: rgb(243, 38, 38)!important; /*inner circle color change*/
|
||||
}
|
||||
|
||||
::ng-deep.mat-radio-button.mat-accent.mat-radio-checked .mat-radio-outer-circle {
|
||||
border-color: rgb(247, 76, 76)!important; /*outer ring color change*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,6 +67,7 @@ export class PdQuestionFinancialInfoPage {
|
||||
tab: string='0';
|
||||
complete_status: boolean = false;
|
||||
spinner_access:boolean=false;
|
||||
tot_business_FY_inWords: string;
|
||||
|
||||
constructor(public navCtrl: NavController, public navParams: NavParams,public aws:AwsServiceProvider,
|
||||
public toast:ToastProvider, public qustCat:QuestionCategoryProvider,
|
||||
@ -85,6 +86,17 @@ export class PdQuestionFinancialInfoPage {
|
||||
this.lender_short_name = this.pdDetails.lender_short_name;
|
||||
this.product_abbr = this.pdDetails.product_abbr;
|
||||
this.initFinancialForm()
|
||||
|
||||
if(this.lender_short_name == "IIB"){
|
||||
this.financialForm.addControl('tot_business_FY',new FormControl())
|
||||
this.financialForm.addControl('remarks_tot_business_FY',new FormControl())
|
||||
this.financialForm.addControl('orders_hand_FY',new FormControl())
|
||||
}
|
||||
if(this.CustSegAbbr == 'DI'){
|
||||
this.financialForm.addControl('kuccha_records_shown',new FormControl())
|
||||
this.financialForm.addControl('kuccha_bill_allowed',new FormControl())
|
||||
this.financialForm.addControl('customer_declared_turnover',new FormControl())
|
||||
}
|
||||
this.qustCat.getTypeofActivityForSuppliedInfoForm(this.pdDetails.pd_id, this.company_id).subscribe(data => {
|
||||
if (data.dataStatus) {
|
||||
if(data.records.type_of_activity.length == 1){
|
||||
@ -593,6 +605,17 @@ submitDetails(){
|
||||
|
||||
retrieveData.select_working_capital_facilities_availed = check_exist_av;
|
||||
}
|
||||
retrieveData.hasOwnProperty('latest_year_financials_as_per_applicant_met') ? delete retrieveData.latest_year_financials_as_per_applicant_met : ''
|
||||
if(this.CustSegAbbr == "DI"){
|
||||
retrieveData.hasOwnProperty('kuccha_records_shown') ? retrieveData.kuccha_records_shown : retrieveData.kuccha_records_shown=''
|
||||
retrieveData.hasOwnProperty('kuccha_bill_allowed') ? retrieveData.kuccha_bill_allowed : retrieveData.kuccha_bill_allowed=''
|
||||
retrieveData.hasOwnProperty('customer_declared_turnover') ? retrieveData.customer_declared_turnover : retrieveData.customer_declared_turnover=''
|
||||
}
|
||||
if(this.lender_short_name == "IIB"){
|
||||
retrieveData.hasOwnProperty('tot_business_FY') ? retrieveData.tot_business_FY != '' && retrieveData.tot_business_FY != null ? this.inWords(retrieveData.tot_business_FY,0,14) : retrieveData.tot_business_FY : retrieveData.tot_business_FY=''
|
||||
retrieveData.hasOwnProperty('remarks_tot_business_FY') ? retrieveData.remarks_tot_business_FY : retrieveData.remarks_tot_business_FY=''
|
||||
retrieveData.hasOwnProperty('orders_hand_FY') ? retrieveData.orders_hand_FY : retrieveData.orders_hand_FY=''
|
||||
}
|
||||
|
||||
this.financialForm.setValue(retrieveData)
|
||||
|
||||
@ -1542,6 +1565,9 @@ calculateLossAmount( i, details){
|
||||
case 13 :
|
||||
this.AV_CCAnnualSalesAmtInwords[i] = this.cons.convertNumberToWords(e.target.value);
|
||||
break;
|
||||
case 14 :
|
||||
this.tot_business_FY_inWords = this.cons.convertNumberToWords(e);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1643,5 +1669,10 @@ calculateLossAmount( i, details){
|
||||
})
|
||||
|
||||
}
|
||||
kucchaChangeFun(){
|
||||
if(this.financialForm.value.kuccha_records_shown == 'no'){
|
||||
this.financialForm.controls.kuccha_bill_allowed.setValue('')
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -441,7 +441,7 @@
|
||||
<mat-option value="not applicable">Stock not required to be maintained</mat-option> -->
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" style="width: 100%" *ngIf="this.stockForm.controls.is_sufficiant_finished_and_traded_goods.value == 'no'">
|
||||
<mat-form-field appearance="outline" style="width: 100%" *ngIf="stockForm.controls.is_sufficiant_finished_and_traded_goods.value == 'no'">
|
||||
<mat-label> <i>Please comment on the stock level observed?</i> </mat-label>
|
||||
<textarea matInput autocomplete="off" placeholder="Please comment on the stock level observed" formControlName="finished_and_traded_goods_remarks"></textarea>
|
||||
</mat-form-field>
|
||||
@ -534,7 +534,7 @@
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" style="width: 100%" *ngIf="this.stockForms.controls.is_sufficiant_service_goods.value == 'no'">
|
||||
<mat-form-field appearance="outline" style="width: 100%" *ngIf="stockForm.controls.is_sufficiant_service_goods.value == 'no'">
|
||||
<mat-label> <i>Please comment on the stock level observed?</i> </mat-label>
|
||||
<textarea matInput autocomplete="off" placeholder="Please comment on the stock level observed"
|
||||
formControlName="service_goods_remarks"></textarea>
|
||||
|
||||
@ -272,7 +272,7 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
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);
|
||||
}
|
||||
@ -504,13 +504,13 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
let arr = val
|
||||
// let arr = val.filter(data => data.type_of_activity_id == 4);
|
||||
if (arr > 0){
|
||||
console.log('IF');
|
||||
// console.log('IF');
|
||||
this.servicingForm = true;
|
||||
return this.fb.group({
|
||||
service_provider: this.fb.array([])
|
||||
});
|
||||
} else {
|
||||
console.log('Else');
|
||||
// console.log('Else');
|
||||
return this.fb.group({
|
||||
service_provider: this.fb.array([])
|
||||
});
|
||||
@ -757,6 +757,7 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
|
||||
|
||||
|
||||
initServicingDetails(datas) {
|
||||
console.log("initservicing",datas);
|
||||
const service = <FormArray>this.stockForm.controls['servicing_details']['controls'][0].controls['service_provider'];
|
||||
if (datas === null) {
|
||||
|
||||
|
||||
@ -347,11 +347,18 @@
|
||||
<mat-card-content>
|
||||
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<mat-form-field style="width: 100%">
|
||||
<mat-select placeholder="Service Provider Name" formControlName="service_provider_name" (change)="setValidationForRemarks($event.value,items,i,1)">
|
||||
<!-- <mat-select placeholder="Service Provider Name" formControlName="service_provider_name" (change)="setValidationForRemarks($event.value,items,i,1)">
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option *ngFor="let msp of m_serviceProvider[0]" [value]="msp.name">{{
|
||||
msp.name }}</mat-option>
|
||||
</mat-select>
|
||||
</mat-select> -->
|
||||
<input matInput placeholder="Service Name" formControlName="service_provider_name"
|
||||
[matAutocomplete]="serviceName_auto" (change)="setValidationForRemarks($event.value,items,i,1)">
|
||||
<mat-autocomplete #serviceName_auto="matAutocomplete">
|
||||
<mat-option *ngFor="let msp of m_serviceProvider[0]" [value]="msp.name">
|
||||
{{msp.name }}
|
||||
</mat-option>
|
||||
</mat-autocomplete>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Supplier Name" formControlName="service_provider_supplier_name">
|
||||
|
||||
78
src/pages/queries-docs/queries-docs.html
Normal file
78
src/pages/queries-docs/queries-docs.html
Normal file
@ -0,0 +1,78 @@
|
||||
<!--
|
||||
Generated template for the QueriesDocsPage page.
|
||||
|
||||
See http://ionicframework.com/docs/components/#navigation for more info on
|
||||
Ionic pages and navigation.
|
||||
-->
|
||||
<ion-header>
|
||||
|
||||
<ion-navbar color="optblue">
|
||||
<ion-title>{{pageTitle.form_name}}</ion-title>
|
||||
<ion-buttons end>
|
||||
<button *ngIf="!complete_status && !spinner_access" style="padding: 0px;color:white;font-size:20px;" ion-button clear (click)="saveForm()"><ion-icon style="font-size: 32px;" name="fn-save"></ion-icon></button>
|
||||
<ion-spinner color="light" name="circles" *ngIf="spinner_access"></ion-spinner>
|
||||
</ion-buttons>
|
||||
</ion-navbar>
|
||||
|
||||
</ion-header>
|
||||
|
||||
|
||||
<ion-content padding>
|
||||
<!-- <components-queries-docs ></components-queries-docs> -->
|
||||
|
||||
<div [formGroup]="docsCollectedForm">
|
||||
<mat-card *ngIf="queries_docs.length !=0">
|
||||
<mat-card-header>
|
||||
<mat-card-title>
|
||||
<h5>Credit Manager’s Specific Queries</h5>
|
||||
</mat-card-title>
|
||||
</mat-card-header>
|
||||
<mat-card-content formArrayName="addtional_requirements">
|
||||
<div *ngFor="let qu of docsCollectedForm.controls.addtional_requirements['controls'];let i=index;" [formGroupName]="i">
|
||||
<div *ngFor="let item of queries_docs">
|
||||
<mat-form-field style="width:100%">
|
||||
<input matInput type="text" [formControlName]="item.add_req_id" [placeholder]="item.add_requirement">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<mat-card *ngIf="docs_array_value.length !=0 ">
|
||||
<mat-card-header>
|
||||
<mat-card-title>
|
||||
<h5>Documents to be collected</h5>
|
||||
</mat-card-title>
|
||||
</mat-card-header>
|
||||
<mat-card-content formArrayName="docs_to_be_sighted">
|
||||
<div *ngFor="let item of docsCollectedForm.controls.docs_to_be_sighted['controls'];let i=index" [formGroupName]="i">
|
||||
|
||||
<ion-row>
|
||||
<ion-col col-9.5>
|
||||
<div >
|
||||
<mat-label>{{item.value.placeholder}}</mat-label><br/>
|
||||
<mat-radio-group [formControlName]="item.value.control_name" (change)="docs_change_fun(i,$event.value)"><br/>
|
||||
<mat-radio-button value="yes">Yes</mat-radio-button>
|
||||
<mat-radio-button value="no">No</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
</div><br/>
|
||||
</ion-col>
|
||||
<ion-col col-4>
|
||||
<div style="width: 100%">
|
||||
<ion-buttons end>
|
||||
<button style="color:#E00201" *ngIf="camera_btn[i] == true" ion-button slot="end" clear small float-right (click)="capture(i,item)"><ion-icon style="font-size:30px;float:right;" name="md-camera"></ion-icon></button>
|
||||
</ion-buttons>
|
||||
</div>
|
||||
<div *ngIf="item.controls['img'] && item.value.img != ''">
|
||||
<img [src]="item.value.img" imageViewer style="width:45px; height: 45px;float:right">
|
||||
</div>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<!-- <button *ngIf="camera_btn[i] == true" ion-button slot="end" small float-right (click)="capture(i,item)">Capture<ion-icon name="md-camera"></ion-icon></button> -->
|
||||
<mat-form-field *ngIf="item.controls['reason']" style="width: 100%">
|
||||
<input matInput type="text" formControlName="reason" placeholder="Enter the Reason">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
||||
</ion-content>
|
||||
13
src/pages/queries-docs/queries-docs.module.ts
Normal file
13
src/pages/queries-docs/queries-docs.module.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { IonicPageModule } from 'ionic-angular';
|
||||
import { QueriesDocsPage } from './queries-docs';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
QueriesDocsPage,
|
||||
],
|
||||
imports: [
|
||||
IonicPageModule.forChild(QueriesDocsPage),
|
||||
],
|
||||
})
|
||||
export class QueriesDocsPageModule {}
|
||||
14
src/pages/queries-docs/queries-docs.scss
Normal file
14
src/pages/queries-docs/queries-docs.scss
Normal file
@ -0,0 +1,14 @@
|
||||
page-queries-docs {
|
||||
|
||||
.mat-card{
|
||||
margin-bottom: 15px;
|
||||
border-radius: 10px !important;
|
||||
box-shadow: 0 16px 38px -12px rgba(0, 0, 0, 0.56), 0 4px 25px 0 rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.2) !important;
|
||||
}
|
||||
.mat-card-content{
|
||||
margin-bottom: 0px !important;
|
||||
}
|
||||
.scroll-content{
|
||||
background-color: #eee;
|
||||
}
|
||||
}
|
||||
240
src/pages/queries-docs/queries-docs.ts
Normal file
240
src/pages/queries-docs/queries-docs.ts
Normal file
@ -0,0 +1,240 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { IonicPage, NavController, NavParams } from 'ionic-angular';
|
||||
import { QuestionCategoryProvider } from '../../providers/question-category/question-category';
|
||||
import { PdtriggerProvider } from '../../providers/pdtrigger/pdtrigger';
|
||||
import { FormGroup, FormControl, Validators, FormBuilder, FormArray } from '@angular/forms';
|
||||
import { CameraProvider } from '../../providers/common-provider/camera';
|
||||
import { AwsServiceProvider } from '../../providers/aws-service/aws-service';
|
||||
import { ConstantsProvider } from '../../providers/constants/constants';
|
||||
import { ToastProvider } from '../../providers/common-provider/toast';
|
||||
import { LoadingProvider } from '../../providers/common-provider/loading';
|
||||
|
||||
/**
|
||||
* Generated class for the QueriesDocsPage page.
|
||||
*
|
||||
* See https://ionicframework.com/docs/components/#navigation for more info on
|
||||
* Ionic pages and navigation.
|
||||
*/
|
||||
|
||||
@IonicPage()
|
||||
@Component({
|
||||
selector: 'page-queries-docs',
|
||||
templateUrl: 'queries-docs.html',
|
||||
})
|
||||
export class QueriesDocsPage {
|
||||
pageTitle:string
|
||||
pdDetails:any=[]
|
||||
queries_docs:any=[]
|
||||
docsCollectedForm:FormGroup
|
||||
docs_array_value: any=[];
|
||||
camera_btn:any=[];
|
||||
users: any;
|
||||
complete_status:boolean=false;
|
||||
spinner_access:boolean=false;
|
||||
|
||||
constructor(public navCtrl: NavController, public navParams: NavParams,private pdTriggerService:PdtriggerProvider,
|
||||
private fb:FormBuilder,private qustCat:QuestionCategoryProvider,private cameraProvider:CameraProvider,
|
||||
private awsService:AwsServiceProvider,private constantProvider:ConstantsProvider,private toastProvider:ToastProvider,private loader:LoadingProvider) {
|
||||
this.pdDetails=this.navParams.get('pdDetails')
|
||||
this.pageTitle=this.navParams.get('FormId');
|
||||
this.users=this.awsService.getlocale();
|
||||
this.docsCollectedForm=this.fb.group({
|
||||
parent_pdid:[this.pdDetails.parent_pd_id],
|
||||
formid:["24"],
|
||||
pdid:[this.pdDetails.pd_id],
|
||||
fk_createdby:[this.users],
|
||||
link:[''],
|
||||
addtional_requirements:this.fb.array([this.createview()])
|
||||
})
|
||||
}
|
||||
createview(){
|
||||
return this.fb.group({
|
||||
name:['']
|
||||
})
|
||||
}
|
||||
ionViewDidLoad() {
|
||||
console.log('ionViewDidLoad QueriesDocsPage');
|
||||
this.getFullPD();
|
||||
|
||||
}
|
||||
|
||||
getFullPD(){
|
||||
let records = {'parent_pdid': this.pdDetails.parent_pd_id,'pdid':this.pdDetails.pd_id,'random_string':this.pdDetails.random_string};
|
||||
this.pdTriggerService.getFullPDdetails(records).subscribe(res=>{
|
||||
if(res['dataStatus']){
|
||||
this.queries_docs=res['records'].pd_additional_requirements
|
||||
|
||||
// if(this.queries_docs.length != 0){
|
||||
// this.queries_docs.forEach(res=>{
|
||||
|
||||
// // this.docsCollectedForm.addControl(res.add_req_id,new FormControl);
|
||||
// console.log( this.docsCollectedForm)
|
||||
// let control:any=<FormArray>this.docsCollectedForm.controls['addtional_requirements']
|
||||
// control.controls[0].addControl(res.add_req_id,new FormControl(''))
|
||||
// console.log( this.docsCollectedForm.controls.addtional_requirements)
|
||||
// })
|
||||
// }
|
||||
|
||||
this.docs_array_value=res['records'].docs_to_be_collected
|
||||
// if(this.docs_array_value.length !=0){
|
||||
// this.docsCollectedForm.addControl('docs_to_be_sighted', this.fb.array([]))
|
||||
// let control:any=<FormArray>this.docsCollectedForm.controls['docs_to_be_sighted']
|
||||
// this.docs_array_value.forEach((data,index)=>{
|
||||
// control.push(this.createDocsArray(data))
|
||||
// control.controls[index].addControl(data.pd_doc_to_be_collect_id,new FormControl(''))
|
||||
// })
|
||||
// }
|
||||
this.initControls();
|
||||
this.getFormData();
|
||||
}
|
||||
console.log(this.queries_docs)
|
||||
})
|
||||
}
|
||||
getFormData(){
|
||||
let records = { 'parent_pdid': this.pdDetails.parent_pd_id, 'pd_id': this.pdDetails.pd_id, 'pd_form_id': "24" };
|
||||
this.qustCat.retiverForm(records).subscribe(result=>{
|
||||
if(result['dataStatus']){
|
||||
this.loader.dataLoader()
|
||||
|
||||
let retrieved_data=result['records'];
|
||||
retrieved_data.parent_pdid=this.pdDetails.parent_pd_id
|
||||
retrieved_data.pdid=this.pdDetails.pd_id
|
||||
retrieved_data.formid="24"
|
||||
retrieved_data.fk_createdby=this.users
|
||||
retrieved_data.addtional_requirements[0].name=''
|
||||
retrieved_data.hasOwnProperty('link') ? retrieved_data.link : retrieved_data.link=''
|
||||
// let geoCoords
|
||||
// if(retrieved_data.link == ''){
|
||||
// this.constantProvider.getGeoTag().then(geoCoordinates=>{
|
||||
// if(geoCoordinates){
|
||||
// geoCoords=geoCoordinates
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// else{
|
||||
// geoCoords=retrieved_data.link
|
||||
// }
|
||||
|
||||
retrieved_data.docs_to_be_sighted.forEach((doc_value,index)=>{
|
||||
if(doc_value.hasOwnProperty('img')){
|
||||
this.docs_change_fun(index,'yes')
|
||||
}
|
||||
else if(doc_value.hasOwnProperty('reason')){
|
||||
this.docs_change_fun(index,'no');
|
||||
}
|
||||
// let data=doc_value.control_name
|
||||
// data=parseInt(data)
|
||||
// console.log("data",data);
|
||||
// data=doc_value.data
|
||||
// this.docs_change_fun(index,data)
|
||||
})
|
||||
console.log("form123",this.docsCollectedForm.value);
|
||||
this.docsCollectedForm.setValue(retrieved_data)
|
||||
this.loader.dismissLoader()
|
||||
}
|
||||
},err=>{
|
||||
this.loader.dismissLoader();
|
||||
})
|
||||
}
|
||||
initControls(){
|
||||
if(this.queries_docs.length != 0){
|
||||
this.queries_docs.forEach(res=>{
|
||||
|
||||
// this.docsCollectedForm.addControl(res.add_req_id,new FormControl);
|
||||
console.log( this.docsCollectedForm)
|
||||
let control:any=<FormArray>this.docsCollectedForm.controls['addtional_requirements']
|
||||
control.controls[0].addControl(res.add_req_id,new FormControl('',Validators.required))
|
||||
console.log( this.docsCollectedForm.controls.addtional_requirements)
|
||||
})
|
||||
}
|
||||
|
||||
// this.docs_array_value=res['records'].docs_to_be_collected
|
||||
if(this.docs_array_value.length !=0){
|
||||
this.docsCollectedForm.addControl('docs_to_be_sighted', this.fb.array([]))
|
||||
let control:any=<FormArray>this.docsCollectedForm.controls['docs_to_be_sighted']
|
||||
this.docs_array_value.forEach((data,index)=>{
|
||||
control.push(this.createDocsArray(data))
|
||||
control.controls[index].addControl(data.pd_doc_to_be_collect_id,new FormControl('',Validators.required))
|
||||
})
|
||||
}
|
||||
}
|
||||
createDocsArray(data){
|
||||
console.log(data);
|
||||
return this.fb.group({
|
||||
control_name:[data.pd_doc_to_be_collect_id],
|
||||
placeholder:[data.doc_name],
|
||||
|
||||
})
|
||||
}
|
||||
capture(index,item){
|
||||
console.log(index,item)
|
||||
// let control:any=<FormArray>this.docsCollectedForm.controls['docs_to_be_sighted']
|
||||
|
||||
this.cameraProvider.getpicture().then(res=>{
|
||||
if(res != 'error'){
|
||||
item.controls['img'].setValue(res);
|
||||
item.controls['is_new'].setValue(1);
|
||||
}
|
||||
else{
|
||||
console.log("Cannot take picture right now");
|
||||
}
|
||||
},err=>{
|
||||
console.log("Error",err)
|
||||
})
|
||||
}
|
||||
saveForm(){
|
||||
console.log(this.docsCollectedForm.value);
|
||||
// this.docsCollectedForm.value.docs_to_be_sighted.forEach(value=>{
|
||||
// if(value.control_name){
|
||||
// delete value.control_name
|
||||
// }
|
||||
// if(value.placeholder){
|
||||
// delete value.placeholder
|
||||
// }
|
||||
// })
|
||||
if(this.docsCollectedForm.invalid){
|
||||
this.toastProvider.pdTriggerappmessage("Please Fill all the Fields and capture the image if required");
|
||||
return
|
||||
}
|
||||
this.spinner_access=true
|
||||
this.docsCollectedForm.value.addtional_requirements[0].hasOwnProperty('name') ? delete this.docsCollectedForm.value.addtional_requirements[0].name : ''
|
||||
console.log(JSON.stringify(this.docsCollectedForm.value));
|
||||
this.constantProvider.getGeoTag().then(geoCoords=>{
|
||||
if(this.docsCollectedForm.value.link == ""){
|
||||
this.docsCollectedForm.value.link = geoCoords
|
||||
}
|
||||
this.qustCat.saveForm(this.docsCollectedForm.value).subscribe(res=>{
|
||||
if(res['dataStatus']){
|
||||
this.toastProvider.pdTriggerappmessage("Record Saved Successfully..")
|
||||
setTimeout(()=>{
|
||||
this.navCtrl.pop();
|
||||
this.spinner_access=false
|
||||
},2000)
|
||||
}
|
||||
else{
|
||||
this.spinner_access=false
|
||||
}
|
||||
},err=>{this.spinner_access=false; console.log("Error",err)})
|
||||
})
|
||||
}
|
||||
|
||||
docs_change_fun(index,value){
|
||||
console.log(index,value);
|
||||
let control:any=<FormArray>this.docsCollectedForm.controls['docs_to_be_sighted']
|
||||
if(value == 'yes'){
|
||||
this.camera_btn[index]=true
|
||||
control.controls[index].removeControl('reason')
|
||||
control.controls[index].addControl('img',new FormControl('',Validators.required))
|
||||
control.controls[index].addControl('is_new',new FormControl('',Validators.required))
|
||||
}
|
||||
else if(value == 'no'){
|
||||
this.camera_btn[index]=false
|
||||
control.controls[index].removeControl('img')
|
||||
control.controls[index].removeControl('is_new')
|
||||
control.controls[index].addControl('reason',new FormControl('',Validators.required));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -28,6 +28,7 @@ public commonimage = "http://pdgenie.com/logo/avatar.jpg";
|
||||
let localapiurl = 'http://192.168.0.6:9999/AWSEC2/sparqapi/api/';
|
||||
let sparqprod= 'https://pdgenie.com/sparqprod/'
|
||||
let demo='https://demo.pdgenie.com/sparqtest/api/'
|
||||
let test='https://demo.pdgenie.com/sparqapi/api/'
|
||||
return demo;
|
||||
}
|
||||
|
||||
|
||||
@ -143,5 +143,9 @@ getCustomersDetails(): Observable<any> {
|
||||
return this.http.get<any>(this.apiurl + 'getListOfCustomerSegments')
|
||||
|
||||
}
|
||||
//AI Purchase Calculation
|
||||
saveAssessedIncomePurchaseDeclaredByCustomer(data){
|
||||
return this.http.post(this.apiurl+'saveAssessedIncomePurchaseDeclaredByCustomer',{records:data})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user