display_error(tr("Cannot delete the supplier record because purchase orders have been created against this supplier.")); } } if ($cancel_delete == 0) { $sql = "DELETE FROM suppliers WHERE supplier_id='" . $_POST['supplier_id'] . "'"; db_query($sql, "check failed"); unset($_SESSION['supplier_id']); meta_forward($_SERVER['PHP_SELF']); } //end if Delete supplier } start_form(); if (db_has_suppliers()) { start_table("", 3); start_row(); supplier_list_cells(tr("Select a supplier: "), 'supplier_id', null); submit_cells('SelectSupplier', tr("Edit Supplier")); end_row(); end_table(); } else { hidden('supplier_id', $_POST['supplier_id']); } hyperlink_params($_SERVER['PHP_SELF'], tr("Enter a new supplier"), "New=1"); echo "<br>"; //start_table("class='tablestyle2'", 0, 3); start_table("class='tablestyle'", 3); table_section_title(tr("Supplier")); if (isset($_POST['supplier_id']) && !isset($_POST['New'])) { //SupplierID exists - either passed when calling the form or from the form itself $myrow = get_supplier($_POST['supplier_id']); $_POST['supp_name'] = $myrow["supp_name"];
$Ajax->activate('orders_tbl'); } //--------------------------------------------------------------------------------------------- start_form(); start_table(TABLESTYLE_NOBORDER); start_row(); ref_cells(_("#:"), 'order_number', '', null, '', true); date_cells(_("from:"), 'OrdersAfterDate', '', null, -30); date_cells(_("to:"), 'OrdersToDate'); locations_list_cells(_("Location:"), 'StockLocation', null, true); end_row(); end_table(); start_table(TABLESTYLE_NOBORDER); start_row(); stock_items_list_cells(_("Item:"), 'SelectStockFromList', null, true); supplier_list_cells(_("Select a supplier: "), 'supplier_id', null, true, true); submit_cells('SearchOrders', _("Search"), '', _('Select documents'), 'default'); end_row(); end_table(1); //--------------------------------------------------------------------------------------------- function trans_view($trans) { return get_trans_view_str(ST_PURCHORDER, $trans["order_no"]); } function edit_link($row) { return pager_link(_("Edit"), "/purchasing/po_entry_items.php?ModifyOrderNumber=" . $row["order_no"], ICON_EDIT); } function prt_link($row) { return print_document_link($row['order_no'], _("Print"), true, 18, ICON_PRINT);
} } if ($cancel_delete == 0) { delete_supplier($_POST['supplier_id']); unset($_SESSION['supplier_id']); $supplier_id = ''; $Ajax->activate('_page_body'); } //end if Delete supplier } start_form(); if (db_has_suppliers()) { start_table(false, "", 3); // start_table(TABLESTYLE_NOBORDER); start_row(); supplier_list_cells(_("Select a supplier: "), 'supplier_id', null, _('New supplier'), true, check_value('show_inactive')); check_cells(_("Show inactive:"), 'show_inactive', null, true); end_row(); end_table(); if (get_post('_show_inactive_update')) { $Ajax->activate('supplier_id'); set_focus('supplier_id'); } } else { hidden('supplier_id', get_post('supplier_id')); } if (!$supplier_id) { unset($_POST['_tabs_sel']); } // force settings tab for new customer tabbed_content_start('tabs', array('settings' => array(_('&General settings'), $supplier_id), 'contacts' => array(_('&Contacts'), $supplier_id), 'transactions' => array(_('&Transactions'), $supplier_id), 'orders' => array(_('Purchase &Orders'), $supplier_id)));
$_POST['TransAfterDate'] = $_GET['FromDate']; } if (isset($_GET['ToDate'])) { $_POST['TransToDate'] = $_GET['ToDate']; } //------------------------------------------------------------------------------------------------ if (!@$_GET['popup']) { start_form(); } if (!isset($_POST['supplier_id'])) { $_POST['supplier_id'] = get_global_supplier(); } start_table(TABLESTYLE_NOBORDER); start_row(); if (!@$_GET['popup']) { supplier_list_cells(_("Select a supplier:"), 'supplier_id', null, true, false, false, !@$_GET['popup']); } date_cells(_("From:"), 'TransAfterDate', '', null, -30); date_cells(_("To:"), 'TransToDate'); supp_transactions_list_cell("filterType", null, true); submit_cells('RefreshInquiry', _("Search"), '', _('Refresh Inquiry'), 'default'); end_row(); end_table(); set_global_supplier($_POST['supplier_id']); //------------------------------------------------------------------------------------------------ function display_supplier_summary($supplier_record) { $past1 = get_company_pref('past_due_days'); $past2 = 2 * $past1; $nowdue = "1-" . $past1 . " " . _('Days'); $pastdue1 = $past1 + 1 . "-" . $past2 . " " . _('Days');
$_POST['supplier_id'] = $_GET['supplier_id']; } if (isset($_GET['FromDate'])) { $_POST['TransAfterDate'] = $_GET['FromDate']; } if (isset($_GET['ToDate'])) { $_POST['TransToDate'] = $_GET['ToDate']; } //------------------------------------------------------------------------------------------------ start_form(); if (!isset($_POST['supplier_id'])) { $_POST['supplier_id'] = get_global_supplier(); } start_table(TABLESTYLE_NOBORDER); start_row(); supplier_list_cells(_("Select a supplier: "), 'supplier_id', $_POST['supplier_id'], true); date_cells(_("From:"), 'TransAfterDate', '', null, -30); date_cells(_("To:"), 'TransToDate', '', null, 1); supp_allocations_list_cell("filterType", null); check_cells(_("show settled:"), 'showSettled', null); submit_cells('RefreshInquiry', _("Search"), '', _('Refresh Inquiry'), 'default'); set_global_supplier($_POST['supplier_id']); end_row(); end_table(); //------------------------------------------------------------------------------------------------ function check_overdue($row) { return $row['TotalAmount'] > $row['Allocated'] && $row['OverDue'] == 1; } function systype_name($dummy, $type) {