diff --git a/api/application/config/autoload.php b/api/application/config/autoload.php
index a5e66d26..208b07bb 100644
--- a/api/application/config/autoload.php
+++ b/api/application/config/autoload.php
@@ -89,7 +89,7 @@ $autoload['drivers'] = array();
|
| $autoload['helper'] = array('url', 'file');
*/
-$autoload['helper'] = array('url','file','form', 'jwt', 'authorization', 'date','mylog','myocr','mydb','pdalerts','myutil','myhttpclient','pdscore','businessform','otherincomeform','financialform','neighbourreferencecheckform', 'otherfamilyform', 'assetsform','stockform', 'bankingform','sms_gupshup');
+$autoload['helper'] = array('url','file','form', 'jwt', 'authorization', 'date','mylog','myocr','mydb','pdalerts','myutil','myhttpclient','pdscore','businessform','otherincomeform','financialform','neighbourreferencecheckform', 'otherfamilyform', 'assetsform','stockform', 'bankingform','sms_gupshup','assessedincome');
/*
| -------------------------------------------------------------------
diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php
index b86ee58b..c3f33342 100644
--- a/api/application/controllers/PD_Controller.php
+++ b/api/application/controllers/PD_Controller.php
@@ -710,7 +710,7 @@ class PD_Controller extends REST_Controller {
$pd_details['random_string'] = $randomString;
- $url = 'https://ssa.sineedge.com/ot/#/officertracking/'.$randomString;
+ $url = 'https://ssa.sineedge.com/officertracking/#/officertracking/'.$randomString;
/* $ch = curl_init();
$timeout = 5;
$url = 'https://ssa.sineedge.com/ot/#/officertracking/'.$randomString;
@@ -785,9 +785,9 @@ class PD_Controller extends REST_Controller {
}
- print_r($pd_details);
+ //print_r($pd_details);
}
- die();
+ //die();
if(isset($pd_details['pd_status']) && ($pd_details['pd_status'] == TRIGGERED || $pd_details['pd_status'] == INITIATED))
{
@@ -3932,6 +3932,7 @@ class PD_Controller extends REST_Controller {
$data['score_questions_display'] = $this->PD_Model->getScoreableQuestionToDispaly($pdid);
$data['pd_score'] = $this->calculateScore($pdid);
$data['dsc_cards'] = $this->getDetailedScoreCardChart( $data['pd_score'] );
+ $data['assessed_income_details'] = $this->getAssessedIncomeForPDReport($pdid);
$score_for_chart = $data['pd_score']['score_summary']['overall_score']['final_score'] ? round($data['pd_score']['score_summary']['overall_score']['final_score'],2) : 0;
//echo $score_for_chart;
@@ -4698,26 +4699,31 @@ class PD_Controller extends REST_Controller {
function getSatelliteImage($pd_id)
{
$pdid = $pd_id;
+ $logger = MYLOG::logFunction();
$pdmas = $this->PD_Model->getPDMasterDetails($pdid);
- print_r($pdmas);
+ //print_r($pdmas);
//load satellite script from db
- $satellite_script_from_db = $this->PD_Model->selectCustomRecords(array('*'),array('script_name' => 'phantomsatellite_local'),SCRIPTS);
- //$satellite_script_from_db = $this->PD_Model->selectCustomRecords(array('*'),array('script_name' => SATELLITE_IMAGE_LOCATION),SCRIPTS);
+ //$satellite_script_from_db = $this->PD_Model->selectCustomRecords(array('*'),array('script_name' => 'phantomsatellite_local'),SCRIPTS);
+
+ $satellite_script_from_db = $this->PD_Model->selectCustomRecords(array('*'),array('script_name' => SATELLITE_IMAGE_LOCATION),SCRIPTS);
$satellite_script = $satellite_script_from_db[0]['script_content'];
//Get Address Data
- echo $pdmas[0]['addressline1'];
- $address = $pdmas[0]['addressline1'].','.$pdmas[0]['city_name'].','.$pdmas[0]['state_name'];
- echo $address;
+
+ $address = preg_replace("/[\n\r]/","",$pdmas[0]['addressline1']);
+
+ $address = $address.','.$pdmas[0]['city_name'].','.$pdmas[0]['state_name'];
+
//Replacing space with + symbol
$address =str_replace(' ','+',$address);
- $address =str_replace('\n','+',$address);
+ $address =str_replace('\n','',$address);
+ $address =str_replace('\r','',$address);
+ $address =str_replace('\n\r','',$address);
+ $address =str_replace(PHP_EOL,'',$address);
$geo_location = $pdmas[0]['start_location'];
$google_map_static_api_key = GOOGLE_STATIC_MAP_API_KEY;
- echo "*****";
- echo $address;
//Replacing Place holders
@@ -4725,7 +4731,7 @@ class PD_Controller extends REST_Controller {
$satellite_script = str_replace('{{GEOLOCATION}}',$geo_location,$satellite_script);
$satellite_script = str_replace('{{API_KEY}}',$google_map_static_api_key,$satellite_script);
- echo $satellite_script;die();
+
file_put_contents(APPPATH.'/views/js/phantomsatellite.js',$satellite_script);
//call& execute phantom script
@@ -4740,6 +4746,8 @@ class PD_Controller extends REST_Controller {
$satellite_img_content = file_get_contents($satellite_image_png_path);
$base64_pdscore_chart_url = 'data:image/' . $type . ';base64,' . base64_encode($satellite_img_content);
+ //generate log
+ $logger->info("Generate Satellite Called in (".ENVIRONMENT.")",array('Address' => $address,'script' => $satellite_script,'script_output' => $ou));
return $base64_pdscore_chart_url;
}
@@ -4798,6 +4806,28 @@ class PD_Controller extends REST_Controller {
}
+
+ function getAssessedIncomeForPDReport($pdid)
+ {
+
+ $assessed_config_details = $this->PD_Model->selectCustomRecords(array('*'),array('fk_pd_id' => $pdid),PDASSESSEDINCOMEESTIMATIONOFGROSSPROFITTYPE);
+ $data = array();
+ if(count($assessed_config_details))
+ {
+ foreach($assessed_config_details as $ai)
+ {
+ $data[ $ai['company_id'] ]['core_details'] = $this->PD_Model->getAssessedIncome($pdid,$ai['company_id']);
+
+ $data[ $ai['company_id'] ]['summary_details'] = $this->calculateAssessedIncome($pdid,$ai['company_id']);
+ }
+ return $data;
+ }
+ else
+ {
+ return null;
+ }
+
+ }
public function codeigniterViewTest_post()
{
@@ -4815,12 +4845,17 @@ class PD_Controller extends REST_Controller {
$data['pd_additional_requirements'] = $this->PD_Model->getPDAdditionalRequirements($pdid);
$data['score_questions_display'] = $this->PD_Model->getScoreableQuestionToDispaly();
$data['pd_score'] = $this->calculateScore($pdid);
+ //print_r($data['pd_score']);
+ //die();
+ $data['assessed_income_details'] = $this->getAssessedIncomeForPDReport($pdid);
- $data['dsc_cards'] = $this->getDetailedScoreCardChart( $data['pd_score'] );
+ // print_r($data['assessed_income_details']);
+ // echo "**************************";
+ $data['dsc_cards'] = $this->getDetailedScoreCardChart( $data['pd_score'] );
- $score_for_chart = $data['pd_score']['score_summary']['overall_score']['final_score'] ? round($data['pd_score']['score_summary']['overall_score']['final_score'],2) : 0;
+ //$score_for_chart = $data['pd_score']['score_summary']['overall_score']['final_score'] ? round($data['pd_score']['score_summary']['overall_score']['final_score'],2) : 0;
//echo $score_for_chart;
- $chart = 1;
+ $chart = null;
if($chart)
{
//GET phantom script from DB
diff --git a/api/application/docs/sample.pdf b/api/application/docs/sample.pdf
index d718fe47..57de9d00 100644
Binary files a/api/application/docs/sample.pdf and b/api/application/docs/sample.pdf differ
diff --git a/api/application/helpers/assessedincome_helper.php b/api/application/helpers/assessedincome_helper.php
new file mode 100644
index 00000000..947898ac
--- /dev/null
+++ b/api/application/helpers/assessedincome_helper.php
@@ -0,0 +1,285 @@
+
Summary ';
+ $sale_revenue_row = ' a. Sales / Revenue ';
+ $purchase_row = ' b. Purchases ';
+ $gross_profit_loss_row = ' c. Gross Profit / Loss(a-b) ';
+ $business_expense_row = ' d. Business Expenses ';
+ $net_profit_loss_row = ' e. Net Profit / Loss(c-d) ';
+ $house_hold_expense_row = ' f. Household Expenses ';
+ $disposable_income_row = ' g. Disposable Income ';
+ $net_margin_row = ' h. Net Margin % ';
+ $considered_sales_revenue_row = ' Considered Sales / Revenue ';
+ $considered_net_profit_row = ' Considered Net Profit ';
+ $considered_net_margint_row = ' Considered Net Margin % ';
+
+ if(isset($ai_summary_details['sales_declared_by_customer']) && count($ai_summary_details['sales_declared_by_customer']))
+ {
+ $ai_table_header_row .= 'Declared by Customer ';
+
+ $sale_revenue_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_declared_by_customer']['sales_revenue']).' ';
+ $purchase_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_declared_by_customer']['purchases']).' ';
+ $gross_profit_loss_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_declared_by_customer']['grossprofit']).' ';
+ $business_expense_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_declared_by_customer']['business_expenses']).' ';
+ $net_profit_loss_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_declared_by_customer']['netprofit']).' ';
+ $house_hold_expense_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_declared_by_customer']['house_hold_expenses']).' ';
+ $disposable_income_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_declared_by_customer']['disposable_income']).' ';
+ $net_margin_row .= ''.($ai_summary_details['sales_declared_by_customer']['netmargin']).'% ';
+
+ }
+
+ if(isset($ai_summary_details['sales_calculated_by_itemwise']) && count($ai_summary_details['sales_calculated_by_itemwise']))
+ {
+ $ai_table_header_row .= 'As Derived from Item Wise Sales ';
+
+ $sale_revenue_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_itemwise']['sales_revenue']).' ';
+ $purchase_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_itemwise']['purchases']).' ';
+ $gross_profit_loss_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_itemwise']['grossprofit']).' ';
+ $business_expense_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_itemwise']['business_expenses']).' ';
+ $net_profit_loss_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_itemwise']['netprofit']).' ';
+ $house_hold_expense_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_itemwise']['house_hold_expenses']).' ';
+ $disposable_income_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_itemwise']['disposable_income']).' ';
+ $net_margin_row .= ''.($ai_summary_details['sales_calculated_by_itemwise']['netmargin']).'% ';
+ }
+
+ if(isset($ai_summary_details['sales_calculated_by_monthwise']) && count($ai_summary_details['sales_calculated_by_monthwise']))
+ {
+ $ai_table_header_row .= 'As Derived from Kuchha Sales Book/Bills ';
+
+ $sale_revenue_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_monthwise']['sales_revenue']).' ';
+ $purchase_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_monthwise']['purchases']).' ';
+ $gross_profit_loss_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_monthwise']['grossprofit']).' ';
+ $business_expense_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_monthwise']['business_expenses']).' ';
+ $net_profit_loss_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_monthwise']['netprofit']).' ';
+ $house_hold_expense_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_monthwise']['house_hold_expenses']).' ';
+ $disposable_income_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['sales_calculated_by_monthwise']['disposable_income']).' ';
+ $net_margin_row .= ''.($ai_summary_details['sales_calculated_by_monthwise']['netmargin']).'% ';
+ }
+
+ if(isset($ai_summary_details['consolidated_report']) && count($ai_summary_details['consolidated_report']))
+ {
+ $considered_sales_revenue_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['consolidated_report']['consolidated_sales_revenue']).' ';
+ $considered_net_profit_row .= ''.MYUTIL::customIndianNumberFormat($ai_summary_details['consolidated_report']['consolidated_nerprofit']).' ';
+ $considered_net_margint_row .= ''.$ai_summary_details['consolidated_report']['consolidated_nermagin'].'% ';
+
+ }
+ $ai_table_header_row .= ' ';
+ $sale_revenue_row .= '';
+ $purchase_row .= '';
+ $gross_profit_loss_row .= '';
+ $business_expense_row .= '';
+ $net_profit_loss_row .= '';
+ $house_hold_expense_row .= '';
+ $disposable_income_row .= '';
+ $net_margin_row .= '';
+ $considered_sales_revenue_row .= '';
+ $considered_net_profit_row .= '';
+ $considered_net_margint_row .= '';
+
+ // echo $ai_table_header_row;
+ // echo $sale_revenue_row;
+ // echo $purchase_row;
+ // echo $gross_profit_loss_row;
+ // echo $business_expense_row;
+ // echo $net_profit_loss_row;
+ // echo $house_hold_expense_row;
+ // echo $disposable_income_row;
+ // echo $net_margin_row;
+ // echo $considered_sales_revenue_row;
+ // echo $considered_net_profit_row;
+ // echo $considered_net_margint_row;
+ return array('ai_table_header_row' => $ai_table_header_row,'sale_revenue_row' => $sale_revenue_row,'purchase_row' => $purchase_row,'gross_profit_loss_row' => $gross_profit_loss_row,'business_expense_row' => $business_expense_row,'net_profit_loss_row' => $net_profit_loss_row,'house_hold_expense_row' => $house_hold_expense_row,'disposable_income_row'=>$disposable_income_row,'net_margin_row' => $net_margin_row,'considered_sales_revenue_row' => $considered_sales_revenue_row,'considered_net_profit_row' => $considered_net_profit_row,'considered_net_margint_row' =>$considered_net_margint_row);
+
+
+
+ }
+
+ public static function getCoreDetails($ai_core_details){
+
+ $purchase_to_display = array();
+ $sales_item_wise_to_diaplay = array();
+ $business_expenses_to_diaplay = array();
+ $household_expenses_to_diaplay = array();
+ $sales_item_wise_header_row = '';
+ // Get Purchase Informations
+ if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 1)
+ {
+ if($ai_core_details['gross_profit_calculation_type'][0]['purchase_type'] == 1)
+ {
+ foreach($ai_core_details['purchase_details'] as $pk => $purchase)
+ {
+ $temp['material_name'] = strcasecmp($purchase['purchase_item'],'others') ? $purchase['purchase_item'] : $purchase['other_purchase_item'];
+
+ $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['annual_value'] = $purchase['annual_purchase_value'];
+ array_push($purchase_to_display,$temp);
+
+ }
+ }
+ else if($ai_core_details['gross_profit_calculation_type'][0]['purchase_type'] == 2)
+ {
+
+ foreach($ai_core_details['purchase_billwise'] as $pbk => $purchase)
+ {
+ $temp['month_count'] = count($purchase['items']);
+ $temp['annual_purchase_value'] = $purchase['annual_purchase_value'];
+ $temp['item_name'] = strcasecmp($purchase['purchase_item'],'others') ? $purchase['purchase_item'] : $purchase['other_purchase_item'];
+ $temp['months'] = array();
+ foreach($purchase['items'] as $item_key => $month_item)
+ {
+ foreach($month_item as $key => $data)
+ {
+ $t['month_to_dispaly'] = $key;
+ $t['month_data'] = array();
+ foreach($data as $singe_data)
+ {
+ array_push($t['month_data'],array('date' => date_format(date_create($singe_data['purchase_date']),'d-m-Y'),'value' => $singe_data['purchase_value']));
+ }
+ array_push($temp['months'],$t);
+ }
+
+ }
+
+ array_push($purchase_to_display,$temp);
+ }
+ }
+ }
+ else
+ {
+ //return $purchase_to_display;
+ }
+
+ // Get Sales Itemwise
+ if(count($ai_core_details['sales_calculated_by_itemwise']))
+ {
+ $sales_item_wise_to_diaplay = array();
+ $sales_item_wise_header_row = " Product/Services Sale Quantitys UOM Rate/Unit or Value of Sale Frequency Annual Sales (Rs) ";
+ if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 2)
+ {
+ $sales_item_wise_header_row .= "Gross Margin % Margin Amount Gross Profit ";
+ }
+ foreach($ai_core_details['sales_calculated_by_itemwise'] as $itemwise)
+ {
+ $temp['sale_item'] = $itemwise['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['annual_sale_value'] = $itemwise['annual_sale_value'];
+ $temp['rate_per_unit'] = $itemwise['rate_per_unit'];
+
+ if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 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']))
+ {
+ $sales_month_wise_to_display = array();
+
+ 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']))
+ {
+ foreach($ai_core_details['business_expenses'] as $business_expense)
+ {
+ $bs_temp['expense_item'] = $business_expense['expense_item'];
+ $bs_temp['frequency_name'] = $business_expense['frequency_name'];
+ $bs_temp['expense_value'] = $business_expense['expense_value'];
+ $bs_temp['annual_expenses_value'] = $business_expense['annual_expenses_value'];
+ array_push($business_expenses_to_diaplay,$bs_temp);
+ }
+ }
+
+ if(count($ai_core_details['house_hold_expenses']))
+ {
+ foreach($ai_core_details['house_hold_expenses'] as $house_hold_expense)
+ {
+ $hhs_temp['expense_item'] = $house_hold_expense['expense_item'];
+ $hhs_temp['frequency_name'] = $house_hold_expense['frequency_name'];
+ $hhs_temp['expense_value'] = $house_hold_expense['expense_value'];
+ $hhs_temp['annual_expense_value'] = $house_hold_expense['annual_expense_value'];
+ array_push($household_expenses_to_diaplay,$hhs_temp);
+ }
+ }
+
+
+ //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);
+ }
+}
+?>
\ No newline at end of file
diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php
index ac3a66af..c55c0ff1 100644
--- a/api/application/models/PD_Model.php
+++ b/api/application/models/PD_Model.php
@@ -1496,7 +1496,7 @@ class PD_Model extends SPARQ_Model {
foreach($sales_items_by_month as $month_key => $month)
{
- $this->db->SELECT('simc_id,sales_date,sales_value,fk_frequency_id,frequency_value,FREQUENCY.name as frequency_name');
+ $this->db->SELECT('simc_id,sales_date,sales_value,fk_frequency_id,frequency_value,FREQUENCY.name as frequency_name,FREQUENCY.mutiple_factor');
$this->db->FROM(SALESITEMMONTHWISECHILD.' as SALESITEMMONTHWISECHILD');
$this->db->WHERE('SALESITEMMONTHWISECHILD.fk_sim_id',$item['sim_id']);
$this->db->JOIN(FREQUENCY.' as FREQUENCY','SALESITEMMONTHWISECHILD.fk_frequency_id = FREQUENCY.frequency_id','LEFT');
diff --git a/api/application/views/business_scorecard.php b/api/application/views/business_scorecard.php
index e3e8f565..e99747d4 100644
--- a/api/application/views/business_scorecard.php
+++ b/api/application/views/business_scorecard.php
@@ -1,3 +1,3 @@
"Business Vintage >>", "location_suited_for_busienss" => "Business Location suitability >>", "business_seasonality" => "Seasonality >>", "employees_total" => "Employee Strength >>", "cerificates" => "Business Certifications Sighted >>","owned_property" => "Business Premise Ownership >>", "owned_vechile" => "Vehicle Ownership >>", "business_activity_has_seen" => "Business Activity Observed >>", "minimum_supplier_info" => "Supplier Information Shared >>", "minimum_client_info" => "Client Information Shared >>","stock_raw_material_enough" => "Sufficiency of RM Stock Observed >>", "stock_finished_goods_enough" => "Sufficiency of Finished / Traded Stock Observed >>", "vintage_of_business_account" => "Main Business Banking Account Vintage >>");$descriptions = '';$score = '';if(isset($business) && count($business)){;foreach($business as $key => $d){$descriptions .= '"'.$business_captions [$key].'",'; $score .= ($d['attributed_score'] * 100).',';}}
-?>
\ No newline at end of file
+?>
\ No newline at end of file
diff --git a/api/application/views/general_scorecard.php b/api/application/views/general_scorecard.php
index c8fd95e7..e81f739f 100644
--- a/api/application/views/general_scorecard.php
+++ b/api/application/views/general_scorecard.php
@@ -1,3 +1,3 @@
"OTP authentication done >>","person_met_is_applicant" => "Is person Met, one of the loan applicants? >>","qualification" => "Qualification of Loan Applicants >>","comment_locality" => "Comment on Locality >>","pd_location_approach" => "Approach to PD location >>","customer_behaviour" => "Customer Behaviour >>","neibourhood_check_as_per_pd_officer" => "Neighbourhood check >>","was_the_company_name_board_sighted" => "Name Board of the Business Seen >>","value_of_other_assets" => "Value of Assets as a % of Loan Amount >>");$descriptions = '';$score = '';if(isset($general) && count($general)){;foreach($general as $key => $d){$descriptions .= '"'.$general_captions [$key].'",'; $score .= ($d['attributed_score'] * 100).',';}}
-?>
\ No newline at end of file
+?>
\ No newline at end of file
diff --git a/api/application/views/js/phantomchart.js b/api/application/views/js/phantomchart.js
index 9c68059e..2c0759cc 100644
--- a/api/application/views/js/phantomchart.js
+++ b/api/application/views/js/phantomchart.js
@@ -1 +1 @@
-var page = require('webpage').create();page.viewportSize = { width: 600, height: 350 };page.clipRect = { top: 0, left: 0, width: 600, height: 350 };var score = 50.94;var url = 'http://localhost:9999/AWSEC2/sparqapi/api?'+score;var image_url = 'C:/5.6/xampp/htdocs/AWSEC2/sparqapi/api/application/views/report_templates/chart.png' ;page.open(url,function() {setTimeout(function() {page.render(image_url);phantom.exit();}, 500);});
\ No newline at end of file
+var page = require('webpage').create();page.viewportSize = { width: 600, height: 350 };page.clipRect = { top: 0, left: 0, width: 600, height: 350 };var score = ;var url = 'http://localhost:9999/AWSEC2/sparqapi/api?'+score;var image_url = 'C:/5.6/xampp/htdocs/AWSEC2/sparqapi/api/application/views/report_templates/chart.png' ;page.open(url,function() {setTimeout(function() {page.render(image_url);phantom.exit();}, 500);});
\ No newline at end of file
diff --git a/api/application/views/js/phantomdsc.js b/api/application/views/js/phantomdsc.js
index bb1b39a8..3e77f23f 100644
--- a/api/application/views/js/phantomdsc.js
+++ b/api/application/views/js/phantomdsc.js
@@ -1 +1 @@
-var wpage = require('webpage').create();var Content = ' ';var pageurl = 'C:/5.6/xampp/htdocs/AWSEC2/sparqapi/api/application/views/report_templates/dsc.html'; wpage.viewportSize = { width: 810, height: 250 };wpage.setContent(Content, pageurl); wpage.onLoadFinished = function(status){wpage.render('C:/5.6/xampp/htdocs/AWSEC2/sparqapi/api/application/views/report_templates/dsc_general.png'); phantom.exit();};
\ No newline at end of file
+var wpage = require('webpage').create();var Content = ' ';var pageurl = 'C:/5.6/xampp/htdocs/AWSEC2/sparqapi/api/application/views/report_templates/dsc.html'; wpage.viewportSize = { width: 810, height: 250 };wpage.setContent(Content, pageurl); wpage.onLoadFinished = function(status){wpage.render('C:/5.6/xampp/htdocs/AWSEC2/sparqapi/api/application/views/report_templates/dsc_general.png'); phantom.exit();};
\ No newline at end of file
diff --git a/api/application/views/js/phantomsatellite.js b/api/application/views/js/phantomsatellite.js
index 34c1e172..ec1a1a4d 100644
--- a/api/application/views/js/phantomsatellite.js
+++ b/api/application/views/js/phantomsatellite.js
@@ -1,2 +1 @@
-var page = require('webpage').create();page.viewportSize = { width: 650, height: 250 };page.clipRect = { top: 0, left: 0, width: 500, height: 250 };var score = 78;var url = 'https://maps.googleapis.com/maps/api/staticmap?center=25,+NORTH+STREET,
-MAMBALAM,Erode,Tamil+Nadu,IND&zoom=14&markers=color:red|12.9202935,80.1685205&size=800x300&maptype=roadmap&key=AIzaSyCXsHTus6hyIB8jYvt9ZEIbZve-2vWeQRg';var image_url ='C:/5.6/xampp/htdocs/AWSEC2/sparqapi/api/application/views/report_templates/satellite.png';page.open(url,function() {setTimeout(function() {page.render(image_url);phantom.exit();}, 500);});
\ No newline at end of file
+var page = require('webpage').create();page.viewportSize = { width: 650, height: 250 };page.clipRect = { top: 0, left: 0, width: 500, height: 250 };var score = 78;var url = 'https://maps.googleapis.com/maps/api/staticmap?center=NO.1,+NEHRU+NAGAR,+3RD+STREET,+ACHRAPAKKAM,KANCHIPURAM,Acharapakkam,Tamil+Nadu,IND&zoom=14&markers=color:red|&size=800x300&maptype=roadmap&key=AIzaSyCXsHTus6hyIB8jYvt9ZEIbZve-2vWeQRg';var image_url ='/opt/lampp/htdocs/sparqtest/api/application/views/report_templates/satellite.png';page.open(url,function() {setTimeout(function() {page.render(image_url);phantom.exit();}, 500);});
\ No newline at end of file
diff --git a/api/application/views/report_templates/JSONTOREPORT.php b/api/application/views/report_templates/JSONTOREPORT.php
index 88716960..9072e521 100644
--- a/api/application/views/report_templates/JSONTOREPORT.php
+++ b/api/application/views/report_templates/JSONTOREPORT.php
@@ -93,10 +93,45 @@ defined('BASEPATH') OR exit('No direct script access allowed');
}
.customth { width: 10%; }
- /* #########Score Card Table Styles######### */
+
+/* #########billwise Table Styles######### */
.customtd { text-align:center; }
.customtd_leftalign { text-align:left; }
-.customtd_rightalign { text-align:right; }
+.customtd_rightalign { text-align:right; }
+
+.billwise_table {
+ /* font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;*/
+ /*font-family: Merriweather;*/
+ border-collapse: collapse;
+ width: auto;
+ //display:inline;
+}
+
+.billwise_table td, .billwise_table th {
+ border: 1px solid #000;
+ padding: 4px;
+
+}
+
+.billwise_table tr:nth-child(even){background-color: #f2f2f2;}
+
+.billwise_table tr:hover {background-color: #ddd;}
+
+.billwise_table th {
+ padding-top: 4px;
+ padding-bottom: 4px;
+ text-align: center;
+ background-color: #0191ed;
+ color: white;
+}
+/* #########billwise Table Styles######### */
+
+
+.customtd { text-align:center; }
+.customtd_leftalign { text-align:left; }
+.customtd_rightalign { text-align:right; }
+
+
#boxstyle1 {
box-sizing: border-box;
width: 60px;
@@ -118,6 +153,19 @@ defined('BASEPATH') OR exit('No direct script access allowed');
padding: 5px;
border: 2px outset black;
}
+
+#billwise {
+ box-sizing: content-box;
+ disply:inline;
+ width: 100%;
+ height: auto;
+ padding: 10px;
+ border: 1px solid #0191ed;
+}
+
+#customhr {
+
+}
@@ -545,8 +593,10 @@ defined('BASEPATH') OR exit('No direct script access allowed');
0) {
for($business_count = 0;$business_count < $total_no_of_business; $business_count++)
{
-
+ // $temp_show = null;
+ // if($temp_show == null)
+ // {
?>
-
+
-
+ Assessed Income - ".MYUTIL::findCompanyName($all_company_details,($business_count+1),1)."";
+
+ 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 magin percentage.
';
+ }
+
+ if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 1 && $ai_core_details['gross_profit_calculation_type'][0]['purchase_type'] == 1)
+ {
+ echo 'Itemwise Purchase Details :
';
+
+ echo '';
+ echo '';
+ echo ' Raw Material/Trading Item Purchase Quantity UOM Rate/Unit of Purchase Frequency Annual Purchase(Rs) ';
+ echo ' ';
+
+ echo '';
+ foreach($ai_core_details_processed['purchase_to_display'] as $dat)
+ {
+ echo ' '.$dat['material_name'] .' '.$dat['qty'] .' '.$dat['uom'] .' '.$dat['rate'] .' '.$dat['frequency'] .' '.$dat['annual_value'] .' ';
+ }
+ echo ' ';
+
+ echo '
';
+
+ }
+ else if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 1 &&$ai_core_details['gross_profit_calculation_type'][0]['purchase_type'] == 2)
+ {
+ echo 'Billwise Purchase Details :
';
+ foreach($ai_core_details_processed['purchase_to_display'] as $billwise)
+ {
+ echo '';
+ echo 'Item name :
' . $billwise['item_name'].' ';
+ echo '
'.$billwise['month_count'].' month(s) purchase value :
'.MYUTIL::customIndianNumberFormat($billwise['annual_purchase_value']).' Annual Purchase value:
'. MYUTIL::customIndianNumberFormat($billwise['annual_purchase_value'] * (12 / $billwise['month_count']) ).' ';
+ echo '
';
+ foreach($billwise['months'] as $month_data)
+ {
+ //echo '
';
+ echo ' ';
+ echo '';
+ echo '';
+ echo ' '.$month_data['month_to_dispaly'].' ';
+ echo ' Date Value ';
+ echo ' ';
+
+ echo '';
+ foreach($month_data['month_data'] as $month)
+ {
+ echo ' '.$month['date'] .' '.$month['value'] .' ';
+ }
+ echo ' ';
+
+ echo '
';
+ //echo ' ';
+ }
+ echo '
';
+
+ }
+ }
+
+ }
+ echo " ";
+ if(isset($ai_core_details) && count($ai_core_details['sales_declared_by_customer']))
+ {
+ $str = 'As per person met, Rs. '.$ai_core_details['sales_declared_by_customer'][0]['sales_declared_by_customer'].' declared as annual sale value.';
+ if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 2)
+ {
+ $str .= 'Also Rs. '.$ai_core_details['sales_declared_by_customer'][0]['margin_value'].' ('.$ai_core_details['sales_declared_by_customer'][0]['margin_per'].'%) as net margin amount';
+ }
+
+ echo $str;
+ echo ' ';
+ }
+
+ if(isset($ai_core_details) && count($ai_core_details['sales_calculated_by_itemwise']))
+ {
+ echo 'Sales Itemwise :
';
+ echo '';
+ echo '';
+ echo $ai_core_details_processed['sales_calculated_by_itemwise_header'];
+ echo ' ';
+ echo '';
+ foreach($ai_core_details_processed['sales_item_wise_to_diaplay'] as $sid)
+ {
+ echo '';
+ echo ''.$sid['sale_item'].' '.$sid['sales_qty'].' '.$sid['uom'].' '.$sid['rate_per_unit'].' '.$sid['frequency'].' '.$sid['annual_sale_value'].' ';
+ if(isset($sid['margin_per'])){echo ''.$sid['margin_per'].' '; }
+ if(isset($sid['margin_per_uom'])){echo ''.$sid['margin_per_uom'].' '; }
+ if(isset($sid['margin_final_value'])){echo ''.$sid['margin_final_value'].' '; }
+
+ echo ' ';
+ }
+ echo ' ';
+ echo '
';
+ }
+
+
+ if(isset($ai_core_details) && count($ai_core_details['sales_items_by_monthwise']))
+ {
+ echo " ";
+ echo "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 purchase value :
'.MYUTIL::customIndianNumberFormat($sale_month_wise['total_months_value']).' Annual Purchase value:
'. MYUTIL::customIndianNumberFormat(($sale_month_wise['total_months_value'] * (12 / $sale_month_wise['month_count']) )).' ';
+ }
+ else
+ {
+ echo 'Annual Purchase value:
'. MYUTIL::customIndianNumberFormat(($sale_month_wise['total_months_value'] )).' ';
+ }
+ echo '
';
+ foreach($sale_month_wise['months'] as $sale_month_data)
+ {
+ //echo '
';
+ echo ' ';
+ echo '';
+ echo '';
+ if($sale_month_wise['sales_type'] == 1)
+ {
+ echo ' '.$sale_month_data['month_to_dispaly'].' ';
+ }
+ if($sale_month_wise['sales_type'] == 1)
+ {
+ echo ' Date Value ';
+ }else if($sale_month_wise['sales_type'] == 2)
+ {
+ echo ' Frequncy Value ';
+ }
+ echo ' ';
+
+ echo '';
+ foreach($sale_month_data['month_data'] as $month)
+ {
+ if($sale_month_wise['sales_type'] == 1)
+ {
+ echo ' '.$month['date'] .' '.$month['value'] .' ';
+ }
+ else if($sale_month_wise['sales_type'] == 2)
+ {
+ echo ' '.$month['frequency_name'] .' '.$month['frequency_value'] .' ';
+ }
+ }
+ echo ' ';
+
+ echo '
';
+ //echo ' ';
+ }
+ echo '
';
+
+ //}
+ }
+ }
+
+
+ if(isset($ai_core_details) && count($ai_core_details['business_expenses']))
+ {
+ echo 'Business Expenses Details :
';
+ echo '';
+ echo '';
+ echo ' Business Expense Amount (Rs) Frequency Annual Expenses(Rs) ';
+ echo ' ';
+ echo '';
+ foreach($ai_core_details_processed['business_expenses_to_diaplay'] as $b_exp)
+ {
+ echo ' '.$b_exp['expense_item'] .' '.$b_exp['expense_value'] .' '.$b_exp['frequency_name'] .' '.$b_exp['annual_expenses_value'] .' ';
+ }
+ echo ' ';
+ echo '
';
+ }
+
+ if(isset($ai_core_details) && count($ai_core_details['house_hold_expenses']))
+ {
+ echo 'Household Expenses Details :
';
+ echo '';
+ echo '';
+ echo ' Expense Particulars Amount (Rs) Frequency Annual Expenses(Rs) ';
+ echo ' ';
+ echo '';
+ foreach($ai_core_details_processed['household_expenses_to_diaplay'] as $h_exp)
+ {
+ echo ' '.$h_exp['expense_item'] .' '.$h_exp['expense_value'] .' '.$h_exp['frequency_name'] .' '.$h_exp['annual_expense_value'] .' ';
+ }
+ echo ' ';
+ echo '
';
+ }
+
+
+ if(isset($ai_core_details) && count($ai_summary_details_processed))
+ {
+ echo 'The Summary of Income :
';
+ echo '';
+ echo '';
+ echo $ai_summary_details_processed['ai_table_header_row'];
+ echo ' ';
+ echo '';
+ echo $ai_summary_details_processed['sale_revenue_row'];
+ echo $ai_summary_details_processed['purchase_row'];
+ echo $ai_summary_details_processed['gross_profit_loss_row'];
+ echo $ai_summary_details_processed['business_expense_row'];
+ echo $ai_summary_details_processed['net_profit_loss_row'];
+ echo $ai_summary_details_processed['house_hold_expense_row'];
+ echo $ai_summary_details_processed['disposable_income_row'];
+ echo $ai_summary_details_processed['net_margin_row'];
+
+ echo ' ';
+ echo '
';
+
+ echo ' ';
+ echo '';
+ echo '';
+ echo ' Particulars Details ';
+ echo ' ';
+ echo '';
+ echo $ai_summary_details_processed['considered_sales_revenue_row'];
+ echo $ai_summary_details_processed['considered_net_profit_row'];
+ echo $ai_summary_details_processed['considered_net_margint_row'];
+ echo ' ';
+ echo '
';
+ }
+ echo "
";
+ //die();
+ ?>
+
+
+
+
diff --git a/api/application/views/report_templates/dsc_business.png b/api/application/views/report_templates/dsc_business.png
index 8bee86f7..35f2e7ca 100644
Binary files a/api/application/views/report_templates/dsc_business.png and b/api/application/views/report_templates/dsc_business.png differ
diff --git a/api/application/views/report_templates/dsc_general.png b/api/application/views/report_templates/dsc_general.png
index 332cba20..9ec8a11f 100644
Binary files a/api/application/views/report_templates/dsc_general.png and b/api/application/views/report_templates/dsc_general.png differ
diff --git a/api/application/views/report_templates/satellite.png b/api/application/views/report_templates/satellite.png
index f7f9a3c5..729eed6c 100644
Binary files a/api/application/views/report_templates/satellite.png and b/api/application/views/report_templates/satellite.png differ