diff --git a/application/controllers/Reports.php b/application/controllers/Reports.php index d2d7c0ebd..14b8458c1 100644 --- a/application/controllers/Reports.php +++ b/application/controllers/Reports.php @@ -31,25 +31,11 @@ class Reports extends Secure_area $this->load->view("reports/listing",$data); } - function _get_common_report_data() - { - $data = array(); - $data['report_date_range_simple'] = get_simple_date_ranges(); - $data['months'] = get_months(); - $data['days'] = get_days(); - $data['years'] = get_years(); - $data['selected_month']=date('n'); - $data['selected_day']=date('d'); - $data['selected_year']=date('Y'); - - return $data; - } - //Input for reports that require only a date range and an export to excel. (see routes.php to see that all summary reports route here) function date_input_excel_export() { - $data = $this->_get_common_report_data(); - $this->load->view("reports/date_input_excel_export",$data); + $data = array(); + $this->load->view("reports/date_input_excel_export", $data); } function get_detailed_sales_row($sale_id) @@ -337,7 +323,7 @@ class Reports extends Secure_area //Input for reports that require only a date range. (see routes.php to see that all graphical summary reports route here) function date_input() { - $data = $this->_get_common_report_data(); + $data = array(); $data['mode'] = 'sale'; $this->load->view("reports/date_input",$data); } @@ -345,7 +331,7 @@ class Reports extends Secure_area //Input for reports that require only a date range. (see routes.php to see that all graphical summary reports route here) function date_input_sales() { - $data = $this->_get_common_report_data(); + $data = array(); $stock_locations = $this->Stock_location->get_allowed_locations('sales'); $stock_locations['all'] = $this->lang->line('reports_all'); $data['stock_locations'] = array_reverse($stock_locations, TRUE); @@ -355,7 +341,7 @@ class Reports extends Secure_area function date_input_recv() { - $data = $this->_get_common_report_data(); + $data = array(); $stock_locations = $this->Stock_location->get_allowed_locations('receivings'); $stock_locations['all'] = $this->lang->line('reports_all'); $data['stock_locations'] = array_reverse($stock_locations, TRUE); @@ -709,7 +695,7 @@ class Reports extends Secure_area function specific_customer_input() { - $data = $this->_get_common_report_data(); + $data = array(); $data['specific_input_name'] = $this->lang->line('reports_customer'); $customers = array(); @@ -759,7 +745,7 @@ class Reports extends Secure_area function specific_employee_input() { - $data = $this->_get_common_report_data(); + $data = array(); $data['specific_input_name'] = $this->lang->line('reports_employee'); $employees = array(); @@ -809,7 +795,7 @@ class Reports extends Secure_area function specific_discount_input() { - $data = $this->_get_common_report_data(); + $data = array(); $data['specific_input_name'] = $this->lang->line('reports_discount'); $discounts = array(); diff --git a/application/helpers/report_helper.php b/application/helpers/report_helper.php index dc6ecf872..716ef7e9b 100644 --- a/application/helpers/report_helper.php +++ b/application/helpers/report_helper.php @@ -1,79 +1,4 @@ load->language('reports'); - - $today = date('Y-m-d'); - $today_last_year = date('Y-m-d', mktime(0,0,0,date("m"),date("d"),date("Y")-1)); - $yesterday = date('Y-m-d', mktime(0,0,0,date("m"),date("d")-1,date("Y"))); - $six_days_ago = date('Y-m-d', mktime(0,0,0,date("m"),date("d")-6,date("Y"))); - $start_of_this_month = date('Y-m-d', mktime(0,0,0,date("m"),1,date("Y"))); - $end_of_this_month = date('Y-m-d',strtotime('-1 second',strtotime('+1 month',strtotime(date('m').'/01/'.date('Y').' 00:00:00')))); - $start_of_this_month_last_year = date('Y-m-d', mktime(0,0,0,date("m"),1,date("Y")-1)); - $end_of_this_month_last_year = date('Y-m-d',strtotime('-1 second',strtotime('+1 month',strtotime(date('m').'/01/'.(date('Y')-1).' 00:00:00')))); - $start_of_last_month = date('Y-m-d', mktime(0,0,0,date("m")-1,1,date("Y"))); - $end_of_last_month = date('Y-m-d',strtotime('-1 second',strtotime('+1 month',strtotime((date('m') - 1).'/01/'.date('Y').' 00:00:00')))); - $start_of_this_year = date('Y-m-d', mktime(0,0,0,1,1,date("Y"))); - $end_of_this_year = date('Y-m-d', mktime(0,0,0,12,31,date("Y"))); - $start_of_last_year = date('Y-m-d', mktime(0,0,0,1,1,date("Y")-1)); - $end_of_last_year = date('Y-m-d', mktime(0,0,0,12,31,date("Y")-1)); - $start_of_time = date('Y-m-d', 0); - - return array( - $today . '/' . $today => $CI->lang->line('reports_today'), - $today_last_year . '/' . $today_last_year => $CI->lang->line('reports_today_last_year'), - $yesterday . '/' . $yesterday => $CI->lang->line('reports_yesterday'), - $six_days_ago . '/' . $today => $CI->lang->line('reports_last_7'), - $start_of_this_month . '/' . $today => $CI->lang->line('reports_this_month_to_today'), - $start_of_this_month . '/' . $end_of_this_month => $CI->lang->line('reports_this_month'), - $start_of_this_month_last_year . '/' . $today_last_year => $CI->lang->line('reports_this_month_to_today_last_year'), - $start_of_this_month_last_year . '/' . $end_of_this_month_last_year => $CI->lang->line('reports_this_month_last_year'), - $start_of_last_month . '/' . $end_of_last_month => $CI->lang->line('reports_last_month'), - $start_of_this_year . '/' . $end_of_this_year => $CI->lang->line('reports_this_year'), - $start_of_last_year . '/' . $end_of_last_year => $CI->lang->line('reports_last_year'), - $start_of_time . '/' . $today => $CI->lang->line('reports_all_time') - ); -} - -function get_months() -{ - $months = array(); - - for($k=1;$k<=12;$k++) - { - $cur_month = mktime(0, 0, 0, $k, 1, 2000); - $months[date("m", $cur_month)] = date("M",$cur_month); - } - - return $months; -} - -function get_days() -{ - $days = array(); - - for($k=1;$k<=31;$k++) - { - $cur_day = mktime(0, 0, 0, 1, $k, 2000); - $days[date('d',$cur_day)] = date('j',$cur_day); - } - - return $days; -} - -function get_years() -{ - $years = array(); - - for($k=0;$k<10;$k++) - { - $years[date("Y")-$k] = date("Y")-$k; - } - - return $years; -} - function get_random_colors($how_many) { $colors = array(); diff --git a/application/language/de-CH/datepicker_lang.php b/application/language/de-CH/datepicker_lang.php index ddf39879e..045b2d114 100644 --- a/application/language/de-CH/datepicker_lang.php +++ b/application/language/de-CH/datepicker_lang.php @@ -47,3 +47,21 @@ $lang["datepicker_monthsshort_november"] = "Nov"; $lang["datepicker_monthsshort_december"] = "Dez"; $lang["datepicker_today"] = "Heute"; $lang["datepicker_weekstart"] = "1"; +$lang["datepicker_all_time"] = "Von Beginn weg"; +$lang["datepicker_last_7"] = "Letzte 7 Tage"; +$lang["datepicker_last_30"] = "Letzte 30 Tage"; +$lang["datepicker_last_month"] = "Letzter Monat"; +$lang["datepicker_last_year"] = "Letztes Jahr"; +$lang["datepicker_this_month"] = "Dieser Monat"; +$lang["datepicker_this_month_last_year"] = "Dieser Monat letzten Jahres"; +$lang["datepicker_this_month_to_today"] = "Dieser Monat bis heute"; +$lang["datepicker_this_month_to_today_last_year"] = "Dieser Monat bis Heute letzten Jahres"; +$lang["datepicker_this_year"] = "Dieses Jahr"; +$lang["datepicker_today"] = "Heute"; +$lang["datepicker_today_last_year"] = "Heute letzten Jahres"; +$lang["datepicker_yesterday"] = "Gestern"; +$lang["datepicker_apply"] = "Apply"; +$lang["datepicker_cancel"] = "Cancel"; +$lang["datepicker_from"] = "From"; +$lang["datepicker_to"] = "To"; +$lang["datepicker_custom"] = "Custom"; diff --git a/application/language/de-CH/reports_lang.php b/application/language/de-CH/reports_lang.php index 99f5b64a3..d487f68b0 100644 --- a/application/language/de-CH/reports_lang.php +++ b/application/language/de-CH/reports_lang.php @@ -1,7 +1,6 @@ ; +var end_date = ; + +$('#daterangepicker').daterangepicker({ + "ranges": { + "lang->line("datepicker_today"); ?>": [ + "config->item('dateformat'), time());?>", + "config->item('dateformat'), time());?>" + ], + "lang->line("datepicker_today_last_year"); ?>": [ + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d"),date("Y")-1));?>", + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d"),date("Y")-1));?>" + ], + "lang->line("datepicker_yesterday"); ?>": [ + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")-1,date("Y")));?>", + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")-1,date("Y")));?>" + ], + "lang->line("datepicker_last_7"); ?>": [ + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")-6,date("Y")));?>", + "config->item('dateformat'), time());?>" + ], + "lang->line("datepicker_last_30"); ?>": [ + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d")-29,date("Y")));?>", + "config->item('dateformat'), time());?>" + ], + "lang->line("datepicker_this_month"); ?>": [ + "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y")));?>", + "config->item('dateformat'), mktime(0,0,0,date("m")+1,1,date("Y"))-1);?>" + ], + "lang->line("datepicker_this_month_to_today_last_year"); ?>": [ + "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y")-1));?>", + "config->item('dateformat'), mktime(0,0,0,date("m"),date("d"),date("Y")-1));?>" + ], + "lang->line("datepicker_this_month_last_year"); ?>": [ + "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y")-1));?>", + "config->item('dateformat'), mktime(0,0,0,date("m")+1,1,date("Y")-1)-1);?>" + ], + "lang->line("datepicker_last_month"); ?>": [ + "config->item('dateformat'), mktime(0,0,0,date("m")-1,1,date("Y")));?>", + "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y"))-1);?>" + ], + "lang->line("datepicker_this_year"); ?>": [ + "config->item('dateformat'), mktime(0,0,0,1,1,date("Y")));?>", + "config->item('dateformat'), mktime(0,0,0,date("m"),1,date("Y")+1)-1);?>" + ], + "lang->line("datepicker_last_year"); ?>": [ + "config->item('dateformat'), mktime(0,0,0,1,1,date("Y")-1));?>", + "config->item('dateformat'), mktime(0,0,0,1,1,date("Y"))-1);?>" + ], + "lang->line("datepicker_all_time"); ?>": [ + "config->item('dateformat'), mktime(0,0,0,01,01,2010));?>", + "config->item('dateformat'), time());?>" + ], + }, + "locale": { + "format": 'config->item("dateformat"))?>', + "separator": " - ", + "applyLabel": "lang->line("datepicker_apply"); ?>", + "cancelLabel": "lang->line("datepicker_cancel"); ?>", + "fromLabel": "lang->line("datepicker_from"); ?>", + "toLabel": "lang->line("datepicker_to"); ?>", + "customRangeLabel": "lang->line("datepicker_custom"); ?>", + "daysOfWeek": [ + "lang->line("datepicker_daysmin_sunday"); ?>", + "lang->line("datepicker_daysmin_monday"); ?>", + "lang->line("datepicker_daysmin_tueday"); ?>", + "lang->line("datepicker_daysmin_wednesday"); ?>", + "lang->line("datepicker_daysmin_thursday"); ?>", + "lang->line("datepicker_daysmin_friday"); ?>", + "lang->line("datepicker_daysmin_saturday"); ?>", + "lang->line("datepicker_daysmin_sunday"); ?>" + ], + "monthNames": [ + "lang->line("datepicker_months_january"); ?>", + "lang->line("datepicker_months_february"); ?>", + "lang->line("datepicker_months_march"); ?>", + "lang->line("datepicker_months_april"); ?>", + "lang->line("datepicker_months_may"); ?>", + "lang->line("datepicker_months_june"); ?>", + "lang->line("datepicker_months_july"); ?>", + "lang->line("datepicker_months_august"); ?>", + "lang->line("datepicker_months_september"); ?>", + "lang->line("datepicker_months_october"); ?>", + "lang->line("datepicker_months_november"); ?>", + "lang->line("datepicker_months_december"); ?>" + ], + "firstDay": lang->line("datepicker_weekstart"); ?> + }, + "startDate": "config->item('dateformat'), time());?>", + "endDate": "config->item('dateformat'), time());?>", + "minDate": "config->item('dateformat'), mktime(0,0,0,01,01,2010));?>", + "maxDate": "config->item('dateformat'), time());?>" +}, function(start, end, label) { + start_date = start.format('YYYY-MM-DD'); + end_date = end.format('YYYY-MM-DD'); +}); \ No newline at end of file diff --git a/application/views/reports/date_input.php b/application/views/reports/date_input.php index c8c6a2f2d..053a01d26 100644 --- a/application/views/reports/date_input.php +++ b/application/views/reports/date_input.php @@ -1,81 +1,72 @@ load->view("partial/header"); ?> +