Fix detailed report editing

This commit is contained in:
jekkos-t520
2014-11-27 08:44:50 +01:00
parent d7a61080e2
commit 78ca94e036
3 changed files with 9 additions and 10 deletions

View File

@@ -720,7 +720,7 @@ class Reports extends Secure_area
foreach($report_data['summary'] as $key=>$row)
{
$summary_data[] = array(anchor('sales/edit/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target' => '_blank')), $row['sale_date'], $row['items_purchased'], $row['employee_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),to_currency($row['profit']), $row['payment_type'], $row['comment']);
$summary_data[] = array(anchor('sales/edit/'.$row['sale_id'], 'POS '.$row['sale_id'], array('class' => 'thickbox')), $row['sale_date'], $row['items_purchased'], $row['employee_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),to_currency($row['profit']), $row['payment_type'], $row['comment']);
foreach($report_data['details'][$key] as $drow)
{
@@ -733,6 +733,7 @@ class Reports extends Secure_area
"title" => $customer_info->first_name .' '. $customer_info->last_name.' '.$this->lang->line('reports_report'),
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
"headers" => $model->getDataColumns(),
"editable" => "sales",
"summary_data" => $summary_data,
"details_data" => $details_data,
"overall_summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date,'customer_id' =>$customer_id, 'sale_type' => $sale_type)),
@@ -769,7 +770,7 @@ class Reports extends Secure_area
foreach($report_data['summary'] as $key=>$row)
{
$summary_data[] = array(anchor('sales/edit/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target' => '_blank')), $row['sale_date'], $row['items_purchased'], $row['customer_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),to_currency($row['profit']), $row['payment_type'], $row['comment']);
$summary_data[] = array(anchor('sales/edit/'.$row['sale_id'], 'POS '.$row['sale_id'], array('class' => 'thickbox')), $row['sale_date'], $row['items_purchased'], $row['customer_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),to_currency($row['profit']), $row['payment_type'], $row['comment']);
foreach($report_data['details'][$key] as $drow)
{
@@ -782,6 +783,7 @@ class Reports extends Secure_area
"title" => $employee_info->first_name .' '. $employee_info->last_name.' '.$this->lang->line('reports_report'),
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
"headers" => $model->getDataColumns(),
"editable" => "sales",
"summary_data" => $summary_data,
"details_data" => $details_data,
"overall_summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date,'employee_id' =>$employee_id, 'sale_type' => $sale_type)),
@@ -818,7 +820,7 @@ class Reports extends Secure_area
foreach($report_data['summary'] as $key=>$row)
{
$summary_data[] = array(anchor('sales/receipt/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target' => '_blank')), $row['sale_date'], $row['items_purchased'], $row['customer_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),/*to_currency($row['profit']),*/ $row['payment_type'], $row['comment']);
$summary_data[] = array(anchor('sales/receipt/'.$row['sale_id'], 'POS '.$row['sale_id'], array('class' => 'thickbox')), $row['sale_date'], $row['items_purchased'], $row['customer_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),/*to_currency($row['profit']),*/ $row['payment_type'], $row['comment']);
foreach($report_data['details'][$key] as $drow)
{
@@ -830,6 +832,7 @@ class Reports extends Secure_area
"title" => $discount. '% '.$this->lang->line('reports_discount') . ' ' . $this->lang->line('reports_report'),
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
"headers" => $headers,
"editable" => "sales",
"summary_data" => $summary_data,
"details_data" => $details_data,
"header_width" => intval(100 / count($headers['summary'])),

View File

@@ -364,10 +364,10 @@ class Sales extends Secure_area
{
$sale_data = array(
'sale_time' => date('Y-m-d', strtotime($this->input->post('date'))),
'customer_id' => $this->input->post('customer_id') ? $this->input->post('customer_id') : null,
'customer_id' => $this->input->post('customer_id') ? $this->input->post('customer_id') : NULL,
'employee_id' => $this->input->post('employee_id'),
'comment' => $this->input->post('comment'),
'invoice_number' => $this->input->post('invoice_number')
'invoice_number' => $this->input->post('invoice_number') ? $this->input->post('invoice_number') : NULL
);
if ($this->Sale->update($sale_data, $sale_id))

View File

@@ -277,11 +277,7 @@ function get_table_row(id) {
id = id || $("input[name='sale_id']").val();
var $element = $("#sortable_table tbody :checkbox[value='" + id + "']");
if ($element.length === 0) {
// parse link
var row_id = $("#sortable_table tbody a").each(function(index, element) {
var result = $(element).attr("href").match(/\/(\d+)\//);
$element = result && result[1] == id ? $(element) : $element;
});
$element = $("#sortable_table a.thickbox[href*='" + id + "']");
}
return $element;
}