From 0f95c6c9b52594211b97f16c3610df84062c159a Mon Sep 17 00:00:00 2001 From: Jorge Colmenarez Date: Tue, 1 Nov 2016 22:08:47 -0400 Subject: [PATCH 01/63] Add Support for filter reports with format date/time --- application/controllers/Config.php | 6 +- application/controllers/Login.php | 5 + application/controllers/Reports.php | 514 +++++++++++++++--- application/controllers/Sales.php | 9 +- application/language/en/config_lang.php | 5 + application/language/es/config_lang.php | 5 + application/models/Receiving.php | 4 +- application/models/Sale.php | 17 +- .../models/reports/Detailed_receivings.php | 14 +- application/models/reports/Detailed_sales.php | 14 +- .../models/reports/Specific_customer.php | 18 +- .../models/reports/Specific_discount.php | 22 +- .../models/reports/Specific_employee.php | 20 +- .../models/reports/Summary_categories.php | 15 +- .../models/reports/Summary_customers.php | 14 +- .../models/reports/Summary_discounts.php | 17 +- .../models/reports/Summary_employees.php | 14 +- application/models/reports/Summary_items.php | 14 +- .../models/reports/Summary_payments.php | 14 +- application/models/reports/Summary_sales.php | 14 +- .../models/reports/Summary_suppliers.php | 14 +- application/models/reports/Summary_taxes.php | 19 +- application/views/configs/locale_config.php | 12 + application/views/partial/daterangepicker.php | 175 ++++-- application/views/reports/date_input.php | 2 +- 25 files changed, 822 insertions(+), 155 deletions(-) diff --git a/application/controllers/Config.php b/application/controllers/Config.php index 9df7fcb0c..7fd0552e3 100644 --- a/application/controllers/Config.php +++ b/application/controllers/Config.php @@ -302,7 +302,11 @@ class Config extends Secure_Controller 'tax_decimals' => $this->input->post('tax_decimals'), 'quantity_decimals' => $this->input->post('quantity_decimals'), 'country_codes' => $this->input->post('country_codes'), - 'payment_options_order' => $this->input->post('payment_options_order') + 'payment_options_order' => $this->input->post('payment_options_order'), + // Added By Jorge Colmenarez 2016-10-31 16:39 + // Support for filter datetime reports + 'filter_datetime_format' => $this->input->post('filter_datetime_format') + // End Jorge Colmenarez ); $result = $this->Appconfig->batch_save($batch_save_data); diff --git a/application/controllers/Login.php b/application/controllers/Login.php index 1ef48e9a7..321a79c00 100644 --- a/application/controllers/Login.php +++ b/application/controllers/Login.php @@ -41,6 +41,11 @@ class Login extends CI_Controller $this->tracking_lib->track_event('Stats', 'Tax Decimals', $this->config->item('tax_decimals')); $this->tracking_lib->track_event('Stats', 'Quantity Decimals', $this->config->item('quantity_decimals')); $this->tracking_lib->track_event('Stats', 'Invoice Enable', $this->config->item('invoice_enable')); + /** + * Jorge Colmenarez 2016-11-01 08:33 + * Set Static Filter DateTime Format Value + */ + $this->tracking_lib->track_event('Stats', 'Filter DateTime Format', $this->config->item('filter_datetime_format')); } redirect('home'); diff --git a/application/controllers/Reports.php b/application/controllers/Reports.php index 7848280da..9f7636ac6 100644 --- a/application/controllers/Reports.php +++ b/application/controllers/Reports.php @@ -43,7 +43,12 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_sales'); $model = $this->Summary_sales; - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); + /** + * Added by Jorge Colmenarez 2016-11-01 19:00 + * Support for send flag datetime filter + */ + $datetime_filter = $this->config->item('filter_datetime_format'); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); $tabular_data = array(); foreach($report_data as $row) @@ -58,12 +63,22 @@ class Reports extends Secure_Controller )); } + /** + * Added by Jorge Colmenarez 2016-11-01 19:01 + * Set subtitle with corresponsed format + */ + $subtitle =""; + if(empty($datetime_filter)) + $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); + else + $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); + $data = array( 'title' => $this->lang->line('reports_sales_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $subtitle, 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, - 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))) + 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) ); $this->load->view('reports/tabular', $data); @@ -75,7 +90,12 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_categories'); $model = $this->Summary_categories; - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); + /** + * Added by Jorge Colmenarez 2016-11-01 19:07 + * Support for send flag datetime filter + */ + $datetime_filter = $this->config->item('filter_datetime_format'); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); $tabular_data = array(); foreach($report_data as $row) @@ -90,12 +110,22 @@ class Reports extends Secure_Controller )); } + /** + * Added by Jorge Colmenarez 2016-11-01 20:01 + * Set subtitle with corresponsed format + */ + $subtitle =""; + if(empty($datetime_filter)) + $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); + else + $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); + $data = array( 'title' => $this->lang->line('reports_categories_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $subtitle, 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, - 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))) + 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) ); $this->load->view('reports/tabular', $data); @@ -107,7 +137,12 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_customers'); $model = $this->Summary_customers; - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); + /** + * Added by Jorge Colmenarez 2016-11-01 20:13 + * Support for send flag datetime filter + */ + $datetime_filter = $this->config->item('filter_datetime_format'); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); $tabular_data = array(); foreach($report_data as $row) @@ -122,12 +157,22 @@ class Reports extends Secure_Controller )); } + /** + * Added by Jorge Colmenarez 2016-11-01 20:14 + * Set subtitle with corresponsed format + */ + $subtitle =""; + if(empty($datetime_filter)) + $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); + else + $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); + $data = array( 'title' => $this->lang->line('reports_customers_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $subtitle, 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, - 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))) + 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) ); $this->load->view('reports/tabular', $data); @@ -138,8 +183,13 @@ class Reports extends Secure_Controller { $this->load->model('reports/Summary_suppliers'); $model = $this->Summary_suppliers; - - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); + + /** + * Added by Jorge Colmenarez 2016-11-01 20:16 + * Support for send flag datetime filter + */ + $datetime_filter = $this->config->item('filter_datetime_format'); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); $tabular_data = array(); foreach($report_data as $row) @@ -154,12 +204,22 @@ class Reports extends Secure_Controller )); } + /** + * Added by Jorge Colmenarez 2016-11-01 20:17 + * Set subtitle with corresponsed format + */ + $subtitle =""; + if(empty($datetime_filter)) + $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); + else + $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); + $data = array( 'title' => $this->lang->line('reports_suppliers_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $subtitle, 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, - 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))) + 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) ); $this->load->view('reports/tabular', $data); @@ -170,8 +230,13 @@ class Reports extends Secure_Controller { $this->load->model('reports/Summary_items'); $model = $this->Summary_items; - - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); + + /** + * Added by Jorge Colmenarez 2016-11-01 20:21 + * Support for send flag datetime filter + */ + $datetime_filter = $this->config->item('filter_datetime_format'); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); $tabular_data = array(); foreach($report_data as $row) @@ -186,12 +251,22 @@ class Reports extends Secure_Controller )); } + /** + * Added by Jorge Colmenarez 2016-11-01 20:22 + * Set subtitle with corresponsed format + */ + $subtitle =""; + if(empty($datetime_filter)) + $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); + else + $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); + $data = array( 'title' => $this->lang->line('reports_items_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $subtitle, 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, - 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))) + 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) ); $this->load->view('reports/tabular', $data); @@ -202,8 +277,13 @@ class Reports extends Secure_Controller { $this->load->model('reports/Summary_employees'); $model = $this->Summary_employees; - - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); + + /** + * Added by Jorge Colmenarez 2016-11-01 20:24 + * Support for send flag datetime filter + */ + $datetime_filter = $this->config->item('filter_datetime_format'); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); $tabular_data = array(); foreach($report_data as $row) @@ -218,12 +298,22 @@ class Reports extends Secure_Controller )); } + /** + * Added by Jorge Colmenarez 2016-11-01 20:25 + * Set subtitle with corresponsed format + */ + $subtitle =""; + if(empty($datetime_filter)) + $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); + else + $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); + $data = array( 'title' => $this->lang->line('reports_employees_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $subtitle, 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, - 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))) + 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) ); $this->load->view('reports/tabular', $data); @@ -235,7 +325,12 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_taxes'); $model = $this->Summary_taxes; - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); + /** + * Added by Jorge Colmenarez 2016-11-01 20:29 + * Support for send flag datetime filter + */ + $datetime_filter = $this->config->item('filter_datetime_format'); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); $tabular_data = array(); foreach($report_data as $row) @@ -248,12 +343,22 @@ class Reports extends Secure_Controller )); } + /** + * Added by Jorge Colmenarez 2016-11-01 20:30 + * Set subtitle with corresponsed format + */ + $subtitle =""; + if(empty($datetime_filter)) + $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); + else + $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); + $data = array( 'title' => $this->lang->line('reports_taxes_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $subtitle, 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, - 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))) + 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) ); $this->load->view('reports/tabular', $data); @@ -265,7 +370,12 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_discounts'); $model = $this->Summary_discounts; - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); + /** + * Added by Jorge Colmenarez 2016-11-01 20:44 + * Support for send flag datetime filter + */ + $datetime_filter = $this->config->item('filter_datetime_format'); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); $tabular_data = array(); foreach($report_data as $row) @@ -275,12 +385,22 @@ class Reports extends Secure_Controller )); } + /** + * Added by Jorge Colmenarez 2016-11-01 20:44 + * Set subtitle with corresponsed format + */ + $subtitle =""; + if(empty($datetime_filter)) + $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); + else + $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); + $data = array( 'title' => $this->lang->line('reports_discounts_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $subtitle, 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, - 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))) + 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) ); $this->load->view('reports/tabular', $data); @@ -292,7 +412,12 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_payments'); $model = $this->Summary_payments; - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); + /** + * Added by Jorge Colmenarez 2016-11-01 20:47 + * Support for send flag datetime filter + */ + $datetime_filter = $this->config->item('filter_datetime_format'); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); $tabular_data = array(); foreach($report_data as $row) @@ -303,12 +428,22 @@ class Reports extends Secure_Controller )); } + /** + * Added by Jorge Colmenarez 2016-11-01 20:48 + * Set subtitle with corresponsed format + */ + $subtitle =""; + if(empty($datetime_filter)) + $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); + else + $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); + $data = array( 'title' => $this->lang->line('reports_payments_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $subtitle, 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, - 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))) + 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) ); $this->load->view('reports/tabular', $data); @@ -354,8 +489,13 @@ class Reports extends Secure_Controller { $this->load->model('reports/Summary_sales'); $model = $this->Summary_sales; - - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); + + /** + * Added by Jorge Colmenarez 2016-11-01 20:53 + * Support for send flag datetime filter + */ + $datetime_filter = $this->config->item('filter_datetime_format'); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); $labels = array(); $series = array(); @@ -368,13 +508,23 @@ class Reports extends Secure_Controller $series[] = array('meta' => $date, 'value' => $row['total']); } + /** + * Added by Jorge Colmenarez 2016-11-01 20:54 + * Set subtitle with corresponsed format + */ + $subtitle =""; + if(empty($datetime_filter)) + $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); + else + $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); + $data = array( 'title' => $this->lang->line('reports_sales_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $subtitle, 'chart_type' => 'reports/graphs/line', 'labels_1' => $labels, 'series_data_1' => $series, - 'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))), + 'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))), 'yaxis_title' => $this->lang->line('reports_revenue'), 'xaxis_title' => $this->lang->line('reports_date'), 'show_currency' => TRUE @@ -388,8 +538,13 @@ class Reports extends Secure_Controller { $this->load->model('reports/Summary_items'); $model = $this->Summary_items; - - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); + + /** + * Added by Jorge Colmenarez 2016-11-01 20:54 + * Support for send flag datetime filter + */ + $datetime_filter = $this->config->item('filter_datetime_format'); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); $labels = array(); $series = array(); @@ -401,13 +556,23 @@ class Reports extends Secure_Controller $series[] = $row['total']; } + /** + * Added by Jorge Colmenarez 2016-11-01 20:55 + * Set subtitle with corresponsed format + */ + $subtitle =""; + if(empty($datetime_filter)) + $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); + else + $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); + $data = array( 'title' => $this->lang->line('reports_items_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $subtitle, 'chart_type' => 'reports/graphs/hbar', 'labels_1' => $labels, 'series_data_1' => $series, - 'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))), + 'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))), 'yaxis_title' => $this->lang->line('reports_items'), 'xaxis_title' => $this->lang->line('reports_revenue'), 'show_currency' => TRUE @@ -421,9 +586,14 @@ class Reports extends Secure_Controller { $this->load->model('reports/Summary_categories'); $model = $this->Summary_categories; - - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); - $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))); + + /** + * Added by Jorge Colmenarez 2016-11-01 20:56 + * Support for send flag datetime filter + */ + $datetime_filter = $this->config->item('filter_datetime_format'); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); + $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))); $labels = array(); $series = array(); @@ -435,9 +605,19 @@ class Reports extends Secure_Controller $series[] = array('meta' => $row['category'] . ' ' . round($row['total'] / $summary['total'] * 100, 2) . '%', 'value' => $row['total']); } + /** + * Added by Jorge Colmenarez 2016-11-01 20:56 + * Set subtitle with corresponsed format + */ + $subtitle =""; + if(empty($datetime_filter)) + $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); + else + $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); + $data = array( 'title' => $this->lang->line('reports_categories_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $subtitle, 'chart_type' => 'reports/graphs/pie', 'labels_1' => $labels, 'series_data_1' => $series, @@ -453,9 +633,14 @@ class Reports extends Secure_Controller { $this->load->model('reports/Summary_suppliers'); $model = $this->Summary_suppliers; - - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); - $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))); + + /** + * Added by Jorge Colmenarez 2016-11-01 20:57 + * Support for send flag datetime filter + */ + $datetime_filter = $this->config->item('filter_datetime_format'); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); + $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))); $labels = array(); $series = array(); @@ -467,9 +652,19 @@ class Reports extends Secure_Controller $series[] = array('meta' => $row['supplier'] . ' ' . round($row['total'] / $summary['total'] * 100, 2) . '%', 'value' => $row['total']); } + /** + * Added by Jorge Colmenarez 2016-11-01 20:57 + * Set subtitle with corresponsed format + */ + $subtitle =""; + if(empty($datetime_filter)) + $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); + else + $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); + $data = array( 'title' => $this->lang->line('reports_suppliers_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $subtitle, 'chart_type' => 'reports/graphs/pie', 'labels_1' => $labels, 'series_data_1' => $series, @@ -485,9 +680,14 @@ class Reports extends Secure_Controller { $this->load->model('reports/Summary_employees'); $model = $this->Summary_employees; - - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); - $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))); + + /** + * Added by Jorge Colmenarez 2016-11-01 20:59 + * Support for send flag datetime filter + */ + $datetime_filter = $this->config->item('filter_datetime_format'); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); + $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))); $labels = array(); $series = array(); @@ -499,9 +699,19 @@ class Reports extends Secure_Controller $series[] = array('meta' => $row['employee'] . ' ' . round($row['total'] / $summary['total'] * 100, 2) . '%', 'value' => $row['total']); } + /** + * Added by Jorge Colmenarez 2016-11-01 20:59 + * Set subtitle with corresponsed format + */ + $subtitle =""; + if(empty($datetime_filter)) + $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); + else + $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); + $data = array( 'title' => $this->lang->line('reports_employees_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $subtitle, 'chart_type' => 'reports/graphs/pie', 'labels_1' => $labels, 'series_data_1' => $series, @@ -517,9 +727,14 @@ class Reports extends Secure_Controller { $this->load->model('reports/Summary_taxes'); $model = $this->Summary_taxes; - - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); - $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))); + + /** + * Added by Jorge Colmenarez 2016-11-01 20:59 + * Support for send flag datetime filter + */ + $datetime_filter = $this->config->item('filter_datetime_format'); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); + $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))); $labels = array(); $series = array(); @@ -531,9 +746,19 @@ class Reports extends Secure_Controller $series[] = array('meta' => $row['percent'] . ' ' . round($row['total'] / $summary['total'] * 100, 2) . '%', 'value' => $row['total']); } + /** + * Added by Jorge Colmenarez 2016-11-01 20:59 + * Set subtitle with corresponsed format + */ + $subtitle =""; + if(empty($datetime_filter)) + $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); + else + $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); + $data = array( 'title' => $this->lang->line('reports_taxes_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $subtitle, 'chart_type' => 'reports/graphs/pie', 'labels_1' => $labels, 'series_data_1' => $series, @@ -549,8 +774,13 @@ class Reports extends Secure_Controller { $this->load->model('reports/Summary_customers'); $model = $this->Summary_customers; - - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); + + /** + * Added by Jorge Colmenarez 2016-11-01 21:01 + * Support for send flag datetime filter + */ + $datetime_filter = $this->config->item('filter_datetime_format'); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); $labels = array(); $series = array(); @@ -562,13 +792,23 @@ class Reports extends Secure_Controller $series[] = $row['total']; } + /** + * Added by Jorge Colmenarez 2016-11-01 21:01 + * Set subtitle with corresponsed format + */ + $subtitle =""; + if(empty($datetime_filter)) + $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); + else + $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); + $data = array( 'title' => $this->lang->line('reports_customers_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $subtitle, 'chart_type' => 'reports/graphs/hbar', 'labels_1' => $labels, 'series_data_1' => $series, - 'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))), + 'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))), 'yaxis_title' => $this->lang->line('reports_customers'), 'xaxis_title' => $this->lang->line('reports_revenue'), 'show_currency' => TRUE @@ -582,8 +822,13 @@ class Reports extends Secure_Controller { $this->load->model('reports/Summary_discounts'); $model = $this->Summary_discounts; - - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); + + /** + * Added by Jorge Colmenarez 2016-11-01 21:02 + * Support for send flag datetime filter + */ + $datetime_filter = $this->config->item('filter_datetime_format'); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); $labels = array(); $series = array(); @@ -595,13 +840,23 @@ class Reports extends Secure_Controller $series[] = $row['count']; } + /** + * Added by Jorge Colmenarez 2016-11-01 21:02 + * Set subtitle with corresponsed format + */ + $subtitle =""; + if(empty($datetime_filter)) + $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); + else + $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); + $data = array( 'title' => $this->lang->line('reports_discounts_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $subtitle, 'chart_type' => 'reports/graphs/bar', 'labels_1' => $labels, 'series_data_1' => $series, - 'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))), + 'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))), 'yaxis_title' => $this->lang->line('reports_count'), 'xaxis_title' => $this->lang->line('reports_discount_percent'), 'show_currency' => FALSE @@ -615,9 +870,14 @@ class Reports extends Secure_Controller { $this->load->model('reports/Summary_payments'); $model = $this->Summary_payments; - - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); - $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))); + + /** + * Added by Jorge Colmenarez 2016-11-01 21:03 + * Support for send flag datetime filter + */ + $datetime_filter = $this->config->item('filter_datetime_format'); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); + $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))); $labels = array(); $series = array(); @@ -629,9 +889,19 @@ class Reports extends Secure_Controller $series[] = array('meta' => $row['payment_type'] . ' ' . round($row['payment_amount'] / $summary['total'] * 100, 2) . '%', 'value' => $row['payment_amount']); } + /** + * Added by Jorge Colmenarez 2016-11-01 21:03 + * Set subtitle with corresponsed format + */ + $subtitle =""; + if(empty($datetime_filter)) + $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); + else + $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); + $data = array( 'title' => $this->lang->line('reports_payments_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $subtitle, 'chart_type' => 'reports/graphs/pie', 'labels_1' => $labels, 'series_data_1' => $series, @@ -663,7 +933,13 @@ class Reports extends Secure_Controller $model = $this->Specific_customer; $headers = $this->xss_clean($model->getDataColumns()); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'customer_id' => $customer_id, 'sale_type' => $sale_type)); + + /** + * Added by Jorge Colmenarez 2016-11-01 21:06 + * Support for send flag datetime filter + */ + $datetime_filter = $this->config->item('filter_datetime_format'); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'customer_id' => $customer_id, 'sale_type' => $sale_type, 'datetime_filter' => $datetime_filter)); $summary_data = array(); $details_data = array(); @@ -679,13 +955,24 @@ class Reports extends Secure_Controller } $customer_info = $this->Customer->get_info($customer_id); + + /** + * Added by Jorge Colmenarez 2016-11-01 21:06 + * Set subtitle with corresponsed format + */ + $subtitle =""; + if(empty($datetime_filter)) + $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); + else + $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); + $data = array( 'title' => $this->xss_clean($customer_info->first_name . ' ' . $customer_info->last_name . ' ' . $this->lang->line('reports_report')), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $subtitle, 'headers' => $headers, 'summary_data' => $summary_data, 'details_data' => $details_data, - 'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'customer_id' => $customer_id, 'sale_type' => $sale_type))) + 'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'customer_id' => $customer_id, 'sale_type' => $sale_type, 'datetime_filter' => $datetime_filter))) ); $this->load->view('reports/tabular_details', $data); @@ -712,7 +999,13 @@ class Reports extends Secure_Controller $model = $this->Specific_employee; $headers = $this->xss_clean($model->getDataColumns()); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'employee_id' => $employee_id, 'sale_type' => $sale_type)); + + /** + * Added by Jorge Colmenarez 2016-11-01 21:13 + * Support for send flag datetime filter + */ + $datetime_filter = $this->config->item('filter_datetime_format'); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'employee_id' => $employee_id, 'sale_type' => $sale_type, 'datetime_filter' => $datetime_filter)); $summary_data = array(); $details_data = array(); @@ -728,13 +1021,24 @@ class Reports extends Secure_Controller } $employee_info = $this->Employee->get_info($employee_id); + + /** + * Added by Jorge Colmenarez 2016-11-01 21:06 + * Set subtitle with corresponsed format + */ + $subtitle =""; + if(empty($datetime_filter)) + $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); + else + $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); + $data = array( 'title' => $this->xss_clean($employee_info->first_name . ' ' . $employee_info->last_name . ' ' . $this->lang->line('reports_report')), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $subtitle, 'headers' => $headers, 'summary_data' => $summary_data, 'details_data' => $details_data, - 'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date,'employee_id' => $employee_id, 'sale_type' => $sale_type))) + 'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date,'employee_id' => $employee_id, 'sale_type' => $sale_type, 'datetime_filter' => $datetime_filter))) ); $this->load->view('reports/tabular_details', $data); @@ -763,7 +1067,13 @@ class Reports extends Secure_Controller $model = $this->Specific_discount; $headers = $this->xss_clean($model->getDataColumns()); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'discount' => $discount, 'sale_type' => $sale_type)); + + /** + * Added by Jorge Colmenarez 2016-11-01 21:17 + * Support for send flag datetime filter + */ + $datetime_filter = $this->config->item('filter_datetime_format'); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'discount' => $discount, 'sale_type' => $sale_type, 'datetime_filter' => $datetime_filter)); $summary_data = array(); $details_data = array(); @@ -778,13 +1088,23 @@ class Reports extends Secure_Controller } } + /** + * Added by Jorge Colmenarez 2016-11-01 21:17 + * Set subtitle with corresponsed format + */ + $subtitle =""; + if(empty($datetime_filter)) + $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); + else + $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); + $data = array( 'title' => $discount . '% ' . $this->lang->line('reports_discount') . ' ' . $this->lang->line('reports_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $subtitle, 'headers' => $headers, 'summary_data' => $summary_data, 'details_data' => $details_data, - 'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date,'discount' => $discount, 'sale_type' => $sale_type))) + 'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date,'discount' => $discount, 'sale_type' => $sale_type, 'datetime_filter' => $datetime_filter))) ); $this->load->view('reports/tabular_details', $data); @@ -824,7 +1144,13 @@ class Reports extends Secure_Controller $model = $this->Detailed_sales; $headers = $this->xss_clean($model->getDataColumns()); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); + + /** + * Added by Jorge Colmenarez 2016-11-01 21:28 + * Support for send flag datetime filter + */ + $datetime_filter = $this->config->item('filter_datetime_format'); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); $summary_data = array(); $details_data = array(); @@ -862,14 +1188,24 @@ class Reports extends Secure_Controller } } + /** + * Added by Jorge Colmenarez 2016-11-01 21:28 + * Set subtitle with corresponsed format + */ + $subtitle =""; + if(empty($datetime_filter)) + $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); + else + $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); + $data = array( 'title' => $this->lang->line('reports_detailed_sales_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $subtitle, 'headers' => $headers, 'editable' => 'sales', 'summary_data' => $summary_data, 'details_data' => $details_data, - 'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))) + 'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) ); $this->load->view('reports/tabular_details', $data); @@ -906,7 +1242,13 @@ class Reports extends Secure_Controller $model = $this->Detailed_receivings; $headers = $this->xss_clean($model->getDataColumns()); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'receiving_type' => $receiving_type, 'location_id' => $location_id)); + + /** + * Added by Jorge Colmenarez 2016-11-01 21:32 + * Support for send flag datetime filter + */ + $datetime_filter = $this->config->item('filter_datetime_format'); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'receiving_type' => $receiving_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); $summary_data = array(); $details_data = array(); @@ -941,14 +1283,24 @@ class Reports extends Secure_Controller } } + /** + * Added by Jorge Colmenarez 2016-11-01 21:32 + * Set subtitle with corresponsed format + */ + $subtitle =""; + if(empty($datetime_filter)) + $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); + else + $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); + $data = array( 'title' => $this->lang->line('reports_detailed_receivings_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $subtitle, 'headers' => $headers, 'editable' => 'receivings', 'summary_data' => $summary_data, 'details_data' => $details_data, - 'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'receiving_type' => $receiving_type, 'location_id' => $location_id))) + 'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'receiving_type' => $receiving_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) ); $this->load->view('reports/tabular_details', $data); diff --git a/application/controllers/Sales.php b/application/controllers/Sales.php index ab4c858b5..df807093d 100644 --- a/application/controllers/Sales.php +++ b/application/controllers/Sales.php @@ -78,8 +78,13 @@ class Sales extends Secure_Controller // check if any filter is set in the multiselect dropdown $filledup = array_fill_keys($this->input->get('filters'), TRUE); $filters = array_merge($filters, $filledup); - - $sales = $this->Sale->search($search, $filters, $limit, $offset, $sort, $order); + /** + * Added by Jorge Colmenarez 2016-11-01 14:22 + * Support for send flag datetime filter + */ + $datetime_filter = $this->config->item('filter_datetime_format'); + // Modify function search to add parameter datetime filter + $sales = $this->Sale->search($search, $filters, $limit, $offset, $sort, $order,$datetime_filter); $total_rows = $this->Sale->get_found_rows($search, $filters); $payments = $this->Sale->get_payments_summary($search, $filters); $payment_summary = $this->xss_clean(get_sales_manage_payments_summary($payments, $sales, $this)); diff --git a/application/language/en/config_lang.php b/application/language/en/config_lang.php index 4963c51c0..c6feba41a 100644 --- a/application/language/en/config_lang.php +++ b/application/language/en/config_lang.php @@ -182,3 +182,8 @@ $lang["config_number_locale_required"] = "Number Locale is a required field"; $lang["config_number_locale_invalid"] = "The entered locale is invalid. Check the link in the tooltip to find a sensible value"; $lang["config_number_locale_tooltip"] = "Find a suitable locale through this link"; $lang["config_theme"] = "Theme"; +/** +* Added by Jorge Colmenarez 2016-10-31 16:30 +* Support for DateTime Reports Filter +*/ +$lang["config_filter_datetime_format"] = "Filter with date/time format in reports"; diff --git a/application/language/es/config_lang.php b/application/language/es/config_lang.php index 84a045f45..a7c8e8aae 100644 --- a/application/language/es/config_lang.php +++ b/application/language/es/config_lang.php @@ -182,3 +182,8 @@ $lang["config_number_locale_required"] = "Numero local es un campo requerido"; $lang["config_number_locale_invalid"] = "El local ingresado es invalido. Revisa el link en el tooltip para encontrar informacion"; $lang["config_number_locale_tooltip"] = "Encontrar un local adecuado en esta liga"; $lang["config_theme"] = "Tema"; +/** +* Added by Jorge Colmenarez 2016-10-31 16:34 +* Support for DateTime Reports Filter +*/ +$lang["config_filter_datetime_format"] = "Filtrar con formato de fecha/hora en los informes"; \ No newline at end of file diff --git a/application/models/Receiving.php b/application/models/Receiving.php index c12605efb..471464950 100644 --- a/application/models/Receiving.php +++ b/application/models/Receiving.php @@ -205,8 +205,10 @@ class Receiving extends CI_Model */ public function create_temp_table() { + // Modify by Jorge Colmenarez 2016-11-01 21:45 + // Add Index receiving_time $this->db->query('CREATE TEMPORARY TABLE IF NOT EXISTS ' . $this->db->dbprefix('receivings_items_temp') . - ' (INDEX(receiving_date), INDEX(receiving_id)) + ' (INDEX(receiving_date), INDEX(receiving_time), INDEX(receiving_id)) ( SELECT DATE(receiving_time) AS receiving_date, diff --git a/application/models/Sale.php b/application/models/Sale.php index 465440746..03d14709b 100644 --- a/application/models/Sale.php +++ b/application/models/Sale.php @@ -26,7 +26,7 @@ class Sale extends CI_Model /* Get the sales data for the takings (sales/manage) view */ - public function search($search, $filters, $rows = 0, $limit_from = 0, $sort = 'sale_date', $order = 'desc') + public function search($search, $filters, $rows = 0, $limit_from = 0, $sort = 'sale_date', $order = 'desc', $datetime_filter = '') { $this->db->select('sale_id, sale_date, sale_time, SUM(quantity_purchased) AS items_purchased, customer_name, customer_company_name AS company_name, @@ -34,9 +34,13 @@ class Sale extends CI_Model sale_payment_amount AS amount_tendered, SUM(total) AS amount_due, (sale_payment_amount - SUM(total)) AS change_due, payment_type, invoice_number'); $this->db->from('sales_items_temp'); - - $this->db->where('sale_date BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date'])); - + // Modify by Jorge Colmenarez 2016-11-01 14:25 + // Set DateTime filter field + if(empty($datetime_filter)) + $this->db->where('sale_date BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date'])); + else + $this->db->where('sale_time BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date'])); + // End Jorge Colmenarez if(!empty($search)) { if($filters['is_valid_receipt'] != FALSE) @@ -559,9 +563,10 @@ class Sale extends CI_Model GROUP BY sale_id )' ); - + // Modify by Jorge Colmenarez 2016-11-01 14:29 + // Add Index sale_time $this->db->query('CREATE TEMPORARY TABLE IF NOT EXISTS ' . $this->db->dbprefix('sales_items_temp') . - ' (INDEX(sale_date), INDEX(sale_id)) + ' (INDEX(sale_date), INDEX(sale_time), INDEX(sale_id)) ( SELECT DATE(sales.sale_time) AS sale_date, diff --git a/application/models/reports/Detailed_receivings.php b/application/models/reports/Detailed_receivings.php index 7a970dc88..518e483b0 100644 --- a/application/models/reports/Detailed_receivings.php +++ b/application/models/reports/Detailed_receivings.php @@ -53,7 +53,12 @@ class Detailed_receivings extends Report $this->db->from('receivings_items_temp'); $this->db->join('people AS employee', 'receivings_items_temp.employee_id = employee.person_id'); $this->db->join('suppliers AS supplier', 'receivings_items_temp.supplier_id = supplier.person_id', 'left'); - $this->db->where('receiving_date BETWEEN '. $this->db->escape($inputs['start_date']). ' AND '. $this->db->escape($inputs['end_date'])); + // Modify by Jorge Colmenarez 2016-11-01 21:47 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("receiving_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("receiving_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); if ($inputs['location_id'] != 'all') { @@ -95,7 +100,12 @@ class Detailed_receivings extends Report { $this->db->select('SUM(total) AS total'); $this->db->from('receivings_items_temp'); - $this->db->where('receiving_date BETWEEN '. $this->db->escape($inputs['start_date']). ' AND '. $this->db->escape($inputs['end_date'])); + // Modify by Jorge Colmenarez 2016-11-01 21:47 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("receiving_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("receiving_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); if ($inputs['location_id'] != 'all') { diff --git a/application/models/reports/Detailed_sales.php b/application/models/reports/Detailed_sales.php index 6059412e4..39cf15fb9 100644 --- a/application/models/reports/Detailed_sales.php +++ b/application/models/reports/Detailed_sales.php @@ -55,7 +55,12 @@ class Detailed_sales extends Report { $this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, employee_name, customer_name, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment'); $this->db->from('sales_items_temp'); - $this->db->where('sale_date BETWEEN '. $this->db->escape($inputs['start_date']). ' AND '. $this->db->escape($inputs['end_date'])); + // Modify by Jorge Colmenarez 2016-11-01 21:29 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); if ($inputs['location_id'] != 'all') { @@ -93,7 +98,12 @@ class Detailed_sales extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - $this->db->where('sale_date BETWEEN '. $this->db->escape($inputs['start_date']). ' AND '. $this->db->escape($inputs['end_date'])); + // Modify by Jorge Colmenarez 2016-11-01 21:29 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); if ($inputs['location_id'] != 'all') { diff --git a/application/models/reports/Specific_customer.php b/application/models/reports/Specific_customer.php index fdb67677f..50eec443b 100644 --- a/application/models/reports/Specific_customer.php +++ b/application/models/reports/Specific_customer.php @@ -21,7 +21,14 @@ class Specific_customer extends Report { $this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, employee_name, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment'); $this->db->from('sales_items_temp'); - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " AND customer_id=" . $this->db->escape($inputs['customer_id'])); + // Modify by Jorge Colmenarez 2016-11-01 21:05 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + // Support for filter by Specific Customer + $this->db->where("customer_id = ".$inputs['customer_id']); if ($inputs['sale_type'] == 'sales') { @@ -54,7 +61,14 @@ class Specific_customer extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " AND customer_id=" . $this->db->escape($inputs['customer_id'])); + // Modify by Jorge Colmenarez 2016-11-01 21:05 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + // Support for filter by Specific Customer + $this->db->where("customer_id = ".$inputs['customer_id']); if ($inputs['sale_type'] == 'sales') { diff --git a/application/models/reports/Specific_discount.php b/application/models/reports/Specific_discount.php index c7a926633..d76560f07 100755 --- a/application/models/reports/Specific_discount.php +++ b/application/models/reports/Specific_discount.php @@ -21,8 +21,15 @@ class Specific_discount extends Report { $this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, customer_name, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment'); $this->db->from('sales_items_temp'); - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " AND discount_percent >=" . $this->db->escape($inputs['discount'])); - + // Modify by Jorge Colmenarez 2016-11-01 21:05 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + // Support for filter by Specific Discount + $this->db->where('discount_percent = '.$inputs['discount']); + if ($inputs['sale_type'] == 'sales') { $this->db->where('quantity_purchased > 0'); @@ -55,8 +62,15 @@ class Specific_discount extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " AND discount_percent >=" . $this->db->escape($inputs['discount'])); - + // Modify by Jorge Colmenarez 2016-11-01 21:05 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + // Support for filter by Specific Discount + $this->db->where('discount_percent = '.$inputs['discount']); + if ($inputs['sale_type'] == 'sales') { $this->db->where('quantity_purchased > 0'); diff --git a/application/models/reports/Specific_employee.php b/application/models/reports/Specific_employee.php index 977de2103..8fc0d75bd 100644 --- a/application/models/reports/Specific_employee.php +++ b/application/models/reports/Specific_employee.php @@ -21,8 +21,15 @@ class Specific_employee extends Report { $this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, customer_name, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment'); $this->db->from('sales_items_temp'); - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " AND employee_id=" . $this->db->escape($inputs['employee_id'])); - + // Modify by Jorge Colmenarez 2016-11-01 21:05 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + // Support by filter Specific Employee + $this->db->where("employee_id = ".$inputs['employee_id']); + if ($inputs['sale_type'] == 'sales') { $this->db->where('quantity_purchased > 0'); @@ -54,7 +61,14 @@ class Specific_employee extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " AND employee_id=" . $this->db->escape($inputs['employee_id'])); + // Modify by Jorge Colmenarez 2016-11-01 21:05 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + // Support by filter Specific Employee + $this->db->where("employee_id = ".$inputs['employee_id']); if ($inputs['sale_type'] == 'sales') { diff --git a/application/models/reports/Summary_categories.php b/application/models/reports/Summary_categories.php index b8fdf22a9..265f45a16 100644 --- a/application/models/reports/Summary_categories.php +++ b/application/models/reports/Summary_categories.php @@ -19,7 +19,12 @@ class Summary_categories extends Report { $this->db->select('category, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + // Modify by Jorge Colmenarez 2016-11-01 16:47 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); if ($inputs['location_id'] != 'all') { @@ -37,7 +42,6 @@ class Summary_categories extends Report $this->db->group_by('category'); $this->db->order_by('category'); - return $this->db->get()->result_array(); } @@ -45,7 +49,12 @@ class Summary_categories extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + // Modify by Jorge Colmenarez 2016-11-01 16:47 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); if ($inputs['location_id'] != 'all') { diff --git a/application/models/reports/Summary_customers.php b/application/models/reports/Summary_customers.php index ebf863c71..8cf646e50 100644 --- a/application/models/reports/Summary_customers.php +++ b/application/models/reports/Summary_customers.php @@ -19,7 +19,12 @@ class Summary_customers extends Report { $this->db->select('customer_name AS customer, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + // Modify by Jorge Colmenarez 2016-11-01 20:15 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); if ($inputs['location_id'] != 'all') { @@ -45,7 +50,12 @@ class Summary_customers extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + // Modify by Jorge Colmenarez 2016-11-01 20:15 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); if ($inputs['location_id'] != 'all') { diff --git a/application/models/reports/Summary_discounts.php b/application/models/reports/Summary_discounts.php index 29d34a327..b3356f54c 100644 --- a/application/models/reports/Summary_discounts.php +++ b/application/models/reports/Summary_discounts.php @@ -19,7 +19,13 @@ class Summary_discounts extends Report { $this->db->select('CONCAT(discount_percent, "%") AS discount_percent, count(*) AS count'); $this->db->from('sales_items_temp'); - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + // Modify by Jorge Colmenarez 2016-11-01 20:45 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + $this->db->where('discount_percent > 0'); if ($inputs['location_id'] != 'all') @@ -46,7 +52,14 @@ class Summary_discounts extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + // Modify by Jorge Colmenarez 2016-11-01 20:45 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + + $this->db->where('discount_percent > 0'); if ($inputs['location_id'] != 'all') { diff --git a/application/models/reports/Summary_employees.php b/application/models/reports/Summary_employees.php index 52c7fc4d1..b6e73b56a 100644 --- a/application/models/reports/Summary_employees.php +++ b/application/models/reports/Summary_employees.php @@ -19,7 +19,12 @@ class Summary_employees extends Report { $this->db->select('employee_name AS employee, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + // Modify by Jorge Colmenarez 2016-11-01 20:26 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); if ($inputs['location_id'] != 'all') { @@ -45,7 +50,12 @@ class Summary_employees extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + // Modify by Jorge Colmenarez 2016-11-01 20:26 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); if ($inputs['location_id'] != 'all') { diff --git a/application/models/reports/Summary_items.php b/application/models/reports/Summary_items.php index 033a9b870..9d38aae69 100644 --- a/application/models/reports/Summary_items.php +++ b/application/models/reports/Summary_items.php @@ -19,7 +19,12 @@ class Summary_items extends Report { $this->db->select('name, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + // Modify by Jorge Colmenarez 2016-11-01 20:23 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); if ($inputs['location_id'] != 'all') { @@ -45,7 +50,12 @@ class Summary_items extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + // Modify by Jorge Colmenarez 2016-11-01 20:23 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); if ($inputs['location_id'] != 'all') { diff --git a/application/models/reports/Summary_payments.php b/application/models/reports/Summary_payments.php index b1f316bd8..25639b3b7 100644 --- a/application/models/reports/Summary_payments.php +++ b/application/models/reports/Summary_payments.php @@ -20,7 +20,12 @@ class Summary_payments extends Report $this->db->select('sales_payments.payment_type, count(*) AS count, SUM(payment_amount) AS payment_amount'); $this->db->from('sales_payments'); $this->db->join('sales', 'sales.sale_id=sales_payments.sale_id'); - $this->db->where("date(sale_time) BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + // Modify by Jorge Colmenarez 2016-11-01 20:49 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("date(sale_time) BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); if ($inputs['location_id'] != 'all') { @@ -67,7 +72,12 @@ class Summary_payments extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + // Modify by Jorge Colmenarez 2016-11-01 20:49 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); if ($inputs['location_id'] != 'all') { diff --git a/application/models/reports/Summary_sales.php b/application/models/reports/Summary_sales.php index 6d8b08dcf..1178c75d4 100644 --- a/application/models/reports/Summary_sales.php +++ b/application/models/reports/Summary_sales.php @@ -19,7 +19,12 @@ class Summary_sales extends Report { $this->db->select('sale_date, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + // Modify by Jorge Colmenarez 2016-11-01 19:01 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); if ($inputs['location_id'] != 'all') { @@ -45,7 +50,12 @@ class Summary_sales extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + // Modify by Jorge Colmenarez 2016-11-01 19:01 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); if ($inputs['location_id'] != 'all') { diff --git a/application/models/reports/Summary_suppliers.php b/application/models/reports/Summary_suppliers.php index 07644a46f..3d2693e1e 100644 --- a/application/models/reports/Summary_suppliers.php +++ b/application/models/reports/Summary_suppliers.php @@ -21,7 +21,12 @@ class Summary_suppliers extends Report $this->db->from('sales_items_temp'); $this->db->join('suppliers', 'suppliers.person_id = sales_items_temp.supplier_id'); $this->db->join('people', 'suppliers.person_id = people.person_id'); - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + // Modify by Jorge Colmenarez 2016-11-01 20:18 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); if ($inputs['location_id'] != 'all') { @@ -49,7 +54,12 @@ class Summary_suppliers extends Report $this->db->from('sales_items_temp'); $this->db->join('suppliers', 'suppliers.person_id = sales_items_temp.supplier_id'); $this->db->join('people', 'suppliers.person_id = people.person_id'); - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + // Modify by Jorge Colmenarez 2016-11-01 20:18 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); if ($inputs['location_id'] != 'all') { diff --git a/application/models/reports/Summary_taxes.php b/application/models/reports/Summary_taxes.php index c5f0a420f..e8f733f85 100644 --- a/application/models/reports/Summary_taxes.php +++ b/application/models/reports/Summary_taxes.php @@ -47,6 +47,16 @@ class Summary_taxes extends Report $decimals = totals_decimals(); + // Modify by Jorge Colmenarez 2016-11-01 20:31 + // Set WHERE Clause with support for DateTime filter field + $clauseWhere = ""; + if(empty($inputs['datetime_filter'])) + $clauseWhere = "WHERE date(sale_time) BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']); + else + $clauseWhere = "WHERE sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date'])); + + $clauseWhere.=" ".$quantity_cond; + $query = $this->db->query("SELECT percent, count(*) AS count, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax FROM (SELECT name, CONCAT(ROUND(percent, $decimals), '%') AS percent, ROUND((item_unit_price * quantity_purchased - item_unit_price * quantity_purchased * discount_percent /100) * $subtotal, $decimals) AS subtotal, @@ -58,7 +68,7 @@ class Summary_taxes extends Report .$this->db->dbprefix('sales_items').'.item_id='.$this->db->dbprefix('sales_items_taxes').'.item_id'." AND " .$this->db->dbprefix('sales_items').'.line='.$this->db->dbprefix('sales_items_taxes').'.line' ." JOIN ".$this->db->dbprefix('sales')." ON ".$this->db->dbprefix('sales_items_taxes').".sale_id=".$this->db->dbprefix('sales').".sale_id - WHERE date(sale_time) BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " $quantity_cond) AS temp_taxes + $clauseWhere) AS temp_taxes GROUP BY percent"); return $query->result_array(); @@ -68,7 +78,12 @@ class Summary_taxes extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + // Modify by Jorge Colmenarez 2016-11-01 20:32 + // Set DateTime filter field + if(empty($inputs['datetime_filter'])) + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); + else + $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); if ($inputs['location_id'] != 'all') { diff --git a/application/views/configs/locale_config.php b/application/views/configs/locale_config.php index e6f335536..e2504c703 100644 --- a/application/views/configs/locale_config.php +++ b/application/views/configs/locale_config.php @@ -261,6 +261,18 @@ ?> + +
+ lang->line('config_filter_datetime_format'), 'filter_datetime_format', array('class' => 'control-label col-xs-2')); ?> +
+ 'filter_datetime_format', + 'id' => 'filter_datetime_format', + 'value' => 'filter_datetime_format', + 'checked'=>$this->config->item('filter_datetime_format'))); ?> +
+
+ 'submit_form', diff --git a/application/views/partial/daterangepicker.php b/application/views/partial/daterangepicker.php index 6427e5efa..fa2597e2b 100644 --- a/application/views/partial/daterangepicker.php +++ b/application/views/partial/daterangepicker.php @@ -1,57 +1,64 @@ lang->load("calendar"); $this->lang->load("date"); ?> -var start_date = ""; -var end_date = ""; +/** +* Added By Jorge Colmenarez 2016-11-01 8:52 +* Support for Set Dinamyc DateTime Filter into Object daterangepicker +*/ +config->item('filter_datetime_format'))){ +?> +var start_date = ""; +var end_date = ""; $('#daterangepicker').daterangepicker({ "ranges": { "lang->line("datepicker_today"); ?>": [ - "config->item('dateformat'), mktime(0,0,0,date("m"),date("d"),date("Y")));?>", - "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d"),date("Y")));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" ], "lang->line("datepicker_today_last_year"); ?>": [ - "config->item('dateformat'), mktime(0,0,0,date("m"),date("d"),date("Y")-1));?>", - "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y")-1)-1);?>" + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d"),date("Y")-1));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y")-1)-1);?>" ], "lang->line("datepicker_yesterday"); ?>": [ - "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")-1,date("Y")));?>", - "config->item('dateformat'), mktime(0,0,0,date("m"),date("d"),date("Y"))-1);?>" + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")-1,date("Y")));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d"),date("Y"))-1);?>" ], "lang->line("datepicker_last_7"); ?>": [ - "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")-6,date("Y")));?>", - "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")-6,date("Y")));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" ], "lang->line("datepicker_last_30"); ?>": [ - "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")-29,date("Y")));?>", - "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")-29,date("Y")));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" ], "lang->line("datepicker_this_month"); ?>": [ - "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y")));?>", - "config->item('dateformat'), mktime(0,0,0,date("m")+1,1,date("Y"))-1);?>" + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y")));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m")+1,1,date("Y"))-1);?>" ], "lang->line("datepicker_same_month_to_same_day_last_year"); ?>": [ - "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y")-1));?>", - "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y")-1)-1);?>" + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y")-1));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y")-1)-1);?>" ], "lang->line("datepicker_this_month_last_year"); ?>": [ - "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y")-1));?>", - "config->item('dateformat'), mktime(0,0,0,date("m")+1,1,date("Y")-1)-1);?>" + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y")-1));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m")+1,1,date("Y")-1)-1);?>" ], "lang->line("datepicker_last_month"); ?>": [ - "config->item('dateformat'), mktime(0,0,0,date("m")-1,1,date("Y")));?>", - "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y"))-1);?>" + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m")-1,1,date("Y")));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y"))-1);?>" ], "lang->line("datepicker_this_year"); ?>": [ - "config->item('dateformat'), mktime(0,0,0,1,1,date("Y")));?>", - "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y")+1)-1);?>" + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,1,1,date("Y")));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y")+1)-1);?>" ], "lang->line("datepicker_last_year"); ?>": [ - "config->item('dateformat'), mktime(0,0,0,1,1,date("Y")-1));?>", - "config->item('dateformat'), mktime(0,0,0,1,1,date("Y"))-1);?>" + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,1,1,date("Y")-1));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,1,1,date("Y"))-1);?>" ], "lang->line("datepicker_all_time"); ?>": [ - "config->item('dateformat'), mktime(0,0,0,01,01,2010));?>", - "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,01,01,2010));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" ], }, "locale": { @@ -89,11 +96,117 @@ $('#daterangepicker').daterangepicker({ "firstDay": lang->line("datepicker_weekstart"); ?> }, "alwaysShowCalendars": true, - "startDate": "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>", - "endDate": "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>", - "minDate": "config->item('dateformat'), mktime(0,0,0,01,01,2010));?>", - "maxDate": "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" + "startDate": "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>", + "endDate": "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>", + "minDate": "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,01,01,2010));?>", + "maxDate": "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" }, function(start, end, label) { start_date = start.format('YYYY-MM-DD'); end_date = end.format('YYYY-MM-DD'); -}); \ No newline at end of file +}); + +var start_date = ""; +var end_date = ""; + +$('#daterangepicker').daterangepicker({ + "ranges": { + "lang->line("datepicker_today"); ?>": [ + "config->item('dateformat')." ".$this->config->item('timeformat'), mktime(0,0,0,date("m"),date("d"),date("Y")));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d")+1,date("Y"))-1);?>" + ], + "lang->line("datepicker_today_last_year"); ?>": [ + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d"),date("Y")-1));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d")+1,date("Y")-1)-1);?>" + ], + "lang->line("datepicker_yesterday"); ?>": [ + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")-1,date("Y")));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d"),date("Y"))-1);?>" + ], + "lang->line("datepicker_last_7"); ?>": [ + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")-6,date("Y")));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d")+1,date("Y"))-1);?>" + ], + "lang->line("datepicker_last_30"); ?>": [ + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")-29,date("Y")));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d")+1,date("Y"))-1);?>" + ], + "lang->line("datepicker_this_month"); ?>": [ + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y")));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m")+1,1,date("Y"))-1);?>" + ], + "lang->line("datepicker_same_month_to_same_day_last_year"); ?>": [ + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y")-1));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d")+1,date("Y")-1)-1);?>" + ], + "lang->line("datepicker_this_month_last_year"); ?>": [ + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y")-1));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m")+1,1,date("Y")-1)-1);?>" + ], + "lang->line("datepicker_last_month"); ?>": [ + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m")-1,1,date("Y")));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),1,date("Y"))-1);?>" + ], + "lang->line("datepicker_this_year"); ?>": [ + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,1,1,date("Y")));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),1,date("Y")+1)-1);?>" + ], + "lang->line("datepicker_last_year"); ?>": [ + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,1,1,date("Y")-1));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,1,1,date("Y"))-1);?>" + ], + "lang->line("datepicker_all_time"); ?>": [ + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,01,01,2010));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d")+1,date("Y"))-1);?>" + ], + }, + "locale": { + "format": 'config->item("dateformat")." ".$this->config->item('timeformat'))?>', + "separator": " - ", + "applyLabel": "lang->line("datepicker_apply"); ?>", + "cancelLabel": "lang->line("datepicker_cancel"); ?>", + "fromLabel": "lang->line("datepicker_from"); ?>", + "toLabel": "lang->line("datepicker_to"); ?>", + "customRangeLabel": "lang->line("datepicker_custom"); ?>", + "daysOfWeek": [ + "lang->line("cal_su"); ?>", + "lang->line("cal_mo"); ?>", + "lang->line("cal_tu"); ?>", + "lang->line("cal_we"); ?>", + "lang->line("cal_th"); ?>", + "lang->line("cal_fr"); ?>", + "lang->line("cal_sa"); ?>", + "lang->line("cal_su"); ?>" + ], + "monthNames": [ + "lang->line("cal_january"); ?>", + "lang->line("cal_february"); ?>", + "lang->line("cal_march"); ?>", + "lang->line("cal_april"); ?>", + "lang->line("cal_may"); ?>", + "lang->line("cal_june"); ?>", + "lang->line("cal_july"); ?>", + "lang->line("cal_august"); ?>", + "lang->line("cal_september"); ?>", + "lang->line("cal_october"); ?>", + "lang->line("cal_november"); ?>", + "lang->line("cal_december"); ?>" + ], + "firstDay": lang->line("datepicker_weekstart"); ?> + }, + "timePicker": true, + "timePickerSeconds": true, + "alwaysShowCalendars": true, + "startDate": "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>", + "endDate": "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d")+1,date("Y"))-1);?>", + "minDate": "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,01,01,2010));?>", + "maxDate": "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d")+1,date("Y"))-1);?>" +}, function(start, end, label) { + start_date = start.format('YYYY-MM-DD HH:mm:ss'); + end_date = end.format('YYYY-MM-DD HH:mm:ss'); +}); + \ No newline at end of file diff --git a/application/views/reports/date_input.php b/application/views/reports/date_input.php index 312e39268..acc10eed4 100644 --- a/application/views/reports/date_input.php +++ b/application/views/reports/date_input.php @@ -77,7 +77,7 @@ $(document).ready(function() load->view('partial/daterangepicker'); ?> $("#generate_report").click(function() - { + { window.location = [window.location, start_date, end_date, $("#input_type").val() || 0, $("#location_id").val()].join("/"); }); }); From e326c1dfd4a02ffd77248df47645f31db7e97f6e Mon Sep 17 00:00:00 2001 From: Jorge Colmenarez Date: Fri, 4 Nov 2016 09:32:41 -0400 Subject: [PATCH 02/63] Remove copyright comments and apply suggestions --- LICENSE | 1 + application/controllers/Config.php | 3 - application/controllers/Login.php | 4 - application/controllers/Reports.php | 392 ++---------------- application/controllers/Sales.php | 5 +- application/language/en/config_lang.php | 4 - application/language/es/config_lang.php | 7 +- application/models/Receiving.php | 2 - application/models/Sale.php | 8 +- .../models/reports/Detailed_receivings.php | 6 +- application/models/reports/Detailed_sales.php | 6 +- .../models/reports/Specific_customer.php | 10 +- .../models/reports/Specific_discount.php | 5 +- .../models/reports/Specific_employee.php | 10 +- .../models/reports/Summary_categories.php | 6 +- .../models/reports/Summary_customers.php | 6 +- .../models/reports/Summary_discounts.php | 6 +- .../models/reports/Summary_employees.php | 6 +- application/models/reports/Summary_items.php | 6 +- .../models/reports/Summary_payments.php | 6 +- application/models/reports/Summary_sales.php | 6 +- .../models/reports/Summary_suppliers.php | 6 +- application/models/reports/Summary_taxes.php | 5 +- application/views/configs/locale_config.php | 3 +- application/views/partial/daterangepicker.php | 7 +- database/database.sql | 3 +- public/license/LICENSE | 1 + 27 files changed, 81 insertions(+), 449 deletions(-) diff --git a/LICENSE b/LICENSE index 9eb29b09e..4f37e2cea 100644 --- a/LICENSE +++ b/LICENSE @@ -10,6 +10,7 @@ Copyright (c) 2015-2016 FrancescoUK (aka daN4cat) Copyright (c) 2015 Aamir Shahzad (aka asakpke), RoshanTech.com Copyright (c) 2015 Toni Haryanto (aka yllumi) Copyright (c) 2016 Ramkrishna Mondal (aka RamkrishnaMondal) +Copyright (c) 2016 Jorge Colmenarez Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/application/controllers/Config.php b/application/controllers/Config.php index 7fd0552e3..b958fc04c 100644 --- a/application/controllers/Config.php +++ b/application/controllers/Config.php @@ -303,10 +303,7 @@ class Config extends Secure_Controller 'quantity_decimals' => $this->input->post('quantity_decimals'), 'country_codes' => $this->input->post('country_codes'), 'payment_options_order' => $this->input->post('payment_options_order'), - // Added By Jorge Colmenarez 2016-10-31 16:39 - // Support for filter datetime reports 'filter_datetime_format' => $this->input->post('filter_datetime_format') - // End Jorge Colmenarez ); $result = $this->Appconfig->batch_save($batch_save_data); diff --git a/application/controllers/Login.php b/application/controllers/Login.php index 321a79c00..2844e3833 100644 --- a/application/controllers/Login.php +++ b/application/controllers/Login.php @@ -41,10 +41,6 @@ class Login extends CI_Controller $this->tracking_lib->track_event('Stats', 'Tax Decimals', $this->config->item('tax_decimals')); $this->tracking_lib->track_event('Stats', 'Quantity Decimals', $this->config->item('quantity_decimals')); $this->tracking_lib->track_event('Stats', 'Invoice Enable', $this->config->item('invoice_enable')); - /** - * Jorge Colmenarez 2016-11-01 08:33 - * Set Static Filter DateTime Format Value - */ $this->tracking_lib->track_event('Stats', 'Filter DateTime Format', $this->config->item('filter_datetime_format')); } diff --git a/application/controllers/Reports.php b/application/controllers/Reports.php index 9f7636ac6..51c557815 100644 --- a/application/controllers/Reports.php +++ b/application/controllers/Reports.php @@ -43,10 +43,6 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_sales'); $model = $this->Summary_sales; - /** - * Added by Jorge Colmenarez 2016-11-01 19:00 - * Support for send flag datetime filter - */ $datetime_filter = $this->config->item('filter_datetime_format'); $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); @@ -63,19 +59,9 @@ class Reports extends Secure_Controller )); } - /** - * Added by Jorge Colmenarez 2016-11-01 19:01 - * Set subtitle with corresponsed format - */ - $subtitle =""; - if(empty($datetime_filter)) - $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); - else - $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); - $data = array( 'title' => $this->lang->line('reports_sales_summary_report'), - 'subtitle' => $subtitle, + 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) @@ -90,10 +76,6 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_categories'); $model = $this->Summary_categories; - /** - * Added by Jorge Colmenarez 2016-11-01 19:07 - * Support for send flag datetime filter - */ $datetime_filter = $this->config->item('filter_datetime_format'); $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); @@ -110,19 +92,9 @@ class Reports extends Secure_Controller )); } - /** - * Added by Jorge Colmenarez 2016-11-01 20:01 - * Set subtitle with corresponsed format - */ - $subtitle =""; - if(empty($datetime_filter)) - $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); - else - $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); - $data = array( 'title' => $this->lang->line('reports_categories_summary_report'), - 'subtitle' => $subtitle, + 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) @@ -137,10 +109,6 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_customers'); $model = $this->Summary_customers; - /** - * Added by Jorge Colmenarez 2016-11-01 20:13 - * Support for send flag datetime filter - */ $datetime_filter = $this->config->item('filter_datetime_format'); $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); @@ -157,19 +125,9 @@ class Reports extends Secure_Controller )); } - /** - * Added by Jorge Colmenarez 2016-11-01 20:14 - * Set subtitle with corresponsed format - */ - $subtitle =""; - if(empty($datetime_filter)) - $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); - else - $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); - $data = array( 'title' => $this->lang->line('reports_customers_summary_report'), - 'subtitle' => $subtitle, + 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) @@ -183,11 +141,7 @@ class Reports extends Secure_Controller { $this->load->model('reports/Summary_suppliers'); $model = $this->Summary_suppliers; - - /** - * Added by Jorge Colmenarez 2016-11-01 20:16 - * Support for send flag datetime filter - */ + $datetime_filter = $this->config->item('filter_datetime_format'); $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); @@ -204,19 +158,9 @@ class Reports extends Secure_Controller )); } - /** - * Added by Jorge Colmenarez 2016-11-01 20:17 - * Set subtitle with corresponsed format - */ - $subtitle =""; - if(empty($datetime_filter)) - $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); - else - $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); - $data = array( 'title' => $this->lang->line('reports_suppliers_summary_report'), - 'subtitle' => $subtitle, + 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) @@ -230,11 +174,7 @@ class Reports extends Secure_Controller { $this->load->model('reports/Summary_items'); $model = $this->Summary_items; - - /** - * Added by Jorge Colmenarez 2016-11-01 20:21 - * Support for send flag datetime filter - */ + $datetime_filter = $this->config->item('filter_datetime_format'); $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); @@ -251,19 +191,9 @@ class Reports extends Secure_Controller )); } - /** - * Added by Jorge Colmenarez 2016-11-01 20:22 - * Set subtitle with corresponsed format - */ - $subtitle =""; - if(empty($datetime_filter)) - $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); - else - $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); - $data = array( 'title' => $this->lang->line('reports_items_summary_report'), - 'subtitle' => $subtitle, + 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) @@ -277,11 +207,7 @@ class Reports extends Secure_Controller { $this->load->model('reports/Summary_employees'); $model = $this->Summary_employees; - - /** - * Added by Jorge Colmenarez 2016-11-01 20:24 - * Support for send flag datetime filter - */ + $datetime_filter = $this->config->item('filter_datetime_format'); $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); @@ -298,19 +224,9 @@ class Reports extends Secure_Controller )); } - /** - * Added by Jorge Colmenarez 2016-11-01 20:25 - * Set subtitle with corresponsed format - */ - $subtitle =""; - if(empty($datetime_filter)) - $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); - else - $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); - $data = array( 'title' => $this->lang->line('reports_employees_summary_report'), - 'subtitle' => $subtitle, + 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) @@ -325,10 +241,6 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_taxes'); $model = $this->Summary_taxes; - /** - * Added by Jorge Colmenarez 2016-11-01 20:29 - * Support for send flag datetime filter - */ $datetime_filter = $this->config->item('filter_datetime_format'); $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); @@ -343,19 +255,9 @@ class Reports extends Secure_Controller )); } - /** - * Added by Jorge Colmenarez 2016-11-01 20:30 - * Set subtitle with corresponsed format - */ - $subtitle =""; - if(empty($datetime_filter)) - $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); - else - $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); - $data = array( 'title' => $this->lang->line('reports_taxes_summary_report'), - 'subtitle' => $subtitle, + 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) @@ -370,10 +272,6 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_discounts'); $model = $this->Summary_discounts; - /** - * Added by Jorge Colmenarez 2016-11-01 20:44 - * Support for send flag datetime filter - */ $datetime_filter = $this->config->item('filter_datetime_format'); $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); @@ -385,19 +283,9 @@ class Reports extends Secure_Controller )); } - /** - * Added by Jorge Colmenarez 2016-11-01 20:44 - * Set subtitle with corresponsed format - */ - $subtitle =""; - if(empty($datetime_filter)) - $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); - else - $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); - $data = array( 'title' => $this->lang->line('reports_discounts_summary_report'), - 'subtitle' => $subtitle, + 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) @@ -412,10 +300,6 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_payments'); $model = $this->Summary_payments; - /** - * Added by Jorge Colmenarez 2016-11-01 20:47 - * Support for send flag datetime filter - */ $datetime_filter = $this->config->item('filter_datetime_format'); $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); @@ -428,19 +312,9 @@ class Reports extends Secure_Controller )); } - /** - * Added by Jorge Colmenarez 2016-11-01 20:48 - * Set subtitle with corresponsed format - */ - $subtitle =""; - if(empty($datetime_filter)) - $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); - else - $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); - $data = array( 'title' => $this->lang->line('reports_payments_summary_report'), - 'subtitle' => $subtitle, + 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) @@ -490,10 +364,6 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_sales'); $model = $this->Summary_sales; - /** - * Added by Jorge Colmenarez 2016-11-01 20:53 - * Support for send flag datetime filter - */ $datetime_filter = $this->config->item('filter_datetime_format'); $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); @@ -508,19 +378,9 @@ class Reports extends Secure_Controller $series[] = array('meta' => $date, 'value' => $row['total']); } - /** - * Added by Jorge Colmenarez 2016-11-01 20:54 - * Set subtitle with corresponsed format - */ - $subtitle =""; - if(empty($datetime_filter)) - $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); - else - $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); - $data = array( 'title' => $this->lang->line('reports_sales_summary_report'), - 'subtitle' => $subtitle, + 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), 'chart_type' => 'reports/graphs/line', 'labels_1' => $labels, 'series_data_1' => $series, @@ -539,10 +399,6 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_items'); $model = $this->Summary_items; - /** - * Added by Jorge Colmenarez 2016-11-01 20:54 - * Support for send flag datetime filter - */ $datetime_filter = $this->config->item('filter_datetime_format'); $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); @@ -556,19 +412,9 @@ class Reports extends Secure_Controller $series[] = $row['total']; } - /** - * Added by Jorge Colmenarez 2016-11-01 20:55 - * Set subtitle with corresponsed format - */ - $subtitle =""; - if(empty($datetime_filter)) - $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); - else - $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); - $data = array( 'title' => $this->lang->line('reports_items_summary_report'), - 'subtitle' => $subtitle, + 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), 'chart_type' => 'reports/graphs/hbar', 'labels_1' => $labels, 'series_data_1' => $series, @@ -587,10 +433,6 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_categories'); $model = $this->Summary_categories; - /** - * Added by Jorge Colmenarez 2016-11-01 20:56 - * Support for send flag datetime filter - */ $datetime_filter = $this->config->item('filter_datetime_format'); $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))); @@ -605,19 +447,9 @@ class Reports extends Secure_Controller $series[] = array('meta' => $row['category'] . ' ' . round($row['total'] / $summary['total'] * 100, 2) . '%', 'value' => $row['total']); } - /** - * Added by Jorge Colmenarez 2016-11-01 20:56 - * Set subtitle with corresponsed format - */ - $subtitle =""; - if(empty($datetime_filter)) - $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); - else - $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); - $data = array( 'title' => $this->lang->line('reports_categories_summary_report'), - 'subtitle' => $subtitle, + 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), 'chart_type' => 'reports/graphs/pie', 'labels_1' => $labels, 'series_data_1' => $series, @@ -634,10 +466,6 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_suppliers'); $model = $this->Summary_suppliers; - /** - * Added by Jorge Colmenarez 2016-11-01 20:57 - * Support for send flag datetime filter - */ $datetime_filter = $this->config->item('filter_datetime_format'); $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))); @@ -652,19 +480,9 @@ class Reports extends Secure_Controller $series[] = array('meta' => $row['supplier'] . ' ' . round($row['total'] / $summary['total'] * 100, 2) . '%', 'value' => $row['total']); } - /** - * Added by Jorge Colmenarez 2016-11-01 20:57 - * Set subtitle with corresponsed format - */ - $subtitle =""; - if(empty($datetime_filter)) - $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); - else - $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); - $data = array( 'title' => $this->lang->line('reports_suppliers_summary_report'), - 'subtitle' => $subtitle, + 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), 'chart_type' => 'reports/graphs/pie', 'labels_1' => $labels, 'series_data_1' => $series, @@ -681,10 +499,6 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_employees'); $model = $this->Summary_employees; - /** - * Added by Jorge Colmenarez 2016-11-01 20:59 - * Support for send flag datetime filter - */ $datetime_filter = $this->config->item('filter_datetime_format'); $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))); @@ -699,19 +513,9 @@ class Reports extends Secure_Controller $series[] = array('meta' => $row['employee'] . ' ' . round($row['total'] / $summary['total'] * 100, 2) . '%', 'value' => $row['total']); } - /** - * Added by Jorge Colmenarez 2016-11-01 20:59 - * Set subtitle with corresponsed format - */ - $subtitle =""; - if(empty($datetime_filter)) - $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); - else - $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); - $data = array( 'title' => $this->lang->line('reports_employees_summary_report'), - 'subtitle' => $subtitle, + 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), 'chart_type' => 'reports/graphs/pie', 'labels_1' => $labels, 'series_data_1' => $series, @@ -728,10 +532,6 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_taxes'); $model = $this->Summary_taxes; - /** - * Added by Jorge Colmenarez 2016-11-01 20:59 - * Support for send flag datetime filter - */ $datetime_filter = $this->config->item('filter_datetime_format'); $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))); @@ -746,19 +546,9 @@ class Reports extends Secure_Controller $series[] = array('meta' => $row['percent'] . ' ' . round($row['total'] / $summary['total'] * 100, 2) . '%', 'value' => $row['total']); } - /** - * Added by Jorge Colmenarez 2016-11-01 20:59 - * Set subtitle with corresponsed format - */ - $subtitle =""; - if(empty($datetime_filter)) - $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); - else - $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); - $data = array( 'title' => $this->lang->line('reports_taxes_summary_report'), - 'subtitle' => $subtitle, + 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), 'chart_type' => 'reports/graphs/pie', 'labels_1' => $labels, 'series_data_1' => $series, @@ -775,10 +565,6 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_customers'); $model = $this->Summary_customers; - /** - * Added by Jorge Colmenarez 2016-11-01 21:01 - * Support for send flag datetime filter - */ $datetime_filter = $this->config->item('filter_datetime_format'); $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); @@ -792,19 +578,9 @@ class Reports extends Secure_Controller $series[] = $row['total']; } - /** - * Added by Jorge Colmenarez 2016-11-01 21:01 - * Set subtitle with corresponsed format - */ - $subtitle =""; - if(empty($datetime_filter)) - $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); - else - $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); - $data = array( 'title' => $this->lang->line('reports_customers_summary_report'), - 'subtitle' => $subtitle, + 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), 'chart_type' => 'reports/graphs/hbar', 'labels_1' => $labels, 'series_data_1' => $series, @@ -823,10 +599,6 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_discounts'); $model = $this->Summary_discounts; - /** - * Added by Jorge Colmenarez 2016-11-01 21:02 - * Support for send flag datetime filter - */ $datetime_filter = $this->config->item('filter_datetime_format'); $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); @@ -840,19 +612,9 @@ class Reports extends Secure_Controller $series[] = $row['count']; } - /** - * Added by Jorge Colmenarez 2016-11-01 21:02 - * Set subtitle with corresponsed format - */ - $subtitle =""; - if(empty($datetime_filter)) - $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); - else - $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); - $data = array( 'title' => $this->lang->line('reports_discounts_summary_report'), - 'subtitle' => $subtitle, + 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), 'chart_type' => 'reports/graphs/bar', 'labels_1' => $labels, 'series_data_1' => $series, @@ -871,10 +633,6 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_payments'); $model = $this->Summary_payments; - /** - * Added by Jorge Colmenarez 2016-11-01 21:03 - * Support for send flag datetime filter - */ $datetime_filter = $this->config->item('filter_datetime_format'); $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))); @@ -889,19 +647,9 @@ class Reports extends Secure_Controller $series[] = array('meta' => $row['payment_type'] . ' ' . round($row['payment_amount'] / $summary['total'] * 100, 2) . '%', 'value' => $row['payment_amount']); } - /** - * Added by Jorge Colmenarez 2016-11-01 21:03 - * Set subtitle with corresponsed format - */ - $subtitle =""; - if(empty($datetime_filter)) - $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); - else - $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); - $data = array( 'title' => $this->lang->line('reports_payments_summary_report'), - 'subtitle' => $subtitle, + 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), 'chart_type' => 'reports/graphs/pie', 'labels_1' => $labels, 'series_data_1' => $series, @@ -933,11 +681,6 @@ class Reports extends Secure_Controller $model = $this->Specific_customer; $headers = $this->xss_clean($model->getDataColumns()); - - /** - * Added by Jorge Colmenarez 2016-11-01 21:06 - * Support for send flag datetime filter - */ $datetime_filter = $this->config->item('filter_datetime_format'); $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'customer_id' => $customer_id, 'sale_type' => $sale_type, 'datetime_filter' => $datetime_filter)); @@ -956,19 +699,9 @@ class Reports extends Secure_Controller $customer_info = $this->Customer->get_info($customer_id); - /** - * Added by Jorge Colmenarez 2016-11-01 21:06 - * Set subtitle with corresponsed format - */ - $subtitle =""; - if(empty($datetime_filter)) - $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); - else - $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); - $data = array( 'title' => $this->xss_clean($customer_info->first_name . ' ' . $customer_info->last_name . ' ' . $this->lang->line('reports_report')), - 'subtitle' => $subtitle, + 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), 'headers' => $headers, 'summary_data' => $summary_data, 'details_data' => $details_data, @@ -999,11 +732,6 @@ class Reports extends Secure_Controller $model = $this->Specific_employee; $headers = $this->xss_clean($model->getDataColumns()); - - /** - * Added by Jorge Colmenarez 2016-11-01 21:13 - * Support for send flag datetime filter - */ $datetime_filter = $this->config->item('filter_datetime_format'); $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'employee_id' => $employee_id, 'sale_type' => $sale_type, 'datetime_filter' => $datetime_filter)); @@ -1022,19 +750,9 @@ class Reports extends Secure_Controller $employee_info = $this->Employee->get_info($employee_id); - /** - * Added by Jorge Colmenarez 2016-11-01 21:06 - * Set subtitle with corresponsed format - */ - $subtitle =""; - if(empty($datetime_filter)) - $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); - else - $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); - $data = array( 'title' => $this->xss_clean($employee_info->first_name . ' ' . $employee_info->last_name . ' ' . $this->lang->line('reports_report')), - 'subtitle' => $subtitle, + 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), 'headers' => $headers, 'summary_data' => $summary_data, 'details_data' => $details_data, @@ -1067,11 +785,6 @@ class Reports extends Secure_Controller $model = $this->Specific_discount; $headers = $this->xss_clean($model->getDataColumns()); - - /** - * Added by Jorge Colmenarez 2016-11-01 21:17 - * Support for send flag datetime filter - */ $datetime_filter = $this->config->item('filter_datetime_format'); $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'discount' => $discount, 'sale_type' => $sale_type, 'datetime_filter' => $datetime_filter)); @@ -1088,19 +801,9 @@ class Reports extends Secure_Controller } } - /** - * Added by Jorge Colmenarez 2016-11-01 21:17 - * Set subtitle with corresponsed format - */ - $subtitle =""; - if(empty($datetime_filter)) - $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); - else - $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); - $data = array( 'title' => $discount . '% ' . $this->lang->line('reports_discount') . ' ' . $this->lang->line('reports_report'), - 'subtitle' => $subtitle, + 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), 'headers' => $headers, 'summary_data' => $summary_data, 'details_data' => $details_data, @@ -1144,11 +847,6 @@ class Reports extends Secure_Controller $model = $this->Detailed_sales; $headers = $this->xss_clean($model->getDataColumns()); - - /** - * Added by Jorge Colmenarez 2016-11-01 21:28 - * Support for send flag datetime filter - */ $datetime_filter = $this->config->item('filter_datetime_format'); $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); @@ -1188,19 +886,9 @@ class Reports extends Secure_Controller } } - /** - * Added by Jorge Colmenarez 2016-11-01 21:28 - * Set subtitle with corresponsed format - */ - $subtitle =""; - if(empty($datetime_filter)) - $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); - else - $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); - $data = array( 'title' => $this->lang->line('reports_detailed_sales_report'), - 'subtitle' => $subtitle, + 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), 'headers' => $headers, 'editable' => 'sales', 'summary_data' => $summary_data, @@ -1242,11 +930,6 @@ class Reports extends Secure_Controller $model = $this->Detailed_receivings; $headers = $this->xss_clean($model->getDataColumns()); - - /** - * Added by Jorge Colmenarez 2016-11-01 21:32 - * Support for send flag datetime filter - */ $datetime_filter = $this->config->item('filter_datetime_format'); $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'receiving_type' => $receiving_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); @@ -1283,19 +966,9 @@ class Reports extends Secure_Controller } } - /** - * Added by Jorge Colmenarez 2016-11-01 21:32 - * Set subtitle with corresponsed format - */ - $subtitle =""; - if(empty($datetime_filter)) - $subtitle = date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)); - else - $subtitle = date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $start_date))) . '-' . date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $end_date))); - $data = array( 'title' => $this->lang->line('reports_detailed_receivings_report'), - 'subtitle' => $subtitle, + 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), 'headers' => $headers, 'editable' => 'receivings', 'summary_data' => $summary_data, @@ -1381,5 +1054,18 @@ class Reports extends Secure_Controller $this->load->view('reports/tabular', $data); } + // Returns subtitle for the reports + private function _get_subtitle_report($value,$datetime_filter){ + $subtitle =""; + if(empty($datetime_filter)) + for($i = 0; $i < count($value); $i++) + $subtitle .= date($this->config->item('dateformat'), strtotime($value[$i])) . ' - '; + else + for($i = 0; $i < count($value); $i++) + $subtitle .= date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $value[$i]))) . ' - '; + $subtitle = substr($subtitle,0,-2); + + return $subtitle; + } } ?> \ No newline at end of file diff --git a/application/controllers/Sales.php b/application/controllers/Sales.php index df807093d..db8b1a27a 100644 --- a/application/controllers/Sales.php +++ b/application/controllers/Sales.php @@ -78,10 +78,7 @@ class Sales extends Secure_Controller // check if any filter is set in the multiselect dropdown $filledup = array_fill_keys($this->input->get('filters'), TRUE); $filters = array_merge($filters, $filledup); - /** - * Added by Jorge Colmenarez 2016-11-01 14:22 - * Support for send flag datetime filter - */ + $datetime_filter = $this->config->item('filter_datetime_format'); // Modify function search to add parameter datetime filter $sales = $this->Sale->search($search, $filters, $limit, $offset, $sort, $order,$datetime_filter); diff --git a/application/language/en/config_lang.php b/application/language/en/config_lang.php index c6feba41a..d29bbba2f 100644 --- a/application/language/en/config_lang.php +++ b/application/language/en/config_lang.php @@ -182,8 +182,4 @@ $lang["config_number_locale_required"] = "Number Locale is a required field"; $lang["config_number_locale_invalid"] = "The entered locale is invalid. Check the link in the tooltip to find a sensible value"; $lang["config_number_locale_tooltip"] = "Find a suitable locale through this link"; $lang["config_theme"] = "Theme"; -/** -* Added by Jorge Colmenarez 2016-10-31 16:30 -* Support for DateTime Reports Filter -*/ $lang["config_filter_datetime_format"] = "Filter with date/time format in reports"; diff --git a/application/language/es/config_lang.php b/application/language/es/config_lang.php index a7c8e8aae..783a847a0 100644 --- a/application/language/es/config_lang.php +++ b/application/language/es/config_lang.php @@ -181,9 +181,4 @@ $lang["config_return_policy_required"] = "Política de Devolución es requerida" $lang["config_number_locale_required"] = "Numero local es un campo requerido"; $lang["config_number_locale_invalid"] = "El local ingresado es invalido. Revisa el link en el tooltip para encontrar informacion"; $lang["config_number_locale_tooltip"] = "Encontrar un local adecuado en esta liga"; -$lang["config_theme"] = "Tema"; -/** -* Added by Jorge Colmenarez 2016-10-31 16:34 -* Support for DateTime Reports Filter -*/ -$lang["config_filter_datetime_format"] = "Filtrar con formato de fecha/hora en los informes"; \ No newline at end of file +$lang["config_theme"] = "Tema"; \ No newline at end of file diff --git a/application/models/Receiving.php b/application/models/Receiving.php index 471464950..ec185109f 100644 --- a/application/models/Receiving.php +++ b/application/models/Receiving.php @@ -205,8 +205,6 @@ class Receiving extends CI_Model */ public function create_temp_table() { - // Modify by Jorge Colmenarez 2016-11-01 21:45 - // Add Index receiving_time $this->db->query('CREATE TEMPORARY TABLE IF NOT EXISTS ' . $this->db->dbprefix('receivings_items_temp') . ' (INDEX(receiving_date), INDEX(receiving_time), INDEX(receiving_id)) ( diff --git a/application/models/Sale.php b/application/models/Sale.php index 03d14709b..1d7b42466 100644 --- a/application/models/Sale.php +++ b/application/models/Sale.php @@ -34,13 +34,12 @@ class Sale extends CI_Model sale_payment_amount AS amount_tendered, SUM(total) AS amount_due, (sale_payment_amount - SUM(total)) AS change_due, payment_type, invoice_number'); $this->db->from('sales_items_temp'); - // Modify by Jorge Colmenarez 2016-11-01 14:25 - // Set DateTime filter field + if(empty($datetime_filter)) $this->db->where('sale_date BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date'])); else $this->db->where('sale_time BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date'])); - // End Jorge Colmenarez + if(!empty($search)) { if($filters['is_valid_receipt'] != FALSE) @@ -563,8 +562,7 @@ class Sale extends CI_Model GROUP BY sale_id )' ); - // Modify by Jorge Colmenarez 2016-11-01 14:29 - // Add Index sale_time + $this->db->query('CREATE TEMPORARY TABLE IF NOT EXISTS ' . $this->db->dbprefix('sales_items_temp') . ' (INDEX(sale_date), INDEX(sale_time), INDEX(sale_id)) ( diff --git a/application/models/reports/Detailed_receivings.php b/application/models/reports/Detailed_receivings.php index 518e483b0..9481bff91 100644 --- a/application/models/reports/Detailed_receivings.php +++ b/application/models/reports/Detailed_receivings.php @@ -53,8 +53,7 @@ class Detailed_receivings extends Report $this->db->from('receivings_items_temp'); $this->db->join('people AS employee', 'receivings_items_temp.employee_id = employee.person_id'); $this->db->join('suppliers AS supplier', 'receivings_items_temp.supplier_id = supplier.person_id', 'left'); - // Modify by Jorge Colmenarez 2016-11-01 21:47 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("receiving_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else @@ -100,8 +99,7 @@ class Detailed_receivings extends Report { $this->db->select('SUM(total) AS total'); $this->db->from('receivings_items_temp'); - // Modify by Jorge Colmenarez 2016-11-01 21:47 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("receiving_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else diff --git a/application/models/reports/Detailed_sales.php b/application/models/reports/Detailed_sales.php index 39cf15fb9..5c717aef8 100644 --- a/application/models/reports/Detailed_sales.php +++ b/application/models/reports/Detailed_sales.php @@ -55,8 +55,7 @@ class Detailed_sales extends Report { $this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, employee_name, customer_name, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment'); $this->db->from('sales_items_temp'); - // Modify by Jorge Colmenarez 2016-11-01 21:29 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else @@ -98,8 +97,7 @@ class Detailed_sales extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - // Modify by Jorge Colmenarez 2016-11-01 21:29 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else diff --git a/application/models/reports/Specific_customer.php b/application/models/reports/Specific_customer.php index 50eec443b..3d9df04cd 100644 --- a/application/models/reports/Specific_customer.php +++ b/application/models/reports/Specific_customer.php @@ -21,13 +21,12 @@ class Specific_customer extends Report { $this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, employee_name, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment'); $this->db->from('sales_items_temp'); - // Modify by Jorge Colmenarez 2016-11-01 21:05 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); - // Support for filter by Specific Customer + $this->db->where("customer_id = ".$inputs['customer_id']); if ($inputs['sale_type'] == 'sales') @@ -61,13 +60,12 @@ class Specific_customer extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - // Modify by Jorge Colmenarez 2016-11-01 21:05 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); - // Support for filter by Specific Customer + $this->db->where("customer_id = ".$inputs['customer_id']); if ($inputs['sale_type'] == 'sales') diff --git a/application/models/reports/Specific_discount.php b/application/models/reports/Specific_discount.php index d76560f07..00f4f777c 100755 --- a/application/models/reports/Specific_discount.php +++ b/application/models/reports/Specific_discount.php @@ -21,13 +21,12 @@ class Specific_discount extends Report { $this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, customer_name, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment'); $this->db->from('sales_items_temp'); - // Modify by Jorge Colmenarez 2016-11-01 21:05 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); - // Support for filter by Specific Discount + $this->db->where('discount_percent = '.$inputs['discount']); if ($inputs['sale_type'] == 'sales') diff --git a/application/models/reports/Specific_employee.php b/application/models/reports/Specific_employee.php index 8fc0d75bd..50ef7be24 100644 --- a/application/models/reports/Specific_employee.php +++ b/application/models/reports/Specific_employee.php @@ -21,13 +21,12 @@ class Specific_employee extends Report { $this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, customer_name, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment'); $this->db->from('sales_items_temp'); - // Modify by Jorge Colmenarez 2016-11-01 21:05 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); - // Support by filter Specific Employee + $this->db->where("employee_id = ".$inputs['employee_id']); if ($inputs['sale_type'] == 'sales') @@ -61,13 +60,12 @@ class Specific_employee extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - // Modify by Jorge Colmenarez 2016-11-01 21:05 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); - // Support by filter Specific Employee + $this->db->where("employee_id = ".$inputs['employee_id']); if ($inputs['sale_type'] == 'sales') diff --git a/application/models/reports/Summary_categories.php b/application/models/reports/Summary_categories.php index 265f45a16..ba5e4150f 100644 --- a/application/models/reports/Summary_categories.php +++ b/application/models/reports/Summary_categories.php @@ -19,8 +19,7 @@ class Summary_categories extends Report { $this->db->select('category, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - // Modify by Jorge Colmenarez 2016-11-01 16:47 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else @@ -49,8 +48,7 @@ class Summary_categories extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - // Modify by Jorge Colmenarez 2016-11-01 16:47 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else diff --git a/application/models/reports/Summary_customers.php b/application/models/reports/Summary_customers.php index 8cf646e50..6464de1bd 100644 --- a/application/models/reports/Summary_customers.php +++ b/application/models/reports/Summary_customers.php @@ -19,8 +19,7 @@ class Summary_customers extends Report { $this->db->select('customer_name AS customer, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - // Modify by Jorge Colmenarez 2016-11-01 20:15 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else @@ -50,8 +49,7 @@ class Summary_customers extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - // Modify by Jorge Colmenarez 2016-11-01 20:15 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else diff --git a/application/models/reports/Summary_discounts.php b/application/models/reports/Summary_discounts.php index b3356f54c..433a4032f 100644 --- a/application/models/reports/Summary_discounts.php +++ b/application/models/reports/Summary_discounts.php @@ -19,8 +19,7 @@ class Summary_discounts extends Report { $this->db->select('CONCAT(discount_percent, "%") AS discount_percent, count(*) AS count'); $this->db->from('sales_items_temp'); - // Modify by Jorge Colmenarez 2016-11-01 20:45 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else @@ -52,8 +51,7 @@ class Summary_discounts extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - // Modify by Jorge Colmenarez 2016-11-01 20:45 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else diff --git a/application/models/reports/Summary_employees.php b/application/models/reports/Summary_employees.php index b6e73b56a..a182a5c67 100644 --- a/application/models/reports/Summary_employees.php +++ b/application/models/reports/Summary_employees.php @@ -19,8 +19,7 @@ class Summary_employees extends Report { $this->db->select('employee_name AS employee, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - // Modify by Jorge Colmenarez 2016-11-01 20:26 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else @@ -50,8 +49,7 @@ class Summary_employees extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - // Modify by Jorge Colmenarez 2016-11-01 20:26 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else diff --git a/application/models/reports/Summary_items.php b/application/models/reports/Summary_items.php index 9d38aae69..86a922a67 100644 --- a/application/models/reports/Summary_items.php +++ b/application/models/reports/Summary_items.php @@ -19,8 +19,7 @@ class Summary_items extends Report { $this->db->select('name, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - // Modify by Jorge Colmenarez 2016-11-01 20:23 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else @@ -50,8 +49,7 @@ class Summary_items extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - // Modify by Jorge Colmenarez 2016-11-01 20:23 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else diff --git a/application/models/reports/Summary_payments.php b/application/models/reports/Summary_payments.php index 25639b3b7..24c8e6a7c 100644 --- a/application/models/reports/Summary_payments.php +++ b/application/models/reports/Summary_payments.php @@ -20,8 +20,7 @@ class Summary_payments extends Report $this->db->select('sales_payments.payment_type, count(*) AS count, SUM(payment_amount) AS payment_amount'); $this->db->from('sales_payments'); $this->db->join('sales', 'sales.sale_id=sales_payments.sale_id'); - // Modify by Jorge Colmenarez 2016-11-01 20:49 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("date(sale_time) BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else @@ -72,8 +71,7 @@ class Summary_payments extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - // Modify by Jorge Colmenarez 2016-11-01 20:49 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else diff --git a/application/models/reports/Summary_sales.php b/application/models/reports/Summary_sales.php index 1178c75d4..fe8dfdd4b 100644 --- a/application/models/reports/Summary_sales.php +++ b/application/models/reports/Summary_sales.php @@ -19,8 +19,7 @@ class Summary_sales extends Report { $this->db->select('sale_date, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - // Modify by Jorge Colmenarez 2016-11-01 19:01 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else @@ -50,8 +49,7 @@ class Summary_sales extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - // Modify by Jorge Colmenarez 2016-11-01 19:01 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else diff --git a/application/models/reports/Summary_suppliers.php b/application/models/reports/Summary_suppliers.php index 3d2693e1e..7400cbf12 100644 --- a/application/models/reports/Summary_suppliers.php +++ b/application/models/reports/Summary_suppliers.php @@ -21,8 +21,7 @@ class Summary_suppliers extends Report $this->db->from('sales_items_temp'); $this->db->join('suppliers', 'suppliers.person_id = sales_items_temp.supplier_id'); $this->db->join('people', 'suppliers.person_id = people.person_id'); - // Modify by Jorge Colmenarez 2016-11-01 20:18 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else @@ -54,8 +53,7 @@ class Summary_suppliers extends Report $this->db->from('sales_items_temp'); $this->db->join('suppliers', 'suppliers.person_id = sales_items_temp.supplier_id'); $this->db->join('people', 'suppliers.person_id = people.person_id'); - // Modify by Jorge Colmenarez 2016-11-01 20:18 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else diff --git a/application/models/reports/Summary_taxes.php b/application/models/reports/Summary_taxes.php index e8f733f85..320799425 100644 --- a/application/models/reports/Summary_taxes.php +++ b/application/models/reports/Summary_taxes.php @@ -47,8 +47,6 @@ class Summary_taxes extends Report $decimals = totals_decimals(); - // Modify by Jorge Colmenarez 2016-11-01 20:31 - // Set WHERE Clause with support for DateTime filter field $clauseWhere = ""; if(empty($inputs['datetime_filter'])) $clauseWhere = "WHERE date(sale_time) BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']); @@ -78,8 +76,7 @@ class Summary_taxes extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - // Modify by Jorge Colmenarez 2016-11-01 20:32 - // Set DateTime filter field + if(empty($inputs['datetime_filter'])) $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); else diff --git a/application/views/configs/locale_config.php b/application/views/configs/locale_config.php index e2504c703..f83e85411 100644 --- a/application/views/configs/locale_config.php +++ b/application/views/configs/locale_config.php @@ -261,7 +261,7 @@ ?> - +
lang->line('config_filter_datetime_format'), 'filter_datetime_format', array('class' => 'control-label col-xs-2')); ?>
@@ -272,7 +272,6 @@ 'checked'=>$this->config->item('filter_datetime_format'))); ?>
- 'submit_form', diff --git a/application/views/partial/daterangepicker.php b/application/views/partial/daterangepicker.php index fa2597e2b..642ffffcf 100644 --- a/application/views/partial/daterangepicker.php +++ b/application/views/partial/daterangepicker.php @@ -1,10 +1,5 @@ -lang->load("calendar"); $this->lang->load("date"); ?> +lang->load("calendar"); $this->lang->load("date"); -/** -* Added By Jorge Colmenarez 2016-11-01 8:52 -* Support for Set Dinamyc DateTime Filter into Object daterangepicker -*/ -config->item('filter_datetime_format'))){ ?> var start_date = ""; diff --git a/database/database.sql b/database/database.sql index 0dfc5dbaf..644741442 100644 --- a/database/database.sql +++ b/database/database.sql @@ -82,7 +82,8 @@ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES ('theme', 'flatly'), ('statistics', '1'), ('language', 'english'), -('language_code', 'en'); +('language_code', 'en'), +('filter_datetime_format',''); -- -------------------------------------------------------- diff --git a/public/license/LICENSE b/public/license/LICENSE index 9eb29b09e..4f37e2cea 100644 --- a/public/license/LICENSE +++ b/public/license/LICENSE @@ -10,6 +10,7 @@ Copyright (c) 2015-2016 FrancescoUK (aka daN4cat) Copyright (c) 2015 Aamir Shahzad (aka asakpke), RoshanTech.com Copyright (c) 2015 Toni Haryanto (aka yllumi) Copyright (c) 2016 Ramkrishna Mondal (aka RamkrishnaMondal) +Copyright (c) 2016 Jorge Colmenarez Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in From 88219b6aa03583d68a85c2ead11156cf79b0d0ce Mon Sep 17 00:00:00 2001 From: Jorge Colmenarez Date: Sun, 6 Nov 2016 21:18:26 -0400 Subject: [PATCH 03/63] Add Support for filter datetime records into Models Items and modify width of input daterangepicker --- application/controllers/Items.php | 4 +++- application/models/Item.php | 8 +++++--- application/views/partial/daterangepicker.php | 2 ++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/application/controllers/Items.php b/application/controllers/Items.php index 7b0b21ba7..06b8a1e57 100644 --- a/application/controllers/Items.php +++ b/application/controllers/Items.php @@ -56,7 +56,9 @@ class Items extends Secure_Controller $filledup = array_fill_keys($this->input->get('filters'), TRUE); $filters = array_merge($filters, $filledup); - $items = $this->Item->search($search, $filters, $limit, $offset, $sort, $order); + $datetime_filter = $this->config->item('filter_datetime_format'); + // Modify function search to add parameter datetime filter + $items = $this->Item->search($search, $filters, $limit, $offset, $sort, $order, $datetime_filter); $total_rows = $this->Item->get_found_rows($search, $filters); $data_rows = array(); diff --git a/application/models/Item.php b/application/models/Item.php index f726ca13d..cab102aa3 100644 --- a/application/models/Item.php +++ b/application/models/Item.php @@ -53,7 +53,7 @@ class Item extends CI_Model /* Perform a search on items */ - public function search($search, $filters, $rows = 0, $limit_from = 0, $sort = 'items.name', $order = 'asc') + public function search($search, $filters, $rows = 0, $limit_from = 0, $sort = 'items.name', $order = 'asc', $datetime_filter = '') { $this->db->from('items'); $this->db->join('suppliers', 'suppliers.person_id = items.supplier_id', 'left'); @@ -64,8 +64,10 @@ class Item extends CI_Model $this->db->join('item_quantities', 'item_quantities.item_id = items.item_id'); $this->db->where('location_id', $filters['stock_location_id']); } - - $this->db->where('DATE_FORMAT(trans_date, "%Y-%m-%d") BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date'])); + if(empty($datetime_filter)) + $this->db->where('DATE_FORMAT(trans_date, "%Y-%m-%d") BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date'])); + else + $this->db->where('trans_date BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date'])); if(!empty($search)) { diff --git a/application/views/partial/daterangepicker.php b/application/views/partial/daterangepicker.php index 642ffffcf..b3c94f046 100644 --- a/application/views/partial/daterangepicker.php +++ b/application/views/partial/daterangepicker.php @@ -2,6 +2,7 @@ if(empty($this->config->item('filter_datetime_format'))){ ?> +$('#daterangepicker').css("width","200"); var start_date = ""; var end_date = ""; @@ -103,6 +104,7 @@ $('#daterangepicker').daterangepicker({ } else{ ?> +$('#daterangepicker').css("width","300"); var start_date = ""; var end_date = ""; From 88db2af11b19fefdd1d01cf409972305329483ab Mon Sep 17 00:00:00 2001 From: Jorge Colmenarez Date: Fri, 18 Nov 2016 12:19:42 -0400 Subject: [PATCH 04/63] Revert "Feature/datetime reports" --- LICENSE | 1 - application/controllers/Config.php | 3 +- application/controllers/Items.php | 4 +- application/controllers/Login.php | 1 - application/controllers/Reports.php | 194 +++++++----------- application/controllers/Sales.php | 6 +- application/language/en/config_lang.php | 1 - application/language/es/config_lang.php | 2 +- application/models/Item.php | 8 +- application/models/Receiving.php | 2 +- application/models/Sale.php | 11 +- .../models/reports/Detailed_receivings.php | 12 +- application/models/reports/Detailed_sales.php | 12 +- .../models/reports/Specific_customer.php | 16 +- .../models/reports/Specific_discount.php | 19 +- .../models/reports/Specific_employee.php | 18 +- .../models/reports/Summary_categories.php | 13 +- .../models/reports/Summary_customers.php | 12 +- .../models/reports/Summary_discounts.php | 15 +- .../models/reports/Summary_employees.php | 12 +- application/models/reports/Summary_items.php | 12 +- .../models/reports/Summary_payments.php | 12 +- application/models/reports/Summary_sales.php | 12 +- .../models/reports/Summary_suppliers.php | 12 +- application/models/reports/Summary_taxes.php | 16 +- application/views/configs/locale_config.php | 11 - application/views/partial/daterangepicker.php | 174 +++------------- application/views/reports/date_input.php | 2 +- database/database.sql | 3 +- public/license/LICENSE | 1 - 30 files changed, 156 insertions(+), 461 deletions(-) diff --git a/LICENSE b/LICENSE index 4f37e2cea..9eb29b09e 100644 --- a/LICENSE +++ b/LICENSE @@ -10,7 +10,6 @@ Copyright (c) 2015-2016 FrancescoUK (aka daN4cat) Copyright (c) 2015 Aamir Shahzad (aka asakpke), RoshanTech.com Copyright (c) 2015 Toni Haryanto (aka yllumi) Copyright (c) 2016 Ramkrishna Mondal (aka RamkrishnaMondal) -Copyright (c) 2016 Jorge Colmenarez Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/application/controllers/Config.php b/application/controllers/Config.php index b958fc04c..9df7fcb0c 100644 --- a/application/controllers/Config.php +++ b/application/controllers/Config.php @@ -302,8 +302,7 @@ class Config extends Secure_Controller 'tax_decimals' => $this->input->post('tax_decimals'), 'quantity_decimals' => $this->input->post('quantity_decimals'), 'country_codes' => $this->input->post('country_codes'), - 'payment_options_order' => $this->input->post('payment_options_order'), - 'filter_datetime_format' => $this->input->post('filter_datetime_format') + 'payment_options_order' => $this->input->post('payment_options_order') ); $result = $this->Appconfig->batch_save($batch_save_data); diff --git a/application/controllers/Items.php b/application/controllers/Items.php index 8f02aabfe..e31954b32 100644 --- a/application/controllers/Items.php +++ b/application/controllers/Items.php @@ -56,9 +56,7 @@ class Items extends Secure_Controller $filledup = array_fill_keys($this->input->get('filters'), TRUE); $filters = array_merge($filters, $filledup); - $datetime_filter = $this->config->item('filter_datetime_format'); - // Modify function search to add parameter datetime filter - $items = $this->Item->search($search, $filters, $limit, $offset, $sort, $order, $datetime_filter); + $items = $this->Item->search($search, $filters, $limit, $offset, $sort, $order); $total_rows = $this->Item->get_found_rows($search, $filters); $data_rows = array(); diff --git a/application/controllers/Login.php b/application/controllers/Login.php index 8eabd84ab..cdf5f928b 100644 --- a/application/controllers/Login.php +++ b/application/controllers/Login.php @@ -40,7 +40,6 @@ class Login extends CI_Controller $this->tracking_lib->track_event('Stats', 'Tax Decimals', $this->config->item('tax_decimals')); $this->tracking_lib->track_event('Stats', 'Quantity Decimals', $this->config->item('quantity_decimals')); $this->tracking_lib->track_event('Stats', 'Invoice Enable', $this->config->item('invoice_enable')); - $this->tracking_lib->track_event('Stats', 'Filter DateTime Format', $this->config->item('filter_datetime_format')); } redirect('home'); diff --git a/application/controllers/Reports.php b/application/controllers/Reports.php index 51c557815..7848280da 100644 --- a/application/controllers/Reports.php +++ b/application/controllers/Reports.php @@ -43,8 +43,7 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_sales'); $model = $this->Summary_sales; - $datetime_filter = $this->config->item('filter_datetime_format'); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); $tabular_data = array(); foreach($report_data as $row) @@ -61,10 +60,10 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_sales_summary_report'), - 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), + 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, - 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) + 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))) ); $this->load->view('reports/tabular', $data); @@ -76,8 +75,7 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_categories'); $model = $this->Summary_categories; - $datetime_filter = $this->config->item('filter_datetime_format'); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); $tabular_data = array(); foreach($report_data as $row) @@ -94,10 +92,10 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_categories_summary_report'), - 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), + 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, - 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) + 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))) ); $this->load->view('reports/tabular', $data); @@ -109,8 +107,7 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_customers'); $model = $this->Summary_customers; - $datetime_filter = $this->config->item('filter_datetime_format'); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); $tabular_data = array(); foreach($report_data as $row) @@ -127,10 +124,10 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_customers_summary_report'), - 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), + 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, - 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) + 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))) ); $this->load->view('reports/tabular', $data); @@ -142,8 +139,7 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_suppliers'); $model = $this->Summary_suppliers; - $datetime_filter = $this->config->item('filter_datetime_format'); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); $tabular_data = array(); foreach($report_data as $row) @@ -160,10 +156,10 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_suppliers_summary_report'), - 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), + 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, - 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) + 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))) ); $this->load->view('reports/tabular', $data); @@ -175,8 +171,7 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_items'); $model = $this->Summary_items; - $datetime_filter = $this->config->item('filter_datetime_format'); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); $tabular_data = array(); foreach($report_data as $row) @@ -193,10 +188,10 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_items_summary_report'), - 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), + 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, - 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) + 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))) ); $this->load->view('reports/tabular', $data); @@ -208,8 +203,7 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_employees'); $model = $this->Summary_employees; - $datetime_filter = $this->config->item('filter_datetime_format'); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); $tabular_data = array(); foreach($report_data as $row) @@ -226,10 +220,10 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_employees_summary_report'), - 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), + 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, - 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) + 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))) ); $this->load->view('reports/tabular', $data); @@ -241,8 +235,7 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_taxes'); $model = $this->Summary_taxes; - $datetime_filter = $this->config->item('filter_datetime_format'); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); $tabular_data = array(); foreach($report_data as $row) @@ -257,10 +250,10 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_taxes_summary_report'), - 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), + 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, - 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) + 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))) ); $this->load->view('reports/tabular', $data); @@ -272,8 +265,7 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_discounts'); $model = $this->Summary_discounts; - $datetime_filter = $this->config->item('filter_datetime_format'); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); $tabular_data = array(); foreach($report_data as $row) @@ -285,10 +277,10 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_discounts_summary_report'), - 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), + 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, - 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) + 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))) ); $this->load->view('reports/tabular', $data); @@ -300,8 +292,7 @@ class Reports extends Secure_Controller $this->load->model('reports/Summary_payments'); $model = $this->Summary_payments; - $datetime_filter = $this->config->item('filter_datetime_format'); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); $tabular_data = array(); foreach($report_data as $row) @@ -314,10 +305,10 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_payments_summary_report'), - 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), + 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, - 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) + 'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))) ); $this->load->view('reports/tabular', $data); @@ -363,9 +354,8 @@ class Reports extends Secure_Controller { $this->load->model('reports/Summary_sales'); $model = $this->Summary_sales; - - $datetime_filter = $this->config->item('filter_datetime_format'); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); + + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); $labels = array(); $series = array(); @@ -380,11 +370,11 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_sales_summary_report'), - 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), + 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), 'chart_type' => 'reports/graphs/line', 'labels_1' => $labels, 'series_data_1' => $series, - 'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))), + 'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))), 'yaxis_title' => $this->lang->line('reports_revenue'), 'xaxis_title' => $this->lang->line('reports_date'), 'show_currency' => TRUE @@ -398,9 +388,8 @@ class Reports extends Secure_Controller { $this->load->model('reports/Summary_items'); $model = $this->Summary_items; - - $datetime_filter = $this->config->item('filter_datetime_format'); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); + + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); $labels = array(); $series = array(); @@ -414,11 +403,11 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_items_summary_report'), - 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), + 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), 'chart_type' => 'reports/graphs/hbar', 'labels_1' => $labels, 'series_data_1' => $series, - 'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))), + 'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))), 'yaxis_title' => $this->lang->line('reports_items'), 'xaxis_title' => $this->lang->line('reports_revenue'), 'show_currency' => TRUE @@ -432,10 +421,9 @@ class Reports extends Secure_Controller { $this->load->model('reports/Summary_categories'); $model = $this->Summary_categories; - - $datetime_filter = $this->config->item('filter_datetime_format'); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); - $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))); + + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); + $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))); $labels = array(); $series = array(); @@ -449,7 +437,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_categories_summary_report'), - 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), + 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), 'chart_type' => 'reports/graphs/pie', 'labels_1' => $labels, 'series_data_1' => $series, @@ -465,10 +453,9 @@ class Reports extends Secure_Controller { $this->load->model('reports/Summary_suppliers'); $model = $this->Summary_suppliers; - - $datetime_filter = $this->config->item('filter_datetime_format'); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); - $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))); + + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); + $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))); $labels = array(); $series = array(); @@ -482,7 +469,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_suppliers_summary_report'), - 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), + 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), 'chart_type' => 'reports/graphs/pie', 'labels_1' => $labels, 'series_data_1' => $series, @@ -498,10 +485,9 @@ class Reports extends Secure_Controller { $this->load->model('reports/Summary_employees'); $model = $this->Summary_employees; - - $datetime_filter = $this->config->item('filter_datetime_format'); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); - $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))); + + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); + $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))); $labels = array(); $series = array(); @@ -515,7 +501,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_employees_summary_report'), - 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), + 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), 'chart_type' => 'reports/graphs/pie', 'labels_1' => $labels, 'series_data_1' => $series, @@ -531,10 +517,9 @@ class Reports extends Secure_Controller { $this->load->model('reports/Summary_taxes'); $model = $this->Summary_taxes; - - $datetime_filter = $this->config->item('filter_datetime_format'); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); - $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))); + + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); + $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))); $labels = array(); $series = array(); @@ -548,7 +533,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_taxes_summary_report'), - 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), + 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), 'chart_type' => 'reports/graphs/pie', 'labels_1' => $labels, 'series_data_1' => $series, @@ -564,9 +549,8 @@ class Reports extends Secure_Controller { $this->load->model('reports/Summary_customers'); $model = $this->Summary_customers; - - $datetime_filter = $this->config->item('filter_datetime_format'); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); + + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); $labels = array(); $series = array(); @@ -580,11 +564,11 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_customers_summary_report'), - 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), + 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), 'chart_type' => 'reports/graphs/hbar', 'labels_1' => $labels, 'series_data_1' => $series, - 'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))), + 'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))), 'yaxis_title' => $this->lang->line('reports_customers'), 'xaxis_title' => $this->lang->line('reports_revenue'), 'show_currency' => TRUE @@ -598,9 +582,8 @@ class Reports extends Secure_Controller { $this->load->model('reports/Summary_discounts'); $model = $this->Summary_discounts; - - $datetime_filter = $this->config->item('filter_datetime_format'); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); + + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); $labels = array(); $series = array(); @@ -614,11 +597,11 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_discounts_summary_report'), - 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), + 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), 'chart_type' => 'reports/graphs/bar', 'labels_1' => $labels, 'series_data_1' => $series, - 'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))), + 'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))), 'yaxis_title' => $this->lang->line('reports_count'), 'xaxis_title' => $this->lang->line('reports_discount_percent'), 'show_currency' => FALSE @@ -632,10 +615,9 @@ class Reports extends Secure_Controller { $this->load->model('reports/Summary_payments'); $model = $this->Summary_payments; - - $datetime_filter = $this->config->item('filter_datetime_format'); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); - $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))); + + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); + $summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))); $labels = array(); $series = array(); @@ -649,7 +631,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_payments_summary_report'), - 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), + 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), 'chart_type' => 'reports/graphs/pie', 'labels_1' => $labels, 'series_data_1' => $series, @@ -681,8 +663,7 @@ class Reports extends Secure_Controller $model = $this->Specific_customer; $headers = $this->xss_clean($model->getDataColumns()); - $datetime_filter = $this->config->item('filter_datetime_format'); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'customer_id' => $customer_id, 'sale_type' => $sale_type, 'datetime_filter' => $datetime_filter)); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'customer_id' => $customer_id, 'sale_type' => $sale_type)); $summary_data = array(); $details_data = array(); @@ -698,14 +679,13 @@ class Reports extends Secure_Controller } $customer_info = $this->Customer->get_info($customer_id); - $data = array( 'title' => $this->xss_clean($customer_info->first_name . ' ' . $customer_info->last_name . ' ' . $this->lang->line('reports_report')), - 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), + 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), 'headers' => $headers, 'summary_data' => $summary_data, 'details_data' => $details_data, - 'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'customer_id' => $customer_id, 'sale_type' => $sale_type, 'datetime_filter' => $datetime_filter))) + 'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'customer_id' => $customer_id, 'sale_type' => $sale_type))) ); $this->load->view('reports/tabular_details', $data); @@ -732,8 +712,7 @@ class Reports extends Secure_Controller $model = $this->Specific_employee; $headers = $this->xss_clean($model->getDataColumns()); - $datetime_filter = $this->config->item('filter_datetime_format'); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'employee_id' => $employee_id, 'sale_type' => $sale_type, 'datetime_filter' => $datetime_filter)); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'employee_id' => $employee_id, 'sale_type' => $sale_type)); $summary_data = array(); $details_data = array(); @@ -749,14 +728,13 @@ class Reports extends Secure_Controller } $employee_info = $this->Employee->get_info($employee_id); - $data = array( 'title' => $this->xss_clean($employee_info->first_name . ' ' . $employee_info->last_name . ' ' . $this->lang->line('reports_report')), - 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), + 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), 'headers' => $headers, 'summary_data' => $summary_data, 'details_data' => $details_data, - 'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date,'employee_id' => $employee_id, 'sale_type' => $sale_type, 'datetime_filter' => $datetime_filter))) + 'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date,'employee_id' => $employee_id, 'sale_type' => $sale_type))) ); $this->load->view('reports/tabular_details', $data); @@ -785,8 +763,7 @@ class Reports extends Secure_Controller $model = $this->Specific_discount; $headers = $this->xss_clean($model->getDataColumns()); - $datetime_filter = $this->config->item('filter_datetime_format'); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'discount' => $discount, 'sale_type' => $sale_type, 'datetime_filter' => $datetime_filter)); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'discount' => $discount, 'sale_type' => $sale_type)); $summary_data = array(); $details_data = array(); @@ -803,11 +780,11 @@ class Reports extends Secure_Controller $data = array( 'title' => $discount . '% ' . $this->lang->line('reports_discount') . ' ' . $this->lang->line('reports_report'), - 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), + 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), 'headers' => $headers, 'summary_data' => $summary_data, 'details_data' => $details_data, - 'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date,'discount' => $discount, 'sale_type' => $sale_type, 'datetime_filter' => $datetime_filter))) + 'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date,'discount' => $discount, 'sale_type' => $sale_type))) ); $this->load->view('reports/tabular_details', $data); @@ -847,8 +824,7 @@ class Reports extends Secure_Controller $model = $this->Detailed_sales; $headers = $this->xss_clean($model->getDataColumns()); - $datetime_filter = $this->config->item('filter_datetime_format'); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)); $summary_data = array(); $details_data = array(); @@ -888,12 +864,12 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_detailed_sales_report'), - 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), + 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), 'headers' => $headers, 'editable' => 'sales', 'summary_data' => $summary_data, 'details_data' => $details_data, - 'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) + 'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))) ); $this->load->view('reports/tabular_details', $data); @@ -930,8 +906,7 @@ class Reports extends Secure_Controller $model = $this->Detailed_receivings; $headers = $this->xss_clean($model->getDataColumns()); - $datetime_filter = $this->config->item('filter_datetime_format'); - $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'receiving_type' => $receiving_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)); + $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'receiving_type' => $receiving_type, 'location_id' => $location_id)); $summary_data = array(); $details_data = array(); @@ -968,12 +943,12 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_detailed_receivings_report'), - 'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter), + 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), 'headers' => $headers, 'editable' => 'receivings', 'summary_data' => $summary_data, 'details_data' => $details_data, - 'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'receiving_type' => $receiving_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))) + 'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'receiving_type' => $receiving_type, 'location_id' => $location_id))) ); $this->load->view('reports/tabular_details', $data); @@ -1054,18 +1029,5 @@ class Reports extends Secure_Controller $this->load->view('reports/tabular', $data); } - // Returns subtitle for the reports - private function _get_subtitle_report($value,$datetime_filter){ - $subtitle =""; - if(empty($datetime_filter)) - for($i = 0; $i < count($value); $i++) - $subtitle .= date($this->config->item('dateformat'), strtotime($value[$i])) . ' - '; - else - for($i = 0; $i < count($value); $i++) - $subtitle .= date($this->config->item('dateformat')." ".$this->config->item('timeformat'), strtotime(str_replace("%20", " ", $value[$i]))) . ' - '; - $subtitle = substr($subtitle,0,-2); - - return $subtitle; - } } ?> \ No newline at end of file diff --git a/application/controllers/Sales.php b/application/controllers/Sales.php index 20defe553..514ba99ce 100644 --- a/application/controllers/Sales.php +++ b/application/controllers/Sales.php @@ -78,10 +78,8 @@ class Sales extends Secure_Controller // check if any filter is set in the multiselect dropdown $filledup = array_fill_keys($this->input->get('filters'), TRUE); $filters = array_merge($filters, $filledup); - - $datetime_filter = $this->config->item('filter_datetime_format'); - // Modify function search to add parameter datetime filter - $sales = $this->Sale->search($search, $filters, $limit, $offset, $sort, $order,$datetime_filter); + + $sales = $this->Sale->search($search, $filters, $limit, $offset, $sort, $order); $total_rows = $this->Sale->get_found_rows($search, $filters); $payments = $this->Sale->get_payments_summary($search, $filters); $payment_summary = $this->xss_clean(get_sales_manage_payments_summary($payments, $sales, $this)); diff --git a/application/language/en/config_lang.php b/application/language/en/config_lang.php index d29bbba2f..4963c51c0 100644 --- a/application/language/en/config_lang.php +++ b/application/language/en/config_lang.php @@ -182,4 +182,3 @@ $lang["config_number_locale_required"] = "Number Locale is a required field"; $lang["config_number_locale_invalid"] = "The entered locale is invalid. Check the link in the tooltip to find a sensible value"; $lang["config_number_locale_tooltip"] = "Find a suitable locale through this link"; $lang["config_theme"] = "Theme"; -$lang["config_filter_datetime_format"] = "Filter with date/time format in reports"; diff --git a/application/language/es/config_lang.php b/application/language/es/config_lang.php index 783a847a0..84a045f45 100644 --- a/application/language/es/config_lang.php +++ b/application/language/es/config_lang.php @@ -181,4 +181,4 @@ $lang["config_return_policy_required"] = "Política de Devolución es requerida" $lang["config_number_locale_required"] = "Numero local es un campo requerido"; $lang["config_number_locale_invalid"] = "El local ingresado es invalido. Revisa el link en el tooltip para encontrar informacion"; $lang["config_number_locale_tooltip"] = "Encontrar un local adecuado en esta liga"; -$lang["config_theme"] = "Tema"; \ No newline at end of file +$lang["config_theme"] = "Tema"; diff --git a/application/models/Item.php b/application/models/Item.php index 2bd676f2d..1cfc03a79 100644 --- a/application/models/Item.php +++ b/application/models/Item.php @@ -58,7 +58,7 @@ class Item extends CI_Model /* Perform a search on items */ - public function search($search, $filters, $rows = 0, $limit_from = 0, $sort = 'items.name', $order = 'asc', $datetime_filter = '') + public function search($search, $filters, $rows = 0, $limit_from = 0, $sort = 'items.name', $order = 'asc') { $this->db->from('items'); $this->db->join('suppliers', 'suppliers.person_id = items.supplier_id', 'left'); @@ -69,10 +69,8 @@ class Item extends CI_Model $this->db->join('item_quantities', 'item_quantities.item_id = items.item_id'); $this->db->where('location_id', $filters['stock_location_id']); } - if(empty($datetime_filter)) - $this->db->where('DATE_FORMAT(trans_date, "%Y-%m-%d") BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date'])); - else - $this->db->where('trans_date BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date'])); + + $this->db->where('DATE_FORMAT(trans_date, "%Y-%m-%d") BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date'])); if(!empty($search)) { diff --git a/application/models/Receiving.php b/application/models/Receiving.php index ec185109f..c12605efb 100644 --- a/application/models/Receiving.php +++ b/application/models/Receiving.php @@ -206,7 +206,7 @@ class Receiving extends CI_Model public function create_temp_table() { $this->db->query('CREATE TEMPORARY TABLE IF NOT EXISTS ' . $this->db->dbprefix('receivings_items_temp') . - ' (INDEX(receiving_date), INDEX(receiving_time), INDEX(receiving_id)) + ' (INDEX(receiving_date), INDEX(receiving_id)) ( SELECT DATE(receiving_time) AS receiving_date, diff --git a/application/models/Sale.php b/application/models/Sale.php index 1d7b42466..465440746 100644 --- a/application/models/Sale.php +++ b/application/models/Sale.php @@ -26,7 +26,7 @@ class Sale extends CI_Model /* Get the sales data for the takings (sales/manage) view */ - public function search($search, $filters, $rows = 0, $limit_from = 0, $sort = 'sale_date', $order = 'desc', $datetime_filter = '') + public function search($search, $filters, $rows = 0, $limit_from = 0, $sort = 'sale_date', $order = 'desc') { $this->db->select('sale_id, sale_date, sale_time, SUM(quantity_purchased) AS items_purchased, customer_name, customer_company_name AS company_name, @@ -34,11 +34,8 @@ class Sale extends CI_Model sale_payment_amount AS amount_tendered, SUM(total) AS amount_due, (sale_payment_amount - SUM(total)) AS change_due, payment_type, invoice_number'); $this->db->from('sales_items_temp'); - - if(empty($datetime_filter)) - $this->db->where('sale_date BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date'])); - else - $this->db->where('sale_time BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date'])); + + $this->db->where('sale_date BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date'])); if(!empty($search)) { @@ -564,7 +561,7 @@ class Sale extends CI_Model ); $this->db->query('CREATE TEMPORARY TABLE IF NOT EXISTS ' . $this->db->dbprefix('sales_items_temp') . - ' (INDEX(sale_date), INDEX(sale_time), INDEX(sale_id)) + ' (INDEX(sale_date), INDEX(sale_id)) ( SELECT DATE(sales.sale_time) AS sale_date, diff --git a/application/models/reports/Detailed_receivings.php b/application/models/reports/Detailed_receivings.php index 9481bff91..7a970dc88 100644 --- a/application/models/reports/Detailed_receivings.php +++ b/application/models/reports/Detailed_receivings.php @@ -53,11 +53,7 @@ class Detailed_receivings extends Report $this->db->from('receivings_items_temp'); $this->db->join('people AS employee', 'receivings_items_temp.employee_id = employee.person_id'); $this->db->join('suppliers AS supplier', 'receivings_items_temp.supplier_id = supplier.person_id', 'left'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("receiving_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("receiving_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + $this->db->where('receiving_date BETWEEN '. $this->db->escape($inputs['start_date']). ' AND '. $this->db->escape($inputs['end_date'])); if ($inputs['location_id'] != 'all') { @@ -99,11 +95,7 @@ class Detailed_receivings extends Report { $this->db->select('SUM(total) AS total'); $this->db->from('receivings_items_temp'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("receiving_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("receiving_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + $this->db->where('receiving_date BETWEEN '. $this->db->escape($inputs['start_date']). ' AND '. $this->db->escape($inputs['end_date'])); if ($inputs['location_id'] != 'all') { diff --git a/application/models/reports/Detailed_sales.php b/application/models/reports/Detailed_sales.php index 5c717aef8..6059412e4 100644 --- a/application/models/reports/Detailed_sales.php +++ b/application/models/reports/Detailed_sales.php @@ -55,11 +55,7 @@ class Detailed_sales extends Report { $this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, employee_name, customer_name, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment'); $this->db->from('sales_items_temp'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + $this->db->where('sale_date BETWEEN '. $this->db->escape($inputs['start_date']). ' AND '. $this->db->escape($inputs['end_date'])); if ($inputs['location_id'] != 'all') { @@ -97,11 +93,7 @@ class Detailed_sales extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + $this->db->where('sale_date BETWEEN '. $this->db->escape($inputs['start_date']). ' AND '. $this->db->escape($inputs['end_date'])); if ($inputs['location_id'] != 'all') { diff --git a/application/models/reports/Specific_customer.php b/application/models/reports/Specific_customer.php index 3d9df04cd..fdb67677f 100644 --- a/application/models/reports/Specific_customer.php +++ b/application/models/reports/Specific_customer.php @@ -21,13 +21,7 @@ class Specific_customer extends Report { $this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, employee_name, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment'); $this->db->from('sales_items_temp'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); - - $this->db->where("customer_id = ".$inputs['customer_id']); + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " AND customer_id=" . $this->db->escape($inputs['customer_id'])); if ($inputs['sale_type'] == 'sales') { @@ -60,13 +54,7 @@ class Specific_customer extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); - - $this->db->where("customer_id = ".$inputs['customer_id']); + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " AND customer_id=" . $this->db->escape($inputs['customer_id'])); if ($inputs['sale_type'] == 'sales') { diff --git a/application/models/reports/Specific_discount.php b/application/models/reports/Specific_discount.php index 00f4f777c..c7a926633 100755 --- a/application/models/reports/Specific_discount.php +++ b/application/models/reports/Specific_discount.php @@ -21,14 +21,8 @@ class Specific_discount extends Report { $this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, customer_name, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment'); $this->db->from('sales_items_temp'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " AND discount_percent >=" . $this->db->escape($inputs['discount'])); - $this->db->where('discount_percent = '.$inputs['discount']); - if ($inputs['sale_type'] == 'sales') { $this->db->where('quantity_purchased > 0'); @@ -61,15 +55,8 @@ class Specific_discount extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - // Modify by Jorge Colmenarez 2016-11-01 21:05 - // Set DateTime filter field - if(empty($inputs['datetime_filter'])) - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); - // Support for filter by Specific Discount - $this->db->where('discount_percent = '.$inputs['discount']); - + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " AND discount_percent >=" . $this->db->escape($inputs['discount'])); + if ($inputs['sale_type'] == 'sales') { $this->db->where('quantity_purchased > 0'); diff --git a/application/models/reports/Specific_employee.php b/application/models/reports/Specific_employee.php index 50ef7be24..977de2103 100644 --- a/application/models/reports/Specific_employee.php +++ b/application/models/reports/Specific_employee.php @@ -21,14 +21,8 @@ class Specific_employee extends Report { $this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, customer_name, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment'); $this->db->from('sales_items_temp'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); - - $this->db->where("employee_id = ".$inputs['employee_id']); - + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " AND employee_id=" . $this->db->escape($inputs['employee_id'])); + if ($inputs['sale_type'] == 'sales') { $this->db->where('quantity_purchased > 0'); @@ -60,13 +54,7 @@ class Specific_employee extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); - - $this->db->where("employee_id = ".$inputs['employee_id']); + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " AND employee_id=" . $this->db->escape($inputs['employee_id'])); if ($inputs['sale_type'] == 'sales') { diff --git a/application/models/reports/Summary_categories.php b/application/models/reports/Summary_categories.php index ba5e4150f..b8fdf22a9 100644 --- a/application/models/reports/Summary_categories.php +++ b/application/models/reports/Summary_categories.php @@ -19,11 +19,7 @@ class Summary_categories extends Report { $this->db->select('category, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); if ($inputs['location_id'] != 'all') { @@ -41,6 +37,7 @@ class Summary_categories extends Report $this->db->group_by('category'); $this->db->order_by('category'); + return $this->db->get()->result_array(); } @@ -48,11 +45,7 @@ class Summary_categories extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); if ($inputs['location_id'] != 'all') { diff --git a/application/models/reports/Summary_customers.php b/application/models/reports/Summary_customers.php index 6464de1bd..ebf863c71 100644 --- a/application/models/reports/Summary_customers.php +++ b/application/models/reports/Summary_customers.php @@ -19,11 +19,7 @@ class Summary_customers extends Report { $this->db->select('customer_name AS customer, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); if ($inputs['location_id'] != 'all') { @@ -49,11 +45,7 @@ class Summary_customers extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); if ($inputs['location_id'] != 'all') { diff --git a/application/models/reports/Summary_discounts.php b/application/models/reports/Summary_discounts.php index 433a4032f..29d34a327 100644 --- a/application/models/reports/Summary_discounts.php +++ b/application/models/reports/Summary_discounts.php @@ -19,12 +19,7 @@ class Summary_discounts extends Report { $this->db->select('CONCAT(discount_percent, "%") AS discount_percent, count(*) AS count'); $this->db->from('sales_items_temp'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); - + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); $this->db->where('discount_percent > 0'); if ($inputs['location_id'] != 'all') @@ -51,13 +46,7 @@ class Summary_discounts extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); - - $this->db->where('discount_percent > 0'); + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); if ($inputs['location_id'] != 'all') { diff --git a/application/models/reports/Summary_employees.php b/application/models/reports/Summary_employees.php index a182a5c67..52c7fc4d1 100644 --- a/application/models/reports/Summary_employees.php +++ b/application/models/reports/Summary_employees.php @@ -19,11 +19,7 @@ class Summary_employees extends Report { $this->db->select('employee_name AS employee, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); if ($inputs['location_id'] != 'all') { @@ -49,11 +45,7 @@ class Summary_employees extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); if ($inputs['location_id'] != 'all') { diff --git a/application/models/reports/Summary_items.php b/application/models/reports/Summary_items.php index 86a922a67..033a9b870 100644 --- a/application/models/reports/Summary_items.php +++ b/application/models/reports/Summary_items.php @@ -19,11 +19,7 @@ class Summary_items extends Report { $this->db->select('name, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); if ($inputs['location_id'] != 'all') { @@ -49,11 +45,7 @@ class Summary_items extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); if ($inputs['location_id'] != 'all') { diff --git a/application/models/reports/Summary_payments.php b/application/models/reports/Summary_payments.php index 24c8e6a7c..b1f316bd8 100644 --- a/application/models/reports/Summary_payments.php +++ b/application/models/reports/Summary_payments.php @@ -20,11 +20,7 @@ class Summary_payments extends Report $this->db->select('sales_payments.payment_type, count(*) AS count, SUM(payment_amount) AS payment_amount'); $this->db->from('sales_payments'); $this->db->join('sales', 'sales.sale_id=sales_payments.sale_id'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("date(sale_time) BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + $this->db->where("date(sale_time) BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); if ($inputs['location_id'] != 'all') { @@ -71,11 +67,7 @@ class Summary_payments extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); if ($inputs['location_id'] != 'all') { diff --git a/application/models/reports/Summary_sales.php b/application/models/reports/Summary_sales.php index fe8dfdd4b..6d8b08dcf 100644 --- a/application/models/reports/Summary_sales.php +++ b/application/models/reports/Summary_sales.php @@ -19,11 +19,7 @@ class Summary_sales extends Report { $this->db->select('sale_date, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); if ($inputs['location_id'] != 'all') { @@ -49,11 +45,7 @@ class Summary_sales extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); if ($inputs['location_id'] != 'all') { diff --git a/application/models/reports/Summary_suppliers.php b/application/models/reports/Summary_suppliers.php index 7400cbf12..07644a46f 100644 --- a/application/models/reports/Summary_suppliers.php +++ b/application/models/reports/Summary_suppliers.php @@ -21,11 +21,7 @@ class Summary_suppliers extends Report $this->db->from('sales_items_temp'); $this->db->join('suppliers', 'suppliers.person_id = sales_items_temp.supplier_id'); $this->db->join('people', 'suppliers.person_id = people.person_id'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); if ($inputs['location_id'] != 'all') { @@ -53,11 +49,7 @@ class Summary_suppliers extends Report $this->db->from('sales_items_temp'); $this->db->join('suppliers', 'suppliers.person_id = sales_items_temp.supplier_id'); $this->db->join('people', 'suppliers.person_id = people.person_id'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); if ($inputs['location_id'] != 'all') { diff --git a/application/models/reports/Summary_taxes.php b/application/models/reports/Summary_taxes.php index 320799425..c5f0a420f 100644 --- a/application/models/reports/Summary_taxes.php +++ b/application/models/reports/Summary_taxes.php @@ -47,14 +47,6 @@ class Summary_taxes extends Report $decimals = totals_decimals(); - $clauseWhere = ""; - if(empty($inputs['datetime_filter'])) - $clauseWhere = "WHERE date(sale_time) BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']); - else - $clauseWhere = "WHERE sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date'])); - - $clauseWhere.=" ".$quantity_cond; - $query = $this->db->query("SELECT percent, count(*) AS count, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax FROM (SELECT name, CONCAT(ROUND(percent, $decimals), '%') AS percent, ROUND((item_unit_price * quantity_purchased - item_unit_price * quantity_purchased * discount_percent /100) * $subtotal, $decimals) AS subtotal, @@ -66,7 +58,7 @@ class Summary_taxes extends Report .$this->db->dbprefix('sales_items').'.item_id='.$this->db->dbprefix('sales_items_taxes').'.item_id'." AND " .$this->db->dbprefix('sales_items').'.line='.$this->db->dbprefix('sales_items_taxes').'.line' ." JOIN ".$this->db->dbprefix('sales')." ON ".$this->db->dbprefix('sales_items_taxes').".sale_id=".$this->db->dbprefix('sales').".sale_id - $clauseWhere) AS temp_taxes + WHERE date(sale_time) BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " $quantity_cond) AS temp_taxes GROUP BY percent"); return $query->result_array(); @@ -76,11 +68,7 @@ class Summary_taxes extends Report { $this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit'); $this->db->from('sales_items_temp'); - - if(empty($inputs['datetime_filter'])) - $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); - else - $this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date']))); + $this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date'])); if ($inputs['location_id'] != 'all') { diff --git a/application/views/configs/locale_config.php b/application/views/configs/locale_config.php index f83e85411..e6f335536 100644 --- a/application/views/configs/locale_config.php +++ b/application/views/configs/locale_config.php @@ -262,17 +262,6 @@ -
- lang->line('config_filter_datetime_format'), 'filter_datetime_format', array('class' => 'control-label col-xs-2')); ?> -
- 'filter_datetime_format', - 'id' => 'filter_datetime_format', - 'value' => 'filter_datetime_format', - 'checked'=>$this->config->item('filter_datetime_format'))); ?> -
-
- 'submit_form', 'id' => 'submit_form', diff --git a/application/views/partial/daterangepicker.php b/application/views/partial/daterangepicker.php index b3c94f046..6427e5efa 100644 --- a/application/views/partial/daterangepicker.php +++ b/application/views/partial/daterangepicker.php @@ -1,60 +1,57 @@ -lang->load("calendar"); $this->lang->load("date"); +lang->load("calendar"); $this->lang->load("date"); ?> - if(empty($this->config->item('filter_datetime_format'))){ -?> -$('#daterangepicker').css("width","200"); -var start_date = ""; -var end_date = ""; +var start_date = ""; +var end_date = ""; $('#daterangepicker').daterangepicker({ "ranges": { "lang->line("datepicker_today"); ?>": [ - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d"),date("Y")));?>", - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d"),date("Y")));?>", + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" ], "lang->line("datepicker_today_last_year"); ?>": [ - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d"),date("Y")-1));?>", - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y")-1)-1);?>" + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d"),date("Y")-1));?>", + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y")-1)-1);?>" ], "lang->line("datepicker_yesterday"); ?>": [ - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")-1,date("Y")));?>", - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d"),date("Y"))-1);?>" + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")-1,date("Y")));?>", + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d"),date("Y"))-1);?>" ], "lang->line("datepicker_last_7"); ?>": [ - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")-6,date("Y")));?>", - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")-6,date("Y")));?>", + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" ], "lang->line("datepicker_last_30"); ?>": [ - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")-29,date("Y")));?>", - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")-29,date("Y")));?>", + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" ], "lang->line("datepicker_this_month"); ?>": [ - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y")));?>", - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m")+1,1,date("Y"))-1);?>" + "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y")));?>", + "config->item('dateformat'), mktime(0,0,0,date("m")+1,1,date("Y"))-1);?>" ], "lang->line("datepicker_same_month_to_same_day_last_year"); ?>": [ - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y")-1));?>", - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y")-1)-1);?>" + "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y")-1));?>", + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y")-1)-1);?>" ], "lang->line("datepicker_this_month_last_year"); ?>": [ - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y")-1));?>", - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m")+1,1,date("Y")-1)-1);?>" + "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y")-1));?>", + "config->item('dateformat'), mktime(0,0,0,date("m")+1,1,date("Y")-1)-1);?>" ], "lang->line("datepicker_last_month"); ?>": [ - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m")-1,1,date("Y")));?>", - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y"))-1);?>" + "config->item('dateformat'), mktime(0,0,0,date("m")-1,1,date("Y")));?>", + "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y"))-1);?>" ], "lang->line("datepicker_this_year"); ?>": [ - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,1,1,date("Y")));?>", - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y")+1)-1);?>" + "config->item('dateformat'), mktime(0,0,0,1,1,date("Y")));?>", + "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y")+1)-1);?>" ], "lang->line("datepicker_last_year"); ?>": [ - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,1,1,date("Y")-1));?>", - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,1,1,date("Y"))-1);?>" + "config->item('dateformat'), mktime(0,0,0,1,1,date("Y")-1));?>", + "config->item('dateformat'), mktime(0,0,0,1,1,date("Y"))-1);?>" ], "lang->line("datepicker_all_time"); ?>": [ - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,01,01,2010));?>", - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" + "config->item('dateformat'), mktime(0,0,0,01,01,2010));?>", + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" ], }, "locale": { @@ -92,118 +89,11 @@ $('#daterangepicker').daterangepicker({ "firstDay": lang->line("datepicker_weekstart"); ?> }, "alwaysShowCalendars": true, - "startDate": "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>", - "endDate": "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>", - "minDate": "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,01,01,2010));?>", - "maxDate": "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" + "startDate": "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>", + "endDate": "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>", + "minDate": "config->item('dateformat'), mktime(0,0,0,01,01,2010));?>", + "maxDate": "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" }, function(start, end, label) { start_date = start.format('YYYY-MM-DD'); end_date = end.format('YYYY-MM-DD'); -}); - -$('#daterangepicker').css("width","300"); -var start_date = ""; -var end_date = ""; - -$('#daterangepicker').daterangepicker({ - "ranges": { - "lang->line("datepicker_today"); ?>": [ - "config->item('dateformat')." ".$this->config->item('timeformat'), mktime(0,0,0,date("m"),date("d"),date("Y")));?>", - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d")+1,date("Y"))-1);?>" - ], - "lang->line("datepicker_today_last_year"); ?>": [ - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d"),date("Y")-1));?>", - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d")+1,date("Y")-1)-1);?>" - ], - "lang->line("datepicker_yesterday"); ?>": [ - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")-1,date("Y")));?>", - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d"),date("Y"))-1);?>" - ], - "lang->line("datepicker_last_7"); ?>": [ - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")-6,date("Y")));?>", - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d")+1,date("Y"))-1);?>" - ], - "lang->line("datepicker_last_30"); ?>": [ - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")-29,date("Y")));?>", - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d")+1,date("Y"))-1);?>" - ], - "lang->line("datepicker_this_month"); ?>": [ - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y")));?>", - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m")+1,1,date("Y"))-1);?>" - ], - "lang->line("datepicker_same_month_to_same_day_last_year"); ?>": [ - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y")-1));?>", - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d")+1,date("Y")-1)-1);?>" - ], - "lang->line("datepicker_this_month_last_year"); ?>": [ - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y")-1));?>", - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m")+1,1,date("Y")-1)-1);?>" - ], - "lang->line("datepicker_last_month"); ?>": [ - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m")-1,1,date("Y")));?>", - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),1,date("Y"))-1);?>" - ], - "lang->line("datepicker_this_year"); ?>": [ - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,1,1,date("Y")));?>", - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),1,date("Y")+1)-1);?>" - ], - "lang->line("datepicker_last_year"); ?>": [ - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,1,1,date("Y")-1));?>", - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,1,1,date("Y"))-1);?>" - ], - "lang->line("datepicker_all_time"); ?>": [ - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,01,01,2010));?>", - "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d")+1,date("Y"))-1);?>" - ], - }, - "locale": { - "format": 'config->item("dateformat")." ".$this->config->item('timeformat'))?>', - "separator": " - ", - "applyLabel": "lang->line("datepicker_apply"); ?>", - "cancelLabel": "lang->line("datepicker_cancel"); ?>", - "fromLabel": "lang->line("datepicker_from"); ?>", - "toLabel": "lang->line("datepicker_to"); ?>", - "customRangeLabel": "lang->line("datepicker_custom"); ?>", - "daysOfWeek": [ - "lang->line("cal_su"); ?>", - "lang->line("cal_mo"); ?>", - "lang->line("cal_tu"); ?>", - "lang->line("cal_we"); ?>", - "lang->line("cal_th"); ?>", - "lang->line("cal_fr"); ?>", - "lang->line("cal_sa"); ?>", - "lang->line("cal_su"); ?>" - ], - "monthNames": [ - "lang->line("cal_january"); ?>", - "lang->line("cal_february"); ?>", - "lang->line("cal_march"); ?>", - "lang->line("cal_april"); ?>", - "lang->line("cal_may"); ?>", - "lang->line("cal_june"); ?>", - "lang->line("cal_july"); ?>", - "lang->line("cal_august"); ?>", - "lang->line("cal_september"); ?>", - "lang->line("cal_october"); ?>", - "lang->line("cal_november"); ?>", - "lang->line("cal_december"); ?>" - ], - "firstDay": lang->line("datepicker_weekstart"); ?> - }, - "timePicker": true, - "timePickerSeconds": true, - "alwaysShowCalendars": true, - "startDate": "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>", - "endDate": "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d")+1,date("Y"))-1);?>", - "minDate": "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,01,01,2010));?>", - "maxDate": "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d")+1,date("Y"))-1);?>" -}, function(start, end, label) { - start_date = start.format('YYYY-MM-DD HH:mm:ss'); - end_date = end.format('YYYY-MM-DD HH:mm:ss'); -}); - \ No newline at end of file +}); \ No newline at end of file diff --git a/application/views/reports/date_input.php b/application/views/reports/date_input.php index acc10eed4..312e39268 100644 --- a/application/views/reports/date_input.php +++ b/application/views/reports/date_input.php @@ -77,7 +77,7 @@ $(document).ready(function() load->view('partial/daterangepicker'); ?> $("#generate_report").click(function() - { + { window.location = [window.location, start_date, end_date, $("#input_type").val() || 0, $("#location_id").val()].join("/"); }); }); diff --git a/database/database.sql b/database/database.sql index 644741442..0dfc5dbaf 100644 --- a/database/database.sql +++ b/database/database.sql @@ -82,8 +82,7 @@ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES ('theme', 'flatly'), ('statistics', '1'), ('language', 'english'), -('language_code', 'en'), -('filter_datetime_format',''); +('language_code', 'en'); -- -------------------------------------------------------- diff --git a/public/license/LICENSE b/public/license/LICENSE index 4f37e2cea..9eb29b09e 100644 --- a/public/license/LICENSE +++ b/public/license/LICENSE @@ -10,7 +10,6 @@ Copyright (c) 2015-2016 FrancescoUK (aka daN4cat) Copyright (c) 2015 Aamir Shahzad (aka asakpke), RoshanTech.com Copyright (c) 2015 Toni Haryanto (aka yllumi) Copyright (c) 2016 Ramkrishna Mondal (aka RamkrishnaMondal) -Copyright (c) 2016 Jorge Colmenarez Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in From 305d9dd55e85399215b2863aa2aeebd020b4caec Mon Sep 17 00:00:00 2001 From: root Date: Wed, 30 Nov 2016 14:32:25 -0400 Subject: [PATCH 05/63] Support for Date or Time Format --- application/controllers/Config.php | 3 +- application/controllers/Login.php | 1 + application/controllers/Reports.php | 62 ++-- application/models/Item.php | 9 +- application/models/Receiving.php | 11 +- application/models/Sale.php | 42 ++- application/models/reports/Summary_report.php | 21 +- application/models/reports/Summary_taxes.php | 19 +- application/views/configs/locale_config.php | 11 + application/views/partial/daterangepicker.php | 305 ++++++++++++------ 10 files changed, 347 insertions(+), 137 deletions(-) diff --git a/application/controllers/Config.php b/application/controllers/Config.php index e7a2cf7ac..483090e6f 100644 --- a/application/controllers/Config.php +++ b/application/controllers/Config.php @@ -304,7 +304,8 @@ class Config extends Secure_Controller 'tax_decimals' => $this->input->post('tax_decimals'), 'quantity_decimals' => $this->input->post('quantity_decimals'), 'country_codes' => $this->input->post('country_codes'), - 'payment_options_order' => $this->input->post('payment_options_order') + 'payment_options_order' => $this->input->post('payment_options_order'), + 'date_or_time_format' => $this->input->post('date_or_time_format') ); $result = $this->Appconfig->batch_save($batch_save_data); diff --git a/application/controllers/Login.php b/application/controllers/Login.php index cdf5f928b..a463ac674 100644 --- a/application/controllers/Login.php +++ b/application/controllers/Login.php @@ -40,6 +40,7 @@ class Login extends CI_Controller $this->tracking_lib->track_event('Stats', 'Tax Decimals', $this->config->item('tax_decimals')); $this->tracking_lib->track_event('Stats', 'Quantity Decimals', $this->config->item('quantity_decimals')); $this->tracking_lib->track_event('Stats', 'Invoice Enable', $this->config->item('invoice_enable')); + $this->tracking_lib->track_event('Stats', 'Date or Time Format', $this->config->item('date_or_time_format')); } redirect('home'); diff --git a/application/controllers/Reports.php b/application/controllers/Reports.php index 6b6f4724d..6ee6b280b 100644 --- a/application/controllers/Reports.php +++ b/application/controllers/Reports.php @@ -64,7 +64,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_sales_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, 'summary_data' => $summary @@ -100,7 +100,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_categories_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, 'summary_data' => $summary @@ -136,7 +136,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_customers_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, 'summary_data' => $summary @@ -172,7 +172,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_suppliers_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, 'summary_data' => $summary @@ -208,7 +208,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_items_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, 'summary_data' => $summary @@ -244,7 +244,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_employees_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, 'summary_data' => $summary @@ -278,7 +278,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_taxes_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, 'summary_data' => $summary @@ -309,7 +309,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_discounts_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, 'summary_data' => $summary @@ -341,7 +341,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_payments_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'headers' => $this->xss_clean($model->getDataColumns()), 'data' => $tabular_data, 'summary_data' => $summary @@ -409,7 +409,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_sales_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'chart_type' => 'reports/graphs/line', 'labels_1' => $labels, 'series_data_1' => $series, @@ -445,7 +445,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_items_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'chart_type' => 'reports/graphs/hbar', 'labels_1' => $labels, 'series_data_1' => $series, @@ -481,7 +481,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_categories_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'chart_type' => 'reports/graphs/pie', 'labels_1' => $labels, 'series_data_1' => $series, @@ -515,7 +515,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_suppliers_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'chart_type' => 'reports/graphs/pie', 'labels_1' => $labels, 'series_data_1' => $series, @@ -549,7 +549,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_employees_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'chart_type' => 'reports/graphs/pie', 'labels_1' => $labels, 'series_data_1' => $series, @@ -583,7 +583,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_taxes_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'chart_type' => 'reports/graphs/pie', 'labels_1' => $labels, 'series_data_1' => $series, @@ -617,7 +617,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_customers_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'chart_type' => 'reports/graphs/hbar', 'labels_1' => $labels, 'series_data_1' => $series, @@ -653,7 +653,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_discounts_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'chart_type' => 'reports/graphs/bar', 'labels_1' => $labels, 'series_data_1' => $series, @@ -689,7 +689,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_payments_summary_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'chart_type' => 'reports/graphs/pie', 'labels_1' => $labels, 'series_data_1' => $series, @@ -754,7 +754,7 @@ class Reports extends Secure_Controller $customer_info = $this->Customer->get_info($customer_id); $data = array( 'title' => $this->xss_clean($customer_info->first_name . ' ' . $customer_info->last_name . ' ' . $this->lang->line('reports_report')), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'headers' => $headers, 'summary_data' => $summary_data, 'details_data' => $details_data, @@ -818,7 +818,7 @@ class Reports extends Secure_Controller $employee_info = $this->Employee->get_info($employee_id); $data = array( 'title' => $this->xss_clean($employee_info->first_name . ' ' . $employee_info->last_name . ' ' . $this->lang->line('reports_report')), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'headers' => $headers, 'summary_data' => $summary_data, 'details_data' => $details_data, @@ -883,7 +883,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $discount . '% ' . $this->lang->line('reports_discount') . ' ' . $this->lang->line('reports_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'headers' => $headers, 'summary_data' => $summary_data, 'details_data' => $details_data, @@ -975,7 +975,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_detailed_sales_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'headers' => $headers, 'editable' => 'sales', 'summary_data' => $summary_data, @@ -1062,7 +1062,7 @@ class Reports extends Secure_Controller $data = array( 'title' => $this->lang->line('reports_detailed_receivings_report'), - 'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)), + 'subtitle' => $this->_get_subtitle_report(array('start_date' => $start_date, 'end_date' => $end_date)), 'headers' => $headers, 'editable' => 'receivings', 'summary_data' => $summary_data, @@ -1154,5 +1154,21 @@ class Reports extends Secure_Controller $this->load->view('reports/tabular', $data); } + // Returns subtitle for the reports + private function _get_subtitle_report($inputs) + { + $subtitle = ''; + + if(empty($this->config->item('filter_datetime_format'))) + { + $subtitle .= date($this->config->item('dateformat'), strtotime($inputs['start_date'])) . ' - ' .date($this->config->item('dateformat'), strtotime($inputs['end_date'])); + } + else + { + $subtitle .= date($this->config->item('dateformat').' '.$this->config->item('timeformat'), strtotime(rawurldecode($inputs['start_date']))) . ' - ' . date($this->config->item('dateformat').' '.$this->config->item('timeformat'), strtotime(rawurldecode($inputs['end_date']))); + } + + return $subtitle; + } } ?> \ No newline at end of file diff --git a/application/models/Item.php b/application/models/Item.php index eb13a5842..5faaf6c65 100644 --- a/application/models/Item.php +++ b/application/models/Item.php @@ -70,7 +70,14 @@ class Item extends CI_Model $this->db->where('location_id', $filters['stock_location_id']); } - $this->db->where('DATE_FORMAT(trans_date, "%Y-%m-%d") BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date'])); + if(empty($this->config->item('date_or_time_format'))) + { + $this->db->where('DATE_FORMAT(trans_date, "%Y-%m-%d") BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date'])); + } + else + { + $this->db->where('trans_date BETWEEN ' . $this->db->escape(rawurldecode($filters['start_date'])) . ' AND ' . $this->db->escape(rawurldecode($filters['end_date']))); + } if(!empty($search)) { diff --git a/application/models/Receiving.php b/application/models/Receiving.php index 4b8b9145e..417fb721f 100644 --- a/application/models/Receiving.php +++ b/application/models/Receiving.php @@ -227,7 +227,14 @@ class Receiving extends CI_Model { if(empty($inputs['receiving_id'])) { - $where = 'WHERE DATE(receiving_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']); + if(empty($this->config->item('date_or_time_format'))) + { + $where = 'WHERE DATE(receiving_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']); + } + else + { + $where = 'WHERE receiving_time BETWEEN ' . $this->db->escape(rawurldecode($inputs['start_date'])) . ' AND ' . $this->db->escape(rawurldecode($inputs['end_date'])); + } } else { @@ -235,7 +242,7 @@ class Receiving extends CI_Model } $this->db->query('CREATE TEMPORARY TABLE IF NOT EXISTS ' . $this->db->dbprefix('receivings_items_temp') . - ' (INDEX(receiving_date), INDEX(receiving_id)) + ' (INDEX(receiving_date), INDEX(receiving_time), INDEX(receiving_id)) ( SELECT DATE(receiving_time) AS receiving_date, diff --git a/application/models/Sale.php b/application/models/Sale.php index 581941ecd..39cfb3d28 100644 --- a/application/models/Sale.php +++ b/application/models/Sale.php @@ -98,6 +98,15 @@ class Sale extends CI_Model */ public function search($search, $filters, $rows = 0, $limit_from = 0, $sort = 'sale_date', $order = 'desc') { + $where = ''; + if (empty($this->config->item('date_or_time_format'))) + { + $where .= 'WHERE DATE(sales.sale_time) BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']) . ' '; + } + else + { + $where .= 'WHERE sales.sale_time BETWEEN ' . $this->db->escape(rawurldecode($filters['start_date'])) . ' AND ' . $this->db->escape(rawurldecode($filters['end_date'])) . ' '; + } // NOTE: temporary tables are created to speed up searches due to the fact that are ortogonal to the main query // create a temporary table to contain all the payments per sale item $this->db->query('CREATE TEMPORARY TABLE IF NOT EXISTS ' . $this->db->dbprefix('sales_payments_temp') . @@ -109,7 +118,7 @@ class Sale extends CI_Model FROM ' . $this->db->dbprefix('sales_payments') . ' AS payments INNER JOIN ' . $this->db->dbprefix('sales') . ' AS sales ON sales.sale_id = payments.sale_id - WHERE DATE(sales.sale_time) BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']) . ' + ' . $where . ' GROUP BY sale_id )' ); @@ -126,7 +135,7 @@ class Sale extends CI_Model ON sales.sale_id = sales_items_taxes.sale_id INNER JOIN ' . $this->db->dbprefix('sales_items') . ' AS sales_items ON sales_items.sale_id = sales_items_taxes.sale_id AND sales_items.line = sales_items_taxes.line - WHERE DATE(sales.sale_time) BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']) . ' + ' . $where . ' GROUP BY sales_items_taxes.sale_id, sales_items_taxes.item_id )' ); @@ -176,7 +185,14 @@ class Sale extends CI_Model $this->db->join('sales_payments_temp AS payments', 'sales.sale_id = payments.sale_id', 'left outer'); $this->db->join('sales_items_taxes_temp AS sales_items_taxes', 'sales_items.sale_id = sales_items_taxes.sale_id AND sales_items.item_id = sales_items_taxes.item_id', 'left outer'); - $this->db->where('DATE(sales.sale_time) BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date'])); + if (empty($this->config->item('date_or_time_format'))) + { + $this->db->where('DATE(sales.sale_time) BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date'])); + } + else + { + $this->db->where('sales.sale_time BETWEEN ' . $this->db->escape(rawurldecode($filters['start_date'])) . ' AND ' . $this->db->escape(rawurldecode($filters['end_date']))); + } if(!empty($search)) { @@ -250,7 +266,14 @@ class Sale extends CI_Model $this->db->join('people AS customer_p', 'sales.customer_id = customer_p.person_id', 'left'); $this->db->join('customers AS customer', 'sales.customer_id = customer.person_id', 'left'); - $this->db->where('DATE(sale_time) BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date'])); + if (empty($this->config->item('date_or_time_format'))) + { + $this->db->where('DATE(sales.sale_time) BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date'])); + } + else + { + $this->db->where('sales.sale_time BETWEEN ' . $this->db->escape(rawurldecode($filters['start_date'])) . ' AND ' . $this->db->escape(rawurldecode($filters['end_date']))); + } if(!empty($search)) { @@ -735,7 +758,14 @@ class Sale extends CI_Model if(empty($inputs['sale_id'])) { - $where = 'WHERE DATE(sales.sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']); + if(empty($this->config->item('date_or_time_format'))) + { + $where = 'WHERE DATE(sales.sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']); + } + else + { + $where = 'WHERE sales.sale_time BETWEEN ' . $this->db->escape(rawurldecode($inputs['start_date'])) . ' AND ' . $this->db->escape(rawurldecode($inputs['end_date'])); + } } else { @@ -760,7 +790,7 @@ class Sale extends CI_Model ); $this->db->query('CREATE TEMPORARY TABLE IF NOT EXISTS ' . $this->db->dbprefix('sales_items_temp') . - ' (INDEX(sale_date), INDEX(sale_id)) + ' (INDEX(sale_date), INDEX(sale_time), INDEX(sale_id)) ( SELECT DATE(sales.sale_time) AS sale_date, diff --git a/application/models/reports/Summary_report.php b/application/models/reports/Summary_report.php index 1cb985372..0c59ea55e 100644 --- a/application/models/reports/Summary_report.php +++ b/application/models/reports/Summary_report.php @@ -17,6 +17,16 @@ abstract class Summary_report extends Report private function _common_select(array $inputs) { + $where = ''; + + if(empty($this->config->item('date_or_time_format'))) + { + $where .= 'WHERE DATE(sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']); + } + else + { + $where .= 'WHERE sale_time BETWEEN ' . $this->db->escape(rawurldecode($inputs['start_date'])) . ' AND ' . $this->db->escape(rawurldecode($inputs['end_date'])); + } // create a temporary table to contain all the sum of taxes per sale item $this->db->query('CREATE TEMPORARY TABLE IF NOT EXISTS ' . $this->db->dbprefix('sales_items_taxes_temp') . ' (INDEX(sale_id), INDEX(item_id)) @@ -29,7 +39,7 @@ abstract class Summary_report extends Report ON sales.sale_id = sales_items_taxes.sale_id INNER JOIN ' . $this->db->dbprefix('sales_items') . ' AS sales_items ON sales_items.sale_id = sales_items_taxes.sale_id AND sales_items.line = sales_items_taxes.line - WHERE DATE(sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']) . ' + ' . $where . ' GROUP BY sales_items_taxes.sale_id, sales_items_taxes.item_id )' ); @@ -69,7 +79,14 @@ abstract class Summary_report extends Report private function _common_where(array $inputs) { - $this->db->where('DATE(sales.sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date'])); + if(empty($this->config->item('date_or_time_format'))) + { + $this->db->where('DATE(sales.sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date'])); + } + else + { + $this->db->where('sales.sale_time BETWEEN ' . $this->db->escape(rawurldecode($inputs['start_date'])) . ' AND ' . $this->db->escape(rawurldecode($inputs['end_date']))); + } if($inputs['location_id'] != 'all') { diff --git a/application/models/reports/Summary_taxes.php b/application/models/reports/Summary_taxes.php index ff869cf03..7dbafe6f9 100644 --- a/application/models/reports/Summary_taxes.php +++ b/application/models/reports/Summary_taxes.php @@ -21,20 +21,29 @@ class Summary_taxes extends Summary_report public function getData(array $inputs) { - $quantity_cond = ''; + $where = ''; + + if(empty($this->config->item('date_or_time_format'))) + { + $where .= 'WHERE DATE(sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']); + } + else + { + $where .= 'WHERE sale_time BETWEEN ' . $this->db->escape(rawurldecode($inputs['start_date'])) . ' AND ' . $this->db->escape(rawurldecode($inputs['end_date'])); + } if($inputs['sale_type'] == 'sales') { - $quantity_cond = 'AND quantity_purchased > 0'; + $where = 'AND quantity_purchased > 0'; } elseif($inputs['sale_type'] == 'returns') { - $quantity_cond = 'AND quantity_purchased < 0'; + $where = 'AND quantity_purchased < 0'; } if($inputs['location_id'] != 'all') { - $quantity_cond .= 'AND item_location = '. $this->db->escape($inputs['location_id']); + $where .= 'AND item_location = '. $this->db->escape($inputs['location_id']); } if($this->config->item('tax_included')) @@ -64,7 +73,7 @@ class Summary_taxes extends Summary_report ON sales_items.sale_id = sales.sale_id LEFT OUTER JOIN ' . $this->db->dbprefix('sales_items_taxes') . ' AS sales_items_taxes ON sales_items.sale_id = sales_items_taxes.sale_id AND sales_items.item_id = sales_items_taxes.item_id AND sales_items.line = sales_items_taxes.line - WHERE DATE(sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']) . " $quantity_cond + ' . " $where ) AS temp_taxes GROUP BY percent" ); diff --git a/application/views/configs/locale_config.php b/application/views/configs/locale_config.php index 79f811261..c1f3fe537 100644 --- a/application/views/configs/locale_config.php +++ b/application/views/configs/locale_config.php @@ -262,6 +262,17 @@ +
+ lang->line('config_date_or_time_format'), 'date_or_time_format', array('class' => 'control-label col-xs-2')); ?> +
+ 'date_or_time_format', + 'id' => 'date_or_time_format', + 'value' => 'date_or_time_format', + 'checked'=>$this->config->item('date_or_time_format'))); ?> +
+
+ 'submit_form', 'id' => 'submit_form', diff --git a/application/views/partial/daterangepicker.php b/application/views/partial/daterangepicker.php index 6427e5efa..5a2e5291c 100644 --- a/application/views/partial/daterangepicker.php +++ b/application/views/partial/daterangepicker.php @@ -1,99 +1,210 @@ -lang->load("calendar"); $this->lang->load("date"); ?> +lang->load("calendar"); $this->lang->load("date"); + if(empty($this->config->item('date_or_time_format'))) + { +?> + $('#daterangepicker').css("width","180"); + var start_date = ""; + var end_date = ""; -var start_date = ""; -var end_date = ""; + $('#daterangepicker').daterangepicker({ + "ranges": { + "lang->line("datepicker_today"); ?>": [ + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d"),date("Y")));?>", + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" + ], + "lang->line("datepicker_today_last_year"); ?>": [ + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d"),date("Y")-1));?>", + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y")-1)-1);?>" + ], + "lang->line("datepicker_yesterday"); ?>": [ + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")-1,date("Y")));?>", + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d"),date("Y"))-1);?>" + ], + "lang->line("datepicker_last_7"); ?>": [ + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")-6,date("Y")));?>", + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" + ], + "lang->line("datepicker_last_30"); ?>": [ + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")-29,date("Y")));?>", + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" + ], + "lang->line("datepicker_this_month"); ?>": [ + "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y")));?>", + "config->item('dateformat'), mktime(0,0,0,date("m")+1,1,date("Y"))-1);?>" + ], + "lang->line("datepicker_same_month_to_same_day_last_year"); ?>": [ + "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y")-1));?>", + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y")-1)-1);?>" + ], + "lang->line("datepicker_this_month_last_year"); ?>": [ + "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y")-1));?>", + "config->item('dateformat'), mktime(0,0,0,date("m")+1,1,date("Y")-1)-1);?>" + ], + "lang->line("datepicker_last_month"); ?>": [ + "config->item('dateformat'), mktime(0,0,0,date("m")-1,1,date("Y")));?>", + "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y"))-1);?>" + ], + "lang->line("datepicker_this_year"); ?>": [ + "config->item('dateformat'), mktime(0,0,0,1,1,date("Y")));?>", + "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y")+1)-1);?>" + ], + "lang->line("datepicker_last_year"); ?>": [ + "config->item('dateformat'), mktime(0,0,0,1,1,date("Y")-1));?>", + "config->item('dateformat'), mktime(0,0,0,1,1,date("Y"))-1);?>" + ], + "lang->line("datepicker_all_time"); ?>": [ + "config->item('dateformat'), mktime(0,0,0,01,01,2010));?>", + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" + ], + }, + "locale": { + "format": 'config->item("dateformat"))?>', + "separator": " - ", + "applyLabel": "lang->line("datepicker_apply"); ?>", + "cancelLabel": "lang->line("datepicker_cancel"); ?>", + "fromLabel": "lang->line("datepicker_from"); ?>", + "toLabel": "lang->line("datepicker_to"); ?>", + "customRangeLabel": "lang->line("datepicker_custom"); ?>", + "daysOfWeek": [ + "lang->line("cal_su"); ?>", + "lang->line("cal_mo"); ?>", + "lang->line("cal_tu"); ?>", + "lang->line("cal_we"); ?>", + "lang->line("cal_th"); ?>", + "lang->line("cal_fr"); ?>", + "lang->line("cal_sa"); ?>", + "lang->line("cal_su"); ?>" + ], + "monthNames": [ + "lang->line("cal_january"); ?>", + "lang->line("cal_february"); ?>", + "lang->line("cal_march"); ?>", + "lang->line("cal_april"); ?>", + "lang->line("cal_may"); ?>", + "lang->line("cal_june"); ?>", + "lang->line("cal_july"); ?>", + "lang->line("cal_august"); ?>", + "lang->line("cal_september"); ?>", + "lang->line("cal_october"); ?>", + "lang->line("cal_november"); ?>", + "lang->line("cal_december"); ?>" + ], + "firstDay": lang->line("datepicker_weekstart"); ?> + }, + "alwaysShowCalendars": true, + "startDate": "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>", + "endDate": "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>", + "minDate": "config->item('dateformat'), mktime(0,0,0,01,01,2010));?>", + "maxDate": "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" + }, function(start, end, label) { + start_date = start.format('YYYY-MM-DD'); + end_date = end.format('YYYY-MM-DD'); + }); + + $('#daterangepicker').css("width","305"); + var start_date = ""; + var end_date = ""; -$('#daterangepicker').daterangepicker({ - "ranges": { - "lang->line("datepicker_today"); ?>": [ - "config->item('dateformat'), mktime(0,0,0,date("m"),date("d"),date("Y")));?>", - "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" - ], - "lang->line("datepicker_today_last_year"); ?>": [ - "config->item('dateformat'), mktime(0,0,0,date("m"),date("d"),date("Y")-1));?>", - "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y")-1)-1);?>" - ], - "lang->line("datepicker_yesterday"); ?>": [ - "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")-1,date("Y")));?>", - "config->item('dateformat'), mktime(0,0,0,date("m"),date("d"),date("Y"))-1);?>" - ], - "lang->line("datepicker_last_7"); ?>": [ - "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")-6,date("Y")));?>", - "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" - ], - "lang->line("datepicker_last_30"); ?>": [ - "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")-29,date("Y")));?>", - "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" - ], - "lang->line("datepicker_this_month"); ?>": [ - "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y")));?>", - "config->item('dateformat'), mktime(0,0,0,date("m")+1,1,date("Y"))-1);?>" - ], - "lang->line("datepicker_same_month_to_same_day_last_year"); ?>": [ - "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y")-1));?>", - "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y")-1)-1);?>" - ], - "lang->line("datepicker_this_month_last_year"); ?>": [ - "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y")-1));?>", - "config->item('dateformat'), mktime(0,0,0,date("m")+1,1,date("Y")-1)-1);?>" - ], - "lang->line("datepicker_last_month"); ?>": [ - "config->item('dateformat'), mktime(0,0,0,date("m")-1,1,date("Y")));?>", - "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y"))-1);?>" - ], - "lang->line("datepicker_this_year"); ?>": [ - "config->item('dateformat'), mktime(0,0,0,1,1,date("Y")));?>", - "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y")+1)-1);?>" - ], - "lang->line("datepicker_last_year"); ?>": [ - "config->item('dateformat'), mktime(0,0,0,1,1,date("Y")-1));?>", - "config->item('dateformat'), mktime(0,0,0,1,1,date("Y"))-1);?>" - ], - "lang->line("datepicker_all_time"); ?>": [ - "config->item('dateformat'), mktime(0,0,0,01,01,2010));?>", - "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" - ], - }, - "locale": { - "format": 'config->item("dateformat"))?>', - "separator": " - ", - "applyLabel": "lang->line("datepicker_apply"); ?>", - "cancelLabel": "lang->line("datepicker_cancel"); ?>", - "fromLabel": "lang->line("datepicker_from"); ?>", - "toLabel": "lang->line("datepicker_to"); ?>", - "customRangeLabel": "lang->line("datepicker_custom"); ?>", - "daysOfWeek": [ - "lang->line("cal_su"); ?>", - "lang->line("cal_mo"); ?>", - "lang->line("cal_tu"); ?>", - "lang->line("cal_we"); ?>", - "lang->line("cal_th"); ?>", - "lang->line("cal_fr"); ?>", - "lang->line("cal_sa"); ?>", - "lang->line("cal_su"); ?>" - ], - "monthNames": [ - "lang->line("cal_january"); ?>", - "lang->line("cal_february"); ?>", - "lang->line("cal_march"); ?>", - "lang->line("cal_april"); ?>", - "lang->line("cal_may"); ?>", - "lang->line("cal_june"); ?>", - "lang->line("cal_july"); ?>", - "lang->line("cal_august"); ?>", - "lang->line("cal_september"); ?>", - "lang->line("cal_october"); ?>", - "lang->line("cal_november"); ?>", - "lang->line("cal_december"); ?>" - ], - "firstDay": lang->line("datepicker_weekstart"); ?> - }, - "alwaysShowCalendars": true, - "startDate": "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>", - "endDate": "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>", - "minDate": "config->item('dateformat'), mktime(0,0,0,01,01,2010));?>", - "maxDate": "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>" -}, function(start, end, label) { - start_date = start.format('YYYY-MM-DD'); - end_date = end.format('YYYY-MM-DD'); -}); \ No newline at end of file + $('#daterangepicker').daterangepicker({ + "ranges": { + "lang->line("datepicker_today"); ?>": [ + "config->item('dateformat')." ".$this->config->item('timeformat'), mktime(0,0,0,date("m"),date("d"),date("Y")));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d"),date("Y"))-1);?>" + ], + "lang->line("datepicker_today_last_year"); ?>": [ + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d"),date("Y")-1));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d"),date("Y")-1)-1);?>" + ], + "lang->line("datepicker_yesterday"); ?>": [ + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")-1,date("Y")));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d")-1,date("Y"))-1);?>" + ], + "lang->line("datepicker_last_7"); ?>": [ + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")-6,date("Y")));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d"),date("Y"))-1);?>" + ], + "lang->line("datepicker_last_30"); ?>": [ + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")-29,date("Y")));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d"),date("Y"))-1);?>" + ], + "lang->line("datepicker_this_month"); ?>": [ + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y")));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m")+1,0,date("Y"))-1);?>" + ], + "lang->line("datepicker_same_month_to_same_day_last_year"); ?>": [ + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y")-1));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d"),date("Y")-1)-1);?>" + ], + "lang->line("datepicker_this_month_last_year"); ?>": [ + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y")-1));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m")+1,0,date("Y")-1)-1);?>" + ], + "lang->line("datepicker_last_month"); ?>": [ + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m")-1,1,date("Y")));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),0,date("Y"))-1);?>" + ], + "lang->line("datepicker_this_year"); ?>": [ + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,1,1,date("Y")));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),1,date("Y")+1)-1);?>" + ], + "lang->line("datepicker_last_year"); ?>": [ + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,1,1,date("Y")-1));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,1,0,date("Y"))-1);?>" + ], + "lang->line("datepicker_all_time"); ?>": [ + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,01,01,2010));?>", + "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d"),date("Y"))-1);?>" + ], + }, + "locale": { + "format": 'config->item("dateformat")." ".$this->config->item('timeformat'))?>', + "separator": " - ", + "applyLabel": "lang->line("datepicker_apply"); ?>", + "cancelLabel": "lang->line("datepicker_cancel"); ?>", + "fromLabel": "lang->line("datepicker_from"); ?>", + "toLabel": "lang->line("datepicker_to"); ?>", + "customRangeLabel": "lang->line("datepicker_custom"); ?>", + "daysOfWeek": [ + "lang->line("cal_su"); ?>", + "lang->line("cal_mo"); ?>", + "lang->line("cal_tu"); ?>", + "lang->line("cal_we"); ?>", + "lang->line("cal_th"); ?>", + "lang->line("cal_fr"); ?>", + "lang->line("cal_sa"); ?>", + "lang->line("cal_su"); ?>" + ], + "monthNames": [ + "lang->line("cal_january"); ?>", + "lang->line("cal_february"); ?>", + "lang->line("cal_march"); ?>", + "lang->line("cal_april"); ?>", + "lang->line("cal_may"); ?>", + "lang->line("cal_june"); ?>", + "lang->line("cal_july"); ?>", + "lang->line("cal_august"); ?>", + "lang->line("cal_september"); ?>", + "lang->line("cal_october"); ?>", + "lang->line("cal_november"); ?>", + "lang->line("cal_december"); ?>" + ], + "firstDay": lang->line("datepicker_weekstart"); ?> + }, + "timePicker": true, + "timePickerSeconds": true, + "alwaysShowCalendars": true, + "startDate": "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d"),date("Y")));?>", + "endDate": "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d"),date("Y"))-1);?>", + "minDate": "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,01,01,2010));?>", + "maxDate": "config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d"),date("Y"))-1);?>" + }, function(start, end, label) { + start_date = start.format('YYYY-MM-DD HH:mm:ss'); + end_date = end.format('YYYY-MM-DD HH:mm:ss'); + }); + \ No newline at end of file From ae26d9a007543025c3dff41cd7d44bd6472b7788 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 30 Nov 2016 14:40:17 -0400 Subject: [PATCH 06/63] Fixed Subtitle reports --- application/controllers/Reports.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/controllers/Reports.php b/application/controllers/Reports.php index 6ee6b280b..14199554e 100644 --- a/application/controllers/Reports.php +++ b/application/controllers/Reports.php @@ -1159,7 +1159,7 @@ class Reports extends Secure_Controller { $subtitle = ''; - if(empty($this->config->item('filter_datetime_format'))) + if(empty($this->config->item('date_or_time_format'))) { $subtitle .= date($this->config->item('dateformat'), strtotime($inputs['start_date'])) . ' - ' .date($this->config->item('dateformat'), strtotime($inputs['end_date'])); } From 31335deeea5484942f9e7d8959cac08c7df32267 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 30 Nov 2016 14:43:34 -0400 Subject: [PATCH 07/63] Add Line into LICENSE --- LICENSE | 1 + public/license/LICENSE | 1 + 2 files changed, 2 insertions(+) diff --git a/LICENSE b/LICENSE index 23f2e3264..99bc38ab5 100644 --- a/LICENSE +++ b/LICENSE @@ -11,6 +11,7 @@ Copyright (c) 2015 Aamir Shahzad (aka asakpke), RoshanTech.com Copyright (c) 2015 Toni Haryanto (aka yllumi) Copyright (c) 2016 Ramkrishna Mondal (aka RamkrishnaMondal) Copyright (c) 2016 Rinaldy@dbarber (aka rnld26) +Copyright (c) 2016 Jorge Colmenarez (aka jlctmaster), frontuari.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/public/license/LICENSE b/public/license/LICENSE index 23f2e3264..99bc38ab5 100644 --- a/public/license/LICENSE +++ b/public/license/LICENSE @@ -11,6 +11,7 @@ Copyright (c) 2015 Aamir Shahzad (aka asakpke), RoshanTech.com Copyright (c) 2015 Toni Haryanto (aka yllumi) Copyright (c) 2016 Ramkrishna Mondal (aka RamkrishnaMondal) Copyright (c) 2016 Rinaldy@dbarber (aka rnld26) +Copyright (c) 2016 Jorge Colmenarez (aka jlctmaster), frontuari.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in From 01e918e776865aa1785bce53f39605491c0a7cfd Mon Sep 17 00:00:00 2001 From: jekkos Date: Tue, 27 Dec 2016 23:59:22 +0100 Subject: [PATCH 08/63] Fix csrf refresh issue in register (#1019) --- application/views/receivings/receiving.php | 1047 ++++++++++---------- application/views/sales/register.php | 2 + 2 files changed, 527 insertions(+), 522 deletions(-) diff --git a/application/views/receivings/receiving.php b/application/views/receivings/receiving.php index 24b8d918f..a7e5044b4 100644 --- a/application/views/receivings/receiving.php +++ b/application/views/receivings/receiving.php @@ -1,522 +1,525 @@ -load->view("partial/header"); ?> - -".$error.""; -} - -if (!empty($warning)) -{ - echo "
".$warning."
"; -} - -if (isset($success)) -{ - echo "
".$success."
"; -} -?> - -
- - - - 'mode_form', 'class'=>'form-horizontal panel panel-default')); ?> -
-
    -
  • - -
  • -
  • - "$('#mode_form').submit();", 'class'=>'selectpicker show-menu-arrow', 'data-style'=>'btn-default btn-sm', 'data-width'=>'fit')); ?> -
  • - - -
  • - -
  • -
  • - "$('#mode_form').submit();", 'class'=>'selectpicker show-menu-arrow', 'data-style'=>'btn-default btn-sm', 'data-width'=>'fit')); ?> -
  • - - -
  • - -
  • -
  • - "$('#mode_form').submit();", 'class'=>'selectpicker show-menu-arrow', 'data-style'=>'btn-default btn-sm', 'data-width'=>'fit')); ?> -
  • - -
