SMC REPORT INPROGRESS

This commit is contained in:
Velz2020 2019-11-14 16:57:57 +05:30
parent 9aa7ce3bd4
commit a3ba12eae3
7 changed files with 111 additions and 137 deletions

View File

@ -256,4 +256,5 @@ $route['(getRawData/:any)'] = 'Data_Dump_Controller/getRawData';
$route['loadSalesPDTemplate'] = 'Sales_PD_Controller/loadSalesPDTemplate';
$route['saveSalesPD'] = 'Sales_PD_Controller/saveSalesPD';
$route['(downloadSalesPDReport/:any)'] = 'Sales_PD_Controller/getSalesPDReport';
$route['(listSalesPD/:any)'] = 'Sales_PD_Controller/listSalesPD';

View File

@ -8187,7 +8187,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
$incomplete_details[] = 'Business Section - Company Employees Details Not Filled';
}
if( !is_numeric($business_form['employees_temporary']) && $pd_master_details[0]['lender_short_name'] != 'CLIX')
if( ($pd_master_details[0]['lender_short_name'] != 'CLIX' && $pd_master_details[0]['lender_short_name'] != 'SMC') && !is_numeric($business_form['employees_temporary']))
{
$incomplete_details[] = 'Business Section - Company Employees Details Not Filled';
}

View File

@ -115,8 +115,21 @@ class Sales_PD_Controller extends REST_Controller {
if(!$sales_pd_data[0]['is_pdf'] || $sales_pd_data[0]['is_edited'])
{
//echo 'FIRST';
//Get Data from DB and process
//print_r(json_decode($sales_pd_data[0]['pd_json'],true));die();
$json_data = (json_decode($sales_pd_data[0]['pd_json'],true));
foreach ($json_data as $sec_key => $section)
{
$data[$section['section_name'] ] = $this->processSalesPDJSON($section);
}
//die();
print_r($data);die();
//End of JSON processing
$view_name = $sales_pd_data[0]['short_name'].'_'.$sales_pd_data[0]['abbr'];
$html_content = $this->load->view('sale_pd_templates/'.$view_name,$data = array(),true);
$html_content = $this->load->view('sale_pd_templates/'.$view_name,$data,true);
$pdf_doc = $this->pdfgenerator->generate($html_content, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait");
//End of PDF Gen using DOM PDF
@ -150,6 +163,97 @@ class Sales_PD_Controller extends REST_Controller {
}
}
public function listSalesPD_get()
{
$lender_id = $this->uri->segment(2);//sales_pd_id, pd_json, lender_id, product_id, createdby, updatedby, createdon, updatedon, isactive, is_pdf, is_edited, length(pd_json)
$columns = array('SALES_PD_DATA.sales_pd_id','SALES_PD_DATA.lender_id','SALES_PD_DATA.product_id','SALES_PD_DATA.is_pdf','SALES_PD_DATA.is_edited','ENTITY.short_name','PRODUCT.abbr');
$table = SALES_PD_DATA.' as SALES_PD_DATA';
$joins = array(
array('table' => ENTITY. ' as ENTITY',
'condition' =>'SALES_PD_DATA.lender_id = ENTITY.entity_id',
'jointype' => 'INNER'),
array('table' => PRODUCTS. ' as PRODUCT',
'condition' =>'SALES_PD_DATA.product_id = PRODUCT.product_id',
'jointype' => 'INNER')
);
$where_condition_array = array();
if(is_numeric($lender_id))
{
$where_condition_array = array('SALES_PD_DATA.lender_id' => $lender_id);
}
$order_by = 'SALES_PD_DATA.sales_pd_id';
$sales_pd_data = $this->Sales_PD_Model->getJoinRecords($columns,$table,$joins,$where_condition_array);
if(count($sales_pd_data))
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = $sales_pd_data;
$this->response($data,REST_Controller::HTTP_OK);
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
$data['msg'] = 'Something went wrong! Try Later';
$this->response($data,REST_Controller::HTTP_OK);
}
}
function processSalesPDJSON($section_array)
{
//
echo '###'.$section_array['section_id'].'####';
if($section_array['section_id'] == 3)
{
//print_r($section_array);
}
if($section_array['section_id'] != 8)
{
//print_r($section_array);
return $this->processSalesPDQuestions($section_array['questions']);
}
// die();
// $general_section_dta = array();
// foreach ($section_array as $sec_key => $section)
// {
//}
}
function processSalesPDQuestions($questions)
{
$temp_array = array();
foreach ($questions as $ques_key => $question)
{
if($question['is_repeatable'] == null && ($question['type'] == 1 || $question['type'] == 2 || $question['type'] == 3))//text,radio,SDD
{
$temp_array[ $question['question_key'] ] = $question['answer_value'];
}
else if($question['is_repeatable'] == 1)
{
//print_r($question['questions_group']);die();
foreach ($question['questions_group'] as $group_key => $group_value)
{
//print_r($group_value['']);die();
foreach ($group_value['questions'] as $q_key => $q_value)
{
//print_r($q_value);die();
$temp_array[ $group_key ][ $q_value['question_key'] ] = $q_value['answer_value'];
}
}
}
}
//print_r($temp_array);die();
return $temp_array;
}
}

