Due to differences in Javascript the script update_db.php had to be changed.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 9 May 2008 09:32:33 +0000 (09:32 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 9 May 2008 09:32:33 +0000 (09:32 +0000)
New fields, base_sales in 0_company and factor in 0_sales_types affects the default chart of accounts.

CHANGELOG.txt
install.html
sql/en_US-demo.sql
sql/en_US-new.sql
update_db.php

index 33f3cc36dc3e049513fcdd65da2edb647c1be3cb..536d3a30cbe2b690991052ebe4f68789ed595930 100644 (file)
@@ -19,6 +19,13 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+09-May-2008 Joe Hunt
+! Due to differences in Javascript the script update_db.php had to be changed.
+! New fields, base_sales in 0_company and factor in 0_sales_types affects the default chart of accounts.
+$ /update_db.php
+  /sql/en_US-new.sql
+  /sql/en_US-demo.sql
+  
 09-May-2008 Janusz Dobrowolski
 # Automatic calculation of not set item prices from home currency and base sales type settings.
 $ /admin/company_preferences.php
index 94e8529b680eca38d3e74bef931a309a716093b1..3e50b71acd745cf1eb30a28c7f1215b60f3895d2 100644 (file)
 <ul style="MARGIN-TOP: 0pt" type="disc">
 
 
-  <li>A working HTTP web server eg. <em><strong>Apache, IIS</strong></em>. 
+  <li>A working HTTP web server eg. <em><strong>Apache, IIS</strong></em>.
 
 
-  <li><strong><em>PHP</em></strong> installed on the web server. 
+  <li><strong><em>PHP</em></strong> installed on the web server.
 
 
-  <li>A working <strong><em>MySQL</em></strong> server - with <strong><em>innodb</em></strong> tables 
-  enabled (see notes below) 
+  <li>A working <strong><em>MySQL</em></strong> server - with <strong><em>innodb</em></strong> tables
+  enabled (see notes below)
 
 
   <li><strong><em>Adobe Acrobat Reader</em></strong> - for viewing the PDF reports before printing them out. </li>
@@ -45,14 +45,14 @@ This starts a new session at the beginning of each script. However,
 this makes it impossible to instantiate any class objects that the
 system relies on. Classes are used extensively by this system. When
 sessions are required they are started by the system and this setting
-of <strong><em>session.auto_start</em></strong> 
-  can and should be set to 0. 
+of <strong><em>session.auto_start</em></strong>
+  can and should be set to 0.
 
 
-  <li><strong><em>Innodb</em></strong> tables must be enabled in the MySQL 
-  server. These tables allow database transactions which are a critical 
-  component of the software. This is enabled by default in the newer versions of 
-  MySQL. If you need to enable it yourself, consult the MySQL manual. 
+  <li><strong><em>Innodb</em></strong> tables must be enabled in the MySQL
+  server. These tables allow database transactions which are a critical
+  component of the software. This is enabled by default in the newer versions of
+  MySQL. If you need to enable it yourself, consult the MySQL manual.
 
 
   <li>FrontAccounting is implemented and tested with MySQL. Generally
@@ -69,12 +69,12 @@ way at the moment. </li>
 <ul>
 
 
-  <li>You must obviously have downloaded the project 
-  archive to be reading this file. 
+  <li>You must obviously have downloaded the project
+  archive to be reading this file.
 
 
-  <li>All the files inside this archive should be copied to 
-  a directory under the web server root directory. 
+  <li>All the files inside this archive should be copied to
+  a directory under the web server root directory.
 
 
   <li>For example, create a folder called <strong>/account</strong>, and extract the archive into this folder. </li>
@@ -89,17 +89,17 @@ way at the moment. </li>
 <ol>
 
 
-  <li>If you have the option to create multiple databases on your host, create one, fi. <strong>frontacc</strong>, 
-  otherwise write down the database name for your account. At the same time look 
-  up the username and password for the database. You will need these 
-  informations during the wizard install. 
+  <li>If you have the option to create multiple databases on your host, create one, fi. <strong>frontacc</strong>,
+  otherwise write down the database name for your account. At the same time look
+  up the username and password for the database. You will need these
+  informations during the wizard install.
 
 
-  <li>Enter <strong><em>your_url/account/install</em></strong> (or whatever 
-  directory you entered). This will run the install wizard, setup a drill 
-  company and populating with initial data. You can later on create your own 
-  real company. It is a good idea to get familiar with the system before 
-  starting your own company.&nbsp; 
+  <li>Enter <strong><em>your_url/account/install</em></strong> (or whatever
+  directory you entered). This will run the install wizard, setup a drill
+  company and populating with initial data. You can later on create your own
+  real company. It is a good idea to get familiar with the system before
+  starting your own company.&nbsp;
   <li>After successfully install, remove or rename your install directory for safety reasons. You don't need it any more.</li>
 
 
@@ -119,27 +119,26 @@ way at the moment. </li>
 
   <li>
 
-    <h3>Creating the Database<img height="16" alt="gylle" 
-  hspace=0 src="themes/default/images/cal.gif" width=16 border=0>  </h3>
+    <h3>Creating the Database</h3>
 
 
 
     <ol>
 
 
-      <li>NOTE : As FrontAccounting is still heavily under 
-    development, the database structure will ALWAYS change between releases, so 
-    if you have a database that you created for a previous release of 
-    FrontAccounting, it WILL NOT WORK after installing a new release. You may 
-    run the script, update_db.php and select the appropriate script, f.i. 
-    alter.sql (from release 1.XX to release 2.0). 
+      <li>NOTE : As FrontAccounting is still heavily under
+    development, the database structure will ALWAYS change between releases, so
+    if you have a database that you created for a previous release of
+    FrontAccounting, it WILL NOT WORK after installing a new release. You may
+    run the script, update_db.php and select the appropriate script, f.i.
+    alter.sql (from release 1.XX to release 2.0).
 
 
-      <li>We strongly suggest using a GUI to manage your database(s) and database users. If you don\92t have any, download <a href="http://www.phpmyadmin.net/"><strong>phpMyAdmin</strong></a>. 
+      <li>We strongly suggest using a GUI to manage your database(s) and database users. If you don\92t have any, download <a href="http://www.phpmyadmin.net/"><strong>phpMyAdmin</strong></a>.
 
 
-      <li>Create a database with a name of your choice. The default in config_db.php is \91<strong><em>frontacc</em></strong>\92, but of course you can select 
-    whatever name you desire. 
+      <li>Create a database with a name of your choice. The default in config_db.php is \91<strong><em>frontacc</em></strong>\92, but of course you can select
+    whatever name you desire.
 
 
       <li>Populate the database you have created. There are two scripts
@@ -149,9 +148,9 @@ are provided to populate the database (both inside the folder /sql) :
         <ol>
 
 
-          <li><strong><em>en_US-demo.sql</em></strong>. This has a minimal 
-      amount of demonstration data set up so that transactions can be tried to 
-      see how the system works. 
+          <li><strong><em>en_US-demo.sql</em></strong>. This has a minimal
+      amount of demonstration data set up so that transactions can be tried to
+      see how the system works.
 
 
           <li><strong><em>en_US-new.sql</em></strong>. This script has
@@ -164,10 +163,10 @@ to use. </li>
         </ol>
 
 
-      <li>Now that the database is created you will need to 
-    set up a database user to access this database. DO NOT USE THE USER \91ROOT\92. 
-    Set up a new user and give that user full privileges over the database 
-    \91frontacc\92. 
+      <li>Now that the database is created you will need to
+    set up a database user to access this database. DO NOT USE THE USER \91ROOT\92.
+    Set up a new user and give that user full privileges over the database
+    \91frontacc\92.
       <li>After successfully install, remove or rename your install directory <strong><em>your_url/account/install</em></strong> (or
 whatever directory you entered) for safety reasons. You don't need it any more.</li>
 
@@ -185,41 +184,41 @@ whatever directory you entered) for safety reasons. You don't need it any more.<
     <ol>
 
 