-
- - - 'add_item_form', 'class'=>'form-horizontal panel panel-default')); ?> -
-
    -
  • - -
  • -
  • - 'item', 'id'=>'item', 'class'=>'form-control input-sm', 'size'=>'50', 'tabindex'=>'1')); ?> -
  • -
  • - -
  • -
-
- - - - - - - - - - - - - - - - - - - - - - - - $item) - { - ?> - 'form-horizontal', 'id'=>'cart_'.$line)); ?> - - - - - - - - - - - - 1) - { - ?> - - - - - - - - - - - - - - - - - - - - - - - - -
lang->line('common_delete'); ?>lang->line('receivings_item_name'); ?>lang->line('receivings_cost'); ?>lang->line('receivings_quantity'); ?>lang->line('receivings_discount'); ?>lang->line('receivings_total'); ?>lang->line('receivings_update'); ?>
-
lang->line('sales_no_items_in_cart'); ?>
-
');?> -
- -
'price', 'class'=>'form-control input-sm', 'value'=>to_currency_no_money($item['price'])));?> - - - 'quantity', 'class'=>'form-control input-sm', 'value'=>to_quantity_decimals($item['quantity']))); ?>'discount', 'class'=>'form-control input-sm', 'value'=>$item['discount']));?>lang->line('receivings_update')?> >
lang->line('sales_description_abbrv').':';?> - 'description', 'class'=>'form-control input-sm', 'value'=>$item['description'])); - } - else - { - if ($item['description']!='') - { - echo $item['description']; - echo form_hidden('description',$item['description']); - } - else - { - echo $this->lang->line('sales_no_description'); - echo form_hidden('description',''); - } - } - ?> -
-
- - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
lang->line("receivings_supplier"); ?>
lang->line("receivings_supplier_email"); ?>
lang->line("receivings_supplier_address"); ?>
lang->line("receivings_supplier_location"); ?>
- -  ' . $this->lang->line('common_remove').' '.$this->lang->line('suppliers_supplier'), - array('class'=>'btn btn-danger btn-sm', 'id'=>'remove_supplier_button', 'title'=>$this->lang->line('common_remove').' '.$this->lang->line('suppliers_supplier'))); ?> - - 'select_supplier_form', 'class'=>'form-horizontal')); ?> -
- - 'supplier', 'id'=>'supplier', 'class'=>'form-control input-sm', 'value'=>$this->lang->line('receivings_start_typing_supplier_name'))); ?> - - - -
- - - - - - - - - - - - - -
lang->line('sales_total'); ?>
- - 0) - { - ?> -
- - 'finish_receiving_form', 'class'=>'form-horizontal')); ?> -
- - 'comment', 'id'=>'comment', 'class'=>'form-control input-sm', 'value'=>$comment, 'rows'=>'4')); ?> - -
 lang->line('receivings_cancel_receiving'); ?>
