NEW AI REPORT CHANGE & DOCS TO COLLECTED

This commit is contained in:
Velz2020 2019-08-14 12:03:21 +05:30
parent 3720d6a2d0
commit fb069743d2
6 changed files with 351 additions and 159 deletions

View File

@ -576,5 +576,8 @@ defined('PDREMARKSID') OR define('PDREMARKSID','pd_remark_id');
defined('PURCHASEDECLAREDBYCUSTOMER') OR define('PURCHASEDECLAREDBYCUSTOMER','t_purchase_declared_by_customer');
defined('PURCHASEDECLAREDBYCUSTOMERID') OR define('PURCHASEDECLAREDBYCUSTOMERID','pdc_id');
defined('PDDOCSTOBECOLLECTED') OR define('PDDOCSTOBECOLLECTED','t_pd_docs_to_be_collected');
defined('PDDOCSTOBECOLLECTEDID') OR define('PDDOCSTOBECOLLECTEDID','pd_doc_to_be_collect_id');

View File

@ -210,6 +210,7 @@ $route['convertBase64'] = 'PD_Controller/convertImgUrlToBase64';
$route['updateNotificationToken'] = 'PD_Controller/updateNotificationToken';
$route['getPDScore'] = 'PD_Controller/getPDScoreForDisplay';
$route['savePDRemark'] = 'PD_Controller/savePDRemark';
$route['savePDDocsToBeCollected'] = 'PD_Controller/savePDDocsToBeCollected';
// $route['savePDFormDetailsJSON'] = 'PD_Controller/savePDFormDetailsJSON';
// $route['getPDFormDetailsJSON'] = 'PD_Controller/getPDFormDetailsJSON';

View File

