epic-ts
[kivitendo-erp.git] / templates / webpages / acctranscorrections / assistant_for_wrong_taxkeys.html
1 [%- USE T8 %]
2 [% USE HTML %][% USE LxERP %]
3 <h1>[% title %]</h1>
4
5  <p>
6   [% 'The following transaction contains wrong taxkeys:' | $T8 %]
7   <a href="[% problem.link %]">
8    [%- IF problem.data.module == 'ar' %]
9    [% 'AR Transaction' | $T8 %]
10    [%- ELSIF problem.data.module == 'ap' %]
11    [% 'AP Transaction' | $T8 %]
12    [%- ELSE %]
13    [% 'General Ledger Transaction' | $T8 %]
14    [%- END %]
15    [% HTML.escape(problem.data.reference) %]
16   </a>
17  </p>
18
19  <p>
20   [% 'This could have happened for two reasons:' | $T8 %]
21
22   [% 'The first reason is that kivitendo contained a bug which resulted in the wrong taxkeys being recorded for transactions in which two entries are posted for the same chart with different taxkeys.' | $T8 %]
23
24   [% 'The second reason is that kivitendo allowed the user to enter the tax amount manually regardless of the taxkey used.' | $T8 %]
25
26   [% 'Such entries cannot be exported into the DATEV format and have to be fixed as well.' | $T8 %]
27  </p>
28
29  <p>
30   [% 'The transaction is shown below in its current state.' | $T8 %]
31
32   [% 'You can correct this transaction by chosing the correct taxkeys from the drop down boxes and hitting the button "Fix transaction" afterwards.' | $T8 %]
33
34   [%- 'It is possible that even after such a correction there is something wrong with this transaction (e.g. taxes that don\'t match the selected taxkey). Therefore you should re-run the general ledger analysis.' | $T8 %]
35  </p>
36
37  <p>
38   [% 'You can also delete this transaction and re-enter it manually.' | $T8 %]
39
40   [% 'In order to do that hit the button "Delete transaction".' | $T8 %]
41  </p>
42
43  <p>[% 'At the moment the transaction looks like this:' | $T8 %]</p>
44
45  <form method="post" action="acctranscorrections.pl" name="Form">
46   <p>
47    <table>
48     <tr>
49      <th class="listheading">[% 'Account' | $T8 %]</th>
50      <th class="listheading">[% 'Debit' | $T8 %]</th>
51      <th class="listheading">[% 'Credit' | $T8 %]</th>
52      <th class="listheading">[% 'Recorded Tax' | $T8 %]</th>
53      <th class="listheading">[% 'Recorded taxkey' | $T8 %]</th>
54      <th class="listheading">[% 'Expected Tax' | $T8 %]</th>
55      <th class="listheading"></th>
56      <th class="listheading">[% 'Correct taxkey' | $T8 %]</th>
57     </tr>
58
59     [%- SET curr_row = 0 %]
60     [%- IF (problem.data.module == 'ar') || ((problem.data.module == 'gl') && (problem.acc_trans.credit.entries.first.acc_trans_id < problem.acc_trans.debit.entries.first.acc_trans_id)) %]
61      [%- SET order = [ 'credit', 'debit' ] %]
62      [%- SET other_side = 'debit' %]
63     [%- ELSE %]
64      [%- SET order = [ 'debit', 'credit' ] %]
65      [%- SET other_side = 'credit' %]
66     [%- END %]
67
68
69     [%- IF problem.acc_trans.credit.entries.size > problem.acc_trans.debit.entries.size %]
70     [%- ELSE %]
71     [%- END %]
72
73
74     [%- FOREACH idx = order %]
75      [%- FOREACH row = problem.acc_trans.$idx.entries %]
76       [%- SET curr_row = curr_row + 1 %]
77       <tr class="listrow[% curr_row % 2 %]">
78        <td>[% HTML.escape(row.accno) %]--[% HTML.escape(row.chartdescription) %]</td>
79        <td align="right">
80         [%- IF idx == 'debit' %]
81          [% LxERP.format_amount(row.display_amount, 2) %]
82         [%- END %]
83        </td>
84        <td align="right">
85         [%- IF idx == 'credit' %]
86          [% LxERP.format_amount(row.display_amount, 2) %]
87         [%- END %]
88        </td>
89        <td align="right">[% IF row.actual_tax %][% LxERP.format_amount(row.display_actual_tax, 2) %][% END %]</td>
90        <td>[% IF (problem.data.module == 'gl') || (idx != other_side) %][% HTML.escape(row.taxdescription) %][% END %]</td>
91        <td align="right">[% IF row.expected_tax %][% LxERP.format_amount(row.display_expected_tax, 2) %][% END %]</td>
92        <td align="center" valign="center"><img src="image/[% IF row.taxkey_error %]error[% ELSE %]ok[% END %].png"></td>
93
94        <td>
95         [%- IF row.taxkey_error %]
96          <input type="hidden" name="fixes[+].acc_trans_id" value="[% HTML.escape(row.acc_trans_id) %]">
97          <input type="hidden" name="fixes[].tax_entry_acc_trans_id" value="[% HTML.escape(row.tax_entry_acc_trans_id) %]">
98          <select name="fixes[].taxkey" style="width: 250px" onchange="enable_fix_button_maybe()">
99           <option value="">[% '---please select---' | $T8 %]</option>
100           [%- FOREACH taxkey = row.correct_taxkeys %]
101            <option value="[% HTML.escape(taxkey.taxkey) %]">[% HTML.escape(taxkey.description) %]</option>
102           [%- END %]
103         [%- ELSE %]
104         &nbsp;
105         [%- END %]
106       </tr>
107      [%- END %]
108     [%- END %]
109
110    </table>
111   </p>
112   <hr>
113
114   <p>
115    <input type="hidden" name="callback" value="[% HTML.escape(callback) %]">
116
117    <input type="hidden" name="action" value="dispatcher">
118    <input type="hidden" name="trans_id" value="[% HTML.escape(problem.data.trans_id) %]">
119    <input type="hidden" name="module" value="[% HTML.escape(problem.data.module) %]">
120    <input type="hidden" name="reference" value="[% HTML.escape(problem.data.reference) %]">
121    <input type="submit" class="submit" id="fix_transaction_button" name="action_fix_wrong_taxkeys" value="[% 'Fix transaction' | $T8 %]" disabled>
122    <input type="submit" class="submit" name="action_delete_transaction" value="[% 'Delete transaction' | $T8 %]">
123    <input type="button" class="submit" onclick="history.back()" value="[% 'Back' | $T8 %]">
124   </p>
125  </form>
126
127  <script type="text/javascript">
128   <!--
129     function enable_fix_button_maybe() {
130       $("#fix_transaction_button").prop('disabled', $("[name='fixes[].taxkey'][value='']").size() != 0);
131     }
132     -->
133  </script>