[0004212] Work Order Entry: fixed error when voided WO refence is reused.
[fa-stable.git] / reporting / rep602.php
index 79b3387b3a1dbea64463eae9021c41e4c730947a..dd7c5427fefecac9c9d2ad4c7b0c543a0fb9a1ee 100644 (file)
@@ -44,14 +44,14 @@ function get_bank_transactions($from, $to, $account)
 {
        $from = date2sql($from);
        $to = date2sql($to);
-       $sql = "SELECT ".TB_PREF."bank_trans.*, ".TB_PREF."comments.memo_
-                       FROM ".TB_PREF."bank_trans LEFT JOIN ".TB_PREF."comments ON 
-                       (".TB_PREF."bank_trans.type = ".TB_PREF."comments.type
-                       AND ".TB_PREF."bank_trans.trans_no = ".TB_PREF."comments.id)
-               WHERE ".TB_PREF."bank_trans.bank_act = '$account'
+       $sql = "SELECT trans.*, com.memo_
+                       FROM "
+                               .TB_PREF."bank_trans trans
+                               LEFT JOIN ".TB_PREF."comments com ON trans.type = com.type AND trans.trans_no = com.id
+               WHERE trans.bank_act = '$account'
                AND trans_date >= '$from'
                AND trans_date <= '$to'
-               ORDER BY trans_date,".TB_PREF."bank_trans.id";
+               ORDER BY trans_date,trans.id";
 
        return db_query($sql,"The transactions for '$account' could not be retrieved");
 }
@@ -73,7 +73,7 @@ function print_bank_transactions_reconcile()
        $rep = new FrontReport(_('Bank Statement w/Reconcile'), "BankStatementReconcile", user_pagesize(), 9, "L");
        $dec = user_price_dec();
 
-       $cols = array(0, 90, 110, 170, 225, 450, 500, 550, 600, 660, 700);
+       $cols = array(0, 90, 120, 170, 225, 450, 500, 550, 600, 660, 700);
 
        $aligns = array('left', 'left', 'left', 'left', 'left', 'right', 'right', 'right', 'center', 'left');
 
@@ -108,11 +108,11 @@ function print_bank_transactions_reconcile()
                $rep->Font();
                $total = $prev_balance;
                $rep->NewLine(2);
+               // Keep a running total as we loop through
+               // the transactions.
+               $total_debit = $total_credit = 0;                       
                if ($rows > 0)
                {
-                       // Keep a running total as we loop through
-                       // the transactions.
-                       $total_debit = $total_credit = 0;                       
                        
                        while ($myrow=db_fetch($trans))
                        {
@@ -217,4 +217,3 @@ function print_bank_transactions_reconcile()
        $rep->End();
 }
 
-?>
\ No newline at end of file