View File

@ -2496,7 +2496,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
$client_sixth_row .= $main_raw_material['manufacturing_payment_mode'] ? '<td class="customtd">'. $main_raw_material['manufacturing_payment_mode'] .'</td>' : '<td class="customtd">NA</td>';;
$client_seventh_row .= $main_raw_material['manufacturing_credit_days_from'] && $main_raw_material['manufacturing_credit_days_to'] ? '<td class="customtd">'. $main_raw_material['manufacturing_credit_days_from'].' to '. $main_raw_material['manufacturing_credit_days_to'].' days'.'</td>' :'<td class="customtd"> NIL </td>' ;
$client_seventh_row .= $main_raw_material['manufacturing_credit_days_from'] && $main_raw_material['manufacturing_credit_days_to'] ? '<td class="customtd">'. $main_raw_material['manufacturing_credit_days_from'].' to '. $main_raw_material['manufacturing_credit_days_to'].' days'.'</td>' :'<td class="customtd"> NA </td>' ;
$client_eigth_row .= isset($main_raw_material['manufacturing_contribution_total_turnover']) && $main_raw_material['manufacturing_contribution_total_turnover'] != "" ? '<td class="customtd">'. $main_raw_material['manufacturing_contribution_total_turnover'].'</td>' :'<td class="customtd"> NA </td>' ;
@ -2542,7 +2542,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
$client_sixth_row .= $trading_product['trade_product_payment_mode'] ? '<td class="customtd">'. $trading_product['trade_product_payment_mode'] .'</td>' : '<td class="customtd">NA</td>';;
$client_seventh_row .= $trading_product['trade_product_credit_days_from'] && $trading_product['trade_product_credit_days_to']? '<td class="customtd">'. $trading_product['trade_product_credit_days_from'].' to '. $trading_product['trade_product_credit_days_to'].' days'.'</td>' :'<td class="customtd"> NIL </td>' ;
$client_seventh_row .= $trading_product['trade_product_credit_days_from'] && $trading_product['trade_product_credit_days_to']? '<td class="customtd">'. $trading_product['trade_product_credit_days_from'].' to '. $trading_product['trade_product_credit_days_to'].' days'.'</td>' :'<td class="customtd"> NA </td>' ;
$client_eigth_row .= isset($trading_product['trade_product_contribution_total_turnover']) && $trading_product['trade_product_contribution_total_turnover'] != "" ? '<td class="customtd">'. $trading_product['trade_product_contribution_total_turnover'].'</td>' :'<td class="customtd"> NA </td>' ;
@ -2589,7 +2589,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
$client_sixth_row .= $service_product['service_provider_product_payment_mode'] ? '<td class="customtd">'. $service_product['service_provider_product_payment_mode'] .'</td>' : '<td class="customtd">NA</td>';
$client_seventh_row .= $service_product['service_provider_product_credit_days_from'] && $service_product['service_provider_product_credit_days_to']? '<td class="customtd">'. $service_product['service_provider_product_credit_days_from'].' to '. $service_product['service_provider_product_credit_days_to'].' days'.'</td>' :'<td class="customtd"> NIL </td>' ;
$client_seventh_row .= $service_product['service_provider_product_credit_days_from'] && $service_product['service_provider_product_credit_days_to']? '<td class="customtd">'. $service_product['service_provider_product_credit_days_from'].' to '. $service_product['service_provider_product_credit_days_to'].' days'.'</td>' :'<td class="customtd"> NA </td>' ;
$client_eigth_row .= isset($service_product['service_provider_contribution_total_turnover']) && $service_product['service_provider_contribution_total_turnover'] != "" ? '<td class="customtd">'. $service_product['service_provider_contribution_total_turnover'].'</td>' :'<td class="customtd"> NA </td>' ;

View File

@ -1,6 +1,7 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>

View File