- -
 lang->line('receivings_complete_receiving'); ?>
-
- - - 'finish_receiving_form', 'class'=>'form-horizontal')); ?> -
- - 'comment', 'id'=>'comment', 'class'=>'form-control input-sm', 'value'=>$comment, 'rows'=>'4'));?> - - - - - - - - - - - - - - - - - - - - - - -
lang->line('receivings_print_after_sale'); ?> - 'recv_print_after_sale', 'id'=>'recv_print_after_sale', 'class'=>'checkbox', 'value'=>1, 'checked'=>$print_after_sale)); ?> -
lang->line('receivings_reference');?> - 'recv_reference', 'id'=>'recv_reference', 'class'=>'form-control input-sm', 'value'=>$reference, 'size'=>5));?> -
lang->line('sales_payment'); ?> - 'payment_types', 'class'=>'selectpicker show-menu-arrow', 'data-style'=>'btn-default btn-sm', 'data-width'=>'auto')); ?> -
lang->line('sales_amount_tendered'); ?> - 'amount_tendered', 'value'=>'', 'class'=>'form-control input-sm', 'size'=>'5')); ?> -
- -
 lang->line('receivings_cancel_receiving') ?>
- -
 lang->line('receivings_complete_receiving') ?>
-
- - -
- -
-
- - - -load->view("partial/footer"); ?> +load->view("partial/header"); ?> + +".$error.""; +} + +if (!empty($warning)) +{ + echo "
".$warning."
"; +} + +if (isset($success)) +{ + echo "
".$success."
"; +} +?> + +
+ + + + 'mode_form', 'class'=>'form-horizontal panel panel-default')); ?> +
+
    +
  • + +
  • +
  • + "$('#mode_form').submit();", 'class'=>'selectpicker show-menu-arrow', 'data-style'=>'btn-default btn-sm', 'data-width'=>'fit')); ?> +
  • + + +
  • + +
  • +
  • + "$('#mode_form').submit();", 'class'=>'selectpicker show-menu-arrow', 'data-style'=>'btn-default btn-sm', 'data-width'=>'fit')); ?> +
  • + + +
  • + +
  • +
  • + "$('#mode_form').submit();", 'class'=>'selectpicker show-menu-arrow', 'data-style'=>'btn-default btn-sm', 'data-width'=>'fit')); ?> +
  • + +
