//----------------------------------------------------------------------------------------------------
function get_invoice_range($from, $to)
{
//----------------------------------------------------------------------------------------------------
function get_invoice_range($from, $to)
{
$sql = "SELECT trans.trans_no, trans.reference
FROM ".TB_PREF."debtor_trans trans
$sql = "SELECT trans.trans_no, trans.reference
FROM ".TB_PREF."debtor_trans trans
$email = $_POST['PARAM_3'];
$pay_service = $_POST['PARAM_4'];
$comments = $_POST['PARAM_5'];
$email = $_POST['PARAM_3'];
$pay_service = $_POST['PARAM_4'];
$comments = $_POST['PARAM_5'];
if ($email == 0)
$rep = new FrontReport(_('INVOICE'), "InvoiceBulk", user_pagesize(), 9, $orientation);
if ($email == 0)
$rep = new FrontReport(_('INVOICE'), "InvoiceBulk", user_pagesize(), 9, $orientation);
$range = get_invoice_range($from, $to);
while($row = db_fetch($range))
{
$range = get_invoice_range($from, $to);
while($row = db_fetch($range))
{
- $myrow = get_customer_trans($i, ST_SALESINVOICE);
+ $myrow = get_customer_trans($row['trans_no'], ST_SALESINVOICE);
+
+ if ($customer && $myrow['debtor_no'] != $customer) {
+ continue;
+ }
+ if ($currency != ALL_TEXT && $myrow['curr_code'] != $currency) {
+ continue;
+ }
$baccount = get_default_bank_account($myrow['curr_code']);
$params['bankaccount'] = $baccount['id'];
$branch = get_branch($myrow["branch_code"]);
$sales_order = get_sales_order_header($myrow["order_"], ST_SALESORDER);
if ($email == 1)
$baccount = get_default_bank_account($myrow['curr_code']);
$params['bankaccount'] = $baccount['id'];
$branch = get_branch($myrow["branch_code"]);
$sales_order = get_sales_order_header($myrow["order_"], ST_SALESORDER);
if ($email == 1)
$rep = new FrontReport("", "", user_pagesize(), 9, $orientation);
$rep = new FrontReport("", "", user_pagesize(), 9, $orientation);
$rep->Info($params, $cols, null, $aligns);
$rep->Info($params, $cols, null, $aligns);
- $contacts = get_branch_contacts($branch['branch_code'], 'invoice', $branch['debtor_no'], false);
+ $contacts = get_branch_contacts($branch['branch_code'], 'invoice', $branch['debtor_no'], true);
$baccount['payment_service'] = $pay_service;
$rep->SetCommonData($myrow, $branch, $sales_order, $baccount, ST_SALESINVOICE, $contacts);
$baccount['payment_service'] = $pay_service;
$rep->SetCommonData($myrow, $branch, $sales_order, $baccount, ST_SALESINVOICE, $contacts);
$rep->TextColLines($c++, $c, $myrow2['StockDescription'], -2);
$newrow = $rep->row;
$rep->row = $oldrow;
$rep->TextColLines($c++, $c, $myrow2['StockDescription'], -2);
$newrow = $rep->row;
$rep->row = $oldrow;
{
$rep->TextCol($c++, $c, $DisplayQty, -2);
$rep->TextCol($c++, $c, $myrow2['units'], -2);
{
$rep->TextCol($c++, $c, $DisplayQty, -2);
$rep->TextCol($c++, $c, $myrow2['units'], -2);
// set to start of summary line:
$rep->row = $summary_start_row;
if (isset($prepayments))
{
// Partial invoices table
// set to start of summary line:
$rep->row = $summary_start_row;
if (isset($prepayments))
{
// Partial invoices table
- //$rep->NewLine();
- $rep->TextCol(1, 4,_("Prepayments invoiced to this order up to day:"));
- $rep->TextCol(1, 4, str_pad('', 150, '_'));
- $rep->cols[3] -= 20;
- $rep->aligns[3] = 'right';
- $rep->NewLine(); $c = 1; $tot_pym=0;
- $rep->TextCol(1, 4, str_pad('', 150, '_'));
+ $rep->TextCol(0, 3,_("Prepayments invoiced to this order up to day:"));
+ $rep->TextCol(0, 3, str_pad('', 150, '_'));
+ $rep->cols[2] -= 20;
+ $rep->aligns[2] = 'right';
+ $rep->NewLine(); $c = 0; $tot_pym=0;
+ $rep->TextCol(0, 3, str_pad('', 150, '_'));
$rep->TextCol($c++, $c, _("Date"));
$rep->TextCol($c++, $c, _("Invoice reference"));
$rep->TextCol($c++, $c, _("Amount"));
$rep->TextCol($c++, $c, _("Date"));
$rep->TextCol($c++, $c, _("Invoice reference"));
$rep->TextCol($c++, $c, _("Amount"));
$rep->TextCol($c++, $c, sql2date($invoice['tran_date']));
$rep->TextCol($c++, $c, $invoice['reference']);
$rep->TextCol($c++, $c, number_format2($invoice['prep_amount'], $dec));
}
if ($invoice['reference']==$myrow['reference']) break;
}
$rep->TextCol($c++, $c, sql2date($invoice['tran_date']));
$rep->TextCol($c++, $c, $invoice['reference']);
$rep->TextCol($c++, $c, number_format2($invoice['prep_amount'], $dec));
}
if ($invoice['reference']==$myrow['reference']) break;
}
- $rep->TextCol(1, 4, str_pad('', 150, '_'));
+ $rep->TextCol(0, 3, str_pad('', 150, '_'));
- $rep->TextCol(2, 3, _("Total payments:"));
- $rep->TextCol(3, 4, number_format2($tot_pym, $dec));
+ $rep->TextCol(1, 2, _("Total payments:"));
+ $rep->TextCol(2, 3, number_format2($tot_pym, $dec));
$rep->TextCol(3, 6, _("Sub-total"), -2);
$rep->TextCol(6, 7, $DisplaySubTot, -2);
$rep->NewLine();
$rep->TextCol(3, 6, _("Sub-total"), -2);
$rep->TextCol(6, 7, $DisplaySubTot, -2);
$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);
+ if ($myrow['ov_freight'] != 0.0)
+ {
+ $DisplayFreight = number_format2($sign*$myrow["ov_freight"],$dec);
+ $rep->TextCol(3, 6, _("Shipping"), -2);
+ $rep->TextCol(6, 7, $DisplayFreight, -2);
+ $rep->NewLine();
+ }
+ $tax_items = get_trans_tax_details(ST_SALESINVOICE, $row['trans_no']);
$tax_type_name = $tax_item['tax_type_name'];
else
$tax_type_name = $tax_item['tax_type_name']." (".$tax_item['rate']."%) ";
if ($myrow['tax_included'])
{
$tax_type_name = $tax_item['tax_type_name'];
else
$tax_type_name = $tax_item['tax_type_name']." (".$tax_item['rate']."%) ";
if ($myrow['tax_included'])
{