1SET FOREIGN_KEY_CHECKS=0;
2ALTER TABLE accountgroups CONVERT TO CHARACTER SET utf8;
3ALTER TABLE accountsection CONVERT TO CHARACTER SET utf8;
4ALTER TABLE areas  CONVERT TO CHARACTER SET utf8;
5ALTER TABLE audittrail CONVERT TO CHARACTER SET utf8;
6ALTER TABLE bankaccounts CONVERT TO CHARACTER SET utf8;
7ALTER TABLE banktrans CONVERT TO CHARACTER SET utf8;
8ALTER TABLE bom CONVERT TO CHARACTER SET utf8;
9ALTER TABLE buckets CONVERT TO CHARACTER SET utf8;
10ALTER TABLE chartdetails CONVERT TO CHARACTER SET utf8;
11ALTER TABLE chartmaster CONVERT TO CHARACTER SET utf8;
12ALTER TABLE cogsglpostings CONVERT TO CHARACTER SET utf8;
13ALTER TABLE companies CONVERT TO CHARACTER SET utf8;
14ALTER TABLE config CONVERT TO CHARACTER SET utf8;
15ALTER TABLE currencies CONVERT TO CHARACTER SET utf8;
16ALTER TABLE custallocns CONVERT TO CHARACTER SET utf8;
17ALTER TABLE custbranch CONVERT TO CHARACTER SET utf8;
18ALTER TABLE custcontacts CONVERT TO CHARACTER SET utf8;
19ALTER TABLE custnotes  CONVERT TO CHARACTER SET utf8;
20ALTER TABLE debtorsmaster CONVERT TO CHARACTER SET utf8;
21ALTER TABLE debtortrans CONVERT TO CHARACTER SET utf8;
22ALTER TABLE debtortranstaxes  CONVERT TO CHARACTER SET utf8;
23ALTER TABLE debtortype CONVERT TO CHARACTER SET utf8;
24ALTER TABLE debtortypenotes CONVERT TO CHARACTER SET utf8;
25ALTER TABLE deliverynotes CONVERT TO CHARACTER SET utf8;
26ALTER TABLE discountmatrix CONVERT TO CHARACTER SET utf8;
27ALTER TABLE edi_orders_seg_groups  CONVERT TO CHARACTER SET utf8;
28ALTER TABLE edi_orders_segs CONVERT TO CHARACTER SET utf8;
29ALTER TABLE ediitemmapping CONVERT TO CHARACTER SET utf8;
30ALTER TABLE edimessageformat CONVERT TO CHARACTER SET utf8;
31ALTER TABLE factorcompanies CONVERT TO CHARACTER SET utf8;
32ALTER TABLE freightcosts  CONVERT TO CHARACTER SET utf8;
33ALTER TABLE geocode_param CONVERT TO CHARACTER SET utf8;
34ALTER TABLE gltrans CONVERT TO CHARACTER SET utf8;
35ALTER TABLE grns  CONVERT TO CHARACTER SET utf8;
36ALTER TABLE holdreasons CONVERT TO CHARACTER SET utf8;
37ALTER TABLE lastcostrollup CONVERT TO CHARACTER SET utf8;
38ALTER TABLE locations CONVERT TO CHARACTER SET utf8;
39ALTER TABLE locstock  CONVERT TO CHARACTER SET utf8;
40ALTER TABLE loctransfers  CONVERT TO CHARACTER SET utf8;
41ALTER TABLE mrpcalendar  CONVERT TO CHARACTER SET utf8;
42ALTER TABLE mrpdemands CONVERT TO CHARACTER SET utf8;
43ALTER TABLE mrpdemandtypes CONVERT TO CHARACTER SET utf8;
44ALTER TABLE orderdeliverydifferenceslog CONVERT TO CHARACTER SET utf8;
45ALTER TABLE paymentmethods CONVERT TO CHARACTER SET utf8;
46ALTER TABLE paymentterms CONVERT TO CHARACTER SET utf8;
47ALTER TABLE periods CONVERT TO CHARACTER SET utf8;
48ALTER TABLE prices CONVERT TO CHARACTER SET utf8;
49ALTER TABLE purchdata CONVERT TO CHARACTER SET utf8;
50ALTER TABLE purchorderauth CONVERT TO CHARACTER SET utf8;
51ALTER TABLE purchorderdetails CONVERT TO CHARACTER SET utf8;
52ALTER TABLE purchorders   CONVERT TO CHARACTER SET utf8;
53ALTER TABLE recurringsalesorders CONVERT TO CHARACTER SET utf8;
54ALTER TABLE recurrsalesorderdetails CONVERT TO CHARACTER SET utf8;
55ALTER TABLE reportcolumns CONVERT TO CHARACTER SET utf8;
56ALTER TABLE reportfields  CONVERT TO CHARACTER SET utf8;
57ALTER TABLE reportheaders CONVERT TO CHARACTER SET utf8;
58ALTER TABLE reportlinks   CONVERT TO CHARACTER SET utf8;
59ALTER TABLE reports  CONVERT TO CHARACTER SET utf8;
60ALTER TABLE salesanalysis CONVERT TO CHARACTER SET utf8;
61ALTER TABLE salescat CONVERT TO CHARACTER SET utf8;
62ALTER TABLE salescatprod  CONVERT TO CHARACTER SET utf8;
63ALTER TABLE salesglpostings  CONVERT TO CHARACTER SET utf8;
64ALTER TABLE salesman      CONVERT TO CHARACTER SET utf8;
65ALTER TABLE salesorderdetails  CONVERT TO CHARACTER SET utf8;
66ALTER TABLE salesorders CONVERT TO CHARACTER SET utf8;
67ALTER TABLE salestypes  CONVERT TO CHARACTER SET utf8;
68ALTER TABLE scripts  CONVERT TO CHARACTER SET utf8;
69ALTER TABLE securitygroups CONVERT TO CHARACTER SET utf8;
70ALTER TABLE securityroles CONVERT TO CHARACTER SET utf8;
71ALTER TABLE securitytokens CONVERT TO CHARACTER SET utf8;
72ALTER TABLE shipmentcharges CONVERT TO CHARACTER SET utf8;
73ALTER TABLE shipments  CONVERT TO CHARACTER SET utf8;
74ALTER TABLE shippers CONVERT TO CHARACTER SET utf8;
75ALTER TABLE stockcategory CONVERT TO CHARACTER SET utf8;
76ALTER TABLE stockcatproperties CONVERT TO CHARACTER SET utf8;
77ALTER TABLE stockcheckfreeze CONVERT TO CHARACTER SET utf8;
78ALTER TABLE stockcounts   CONVERT TO CHARACTER SET utf8;
79ALTER TABLE stockitemproperties CONVERT TO CHARACTER SET utf8;
80ALTER TABLE stockmaster CONVERT TO CHARACTER SET utf8;
81ALTER TABLE stockmoves CONVERT TO CHARACTER SET utf8;
82ALTER TABLE stockmovestaxes CONVERT TO CHARACTER SET utf8;
83ALTER TABLE stockserialitems CONVERT TO CHARACTER SET utf8;
84ALTER TABLE stockserialmoves CONVERT TO CHARACTER SET utf8;
85ALTER TABLE suppallocs CONVERT TO CHARACTER SET utf8;
86ALTER TABLE suppliercontacts CONVERT TO CHARACTER SET utf8;
87ALTER TABLE suppliers CONVERT TO CHARACTER SET utf8;
88ALTER TABLE supptrans CONVERT TO CHARACTER SET utf8;
89ALTER TABLE supptranstaxes CONVERT TO CHARACTER SET utf8;
90ALTER TABLE systypes  CONVERT TO CHARACTER SET utf8;
91ALTER TABLE tags CONVERT TO CHARACTER SET utf8;
92ALTER TABLE taxauthorities CONVERT TO CHARACTER SET utf8;
93ALTER TABLE taxauthrates CONVERT TO CHARACTER SET utf8;
94ALTER TABLE taxcategories CONVERT TO CHARACTER SET utf8;
95ALTER TABLE taxgroups CONVERT TO CHARACTER SET utf8;
96ALTER TABLE taxgrouptaxes CONVERT TO CHARACTER SET utf8;
97ALTER TABLE taxprovinces  CONVERT TO CHARACTER SET utf8;
98ALTER TABLE unitsofmeasure CONVERT TO CHARACTER SET utf8;
99ALTER TABLE woitems CONVERT TO CHARACTER SET utf8;
100ALTER TABLE worequirements CONVERT TO CHARACTER SET utf8;
101ALTER TABLE workcentres CONVERT TO CHARACTER SET utf8;
102ALTER TABLE workorders CONVERT TO CHARACTER SET utf8;
103ALTER TABLE woserialnos CONVERT TO CHARACTER SET utf8;
104ALTER TABLE www_users CONVERT TO CHARACTER SET utf8;
105
106INSERT INTO `config` (`confname`, `confvalue`) VALUES ('FrequentlyOrderedItems',0);
107ALTER TABLE `www_users` CHANGE COLUMN `language` `language` varchar(10) NOT NULL DEFAULT 'en_GB.utf8';
108
109ALTER TABLE `currencies` ADD COLUMN `decimalplaces` tinyint(3) NOT NULL DEFAULT 2 AFTER `hundredsname`;
110
111INSERT INTO `config` (`confname`, `confvalue`) VALUES ('NumberOfMonthMustBeShown', '6');
112
113ALTER TABLE `holdreasons` DROP INDEX `ReasonCode`;
114ALTER TABLE `chartmaster` DROP INDEX `AccountCode`;
115
116ALTER TABLE `purchorders` ADD COLUMN `paymentterms` char(2) NOT NULL DEFAULT '';
117ALTER TABLE `purchorders` ADD COLUMN `suppdeladdress1` varchar(40) NOT NULL DEFAULT '' AFTER deladd6;
118ALTER TABLE `purchorders` ADD COLUMN `suppdeladdress2` varchar(40) NOT NULL DEFAULT '' AFTER suppdeladdress1;
119ALTER TABLE `purchorders` ADD COLUMN `suppdeladdress3` varchar(40) NOT NULL DEFAULT '' AFTER suppdeladdress2;
120ALTER TABLE `purchorders` ADD COLUMN `suppdeladdress4` varchar(40) NOT NULL DEFAULT '' AFTER suppdeladdress3;
121ALTER TABLE `purchorders` ADD COLUMN `suppdeladdress5` varchar(20) NOT NULL DEFAULT '' AFTER suppdeladdress4;
122ALTER TABLE `purchorders` ADD COLUMN `suppdeladdress6` varchar(15) NOT NULL DEFAULT '' AFTER suppdeladdress5;
123ALTER TABLE `purchorders` ADD COLUMN `suppliercontact` varchar(30) NOT NULL DEFAULT '' AFTER suppdeladdress6;
124ALTER TABLE `purchorders` ADD COLUMN `supptel` varchar(30) NOT NULL DEFAULT '' AFTER suppliercontact;
125ALTER TABLE `purchorders` ADD COLUMN `tel` varchar(15) NOT NULL DEFAULT '' AFTER deladd6;
126ALTER TABLE `purchorders` ADD COLUMN `port` varchar(40) NOT NULL DEFAULT '' ;
127
128ALTER TABLE `suppliers` DROP FOREIGN KEY `suppliers_ibfk_4`;
129UPDATE `suppliers` SET `factorcompanyid`=0 WHERE `factorcompanyid`=1;
130DELETE FROM `factorcompanies` WHERE `coyname`='None';
131
132INSERT INTO  `config` (`confname`, `confvalue`) VALUES ('LogPath', '');
133INSERT INTO  `config` (`confname`, `confvalue`) VALUES ('LogSeverity', '0');
134
135ALTER TABLE `www_users` ADD COLUMN `pdflanguage` tinyint(1) NOT NULL DEFAULT '0';
136
137ALTER TABLE `purchorderauth` ADD COLUMN `offhold` tinyint(1) NOT NULL DEFAULT 0;
138
139UPDATE `www_users` SET `modulesallowed` = '1,1,1,1,1,1,1,1,1,1';
140
141UPDATE securitytokens SET tokenname = 'Petty Cash' WHERE tokenid = 6;
142
143CREATE TABLE IF NOT EXISTS `pcashdetails` (
144  `counterindex` int(20) NOT NULL AUTO_INCREMENT,
145  `tabcode` varchar(20) NOT NULL,
146  `date` date NOT NULL,
147  `codeexpense` varchar(20) NOT NULL,
148  `amount` double NOT NULL,
149  `authorized` date NOT NULL COMMENT 'date cash assigment was revised and authorized by authorizer from tabs table',
150  `posted` tinyint(4) NOT NULL COMMENT 'has (or has not) been posted into gltrans',
151  `notes` text NOT NULL,
152  `receipt` text COMMENT 'filename or path to scanned receipt or code of receipt to find physical receipt if tax guys or auditors show up',
153  PRIMARY KEY (`counterindex`)
154) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
155
156
157CREATE TABLE IF NOT EXISTS `pcexpenses` (
158  `codeexpense` varchar(20) NOT NULL COMMENT 'code for the group',
159  `description` varchar(50) NOT NULL COMMENT 'text description, e.g. meals, train tickets, fuel, etc',
160  `glaccount` int(11) NOT NULL COMMENT 'GL related account',
161  PRIMARY KEY (`codeexpense`),
162  KEY (`glaccount`)
163) ENGINE=InnoDB DEFAULT CHARSET=utf8;
164
165
166CREATE TABLE IF NOT EXISTS `pctabexpenses` (
167  `typetabcode` varchar(20) NOT NULL,
168  `codeexpense` varchar(20) NOT NULL,
169  KEY (`typetabcode`),
170  KEY (`codeexpense`)
171) ENGINE=InnoDB DEFAULT CHARSET=utf8;
172
173CREATE TABLE IF NOT EXISTS `pctabs` (
174  `tabcode` varchar(20) NOT NULL,
175  `usercode` varchar(20) NOT NULL COMMENT 'code of user employee from www_users',
176  `typetabcode` varchar(20) NOT NULL,
177  `currency` char(3) NOT NULL,
178  `tablimit` double NOT NULL,
179  `authorizer` varchar(20) NOT NULL COMMENT 'code of user from www_users',
180  `glaccountassignment` int(11) NOT NULL COMMENT 'gl account where the money comes from',
181  `glaccountpcash` int(11) NOT NULL,
182  PRIMARY KEY (`tabcode`),
183  KEY (`usercode`),
184  KEY (`typetabcode`),
185  KEY (`currency`),
186  KEY (`authorizer`),
187  KEY (`glaccountassignment`)
188) ENGINE=InnoDB DEFAULT CHARSET=utf8;
189
190CREATE TABLE IF NOT EXISTS `pctypetabs` (
191  `typetabcode` varchar(20) NOT NULL COMMENT 'code for the type of petty cash tab',
192  `typetabdescription` varchar(50) NOT NULL COMMENT 'text description, e.g. tab for CEO',
193  PRIMARY KEY (`typetabcode`)
194) ENGINE=InnoDB DEFAULT CHARSET=utf8;
195
196ALTER TABLE `pcexpenses`   ADD CONSTRAINT `pcexpenses_ibfk_1` FOREIGN KEY (`glaccount`) REFERENCES `chartmaster` (`accountcode`);
197
198ALTER TABLE `pctabexpenses`
199  ADD CONSTRAINT `pctabexpenses_ibfk_1` FOREIGN KEY (`typetabcode`) REFERENCES `pctypetabs` (`typetabcode`),
200  ADD CONSTRAINT `pctabexpenses_ibfk_2` FOREIGN KEY (`codeexpense`) REFERENCES `pcexpenses` (`codeexpense`);
201
202ALTER TABLE `pctabs`
203  ADD CONSTRAINT `pctabs_ibfk_1` FOREIGN KEY (`usercode`) REFERENCES `www_users` (`userid`),
204  ADD CONSTRAINT `pctabs_ibfk_2` FOREIGN KEY (`typetabcode`) REFERENCES `pctypetabs` (`typetabcode`),
205  ADD CONSTRAINT `pctabs_ibfk_3` FOREIGN KEY (`currency`) REFERENCES `currencies` (`currabrev`),
206  ADD CONSTRAINT `pctabs_ibfk_4` FOREIGN KEY (`authorizer`) REFERENCES `www_users` (`userid`),
207  ADD CONSTRAINT `pctabs_ibfk_5` FOREIGN KEY (`glaccountassignment`) REFERENCES `chartmaster` (`accountcode`);
208
209ALTER TABLE `supptrans`  ADD COLUMN `inputdate` datetime NOT NULL AFTER `duedate` ;
210
211ALTER TABLE `debtortrans`  ADD COLUMN `inputdate` datetime NOT NULL AFTER `trandate` ;
212
213ALTER TABLE `reportfields` CHANGE COLUMN `fieldname` `fieldname` VARCHAR(60) NOT NULL DEFAULT '';
214
215INSERT INTO `config` (`confname`, `confvalue`) VALUES ('RequirePickingNote',0);
216
217CREATE TABLE IF NOT EXISTS `pickinglists` (
218  `pickinglistno` int(11) NOT NULL DEFAULT 0,
219  `orderno` int(11) NOT NULL DEFAULT 0,
220  `pickinglistdate` date NOT NULL default '0000-00-00',
221  `dateprinted` date NOT NULL default '0000-00-00',
222  `deliverynotedate` date NOT NULL default '0000-00-00',
223  CONSTRAINT `pickinglists_ibfk_1` FOREIGN KEY (`orderno`) REFERENCES `salesorders` (`orderno`),
224  PRIMARY KEY (`pickinglistno`)
225) ENGINE=InnoDB DEFAULT CHARSET=utf8;
226
227CREATE TABLE IF NOT EXISTS `pickinglistdetails` (
228  `pickinglistno` int(11) NOT NULL DEFAULT 0,
229  `pickinglistlineno` int(11) NOT NULL DEFAULT 0,
230  `orderlineno` int(11) NOT NULL DEFAULT 0,
231  `qtyexpected` double NOT NULL default 0.00,
232  `qtypicked` double NOT NULL default 0.00,
233  CONSTRAINT `pickinglistdetails_ibfk_1` FOREIGN KEY (`pickinglistno`) REFERENCES `pickinglists` (`pickinglistno`),
234  PRIMARY KEY (`pickinglistno`, `pickinglistlineno`)
235) ENGINE=InnoDB DEFAULT CHARSET=utf8;
236
237INSERT INTO `systypes` VALUES(19, 'Picking List', 0);
238ALTER TABLE `prices` ADD `startdate` DATE NOT NULL DEFAULT '0000-00-00' , ADD `enddate` DATE NOT NULL DEFAULT '0000-00-00';
239ALTER TABLE prices DROP PRIMARY KEY ,
240ADD PRIMARY KEY ( `stockid` , `typeabbrev` , `currabrev` , `debtorno` , `branchcode`, `startdate` , `enddate` ) ;
241ALTER TABLE purchdata ADD column minorderqty int(11) NOT NULL default 1;
242UPDATE prices SET startdate='1999-01-01', enddate='0000-00-00';
243
244ALTER TABLE stockcheckfreeze ADD COLUMN stockcheckdate date NOT NULL;
245
246ALTER TABLE suppliers add (email varchar(55),fax varchar(25), telephone varchar(25));
247
248ALTER TABLE `www_users` add `supplierid` varchar(10) NOT NULL DEFAULT '' AFTER `customerid`;
249INSERT INTO `securityroles` VALUES (9,'Supplier Log On Only');
250UPDATE `securitytokens` SET `tokenname`='Supplier centre - Supplier access only' WHERE tokenid=9;
251INSERT INTO `securitygroups` VALUES(9,9);
252
253ALTER TABLE locations add cashsalecustomer VARCHAR(21) NOT NULL DEFAULT '';
254
255DROP TABLE contracts;
256DROP TABLE contractreqts;
257DROP TABLE contractbom;
258
259CREATE TABLE IF NOT EXISTS `contractbom` (
260   contractref varchar(20) NOT NULL DEFAULT '0',
261   `stockid` varchar(20) NOT NULL DEFAULT '',
262  `workcentreadded` char(5) NOT NULL DEFAULT '',
263  `quantity` double NOT NULL DEFAULT '1',
264  PRIMARY KEY (`contractref`,`stockid`,`workcentreadded`),
265  KEY `Stockid` (`stockid`),
266  KEY `ContractRef` (`contractref`),
267  KEY `WorkCentreAdded` (`workcentreadded`),
268  CONSTRAINT `contractbom_ibfk_1` FOREIGN KEY (`workcentreadded`) REFERENCES `workcentres` (`code`),
269  CONSTRAINT `contractbom_ibfk_3` FOREIGN KEY (`stockid`) REFERENCES `stockmaster` (`stockid`)
270) ENGINE=InnoDB DEFAULT CHARSET=utf8;
271
272
273CREATE TABLE IF NOT EXISTS `contractreqts` (
274  `contractreqid` int(11) NOT NULL AUTO_INCREMENT,
275  `contractref` varchar(20) NOT NULL DEFAULT '0',
276  `requirement` varchar(40) NOT NULL DEFAULT '',
277  `quantity` double NOT NULL DEFAULT '1',
278  `costperunit` double NOT NULL DEFAULT '0.0000',
279  PRIMARY KEY (`contractreqid`),
280  KEY `ContractRef` (`contractref`),
281  CONSTRAINT `contractreqts_ibfk_1` FOREIGN KEY (`contractref`) REFERENCES `contracts` (`contractref`)
282) ENGINE=InnoDB DEFAULT CHARSET=utf8;
283
284
285CREATE TABLE IF NOT EXISTS `contracts` (
286  `contractref` varchar(20) NOT NULL DEFAULT '',
287  `contractdescription` text NOT NULL DEFAULT '',
288  `debtorno` varchar(10) NOT NULL DEFAULT '',
289  `branchcode` varchar(10) NOT NULL DEFAULT '',
290   `loccode` varchar(5) NOT NULL DEFAULT '',
291  `status` tinyint NOT NULL DEFAULT 0,
292  `categoryid` varchar(6) NOT NULL DEFAULT '',
293  `orderno` int(11) NOT NULL DEFAULT '0',
294  `customerref` VARCHAR( 20 ) NOT NULL DEFAULT '',
295  `margin` double NOT NULL DEFAULT '1',
296  `wo` int(11) NOT NULL DEFAULT '0',
297  `requireddate` date NOT NULL DEFAULT '0000-00-00',
298  `drawing` varchar(50) NOT NULL DEFAULT '',
299  `exrate` double NOT NULL DEFAULT '1',
300  PRIMARY KEY (`contractref`),
301  KEY `OrderNo` (`orderno`),
302  KEY `CategoryID` (`categoryid`),
303  KEY `Status` (`status`),
304  KEY `WO` (`wo`),
305  KEY `loccode` (`loccode`),
306  KEY `DebtorNo` (`debtorno`,`branchcode`),
307  CONSTRAINT `contracts_ibfk_1` FOREIGN KEY (`debtorno`, `branchcode`) REFERENCES `custbranch` (`debtorno`, `branchcode`),
308  CONSTRAINT `contracts_ibfk_2` FOREIGN KEY (`categoryid`) REFERENCES `stockcategory` (`categoryid`),
309  CONSTRAINT `contracts_ibfk_3` FOREIGN KEY (`loccode`) REFERENCES `locations` (`loccode`)
310) ENGINE=InnoDB DEFAULT CHARSET=utf8;
311
312
313ALTER TABLE `salestypes` CHANGE COLUMN `sales_type` `sales_type` VARCHAR(40) NOT NULL DEFAULT '';
314INSERT INTO `config` VALUES ('ShowValueOnGRN', 1);
315
316CREATE TABLE IF NOT EXISTS `offers` (
317  offerid int(11) NOT NULL AUTO_INCREMENT,
318  tenderid int(11) NOT NULL DEFAULT 0,
319  supplierid varchar(10) NOT NULL DEFAULT '',
320  stockid varchar(20) NOT NULL DEFAULT '',
321  quantity double NOT NULL DEFAULT 0.0,
322  uom varchar(15) NOT NULL DEFAULT '',
323  price double NOT NULL DEFAULT 0.0,
324  expirydate date NOT NULL DEFAULT '0000-00-00',
325  currcode char(3) NOT NULL DEFAULT '',
326  PRIMARY KEY (`offerid`),
327  CONSTRAINT `offers_ibfk_1` FOREIGN KEY (`supplierid`) REFERENCES `suppliers` (`supplierid`),
328  CONSTRAINT `offers_ibfk_2` FOREIGN KEY (`stockid`) REFERENCES `stockmaster` (`stockid`)
329) ENGINE=InnoDB DEFAULT CHARSET=utf8;
330
331INSERT INTO `config` VALUES('PurchasingManagerEmail', '');
332
333CREATE TABLE IF NOT EXISTS `emailsettings` (
334  `id` int(11) NOT NULL AUTO_INCREMENT,
335  `host` varchar(30) NOT NULL,
336  `port` char(5) NOT NULL,
337  `heloaddress` varchar(20) NOT NULL,
338  `username` varchar(30) DEFAULT NULL,
339  `password` varchar(30) DEFAULT NULL,
340  `timeout` int(11) DEFAULT '5',
341  `companyname` varchar(50) DEFAULT NULL,
342  `auth` tinyint(1) DEFAULT '0',
343  PRIMARY KEY (`id`)
344) ENGINE=InnoDB DEFAULT CHARSET=utf8;
345
346INSERT INTO emailsettings VALUES(Null, 'localhost', 25, 'helo', '', '', 5, '', 0);
347
348ALTER TABLE `salesorderdetails` ADD COLUMN `commissionrate` double NOT NULL DEFAULT 0.0;
349ALTER TABLE `salesorderdetails` ADD COLUMN `commissionearned` double NOT NULL DEFAULT 0.0;
350
351CREATE TABLE `suppliertype` (
352  `typeid` tinyint(4) NOT NULL AUTO_INCREMENT,
353  `typename` varchar(100) NOT NULL,
354  PRIMARY KEY (`typeid`)
355) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
356
357INSERT INTO `config` VALUES ('DefaultSupplierType', 1);
358INSERT INTO `suppliertype` VALUES(1, 'Default');
359ALTER TABLE `suppliers` ADD COLUMN `supptype` tinyint(4) NOT NULL DEFAULT 1 AFTER `address6`;
360
361ALTER TABLE `loctransfers` CHANGE COLUMN `shipqty` `shipqty` double NOT NULL DEFAULT 0.0;
362
363UPDATE `securitytokens` SET `tokenname`='Prices Security' WHERE tokenid=12;
364
365ALTER TABLE `www_users` CHANGE `supplierid` `supplierid` VARCHAR( 10 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
366ALTER TABLE `orderdeliverydifferenceslog` DROP PRIMARY KEY;
367
368ALTER TABLE `loctransfers` CHANGE COLUMN `recqty` `recqty` double NOT NULL DEFAULT 0.0;
369
370CREATE TABLE IF NOT EXISTS `contractcharges` (
371  `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
372  `contractref` varchar(20) NOT NULL,
373  `transtype` SMALLINT NOT NULL DEFAULT 20,
374  `transno` INT NOT NULL DEFAULT 0,
375  `amount` double NOT NULL DEFAULT 0,
376  `narrative` TEXT NOT NULL DEFAULT '',
377  `anticipated` TINYINT NOT NULL DEFAULT 0,
378  INDEX ( `contractref` , `transtype` , `transno` ),
379  CONSTRAINT `contractcharges_ibfk_1` FOREIGN KEY (`contractref`) REFERENCES `contracts` (`contractref`),
380  CONSTRAINT `contractcharges_ibfk_2` FOREIGN KEY (`transtype`) REFERENCES `systypes` (`typeid`)
381) ENGINE=InnoDB DEFAULT CHARSET=utf8;
382
383INSERT INTO `systypes` (`typeid`, `typename`, `typeno`) VALUES ('32', 'Contract Close', '1');
384
385ALTER TABLE `reports` ADD `col9width` INT( 3 ) NOT NULL DEFAULT '25' AFTER `col8width` ;
386
387ALTER TABLE `reports` ADD `col10width` INT( 3 ) NOT NULL DEFAULT '25' AFTER `col9width` ;
388
389ALTER TABLE `reports` ADD `col11width` INT( 3 ) NOT NULL DEFAULT '25' AFTER `col10width` ;
390
391ALTER TABLE `reports` ADD `col12width` INT( 3 ) NOT NULL DEFAULT '25' AFTER `col11width` ;
392
393ALTER TABLE `reports` ADD `col13width` INT( 3 ) NOT NULL DEFAULT '25' AFTER `col12width` ;
394
395ALTER TABLE `reports` ADD `col14width` INT( 3 ) NOT NULL DEFAULT '25' AFTER `col13width` ;
396
397ALTER TABLE `reports` ADD `col15width` INT( 3 ) NOT NULL DEFAULT '25' AFTER `col14width` ;
398
399ALTER TABLE `reports` ADD `col16width` INT( 3 ) NOT NULL DEFAULT '25' AFTER `col15width` ;
400
401ALTER TABLE `reports` ADD `col17width` INT( 3 ) NOT NULL DEFAULT '25' AFTER `col16width` ;
402
403ALTER TABLE `reports` ADD `col18width` INT( 3 ) NOT NULL DEFAULT '25' AFTER `col17width` ;
404
405ALTER TABLE `reports` ADD `col19width` INT( 3 ) NOT NULL DEFAULT '25' AFTER `col18width` ;
406
407ALTER TABLE `reports` ADD `col20width` INT( 3 ) NOT NULL DEFAULT '25' AFTER `col19width` ;
408
409ALTER TABLE `reportfields` CHANGE `fieldname` `fieldname` VARCHAR( 80) NOT NULL DEFAULT '';
410
411ALTER TABLE `stockcatproperties` ADD `maximumvalue` DOUBLE NOT NULL DEFAULT 999999999 AFTER `defaultvalue` ,
412	ADD `minimumvalue` DOUBLE NOT NULL DEFAULT -999999999,
413	ADD `numericvalue` TINYINT NOT NULL DEFAULT 0 ;
414
415CREATE TABLE IF NOT EXISTS `fixedassetcategories` (
416  `categoryid` char(6) NOT NULL DEFAULT '',
417  `categorydescription` char(20) NOT NULL DEFAULT '',
418  `costact` int(11) NOT NULL DEFAULT '0',
419  `depnact` int(11) NOT NULL DEFAULT '0',
420  `disposalact` int(11) NOT NULL DEFAULT '80000',
421  `accumdepnact` int(11) NOT NULL DEFAULT '0',
422  defaultdepnrate double NOT NULL DEFAULT '.2',
423  defaultdepntype int NOT NULL DEFAULT '1',
424  PRIMARY KEY (`categoryid`)
425) ENGINE=InnoDB DEFAULT CHARSET=utf8;
426
427CREATE TABLE IF NOT EXISTS `fixedassets` (
428  `assetid` int(11) NOT NULL AUTO_INCREMENT,
429  `serialno` varchar(30) NOT NULL DEFAULT '',
430  `barcode` varchar(20) NOT NULL,
431  `assetlocation` varchar(6) NOT NULL DEFAULT '',
432  `cost` double NOT NULL DEFAULT '0',
433  `accumdepn` double NOT NULL DEFAULT '0',
434  `datepurchased` date NOT NULL DEFAULT '0000-00-00',
435  `disposalproceeds` double NOT NULL DEFAULT '0',
436  `assetcategoryid` varchar(6) NOT NULL DEFAULT '',
437  `description` varchar(50) NOT NULL DEFAULT '',
438  `longdescription` text NOT NULL,
439  `depntype` int(11) NOT NULL DEFAULT '1',
440  `depnrate` double NOT NULL,
441  `disposaldate` date NOT NULL DEFAULT '0000-00-00',
442  PRIMARY KEY (`assetid`)
443) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
444
445
446
447INSERT INTO `systypes` (`typeid`, `typename`, `typeno`) VALUES ('41', 'Asset Addition', '1');
448INSERT INTO `systypes` (`typeid`, `typename`, `typeno`) VALUES ('42', 'Asset Category Change', '1');
449INSERT INTO `systypes` (`typeid`, `typename`, `typeno`) VALUES ('43', 'Delete w/down asset', '1');
450INSERT INTO `systypes` (`typeid`, `typename`, `typeno`) VALUES ('44', 'Depreciation', '1');
451
452CREATE TABLE fixedassettrans(
453	id INT( 11 ) NOT NULL AUTO_INCREMENT ,
454	assetid INT( 11 ) NOT NULL ,
455	transtype TINYINT( 4 ) NOT NULL ,
456	transdate DATE NOT NULL,
457	transno INT NOT NULL ,
458	periodno SMALLINT( 6 ) NOT NULL ,
459	inputdate DATE NOT NULL ,
460	fixedassettranstype  varchar(8) NOT NULL ,
461	amount DOUBLE NOT NULL ,
462	PRIMARY KEY ( id ) ,
463	INDEX ( assetid, transtype, transno ) ,
464	INDEX ( inputdate ),
465	INDEX (transdate)
466) ENGINE = InnoDB DEFAULT CHARSET = utf8;
467
468ALTER TABLE stockcheckfreeze CHANGE stockcheckdate stockcheckdate date NOT NULL DEFAULT '0000-00-00';
469
470ALTER TABLE purchorderdetails ADD COLUMN assetid int NOT NULL DEFAULT 0;
471
472INSERT INTO `systypes` (`typeid` ,`typename` ,`typeno`) VALUES ('49', 'Import Fixed Assets', '1');
473
474DROP TABLE scripts;
475
476CREATE TABLE IF NOT EXISTS `scripts` (
477  `script` varchar(78) NOT NULL DEFAULT '',
478  `pagesecurity` tinyint(11) NOT NULL DEFAULT '1',
479  `description` text NOT NULL,
480  PRIMARY KEY (`script`)
481) ENGINE=InnoDB DEFAULT CHARSET=utf8;
482
483INSERT INTO `scripts` (`script`, `pagesecurity`, `description`) VALUES
484('AccountGroups.php', 10, 'Defines the groupings of general ledger accounts'),
485('AccountSections.php', 10, 'Defines the sections in the general ledger reports'),
486('AddCustomerContacts.php', 3, 'Adds customer contacts'),
487('AddCustomerNotes.php', 3, 'Adds notes about customers'),
488('AddCustomerTypeNotes.php', 3, ''),
489('AgedDebtors.php', 2, 'Lists customer account balances in detail or summary in selected currency'),
490('AgedSuppliers.php', 2, 'Lists supplier account balances in detail or summary in selected currency'),
491('Areas.php', 3, 'Defines the sales areas - all customers must belong to a sales area for the purposes of sales analysis'),
492('AuditTrail.php', 15, 'Shows the activity with SQL statements and who performed the changes'),
493('BankAccounts.php', 10, 'Defines the general ledger code for bank accounts and specifies that bank transactions be created for these accounts for the purposes of reconciliation'),
494('BankMatching.php', 7, 'Allows payments and receipts to be matched off against bank statements'),
495('BankReconciliation.php', 7, 'Displays the bank reconciliation for a selected bank account'),
496('BOMExtendedQty.php', 2, 'Shows the component requirements to make an item'),
497('BOMIndented.php', 2, 'Shows the bill of material indented for each level'),
498('BOMIndentedReverse.php', 2, ''),
499('BOMInquiry.php', 2, 'Displays the bill of material with cost information'),
500('BOMListing.php', 2, 'Lists the bills of material for a selected range of items'),
501('BOMs.php', 9, 'Administers the bills of material for a selected item'),
502('COGSGLPostings.php', 10, 'Defines the general ledger account to be used for cost of sales entries'),
503('CompanyPreferences.php', 10, 'Defines the settings applicable for the company, including name, address, tax authority reference, whether GL integration used etc.'),
504('ConfirmDispatchControlled_Invoice.php', 11, 'Specifies the batch references/serial numbers of items dispatched that are being invoiced'),
505('ConfirmDispatch_Invoice.php', 2, 'Creates sales invoices from entered sales orders based on the quantities dispatched that can be modified'),
506('ContractBOM.php', 6, 'Creates the item requirements from stock for a contract as part of the contract cost build up'),
507('ContractCosting.php', 6, 'Shows a contract cost - the components and other non-stock costs issued to the contract'),
508('ContractOtherReqts.php', 4, 'Creates the other requirements for a contract cost build up'),
509('Contracts.php', 6, 'Creates or modifies a customer contract costing'),
510('CounterSales.php', 1, 'Allows sales to be entered against a cash sale customer account defined in the users location record'),
511('CreditItemsControlled.php', 3, 'Specifies the batch references/serial numbers of items being credited back into stock'),
512('CreditStatus.php', 3, 'Defines the credit status records. Each customer account is given a credit status from this table. Some credit status records can prohibit invoicing and new orders being entered.'),
513('Credit_Invoice.php', 3, 'Creates a credit note based on the details of an existing invoice'),
514('Currencies.php', 9, 'Defines the currencies available. Each customer and supplier must be defined as transacting in one of the currencies defined here.'),
515('CustEDISetup.php', 11, 'Allows the set up the customer specified EDI parameters for server, email or ftp.'),
516('CustLoginSetup.php', 15, ''),
517('CustomerAllocations.php', 3, 'Allows customer receipts and credit notes to be allocated to sales invoices'),
518('CustomerBranches.php', 3, 'Defines the details of customer branches such as delivery address and contact details - also sales area, representative etc'),
519('CustomerInquiry.php', 1, 'Shows the customers account transactions with balances outstanding, links available to drill down to invoice/credit note or email invoices/credit notes'),
520('CustomerReceipt.php', 3, 'Entry of both customer receipts against accounts receivable and also general ledger or nominal receipts'),
521('Customers.php', 3, 'Defines the setup of a customer account, including payment terms, billing address, credit status, currency etc'),
522('CustomerTransInquiry.php', 2, 'Lists in html the sequence of customer transactions, invoices, credit notes or receipts by a user entered date range'),
523('CustomerTypes.php', 15, ''),
524('CustWhereAlloc.php', 2, 'Shows to which invoices a receipt was allocated to'),
525('DailyBankTransactions.php', 8, ''),
526('DailySalesInquiry.php', 2, 'Shows the daily sales with GP in a calendar format'),
527('DebtorsAtPeriodEnd.php', 2, 'Shows the debtors control account as at a previous period end - based on system calendar monthly periods'),
528('DeliveryDetails.php', 1, 'Used during order entry to allow the entry of delivery addresses other than the defaulted branch delivery address and information about carrier/shipping method etc'),
529('DiscountCategories.php', 11, 'Defines the items belonging to a discount category. Discount Categories are used to allow discounts based on quantities across a range of producs'),
530('DiscountMatrix.php', 11, 'Defines the rates of discount applicable to discount categories and the customer groupings to which the rates are to apply'),
531('EDIMessageFormat.php', 10, 'Specifies the EDI message format used by a customer - administrator use only.'),
532('EDIProcessOrders.php', 11, 'Processes incoming EDI orders into sales orders'),
533('EDISendInvoices.php', 15, 'Processes invoiced EDI customer invoices into EDI messages and sends using the customers preferred method either ftp or email attachments.'),
534('EmailConfirmation.php', 2, ''),
535('EmailCustTrans.php', 2, 'Emails selected invoice or credit to the customer'),
536('ExchangeRateTrend.php', 2, 'Shows the trend in exchange rates as retrieved from ECB'),
537('Factors.php', 5, 'Defines supplier factor companies'),
538('FixedAssetCategories.php', 11, 'Defines the various categories of fixed assets'),
539('FixedAssetDepreciation.php', 10, 'Calculates and creates GL transactions to post depreciation for a period'),
540('FixedAssetItems.php', 11, 'Allows fixed assets to be defined'),
541('FixedAssetList.php', 11, ''),
542('FixedAssetLocations.php', 11, 'Allows the locations of fixed assets to be defined'),
543('FixedAssetRegister.php', 11, 'Produces a csv, html or pdf report of the fixed assets over a period showing period depreciation, additions and disposals'),
544('FixedAssetTransfer.php', 11, 'Allows the fixed asset locations to be changed in bulk'),
545('FormDesigner.php', 14, ''),
546('FreightCosts.php', 11, 'Defines the setup of the freight cost using different shipping methods to different destinations. The system can use this information to calculate applicable freight if the items are defined with the correct kgs and cubic volume'),
547('FTP_RadioBeacon.php', 2, 'FTPs sales orders for dispatch to a radio beacon software enabled warehouse dispatching facility'),
548('geocode.php', 3, ''),
549('GeocodeSetup.php', 3, ''),
550('geocode_genxml_customers.php', 3, ''),
551('geocode_genxml_suppliers.php', 3, ''),
552('geo_displaymap_customers.php', 3, ''),
553('geo_displaymap_suppliers.php', 3, ''),
554('GetStockImage.php', 1, ''),
555('GLAccountCSV.php', 8, 'Produces a CSV of the GL transactions for a particular range of periods and GL account'),
556('GLAccountInquiry.php', 8, 'Shows the general ledger transactions for a specified account over a specified range of periods'),
557('GLAccountReport.php', 8, 'Produces a report of the GL transactions for a particular account'),
558('GLAccounts.php', 10, 'Defines the general ledger accounts'),
559('GLBalanceSheet.php', 8, 'Shows the balance sheet for the company as at a specified date'),
560('GLBudgets.php', 10, 'Defines GL Budgets'),
561('GLCodesInquiry.php', 8, 'Shows the list of general ledger codes defined with account names and groupings'),
562('GLJournal.php', 10, 'Entry of general ledger journals, periods are calculated based on the date entered here'),
563('GLProfit_Loss.php', 8, 'Shows the profit and loss of the company for the range of periods entered'),
564('GLTagProfit_Loss.php', 8, ''),
565('GLTags.php', 10, 'Allows GL tags to be defined'),
566('GLTransInquiry.php', 8, 'Shows the general ledger journal created for the sub ledger transaction specified'),
567('GLTrialBalance.php', 8, 'Shows the trial balance for the month and the for the period selected together with the budgeted trial balances'),
568('GLTrialBalance_csv.php', 8, 'Produces a CSV of the Trial Balance for a particular period'),
569('GoodsReceived.php', 11, 'Entry of items received against purchase orders'),
570('GoodsReceivedControlled.php', 11, 'Entry of the serial numbers or batch references for controlled items received against purchase orders'),
571('index.php', 1, 'The main menu from where all functions available to the user are accessed by clicking on the links'),
572('InventoryPlanning.php', 2, 'Creates a pdf report showing the last 4 months use of items including as a component of assemblies together with stock quantity on hand, current demand for the item and current quantity on sales order.'),
573('InventoryPlanningPrefSupplier.php', 2, 'Produces a report showing the inventory to be ordered by supplier'),
574('InventoryQuantities.php', 2, ''),
575('InventoryValuation.php', 2, 'Creates a pdf report showing the value of stock at standard cost for a range of product categories selected'),
576('Labels.php', 15, 'Produces item pricing labels in a pdf from a range of selected criteria'),
577('Locations.php', 11, 'Defines the inventory stocking locations or warehouses'),
578('Logout.php', 1, 'Shows when the user logs out of webERP'),
579('MailInventoryValuation.php', 1, 'Meant to be run as a scheduled process to email the stock valuation off to a specified person. Creates the same stock valuation report as InventoryValuation.php'),
580('ManualContents.php', 1, ''),
581('MenuAccess.php', 15, ''),
582('MRP.php', 9, ''),
583('MRPCalendar.php', 9, ''),
584('MRPCreateDemands.php', 9, ''),
585('MRPDemands.php', 9, ''),
586('MRPDemandTypes.php', 9, ''),
587('MRPPlannedPurchaseOrders.php', 2, ''),
588('MRPPlannedWorkOrders.php', 2, ''),
589('MRPReport.php', 2, ''),
590('MRPReschedules.php', 2, ''),
591('MRPShortages.php', 2, ''),
592('OffersReceived.php', 4, ''),
593('OrderDetails.php', 2, 'Shows the detail of a sales order'),
594('OutstandingGRNs.php', 2, 'Creates a pdf showing all GRNs for which there has been no purchase invoice matched off against.'),
595('PageSecurity.php', 15, ''),
596('PaymentAllocations.php', 5, ''),
597('PaymentMethods.php', 15, ''),
598('Payments.php', 5, 'Entry of bank account payments either against an AP account or a general ledger payment - if the AP-GL link in company preferences is set'),
599('PaymentTerms.php', 10, 'Defines the payment terms records, these can be expressed as either a number of days credit or a day in the following month. All customers and suppliers must have a corresponding payment term recorded against their account'),
600('PcAssignCashToTab.php', 6, ''),
601('PcAuthorizeExpenses.php', 6, ''),
602('PcClaimExpensesFromTab.php', 6, ''),
603('PcExpenses.php', 15, ''),
604('PcExpensesTypeTab.php', 15, ''),
605('PcReportTab.php', 6, ''),
606('PcTabs.php', 15, ''),
607('PcTypeTabs.php', 15, ''),
608('PDFBankingSummary.php', 3, 'Creates a pdf showing the amounts entered as receipts on a specified date together with references for the purposes of banking'),
609('PDFChequeListing.php', 3, 'Creates a pdf showing all payments that have been made from a specified bank account over a specified period. This can be emailed to an email account defined in config.php - ie a financial controller'),
610('PDFCustomerList.php', 2, 'Creates a report of the customer and branch information held. This report has options to print only customer branches in a specified sales area and sales person. Additional option allows to list only those customers with activity either under or over a specified amount, since a specified date.'),
611('PDFCustTransListing.php', 3, ''),
612('PDFDeliveryDifferences.php', 3, 'Creates a pdf report listing the delivery differences from what the customer requested as recorded in the order entry. The report calculates a percentage of order fill based on the number of orders filled in full on time'),
613('PDFDIFOT.php', 3, 'Produces a pdf showing the delivery in full on time performance'),
614('PDFGrn.php', 2, 'Produces a GRN report on the receipt of stock'),
615('PDFLowGP.php', 2, 'Creates a pdf report showing the low gross profit sales made in the selected date range. The percentage of gp deemed acceptable can also be entered'),
616('PDFOrdersInvoiced.php', 3, 'Produces a pdf of orders invoiced based on selected criteria'),
617('PDFOrderStatus.php', 3, 'Reports on sales order status by date range, by stock location and stock category - producing a pdf showing each line items and any quantites delivered'),
618('PDFPickingList.php', 2, ''),
619('PDFPriceList.php', 2, 'Creates a pdf of the price list applicable to a given sales type and customer. Also allows the listing of prices specific to a customer'),
620('PDFPrintLabel.php', 10, ''),
621('PDFQuotation.php', 2, ''),
622('PDFReceipt.php', 2, ''),
623('PDFRemittanceAdvice.php', 2, ''),
624('PDFStockCheckComparison.php', 2, 'Creates a pdf comparing the quantites entered as counted at a given range of locations against the quantity stored as on hand as at the time a stock check was initiated.'),
625('PDFStockLocTransfer.php', 1, 'Creates a stock location transfer docket for the selected location transfer reference number'),
626('PDFStockNegatives.php', 1, 'Produces a pdf of the negative stocks by location'),
627('PDFStockTransfer.php', 2, 'Produces a report for stock transfers'),
628('PDFStockTransListing.php', 3, ''),
629('PDFSuppTransListing.php', 3, ''),
630('PDFTopItems.php', 2, 'Produces a pdf report of the top items sold'),
631('PeriodsInquiry.php', 2, 'Shows a list of all the system defined periods'),
632('POReport.php', 2, ''),
633('PO_AuthorisationLevels.php', 15, ''),
634('PO_AuthoriseMyOrders.php', 4, ''),
635('PO_Header.php', 4, 'Entry of a purchase order header record - date, references buyer etc'),
636('PO_Items.php', 4, 'Entry of a purchase order items - allows entry of items with lookup of currency cost from Purchasing Data previously entered also allows entry of nominal items against a general ledger code if the AP is integrated to the GL'),
637('PO_OrderDetails.php', 2, 'Purchase order inquiry shows the quantity received and invoiced of purchase order items as well as the header information'),
638('PO_PDFPurchOrder.php', 2, 'Creates a pdf of the selected purchase order for printing or email to one of the supplier contacts entered'),
639('PO_SelectOSPurchOrder.php', 2, 'Shows the outstanding purchase orders for selecting with links to receive or modify the purchase order header and items'),
640('PO_SelectPurchOrder.php', 2, 'Allows selection of any purchase order with links to the inquiry'),
641('Prices.php', 9, 'Entry of prices for a selected item also allows selection of sales type and currency for the price'),
642('PricesBasedOnMarkUp.php', 11, ''),
643('PricesByCost.php', 11, 'Allows prices to be updated based on cost'),
644('Prices_Customer.php', 11, 'Entry of prices for a selected item and selected customer/branch. The currency and sales type is defaulted from the customer''s record'),
645('PrintCheque.php', 5, ''),
646('PrintCustOrder.php', 2, 'Creates a pdf of the dispatch note - by default this is expected to be on two part pre-printed stationery to allow pickers to note discrepancies for the confirmer to update the dispatch at the time of invoicing'),
647('PrintCustOrder_generic.php', 2, 'Creates two copies of a laser printed dispatch note - both copies need to be written on by the pickers with any discrepancies to advise customer of any shortfall and on the office copy to ensure the correct quantites are invoiced'),
648('PrintCustStatements.php', 2, 'Creates a pdf for the customer statements in the selected range'),
649('PrintCustTrans.php', 1, 'Creates either a html invoice or credit note or a pdf. A range of invoices or credit notes can be selected also.'),
650('PrintCustTransPortrait.php', 1, ''),
651('PrintSalesOrder_generic.php', 2, ''),
652('PurchData.php', 4, 'Entry of supplier purchasing data, the suppliers part reference and the suppliers currency cost of the item'),
653('RecurringSalesOrders.php', 1, ''),
654('ReorderLevel.php', 2, 'Allows reorder levels of inventory to be updated'),
655('ReorderLevelLocation.php', 2, ''),
656('ReportBug.php', 15, ''),
657('ReportletContainer.php', 1, ''),
658('ReverseGRN.php', 11, 'Reverses the entry of goods received - creating stock movements back out and necessary general ledger journals to effect the reversal'),
659('SalesAnalReptCols.php', 2, 'Entry of the definition of a sales analysis report''s columns.'),
660('SalesAnalRepts.php', 2, 'Entry of the definition of a sales analysis report headers'),
661('SalesAnalysis_UserDefined.php', 2, 'Creates a pdf of a selected user defined sales analysis report'),
662('SalesCategories.php', 11, ''),
663('SalesGLPostings.php', 10, 'Defines the general ledger accounts used to post sales to based on product categories and sales areas'),
664('SalesGraph.php', 6, ''),
665('SalesInquiry.php', 2, ''),
666('SalesPeople.php', 3, 'Defines the sales people of the business'),
667('SalesTypes.php', 15, 'Defines the sales types - prices are held against sales types they can be considered price lists. Sales analysis records are held by sales type too.'),
668('SelectAsset.php', 2, 'Allows a fixed asset to be selected for modification or viewing'),
669('SelectCompletedOrder.php', 1, 'Allows the selection of completed sales orders for inquiries - choices to select by item code or customer'),
670('SelectContract.php', 6, 'Allows a contract costing to be selected for modification or viewing'),
671('SelectCreditItems.php', 3, 'Entry of credit notes from scratch, selecting the items in either quick entry mode or searching for them manually'),
672('SelectCustomer.php', 2, 'Selection of customer - from where all customer related maintenance, transactions and inquiries start'),
673('SelectGLAccount.php', 8, 'Selection of general ledger account from where all general ledger account maintenance, or inquiries are initiated'),
674('SelectOrderItems.php', 1, 'Entry of sales order items with both quick entry and part search functions'),
675('SelectProduct.php', 2, 'Selection of items. All item maintenance, transactions and inquiries start with this script'),
676('SelectRecurringSalesOrder.php', 2, ''),
677('SelectSalesOrder.php', 2, 'Selects a sales order irrespective of completed or not for inquiries'),
678('SelectSupplier.php', 2, 'Selects a supplier. A supplier is required to be selected before any AP transactions and before any maintenance or inquiry of the supplier'),
679('SelectWorkOrder.php', 2, ''),
680('ShipmentCosting.php', 11, 'Shows the costing of a shipment with all the items invoice values and any shipment costs apportioned. Updating the shipment has an option to update standard costs of all items on the shipment and create any general ledger variance journals'),
681('Shipments.php', 11, 'Entry of shipments from outstanding purchase orders for a selected supplier - changes in the delivery date will cascade into the different purchase orders on the shipment'),
682('Shippers.php', 15, 'Defines the shipping methods available. Each customer branch has a default shipping method associated with it which must match a record from this table'),
683('ShiptsList.php', 2, 'Shows a list of all the open shipments for a selected supplier. Linked from POItems.php'),
684('Shipt_Select.php', 11, 'Selection of a shipment for displaying and modification or updating'),
685('SMTPServer.php', 15, ''),
686('SpecialOrder.php', 4, 'Allows for a sales order to be created and an indent order to be created on a supplier for a one off item that may never be purchased again. A dummy part is created based on the description and cost details given.'),
687('StockAdjustments.php', 11, 'Entry of quantity corrections to stocks in a selected location.'),
688('StockAdjustmentsControlled.php', 11, 'Entry of batch references or serial numbers on controlled stock items being adjusted'),
689('StockCategories.php', 11, 'Defines the stock categories. All items must refer to one of these categories. The category record also allows the specification of the general ledger codes where stock items are to be posted - the balance sheet account and the profit and loss effect of any adjustments and the profit and loss effect of any price variances'),
690('StockCheck.php', 2, 'Allows creation of a stock check file - copying the current quantites in stock for later comparison to the entered counts. Also produces a pdf for the count sheets.'),
691('StockCostUpdate.php', 9, 'Allows update of the standard cost of items producing general ledger journals if the company preferences stock GL interface is active'),
692('StockCounts.php', 2, 'Allows entry of stock counts'),
693('StockDispatch.php', 2, ''),
694('StockLocMovements.php', 2, 'Inquiry shows the Movements of all stock items for a specified location'),
695('StockLocStatus.php', 2, 'Shows the stock on hand together with outstanding sales orders and outstanding purchase orders by stock location for all items in the selected stock category'),
696('StockLocTransfer.php', 11, 'Entry of a bulk stock location transfer for many parts from one location to another.'),
697('StockLocTransferReceive.php', 11, 'Effects the transfer and creates the stock movements for a bulk stock location transfer initiated from StockLocTransfer.php'),
698('StockMovements.php', 2, 'Shows a list of all the stock movements for a selected item and stock location including the price at which they were sold in local currency and the price at which they were purchased for in local currency'),
699('StockQties_csv.php', 5, 'Makes a comma separated values (CSV)file of the stock item codes and quantities'),
700('StockQuantityByDate.php', 2, 'Shows the stock on hand for each item at a selected location and stock category as at a specified date'),
701('StockReorderLevel.php', 4, 'Entry and review of the re-order level of items by stocking location'),
702('Stocks.php', 11, 'Defines an item - maintenance and addition of new parts'),
703('StockSerialItemResearch.php', 3, ''),
704('StockSerialItems.php', 2, 'Shows a list of the serial numbers or the batch references and quantities of controlled items. This inquiry is linked from the stock status inquiry'),
705('StockStatus.php', 2, 'Shows the stock on hand together with outstanding sales orders and outstanding purchase orders by stock location for a selected part. Has a link to show the serial numbers in stock at the location selected if the item is controlled'),
706('StockTransferControlled.php', 11, 'Entry of serial numbers/batch references for controlled items being received on a stock transfer. The script is used by both bulk transfers and point to point transfers'),
707('StockTransfers.php', 11, 'Entry of point to point stock location transfers of a single part'),
708('StockUsage.php', 2, 'Inquiry showing the quantity of stock used by period calculated from the sum of the stock movements over that period - by item and stock location. Also available over all locations'),
709('StockUsageGraph.php', 2, ''),
710('SuppContractChgs.php', 5, ''),
711('SuppCreditGRNs.php', 5, 'Entry of a supplier credit notes (debit notes) against existing GRN which have already been matched in full or in part'),
712('SuppFixedAssetChgs.php', 5, ''),
713('SuppInvGRNs.php', 5, 'Entry of supplier invoices against goods received'),
714('SupplierAllocations.php', 5, 'Entry of allocations of supplier payments and credit notes to invoices'),
715('SupplierBalsAtPeriodEnd.php', 2, ''),
716('SupplierContacts.php', 5, 'Entry of supplier contacts and contact details including email addresses'),
717('SupplierCredit.php', 5, 'Entry of supplier credit notes (debit notes)'),
718('SupplierInquiry.php', 2, 'Inquiry showing invoices, credit notes and payments made to suppliers together with the amounts outstanding'),
719('SupplierInvoice.php', 5, 'Entry of supplier invoices'),
720('Suppliers.php', 5, 'Entry of new suppliers and maintenance of existing suppliers'),
721('SupplierTenders.php', 9, ''),
722('SupplierTransInquiry.php', 2, ''),
723('SupplierTypes.php', 4, ''),
724('SuppLoginSetup.php', 15, ''),
725('SuppPaymentRun.php', 5, 'Automatic creation of payment records based on calculated amounts due from AP invoices entered'),
726('SuppPriceList.php', 2, ''),
727('SuppShiptChgs.php', 5, 'Entry of supplier invoices against shipments as charges against a shipment'),
728('SuppTransGLAnalysis.php', 5, 'Entry of supplier invoices against general ledger codes'),
729('SystemCheck.php', 10, ''),
730('SystemParameters.php', 15, ''),
731('Tax.php', 2, 'Creates a report of the ad-valoerm tax - GST/VAT - for the period selected from accounts payable and accounts receivable data'),
732('TaxAuthorities.php', 15, 'Entry of tax authorities - the state intitutions that charge tax'),
733('TaxAuthorityRates.php', 11, 'Entry of the rates of tax applicable to the tax authority depending on the item tax level'),
734('TaxCategories.php', 15, 'Allows for categories of items to be defined that might have different tax rates applied to them'),
735('TaxGroups.php', 15, 'Allows for taxes to be grouped together where multiple taxes might apply on sale or purchase of items'),
736('TaxProvinces.php', 15, 'Allows for inventory locations to be defined so that tax applicable from sales in different provinces can be dealt with'),
737('TopItems.php', 2, 'Shows the top selling items'),
738('UnitsOfMeasure.php', 15, 'Allows for units of measure to be defined'),
739('UpgradeDatabase.php', 15, 'Allows for the database to be automatically upgraded based on currently recorded DBUpgradeNumber config option'),
740('UserSettings.php', 1, 'Allows the user to change system wide defaults for the theme - appearance, the number of records to show in searches and the language to display messages in'),
741('WhereUsedInquiry.php', 2, 'Inquiry showing where an item is used ie all the parents where the item is a component of'),
742('WorkCentres.php', 9, 'Defines the various centres of work within a manufacturing company. Also the overhead and labour rates applicable to the work centre and its standard capacity'),
743('WorkOrderCosting.php', 11, ''),
744('WorkOrderEntry.php', 10, 'Entry of new work orders'),
745('WorkOrderIssue.php', 11, 'Issue of materials to a work order'),
746('WorkOrderReceive.php', 11, 'Allows for receiving of works orders'),
747('WorkOrderStatus.php', 11, 'Shows the status of works orders'),
748('WOSerialNos.php', 10, ''),
749('WWW_Access.php', 15, ''),
750('WWW_Users.php', 15, 'Entry of users and security settings of users'),
751('Z_BottomUpCosts.php', 15, ''),
752('Z_ChangeBranchCode.php', 15, 'Utility to change the branch code of a customer that cascades the change through all the necessary tables'),
753('Z_ChangeCustomerCode.php', 15, 'Utility to change a customer code that cascades the change through all the necessary tables'),
754('Z_ChangeStockCategory.php', 15, ''),
755('Z_ChangeStockCode.php', 15, 'Utility to change an item code that cascades the change through all the necessary tables'),
756('Z_CheckAllocationsFrom.php', 15, ''),
757('Z_CheckAllocs.php', 2, ''),
758('Z_CheckDebtorsControl.php', 15, 'Inquiry that shows the total local currency (functional currency) balance of all customer accounts to reconcile with the general ledger debtors account'),
759('Z_CheckGLTransBalance.php', 15, 'Checks all GL transactions balance and reports problem ones'),
760('Z_CopyBOM.php', 9, 'Allows a bill of material to be copied between items'),
761('Z_CreateChartDetails.php', 9, 'Utility page to create chart detail records for all general ledger accounts and periods created - needs expert assistance in use'),
762('Z_CreateCompany.php', 15, 'Utility to insert company number 1 if not already there - actually only company 1 is used - the system is not multi-company'),
763('Z_CreateCompanyTemplateFile.php', 15, ''),
764('Z_CurrencyDebtorsBalances.php', 15, 'Inquiry that shows the total foreign currency together with the total local currency (functional currency) balances of all customer accounts to reconcile with the general ledger debtors account'),
765('Z_CurrencySuppliersBalances.php', 15, 'Inquiry that shows the total foreign currency amounts and also the local currency (functional currency) balances of all supplier accounts to reconcile with the general ledger creditors account'),
766('Z_DataExport.php', 15, ''),
767('Z_DeleteCreditNote.php', 15, 'Utility to reverse a customer credit note - a desperate measure that should not be used except in extreme circumstances'),
768('Z_DeleteInvoice.php', 15, 'Utility to reverse a customer invoice - a desperate measure that should not be used except in extreme circumstances'),
769('Z_DeleteSalesTransActions.php', 15, 'Utility to delete all sales transactions, sales analysis the lot! Extreme care required!!!'),
770('Z_DescribeTable.php', 11, ''),
771('Z_ImportChartOfAccounts.php', 11, ''),
772('Z_ImportFixedAssets.php', 15, 'Allow fixed assets to be imported from a csv'),
773('Z_ImportGLAccountGroups.php', 11, ''),
774('Z_ImportGLAccountSections.php', 11, ''),
775('Z_ImportPartCodes.php', 11, 'Allows inventory items to be imported from a csv'),
776('Z_ImportStocks.php', 15, ''),
777('Z_index.php', 15, 'Utility menu page'),
778('Z_MakeNewCompany.php', 15, ''),
779('Z_MakeStockLocns.php', 15, 'Utility to make LocStock records for all items and locations if not already set up.'),
780('Z_poAddLanguage.php', 15, 'Allows a new language po file to be created'),
781('Z_poAdmin.php', 15, 'Allows for a gettext language po file to be administered'),
782('Z_poEditLangHeader.php', 15, ''),
783('Z_poEditLangModule.php', 15, ''),
784('Z_poEditLangRemaining.php', 15, ''),
785('Z_poRebuildDefault.php', 15, ''),
786('Z_PriceChanges.php', 15, 'Utility to make bulk pricing alterations to selected sales type price lists or selected customer prices only'),
787('Z_ReApplyCostToSA.php', 15, 'Utility to allow the sales analysis table to be updated with the latest cost information - the sales analysis takes the cost at the time the sale was made to reconcile with the enteries made in the gl.'),
788('Z_RePostGLFromPeriod.php', 15, 'Utility to repost all general ledger transaction commencing from a specified period. This can take some time in busy environments. Normally GL transactions are posted automatically each time a trial balance or profit and loss account is run'),
789('Z_ReverseSuppPaymentRun.php', 15, 'Utility to reverse an entire Supplier payment run'),
790('Z_SalesIntegrityCheck.php', 15, ''),
791('Z_UpdateChartDetailsBFwd.php', 15, 'Utility to recalculate the ChartDetails table B/Fwd balances - extreme care!!'),
792('Z_Upgrade3.10.php', 15, ''),
793('Z_Upgrade_3.01-3.02.php', 15, ''),
794('Z_Upgrade_3.04-3.05.php', 15, ''),
795('Z_Upgrade_3.05-3.06.php', 15, ''),
796('Z_Upgrade_3.07-3.08.php', 15, ''),
797('Z_Upgrade_3.08-3.09.php', 15, ''),
798('Z_Upgrade_3.09-3.10.php', 15, ''),
799('Z_Upgrade_3.10-3.11.php', 15, ''),
800('Z_Upgrade_3.11-4.00.php', 15, ''),
801('Z_UploadForm.php', 15, 'Utility to upload a file to a remote server'),
802('Z_UploadResult.php', 15, 'Utility to upload a file to a remote server');
803
804INSERT INTO config (confname, confvalue) VALUES ('VersionNumber', '3.12.0');
805UPDATE config SET confvalue='3.12.1' WHERE confname='VersionNumber';
806
807INSERT INTO `scripts` (`script`, `pagesecurity`, `description`) VALUES
808('FormMaker.php', 1, 'Allows running user defined Forms'),
809('ReportMaker.php', 1, 'Produces reports from the report writer templates created'),
810('ReportCreator.php', 13, 'Report Writer and Form Creator script that creates templates for user defined reports and forms');
811UPDATE config SET confvalue='3.12.2' WHERE confname='VersionNumber';
812ALTER TABLE `purchorderdetails` CHANGE `nw` `netweight` VARCHAR( 50 )  DEFAULT '';
813ALTER TABLE `purchorderdetails` CHANGE `gw` `kgs` VARCHAR( 50 )  DEFAULT '';
814ALTER TABLE `purchorderdetails` ADD `conversionfactor` DOUBLE NOT NULL DEFAULT '1';
815UPDATE config SET confvalue='3.12.3' WHERE confname='VersionNumber';
816ALTER TABLE `purchorderdetails` CHANGE `uom` `suppliersunit` VARCHAR( 50 );
817UPDATE config SET confvalue='3.12.31' WHERE confname='VersionNumber';
818INSERT INTO config (`confname`, `confvalue`) VALUES ('AutoAuthorisePO', '1');
819UPDATE config SET confvalue='4.03' WHERE confname='VersionNumber';
820ALTER TABLE `salesorders` ADD `poplaced` TINYINT NOT NULL DEFAULT '0',
821ADD INDEX ( `poplaced` );
822UPDATE config SET confvalue='4.03.1' WHERE confname='VersionNumber';
823
824CREATE TABLE IF NOT EXISTS `fixedassetlocations` (
825  `locationid` char(6) NOT NULL DEFAULT '',
826  `locationdescription` char(20) NOT NULL DEFAULT '',
827  `parentlocationid` char(6) DEFAULT '',
828  PRIMARY KEY (`locationid`)
829) ENGINE=InnoDB DEFAULT CHARSET=utf8;
830
831
832INSERT INTO `fixedassetlocations` (`locationid`, `locationdescription`, `parentlocationid`) VALUES
833('HEADOF', 'Head Office', '');
834UPDATE config SET confvalue='4.03.2' WHERE confname='VersionNumber';
835ALTER TABLE locations ADD cashsalebranch varchar(10) DEFAULT '';
836ALTER TABLE `locations` CHANGE `cashsalecustomer` `cashsalecustomer` VARCHAR( 10 ) DEFAULT '';
837UPDATE config SET confvalue='4.03.3' WHERE confname='VersionNumber';
838INSERT INTO `scripts` (`script`, `pagesecurity`, `description`) VALUES ('Z_ChangeSupplierCode.php', '15', 'Script to change a supplier code accross all tables necessary');
839UPDATE config SET confvalue='4.03.5' WHERE confname='VersionNumber';
840INSERT INTO `scripts` (`script` ,`pagesecurity` ,`description`) VALUES ( 'ReprintGRN.php', '11', 'Allows selection of a goods received batch for reprinting the goods received note given a purchase order number');
841UPDATE config SET confvalue='4.03.6' WHERE confname='VersionNumber';
842ALTER TABLE `paymentmethods` ADD `usepreprintedstationery` TINYINT NOT NULL DEFAULT '0';
843DELETE FROM scripts WHERE script='PDFStockTransListing.php';
844INSERT INTO scripts (`script` ,`pagesecurity` ,`description`) VALUES('PDFPeriodStockTransListing.php','3','Allows stock transactions of a specific transaction type to be listed over a single day or period range');
845UPDATE config SET confvalue='4.03.7' WHERE confname='VersionNumber';
846ALTER TABLE `purchorderdetails`
847  DROP `itemno`,
848  DROP `subtotal_amount`,
849  DROP `package`,
850  DROP `pcunit`,
851  DROP `kgs`,
852  DROP `cuft`,
853  DROP `total_quantity`,
854  DROP `netweight`,
855  DROP `total_amount`;
856  UPDATE purchdata INNER JOIN unitsofmeasure  ON purchdata.suppliersuom=unitsofmeasure.unitid SET suppliersuom = unitsofmeasure.unitname;
857UPDATE config SET confvalue='4.03.8' WHERE confname='VersionNumber';
858SET FOREIGN_KEY_CHECKS=1;