<commit_before><?
require 'scat.php';

head("report");
?>
<form id="report-params">
From:
<input name="begin" type="date">
to:
<input name="end" type="date">
Grouped by:
<select name="span">
 <option value="day">Day</span>
 <option value="week">Week</span>
 <option value="month">Month</span>
</select>
<input type="submit" value="Show">
</form>
<br>
<table id="report">
 <thead>
  <tr><th>When</th><th>Sales</th></tr>
 </thead>
 <tbody>
 </tbody>
</table>
<script>
$(function() {
  $('input[type="date"]').datepicker({ dateFormat: 'yy-mm-dd' });
});
$("#report-params").on('submit', function(ev) {
  ev.preventDefault();
  $.getJSON("./api/report-sales.php?callback=?",
            $(this).serializeArray(),
            function(data) {
              if (data.error) {
                $.modal(data.error);
              } else {
                var t= $("#report tbody");
                t.empty();
                $.each(data.sales, function(i, sales) {
                  t.append($('<tr><td>' + sales.span +
                             '<td align="right">' + amount(sales.total) +
                             '</tr>'));
                });
              }
            });
});
</script>
<?
foot();<commit_msg>Display resale and tax information<commit_after><?
require 'scat.php';

head("report");
?>
<form id="report-params">
From:
<input name="begin" type="date">
to:
<input name="end" type="date">
Grouped by:
<select name="span">
 <option value="day">Day</span>
 <option value="week">Week</span>
 <option value="month">Month</span>
</select>
<input type="submit" value="Show">
</form>
<br>
<table id="report">
 <thead>
  <tr><th>When</th><th>Subtotal</th><th>Resale</th><th>Tax</th><th>Total</th></tr>
 </thead>
 <tbody>
 </tbody>
</table>
<script>
$(function() {
  $('input[type="date"]').datepicker({ dateFormat: 'yy-mm-dd' });
});
$("#report-params").on('submit', function(ev) {
  ev.preventDefault();
  $.getJSON("./api/report-sales.php?callback=?",
            $(this).serializeArray(),
            function(data) {
              if (data.error) {
                $.modal(data.error);
              } else {
                var t= $("#report tbody");
                t.empty();
                $.each(data.sales, function(i, sales) {
                  t.append($('<tr><td>' + sales.span +
                             '<td align="right">' + amount(sales.total) +
                             '<td align="right">' + amount(sales.resale) +
                             '<td align="right">' + amount(sales.tax) +
                             '<td align="right">' + amount(sales.total_taxed) +
                             '</tr>'));
                });
              }
            });
});
</script>
<?
foot();
{'fraction_non_alphanumeric': 0.22259013980868286, 'fraction_numerical': 0.0, 'mean_word_length': 2.1579558652729385, 'pattern_counts': {'":': 0, '<': 80, '<?xml version=': 0, '>': 78, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '42097', 'n_tokens_mistral': 874, 'n_tokens_neox': 856, 'n_words': 150}