diff --git a/application/controllers/Config.php b/application/controllers/Config.php
index 61b4f7da4..6d0d1a994 100644
--- a/application/controllers/Config.php
+++ b/application/controllers/Config.php
@@ -1,4 +1,4 @@
-load->view('home');
@@ -21,4 +16,4 @@ class Home extends Secure_Controller
$this->Employee->logout();
}
}
-?>
\ No newline at end of file
+?>
diff --git a/application/controllers/Login.php b/application/controllers/Login.php
index 46a5e4764..cb883b4e2 100644
--- a/application/controllers/Login.php
+++ b/application/controllers/Login.php
@@ -2,11 +2,6 @@
class Login extends CI_Controller
{
- public function __construct()
- {
- parent::__construct();
- }
-
public function index()
{
if($this->Employee->is_logged_in())
diff --git a/application/controllers/Migrate.php b/application/controllers/Migrate.php
index ad3452316..70c3bf2ff 100644
--- a/application/controllers/Migrate.php
+++ b/application/controllers/Migrate.php
@@ -1,17 +1,17 @@
-load->library('migration');
}
- public function index()
+ public function index()
{
$this->load->view('migrate/manage');
}
@@ -20,15 +20,12 @@ class Migrate extends Secure_Controller {
{
if( ! $this->migration->latest())
{
- echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('migrate_failed - '.$this->migration->error_string())));
+ echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('migrate_failed - ' . $this->migration->error_string())));
}
else
{
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('migrate_success')));
}
}
-
}
-
?>
-
diff --git a/application/controllers/No_access.php b/application/controllers/No_access.php
index d8efeea69..9a2a306bb 100644
--- a/application/controllers/No_access.php
+++ b/application/controllers/No_access.php
@@ -2,11 +2,6 @@
class No_Access extends CI_Controller
{
- public function __construct()
- {
- parent::__construct();
- }
-
public function index($module_id = '', $permission_id = '')
{
$data['module_name'] = $this->Module->get_module_name($module_id);
@@ -17,4 +12,4 @@ class No_Access extends CI_Controller
$this->load->view('no_access', $data);
}
}
-?>
\ No newline at end of file
+?>
diff --git a/application/core/MY_Lang.php b/application/core/MY_Lang.php
index 5b82d84b0..b04738367 100644
--- a/application/core/MY_Lang.php
+++ b/application/core/MY_Lang.php
@@ -1,12 +1,7 @@
-output();
}
}
-?>
\ No newline at end of file
+?>
diff --git a/application/helpers/locale_helper.php b/application/helpers/locale_helper.php
index 3c98d06fb..0a39aa985 100644
--- a/application/helpers/locale_helper.php
+++ b/application/helpers/locale_helper.php
@@ -1,7 +1,7 @@
-config;
$fmt = new \NumberFormatter($config->item('number_locale'), $type);
$fmt->setAttribute(\NumberFormatter::MIN_FRACTION_DIGITS, $config->item($decimals));
diff --git a/application/helpers/report_helper.php b/application/helpers/report_helper.php
index 473e60213..ce5fc3850 100644
--- a/application/helpers/report_helper.php
+++ b/application/helpers/report_helper.php
@@ -1,10 +1,10 @@
-Employee->has_grant($permission_id, $person_id))
{
show_report($report_prefix, $report_name, $permission_id);
@@ -23,8 +23,7 @@ function show_report($report_prefix, $report_name, $lang_key='')
{
?>
-
\ No newline at end of file
+?>
diff --git a/application/helpers/table_helper.php b/application/helpers/table_helper.php
index e881a7c05..060cf8e3d 100644
--- a/application/helpers/table_helper.php
+++ b/application/helpers/table_helper.php
@@ -1,4 +1,4 @@
- $CI->lang->line('sales_change_due')),
array('payment_type' => $CI->lang->line('sales_payment_type'))
);
-
+
if($CI->config->item('invoice_enable') == TRUE)
{
$headers[] = array('invoice_number' => $CI->lang->line('sales_invoice_number'));
@@ -170,7 +170,7 @@ function get_people_manage_table_headers()
{
$headers[] = array('messages' => '', 'sortable' => FALSE);
}
-
+
return transform_headers($headers);
}
@@ -185,7 +185,7 @@ function get_person_data_row($person, $controller)
'first_name' => $person->first_name,
'email' => empty($person->email) ? '' : mailto($person->email, $person->email),
'phone_number' => $person->phone_number,
- 'messages' => empty($person->phone_number) ? '' : anchor("Messages/view/$person->person_id", '',
+ 'messages' => empty($person->phone_number) ? '' : anchor("Messages/view/$person->person_id", '',
array('class'=>'modal-dlg', 'data-btn-submit' => $CI->lang->line('common_submit'), 'title'=>$CI->lang->line('messages_sms_send'))),
'edit' => anchor($controller_name."/view/$person->person_id", '',
array('class'=>'modal-dlg', 'data-btn-submit' => $CI->lang->line('common_submit'), 'title'=>$CI->lang->line($controller_name.'_update'))
@@ -209,7 +209,7 @@ function get_customer_manage_table_headers()
{
$headers[] = array('messages' => '', 'sortable' => FALSE);
}
-
+
return transform_headers($headers);
}
@@ -225,7 +225,7 @@ function get_customer_data_row($person, $stats, $controller)
'email' => empty($person->email) ? '' : mailto($person->email, $person->email),
'phone_number' => $person->phone_number,
'total' => to_currency($stats->total),
- 'messages' => empty($person->phone_number) ? '' : anchor("Messages/view/$person->person_id", '',
+ 'messages' => empty($person->phone_number) ? '' : anchor("Messages/view/$person->person_id", '',
array('class'=>'modal-dlg', 'data-btn-submit' => $CI->lang->line('common_submit'), 'title'=>$CI->lang->line('messages_sms_send'))),
'edit' => anchor($controller_name."/view/$person->person_id", '',
array('class'=>'modal-dlg', 'data-btn-submit' => $CI->lang->line('common_submit'), 'title'=>$CI->lang->line($controller_name.'_update'))
@@ -267,7 +267,7 @@ function get_supplier_data_row($supplier, $controller)
'first_name' => $supplier->first_name,
'email' => empty($supplier->email) ? '' : mailto($supplier->email, $supplier->email),
'phone_number' => $supplier->phone_number,
- 'messages' => empty($supplier->phone_number) ? '' : anchor("Messages/view/$supplier->person_id", '',
+ 'messages' => empty($supplier->phone_number) ? '' : anchor("Messages/view/$supplier->person_id", '',
array('class'=>"modal-dlg", 'data-btn-submit' => $CI->lang->line('common_submit'), 'title'=>$CI->lang->line('messages_sms_send'))),
'edit' => anchor($controller_name."/view/$supplier->person_id", '',
array('class'=>"modal-dlg", 'data-btn-submit' => $CI->lang->line('common_submit'), 'title'=>$CI->lang->line($controller_name.'_update')))
@@ -450,5 +450,4 @@ function get_item_kit_data_row($item_kit, $controller)
array('class'=>'modal-dlg', 'data-btn-submit' => $CI->lang->line('common_submit'), 'title'=>$CI->lang->line($controller_name.'_update'))
));
}
-
?>
diff --git a/application/libraries/Barcode_lib.php b/application/libraries/Barcode_lib.php
index 153c61d8e..afe72fbeb 100644
--- a/application/libraries/Barcode_lib.php
+++ b/application/libraries/Barcode_lib.php
@@ -7,21 +7,31 @@ require APPPATH.'/views/barcodes/Code128.php';
require APPPATH.'/views/barcodes/Ean13.php';
require APPPATH.'/views/barcodes/Ean8.php';
+/**
+ * Barcode library
+ *
+ * Library with utilities to manage barcodes
+ *
+ * @link github.com/jekkos/opensourcepos
+ * @since 2.x
+ * @author Jekkos
+ */
+
class Barcode_lib
{
private $CI;
private $supported_barcodes = array('Code39' => 'Code 39', 'Code128' => 'Code 128', 'Ean8' => 'EAN 8', 'Ean13' => 'EAN 13');
-
+
public function __construct()
{
$this->CI =& get_instance();
}
-
+
public function get_list_barcodes()
{
return $this->supported_barcodes;
}
-
+
public function get_barcode_config()
{
$data['company'] = $this->CI->config->item('company');
@@ -36,10 +46,10 @@ class Barcode_lib
$data['barcode_second_row'] = $this->CI->config->item('barcode_second_row');
$data['barcode_third_row'] = $this->CI->config->item('barcode_third_row');
$data['barcode_num_in_row'] = $this->CI->config->item('barcode_num_in_row');
- $data['barcode_page_width'] = $this->CI->config->item('barcode_page_width');
+ $data['barcode_page_width'] = $this->CI->config->item('barcode_page_width');
$data['barcode_page_cellspacing'] = $this->CI->config->item('barcode_page_cellspacing');
$data['barcode_generate_if_empty'] = $this->CI->config->item('barcode_generate_if_empty');
-
+
return $data;
}
@@ -73,16 +83,16 @@ class Barcode_lib
case 'Code39':
return new emberlabs\Barcode\Code39();
break;
-
+
case 'Code128':
default:
return new emberlabs\Barcode\Code128();
break;
-
+
case 'Ean8':
return new emberlabs\Barcode\Ean8();
break;
-
+
case 'Ean13':
return new emberlabs\Barcode\Ean13();
break;
@@ -121,12 +131,12 @@ class Barcode_lib
$barcode_instance->setDimensions($barcode_config['barcode_width'], $barcode_config['barcode_height']);
$barcode_instance->draw();
-
+
return $barcode_instance->base64();
- }
+ }
catch(Exception $e)
{
- echo 'Caught exception: ', $e->getMessage(), "\n";
+ echo 'Caught exception: ', $e->getMessage(), "\n";
}
}
@@ -139,24 +149,24 @@ class Barcode_lib
// set the receipt number to generate the barcode for
$barcode->setData($barcode_content);
-
+
// image quality 100
$barcode->setQuality(100);
-
+
// width: 200, height: 30
$barcode->setDimensions(200, 30);
// draw the image
$barcode->draw();
-
+
return $barcode->base64();
- }
+ }
catch(Exception $e)
{
- echo 'Caught exception: ', $e->getMessage(), "\n";
+ echo 'Caught exception: ', $e->getMessage(), "\n";
}
}
-
+
public function display_barcode($item, $barcode_config)
{
$display_table = "
";
@@ -166,14 +176,14 @@ class Barcode_lib
$display_table .= "| " . $this->manage_display_layout($barcode_config['barcode_second_row'], $item, $barcode_config) . " |
";
$display_table .= "| " . $this->manage_display_layout($barcode_config['barcode_third_row'], $item, $barcode_config) . " |
";
$display_table .= "
";
-
+
return $display_table;
}
-
+
private function manage_display_layout($layout_type, $item, $barcode_config)
{
$result = '';
-
+
if($layout_type == 'name')
{
$result = $this->CI->lang->line('items_name') . " " . $item['name'];
@@ -201,8 +211,8 @@ class Barcode_lib
return character_limiter($result, 40);
}
-
- public function listfonts($folder)
+
+ public function listfonts($folder)
{
$array = array();
diff --git a/application/libraries/Email_lib.php b/application/libraries/Email_lib.php
index 2a8050391..d4c11b007 100644
--- a/application/libraries/Email_lib.php
+++ b/application/libraries/Email_lib.php
@@ -1,5 +1,15 @@
CI =& get_instance();
-
+
$this->CI->load->library('email');
$config = array(
@@ -23,34 +33,34 @@ class Email_lib
'smtp_timeout' => $this->CI->config->item('smtp_timeout'),
'smtp_crypto' => $this->CI->config->item('smtp_crypto')
);
-
+
$this->CI->email->initialize($config);
}
-
- /*
+
+ /**
* Email sending function
* Example of use: $response = sendEmail('john@doe.com', 'Hello', 'This is a message', $filename);
*/
public function sendEmail($to, $subject, $message, $attachment = NULL)
{
$email = $this->CI->email;
-
+
$email->from($this->CI->config->item('email'), $this->CI->config->item('company'));
$email->to($to);
$email->subject($subject);
$email->message($message);
- if( !empty($attachment) )
+ if(!empty($attachment))
{
$email->attach($attachment);
}
$result = $email->send();
-
+
if(!$result)
{
error_log($email->print_debugger());
}
-
+
return $result;
}
}
diff --git a/application/libraries/Item_lib.php b/application/libraries/Item_lib.php
index 4ed53ec14..2ccb310b9 100644
--- a/application/libraries/Item_lib.php
+++ b/application/libraries/Item_lib.php
@@ -1,5 +1,15 @@
CI->session->unset_userdata('item_location');
- }
+ }
}
?>
diff --git a/application/libraries/Mailchimp_lib.php b/application/libraries/Mailchimp_lib.php
index 3dc39c443..e3f9011c5 100644
--- a/application/libraries/Mailchimp_lib.php
+++ b/application/libraries/Mailchimp_lib.php
@@ -2,9 +2,13 @@
/**
* MailChimp API v3 REST client Connector
- *
+ *
* Interface for communicating with the Mailchimp v3 API
*
+ * @link github.com/jekkos/opensourcepos
+ * @since 3.1
+ * @author daN4cat (FrancescoUK)
+ *
* Inspired by the work of:
* - Rajitha Bandara: https://github.com/rajitha-bandara/ci-mailchimp-v3-rest-client
* - Stefan Ashwell: https://github.com/stef686/codeigniter-mailchimp-api-v3
@@ -66,7 +70,7 @@ class MailchimpConnector
{
return $this->_request($httpVerb, $method, $args);
}
-
+
return FALSE;
}
@@ -88,13 +92,13 @@ class MailchimpConnector
}
/**
- * Performs the underlying HTTP request.
+ * Performs the underlying HTTP request.
* @param string $httpVerb The HTTP method to be used
* @param string $method The API method to be called
* @param array $args Assoc array of parameters to be passed
* @return array Assoc array of decoded result
*/
- private function _request($httpVerb, $method, $args = array())
+ private function _request($httpVerb, $method, $args = array())
{
$result = FALSE;
@@ -123,9 +127,13 @@ class MailchimpConnector
/**
* Mailchimp library, usable from CI code
- *
+ *
* Library with utility queries to interface Mailchimp v3 API
*
+ * @link github.com/jekkos/opensourcepos
+ * @since 3.1
+ * @author daN4cat (FrancescoUK)
+ *
* Inspired by the work of ThinkShout: https://github.com/thinkshout/mailchimp-api-php
*/
@@ -138,7 +146,7 @@ class Mailchimp_lib
$api_key = (count($params) > 0 && !empty($params['api_key'])) ? $params['api_key'] : '';
$this->_connector = new MailchimpConnector($api_key);
}
-
+
/**
* Gets information about all lists owned by the authenticated account.
*
@@ -191,7 +199,7 @@ class Mailchimp_lib
'count' => $count,
'offset' => $offset
];
-
+
return $this->_connector->call('GET', '/lists/' . $list_id . '/members', $parameters);
}
@@ -354,4 +362,4 @@ class Mailchimp_lib
}
}
-?>
\ No newline at end of file
+?>
diff --git a/application/libraries/Receiving_lib.php b/application/libraries/Receiving_lib.php
index 80a8c47b9..fc7adc157 100644
--- a/application/libraries/Receiving_lib.php
+++ b/application/libraries/Receiving_lib.php
@@ -1,5 +1,15 @@
CI =& get_instance();
$this->CI->load->library('tax_lib');
$this->CI->load->model('enums/Rounding_code');
-
}
public function get_line_sequence_options()
@@ -114,8 +123,8 @@ class Sale_lib
{
$this->CI->session->unset_userdata('sales_cart');
}
-
- public function get_comment()
+
+ public function get_comment()
{
// avoid returning a NULL that results in a 0 in the comment if nothing is set/available
$comment = $this->CI->session->userdata('sales_comment');
@@ -123,16 +132,16 @@ class Sale_lib
return empty($comment) ? '' : $comment;
}
- public function set_comment($comment)
+ public function set_comment($comment)
{
$this->CI->session->set_userdata('sales_comment', $comment);
}
- public function clear_comment()
+ public function clear_comment()
{
$this->CI->session->unset_userdata('sales_comment');
}
-
+
public function get_invoice_number()
{
return $this->CI->session->userdata('sales_invoice_number');
@@ -203,29 +212,29 @@ class Sale_lib
{
return $this->CI->session->set_userdata('sales_invoice_number_enabled', $invoice_number_enabled);
}
-
- public function is_print_after_sale()
+
+ public function is_print_after_sale()
{
return ($this->CI->session->userdata('sales_print_after_sale') == 'true' ||
$this->CI->session->userdata('sales_print_after_sale') == '1');
}
-
+
public function set_print_after_sale($print_after_sale)
{
return $this->CI->session->set_userdata('sales_print_after_sale', $print_after_sale);
}
-
- public function get_email_receipt()
+
+ public function get_email_receipt()
{
return $this->CI->session->userdata('sales_email_receipt');
}
- public function set_email_receipt($email_receipt)
+ public function set_email_receipt($email_receipt)
{
$this->CI->session->set_userdata('sales_email_receipt', $email_receipt);
}
- public function clear_email_receipt()
+ public function clear_email_receipt()
{
$this->CI->session->unset_userdata('sales_email_receipt');
}
@@ -260,7 +269,7 @@ class Sale_lib
{
//add to existing array
$payment = array($payment_id => array('payment_type' => $payment_id, 'payment_amount' => $payment_amount));
-
+
$payments += $payment;
}
@@ -459,7 +468,7 @@ class Sale_lib
{
$this->CI->session->unset_userdata('sales_customer');
}
-
+
public function get_employee()
{
if(!$this->CI->session->userdata('sales_employee'))
@@ -593,7 +602,7 @@ class Sale_lib
{
$item_info = $this->CI->Item->get_info_by_id_or_number($item_id);
- //make sure item exists
+ //make sure item exists
if(empty($item_info))
{
$item_id = -1;
@@ -707,10 +716,10 @@ class Sale_lib
return TRUE;
}
-
+
public function out_of_stock($item_id, $item_location)
{
- //make sure item exists
+ //make sure item exists
if($item_id != -1)
{
$item_info = $this->CI->Item->get_info_by_id_or_number($item_id);
@@ -733,7 +742,7 @@ class Sale_lib
return '';
}
-
+
public function get_quantity_already_added($item_id, $item_location)
{
$items = $this->get_cart();
@@ -745,10 +754,10 @@ class Sale_lib
$quanity_already_added+=$item['quantity'];
}
}
-
+
return $quanity_already_added;
}
-
+
public function get_item_id($line_to_get)
{
$items = $this->get_cart();
@@ -760,14 +769,14 @@ class Sale_lib
return $item['item_id'];
}
}
-
+
return -1;
}
public function edit_item($line, $description, $serialnumber, $quantity, $discount, $price)
{
$items = $this->get_cart();
- if(isset($items[$line]))
+ if(isset($items[$line]))
{
$line = &$items[$line];
$line['description'] = $description;
@@ -806,7 +815,7 @@ class Sale_lib
$this->set_customer($this->CI->Sale->get_customer($sale_id)->person_id);
}
-
+
public function add_item_kit($external_item_kit_id, $item_location, $discount, $price_option, $kit_print_option, &$stock_warning)
{
//KIT #
@@ -856,7 +865,7 @@ class Sale_lib
$stock_warning = $this->out_of_stock($item_kit_item['item_id'], $item_location);
}
}
-
+
return $result;
}
@@ -893,7 +902,7 @@ class Sale_lib
return $this->CI->session->userdata('sales_cart');
}
-
+
public function copy_entire_suspended_sale($sale_id)
{
$this->empty_cart();
@@ -987,12 +996,12 @@ class Sale_lib
}
$this->CI->session->set_userdata('cash_rounding', $cash_rounding);
}
-
+
public function is_customer_taxable()
{
$customer_id = $this->get_customer();
$customer = $this->CI->Customer->get_info($customer_id);
-
+
//Do not charge sales tax if we have a customer that is not taxable
return $customer->taxable or $customer_id == -1;
}
@@ -1061,10 +1070,10 @@ class Sale_lib
}
public function apply_customer_discount($discount_percent)
- {
+ {
// Get all items in the cart so far...
$items = $this->get_cart();
-
+
foreach($items as &$item)
{
$quantity = $item['quantity'];
@@ -1081,7 +1090,7 @@ class Sale_lib
$this->set_cart($items);
}
-
+
public function get_discount()
{
$discount = 0;
@@ -1101,8 +1110,8 @@ class Sale_lib
{
return $this->calculate_subtotal($include_discount, $exclude_tax);
}
-
- public function get_item_total_tax_exclusive($item_id, $quantity, $price, $discount_percentage, $include_discount = FALSE)
+
+ public function get_item_total_tax_exclusive($item_id, $quantity, $price, $discount_percentage, $include_discount = FALSE)
{
$tax_info = $this->CI->Item_taxes->get_info($item_id);
$item_total = $this->get_item_total($quantity, $price, $discount_percentage, $include_discount);
@@ -1112,7 +1121,7 @@ class Sale_lib
$tax_percentage = $tax['percent'];
$item_total = bcsub($item_total, $this->get_item_tax($quantity, $price, $discount_percentage, $tax_percentage));
}
-
+
return $item_total;
}
@@ -1128,7 +1137,7 @@ class Sale_lib
return $discounted_extended_amount;
}
- public function get_item_total($quantity, $price, $discount_percentage, $include_discount = FALSE)
+ public function get_item_total($quantity, $price, $discount_percentage, $include_discount = FALSE)
{
$total = bcmul($quantity, $price);
if($include_discount)
@@ -1154,8 +1163,8 @@ class Sale_lib
return bcmul($total, $discount_fraction);
}
-
- public function get_item_tax($quantity, $price, $discount_percentage, $tax_percentage)
+
+ public function get_item_tax($quantity, $price, $discount_percentage, $tax_percentage)
{
$price = $this->get_item_total($quantity, $price, $discount_percentage, TRUE);
if($this->CI->config->item('tax_included'))
@@ -1180,7 +1189,7 @@ class Sale_lib
{
$subtotal = bcadd($subtotal, $this->get_item_total_tax_exclusive($item['item_id'], $item['quantity'], $item['price'], $item['discount'], $include_discount));
}
- else
+ else
{
$subtotal = bcadd($subtotal, $this->get_item_total($item['quantity'], $item['price'], $item['discount'], $include_discount));
}
@@ -1210,7 +1219,7 @@ class Sale_lib
public function get_empty_tables()
{
- return $this->CI->Dinner_table->get_empty_tables();
+ return $this->CI->Dinner_table->get_empty_tables();
}
public function check_for_cash_rounding($total)
diff --git a/application/libraries/Sms_lib.php b/application/libraries/Sms_lib.php
index 8f1bbbea0..e56cebd63 100644
--- a/application/libraries/Sms_lib.php
+++ b/application/libraries/Sms_lib.php
@@ -1,5 +1,15 @@
CI =& get_instance();
}
-
+
/*
* SMS sending function
* Example of use: $response = sendSMS('4477777777', 'My test message');
@@ -18,34 +28,34 @@ class Sms_lib
$username = $this->CI->config->item('msg_uid');
$password = $this->CI->encryption->decrypt($this->CI->config->item('msg_pwd'));
$originator = $this->CI->config->item('msg_src');
-
+
$response = FALSE;
-
+
// if any of the parameters is empty return with a FALSE
if(empty($username) || empty($password) || empty($phone) || empty($message) || empty($originator))
{
//echo $username . ' ' . $password . ' ' . $phone . ' ' . $message . ' ' . $originator;
}
else
- {
+ {
$response = TRUE;
-
+
// make sure passed string is url encoded
$message = rawurlencode($message);
-
+
// add call to send a message via 3rd party API here
// Some examples
/*
$url = "http://xxx.xxx.xxx.xxx/send_sms?username=$username&password=$password&src=$originator&dst=$phone&msg=$message&dr=1";
-
- $c = curl_init();
- curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($c, CURLOPT_URL, $url);
- $response = curl_exec($c);
+
+ $c = curl_init();
+ curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($c, CURLOPT_URL, $url);
+ $response = curl_exec($c);
curl_close($c);
*/
-
+
// This is a textmarketer.co.uk API call, see: http://wiki.textmarketer.co.uk/display/DevDoc/Text+Marketer+Developer+Documentation+-+Wiki+Home
/*
$url = 'https://api.textmarketer.co.uk/gateway/'."?username=$username&password=$password&option=xml";
diff --git a/application/libraries/Tax_lib.php b/application/libraries/Tax_lib.php
index 994c3e967..df417ab8a 100644
--- a/application/libraries/Tax_lib.php
+++ b/application/libraries/Tax_lib.php
@@ -1,5 +1,15 @@
\ No newline at end of file
+?>
diff --git a/application/libraries/Token_lib.php b/application/libraries/Token_lib.php
index ef423e5d0..09a2de052 100644
--- a/application/libraries/Token_lib.php
+++ b/application/libraries/Token_lib.php
@@ -2,6 +2,16 @@
require_once(APPPATH . 'libraries/tokens/Token.php');
+/**
+ * Token library
+ *
+ * Library with utilities to manage tokens
+ *
+ * @link github.com/jekkos/opensourcepos
+ * @since 3.1
+ * @author SteveIreland
+ */
+
class Token_lib
{
private $CI;
diff --git a/application/libraries/Tracking_lib.php b/application/libraries/Tracking_lib.php
index 6aeb4a289..17a01a895 100644
--- a/application/libraries/Tracking_lib.php
+++ b/application/libraries/Tracking_lib.php
@@ -1,5 +1,15 @@
CI->Appconfig->batch_save(array('client_id' => $clientId));
}
}
-
+
/*
* Track Event function
*/
@@ -66,7 +76,7 @@ class Tracking_lib
error_log($e->getMessage());
}
}
-
+
/*
* Track Page function
*/
diff --git a/application/libraries/tokens/Token.php b/application/libraries/tokens/Token.php
index b11522aad..f4700fa04 100644
--- a/application/libraries/tokens/Token.php
+++ b/application/libraries/tokens/Token.php
@@ -1,4 +1,4 @@
-
\ No newline at end of file
+?>
diff --git a/application/libraries/tokens/Token_customer.php b/application/libraries/tokens/Token_customer.php
index 99688ef4f..46a222b3d 100644
--- a/application/libraries/tokens/Token_customer.php
+++ b/application/libraries/tokens/Token_customer.php
@@ -1,13 +1,19 @@
-CI =& get_instance();
+
$this->CI->load->library('sale_lib');
}
@@ -25,7 +31,6 @@ class Token_customer extends Token
}
return '';
-
}
-
-}
\ No newline at end of file
+}
+?>
diff --git a/application/libraries/tokens/Token_invoice_count.php b/application/libraries/tokens/Token_invoice_count.php
index c3b9ab1fe..a6b592058 100644
--- a/application/libraries/tokens/Token_invoice_count.php
+++ b/application/libraries/tokens/Token_invoice_count.php
@@ -1,13 +1,19 @@
-CI =& get_instance();
+
$this->CI->load->model('Sale');
}
@@ -15,4 +21,5 @@ class Token_invoice_count extends Token
{
return $this->CI->Sale->get_invoice_count();
}
-}
\ No newline at end of file
+}
+?>
diff --git a/application/libraries/tokens/Token_invoice_sequence.php b/application/libraries/tokens/Token_invoice_sequence.php
index cdae5cdbb..c6a0802b1 100644
--- a/application/libraries/tokens/Token_invoice_sequence.php
+++ b/application/libraries/tokens/Token_invoice_sequence.php
@@ -1,17 +1,18 @@
-CI =& get_instance();
- }
-
public function get_value()
{
return $this->CI->Appconfig->acquire_save_next_invoice_sequence();
}
-}
\ No newline at end of file
+}
+?>
diff --git a/application/libraries/tokens/Token_quote_sequence.php b/application/libraries/tokens/Token_quote_sequence.php
index 7169ac695..b7cc08186 100644
--- a/application/libraries/tokens/Token_quote_sequence.php
+++ b/application/libraries/tokens/Token_quote_sequence.php
@@ -1,17 +1,18 @@
-CI =& get_instance();
- }
-
public function get_value()
{
return $this->CI->Appconfig->acquire_save_next_quote_sequence();
}
-}
\ No newline at end of file
+}
+?>
diff --git a/application/libraries/tokens/Token_suspended_invoice_count.php b/application/libraries/tokens/Token_suspended_invoice_count.php
index 2809103b4..ca3e6822a 100644
--- a/application/libraries/tokens/Token_suspended_invoice_count.php
+++ b/application/libraries/tokens/Token_suspended_invoice_count.php
@@ -1,13 +1,19 @@
-CI =& get_instance();
+
$this->CI->load->model('Sale');
}
@@ -16,5 +22,4 @@ class Token_suspended_invoice_count extends Token
return $this->CI->Sale->get_suspended_invoice_count();
}
}
-
-?>
\ No newline at end of file
+?>
diff --git a/application/libraries/tokens/Token_year_invoice_count.php b/application/libraries/tokens/Token_year_invoice_count.php
index 36a1e48eb..6e2242a3b 100644
--- a/application/libraries/tokens/Token_year_invoice_count.php
+++ b/application/libraries/tokens/Token_year_invoice_count.php
@@ -1,13 +1,19 @@
-CI =& get_instance();
+
$this->CI->load->model('Sale');
}
@@ -15,4 +21,5 @@ class Token_year_invoice_count extends Token
{
return $this->CI->Sale->get_invoice_number_for_year();
}
-}
\ No newline at end of file
+}
+?>
diff --git a/application/migrations/20170502221506_sales_tax_data.php b/application/migrations/20170502221506_sales_tax_data.php
index c22873595..c00746171 100644
--- a/application/migrations/20170502221506_sales_tax_data.php
+++ b/application/migrations/20170502221506_sales_tax_data.php
@@ -1,21 +1,23 @@
-load->library('tax_lib');
$this->load->library('sale_lib');
$CI =& get_instance();
-
}
+
public function up()
{
$number_of_unmigrated = $this->get_count_of_unmigrated();
+
error_log('Migrating sales tax history. The number of sales that will be migrated is '.$number_of_unmigrated);
- if ($number_of_unmigrated > 0)
+
+ if($number_of_unmigrated > 0)
{
$unmigrated_invoices = $this->get_unmigrated($number_of_unmigrated)->result_array();
@@ -24,6 +26,7 @@ class Migration_Sales_Tax_Data extends CI_Migration
$this->upgrade_tax_history_for_sale($unmigrated_invoice['sale_id']);
}
}
+
error_log('Migrating sales tax history. The number of sales that will be migrated is finished.');
}
@@ -68,6 +71,7 @@ class Migration_Sales_Tax_Data extends CI_Migration
$this->tax_lib->update_sales_taxes($sales_taxes, $tax_type, $tax_group, $item['percent'], $tax_basis, $item_tax_amount, $tax_group_sequence, '0', $sale_id, $item['name']);
$tax_group_sequence += 1;
}
+
$this->tax_lib->apply_invoice_taxing($sales_taxes);
$this->save_sales_tax($sales_taxes);
@@ -75,7 +79,6 @@ class Migration_Sales_Tax_Data extends CI_Migration
private function get_unmigrated($block_count)
{
-
$this->db->select('SIT.sale_id');
$this->db->select('ST.sale_id as sales_taxes_sale_id');
$this->db->from('sales_items_taxes as SIT');
@@ -85,10 +88,8 @@ class Migration_Sales_Tax_Data extends CI_Migration
$this->db->group_by('ST.sale_id');
$this->db->order_by('SIT.sale_id');
$this->db->limit($block_count);
- $query = $this->db->get();
-
- return $query;
+ return $this->db->get();
}
private function get_sale_items_for_migration($sale_id)
@@ -136,3 +137,4 @@ class Migration_Sales_Tax_Data extends CI_Migration
}
}
}
+?>
diff --git a/application/models/Appconfig.php b/application/models/Appconfig.php
index 60a89ad1f..085a318b6 100644
--- a/application/models/Appconfig.php
+++ b/application/models/Appconfig.php
@@ -1,22 +1,31 @@
-db->from('app_config');
+ $this->db->from('app_config');
$this->db->where('app_config.key', $key);
return ($this->db->get()->num_rows() == 1);
}
-
+
public function get_all()
{
$this->db->from('app_config');
$this->db->order_by('key', 'asc');
- return $this->db->get();
+ return $this->db->get();
}
-
+
public function get($key)
{
$query = $this->db->get_where('app_config', array('key' => $key), 1);
@@ -28,7 +37,7 @@ class Appconfig extends CI_Model
return '';
}
-
+
public function save($key, $value)
{
$config_data = array(
@@ -45,11 +54,11 @@ class Appconfig extends CI_Model
return $this->db->update('app_config', $config_data);
}
-
+
public function batch_save($data)
{
$success = TRUE;
-
+
//Run these queries as a transaction, we want to make sure we do all or nothing
$this->db->trans_start();
@@ -64,15 +73,15 @@ class Appconfig extends CI_Model
return $success;
}
-
+
public function delete($key)
{
- return $this->db->delete('app_config', array('key' => $key));
+ return $this->db->delete('app_config', array('key' => $key));
}
-
+
public function delete_all()
{
- return $this->db->empty_table('app_config');
+ return $this->db->empty_table('app_config');
}
public function acquire_save_next_invoice_sequence()
@@ -89,4 +98,4 @@ class Appconfig extends CI_Model
return $last_used;
}
}
-?>
\ No newline at end of file
+?>
diff --git a/application/models/Customer.php b/application/models/Customer.php
index 8e8a496c4..1cff3fc2c 100644
--- a/application/models/Customer.php
+++ b/application/models/Customer.php
@@ -1,4 +1,4 @@
-db->from('customers');
+ $this->db->from('customers');
$this->db->join('people', 'people.person_id = customers.person_id');
$this->db->where('customers.person_id', $person_id);
-
+
return ($this->db->get()->num_rows() == 1);
}
@@ -36,7 +36,7 @@ class Customer extends Person
}
return ($this->db->get()->num_rows() == 1);
- }
+ }
/*
Gets total of rows
@@ -48,14 +48,14 @@ class Customer extends Person
return $this->db->count_all_results();
}
-
+
/*
Returns all the customers
*/
public function get_all($rows = 0, $limit_from = 0)
{
$this->db->from('customers');
- $this->db->join('people', 'customers.person_id = people.person_id');
+ $this->db->join('people', 'customers.person_id = people.person_id');
$this->db->where('deleted', 0);
$this->db->order_by('last_name', 'asc');
@@ -64,9 +64,9 @@ class Customer extends Person
$this->db->limit($rows, $limit_from);
}
- return $this->db->get();
+ return $this->db->get();
}
-
+
/*
Gets information about a particular customer
*/
@@ -76,7 +76,7 @@ class Customer extends Person
$this->db->join('people', 'people.person_id = customers.person_id');
$this->db->where('customers.person_id', $customer_id);
$query = $this->db->get();
-
+
if($query->num_rows() == 1)
{
return $query->row();
@@ -85,25 +85,25 @@ class Customer extends Person
{
//Get empty base parent object, as $customer_id is NOT a customer
$person_obj = parent::get_info(-1);
-
+
//Get all the fields from customer table
//append those fields to base parent object, we we have a complete empty object
foreach($this->db->list_fields('customers') as $field)
{
$person_obj->$field = '';
}
-
+
return $person_obj;
}
}
-
+
/*
Gets stats about a particular customer
*/
public function get_stats($customer_id)
{
// create a temporary table to contain all the sum and average of items
- $this->db->query('CREATE TEMPORARY TABLE IF NOT EXISTS ' . $this->db->dbprefix('sales_items_temp') .
+ $this->db->query('CREATE TEMPORARY TABLE IF NOT EXISTS ' . $this->db->dbprefix('sales_items_temp') .
' (INDEX(sale_id))
(
SELECT
@@ -144,14 +144,14 @@ class Customer extends Person
return $stat;
}
-
+
/*
Gets information about multiple customers
*/
public function get_multiple_info($customer_ids)
{
$this->db->from('customers');
- $this->db->join('people', 'people.person_id = customers.person_id');
+ $this->db->join('people', 'people.person_id = customers.person_id');
$this->db->where_in('customers.person_id', $customer_ids);
$this->db->order_by('last_name', 'asc');
@@ -205,14 +205,14 @@ class Customer extends Person
$success = $this->db->update('customers', $customer_data);
}
}
-
+
$this->db->trans_complete();
$success &= $this->db->trans_status();
return $success;
}
-
+
/*
Updates reward points value
*/
@@ -220,7 +220,7 @@ class Customer extends Person
{
$this->db->where('person_id', $customer_id);
$this->db->update('customers', array('points' => $value));
- }
+ }
/*
@@ -232,7 +232,7 @@ class Customer extends Person
return $this->db->update('customers', array('deleted' => 1));
}
-
+
/*
Deletes a list of customers
*/
@@ -242,19 +242,19 @@ class Customer extends Person
return $this->db->update('customers', array('deleted' => 1));
}
-
+
/*
Get search suggestions to find customers
*/
public function get_search_suggestions($search, $unique = TRUE, $limit = 25)
{
$suggestions = array();
-
+
$this->db->from('customers');
$this->db->join('people', 'customers.person_id = people.person_id');
- $this->db->group_start();
+ $this->db->group_start();
$this->db->like('first_name', $search);
- $this->db->or_like('last_name', $search);
+ $this->db->or_like('last_name', $search);
$this->db->or_like('CONCAT(first_name, " ", last_name)', $search);
$this->db->group_end();
$this->db->where('deleted', 0);
@@ -296,7 +296,7 @@ class Customer extends Person
$suggestions[] = array('value' => $row->person_id, 'label' => $row->account_number);
}
}
-
+
//only return $limit suggestions
if(count($suggestions > $limit))
{
@@ -325,7 +325,7 @@ class Customer extends Person
return $this->db->get()->num_rows();
}
-
+
/*
Performs a search on customers
*/
@@ -349,7 +349,7 @@ class Customer extends Person
$this->db->limit($rows, $limit_from);
}
- return $this->db->get();
+ return $this->db->get();
}
}
?>
diff --git a/application/models/Customer_rewards.php b/application/models/Customer_rewards.php
index 432993f30..2c21e9b8d 100644
--- a/application/models/Customer_rewards.php
+++ b/application/models/Customer_rewards.php
@@ -1,15 +1,24 @@
-db->from('customers_packages');
+ $this->db->from('customers_packages');
$this->db->where('package_id', $package_id);
return ($this->db->get()->num_rows() >= 1);
}
- public function save($package_data, $package_id)
+ public function save($package_data, $package_id)
{
$name = $package_data['package_name'];
$points_percent = $package_data['points_percent'];
@@ -26,7 +35,7 @@ class Customer_rewards extends CI_Model
return $this->db->trans_status();
}
- else
+ else
{
$this->db->where('package_id', $package_id);
diff --git a/application/models/Dinner_table.php b/application/models/Dinner_table.php
index 4dcdc8c66..2635c3023 100644
--- a/application/models/Dinner_table.php
+++ b/application/models/Dinner_table.php
@@ -1,15 +1,24 @@
-db->from('dinner_tables');
+ $this->db->from('dinner_tables');
$this->db->where('dinner_table_id', $dinner_table_id);
return ($this->db->get()->num_rows() >= 1);
}
- public function save($table_data, $dinner_table_id)
+ public function save($table_data, $dinner_table_id)
{
$name = $table_data['name'];
@@ -25,7 +34,7 @@ class Dinner_table extends CI_Model
return $this->db->trans_status();
}
- else
+ else
{
$this->db->where('dinner_table_id', $dinner_table_id);
diff --git a/application/models/Employee.php b/application/models/Employee.php
index 7b477d44d..43e7dc940 100644
--- a/application/models/Employee.php
+++ b/application/models/Employee.php
@@ -1,4 +1,4 @@
-db->from('employees');
+ $this->db->from('employees');
$this->db->join('people', 'people.person_id = employees.person_id');
$this->db->where('employees.person_id', $person_id);
return ($this->db->get()->num_rows() == 1);
- }
+ }
/*
Gets total of rows
@@ -39,21 +39,21 @@ class Employee extends Person
public function get_all($limit = 10000, $offset = 0)
{
$this->db->from('employees');
- $this->db->where('deleted', 0);
- $this->db->join('people', 'employees.person_id = people.person_id');
+ $this->db->where('deleted', 0);
+ $this->db->join('people', 'employees.person_id = people.person_id');
$this->db->order_by('last_name', 'asc');
$this->db->limit($limit);
$this->db->offset($offset);
- return $this->db->get();
+ return $this->db->get();
}
-
+
/*
Gets information about a particular employee
*/
public function get_info($employee_id)
{
- $this->db->from('employees');
+ $this->db->from('employees');
$this->db->join('people', 'people.person_id = employees.person_id');
$this->db->where('employees.person_id', $employee_id);
$query = $this->db->get();
@@ -84,11 +84,11 @@ class Employee extends Person
public function get_multiple_info($employee_ids)
{
$this->db->from('employees');
- $this->db->join('people', 'people.person_id = employees.person_id');
+ $this->db->join('people', 'people.person_id = employees.person_id');
$this->db->where_in('employees.person_id', $employee_ids);
$this->db->order_by('last_name', 'asc');
- return $this->db->get();
+ return $this->db->get();
}
/*
@@ -114,12 +114,12 @@ class Employee extends Person
$success = $this->db->update('employees', $employee_data);
}
- //We have either inserted or updated a new employee, now lets set permissions.
+ //We have either inserted or updated a new employee, now lets set permissions.
if($success)
{
//First lets clear out any grants the employee currently has.
$success = $this->db->delete('grants', array('person_id' => $employee_id));
-
+
//Now insert the new grants
if($success)
{
@@ -156,7 +156,7 @@ class Employee extends Person
//Delete permissions
if($this->db->delete('grants', array('person_id' => $employee_id)))
- {
+ {
$this->db->where('person_id', $employee_id);
$success = $this->db->update('employees', array('deleted' => 1));
}
@@ -207,7 +207,7 @@ class Employee extends Person
$this->db->join('people', 'employees.person_id = people.person_id');
$this->db->group_start();
$this->db->like('first_name', $search);
- $this->db->or_like('last_name', $search);
+ $this->db->or_like('last_name', $search);
$this->db->or_like('CONCAT(first_name, " ", last_name)', $search);
$this->db->group_end();
$this->db->where('deleted', 0);
@@ -299,7 +299,7 @@ class Employee extends Person
$this->db->limit($rows, $limit_from);
}
- return $this->db->get();
+ return $this->db->get();
}
/*
@@ -343,7 +343,7 @@ class Employee extends Person
redirect('login');
}
-
+
/*
Determins if a employee is logged in
*/
@@ -407,7 +407,7 @@ class Employee extends Person
$query = $this->db->get_where('grants', array('person_id' => $person_id, 'permission_id' => $permission_id), 1);
- return ($query->num_rows() == 1);
+ return ($query->num_rows() == 1);
}
/*
diff --git a/application/models/Giftcard.php b/application/models/Giftcard.php
index e2266b79c..82c1021aa 100644
--- a/application/models/Giftcard.php
+++ b/application/models/Giftcard.php
@@ -1,4 +1,13 @@
-db->get()->num_rows() == 1);
}
-
+
/*
Gets max gift card number
*/
@@ -27,7 +36,7 @@ class Giftcard extends CI_Model
return $this->db->get()->row();
}
-
+
/*
Gets total of rows
*/
@@ -182,7 +191,7 @@ class Giftcard extends CI_Model
foreach($this->db->get()->result() as $row)
{
$suggestions[] = array('label' => $row->first_name.' '.$row->last_name);
- }
+ }
//only return $limit suggestions
if(count($suggestions > $limit))
@@ -192,7 +201,7 @@ class Giftcard extends CI_Model
return $suggestions;
}
-
+
/*
Performs a search on giftcards
*/
@@ -217,7 +226,7 @@ class Giftcard extends CI_Model
return $this->db->get();
}
-
+
/*
Gets gift cards
*/
@@ -236,7 +245,7 @@ class Giftcard extends CI_Model
return $this->db->get()->num_rows();
}
-
+
/*
Gets gift card value
*/
@@ -246,13 +255,13 @@ class Giftcard extends CI_Model
{
return 0;
}
-
+
$this->db->from('giftcards');
$this->db->where('giftcard_number', $giftcard_number);
return $this->db->get()->row()->value;
}
-
+
/*
Updates gift card value
*/
@@ -300,7 +309,7 @@ class Giftcard extends CI_Model
{
return 0;
}
-
+
$this->db->from('giftcards');
$this->db->where('giftcard_number', $giftcard_number);
diff --git a/application/models/Inventory.php b/application/models/Inventory.php
index c01463b0b..bf81c3859 100644
--- a/application/models/Inventory.php
+++ b/application/models/Inventory.php
@@ -1,11 +1,20 @@
-db->insert('inventory', $inventory_data);
}
-
+
public function get_inventory_data_for_item($item_id, $location_id = FALSE)
{
$this->db->from('inventory');
@@ -16,7 +25,7 @@ class Inventory extends CI_Model
}
$this->db->order_by('trans_date', 'desc');
- return $this->db->get();
+ return $this->db->get();
}
public function reset_quantity($item_id)
@@ -48,4 +57,4 @@ class Inventory extends CI_Model
return $this->db->get()->result_array();
}
}
-?>
\ No newline at end of file
+?>
diff --git a/application/models/Item.php b/application/models/Item.php
index 6fe22dfcc..5d757139e 100644
--- a/application/models/Item.php
+++ b/application/models/Item.php
@@ -1,4 +1,13 @@
-db->count_all_results();
}
-
+
/*
Gets information about a particular item kit
*/
public function get_info($item_kit_id)
{
$this->db->select('
- item_kit_id,
- item_kits.name as name,
- items.name as item_name,
- item_kits.description,
- items.description as item_description,
- item_kits.item_id as kit_item_id,
- kit_discount_percent,
- price_option,
- print_option,
- category,
- supplier_id,
- item_number,
- cost_price,
- unit_price,
- reorder_level,
- receiving_quantity,
- pic_filename,
- allow_alt_description,
- is_serialized,
- deleted,
- custom1,
- custom2,
- custom3,
- custom4,
- custom5,
- custom6,
- custom7,
- custom8,
- custom9,
+ item_kit_id,
+ item_kits.name as name,
+ items.name as item_name,
+ item_kits.description,
+ items.description as item_description,
+ item_kits.item_id as kit_item_id,
+ kit_discount_percent,
+ price_option,
+ print_option,
+ category,
+ supplier_id,
+ item_number,
+ cost_price,
+ unit_price,
+ reorder_level,
+ receiving_quantity,
+ pic_filename,
+ allow_alt_description,
+ is_serialized,
+ deleted,
+ custom1,
+ custom2,
+ custom3,
+ custom4,
+ custom5,
+ custom6,
+ custom7,
+ custom8,
+ custom9,
custom10,
item_type,
stock_type');
@@ -83,7 +92,7 @@ class Item_kit extends CI_Model
$this->db->from('item_kits');
$this->db->join('items', 'item_kits.item_id = items.item_id', 'left');
$this->db->where('item_kit_id', $item_kit_id);
-
+
$query = $this->db->get();
if($query->num_rows()==1)
@@ -144,7 +153,7 @@ class Item_kit extends CI_Model
*/
public function delete($item_kit_id)
{
- return $this->db->delete('item_kits', array('item_kit_id' => $id));
+ return $this->db->delete('item_kits', array('item_kit_id' => $id));
}
/*
@@ -154,7 +163,7 @@ class Item_kit extends CI_Model
{
$this->db->where_in('item_kit_id', $item_kit_ids);
- return $this->db->delete('item_kits');
+ return $this->db->delete('item_kits');
}
public function get_search_suggestions($search, $limit = 25)
@@ -216,9 +225,9 @@ class Item_kit extends CI_Model
$this->db->limit($rows, $limit_from);
}
- return $this->db->get();
+ return $this->db->get();
}
-
+
public function get_found_rows($search)
{
$this->db->from('item_kits');
diff --git a/application/models/Item_kit_items.php b/application/models/Item_kit_items.php
index 293b78b22..1282e8218 100644
--- a/application/models/Item_kit_items.php
+++ b/application/models/Item_kit_items.php
@@ -1,4 +1,13 @@
-db->delete('item_kit_items', array('item_kit_id' => $item_kit_id));
+ return $this->db->delete('item_kit_items', array('item_kit_id' => $item_kit_id));
}
}
?>
diff --git a/application/models/Item_quantity.php b/application/models/Item_quantity.php
index ac9ef37f0..96fd64154 100644
--- a/application/models/Item_quantity.php
+++ b/application/models/Item_quantity.php
@@ -1,4 +1,13 @@
-db->get()->num_rows() == 1);
}
-
+
public function save($location_detail, $item_id, $location_id)
{
if(!$this->exists($item_id, $location_id))
@@ -22,9 +31,9 @@ class Item_quantity extends CI_Model
return $this->db->update('item_quantities', $location_detail);
}
-
+
public function get_item_quantity($item_id, $location_id)
- {
+ {
$this->db->from('item_quantities');
$this->db->where('item_id', $item_id);
$this->db->where('location_id', $location_id);
@@ -42,10 +51,10 @@ class Item_quantity extends CI_Model
$result->quantity = 0;
}
-
- return $result;
+
+ return $result;
}
-
+
/*
* changes to quantity of an item according to the given amount.
* if $quantity_change is negative, it will be subtracted,
@@ -59,7 +68,7 @@ class Item_quantity extends CI_Model
return $this->save($location_detail, $item_id, $location_id);
}
-
+
/*
* Set to 0 all quantity in the given item
*/
@@ -69,7 +78,7 @@ class Item_quantity extends CI_Model
return $this->db->update('item_quantities', array('quantity' => 0));
}
-
+
/*
* Set to 0 all quantity in the given list of items
*/
@@ -80,4 +89,4 @@ class Item_quantity extends CI_Model
return $this->db->update('item_quantities', array('quantity' => 0));
}
}
-?>
\ No newline at end of file
+?>
diff --git a/application/models/Item_taxes.php b/application/models/Item_taxes.php
index 270a6925f..0e419c092 100644
--- a/application/models/Item_taxes.php
+++ b/application/models/Item_taxes.php
@@ -1,4 +1,13 @@
-db->get()->result_array();
}
-
+
/*
Inserts or updates an item's taxes
*/
public function save(&$items_taxes_data, $item_id)
{
$success = TRUE;
-
+
//Run these queries as a transaction, we want to make sure we do all or nothing
$this->db->trans_start();
@@ -28,9 +37,9 @@ class Item_taxes extends CI_Model
foreach($items_taxes_data as $row)
{
$row['item_id'] = $item_id;
- $success &= $this->db->insert('items_taxes', $row);
+ $success &= $this->db->insert('items_taxes', $row);
}
-
+
$this->db->trans_complete();
$success &= $this->db->trans_status();
@@ -44,10 +53,10 @@ class Item_taxes extends CI_Model
public function save_multiple(&$items_taxes_data, $item_ids)
{
$success = TRUE;
-
+
//Run these queries as a transaction, we want to make sure we do all or nothing
$this->db->trans_start();
-
+
foreach(explode(':', $item_ids) as $item_id)
{
$this->delete($item_id);
@@ -55,7 +64,7 @@ class Item_taxes extends CI_Model
foreach($items_taxes_data as $row)
{
$row['item_id'] = $item_id;
- $success &= $this->db->insert('items_taxes', $row);
+ $success &= $this->db->insert('items_taxes', $row);
}
}
@@ -71,7 +80,7 @@ class Item_taxes extends CI_Model
*/
public function delete($item_id)
{
- return $this->db->delete('items_taxes', array('item_id' => $item_id));
+ return $this->db->delete('items_taxes', array('item_id' => $item_id));
}
}
?>
diff --git a/application/models/Module.php b/application/models/Module.php
index e89a9bc57..f945b58c7 100644
--- a/application/models/Module.php
+++ b/application/models/Module.php
@@ -1,25 +1,29 @@
-db->get_where('modules', array('module_id' => $module_id), 1);
-
+
if($query->num_rows() == 1)
{
$row = $query->row();
return $this->lang->line($row->name_lang_key);
}
-
+
return $this->lang->line('error_unknown');
}
-
+
public function get_module_desc($module_id)
{
$query = $this->db->get_where('modules', array('module_id' => $module_id), 1);
@@ -30,17 +34,17 @@ class Module extends CI_Model
return $this->lang->line($row->desc_lang_key);
}
-
- return $this->lang->line('error_unknown');
+
+ return $this->lang->line('error_unknown');
}
-
+
public function get_all_permissions()
{
$this->db->from('permissions');
return $this->db->get();
}
-
+
public function get_all_subpermissions()
{
$this->db->from('permissions');
@@ -50,15 +54,15 @@ class Module extends CI_Model
return $this->db->get();
}
-
+
public function get_all_modules()
{
$this->db->from('modules');
$this->db->order_by('sort', 'asc');
- return $this->db->get();
+ return $this->db->get();
}
-
+
public function get_allowed_modules($person_id)
{
$this->db->from('modules');
@@ -67,7 +71,7 @@ class Module extends CI_Model
$this->db->where('person_id', $person_id);
$this->db->order_by('sort', 'asc');
- return $this->db->get();
+ return $this->db->get();
}
}
?>
diff --git a/application/models/Person.php b/application/models/Person.php
index 456390ff8..d8b952f44 100644
--- a/application/models/Person.php
+++ b/application/models/Person.php
@@ -1,7 +1,7 @@
-db->get();
}
- /*
- Get number of rows for the takings (sales/manage) view
- */
+ /**
+ * Get number of rows for the takings (sales/manage) view
+ */
public function get_found_rows($search, $filters)
{
return $this->search($search, $filters)->num_rows();
}
- /*
- Get the sales data for the takings (sales/manage) view
- */
+ /**
+ * Get the sales data for the takings (sales/manage) view
+ */
public function search($search, $filters, $rows = 0, $limit_from = 0, $sort = 'sale_time', $order = 'desc')
{
$where = '';
@@ -265,9 +277,9 @@ class Sale extends CI_Model
return $this->db->get();
}
- /*
- Get the payment summary for the takings (sales/manage) view
- */
+ /**
+ * Get the payment summary for the takings (sales/manage) view
+ */
public function get_payments_summary($search, $filters)
{
// get payment summary
@@ -359,9 +371,9 @@ class Sale extends CI_Model
return $payments;
}
- /*
- Gets total of rows
- */
+ /**
+ * Gets total of rows
+ */
public function get_total_rows()
{
$this->db->from('sales');
@@ -369,6 +381,9 @@ class Sale extends CI_Model
return $this->db->count_all_results();
}
+ /**
+ * Gets search suggestions
+ */
public function get_search_suggestions($search, $limit = 25)
{
$suggestions = array();
@@ -398,9 +413,9 @@ class Sale extends CI_Model
return $suggestions;
}
- /*
- Gets total of invoice rows
- */
+ /**
+ * Gets total of invoice rows
+ */
public function get_invoice_count()
{
$this->db->from('sales');
@@ -409,6 +424,9 @@ class Sale extends CI_Model
return $this->db->count_all_results();
}
+ /**
+ * Gets sale by invoice number
+ */
public function get_sale_by_invoice_number($invoice_number)
{
$this->db->from('sales');
@@ -417,6 +435,9 @@ class Sale extends CI_Model
return $this->db->get();
}
+ /**
+ * Gets invoice number by year
+ */
public function get_invoice_number_for_year($year = '', $start_from = 0)
{
$year = $year == '' ? date('Y') : $year;
@@ -429,6 +450,9 @@ class Sale extends CI_Model
return ($start_from + $result['invoice_number_year']);
}
+ /**
+ * Checks if valid receipt
+ */
public function is_valid_receipt(&$receipt_sale_id)
{
if(!empty($receipt_sale_id))
@@ -455,6 +479,9 @@ class Sale extends CI_Model
return FALSE;
}
+ /**
+ * Checks if sale exists
+ */
public function exists($sale_id)
{
$this->db->from('sales');
@@ -463,6 +490,9 @@ class Sale extends CI_Model
return ($this->db->get()->num_rows()==1);
}
+ /**
+ * Update sale
+ */
public function update($sale_id, $sale_data, $payments)
{
$this->db->where('sale_id', $sale_id);
@@ -498,7 +528,7 @@ class Sale extends CI_Model
}
- /*
+ /**
* Save the sale information after the sales is complete but before the final document is printed
* The sales_taxes variable needs to be initialized to an empty array before calling
*/
@@ -767,6 +797,9 @@ class Sale extends CI_Model
}
}
+ /**
+ * Saves sale tax
+ */
public function save_sales_tax(&$sales_taxes)
{
foreach($sales_taxes as $line=>$sales_tax)
@@ -775,6 +808,9 @@ class Sale extends CI_Model
}
}
+ /**
+ * Deletes list of sales
+ */
public function delete_list($sale_ids, $employee_id, $update_inventory = TRUE)
{
$result = TRUE;
@@ -787,6 +823,9 @@ class Sale extends CI_Model
return $result;
}
+ /**
+ * Delete sale
+ */
public function delete($sale_id, $employee_id, $update_inventory = TRUE)
{
// start a transaction to assure data integrity
@@ -836,6 +875,9 @@ class Sale extends CI_Model
return $this->db->trans_status();
}
+ /**
+ * Gets sale item
+ */
public function get_sale_items($sale_id)
{
$this->db->from('sales_items');
@@ -844,7 +886,7 @@ class Sale extends CI_Model
return $this->db->get();
}
- /*
+ /**
* Used by the invoice and receipt programs
*/
public function get_sale_items_ordered($sale_id)
@@ -897,6 +939,9 @@ class Sale extends CI_Model
return $this->db->get();
}
+ /**
+ * Gets sale payments
+ */
public function get_sale_payments($sale_id)
{
$this->db->from('sales_payments');
@@ -905,6 +950,9 @@ class Sale extends CI_Model
return $this->db->get();
}
+ /**
+ * Gets sale payment options
+ */
public function get_payment_options($giftcard = TRUE, $reward_points = FALSE)
{
$payments = array();
@@ -943,6 +991,9 @@ class Sale extends CI_Model
return $payments;
}
+ /**
+ * Gets sale customer name
+ */
public function get_customer($sale_id)
{
$this->db->from('sales');
@@ -951,6 +1002,9 @@ class Sale extends CI_Model
return $this->Customer->get_info($this->db->get()->row()->customer_id);
}
+ /**
+ * Gets sale employee name
+ */
public function get_employee($sale_id)
{
$this->db->from('sales');
@@ -959,6 +1013,9 @@ class Sale extends CI_Model
return $this->Employee->get_info($this->db->get()->row()->employee_id);
}
+ /**
+ * Checks if quote number exists
+ */
// TODO change to use new quote_number field
public function check_quote_number_exists($quote_number, $sale_id = '')
{
@@ -972,6 +1029,9 @@ class Sale extends CI_Model
return ($this->db->get()->num_rows() == 1);
}
+ /**
+ * Checks if invoice number exists
+ */
public function check_invoice_number_exists($invoice_number, $sale_id = '')
{
$this->db->from('sales');
@@ -984,6 +1044,9 @@ class Sale extends CI_Model
return ($this->db->get()->num_rows() == 1);
}
+ /**
+ * Gets Giftcard value
+ */
public function get_giftcard_value($giftcardNumber)
{
if(!$this->Giftcard->exists($this->Giftcard->get_giftcard_id($giftcardNumber)))
@@ -997,7 +1060,10 @@ class Sale extends CI_Model
return $this->db->get()->row()->value;
}
- //We create a temp table that allows us to do easy report/sales queries
+ /**
+ * Creates sales temporary dimentional table
+ * We create a temp table that allows us to do easy report/sales queries
+ */
public function create_temp_table(array $inputs)
{
if(empty($inputs['sale_id']))
@@ -1133,7 +1199,7 @@ class Sale extends CI_Model
$this->db->query('DROP TEMPORARY TABLE IF EXISTS ' . $this->db->dbprefix('sales_items_taxes_temp'));
}
- /*
+ /**
* Retrieves all sales that are in a suspended state
*/
public function get_all_suspended($customer_id = NULL)
@@ -1157,8 +1223,8 @@ class Sale extends CI_Model
}
- /*
- * get the dinner table for the selected sale
+ /**
+ * Gets the dinner table for the selected sale
*/
public function get_dinner_table($sale_id)
{
@@ -1168,8 +1234,8 @@ class Sale extends CI_Model
return $this->db->get()->row()->dinner_table_id;
}
- /*
- * get the quote_number for the selected sale
+ /**
+ * Gets the quote_number for the selected sale
*/
public function get_quote_number($sale_id)
{
@@ -1188,8 +1254,8 @@ class Sale extends CI_Model
}
}
- /*
- * get the quote_number for the selected sale
+ /**
+ * Gets the quote_number for the selected sale
*/
public function get_comment($sale_id)
{
@@ -1208,9 +1274,9 @@ class Sale extends CI_Model
}
}
- /*
- * Gets total of suspended invoices rows
- */
+ /**
+ * Gets total of suspended invoices rows
+ */
public function get_suspended_invoice_count()
{
$this->db->from('sales');
@@ -1220,8 +1286,8 @@ class Sale extends CI_Model
return $this->db->count_all_results();
}
- /*
- * This will remove a selected sale from the sales table.
+ /**
+ * Removes a selected sale from the sales table.
* This function should only be called for suspended sales that are being restored to the current cart
*/
public function delete_suspended_sale($sale_id)
@@ -1248,6 +1314,9 @@ class Sale extends CI_Model
return $this->db->trans_status();
}
+ /**
+ * Gets suspended sale info
+ */
public function get_suspended_sale_info($sale_id)
{
$this->db->from('sales');
@@ -1256,6 +1325,5 @@ class Sale extends CI_Model
return $this->db->get();
}
-
}
?>
diff --git a/application/models/Sale_suspended.php b/application/models/Sale_suspended.php
index 7cf461152..42b2c9981 100644
--- a/application/models/Sale_suspended.php
+++ b/application/models/Sale_suspended.php
@@ -1,4 +1,13 @@
-db->get();
}
-
+
public function get_info($sale_id)
{
$this->db->from('sales_suspended');
@@ -28,7 +37,7 @@ class Sale_suspended extends CI_Model
return $this->db->count_all_results();
}
-
+
public function get_sale_by_invoice_number($invoice_number)
{
$this->db->from('sales_suspended');
@@ -44,14 +53,14 @@ class Sale_suspended extends CI_Model
return ($this->db->get()->num_rows() == 1);
}
-
+
public function update($sale_data, $sale_id)
{
$this->db->where('sale_id', $sale_id);
return $this->db->update('sales_suspended', $sale_data);
}
-
+
public function save($items, $customer_id, $employee_id, $comment, $invoice_number, $quote_number, $payments, $dinner_table, $sale_id = FALSE)
{
if(count($items) == 0)
@@ -126,7 +135,7 @@ class Sale_suspended extends CI_Model
'name' => $row['name'],
'percent' => $row['percent']
);
-
+
$this->db->insert('sales_suspended_items_taxes', $sales_items_taxes);
}
}
@@ -140,20 +149,20 @@ class Sale_suspended extends CI_Model
$this->db->update('dinner_tables', $dinner_table_data);
$this->db->trans_complete();
-
+
if($this->db->trans_status() === FALSE)
{
return -1;
}
-
+
return $sale_id;
}
-
+
public function delete($sale_id)
{
//Run these queries as a transaction, we want to make sure we do all or nothing
$this->db->trans_start();
-
+
$dinner_table = $this->get_dinner_table($sale_id);
$dinner_table_data = array(
'status' => 0
@@ -161,14 +170,14 @@ class Sale_suspended extends CI_Model
$this->db->where('dinner_table_id',$dinner_table);
$this->db->update('dinner_tables', $dinner_table_data);
-
- $this->db->delete('sales_suspended_payments', array('sale_id' => $sale_id));
- $this->db->delete('sales_suspended_items_taxes', array('sale_id' => $sale_id));
- $this->db->delete('sales_suspended_items', array('sale_id' => $sale_id));
- $this->db->delete('sales_suspended', array('sale_id' => $sale_id));
-
+
+ $this->db->delete('sales_suspended_payments', array('sale_id' => $sale_id));
+ $this->db->delete('sales_suspended_items_taxes', array('sale_id' => $sale_id));
+ $this->db->delete('sales_suspended_items', array('sale_id' => $sale_id));
+ $this->db->delete('sales_suspended', array('sale_id' => $sale_id));
+
$this->db->trans_complete();
-
+
return $this->db->trans_status();
}
diff --git a/application/models/Stock_location.php b/application/models/Stock_location.php
index 9c533147a..6919974e5 100644
--- a/application/models/Stock_location.php
+++ b/application/models/Stock_location.php
@@ -1,23 +1,32 @@
-db->from('stock_locations');
+ $this->db->from('stock_locations');
$this->db->where('location_name', $location_name);
-
+
return ($this->db->get()->num_rows() >= 1);
}
-
+
public function get_all($limit = 10000, $offset = 0)
{
$this->db->from('stock_locations');
$this->db->limit($limit);
$this->db->offset($offset);
-
+
return $this->db->get();
}
-
+
public function get_undeleted_all($module_id = 'items')
{
$this->db->from('stock_locations');
@@ -66,7 +75,7 @@ class Stock_location extends CI_Model
return ($this->db->get()->num_rows() == 1);
}
-
+
public function get_default_location_id()
{
$this->db->from('stock_locations');
@@ -78,16 +87,16 @@ class Stock_location extends CI_Model
return $this->db->get()->row()->location_id;
}
-
- public function get_location_name($location_id)
+
+ public function get_location_name($location_id)
{
$this->db->from('stock_locations');
$this->db->where('location_id', $location_id);
return $this->db->get()->row()->location_name;
}
-
- public function save(&$location_data, $location_id)
+
+ public function save(&$location_data, $location_id)
{
$location_name = $location_data['location_name'];
@@ -98,11 +107,11 @@ class Stock_location extends CI_Model
$location_data = array('location_name'=>$location_name, 'deleted'=>0);
$this->db->insert('stock_locations', $location_data);
$location_id = $this->db->insert_id();
-
+
$this->_insert_new_permission('items', $location_id, $location_name);
$this->_insert_new_permission('sales', $location_id, $location_name);
$this->_insert_new_permission('receivings', $location_id, $location_name);
-
+
// insert quantities for existing items
$items = $this->Item->get_all();
foreach($items->result_array() as $item)
@@ -112,24 +121,24 @@ class Stock_location extends CI_Model
}
$this->db->trans_complete();
-
+
return $this->db->trans_status();
}
- else
+ else
{
$this->db->where('location_id', $location_id);
return $this->db->update('stock_locations', $location_data);
}
}
-
+
private function _insert_new_permission($module, $location_id, $location_name)
{
// insert new permission for stock location
$permission_id = $module . '_' . $location_name;
$permission_data = array('permission_id' => $permission_id, 'module_id' => $module, 'location_id' => $location_id);
$this->db->insert('permissions', $permission_data);
-
+
// insert grants for new permission
$employees = $this->Employee->get_all();
foreach($employees->result_array() as $employee)
@@ -138,7 +147,7 @@ class Stock_location extends CI_Model
$this->db->insert('grants', $grants_data);
}
}
-
+
/*
Deletes one item
*/
@@ -148,13 +157,13 @@ class Stock_location extends CI_Model
$this->db->where('location_id', $location_id);
$this->db->update('stock_locations', array('deleted' => 1));
-
+
$this->db->where('location_id', $location_id);
$this->db->delete('permissions');
$this->db->trans_complete();
-
+
return $this->db->trans_status();
}
}
-?>
\ No newline at end of file
+?>
diff --git a/application/models/Supplier.php b/application/models/Supplier.php
index cb6797639..7efdafaa1 100644
--- a/application/models/Supplier.php
+++ b/application/models/Supplier.php
@@ -1,4 +1,4 @@
-db->from('tax_code_rates');
@@ -106,8 +115,8 @@ Gets information about a particular tax_code
}
/*
- * Gets the tax code to use for a given customer
- */
+ Gets the tax code to use for a given customer
+ */
public function get_sales_tax_code($city = '', $state = '')
{
// if tax code using both city and state cannot be found then try again using just the state
@@ -207,7 +216,7 @@ Gets information about a particular tax_code
if ($tax_rate_data != NULL)
{
- foreach ($tax_rate_data as $row)
+ foreach ($tax_rate_data as $row)
{
$row['rate_tax_code'] = $tax_code;
$success &= $this->db->insert('tax_code_rates', $row);
@@ -289,7 +298,8 @@ Gets information about a particular tax_code
return $this->db->get()->num_rows();
}
- public function get_tax_code_type_name($tax_code_type) {
+ public function get_tax_code_type_name($tax_code_type)
+ {
if ($tax_code_type == '0')
{
return $this->lang->line('taxes_sales_tax');
@@ -302,7 +312,6 @@ Gets information about a particular tax_code
public function get_sales_tax_codes_search_suggestions($search, $limit = 25)
{
-
$suggestions = array();
$this->db->from('tax_codes');
diff --git a/application/models/enums/Rounding_code.php b/application/models/enums/Rounding_code.php
index a72bc9aff..451f9576f 100644
--- a/application/models/enums/Rounding_code.php
+++ b/application/models/enums/Rounding_code.php
@@ -1,4 +1,12 @@
-db->select('receiving_id,
- MAX(receiving_date) as receiving_date,
- SUM(quantity_purchased) AS items_purchased,
- MAX(CONCAT(employee.first_name, " ", employee.last_name)) AS employee_name,
- MAX(supplier.company_name) AS supplier_name,
- SUM(subtotal) AS subtotal,
- SUM(total) AS total,
- SUM(profit) AS profit,
- MAX(payment_type) as payment_type,
- MAX(comment) as comment,
+ $this->db->select('receiving_id,
+ MAX(receiving_date) as receiving_date,
+ SUM(quantity_purchased) AS items_purchased,
+ MAX(CONCAT(employee.first_name, " ", employee.last_name)) AS employee_name,
+ MAX(supplier.company_name) AS supplier_name,
+ SUM(subtotal) AS subtotal,
+ SUM(total) AS total,
+ SUM(profit) AS profit,
+ MAX(payment_type) as payment_type,
+ MAX(comment) as comment,
MAX(reference) as reference');
$this->db->from('receivings_items_temp');
$this->db->join('people AS employee', 'receivings_items_temp.employee_id = employee.person_id');
@@ -64,15 +59,15 @@ class Detailed_receivings extends Report
public function getData(array $inputs)
{
- $this->db->select('receiving_id,
- MAX(receiving_date) as receiving_date,
- SUM(quantity_purchased) AS items_purchased,
- MAX(CONCAT(employee.first_name," ",employee.last_name)) AS employee_name,
- MAX(supplier.company_name) AS supplier_name,
- SUM(total) AS total,
- SUM(profit) AS profit,
- MAX(payment_type) AS payment_type,
- MAX(comment) AS comment,
+ $this->db->select('receiving_id,
+ MAX(receiving_date) as receiving_date,
+ SUM(quantity_purchased) AS items_purchased,
+ MAX(CONCAT(employee.first_name," ",employee.last_name)) AS employee_name,
+ MAX(supplier.company_name) AS supplier_name,
+ SUM(total) AS total,
+ SUM(profit) AS profit,
+ MAX(payment_type) AS payment_type,
+ MAX(comment) AS comment,
MAX(reference) AS reference');
$this->db->from('receivings_items_temp AS receivings_items_temp');
$this->db->join('people AS employee', 'receivings_items_temp.employee_id = employee.person_id');
diff --git a/application/models/reports/Detailed_sales.php b/application/models/reports/Detailed_sales.php
index 6d71e7ff8..97f8d41d8 100644
--- a/application/models/reports/Detailed_sales.php
+++ b/application/models/reports/Detailed_sales.php
@@ -1,14 +1,9 @@
-db->select('sale_id,
- 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,
- SUM(total) AS total,
- SUM(cost) AS cost,
- SUM(profit) AS profit,
- MAX(payment_type) AS payment_type,
+ $this->db->select('sale_id,
+ 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,
+ SUM(total) AS total,
+ SUM(cost) AS cost,
+ SUM(profit) AS profit,
+ MAX(payment_type) AS payment_type,
MAX(comment) AS comment');
$this->db->from('sales_items_temp');
diff --git a/application/models/reports/Inventory_low.php b/application/models/reports/Inventory_low.php
index 11584dcc6..2cca4519f 100644
--- a/application/models/reports/Inventory_low.php
+++ b/application/models/reports/Inventory_low.php
@@ -4,11 +4,6 @@ require_once("Report.php");
class Inventory_low extends Report
{
- function __construct()
- {
- parent::__construct();
- }
-
public function getDataColumns()
{
return array(
@@ -18,7 +13,7 @@ class Inventory_low extends Report
array('reorder_level' => $this->lang->line('reports_reorder_level')),
array('location_name' => $this->lang->line('reports_stock_location')));
}
-
+
public function getData(array $inputs)
{
$this->db->select('items.name, items.item_number, item_quantities.quantity, items.reorder_level, stock_locations.location_name');
@@ -33,7 +28,7 @@ class Inventory_low extends Report
return $this->db->get()->result_array();
}
-
+
public function getSummaryData(array $inputs)
{
return array();
diff --git a/application/models/reports/Inventory_summary.php b/application/models/reports/Inventory_summary.php
index b2ed5b582..90bdf534e 100644
--- a/application/models/reports/Inventory_summary.php
+++ b/application/models/reports/Inventory_summary.php
@@ -4,11 +4,6 @@ require_once("Report.php");
class Inventory_summary extends Report
{
- function __construct()
- {
- parent::__construct();
- }
-
public function getDataColumns()
{
return array(array('item_name' => $this->lang->line('reports_item_name')),
@@ -22,7 +17,7 @@ class Inventory_summary extends Report
}
public function getData(array $inputs)
- {
+ {
$this->db->select('items.name, items.item_number, item_quantities.quantity, items.reorder_level, stock_locations.location_name, items.cost_price, items.unit_price, (items.cost_price * item_quantities.quantity) AS sub_total_value');
$this->db->from('items AS items');
$this->db->join('item_quantities AS item_quantities', 'items.item_id = item_quantities.item_id');
@@ -53,7 +48,7 @@ class Inventory_summary extends Report
/**
* calculates the total value of the given inventory summary by summing all sub_total_values (see Inventory_summary::getData())
- *
+ *
* @param array $inputs expects the reports-data-array which Inventory_summary::getData() returns
* @return array
*/
@@ -71,7 +66,7 @@ class Inventory_summary extends Report
/**
* returns the array for the dropdown-element item-count in the form for the inventory summary-report
- *
+ *
* @return array
*/
public function getItemCountDropdownArray()
diff --git a/application/models/reports/Report.php b/application/models/reports/Report.php
index 8bde837ba..370470aca 100644
--- a/application/models/reports/Report.php
+++ b/application/models/reports/Report.php
@@ -1,6 +1,6 @@
value pairing of summary data for the report
public abstract function getSummaryData(array $inputs);
}
-?>
\ No newline at end of file
+?>
diff --git a/application/models/reports/Specific_customer.php b/application/models/reports/Specific_customer.php
index 675f011f6..17c34b0c0 100644
--- a/application/models/reports/Specific_customer.php
+++ b/application/models/reports/Specific_customer.php
@@ -4,11 +4,6 @@ require_once("Report.php");
class Specific_customer extends Report
{
- function __construct()
- {
- parent::__construct();
- }
-
public function create(array $inputs)
{
//Create our temp tables to work with the data in our report
diff --git a/application/models/reports/Specific_discount.php b/application/models/reports/Specific_discount.php
index 7de97a80b..36a22195c 100755
--- a/application/models/reports/Specific_discount.php
+++ b/application/models/reports/Specific_discount.php
@@ -4,11 +4,6 @@ require_once("Report.php");
class Specific_discount extends Report
{
- function __construct()
- {
- parent::__construct();
- }
-
public function create(array $inputs)
{
//Create our temp tables to work with the data in our report
diff --git a/application/models/reports/Specific_employee.php b/application/models/reports/Specific_employee.php
index 43fe46a5d..350df8283 100644
--- a/application/models/reports/Specific_employee.php
+++ b/application/models/reports/Specific_employee.php
@@ -4,11 +4,6 @@ require_once("Report.php");
class Specific_employee extends Report
{
- function __construct()
- {
- parent::__construct();
- }
-
public function create(array $inputs)
{
//Create our temp tables to work with the data in our report
diff --git a/application/models/reports/Summary_categories.php b/application/models/reports/Summary_categories.php
index e7b3b7401..0c6fbd2c4 100644
--- a/application/models/reports/Summary_categories.php
+++ b/application/models/reports/Summary_categories.php
@@ -4,11 +4,6 @@ require_once("Summary_report.php");
class Summary_categories extends Summary_report
{
- function __construct()
- {
- parent::__construct();
- }
-
protected function _get_data_columns()
{
return array(
diff --git a/application/models/reports/Summary_customers.php b/application/models/reports/Summary_customers.php
index 5a644b531..88c13e611 100644
--- a/application/models/reports/Summary_customers.php
+++ b/application/models/reports/Summary_customers.php
@@ -4,11 +4,6 @@ require_once("Summary_report.php");
class Summary_customers extends Summary_report
{
- function __construct()
- {
- parent::__construct();
- }
-
protected function _get_data_columns()
{
return array(
diff --git a/application/models/reports/Summary_discounts.php b/application/models/reports/Summary_discounts.php
index 80a279e8b..e94119f6d 100644
--- a/application/models/reports/Summary_discounts.php
+++ b/application/models/reports/Summary_discounts.php
@@ -4,11 +4,6 @@ require_once("Summary_report.php");
class Summary_discounts extends Summary_report
{
- function __construct()
- {
- parent::__construct();
- }
-
protected function _get_data_columns()
{
return array(
diff --git a/application/models/reports/Summary_employees.php b/application/models/reports/Summary_employees.php
index 2824911ec..3f9723361 100644
--- a/application/models/reports/Summary_employees.php
+++ b/application/models/reports/Summary_employees.php
@@ -4,11 +4,6 @@ require_once("Summary_report.php");
class Summary_employees extends Summary_report
{
- function __construct()
- {
- parent::__construct();
- }
-
protected function _get_data_columns()
{
return array(
diff --git a/application/models/reports/Summary_items.php b/application/models/reports/Summary_items.php
index 515e0f636..b74339f9f 100644
--- a/application/models/reports/Summary_items.php
+++ b/application/models/reports/Summary_items.php
@@ -4,11 +4,6 @@ require_once("Summary_report.php");
class Summary_items extends Summary_report
{
- function __construct()
- {
- parent::__construct();
- }
-
protected function _get_data_columns()
{
return array(
diff --git a/application/models/reports/Summary_payments.php b/application/models/reports/Summary_payments.php
index 5e4576dd2..88fe075f1 100644
--- a/application/models/reports/Summary_payments.php
+++ b/application/models/reports/Summary_payments.php
@@ -4,11 +4,6 @@ require_once("Summary_report.php");
class Summary_payments extends Summary_report
{
- function __construct()
- {
- parent::__construct();
- }
-
protected function _get_data_columns()
{
return array(
diff --git a/application/models/reports/Summary_report.php b/application/models/reports/Summary_report.php
index 1e01363ee..df2a18187 100644
--- a/application/models/reports/Summary_report.php
+++ b/application/models/reports/Summary_report.php
@@ -4,15 +4,8 @@ require_once("Report.php");
abstract class Summary_report extends Report
{
- function __construct()
- {
- parent::__construct();
- }
-
/*
-
Private interface
-
*/
private function _common_select(array $inputs)
diff --git a/application/models/reports/Summary_sales.php b/application/models/reports/Summary_sales.php
index 2c174fa76..6d8dc3b76 100644
--- a/application/models/reports/Summary_sales.php
+++ b/application/models/reports/Summary_sales.php
@@ -4,11 +4,6 @@ require_once("Summary_report.php");
class Summary_sales extends Summary_report
{
- function __construct()
- {
- parent::__construct();
- }
-
protected function _get_data_columns()
{
return array(
@@ -26,7 +21,7 @@ class Summary_sales extends Summary_report
parent::_select($inputs);
$this->db->select('
- DATE(sales.sale_time) AS sale_date,
+ DATE(sales.sale_time) AS sale_date,
SUM(sales_items.quantity_purchased) AS quantity_purchased
');
}
diff --git a/application/models/reports/Summary_suppliers.php b/application/models/reports/Summary_suppliers.php
index 0aad9c808..9ba65c8e8 100644
--- a/application/models/reports/Summary_suppliers.php
+++ b/application/models/reports/Summary_suppliers.php
@@ -4,11 +4,6 @@ require_once("Summary_report.php");
class Summary_suppliers extends Summary_report
{
- function __construct()
- {
- parent::__construct();
- }
-
protected function _get_data_columns()
{
return array(
diff --git a/application/models/reports/Summary_taxes.php b/application/models/reports/Summary_taxes.php
index be9eff779..4fec642c0 100644
--- a/application/models/reports/Summary_taxes.php
+++ b/application/models/reports/Summary_taxes.php
@@ -4,11 +4,6 @@ require_once("Summary_report.php");
class Summary_taxes extends Summary_report
{
- function __construct()
- {
- parent::__construct();
- }
-
protected function _get_data_columns()
{
return array(