- $sql = "SELECT * FROM ".TB_PREF."debtors_master WHERE debtor_no = '" . $_POST['customer_id'] . "'";
- $result = db_query($sql,"check failed");
-
- $myrow = db_fetch($result);
-
- $_POST['CustName'] = $myrow["name"];
- $_POST['address'] = $myrow["address"];
- $_POST['tax_id'] = $myrow["tax_id"];
- $_POST['email'] = $myrow["email"];
- $_POST['dimension_id'] = $myrow["dimension_id"];
- $_POST['dimension2_id'] = $myrow["dimension2_id"];
- $_POST['sales_type'] = $myrow["sales_type"];
- $_POST['curr_code'] = $myrow["curr_code"];
- $_POST['credit_status'] = $myrow["credit_status"];
- $_POST['payment_terms'] = $myrow["payment_terms"];
- $_POST['discount'] = percent_format($myrow["discount"] * 100);
- $_POST['pymt_discount'] = percent_format($myrow["pymt_discount"] * 100);
- $_POST['credit_limit'] = price_format($myrow["credit_limit"]);
-}
+ if (!$selected_id || is_new_customer($selected_id))
+ {
+ currencies_list_row(_("Customer's Currency:"), 'curr_code', $_POST['curr_code']);
+ }
+ else
+ {
+ label_row(_("Customer's Currency:"), $_POST['curr_code']);
+ hidden('curr_code', $_POST['curr_code']);
+ }
+ sales_types_list_row(_("Sales Type/Price List:"), 'sales_type', $_POST['sales_type']);
+
+ if($selected_id)
+ record_status_list_row(_("Customer status:"), 'inactive');
+
+ table_section(2);
+
+ table_section_title(_("Sales"));
+
+ percent_row(_("Discount Percent:"), 'discount', $_POST['discount']);
+ percent_row(_("Prompt Payment Discount Percent:"), 'pymt_discount', $_POST['pymt_discount']);
+ amount_row(_("Credit Limit:"), 'credit_limit', $_POST['credit_limit']);
+
+ payment_terms_list_row(_("Payment Terms:"), 'payment_terms', $_POST['payment_terms']);
+ credit_status_list_row(_("Credit Status:"), 'credit_status', $_POST['credit_status']);
+ $dim = get_company_pref('use_dimension');
+ if ($dim >= 1)
+ dimensions_list_row(_("Dimension")." 1:", 'dimension_id', $_POST['dimension_id'], true, " ", false, 1);
+ if ($dim > 1)
+ dimensions_list_row(_("Dimension")." 2:", 'dimension2_id', $_POST['dimension2_id'], true, " ", false, 2);
+ if ($dim < 1)
+ hidden('dimension_id', 0);
+ if ($dim < 2)
+ hidden('dimension2_id', 0);
+
+ if ($selected_id) {
+ start_row();
+ echo '<td class="label">'._('Customer branches').':</td>';
+ hyperlink_params_td($path_to_root . "/sales/manage/customer_branches.php",
+ '<b>'. (@$_REQUEST['popup'] ? _("Select or &Add") : _("&Add or Edit ")).'</b>',
+ "debtor_no=".$selected_id.(@$_REQUEST['popup'] ? '&popup=1':''));
+ end_row();
+ }