fixes : ps

This commit is contained in:
venbatechnologies@gmail.com 2019-03-30 19:27:11 +05:30
parent 460ae97a86
commit a418fb42c0
15 changed files with 1807 additions and 1711 deletions

File diff suppressed because one or more lines are too long

2042
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -102,4 +102,4 @@
"android"
]
}
}
}

View File

@ -27,7 +27,6 @@
<mat-select placeholder="Financial Statements Available ?" formControlName="is_financial_statements" (selectionChange)="selectedStatement($event.value)">
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
</mat-form-field>
<div *ngIf="isDisplay">
@ -51,11 +50,12 @@
<div *ngIf="i>0">
<!-- <mat-label>Sale Variation from Previous Year in %</mat-label>&nbsp;&nbsp;- -->
<mat-form-field>
<input matInput placeholder="Sale Variation from Previous Year in %" formControlName="financial_annualsales_variation" (keypress)="keyPress($event)" readonly>
<input matInput placeholder="Sale Variation from Previous Year in %" formControlName="financial_annualsales_variation" [ngClass]="details.get('financial_annualsales_variation').value > 0 ? 'greenhighlight' : 'highlight'"
(keypress)="keyPress($event)" readonly>
</mat-form-field>
<p class="info" *ngIf="details.get('financial_annualsales_variation').value != '' " >
<p class="info" *ngIf="details.get('financial_annualsales_variation').value != '' " >
<span *ngIf="details.get('financial_annualsales_variation').value == 0">
No difference in Sales in FY <i> {{details.get('financial_year').value}} </i> over Sales in FY <i> {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} </i>
No difference in Sales in FY <i> {{details.get('financial_year').value}} </i> over Sales in FY <i> {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} </i>
</span>
<span *ngIf="details.get('financial_annualsales_variation').value > 0" class="greenhighlight">
Increase in Sales in FY <i> {{details.get('financial_year').value}} </i> over Sales in FY <i> {{financialForm.controls.date_per_financial['controls'][i-1].get('financial_year').value}} </i> <b> {{details.get('financial_annualsales_variation').value}} % </b>

View File

