Added more fields to suppliers table and fixed PO document
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Sat, 10 Jan 2009 11:23:56 +0000 (11:23 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Sat, 10 Jan 2009 11:23:56 +0000 (11:23 +0000)
CHANGELOG.txt
includes/ui/ui_input.inc
purchasing/manage/suppliers.php
reporting/includes/header2.inc
reporting/rep209.php
sql/alter2.1.sql

index 699816ad2a39c0348980d790bbf169ce4ee73dab..ab5d8dffdcde68ef0e5af6e8e594a87677b77d2b 100644 (file)
@@ -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.
index 588f867c31ddd381387a3c6a90478d6457a6cc24..a122b48790cf52e83e62b6a5c881883f58e21c27 100644 (file)
@@ -444,6 +444,16 @@ function email_row_ex($label, $name, $size, $max=null, $title=null, $value=null,
        text_row_ex("<a href='Mailto:".$_POST[$name]."'>$label</a>", $name, $size, $max, $title, $value, $params, $post_label);
 }
 
+function link_row($label, $name, $value, $size, $max, $title=null, $params="", $post_label="")
+{
+       text_row("<a href='".$_POST[$name]."' target='_blank'>$label</a>", $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("<a href='".$_POST[$name]."' target='_blank'>$label</a>", $name, $size, $max, $title, $value, $params, $post_label);
+}
+
 //-----------------------------------------------------------------------------------
 
 function date_cells($label, $name, $title = null, $init=null, $inc_days=0, 
index fb2a05948f277a9ee449ffc997bc455667784b6e..9b657ffdb7375485379e5b3775d996ca05b8373b 100644 (file)
@@ -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);
 
index c71ce254f49cc9b2dc3c87d2e3dbc071f81fff20..a0ab9c63360e6811c648f2d3531ee5de0f488dad 100644 (file)
                $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)
index 4130124b83cfc81beeb2af111901c2632c58b4a9..6639d7c4a67f8481fa7f2ea01ad99a2c469afce7 100644 (file)
@@ -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
index a65277d33277cbe61262cdb08223ef3339f5bbaa..7201d1c465260fce83a2c6c49abe72c88987761a 100644 (file)
@@ -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`;