Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 58e28ca0

Von Werner Hahn vor etwa 6 Jahren hinzugefügt

  • ID 58e28ca02c1fe93ff9db9024318d3529715bd8fb
  • Vorgänger bec23a70
  • Nachfolger 3f88c642

Kundenstatistik: javascript uas Templates in eigene js ausgelagert

Unterschiede anzeigen:

SL/Controller/CustomerVendor.pm
983 983

  
984 984
  $::request->{layout}->add_javascripts('kivi.CustomerVendor.js');
985 985
  $::request->{layout}->add_javascripts('kivi.File.js');
986
  $::request->{layout}->add_javascripts('kivi.CustomerVendorTurnover.js');
986 987

  
987 988
  $self->_setup_form_action_bar;
988 989
}
js/kivi.CustomerVendorTurnover.js
1
namespace('kivi.CustomerVendorTurnover', function(ns) {
2

  
3
  ns.show_dun_stat = function(period) {
4
    if (period === 'y') {
5
      var url = 'controller.pl?action=CustomerVendorTurnover/count_open_items_by_year&id=' + $('#cv_id').val();
6
      $('#duns').load(url);
7
    } else {
8
      var url = 'controller.pl?action=CustomerVendorTurnover/count_open_items_by_month&id=' + $('#cv_id').val();
9
      $('#duns').load(url);
10
    }
11
  };
12

  
13
  ns.get_invoices = function() {
14
    var url = 'controller.pl?action=CustomerVendorTurnover/get_invoices&id=' + $('#cv_id').val() + '&db=' + $('#db').val();
15
    $('#invoices').load(url);
16
  };
17

  
18
  ns.get_sales_quotations = function() {
19
    var url = 'controller.pl?action=CustomerVendorTurnover/get_orders&id=' + $('#cv_id').val() + '&db=' + $('#db').val() + '&type=quotation';
20
    $('#quotations').load(url);
21
  };
22

  
23
  ns.get_orders = function() {
24
    var url = 'controller.pl?action=CustomerVendorTurnover/get_orders&id=' + $('#cv_id').val() + '&db=' + $('#db').val() + '&type=order';
25
    $('#orders').load(url);
26
  };
27

  
28
  ns.get_letters = function() {
29
    var url = 'controller.pl?action=CustomerVendorTurnover/get_letters&id=' + $('#cv_id').val() + '&db=' + $('#db').val();;
30
    $('#letters').load(url);
31
  };
32

  
33
  ns.get_mails = function() {
34
    var url = 'controller.pl?action=CustomerVendorTurnover/get_mails&id=' + $('#cv_id').val() + '&db=' + $('#db').val();;
35
    $('#mails').load(url);
36
  };
37

  
38
  ns.show_turnover_stat = function(period) {
39
    if (period === 'y') {
40
      var url = 'controller.pl?action=CustomerVendorTurnover/turnover_by_year&id=' + $('#cv_id').val() + '&db=' + $('#db').val();
41
      $('#turnovers').load(url);
42
    } else {
43
      var url = 'controller.pl?action=CustomerVendorTurnover/turnover_by_month&id=' + $('#cv_id').val() + '&db=' + $('#db').val();
44
      $('#turnovers').load(url);
45
    }
46
  };
47

  
48
});
templates/webpages/customer_vendor_turnover/_statistic_tabs.html
6 6
  $(function() {
7 7
    $ ( "#statistic_tabs" ).tabs();
8 8
  });
9
  function get_invoices() {
10
    var url = 'controller.pl?action=CustomerVendorTurnover/get_invoices&id=' + $('#cv_id').val() + '&db=' + $('#db').val();
11
    $('#invoices').load(url);
12
  }
13
  function get_sales_quotations() {
14
    var url = 'controller.pl?action=CustomerVendorTurnover/get_orders&id=' + $('#cv_id').val() + '&db=' + $('#db').val() + '&type=quotation';
15
    $('#quotations').load(url);
16
  }
17
  function get_orders() {
18
    var url = 'controller.pl?action=CustomerVendorTurnover/get_orders&id=' + $('#cv_id').val() + '&db=' + $('#db').val() + '&type=order';
19
    $('#orders').load(url);
20
  }
21
  function get_letters() {
22
    var url = 'controller.pl?action=CustomerVendorTurnover/get_letters&id=' + $('#cv_id').val() + '&db=' + $('#db').val();;
23
    $('#letters').load(url);
24
  }
25
  function get_mails() {
26
    var url = 'controller.pl?action=CustomerVendorTurnover/get_mails&id=' + $('#cv_id').val() + '&db=' + $('#db').val();;
27
    $('#mails').load(url);
28
  }
29 9
</script>
30 10
<div class="tabwidget" id="statistic_tabs">
31 11
  <ul>
32 12
    <li><a href="#turnover_stat">[% 'Turnoverstatistic' | $T8 %]</a></li>
