mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-03-22 17:02:09 -04:00
Merge pull request #2 from jlctmaster/feature/datetime_reports
Feature/datetime reports
This commit is contained in:
1
LICENSE
1
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
|
||||
|
||||
@@ -302,7 +302,8 @@ class Config extends Secure_Controller
|
||||
'tax_decimals' => $this->input->post('tax_decimals'),
|
||||
'quantity_decimals' => $this->input->post('quantity_decimals'),
|
||||
'country_codes' => $this->input->post('country_codes'),
|
||||
'payment_options_order' => $this->input->post('payment_options_order')
|
||||
'payment_options_order' => $this->input->post('payment_options_order'),
|
||||
'filter_datetime_format' => $this->input->post('filter_datetime_format')
|
||||
);
|
||||
|
||||
$result = $this->Appconfig->batch_save($batch_save_data);
|
||||
|
||||
@@ -56,7 +56,9 @@ class Items extends Secure_Controller
|
||||
$filledup = array_fill_keys($this->input->get('filters'), TRUE);
|
||||
$filters = array_merge($filters, $filledup);
|
||||
|
||||
$items = $this->Item->search($search, $filters, $limit, $offset, $sort, $order);
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
// Modify function search to add parameter datetime filter
|
||||
$items = $this->Item->search($search, $filters, $limit, $offset, $sort, $order, $datetime_filter);
|
||||
$total_rows = $this->Item->get_found_rows($search, $filters);
|
||||
|
||||
$data_rows = array();
|
||||
|
||||
@@ -40,6 +40,7 @@ class Login extends CI_Controller
|
||||
$this->tracking_lib->track_event('Stats', 'Tax Decimals', $this->config->item('tax_decimals'));
|
||||
$this->tracking_lib->track_event('Stats', 'Quantity Decimals', $this->config->item('quantity_decimals'));
|
||||
$this->tracking_lib->track_event('Stats', 'Invoice Enable', $this->config->item('invoice_enable'));
|
||||
$this->tracking_lib->track_event('Stats', 'Filter DateTime Format', $this->config->item('filter_datetime_format'));
|
||||
}
|
||||
|
||||
redirect('home');
|
||||
|
||||
@@ -43,7 +43,8 @@ class Reports extends Secure_Controller
|
||||
$this->load->model('reports/Summary_sales');
|
||||
$model = $this->Summary_sales;
|
||||
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter));
|
||||
|
||||
$tabular_data = array();
|
||||
foreach($report_data as $row)
|
||||
@@ -60,10 +61,10 @@ class Reports extends Secure_Controller
|
||||
|
||||
$data = array(
|
||||
'title' => $this->lang->line('reports_sales_summary_report'),
|
||||
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
'subtitle' => $this->_get_subtitle_report(array($start_date,$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)))
|
||||
'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)))
|
||||
);
|
||||
|
||||
$this->load->view('reports/tabular', $data);
|
||||
@@ -75,7 +76,8 @@ class Reports extends Secure_Controller
|
||||
$this->load->model('reports/Summary_categories');
|
||||
$model = $this->Summary_categories;
|
||||
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter));
|
||||
|
||||
$tabular_data = array();
|
||||
foreach($report_data as $row)
|
||||
@@ -92,10 +94,10 @@ class Reports extends Secure_Controller
|
||||
|
||||
$data = array(
|
||||
'title' => $this->lang->line('reports_categories_summary_report'),
|
||||
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
'subtitle' => $this->_get_subtitle_report(array($start_date,$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)))
|
||||
'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)))
|
||||
);
|
||||
|
||||
$this->load->view('reports/tabular', $data);
|
||||
@@ -107,7 +109,8 @@ class Reports extends Secure_Controller
|
||||
$this->load->model('reports/Summary_customers');
|
||||
$model = $this->Summary_customers;
|
||||
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter));
|
||||
|
||||
$tabular_data = array();
|
||||
foreach($report_data as $row)
|
||||
@@ -124,10 +127,10 @@ class Reports extends Secure_Controller
|
||||
|
||||
$data = array(
|
||||
'title' => $this->lang->line('reports_customers_summary_report'),
|
||||
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
'subtitle' => $this->_get_subtitle_report(array($start_date,$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)))
|
||||
'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)))
|
||||
);
|
||||
|
||||
$this->load->view('reports/tabular', $data);
|
||||
@@ -139,7 +142,8 @@ class Reports extends Secure_Controller
|
||||
$this->load->model('reports/Summary_suppliers');
|
||||
$model = $this->Summary_suppliers;
|
||||
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter));
|
||||
|
||||
$tabular_data = array();
|
||||
foreach($report_data as $row)
|
||||
@@ -156,10 +160,10 @@ class Reports extends Secure_Controller
|
||||
|
||||
$data = array(
|
||||
'title' => $this->lang->line('reports_suppliers_summary_report'),
|
||||
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
'subtitle' => $this->_get_subtitle_report(array($start_date,$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)))
|
||||
'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)))
|
||||
);
|
||||
|
||||
$this->load->view('reports/tabular', $data);
|
||||
@@ -171,7 +175,8 @@ class Reports extends Secure_Controller
|
||||
$this->load->model('reports/Summary_items');
|
||||
$model = $this->Summary_items;
|
||||
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter));
|
||||
|
||||
$tabular_data = array();
|
||||
foreach($report_data as $row)
|
||||
@@ -188,10 +193,10 @@ class Reports extends Secure_Controller
|
||||
|
||||
$data = array(
|
||||
'title' => $this->lang->line('reports_items_summary_report'),
|
||||
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
'subtitle' => $this->_get_subtitle_report(array($start_date,$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)))
|
||||
'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)))
|
||||
);
|
||||
|
||||
$this->load->view('reports/tabular', $data);
|
||||
@@ -203,7 +208,8 @@ class Reports extends Secure_Controller
|
||||
$this->load->model('reports/Summary_employees');
|
||||
$model = $this->Summary_employees;
|
||||
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter));
|
||||
|
||||
$tabular_data = array();
|
||||
foreach($report_data as $row)
|
||||
@@ -220,10 +226,10 @@ class Reports extends Secure_Controller
|
||||
|
||||
$data = array(
|
||||
'title' => $this->lang->line('reports_employees_summary_report'),
|
||||
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
'subtitle' => $this->_get_subtitle_report(array($start_date,$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)))
|
||||
'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)))
|
||||
);
|
||||
|
||||
$this->load->view('reports/tabular', $data);
|
||||
@@ -235,7 +241,8 @@ class Reports extends Secure_Controller
|
||||
$this->load->model('reports/Summary_taxes');
|
||||
$model = $this->Summary_taxes;
|
||||
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter));
|
||||
|
||||
$tabular_data = array();
|
||||
foreach($report_data as $row)
|
||||
@@ -250,10 +257,10 @@ class Reports extends Secure_Controller
|
||||
|
||||
$data = array(
|
||||
'title' => $this->lang->line('reports_taxes_summary_report'),
|
||||
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
'subtitle' => $this->_get_subtitle_report(array($start_date,$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)))
|
||||
'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)))
|
||||
);
|
||||
|
||||
$this->load->view('reports/tabular', $data);
|
||||
@@ -265,7 +272,8 @@ class Reports extends Secure_Controller
|
||||
$this->load->model('reports/Summary_discounts');
|
||||
$model = $this->Summary_discounts;
|
||||
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter));
|
||||
|
||||
$tabular_data = array();
|
||||
foreach($report_data as $row)
|
||||
@@ -277,10 +285,10 @@ class Reports extends Secure_Controller
|
||||
|
||||
$data = array(
|
||||
'title' => $this->lang->line('reports_discounts_summary_report'),
|
||||
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
'subtitle' => $this->_get_subtitle_report(array($start_date,$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)))
|
||||
'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)))
|
||||
);
|
||||
|
||||
$this->load->view('reports/tabular', $data);
|
||||
@@ -292,7 +300,8 @@ class Reports extends Secure_Controller
|
||||
$this->load->model('reports/Summary_payments');
|
||||
$model = $this->Summary_payments;
|
||||
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter));
|
||||
|
||||
$tabular_data = array();
|
||||
foreach($report_data as $row)
|
||||
@@ -305,10 +314,10 @@ class Reports extends Secure_Controller
|
||||
|
||||
$data = array(
|
||||
'title' => $this->lang->line('reports_payments_summary_report'),
|
||||
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
'subtitle' => $this->_get_subtitle_report(array($start_date,$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)))
|
||||
'summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)))
|
||||
);
|
||||
|
||||
$this->load->view('reports/tabular', $data);
|
||||
@@ -354,8 +363,9 @@ class Reports extends Secure_Controller
|
||||
{
|
||||
$this->load->model('reports/Summary_sales');
|
||||
$model = $this->Summary_sales;
|
||||
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
|
||||
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter));
|
||||
|
||||
$labels = array();
|
||||
$series = array();
|
||||
@@ -370,11 +380,11 @@ class Reports extends Secure_Controller
|
||||
|
||||
$data = array(
|
||||
'title' => $this->lang->line('reports_sales_summary_report'),
|
||||
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter),
|
||||
'chart_type' => 'reports/graphs/line',
|
||||
'labels_1' => $labels,
|
||||
'series_data_1' => $series,
|
||||
'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))),
|
||||
'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))),
|
||||
'yaxis_title' => $this->lang->line('reports_revenue'),
|
||||
'xaxis_title' => $this->lang->line('reports_date'),
|
||||
'show_currency' => TRUE
|
||||
@@ -388,8 +398,9 @@ class Reports extends Secure_Controller
|
||||
{
|
||||
$this->load->model('reports/Summary_items');
|
||||
$model = $this->Summary_items;
|
||||
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
|
||||
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter));
|
||||
|
||||
$labels = array();
|
||||
$series = array();
|
||||
@@ -403,11 +414,11 @@ class Reports extends Secure_Controller
|
||||
|
||||
$data = array(
|
||||
'title' => $this->lang->line('reports_items_summary_report'),
|
||||
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter),
|
||||
'chart_type' => 'reports/graphs/hbar',
|
||||
'labels_1' => $labels,
|
||||
'series_data_1' => $series,
|
||||
'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))),
|
||||
'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))),
|
||||
'yaxis_title' => $this->lang->line('reports_items'),
|
||||
'xaxis_title' => $this->lang->line('reports_revenue'),
|
||||
'show_currency' => TRUE
|
||||
@@ -421,9 +432,10 @@ class Reports extends Secure_Controller
|
||||
{
|
||||
$this->load->model('reports/Summary_categories');
|
||||
$model = $this->Summary_categories;
|
||||
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
|
||||
$summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)));
|
||||
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter));
|
||||
$summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)));
|
||||
|
||||
$labels = array();
|
||||
$series = array();
|
||||
@@ -437,7 +449,7 @@ class Reports extends Secure_Controller
|
||||
|
||||
$data = array(
|
||||
'title' => $this->lang->line('reports_categories_summary_report'),
|
||||
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter),
|
||||
'chart_type' => 'reports/graphs/pie',
|
||||
'labels_1' => $labels,
|
||||
'series_data_1' => $series,
|
||||
@@ -453,9 +465,10 @@ class Reports extends Secure_Controller
|
||||
{
|
||||
$this->load->model('reports/Summary_suppliers');
|
||||
$model = $this->Summary_suppliers;
|
||||
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
|
||||
$summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)));
|
||||
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter));
|
||||
$summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)));
|
||||
|
||||
$labels = array();
|
||||
$series = array();
|
||||
@@ -469,7 +482,7 @@ class Reports extends Secure_Controller
|
||||
|
||||
$data = array(
|
||||
'title' => $this->lang->line('reports_suppliers_summary_report'),
|
||||
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter),
|
||||
'chart_type' => 'reports/graphs/pie',
|
||||
'labels_1' => $labels,
|
||||
'series_data_1' => $series,
|
||||
@@ -485,9 +498,10 @@ class Reports extends Secure_Controller
|
||||
{
|
||||
$this->load->model('reports/Summary_employees');
|
||||
$model = $this->Summary_employees;
|
||||
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
|
||||
$summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)));
|
||||
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter));
|
||||
$summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)));
|
||||
|
||||
$labels = array();
|
||||
$series = array();
|
||||
@@ -501,7 +515,7 @@ class Reports extends Secure_Controller
|
||||
|
||||
$data = array(
|
||||
'title' => $this->lang->line('reports_employees_summary_report'),
|
||||
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter),
|
||||
'chart_type' => 'reports/graphs/pie',
|
||||
'labels_1' => $labels,
|
||||
'series_data_1' => $series,
|
||||
@@ -517,9 +531,10 @@ class Reports extends Secure_Controller
|
||||
{
|
||||
$this->load->model('reports/Summary_taxes');
|
||||
$model = $this->Summary_taxes;
|
||||
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
|
||||
$summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)));
|
||||
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter));
|
||||
$summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)));
|
||||
|
||||
$labels = array();
|
||||
$series = array();
|
||||
@@ -533,7 +548,7 @@ class Reports extends Secure_Controller
|
||||
|
||||
$data = array(
|
||||
'title' => $this->lang->line('reports_taxes_summary_report'),
|
||||
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter),
|
||||
'chart_type' => 'reports/graphs/pie',
|
||||
'labels_1' => $labels,
|
||||
'series_data_1' => $series,
|
||||
@@ -549,8 +564,9 @@ class Reports extends Secure_Controller
|
||||
{
|
||||
$this->load->model('reports/Summary_customers');
|
||||
$model = $this->Summary_customers;
|
||||
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
|
||||
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter));
|
||||
|
||||
$labels = array();
|
||||
$series = array();
|
||||
@@ -564,11 +580,11 @@ class Reports extends Secure_Controller
|
||||
|
||||
$data = array(
|
||||
'title' => $this->lang->line('reports_customers_summary_report'),
|
||||
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter),
|
||||
'chart_type' => 'reports/graphs/hbar',
|
||||
'labels_1' => $labels,
|
||||
'series_data_1' => $series,
|
||||
'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))),
|
||||
'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))),
|
||||
'yaxis_title' => $this->lang->line('reports_customers'),
|
||||
'xaxis_title' => $this->lang->line('reports_revenue'),
|
||||
'show_currency' => TRUE
|
||||
@@ -582,8 +598,9 @@ class Reports extends Secure_Controller
|
||||
{
|
||||
$this->load->model('reports/Summary_discounts');
|
||||
$model = $this->Summary_discounts;
|
||||
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
|
||||
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter));
|
||||
|
||||
$labels = array();
|
||||
$series = array();
|
||||
@@ -597,11 +614,11 @@ class Reports extends Secure_Controller
|
||||
|
||||
$data = array(
|
||||
'title' => $this->lang->line('reports_discounts_summary_report'),
|
||||
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter),
|
||||
'chart_type' => 'reports/graphs/bar',
|
||||
'labels_1' => $labels,
|
||||
'series_data_1' => $series,
|
||||
'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id))),
|
||||
'summary_data_1' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter))),
|
||||
'yaxis_title' => $this->lang->line('reports_count'),
|
||||
'xaxis_title' => $this->lang->line('reports_discount_percent'),
|
||||
'show_currency' => FALSE
|
||||
@@ -615,9 +632,10 @@ class Reports extends Secure_Controller
|
||||
{
|
||||
$this->load->model('reports/Summary_payments');
|
||||
$model = $this->Summary_payments;
|
||||
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
|
||||
$summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)));
|
||||
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter));
|
||||
$summary = $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)));
|
||||
|
||||
$labels = array();
|
||||
$series = array();
|
||||
@@ -631,7 +649,7 @@ class Reports extends Secure_Controller
|
||||
|
||||
$data = array(
|
||||
'title' => $this->lang->line('reports_payments_summary_report'),
|
||||
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter),
|
||||
'chart_type' => 'reports/graphs/pie',
|
||||
'labels_1' => $labels,
|
||||
'series_data_1' => $series,
|
||||
@@ -663,7 +681,8 @@ class Reports extends Secure_Controller
|
||||
$model = $this->Specific_customer;
|
||||
|
||||
$headers = $this->xss_clean($model->getDataColumns());
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'customer_id' => $customer_id, 'sale_type' => $sale_type));
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'customer_id' => $customer_id, 'sale_type' => $sale_type, 'datetime_filter' => $datetime_filter));
|
||||
|
||||
$summary_data = array();
|
||||
$details_data = array();
|
||||
@@ -679,13 +698,14 @@ class Reports extends Secure_Controller
|
||||
}
|
||||
|
||||
$customer_info = $this->Customer->get_info($customer_id);
|
||||
|
||||
$data = array(
|
||||
'title' => $this->xss_clean($customer_info->first_name . ' ' . $customer_info->last_name . ' ' . $this->lang->line('reports_report')),
|
||||
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter),
|
||||
'headers' => $headers,
|
||||
'summary_data' => $summary_data,
|
||||
'details_data' => $details_data,
|
||||
'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'customer_id' => $customer_id, 'sale_type' => $sale_type)))
|
||||
'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'customer_id' => $customer_id, 'sale_type' => $sale_type, 'datetime_filter' => $datetime_filter)))
|
||||
);
|
||||
|
||||
$this->load->view('reports/tabular_details', $data);
|
||||
@@ -712,7 +732,8 @@ class Reports extends Secure_Controller
|
||||
$model = $this->Specific_employee;
|
||||
|
||||
$headers = $this->xss_clean($model->getDataColumns());
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'employee_id' => $employee_id, 'sale_type' => $sale_type));
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'employee_id' => $employee_id, 'sale_type' => $sale_type, 'datetime_filter' => $datetime_filter));
|
||||
|
||||
$summary_data = array();
|
||||
$details_data = array();
|
||||
@@ -728,13 +749,14 @@ class Reports extends Secure_Controller
|
||||
}
|
||||
|
||||
$employee_info = $this->Employee->get_info($employee_id);
|
||||
|
||||
$data = array(
|
||||
'title' => $this->xss_clean($employee_info->first_name . ' ' . $employee_info->last_name . ' ' . $this->lang->line('reports_report')),
|
||||
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter),
|
||||
'headers' => $headers,
|
||||
'summary_data' => $summary_data,
|
||||
'details_data' => $details_data,
|
||||
'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date,'employee_id' => $employee_id, 'sale_type' => $sale_type)))
|
||||
'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date,'employee_id' => $employee_id, 'sale_type' => $sale_type, 'datetime_filter' => $datetime_filter)))
|
||||
);
|
||||
|
||||
$this->load->view('reports/tabular_details', $data);
|
||||
@@ -763,7 +785,8 @@ class Reports extends Secure_Controller
|
||||
$model = $this->Specific_discount;
|
||||
|
||||
$headers = $this->xss_clean($model->getDataColumns());
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'discount' => $discount, 'sale_type' => $sale_type));
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'discount' => $discount, 'sale_type' => $sale_type, 'datetime_filter' => $datetime_filter));
|
||||
|
||||
$summary_data = array();
|
||||
$details_data = array();
|
||||
@@ -780,11 +803,11 @@ class Reports extends Secure_Controller
|
||||
|
||||
$data = array(
|
||||
'title' => $discount . '% ' . $this->lang->line('reports_discount') . ' ' . $this->lang->line('reports_report'),
|
||||
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter),
|
||||
'headers' => $headers,
|
||||
'summary_data' => $summary_data,
|
||||
'details_data' => $details_data,
|
||||
'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date,'discount' => $discount, 'sale_type' => $sale_type)))
|
||||
'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date,'discount' => $discount, 'sale_type' => $sale_type, 'datetime_filter' => $datetime_filter)))
|
||||
);
|
||||
|
||||
$this->load->view('reports/tabular_details', $data);
|
||||
@@ -824,7 +847,8 @@ class Reports extends Secure_Controller
|
||||
$model = $this->Detailed_sales;
|
||||
|
||||
$headers = $this->xss_clean($model->getDataColumns());
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter));
|
||||
|
||||
$summary_data = array();
|
||||
$details_data = array();
|
||||
@@ -864,12 +888,12 @@ class Reports extends Secure_Controller
|
||||
|
||||
$data = array(
|
||||
'title' => $this->lang->line('reports_detailed_sales_report'),
|
||||
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter),
|
||||
'headers' => $headers,
|
||||
'editable' => 'sales',
|
||||
'summary_data' => $summary_data,
|
||||
'details_data' => $details_data,
|
||||
'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id)))
|
||||
'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)))
|
||||
);
|
||||
|
||||
$this->load->view('reports/tabular_details', $data);
|
||||
@@ -906,7 +930,8 @@ class Reports extends Secure_Controller
|
||||
$model = $this->Detailed_receivings;
|
||||
|
||||
$headers = $this->xss_clean($model->getDataColumns());
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'receiving_type' => $receiving_type, 'location_id' => $location_id));
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
$report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'receiving_type' => $receiving_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter));
|
||||
|
||||
$summary_data = array();
|
||||
$details_data = array();
|
||||
@@ -943,12 +968,12 @@ class Reports extends Secure_Controller
|
||||
|
||||
$data = array(
|
||||
'title' => $this->lang->line('reports_detailed_receivings_report'),
|
||||
'subtitle' => date($this->config->item('dateformat'), strtotime($start_date)) . '-' . date($this->config->item('dateformat'), strtotime($end_date)),
|
||||
'subtitle' => $this->_get_subtitle_report(array($start_date,$end_date),$datetime_filter),
|
||||
'headers' => $headers,
|
||||
'editable' => 'receivings',
|
||||
'summary_data' => $summary_data,
|
||||
'details_data' => $details_data,
|
||||
'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'receiving_type' => $receiving_type, 'location_id' => $location_id)))
|
||||
'overall_summary_data' => $this->xss_clean($model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'receiving_type' => $receiving_type, 'location_id' => $location_id, 'datetime_filter' => $datetime_filter)))
|
||||
);
|
||||
|
||||
$this->load->view('reports/tabular_details', $data);
|
||||
@@ -1029,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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -78,8 +78,10 @@ class Sales extends Secure_Controller
|
||||
// check if any filter is set in the multiselect dropdown
|
||||
$filledup = array_fill_keys($this->input->get('filters'), TRUE);
|
||||
$filters = array_merge($filters, $filledup);
|
||||
|
||||
$sales = $this->Sale->search($search, $filters, $limit, $offset, $sort, $order);
|
||||
|
||||
$datetime_filter = $this->config->item('filter_datetime_format');
|
||||
// Modify function search to add parameter datetime filter
|
||||
$sales = $this->Sale->search($search, $filters, $limit, $offset, $sort, $order,$datetime_filter);
|
||||
$total_rows = $this->Sale->get_found_rows($search, $filters);
|
||||
$payments = $this->Sale->get_payments_summary($search, $filters);
|
||||
$payment_summary = $this->xss_clean(get_sales_manage_payments_summary($payments, $sales, $this));
|
||||
|
||||
@@ -182,3 +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";
|
||||
$lang["config_filter_datetime_format"] = "Filter with date/time format in reports";
|
||||
|
||||
@@ -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";
|
||||
@@ -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')
|
||||
public function search($search, $filters, $rows = 0, $limit_from = 0, $sort = 'items.name', $order = 'asc', $datetime_filter = '')
|
||||
{
|
||||
$this->db->from('items');
|
||||
$this->db->join('suppliers', 'suppliers.person_id = items.supplier_id', 'left');
|
||||
@@ -69,8 +69,10 @@ class Item extends CI_Model
|
||||
$this->db->join('item_quantities', 'item_quantities.item_id = items.item_id');
|
||||
$this->db->where('location_id', $filters['stock_location_id']);
|
||||
}
|
||||
|
||||
$this->db->where('DATE_FORMAT(trans_date, "%Y-%m-%d") BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']));
|
||||
if(empty($datetime_filter))
|
||||
$this->db->where('DATE_FORMAT(trans_date, "%Y-%m-%d") BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']));
|
||||
else
|
||||
$this->db->where('trans_date BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']));
|
||||
|
||||
if(!empty($search))
|
||||
{
|
||||
|
||||
@@ -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_id))
|
||||
' (INDEX(receiving_date), INDEX(receiving_time), INDEX(receiving_id))
|
||||
(
|
||||
SELECT
|
||||
DATE(receiving_time) AS receiving_date,
|
||||
|
||||
@@ -26,7 +26,7 @@ class Sale extends CI_Model
|
||||
/*
|
||||
Get the sales data for the takings (sales/manage) view
|
||||
*/
|
||||
public function search($search, $filters, $rows = 0, $limit_from = 0, $sort = 'sale_date', $order = 'desc')
|
||||
public function search($search, $filters, $rows = 0, $limit_from = 0, $sort = 'sale_date', $order = 'desc', $datetime_filter = '')
|
||||
{
|
||||
$this->db->select('sale_id, sale_date, sale_time, SUM(quantity_purchased) AS items_purchased,
|
||||
customer_name, customer_company_name AS company_name,
|
||||
@@ -34,8 +34,11 @@ class Sale extends CI_Model
|
||||
sale_payment_amount AS amount_tendered, SUM(total) AS amount_due, (sale_payment_amount - SUM(total)) AS change_due,
|
||||
payment_type, invoice_number');
|
||||
$this->db->from('sales_items_temp');
|
||||
|
||||
$this->db->where('sale_date BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']));
|
||||
|
||||
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']));
|
||||
|
||||
if(!empty($search))
|
||||
{
|
||||
@@ -561,7 +564,7 @@ class Sale extends CI_Model
|
||||
);
|
||||
|
||||
$this->db->query('CREATE TEMPORARY TABLE IF NOT EXISTS ' . $this->db->dbprefix('sales_items_temp') .
|
||||
' (INDEX(sale_date), INDEX(sale_id))
|
||||
' (INDEX(sale_date), INDEX(sale_time), INDEX(sale_id))
|
||||
(
|
||||
SELECT
|
||||
DATE(sales.sale_time) AS sale_date,
|
||||
|
||||
@@ -53,7 +53,11 @@ class Detailed_receivings extends Report
|
||||
$this->db->from('receivings_items_temp');
|
||||
$this->db->join('people AS employee', 'receivings_items_temp.employee_id = employee.person_id');
|
||||
$this->db->join('suppliers AS supplier', 'receivings_items_temp.supplier_id = supplier.person_id', 'left');
|
||||
$this->db->where('receiving_date BETWEEN '. $this->db->escape($inputs['start_date']). ' AND '. $this->db->escape($inputs['end_date']));
|
||||
|
||||
if(empty($inputs['datetime_filter']))
|
||||
$this->db->where("receiving_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
else
|
||||
$this->db->where("receiving_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date'])));
|
||||
|
||||
if ($inputs['location_id'] != 'all')
|
||||
{
|
||||
@@ -95,7 +99,11 @@ class Detailed_receivings extends Report
|
||||
{
|
||||
$this->db->select('SUM(total) AS total');
|
||||
$this->db->from('receivings_items_temp');
|
||||
$this->db->where('receiving_date BETWEEN '. $this->db->escape($inputs['start_date']). ' AND '. $this->db->escape($inputs['end_date']));
|
||||
|
||||
if(empty($inputs['datetime_filter']))
|
||||
$this->db->where("receiving_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
else
|
||||
$this->db->where("receiving_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date'])));
|
||||
|
||||
if ($inputs['location_id'] != 'all')
|
||||
{
|
||||
|
||||
@@ -55,7 +55,11 @@ class Detailed_sales extends Report
|
||||
{
|
||||
$this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, employee_name, customer_name, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment');
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where('sale_date BETWEEN '. $this->db->escape($inputs['start_date']). ' AND '. $this->db->escape($inputs['end_date']));
|
||||
|
||||
if(empty($inputs['datetime_filter']))
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
else
|
||||
$this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date'])));
|
||||
|
||||
if ($inputs['location_id'] != 'all')
|
||||
{
|
||||
@@ -93,7 +97,11 @@ class Detailed_sales extends Report
|
||||
{
|
||||
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where('sale_date BETWEEN '. $this->db->escape($inputs['start_date']). ' AND '. $this->db->escape($inputs['end_date']));
|
||||
|
||||
if(empty($inputs['datetime_filter']))
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
else
|
||||
$this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date'])));
|
||||
|
||||
if ($inputs['location_id'] != 'all')
|
||||
{
|
||||
|
||||
@@ -21,7 +21,13 @@ class Specific_customer extends Report
|
||||
{
|
||||
$this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, employee_name, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment');
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " AND customer_id=" . $this->db->escape($inputs['customer_id']));
|
||||
|
||||
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']);
|
||||
|
||||
if ($inputs['sale_type'] == 'sales')
|
||||
{
|
||||
@@ -54,7 +60,13 @@ class Specific_customer extends Report
|
||||
{
|
||||
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " AND customer_id=" . $this->db->escape($inputs['customer_id']));
|
||||
|
||||
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']);
|
||||
|
||||
if ($inputs['sale_type'] == 'sales')
|
||||
{
|
||||
|
||||
@@ -21,8 +21,14 @@ class Specific_discount extends Report
|
||||
{
|
||||
$this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, customer_name, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment');
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " AND discount_percent >=" . $this->db->escape($inputs['discount']));
|
||||
|
||||
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 = '.$inputs['discount']);
|
||||
|
||||
if ($inputs['sale_type'] == 'sales')
|
||||
{
|
||||
$this->db->where('quantity_purchased > 0');
|
||||
@@ -55,8 +61,15 @@ class Specific_discount extends Report
|
||||
{
|
||||
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " AND discount_percent >=" . $this->db->escape($inputs['discount']));
|
||||
|
||||
// Modify by Jorge Colmenarez 2016-11-01 21:05
|
||||
// Set DateTime filter field
|
||||
if(empty($inputs['datetime_filter']))
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
else
|
||||
$this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date'])));
|
||||
// Support for filter by Specific Discount
|
||||
$this->db->where('discount_percent = '.$inputs['discount']);
|
||||
|
||||
if ($inputs['sale_type'] == 'sales')
|
||||
{
|
||||
$this->db->where('quantity_purchased > 0');
|
||||
|
||||
@@ -21,8 +21,14 @@ class Specific_employee extends Report
|
||||
{
|
||||
$this->db->select('sale_id, sale_date, SUM(quantity_purchased) AS items_purchased, customer_name, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit, payment_type, comment');
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " AND employee_id=" . $this->db->escape($inputs['employee_id']));
|
||||
|
||||
|
||||
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']);
|
||||
|
||||
if ($inputs['sale_type'] == 'sales')
|
||||
{
|
||||
$this->db->where('quantity_purchased > 0');
|
||||
@@ -54,7 +60,13 @@ class Specific_employee extends Report
|
||||
{
|
||||
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " AND employee_id=" . $this->db->escape($inputs['employee_id']));
|
||||
|
||||
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']);
|
||||
|
||||
if ($inputs['sale_type'] == 'sales')
|
||||
{
|
||||
|
||||
@@ -19,7 +19,11 @@ class Summary_categories extends Report
|
||||
{
|
||||
$this->db->select('category, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
|
||||
if(empty($inputs['datetime_filter']))
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
else
|
||||
$this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date'])));
|
||||
|
||||
if ($inputs['location_id'] != 'all')
|
||||
{
|
||||
@@ -37,7 +41,6 @@ class Summary_categories extends Report
|
||||
|
||||
$this->db->group_by('category');
|
||||
$this->db->order_by('category');
|
||||
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
@@ -45,7 +48,11 @@ class Summary_categories extends Report
|
||||
{
|
||||
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
|
||||
if(empty($inputs['datetime_filter']))
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
else
|
||||
$this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date'])));
|
||||
|
||||
if ($inputs['location_id'] != 'all')
|
||||
{
|
||||
|
||||
@@ -19,7 +19,11 @@ class Summary_customers extends Report
|
||||
{
|
||||
$this->db->select('customer_name AS customer, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
|
||||
if(empty($inputs['datetime_filter']))
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
else
|
||||
$this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date'])));
|
||||
|
||||
if ($inputs['location_id'] != 'all')
|
||||
{
|
||||
@@ -45,7 +49,11 @@ class Summary_customers extends Report
|
||||
{
|
||||
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
|
||||
if(empty($inputs['datetime_filter']))
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
else
|
||||
$this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date'])));
|
||||
|
||||
if ($inputs['location_id'] != 'all')
|
||||
{
|
||||
|
||||
@@ -19,7 +19,12 @@ class Summary_discounts extends Report
|
||||
{
|
||||
$this->db->select('CONCAT(discount_percent, "%") AS discount_percent, count(*) AS count');
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
|
||||
if(empty($inputs['datetime_filter']))
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
else
|
||||
$this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date'])));
|
||||
|
||||
$this->db->where('discount_percent > 0');
|
||||
|
||||
if ($inputs['location_id'] != 'all')
|
||||
@@ -46,7 +51,13 @@ class Summary_discounts extends Report
|
||||
{
|
||||
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
|
||||
if(empty($inputs['datetime_filter']))
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
else
|
||||
$this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date'])));
|
||||
|
||||
$this->db->where('discount_percent > 0');
|
||||
|
||||
if ($inputs['location_id'] != 'all')
|
||||
{
|
||||
|
||||
@@ -19,7 +19,11 @@ class Summary_employees extends Report
|
||||
{
|
||||
$this->db->select('employee_name AS employee, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
|
||||
if(empty($inputs['datetime_filter']))
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
else
|
||||
$this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date'])));
|
||||
|
||||
if ($inputs['location_id'] != 'all')
|
||||
{
|
||||
@@ -45,7 +49,11 @@ class Summary_employees extends Report
|
||||
{
|
||||
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
|
||||
if(empty($inputs['datetime_filter']))
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
else
|
||||
$this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date'])));
|
||||
|
||||
if ($inputs['location_id'] != 'all')
|
||||
{
|
||||
|
||||
@@ -19,7 +19,11 @@ class Summary_items extends Report
|
||||
{
|
||||
$this->db->select('name, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
|
||||
if(empty($inputs['datetime_filter']))
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
else
|
||||
$this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date'])));
|
||||
|
||||
if ($inputs['location_id'] != 'all')
|
||||
{
|
||||
@@ -45,7 +49,11 @@ class Summary_items extends Report
|
||||
{
|
||||
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
|
||||
if(empty($inputs['datetime_filter']))
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
else
|
||||
$this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date'])));
|
||||
|
||||
if ($inputs['location_id'] != 'all')
|
||||
{
|
||||
|
||||
@@ -20,7 +20,11 @@ class Summary_payments extends Report
|
||||
$this->db->select('sales_payments.payment_type, count(*) AS count, SUM(payment_amount) AS payment_amount');
|
||||
$this->db->from('sales_payments');
|
||||
$this->db->join('sales', 'sales.sale_id=sales_payments.sale_id');
|
||||
$this->db->where("date(sale_time) BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
|
||||
if(empty($inputs['datetime_filter']))
|
||||
$this->db->where("date(sale_time) BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
else
|
||||
$this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date'])));
|
||||
|
||||
if ($inputs['location_id'] != 'all')
|
||||
{
|
||||
@@ -67,7 +71,11 @@ class Summary_payments extends Report
|
||||
{
|
||||
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
|
||||
if(empty($inputs['datetime_filter']))
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
else
|
||||
$this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date'])));
|
||||
|
||||
if ($inputs['location_id'] != 'all')
|
||||
{
|
||||
|
||||
@@ -19,7 +19,11 @@ class Summary_sales extends Report
|
||||
{
|
||||
$this->db->select('sale_date, SUM(quantity_purchased) AS quantity_purchased, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
|
||||
if(empty($inputs['datetime_filter']))
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
else
|
||||
$this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date'])));
|
||||
|
||||
if ($inputs['location_id'] != 'all')
|
||||
{
|
||||
@@ -45,7 +49,11 @@ class Summary_sales extends Report
|
||||
{
|
||||
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
|
||||
if(empty($inputs['datetime_filter']))
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
else
|
||||
$this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date'])));
|
||||
|
||||
if ($inputs['location_id'] != 'all')
|
||||
{
|
||||
|
||||
@@ -21,7 +21,11 @@ class Summary_suppliers extends Report
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->join('suppliers', 'suppliers.person_id = sales_items_temp.supplier_id');
|
||||
$this->db->join('people', 'suppliers.person_id = people.person_id');
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
|
||||
if(empty($inputs['datetime_filter']))
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
else
|
||||
$this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date'])));
|
||||
|
||||
if ($inputs['location_id'] != 'all')
|
||||
{
|
||||
@@ -49,7 +53,11 @@ class Summary_suppliers extends Report
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->join('suppliers', 'suppliers.person_id = sales_items_temp.supplier_id');
|
||||
$this->db->join('people', 'suppliers.person_id = people.person_id');
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
|
||||
if(empty($inputs['datetime_filter']))
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
else
|
||||
$this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date'])));
|
||||
|
||||
if ($inputs['location_id'] != 'all')
|
||||
{
|
||||
|
||||
@@ -47,6 +47,14 @@ 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,
|
||||
@@ -58,7 +66,7 @@ class Summary_taxes extends Report
|
||||
.$this->db->dbprefix('sales_items').'.item_id='.$this->db->dbprefix('sales_items_taxes').'.item_id'." AND "
|
||||
.$this->db->dbprefix('sales_items').'.line='.$this->db->dbprefix('sales_items_taxes').'.line'
|
||||
." JOIN ".$this->db->dbprefix('sales')." ON ".$this->db->dbprefix('sales_items_taxes').".sale_id=".$this->db->dbprefix('sales').".sale_id
|
||||
WHERE date(sale_time) BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']) . " $quantity_cond) AS temp_taxes
|
||||
$clauseWhere) AS temp_taxes
|
||||
GROUP BY percent");
|
||||
|
||||
return $query->result_array();
|
||||
@@ -68,7 +76,11 @@ class Summary_taxes extends Report
|
||||
{
|
||||
$this->db->select('SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit');
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
|
||||
if(empty($inputs['datetime_filter']))
|
||||
$this->db->where("sale_date BETWEEN " . $this->db->escape($inputs['start_date']) . " AND " . $this->db->escape($inputs['end_date']));
|
||||
else
|
||||
$this->db->where("sale_time BETWEEN " . $this->db->escape(str_replace("%20"," ", $inputs['start_date'])) . " AND " . $this->db->escape(str_replace("%20"," ", $inputs['end_date'])));
|
||||
|
||||
if ($inputs['location_id'] != 'all')
|
||||
{
|
||||
|
||||
@@ -262,6 +262,17 @@
|
||||
</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',
|
||||
|
||||
@@ -1,57 +1,60 @@
|
||||
<?php $this->lang->load("calendar"); $this->lang->load("date"); ?>
|
||||
<?php $this->lang->load("calendar"); $this->lang->load("date");
|
||||
|
||||
var start_date = "<?php echo date('Y-m-d') ?>";
|
||||
var end_date = "<?php echo date('Y-m-d') ?>";
|
||||
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')?>";
|
||||
|
||||
$('#daterangepicker').daterangepicker({
|
||||
"ranges": {
|
||||
"<?php echo $this->lang->line("datepicker_today"); ?>": [
|
||||
"<?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 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 $this->lang->line("datepicker_today_last_year"); ?>": [
|
||||
"<?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 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 $this->lang->line("datepicker_yesterday"); ?>": [
|
||||
"<?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 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 $this->lang->line("datepicker_last_7"); ?>": [
|
||||
"<?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 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 $this->lang->line("datepicker_last_30"); ?>": [
|
||||
"<?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 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 $this->lang->line("datepicker_this_month"); ?>": [
|
||||
"<?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 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 $this->lang->line("datepicker_same_month_to_same_day_last_year"); ?>": [
|
||||
"<?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 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 $this->lang->line("datepicker_this_month_last_year"); ?>": [
|
||||
"<?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 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 $this->lang->line("datepicker_last_month"); ?>": [
|
||||
"<?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 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 $this->lang->line("datepicker_this_year"); ?>": [
|
||||
"<?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 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 $this->lang->line("datepicker_last_year"); ?>": [
|
||||
"<?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 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 $this->lang->line("datepicker_all_time"); ?>": [
|
||||
"<?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);?>"
|
||||
"<?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);?>"
|
||||
],
|
||||
},
|
||||
"locale": {
|
||||
@@ -89,11 +92,118 @@ $('#daterangepicker').daterangepicker({
|
||||
"firstDay": <?php echo $this->lang->line("datepicker_weekstart"); ?>
|
||||
},
|
||||
"alwaysShowCalendars": true,
|
||||
"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);?>"
|
||||
"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);?>"
|
||||
}, 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
|
||||
}
|
||||
?>
|
||||
@@ -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("/");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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','');
|
||||
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user