From f7c756dac5a70f01550b1fceb99c6858e232faf2 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Sat, 10 Jan 2009 11:23:56 +0000 Subject: [PATCH] Added more fields to suppliers table and fixed PO document --- CHANGELOG.txt | 6 ++++++ includes/ui/ui_input.inc | 10 ++++++++++ purchasing/manage/suppliers.php | 22 ++++++++++++++++++---- reporting/includes/header2.inc | 4 +++- reporting/rep209.php | 2 +- sql/alter2.1.sql | 9 +++++++++ 6 files changed, 47 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 699816ad..ab5d8dff 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -24,6 +24,12 @@ $ -> Affected files $ /applications/generalledger.php /gl/bank_account_reconcile.php (new file) /sql/alter2.1.sql ++ Added more fields to suppliers table and fixed PO document +$ /sql/alter2.1.sql + /includes/ui/ui_input.inc (new link_row) + /purchasing/manage/suppliers.php + /reporting/includes/header2.inc + /reporting/rep209.php 09-Jan-2009 Janusz Dobrowolski + Added hook file for localized functions. diff --git a/includes/ui/ui_input.inc b/includes/ui/ui_input.inc index 588f867c..a122b487 100644 --- a/includes/ui/ui_input.inc +++ b/includes/ui/ui_input.inc @@ -444,6 +444,16 @@ function email_row_ex($label, $name, $size, $max=null, $title=null, $value=null, text_row_ex("$label", $name, $size, $max, $title, $value, $params, $post_label); } +function link_row($label, $name, $value, $size, $max, $title=null, $params="", $post_label="") +{ + text_row("$label", $name, $value, $size, $max, $title, $params, $post_label); +} + +function link_row_ex($label, $name, $size, $max=null, $title=null, $value=null, $params=null, $post_label=null) +{ + text_row_ex("$label", $name, $size, $max, $title, $value, $params, $post_label); +} + //----------------------------------------------------------------------------------- function date_cells($label, $name, $title = null, $init=null, $inc_days=0, diff --git a/purchasing/manage/suppliers.php b/purchasing/manage/suppliers.php index fb2a0594..9b657ffd 100644 --- a/purchasing/manage/suppliers.php +++ b/purchasing/manage/suppliers.php @@ -58,7 +58,9 @@ if (isset($_POST['submit'])) fax=".db_escape($_POST['fax']) . ", gst_no=".db_escape($_POST['gst_no']) . ", email=".db_escape($_POST['email']) . ", + website=".db_escape($_POST['website']) . ", contact=".db_escape($_POST['contact']) . ", + supp_account_no=".db_escape($_POST['supp_account_no']) . ", bank_account=".db_escape($_POST['bank_account']) . ", credit_limit=".db_escape($_POST['credit_limit']) . ", dimension_id=".db_escape($_POST['dimension_id']) . ", @@ -68,6 +70,7 @@ if (isset($_POST['submit'])) payable_account=".db_escape($_POST['payable_account']) . ", purchase_account=".db_escape($_POST['purchase_account']) . ", payment_discount_account=".db_escape($_POST['payment_discount_account']) . ", + notes=".db_escape($_POST['notes']) . ", tax_group_id=".db_escape($_POST['tax_group_id']) . " WHERE supplier_id = '" . $_POST['supplier_id'] . "'"; db_query($sql,"The supplier could not be updated"); @@ -76,9 +79,9 @@ if (isset($_POST['submit'])) else { - $sql = "INSERT INTO ".TB_PREF."suppliers (supp_name, address, supp_address, phone, fax, gst_no, email, - contact, bank_account, credit_limit, dimension_id, dimension2_id, curr_code, - payment_terms, payable_account, purchase_account, payment_discount_account, tax_group_id) + $sql = "INSERT INTO ".TB_PREF."suppliers (supp_name, address, supp_address, phone, fax, gst_no, email, website, + contact, supp_account_no, bank_account, credit_limit, dimension_id, dimension2_id, curr_code, + payment_terms, payable_account, purchase_account, payment_discount_account, notes, tax_group_id) VALUES (".db_escape($_POST['supp_name']). ", " .db_escape($_POST['address']) . ", " .db_escape($_POST['supp_address']) . ", " @@ -86,7 +89,9 @@ if (isset($_POST['submit'])) .db_escape($_POST['fax']). ", " .db_escape($_POST['gst_no']). ", " .db_escape($_POST['email']). ", " + .db_escape($_POST['website']). ", " .db_escape($_POST['contact']). ", " + .db_escape($_POST['supp_account_no']). ", " .db_escape($_POST['bank_account']). ", " .db_escape($_POST['credit_limit']). ", " .db_escape($_POST['dimension_id']). ", " @@ -96,6 +101,7 @@ if (isset($_POST['submit'])) .db_escape($_POST['payable_account']). ", " .db_escape($_POST['purchase_account']). ", " .db_escape($_POST['payment_discount_account']). ", " + .db_escape($_POST['notes']). ", " .db_escape($_POST['tax_group_id']). ")"; db_query($sql,"The supplier could not be added"); @@ -182,7 +188,9 @@ if (!$new_supplier) $_POST['fax'] = $myrow["fax"]; $_POST['gst_no'] = $myrow["gst_no"]; $_POST['email'] = $myrow["email"]; + $_POST['website'] = $myrow["website"]; $_POST['contact'] = $myrow["contact"]; + $_POST['supp_account_no'] = $myrow["supp_account_no"]; $_POST['bank_account'] = $myrow["bank_account"]; $_POST['dimension_id'] = $myrow["dimension_id"]; $_POST['dimension2_id'] = $myrow["dimension2_id"]; @@ -193,11 +201,13 @@ if (!$new_supplier) $_POST['payable_account'] = $myrow["payable_account"]; $_POST['purchase_account'] = $myrow["purchase_account"]; $_POST['payment_discount_account'] = $myrow["payment_discount_account"]; + $_POST['notes'] = $myrow["notes"]; } else { - $_POST['supp_name'] = $_POST['address'] = $_POST['supp_address'] = $_POST['tax_group_id'] = ''; + $_POST['supp_name'] = $_POST['address'] = $_POST['supp_address'] = $_POST['tax_group_id'] = + $_POST['website'] = $_POST['supp_account_no'] = $_POST['notes'] = ''; $_POST['dimension_id'] = 0; $_POST['dimension2_id'] = 0; $_POST['sales_type'] = -1; @@ -221,6 +231,8 @@ text_row(_("Phone Number:"), 'phone', null, 42, 40); text_row(_("Fax Number:"), 'fax', null, 42, 40); email_row(_("E-mail:"), 'email', null, 35, 55); +link_row(_("Website:"), 'website', null, 35, 55); +text_row(_("Supplier Account No.:"), 'supp_account_no', null, 42, 40); table_section_title(_("Addresses")); textarea_row(_("Mailing Address:"), 'address', null, 35, 5); @@ -267,6 +279,8 @@ if ($dim < 1) hidden('dimension_id', 0); if ($dim < 2) hidden('dimension2_id', 0); +table_section_title(_("General")); +textarea_row(_("General Notes:"), 'notes', null, 35, 5); end_outer_table(1); diff --git a/reporting/includes/header2.inc b/reporting/includes/header2.inc index c71ce254..a0ab9c63 100644 --- a/reporting/includes/header2.inc +++ b/reporting/includes/header2.inc @@ -189,7 +189,9 @@ $this->TextWrap($col, $this->row, $width, $doc_Due_Date, 'C'); $this->row = $iline3 - $this->lineHeight - 1; $col = $this->leftMargin; - if (isset($sales_order["customer_ref"])) + if ($doctype == 8) + $this->TextWrap($col, $this->row, $width, $myrow['supp_account_no'], 'C'); + elseif (isset($sales_order["customer_ref"])) $this->TextWrap($col, $this->row, $width, $sales_order["customer_ref"], 'C'); $col += $width; if ($branch != null) diff --git a/reporting/rep209.php b/reporting/rep209.php index 4130124b..6639d7c4 100644 --- a/reporting/rep209.php +++ b/reporting/rep209.php @@ -30,7 +30,7 @@ print_po(); //---------------------------------------------------------------------------------------------------- function get_po($order_no) { - $sql = "SELECT ".TB_PREF."purch_orders.*, ".TB_PREF."suppliers.supp_name, + $sql = "SELECT ".TB_PREF."purch_orders.*, ".TB_PREF."suppliers.supp_name, ".TB_PREF."suppliers.supp_account_no, ".TB_PREF."suppliers.curr_code, ".TB_PREF."suppliers.payment_terms, ".TB_PREF."locations.location_name, ".TB_PREF."suppliers.email, ".TB_PREF."suppliers.address FROM ".TB_PREF."purch_orders, ".TB_PREF."suppliers, ".TB_PREF."locations diff --git a/sql/alter2.1.sql b/sql/alter2.1.sql index a65277d3..7201d1c4 100644 --- a/sql/alter2.1.sql +++ b/sql/alter2.1.sql @@ -218,6 +218,15 @@ ALTER TABLE `0_suppliers` ADD `contact` varchar(60) NOT NULL DEFAULT '' AFTER `g ALTER TABLE `0_suppliers` DROP COLUMN `credit_limit`; ALTER TABLE `0_suppliers` ADD `credit_limit` double NOT NULL DEFAULT '0' AFTER `tax_group_id`; +ALTER TABLE `0_suppliers` DROP COLUMN `supp_account_no`; +ALTER TABLE `0_suppliers` ADD `supp_account_no` varchar(40) NOT NULL DEFAULT '' AFTER `contact`; + +ALTER TABLE `0_suppliers` DROP COLUMN `website`; +ALTER TABLE `0_suppliers` ADD `website` varchar(100) NOT NULL DEFAULT '' AFTER `email`; + +ALTER TABLE `0_suppliers` DROP COLUMN `notes`; +ALTER TABLE `0_suppliers` ADD `notes` tinytext NOT NULL DEFAULT ''; + ALTER TABLE `0_chart_types` DROP INDEX `name`, ADD INDEX `name` ( `name` ); DROP TABLE IF EXISTS `0_sql_trail`; -- 2.30.2