handle_new_credit(0); } elseif (isset($_GET['ModifyCredit'])) { $_SESSION['page_title'] = sprintf(tr("Modifying Customer Credit Note #%d"), $_GET['ModifyCredit']); handle_new_credit($_GET['ModifyCredit']); $help_page_title = tr("Modifying Customer Credit Note"); } page($_SESSION['page_title'], false, false, "", $js); //----------------------------------------------------------------------------- check_db_has_stock_items(tr("There are no items defined in the system.")); check_db_has_customer_branches(tr("There are no customers, or there are no customers with branches. Please define customers and customer branches.")); //----------------------------------------------------------------------------- if (isset($_GET['AddedID'])) { $credit_no = $_GET['AddedID']; $trans_type = 11; display_notification_centered(sprintf(tr("Credit Note # %d has been processed"), $credit_no)); display_note(get_customer_trans_view_str($trans_type, $credit_no, tr("View this credit note")), 0, 1); display_note(get_gl_view_str($trans_type, $credit_no, tr("View the GL Journal Entries for this Credit Note"))); hyperlink_params($_SERVER['PHP_SELF'], tr("Enter Another Credit Note"), "NewCredit=yes"); display_footer_exit(); } //-------------------------------------------------------------------------------- function line_start_focus() { set_focus(get_company_pref('no_supplier_list') ? 'stock_id_edit' : 'StockID2'); } //----------------------------------------------------------------------------- function copy_to_cn() { $_SESSION['Items']->Comments = $_POST['CreditText']; $_SESSION['Items']->document_date = $_POST['OrderDate']; $_SESSION['Items']->freight_cost = input_num('ChargeFreightCost');
$due = false; while ($myrow = db_fetch($result)) { $begin = sql2date($myrow["begin"]); $end = sql2date($myrow["end"]); $last_sent = calculate_from($myrow); $due_date = add_months($last_sent, $myrow['monthly']); $due_date = add_days($due_date, $myrow['days']); $overdue = date1_greater_date2($today, $due_date) && date1_greater_date2($today, $begin) && date1_greater_date2($end, $today); if ($overdue) { start_row("class='overduebg'"); $due = true; } else { alt_table_row_color($k); } label_cell($myrow["description"]); label_cell(get_customer_trans_view_str(30, $myrow["order_no"])); if ($myrow["debtor_no"] == 0) { label_cell(""); label_cell(get_sales_group_name($myrow["group_no"])); } else { label_cell(get_customer_name($myrow["debtor_no"])); label_cell(get_branch_name($myrow['group_no'])); } label_cell($myrow["days"]); label_cell($myrow['monthly']); label_cell($begin); label_cell($end); label_cell($myrow['last_sent'] == "0000-00-00" ? "" : $last_sent); if ($overdue) { button_cell("create" . $myrow["id"], _("Create Invoices"), "", ICON_DOC); } else {
case 11: if ($myrow['order_'] == 0) { // free-hand credit note $edit_page = $path_to_root . '/sales/credit_note_entry.php?ModifyCredit=' . $myrow['trans_no']; } else { // credit invoice $edit_page = $path_to_root . '/sales/customer_credit_invoice.php?' . 'ModifyCredit=' . $myrow['trans_no']; } break; case 13: $edit_page = $path_to_root . '/sales/customer_delivery.php?ModifyDelivery=' . $myrow['trans_no']; break; } $date = sql2date($myrow["tran_date"]); if ($myrow["order_"] > 0) { $preview_order_str = get_customer_trans_view_str(systypes::sales_order(), $myrow["order_"]); } else { $preview_order_str = ""; } $gl_trans_str = get_gl_view_str_cell($myrow["type"], $myrow["trans_no"]); $branch_name = ""; if ($myrow["branch_code"] > 0) { $branch_name = get_branch_name($myrow["branch_code"]); } $preview_trans_str = get_trans_view_str($myrow["type"], $myrow["trans_no"]); label_cell(systypes::name($myrow["type"])); label_cell($preview_trans_str); label_cell($preview_order_str); label_cell($myrow["reference"]); label_cell($date, "nowrap"); label_cell($due_date_str, "nowrap");
function display_credit_items() { start_form(); hidden('cart_id'); start_table(TABLESTYLE2, "width=80%", 5); echo "<tr><td>"; // outer table start_table(TABLESTYLE, "width=100%"); start_row(); label_cells(_("Customer"), $_SESSION['Items']->customer_name, "class='tableheader2'"); label_cells(_("Branch"), get_branch_name($_SESSION['Items']->Branch), "class='tableheader2'"); label_cells(_("Currency"), $_SESSION['Items']->customer_currency, "class='tableheader2'"); end_row(); start_row(); // if (!isset($_POST['ref'])) // $_POST['ref'] = $Refs->get_next(11); if ($_SESSION['Items']->trans_no == 0) { ref_cells(_("Reference"), 'ref', '', null, "class='tableheader2'"); } else { label_cells(_("Reference"), $_SESSION['Items']->reference, "class='tableheader2'"); } label_cells(_("Crediting Invoice"), get_customer_trans_view_str(ST_SALESINVOICE, array_keys($_SESSION['Items']->src_docs)), "class='tableheader2'"); if (!isset($_POST['ShipperID'])) { $_POST['ShipperID'] = $_SESSION['Items']->ship_via; } label_cell(_("Shipping Company"), "class='tableheader2'"); shippers_list_cells(null, 'ShipperID', $_POST['ShipperID']); // if (!isset($_POST['sales_type_id'])) // $_POST['sales_type_id'] = $_SESSION['Items']->sales_type; // label_cell(_("Sales Type"), "class='tableheader2'"); // sales_types_list_cells(null, 'sales_type_id', $_POST['sales_type_id']); end_row(); end_table(); echo "</td><td>"; // outer table start_table(TABLESTYLE, "width=100%"); if ($_SESSION['Items']->custom_num != '') { text_row(_("Credit Memo No."), 'custom_num', $_SESSION['Items']->custom_num, null, "class='tableheader2'"); } else { text_row(_("Credit Memo No."), 'custom_num', '', null, "class='tableheader2'"); } //moodlearning label_row(_("Invoice Date"), $_SESSION['Items']->src_date, "class='tableheader2'"); date_row(_("Credit Note Date"), 'CreditDate', '', $_SESSION['Items']->trans_no == 0, 0, 0, 0, "class='tableheader2'"); end_table(); echo "</td></tr>"; end_table(1); // outer table div_start('credit_items'); start_table(TABLESTYLE, "width=80%"); $th = array(_("Item Code"), _("Item Description"), _("Invoiced Quantity"), _("Units"), _("Credited"), _("Credit Quantity"), _("Price"), _("Discount %"), _("Total")); //Karen edited Credited table_header($th); $k = 0; //row colour counter foreach ($_SESSION['Items']->line_items as $line_no => $ln_itm) { if ($ln_itm->quantity == $ln_itm->qty_done) { continue; // this line was fully credited/removed } alt_table_row_color($k); // view_stock_status_cell($ln_itm->stock_id); alternative view label_cell($ln_itm->stock_id); text_cells(null, 'Line' . $line_no . 'Desc', $ln_itm->item_description, 30, 50); $dec = get_qty_dec($ln_itm->stock_id); qty_cell($ln_itm->quantity, false, $dec); label_cell($ln_itm->units); label_cell($ln_itm->qty_done); //Karen edited amount_cells(null, 'Line' . $line_no, number_format2($ln_itm->qty_dispatched, $dec), null, null, $dec); $line_total = $ln_itm->qty_dispatched * $ln_itm->price * (1 - $ln_itm->discount_percent); amount_cell($ln_itm->price); percent_cell($ln_itm->discount_percent * 100); amount_cell($line_total); end_row(); } if (!check_num('ChargeFreightCost')) { $_POST['ChargeFreightCost'] = price_format($_SESSION['Items']->freight_cost); } $colspan = 8; //Karen edited 7 start_row(); label_cell(_("Credit Shipping Cost"), "colspan={$colspan} align=right"); small_amount_cells(null, "ChargeFreightCost", price_format(get_post('ChargeFreightCost', 0))); end_row(); /*moodlearning*/ start_row(); label_cell(_("Bulk Discount"), "colspan={$colspan} align=right"); small_amount_cells(null, "bulk_dis", $_SESSION['Items']->bulk_discount); end_row(); /* */ $inv_items_total = $_SESSION['Items']->get_items_total_dispatch(); $discount = input_num('bulk_dis') / 100; $display_sub_total = price_format($inv_items_total + input_num($_POST['ChargeFreightCost'])); label_row(_("Sub-total"), $display_sub_total, "colspan={$colspan} align=right", "align=right"); $taxes = $_SESSION['Items']->get_taxes(input_num($_POST['ChargeFreightCost'])); $tax_total = display_edit_tax_items($taxes, $colspan, $_SESSION['Items']->tax_included); /*moodlearning*/ $total = $inv_items_total + input_num('ChargeFreightCost') + $tax_total; $tot = price_format($total - $total * $discount); /* */ $display_total = price_format($inv_items_total + input_num('ChargeFreightCost') + $tax_total); label_row(_("Credit Note Total"), $tot, "colspan={$colspan} align=right", "align=right"); //moodlearning edit $tot end_table(); div_end(); }
// outer table start_table("{$table_style} width=100%"); start_row(); label_cells(tr("Customer"), $_SESSION['Items']->customer_name, "class='tableheader2'"); label_cells(tr("Branch"), get_branch_name($_SESSION['Items']->Branch), "class='tableheader2'"); label_cells(tr("Currency"), $_SESSION['Items']->customer_currency, "class='tableheader2'"); end_row(); start_row(); //if (!isset($_POST['ref'])) // $_POST['ref'] = references::get_next(13); if ($_SESSION['Items']->trans_no == 0) { ref_cells(tr("Reference"), 'ref', $_SESSION['Items']->reference, "class='tableheader2'"); } else { label_cells(tr("Reference"), $_SESSION['Items']->reference, "class='tableheader2'"); } label_cells(tr("For Sales Order"), get_customer_trans_view_str(systypes::sales_order(), $_SESSION['Items']->order_no), "class='tableheader2'"); label_cells(tr("Sales Type"), $_SESSION['Items']->sales_type_name, "class='tableheader2'"); end_row(); start_row(); if (!isset($_POST['Location'])) { $_POST['Location'] = $_SESSION['Items']->Location; } label_cell(tr("Delivery From"), "class='tableheader2'"); locations_list_cells(null, 'Location', $_POST['Location'], false, true); if (!isset($_POST['ship_via'])) { $_POST['ship_via'] = $_SESSION['Items']->ship_via; } label_cell(tr("Shipping Company"), "class='tableheader2'"); shippers_list_cells(null, 'ship_via', $_POST['ship_via']); // set this up here cuz it's used to calc qoh if (!isset($_POST['DispatchDate']) || !is_date($_POST['DispatchDate'])) {
if (isset($_GET['ModifyInvoice'])) { $_SESSION['page_title'] = sprintf(_("Modifying Sales Invoice # %d."), $_GET['ModifyInvoice']); $help_context = "Modifying Sales Invoice"; } elseif (isset($_GET['DeliveryNumber'])) { $_SESSION['page_title'] = _($help_context = "Issue an Invoice for Delivery Note"); } elseif (isset($_GET['BatchInvoice'])) { $_SESSION['page_title'] = _($help_context = "Issue Batch Invoice for Delivery Notes"); } page($_SESSION['page_title'], false, false, "", $js); //----------------------------------------------------------------------------- check_edit_conflicts(); if (isset($_GET['AddedID'])) { $invoice_no = $_GET['AddedID']; $trans_type = ST_SALESINVOICE; display_notification(_("Selected deliveries has been processed"), true); display_note(get_customer_trans_view_str($trans_type, $invoice_no, _("&View This Invoice")), 0, 1); display_note(print_document_link($invoice_no . "-" . $trans_type, _("&Print This Invoice"), true, ST_SALESINVOICE)); display_note(print_document_link($invoice_no . "-" . $trans_type, _("&Email This Invoice"), true, ST_SALESINVOICE, false, "printlink", "", 1), 1); display_note(get_gl_view_str($trans_type, $invoice_no, _("View the GL &Journal Entries for this Invoice")), 1); hyperlink_params("{$path_to_root}/sales/inquiry/sales_deliveries_view.php", _("Select Another &Delivery For Invoicing"), "OutstandingOnly=1"); hyperlink_no_params("{$path_to_root}/sales/inquiry/customer_allocation_inquiry.php?customer_id=", _("Go to Allocation Inquiry")); $sql = "SELECT trans_type_from, trans_no_from FROM " . TB_PREF . "cust_allocations\n\t\t\tWHERE trans_type_to=" . ST_SALESINVOICE . " AND trans_no_to=" . db_escape($invoice_no); $result = db_query($sql, "could not retrieve customer allocation"); $row = db_fetch($result); if ($row === false) { hyperlink_params("{$path_to_root}/sales/customer_payments.php", _("Entry &customer payment for this invoice"), "SInvoice=" . $invoice_no); } hyperlink_params("{$path_to_root}/admin/attachments.php", _("Add an Attachment"), "filterType={$trans_type}&trans_no={$invoice_no}"); display_footer_exit(); } elseif (isset($_GET['UpdatedID'])) { $invoice_no = $_GET['UpdatedID'];
function view_link($dummy, $order_no) { global $trans_type; return get_customer_trans_view_str($trans_type, $order_no); }
// outer table start_table(TABLESTYLE, "width=100%"); start_row(); label_cells(_("Customer"), $_SESSION['Items']->customer_name, "class='tableheader2'"); label_cells(_("Branch"), get_branch_name($_SESSION['Items']->Branch), "class='tableheader2'"); label_cells(_("Currency"), $_SESSION['Items']->customer_currency, "class='tableheader2'"); end_row(); start_row(); //if (!isset($_POST['ref'])) // $_POST['ref'] = $Refs->get_next(ST_CUSTDELIVERY); if ($_SESSION['Items']->trans_no == 0) { ref_cells(_("Reference"), 'ref', '', null, "class='tableheader2'"); } else { label_cells(_("Reference"), $_SESSION['Items']->reference, "class='tableheader2'"); } label_cells(_("For Sales Order"), get_customer_trans_view_str(ST_SALESORDER, $_SESSION['Items']->order_no), "class='tableheader2'"); label_cells(_("Sales Type"), $_SESSION['Items']->sales_type_name, "class='tableheader2'"); end_row(); start_row(); if (!isset($_POST['Location'])) { $_POST['Location'] = $_SESSION['Items']->Location; } label_cell(_("Delivery From"), "class='tableheader2'"); locations_list_cells(null, 'Location', null, false, true); if (!isset($_POST['ship_via'])) { $_POST['ship_via'] = $_SESSION['Items']->ship_via; } label_cell(_("Shipping Company"), "class='tableheader2'"); shippers_list_cells(null, 'ship_via', $_POST['ship_via']); // set this up here cuz it's used to calc qoh if (!isset($_POST['DispatchDate']) || !is_date($_POST['DispatchDate'])) {
function display_credit_items() { global $table_style, $table_style2; start_form(false, true); start_table("{$table_style2} width=80%", 5); echo "<tr><td>"; // outer table start_table("{$table_style} width=100%"); start_row(); label_cells(tr("Customer"), $_SESSION['Items']->customer_name, "class='tableheader2'"); label_cells(tr("Branch"), get_branch_name($_SESSION['Items']->Branch), "class='tableheader2'"); label_cells(tr("Currency"), $_SESSION['Items']->customer_currency, "class='tableheader2'"); end_row(); start_row(); // if (!isset($_POST['ref'])) // $_POST['ref'] = references::get_next(11); if ($_SESSION['Items']->trans_no == 0) { ref_cells(tr("Reference"), 'ref', $_SESSION['Items']->reference, "class='tableheader2'"); } else { label_cells(tr("Reference"), $_SESSION['Items']->reference, "class='tableheader2'"); } // label_cells(tr("Crediting Invoice"), get_customer_trans_view_str(10, $_SESSION['InvoiceToCredit']), "class='tableheader2'"); label_cells(tr("Crediting Invoice"), get_customer_trans_view_str(10, array_keys($_SESSION['Items']->src_docs)), "class='tableheader2'"); if (!isset($_POST['ShipperID'])) { $_POST['ShipperID'] = $_SESSION['Items']->ship_via; } label_cell(tr("Shipping Company"), "class='tableheader2'"); shippers_list_cells(null, 'ShipperID', $_POST['ShipperID']); // if (!isset($_POST['sales_type_id'])) // $_POST['sales_type_id'] = $_SESSION['Items']->sales_type; // label_cell(tr("Sales Type"), "class='tableheader2'"); // sales_types_list_cells(null, 'sales_type_id', $_POST['sales_type_id']); end_row(); end_table(); echo "</td><td>"; // outer table start_table("{$table_style} width=100%"); label_row(tr("Invoice Date"), $_SESSION['Items']->src_date, "class='tableheader2'"); date_row(tr("Credit Note Date"), 'CreditDate', null, 0, 0, 0, "class='tableheader2'"); end_table(); echo "</td></tr>"; end_table(1); // outer table start_table("{$table_style} width=80%"); $th = array(tr("Item Code"), tr("Item Description"), tr("Invoiced Quantity"), tr("Units"), tr("Credit Quantity"), tr("Price"), tr("Discount %"), tr("Total")); table_header($th); $k = 0; //row colour counter foreach ($_SESSION['Items']->line_items as $line_no => $ln_itm) { if ($ln_itm->quantity == $ln_itm->qty_done) { continue; // this line was fully credited } alt_table_row_color($k); // view_stock_status_cell($ln_itm->stock_id); alternative view label_cell($ln_itm->stock_id); text_cells(null, 'Line' . $line_no . 'Desc', $ln_itm->item_description, 30, 50); qty_cell($ln_itm->quantity); label_cell($ln_itm->units); amount_cells(null, 'Line' . $line_no, qty_format($ln_itm->qty_dispatched)); $line_total = $ln_itm->qty_dispatched * $ln_itm->price * (1 - $ln_itm->discount_percent); amount_cell($ln_itm->price); percent_cell($ln_itm->discount_percent * 100); amount_cell($line_total); end_row(); } if (!check_num('ChargeFreightCost')) { $_POST['ChargeFreightCost'] = price_format($_SESSION['Items']->freight_cost); } start_row(); label_cell(tr("Credit Shipping Cost"), "colspan=7 align=right"); amount_cells(null, "ChargeFreightCost", $_POST['ChargeFreightCost'], 6, 6); end_row(); $inv_items_total = $_SESSION['Items']->get_items_total_dispatch(); $display_sub_total = price_format($inv_items_total + input_num($_POST['ChargeFreightCost'])); label_row(tr("Sub-total"), $display_sub_total, "colspan=7 align=right", "align=right"); $taxes = $_SESSION['Items']->get_taxes(input_num($_POST['ChargeFreightCost'])); $tax_total = display_edit_tax_items($taxes, 7, $_SESSION['Items']->tax_included); $display_total = price_format($inv_items_total + input_num('ChargeFreightCost') + $tax_total); label_row(tr("Credit Note Total"), $display_total, "colspan=7 align=right", "align=right"); end_table(); }
label_row(null, $branch["br_name"] . "<br>" . nl2br($branch["br_address"]), "nowrap"); end_table(); echo "</td><td>"; // outer table start_table(TABLESTYLE, "width='100%'"); $th = array(_("Delivered To")); table_header($th); label_row(null, $sales_order["deliver_to"] . "<br>" . nl2br($sales_order["delivery_address"]), "nowrap"); end_table(); echo "</td><td>"; // 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(_("Dispatch Date"), sql2date($myrow["tran_date"]), "class='tableheader2'", "nowrap"); label_cells(_("Due Date"), sql2date($myrow["due_date"]), "class='tableheader2'", "nowrap"); end_row(); comments_display_row(ST_CUSTDELIVERY, $trans_id); end_table(); echo "</td></tr>"; end_table(1); // outer table
$allocations_str = ""; $allocations = "<a href='{$path_to_root}/sales/allocations/customer_allocate.php?trans_no=" . $myrow["trans_no"] . "&trans_type=" . $myrow["type"] . "'>" . tr("Allocation") . "</a>"; $due_date_str = ""; if ($myrow["type"] == 10) { $due_date_str = sql2date($myrow["due_date"]); } elseif ($myrow["type"] == 11 && $myrow['TotalAmount'] < 0) { /*its a credit note which could have an allocation */ $allocations_str = $allocations; } elseif ($myrow["type"] == systypes::cust_payment() && $myrow['TotalAmount'] + $myrow['Allocated'] < 0) { /*its a receipt which could have an allocation*/ $allocations_str = $allocations; } elseif ($myrow["type"] == systypes::cust_payment() && $myrow['TotalAmount'] > 0) { /*its a negative receipt */ } label_cell(systypes::name($myrow["type"])); label_cell(get_customer_trans_view_str($myrow["type"], $myrow["trans_no"])); label_cell($myrow["reference"]); label_cell($preview_order_str); label_cell(sql2date($myrow["tran_date"]), "nowrap"); label_cell($due_date_str, "nowrap"); if ($_POST['customer_id'] == reserved_words::get_all()) { label_cell($myrow["CustName"]); label_cell($myrow["CustCurrCode"]); } display_debit_or_credit_cells($myrow["TotalAmount"]); amount_cell(abs($myrow["Allocated"])); amount_cell(abs($myrow["TotalAmount"]) - $myrow["Allocated"]); label_cell($allocations_str); end_row(); $j++; if ($j == 12) {
label_row(null, $branch["br_name"] . "<br>" . nl2br($branch["br_address"]), "nowrap"); end_table(); echo "</td><td>"; // outer table start_table("{$table_style} width=100%"); $th = array(tr("Delivered To")); table_header($th); label_row(null, $sales_order["deliver_to"] . "<br>" . nl2br($sales_order["delivery_address"]), "nowrap"); end_table(); echo "</td><td>"; // outer table start_table("{$table_style} width=100%"); start_row(); label_cells(tr("Reference"), $myrow["reference"], "class='tableheader2'"); label_cells(tr("Currency"), $sales_order["curr_code"], "class='tableheader2'"); label_cells(tr("Our Order No"), get_customer_trans_view_str(systypes::sales_order(), $sales_order["order_no"]), "class='tableheader2'"); end_row(); start_row(); label_cells(tr("Customer Order Ref."), $sales_order["customer_ref"], "class='tableheader2'"); label_cells(tr("Shipping Company"), $myrow["shipper_name"], "class='tableheader2'"); label_cells(tr("Sales Type"), $myrow["sales_type"], "class='tableheader2'"); end_row(); start_row(); label_cells(tr("Dispatch Date"), sql2date($myrow["tran_date"]), "class='tableheader2'", "nowrap"); label_cells(tr("Due Date"), sql2date($myrow["due_date"]), "class='tableheader2'", "nowrap"); end_row(); comments_display_row(13, $trans_id); end_table(); echo "</td></tr>"; end_table(1); // outer table
if ($_POST['order_view_mode'] == 'InvoiceTemplates' || $_POST['order_view_mode'] == 'DeliveryTemplates') { $th[3] = tr('Description'); } elseif ($_POST['order_view_mode'] != 'OutstandingOnly') { $th[9] = tr('Tmpl'); $th[] = ''; $th[] = ''; $th[] = ''; } table_header($th); start_form(); $j = 1; $k = 0; //row colour counter $overdue_items = false; while ($myrow = db_fetch($result)) { $view_page = get_customer_trans_view_str(systypes::sales_order(), $myrow["order_no"]); $formated_del_date = sql2date($myrow["delivery_date"]); $formated_order_date = sql2date($myrow["ord_date"]); // $not_closed = $myrow['type'] && ($myrow["TotDelivered"] < $myrow["TotQuantity"]); // if overdue orders, then highlight as so if ($myrow['type'] == 0 && date1_greater_date2(Today(), $formated_del_date)) { start_row("class='overduebg'"); $overdue_items = true; } else { alt_table_row_color($k); } label_cell($view_page); label_cell($myrow["name"]); label_cell($myrow["br_name"]); if ($_POST['order_view_mode'] == 'InvoiceTemplates' || $_POST['order_view_mode'] == 'DeliveryTemplates') { label_cell($myrow["comments"]);
} } label_row(null, price_format($invoices_total), " ", "colspan=4 align=right"); end_table(); display_heading2(_("Credit Notes")); start_table(TABLESTYLE); $th = array(_("#"), _("Ref"), _("Date"), _("Total")); table_header($th); $credits_total = 0; if ($result = get_sales_child_documents(ST_SALESINVOICE, $inv_numbers)) { $k = 0; while ($credits_row = db_fetch($result)) { alt_table_row_color($k); $this_total = $credits_row["ov_freight"] + $credits_row["ov_freight_tax"] + $credits_row["ov_gst"] + $credits_row["ov_amount"]; $credits_total += $this_total; label_cell(get_customer_trans_view_str($credits_row["type"], $credits_row["trans_no"])); label_cell($credits_row["reference"]); label_cell(sql2date($credits_row["tran_date"])); amount_cell(-$this_total); end_row(); } } label_row(null, "<font color=red>" . price_format(-$credits_total) . "</font>", " ", "colspan=4 align=right"); end_table(); echo "</td></tr>"; end_table(); } echo "<center>"; if ($_SESSION['View']->so_type == 1) { display_note(_("This Sales Order is used as a Template."), 0, 0, "class='currentfg'"); }
// 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)) {
function order_link($row) { return $row['order_'] > 0 ? get_customer_trans_view_str(ST_SALESORDER, $row['order_']) : ""; }
function trans_view($trans, $trans_no) { return get_customer_trans_view_str(ST_CUSTDELIVERY, $trans['trans_no']); }
unset($_POST); } //------------------------------------------------------------------------------------------------- $result = get_recurrent_invoices(); start_form(); start_table(TABLESTYLE, "width=70%"); $th = array(_("Description"), _("Template No"), _("Customer"), _("Branch") . "/" . _("Group"), _("Days"), _("Monthly"), _("Begin"), _("End"), _("Last Created"), "", ""); table_header($th); $k = 0; while ($myrow = db_fetch($result)) { $begin = sql2date($myrow["begin"]); $end = sql2date($myrow["end"]); $last_sent = $myrow["last_sent"] == '0000-00-00' ? '' : sql2date($myrow["last_sent"]); alt_table_row_color($k); label_cell($myrow["description"]); label_cell(get_customer_trans_view_str(ST_SALESORDER, $myrow["order_no"])); if ($myrow["debtor_no"] == 0) { label_cell(""); label_cell(get_sales_group_name($myrow["group_no"])); } else { label_cell(get_customer_name($myrow["debtor_no"])); label_cell(get_branch_name($myrow['group_no'])); } label_cell($myrow["days"]); label_cell($myrow['monthly']); label_cell($begin); label_cell($end); label_cell($last_sent); edit_button_cell("Edit" . $myrow["id"], _("Edit")); delete_button_cell("Delete" . $myrow["id"], _("Delete")); end_row();
$is_batch_invoice = count($_SESSION['Items']->src_docs) > 1; $is_edition = $_SESSION['Items']->trans_type == 10 && $_SESSION['Items']->trans_no != 0; start_form(false, true); start_table("{$table_style2} width=80%", 5); start_row(); label_cells(tr("Customer"), $_SESSION['Items']->customer_name, "class='tableheader2'"); label_cells(tr("Branch"), get_branch_name($_SESSION['Items']->Branch), "class='tableheader2'"); label_cells(tr("Currency"), $_SESSION['Items']->customer_currency, "class='tableheader2'"); end_row(); start_row(); if ($_SESSION['Items']->trans_no == 0) { ref_cells(tr("Reference"), 'ref', $_SESSION['Items']->reference, "class='tableheader2'"); } else { label_cells(tr("Reference"), $_SESSION['Items']->reference, "class='tableheader2'"); } label_cells(tr("Delivery Notes"), get_customer_trans_view_str(systypes::cust_dispatch(), array_keys($_SESSION['Items']->src_docs)), "class='tableheader2'"); label_cells(tr("Sales Type"), $_SESSION['Items']->sales_type_name, "class='tableheader2'"); end_row(); start_row(); if (!isset($_POST['ship_via'])) { $_POST['ship_via'] = $_SESSION['Items']->ship_via; } label_cell(tr("Shipping Company"), "class='tableheader2'"); shippers_list_cells(null, 'ship_via', $_POST['ship_via']); if (!isset($_POST['InvoiceDate']) || !is_date($_POST['InvoiceDate'])) { $_POST['InvoiceDate'] = Today(); if (!is_date_in_fiscalyear($_POST['InvoiceDate'])) { $_POST['InvoiceDate'] = end_fiscalyear(); } } date_cells(tr("Date"), 'InvoiceDate', $_POST['InvoiceDate'], 0, 0, 0, "class='tableheader2'");