@ -1,94 +0,0 @@
<?php
/* Smarty version 3.1.33, created on 2018-12-13 17:48:52
from 'C:\5.6\xampp\htdocs\AWSEC2\sparqapi\api\application\views\report_templates\index.tpl' */
/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
'version' => '3.1.33',
'unifunc' => 'content_5c124e2c129999_32537547',
'has_nocache_code' => false,
'file_dependency' =>
array (
'b0e5cd66cbc435419cef094f2e45e2c462937187' =>
array (
0 => 'C:\\5.6\\xampp\\htdocs\\AWSEC2\\sparqapi\\api\\application\\views\\report_templates\\index.tpl',
1 => 1544703528,
2 => 'file',
),
),
'includes' =>
array (
),
),false)) {
function content_5c124e2c129999_32537547 (Smarty_Internal_Template $_smarty_tpl) {
?><html>
<head>
<title>PD Report</title>
</head>
<body>
PD Report ID: <?php echo $_smarty_tpl->tpl_vars['pdid']->value;?>
Main Applicant Name: <?php echo $_smarty_tpl->tpl_vars['main_applicant_name']->value;?>
Customer Segment: <?php echo $_smarty_tpl->tpl_vars['cus_seg']->value;?>
Lender: <?php echo $_smarty_tpl->tpl_vars['lender_name']->value;?>
<p>Product :- <?php echo $_smarty_tpl->tpl_vars['product']->value;?>
</p>
<!-- command -->
<p>Business Info - Type Of Activity</p>
<?php if ($_smarty_tpl->tpl_vars['type_of_activity']->value == "Manufacturing") {?>
<span>Manufacturing Products</span>
<?php } elseif ($_smarty_tpl->tpl_vars['type_of_activity']->value == "Retails") {?>
<span>Retails</span>
<?php } elseif ($_smarty_tpl->tpl_vars['type_of_activity']->value == "Service Providers") {?>
<span>Service Providers</span>
<?php } else { ?>
<span>Others</span>
<?php }?>
<p><b>List of Co - Applicant's with Foreach</b></p>
<?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['applicants']->value, 'applicant');
if ($_from !== null) {
foreach ($_from as $_smarty_tpl->tpl_vars['applicant']->value) {
if ($_smarty_tpl->tpl_vars['applicant']->value['name'] > 50) {?>
<h2 style="color:red;"><?php echo $_smarty_tpl->tpl_vars['applicant']->value['name'];?>
</h2>
<h3><?php echo $_smarty_tpl->tpl_vars['applicant']->value['age'];?>
</h3>
<?php } else { ?>
<h2><?php echo $_smarty_tpl->tpl_vars['applicant']->value['name'];?>
</h2>
<h3><?php echo $_smarty_tpl->tpl_vars['applicant']->value['age'];?>
</h3>
<?php }
}
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
<p><b>List of Co - Applicant's With Section</b></p>
<?php
$__section_a_0_loop = (is_array(@$_loop=$_smarty_tpl->tpl_vars['applicants']->value) ? count($_loop) : max(0, (int) $_loop));
$__section_a_0_total = $__section_a_0_loop;
$_smarty_tpl->tpl_vars['__smarty_section_a'] = new Smarty_Variable(array());
if ($__section_a_0_total !== 0) {
for ($__section_a_0_iteration = 1, $_smarty_tpl->tpl_vars['__smarty_section_a']->value['index'] = 0; $__section_a_0_iteration <= $__section_a_0_total; $__section_a_0_iteration++, $_smarty_tpl->tpl_vars['__smarty_section_a']->value['index']++){
?>
<?php echo $_smarty_tpl->tpl_vars['applicants']->value[(isset($_smarty_tpl->tpl_vars['__smarty_section_a']->value['index']) ? $_smarty_tpl->tpl_vars['__smarty_section_a']->value['index'] : null)]['name'];?>
*
<?php echo $_smarty_tpl->tpl_vars['applicants']->value[(isset($_smarty_tpl->tpl_vars['__smarty_section_a']->value['index']) ? $_smarty_tpl->tpl_vars['__smarty_section_a']->value['index'] : null)]['age'];?>
<br/>
<?php
}
}
?>
</body>
</html><?php }
}

View File

@ -1,38 +0,0 @@
<?php
/* Smarty version 3.1.33, created on 2018-12-12 20:25:04
from 'C:\5.6\xampp\htdocs\AWSEC2\sparqapi\api\application\views\report_templates\index.tpl' */
/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
'version' => '3.1.33',
'unifunc' => 'content_5c1121488f21d5_74936089',
'has_nocache_code' => false,
'file_dependency' =>
array (
'b0e5cd66cbc435419cef094f2e45e2c462937187' =>
array (
0 => 'C:\\5.6\\xampp\\htdocs\\AWSEC2\\sparqapi\\api\\application\\views\\report_templates\\index.tpl',
1 => 1544626457,
2 => 'file',
),
),
'includes' =>
array (
),
),false)) {
function content_5c1121488f21d5_74936089 (Smarty_Internal_Template $_smarty_tpl) {
?><html>
<head>
<title>Info</title>
</head>
<body>
Test Article:
Title: <?php echo $_smarty_tpl->tpl_vars['title']->value;?>
Description: <?php echo $_smarty_tpl->tpl_vars['description']->value;?>
<p><?php echo $_smarty_tpl->tpl_vars['Name']->value;?>
</p>
</body>
</html><?php }
}