-      <li><strong><em>config_db.php</em></strong> contains connection 
-    information for the database. These must be set to your local settings or 
-    you will not be able to access FrontAccounting. 
+      <li><strong><em>config_db.php</em></strong> contains connection
+    information for the database. These must be set to your local settings or
+    you will not be able to access FrontAccounting.
 
 
-      <li>FrontAccounting allows multiple connections, you 
-    can enter as many connections as you have separate entities (most people 
-    will use only one). 
+      <li>FrontAccounting allows multiple connections, you
+    can enter as many connections as you have separate entities (most people
+    will use only one).
 
 
-      <li><strong>$db_connections</strong> is an array of connections \96 
-    for each connection : 
+      <li><strong>$db_connections</strong> is an array of connections \96
+    for each connection :
 
 
-      <li>\93<strong>name</strong>\94 is the 
-    name of the connection, this is the name that will be displayed to the user 
+      <li>\93<strong>name</strong>\94 is the
+    name of the connection, this is the name that will be displayed to the user
 
 
-      <li>\93<strong>host</strong>\94 is the 
-    computer IP address or name where the database is. The default is localhost 
-    assuming that the web server is also the sql server. 
+      <li>\93<strong>host</strong>\94 is the
+    computer IP address or name where the database is. The default is localhost
+    assuming that the web server is also the sql server.
 
 
-      <li>\93<strong>dbuse</strong>r\94 is 
-    the user name under which the database should be accessed. NB, again, do not 
-    use the user ROOT. A user with appropriate privileges must be set up. 
+      <li>\93<strong>dbuse</strong>r\94 is
+    the user name under which the database should be accessed. NB, again, do not
+    use the user ROOT. A user with appropriate privileges must be set up.
 
 
-      <li>\93<strong>dbpassword</strong>\94 
-    is the password for \93dbuser\94. You would have entered this when you created 
-    \93dbuser\94. 
+      <li>\93<strong>dbpassword</strong>\94
+    is the password for \93dbuser\94. You would have entered this when you created
+    \93dbuser\94.
 
 
-      <li>\93<strong>dbname</strong>\94 is 
-    the name of the database. The provided scripts use the name OpenAccounting. 
+      <li>\93<strong>dbname</strong>\94 is
+    the name of the database. The provided scripts use the name OpenAccounting.
 
 
       <li>\93<strong>tbpref</strong>\94 is the table prefix for
