0a38b2b5b4930f3ccf21214d4a2eacc8380c5b0e
[kivitendo-erp.git] / templates / webpages / bank_transactions / list.html
1 [%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%]
2
3 <script type="text/javascript" src="js/wz_tooltip.js"></script>
4
5 <h1>[% title %]</h1>
6
7 [%- INCLUDE 'common/flash.html' %]
8
9 <p>[% HTML.escape(bank_account.name) %] [% HTML.escape(bank_account.iban) %], [% 'Bank code' | $T8 %] [% HTML.escape(bank_account.bank_code) %], [% 'Bank' | $T8 %] [% HTML.escape(bank_account.bank) %]</p>
10 <p>
11 [% IF FORM.filter.fromdate %] [% 'From' | $T8 %] [% FORM.filter.fromdate %] [% END %]
12 [% IF FORM.filter.todate %]   [% 'to (date)' | $T8 %] [% FORM.filter.todate %][% END %]
13 </p>
14
15 <form id="list_form">
16 [% L.hidden_tag('filter.bank_account', FORM.filter.bank_account) %]
17 [% L.hidden_tag('filter.fromdate', FORM.filter.fromdate) %]
18 [% L.hidden_tag('filter.todate',   FORM.filter.todate) %]
19
20 <div class="tabwidget">
21   <ul>
22     <li><a href="#all" onclick="show_invoice_button();">[% 'All transactions' | $T8 %]</a></li>
23     <li><a href="#automatic" onclick="show_proposal_button();">[% 'Proposals' | $T8 %]</a></li>
24   </ul>
25
26   <div id="all">[% PROCESS "bank_transactions/tabs/all.html" %]</div>
27   <div id="automatic">[% PROCESS "bank_transactions/tabs/automatic.html" %]</div>
28 </div>
29
30 [% L.hidden_tag('action', 'BankTransaction/dispatch') %]
31 [% L.submit_tag('action_save_invoices', LxERP.t8('Save invoices')) %]
32 [% L.submit_tag('action_save_proposals', LxERP.t8('Save proposals'), style='display: none') %]
33
34 </form>
35
36 <script type="text/javascript">
37 <!--
38
39 $(function() {
40   $('#check_all').checkall('INPUT[name^="proposal_ids"]');
41 });
42
43 $(function() {
44   $('.sort_link').each(function() {
45     var _href = $(this).attr("href");
46     $(this).attr("href", _href + "&filter.fromdate=" + "[% FORM.filter.fromdate %]" + "&filter.todate=" + "[% FORM.filter.todate %]");
47   });
48 });
49
50 function show_invoice_button () {
51   $("#action_save_proposals").hide();
52   $("#action_save_invoices").show();
53 }
54
55 function show_proposal_button () {
56   $("#action_save_invoices").hide();
57   $("#action_save_proposals").show();
58 }
59
60 function assign_invoice(bt_id) {
61   kivi.popup_dialog({
62     url:    'controller.pl?action=BankTransaction/assign_invoice',
63     data:   '&bt_id=' + bt_id,
64     type:   'POST',
65     id:     'assign_invoice_window',
66     dialog: { title: kivi.t8('Assign invoice') }
67   });
68   return true;
69 }
70
71 function add_invoices(bt_id, prop_id, prop_invnumber) {
72   // prop_id is a proposed invoice_id
73   // remove the added invoice from all the other suggestions
74   var number_of_elements = document.getElementsByName(prop_id).length;
75   for( var i = 0; i < number_of_elements; i++ ) {
76     var node = document.getElementsByName(prop_id)[0];
77     node.parentNode.removeChild(node);
78   }
79   UnTip();
80   var invoices = document.getElementById('assigned_invoices_' + bt_id);
81
82   $.ajax({
83     url: 'controller.pl?action=BankTransaction/ajax_payment_suggestion&bt_id=' + bt_id  + '&prop_id=' + prop_id,
84     success: function(data) {
85       invoices.innerHTML += data.html;
86     }
87   });
88 }
89
90 function delete_invoice(bt_id, prop_id) {
91   $( "#" + bt_id + "\\." + prop_id ).remove();
92 }
93
94 function create_invoice(bt_id) {
95   kivi.popup_dialog({
96     url:    'controller.pl?action=BankTransaction/create_invoice',
97     data:   '&bt_id=' + bt_id + "&filter.bank_account=[% FORM.filter.bank_account %]&filter.todate=[% FORM.filter.todate %]&filter.fromdate=[% FORM.filter.fromdate %]",
98     type:   'POST',
99     id:     'create_invoice_window',
100     dialog: { title: kivi.t8('Create invoice') }
101   });
102   return true;
103 }
104
105 //-->
106 </script>
107