UNION ALL
SELECT ac.acc_trans_id, ac.transdate, ac.gldate, ac.trans_id,gl.id, ac.amount, ac.taxkey, ac.memo,
- gl.reference AS invnumber, NULL AS duedate, ac.amount as umsatz, NULL as deliverydate, gl.itime::date,
+ gl.reference AS invnumber, NULL AS duedate, ac.amount as umsatz, gl.deliverydate, gl.itime::date,
gl.description AS name, NULL as ustid, '' AS vcname, NULL AS customer_id, NULL AS vendor_id,
c.accno, c.description AS accname, c.taxkey_id as charttax, c.datevautomatik, c.id, ac.chart_link AS link,
FALSE AS invoice,
if (($transaction->[$haben]->{'duedate'} // '') ne "") {
$datev_data{belegfeld2} = $transaction->[$haben]->{'duedate'};
}
+
+ # if deliverydate exists, add it to datev export if it is
+ # * an ar/ap booking that is not a payment
+ # * a gl booking
+ if ( ($transaction->[$haben]->{'deliverydate'} // '') ne ''
+ && (
+ ( $transaction->[$haben]->{'table'} =~ /^(ar|ap)$/
+ && $transaction->[$haben]->{'link'} !~ m/_paid/
+ && $transaction->[$soll]->{'link'} !~ m/_paid/
+ )
+ || $transaction->[$haben]->{'table'} eq 'gl'
+ )
+ ) {
+ $datev_data{leistungsdatum} = $transaction->[$haben]->{'deliverydate'};
+ }
}
$datev_data{umsatz} = abs($umsatz); # sales invoices without tax have a different sign???
=item errors
-Returns a list of errors that occured. If no errors occured, the export was a success.
+Returns a list of errors that occurred. If no errors occurred, the export was a success.
=item export