Use and display billing_date as well
authorJoey Schulze <joey@infodrom.org>
Mon, 25 Apr 2016 16:15:11 +0000 (18:15 +0200)
committerJoey Schulze <joey@infodrom.org>
Sat, 25 Jun 2016 10:48:31 +0000 (12:48 +0200)
src/InfoCon/buch/vorsteueranmeldung

index dbf9abd..86aa507 100755 (executable)
@@ -175,9 +175,9 @@ sub print_income
     print "\n" . "~" x 23 . "\n\n";
 
     $sql = qq{
     print "\n" . "~" x 23 . "\n\n";
 
     $sql = qq{
-SELECT date,description,tax_percent,tax_assigned,price
+SELECT date,billing_date AS billing,description,tax_percent,tax_assigned,price
         FROM sales
         FROM sales
-WHERE date >= '$opt_start'  AND date < '$opt_end'
+WHERE billing_date >= '$opt_start' AND billing_date < '$opt_end'
         AND price > 0.0 AND visible = 1
         ORDER BY date,nr};
     print_table $dbh, $sql;
         AND price > 0.0 AND visible = 1
         ORDER BY date,nr};
     print_table $dbh, $sql;
@@ -185,7 +185,7 @@ WHERE date >= '$opt_start'  AND date < '$opt_end'
     $sql = qq{
 SELECT tax_percent as percent,sum(price) AS brutto, sum(price) - sum(tax_assigned) AS netto, sum(tax_assigned) AS tax
         FROM sales
     $sql = qq{
 SELECT tax_percent as percent,sum(price) AS brutto, sum(price) - sum(tax_assigned) AS netto, sum(tax_assigned) AS tax
         FROM sales
-WHERE date >= '$opt_start'  AND date < '$opt_end'
+WHERE billing_date >= '$opt_start' AND billing_date < '$opt_end'
         AND price > 0.0 AND visible = 1
         GROUP BY tax_percent
         ORDER BY tax_percent};
         AND price > 0.0 AND visible = 1
         GROUP BY tax_percent
         ORDER BY tax_percent};
@@ -194,7 +194,7 @@ WHERE date >= '$opt_start'  AND date < '$opt_end'
     $sql = qq{
 SELECT sum(price) AS brutto, sum(price) - sum(tax_assigned) AS netto, sum(tax_assigned) AS tax
         FROM sales
     $sql = qq{
 SELECT sum(price) AS brutto, sum(price) - sum(tax_assigned) AS netto, sum(tax_assigned) AS tax
         FROM sales
-WHERE date >= '$opt_start'  AND date < '$opt_end'
+WHERE billing_date >= '$opt_start' AND billing_date < '$opt_end'
         AND price > 0.0 AND visible = 1};
     print_table $dbh, $sql;
 }
         AND price > 0.0 AND visible = 1};
     print_table $dbh, $sql;
 }