@@ -244,20 +243,20 @@ counter inside config_db.php, fi. 0_ for the first company.</li>
 <ol>
 
 
-  <li>Pleae ensure that the folder <strong>/company/0</strong> on the server is <strong>writable</strong>. 
+  <li>Pleae ensure that the folder <strong>/company/0</strong> on the server is <strong>writable</strong>.
 
 
-  <li>Open a browser and enter the URL for the web server 
-  directory where FrontAccounting is installed. 
+  <li>Open a browser and enter the URL for the web server
+  directory where FrontAccounting is installed.
 
 
-  <li>Enter the user name:&nbsp; '<strong>admin</strong>' 
+  <li>Enter the user name:&nbsp; '<strong>admin</strong>'
 
 
-  <li>Enter the password: '<strong>password</strong>' 
+  <li>Enter the password: '<strong>password</strong>'
 
 
-  <li>(NB : enter without quotation marks). 
+  <li>(NB : enter without quotation marks).
 
 
   <li>
@@ -296,15 +295,15 @@ implemented and we strongly recommend you to use this approach, see <strong><em>
 <ol>
 
 
-  <li>If FrontAccounting is installed locally, you may have the <strong><em>session save path</em></strong> not set correctly. Normally this is set in your php.ini (for Windows). The entry is called <strong><em>session.save_path</em></strong>. Make sure this is set to 
-  a directory that actually exists. The default is set to /tmp, which may not be 
-  valid. 
+  <li>If FrontAccounting is installed locally, you may have the <strong><em>session save path</em></strong> not set correctly. Normally this is set in your php.ini (for Windows). The entry is called <strong><em>session.save_path</em></strong>. Make sure this is set to
+  a directory that actually exists. The default is set to /tmp, which may not be
+  valid.
 
 
-  <li>If you are installing FrontAccounting onto a shared 
-  server, you may have to set the session save path within FrontAccounting. At 
-  the top of config.php (in release 2.0 this has moved to /includes/session.inc) 
-  you will find this line : 
+  <li>If you are installing FrontAccounting onto a shared
+  server, you may have to set the session save path within FrontAccounting. At
+  the top of config.php (in release 2.0 this has moved to /includes/session.inc)
+  you will find this line :
 
 
   <li>Uncomment this line and set the path to a directory that exists
index 5fc652f89888f110b05944619d199859ec028ba5..20f2783bb1279310d5b72f6ca1f855d51652ab66 100644 (file)
@@ -210,6 +210,7 @@ CREATE TABLE `0_company` (
   `no_item_list` tinyint(1) NOT NULL default '0',
   `no_customer_list` tinyint(1) NOT NULL default '0',
   `no_supplier_list` tinyint(1) NOT NULL default '0',
+  `base_sales` int(11) NOT NULL default '-1',
   PRIMARY KEY  (`coy_code`)
 ) TYPE=MyISAM ;
 
