From e326c1dfd4a02ffd77248df47645f31db7e97f6e Mon Sep 17 00:00:00 2001 From: Jorge Colmenarez Date: Fri, 4 Nov 2016 09:32:41 -0400 Subject: [PATCH] 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