diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 67061a3d..368abf0f 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -2260,7 +2260,7 @@ class PD_Controller extends REST_Controller { if(count($inline_forms_photo_status_check) && $inline_forms_photo_status_check[0]['is_business_photo_saved'] != 1) { $records = INLINEPHOTOTRANSFORM::retransformBusinessFormInlinePhotos($records); - $this->PD_Model->saveRecords(array('fk_pd_id' => $pdid,'is_business_photo_saved' => 1),T_PD_INLINE_PHOTO_FORM_STATUS); + $this->PD_Model->updateRecords(array('is_business_photo_saved' => 1),T_PD_INLINE_PHOTO_FORM_STATUS,array('fk_pd_id' => $pdid)); } } @@ -3281,7 +3281,7 @@ class PD_Controller extends REST_Controller { unset($record['child']); } $id = ""; - if($record['sim_id'] != null || $record['sim_id'] != "") + if($record['sim_id'] != null || $record['sim_id'] != "" ) { $where_condition_array = array('sim_id'=>$record['sim_id']); $id = $this->PD_Model->updateRecords($record,SALESITEMMONTHWISE,$where_condition_array); @@ -3297,8 +3297,11 @@ class PD_Controller extends REST_Controller { } else { - $child['fk_sim_id'] = $record['sim_id']; - $child_id = $this->PD_Model->saveRecords($child,SALESITEMMONTHWISECHILD); + if($child['sales_date'] != null || $child['sales_date'] != "") + { + $child['fk_sim_id'] = $record['sim_id']; + $child_id = $this->PD_Model->saveRecords($child,SALESITEMMONTHWISECHILD); + } } } } @@ -3306,16 +3309,26 @@ class PD_Controller extends REST_Controller { } else { - $id = $this->PD_Model->saveRecords($record,SALESITEMMONTHWISE); - if($id != "" || $id != null) - { - $count++; - foreach($child_data as $ckey => $child) + //print_r($child_data);die(); + + + + $id = $this->PD_Model->saveRecords($record,SALESITEMMONTHWISE); + if($id != "" || $id != null) { - $child['fk_sim_id'] = $id; - $child_id = $this->PD_Model->saveRecords($child,SALESITEMMONTHWISECHILD); + $count++; + + foreach($child_data as $ckey => $child) + { + if($child['sales_date'] != null || $child['sales_date'] != "") + { + //echo 'true'; + $child['fk_sim_id'] = $id; + $child_id = $this->PD_Model->saveRecords($child,SALESITEMMONTHWISECHILD); + } + } } - } + } } @@ -3744,25 +3757,33 @@ class PD_Controller extends REST_Controller { //print_r($sales_by_item_monthwise);die(); 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(); $month_total = 0; $i = 0; $temp_netprofit = $temp_netprofit + $sales_by_item_month['margin_value']; - foreach($sales_by_item_month['items'] as $month_key => $month) + if(isset($sales_by_item_month['items'])) { - $temp = 0; - - $i++; - foreach($month as $key => $m) - { - $temp = $temp + $m['sales_value']; - } - $month_total = $month_total + $temp; + //echo 'insdie if'; + foreach($sales_by_item_month['items'] as $month_key => $month) + { + $temp = 0; + + $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' => $sales_by_item_month['sales_type']); } - + //print_r($sales_monthwise);die(); foreach($sales_monthwise as $sale) { //print_r($sale); diff --git a/api/application/docs/sample.pdf b/api/application/docs/sample.pdf index 2862345f..78834aa5 100644 Binary files a/api/application/docs/sample.pdf and b/api/application/docs/sample.pdf differ diff --git a/api/application/helpers/getprocessedjson_helper.php b/api/application/helpers/getprocessedjson_helper.php index 445f8ad5..b4e49b7f 100644 --- a/api/application/helpers/getprocessedjson_helper.php +++ b/api/application/helpers/getprocessedjson_helper.php @@ -302,7 +302,7 @@ class GETPROCESSEDJSON $master_tables_field_names = $CI->config->item('master_tables_field_names'); $master_tables_pkid = $CI->config->item('master_tables_pkid'); - //print_r($raw_json); + //print_r($raw_json);die(); // GET KEYS FROM MASTER TABLE FOR SUPPLIER FORM $fields = array('question', 'key', 'ismaster', 'master_name'); @@ -428,6 +428,55 @@ class GETPROCESSEDJSON } } } + + if(array_key_exists('state',$raw_json)) + { + //print_r($address); + $CI->db->SELECT( $master_tables_field_names['STATE'] ); + $CI->db->FROM(STATE); + $CI->db->WHERE('isactive',1); + $CI->db->WHERE($master_tables_pkid['STATE'] ,$raw_json['state']); + $adress_type_name= $CI->db->GET()->result_array(); + //print_r($CI->db->last_query()); + if(count($adress_type_name)) + { + $raw_json['state_master'] = $adress_type_name[0][$master_tables_field_names['STATE']]; + } + } + + if(array_key_exists('city',$raw_json)) + { + //print_r($address); + $CI->db->SELECT( $master_tables_field_names['CITY'] ); + $CI->db->FROM(CITY); + $CI->db->WHERE('isactive',1); + $CI->db->WHERE($master_tables_pkid['CITY'] ,$raw_json['city']); + $city= $CI->db->GET()->result_array(); + //print_r($CI->db->last_query()); + if(count($city)) + { + $raw_json['city_master'] = $city[0][$master_tables_field_names['CITY']]; + } + } + + if(array_key_exists('pincode',$raw_json)) + { + //print_r($address); + $CI->db->SELECT( $master_tables_field_names['PINCODE'] ); + $CI->db->FROM(PINCODE); + $CI->db->WHERE('isactive',1); + $CI->db->WHERE($master_tables_pkid['PINCODE'] ,$raw_json['pincode']); + $pincode= $CI->db->GET()->result_array(); + //print_r($CI->db->last_query()); + if(count($pincode)) + { + $raw_json['pincode_master'] = $pincode[0][$master_tables_field_names['PINCODE']]; + } + } + + + + $raw_json['owners_list_master'] = $owners_list_master; } diff --git a/api/application/views/report_templates/JSONTOREPORT.php b/api/application/views/report_templates/JSONTOREPORT.php index 432c9dbe..13bfd99c 100644 --- a/api/application/views/report_templates/JSONTOREPORT.php +++ b/api/application/views/report_templates/JSONTOREPORT.php @@ -2294,6 +2294,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); { $cRow = $pd_processed_forms[2][$business_count]; $clientRow = json_decode($cRow['processed_json'],true); + $client_form_remarks = isset($clientRow['supplier_info_form_remark']) ? $clientRow['supplier_info_form_remark'] : ''; $name_of_the_company = MYUTIL::findCompanyName($all_company_details,$clientRow['company_id'],1); // $bindEachResult["company_name"]=MYUTIL::findCompanyName($all_company_details,$clientRow['company_id'],1); @@ -2458,11 +2459,12 @@ defined('BASEPATH') OR exit('No direct script access allowed'); ?> Client Details"; if($to_no_of_clients > 0 ) { - echo "

Client Details

"; + ?> @@ -2494,7 +2496,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
Out of total sales done by ".$name_of_the_company .", ".$done_on_credit."% is done on credit.

"; } - echo '

'.$client_form_remarks.'

'; + //CLient Photo Section // $client_photo_count = $pd_images[2]; // $client_img_row_count = ceil(count($client_photo_count) / 3); @@ -2537,6 +2539,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); //End of CLient Photo Section ?> '.$client_form_remarks.'

'; } // ENd of client info available in this current index ?> @@ -2667,12 +2670,12 @@ defined('BASEPATH') OR exit('No direct script access allowed'); } // echo "dsfnsdkfnj**********"; //print_r($supplierResult);die(); - + echo '

Supplier Details

' ; if($total_no_of_suppliers > 0) { ?> -

Supplier Details

+ $fetchRow){ echo '
Supplier '.($k+1).':

'; @@ -3729,7 +3732,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
-

PD OFFICERS REMARKS ON CUSTOMER BEHAVIOUR, BUSINESS LOCATION & OVERALL PD STATUS

+

PD OFFICERS` REMARKS ON CUSTOMER BEHAVIOUR, BUSINESS LOCATION & OVERALL PD STATUS