+
+ + + 'add_item_form', 'class'=>'form-horizontal panel panel-default')); ?> +
+
    +
  • + +
  • +
  • + 'item', 'id'=>'item', 'class'=>'form-control input-sm', 'size'=>'50', 'tabindex'=>'1')); ?> +
  • +
  • + +
  • +
+
+ + + + + + + + + + + + + + + + + + + + + + + + $item) + { + ?> + 'form-horizontal', 'id'=>'cart_'.$line)); ?> + + + + + + + + + + + + 1) + { + ?> + + + + + + + + + + + + + + + + + + + + + + + + +
lang->line('common_delete'); ?>lang->line('receivings_item_name'); ?>lang->line('receivings_cost'); ?>lang->line('receivings_quantity'); ?>lang->line('receivings_discount'); ?>lang->line('receivings_total'); ?>lang->line('receivings_update'); ?>
+
lang->line('sales_no_items_in_cart'); ?>
+
');?> +
+ +
'price', 'class'=>'form-control input-sm', 'value'=>to_currency_no_money($item['price'])));?> + + + 'quantity', 'class'=>'form-control input-sm', 'value'=>to_quantity_decimals($item['quantity']))); ?>'discount', 'class'=>'form-control input-sm', 'value'=>$item['discount']));?>lang->line('receivings_update')?> >
lang->line('sales_description_abbrv').':';?> + 'description', 'class'=>'form-control input-sm', 'value'=>$item['description'])); + } + else + { + if ($item['description']!='') + { + echo $item['description']; + echo form_hidden('description',$item['description']); + } + else + { + echo $this->lang->line('sales_no_description'); + echo form_hidden('description',''); + } + } + ?> +
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
lang->line("receivings_supplier"); ?>
lang->line("receivings_supplier_email"); ?>
lang->line("receivings_supplier_address"); ?>
lang->line("receivings_supplier_location"); ?>
+ +  ' . $this->lang->line('common_remove').' '.$this->lang->line('suppliers_supplier'), + array('class'=>'btn btn-danger btn-sm', 'id'=>'remove_supplier_button', 'title'=>$this->lang->line('common_remove').' '.$this->lang->line('suppliers_supplier'))); ?> + + 'select_supplier_form', 'class'=>'form-horizontal')); ?> +
+ + 'supplier', 'id'=>'supplier', 'class'=>'form-control input-sm', 'value'=>$this->lang->line('receivings_start_typing_supplier_name'))); ?> + + + +
+ + + + + + + + + + + + + +
lang->line('sales_total'); ?>
+ + 0) + { + ?> +
+ + 'finish_receiving_form', 'class'=>'form-horizontal')); ?> +
+ + 'comment', 'id'=>'comment', 'class'=>'form-control input-sm', 'value'=>$comment, 'rows'=>'4')); ?> + +
 lang->line('receivings_cancel_receiving'); ?>
