From 6c0124cd176bdbb6b0a14e403ebff1a72fe0e5a8 Mon Sep 17 00:00:00 2001 From: FrancescoUK Date: Sat, 15 Apr 2017 10:04:48 +0100 Subject: [PATCH] Minor fixes --- application/config/autoload.php | 2 +- application/controllers/Customers.php | 8 ++++---- application/controllers/Items.php | 6 +++--- application/controllers/Receivings.php | 2 -- application/controllers/Sales.php | 13 +++++++++---- application/libraries/Tax_lib.php | 11 +++++++---- application/models/Dinner_table.php | 2 +- application/models/Tax.php | 25 ++++++++++++++++++------- 8 files changed, 43 insertions(+), 26 deletions(-) diff --git a/application/config/autoload.php b/application/config/autoload.php index e039a5c28..7b0454a6b 100644 --- a/application/config/autoload.php +++ b/application/config/autoload.php @@ -132,4 +132,4 @@ $autoload['language'] = array(); | | $autoload['model'] = array('first_model' => 'first'); */ -$autoload['model'] = array('Appconfig', 'Person', 'Customer', 'Employee', 'Module', 'Item', 'Item_taxes', 'Sale', 'Sale_suspended', 'Supplier', 'Inventory', 'Receiving', 'Giftcard', 'Item_kit', 'Item_kit_items', 'Stock_location', 'Item_quantity','Dinner_table','Customer_rewards','Rewards', 'Tax'); +$autoload['model'] = array('Appconfig', 'Person', 'Customer', 'Employee', 'Module', 'Item', 'Item_taxes', 'Sale', 'Sale_suspended', 'Supplier', 'Inventory', 'Receiving', 'Giftcard', 'Item_kit', 'Item_kit_items', 'Stock_location', 'Item_quantity', 'Dinner_table', 'Customer_rewards', 'Rewards', 'Tax'); diff --git a/application/controllers/Customers.php b/application/controllers/Customers.php index ca0b27c4f..0b643a060 100644 --- a/application/controllers/Customers.php +++ b/application/controllers/Customers.php @@ -71,7 +71,7 @@ class Customers extends Persons $info->$property = $this->xss_clean($value); } $data['person_info'] = $info; - $data['sales_tax_code_label'] = $info->sales_tax_code . ' ' .$this->Tax->get_info($info->sales_tax_code)->tax_code_name; + $data['sales_tax_code_label'] = $info->sales_tax_code . ' ' . $this->Tax->get_info($info->sales_tax_code)->tax_code_name; $data['total'] = $this->xss_clean($this->Customer->get_totals($customer_id)->total); $packages = array('' => $this->lang->line('items_none')); foreach($this->Customer_rewards->get_all()->result_array() as $row) @@ -83,11 +83,11 @@ class Customers extends Persons if ($customer_sales_tax_support == '1') { - $data['customer_sales_tax_enabled'] = TRUE; + $data['customer_sales_tax_enabled'] = TRUE; } else { - $data['customer_sales_tax_enabled'] = FALSE; + $data['customer_sales_tax_enabled'] = FALSE; } $this->load->view("customers/form", $data); @@ -271,4 +271,4 @@ class Customers extends Persons } } } -?> \ No newline at end of file +?> diff --git a/application/controllers/Items.php b/application/controllers/Items.php index ee1b73ade..3ada48bc0 100644 --- a/application/controllers/Items.php +++ b/application/controllers/Items.php @@ -213,7 +213,7 @@ class Items extends Secure_Controller $customer_sales_tax_support = $this->config->item('customer_sales_tax_support'); if($customer_sales_tax_support == '1') { - $data['customer_sales_tax_enabled'] = TRUE; + $data['customer_sales_tax_enabled'] = TRUE; $tax_categories = array(); foreach($this->Tax->get_all_tax_categories()->result_array() as $row) { @@ -224,7 +224,7 @@ class Items extends Secure_Controller } else { - $data['customer_sales_tax_enabled'] = FALSE; + $data['customer_sales_tax_enabled'] = FALSE; $data['tax_categories'] = array(); $data['selected_tax_category'] = ''; } @@ -705,7 +705,7 @@ class Items extends Secure_Controller /*if(strcmp('.htaccess', $pic_file)==0) { $pic_file=''; }*/ - $item_data['pic_filename']=$pic_file; + $item_data['pic_filename'] = $pic_file; $item_number = $data[0]; $invalidated = FALSE; diff --git a/application/controllers/Receivings.php b/application/controllers/Receivings.php index d0eb93381..a6f98a859 100644 --- a/application/controllers/Receivings.php +++ b/application/controllers/Receivings.php @@ -37,8 +37,6 @@ class Receivings extends Secure_Controller echo json_encode($suggestions); } - - public function select_supplier() { $supplier_id = $this->input->post('supplier'); diff --git a/application/controllers/Sales.php b/application/controllers/Sales.php index f5215d2c7..12a9e5f8c 100644 --- a/application/controllers/Sales.php +++ b/application/controllers/Sales.php @@ -236,7 +236,7 @@ class Sales extends Secure_Controller $this->sale_lib->add_payment($payment_type, $amount_tendered); } } - else if ($payment_type == $this->lang->line('sales_rewards')) + elseif ($payment_type == $this->lang->line('sales_rewards')) { $customer_id = $this->sale_lib->get_customer(); $package_id = $this->Customer->get_info($customer_id)->package_id; @@ -970,9 +970,13 @@ class Sales extends Secure_Controller $data['email_receipt'] = $this->sale_lib->get_email_receipt(); $data['selected_payment_type'] = $this->sale_lib->get_payment_type(); if($customer_info && $this->config->item('customer_reward_enable') == TRUE) - $data['payment_options'] = $this->Sale->get_payment_options(TRUE,TRUE); + { + $data['payment_options'] = $this->Sale->get_payment_options(TRUE, TRUE); + } else + { $data['payment_options'] = $this->Sale->get_payment_options(); + } $quote_number = $this->sale_lib->get_quote_number(); if ($quote_number != NULL) { @@ -1214,7 +1218,8 @@ class Sales extends Secure_Controller $sale_id = $this->input->post('suspended_sale_id'); $this->sale_lib->clear_all(); - if($sale_id > 0) { + if($sale_id > 0) + { $this->sale_lib->copy_entire_sale($sale_id); $this->Sale->delete_suspended_sale($sale_id); } @@ -1256,4 +1261,4 @@ class Sales extends Secure_Controller } } -?> \ No newline at end of file +?> diff --git a/application/libraries/Tax_lib.php b/application/libraries/Tax_lib.php index aefd54f89..0718dbb9d 100644 --- a/application/libraries/Tax_lib.php +++ b/application/libraries/Tax_lib.php @@ -89,7 +89,8 @@ class Tax_lib $tax_group_index = $this->clean('X'.$tax_group); - if ($item_tax_amount != 0) { + if ($item_tax_amount != 0) + { if(!array_key_exists($tax_group_index, $sales_taxes)) { $insertkey = $tax_group_index; @@ -148,10 +149,11 @@ class Tax_lib */ public function round_sales_taxes(&$sales_taxes) { - if (!empty($sales_taxes)) + if(!empty($sales_taxes)) { $sort = array(); - foreach($sales_taxes as $k=>$v) { + foreach($sales_taxes as $k=>$v) + { $sort['print_sequence'][$k] = $v['print_sequence']; } array_multisort($sort['print_sequence'], SORT_ASC, $sales_taxes); @@ -307,6 +309,7 @@ class Tax_lib $tax_code = $sales_tax_code; } } + return $tax_code; } @@ -317,4 +320,4 @@ class Tax_lib } } -?> \ No newline at end of file +?> diff --git a/application/models/Dinner_table.php b/application/models/Dinner_table.php index 96a3c4acd..55538366c 100644 --- a/application/models/Dinner_table.php +++ b/application/models/Dinner_table.php @@ -57,7 +57,7 @@ class Dinner_table extends CI_Model public function get_name($dinner_table_id) { - if($dinner_table_id == null || empty($dinner_table_id)) + if(empty($dinner_table_id)) { return ''; } diff --git a/application/models/Tax.php b/application/models/Tax.php index 4ed6e0bfd..a4b613b15 100644 --- a/application/models/Tax.php +++ b/application/models/Tax.php @@ -157,6 +157,7 @@ Gets information about a particular tax_code $this->save_tax_rates($tax_rate_data, $tax_code); return TRUE; } + return FALSE; } @@ -180,6 +181,7 @@ Gets information about a particular tax_code { return TRUE; } + return FALSE; } @@ -203,8 +205,10 @@ Gets information about a particular tax_code // Delete all exceptions for the given tax_code $this->delete_tax_rate_exceptions($tax_code); - if ($tax_rate_data != NULL) { - foreach ($tax_rate_data as $row) { + if ($tax_rate_data != NULL) + { + foreach ($tax_rate_data as $row) + { $row['rate_tax_code'] = $tax_code; $success &= $this->db->insert('tax_code_rates', $row); } @@ -255,7 +259,8 @@ Gets information about a particular tax_code $this->db->from('tax_codes'); $this->db->join('tax_code_rates', 'tax_code = rate_tax_code and rate_tax_category_id = 0', 'LEFT'); - if (!empty($search)) { + if (!empty($search)) + { $this->db->like('tax_code', $search); $this->db->or_like('tax_code_name', $search); } @@ -275,7 +280,8 @@ Gets information about a particular tax_code public function get_found_rows($search) { $this->db->from('tax_codes'); - if (!empty($search)) { + if (!empty($search)) + { $this->db->like('tax_code', $search); $this->db->or_like('tax_code_name', $search); } @@ -300,7 +306,8 @@ Gets information about a particular tax_code $suggestions = array(); $this->db->from('tax_codes'); - if (!empty($search)) { + if (!empty($search)) + { $this->db->like('tax_code', $search); $this->db->or_like('tax_code_name', $search); } @@ -326,7 +333,8 @@ Gets information about a particular tax_code $this->db->from('tax_categories'); $this->db->where('tax_category_id !=', 0); - if (!empty($search)) { + if (!empty($search)) + { $this->db->like('tax_category', '%'.$search.'%'); } $this->db->order_by('tax_category', 'asc'); @@ -344,6 +352,7 @@ Gets information about a particular tax_code $this->db->select('tax_category'); $this->db->from('tax_categories'); $this->db->where('tax_category_id', $tax_category_id); + return $this->db->get()->row()->tax_category; } @@ -351,6 +360,7 @@ Gets information about a particular tax_code { $this->db->from('tax_categories'); $this->db->order_by('tax_category_id'); + return $this->db->get(); } @@ -358,6 +368,7 @@ Gets information about a particular tax_code { $this->db->select('tax_category_id'); $this->db->from('tax_categories'); + return $this->db->get()->row()->tax_category_id; } @@ -372,4 +383,4 @@ Gets information about a particular tax_code return $this->db->get()->result_array(); } } -?> \ No newline at end of file +?>