From: Werner Hahn Date: Mon, 10 Sep 2018 17:43:07 +0000 (+0200) Subject: Kundenstatistik: javascript uas Templates in eigene js ausgelagert X-Git-Tag: release-3.5.4~289 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=58e28ca02c1fe93ff9db9024318d3529715bd8fb;p=kivitendo-erp.git Kundenstatistik: javascript uas Templates in eigene js ausgelagert --- diff --git a/SL/Controller/CustomerVendor.pm b/SL/Controller/CustomerVendor.pm index a380f4373..2d373c1d0 100644 --- a/SL/Controller/CustomerVendor.pm +++ b/SL/Controller/CustomerVendor.pm @@ -983,6 +983,7 @@ sub _pre_render { $::request->{layout}->add_javascripts('kivi.CustomerVendor.js'); $::request->{layout}->add_javascripts('kivi.File.js'); + $::request->{layout}->add_javascripts('kivi.CustomerVendorTurnover.js'); $self->_setup_form_action_bar; } diff --git a/js/kivi.CustomerVendorTurnover.js b/js/kivi.CustomerVendorTurnover.js new file mode 100644 index 000000000..62923bb12 --- /dev/null +++ b/js/kivi.CustomerVendorTurnover.js @@ -0,0 +1,48 @@ +namespace('kivi.CustomerVendorTurnover', function(ns) { + + ns.show_dun_stat = function(period) { + if (period === 'y') { + var url = 'controller.pl?action=CustomerVendorTurnover/count_open_items_by_year&id=' + $('#cv_id').val(); + $('#duns').load(url); + } else { + var url = 'controller.pl?action=CustomerVendorTurnover/count_open_items_by_month&id=' + $('#cv_id').val(); + $('#duns').load(url); + } + }; + + ns.get_invoices = function() { + var url = 'controller.pl?action=CustomerVendorTurnover/get_invoices&id=' + $('#cv_id').val() + '&db=' + $('#db').val(); + $('#invoices').load(url); + }; + + ns.get_sales_quotations = function() { + var url = 'controller.pl?action=CustomerVendorTurnover/get_orders&id=' + $('#cv_id').val() + '&db=' + $('#db').val() + '&type=quotation'; + $('#quotations').load(url); + }; + + ns.get_orders = function() { + var url = 'controller.pl?action=CustomerVendorTurnover/get_orders&id=' + $('#cv_id').val() + '&db=' + $('#db').val() + '&type=order'; + $('#orders').load(url); + }; + + ns.get_letters = function() { + var url = 'controller.pl?action=CustomerVendorTurnover/get_letters&id=' + $('#cv_id').val() + '&db=' + $('#db').val();; + $('#letters').load(url); + }; + + ns.get_mails = function() { + var url = 'controller.pl?action=CustomerVendorTurnover/get_mails&id=' + $('#cv_id').val() + '&db=' + $('#db').val();; + $('#mails').load(url); + }; + + ns.show_turnover_stat = function(period) { + if (period === 'y') { + var url = 'controller.pl?action=CustomerVendorTurnover/turnover_by_year&id=' + $('#cv_id').val() + '&db=' + $('#db').val(); + $('#turnovers').load(url); + } else { + var url = 'controller.pl?action=CustomerVendorTurnover/turnover_by_month&id=' + $('#cv_id').val() + '&db=' + $('#db').val(); + $('#turnovers').load(url); + } + }; + +}); diff --git a/templates/webpages/customer_vendor_turnover/_statistic_tabs.html b/templates/webpages/customer_vendor_turnover/_statistic_tabs.html index 32bb9f559..b6fdac402 100644 --- a/templates/webpages/customer_vendor_turnover/_statistic_tabs.html +++ b/templates/webpages/customer_vendor_turnover/_statistic_tabs.html @@ -6,36 +6,16 @@ $(function() { $ ( "#statistic_tabs" ).tabs(); }); - function get_invoices() { - var url = 'controller.pl?action=CustomerVendorTurnover/get_invoices&id=' + $('#cv_id').val() + '&db=' + $('#db').val(); - $('#invoices').load(url); - } - function get_sales_quotations() { - var url = 'controller.pl?action=CustomerVendorTurnover/get_orders&id=' + $('#cv_id').val() + '&db=' + $('#db').val() + '&type=quotation'; - $('#quotations').load(url); - } - function get_orders() { - var url = 'controller.pl?action=CustomerVendorTurnover/get_orders&id=' + $('#cv_id').val() + '&db=' + $('#db').val() + '&type=order'; - $('#orders').load(url); - } - function get_letters() { - var url = 'controller.pl?action=CustomerVendorTurnover/get_letters&id=' + $('#cv_id').val() + '&db=' + $('#db').val();; - $('#letters').load(url); - } - function get_mails() { - var url = 'controller.pl?action=CustomerVendorTurnover/get_mails&id=' + $('#cv_id').val() + '&db=' + $('#db').val();; - $('#mails').load(url); - }
[% PROCESS "customer_vendor_turnover/turnover_statistic.html" %]
[% PROCESS "customer_vendor_turnover/dun_statistic.html" %]
diff --git a/templates/webpages/customer_vendor_turnover/dun_statistic.html b/templates/webpages/customer_vendor_turnover/dun_statistic.html index 7d46bf98c..e0c95c571 100644 --- a/templates/webpages/customer_vendor_turnover/dun_statistic.html +++ b/templates/webpages/customer_vendor_turnover/dun_statistic.html @@ -3,20 +3,9 @@ [%- USE L %] [%- USE HTML %] -

-[% L.radio_button_tag('period', value='year', label= LxERP.t8('Year'), onclick='show_dun_stat("y");') %] +

+[% L.radio_button_tag('period', value='year', label= LxERP.t8('Year'), onclick='kivi.CustomerVendorTurnover.show_dun_stat("y");') %] -[% L.radio_button_tag('period', value='month', label= LxERP.t8('Month'), onclick='show_dun_stat("m");') %] +[% L.radio_button_tag('period', value='month', label= LxERP.t8('Month'), onclick='kivi.CustomerVendorTurnover.show_dun_stat("m");') %]

-
diff --git a/templates/webpages/customer_vendor_turnover/turnover_statistic.html b/templates/webpages/customer_vendor_turnover/turnover_statistic.html index 0ee39bf57..390835896 100644 --- a/templates/webpages/customer_vendor_turnover/turnover_statistic.html +++ b/templates/webpages/customer_vendor_turnover/turnover_statistic.html @@ -3,19 +3,8 @@ [%- USE L %] [%- USE HTML %]

-[% L.radio_button_tag('period', value='year', label= LxERP.t8('Year'), onclick='show_turnover_stat("y");') %] +[% L.radio_button_tag('period', value='year', label= LxERP.t8('Year'), onclick='kivi.CustomerVendorTurnover.show_turnover_stat("y");') %] -[% L.radio_button_tag('period', value='month', label= LxERP.t8('Month'), onclick='show_turnover_stat("m");') %] +[% L.radio_button_tag('period', value='month', label= LxERP.t8('Month'), onclick='kivi.CustomerVendorTurnover.show_turnover_stat("m");') %]

-