diff --git a/api/application/config/constants.php b/api/application/config/constants.php
index 37ea2739..983982e0 100644
--- a/api/application/config/constants.php
+++ b/api/application/config/constants.php
@@ -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');
+
diff --git a/api/application/config/routes.php b/api/application/config/routes.php
index 62d739d5..ff4b4666 100644
--- a/api/application/config/routes.php
+++ b/api/application/config/routes.php
@@ -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';
diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php
index b453484f..620a982f 100644
--- a/api/application/controllers/PD_Controller.php
+++ b/api/application/controllers/PD_Controller.php
@@ -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']))
{
diff --git a/api/application/helpers/assessedincome_helper.php b/api/application/helpers/assessedincome_helper.php
index fecd3684..ef68edaa 100644
--- a/api/application/helpers/assessedincome_helper.php
+++ b/api/application/helpers/assessedincome_helper.php
@@ -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 .= "
Gross Margin % | Margin Amount | Gross Profit | ";
$sales_item_wise_header_row .= "Gross Margin % | Gross Profit | ";
}
+
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 .= "";
-
- }
-
- 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 .= "";
+
}
+ // 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);
}
}
?>
\ No newline at end of file
diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php
index 270f6fa8..2c85fa0d 100644
--- a/api/application/models/PD_Model.php
+++ b/api/application/models/PD_Model.php
@@ -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)
{
diff --git a/api/application/views/report_templates/JSONTOREPORT.php b/api/application/views/report_templates/JSONTOREPORT.php
index 0aea4228..b86b8823 100644
--- a/api/application/views/report_templates/JSONTOREPORT.php
+++ b/api/application/views/report_templates/JSONTOREPORT.php
@@ -3165,28 +3165,28 @@ defined('BASEPATH') OR exit('No direct script access allowed');
echo '';
- if(isset($ai_core_details) && count($ai_core_details['sales_items_by_monthwise']))
- {
- echo "
";
- echo '
'.$order_dipaly_array[0].') Kuchha Sales Book/Bills :
';
- foreach($ai_core_details_processed['sales_month_wise_to_display'] as $sale_month_wise)
- {
- // if($sale_month_wise['sales_type'] == 1)
- // {
- echo '
';
- echo 'Item name : ' . $sale_month_wise['sales_item'].'
';
- if($sale_month_wise['sales_type'] == 1)
- {
- echo ''.$sale_month_wise['month_count'].' month sales value : '.$rupee_symbol.''.MYUTIL::customIndianNumberFormat($sale_month_wise['total_months_value']).' Annual Sales value:'.$rupee_symbol.'' .MYUTIL::customIndianNumberFormat(($sale_month_wise['total_months_value'] * (12 / $sale_month_wise['month_count']) )).'';
- }
- else
- {
- echo 'Annual Sales value:'. $rupee_symbol.' '.MYUTIL::customIndianNumberFormat(($sale_month_wise['total_months_value'] )).'';
- }
- }
- array_shift($order_dipaly_array);
- echo '
Detail Available on Annexure A';
- }
+ // if(isset($ai_core_details) && count($ai_core_details['sales_items_by_monthwise']))
+ // {
+ // echo "
";
+ // echo ''.$order_dipaly_array[0].') Kuchha Sales Book/Bills :
';
+ // foreach($ai_core_details_processed['sales_month_wise_to_display'] as $sale_month_wise)
+ // {
+ // // if($sale_month_wise['sales_type'] == 1)
+ // // {
+ // echo '
';
+ // echo 'Item name : ' . $sale_month_wise['sales_item'].'
';
+ // if($sale_month_wise['sales_type'] == 1)
+ // {
+ // echo ''.$sale_month_wise['month_count'].' month sales value : '.$rupee_symbol.''.MYUTIL::customIndianNumberFormat($sale_month_wise['total_months_value']).' Annual Sales value:'.$rupee_symbol.'' .MYUTIL::customIndianNumberFormat(($sale_month_wise['total_months_value'] * (12 / $sale_month_wise['month_count']) )).'';
+ // }
+ // else
+ // {
+ // echo 'Annual Sales value:'. $rupee_symbol.' '.MYUTIL::customIndianNumberFormat(($sale_month_wise['total_months_value'] )).'';
+ // }
+ // }
+ // array_shift($order_dipaly_array);
+ // echo '
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 '';
- echo '| '.($sid['other_sales_item'] != '' ? $sid['other_sales_item'] :$sid['sale_item']).' | '.$sid['sales_qty'].' | '.$sid['uom'].' | '.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($sid['rate_per_unit']).' | '.$sid['frequency'].' | '.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($sid['annual_sale_value']).' | ';
+ echo ''.($sid['other_sales_item'] != '' ? $sid['other_sales_item'] :$sid['sale_item']).' | '.$sid['sales_qty'].' | '.$sid['uom'].' | '. $rate_per_unit .' | '.$sid['frequency'].' | '.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($sid['annual_sale_value']).($sid['sales_type'] == 3 ? ' *' : '').' | ';
if(isset($sid['margin_per'])){echo ''.($sid['margin_per'] != 0 ? $sid['margin_per'] : '-').' | '; }
// if(isset($sid['margin_per_uom'])){echo ''.($sid['margin_per_uom'] != 0? $sid['margin_per_uom'] : '-').' | '; }
- if(isset($sid['margin_final_value'])){echo ''.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($sid['margin_final_value']).' | '; }
+ if(isset($sid['margin_final_value'])){ echo ''.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($sid['margin_final_value']).' | '; }
echo '
';
}
@@ -3299,7 +3299,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
echo '';
array_shift($order_dipaly_array);
}
-
+ echo '
* 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 ''.$order_dipaly_array[0].') Sales Declared By Customer
';
- if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 1)
- {
- echo 'As per person met, the following Purchase details were shared:
';
- }
- else if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 2)
- {
- echo 'As per person met, Purchase details were not shared, income calculated by Net margin percentage.
';
- }
+ // if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 1)
+ // {
+ // echo 'As per person met, the following Purchase details were shared:
';
+ // }
+ // else if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 2)
+ // {
+ // echo 'As per person met, Purchase details were not shared, income calculated by Net margin percentage.
';
+ // }
$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 'As per person met, the following Purchase details were shared:
';
+ }
+ else if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 2)
+ {
+ echo 'As per person met, Purchase details were not shared, income calculated by Net margin percentage.
';
+ }
+
+ echo '
';
+ if(isset($ai_core_details) && count($ai_core_details['purchase_declared_by_customer']))
+ {
+
+ echo ''.$order_dipaly_array[0].') Purchase Declared By Customer
';
+
+
+
+
+ $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 .= '
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 '
';
+ array_shift($order_dipaly_array);
+ }
@@ -3343,7 +3371,8 @@ defined('BASEPATH') OR exit('No direct script access allowed');
echo '';
foreach($ai_core_details_processed['purchase_to_display'] as $dat)
{
- echo ' | '.$dat['material_name'] .' | '.$dat['qty'] .' | '.$dat['uom'] .' | '.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($dat['rate']) .' | '.$dat['frequency'] .' | '.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($dat['annual_value']) .' |
';
+ $rate = $dat['rate'] != 0 && $dat['rate'] != '' ? $rupee_symbol.' '.MYUTIL::customIndianNumberFormat($dat['rate']) : '-';
+ echo ' | '.$dat['material_name'] .' | '.$dat['qty'] .' | '.$dat['uom'] .' | '. $rate .' | '.$dat['frequency'] .' | '.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($dat['annual_value']) .' |
';
}
echo '';
@@ -4031,24 +4060,26 @@ defined('BASEPATH') OR exit('No direct script access allowed');
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 '';
echo ' Annexure A
';
- 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 "
";
echo 'Kuchha Sales Book/Bills Details:
';
- //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 '';
-
- echo 'Item name :
' . $sale_month_wise['sales_item'].'';
- 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 :
' . $sale_month_wise['sale_item'] .'';
+ if($sale_month_wise['sales_type'] == 3)
{
- echo '
'.$sale_month_wise['month_count'].' month sales value :
'.$rupee_symbol.''.MYUTIL::customIndianNumberFormat($sale_month_wise['total_months_value']).' Annual Sales value:
'.$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'] .')';
+ echo '
'.$sale_month_wise['month_count'].' month sales value :
'.$rupee_symbol.''.MYUTIL::customIndianNumberFormat($sale_month_wise['total_months_value']).' Annual Sales value:
'.$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'] .')';
}
else
{
@@ -4079,11 +4110,11 @@ defined('BASEPATH') OR exit('No direct script access allowed');
//echo '
';
echo '';
echo '';
- if($sale_month_wise['sales_type'] == 1)
+ if($sale_month_wise['sales_type'] == 3)
{
echo ' | '.$sale_month_wise['months'][$j]['month_to_dispaly'].' |
';
}
- if($sale_month_wise['sales_type'] == 1)
+ if($sale_month_wise['sales_type'] == 3)
{
echo ' | Date | Value |
';
}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 ' | '.$month['date'] .' | '.$month['value'] .' |
';
$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 ' | '.$month['frequency_name'] .' | '.$month['frequency_value'] .' |
';
- $month_sub_total += $month['frequency_value'];
+ $month_sub_total += $sale_month_wise['annual_sale_value'];
}
}
echo ' | Total | '. MYUTIL::customIndianNumberFormat ( $month_sub_total ) .' |
';
@@ -4124,7 +4155,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
echo '';
echo '';
- //}
+ }
}