X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FRP.pm;h=072c54bd42123ed4151035c51b09e87839dd6b05;hb=4f7b541697e2226be9a7ff9ac0dc62f8b4002544;hp=113e9dd42b389dd43fee56e2993902b6a3348c51;hpb=8ef312a73d7d2e2db8274a9ab9d88bfd387bfc4c;p=kivitendo-erp.git diff --git a/SL/RP.pm b/SL/RP.pm index 113e9dd42..072c54bd4 100644 --- a/SL/RP.pm +++ b/SL/RP.pm @@ -211,6 +211,13 @@ sub get_accounts { $sth->finish; + # if l_ob is selected l_cb is always ignored + if ( $form->{l_ob} ) { + $where .= ' AND ac.ob_transaction is true ' + } elsif ( not $form->{l_cb} ) { + $where .= ' AND ac.cb_transaction is false '; + }; + if ($fromdate) { $fromdate = conv_dateq($fromdate); if ($form->{method} eq 'cash') { @@ -464,6 +471,8 @@ sub get_accounts_g { my $inwhere = ""; my $item; + $where .= ' AND ac.cb_transaction is false ' unless $form->{l_cb}; + if ($fromdate) { $fromdate = conv_dateq($fromdate); if ($form->{method} eq 'cash') { @@ -512,7 +521,7 @@ sub get_accounts_g { FROM acc_trans acc INNER JOIN chart c ON (acc.chart_id = c.id AND c.link LIKE '%AR_paid%') WHERE 1=1 $inwhere AND acc.trans_id = ac.trans_id) - / (SELECT amount FROM ar WHERE id = ac.trans_id) + / COALESCE((SELECT amount FROM ar WHERE id = ac.trans_id and amount != 0 ), 1) ) AS amount, c.pos_eur FROM acc_trans ac LEFT JOIN chart c ON (c.id = ac.chart_id) @@ -1219,7 +1228,7 @@ sub aging { phone as customerphone, fax as customerfax, ${ct}number, "invnumber", "transdate", (amount - COALESCE((SELECT sum(amount)*$ml FROM acc_trans LEFT JOIN chart ON (acc_trans.chart_id=chart.id) WHERE link ilike '%paid%' AND acc_trans.trans_id=${arap}.id AND acc_trans.transdate <= (date $todate)),0)) as "open", "amount", - "duedate", invoice, ${arap}.id, + "duedate", invoice, ${arap}.id, date_part('days', now() - duedate) as overduedays, (SELECT $buysell FROM exchangerate WHERE (${arap}.curr = exchangerate.curr) @@ -1293,27 +1302,6 @@ sub get_customer { $main::lxdebug->leave_sub(); } -sub get_taxaccounts { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form) = @_; - - # connect to database - my $dbh = $form->dbconnect($myconfig); - - # get tax accounts - my $query = - qq|SELECT c.accno, c.description, t.rate - FROM chart c, tax t - WHERE (c.link LIKE '%CT_tax%') AND (c.id = t.chart_id) - ORDER BY c.accno|; - $form->{taxaccounts} = selectall_hashref_quert($form, $dbh, $query); - - $dbh->disconnect; - - $main::lxdebug->leave_sub(); -} - sub tax_report { $main::lxdebug->enter_sub();