@@ -668,6 +669,7 @@ CREATE TABLE `0_sales_types` (
   `id` int(11) NOT NULL auto_increment,
   `sales_type` char(50) NOT NULL default '',
   `tax_included` int(1) NOT NULL default '0',
+  `factor` double NOT NULL default '1',
   PRIMARY KEY  (`id`),
   UNIQUE KEY `sales_type` (`sales_type`)
 ) TYPE=MyISAM AUTO_INCREMENT=3 ;
@@ -1178,7 +1180,7 @@ INSERT INTO `0_comments` VALUES ('40', '2', '0000-00-00', 'Another project');
 
 ### Data of table `0_company` ###
 
-INSERT INTO `0_company` VALUES ('1', 'Drill Company Inc.', '987654321', '123123123', '1', '1', 'N/A', '202-122320', '202-18889123', 'delta@delta.com', 'logo_frontaccounting.jpg', 'DownTown', 'USD', '1500', '4250', '2630', '1430', '4260', '4220', '2050', '3800', '3000', '3000', '3200', '1420', '4010', '4210', '3000', '1410', '5000', '', '', '', '', '', '', '0', '10', '10', '1000', '20', '20', '30', '1', '6', '0', '0', '0');
+INSERT INTO `0_company` VALUES ('1', 'Drill Company Inc.', '987654321', '123123123', '1', '1', 'N/A', '202-122320', '202-18889123', 'delta@delta.com', 'logo_frontaccounting.jpg', 'DownTown', 'USD', '1500', '4250', '2630', '1430', '4260', '4220', '2050', '3800', '3000', '3000', '3200', '1420', '4010', '4210', '3000', '1410', '5000', '', '', '', '', '', '', '0', '10', '10', '1000', '20', '20', '30', '1', '6', '0', '0', '0', -1);
 
 ### Data of table `0_credit_status` ###
 