+ +
 lang->line('receivings_complete_receiving'); ?>
+
+ + + 'finish_receiving_form', 'class'=>'form-horizontal')); ?> +
+ + 'comment', 'id'=>'comment', 'class'=>'form-control input-sm', 'value'=>$comment, 'rows'=>'4'));?> + + + + + + + + + + + + + + + + + + + + + + +
lang->line('receivings_print_after_sale'); ?> + 'recv_print_after_sale', 'id'=>'recv_print_after_sale', 'class'=>'checkbox', 'value'=>1, 'checked'=>$print_after_sale)); ?> +
lang->line('receivings_reference');?> + 'recv_reference', 'id'=>'recv_reference', 'class'=>'form-control input-sm', 'value'=>$reference, 'size'=>5));?> +
lang->line('sales_payment'); ?> + 'payment_types', 'class'=>'selectpicker show-menu-arrow', 'data-style'=>'btn-default btn-sm', 'data-width'=>'auto')); ?> +
lang->line('sales_amount_tendered'); ?> + 'amount_tendered', 'value'=>'', 'class'=>'form-control input-sm', 'size'=>'5')); ?> +
+ +
 lang->line('receivings_cancel_receiving') ?>
+ +
 lang->line('receivings_complete_receiving') ?>
+
+ + +
+ +
+
+ + + +load->view("partial/footer"); ?> diff --git a/application/views/sales/register.php b/application/views/sales/register.php index 50cede8c7..3b0d4fc1a 100644 --- a/application/views/sales/register.php +++ b/application/views/sales/register.php @@ -528,6 +528,7 @@ $(document).ready(function() select: function (a, ui) { $(this).val(ui.item.value); $("#add_item_form").submit(); + setup_csrf_token(); return false; } }); @@ -537,6 +538,7 @@ $(document).ready(function() $('#item').keypress(function (e) { if (e.which == 13) { $('#add_item_form').submit(); + setup_csrf_token(); return false; } }); From a8bca7681d44b70826e7bf84cfb919884e12d72e Mon Sep 17 00:00:00 2001 From: mitchel Date: Sun, 25 Dec 2016 12:55:46 +0000 Subject: [PATCH 09/63] Translated using Weblate (Dutch (Belgium)) Currently translated at 100.0% (22 of 22 strings) Translated using Weblate (Dutch (Belgium)) Currently translated at 100.0% (26 of 26 strings) Translated using Weblate (Dutch (Belgium)) Currently translated at 100.0% (66 of 66 strings) Translated using Weblate (Dutch (Belgium)) Currently translated at 100.0% (89 of 89 strings) Translated using Weblate (Dutch (Belgium)) Currently translated at 100.0% (12 of 12 strings) Translated using Weblate (Dutch (Belgium)) Currently translated at 100.0% (84 of 84 strings) Translated using Weblate (Dutch (Belgium)) Currently translated at 100.0% (117 of 117 strings) --- application/language/nl-BE/customers_lang.php | 4 ++-- application/language/nl-BE/employees_lang.php | 19 +++++++++--------- application/language/nl-BE/giftcards_lang.php | 2 +- application/language/nl-BE/items_lang.php | 2 +- application/language/nl-BE/messages_lang.php | 20 +++++++++---------- application/language/nl-BE/reports_lang.php | 8 ++++---- application/language/nl-BE/sales_lang.php | 4 ++-- 7 files changed, 30 insertions(+), 29 deletions(-) diff --git a/application/language/nl-BE/customers_lang.php b/application/language/nl-BE/customers_lang.php index 93d61dd21..74312e16b 100755 --- a/application/language/nl-BE/customers_lang.php +++ b/application/language/nl-BE/customers_lang.php @@ -6,7 +6,7 @@ $lang["customers_cannot_be_deleted"] = "De geselecteerde klanten konden niet wor $lang["customers_company_name"] = "Bedrijfsnaam"; $lang["customers_confirm_delete"] = "Bent u zeker dat u de geselecteerde klanten wil verwijderen?"; $lang["customers_customer"] = "Klant"; -$lang["customers_discount"] = "Discount"; +$lang["customers_discount"] = "Korting"; $lang["customers_error_adding_updating"] = "Fout bij het toevoegen/bewerken van een klant"; $lang["customers_new"] = "Nieuwe Klant"; $lang["customers_none_selected"] = "U hebt geen klanten geselecteerd"; @@ -15,7 +15,7 @@ $lang["customers_successful_adding"] = "Klant succesvol aangemaakt"; $lang["customers_successful_deleted"] = "Er werd(en)"; $lang["customers_successful_updating"] = "Wijzigingen klantgegevens bewaard voor "; $lang["customers_taxable"] = "Belastbaar"; -$lang["customers_total"] = "Total"; +$lang["customers_total"] = "Totaal"; $lang["customers_update"] = "Bewerk Klant"; $lang["customers_import_items_excel"] = "Import customers from Excel sheet"; $lang["customers_excel_import_failed"] = "Excel import mislukt"; diff --git a/application/language/nl-BE/employees_lang.php b/application/language/nl-BE/employees_lang.php index c3da00f98..5eda494a6 100755 --- a/application/language/nl-BE/employees_lang.php +++ b/application/language/nl-BE/employees_lang.php @@ -1,12 +1,13 @@ Date: Wed, 28 Dec 2016 01:24:47 +0100 Subject: [PATCH 10/63] Refresh csrf tokens before submit (#1019) --- application/views/receivings/receiving.php | 4 ++-- application/views/sales/register.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/application/views/receivings/receiving.php b/application/views/receivings/receiving.php index a7e5044b4..1ddd6ed72 100644 --- a/application/views/receivings/receiving.php +++ b/application/views/receivings/receiving.php @@ -414,8 +414,8 @@ $(document).ready(function() autoFocus: false, select: function (a, ui) { $(this).val(ui.item.value); - $("#add_item_form").submit(); setup_csrf_token(); + $("#add_item_form").submit(); return false; } }); @@ -424,8 +424,8 @@ $(document).ready(function() $('#item').keypress(function (e) { if (e.which == 13) { - $('#add_item_form').submit(); setup_csrf_token(); + $('#add_item_form').submit(); return false; } }); diff --git a/application/views/sales/register.php b/application/views/sales/register.php index 3b0d4fc1a..ffb50debe 100644 --- a/application/views/sales/register.php +++ b/application/views/sales/register.php @@ -527,8 +527,8 @@ $(document).ready(function() delay: 500, select: function (a, ui) { $(this).val(ui.item.value); - $("#add_item_form").submit(); setup_csrf_token(); + $("#add_item_form").submit(); return false; } }); @@ -537,8 +537,8 @@ $(document).ready(function() $('#item').keypress(function (e) { if (e.which == 13) { - $('#add_item_form').submit(); setup_csrf_token(); + $('#add_item_form').submit(); return false; } }); From 7f1c374e3d549e0be7f3a1cc47d60eafa25dbc2d Mon Sep 17 00:00:00 2001 From: jekkos Date: Wed, 28 Dec 2016 01:30:21 +0100 Subject: [PATCH 11/63] Fix date, location and sale type filtering for summary payments (#1045) --- .../models/reports/Summary_payments.php | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/application/models/reports/Summary_payments.php b/application/models/reports/Summary_payments.php index 2f8463b3f..1df4763bd 100644 --- a/application/models/reports/Summary_payments.php +++ b/application/models/reports/Summary_payments.php @@ -16,24 +16,37 @@ class Summary_payments extends Summary_report array('report_count' => $this->lang->line('reports_count')), array('amount_tendered' => $this->lang->line('sales_amount_tendered'), 'sorter' => 'number_sorter')); } - + public function getData(array $inputs) { - $this->db->select('sales_payments.payment_type, count(*) AS count, SUM(payment_amount) AS payment_amount'); - $this->db->from('sales_payments'); - $this->db->join('sales AS sales', 'sales.sale_id = sales_payments.sale_id'); + $w = 'WHERE DATE(salesx.sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']) . ' '; - $this->_where($inputs); + if (!empty($inputs['sale_type']) && $inputs['sale_type'] != 'all') + { + $w .= ' and salesx.sales_type = ' . $this->db->escape($inputs['sale_type']) . ' '; + } + + if (!empty($inputs['location']) && $inputs['location'] != 'all') + { + $w .= ' and salesx.location = ' . $this->db->escape($inputs['location']) . ' '; + } + + $sql = 'select sales_payments.payment_type, count(*) AS count, SUM(sales_payments.payment_amount) AS payment_amount + from ' . $this->db->dbprefix('sales_payments') . ' as sales_payments + join (select sales_items.sale_id, case when sum(sales_items.quantity_purchased) > 0 then \'sales\' else \'returns\' end as sales_type, sales_items.item_location as location, max(sales.sale_time) as sale_time + from ' . $this->db->dbprefix('sales_items') . ' as sales_items + join ' . $this->db->dbprefix('sales') . ' as sales + group by sales_items.sale_id, sales_items.item_location) as salesx on sales_payments.sale_id = salesx.sale_id ' + . $w + . ' group by payment_type'; + + $payments = $this->db->query($sql)->result_array(); - $this->db->group_by("payment_type"); - - $payments = $this->db->get()->result_array(); - // consider Gift Card as only one type of payment and do not show "Gift Card: 1, Gift Card: 2, etc." in the total $gift_card_count = 0; $gift_card_amount = 0; foreach($payments as $key=>$payment) - { + { if( strstr($payment['payment_type'], $this->lang->line('sales_giftcard')) != FALSE ) { $gift_card_count += $payment['count']; @@ -48,7 +61,7 @@ class Summary_payments extends Summary_report { $payments[] = array('payment_type' => $this->lang->line('sales_giftcard'), 'count' => $gift_card_count, 'payment_amount' => $gift_card_amount); } - + return $payments; } } From f3dd11e2c55cba4114fbe6fd9eba61b6caf566d4 Mon Sep 17 00:00:00 2001 From: jekkos Date: Wed, 28 Dec 2016 01:38:06 +0100 Subject: [PATCH 12/63] Stop running compose as travis seems to fail after startup? --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8a9857847..34b15172f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,10 +12,8 @@ before_install: - sudo mv docker-compose /usr/local/bin script: - docker-compose build - - docker-compose up -d env: - TAG=$(echo ${TRAVIS_BRANCH} | sed s/feature\\///) after_success: - - - '[ -n ${DOCKER_USERNAME} ] && docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" && docker tag opensourcepos_php "jekkos/opensourcepos:$TAG" && docker tag opensourcepos_sqlscript jekkos/opensourcepos:sqlscript && docker push "jekkos/opensourcepos:$TAG" && docker push jekkos/opensourcepos:sqlscript' From 744d166f58a448065bf0f6374d2ec31721edc9ff Mon Sep 17 00:00:00 2001 From: jekkos Date: Wed, 28 Dec 2016 18:12:54 +0100 Subject: [PATCH 13/63] Hook standard jquery submit function and update csrf (#1019) --- application/views/partial/header_js.php | 7 +++++++ application/views/receivings/receiving.php | 2 -- application/views/sales/register.php | 2 -- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/application/views/partial/header_js.php b/application/views/partial/header_js.php index 212a0b54d..027026944 100644 --- a/application/views/partial/header_js.php +++ b/application/views/partial/header_js.php @@ -44,6 +44,13 @@ } }); + var submit = $.fn.submit; + + $.fn.submit = function() { + setup_csrf_token(); + submit.apply(this, arguments); + }; + session_sha1 = 'session->userdata('session_sha1'); ?>'; diff --git a/application/views/receivings/receiving.php b/application/views/receivings/receiving.php index 1ddd6ed72..fd3a9fef3 100644 --- a/application/views/receivings/receiving.php +++ b/application/views/receivings/receiving.php @@ -414,7 +414,6 @@ $(document).ready(function() autoFocus: false, select: function (a, ui) { $(this).val(ui.item.value); - setup_csrf_token(); $("#add_item_form").submit(); return false; } @@ -424,7 +423,6 @@ $(document).ready(function() $('#item').keypress(function (e) { if (e.which == 13) { - setup_csrf_token(); $('#add_item_form').submit(); return false; } diff --git a/application/views/sales/register.php b/application/views/sales/register.php index ffb50debe..50cede8c7 100644 --- a/application/views/sales/register.php +++ b/application/views/sales/register.php @@ -527,7 +527,6 @@ $(document).ready(function() delay: 500, select: function (a, ui) { $(this).val(ui.item.value); - setup_csrf_token(); $("#add_item_form").submit(); return false; } @@ -537,7 +536,6 @@ $(document).ready(function() $('#item').keypress(function (e) { if (e.which == 13) { - setup_csrf_token(); $('#add_item_form').submit(); return false; } From cb907ea3039627fbf5792784f306fd8fa2f6f41a Mon Sep 17 00:00:00 2001 From: jekkos Date: Wed, 28 Dec 2016 18:36:16 +0100 Subject: [PATCH 14/63] Set apache as owner of uploads folder (#1014) --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index acac9fe93..113fd4a46 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ RUN echo -e “$(hostname -i)\t$(hostname) $(hostname).localhost” >> /etc/host WORKDIR /app COPY . /app RUN ln -s /app/*[^public] /var/www && rm -rf /var/www/html && ln -nsf /app/public /var/www/html -RUN chmod 775 /app/public/uploads +RUN chmod 775 /app/public/uploads && chown -R www-data:www-data /app/public/uploads RUN cp application/config/database.php.tmpl application/config/database.php && \ sed -i -e "s/\(localhost\)/web/g" test/ospos.js && \ From 399b997fd068b7d35ad69392456fd9aaee25f9fa Mon Sep 17 00:00:00 2001 From: jekkos Date: Wed, 28 Dec 2016 20:19:09 +0100 Subject: [PATCH 15/63] Set folder upload folder permissions to 755 (#1014) Don't load item avatar if item_pic is empty --- Dockerfile | 2 +- application/controllers/Items.php | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 113fd4a46..d536ef467 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ RUN echo -e “$(hostname -i)\t$(hostname) $(hostname).localhost” >> /etc/host WORKDIR /app COPY . /app RUN ln -s /app/*[^public] /var/www && rm -rf /var/www/html && ln -nsf /app/public /var/www/html -RUN chmod 775 /app/public/uploads && chown -R www-data:www-data /app/public/uploads +RUN chmod 755 /app/public/uploads && chown -R www-data:www-data /app/public/uploads RUN cp application/config/database.php.tmpl application/config/database.php && \ sed -i -e "s/\(localhost\)/web/g" test/ospos.js && \ diff --git a/application/controllers/Items.php b/application/controllers/Items.php index 96cf176ac..39c93e5f6 100644 --- a/application/controllers/Items.php +++ b/application/controllers/Items.php @@ -190,8 +190,11 @@ class Items extends Secure_Controller $data['selected_supplier'] = $item_info->supplier_id; $data['logo_exists'] = $item_info->pic_id != ''; - $images = glob('./uploads/item_pics/' . $item_info->pic_id . '.*'); - $data['image_path'] = sizeof($images) > 0 ? base_url($images[0]) : ''; + if (!empty($item_info->pic_id)) + { + $images = glob('./uploads/item_pics/' . $item_info->pic_id . '.*'); + $data['image_path'] = sizeof($images) > 0 ? base_url($images[0]) : ''; + } $stock_locations = $this->Stock_location->get_undeleted_all()->result_array(); foreach($stock_locations as $location) From a387a5257864a4a5fd14529040aaa01af4a03fc2 Mon Sep 17 00:00:00 2001 From: FrancescoUK Date: Fri, 30 Dec 2016 18:26:43 +0000 Subject: [PATCH 16/63] Fix Summary Reports Payments (#1045) --- .../models/reports/Summary_categories.php | 2 +- .../models/reports/Summary_customers.php | 2 +- .../models/reports/Summary_discounts.php | 2 +- .../models/reports/Summary_employees.php | 2 +- application/models/reports/Summary_items.php | 2 +- .../models/reports/Summary_payments.php | 34 +++++++------------ application/models/reports/Summary_report.php | 20 +++++------ application/models/reports/Summary_sales.php | 4 +-- .../models/reports/Summary_suppliers.php | 2 +- application/models/reports/Summary_taxes.php | 27 +++++---------- 10 files changed, 39 insertions(+), 58 deletions(-) diff --git a/application/models/reports/Summary_categories.php b/application/models/reports/Summary_categories.php index c642faab7..e7b3b7401 100644 --- a/application/models/reports/Summary_categories.php +++ b/application/models/reports/Summary_categories.php @@ -44,4 +44,4 @@ class Summary_categories extends Summary_report $this->db->order_by('category'); } } -?> \ No newline at end of file +?> diff --git a/application/models/reports/Summary_customers.php b/application/models/reports/Summary_customers.php index 3b41c1301..5a644b531 100644 --- a/application/models/reports/Summary_customers.php +++ b/application/models/reports/Summary_customers.php @@ -44,4 +44,4 @@ class Summary_customers extends Summary_report $this->db->order_by('customer_p.last_name'); } } -?> \ No newline at end of file +?> diff --git a/application/models/reports/Summary_discounts.php b/application/models/reports/Summary_discounts.php index 156f58238..338fec5b7 100644 --- a/application/models/reports/Summary_discounts.php +++ b/application/models/reports/Summary_discounts.php @@ -32,4 +32,4 @@ class Summary_discounts extends Summary_report return $this->db->get()->result_array(); } } -?> \ No newline at end of file +?> diff --git a/application/models/reports/Summary_employees.php b/application/models/reports/Summary_employees.php index 788c2b720..2e3997a1b 100644 --- a/application/models/reports/Summary_employees.php +++ b/application/models/reports/Summary_employees.php @@ -44,4 +44,4 @@ class Summary_employees extends Summary_report $this->db->order_by('employee_p.last_name'); } } -?> \ No newline at end of file +?> diff --git a/application/models/reports/Summary_items.php b/application/models/reports/Summary_items.php index c107479f4..30a57039f 100644 --- a/application/models/reports/Summary_items.php +++ b/application/models/reports/Summary_items.php @@ -44,4 +44,4 @@ class Summary_items extends Summary_report $this->db->order_by('items.name'); } } -?> \ No newline at end of file +?> diff --git a/application/models/reports/Summary_payments.php b/application/models/reports/Summary_payments.php index 1df4763bd..aae3131cc 100644 --- a/application/models/reports/Summary_payments.php +++ b/application/models/reports/Summary_payments.php @@ -17,37 +17,29 @@ class Summary_payments extends Summary_report array('amount_tendered' => $this->lang->line('sales_amount_tendered'), 'sorter' => 'number_sorter')); } + protected function _where(array $inputs) + { + $this->db->where('DATE(sales.sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date'])); + } + public function getData(array $inputs) { - $w = 'WHERE DATE(salesx.sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']) . ' '; + $this->db->select('sales_payments.payment_type, count(*) AS count, SUM(sales_payments.payment_amount) AS payment_amount'); + $this->db->from('sales_payments AS sales_payments'); + $this->db->join('sales AS sales', 'sales.sale_id = sales_payments.sale_id'); - if (!empty($inputs['sale_type']) && $inputs['sale_type'] != 'all') - { - $w .= ' and salesx.sales_type = ' . $this->db->escape($inputs['sale_type']) . ' '; - } + $this->_where($inputs); - if (!empty($inputs['location']) && $inputs['location'] != 'all') - { - $w .= ' and salesx.location = ' . $this->db->escape($inputs['location']) . ' '; - } + $this->db->group_by("payment_type"); - $sql = 'select sales_payments.payment_type, count(*) AS count, SUM(sales_payments.payment_amount) AS payment_amount - from ' . $this->db->dbprefix('sales_payments') . ' as sales_payments - join (select sales_items.sale_id, case when sum(sales_items.quantity_purchased) > 0 then \'sales\' else \'returns\' end as sales_type, sales_items.item_location as location, max(sales.sale_time) as sale_time - from ' . $this->db->dbprefix('sales_items') . ' as sales_items - join ' . $this->db->dbprefix('sales') . ' as sales - group by sales_items.sale_id, sales_items.item_location) as salesx on sales_payments.sale_id = salesx.sale_id ' - . $w - . ' group by payment_type'; - - $payments = $this->db->query($sql)->result_array(); + $payments = $this->db->get()->result_array(); // consider Gift Card as only one type of payment and do not show "Gift Card: 1, Gift Card: 2, etc." in the total $gift_card_count = 0; $gift_card_amount = 0; foreach($payments as $key=>$payment) { - if( strstr($payment['payment_type'], $this->lang->line('sales_giftcard')) != FALSE ) + if(strstr($payment['payment_type'], $this->lang->line('sales_giftcard')) != FALSE) { $gift_card_count += $payment['count']; $gift_card_amount += $payment['payment_amount']; @@ -65,4 +57,4 @@ class Summary_payments extends Summary_report return $payments; } } -?> \ No newline at end of file +?> diff --git a/application/models/reports/Summary_report.php b/application/models/reports/Summary_report.php index 1cb985372..2b02248cf 100644 --- a/application/models/reports/Summary_report.php +++ b/application/models/reports/Summary_report.php @@ -73,17 +73,17 @@ abstract class Summary_report extends Report if($inputs['location_id'] != 'all') { - $this->db->where('item_location', $inputs['location_id']); + $this->db->where('sales_items.item_location', $inputs['location_id']); } if($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } + { + $this->db->where('sales_items.quantity_purchased >= 0'); + } + elseif($inputs['sale_type'] == 'returns') + { + $this->db->where('sales_items.quantity_purchased < 0'); + } } /* @@ -129,9 +129,9 @@ abstract class Summary_report extends Report $this->_common_from(); - $this->_common_where($inputs); + $this->_where($inputs); return $this->db->get()->row_array(); } } -?> \ No newline at end of file +?> diff --git a/application/models/reports/Summary_sales.php b/application/models/reports/Summary_sales.php index db565b320..692df096d 100644 --- a/application/models/reports/Summary_sales.php +++ b/application/models/reports/Summary_sales.php @@ -26,7 +26,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 '); } @@ -37,4 +37,4 @@ class Summary_sales extends Summary_report $this->db->order_by('sale_date'); } } -?> \ No newline at end of file +?> diff --git a/application/models/reports/Summary_suppliers.php b/application/models/reports/Summary_suppliers.php index c639d626b..97b478c51 100644 --- a/application/models/reports/Summary_suppliers.php +++ b/application/models/reports/Summary_suppliers.php @@ -46,4 +46,4 @@ class Summary_suppliers extends Summary_report $this->db->order_by('supplier_p.last_name'); } } -?> \ No newline at end of file +?> diff --git a/application/models/reports/Summary_taxes.php b/application/models/reports/Summary_taxes.php index ff869cf03..45aedf837 100644 --- a/application/models/reports/Summary_taxes.php +++ b/application/models/reports/Summary_taxes.php @@ -19,24 +19,13 @@ class Summary_taxes extends Summary_report array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter')); } + protected function _where(array $inputs) + { + $this->db->where('DATE(sales.sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date'])); + } + public function getData(array $inputs) { - $quantity_cond = ''; - - if($inputs['sale_type'] == 'sales') - { - $quantity_cond = 'AND quantity_purchased > 0'; - } - elseif($inputs['sale_type'] == 'returns') - { - $quantity_cond = 'AND quantity_purchased < 0'; - } - - if($inputs['location_id'] != 'all') - { - $quantity_cond .= 'AND item_location = '. $this->db->escape($inputs['location_id']); - } - if($this->config->item('tax_included')) { $sale_total = '(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100))'; @@ -64,12 +53,12 @@ class Summary_taxes extends Summary_report ON sales_items.sale_id = sales.sale_id LEFT OUTER JOIN ' . $this->db->dbprefix('sales_items_taxes') . ' AS sales_items_taxes ON sales_items.sale_id = sales_items_taxes.sale_id AND sales_items.item_id = sales_items_taxes.item_id AND sales_items.line = sales_items_taxes.line - WHERE DATE(sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']) . " $quantity_cond + WHERE DATE(sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']) . ' ) AS temp_taxes - GROUP BY percent" + GROUP BY percent' ); return $query->result_array(); } } -?> \ No newline at end of file +?> From aae2d8ffc85718d840fd761fad121e845b60d27c Mon Sep 17 00:00:00 2001 From: FrancescoUK Date: Sat, 31 Dec 2016 20:59:38 +0000 Subject: [PATCH 17/63] Update WHATS_NEW.txt with 3.0.2 improvements --- WHATS_NEW.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/WHATS_NEW.txt b/WHATS_NEW.txt index a64171bf6..44c9436f1 100644 --- a/WHATS_NEW.txt +++ b/WHATS_NEW.txt @@ -1,9 +1,11 @@ Version 3.0.2 ----------- -+ -+ Protect Employee privacy printing just the first letter of family name ++ Fixed error when performing scans multiple times in a row ++ Fixed summary reports ++ Protect Employee privacy printing just the first letter of the family name + Updates to language translations - ++ Various Dockers support improvements ++ Minor bugfixes Version 3.0.1 ----------- From 1dba07049c139fef6610c2fe6bd607b19c057b35 Mon Sep 17 00:00:00 2001 From: jekkos Date: Thu, 19 Jan 2017 23:54:30 +0100 Subject: [PATCH 18/63] Enable jsPrint for custom receipt templates (#1070) --- application/views/partial/print_receipt.php | 114 ++++++++++---------- 1 file changed, 55 insertions(+), 59 deletions(-) diff --git a/application/views/partial/print_receipt.php b/application/views/partial/print_receipt.php index 01d17ad88..549aaea0c 100644 --- a/application/views/partial/print_receipt.php +++ b/application/views/partial/print_receipt.php @@ -1,68 +1,64 @@ - - -load->view("partial/footer"); ?> +load->view("partial/header"); ?> + +".$error.""; +} + +if (!empty($warning)) +{ + echo "
".$warning."
"; +} + +if (isset($success)) +{ + echo "
".$success."
"; +} +?> + +
+ + + + 'mode_form', 'class'=>'form-horizontal panel panel-default')); ?> +
+
    +
  • + +
  • +
  • + "$('#mode_form').submit();", 'class'=>'selectpicker show-menu-arrow', 'data-style'=>'btn-default btn-sm', 'data-width'=>'fit')); ?> +
  • + + +
  • + +
  • +
  • + "$('#mode_form').submit();", 'class'=>'selectpicker show-menu-arrow', 'data-style'=>'btn-default btn-sm', 'data-width'=>'fit')); ?> +
  • + + +
  • + +
  • +
  • + "$('#mode_form').submit();", 'class'=>'selectpicker show-menu-arrow', 'data-style'=>'btn-default btn-sm', 'data-width'=>'fit')); ?> +
  • + +
