Layout: title Ausgabe normalisieren
[kivitendo-erp.git] / templates / webpages / am / edit_accounts.html
index 6252ee1..95cd8c0 100644 (file)
@@ -1,5 +1,9 @@
 [%- USE T8 %]
-[% USE HTML %]<script type="text/javascript" src="js/FormManager.js" >
+[%- USE L %]
+[% USE HTML %]
+<h1>[% title %]</h1>
+
+<script type="text/javascript" src="js/FormManager.js" >
 /****************************************************
 * Form Dependency Manager- By Twey- http://www.twey.co.uk
 * Visit Dynamic Drive for this script and more: http://www.dynamicdrive.com
 </script>
 
 <script type="text/javascript">
-window.onload = function() {
+$(function() {
     setupDependencies('EditAccount'); //name of form(s). Seperate each with a comma (ie: 'weboptions', 'myotherform' )
-  };
+});
 </script>
 
-<body>
 <form method="post" name="EditAccount" action="am.pl">
 
 <input type="hidden" name="id"                 value="[% HTML.escape(id) %]">
 <input type="hidden" name="type"               value="account">
 <input type="hidden" name="orphaned"           value="[% HTML.escape(orphaned) %]">
 <input type="hidden" name="new_chart_valid"    value="[% HTML.escape(new_chart_valid) %]">
-<input type="hidden" name="original_accno"    value="[% HTML.escape(accno) %]">
 <input type="hidden" name="inventory_accno_id" value="[% HTML.escape(inventory_accno_id) %]">
 <input type="hidden" name="income_accno_id"    value="[% HTML.escape(income_accno_id) %]">
 <input type="hidden" name="expense_accno_id"   value="[% HTML.escape(expense_accno_id) %]">
 <input type="hidden" name="fxgain_accno_id"    value="[% HTML.escape(fxgain_accno_id) %]">
 <input type="hidden" name="fxloss_accno_id"    value="[% HTML.escape(fxloss_accno_id) %]">
 
-<table border="0" width="100%">
-  <tr>
-    <th class="listtop">[% title %]</th>
-  </tr>
-</table>
-
 <fieldset>
   <legend>
     [% 'Main Preferences' | $T8 %]
@@ -42,7 +38,7 @@ window.onload = function() {
         <label>
           [% 'Account Number' | $T8 %]
         </label></td>
-        <td><input name="accno" size="20" value="[% HTML.escape(accno) %]"></td>
+        <td><input id="accno" name="accno" size="20" value="[% HTML.escape(accno) %]"></td>
     </tr>
     <tr>
       <td>
@@ -50,7 +46,7 @@ window.onload = function() {
           [% 'Description' | $T8 %]
         </label>
       </td>
-      <td><input name="description" size="40" value="[% HTML.escape(description) %]"></td>
+      <td><input id="description" name="description" size="40" value="[% HTML.escape(description) %]"></td>
     </tr>
     <tr>
       <td>
@@ -59,10 +55,27 @@ window.onload = function() {
 
         </label>
       </td>
-      <td><select name="charttype">[% select_charttype %]</select></td>
+      <td>
+[% IF AccountIsPosted %]
+        [% L.select_tag('dummy_charttype',
+                        all_charttypes,
+                        title_key => 'name',
+                        value_key => 'value',
+                        default => selected_charttype,
+                        disabled => '1') %]
+        [% L.hidden_tag('charttype', selected_charttype) %]
+[% ELSE %]
+        [% L.select_tag('charttype',
+                        all_charttypes,
+                        title_key => 'name',
+                        value_key => 'value',
+                        default => selected_charttype) %]
+[% END %]
+      </td>
     </tr>
   </table>
 </fieldset>
+
 <fieldset class="DEPENDS ON charttype BEING A">
   <legend>[% 'Account Type' | $T8 %]</legend>
   <select name="category" id="AccountType" class="DEPENDS ON charttype BEING A">
@@ -72,17 +85,48 @@ window.onload = function() {
 [% IF ChartTypeIsAccount %]
 <fieldset class="DEPENDS ON charttype BEING A">
   <legend>[% 'Is this a summary account to record' | $T8 %]</legend>
-    <input name="AR" type="checkbox" class="checkbox" value="AR" [% HTML.escape(AR) %]>
-    &nbsp;[% 'AR' | $T8 %]
-    <input name="AP" type="checkbox" class="checkbox" value="AP" [% HTML.escape(AP) %]>
-    &nbsp;[% 'AP' | $T8 %]
-    <input name="IC" type="checkbox" class="checkbox" value="IC" [% HTML.escape(IC) %]>
-    &nbsp;[% 'Inventory' | $T8 %]
+        [% L.radio_button_tag('summary_account',
+          value => 'AR',
+          disabled => AccountIsPosted,
+          checked  => AR) %]
+        &nbsp;[% 'AR' | $T8 %]
+        [% L.radio_button_tag('summary_account',
+          value => 'AP',
+          disabled => AccountIsPosted,
+          checked  => AP) %]
+        &nbsp;[% 'AP' | $T8 %]
+        [% L.radio_button_tag('summary_account',
+          value => 'IC',
+          disabled => AccountIsPosted,
+          checked  => IC) %]
+        &nbsp;[% 'Inventory' | $T8 %]
+        [% L.radio_button_tag('summary_account',
+          value => '',
+          disabled => AccountIsPosted) %]
+        &nbsp;[% 'No summary account' | $T8 %]
+
+[% IF AccountIsPosted %]
+    [% IF AR %] [% L.hidden_tag('AR', 'AR') %] [% END %]
+    [% IF AP %] [% L.hidden_tag('AP', 'AP') %] [% END %]
+    [% IF IC %] [% L.hidden_tag('IC', 'IC') %] [% END %]
+[% END %]
+
 </fieldset>
 
+[% IF AccountIsPosted %]
+  [% IF AR_amount %] [% L.hidden_tag('AR_amount', 'AR_amount') %] [% END %]
+  [% IF AR_paid   %] [% L.hidden_tag('AR_paid',   'AR_paid')   %] [% END %]
+  [% IF AR_tax    %] [% L.hidden_tag('AR_tax',    'AR_tax')    %] [% END %]
+  [% IF AP_amount %] [% L.hidden_tag('AP_amount', 'AP_amount') %] [% END %]
+  [% IF AP_paid   %] [% L.hidden_tag('AP_paid',   'AP_paid')   %] [% END %]
+  [% IF AP_tax    %] [% L.hidden_tag('AP_tax',    'AP_tax')    %] [% END %]
+  [%- SET DIS = ' disabled="disabled"' %]
+[% END %]
 <fieldset class="DEPENDS ON charttype BEING A">
   <legend>[% 'Include in drop-down menus' | $T8 %]</legend>
-  <p style='font-weight:normal'>[% 'These will only be effective if the account is NOT a summary account AND there exists at least one taxkey. Setting the account as a summary account will erase these settings.' | $T8 %]</p>
+  <p style='font-weight:normal'>[% 'Changes in this block are only sensible if the account is NOT a summary account AND there exists one valid taxkey. To select both Receivables and Payables only make sense for Payment / Receipt (i.e. account cash).' | $T8 %]</p>
+  <p style='font-weight:normal'>[% 'Changes to Receivables and Payables are only possible if no transactions to this account are posted yet.' | $T8 %]
+  [% 'The changing of tax-o-matic account is NOT recommended, but if you do so please also (re)configure buchungsgruppen and reconfigure ALL charts which point to this tax-o-matic account. ' | $T8 %]</p>
   <table width="100%">
     <tr>
       <th align="left">[% 'Receivables' | $T8 %]</th>
@@ -92,26 +136,46 @@ window.onload = function() {
     </tr>
     <tr>
       <td>
-        <input name="AR_amount" type="checkbox" class="checkbox" value="AR_amount"
-          [% HTML.escape(AR_amount) %]>&nbsp;
-        [% 'Revenue' | $T8 %] <br>
-        <input name="AR_paid" type="checkbox" class="checkbox" value="AR_paid"
-          [% HTML.escape(AR_paid) %]>&nbsp;
-        [% 'Receipt' | $T8 %] <br>
-        <input name="AR_tax" type="checkbox" class="checkbox" value="AR_tax"
-          [% HTML.escape(AR_tax) %]>&nbsp;
-        [% 'Tax' | $T8 %]
+        [% L.radio_button_tag('AR_include_in_dropdown',
+          value => 'AR_amount',
+          disabled => AccountIsPosted,
+          checked  => AR_amount) %]
+        &nbsp;[% 'Revenue' | $T8 %] <br>
+        [% L.radio_button_tag('AR_include_in_dropdown',
+          value => 'AR_paid',
+          disabled => AccountIsPosted,
+          checked  => AR_paid) %]
+        &nbsp;[% 'Receipt' | $T8 %] <br>
+        [% L.radio_button_tag('AR_include_in_dropdown',
+          value => 'AR_tax',
+          disabled => AccountIsPosted,
+          checked  => AR_tax) %]
+        &nbsp;[% 'Tax' | $T8 %] <br>
+        [% L.radio_button_tag('AR_include_in_dropdown',
+          value => '',
+          disabled => AccountIsPosted) %]
+        &nbsp;[% 'do not include' | $T8 %]
       </td>
       <td>
-        <input name="AP_amount" type="checkbox" class="checkbox" value="AP_amount"
-          [% HTML.escape(AP_amount) %]>&nbsp;
-        [% 'Expense/Asset' | $T8 %] <br>
-        <input name="AP_paid" type="checkbox" class="checkbox" value="AP_paid"
-          [% HTML.escape(AP_paid) %]>&nbsp;
-        [% 'Payment' | $T8 %] <br>
-        <input name="AP_tax" type="checkbox" class="checkbox" value="AP_tax"
-            [% HTML.escape(AP_tax) %]>&nbsp;
-        [% 'Tax' | $T8 %]
+        [% L.radio_button_tag('AP_include_in_dropdown',
+          value => 'AP_amount',
+          disabled => AccountIsPosted,
+          checked  => AP_amount) %]
+        &nbsp;[% 'Expense/Asset' | $T8 %] <br>
+        [% L.radio_button_tag('AP_include_in_dropdown',
+          value => 'AP_paid',
+          disabled => AccountIsPosted,
+          checked  => AP_paid) %]
+        &nbsp;[% 'Payment' | $T8 %] <br>
+        [% L.radio_button_tag('AP_include_in_dropdown',
+          value => 'AP_tax',
+          disabled => AccountIsPosted,
+          checked  => AP_tax) %]
+        &nbsp;[% 'Tax' | $T8 %] <br>
+        [% L.radio_button_tag('AP_include_in_dropdown',
+          value => '',
+          disabled => AccountIsPosted) %]
+        &nbsp;[% 'do not include' | $T8 %]
       </td>
       <td>
         <input name="IC_sale" type="checkbox" class="checkbox" value="IC_sale"
@@ -123,6 +187,7 @@ window.onload = function() {
         <input name="IC_taxpart" type="checkbox" class="checkbox" value="IC_taxpart"
           [% HTML.escape(IC_taxpart) %]>&nbsp;
         [% 'Tax' | $T8 %]
+        <br><br>
       </td>
       <td>
         <input name=IC_income type=checkbox class=checkbox value="IC_income"
@@ -134,6 +199,7 @@ window.onload = function() {
         <input name=IC_taxservice type=checkbox class=checkbox value="IC_taxservice"
           [% HTML.escape(IC_taxservice) %]>&nbsp;
         [% 'Tax' | $T8 %]
+        <br><br>
       </td>
     </tr>
   </table>
@@ -146,7 +212,6 @@ window.onload = function() {
   <p style='font-weight:normal'>[% 'Note: Taxkeys must have a "valid from" date, and will not behave correctly without.' | $T8 %]</p>
 
             <table>
-[% IF account_exists %]
               <tr>
                 <th align="left">[% 'Taxkey' | $T8 %]</th>
                 <th align="left">[% 'valid from' | $T8 %]</th>
@@ -154,6 +219,7 @@ window.onload = function() {
                 <th align="left">[% 'delete' | $T8 %] ? </th>
               </tr>
 [% FOREACH tk = ACCOUNT_TAXKEYS %]
+
               <tr>
     [% IF tk.id %]
                 <input type="hidden" name="taxkey_id_[% tk.runningnumber %]" value="[% tk.id %]">
@@ -171,14 +237,9 @@ window.onload = function() {
     [% END %]
               </tr>
 
+
 [% END %]
-[% ELSE %]
-<tr>
-  <td align="center" colspan="4"><p>[% 'Save account first to insert taxkeys' | $T8 %]</p>
-  </td>
-</tr>
-[% END %]
-            </table>
+    </table>
 </fieldset>
 
 <fieldset class="DEPENDS ON charttype BEING A">
@@ -199,7 +260,7 @@ window.onload = function() {
         </tr -->
         <tr>
           <th align="left">[% 'Datevautomatik' | $T8 %]</th>
-          <td colspan="3"><input name="datevautomatik" type="checkbox" class="checkbox" value="T" [% IF datevautomatik %]checked [% END %]></td>
+          <td colspan="3"><input name="datevautomatik" type="checkbox" class="checkbox" value="T" [% IF datevautomatik %]checked [% END %]>[% 'If checked the taxkey will not be exported in the DATEV Export, but only IF chart taxkeys differ from general ledger taxkeys' | $T8 %] </td>
         </tr>
         <tr>
           <th align="left">[% 'Folgekonto' | $T8 %]</th>
@@ -211,3 +272,19 @@ window.onload = function() {
 [% END %]
 </fieldset>
 <hr size="3" noshade>
+
+[% IF ( id ) %]
+  <script type="text/javascript">
+  function callback_save() {
+    var prev_desc = "[% description | html %]";
+    var prev_accno = "[% accno | html %]";
+    var cur_desc = $("#description").val();
+    var cur_accno = $("#accno").val();
+
+    if ( prev_desc != cur_desc || prev_accno != cur_accno )
+      return confirm(kivi.t8("Do you want to set the account number \"#1\" to \"#2\" and the name \"#3\" to \"#4\"?", [prev_accno, cur_accno, prev_desc, cur_desc]));
+    else
+      return true;
+  }
+  </script>
+[% END %]