From 628aa60b5ea110cf9a97a92e0009e5295db47942 Mon Sep 17 00:00:00 2001
From: Velz2020
Date: Sat, 23 Nov 2019 18:07:39 +0530
Subject: [PATCH] SALES PD CLIX PROD ISSUES
---
api/application/controllers/PD_Controller.php | 44 ++++++++++-----
.../controllers/Sales_PD_Controller.php | 1 +
.../report_templates/JSONTOREPORT_DI_AI.php | 54 +++++++++++++++----
.../JSONTOREPORT_DI_AI_ADDON.php | 49 ++++++++++++++---
.../sale_pd_templates/{SMC.php => MWISE.php} | 3 +-
5 files changed, 119 insertions(+), 32 deletions(-)
rename api/application/views/sale_pd_templates/{SMC.php => MWISE.php} (98%)
diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php
index 07b9449b..da5aae59 100644
--- a/api/application/controllers/PD_Controller.php
+++ b/api/application/controllers/PD_Controller.php
@@ -9083,14 +9083,30 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
}
- public function deactiveFormData_get()
+ public function deactiveFormData_post()
{
//$records = $this->post('records');
- $pd_form_detail_json_id = $this->get('jid');
-
- if(is_numeric($pd_form_detail_json_id))
+ $records = $this->post('records');
+ $fk_pd_id = $records['fk_pd_id'];
+ $fk_form_id = $records['fk_form_id'];
+ $company_id = $records['company_id'];
+ $fk_createdby = $records['fk_createdby'];
+ $rental_count_id = $records['rental_count_id'];
+
+ $fields = array('isactive' => 0,'fk_updatedby' => $fk_createdby);
+ $where_condition_array = array('fk_pd_id' => $fk_pd_id,'fk_form_id' => $fk_form_id);
+ if($company_id)
{
- $id = $this->PD_Model->updateRecords(array('isactive' => 0),PDFORMDETAILSJSON,array('pd_form_detail_json_id' => $pd_form_detail_json_id));
+ $where_condition_array['company_id'] = $company_id;
+ }
+ if($rental_count_id)
+ {
+ $where_condition_array['rental_count_id'] = $rental_count_id;
+ }
+ //print_r($where_condition_array);die();
+
+ $id = $this->PD_Model->updateRecords($fields,PDFORMDETAILSJSON,$where_condition_array);
+ //print_r($this->db->last_query());
if($id)
{
$data['dataStatus'] = true;
@@ -9104,15 +9120,15 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
$data['status'] = REST_Controller::HTTP_NOT_MODIFIED;
$data['msg'] = 'Something went wrong..! Try Later...!';
$this->response($data,REST_Controller::HTTP_OK);
- }
- }
- else
- {
- $data['dataStatus'] = false;
- $data['status'] = REST_Controller::HTTP_NOT_FOUND;
- $data['msg'] = 'Wrong Call...!';
- $this->response($data,REST_Controller::HTTP_OK);
- }
+ }
+ // }
+ // else
+ // {
+ // $data['dataStatus'] = false;
+ // $data['status'] = REST_Controller::HTTP_NOT_FOUND;
+ // $data['msg'] = 'Wrong Call...!';
+ // $this->response($data,REST_Controller::HTTP_OK);
+ // }
}
}
diff --git a/api/application/controllers/Sales_PD_Controller.php b/api/application/controllers/Sales_PD_Controller.php
index c7d9486e..0305dd07 100644
--- a/api/application/controllers/Sales_PD_Controller.php
+++ b/api/application/controllers/Sales_PD_Controller.php
@@ -162,6 +162,7 @@ class Sales_PD_Controller extends REST_Controller {
}
$view_data['section9'] = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('fk_sales_pd_id' => $sales_pd_id),SALEPD_DOCS);
+ $view_data['product_id'] = $sales_pd_data[0]['product_id'];
//print_r($this->db->last_query());die();
//$view_name = $sales_pd_data[0]['short_name'].'_'.$sales_pd_data[0]['abbr'];
$view_name = $sales_pd_data[0]['short_name'];
diff --git a/api/application/views/report_templates/JSONTOREPORT_DI_AI.php b/api/application/views/report_templates/JSONTOREPORT_DI_AI.php
index fc20e99c..dd4ba540 100644
--- a/api/application/views/report_templates/JSONTOREPORT_DI_AI.php
+++ b/api/application/views/report_templates/JSONTOREPORT_DI_AI.php
@@ -1260,20 +1260,20 @@ defined('BASEPATH') OR exit('No direct script access allowed');
//echo 'sdn-'.((!$is_current_product_bl) && !$is_current_product_lab); die();
if((!$is_current_product_bl) && !$is_current_product_lab && !$is_current_product_laep)
{
- $loan_table_dispaly_rows[] = array('particulars' => 'Amount of Own Contribution','details' =>"₹"." ".MYUTIL::customIndianNumberFormat($loan_form['own_contribution']).' ('.MYUTIL::numtowords($loan_form['own_contribution']).')' );
+ $loan_table_dispaly_rows[] = array('particulars' => 'Amount of Own Contribution','details' =>is_numeric($loan_form['own_contribution']) && $loan_form['own_contribution'] != 0 ? ("₹"." ".MYUTIL::customIndianNumberFormat($loan_form['own_contribution']).' ('.MYUTIL::numtowords($loan_form['own_contribution']).')') : 'Not Provided' );
$source_of_own_contribution = null;
foreach($loan_form['source_of_own_contribution_master'] as $own_source)
{
- if(strpos(strval($own_source), 'Others') === false) { $source_of_own_contribution.= $own_source.' and ';}else{ $source_of_own_contribution.=$loan_form['other_source'].' and '; }
+ if(strpos(strval($own_source), 'Others') === false) { $source_of_own_contribution_mastertribution.= $own_source.' and ';}else{ $source_of_own_contribution.=$loan_form['other_source'].' and '; }
}
$source_of_own_contribution = substr_replace($source_of_own_contribution, '', strrpos($source_of_own_contribution, ' and '),strlen($source_of_own_contribution));
- $loan_table_dispaly_rows[] = array('particulars' => 'Source of Own Contribution','details' => $source_of_own_contribution);
+ $loan_table_dispaly_rows[] = array('particulars' => 'Source of Own Contribution','details' => $source_of_own_contribution );
}
}
- $loan_table_dispaly_rows[] = array('particulars' => 'EMI Comfortable Paying','details' => $rupee_symbol." ".MYUTIL::customIndianNumberFormat($loan_form['emi_level']).' ('.MYUTIL::numtowords($loan_form['emi_level']).')' );
+ $loan_table_dispaly_rows[] = array('particulars' => 'EMI Comfortable Paying','details' => is_numeric($loan_form['emi_level']) && $loan_form['emi_level'] != 0? ($rupee_symbol." ".MYUTIL::customIndianNumberFormat($loan_form['emi_level']).' ('.MYUTIL::numtowords($loan_form['emi_level']).')') : "Not Provided" );
if(!$is_current_product_bl && !$is_current_product_laep)
{
@@ -2489,7 +2489,7 @@ if($total_no_of_business > 0) {
$client_sixth_row = '';
$client_seventh_row = '';
$to_no_of_clients = 0;
- $done_on_credit = 0;
+ $done_on_credit = array();
$name_of_the_company = '';
$is_client_details_available = null;
if(isset($pd_processed_forms[2][$business_count]))
@@ -2519,7 +2519,7 @@ if($total_no_of_business > 0) {
// this is for manufacturing
if(array_key_exists('manufacturing_details',$clientRow)){
- $done_on_credit += $clientRow['manufacturing_details'][0]['main_raw_materials_total_payments_percent_on_credit'];
+ $clientRow['manufacturing_details'][0]['main_raw_materials_total_payments_percent_on_credit'] ? $done_on_credit['manufacturing prodcuts'] = $clientRow['manufacturing_details'][0]['main_raw_materials_total_payments_percent_on_credit'] : '';
foreach($clientRow['manufacturing_details'] as $manuRow){
@@ -2565,7 +2565,7 @@ if($total_no_of_business > 0) {
// this is for trading
if(array_key_exists('trade_details',$clientRow)){
- $done_on_credit += $clientRow['trade_details'][0]['trading_products_total_payments_percent_on_credit'];
+ $clientRow['trade_details'][0]['trading_products_total_payments_percent_on_credit'] ? $done_on_credit['trading products'] = $clientRow['trade_details'][0]['trading_products_total_payments_percent_on_credit'] : '';
foreach($clientRow['trade_details'] as $tradeRow){
if(isset($tradeRow['trading_products'])){
@@ -2610,7 +2610,7 @@ if($total_no_of_business > 0) {
//this is for service
if(array_key_exists('service_provider_details',$clientRow)){
- $done_on_credit += $clientRow['service_provider_details'][0]['service_products_total_payments_percent_on_credit'];
+ $clientRow['service_provider_details'][0]['service_products_total_payments_percent_on_credit'] ? $done_on_credit['service providing'] = $clientRow['service_provider_details'][0]['service_products_total_payments_percent_on_credit'] : '';
foreach($clientRow['service_provider_details'] as $serviceRow){
@@ -2700,7 +2700,42 @@ if($total_no_of_business > 0) {
- Out of total sales done by ".$name_of_the_company .", ".$done_on_credit."% is done on credit.
"; }
+ $value)
+ {
+ if(count($temp))
+ {
+ foreach ($temp as $tk => $tvalue)
+ {
+ $value == $tvalue ? $all_same = true : $all_same = false ;array_push($temp, $value);
+ }
+ }
+ else
+ {
+ array_push($temp, $value);
+ }
+
+ }
+
+ if($all_same)
+ { echo " Out of total sales done by ".$name_of_the_company .", ".$vals[0]."% is done on credit.
"; }
+ else
+ {
+ $activities = '';
+ foreach ($done_on_credit as $dkey => $dvalue)
+ {
+ $activities .= $dkey.' '.$dvalue.'%, ';
+ }
+ $activities = substr_replace($activities,' ', -2);
+ $activities = substr_replace($activities,' and ',strripos($activities,','),2);
+
+ echo " Out of total sales done by ".$name_of_the_company .", ".$activities."are done on credit.
";
+ }
+
+ }
//CLient Photo Section
@@ -2742,7 +2777,6 @@ if($total_no_of_business > 0) {
// //echo '';
// echo '';
// }
- //End of CLient Photo Section
?>
'.$client_form_remarks.'';
diff --git a/api/application/views/report_templates/JSONTOREPORT_DI_AI_ADDON.php b/api/application/views/report_templates/JSONTOREPORT_DI_AI_ADDON.php
index 1bb3eb8f..2f767f83 100644
--- a/api/application/views/report_templates/JSONTOREPORT_DI_AI_ADDON.php
+++ b/api/application/views/report_templates/JSONTOREPORT_DI_AI_ADDON.php
@@ -1529,11 +1529,11 @@ defined('BASEPATH') OR exit('No direct script access allowed');
}
$source_of_own_contribution = substr_replace($source_of_own_contribution, '', strrpos($source_of_own_contribution, ' and '),strlen($source_of_own_contribution));
- $loan_table_dispaly_rows[] = array('particulars' => 'Source of Own Contribution','details' => $source_of_own_contribution);
+ $loan_table_dispaly_rows[] = array('particulars' => 'Source of Own Contribution','details' => is_numeric($source_of_own_contribution) && $source_of_own_contribution != 0 ? $source_of_own_contribution : 'Not Provided');
}
}
- $loan_table_dispaly_rows[] = array('particulars' => 'EMI Comfortable Paying','details' => $rupee_symbol." ".MYUTIL::customIndianNumberFormat($loan_form['emi_level']).' ('.MYUTIL::numtowords($loan_form['emi_level']).')' );
+ $loan_table_dispaly_rows[] = array('particulars' => 'EMI Comfortable Paying','details' => is_numeric($loan_form['emi_level']) && $loan_form['emi_level'] != 0? ($rupee_symbol." ".MYUTIL::customIndianNumberFormat($loan_form['emi_level']).' ('.MYUTIL::numtowords($loan_form['emi_level']).')') : "Not Provided" );
if(!$is_current_product_bl && !$is_current_product_laep)
{
@@ -2734,7 +2734,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
$client_sixth_row = '';
$client_seventh_row = '';
$to_no_of_clients = 0;
- $done_on_credit = 0;
+ $done_on_credit = array();
$name_of_the_company = '';
$is_client_details_available = null;
if(isset($pd_processed_forms[2][$business_count]))
@@ -2764,7 +2764,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
// this is for manufacturing
if(array_key_exists('manufacturing_details',$clientRow)){
- $done_on_credit += $clientRow['manufacturing_details'][0]['main_raw_materials_total_payments_percent_on_credit'];
+ $clientRow['manufacturing_details'][0]['main_raw_materials_total_payments_percent_on_credit'] ? $done_on_credit['manufacturing prodcuts'] = $clientRow['manufacturing_details'][0]['main_raw_materials_total_payments_percent_on_credit'] : '';
foreach($clientRow['manufacturing_details'] as $manuRow){
@@ -2810,7 +2810,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
// this is for trading
if(array_key_exists('trade_details',$clientRow)){
- $done_on_credit += $clientRow['trade_details'][0]['trading_products_total_payments_percent_on_credit'];
+ $clientRow['trade_details'][0]['trading_products_total_payments_percent_on_credit'] ? $done_on_credit['trading products'] = $clientRow['trade_details'][0]['trading_products_total_payments_percent_on_credit'] : '';
foreach($clientRow['trade_details'] as $tradeRow){
if(isset($tradeRow['trading_products'])){
@@ -2855,7 +2855,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
//this is for service
if(array_key_exists('service_provider_details',$clientRow)){
- $done_on_credit += $clientRow['service_provider_details'][0]['service_products_total_payments_percent_on_credit'];
+ $clientRow['service_provider_details'][0]['service_products_total_payments_percent_on_credit'] ? $done_on_credit['service providing'] = $clientRow['service_provider_details'][0]['service_products_total_payments_percent_on_credit'] : '';
foreach($clientRow['service_provider_details'] as $serviceRow){
@@ -2945,7 +2945,42 @@ defined('BASEPATH') OR exit('No direct script access allowed');
- Out of total sales done by ".$name_of_the_company .", ".$done_on_credit."% is done on credit."; }
+ $value)
+ {
+ if(count($temp))
+ {
+ foreach ($temp as $tk => $tvalue)
+ {
+ $value == $tvalue ? $all_same = true : $all_same = false ;array_push($temp, $value);
+ }
+ }
+ else
+ {
+ array_push($temp, $value);
+ }
+
+ }
+
+ if($all_same)
+ { echo " Out of total sales done by ".$name_of_the_company .", ".$vals[0]."% is done on credit.
"; }
+ else
+ {
+ $activities = '';
+ foreach ($done_on_credit as $dkey => $dvalue)
+ {
+ $activities .= $dkey.' '.$dvalue.'%, ';
+ }
+ $activities = substr_replace($activities,' ', -2);
+ $activities = substr_replace($activities,' and ',strripos($activities,','),2);
+
+ echo " Out of total sales done by ".$name_of_the_company .", ".$activities."are done on credit.
";
+ }
+
+ }
//CLient Photo Section
diff --git a/api/application/views/sale_pd_templates/SMC.php b/api/application/views/sale_pd_templates/MWISE.php
similarity index 98%
rename from api/application/views/sale_pd_templates/SMC.php
rename to api/application/views/sale_pd_templates/MWISE.php
index f58b15a2..ec93bc24 100644
--- a/api/application/views/sale_pd_templates/SMC.php
+++ b/api/application/views/sale_pd_templates/MWISE.php
@@ -4,6 +4,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
$uparrow = '↑';
$downarrow = '↓';
$dash = ' ';
+ $product_name = $product_id == 8 ? 'LFMP' : 'BL';
?>
@@ -105,7 +106,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
- | Personal Discussion Sheet - LFMP (For Sales Team) |
+ Personal Discussion Sheet - (For Sales Team) |
| Application ID |