33 13
    [% IF FORM.db == "customer" %]<li><a href="#dun_stat">[% 'Dunningstatistic' | $T8 %]</a></li>[% END %]
34
    <li><a href="#quotations" onclick="get_sales_quotations();">[% IF FORM.db == "customer" %][% 'Sales Quotations' | $T8 %][% ELSE %][% 'Request Quotations' | $T8 %][% END %]</a></li>
35
    <li><a href="#orders" onclick="get_orders();">[% 'Orders' | $T8 %]</a></li>
36
    <li><a href="#invoices" onclick="get_invoices();">[% 'Invoices' | $T8 %]</a></li>
37
    <li><a href="#mails" onclick="get_mails();">[% 'Mails' | $T8 %]</a></li>
38
    <li><a href="#letters" onclick="get_letters();">[% 'Letters' | $T8 %]</a></li>
14
    <li><a href="#quotations" onclick="kivi.CustomerVendorTurnover.get_sales_quotations();">[% IF FORM.db == "customer" %][% 'Sales Quotations' | $T8 %][% ELSE %][% 'Request Quotations' | $T8 %][% END %]</a></li>
15
    <li><a href="#orders" onclick="kivi.CustomerVendorTurnover.get_orders();">[% 'Orders' | $T8 %]</a></li>
16
    <li><a href="#invoices" onclick="kivi.CustomerVendorTurnover.get_invoices();">[% 'Invoices' | $T8 %]</a></li>
17
    <li><a href="#mails" onclick="kivi.CustomerVendorTurnover.get_mails();">[% 'Mails' | $T8 %]</a></li>
18
    <li><a href="#letters" onclick="kivi.CustomerVendorTurnover.get_letters();">[% 'Letters' | $T8 %]</a></li>
39 19
  </ul>
40 20
  <div id="turnover_stat">[% PROCESS "customer_vendor_turnover/turnover_statistic.html" %]</div>
41 21
  <div id="dun_stat">[% PROCESS "customer_vendor_turnover/dun_statistic.html" %]</div>
templates/webpages/customer_vendor_turnover/dun_statistic.html
3 3
[%- USE L %]
4 4
[%- USE HTML %]
5 5

  
6
<p> 
7
[% L.radio_button_tag('period', value='year', label= LxERP.t8('Year'), onclick='show_dun_stat("y");') %]
6
<p>
7
[% L.radio_button_tag('period', value='year', label= LxERP.t8('Year'), onclick='kivi.CustomerVendorTurnover.show_dun_stat("y");') %]
8 8

  
9
[% L.radio_button_tag('period', value='month', label= LxERP.t8('Month'), onclick='show_dun_stat("m");') %]
9
[% L.radio_button_tag('period', value='month', label= LxERP.t8('Month'), onclick='kivi.CustomerVendorTurnover.show_dun_stat("m");') %]
10 10
</p>
11
<script type="text/javascript">
12
  function show_dun_stat(period) {
13
    if (period === 'y') {
14
      var url = 'controller.pl?action=CustomerVendorTurnover/count_open_items_by_year&id=' + $('#cv_id').val();
15
      $('#duns').load(url);
16
    } else {
17
      var url = 'controller.pl?action=CustomerVendorTurnover/count_open_items_by_month&id=' + $('#cv_id').val();
18
      $('#duns').load(url);
19
    }
20
  }
21
</script>
22 11
<div id="duns"></div>
templates/webpages/customer_vendor_turnover/turnover_statistic.html
3 3
[%- USE L %]
4 4
[%- USE HTML %]
5 5
<p>
6
[% L.radio_button_tag('period', value='year', label= LxERP.t8('Year'), onclick='show_turnover_stat("y");') %]
6
[% L.radio_button_tag('period', value='year', label= LxERP.t8('Year'), onclick='kivi.CustomerVendorTurnover.show_turnover_stat("y");') %]
7 7

  
8
[% L.radio_button_tag('period', value='month', label= LxERP.t8('Month'), onclick='show_turnover_stat("m");') %]
8
[% L.radio_button_tag('period', value='month', label= LxERP.t8('Month'), onclick='kivi.CustomerVendorTurnover.show_turnover_stat("m");') %]
9 9
</p>
10
<script type="text/javascript">
11
  function show_turnover_stat(period) {
12
    if (period === 'y') {
13
      var url = 'controller.pl?action=CustomerVendorTurnover/turnover_by_year&id=' + $('#cv_id').val() + '&db=' + $('#db').val();
14
      $('#turnovers').load(url);
15
    } else {
16
      var url = 'controller.pl?action=CustomerVendorTurnover/turnover_by_month&id=' + $('#cv_id').val() + '&db=' + $('#db').val();
17
      $('#turnovers').load(url);
18
    }
19
  }
20
</script>
21 10
<div id="turnovers"></div>

Auch abrufbar als: Unified diff