fix A/R report
[freeside.git] / httemplate / search / report_tax.html
index 20aa07f..f920adb 100755 (executable)
@@ -8,6 +8,20 @@
 
   <& /elements/tr-input-beginning_ending.html &>
 
+  <tr>
+    <td></td>
+    <td colspan=2 style="font-weight: bold">
+      <& /elements/radio.html,
+        'field' => 'all',
+        'value' => 1,
+        'curr_value' => 1,
+      &> All taxes
+      <& /elements/radio.html,
+        'field' => 'all',
+        'value' => 0,
+      &> A specific tax
+    </td>
+  </tr>
   <& /elements/tr-select.html,
     'label'         => 'Country',
     'field'         => 'country',
       taxclass  => 'Tax class',
       pkgclass  => 'Package class',
       city      => 'City',
+      district  => 'District',
     },
   &>
+  <TR>
+    <TD></TD>
+    <TD>Deduct credited tax if it was 
+      <SELECT NAME="credit_date">
+        <OPTION VALUE="cust_bill" SELECTED>invoiced in this period</OPTION>
+        <OPTION VALUE="cust_credit_bill">credited in this period</OPTION>
+      </SELECT>
+    </TD>
+  </TR>
+
 </TABLE>
 
 <BR><INPUT TYPE="submit" VALUE="Get Report">
 
 </FORM>
 
+<script>
+$(document).ready(function() {
+  $('[name=all]').on('change', function(ev) {
+    // disable country/taxname/breakdown if 'all' = 1
+    if (this.checked) {
+      var disabled = (this.value == 1);
+      $('[name=country').prop('disabled', disabled);
+      $('[name=taxname').prop('disabled', disabled);
+      $('[name=breakdown').prop('disabled', disabled);
+    }
+  });
+  $('[name=all]').change();
+});
+</script>
+
 <% include('/elements/footer.html') %>
 <%init>
 
@@ -64,5 +104,8 @@ if ( FS::pkg_class->count() > 0 ) {
 if ( FS::cust_main_county->count("city is not null and city != ''") > 0 ) {
   push @breakdown, 'city';
 }
+if ( FS::cust_main_county->count("district is not null") > 0 ) {
+  push @breakdown, 'district';
+}
 
 </%init>