reports display added for detailed sale and customer

This commit is contained in:
Joshua Fernandes
2017-03-04 17:17:03 +05:30
parent deea43ce67
commit 3650b47d8b
5 changed files with 42 additions and 4 deletions

View File

@@ -729,6 +729,7 @@ class Reports extends Secure_Controller
$summary_data = array();
$details_data = array();
$details_data_rewards = array();
foreach($report_data['summary'] as $key => $row)
{
@@ -749,6 +750,12 @@ class Reports extends Secure_Controller
{
$details_data[$row['sale_id']][] = $this->xss_clean(array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], to_quantity_decimals($drow['quantity_purchased']), to_currency($drow['subtotal']), to_currency($drow['tax']), to_currency($drow['total']), to_currency($drow['cost']), to_currency($drow['profit']), $drow['discount_percent'].'%'));
}
if(isset($report_data['rewards'][$key])){
foreach($report_data['rewards'][$key] as $drow)
{
$details_data_rewards[$row['sale_id']][] = $this->xss_clean(array($drow['earned'], $drow['used']));
}
}
}
$customer_info = $this->Customer->get_info($customer_id);
@@ -758,6 +765,7 @@ class Reports extends Secure_Controller
'headers' => $headers,
'summary_data' => $summary_data,
'details_data' => $details_data,
'details_data_rewards' => $details_data_rewards,
'overall_summary_data' => $this->xss_clean($model->getSummaryData($inputs))
);
@@ -940,6 +948,7 @@ class Reports extends Secure_Controller
$summary_data = array();
$details_data = array();
$details_data_rewards = array();
$show_locations = $this->xss_clean($this->Stock_location->multiple_locations());
@@ -972,6 +981,12 @@ class Reports extends Secure_Controller
}
$details_data[$row['sale_id']][] = $this->xss_clean(array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], $quantity_purchased, to_currency($drow['subtotal']), to_currency($drow['tax']), to_currency($drow['total']), to_currency($drow['cost']), to_currency($drow['profit']), $drow['discount_percent'].'%'));
}
if(isset($report_data['rewards'][$key])){
foreach($report_data['rewards'][$key] as $drow)
{
$details_data_rewards[$row['sale_id']][] = $this->xss_clean(array($drow['earned'], $drow['used']));
}
}
}
$data = array(
@@ -981,9 +996,9 @@ class Reports extends Secure_Controller
'editable' => 'sales',
'summary_data' => $summary_data,
'details_data' => $details_data,
'details_data_rewards' => $details_data_rewards,
'overall_summary_data' => $this->xss_clean($model->getSummaryData($inputs))
);
$this->load->view('reports/tabular_details', $data);
}

View File

@@ -95,3 +95,5 @@ $lang["reports_total_inventory_value"] = "Total Inventory Value";
$lang["reports_zero_and_less"] = "Zero and less";
$lang["reports_more_than_zero"] = "More than zero";
$lang["reports_no_reports_to_display"] = "No Items to display";
$lang["reports_used"] = "Points Used";
$lang["reports_earned"] = "Points Earned";

View File

@@ -42,7 +42,10 @@ class Detailed_sales extends Report
$this->lang->line('reports_total'),
$this->lang->line('reports_cost'),
$this->lang->line('reports_profit'),
$this->lang->line('reports_discount'))
$this->lang->line('reports_discount')),
'details_rewards' => array(
$this->lang->line('reports_used'),
$this->lang->line('reports_earned'))
);
}
@@ -91,6 +94,7 @@ class Detailed_sales extends Report
$data = array();
$data['summary'] = $this->db->get()->result_array();
$data['details'] = array();
$data['rewards'] = array();
foreach($data['summary'] as $key=>$value)
{
@@ -98,6 +102,10 @@ class Detailed_sales extends Report
$this->db->from('sales_items_temp');
$this->db->where('sale_id', $value['sale_id']);
$data['details'][$key] = $this->db->get()->result_array();
$this->db->select('earned, used');
$this->db->from('sales_reward_points');
$this->db->where('sale_id', $value['sale_id']);
$data['rewards'][$key] = $this->db->get()->result_array();
}
return $data;

View File

@@ -41,7 +41,10 @@ class Specific_customer extends Report
$this->lang->line('reports_total'),
$this->lang->line('reports_cost'),
$this->lang->line('reports_profit'),
$this->lang->line('reports_discount'))
$this->lang->line('reports_discount')),
'details_rewards' => array(
$this->lang->line('reports_used'),
$this->lang->line('reports_earned'))
);
}
@@ -73,6 +76,10 @@ class Specific_customer extends Report
$this->db->from('sales_items_temp');
$this->db->where('sale_id', $value['sale_id']);
$data['details'][$key] = $this->db->get()->result_array();
$this->db->select('earned, used');
$this->db->from('sales_reward_points');
$this->db->where('sale_id', $value['sale_id']);
$data['rewards'][$key] = $this->db->get()->result_array();
}
return $data;

View File

@@ -26,7 +26,7 @@
<?php $this->load->view('partial/bootstrap_tables_locale'); ?>
var detail_data = <?php echo json_encode($details_data); ?>;
var details_data_rewards = <?php echo json_encode($details_data_rewards); ?>;
var init_dialog = function()
{
@@ -60,6 +60,12 @@
columns: <?php echo transform_headers_readonly($headers['details']); ?>,
data: detail_data[(!isNaN(row.id) && row.id) || $(row[0] || row.id).text().replace(/(POS|RECV)\s*/g, '')]
});
<?php if(isset($details_data_rewards) && $details_data_rewards!= null && !empty($details_data_rewards)) { ?>
$detail.append('<table></table>').find("table").bootstrapTable({
columns: <?php echo transform_headers_readonly($headers['details_rewards']); ?>,
data: details_data_rewards[(!isNaN(row.id) && row.id) || $(row[0] || row.id).text().replace(/(POS|RECV)\s*/g, '')]
});
<?php } ?>
}
});