From: <dai...@us...> - 2012-08-04 10:15:55
|
Revision: 5584 http://web-erp.svn.sourceforge.net/web-erp/?rev=5584&view=rev Author: daintree Date: 2012-08-04 10:15:47 +0000 (Sat, 04 Aug 2012) Log Message: ----------- POS xml-rpc fixes for allocations Modified Paths: -------------- trunk/api/api_debtortransactions.php trunk/api/api_webERPsettings.php trunk/api/api_xml-rpc.php trunk/sql/mysql/weberp-demo.sql Modified: trunk/api/api_debtortransactions.php =================================================================== --- trunk/api/api_debtortransactions.php 2012-08-02 10:50:19 UTC (rev 5583) +++ trunk/api/api_debtortransactions.php 2012-08-04 10:15:47 UTC (rev 5584) @@ -314,7 +314,7 @@ $CustCurrRow = DB_fetch_array($CurrResult); - /*Get the currency and rate of the bank account transferring to*/ + /*Get the currency and rate of the bank account receiving into*/ $SQL = "SELECT currcode, rate FROM bankaccounts INNER JOIN currencies @@ -1333,7 +1333,8 @@ $Result = api_DB_query($SQL,$db); $LeftToAllocRow = DB_fetch_array($Result); if (DB_num_rows($Result)==0){ - $Errors[] = NoTransactionToAllocate; + $Errors[0] = NoTransactionToAllocate; + return $Errors; } if ($LeftToAllocRow['lefttoalloc'] < 0){ /* negative if it is a positive receipt to allocate against invoices */ @@ -1345,13 +1346,19 @@ WHERE debtorno='" . $AllocDetails['debtorno'] . "' AND type=10 AND reference='" . $AllocDetails['customerref'] . "' - AND ovamount+ovgst+ovdiscount-alloc <0"; + AND ovamount+ovgst+ovdiscount-alloc >0"; $Result = api_DB_query($SQL,$db); + if (DB_num_rows($Result)==0){ + $Errors[0] = NoTransactionToAllocate; + return $Errors; + } + /* The receipts will always be smaller than the invoice as there can be several receipts to make up payment for a single invocie - but not vice-versa - that's why there is no point iterating over the possibilities - in the words of McCloud "There can be only one"*/ + $OSInvRow = DB_fetch_array($Result); - if ($OSInvRow['rate']==$LeftToAllocRow['rate'] - AND $OSInvRow['outstanding']>0){ + if ($OSInvRow['rate']==$LeftToAllocRow['rate'] AND $OSInvRow['outstanding']>0){ + if ($OSInvRow['outstanding']+$LeftToAllocRow['lefttoalloc']>=0){ /*We can allocate the whole amount of the credit/receipt */ $AllocateAmount = -$LeftToAllocRow['lefttoalloc']; @@ -1380,8 +1387,9 @@ $Result = api_DB_query($SQL,$db,'','',true); } /*end if the exchange rates are the same so no diff on exchange */ /*end if it is a normal allocation of receipt to invoice*/ - } elseif ($LeftToAllocRow['lefttoalloc']>0) { /* it is a payment - negative receipt - already checked type=12 need to find credit note to allocate to */ - /*Now look for credit notes type 11 with the same customerref to allocate to */ + } elseif ($LeftToAllocRow['lefttoalloc']>0) { + /* it is a payment - negative receipt - already checked type=12 need to find credit note to allocate to + Now look for credit notes type 11 with the same customerref to allocate to */ $SQL = "SELECT id, rate, ovamount+ovgst+ovdiscount-alloc AS outstanding @@ -1389,9 +1397,10 @@ WHERE debtorno='" . $AllocDetails['debtorno'] . "' AND type=11 AND reference='" . $AllocDetails['customerref'] . "' - AND ovamount+ovgst+ovdiscount-alloc < 0"; + AND ovamount+ovgst+ovdiscount-alloc < -0.005"; $Result = api_DB_query($SQL,$db); - if (DB_num_rows($Result)) { // then we need to cast the net further afield + if (DB_num_rows($Result)==0) { + // then we need to cast the net further afield and look for normal receipts to allocate to $SQL = "SELECT id, rate, ovamount+ovgst+ovdiscount-alloc AS outstanding @@ -1402,24 +1411,26 @@ AND ovamount+ovgst+ovdiscount-alloc < 0"; $Result = api_DB_query($SQL,$db); } + if (DB_num_rows($Result)==0) { //then no trans to allocate this to + $Errors[0] = 'no transactions to allocate this to'; + return $Errors; + } $LeftToAllocate = $LeftToAllocRow['lefttoalloc']; - + DB_Txn_Begin($db); - + /* there could be several receipts to allocate against ... loop through until $LefToAllocate is exhausted */ while ($OSCreditRow = DB_fetch_array($Result)){ - if ($OSCreditRow['rate']==$LeftToAllocRow['rate'] - AND $OSCreditRow['outstanding']<0 - AND $LeftToAllocate > 0){ + if ($OSCreditRow['rate']==$LeftToAllocRow['rate'] AND $LeftToAllocate > 0){ if ($OSCreditRow['outstanding']+$LeftToAllocate<=0){ /*We can allocate the whole amount of the receipt */ - $AllocateAmount = $LeftToAlloc; + $AllocateAmount = $LeftToAllocate; $LeftToAllocate =0; } else { /*We can only allocate the rest of the invoice outstanding */ - $AllocateAmount = -$OSCreditRow['outstanding']; - $LeftToAllocate -= $OSCreditRow['outstanding']; + $AllocateAmount = $OSCreditRow['outstanding']; + $LeftToAllocate += $OSCreditRow['outstanding']; } /*Now insert the allocation records */ @@ -1429,14 +1440,14 @@ transid_allocto) VALUE('" . $AllocateAmount . "', '" . Date('Y-m-d') . "', - '" . $LeftToAllocRow['id'] . "', - '" . $OSCreditRow['id'] . "')"; + '" . $OSCreditRow['id'] . "', + '" . $LeftToAllocRow['id'] . "')"; $Result = api_DB_query($SQL,$db,'','',true); /*Now update the allocated amounts in the debtortrans for both transactions */ - $SQL = "UPDATE debtortrans SET alloc=alloc-" . $AllocateAmount . " + $SQL = "UPDATE debtortrans SET alloc=alloc+" . $AllocateAmount . " WHERE id = '" . $LeftToAllocRow['id'] . "'"; $Result = api_DB_query($SQL,$db,'','',true); - $SQL = "UPDATE debtortrans SET alloc=alloc+" . $AllocateAmount . " + $SQL = "UPDATE debtortrans SET alloc=alloc-" . $AllocateAmount . " WHERE id = '" . $OSCreditRow['id'] . "'"; $Result = api_DB_query($SQL,$db,'','',true); Modified: trunk/api/api_webERPsettings.php =================================================================== --- trunk/api/api_webERPsettings.php 2012-08-02 10:50:19 UTC (rev 5583) +++ trunk/api/api_webERPsettings.php 2012-08-04 10:15:47 UTC (rev 5584) @@ -47,7 +47,7 @@ $Errors[0]=NoAuthorisation; return $Errors; } - $sql = "select confvalue from config where confname='DefaultDateFormat'"; + $sql = "SELECT confvalue FROM config WHERE confname='DefaultDateFormat'"; $result = DB_query($sql, $db); $answer=DB_fetch_array($result); $ReturnValue[0]=0; @@ -55,9 +55,25 @@ return $ReturnValue; } -/* This function returns the default date format in webERP. - */ +/* This function returns the reports directory of the webERP installation for the company in api/api_php.php */ + function GetReportsDirectory($user, $password) { + $Errors = array(); + $db = db($user, $password); + if (gettype($db)=='integer') { + $Errors[0]=NoAuthorisation; + return $Errors; + } + $sql = "SELECT confvalue FROM config WHERE confname='reports_dir'"; + $result = DB_query($sql, $db); + $answer=DB_fetch_array($result); + $ReturnValue[0]=0; + $ReturnValue[1]=$answer; + return $ReturnValue; + } + +/* This function returns the default location of the weberp user being used */ + function GetDefaultLocation($user, $password) { $Errors = array(); $db = db($user, $password); @@ -108,7 +124,7 @@ } return $ReturnValue; } - + function DeletePOSData($User, $Password) { $Errors = array(); $db = db($User, $Password); Modified: trunk/api/api_xml-rpc.php =================================================================== --- trunk/api/api_xml-rpc.php 2012-08-02 10:50:19 UTC (rev 5583) +++ trunk/api/api_xml-rpc.php 2012-08-04 10:15:47 UTC (rev 5584) @@ -2945,17 +2945,36 @@ function xmlrpc_GetDefaultLocation($xmlrpcmsg){ ob_start('ob_file_callback'); -/*x*/ if ($xmlrpcmsg->getNumParams() == 2) -/*x*/ { -/*x*/ $rtn = new xmlrpcresp( php_xmlrpc_encode(GetDefaultLocation($xmlrpcmsg->getParam( 0 )->scalarval( ), -/*x*/ $xmlrpcmsg->getParam( 1 )->scalarval( ))) ); -/*x*/ } else { -/*e*/ $rtn = new xmlrpcresp( php_xmlrpc_encode(GetDefaultLocation( '', ''))); -/*x*/ } + if ($xmlrpcmsg->getNumParams() == 2){ + $rtn = new xmlrpcresp( php_xmlrpc_encode(GetDefaultLocation($xmlrpcmsg->getParam( 0 )->scalarval( ), $xmlrpcmsg->getParam( 1 )->scalarval( ))) ); + } else { + $rtn = new xmlrpcresp( php_xmlrpc_encode(GetDefaultLocation( '', ''))); + } ob_end_flush(); return $rtn; } + $Description = _('Returns the webERP reports_dir for the company selected'); + $Parameter[0]['name'] = _('User name'); + $Parameter[0]['description'] = _('A valid weberp username. This user should have security access to this data.'); + $Parameter[1]['name'] = _('User password'); + $Parameter[1]['description'] = _('The weberp password associated with this user name. '); + $ReturnValue[0] = _('If successful this function returns a string containing the path to the company reporte_dir') . ' ' . _('Otherwise an array of error codes is returned. '); + + $GetReportsDirectory_sig = array(array($xmlrpcStruct), + array($xmlrpcStruct,$xmlrpcString,$xmlrpcString)); + $GetReportsDirectory_doc = apiBuildDocHTML( $Description,$Parameter,$ReturnValue ); + + function xmlrpc_GetReportsDirectory($xmlrpcmsg){ + ob_start('ob_file_callback'); + if ($xmlrpcmsg->getNumParams() == 2) { + $rtn = new xmlrpcresp( php_xmlrpc_encode(GetReportsDirectory($xmlrpcmsg->getParam( 0 )->scalarval( ), $xmlrpcmsg->getParam( 1 )->scalarval( ))) ); + } else { + $rtn = new xmlrpcresp( php_xmlrpc_encode(GetReportsDirectory( '', ''))); + } + ob_end_flush(); + return $rtn; + } unset($Description); unset($Parameter); unset($ReturnValue); @@ -3439,6 +3458,10 @@ "function" => "xmlrpc_GetDefaultLocation", "signature" => $GetDefaultLocation_sig, "docstring" => $GetDefaultLocation_doc), + "weberp.xmlrpc_GetReportsDirectory" => array( + "function" => "xmlrpc_GetReportsDirectory", + "signature" => $GetReportsDirectory_sig, + "docstring" => $GetReportsDirectory_doc), "weberp.xmlrpc_CreatePOSDataFull" => array( "function" => "xmlrpc_CreatePOSDataFull", "signature" => $CreatePOSDataFull_sig, Modified: trunk/sql/mysql/weberp-demo.sql =================================================================== --- trunk/sql/mysql/weberp-demo.sql 2012-08-02 10:50:19 UTC (rev 5583) +++ trunk/sql/mysql/weberp-demo.sql 2012-08-04 10:15:47 UTC (rev 5584) @@ -17,8 +17,8 @@ -- Table structure for table `accountgroups` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `accountgroups` ( `groupname` char(30) NOT NULL DEFAULT '', `sectioninaccounts` int(11) NOT NULL DEFAULT '0', @@ -31,40 +31,40 @@ KEY `parentgroupname` (`parentgroupname`), CONSTRAINT `accountgroups_ibfk_1` FOREIGN KEY (`sectioninaccounts`) REFERENCES `accountsection` (`sectionid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `accountsection` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `accountsection` ( `sectionid` int(11) NOT NULL DEFAULT '0', `sectionname` text NOT NULL, PRIMARY KEY (`sectionid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `areas` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `areas` ( `areacode` char(3) NOT NULL, `areadescription` varchar(25) NOT NULL DEFAULT '', PRIMARY KEY (`areacode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `assetmanager` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `assetmanager` ( `id` int(11) NOT NULL AUTO_INCREMENT, `stockid` varchar(20) NOT NULL DEFAULT '', @@ -76,14 +76,14 @@ `disposalvalue` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `audittrail` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `audittrail` ( `transactiondate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `userid` varchar(20) NOT NULL DEFAULT '', @@ -91,14 +91,14 @@ KEY `UserID` (`userid`), CONSTRAINT `audittrail_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `www_users` (`userid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `bankaccounts` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `bankaccounts` ( `accountcode` varchar(20) NOT NULL DEFAULT '0', `currcode` char(3) NOT NULL, @@ -113,14 +113,14 @@ KEY `BankAccountNumber` (`bankaccountnumber`), CONSTRAINT `bankaccounts_ibfk_1` FOREIGN KEY (`accountcode`) REFERENCES `chartmaster` (`accountcode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `banktrans` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `banktrans` ( `banktransid` bigint(20) NOT NULL AUTO_INCREMENT, `type` smallint(6) NOT NULL DEFAULT '0', @@ -153,14 +153,14 @@ CONSTRAINT `banktrans_ibfk_1` FOREIGN KEY (`type`) REFERENCES `systypes` (`typeid`), CONSTRAINT `banktrans_ibfk_2` FOREIGN KEY (`bankact`) REFERENCES `bankaccounts` (`accountcode`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `bom` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `bom` ( `parent` char(20) NOT NULL DEFAULT '', `component` char(20) NOT NULL DEFAULT '', @@ -183,14 +183,14 @@ CONSTRAINT `bom_ibfk_3` FOREIGN KEY (`workcentreadded`) REFERENCES `workcentres` (`code`), CONSTRAINT `bom_ibfk_4` FOREIGN KEY (`loccode`) REFERENCES `locations` (`loccode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `chartdetails` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `chartdetails` ( `accountcode` varchar(20) NOT NULL DEFAULT '0', `period` smallint(6) NOT NULL DEFAULT '0', @@ -203,14 +203,14 @@ CONSTRAINT `chartdetails_ibfk_1` FOREIGN KEY (`accountcode`) REFERENCES `chartmaster` (`accountcode`), CONSTRAINT `chartdetails_ibfk_2` FOREIGN KEY (`period`) REFERENCES `periods` (`periodno`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `chartmaster` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `chartmaster` ( `accountcode` varchar(20) NOT NULL DEFAULT '0', `accountname` char(50) NOT NULL DEFAULT '', @@ -220,14 +220,14 @@ KEY `Group_` (`group_`), CONSTRAINT `chartmaster_ibfk_1` FOREIGN KEY (`group_`) REFERENCES `accountgroups` (`groupname`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `cogsglpostings` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `cogsglpostings` ( `id` int(11) NOT NULL AUTO_INCREMENT, `area` char(3) NOT NULL DEFAULT '', @@ -241,14 +241,14 @@ KEY `GLCode` (`glcode`), KEY `SalesType` (`salestype`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `companies` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `companies` ( `coycode` int(11) NOT NULL DEFAULT '1', `coyname` varchar(50) NOT NULL DEFAULT '', @@ -278,27 +278,27 @@ `freightact` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`coycode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `config` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `config` ( `confname` varchar(35) NOT NULL DEFAULT '', `confvalue` text NOT NULL, PRIMARY KEY (`confname`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `contractbom` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `contractbom` ( `contractref` varchar(20) NOT NULL DEFAULT '0', `stockid` varchar(20) NOT NULL DEFAULT '', @@ -311,14 +311,14 @@ CONSTRAINT `contractbom_ibfk_1` FOREIGN KEY (`workcentreadded`) REFERENCES `workcentres` (`code`), CONSTRAINT `contractbom_ibfk_3` FOREIGN KEY (`stockid`) REFERENCES `stockmaster` (`stockid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `contractcharges` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `contractcharges` ( `id` int(11) NOT NULL AUTO_INCREMENT, `contractref` varchar(20) NOT NULL, @@ -333,14 +333,14 @@ CONSTRAINT `contractcharges_ibfk_1` FOREIGN KEY (`contractref`) REFERENCES `contracts` (`contractref`), CONSTRAINT `contractcharges_ibfk_2` FOREIGN KEY (`transtype`) REFERENCES `systypes` (`typeid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `contractreqts` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `contractreqts` ( `contractreqid` int(11) NOT NULL AUTO_INCREMENT, `contractref` varchar(20) NOT NULL DEFAULT '0', @@ -351,14 +351,14 @@ KEY `ContractRef` (`contractref`), CONSTRAINT `contractreqts_ibfk_1` FOREIGN KEY (`contractref`) REFERENCES `contracts` (`contractref`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `contracts` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `contracts` ( `contractref` varchar(20) NOT NULL DEFAULT '', `contractdescription` text NOT NULL, @@ -385,14 +385,14 @@ CONSTRAINT `contracts_ibfk_2` FOREIGN KEY (`categoryid`) REFERENCES `stockcategory` (`categoryid`), CONSTRAINT `contracts_ibfk_3` FOREIGN KEY (`loccode`) REFERENCES `locations` (`loccode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `currencies` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `currencies` ( `currency` char(20) NOT NULL DEFAULT '', `currabrev` char(3) NOT NULL DEFAULT '', @@ -403,14 +403,14 @@ PRIMARY KEY (`currabrev`), KEY `Country` (`country`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `custallocns` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `custallocns` ( `id` int(11) NOT NULL AUTO_INCREMENT, `amt` decimal(20,4) NOT NULL DEFAULT '0.0000', @@ -424,14 +424,14 @@ CONSTRAINT `custallocns_ibfk_1` FOREIGN KEY (`transid_allocfrom`) REFERENCES `debtortrans` (`id`), CONSTRAINT `custallocns_ibfk_2` FOREIGN KEY (`transid_allocto`) REFERENCES `debtortrans` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `custbranch` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `custbranch` ( `branchcode` varchar(10) NOT NULL DEFAULT '', `debtorno` varchar(10) NOT NULL DEFAULT '', @@ -480,14 +480,14 @@ CONSTRAINT `custbranch_ibfk_6` FOREIGN KEY (`defaultshipvia`) REFERENCES `shippers` (`shipper_id`), CONSTRAINT `custbranch_ibfk_7` FOREIGN KEY (`taxgroupid`) REFERENCES `taxgroups` (`taxgroupid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `custcontacts` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `custcontacts` ( `contid` int(11) NOT NULL AUTO_INCREMENT, `debtorno` varchar(10) NOT NULL, @@ -498,14 +498,14 @@ `email` varchar(55) NOT NULL, PRIMARY KEY (`contid`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `custnotes` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `custnotes` ( `noteid` tinyint(4) NOT NULL AUTO_INCREMENT, `debtorno` varchar(10) NOT NULL DEFAULT '0', @@ -515,14 +515,14 @@ `priority` varchar(20) NOT NULL, PRIMARY KEY (`noteid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `debtorsmaster` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `debtorsmaster` ( `debtorno` varchar(10) NOT NULL DEFAULT '', `name` varchar(40) NOT NULL DEFAULT '', @@ -569,14 +569,14 @@ CONSTRAINT `debtorsmaster_ibfk_4` FOREIGN KEY (`salestype`) REFERENCES `salestypes` (`typeabbrev`), CONSTRAINT `debtorsmaster_ibfk_5` FOREIGN KEY (`typeid`) REFERENCES `debtortype` (`typeid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `debtortrans` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `debtortrans` ( `id` int(11) NOT NULL AUTO_INCREMENT, `transno` int(11) NOT NULL DEFAULT '0', @@ -615,14 +615,14 @@ CONSTRAINT `debtortrans_ibfk_2` FOREIGN KEY (`type`) REFERENCES `systypes` (`typeid`), CONSTRAINT `debtortrans_ibfk_3` FOREIGN KEY (`prd`) REFERENCES `periods` (`periodno`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `debtortranstaxes` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `debtortranstaxes` ( `debtortransid` int(11) NOT NULL DEFAULT '0', `taxauthid` tinyint(4) NOT NULL DEFAULT '0', @@ -632,27 +632,27 @@ CONSTRAINT `debtortranstaxes_ibfk_1` FOREIGN KEY (`taxauthid`) REFERENCES `taxauthorities` (`taxid`), CONSTRAINT `debtortranstaxes_ibfk_2` FOREIGN KEY (`debtortransid`) REFERENCES `debtortrans` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `debtortype` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `debtortype` ( `typeid` tinyint(4) NOT NULL AUTO_INCREMENT, `typename` varchar(100) NOT NULL, PRIMARY KEY (`typeid`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `debtortypenotes` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `debtortypenotes` ( `noteid` tinyint(4) NOT NULL AUTO_INCREMENT, `typeid` tinyint(4) NOT NULL DEFAULT '0', @@ -662,14 +662,14 @@ `priority` varchar(20) NOT NULL, PRIMARY KEY (`noteid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `deliverynotes` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `deliverynotes` ( `deliverynotenumber` int(11) NOT NULL, `deliverynotelineno` tinyint(4) NOT NULL, @@ -684,28 +684,28 @@ CONSTRAINT `deliverynotes_ibfk_1` FOREIGN KEY (`salesorderno`) REFERENCES `salesorders` (`orderno`), CONSTRAINT `deliverynotes_ibfk_2` FOREIGN KEY (`salesorderno`, `salesorderlineno`) REFERENCES `salesorderdetails` (`orderno`, `orderlineno`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `departments` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `departments` ( `departmentid` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(100) NOT NULL DEFAULT '', `authoriser` varchar(20) NOT NULL DEFAULT '', PRIMARY KEY (`departmentid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `discountmatrix` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `discountmatrix` ( `salestype` char(2) NOT NULL DEFAULT '', `discountcategory` char(2) NOT NULL DEFAULT '', @@ -717,28 +717,28 @@ KEY `SalesType` (`salestype`), CONSTRAINT `discountmatrix_ibfk_1` FOREIGN KEY (`salestype`) REFERENCES `salestypes` (`typeabbrev`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `edi_orders_seg_groups` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `edi_orders_seg_groups` ( `seggroupno` tinyint(4) NOT NULL DEFAULT '0', `maxoccur` int(4) NOT NULL DEFAULT '0', `parentseggroup` tinyint(4) NOT NULL DEFAULT '0', PRIMARY KEY (`seggroupno`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `edi_orders_segs` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `edi_orders_segs` ( `id` int(11) NOT NULL AUTO_INCREMENT, `segtag` char(3) NOT NULL DEFAULT '', @@ -748,14 +748,14 @@ KEY `SegTag` (`segtag`), KEY `SegNo` (`seggroup`) ) ENGINE=InnoDB AUTO_INCREMENT=96 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `ediitemmapping` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `ediitemmapping` ( `supporcust` varchar(4) NOT NULL DEFAULT '', `partnercode` varchar(10) NOT NULL DEFAULT '', @@ -767,14 +767,14 @@ KEY `PartnerStockID` (`partnerstockid`), KEY `SuppOrCust` (`supporcust`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `edimessageformat` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `edimessageformat` ( `id` int(11) NOT NULL AUTO_INCREMENT, `partnercode` varchar(10) NOT NULL DEFAULT '', @@ -786,14 +786,14 @@ UNIQUE KEY `PartnerCode` (`partnercode`,`messagetype`,`sequenceno`), KEY `Section` (`section`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `emailsettings` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `emailsettings` ( `id` int(11) NOT NULL AUTO_INCREMENT, `host` varchar(30) NOT NULL, @@ -806,14 +806,14 @@ `auth` tinyint(1) DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `factorcompanies` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `factorcompanies` ( `id` int(11) NOT NULL AUTO_INCREMENT, `coyname` varchar(50) NOT NULL DEFAULT '', @@ -830,14 +830,14 @@ PRIMARY KEY (`id`), UNIQUE KEY `factor_name` (`coyname`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `fixedassetcategories` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `fixedassetcategories` ( `categoryid` char(6) NOT NULL DEFAULT '', `categorydescription` char(20) NOT NULL DEFAULT '', @@ -849,28 +849,28 @@ `defaultdepntype` int(11) NOT NULL DEFAULT '1', PRIMARY KEY (`categoryid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `fixedassetlocations` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `fixedassetlocations` ( `locationid` char(6) NOT NULL DEFAULT '', `locationdescription` char(20) NOT NULL DEFAULT '', `parentlocationid` char(6) DEFAULT '', PRIMARY KEY (`locationid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `fixedassets` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `fixedassets` ( `assetid` int(11) NOT NULL AUTO_INCREMENT, `serialno` varchar(30) NOT NULL DEFAULT '', @@ -888,14 +888,14 @@ `disposaldate` date NOT NULL DEFAULT '0000-00-00', PRIMARY KEY (`assetid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `fixedassettrans` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `fixedassettrans` ( `id` int(11) NOT NULL AUTO_INCREMENT, `assetid` int(11) NOT NULL, @@ -911,14 +911,14 @@ KEY `inputdate` (`inputdate`), KEY `transdate` (`transdate`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `freightcosts` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `freightcosts` ( `shipcostfromid` int(11) NOT NULL AUTO_INCREMENT, `locationfrom` varchar(5) NOT NULL DEFAULT '', @@ -938,14 +938,14 @@ CONSTRAINT `freightcosts_ibfk_1` FOREIGN KEY (`locationfrom`) REFERENCES `locations` (`loccode`), CONSTRAINT `freightcosts_ibfk_2` FOREIGN KEY (`shipperid`) REFERENCES `shippers` (`shipper_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `geocode_param` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `geocode_param` ( `geocodeid` tinyint(4) NOT NULL AUTO_INCREMENT, `geocode_key` varchar(200) NOT NULL DEFAULT '', @@ -956,14 +956,14 @@ `map_host` varchar(50) NOT NULL DEFAULT '', PRIMARY KEY (`geocodeid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `gltrans` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `gltrans` ( `counterindex` int(11) NOT NULL AUTO_INCREMENT, `type` smallint(6) NOT NULL DEFAULT '0', @@ -990,14 +990,14 @@ CONSTRAINT `gltrans_ibfk_2` FOREIGN KEY (`type`) REFERENCES `systypes` (`typeid`), CONSTRAINT `gltrans_ibfk_3` FOREIGN KEY (`periodno`) REFERENCES `periods` (`periodno`) ) ENGINE=InnoDB AUTO_INCREMENT=62 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `grns` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `grns` ( `grnbatch` smallint(6) NOT NULL DEFAULT '0', `grnno` int(11) NOT NULL AUTO_INCREMENT, @@ -1017,14 +1017,14 @@ CONSTRAINT `grns_ibfk_1` FOREIGN KEY (`supplierid`) REFERENCES `suppliers` (`supplierid`), CONSTRAINT `grns_ibfk_2` FOREIGN KEY (`podetailitem`) REFERENCES `purchorderdetails` (`podetailitem`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `holdreasons` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `holdreasons` ( `reasoncode` smallint(6) NOT NULL DEFAULT '1', `reasondescription` char(30) NOT NULL DEFAULT '', @@ -1032,14 +1032,14 @@ PRIMARY KEY (`reasoncode`), KEY `ReasonDescription` (`reasondescription`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `labelfields` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `labelfields` ( `labelfieldid` int(11) NOT NULL AUTO_INCREMENT, `labelid` tinyint(4) NOT NULL, @@ -1052,14 +1052,14 @@ KEY `labelid` (`labelid`), KEY `vpos` (`vpos`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `labels` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `labels` ( `labelid` tinyint(11) NOT NULL AUTO_INCREMENT, `description` varchar(50) NOT NULL, @@ -1073,14 +1073,14 @@ `columnwidth` double NOT NULL DEFAULT '0', PRIMARY KEY (`labelid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `lastcostrollup` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `lastcostrollup` ( `stockid` char(20) NOT NULL DEFAULT '', `totalonhand` double NOT NULL DEFAULT '0', @@ -1094,14 +1094,14 @@ `newlabcost` decimal(20,4) NOT NULL DEFAULT '0.0000', `newoheadcost` decimal(20,4) NOT NULL DEFAULT '0.0000' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `locations` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `locations` ( `loccode` varchar(5) NOT NULL DEFAULT '', `locationname` varchar(50) NOT NULL DEFAULT '', @@ -1124,14 +1124,14 @@ KEY `taxprovinceid` (`taxprovinceid`), CONSTRAINT `locations_ibfk_1` FOREIGN KEY (`taxprovinceid`) REFERENCES `taxprovinces` (`taxprovinceid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `locstock` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `locstock` ( `loccode` varchar(5) NOT NULL DEFAULT '', `stockid` varchar(20) NOT NULL DEFAULT '', @@ -1142,14 +1142,14 @@ CONSTRAINT `locstock_ibfk_1` FOREIGN KEY (`loccode`) REFERENCES `locations` (`loccode`), CONSTRAINT `locstock_ibfk_2` FOREIGN KEY (`stockid`) REFERENCES `stockmaster` (`stockid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `loctransfers` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `loctransfers` ( `reference` int(11) NOT NULL DEFAULT '0', `stockid` varchar(20) NOT NULL DEFAULT '', @@ -1167,14 +1167,14 @@ CONSTRAINT `loctransfers_ibfk_2` FOREIGN KEY (`recloc`) REFERENCES `locations` (`loccode`), CONSTRAINT `loctransfers_ibfk_3` FOREIGN KEY (`stockid`) REFERENCES `stockmaster` (`stockid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Stores Shipments To And From Locations'; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `mrpcalendar` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `mrpcalendar` ( `calendardate` date NOT NULL, `daynumber` int(6) NOT NULL, @@ -1182,14 +1182,14 @@ PRIMARY KEY (`calendardate`), KEY `daynumber` (`daynumber`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `mrpdemands` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `mrpdemands` ( `demandid` int(11) NOT NULL AUTO_INCREMENT, `stockid` varchar(20) NOT NULL DEFAULT '', @@ -1202,28 +1202,28 @@ CONSTRAINT `mrpdemands_ibfk_1` FOREIGN KEY (`mrpdemandtype`) REFERENCES `mrpdemandtypes` (`mrpdemandtype`), CONSTRAINT `mrpdemands_ibfk_2` FOREIGN KEY (`stockid`) REFERENCES `stockmaster` (`stockid`) ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `mrpdemandtypes` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `mrpdemandtypes` ( `mrpdemandtype` varchar(6) NOT NULL DEFAULT '', `description` char(30) NOT NULL DEFAULT '', PRIMARY KEY (`mrpdemandtype`), KEY `mrpdemandtype` (`mrpdemandtype`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `mrpplannedorders` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `mrpplannedorders` ( `id` int(11) NOT NULL AUTO_INCREMENT, `part` char(20) DEFAULT NULL, @@ -1235,14 +1235,14 @@ `updateflag` smallint(6) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `offers` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `offers` ( `offerid` int(11) NOT NULL AUTO_INCREMENT, `tenderid` int(11) NOT NULL DEFAULT '0', @@ -1259,14 +1259,14 @@ CONSTRAINT `offers_ibfk_1` FOREIGN KEY (`supplierid`) REFERENCES `suppliers` (`supplierid`), CONSTRAINT `offers_ibfk_2` FOREIGN KEY (`stockid`) REFERENCES `stockmaster` (`stockid`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `orderdeliverydifferenceslog` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `orderdeliverydifferenceslog` ( `orderno` int(11) NOT NULL DEFAULT '0', `invoiceno` int(11) NOT NULL DEFAULT '0', @@ -1283,14 +1283,14 @@ CONSTRAINT `orderdeliverydifferenceslog_ibfk_2` FOREIGN KEY (`debtorno`, `branch`) REFERENCES `custbranch` (`debtorno`, `branchcode`), CONSTRAINT `orderdeliverydifferenceslog_ibfk_3` FOREIGN KEY (`orderno`) REFERENCES `salesorders` (`orderno`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `paymentmethods` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `paymentmethods` ( `paymentid` tinyint(4) NOT NULL AUTO_INCREMENT, `paymentname` varchar(15) NOT NULL DEFAULT '', @@ -1300,14 +1300,14 @@ `opencashdrawer` tinyint(4) NOT NULL DEFAULT '0', PRIMARY KEY (`paymentid`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `paymentterms` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `paymentterms` ( `termsindicator` char(2) NOT NULL DEFAULT '', `terms` char(40) NOT NULL DEFAULT '', @@ -1317,14 +1317,14 @@ KEY `DaysBeforeDue` (`daysbeforedue`), KEY `DayInFollowingMonth` (`dayinfollowingmonth`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `pcashdetails` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `pcashdetails` ( `counterindex` int(20) NOT NULL AUTO_INCREMENT, `tabcode` varchar(20) NOT NULL, @@ -1337,14 +1337,14 @@ `receipt` text COMMENT 'filename or path to scanned receipt or code of receipt to find physical receipt if tax guys or auditors show up', PRIMARY KEY (`counterindex`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `pcexpenses` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `pcexpenses` ( `codeexpense` varchar(20) NOT NULL COMMENT 'code for the group', `description` varchar(50) NOT NULL COMMENT 'text description, e.g. meals, train tickets, fuel, etc', @@ -1354,14 +1354,14 @@ KEY `glaccount` (`glaccount`), CONSTRAINT `pcexpenses_ibfk_1` FOREIGN KEY (`glaccount`) REFERENCES `chartmaster` (`accountcode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `pctabexpenses` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `pctabexpenses` ( `typetabcode` varchar(20) NOT NULL, `codeexpense` varchar(20) NOT NULL, @@ -1370,14 +1370,14 @@ CONSTRAINT `pctabexpenses_ibfk_1` FOREIGN KEY (`typetabcode`) REFERENCES `pctypetabs` (`typetabcode`), CONSTRAINT `pctabexpenses_ibfk_2` FOREIGN KEY (`codeexpense`) REFERENCES `pcexpenses` (`codeexpense`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `pctabs` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `pctabs` ( `tabcode` varchar(20) NOT NULL, `usercode` varchar(20) NOT NULL COMMENT 'code of user employee from www_users', @@ -1400,41 +1400,41 @@ CONSTRAINT `pctabs_ibfk_4` FOREIGN KEY (`authorizer`) REFERENCES `www_users` (`userid`), CONSTRAINT `pctabs_ibfk_5` FOREIGN KEY (`glaccountassignment`) REFERENCES `chartmaster` (`accountcode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `pctypetabs` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `pctypetabs` ( `typetabcode` varchar(20) NOT NULL COMMENT 'code for the type of petty cash tab', `typetabdescription` varchar(50) NOT NULL COMMENT 'text description, e.g. tab for CEO', PRIMARY KEY (`typetabcode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `periods` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `periods` ( `periodno` smallint(6) NOT NULL DEFAULT '0', `lastdate_in_period` date NOT NULL DEFAULT '0000-00-00', PRIMARY KEY (`periodno`), KEY `LastDate_in_Period` (`lastdate_in_period`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `pickinglistdetails` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `pickinglistdetails` ( `pickinglistno` int(11) NOT NULL DEFAULT '0', `pickinglistlineno` int(11) NOT NULL DEFAULT '0', @@ -1444,14 +1444,14 @@ PRIMARY KEY (`pickinglistno`,`pickinglistlineno`), CONSTRAINT `pickinglistdetails_ibfk_1` FOREIGN KEY (`pickinglistno`) REFERENCES `pickinglists` (`pickinglistno`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `pickinglists` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `pickinglists` ( `pickinglistno` int(11) NOT NULL DEFAULT '0', `orderno` int(11) NOT NULL DEFAULT '0', @@ -1462,14 +1462,14 @@ KEY `pickinglists_ibfk_1` (`orderno`), CONSTRAINT `pickinglists_ibfk_1` FOREIGN KEY (`orderno`) REFERENCES `salesorders` (`orderno`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `prices` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `prices` ( `stockid` varchar(20) NOT NULL DEFAULT '', `typeabbrev` char(2) NOT NULL DEFAULT '', @@ -1488,14 +1488,14 @@ CONSTRAINT `prices_ibfk_2` FOREIGN KEY (`currabrev`) REFERENCES `currencies` (`currabrev`), CONSTRAINT `prices_ibfk_3` FOREIGN KEY (`typeabbrev`) REFERENCES `salestypes` (`typeabbrev`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `purchdata` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `purchdata` ( `supplierno` char(10) NOT NULL DEFAULT '', `stockid` char(20) NOT NULL DEFAULT '', @@ -1515,14 +1515,14 @@ CONSTRAINT `purchdata_ibfk_1` FOREIGN KEY (`stockid`) REFERENCES `stockmaster` (`stockid`), CONSTRAINT `purchdata_ibfk_2` FOREIGN KEY (`supplierno`) REFERENCES `suppliers` (`supplierid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `purchorderauth` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `purchorderauth` ( `userid` varchar(20) NOT NULL DEFAULT '', `currabrev` char(3) NOT NULL DEFAULT '', @@ -1531,14 +1531,14 @@ `offhold` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`userid`,`currabrev`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `purchorderdetails` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `purchorderdetails` ( `podetailitem` int(11) NOT NULL AUTO_INCREMENT, `orderno` int(11) NOT NULL DEFAULT '0', @@ -1569,14 +1569,14 @@ KEY `Completed` (`completed`), CONSTRAINT `purchorderdetails_ibfk_1` FOREIGN KEY (`orderno`) REFERENCES `purchorders` (`orderno`) ) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `purchorders` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `purchorders` ( `orderno` int(11) NOT NULL AUTO_INCREMENT, `supplierno` varchar(10) NOT NULL DEFAULT '', @@ -1621,14 +1621,14 @@ CONSTRAINT `purchorders_ibfk_1` FOREIGN KEY (`supplierno`) REFERENCES `suppliers` (`supplierid`), CONSTRAINT `purchorders_ibfk_2` FOREIGN KEY (`intostocklocation`) REFERENCES `locations` (`loccode`) ) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `recurringsalesorders` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `recurringsalesorders` ( `recurrorderno` int(11) NOT NULL AUTO_INCREMENT, `debtorno` varchar(10) NOT NULL DEFAULT '', @@ -1662,14 +1662,15 @@ KEY `branchcode` (`branchcode`,`debtorno`), CONSTRAINT `recurringsalesorders_ibfk_1` FOREIGN KEY (`branchcode`, `debtorno`) REFERENCES `custbranch` (`branchcode`, `debtorno`) ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `recurrsalesorderdetails` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + + CREATE TABLE `recurrsalesorderdetails` ( `recurrorderno` int(11) NOT NULL DEFAULT '0', `stkcode` varchar(20) NOT NULL DEFAULT '', @@ -1682,14 +1683,14 @@ CONSTRAINT `recurrsalesorderdetails_ibfk_1` FOREIGN KEY (`recurrorderno`) REFERENCES `recurringsalesorders` (`recurrorderno`), CONSTRAINT `recurrsalesorderdetails_ibfk_2` FOREIGN KEY (`stkcode`) REFERENCES `stockmaster` (`stockid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `reportcolumns` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `reportcolumns` ( `reportid` smallint(6) NOT NULL DEFAULT '0', `colno` smallint(6) NOT NULL DEFAULT '0', @@ -1708,14 +1709,14 @@ PRIMARY KEY (`reportid`,`colno`), CONSTRAINT `reportcolumns_ibfk_1` FOREIGN KEY (`reportid`) REFERENCES `reportheaders` (`reportid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `reportfields` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `reportfields` ( `id` int(8) NOT NULL AUTO_INCREMENT, `reportid` int(5) NOT NULL DEFAULT '0', @@ -1729,14 +1730,14 @@ PRIMARY KEY (`id`), KEY `reportid` (`reportid`) ) ENGINE=MyISAM AUTO_INCREMENT=1805 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `reportheaders` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `reportheaders` ( `reportid` smallint(6) NOT NULL AUTO_INCREMENT, `reportheading` varchar(80) NOT NULL DEFAULT '', @@ -1759,27 +1760,27 @@ PRIMARY KEY (`reportid`), KEY `ReportHeading` (`reportheading`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `reportlinks` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `reportlinks` ( `table1` varchar(25) NOT NULL DEFAULT '', `table2` varchar(25) NOT NULL DEFAULT '', `equation` varchar(75) NOT NULL DEFAULT '' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `reports` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `reports` ( `id` int(5) NOT NULL AUTO_INCREMENT, `reportname` varchar(30) NOT NULL DEFAULT '', @@ -1855,14 +1856,14 @@ PRIMARY KEY (`id`), KEY `name` (`reportname`,`groupname`) ) ENGINE=MyISAM AUTO_INCREMENT=136 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `salesanalysis` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `salesanalysis` ( `typeabbrev` char(2) NOT NULL DEFAULT '', `periodno` smallint(6) NOT NULL DEFAULT '0', @@ -1890,28 +1891,28 @@ KEY `Salesperson` (`salesperson`), CONSTRAINT `salesanalysis_ibfk_1` FOREIGN KEY (`periodno`) REFERENCES `periods` (`periodno`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `salescat` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `salescat` ( `salescatid` tinyint(4) NOT NULL AUTO_INCREMENT, `parentcatid` tinyint(4) DEFAULT NULL, `salescatname` varchar(30) DEFAULT NULL, PRIMARY KEY (`salescatid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `salescatprod` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `salescatprod` ( `salescatid` tinyint(4) NOT NULL DEFAULT '0', `stockid` varchar(20) NOT NULL DEFAULT '', @@ -1921,14 +1922,14 @@ CONSTRAINT `salescatprod_ibfk_1` FOREIGN KEY (`stockid`) REFERENCES `stockmaster` (`stockid`), CONSTRAINT `salescatprod_ibfk_2` FOREIGN KEY (`salescatid`) REFERENCES `salescat` (`salescatid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `salesglpostings` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `salesglpostings` ( `id` int(11) NOT NULL AUTO_INCREMENT, `area` varchar(3) NOT NULL, @@ -1942,14 +1943,14 @@ KEY `StkCat` (`stkcat`), KEY `SalesType` (`salestype`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `salesman` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `salesman` ( `salesmancode` char(3) NOT NULL DEFAULT '', `salesmanname` char(30) NOT NULL DEFAULT '', @@ -1961,14 +1962,14 @@ `current` tinyint(4) NOT NULL COMMENT 'Salesman current (1) or not (0)', PRIMARY KEY (`salesmancode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `salesorderdetails` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `salesorderdetails` ( `orderlineno` int(11) NOT NULL DEFAULT '0', `orderno` int(11) NOT NULL DEFAULT '0', @@ -1992,14 +1993,14 @@ CONSTRAINT `salesorderdetails_ibfk_1` FOREIGN KEY (`orderno`) REFERENCES `salesorders` (`orderno`), CONSTRAINT `salesorderdetails_ibfk_2` FOREIGN KEY (`stkcode`) REFERENCES `stockmaster` (`stockid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `salesorders` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `salesorders` ( `orderno` int(11) NOT NULL, `debtorno` varchar(10) NOT NULL DEFAULT '', @@ -2042,42 +2043,42 @@ CONSTRAINT `salesorders_ibfk_2` FOREIGN KEY (`shipvia`) REFERENCES `shippers` (`shipper_id`), CONSTRAINT `salesorders_ibfk_3` FOREIGN KEY (`fromstkloc`) REFERENCES `locations` (`loccode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `salestypes` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `salestypes` ( `typeabbrev` char(2) NOT NULL DEFAULT '', `sales_type` varchar(40) NOT NULL DEFAULT '', PRIMARY KEY (`typeabbrev`), KEY `Sales_Type` (`sales_type`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `scripts` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `scripts` ( `script` varchar(78) NOT NULL DEFAULT '', `pagesecurity` int(11) NOT NULL DEFAULT '1', `description` text NOT NULL, PRIMARY KEY (`script`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `securitygroups` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `securitygroups` ( `secroleid` int(11) NOT NULL DEFAULT '0', `tokenid` int(11) NOT NULL DEFAULT '0', @@ -2087,40 +2088,40 @@ CONSTRAINT `securitygroups_secroleid_fk` FOREIGN KEY (`secroleid`) REFERENCES `securityroles` (`secroleid`), CONSTRAINT `securitygroups_tokenid_fk` FOREIGN KEY (`tokenid`) REFERENCES `securitytokens` (`tokenid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `securityroles` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `securityroles` ( `secroleid` int(11) NOT NULL AUTO_INCREMENT, `secrolename` text NOT NULL, PRIMARY KEY (`secroleid`) ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `securitytokens` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `securitytokens` ( `tokenid` int(11) NOT NULL DEFAULT '0', `tokenname` text NOT NULL, PRIMARY KEY (`tokenid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `shipmentcharges` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `shipmentcharges` ( `shiptchgid` int(11) NOT NULL AUTO_INCREMENT, `shiptref` int(11) NOT NULL DEFAULT '0', @@ -2136,14 +2137,14 @@ CONSTRAINT `shipmentcharges_ibfk_1` FOREIGN KEY (`shiptref`) REFERENCES `shipments` (`shiptref`), CONSTRAINT `shipmentcharges_ibfk_2` FOREIGN KEY (`transtype`) REFERENCES `systypes` (`typeid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `shipments` -- -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; + + CREATE TABLE `shipments` ( `shiptref` int(... [truncated message content] |