@@ -1751,8 +1753,8 @@ INSERT INTO `0_sales_orders` VALUES ('21', '1', '0', '4', '6', '', NULL, '2008-0
 
 ### Data of table `0_sales_types` ###
 
-INSERT INTO `0_sales_types` VALUES ('1', 'Retail', '1');
-INSERT INTO `0_sales_types` VALUES ('2', 'Wholesale', '0');
+INSERT INTO `0_sales_types` VALUES ('1', 'Retail', '1', 1);
+INSERT INTO `0_sales_types` VALUES ('2', 'Wholesale', '0', 1);
 
 ### Data of table `0_salesman` ###
 
index 7ea94e0c08a9debd4235fe7b2832b28b7d39d7b6..22e0e09024a19c60aa5010b840e7addac62895c5 100644 (file)
@@ -248,6 +248,7 @@ CREATE TABLE IF NOT EXISTS `0_company` (
   `no_item_list` tinyint(1) NOT NULL default '0',
   `no_customer_list` tinyint(1) NOT NULL default '0',
   `no_supplier_list` tinyint(1) NOT NULL default '0',
+  `base_sales` int(11) NOT NULL default '-1',
   PRIMARY KEY  (`coy_code`)
 ) TYPE=MyISAM;
 
@@ -812,6 +813,7 @@ CREATE TABLE IF NOT EXISTS `0_sales_types` (
   `id` int(11) NOT NULL auto_increment,
   `sales_type` char(50) NOT NULL default '',
   `tax_included` int(1) NOT NULL default '0',
+  `factor` double NOT NULL default '1',
   PRIMARY KEY  (`id`),
   UNIQUE KEY `sales_type` (`sales_type`)
 ) TYPE=MyISAM  AUTO_INCREMENT=3 ;
@@ -1329,7 +1331,7 @@ INSERT INTO `0_chart_types` VALUES(52, 'Financials', 4, -1);
 -- Dumping data for table `0_company`
 --
 
-INSERT INTO `0_company` VALUES(1, 'Company name', '', '', 1, 1, 'N/A', '', '', '', '', '', 'USD', '1500', '4250', '2630', '1430', '4260', '4220', '2050', '3800', '3000', '3000', '3200', '1420', '4010', '4210', '3000', '1410', '5000', '', '', '', '', '', '', 0, 10, 10, 1000, 20, 20, 30, 1, 1, 0, 0, 0);
+INSERT INTO `0_company` VALUES(1, 'Company name', '', '', 1, 1, 'N/A', '', '', '', '', '', 'USD', '1500', '4250', '2630', '1430', '4260', '4220', '2050', '3800', '3000', '3000', '3200', '1420', '4010', '4210', '3000', '1410', '5000', '', '', '', '', '', '', 0, 10, 10, 1000, 20, 20, 30, 1, 1, 0, 0, 0, -1);
 
 --
 -- Dumping data for table `0_credit_status`
@@ -1390,8 +1392,8 @@ INSERT INTO `0_salesman` VALUES(1, 'Sales Person', '', '', '', 5, 1000, 4);
 -- Dumping data for table `0_sales_types`
 --
 
-INSERT INTO `0_sales_types` VALUES(1, 'Retail', 0);
-INSERT INTO `0_sales_types` VALUES(2, 'Wholesale', 0);
+INSERT INTO `0_sales_types` VALUES(1, 'Retail', 0, 1);
+INSERT INTO `0_sales_types` VALUES(2, 'Wholesale', 0, 1);
 
 --
 -- Dumping data for table `0_shippers`
index 5e160b2d2cd9e228fbfaefbd2683dd4922b890ba..26c14ee5fc1f4e5246c83de37dd812a8931fa128 100644 (file)
@@ -1,16 +1,41 @@
 <?php
-//ini_set("display_errors", "on");
+ini_set("display_errors", "on");
 $path_to_root = ".";
 include_once($path_to_root. "/admin/db/maintenance_db.inc");
 include_once($path_to_root. "/includes/db/connect_db.inc");
-include_once($path_to_root. "/includes/ui/ui_view.inc");
-include_once($path_to_root. "/includes/ui/ui_input.inc");
 
 $js = get_js_png_fix();
 $js .= get_js_set_focus("user");
 $image = $path_to_root."/themes/default/images/logo_frontaccounting.png";
 $title = "Update All Company Databases";
 
+function get_js_png_fix()
+{
+       $js = "<script type=\"text/javascript\">\n"
+               . "function fixPNG(myImage)\n"
+               . "{\n"
+               . " var arVersion = navigator.appVersion.split(\"MSIE\")\n"
+               . " var version = parseFloat(arVersion[1])\n"
+       . " if ((version >= 5.5) && (version < 7) && (document.body.filters))\n"
+       . " {\n"
+               . "  var imgID = (myImage.id) ? \"id='\" + myImage.id + \"' \" : \"\"\n"
+               . "  var imgClass = (myImage.className) ? \"class='\" + myImage.className + \"' \" : \"\"\n"
+               . "  var imgTitle = (myImage.title) ?\n"
+               . "    \"title='\" + myImage.title  + \"' \" : \"title='\" + myImage.alt + \"' \"\n"
+               . "  var imgStyle = \"display:inline-block;\" + myImage.style.cssText\n"
+               . "  var strNewHTML = \"<span \" + imgID + imgClass + imgTitle\n"
+        . "    + \" style=\\\"\" + \"width:\" + myImage.width\n"
+        . "    + \"px; height:\" + myImage.height\n"
+        . "    + \"px;\" + imgStyle + \";\"\n"
+        . "    + \"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader\"\n"
+        . "    + \"(src=\'\" + myImage.src + \"\', sizingMethod='scale');\\\"></span>\"\n"
+               . "  myImage.outerHTML = strNewHTML\n"
+       . " }\n"
+               . "}\n"
+               . "</script>\n";
+       return $js;
+}
+
 function get_js_set_focus($name)
 {
        $js = "\n<script type=\"text/javascript\">\n"
@@ -108,15 +133,17 @@ if (isset($_POST["submit"]))
 }
 if (!isset($_POST['passwd']))
        $_POST['passwd'] = "";
+if (!isset($_POST['user']))
+       $_POST['user'] = "";
 
 echo "<form enctype='multipart/form-data' method='post' action='".$_SERVER['PHP_SELF']."'>\n";
 
 echo "<table align='center' width='50%' cellpadding=3 border=1 bordercolor='#cccccc' style='border-collapse: collapse'>\n";
 
-text_row_ex("Database User", "user", 20);
-label_row("Password", "<input name='passwd' type='password' value='".$_POST['passwd']."' />");
-label_row("Upload Script", "<input name='uploadfile' type='file'>");
-submit_row("submit", "Update");
+echo "<tr><td>Database User</td><td><input type='text' name='user' value='".$_POST['user']."' size='20' /></td></tr>";
+echo "<tr><td>Password</td><td><input name='passwd' type='password' value='".$_POST['passwd']."' /></td></tr>";
+echo "<tr><td>Upload Script</td><td><input name='uploadfile' type='file' /></td></tr>";
+echo "<tr><td>&nbsp;</td><td><input type='submit' class='inputsubmit' name='submit' value='Update' /></td></tr>";
 
 echo "</table>\n";;