@ -356,185 +356,202 @@ submitDetails(){
})
}
/**
/**
* New Calculation for Finanical Statement
**/
calculationForFinanicalStatement(){
let parentArray = <FormArray>this.financialForm.controls['date_per_financial'];
// let prev_annual_sale : any = '';
// let prev_profit_margin : any = '';
// let prev_loss_margin : any = '';
// let prev_profit_amt : any = '';
// let prev_loss_amt : any = '';
// let profit_margin : any = '';
// let loss_margin : any = '';
// let annual_sale : any = '';
// let profit_amt : any = '';
// let loss_amt : any = '';
let prev_annual_sale : any = '';
let prev_profit_margin : any = [];
let prev_loss_margin : any = [];
let prev_profit_amt : any = '';
let prev_loss_amt : any = '';
let profit_margin : any = '';
let loss_margin : any = '';
let annual_sale : any = '';
let profit_amt : any = '';
let loss_amt : any = '';
let parentArray = <FormArray>this.financialForm.controls['date_per_financial'];
// let prev_annual_sale : any = '';
// let prev_profit_margin : any = '';
// let prev_loss_margin : any = '';
// let prev_profit_amt : any = '';
// let prev_loss_amt : any = '';
// let profit_margin : any = '';
// let loss_margin : any = '';
// let annual_sale : any = '';
// let profit_amt : any = '';
// let loss_amt : any = '';
let prev_annual_sale : any = '';
let prev_profit_margin : any = [];
let prev_loss_margin : any = [];
let prev_profit_amt : any = '';
let prev_loss_amt : any = '';
let profit_margin : any = '';
let loss_margin : any = '';
let annual_sale : any = '';
let profit_amt : any = '';
let loss_amt : any = '';
parentArray.value.forEach((val,index) => {
parentArray.value.forEach((val,index) => {
let childArray : any = <FormArray>parentArray.controls[index];
annual_sale = val.financial_annual_sale;
/** Calculating Sale Variation Based on Prev.Year ( Datas returns in percentage )
* Label name = " Sale Variation from Previous Year in % "
*/
if (index != 0) {
if(annual_sale != ''){
let annual_sale_variation = (( annual_sale - prev_annual_sale)/prev_annual_sale) * 100 ;
let final_annual_sale_variation = (annual_sale_variation!= Infinity) ? !(Number.isNaN(annual_sale_variation)) ? annual_sale_variation.toFixed(2): 0.00 : 0.00;
childArray.controls.financial_annualsales_variation.setValue(final_annual_sale_variation);
}
}
else{
childArray.controls.financial_annualsales_variation.setValue(0.00);
}
let childArray : any = <FormArray>parentArray.controls[index];
annual_sale = val.financial_annual_sale;
/** Calculating Sale Variation Based on Prev.Year ( Datas returns in percentage )
* Explaination : Comparing Curr.Year annual sales and Prev.year annual sales
* Label name : " Sale Variation from Previous Year in % "
*/
if (index != 0) {
if(annual_sale != ''){
let annual_sale_variation = (( annual_sale - prev_annual_sale)/prev_annual_sale) * 100 ;
let final_annual_sale_variation = (annual_sale_variation!= Infinity) ? !(Number.isNaN(annual_sale_variation)) ? annual_sale_variation.toFixed(2): 0.00 : 0.00;
childArray.controls.financial_annualsales_variation.setValue(final_annual_sale_variation);
}
}
else{
childArray.controls.financial_annualsales_variation.setValue(0.00);
}
prev_annual_sale = annual_sale;
/******************************************** Calculation Sale Variation ends Here ******************************************************************************************************/
prev_annual_sale = annual_sale;
/******************************************** Calculation Sale Variation ends Here ******************************************************************************************************/
profit_amt = val.financial_net_profit;
loss_amt = val.financial_net_loss;
profit_amt = val.financial_net_profit;
loss_amt = val.financial_net_loss;
/** Calculating Profit's Variation - STARTS HERE
* Label name = "Profit Variation from Previous Year in %"
*/
if((profit_amt != '' || loss_amt != '') && index != 0) {
if(+profit_amt > +annual_sale){
childArray.controls.financial_margin_of_profit.setValue('');
}
else{
loss_amt = val.financial_net_loss != 0 ? val.financial_net_loss * (-1) : val.financial_net_loss;
prev_loss_amt = prev_loss_amt != 0 ? prev_loss_amt * (-1) : prev_loss_amt ;
/** Calculating Profit's Variation - STARTS HERE
* Explaination : Comparing Curr.Year Net Profit (or) Loss Amount With Prev.year Net Profit (or) Loss Amount
* Label name : "Profit Variation from Previous Year in %"
*/
if((profit_amt != '' || loss_amt != '') && index != 0) {
if(+profit_amt > +annual_sale){
childArray.controls.financial_margin_of_profit.setValue('');
}
else{
loss_amt = val.financial_net_loss != 0 ? val.financial_net_loss * (-1) : val.financial_net_loss;
prev_loss_amt = prev_loss_amt != 0 ? prev_loss_amt * (-1) : prev_loss_amt ;
let variation = (((profit_amt != '' ? profit_amt : loss_amt ) - (prev_profit_amt != '' ? prev_profit_amt : prev_loss_amt ))/ (prev_profit_amt != '' ? Math.abs(prev_profit_amt) : Math.abs(prev_loss_amt))) * 100;
let final_variation = variation!= Infinity ? !(Number.isNaN(variation)) ? variation.toFixed(2) : 0.00 : 0.00 ;
childArray.controls.financial_variation.setValue(final_variation);
let variation = (((profit_amt != '' ? profit_amt : loss_amt ) - (prev_profit_amt != '' ? prev_profit_amt : prev_loss_amt ))/ (prev_profit_amt != '' ? Math.abs(prev_profit_amt) : Math.abs(prev_loss_amt))) * 100;
let final_variation = variation!= Infinity ? !(Number.isNaN(variation)) ? variation.toFixed(2) : 0.00 : 0.00 ;
childArray.controls.financial_variation.setValue(final_variation);
}
}
prev_profit_amt = val.financial_net_profit != '' ? val.financial_net_profit : 0;
prev_loss_amt = val.financial_net_loss !='' ? val.financial_net_loss : 0 ;
/********************************* Calculating Profit's Variation - ENDS HERE **************************************************************/
}
}
prev_profit_amt = val.financial_net_profit != '' ? val.financial_net_profit : 0;
prev_loss_amt = val.financial_net_loss !='' ? val.financial_net_loss : 0 ;
/********************************* Calculating Profit's Variation - ENDS HERE **************************************************************/
/** Calculating Net Profit (or) Net Loss (and) Sales's Profit Variation
* Label name = "Net Profit to Sales in % (or) Net Loss to Sales in %
**/
let SelectedlossOrProfit = val.finanical_profit_or_loss;
if(SelectedlossOrProfit == 1){
/** Calculating Net Profit (or) Net Loss (and) Sales's Profit Variation
* Explaination : Comparing Curr.Year Net Profit Amount With Curr.year Annual Sales Amount ( like wise loss )
* Label name : "Net Profit to Sales in % (or) Net Loss to Sales in %
**/
let SelectedlossOrProfit = val.finanical_profit_or_loss;
if(SelectedlossOrProfit == 1){
loss_margin = '';
childArray.controls.financial_margin_of_loss.setValue('');
if (annual_sale != '' && val.financial_net_profit != '') {
if(+profit_amt>+annual_sale){
// alert("profit is greater than Annual Sale ");
this.toast.pdTriggerappmessage("profit is greater than Annual Sale ")
childArray.controls.financial_net_profit.setValue(0);
childArray.controls.financial_margin_of_profit.setValue('');
childArray.controls.financial_profit_to_sale_variation.setValue('');
childArray.controls.financial_variation.setValue('');
}
else{
profit_margin = (val.financial_net_profit / val.financial_annual_sale) * 100;
childArray.controls.financial_margin_of_profit.setValue(profit_margin!= Infinity ? !(Number.isNaN(profit_margin)) ? profit_margin.toFixed(2):0:0);
}
}
}
else if(SelectedlossOrProfit == 2){
profit_margin = '';
childArray.controls.financial_margin_of_profit.setValue('');
if (annual_sale != '' && val.financial_net_loss != '') {
if(+val.financial_net_loss>+annual_sale){
// alert("Loss is greater than Annual Sale ");
this.toast.pdTriggerappmessage("Loss is greater than Annual Sale ")
childArray.controls.financial_net_loss.setValue(0);
childArray.controls.financial_margin_of_loss.setValue('');
childArray.controls.financial_profit_to_sale_variation.setValue('');
childArray.controls.financial_variation.setValue('');
}
if(+loss_amt>+annual_sale){
childArray.controls.financial_net_loss.setValue(0);
childArray.controls.financial_margin_of_loss.setValue('');
childArray.controls.financial_profit_to_sale_variation.setValue('');
childArray.controls.financial_variation.setValue('');
}
else{
loss_margin = '';
childArray.controls.financial_margin_of_loss.setValue('');
if (annual_sale != '' && val.financial_net_profit != '') {
if(+profit_amt>+annual_sale){
alert("profit is greater than Annual Sale ");
childArray.controls.financial_net_profit.setValue(0);
childArray.controls.financial_margin_of_profit.setValue('');
childArray.controls.financial_profit_to_sale_variation.setValue('');
childArray.controls.financial_variation.setValue('');
}
else{
profit_margin = (val.financial_net_profit / val.financial_annual_sale) * 100;
childArray.controls.financial_margin_of_profit.setValue(profit_margin!= Infinity ? !(Number.isNaN(profit_margin)) ? profit_margin.toFixed(2):0:0);
}
}
}
else if(SelectedlossOrProfit == 2){
profit_margin = '';
childArray.controls.financial_margin_of_profit.setValue('');
if (annual_sale != '' && val.financial_net_loss != '') {
if(+val.financial_net_loss>+annual_sale){
alert("Loss is greater than Annual Sale ");
childArray.controls.financial_net_loss.setValue(0);
childArray.controls.financial_margin_of_loss.setValue('');
childArray.controls.financial_profit_to_sale_variation.setValue('');
childArray.controls.financial_variation.setValue('');
}
if(+loss_amt>+annual_sale){
childArray.controls.financial_net_loss.setValue(0);
childArray.controls.financial_margin_of_loss.setValue('');
childArray.controls.financial_profit_to_sale_variation.setValue('');
childArray.controls.financial_variation.setValue('');
}
else{
loss_margin = (val.financial_net_loss/val.financial_annual_sale) * 100 * (-1);
loss_margin = (val.financial_net_loss/val.financial_annual_sale) * 100 * (-1);
childArray.controls.financial_margin_of_loss.setValue(loss_margin != Infinity ? !(Number.isNaN(loss_margin)) ? loss_margin.toFixed(2) : 0 : 0);
}
}
}
childArray.controls.financial_margin_of_loss.setValue(loss_margin != Infinity ? !(Number.isNaN(loss_margin)) ? loss_margin.toFixed(2) : 0 : 0);
}
}
}
// console.log('val.financial_margin_of_profit',val.financial_margin_of_profit);
// console.log('profit_margin',profit_margin);
// console.log('childArray.controls.financial_margin_of_loss',childArray.controls.financial_margin_of_loss.value);
// prev_profit_margin[index] = val.financial_margin_of_profit != '' ? val.financial_margin_of_profit: 0;
// prev_loss_margin[index] = val.financial_margin_of_loss !='' ? val.financial_margin_of_loss : 0 ;
prev_profit_margin[index] = profit_margin != '' ? profit_margin : 0;
prev_loss_margin[index] = loss_margin !='' ? loss_margin : 0 ;
// if(index != 0 ){
// let variation_percent = (((profit_margin != '' ? profit_margin : loss_margin ) - (prev_profit_margin != '' ? prev_profit_margin : prev_loss_margin ))/ (prev_profit_margin != '' ? Math.abs(prev_profit_margin) : Math.abs(prev_loss_margin))) * 100;
// let final_variation_percent = variation_percent != Infinity ? !(Number.isNaN(variation_percent)) ? variation_percent.toFixed(2) :0: 0;
// childArray.controls.financial_profit_to_sale_variation.setValue(final_variation_percent);
prev_profit_margin[index] = val.financial_margin_of_profit != '' ? val.financial_margin_of_profit: 0;
prev_loss_margin[index] = val.financial_margin_of_loss !='' ? val.financial_margin_of_loss : 0 ;
// if(index != 0 ){
// let variation_percent = (((profit_margin != '' ? profit_margin : loss_margin ) - (prev_profit_margin != '' ? prev_profit_margin : prev_loss_margin ))/ (prev_profit_margin != '' ? Math.abs(prev_profit_margin) : Math.abs(prev_loss_margin))) * 100;
// let final_variation_percent = variation_percent != Infinity ? !(Number.isNaN(variation_percent)) ? variation_percent.toFixed(2) :0: 0;
// childArray.controls.financial_profit_to_sale_variation.setValue(final_variation_percent);
// }
// }
/**************************** Calculating Net Profit (or) Net Loss - ENDS HERE **************************************************************/
/**************************** Calculating Net Profit (or) Net Loss - ENDS HERE **************************************************************/
/** Calculating Sales's Profit Variation
* Label name = "Variation of Profit % over sales"
**/
if ((profit_margin != '' || loss_margin != '') && index != 0) {
// console.log('temp_prev_losses',prev_loss_margin);
// console.log('temp_prev_profits',prev_profit_margin);
/** Calculating Sales's Profit Variation
* Label name = "Variation of Profit % over sales"
**/
if ((profit_margin != '' || loss_margin != '') && index != 0) {
// console.log('curr index',index);
loss_margin = loss_margin !== undefined ? loss_margin : 0;
profit_margin = profit_margin !== undefined ? profit_margin:0;
let temp_prev_loss_margin = prev_loss_margin[index-1] !== undefined ? prev_loss_margin[index-1] : 0 ;
let temp_prev_profit_margin = prev_profit_margin[index-1] !== undefined ? prev_profit_margin[index-1] : 0 ;
loss_margin = loss_margin !== undefined ? loss_margin : 0;
profit_margin = profit_margin !== undefined ? profit_margin:0;
let temp_prev_loss_margin = prev_loss_margin[index-1] !== undefined ? prev_loss_margin[index-1] : 0 ;
let temp_prev_profit_margin = prev_profit_margin[index-1] !== undefined ? prev_profit_margin[index-1] : 0 ;
if(annual_sale != ''){
// console.log('profit_margin',profit_margin);
// console.log('pre year loss_margin',temp_prev_loss_margin);
// console.log('loss_margin',loss_margin);
// console.log('pre year profit_margin',temp_prev_profit_margin);
let a = (profit_margin != '' ? profit_margin : loss_margin ) - (temp_prev_profit_margin != 0 ? temp_prev_profit_margin : temp_prev_loss_margin);
let b = a / (temp_prev_profit_margin != 0 ? Math.abs(temp_prev_profit_margin) : Math.abs(temp_prev_loss_margin));
let c = b * 100;
let final_percent = c != Infinity ? !(Number.isNaN(c)) ? c != -Infinity ? c.toFixed(2) : 0 : 0 : 0 ;
childArray.controls.financial_profit_to_sale_variation.setValue(final_percent);
}
}
/**************************** Calculating Sales's Profit Variation - ENDS HERE **************************************************************/
if(annual_sale != ''){
let a = (profit_margin != '' ? profit_margin : loss_margin ) - (temp_prev_profit_margin != 0 ? temp_prev_profit_margin : temp_prev_loss_margin);
let b = a / (temp_prev_profit_margin != 0 ? Math.abs(temp_prev_profit_margin) : Math.abs(temp_prev_loss_margin));
let c = b * 100;
let final_percent = c != Infinity ? !(Number.isNaN(c)) ? c != -Infinity ? c.toFixed(2) : 0 : 0 : 0 ;
childArray.controls.financial_profit_to_sale_variation.setValue(final_percent);
}
}
/**************************** Calculating Sales's Profit Variation - ENDS HERE **************************************************************/
});
}
});
}
confirmAlert(i, details){
let estimate_sales_from = +details.value.estimate_sales_from;

View File

@ -28,7 +28,7 @@
<mat-select placeholder="Stock" formControlName="stock_observed" (selectionChange)="checkComments($event.value,1,a)">
<mat-option value="yes">Add Stock Details</mat-option>
<mat-option value="no">No Stock Observed</mat-option>
<mat-option value="stock not required to be maintained">Stock not required to be maintained</mat-option>
<!-- <mat-option value="stock not required to be maintained">Stock not required to be maintained</mat-option> -->
</mat-select>
</mat-form-field>
<span *ngIf="mrm.get('stock_observed').value == 'yes'">
@ -77,8 +77,12 @@
<mat-placeholder>Is the stock of Raw Materials observed, sufficient considering the size of operations</mat-placeholder><br/>
<mat-select
formControlName="is_sufficiant_raw"><!-- (selectionChange)="checkComments($event.value,1,a)" -->
<mat-option value="yes">Yes</mat-option>
<mat-option *ngFor="let val of RMsufficientList" [value]="val.value" [disabled]="val.disabled">
{{val.isdisplayvalue}}
</mat-option>
<!-- <mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
<mat-option value="not applicable">Stock not required to be maintained</mat-option> -->
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="md.get('is_sufficiant_raw').value == 'no'" appearance="outline" style="width: 100%">
@ -101,7 +105,6 @@
<mat-select placeholder="Stock" formControlName="goods_observed" (selectionChange)="checkComments($event.value,2,b)">
<mat-option value="yes">Add Stock Details</mat-option>
<mat-option value="no">No Stock Observed</mat-option>
<mat-option value="stock not required to be maintained">Stock not required to be maintained</mat-option>
</mat-select>
</mat-form-field>
<span *ngIf="mfg.get('goods_observed').value == 'yes'">
@ -175,7 +178,6 @@
<mat-select placeholder="Stock" formControlName="traded_goods_observed" (selectionChange)="checkComments($event.value,3,e)">
<mat-option value="yes">Add Stock Details</mat-option>
<mat-option value="no">No Stock Observed</mat-option>
<mat-option value="stock not required to be maintained">Stock not required to be maintained</mat-option>
</mat-select>
</mat-form-field>
<span *ngIf="item.get('traded_goods_observed').value == 'yes'">
@ -315,8 +317,12 @@
<mat-placeholder>Is the stock of finished / traded goods observed, sufficient considering the size of operations</mat-placeholder><br/>
<mat-select formControlName="is_sufficiant_finished_and_traded_goods">
<mat-option>Select</mat-option>
<mat-option value="yes" >Yes</mat-option>
<mat-option *ngFor="let val of TGsufficientList" [value]="val.value" [disabled]="val.isdisabled">
{{val.isdisplayvalue}}
</mat-option>
<!-- <mat-option value="yes" >Yes</mat-option>
<mat-option value="no" >No</mat-option>
<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'">

View File

@ -123,32 +123,36 @@ export class PdQuestionSupplierInfoPage {
// let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) {
// return dataForm.main_raw_materials[key];
// });
if(dataForm.manufacturing_details[0] != null){
let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials;
if (dataForm.manufacturing_details[0] != null) {
let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials;
this.initManufacturingProductsDetails(api_main_raw_materials);
this.supplierInfoForm.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(dataForm.manufacturing_details[0].main_raw_materials_total_payments_percent_on_credit || null);
this.initManufacturingProductsDetails(api_main_raw_materials);
this.supplierInfoForm.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(dataForm.manufacturing_details[0].main_raw_materials_total_payments_percent_on_credit || null);
}
else {
this.initManufacturingProductsDetails(null);
this.supplierInfoForm.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null)
}
}
else{
this.initManufacturingProductsDetails(null);
this.supplierInfoForm.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null)
}
}
let arr1 = record.filter(data => data.type_of_activity_id == 3 || data.type_of_activity_id == 4);
if (arr1.length > 0) {
// let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) {
// return dataForm.trading_products[key];
// });
if(dataForm.trade_details[0] != null){
let api_trading_products = dataForm.trade_details[0].trading_products;
this.initTradingProductsDetails(api_trading_products);
this.supplierInfoForm.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trade_details[0].trading_products_total_payments_percent_on_credit || null);
if (dataForm.trade_details[0] != null) {
let api_trading_products = dataForm.trade_details[0].trading_products;
this.initTradingProductsDetails(api_trading_products);
this.supplierInfoForm.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trade_details[0].trading_products_total_payments_percent_on_credit || null);
}
else{
else {
this.initTradingProductsDetails(null);
this.supplierInfoForm.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(null);
this.supplierInfoForm.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(null);
}
}
let arr2 = record.filter(data => data.type_of_activity_id == 5);
if (arr2.length > 0) {
this.serviceProviderForm = true;
}
this.noRecordsFound = true;
} else {
this.supplierInfoForm = this.fb.group({
@ -407,11 +411,11 @@ export class PdQuestionSupplierInfoPage {
this.qustCat.saveForm(answerFormValues).subscribe(responsed => {
if (responsed['status'] == 200) {
this.toast.pdTriggerappmessage('Record Saved Successfully.!');
setTimeout(()=>{
setTimeout(() => {
this.navCtrl.pop();
},2000);
}, 2000);
} else {
this.toast.pdTriggerappmessage('Something Wents Wrong Try Again.!');
}

View File

@ -262,13 +262,13 @@
<div fxLayout="row wrap" class="align-margin" *ngFor="let fUnits of floor.controls.floor_unit_details['controls']; let fu=index;" [formGroupName]="fu">
<mat-form-field style="width:100%;">
<mat-label>Rent per Unit</mat-label>
<input type="number" matInput autocomplete="off" placeholder="" formControlName="rent_per_unit" (keyup)="calculateFloorRentAmt(floor.value,f)" required (keyup)="inWords($event.target.value,fu,1)">
<input type="number" matInput autocomplete="off" placeholder="" formControlName="rent_per_unit" (keyup)="calculateFloorRentAmt(floor.value,f);" required>
<mat-hint align="end" style="font-size:12px" *ngIf="fUnits.value.rent_per_unit != ''">{{"&#8377;"}} {{rent_per_unit_Inwords[f]}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width:100%;">
<mat-label>Amount</mat-label>
<input type="number" matInput autocomplete="off" placeholder="" formControlName="amount" readonly (keyup)="inWords($event.target.value,fu,2)">
<input type="number" matInput autocomplete="off" placeholder="" formControlName="amount" readonly>
<mat-hint align="end" style="font-size:12px" *ngIf="fUnits.value.amount != ''">{{"&#8377;"}} {{amount_Inwords[f] }} Only</mat-hint>
</mat-form-field>
@ -281,7 +281,7 @@
<div class="rent-unit" fxFlex.xs="100" fxFlex.sm="45" fxFlex.md="45" fxFlex.lg="45" fxFlex.xl="45" *ngFor="let fUnits of floor.controls.floor_unit_details['controls']; let fu=index;" [formGroupName]="fu">
<mat-form-field style="width:100%" appearance="outline">
<mat-label>Rent Unit {{fu+1}} </mat-label>
<input type="number" matInput autocomplete="off" placeholder="" formControlName="rent_per_unit" (keyup)="calculateFloorRentAmt(floor.value,f)" required (keyup)="inWords($event.target.value,fu,3)">
<input type="number" matInput autocomplete="off" placeholder="" formControlName="rent_per_unit" (keyup)="calculateFloorRentAmt(floor.value,f);" required>
<mat-hint align="end" style="font-size:12px" *ngIf="fUnits.value.rent_per_unit != ''">{{"&#8377;"}} {{rent_per_unit_2_Inwords[f]}} Only</mat-hint>
</mat-form-field>
</div>
@ -295,7 +295,7 @@
<mat-form-field style="width:100%">
<mat-label>Total Rent Amount</mat-label>
<input type="number" matInput autocomplete="off" placeholder="" formControlName="floor_rent_amount" readonly>
<!-- <mat-hint align="end" style="font-size:12px" *ngIf="floor.value.floor_rent_amount != ''">{{"&#8377;"}} {{floor_rent_amount_Inwords[f]}} Only</mat-hint> -->
<mat-hint align="end" style="font-size:12px" *ngIf="floor.value.floor_rent_amount != ''">{{"&#8377;"}} {{floor_rent_amount_Inwords[f]}} Only</mat-hint>
</mat-form-field>
</div>
</mat-card-actions>
@ -339,7 +339,7 @@
<input matInput autocomplete="off" placeholder="" formControlName="monthly_rent_amount"
required (keyup)="inWords($event.target.value,u,5)" type="number">
<!-- (keyup)="inWords($event,1)" -->
<!-- <mat-hint align="end" style="font-size:12px" *ngIf="units.value.monthly_rent_amount != ''">{{"&#8377;"}} {{monthly_rent_amount_Inwords[u]}} Only</mat-hint> -->
<mat-hint align="end" style="font-size:12px" *ngIf="units.value.monthly_rent_amount != ''">{{"&#8377;"}} {{monthly_rent_amount_Inwords[u]}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width:100%">
<mat-label>Mode of Payment of Rent as per Loan Applicant</mat-label>

View File

@ -779,13 +779,16 @@ createFloorUnitDetails(type:number){
}
// calculate floor rent amount
calculateFloorRentAmt(values: any, index: number){
// this.inWords(values,index,1);
if(values.unit_rent_difference_options=="1"){
let control: any = <FormArray>this.rentalForms.controls['multistoried_building_details'];
let unitcontrol = control.controls[index];
unitcontrol= <FormArray> unitcontrol.controls['floor_unit_details'];
if(unitcontrol.value[unitcontrol.value.length-1].rent_per_unit>0 && values.no_units_in_floor>0){
unitcontrol.controls[unitcontrol.value.length-1].controls['amount'].setValue(unitcontrol.value[unitcontrol.value.length-1].rent_per_unit * values.no_units_in_floor);
// this.inWords(unitcontrol.value[unitcontrol.value.length-1].rent_per_unit * values.no_units_in_floor,index,2);
control.controls[index].controls['floor_rent_amount'].setValue(unitcontrol.value[unitcontrol.value.length-1].rent_per_unit * values.no_units_in_floor);
// this.inWords(unitcontrol.value[unitcontrol.value.length-1].rent_per_unit * values.no_units_in_floor,index,3);
}
else{
unitcontrol.controls[unitcontrol.value.length-1].controls['amount'].setValue('');
@ -801,6 +804,7 @@ calculateFloorRentAmt(values: any, index: number){
let getunitValues = unitcontrol.value.filter(val=>val.rent_per_unit!='');
if(getunitValues.length>0){
control.controls[index].controls['floor_rent_amount'].setValue(getunitValues.map(mval=>mval.rent_per_unit).reduce((acc, val) => Number(acc) + Number(val), 0));
// this.inWords(getunitValues.map(mval=>mval.rent_per_unit).reduce((acc, val) => Number(acc) + Number(val)),index,3);
}
else{
control.controls[index].controls['floor_rent_amount'].setValue('');
@ -1010,12 +1014,12 @@ compareSingleObjects(o1: any, o2: any) {
element.amount_received_bank_per_met ? control.controls[index].addControl('amount_received_bank_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('amount_received_bank_per_met');
element.payment_received_reason_per_met ? control.controls[index].addControl('payment_received_reason_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_received_reason_per_met');
element.payment_difference_per_met ? control.controls[index].addControl('payment_difference_per_met', new FormControl('')) : control.controls[index].removeControl('payment_difference_per_met');
this.inWords(element.monthly_rent_amount != '' ? +element.monthly_rent_amount : '',index,5);
this.inWords(element.amount_received_cash != '' ? +element.amount_received_cash : '',index,6);
this.inWords(element.amount_received_bank != '' ? +element.amount_received_bank : '',index,7);
this.inWords(element.securtity_deposit_amount != '' ? +element.securtity_deposit_amount : '',index,8);
this.inWords(element.agreement_monthly_rent_amount != '' ? +element.agreement_monthly_rent_amount : '',index,9);
this.inWords(element.agreement_security_deposit != '' ? +element.agreement_security_deposit :'',index,10);
this.inWords(element.agreement_security_deposit_amount != '' ? +element.agreement_security_deposit_amount :'',index,10);
this.inWords(element.paid_monthly_rent_per_met != '' ? +element.paid_monthly_rent_per_met : '',index,11);
this.inWords(element.amount_received_cash_per_met != '' ? +element.amount_received_cash_per_met : '',index,12);
this.inWords(element.amount_received_bank_per_met != '' ? +element.amount_received_bank_per_met : '',index,13);
@ -1107,7 +1111,7 @@ compareSingleObjects(o1: any, o2: any) {
// }
inWords(e,i,flag){
console.log(e,i,flag);
// console.log(e,i,flag);
switch(flag){
case 1 :
this.rent_per_unit_Inwords[i] = this.constprovider.convertNumberToWords(e);
@ -1116,9 +1120,9 @@ compareSingleObjects(o1: any, o2: any) {
this.amount_Inwords[i] = this.constprovider.convertNumberToWords(e);
break;
case 3 :
this.rent_per_unit_2_Inwords[i] = this.constprovider.convertNumberToWords(e);
break;
case 4 :
this.rent_per_unit_2_Inwords[i] = this.constprovider.convertNumberToWords(e);
break;
case 4 :
this.floor_rent_amount_Inwords[i] = this.constprovider.convertNumberToWords(e);
break;
case 5 :

View File

@ -19,7 +19,7 @@ public commonimage = "http://ssa.sineedge.com/sparqapi/logo/avatar.jpg";
let testapiurl = 'http://ssa.sineedge.com/sparqtest/api/';
let devapiurl = 'http://ssa.sineedge.com/sparqapi/api/';
let localapiurl = 'http://192.168.0.9/sparqapi/api/';
return testapiurl;
return devapiurl;
}
getcurrentDate()

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.