diff --git a/application/controllers/Reports.php b/application/controllers/Reports.php index cb4ecd8dd..1ff8d2f0f 100644 --- a/application/controllers/Reports.php +++ b/application/controllers/Reports.php @@ -811,6 +811,17 @@ class Reports extends Secure_Controller foreach($report_data['summary'] as $key => $row) { + if($row['sale_status'] == CANCELED) + { + $button_key = 'data-btn-restore'; + $button_label = $this->lang->line('common_restore'); + } + else + { + $button_key = 'data-btn-delete'; + $button_label = $this->lang->line('common_delete'); + } + $summary_data[] = $this->xss_clean(array( 'id' => anchor('sales/receipt/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target'=>'_blank')), 'type_code' => $row['type_code'], @@ -823,7 +834,10 @@ class Reports extends Secure_Controller 'cost' => to_currency($row['cost']), 'profit' => to_currency($row['profit']), 'payment_type' => $row['payment_type'], - 'comment' => $row['comment'])); + 'comment' => $row['comment'], + 'edit' => anchor('sales/edit/'. $row['sale_id'], '', + array('class'=>'modal-dlg print_hide', $button_key => $button_label, 'data-btn-submit' => $this->lang->line('common_submit'), 'title' => $this->lang->line('sales_update'))) + )); foreach($report_data['details'][$key] as $drow) { @@ -898,6 +912,17 @@ class Reports extends Secure_Controller foreach($report_data['summary'] as $key => $row) { + if($row['sale_status'] == CANCELED) + { + $button_key = 'data-btn-restore'; + $button_label = $this->lang->line('common_restore'); + } + else + { + $button_key = 'data-btn-delete'; + $button_label = $this->lang->line('common_delete'); + } + $summary_data[] = $this->xss_clean(array( 'id' => anchor('sales/receipt/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target'=>'_blank')), 'type_code' => $row['type_code'], @@ -910,7 +935,10 @@ class Reports extends Secure_Controller 'cost' => to_currency($row['cost']), 'profit' => to_currency($row['profit']), 'payment_type' => $row['payment_type'], - 'comment' => $row['comment'])); + 'comment' => $row['comment'], + 'edit' => anchor('sales/edit/'. $row['sale_id'], '', + array('class'=>'modal-dlg print_hide', $button_key => $button_label, 'data-btn-submit' => $this->lang->line('common_submit'), 'title' => $this->lang->line('sales_update'))) + )); foreach($report_data['details'][$key] as $drow) { @@ -987,18 +1015,33 @@ class Reports extends Secure_Controller foreach($report_data['summary'] as $key => $row) { + if($row['sale_status'] == CANCELED) + { + $button_key = 'data-btn-restore'; + $button_label = $this->lang->line('common_restore'); + } + else + { + $button_key = 'data-btn-delete'; + $button_label = $this->lang->line('common_delete'); + } + $summary_data[] = $this->xss_clean(array( 'id' => anchor('sales/receipt/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target'=>'_blank')), 'type_code' => $row['type_code'], 'sale_date' => $row['sale_date'], 'quantity' => to_quantity_decimals($row['items_purchased']), + 'employee_name' => $row['employee_name'], 'customer_name' => $row['customer_name'], 'subtotal' => to_currency($row['subtotal']), 'tax' => to_currency_tax($row['tax']), 'total' => to_currency($row['total']), + 'cost' => to_currency($row['cost']), 'profit' => to_currency($row['profit']), 'payment_type' => $row['payment_type'], - 'comment' => $row['comment'] + 'comment' => $row['comment'], + 'edit' => anchor('sales/edit/'. $row['sale_id'], '', + array('class'=>'modal-dlg print_hide', $button_key => $button_label, 'data-btn-submit' => $this->lang->line('common_submit'), 'title' => $this->lang->line('sales_update'))) )); foreach($report_data['details'][$key] as $drow) @@ -1262,7 +1305,13 @@ class Reports extends Secure_Controller { $quantity_purchased .= ' [' . $this->Stock_location->get_location_name($drow['item_location']) . ']'; } - $details_data[$row['receiving_id']][] = $this->xss_clean(array($drow['item_number'], $drow['name'], $drow['category'], $quantity_purchased, to_currency($drow['total']), $drow['discount_percent'].'%')); + $details_data[$row['receiving_id']][] = $this->xss_clean(array( + $drow['item_number'], + $drow['name'], + $drow['category'], + $quantity_purchased, + to_currency($drow['total']), + $drow['discount_percent'].'%')); } } diff --git a/application/language/en-GB/reports_lang.php b/application/language/en-GB/reports_lang.php index b61e624c1..358d08ba8 100644 --- a/application/language/en-GB/reports_lang.php +++ b/application/language/en-GB/reports_lang.php @@ -52,7 +52,7 @@ $lang["reports_inventory_summary_report"] = "Inventory Summary Report"; $lang["reports_item"] = "Item"; $lang["reports_item_count"] = "Filter Item Count"; $lang["reports_item_name"] = "Item Name"; -$lang["reports_item_number"] = "Item Number"; +$lang["reports_item_number"] = "Barcode"; $lang["reports_items"] = "Items"; $lang["reports_items_purchased"] = "Items Purchased"; $lang["reports_items_received"] = "Items Received"; diff --git a/application/language/en-US/reports_lang.php b/application/language/en-US/reports_lang.php index 8d7931e76..8160bfefc 100644 --- a/application/language/en-US/reports_lang.php +++ b/application/language/en-US/reports_lang.php @@ -39,7 +39,9 @@ $lang["reports_expenses_categories"] = "Expenses"; $lang["reports_expenses_categories_summary_report"] = "Expense Categories Summary Report"; $lang["reports_expenses_category"] = "Category"; $lang["reports_expenses_amount"] = "Amount"; +$lang["reports_expenses_tax_amount"] = "Tax"; $lang["reports_expenses_total_amount"] = "Total Amount"; +$lang["reports_expenses_total_tax_amount"] = "Total Tax"; $lang["reports_graphical_reports"] = "Graphical Reports"; $lang["reports_inventory"] = "Inventory"; $lang["reports_inventory_low"] = "Low Inventory"; @@ -50,7 +52,7 @@ $lang["reports_inventory_summary_report"] = "Inventory Summary Report"; $lang["reports_item"] = "Item"; $lang["reports_item_count"] = "Filter Item Count"; $lang["reports_item_name"] = "Item Name"; -$lang["reports_item_number"] = "Item Number"; +$lang["reports_item_number"] = "Barcode"; $lang["reports_items"] = "Items"; $lang["reports_items_purchased"] = "Items Purchased"; $lang["reports_items_received"] = "Items Received"; diff --git a/application/models/Item.php b/application/models/Item.php index d8dac58d4..d876d5d87 100644 --- a/application/models/Item.php +++ b/application/models/Item.php @@ -484,7 +484,7 @@ class Item extends CI_Model { $suggestions = array(); - $this->db->select($this->get_search_suggestion_format('item_id,name')); + $this->db->select($this->get_search_suggestion_format('item_id, name')); $this->db->from('items'); $this->db->where('deleted', $filters['is_deleted']); $this->db->where("item_type = " . ITEM); // standard, exclude kit items since kits will be picked up later @@ -495,7 +495,7 @@ class Item extends CI_Model $suggestions[] = array('value' => $row->item_id, 'label' => $this->get_search_suggestion_label($row)); } - $this->db->select($this->get_search_suggestion_format('item_id,item_number')); + $this->db->select($this->get_search_suggestion_format('item_id, item_number')); $this->db->from('items'); $this->db->where('deleted', $filters['is_deleted']); $this->db->where("item_type = " . ITEM); // standard, exclude kit items since kits will be picked up later @@ -576,7 +576,6 @@ class Item extends CI_Model } } - //only return $limit suggestions if(count($suggestions > $limit)) { @@ -687,7 +686,6 @@ class Item extends CI_Model } } - //only return $limit suggestions if(count($suggestions > $limit)) { diff --git a/application/models/Sale.php b/application/models/Sale.php index 4330065a0..443fa9ec0 100644 --- a/application/models/Sale.php +++ b/application/models/Sale.php @@ -1183,6 +1183,7 @@ class Sale extends CI_Model MAX(CONCAT(employee.first_name, " ", employee.last_name)) AS employee_name, items.item_id AS item_id, MAX(items.name) AS name, + MAX(items.item_number) AS item_number, MAX(items.category) AS category, MAX(items.supplier_id) AS supplier_id, MAX(sales_items.quantity_purchased) AS quantity_purchased, diff --git a/application/models/reports/Detailed_sales.php b/application/models/reports/Detailed_sales.php index e247ae9c1..562c9ab93 100644 --- a/application/models/reports/Detailed_sales.php +++ b/application/models/reports/Detailed_sales.php @@ -25,7 +25,7 @@ class Detailed_sales extends Report array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'), array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'number_sorter'), array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'number_sorter'), - array('payment_type' => $this->lang->line('sales_amount_tendered')), + array('payment_type' => $this->lang->line('reports_payment_type')), array('comment' => $this->lang->line('reports_comments'))), 'details' => array( $this->lang->line('reports_name'), @@ -50,14 +50,14 @@ class Detailed_sales extends Report $this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, - employee_name, - customer_name, + MAX(employee_name) AS employee_name, + MAX(customer_name) AS customer_name, SUM(subtotal) AS subtotal, SUM(tax) AS tax, SUM(total) AS total, SUM(cost) AS cost, SUM(profit) AS profit, - payment_type, + MAX(payment_type) AS payment_type, comment'); $this->db->from('sales_items_temp'); $this->db->where('sale_id', $sale_id); diff --git a/application/models/reports/Specific_customer.php b/application/models/reports/Specific_customer.php index ba33c3933..7ec5ab0df 100644 --- a/application/models/reports/Specific_customer.php +++ b/application/models/reports/Specific_customer.php @@ -55,6 +55,7 @@ class Specific_customer extends Report WHEN sale_status = ' . CANCELED . ' THEN \'' . $this->lang->line('reports_code_canceled') . '\' ELSE \'\' END) AS type_code, + MAX(sale_status) as sale_status, MAX(sale_date) AS sale_date, SUM(quantity_purchased) AS items_purchased, MAX(employee_name) AS employee_name, diff --git a/application/models/reports/Specific_discount.php b/application/models/reports/Specific_discount.php index c2291ebb5..233500168 100755 --- a/application/models/reports/Specific_discount.php +++ b/application/models/reports/Specific_discount.php @@ -18,10 +18,12 @@ class Specific_discount extends Report array('type_code' => $this->lang->line('reports_code_type')), array('sale_date' => $this->lang->line('reports_date')), array('quantity' => $this->lang->line('reports_quantity')), + array('employee_name' => $this->lang->line('reports_sold_by')), array('customer_name' => $this->lang->line('reports_sold_to')), array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'), array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'), array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'), + array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'number_sorter'), array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'number_sorter'), array('payment_type' => $this->lang->line('reports_payment_type')), array('comment' => $this->lang->line('reports_comments'))), @@ -53,8 +55,10 @@ class Specific_discount extends Report WHEN sale_status = ' . CANCELED . ' THEN \'' . $this->lang->line('reports_code_canceled') . '\' ELSE \'\' END) AS type_code, + MAX(sale_status) as sale_status, MAX(sale_date) AS sale_date, SUM(quantity_purchased) AS items_purchased, + MAX(employee_name) AS employee_name, MAX(customer_name) AS customer_name, SUM(subtotal) AS subtotal, SUM(tax) AS tax, diff --git a/application/models/reports/Specific_employee.php b/application/models/reports/Specific_employee.php index f0e83f80f..4d8f0a3ce 100644 --- a/application/models/reports/Specific_employee.php +++ b/application/models/reports/Specific_employee.php @@ -55,6 +55,7 @@ class Specific_employee extends Report WHEN sale_status = ' . CANCELED . ' THEN \'' . $this->lang->line('reports_code_canceled') . '\' ELSE \'\' END) AS type_code, + MAX(sale_status) as sale_status, MAX(sale_date) AS sale_date, SUM(quantity_purchased) AS items_purchased, MAX(customer_name) AS customer_name, diff --git a/application/views/items/form.php b/application/views/items/form.php index a44309a8c..54f0e4e49 100644 --- a/application/views/items/form.php +++ b/application/views/items/form.php @@ -252,7 +252,7 @@ );?> - +