Dimensions not utilized in Direct Invoice/Delivery
[fa-stable.git] / reporting / rep112.php
index d2e06c0964a0e4e221f097366220d21d19f9cf02..ba6c94653b4571ccf24f83b4ff94a1294ad7efd4 100644 (file)
@@ -71,14 +71,14 @@ function print_receipts()
        $currency = $_POST['PARAM_2'];
        $comments = $_POST['PARAM_3'];
 
-       if ($from == null)
-               $from = 0;
-       if ($to == null)
-               $to = 0;
+       if (!$from || !$to) return;
+
        $dec = user_price_dec();
 
        $fno = explode("-", $from);
        $tno = explode("-", $to);
+       $from = min($fno[0], $tno[0]);
+       $to = max($fno[0], $tno[0]);
 
        $cols = array(4, 85, 150, 225, 275, 360, 450, 515);
 
@@ -95,7 +95,7 @@ function print_receipts()
        $rep->Font();
        $rep->Info($params, $cols, null, $aligns);
 
-       for ($i = $fno[0]; $i <= $tno[0]; $i++)
+       for ($i = $from; $i <= $to; $i++)
        {
                if ($fno[0] == $tno[0])
                        $types = array($fno[1]);
@@ -106,8 +106,9 @@ function print_receipts()
                        $myrow = get_receipt($j, $i);
                        if (!$myrow)
                                continue;                       
-                       $baccount = get_default_bank_account($myrow['curr_code']);
-                       $params['bankaccount'] = $baccount['id'];
+                       $res = get_bank_trans($j, $i);
+                       $baccount = db_fetch($res);
+                       $params['bankaccount'] = $baccount['bank_act'];
 
                        $rep->title = _('RECEIPT');
                        $contacts = get_branch_contacts($myrow['branch_code'], 'invoice', $myrow['debtor_no']);
@@ -137,6 +138,13 @@ function print_receipts()
                                        $rep->NewPage();
                        }
 
+                       $memo = get_comments_string($j, $i);
+                       if ($memo != "")
+                       {
+                               $rep->NewLine();
+                               $rep->TextColLines(1, 5, $memo, -2);
+                       }
+
                        $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
 
                        $rep->TextCol(3, 6, _("Total Allocated"), -2);