@@ -208,9 +208,9 @@ sub print_outgoing
     print "\n" . "~" x 38 . "\n\n";
 
     $sql = qq{
     print "\n" . "~" x 38 . "\n\n";
 
     $sql = qq{
-SELECT date,description,tax_percent,tax_assigned * -1 as tax_assigned,price * -1 as price
+SELECT date,billing_date AS billing,description,tax_percent,tax_assigned * -1 as tax_assigned,price * -1 as price
         FROM sales
         FROM sales
-WHERE date >= '$opt_start'  AND date < '$opt_end'
+WHERE billing_date >= '$opt_start' AND billing_date < '$opt_end'
         AND price < 0.0 AND visible = 1
         AND category <> 'privat'
         AND category <> 'tax'
         AND price < 0.0 AND visible = 1
         AND category <> 'privat'
         AND category <> 'tax'
@@ -220,7 +220,7 @@ WHERE date >= '$opt_start'  AND date < '$opt_end'
     $sql = qq{
 SELECT tax_percent AS percent,sum(price) * -1 AS brutto, sum(price) * -1 - sum(tax_assigned) * -1 AS netto, sum(tax_assigned) * -1 AS tax
         FROM sales
     $sql = qq{
 SELECT tax_percent AS percent,sum(price) * -1 AS brutto, sum(price) * -1 - sum(tax_assigned) * -1 AS netto, sum(tax_assigned) * -1 AS tax
         FROM sales
-WHERE date >= '$opt_start'  AND date < '$opt_end'
+WHERE billing_date >= '$opt_start' AND billing_date < '$opt_end'
         AND price < 0.0 AND visible = 1
         AND category <> 'privat'
         AND category <> 'tax'
         AND price < 0.0 AND visible = 1
         AND category <> 'privat'
         AND category <> 'tax'
@@ -231,7 +231,7 @@ WHERE date >= '$opt_start'  AND date < '$opt_end'
     $sql = qq{
 SELECT sum(price) * -1 AS brutto, sum(price) * -1 - sum(tax_assigned) * -1 AS netto, sum(tax_assigned) * -1 AS tax
         FROM sales
     $sql = qq{
 SELECT sum(price) * -1 AS brutto, sum(price) * -1 - sum(tax_assigned) * -1 AS netto, sum(tax_assigned) * -1 AS tax
         FROM sales
-WHERE date >= '$opt_start'  AND date < '$opt_end'
+WHERE billing_date >= '$opt_start' AND billing_date < '$opt_end'
         AND price < 0.0 AND visible = 1
         AND category <> 'privat'
         AND category <> 'tax'};
         AND price < 0.0 AND visible = 1
         AND category <> 'privat'
         AND category <> 'tax'};
@@ -249,19 +249,19 @@ sub print_summary
     $sql = qq{
 SELECT '1 Einnahmen' AS type, sum(price) AS brutto, sum(price) - sum(tax_assigned) AS netto, sum(tax_assigned) AS tax
         FROM sales
     $sql = qq{
 SELECT '1 Einnahmen' AS type, sum(price) AS brutto, sum(price) - sum(tax_assigned) AS netto, sum(tax_assigned) AS tax
         FROM sales
-WHERE date >= '$opt_start'  AND date < '$opt_end'
+WHERE billing_date >= '$opt_start' AND billing_date < '$opt_end'
         AND price > 0.0 AND visible = 1
 UNION
 SELECT '2 Ausgaben' AS type, sum(price) * -1 AS brutto, sum(price) * -1 - sum(tax_assigned) * -1 AS netto, sum(tax_assigned) * -1 AS tax
         FROM sales
         AND price > 0.0 AND visible = 1
 UNION
 SELECT '2 Ausgaben' AS type, sum(price) * -1 AS brutto, sum(price) * -1 - sum(tax_assigned) * -1 AS netto, sum(tax_assigned) * -1 AS tax
         FROM sales
-WHERE date >= '$opt_start'  AND date < '$opt_end'
+WHERE billing_date >= '$opt_start' AND billing_date < '$opt_end'
         AND price < 0.0 AND visible = 1
         AND category <> 'privat'
         AND category <> 'tax'
 UNION
 SELECT '3 Summe' AS type, sum(price) AS brutto, sum(price) - sum(tax_assigned) AS netto, sum(tax_assigned) AS tax
         FROM sales
         AND price < 0.0 AND visible = 1
         AND category <> 'privat'
         AND category <> 'tax'
 UNION
 SELECT '3 Summe' AS type, sum(price) AS brutto, sum(price) - sum(tax_assigned) AS netto, sum(tax_assigned) AS tax
         FROM sales
-WHERE date >= '$opt_start'  AND date < '$opt_end'
+WHERE billing_date >= '$opt_start' AND billing_date < '$opt_end'
         AND visible = 1
         AND category <> 'privat'
         AND category <> 'tax'
         AND visible = 1
         AND category <> 'privat'
         AND category <> 'tax'