$rep = new FrontReport(_('INVOICE'), "InvoiceBulk", user_pagesize(), 9, $orientation);
if ($orientation == 'L')
recalculate_cols($cols);
- for ($i = $from; $i <= $to; $i++)
+
+ $range = get_invoice_range($from, $to);
+ while($row = db_fetch($range))
{
- if (!exists_customer_trans(ST_SALESINVOICE, $i))
+ if (!exists_customer_trans(ST_SALESINVOICE, $row['trans_no']))
continue;
$sign = 1;
- $myrow = get_customer_trans($i, ST_SALESINVOICE);
+ $myrow = get_customer_trans($row['trans_no'], ST_SALESINVOICE);
if($customer && $myrow['debtor_no'] != $customer) {
continue;
while($inv = db_fetch($result))
{
$prepayments[] = $inv;
- if ($inv['trans_no'] == $i)
+ if ($inv['trans_no'] == $row['trans_no'])
break;
}
unset($prepayments);
}
- $result = get_customer_trans_details(ST_SALESINVOICE, $i);
+ $result = get_customer_trans_details(ST_SALESINVOICE, $row['trans_no']);
$SubTotal = 0;
while ($myrow2=db_fetch($result))
{
$rep->NewPage();
}
- $memo = get_comments_string(ST_SALESINVOICE, $i);
+ $memo = get_comments_string(ST_SALESINVOICE, $row['trans_no']);
if ($memo != "")
{
$rep->NewLine();
$rep->TextCol(3, 6, _("Shipping"), -2);
$rep->TextCol(6, 7, $DisplayFreight, -2);
$rep->NewLine();
- $tax_items = get_trans_tax_details(ST_SALESINVOICE, $i);
+ $tax_items = get_trans_tax_details(ST_SALESINVOICE, $row['trans_no']);
$first = true;
while ($tax_item = db_fetch($tax_items))
{