if (isset($_GET['BatchInvoice'])) { $src = $_SESSION['DeliveryBatch']; unset($_SESSION['DeliveryBatch']); } else { $src = array($_GET['DeliveryNumber']); } /*read in all the selected deliveries into the Items cart */ $dn = new Cart(ST_CUSTDELIVERY, $src, true); if ($dn->count_items() == 0) { hyperlink_params($path_to_root . "/sales/inquiry/sales_deliveries_view.php", _("Select a different delivery to invoice"), "OutstandingOnly=1"); die("<br><b>" . _("There are no delivered items with a quantity left to invoice. There is nothing left to invoice.") . "</b>"); } $_SESSION['Items'] = $dn; copy_from_cart(); } elseif (isset($_GET['ModifyInvoice']) && $_GET['ModifyInvoice'] > 0) { if (get_sales_parent_numbers(ST_SALESINVOICE, $_GET['ModifyInvoice']) == 0) { // 1.xx compatibility hack echo "<center><br><b>" . _("There are no delivery notes for this invoice.<br>\n\t\tMost likely this invoice was created in Front Accounting version prior to 2.0\n\t\tand therefore can not be modified.") . "</b></center>"; display_footer_exit(); } processing_start(); $_SESSION['Items'] = new Cart(ST_SALESINVOICE, $_GET['ModifyInvoice']); if ($_SESSION['Items']->count_items() == 0) { echo "<center><br><b>" . _("All quantities on this invoice has been credited. There is nothing to modify on this invoice") . "</b></center>"; display_footer_exit(); } copy_from_cart(); } elseif (!processing_active()) { /* This page can only be called with a delivery for invoicing or invoice no for edit */ display_error(_("This page can only be opened after delivery selection. Please select delivery to invoicing first.")); hyperlink_no_params("{$path_to_root}/sales/inquiry/sales_deliveries_view.php", _("Select Delivery to Invoice"));
// outer table start_table(TABLESTYLE, "width=100%"); start_row(); label_cells(_("Reference"), $myrow["reference"], "class='tableheader2'"); label_cells(_("Currency"), $sales_order["curr_code"], "class='tableheader2'"); label_cells(_("Our Order No"), get_customer_trans_view_str(ST_SALESORDER, $sales_order["order_no"]), "class='tableheader2'"); end_row(); start_row(); label_cells(_("Customer Order Ref."), $sales_order["customer_ref"], "class='tableheader2'"); label_cells(_("Shipping Company"), $myrow["shipper_name"], "class='tableheader2'"); label_cells(_("Sales Type"), $myrow["sales_type"], "class='tableheader2'"); end_row(); start_row(); label_cells(_("Invoice Date"), sql2date($myrow["tran_date"]), "class='tableheader2'", "nowrap"); label_cells(_("Due Date"), sql2date($myrow["due_date"]), "class='tableheader2'", "nowrap"); label_cells(_("Deliveries"), get_customer_trans_view_str(ST_CUSTDELIVERY, get_sales_parent_numbers(ST_SALESINVOICE, $trans_id)), "class='tableheader2'"); end_row(); comments_display_row(ST_SALESINVOICE, $trans_id); end_table(); echo "</td></tr>"; end_table(1); // outer table $result = get_customer_trans_details(ST_SALESINVOICE, $trans_id); start_table(TABLESTYLE, "width=95%"); if (db_num_rows($result) > 0) { $th = array(_("Item Code"), _("Item Description"), _("Quantity"), _("Unit"), _("Price"), _("Discount %"), _("Total")); table_header($th); $k = 0; //row colour counter $sub_total = 0; while ($myrow2 = db_fetch($result)) {