my $query =
qq|SELECT a.id, a.invnumber, a.transdate, a.duedate, a.amount, a.paid, | .
qq| a.ordnumber, v.name, a.invoice, a.netamount, a.datepaid, a.notes, | .
- qq| a.globalproject_id, | .
+ qq| a.globalproject_id, a.storno, a.storno_id, | .
qq| pr.projectnumber AS globalprojectnumber, | .
qq| e.name AS employee | .
qq|FROM ap a | .
qq|LEFT JOIN employee e ON (a.employee_id = e.id) | .
qq|LEFT JOIN project pr ON (a.globalproject_id = pr.id) |;
- my $where = qq| WHERE COALESCE(storno, false) != true |;
+ my $where = '';
my @values;
if ($form->{vendor_id}) {
}
if ($where) {
-# substr($where, 0, 4) = "WHERE";
+ substr($where, 0, 4, " WHERE ");
$query .= $where;
}
map { $ap->{$_} = $form->format_amount(\%myconfig, $ap->{$_}, 2) } qw(netamount tax amount paid due);
- $ap->{type} =
- $ap->{invoice} ? $locale->text("Invoice (one letter abbreviation)") :
- $locale->text("AP Transaction (abbreviation)");
+ my $is_storno = $ap->{storno} && $ap->{storno_id};
+ my $has_storno = $ap->{storno} && !$ap->{storno_id};
+
+ if ($ap->{invoice}) {
+ $ap->{type} =
+ $has_storno ? $locale->text("Invoice with Storno (abbreviation)")
+ : $is_storno ? $locale->text("Storno (one letter abbreviation)")
+ : $locale->text("Invoice (one letter abbreviation)");
+ } else {
+ $ap->{type} =
+ $has_storno ? $locale->text("AP Transaction with Storno (abbreviation)")
+ : $is_storno ? $locale->text("AP Transaction Storno (one letter abbreviation)")
+ : $locale->text("AP Transaction (abbreviation)");
+ }
my $row = { };
'AP Aging' => 'Offene Verbindlichkeiten',
'AP Transaction' => 'Kreditorenbuchung',
'AP Transaction (abbreviation)' => 'K',
+ 'AP Transaction Storno (one letter abbreviation)' => 'S',
+ 'AP Transaction with Storno (abbreviation)' => 'K(S)',
'AP Transactions' => 'Kreditorenbuchungen',
'AR' => 'Verkauf',
'AR Aging' => 'Offene Forderungen',
'Difference' => 'Differenz',
'Dimension unit' => 'Maßeinheit',
'Directory' => 'Verzeichnis',
- 'direct debit' => 'Lastschrift',
'Discount' => 'Rabatt',
'Display' => 'Anzeigen',
'Display file' => 'Datei anzeigen',
'debug' => 'Debug',
'delete' => 'Löschen',
'deliverydate' => 'Lieferdatum',
+ 'direct debit' => 'Lastschrift',
'disposed' => 'Entsorgung',
'done' => 'erledigt',
'down' => 'runter',
'AP' => 'Einkauf',
'AP Transaction' => 'Kreditorenbuchung',
'AP Transaction (abbreviation)' => 'K',
+ 'AP Transaction Storno (one letter abbreviation)' => 'S',
+ 'AP Transaction with Storno (abbreviation)' => 'K(S)',
'AP Transactions' => 'Kreditorenbuchungen',
'AR' => 'Verkauf',
'AR Transaction' => 'Debitorenbuchung',
'Invoice Date' => 'Rechnungsdatum',
'Invoice Date missing!' => 'Rechnungsdatum fehlt!',
'Invoice Number' => 'Rechnungsnummer',
+ 'Invoice with Storno (abbreviation)' => 'R(S)',
'Jan' => 'Jan',
'January' => 'Januar',
'Jul' => 'Jul',
'Skip' => 'Überspringen',
'Source' => 'Beleg',
'Storno' => 'Storno',
+ 'Storno (one letter abbreviation)' => 'S',
'Storno Invoice' => 'Stornorechnung',
'Storno Packing List' => 'Stornolieferschein',
'Subject' => 'Betreff',