@ -331,6 +331,7 @@ class PD_Controller extends REST_Controller {
// $pd_details['pd_status'] = TRIGGERED;
$pd_addtional_requirements = array();
$docs_to_be_collected = array();
unset($pd_details['createdon']);
$addresses = array();
$company = array();
@ -339,6 +340,11 @@ class PD_Controller extends REST_Controller {
$pd_addtional_requirements = json_decode($this->post('addtional_requirements'),true);
}
if($this->post('docs_to_be_collected'))
{
$docs_to_be_collected = json_decode($this->post('docs_to_be_collected'),true);
}
if($this->post('addresses'))
{
$addresses = json_decode($this->post('addresses'),true);
@ -617,6 +623,15 @@ class PD_Controller extends REST_Controller {
$this->PD_Model->saveRecords($pd_addtional_requirement,PDADDTIONALREQUIREMENTS);
}
}
if(count($docs_to_be_collected))
{
foreach($docs_to_be_collected as $docs_to_be_collected_key => $docs_to_be_collect)
{
$docs_to_be_collect['fk_pd_id'] = $pd_id;
$this->PD_Model->saveRecords($docs_to_be_collect,PDDOCSTOBECOLLECTED);
}
}
$temp_address_id = null;
@ -723,6 +738,47 @@ class PD_Controller extends REST_Controller {
}
}
public function savePDDocsToBeCollected_post()
{
$records = $this->post('records');
$docs_to_be_collected = $records['docs_to_be_collected'];
$count = 0;
if(count($docs_to_be_collected))
{
foreach($docs_to_be_collected as $pd_doc_key => $pd_doc_requirement)
{
if($pd_doc_requirement['pd_doc_to_be_collect_id'] != null || $pd_doc_requirement['pd_doc_to_be_collect_id'] != "")
{
$where_condition_array = array('pd_doc_to_be_collect_id' => $pd_doc_requirement['pd_doc_to_be_collect_id']);
$pk_id = $this->PD_Model->updateRecords($pd_doc_requirement,PDDOCSTOBECOLLECTED,$where_condition_array);
if($pk_id != "" || $pk_id != null){ $count++; }
}
else
{
$pd_doc_requirement['fk_pd_id'] = $records['pdid'];
$pk_id = $this->PD_Model->saveRecords($pd_doc_requirement,PDDOCSTOBECOLLECTED);
if($pk_id != "" || $pk_id != null){ $count++; }
}
}
}
if($count != 0 && $count == count($docs_to_be_collected))
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = true;
$this->response($data,REST_Controller::HTTP_OK);
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
$data['msg'] = "Some thing went wrong";
$this->response($data,REST_Controller::HTTP_OK);
}
}
/*
*
@ -1871,6 +1927,9 @@ class PD_Controller extends REST_Controller {
//Get Addtional Requirements details
$result_data['pd_additional_requirements'] = $this->PD_Model->getPDAdditionalRequirements($pdid);
//Get Docs to be collected array
$result_data['docs_to_be_collected'] = $this->PD_Model->getDocsToBeCollected($pdid);
//Get All PD Logs
$result_data['pd_logs'] = $this->PD_Model->getPDLogs($pdid);
//print_r($result_data['pd_logs']);die();
@ -3068,6 +3127,7 @@ class PD_Controller extends REST_Controller {
$result_array['final_data'] = array();
$fine = $this->calculateAssessedIncome($pd_id,$company_id);
//print_r($fine);die();
//print_r($fine);die();
if($fine != null)
{
$fine['purchase_declared_by_customer'] = $result_array['purchase_declared_by_customer'];
@ -3869,7 +3929,7 @@ class PD_Controller extends REST_Controller {
foreach($purchases as $purchase_key => $purchase)
{
$overall_purchase_total += $purchase['purchase_type'] != 3 ? $purchase['annual_purchase_value'] : ($purchase['annual_purchase_value'] * (12/ count($purchase['items'])) );
$overall_purchase_total += $purchase['annual_purchase_value'];
}
// }
// else if($gross_profit_calculation_type[0]['mode'] == 1 && $gross_profit_calculation_type[0]['purchase_type'] == 2)////purchase bill wise
@ -3898,63 +3958,63 @@ class PD_Controller extends REST_Controller {
{
//print_r($item);die();
if($item['sales_type'] != 3)
{
// if($item['sales_type'] != 3)
// {
$total_sales_itemwise = $total_sales_itemwise + $item['annual_sale_value'];
$temp_netprofit = $temp_netprofit + $item['margin_final_value'];
}
else
{
//*****************************
// foreach($sales_by_item_monthwise as $monthwise_key => $sales_by_item_month)
// {
//print_r($sales_by_item_month['items']);
//echo isset($sales_by_item_month['items']);die();
// }
// else
// {
// //*****************************
// // foreach($sales_by_item_monthwise as $monthwise_key => $sales_by_item_month)
// // {
// //print_r($sales_by_item_month['items']);
// //echo isset($sales_by_item_month['items']);die();
$temp_netprofit = $temp_netprofit + $item['margin_final_value'];
if(isset($item['items']))
{
//echo 'insdie if';
foreach($item['items'] as $month_key => $month)
{
$temp = 0;
// $temp_netprofit = $temp_netprofit + $item['margin_final_value'];
// if(isset($item['items']))
// {
// //echo 'insdie if';
// foreach($item['items'] as $month_key => $month)
// {
// $temp = 0;
$i++;
foreach($month as $key => $m)
{
$temp = $temp + $m['sales_value'];
}
$month_total = $month_total + $temp;
}
}
// $i++;
// foreach($month as $key => $m)
// {
// $temp = $temp + $m['sales_value'];
// }
// $month_total = $month_total + $temp;
// }
// }
//die();
$sales_monthwise[] = array('total' => $month_total,'no_of_months' => $i,'sales_type' => $item['sales_type']);
//}
// //die();
// $sales_monthwise[] = array('total' => $month_total,'no_of_months' => $i,'sales_type' => $item['sales_type']);
// //}
//print_r($sales_monthwise);die();
$total_sales_monthwise = 0;
foreach($sales_monthwise as $sale)
{
// //print_r($sales_monthwise);die();
// $total_sales_monthwise = 0;
// foreach($sales_monthwise as $sale)
// {
$annual_multuplier = 12 / ( $sale['no_of_months'] ? $sale['no_of_months'] : 1);
// $annual_multuplier = 12 / ( $sale['no_of_months'] ? $sale['no_of_months'] : 1);
if($sale['sales_type'] == 1)
{
$total_sales_monthwise = $total_sales_monthwise + ($sale['total'] * $annual_multuplier);
}
else if($sale['sales_type'] == 2)
{
$total_sales_monthwise = $total_sales_monthwise + $sale['total'];
}
}
//*****************************
}
// if($sale['sales_type'] == 1)
// {
// $total_sales_monthwise = $total_sales_monthwise + ($sale['total'] * $annual_multuplier);
// }
// else if($sale['sales_type'] == 2)
// {
// $total_sales_monthwise = $total_sales_monthwise + $sale['total'];
// }
// }
// //*****************************
// }
}
$total_sales_monthwise = 0;
//calculatin part
@ -3963,7 +4023,7 @@ class PD_Controller extends REST_Controller {
$temp_purchases = $overall_purchase_total;
$temp_grossprofit = ($total_sales_itemwise + $total_sales_monthwise) - $temp_purchases;
$temp_netprofit = $temp_grossprofit - $overall_business_expenses_total;
$temp_netmargin = ($temp_netprofit/ ($total_sales_itemwise + $total_sales_monthwise) ? ($total_sales_itemwise + $total_sales_monthwise): 1) * 100;
$temp_netmargin = ($temp_netprofit/ ($total_sales_itemwise + $total_sales_monthwise)) * 100;
}
else
{
@ -4069,7 +4129,7 @@ class PD_Controller extends REST_Controller {
// }
if($sales_declared_by_customer_flag == 1 && $purchase_declared_by_customer_flag == 1)
if($sales_declared_by_customer_flag == 1)
{
$temp_purchases = 0;
@ -4077,11 +4137,14 @@ class PD_Controller extends REST_Controller {
$temp_grossprofit = 0;
$temp_netmargin = 0;
$total_sales_declared_by_customer = $sales_declared_by_customer[0]['sales_declared_by_customer'];
$total_purchase_declared_by_customer = $purchase_declared_by_customer[0]['purchase_declared_by_customer'];
$temp_netprofit = $sales_declared_by_customer[0]['margin_value'];
if($gross_profit_calculation_type[0]['mode'] == 1)
{
$total_purchase_declared_by_customer = $purchase_declared_by_customer[0]['purchase_declared_by_customer'];
$temp_purchases = $total_purchase_declared_by_customer;
$temp_grossprofit = $total_sales_declared_by_customer - $temp_purchases;
$temp_netprofit = $temp_grossprofit - $overall_business_expenses_total;
@ -5336,6 +5399,7 @@ class PD_Controller extends REST_Controller {
}
function demo($var) {
echo " Before try block";
try {
@ -5389,9 +5453,8 @@ class PD_Controller extends REST_Controller {
// die();
//$this->demo(5);
// $this->demo(0);
// die();
//$this->demo(0);
$is_regenerate = 0;
if(isset($records['regenerate']))
{

View File

@ -163,7 +163,7 @@ class AssessedIncome
$temp['qty'] = $purchase['purchase_qty'] != 0 ? $purchase['purchase_qty'] : '-';
$temp['uom'] = $purchase['uom_name'] != "" ? $purchase['uom_name'] : '-';
$temp['rate'] = $purchase['rate_per_unit'];
$temp['frequency'] = $purchase['frequency_name'];
$temp['frequency'] = $purchase['frequency_name'] ? $purchase['frequency_name'] : '-';
$temp['annual_value'] = $purchase['annual_purchase_value'];
array_push($purchase_to_display,$temp);
@ -202,6 +202,8 @@ class AssessedIncome
//return $purchase_to_display;
}
//print_r($ai_core_details['sales_calculated_by_itemwise']);die();
// Get Sales Itemwise
if(count($ai_core_details['sales_calculated_by_itemwise']))
{
@ -212,45 +214,34 @@ class AssessedIncome
//$sales_item_wise_header_row .= "<th>Gross Margin %</th><th>Margin Amount</th><th>Gross Profit</th>";
$sales_item_wise_header_row .= "<th>Gross Margin %</th><th>Gross Profit</th>";
}
foreach($ai_core_details['sales_calculated_by_itemwise'] as $itemwise)
{
$temp['sale_item'] = $itemwise['sales_item'];
$temp['sale_item'] = strcasecmp($itemwise['sales_item'],'others') ? $itemwise['sales_item'] : $itemwise['other_sales_item'];
$temp['sales_qty'] = $itemwise['sales_qty'] != 0 ? $itemwise['sales_qty']: '-';
$temp['uom'] = $itemwise['uom_name'] ? $itemwise['uom_name'] : '-';
$temp['frequency'] = $itemwise['frequency_name'];
$temp['frequency'] = $itemwise['frequency_name'] ? $itemwise['frequency_name'] : '-';
$temp['annual_sale_value'] = $itemwise['annual_sale_value'];
$temp['rate_per_unit'] = $itemwise['rate_per_unit'];
$temp['other_sales_item'] = $itemwise['other_sales_item'];
if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 2)
$temp['sales_type'] = $itemwise['sales_type'];
if($itemwise['sales_type'] == 3)// || $itemwise['sales_type'] == 2)
{
$temp['margin_per'] = $itemwise['margin_per'];
$temp['margin_per_uom'] = $itemwise['margin_per_uom'];
$temp['margin_final_value'] = $itemwise['margin_final_value'];
}
array_push($sales_item_wise_to_diaplay,$temp);
}
$sales_item_wise_header_row .= "</tr>";
}
if(count($ai_core_details['sales_items_by_monthwise']))
{
foreach($ai_core_details['sales_items_by_monthwise'] as $simwk => $sale_item)
{
$x['month_count'] = count($sale_item['items']);
$x['margin_value'] =$sale_item['margin_value'];
$x['margin_per'] =$sale_item['margin_per'];
$x['sales_item'] = strcasecmp($sale_item['sales_item'],'others') ? $sale_item['sales_item'] : $sale_item['other_sales_item'];
$x['sales_type'] = $sale_item['sales_type'];
$x['months'] = array();
if($sale_item['sales_type'] == 1)
//$temp['month_items'] = $itemwise['items'];
$temp['month_count'] = count($itemwise['items']);
if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 2)
{
$temp['margin_value'] =$itemwise['margin_value'];
$temp['margin_per'] =$itemwise['margin_per'];
}
$temp['sales_type'] = $itemwise['sales_type'];
$temp['months'] = array();
// if($itemwise['sales_type'] == 3)
// {
$total_month_value = 0;
foreach($sale_item['items'] as $item_key => $month_item)
foreach($itemwise['items'] as $item_key => $month_item)
{
$z['month_to_dispaly'] = $item_key;
$z['month_data'] = array();
@ -261,39 +252,133 @@ class AssessedIncome
array_push($z['month_data'],array('date' => date_format(date_create($item['sales_date']),'d-m-Y'),'value' => $item['sales_value']));
}
array_push($x['months'],$z);
array_push($temp['months'],$z);
}
$x['total_months_value'] = $total_month_value;
array_push($sales_month_wise_to_display,$x);
}else
{
//print_r($sale_item);
$total_month_value = 0;
$multiple_factor = 0;
foreach($sale_item['items'] as $item_key => $month_item)
{
$t['month_to_dispaly'] = $item_key;
$t['month_data'] = array();
$temp['total_months_value'] = $total_month_value;
//array_push($temp,$x);
//}
//else
// {
// //print_r($sale_item);
// //echo "AAAAA";die();
// $total_month_value = 0;
// $multiple_factor = 0;
// foreach($sale_item['items'] as $item_key => $month_item)
// {
// $t['month_to_dispaly'] = $item_key;
// $t['month_data'] = array();
foreach($month_item as $item)
{
$total_month_value += $item['sales_value'];
$multiple_factor = $item['mutiple_factor'];
array_push($t['month_data'],array('frequency_value' => $item['frequency_value'],'value' => $item['sales_value'],'frequency_name' => $item['frequency_name'],'multiple_factor'=> $item['mutiple_factor']));
// foreach($month_item as $item)
// {
// $total_month_value += $item['sales_value'];
// $multiple_factor = $item['mutiple_factor'];
// array_push($t['month_data'],array('frequency_value' => $item['frequency_value'],'value' => $item['sales_value'],'frequency_name' => $item['frequency_name'],'multiple_factor'=> $item['mutiple_factor']));
}
array_push($x['months'],$t);
}
$x['total_months_value'] = $total_month_value;
$x['annual_sale_value'] = ($total_month_value * $multiple_factor);
array_push($sales_month_wise_to_display,$x);
}
// }
// array_push($x['months'],$t);
// }
// $x['total_months_value'] = $total_month_value;
// $x['annual_sale_value'] = ($total_month_value * $multiple_factor);
// array_push($temp,$x);
// }
}
else if($itemwise['sales_type'] == 2)
{
//print_r($itemwise);die();
//$temp['month_count'] = count($itemwise['items']);
// $temp['margin_value'] = $itemwise['margin_value'];
// $temp['margin_per'] = $itemwise['margin_per'];
//$temp['sales_item'] = strcasecmp($itemwise['sales_item'],'others') ? $sale_item['sales_item'] : $sale_item['other_sales_item'];
$temp['sales_type'] = $itemwise['sales_type'];
$temp['months'] = array();
$z['month_data'] = array();
$total_month_value = $itemwise['annual_sale_value'];
array_push($z['month_data'],array('frequency_name' => $itemwise['frequency_name'],'frequency_value' => $itemwise['rate_per_unit']));
array_push($temp['months'],$z);
$temp['total_months_value'] = $total_month_value;
//array_push($temp,$x);
}
if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 2)
{
$temp['margin_per'] = $itemwise['margin_per'] ? $itemwise['margin_per'] : '-';
$temp['margin_per_uom'] = $itemwise['margin_per_uom'] ? $itemwise['margin_per_uom'] : '-';
$temp['margin_final_value'] = $itemwise['margin_final_value'] ? $itemwise['margin_final_value'] : '-';
}
array_push($sales_item_wise_to_diaplay,$temp);
}
$sales_item_wise_header_row .= "</tr>";
}
// if(count($ai_core_details['sales_items_by_monthwise']))
// {
// foreach($ai_core_details['sales_items_by_monthwise'] as $simwk => $sale_item)
// {
// $x['month_count'] = count($sale_item['items']);
// $x['margin_value'] =$sale_item['margin_value'];
// $x['margin_per'] =$sale_item['margin_per'];
// $x['sales_item'] = strcasecmp($sale_item['sales_item'],'others') ? $sale_item['sales_item'] : $sale_item['other_sales_item'];
// $x['sales_type'] = $sale_item['sales_type'];
// $x['months'] = array();
// if($sale_item['sales_type'] == 1)
// {
// $total_month_value = 0;
// foreach($sale_item['items'] as $item_key => $month_item)
// {
// $z['month_to_dispaly'] = $item_key;
// $z['month_data'] = array();
// foreach($month_item as $item)
// {
// $total_month_value += $item['sales_value'];
// array_push($z['month_data'],array('date' => date_format(date_create($item['sales_date']),'d-m-Y'),'value' => $item['sales_value']));
// }
// array_push($x['months'],$z);
// }
// $x['total_months_value'] = $total_month_value;
// array_push($sales_month_wise_to_display,$x);
// }else
// {
// //print_r($sale_item);
// $total_month_value = 0;
// $multiple_factor = 0;
// foreach($sale_item['items'] as $item_key => $month_item)
// {
// $t['month_to_dispaly'] = $item_key;
// $t['month_data'] = array();
// foreach($month_item as $item)
// {
// $total_month_value += $item['sales_value'];
// $multiple_factor = $item['mutiple_factor'];
// array_push($t['month_data'],array('frequency_value' => $item['frequency_value'],'value' => $item['sales_value'],'frequency_name' => $item['frequency_name'],'multiple_factor'=> $item['mutiple_factor']));
// }
// array_push($x['months'],$t);
// }
// $x['total_months_value'] = $total_month_value;
// $x['annual_sale_value'] = ($total_month_value * $multiple_factor);
// array_push($sales_month_wise_to_display,$x);
// }
// }
// }
if(count($ai_core_details['business_expenses']))
{
@ -320,11 +405,11 @@ class AssessedIncome
}
//print_r($sales_month_wise_to_display);
//die();
// print_r($sales_month_wise_to_display);
// die();
return array('purchase_to_display' => $purchase_to_display,'sales_item_wise_to_diaplay' => $sales_item_wise_to_diaplay,'sales_calculated_by_itemwise_header' => $sales_item_wise_header_row,'sales_month_wise_to_display' => $sales_month_wise_to_display,'business_expenses_to_diaplay' => $business_expenses_to_diaplay,'household_expenses_to_diaplay' => $household_expenses_to_diaplay);
return array('purchase_to_display' => $purchase_to_display,'sales_item_wise_to_diaplay' => $sales_item_wise_to_diaplay,'sales_calculated_by_itemwise_header' => $sales_item_wise_header_row,'business_expenses_to_diaplay' => $business_expenses_to_diaplay,'household_expenses_to_diaplay' => $household_expenses_to_diaplay);
}
}
?>

View File

@ -870,6 +870,15 @@ class PD_Model extends SPARQ_Model {
$this->db->WHERE('fk_pd_id',$pdid);
return $this->db->GET()->result_array();
}
public function getDocsToBeCollected($pdid)
{
$this->db->SELECT('pd_doc_to_be_collect_id, doc_name, isactive, fk_pd_id');
$this->db->FROM(PDDOCSTOBECOLLECTED);
$this->db->WHERE('isactive',1);
$this->db->WHERE('fk_pd_id',$pdid);
return $this->db->GET()->result_array();
}
public function getTemplateForPD($pdid,$client,$random_string)
{

View File

@ -3165,28 +3165,28 @@ defined('BASEPATH') OR exit('No direct script access allowed');
echo '<p style="text-align:justify;">';
if(isset($ai_core_details) && count($ai_core_details['sales_items_by_monthwise']))
{
echo "<br>";
echo '<p contenteditable="true">'.$order_dipaly_array[0].') Kuchha Sales Book/Bills : </p>';
foreach($ai_core_details_processed['sales_month_wise_to_display'] as $sale_month_wise)
{
// if($sale_month_wise['sales_type'] == 1)
// {
echo '<br><br>';
echo 'Item name : <b>' . $sale_month_wise['sales_item'].'</b><br>';
if($sale_month_wise['sales_type'] == 1)
{
echo '<b>'.$sale_month_wise['month_count'].'</b> month sales value : <b>'.$rupee_symbol.''.MYUTIL::customIndianNumberFormat($sale_month_wise['total_months_value']).'</b> Annual Sales value:<b>'.$rupee_symbol.'' .MYUTIL::customIndianNumberFormat(($sale_month_wise['total_months_value'] * (12 / $sale_month_wise['month_count']) )).'</b>';
}
else
{
echo 'Annual Sales value:<b>'. $rupee_symbol.' '.MYUTIL::customIndianNumberFormat(($sale_month_wise['total_months_value'] )).'</b>';
}
}
array_shift($order_dipaly_array);
echo '<br><br>Detail Available on Annexure A';
}
// if(isset($ai_core_details) && count($ai_core_details['sales_items_by_monthwise']))
// {
// echo "<br>";
// echo '<p contenteditable="true">'.$order_dipaly_array[0].') Kuchha Sales Book/Bills : </p>';
// foreach($ai_core_details_processed['sales_month_wise_to_display'] as $sale_month_wise)
// {
// // if($sale_month_wise['sales_type'] == 1)
// // {
// echo '<br><br>';
// echo 'Item name : <b>' . $sale_month_wise['sales_item'].'</b><br>';
// if($sale_month_wise['sales_type'] == 1)
// {
// echo '<b>'.$sale_month_wise['month_count'].'</b> month sales value : <b>'.$rupee_symbol.''.MYUTIL::customIndianNumberFormat($sale_month_wise['total_months_value']).'</b> Annual Sales value:<b>'.$rupee_symbol.'' .MYUTIL::customIndianNumberFormat(($sale_month_wise['total_months_value'] * (12 / $sale_month_wise['month_count']) )).'</b>';
// }
// else
// {
// echo 'Annual Sales value:<b>'. $rupee_symbol.' '.MYUTIL::customIndianNumberFormat(($sale_month_wise['total_months_value'] )).'</b>';
// }
// }
// array_shift($order_dipaly_array);
// echo '<br><br>Detail Available on Annexure A';
// }
// if(isset($ai_core_details) && count($ai_core_details['sales_items_by_monthwise']))
@ -3285,13 +3285,13 @@ defined('BASEPATH') OR exit('No direct script access allowed');
foreach($ai_core_details_processed['sales_item_wise_to_diaplay'] as $sid)
{
//print_r($sid);
$rate_per_unit = ($sid['rate_per_unit'] != 0 && $sid['rate_per_unit'] != '' ? $rupee_symbol.' '.MYUTIL::customIndianNumberFormat($sid['rate_per_unit']) : '-');
echo '<tr>';
echo '<td>'.($sid['other_sales_item'] != '' ? $sid['other_sales_item'] :$sid['sale_item']).'</td><td class="customtd">'.$sid['sales_qty'].'</td><td class="customtd">'.$sid['uom'].'</td><td class="customtd">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($sid['rate_per_unit']).'</td><td class="customtd">'.$sid['frequency'].'</td><td class="customtd">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($sid['annual_sale_value']).'</td>';
echo '<td>'.($sid['other_sales_item'] != '' ? $sid['other_sales_item'] :$sid['sale_item']).'</td><td class="customtd">'.$sid['sales_qty'].'</td><td class="customtd">'.$sid['uom'].'</td><td class="customtd">'. $rate_per_unit .'</td><td class="customtd">'.$sid['frequency'].'</td><td class="customtd">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($sid['annual_sale_value']).($sid['sales_type'] == 3 ? ' *' : '').'</td>';
if(isset($sid['margin_per'])){echo '<td class="customtd">'.($sid['margin_per'] != 0 ? $sid['margin_per'] : '-').'</td>'; }
// if(isset($sid['margin_per_uom'])){echo '<td class="customtd">'.($sid['margin_per_uom'] != 0? $sid['margin_per_uom'] : '-').'</td>'; }
if(isset($sid['margin_final_value'])){echo '<td class="customtd">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($sid['margin_final_value']).'</td>'; }
if(isset($sid['margin_final_value'])){ echo '<td class="customtd">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($sid['margin_final_value']).'</td>'; }
echo '</tr>';
}
@ -3299,7 +3299,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
echo '</table>';
array_shift($order_dipaly_array);
}
echo '<br>* Assessed From Kuchha Records, Details Available in Annexure A';
if(isset($ai_core_details) && count($ai_core_details['sales_declared_by_customer']))
@ -3307,14 +3307,14 @@ defined('BASEPATH') OR exit('No direct script access allowed');
echo '<p contenteditable="true">'.$order_dipaly_array[0].') Sales Declared By Customer</p>';
if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 1)
{
echo '<p style="text-align:justify;">As per person met, the following Purchase details were shared:</p>';
}
else if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 2)
{
echo '<p>As per person met, Purchase details were not shared, income calculated by Net margin percentage.</p>';
}
// if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 1)
// {
// echo '<p style="text-align:justify;">As per person met, the following Purchase details were shared:</p>';
// }
// else if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 2)
// {
// echo '<p>As per person met, Purchase details were not shared, income calculated by Net margin percentage.</p>';
// }
$str = 'As per person met, '.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($ai_core_details['sales_declared_by_customer'][0]['sales_declared_by_customer']).' ( '.MYUTIL::numtowords($ai_core_details['sales_declared_by_customer'][0]['sales_declared_by_customer']).' ) declared as annual sale value.';
@ -3328,6 +3328,34 @@ defined('BASEPATH') OR exit('No direct script access allowed');
array_shift($order_dipaly_array);
}
if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 1)
{
echo '<p style="text-align:justify;">As per person met, the following Purchase details were shared:</p>';
}
else if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 2)
{
echo '<p>As per person met, Purchase details were not shared, income calculated by Net margin percentage.</p>';
}
echo '<br>';
if(isset($ai_core_details) && count($ai_core_details['purchase_declared_by_customer']))
{
echo '<p contenteditable="true">'.$order_dipaly_array[0].') Purchase Declared By Customer</p>';
$str = 'As per person met, '.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($ai_core_details['purchase_declared_by_customer'][0]['purchase_declared_by_customer']).' ( '.MYUTIL::numtowords($ai_core_details['purchase_declared_by_customer'][0]['purchase_declared_by_customer']).' ) declared as annual purchase value.';
// if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 2)
// {
// $str .= '<br>and '.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($ai_core_details['sales_declared_by_customer'][0]['margin_value']).' ( '.MYUTIL::numtowords( $ai_core_details['sales_declared_by_customer'][0]['margin_value']).' )'.'( '.$ai_core_details['sales_declared_by_customer'][0]['margin_per'].'% sales declared ) as net margin amount.';
// }
echo $str;
echo '</p><br>';
array_shift($order_dipaly_array);
}
@ -3343,7 +3371,8 @@ defined('BASEPATH') OR exit('No direct script access allowed');
echo '<tbody>';
foreach($ai_core_details_processed['purchase_to_display'] as $dat)
{
echo '<tr> <td>'.$dat['material_name'] .'</td> <td class="customtd">'.$dat['qty'] .'</td> <td class="customtd">'.$dat['uom'] .'</td> <td class="customtd">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($dat['rate']) .'</td> <td class="customtd">'.$dat['frequency'] .'</td> <td class="customtd">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($dat['annual_value']) .'</td> </tr>';
$rate = $dat['rate'] != 0 && $dat['rate'] != '' ? $rupee_symbol.' '.MYUTIL::customIndianNumberFormat($dat['rate']) : '-';
echo '<tr> <td>'.$dat['material_name'] .'</td> <td class="customtd">'.$dat['qty'] .'</td> <td class="customtd">'.$dat['uom'] .'</td> <td class="customtd">'. $rate .'</td> <td class="customtd">'.$dat['frequency'] .'</td> <td class="customtd">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($dat['annual_value']) .'</td> </tr>';
}
echo '</tbody>';
@ -4031,24 +4060,26 @@ defined('BASEPATH') OR exit('No direct script access allowed');
<?php if($total_no_of_business > 0) {
for($business_count = 0;$business_count < $total_no_of_business; $business_count++)
{
if(is_array($assessed_income_details) && count($assessed_income_details) && isset($assessed_income_details[ ($business_count+1) ] ) && count($ai_core_details['sales_items_by_monthwise']))
if(is_array($assessed_income_details) && count($assessed_income_details) && isset($assessed_income_details[ ($business_count+1) ] ) && count($ai_core_details['sales_calculated_by_itemwise']))
{
echo '<div id="page_break"></div>';
echo '<p> Annexure A</p>';
if(isset($ai_core_details) && count($ai_core_details['sales_items_by_monthwise']))
if(isset($ai_core_details) && count($ai_core_details['sales_calculated_by_itemwise']))
{
//echo "<br>";
echo '<p contenteditable="true">Kuchha Sales Book/Bills Details: </p>';
//print_r($ai_core_details_processed['sales_month_wise_to_display']);die();
foreach($ai_core_details_processed['sales_month_wise_to_display'] as $sale_month_wise)
//print_r($ai_core_details_processed['sales_item_wise_to_diaplay']);//die();
foreach($ai_core_details_processed['sales_item_wise_to_diaplay'] as $sale_month_wise)
{
//echo '<div id="billwise">';
echo 'Item name : <b>' . $sale_month_wise['sales_item'].'</b><br>';
if($sale_month_wise['sales_type'] == 1)
if($sale_month_wise['sales_type'] == 3 || $sale_month_wise['sales_type'] == 2)
{
//print_r($sale_month_wise);//die();
echo 'Item name : <b>' . $sale_month_wise['sale_item'] .'</b><br>';
if($sale_month_wise['sales_type'] == 3)
{
echo '<b>'.$sale_month_wise['month_count'].'</b> month sales value : <b>'.$rupee_symbol.''.MYUTIL::customIndianNumberFormat($sale_month_wise['total_months_value']).'</b> Annual Sales value:<b>'.$rupee_symbol.'' .MYUTIL::customIndianNumberFormat(($sale_month_wise['total_months_value'] * (12 / $sale_month_wise['month_count']) )).' (i.e. ' . (12 / $sale_month_wise['month_count']).' * '. $sale_month_wise['total_months_value'] .')</b>';
echo '<b>'.$sale_month_wise['month_count'].'</b> month sales value : <b>'.$rupee_symbol.''.MYUTIL::customIndianNumberFormat($sale_month_wise['total_months_value']).'</b> Annual Sales value:<b>'.$rupee_symbol.'' .MYUTIL::customIndianNumberFormat(($sale_month_wise['total_months_value'] * (12 / $sale_month_wise['month_count']) )).' (i.e. ' . (12 / $sale_month_wise['month_count']).' * '. $sale_month_wise['total_months_value'] .')</b>';
}
else
{
@ -4079,11 +4110,11 @@ defined('BASEPATH') OR exit('No direct script access allowed');
//echo '<table class="annexure_table">';
echo '<table class="annexure_table">';
echo '<thead>';
if($sale_month_wise['sales_type'] == 1)
if($sale_month_wise['sales_type'] == 3)
{
echo '<tr> <th colspan="2">'.$sale_month_wise['months'][$j]['month_to_dispaly'].'</th> </tr>';
}
if($sale_month_wise['sales_type'] == 1)
if($sale_month_wise['sales_type'] == 3)
{
echo '<tr> <th>Date</th> <th>Value</th></tr>';
}else if(($sale_month_wise['sales_type'] == 2))
@ -4098,7 +4129,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
foreach($sale_month_wise['months'][$j]['month_data'] as $m_key => $month)
{
if($sale_month_wise['sales_type'] == 1)
if($sale_month_wise['sales_type'] == 3)
{
echo '<tr> <td>'.$month['date'] .'</td> <td>'.$month['value'] .'</td> </tr>';
$month_sub_total += $month['value'];
@ -4107,7 +4138,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
else if($sale_month_wise['sales_type'] == 2)
{
echo '<tr> <td>'.$month['frequency_name'] .'</td> <td>'.$month['frequency_value'] .'</td> </tr>';
$month_sub_total += $month['frequency_value'];
$month_sub_total += $sale_month_wise['annual_sale_value'];
}
}
echo '<tr> <th> Total </th> <th>'. MYUTIL::customIndianNumberFormat ( $month_sub_total ) .'</th> </tr>';
@ -4124,7 +4155,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
echo '</div>';
echo '</div>';
//}
}
}