Merge pull request #3 from jlctmaster/revert-2-feature/datetime_reports

Revert "Feature/datetime reports"
This commit is contained in:
Jorge Colmenarez
2016-11-18 12:20:23 -04:00
committed by GitHub
30 changed files with 156 additions and 461 deletions

View File

@@ -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

View File

@@ -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);

View File

@@ -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();

View File

@@ -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');

View File

@@ -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;
}
}
?>

View File

@@ -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));

View File

@@ -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";

View File

@@ -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";
$lang["config_theme"] = "Tema";

View File

@@ -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))
{

View File

@@ -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,

View File

@@ -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,

View File

@@ -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')
{

View File

@@ -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')
{

View File

@@ -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')
{

View File

@@ -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');

View File

@@ -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')
{

View File

@@ -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')
{

View File

@@ -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')
{

View File

@@ -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')
{

View File

@@ -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')
{

View File

@@ -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')
{

View File

@@ -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')
{

View File

@@ -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')
{

View File

@@ -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')
{

View File

@@ -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')
{

View File

@@ -262,17 +262,6 @@
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_filter_datetime_format'), 'filter_datetime_format', array('class' => 'control-label col-xs-2')); ?>
<div class='col-xs-2'>
<?php echo form_checkbox(array(
'name' => 'filter_datetime_format',
'id' => 'filter_datetime_format',
'value' => 'filter_datetime_format',
'checked'=>$this->config->item('filter_datetime_format'))); ?>
</div>
</div>
<?php echo form_submit(array(
'name' => 'submit_form',
'id' => 'submit_form',

View File

@@ -1,60 +1,57 @@
<?php $this->lang->load("calendar"); $this->lang->load("date");
<?php $this->lang->load("calendar"); $this->lang->load("date"); ?>
if(empty($this->config->item('filter_datetime_format'))){
?>
$('#daterangepicker').css("width","200");
var start_date = "<?php echo date('Y-m-d')?>";
var end_date = "<?php echo date('Y-m-d')?>";
var start_date = "<?php echo date('Y-m-d') ?>";
var end_date = "<?php echo date('Y-m-d') ?>";
$('#daterangepicker').daterangepicker({
"ranges": {
"<?php echo $this->lang->line("datepicker_today"); ?>": [
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d"),date("Y")));?>",
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>"
"<?php echo date($this->config->item('dateformat'), mktime(0,0,0,date("m"),date("d"),date("Y")));?>",
"<?php echo date($this->config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>"
],
"<?php echo $this->lang->line("datepicker_today_last_year"); ?>": [
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d"),date("Y")-1));?>",
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y")-1)-1);?>"
"<?php echo date($this->config->item('dateformat'), mktime(0,0,0,date("m"),date("d"),date("Y")-1));?>",
"<?php echo date($this->config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y")-1)-1);?>"
],
"<?php echo $this->lang->line("datepicker_yesterday"); ?>": [
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")-1,date("Y")));?>",
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d"),date("Y"))-1);?>"
"<?php echo date($this->config->item('dateformat'), mktime(0,0,0,date("m"),date("d")-1,date("Y")));?>",
"<?php echo date($this->config->item('dateformat'), mktime(0,0,0,date("m"),date("d"),date("Y"))-1);?>"
],
"<?php echo $this->lang->line("datepicker_last_7"); ?>": [
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")-6,date("Y")));?>",
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>"
"<?php echo date($this->config->item('dateformat'), mktime(0,0,0,date("m"),date("d")-6,date("Y")));?>",
"<?php echo date($this->config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>"
],
"<?php echo $this->lang->line("datepicker_last_30"); ?>": [
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")-29,date("Y")));?>",
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>"
"<?php echo date($this->config->item('dateformat'), mktime(0,0,0,date("m"),date("d")-29,date("Y")));?>",
"<?php echo date($this->config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>"
],
"<?php echo $this->lang->line("datepicker_this_month"); ?>": [
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y")));?>",
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m")+1,1,date("Y"))-1);?>"
"<?php echo date($this->config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y")));?>",
"<?php echo date($this->config->item('dateformat'), mktime(0,0,0,date("m")+1,1,date("Y"))-1);?>"
],
"<?php echo $this->lang->line("datepicker_same_month_to_same_day_last_year"); ?>": [
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y")-1));?>",
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y")-1)-1);?>"
"<?php echo date($this->config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y")-1));?>",
"<?php echo date($this->config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y")-1)-1);?>"
],
"<?php echo $this->lang->line("datepicker_this_month_last_year"); ?>": [
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y")-1));?>",
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m")+1,1,date("Y")-1)-1);?>"
"<?php echo date($this->config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y")-1));?>",
"<?php echo date($this->config->item('dateformat'), mktime(0,0,0,date("m")+1,1,date("Y")-1)-1);?>"
],
"<?php echo $this->lang->line("datepicker_last_month"); ?>": [
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m")-1,1,date("Y")));?>",
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y"))-1);?>"
"<?php echo date($this->config->item('dateformat'), mktime(0,0,0,date("m")-1,1,date("Y")));?>",
"<?php echo date($this->config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y"))-1);?>"
],
"<?php echo $this->lang->line("datepicker_this_year"); ?>": [
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,1,1,date("Y")));?>",
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y")+1)-1);?>"
"<?php echo date($this->config->item('dateformat'), mktime(0,0,0,1,1,date("Y")));?>",
"<?php echo date($this->config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y")+1)-1);?>"
],
"<?php echo $this->lang->line("datepicker_last_year"); ?>": [
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,1,1,date("Y")-1));?>",
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,1,1,date("Y"))-1);?>"
"<?php echo date($this->config->item('dateformat'), mktime(0,0,0,1,1,date("Y")-1));?>",
"<?php echo date($this->config->item('dateformat'), mktime(0,0,0,1,1,date("Y"))-1);?>"
],
"<?php echo $this->lang->line("datepicker_all_time"); ?>": [
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,01,01,2010));?>",
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>"
"<?php echo date($this->config->item('dateformat'), mktime(0,0,0,01,01,2010));?>",
"<?php echo date($this->config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>"
],
},
"locale": {
@@ -92,118 +89,11 @@ $('#daterangepicker').daterangepicker({
"firstDay": <?php echo $this->lang->line("datepicker_weekstart"); ?>
},
"alwaysShowCalendars": true,
"startDate": "<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>",
"endDate": "<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>",
"minDate": "<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,01,01,2010));?>",
"maxDate": "<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>"
"startDate": "<?php echo date($this->config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>",
"endDate": "<?php echo date($this->config->item('dateformat'), mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>",
"minDate": "<?php echo date($this->config->item('dateformat'), mktime(0,0,0,01,01,2010));?>",
"maxDate": "<?php echo date($this->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');
});
<?php
}
else{
?>
$('#daterangepicker').css("width","300");
var start_date = "<?php echo date('Y-m-d H:i:s')?>";
var end_date = "<?php echo date('Y-m-d H:i:s')?>";
$('#daterangepicker').daterangepicker({
"ranges": {
"<?php echo $this->lang->line("datepicker_today"); ?>": [
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'), mktime(0,0,0,date("m"),date("d"),date("Y")));?>",
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d")+1,date("Y"))-1);?>"
],
"<?php echo $this->lang->line("datepicker_today_last_year"); ?>": [
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d"),date("Y")-1));?>",
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d")+1,date("Y")-1)-1);?>"
],
"<?php echo $this->lang->line("datepicker_yesterday"); ?>": [
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")-1,date("Y")));?>",
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d"),date("Y"))-1);?>"
],
"<?php echo $this->lang->line("datepicker_last_7"); ?>": [
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")-6,date("Y")));?>",
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d")+1,date("Y"))-1);?>"
],
"<?php echo $this->lang->line("datepicker_last_30"); ?>": [
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")-29,date("Y")));?>",
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d")+1,date("Y"))-1);?>"
],
"<?php echo $this->lang->line("datepicker_this_month"); ?>": [
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y")));?>",
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m")+1,1,date("Y"))-1);?>"
],
"<?php echo $this->lang->line("datepicker_same_month_to_same_day_last_year"); ?>": [
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y")-1));?>",
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d")+1,date("Y")-1)-1);?>"
],
"<?php echo $this->lang->line("datepicker_this_month_last_year"); ?>": [
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),1,date("Y")-1));?>",
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m")+1,1,date("Y")-1)-1);?>"
],
"<?php echo $this->lang->line("datepicker_last_month"); ?>": [
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m")-1,1,date("Y")));?>",
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),1,date("Y"))-1);?>"
],
"<?php echo $this->lang->line("datepicker_this_year"); ?>": [
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,1,1,date("Y")));?>",
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),1,date("Y")+1)-1);?>"
],
"<?php echo $this->lang->line("datepicker_last_year"); ?>": [
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,1,1,date("Y")-1));?>",
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,1,1,date("Y"))-1);?>"
],
"<?php echo $this->lang->line("datepicker_all_time"); ?>": [
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,01,01,2010));?>",
"<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d")+1,date("Y"))-1);?>"
],
},
"locale": {
"format": '<?php echo dateformat_momentjs($this->config->item("dateformat")." ".$this->config->item('timeformat'))?>',
"separator": " - ",
"applyLabel": "<?php echo $this->lang->line("datepicker_apply"); ?>",
"cancelLabel": "<?php echo $this->lang->line("datepicker_cancel"); ?>",
"fromLabel": "<?php echo $this->lang->line("datepicker_from"); ?>",
"toLabel": "<?php echo $this->lang->line("datepicker_to"); ?>",
"customRangeLabel": "<?php echo $this->lang->line("datepicker_custom"); ?>",
"daysOfWeek": [
"<?php echo $this->lang->line("cal_su"); ?>",
"<?php echo $this->lang->line("cal_mo"); ?>",
"<?php echo $this->lang->line("cal_tu"); ?>",
"<?php echo $this->lang->line("cal_we"); ?>",
"<?php echo $this->lang->line("cal_th"); ?>",
"<?php echo $this->lang->line("cal_fr"); ?>",
"<?php echo $this->lang->line("cal_sa"); ?>",
"<?php echo $this->lang->line("cal_su"); ?>"
],
"monthNames": [
"<?php echo $this->lang->line("cal_january"); ?>",
"<?php echo $this->lang->line("cal_february"); ?>",
"<?php echo $this->lang->line("cal_march"); ?>",
"<?php echo $this->lang->line("cal_april"); ?>",
"<?php echo $this->lang->line("cal_may"); ?>",
"<?php echo $this->lang->line("cal_june"); ?>",
"<?php echo $this->lang->line("cal_july"); ?>",
"<?php echo $this->lang->line("cal_august"); ?>",
"<?php echo $this->lang->line("cal_september"); ?>",
"<?php echo $this->lang->line("cal_october"); ?>",
"<?php echo $this->lang->line("cal_november"); ?>",
"<?php echo $this->lang->line("cal_december"); ?>"
],
"firstDay": <?php echo $this->lang->line("datepicker_weekstart"); ?>
},
"timePicker": true,
"timePickerSeconds": true,
"alwaysShowCalendars": true,
"startDate": "<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,date("m"),date("d")+1,date("Y"))-1);?>",
"endDate": "<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(23,59,59,date("m"),date("d")+1,date("Y"))-1);?>",
"minDate": "<?php echo date($this->config->item('dateformat')." ".$this->config->item('timeformat'),mktime(0,0,0,01,01,2010));?>",
"maxDate": "<?php echo date($this->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');
});
<?php
}
?>
});

View File

@@ -77,7 +77,7 @@ $(document).ready(function()
<?php $this->load->view('partial/daterangepicker'); ?>
$("#generate_report").click(function()
{
{
window.location = [window.location, start_date, end_date, $("#input_type").val() || 0, $("#location_id").val()].join("/");
});
});

View File

@@ -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');
-- --------------------------------------------------------

View File

@@ -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