From 498f8a06b8b7072cebac9cf6380b743da10df511 Mon Sep 17 00:00:00 2001 From: jekkos Date: Tue, 10 May 2016 18:36:20 +0200 Subject: [PATCH] Rework url generation for excel export (#539, #540) --- application/views/reports/date_input.php | 16 +--------------- .../views/reports/date_input_excel_export.php | 6 +----- application/views/reports/excel_export.php | 8 +------- .../views/reports/inventory_summary_input.php | 8 +------- application/views/reports/specific_input.php | 14 +------------- 5 files changed, 5 insertions(+), 47 deletions(-) diff --git a/application/views/reports/date_input.php b/application/views/reports/date_input.php index 8fede009a..3747a1ed9 100644 --- a/application/views/reports/date_input.php +++ b/application/views/reports/date_input.php @@ -78,21 +78,7 @@ $(document).ready(function() $("#generate_report").click(function() { - var input_type = $("#input_type").val(); - var location_id = $("#location_id").val(); - var location = window.location + '/' + start_date + '/' + end_date; - - if (input_type) - { - location += '/' + input_type; - } - - if (location_id) - { - location += '/' + location_id; - } - - window.location = location; + window.location = [window.location, start_date, end_date, $("#input_type").val() || 0, $("#location_id").val()].join("/"); }); }); \ No newline at end of file diff --git a/application/views/reports/date_input_excel_export.php b/application/views/reports/date_input_excel_export.php index 3c2347a82..67b272e9d 100644 --- a/application/views/reports/date_input_excel_export.php +++ b/application/views/reports/date_input_excel_export.php @@ -57,11 +57,7 @@ $(document).ready(function() $("#generate_report").click(function() { - var sale_type = $("#sale_type").val(); - var location = window.location + '/' + start_date + '/' + end_date + '/' + sale_type; - location += '/' + $("input[name='export_excel']:checked").val(); - - window.location = location; + window.location = [window.location, start_date, end_date, $("#sale_type").val() || 0, $("input[name='export_excel']:checked").val()].join("/"); }); }); \ No newline at end of file diff --git a/application/views/reports/excel_export.php b/application/views/reports/excel_export.php index 101fd55f8..90b8b1386 100644 --- a/application/views/reports/excel_export.php +++ b/application/views/reports/excel_export.php @@ -39,13 +39,7 @@ $(document).ready(function() { $("#generate_report").click(function() { - var export_excel = 0; - if ($("#export_excel_yes").attr('checked')) - { - export_excel = 1; - } - - window.location = window.location+'/' + export_excel; + window.location = [window.location, $("input[name='export_excel']").val()].join("/"); }); }); \ No newline at end of file diff --git a/application/views/reports/inventory_summary_input.php b/application/views/reports/inventory_summary_input.php index 3588574ee..b2e7f0d57 100644 --- a/application/views/reports/inventory_summary_input.php +++ b/application/views/reports/inventory_summary_input.php @@ -53,13 +53,7 @@ $(document).ready(function() { $("#generate_report").click(function() { - var export_excel = 0; - if ($("#export_excel_yes").attr('checked')) - { - export_excel = 1; - } - - window.location = window.location+'/' + export_excel + '/' + $("#location_id").val() + '/' + $("#item_count").val(); + window.location = [window.location, $("input[name='export_excel']").is(':checked'), $("#location_id").val(), $("#item_count").val()].join("/"); }); }); \ No newline at end of file diff --git a/application/views/reports/specific_input.php b/application/views/reports/specific_input.php index 3d4e10913..bb59451ac 100644 --- a/application/views/reports/specific_input.php +++ b/application/views/reports/specific_input.php @@ -64,19 +64,7 @@ $(document).ready(function() $("#generate_report").click(function() { - var sale_type = $("#sale_type").val(); - var location = window.location + '/' + start_date + '/' + end_date + '/' + $('#specific_input_data').val() + '/' + sale_type; - - if ($("#export_excel_yes").attr('checked')) - { - location += '/' + 1; - } - else - { - location += '/' + 0; - } - - window.location = location; + window.location = [window.location, start_date, end_date, $('#specific_input_data').val(), $("#sale_type").val(), $("input[name='export_excel']").val()].join("/"); }); }); \ No newline at end of file