+
+ + + 'add_item_form', 'class'=>'form-horizontal panel panel-default')); ?> +
+
    +
  • + +
  • +
  • + 'item', 'id'=>'item', 'class'=>'form-control input-sm', 'size'=>'50', 'tabindex'=>'1')); ?> +
  • +
  • + +
  • +
+
+ + + + + + + + + + + + + + + + + + + + + + + + $item) + { + ?> + 'form-horizontal', 'id'=>'cart_'.$line)); ?> + + + + + + + + + + + + 1) + { + ?> + + + + + + + + + + + + + + + + + + + + + + + + +
lang->line('common_delete'); ?>lang->line('receivings_item_name'); ?>lang->line('receivings_cost'); ?>lang->line('receivings_quantity'); ?>lang->line('receivings_discount'); ?>lang->line('receivings_total'); ?>lang->line('receivings_update'); ?>
+
lang->line('sales_no_items_in_cart'); ?>
+
');?> +
+ +
'price', 'class'=>'form-control input-sm', 'value'=>to_currency_no_money($item['price'])));?> + + + 'quantity', 'class'=>'form-control input-sm', 'value'=>to_quantity_decimals($item['quantity']))); ?>'discount', 'class'=>'form-control input-sm', 'value'=>$item['discount']));?>lang->line('receivings_update')?> >
lang->line('sales_description_abbrv').':';?> + 'description', 'class'=>'form-control input-sm', 'value'=>$item['description'])); + } + else + { + if ($item['description']!='') + { + echo $item['description']; + echo form_hidden('description',$item['description']); + } + else + { + echo $this->lang->line('sales_no_description'); + echo form_hidden('description',''); + } + } + ?> +
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
lang->line("receivings_supplier"); ?>
lang->line("receivings_supplier_email"); ?>
lang->line("receivings_supplier_address"); ?>
lang->line("receivings_supplier_location"); ?>
+ +  ' . $this->lang->line('common_remove').' '.$this->lang->line('suppliers_supplier'), + array('class'=>'btn btn-danger btn-sm', 'id'=>'remove_supplier_button', 'title'=>$this->lang->line('common_remove').' '.$this->lang->line('suppliers_supplier'))); ?> + + 'select_supplier_form', 'class'=>'form-horizontal')); ?> +
+ + 'supplier', 'id'=>'supplier', 'class'=>'form-control input-sm', 'value'=>$this->lang->line('receivings_start_typing_supplier_name'))); ?> + + + +
+ + + + + + + + + + + + + +
lang->line('sales_total'); ?>
+ + 0) + { + ?> +
+ + 'finish_receiving_form', 'class'=>'form-horizontal')); ?> +
+ + 'comment', 'id'=>'comment', 'class'=>'form-control input-sm', 'value'=>$comment, 'rows'=>'4')); ?> + +
 lang->line('receivings_cancel_receiving'); ?>
