display_error(tr("Cannot delete this branch because sales orders exist for it. Purge old sales orders first.")); } else { $sql = "DELETE FROM cust_branch WHERE branch_code='" . $_POST['branch_code'] . "' AND debtor_no='" . $_POST['customer_id'] . "'"; db_query($sql, "could not delete branch"); meta_forward($_SERVER['PHP_SELF'], "debtor_no=" . $_POST['customer_id']); } } //end ifs to test if the branch can be deleted } start_form(); echo "<center>" . tr("Select a customer: ") . " "; customer_list('customer_id', null, false, true); echo "</center><br><br>"; check_branches(); // we always want to have a branch (if possible) $num_branches = db_customer_has_branches($_POST['customer_id']); if ($num_branches) { $sql = "SELECT debtors_master.name, cust_branch.*, salesman.salesman_name," . "areas.description, tax_groups.name AS tax_group_name " . "FROM cust_branch, debtors_master, areas, salesman, tax_groups " . "WHERE cust_branch.debtor_no=debtors_master.debtor_no " . "AND cust_branch.tax_group_id=tax_groups.id " . "AND cust_branch.area=areas.area_code " . "AND cust_branch.salesman=salesman.salesman_code " . "AND cust_branch.debtor_no = '" . $_POST['customer_id'] . "'"; $result = db_query($sql, "could not get customer branches"); start_table("{$table_style} width=60%"); $th = array(tr("Name"), tr("Contact"), tr("Sales Person"), tr("Area"), tr("Phone No"), tr("Fax No"), tr("E-mail"), tr("Tax Group"), "", ""); table_header($th); while ($myrow = db_fetch($result)) { start_row(); label_cell($myrow["br_name"]); label_cell($myrow["contact_name"]); label_cell($myrow["salesman_name"]); label_cell($myrow["description"]); label_cell($myrow["phone"]); label_cell($myrow["fax"]); label_cell("<a href=mailto:" . $myrow["email"] . ">" . $myrow["email"] . "</a>");
function display_item_form() { global $table_style2; start_table($table_style2, 5, 7); echo "<tr><td valign=top>"; // outer table echo "<table>"; if (!isset($_POST['customer_id'])) { $_POST['customer_id'] = get_global_customer(false); } if (!isset($_POST['DateBanked'])) { $_POST['DateBanked'] = Today(); if (!is_date_in_fiscalyear($_POST['DateBanked'])) { $_POST['DateBanked'] = end_fiscalyear(); } } customer_list_row(tr("From Customer:"), 'customer_id', null, false, true); if (db_customer_has_branches($_POST['customer_id'])) { customer_branches_list_row(tr("Branch:"), $_POST['customer_id'], 'BranchID', null, false, true, true); } else { hidden('BranchID', reserved_words::get_any_numeric()); } read_customer_data(); set_global_customer($_POST['customer_id']); if (isset($_POST['HoldAccount']) && $_POST['HoldAccount'] != 0) { echo "</table></table>"; display_note(tr("This customer account is on hold."), 0, 0, "class='redfb'"); } else { $display_discount_percent = percent_format($_POST['pymt_discount'] * 100) . "%"; amount_row(tr("Amount:"), 'amount'); amount_row(tr("Amount of Discount:"), 'discount'); label_row(tr("Customer prompt payment discount :"), $display_discount_percent); date_row(tr("Date of Deposit:"), 'DateBanked'); echo "</table>"; echo "</td><td valign=top class='tableseparator'>"; // outer table echo "<table>"; bank_accounts_list_row(tr("Into Bank Account:"), 'bank_account', null, true); $cust_currency = get_customer_currency($_POST['customer_id']); $bank_currency = get_bank_account_currency($_POST['bank_account']); if ($cust_currency != $bank_currency) { exchange_rate_display($cust_currency, $bank_currency, $_POST['DateBanked']); } bank_trans_types_list_row(tr("Type:"), 'ReceiptType', null); text_row(tr("Reference:"), 'ref', null, 20, 40); textarea_row(tr("Memo:"), 'memo_', null, 22, 4); echo "</table>"; echo "</td></tr>"; end_table(); // outer table if ($cust_currency != $bank_currency) { display_note(tr("Amount and discount are in customer's currency.")); } echo "<br>"; submit_center('AddPaymentItem', tr("Add Payment")); } echo "<br>"; }
hidden('trans_no'); hidden('old_ref', $old_ref); start_outer_table(TABLESTYLE2, "width=60%", 5); table_section(1); if ($new) { customer_list_row(_("From Customer:"), 'customer_id', null, false, true); } else { label_cells(_("From Customer:"), $_POST['customer_name'], "class='label'"); hidden('customer_id', $_POST['customer_id']); } if (list_updated('customer_id') || $new && list_updated('bank_account')) { $_SESSION['alloc']->read(); $_POST['memo_'] = $_POST['amount'] = $_POST['discount'] = ''; $Ajax->activate('alloc_tbl'); } if (db_customer_has_branches($_POST['customer_id'])) { customer_branches_list_row(_("Branch:"), $_POST['customer_id'], 'BranchID', null, false, true, true); } else { hidden('BranchID', ANY_NUMERIC); } read_customer_data(); set_global_customer($_POST['customer_id']); if (isset($_POST['HoldAccount']) && $_POST['HoldAccount'] != 0) { display_warning(_("This customer account is on hold.")); } $display_discount_percent = percent_format($_POST['pymt_discount'] * 100) . "%"; table_section(2); if (!list_updated('bank_account')) { $_POST['bank_account'] = get_default_customer_bank_account($_POST['customer_id']); } //Chaitanya : 13-OCT-2011 - Is AJAX call really needed ???
text_row_ex($payment ? _("To the Order of:") : _("Name:"), 'person_id', 40, 50); textarea_row(_("Address:"), 'address', '', 40, 3); //moodlearning break; //case PT_WORKORDER : // workorders_list_row(_("Work Order:"), 'person_id', null); // break; //case PT_WORKORDER : // workorders_list_row(_("Work Order:"), 'person_id', null); // break; case PT_SUPPLIER: supplier_list_row(_("Supplier:"), 'person_id', null, false, true, false, true); break; case PT_CUSTOMER: customer_list_row(_("Customer:"), 'person_id', null, false, true, false, true); if (db_customer_has_branches($_POST['person_id'])) { customer_branches_list_row(_("Branch:"), $_POST['person_id'], 'PersonDetailID', null, false, true, true, true); } else { $_POST['PersonDetailID'] = ANY_NUMERIC; hidden('PersonDetailID'); } $trans = get_customer_habit($_POST['person_id']); // take care of customers on hold if ($trans['dissallow_invoices'] != 0) { if ($payment) { $customer_error = true; display_error(_("This customer account is on hold.")); } else { display_warning(_("This customer account is on hold.")); } }