</tr>'; $TaxTotal += $FreightTaxTotal; $DisplaySubTotal = number_format($_SESSION['Items']->total + $_POST['ChargeFreightCost'], 2); /* round the totals to avoid silly entries */ $TaxTotal = round($TaxTotal, 2); $_SESSION['Items']->total = round($_SESSION['Items']->total, 2); $_POST['ChargeFreightCost'] = round($_POST['ChargeFreightCost'], 2); echo '<tr> <td colspan="10" class="number">' . _('Invoice Totals') . '</td> <td class="number:><hr><b>' . $DisplaySubTotal . '</b><hr></td> <td colspan="2"></td> <td class="number"><hr><b>' . number_format($TaxTotal, 2) . '</b><hr></td> <td class="number"><hr><b>' . number_format($TaxTotal + ($_SESSION['Items']->total + $_POST['ChargeFreightCost']), 2) . '</b><hr></td> </tr>'; if (!isset($_POST['DispatchDate']) or !Is_Date($_POST['DispatchDate'])) { $DefaultDispatchDate = Date($_SESSION['DefaultDateFormat'], CalcEarliestDispatchDate()); } else { $DefaultDispatchDate = $_POST['DispatchDate']; } echo '</table><br>'; if (isset($_POST['ProcessInvoice']) && $_POST['ProcessInvoice'] != "") { /* SQL to process the postings for sales invoices... /*First check there are lines on the dipatch with quantities to invoice invoices can have a zero amount but there must be a quantity to invoice */ $QuantityInvoicedIsPositive = false; foreach ($_SESSION['Items']->LineItems as $OrderLine) { if ($OrderLine->QtyDispatched > 0) { $QuantityInvoicedIsPositive = true; } }
} // This is not required on this page //echo '<a href="'. $rootpath . '/SelectSalesOrder.php?' . SID . '">'. _('Back to Sales Orders'). '</a><br>'; unset($_SESSION['WarnOnce']); if (!isset($_SESSION['Items' . $identifier]) or !isset($_SESSION['Items' . $identifier]->DebtorNo)) { prnMsg(_('This page can only be read if an order has been entered') . '. ' . _('To enter an order select customer transactions then sales order entry'), 'error'); include 'includes/footer.inc'; exit; } if ($_SESSION['Items' . $identifier]->ItemsOrdered == 0) { prnMsg(_('This page can only be read if an there are items on the order') . '. ' . _('To enter an order select customer transactions, then sales order entry'), 'error'); include 'includes/footer.inc'; exit; } /*Calculate the earliest dispacth date in DateFunctions.inc */ $EarliestDispatch = CalcEarliestDispatchDate(); if (isset($_POST['ProcessOrder']) or isset($_POST['MakeRecurringOrder'])) { /*need to check for input errors in any case before order processed */ $_POST['Update'] = 'Yes rerun the validation checks'; /*store the old freight cost before it is recalculated to ensure that there has been no change - test for change after freight recalculated and get user to re-confirm if changed */ $OldFreightCost = round($_POST['FreightCost'], 2); } if (isset($_POST['Update']) or isset($_POST['BackToLineDetails']) or isset($_POST['MakeRecurringOrder'])) { $InputErrors = 0; if (strlen($_POST['DeliverTo']) <= 1) { $InputErrors = 1; prnMsg(_('You must enter the person or company to whom delivery should be made'), 'error'); } if (strlen($_POST['BrAdd1']) <= 1) { $InputErrors = 1; prnMsg(_('You should enter the street address in the box provided') . '. ' . _('Orders cannot be accepted without a valid street address'), 'error');