+ +
 lang->line('receivings_complete_receiving'); ?>
+
+ + + 'finish_receiving_form', 'class'=>'form-horizontal')); ?> +
+ + 'comment', 'id'=>'comment', 'class'=>'form-control input-sm', 'value'=>$comment, 'rows'=>'4'));?> + + + + + + + + + + + + + + + + + + + + + + +
lang->line('receivings_print_after_sale'); ?> + 'recv_print_after_sale', 'id'=>'recv_print_after_sale', 'class'=>'checkbox', 'value'=>1, 'checked'=>$print_after_sale)); ?> +
lang->line('receivings_reference');?> + 'recv_reference', 'id'=>'recv_reference', 'class'=>'form-control input-sm', 'value'=>$reference, 'size'=>5));?> +
lang->line('sales_payment'); ?> + 'payment_types', 'class'=>'selectpicker show-menu-arrow', 'data-style'=>'btn-default btn-sm', 'data-width'=>'auto')); ?> +
lang->line('sales_amount_tendered'); ?> + 'amount_tendered', 'value'=>'', 'class'=>'form-control input-sm', 'size'=>'5')); ?> +
+ +
 lang->line('receivings_cancel_receiving') ?>
+ +
 lang->line('receivings_complete_receiving') ?>
+
+ + +
+ +
+
+ + + +load->view("partial/footer"); ?> diff --git a/application/views/sales/register.php b/application/views/sales/register.php index 50cede8c7..3b0d4fc1a 100644 --- a/application/views/sales/register.php +++ b/application/views/sales/register.php @@ -528,6 +528,7 @@ $(document).ready(function() select: function (a, ui) { $(this).val(ui.item.value); $("#add_item_form").submit(); + setup_csrf_token(); return false; } }); @@ -537,6 +538,7 @@ $(document).ready(function() $('#item').keypress(function (e) { if (e.which == 13) { $('#add_item_form').submit(); + setup_csrf_token(); return false; } }); From 57e559e67b9d69f2f7971f57302f48eaee1b712d Mon Sep 17 00:00:00 2001 From: mitchel Date: Sun, 25 Dec 2016 12:55:46 +0000 Subject: [PATCH 36/63] Translated using Weblate (Dutch (Belgium)) Currently translated at 100.0% (22 of 22 strings) Translated using Weblate (Dutch (Belgium)) Currently translated at 100.0% (26 of 26 strings) Translated using Weblate (Dutch (Belgium)) Currently translated at 100.0% (66 of 66 strings) Translated using Weblate (Dutch (Belgium)) Currently translated at 100.0% (89 of 89 strings) Translated using Weblate (Dutch (Belgium)) Currently translated at 100.0% (12 of 12 strings) Translated using Weblate (Dutch (Belgium)) Currently translated at 100.0% (84 of 84 strings) Translated using Weblate (Dutch (Belgium)) Currently translated at 100.0% (117 of 117 strings) --- application/language/nl-BE/customers_lang.php | 4 ++-- application/language/nl-BE/employees_lang.php | 19 +++++++++--------- application/language/nl-BE/giftcards_lang.php | 2 +- application/language/nl-BE/items_lang.php | 2 +- application/language/nl-BE/messages_lang.php | 20 +++++++++---------- application/language/nl-BE/reports_lang.php | 8 ++++---- application/language/nl-BE/sales_lang.php | 4 ++-- 7 files changed, 30 insertions(+), 29 deletions(-) diff --git a/application/language/nl-BE/customers_lang.php b/application/language/nl-BE/customers_lang.php index 93d61dd21..74312e16b 100755 --- a/application/language/nl-BE/customers_lang.php +++ b/application/language/nl-BE/customers_lang.php @@ -6,7 +6,7 @@ $lang["customers_cannot_be_deleted"] = "De geselecteerde klanten konden niet wor $lang["customers_company_name"] = "Bedrijfsnaam"; $lang["customers_confirm_delete"] = "Bent u zeker dat u de geselecteerde klanten wil verwijderen?"; $lang["customers_customer"] = "Klant"; -$lang["customers_discount"] = "Discount"; +$lang["customers_discount"] = "Korting"; $lang["customers_error_adding_updating"] = "Fout bij het toevoegen/bewerken van een klant"; $lang["customers_new"] = "Nieuwe Klant"; $lang["customers_none_selected"] = "U hebt geen klanten geselecteerd"; @@ -15,7 +15,7 @@ $lang["customers_successful_adding"] = "Klant succesvol aangemaakt"; $lang["customers_successful_deleted"] = "Er werd(en)"; $lang["customers_successful_updating"] = "Wijzigingen klantgegevens bewaard voor "; $lang["customers_taxable"] = "Belastbaar"; -$lang["customers_total"] = "Total"; +$lang["customers_total"] = "Totaal"; $lang["customers_update"] = "Bewerk Klant"; $lang["customers_import_items_excel"] = "Import customers from Excel sheet"; $lang["customers_excel_import_failed"] = "Excel import mislukt"; diff --git a/application/language/nl-BE/employees_lang.php b/application/language/nl-BE/employees_lang.php index c3da00f98..5eda494a6 100755 --- a/application/language/nl-BE/employees_lang.php +++ b/application/language/nl-BE/employees_lang.php @@ -1,12 +1,13 @@ Date: Wed, 28 Dec 2016 01:24:47 +0100 Subject: [PATCH 37/63] Refresh csrf tokens before submit (#1019) --- application/views/receivings/receiving.php | 4 ++-- application/views/sales/register.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/application/views/receivings/receiving.php b/application/views/receivings/receiving.php index a7e5044b4..1ddd6ed72 100644 --- a/application/views/receivings/receiving.php +++ b/application/views/receivings/receiving.php @@ -414,8 +414,8 @@ $(document).ready(function() autoFocus: false, select: function (a, ui) { $(this).val(ui.item.value); - $("#add_item_form").submit(); setup_csrf_token(); + $("#add_item_form").submit(); return false; } }); @@ -424,8 +424,8 @@ $(document).ready(function() $('#item').keypress(function (e) { if (e.which == 13) { - $('#add_item_form').submit(); setup_csrf_token(); + $('#add_item_form').submit(); return false; } }); diff --git a/application/views/sales/register.php b/application/views/sales/register.php index 3b0d4fc1a..ffb50debe 100644 --- a/application/views/sales/register.php +++ b/application/views/sales/register.php @@ -527,8 +527,8 @@ $(document).ready(function() delay: 500, select: function (a, ui) { $(this).val(ui.item.value); - $("#add_item_form").submit(); setup_csrf_token(); + $("#add_item_form").submit(); return false; } }); @@ -537,8 +537,8 @@ $(document).ready(function() $('#item').keypress(function (e) { if (e.which == 13) { - $('#add_item_form').submit(); setup_csrf_token(); + $('#add_item_form').submit(); return false; } }); From bc56ee54a38875fb25549ad72dc4bbb6d9b8279d Mon Sep 17 00:00:00 2001 From: jekkos Date: Wed, 28 Dec 2016 01:30:21 +0100 Subject: [PATCH 38/63] Fix date, location and sale type filtering for summary payments (#1045) --- .../models/reports/Summary_payments.php | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/application/models/reports/Summary_payments.php b/application/models/reports/Summary_payments.php index 2f8463b3f..1df4763bd 100644 --- a/application/models/reports/Summary_payments.php +++ b/application/models/reports/Summary_payments.php @@ -16,24 +16,37 @@ class Summary_payments extends Summary_report array('report_count' => $this->lang->line('reports_count')), array('amount_tendered' => $this->lang->line('sales_amount_tendered'), 'sorter' => 'number_sorter')); } - + public function getData(array $inputs) { - $this->db->select('sales_payments.payment_type, count(*) AS count, SUM(payment_amount) AS payment_amount'); - $this->db->from('sales_payments'); - $this->db->join('sales AS sales', 'sales.sale_id = sales_payments.sale_id'); + $w = 'WHERE DATE(salesx.sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']) . ' '; - $this->_where($inputs); + if (!empty($inputs['sale_type']) && $inputs['sale_type'] != 'all') + { + $w .= ' and salesx.sales_type = ' . $this->db->escape($inputs['sale_type']) . ' '; + } + + if (!empty($inputs['location']) && $inputs['location'] != 'all') + { + $w .= ' and salesx.location = ' . $this->db->escape($inputs['location']) . ' '; + } + + $sql = 'select sales_payments.payment_type, count(*) AS count, SUM(sales_payments.payment_amount) AS payment_amount + from ' . $this->db->dbprefix('sales_payments') . ' as sales_payments + join (select sales_items.sale_id, case when sum(sales_items.quantity_purchased) > 0 then \'sales\' else \'returns\' end as sales_type, sales_items.item_location as location, max(sales.sale_time) as sale_time + from ' . $this->db->dbprefix('sales_items') . ' as sales_items + join ' . $this->db->dbprefix('sales') . ' as sales + group by sales_items.sale_id, sales_items.item_location) as salesx on sales_payments.sale_id = salesx.sale_id ' + . $w + . ' group by payment_type'; + + $payments = $this->db->query($sql)->result_array(); - $this->db->group_by("payment_type"); - - $payments = $this->db->get()->result_array(); - // consider Gift Card as only one type of payment and do not show "Gift Card: 1, Gift Card: 2, etc." in the total $gift_card_count = 0; $gift_card_amount = 0; foreach($payments as $key=>$payment) - { + { if( strstr($payment['payment_type'], $this->lang->line('sales_giftcard')) != FALSE ) { $gift_card_count += $payment['count']; @@ -48,7 +61,7 @@ class Summary_payments extends Summary_report { $payments[] = array('payment_type' => $this->lang->line('sales_giftcard'), 'count' => $gift_card_count, 'payment_amount' => $gift_card_amount); } - + return $payments; } } From 47974074ee6d7344cf82172d3fd75f5c5e52c9c5 Mon Sep 17 00:00:00 2001 From: jekkos Date: Wed, 28 Dec 2016 01:38:06 +0100 Subject: [PATCH 39/63] Stop running compose as travis seems to fail after startup? --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8a9857847..34b15172f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,10 +12,8 @@ before_install: - sudo mv docker-compose /usr/local/bin script: - docker-compose build - - docker-compose up -d env: - TAG=$(echo ${TRAVIS_BRANCH} | sed s/feature\\///) after_success: - - - '[ -n ${DOCKER_USERNAME} ] && docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" && docker tag opensourcepos_php "jekkos/opensourcepos:$TAG" && docker tag opensourcepos_sqlscript jekkos/opensourcepos:sqlscript && docker push "jekkos/opensourcepos:$TAG" && docker push jekkos/opensourcepos:sqlscript' From 9b473e415d0f3078afe049d6a7dbcb4135e17128 Mon Sep 17 00:00:00 2001 From: jekkos Date: Wed, 28 Dec 2016 18:12:54 +0100 Subject: [PATCH 40/63] Hook standard jquery submit function and update csrf (#1019) --- application/views/partial/header_js.php | 7 +++++++ application/views/receivings/receiving.php | 2 -- application/views/sales/register.php | 2 -- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/application/views/partial/header_js.php b/application/views/partial/header_js.php index 212a0b54d..027026944 100644 --- a/application/views/partial/header_js.php +++ b/application/views/partial/header_js.php @@ -44,6 +44,13 @@ } }); + var submit = $.fn.submit; + + $.fn.submit = function() { + setup_csrf_token(); + submit.apply(this, arguments); + }; + session_sha1 = 'session->userdata('session_sha1'); ?>'; diff --git a/application/views/receivings/receiving.php b/application/views/receivings/receiving.php index 1ddd6ed72..fd3a9fef3 100644 --- a/application/views/receivings/receiving.php +++ b/application/views/receivings/receiving.php @@ -414,7 +414,6 @@ $(document).ready(function() autoFocus: false, select: function (a, ui) { $(this).val(ui.item.value); - setup_csrf_token(); $("#add_item_form").submit(); return false; } @@ -424,7 +423,6 @@ $(document).ready(function() $('#item').keypress(function (e) { if (e.which == 13) { - setup_csrf_token(); $('#add_item_form').submit(); return false; } diff --git a/application/views/sales/register.php b/application/views/sales/register.php index ffb50debe..50cede8c7 100644 --- a/application/views/sales/register.php +++ b/application/views/sales/register.php @@ -527,7 +527,6 @@ $(document).ready(function() delay: 500, select: function (a, ui) { $(this).val(ui.item.value); - setup_csrf_token(); $("#add_item_form").submit(); return false; } @@ -537,7 +536,6 @@ $(document).ready(function() $('#item').keypress(function (e) { if (e.which == 13) { - setup_csrf_token(); $('#add_item_form').submit(); return false; } From 0507db6a6fc0e0257c0a6d60d103c9485894d28f Mon Sep 17 00:00:00 2001 From: jekkos Date: Wed, 28 Dec 2016 18:36:16 +0100 Subject: [PATCH 41/63] Set apache as owner of uploads folder (#1014) --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index acac9fe93..113fd4a46 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ RUN echo -e “$(hostname -i)\t$(hostname) $(hostname).localhost” >> /etc/host WORKDIR /app COPY . /app RUN ln -s /app/*[^public] /var/www && rm -rf /var/www/html && ln -nsf /app/public /var/www/html -RUN chmod 775 /app/public/uploads +RUN chmod 775 /app/public/uploads && chown -R www-data:www-data /app/public/uploads RUN cp application/config/database.php.tmpl application/config/database.php && \ sed -i -e "s/\(localhost\)/web/g" test/ospos.js && \ From feff5ff3f37965d6b2d68b842a830c4432b9d9c7 Mon Sep 17 00:00:00 2001 From: jekkos Date: Wed, 28 Dec 2016 20:19:09 +0100 Subject: [PATCH 42/63] Set folder upload folder permissions to 755 (#1014) Don't load item avatar if item_pic is empty --- Dockerfile | 2 +- application/controllers/Items.php | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 113fd4a46..d536ef467 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ RUN echo -e “$(hostname -i)\t$(hostname) $(hostname).localhost” >> /etc/host WORKDIR /app COPY . /app RUN ln -s /app/*[^public] /var/www && rm -rf /var/www/html && ln -nsf /app/public /var/www/html -RUN chmod 775 /app/public/uploads && chown -R www-data:www-data /app/public/uploads +RUN chmod 755 /app/public/uploads && chown -R www-data:www-data /app/public/uploads RUN cp application/config/database.php.tmpl application/config/database.php && \ sed -i -e "s/\(localhost\)/web/g" test/ospos.js && \ diff --git a/application/controllers/Items.php b/application/controllers/Items.php index 96cf176ac..39c93e5f6 100644 --- a/application/controllers/Items.php +++ b/application/controllers/Items.php @@ -190,8 +190,11 @@ class Items extends Secure_Controller $data['selected_supplier'] = $item_info->supplier_id; $data['logo_exists'] = $item_info->pic_id != ''; - $images = glob('./uploads/item_pics/' . $item_info->pic_id . '.*'); - $data['image_path'] = sizeof($images) > 0 ? base_url($images[0]) : ''; + if (!empty($item_info->pic_id)) + { + $images = glob('./uploads/item_pics/' . $item_info->pic_id . '.*'); + $data['image_path'] = sizeof($images) > 0 ? base_url($images[0]) : ''; + } $stock_locations = $this->Stock_location->get_undeleted_all()->result_array(); foreach($stock_locations as $location) From 1cdbee1a4255aa31673be22e88f21b1d050ec20c Mon Sep 17 00:00:00 2001 From: FrancescoUK Date: Fri, 30 Dec 2016 18:26:43 +0000 Subject: [PATCH 43/63] Fix Summary Reports Payments (#1045) --- .../models/reports/Summary_categories.php | 2 +- .../models/reports/Summary_customers.php | 2 +- .../models/reports/Summary_discounts.php | 2 +- .../models/reports/Summary_employees.php | 2 +- application/models/reports/Summary_items.php | 2 +- .../models/reports/Summary_payments.php | 34 +++++++------------ application/models/reports/Summary_report.php | 20 +++++------ application/models/reports/Summary_sales.php | 4 +-- .../models/reports/Summary_suppliers.php | 2 +- application/models/reports/Summary_taxes.php | 29 +++++++--------- 10 files changed, 44 insertions(+), 55 deletions(-) diff --git a/application/models/reports/Summary_categories.php b/application/models/reports/Summary_categories.php index c642faab7..e7b3b7401 100644 --- a/application/models/reports/Summary_categories.php +++ b/application/models/reports/Summary_categories.php @@ -44,4 +44,4 @@ class Summary_categories extends Summary_report $this->db->order_by('category'); } } -?> \ No newline at end of file +?> diff --git a/application/models/reports/Summary_customers.php b/application/models/reports/Summary_customers.php index 3b41c1301..5a644b531 100644 --- a/application/models/reports/Summary_customers.php +++ b/application/models/reports/Summary_customers.php @@ -44,4 +44,4 @@ class Summary_customers extends Summary_report $this->db->order_by('customer_p.last_name'); } } -?> \ No newline at end of file +?> diff --git a/application/models/reports/Summary_discounts.php b/application/models/reports/Summary_discounts.php index 156f58238..338fec5b7 100644 --- a/application/models/reports/Summary_discounts.php +++ b/application/models/reports/Summary_discounts.php @@ -32,4 +32,4 @@ class Summary_discounts extends Summary_report return $this->db->get()->result_array(); } } -?> \ No newline at end of file +?> diff --git a/application/models/reports/Summary_employees.php b/application/models/reports/Summary_employees.php index 788c2b720..2e3997a1b 100644 --- a/application/models/reports/Summary_employees.php +++ b/application/models/reports/Summary_employees.php @@ -44,4 +44,4 @@ class Summary_employees extends Summary_report $this->db->order_by('employee_p.last_name'); } } -?> \ No newline at end of file +?> diff --git a/application/models/reports/Summary_items.php b/application/models/reports/Summary_items.php index c107479f4..30a57039f 100644 --- a/application/models/reports/Summary_items.php +++ b/application/models/reports/Summary_items.php @@ -44,4 +44,4 @@ class Summary_items extends Summary_report $this->db->order_by('items.name'); } } -?> \ No newline at end of file +?> diff --git a/application/models/reports/Summary_payments.php b/application/models/reports/Summary_payments.php index 1df4763bd..aae3131cc 100644 --- a/application/models/reports/Summary_payments.php +++ b/application/models/reports/Summary_payments.php @@ -17,37 +17,29 @@ class Summary_payments extends Summary_report array('amount_tendered' => $this->lang->line('sales_amount_tendered'), 'sorter' => 'number_sorter')); } + protected function _where(array $inputs) + { + $this->db->where('DATE(sales.sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date'])); + } + public function getData(array $inputs) { - $w = 'WHERE DATE(salesx.sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']) . ' '; + $this->db->select('sales_payments.payment_type, count(*) AS count, SUM(sales_payments.payment_amount) AS payment_amount'); + $this->db->from('sales_payments AS sales_payments'); + $this->db->join('sales AS sales', 'sales.sale_id = sales_payments.sale_id'); - if (!empty($inputs['sale_type']) && $inputs['sale_type'] != 'all') - { - $w .= ' and salesx.sales_type = ' . $this->db->escape($inputs['sale_type']) . ' '; - } + $this->_where($inputs); - if (!empty($inputs['location']) && $inputs['location'] != 'all') - { - $w .= ' and salesx.location = ' . $this->db->escape($inputs['location']) . ' '; - } + $this->db->group_by("payment_type"); - $sql = 'select sales_payments.payment_type, count(*) AS count, SUM(sales_payments.payment_amount) AS payment_amount - from ' . $this->db->dbprefix('sales_payments') . ' as sales_payments - join (select sales_items.sale_id, case when sum(sales_items.quantity_purchased) > 0 then \'sales\' else \'returns\' end as sales_type, sales_items.item_location as location, max(sales.sale_time) as sale_time - from ' . $this->db->dbprefix('sales_items') . ' as sales_items - join ' . $this->db->dbprefix('sales') . ' as sales - group by sales_items.sale_id, sales_items.item_location) as salesx on sales_payments.sale_id = salesx.sale_id ' - . $w - . ' group by payment_type'; - - $payments = $this->db->query($sql)->result_array(); + $payments = $this->db->get()->result_array(); // consider Gift Card as only one type of payment and do not show "Gift Card: 1, Gift Card: 2, etc." in the total $gift_card_count = 0; $gift_card_amount = 0; foreach($payments as $key=>$payment) { - if( strstr($payment['payment_type'], $this->lang->line('sales_giftcard')) != FALSE ) + if(strstr($payment['payment_type'], $this->lang->line('sales_giftcard')) != FALSE) { $gift_card_count += $payment['count']; $gift_card_amount += $payment['payment_amount']; @@ -65,4 +57,4 @@ class Summary_payments extends Summary_report return $payments; } } -?> \ No newline at end of file +?> diff --git a/application/models/reports/Summary_report.php b/application/models/reports/Summary_report.php index 0c59ea55e..33773f089 100644 --- a/application/models/reports/Summary_report.php +++ b/application/models/reports/Summary_report.php @@ -90,17 +90,17 @@ abstract class Summary_report extends Report if($inputs['location_id'] != 'all') { - $this->db->where('item_location', $inputs['location_id']); + $this->db->where('sales_items.item_location', $inputs['location_id']); } if($inputs['sale_type'] == 'sales') - { - $this->db->where('quantity_purchased > 0'); - } - elseif($inputs['sale_type'] == 'returns') - { - $this->db->where('quantity_purchased < 0'); - } + { + $this->db->where('sales_items.quantity_purchased >= 0'); + } + elseif($inputs['sale_type'] == 'returns') + { + $this->db->where('sales_items.quantity_purchased < 0'); + } } /* @@ -146,9 +146,9 @@ abstract class Summary_report extends Report $this->_common_from(); - $this->_common_where($inputs); + $this->_where($inputs); return $this->db->get()->row_array(); } } -?> \ No newline at end of file +?> diff --git a/application/models/reports/Summary_sales.php b/application/models/reports/Summary_sales.php index db565b320..692df096d 100644 --- a/application/models/reports/Summary_sales.php +++ b/application/models/reports/Summary_sales.php @@ -26,7 +26,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 '); } @@ -37,4 +37,4 @@ class Summary_sales extends Summary_report $this->db->order_by('sale_date'); } } -?> \ No newline at end of file +?> diff --git a/application/models/reports/Summary_suppliers.php b/application/models/reports/Summary_suppliers.php index c639d626b..97b478c51 100644 --- a/application/models/reports/Summary_suppliers.php +++ b/application/models/reports/Summary_suppliers.php @@ -46,4 +46,4 @@ class Summary_suppliers extends Summary_report $this->db->order_by('supplier_p.last_name'); } } -?> \ No newline at end of file +?> diff --git a/application/models/reports/Summary_taxes.php b/application/models/reports/Summary_taxes.php index 7dbafe6f9..92ddbe01e 100644 --- a/application/models/reports/Summary_taxes.php +++ b/application/models/reports/Summary_taxes.php @@ -19,6 +19,18 @@ class Summary_taxes extends Summary_report array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter')); } + protected function _where(array $inputs) + { + if(empty($this->config->item('date_or_time_format'))) + { + $this->db->where('DATE(sales.sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date'])); + } + else + { + $this->db->where('sales.sale_time BETWEEN ' . $this->db->escape(rawurldecode($inputs['start_date'])) . ' AND ' . $this->db->escape(rawurldecode($inputs['end_date'])); + } + } + public function getData(array $inputs) { $where = ''; @@ -31,21 +43,6 @@ class Summary_taxes extends Summary_report { $where .= 'WHERE sale_time BETWEEN ' . $this->db->escape(rawurldecode($inputs['start_date'])) . ' AND ' . $this->db->escape(rawurldecode($inputs['end_date'])); } - - if($inputs['sale_type'] == 'sales') - { - $where = 'AND quantity_purchased > 0'; - } - elseif($inputs['sale_type'] == 'returns') - { - $where = 'AND quantity_purchased < 0'; - } - - if($inputs['location_id'] != 'all') - { - $where .= 'AND item_location = '. $this->db->escape($inputs['location_id']); - } - if($this->config->item('tax_included')) { $sale_total = '(sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100))'; @@ -81,4 +78,4 @@ class Summary_taxes extends Summary_report return $query->result_array(); } } -?> \ No newline at end of file +?> From b4023a051cc668dd7d74989597d2db49762d69f3 Mon Sep 17 00:00:00 2001 From: FrancescoUK Date: Sat, 31 Dec 2016 20:59:38 +0000 Subject: [PATCH 44/63] Update WHATS_NEW.txt with 3.0.2 improvements --- WHATS_NEW.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/WHATS_NEW.txt b/WHATS_NEW.txt index a64171bf6..44c9436f1 100644 --- a/WHATS_NEW.txt +++ b/WHATS_NEW.txt @@ -1,9 +1,11 @@ Version 3.0.2 ----------- -+ -+ Protect Employee privacy printing just the first letter of family name ++ Fixed error when performing scans multiple times in a row ++ Fixed summary reports ++ Protect Employee privacy printing just the first letter of the family name + Updates to language translations - ++ Various Dockers support improvements ++ Minor bugfixes Version 3.0.1 ----------- From 258622ec87a98774e33b46149d26dc1cff848a29 Mon Sep 17 00:00:00 2001 From: jekkos Date: Thu, 19 Jan 2017 23:54:30 +0100 Subject: [PATCH 45/63] Enable jsPrint for custom receipt templates (#1070) --- application/views/partial/print_receipt.php | 114 ++++++++++---------- 1 file changed, 55 insertions(+), 59 deletions(-) diff --git a/application/views/partial/print_receipt.php b/application/views/partial/print_receipt.php index 01d17ad88..549aaea0c 100644 --- a/application/views/partial/print_receipt.php +++ b/application/views/partial/print_receipt.php @@ -1,68 +1,64 @@ -