[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Reconciliation page reconciles too much?
- Subject: Reconciliation page reconciles too much?
- From: Dean Serenevy <..hidden..>
- Date: Fri, 04 Mar 2011 16:48:07 -0500
The Reconciliation page is reconciling more than I would expect it to.
If I enter payroll into a single monster AP transaction, then use a separate row in "Payments" for each check paid out, I am unable to reconcile checks individually, checking one item off in the reconciliation page clears all checks made on the same day to/from the same chart.
In RC.pm, the reconcile sub determines the trans_id using source, date, and chart as a lookup value, but then clears all transactions regardless of source.
UPDATE acc_trans
SET cleared = '1'
WHERE cleared = '0' AND transdate = ? AND chart_id = ?
* Is this a bug in LedgerSMB?
* If not, what is the purpose of reconciling line items which do not have a matching source? More precisely, what trouble might I be in if I modify that sub to behave as I expect and only clear lines which have a matching source (for instance, using the attached patch - actually, in the non-summary case, the patch should probably just use entry_id, no?).
Thanks,
Dean
Index: LedgerSMB/RC.pm
===================================================================
--- LedgerSMB/RC.pm (revision 3124)
+++ LedgerSMB/RC.pm (working copy)
@@ -472,10 +472,17 @@
$query = qq|
UPDATE acc_trans
SET cleared = '1'
- WHERE cleared = '0' AND trans_id = ? AND transdate = ?
+ WHERE cleared = '0' AND trans_id = ? AND transdate = ? AND (source IS NULL or source = '')
AND chart_id = | . $dbh->quote($chart_id);
my $tth = $dbh->prepare($query) || $form->dberror($query);
+ $query = qq|
+ UPDATE acc_trans
+ SET cleared = '1'
+ WHERE cleared = '0' AND trans_id = ? AND transdate = ? AND source = ?
+ AND chart_id = | . $dbh->quote($chart_id);
+ my $tth_src = $dbh->prepare($query) || $form->dberror($query);
+
# clear flags
for $i ( 1 .. $form->{rowcount} ) {
if ( $form->{"cleared_$i"} && !$form->{"oldcleared_$i"} ) {
@@ -484,18 +491,32 @@
|| $form->dberror;
while ( ($trans_id) = $sth->fetchrow_array ) {
+ if (length($form->{"source_$i"})) {
+ $tth_src->execute( $trans_id, $form->{"transdate_$i"}, $form->{"source_$i"} )
+ || $form->dberror;
+ $tth_src->finish;
+ }
+ else {
$tth->execute( $trans_id, $form->{"transdate_$i"} )
|| $form->dberror;
$tth->finish;
+ }
}
$sth->finish;
}
else {
+ if (length($form->{"source_$i"})) {
+ $tth_src->execute( $form->{"id_$i"}, $form->{"transdate_$i"}, $form->{"source_$i"} )
+ || $form->dberror;
+ $tth_src->finish;
+ }
+ else {
$tth->execute( $form->{"id_$i"}, $form->{"transdate_$i"} )
|| $form->dberror;
$tth->finish;
+ }
}
}
}