DROP DATABASE balesmart; CREATE DATABASE balesmart; USE balesmart; CREATE TABLE mstcompany ( comcode tinyint NOT NULL , comname varchar (40) NOT NULL , comsname varchar (10) NOT NULL , comadd1 varchar (40) NULL , comadd2 varchar (40) NULL , comadd3 varchar (40) NULL , compincode varchar (8) NULL , comphone varchar (40) NULL , comfax varchar (15) NULL , comemail varchar (40) NULL , comurl varchar (40) NULL , comspindle int NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key(comcode) ) type = InnoDB; CREATE TABLE mstlocation ( loccomcode tinyint NOT NULL , loccode tinyint NOT NULL , locname varchar (40) NOT NULL , locsname varchar (10) NOT NULL , locadd1 varchar (40) NULL , locadd2 varchar (40) NULL , locadd3 varchar (40) NULL , locpincode varchar (8) NULL , locphone varchar (40) NULL , locfax varchar (15) NULL , locemail varchar (40) NULL , locurl varchar (40) NULL , locspindle int NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (loccomcode, loccode), index mstlocation_idx_1 (loccomcode), foreign key (loccomcode) references mstcompany (comcode) ) type = InnoDB; CREATE TABLE mstcountry ( concode char (6) NOT NULL , conname char (40) NOT NULL , consname char (10) NOT NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key(concode) ) type = InnoDB; CREATE TABLE mstcrop ( crpcode char (5) NOT NULL , crpname varchar (40) NOT NULL , crpsname varchar (10) NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key(crpcode) ) type = InnoDB; CREATE TABLE mststate ( stacode char (4) NOT NULL , staname char (40) NOT NULL , stasname char (10) NOT NULL , staconcode char (6) NOT NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (stacode) , index mststate_idx_1 (staconcode) , foreign key (staconcode) references mstcountry (concode) ) type = InnoDB; CREATE TABLE mststation ( stncode char (4) NOT NULL , stnname char (40) NOT NULL , stnsname char (10) NOT NULL , stnstatecd char (4) NULL , stnzonecd char (4) NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (stncode) ) type = InnoDB; CREATE TABLE mstvariety ( varcode char (5) NOT NULL , varname varchar (40) NOT NULL , varsname varchar (10) NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (varcode) ) type = InnoDB; CREATE TABLE mstvendagent ( agvencode char (10) NOT NULL , agvenslnum varchar (40) NOT NULL , agentcode varchar (40) NOT NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (agvencode,agentcode) ) type = InnoDB; CREATE TABLE mstzone ( zoncode char (4) NOT NULL , zonname char (40) NOT NULL , zonsname char (10) NOT NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (zoncode) ) type = InnoDB; CREATE TABLE mstuom ( uomcode char (5) NOT NULL , uomdesc varchar (40) NOT NULL , uomsdesc varchar (10) NULL , uompactag char (1) NULL , uomunits decimal(8, 3) NULL , uomconvcode char (5) NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (uomcode) ) type = InnoDB; CREATE TABLE mstcurrency ( crcode char (3) NOT NULL , crdesc varchar (40) NULL , crshnam varchar (10) NULL , crlowden varchar (10) NULL , crexrate decimal(11, 2) NULL , crltdate datetime NULL , crconvcur char (3) NOT NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key(crcode) ) type = InnoDB; CREATE TABLE mstparameter ( parcode char (5) NOT NULL , parname varchar (40) NOT NULL , parsname varchar (10) NULL , paruom char (5) NOT NULL , parseqno numeric(5, 0) NULL , partype char (1) NOT NULL , parformula varchar (250) NULL , parrefname varchar (40) NOT NULL , parrefsname varchar (10) NOT NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (parcode) ) type = InnoDB; CREATE TABLE mstmix ( mixcomcode tinyint NOT NULL , mixloccode tinyint NOT NULL , mixcode char (4) NOT NULL , mixname varchar (40) NULL , mixsname char (10) NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key(mixcomcode,mixloccode,mixcode) ) type = InnoDB; CREATE TABLE mstsubmix ( smixcomcode tinyint NOT NULL , smixloccode tinyint NOT NULL , smixmixcode char (4) NOT NULL , smixcode char (4) NOT NULL , smixname varchar (40) NULL , smixsname char (10) NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (smixcomcode,smixloccode,smixmixcode,smixcode) , index mstsubmix_idx_1 (smixcomcode,smixloccode,smixmixcode) , foreign key (smixcomcode,smixloccode,smixmixcode) references mstmix(mixcomcode,mixloccode,mixcode) ) type = InnoDB; CREATE TABLE mstmixhdr ( mixhcomcode tinyint NOT NULL , mixhloccode tinyint NOT NULL , mixhcode char (4) NOT NULL , mixhscode char (4) NOT NULL , mixhtype char (1) NOT NULL , mixhgroup numeric(2, 0) NULL , mixhndmean numeric(8,5) , mixhndstddev numeric(8,5) , luid decimal(5,0) NULL, ludt datetime NULL, primary key (mixhcomcode,mixhloccode,mixhcode,mixhscode) , index mstmixhdr_idx_1 (mixhcomcode,mixhloccode,mixhcode,mixhscode) , foreign key (mixhcomcode,mixhloccode,mixhcode,mixhscode) references mstsubmix (smixcomcode,smixloccode,smixmixcode,smixcode) ) type = InnoDB; CREATE TABLE mstmixdtls ( mixdcomcode tinyint NOT NULL , mixdloccode tinyint NOT NULL , mixdcode char (4) NOT NULL , mixdscode char (4) NOT NULL , mixdparcode char (5) NULL , mixdpriority numeric(2, 0) NOT NULL , mixdissll decimal(10, 5) NOT NULL , mixdissul decimal(10, 5) NOT NULL , mixhcategory numeric(2, 0) NOT NULL , mixdretrieval char (5) NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (mixdcomcode,mixdloccode,mixdcode,mixdscode,mixdpriority) , unique key (mixdcomcode,mixdloccode,mixdcode,mixdscode,mixdparcode) , index mstmixdtls_idx_1 (mixdcomcode,mixdloccode,mixdcode,mixdscode) , foreign key (mixdcomcode,mixdloccode,mixdcode,mixdscode) references mstmixhdr (mixhcomcode,mixhloccode,mixhcode,mixhscode) ) type = InnoDB; CREATE TABLE mstgensettings ( gencomcode tinyint NULL , genloccode tinyint NULL , genfilepath char (100) NULL , genuom char (5) NULL , gencurrency char (3) NULL , genbalesperlot numeric(5, 0) NULL , genndavg numeric(8, 5) NULL , genndsd numeric(8, 5) NULL , gencompany tinyint NULL , genlocation tinyint NULL , luid decimal(5,0) NULL, ludt datetime NULL, index mstgensettings_idx_1 (genuom) , foreign key (genuom) references mstuom (uomcode), index mstgensettings_idx_2 (gencurrency) , foreign key (gencurrency) references mstcurrency (crcode) ) type = InnoDB; CREATE TABLE mstgodown ( gdncode char (5) NOT NULL , gdnname varchar (40) NOT NULL , gdnsname varchar (10) NULL , gdncapacity numeric(10, 0) NULL , gdnuom char (5) NOT NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (gdncode) , index mstgodown_idx_1 (gdnuom) , foreign key (gdnuom) references mstuom (uomcode) ) type = InnoDB; CREATE TABLE mstgrade ( grdcode char (5) NOT NULL , grdname varchar (40) NOT NULL , grdsname varchar (10) NOT NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key(grdcode) ) type = InnoDB; CREATE TABLE mstgraphset ( gracomcode tinyint NOT NULL , graloccode tinyint NOT NULL , grarptcode char (5) NOT NULL , gratype numeric(2, 0) NULL , grared numeric(3, 0) NULL , gragreen numeric(3, 0) NULL , grablue numeric(3, 0) NULL , graxmin numeric(7, 0) NULL , graxmax numeric(7, 0) NULL , graxmajor numeric(5, 0) NULL , graxminor numeric(4, 0) NULL , graymin numeric(7, 0) NULL , graymax numeric(7, 0) NULL , graymajor numeric(5, 0) NULL , grayminor numeric(4, 0) NULL , grascalex char (1) NULL , grascaley char (1) NULL , gramarker char (1) NULL , luid decimal(5,0) NULL, ludt datetime NULL ) type = InnoDB; CREATE TABLE mstlimithdr ( limhcomcode tinyint NOT NULL , limhloccode tinyint NOT NULL , limhcode char (5) NOT NULL , limhname varchar (40) NOT NULL , limhsname varchar (10) NOT NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key(limhcomcode,limhloccode,limhcode) ) type = InnoDB; CREATE TABLE mstlimitdtls ( limdcomcode tinyint NOT NULL , limdloccode tinyint NOT NULL , limdcode char (5) NOT NULL , limdparcode char (5) NOT NULL , limdrecll decimal(10, 5) NOT NULL , limdrecul decimal(10, 5) NOT NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key(limdcomcode,limdloccode,limdcode,limdparcode), index mstlimitdtls_idx_1 (limdcomcode,limdloccode,limdcode) , foreign key (limdcomcode,limdloccode,limdcode) references mstlimithdr (limhcomcode,limhloccode,limhcode), index mstlimitdtls_idx_2 (limdparcode) , foreign key (limdparcode) references mstparameter (parcode) ) type = InnoDB; CREATE TABLE mstallocation ( allcomcode tinyint NOT NULL , allloccode tinyint NOT NULL , allmixcode char (4) NOT NULL , allsmixcode char (4) NOT NULL , allretcode char (5) NOT NULL , allitemcode char (10) NOT NULL , allpercentage decimal(6, 2) NOT NULL , allrejpercent numeric(5, 2) NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key(allcomcode,allloccode,allmixcode,allsmixcode,allretcode,allitemcode) , index mstallocation_idx_1 (allcomcode,allloccode,allmixcode,allsmixcode) , foreign key (allcomcode,allloccode,allmixcode,allsmixcode) references mstsubmix (smixcomcode,smixloccode,smixmixcode,smixcode) ) type = InnoDB; CREATE TABLE mstmixmoving ( mixmcomcode tinyint NOT NULL , mixmloccode tinyint NOT NULL , mixmcode char (4) NOT NULL , mixmscode char (4) NOT NULL , mixmmovll decimal(10, 5) NOT NULL , mixmmovul decimal(10, 5) NOT NULL , mixmrange decimal(10, 5) NOT NULL , mixmdir char (1) NOT NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (mixmcomcode,mixmloccode,mixmcode,mixmscode) , index mstmixmoving_idx_1 (mixmcomcode,mixmloccode,mixmcode,mixmscode), foreign key (mixmcomcode,mixmloccode,mixmcode,mixmscode) references mstsubmix (smixcomcode,smixloccode,smixmixcode,smixcode) ) type = InnoDB; CREATE TABLE mstparamscale ( parsrptcode char (5) NOT NULL , parsparcode char (5) NOT NULL , parsxmin numeric(6, 2) NULL , parsxmax numeric(6, 2) NULL , parsxinterval numeric(5, 2) NULL , luid decimal(5,0) NULL, ludt datetime NULL ) type = InnoDB; CREATE TABLE mstparty ( ptycode char (10) NOT NULL , ptyname1 varchar (40) NOT NULL , ptyname2 varchar (40) NULL , ptyadd1 varchar (40) NULL , ptyadd2 varchar (40) NULL , ptyadd3 varchar (40) NULL , ptyadd4 varchar (40) NULL , ptypincode varchar (8) NULL , ptysname varchar (10) NULL , ptyphone varchar (40) NULL , ptyfax varchar (15) NULL , ptyemail varchar (40) NULL , ptyurl varchar (40) NULL , ptystncode varchar (4) NULL , ptyid varchar (2) NOT NULL , status smallint NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (ptycode) ) type = InnoDB; CREATE TABLE mstretrieval ( retcode char (5) NOT NULL , retname char (40) NOT NULL , retsname char (15) NOT NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (retcode) ) type = InnoDB; CREATE TABLE mstrptcntrl ( rptccode char (5) NOT NULL , rptcvar char (1) NULL , rptccrp char (1) NULL , rptccon char (1) NULL , rptcsta char (1) NULL , rptcstn char (1) NULL , rptczon char (1) NULL , rptcpty char (1) NULL , rptcgdn char (1) NULL , rptcopt char (1) NULL , rptmean char (1) NULL , rptrange char (1) NULL , rptmin char (1) NULL , rptmax char (1) NULL , rptsd char (1) NULL , rptcv char (1) NULL , rptcmix char (1) NULL , rptcsubmix char (1) NULL , luid decimal(5,0) NULL, ludt datetime NULL ) type = InnoDB; CREATE TABLE rptgraphdata ( rgdx varchar (15) NULL , rgdy varchar (10) NULL , luid decimal(5,0) NULL, ludt datetime NULL ) type = InnoDB; CREATE TABLE tmpparamlbtr ( parlparseqno numeric(6, 0) NOT NULL , parlavg decimal(10, 5) NULL , parlrng decimal(10, 5) NULL , parlsd decimal(10, 5) NULL , parlcv decimal(10, 5) NULL , parlmin decimal(10, 5) NULL , parlmax decimal(10, 5) NULL , parlparcode char (5) NULL , parllot numeric(6, 0) NULL , parlissnum char(10) NULL , luid decimal(5,0) NULL, ludt datetime NULL ) type = InnoDB; CREATE TABLE trnrechdr ( rechrecnum char (10) NOT NULL , rechrecdate datetime NOT NULL , rechcomcode tinyint NOT NULL , rechloccode tinyint NOT NULL , rechperiodno numeric(6, 0) NOT NULL , rechcrpcode char (5) NULL , rechdcno varchar (20) NULL , rechdcdate datetime NULL , rechponum char (10) NULL , rechpodate datetime NULL , rechptycode char (10) NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (rechcomcode,rechloccode,rechperiodno,rechrecnum) , index trnechdr_idx_1 (rechcrpcode) , foreign key (rechcrpcode) references mstcrop (crpcode) , index trnechdr_idx_2 (rechptycode) , foreign key (rechptycode) references mstparty (ptycode) ) type = InnoDB; CREATE TABLE trnrecdtls ( recdrecnum char (10) NOT NULL , recdcomcode tinyint NOT NULL , recdloccode tinyint NOT NULL , recdperiodno numeric(6, 0) NOT NULL , recdsno numeric(3, 0) NOT NULL , recdvarcode char (5) NOT NULL , recdstncode char (4) NOT NULL , recdptylotno varchar (50) NULL , recdrate numeric(10, 4) NULL , recdcrcode char (3) NULL , recdrateuom char (5) NULL , recdqty numeric(8, 2) NOT NULL , recdqtyuom char (5) NOT NULL , recdgdncode char (5) NULL , recdmlotnum numeric(6, 0) NULL , recdavgwt numeric(8, 2) NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (recdcomcode,recdloccode,recdperiodno,recdrecnum,recdsno) , index trnrecdtls_idx_1 (recdcomcode,recdloccode,recdperiodno,recdrecnum) , foreign key (recdcomcode,recdloccode,recdperiodno,recdrecnum) references trnrechdr (rechcomcode,rechloccode,rechperiodno,rechrecnum) , index trnrecdtls_idx_2 (recdvarcode) , foreign key (recdvarcode) references mstvariety (varcode) , index trnrecdtls_idx_3 (recdstncode) , foreign key (recdstncode) references mststation (stncode) , index trnrecdtls_idx_6 (recdqtyuom) , foreign key (recdqtyuom) references mstuom (uomcode) ) type = InnoDB; CREATE TABLE trnrecbales ( recbcomcode tinyint NOT NULL , recbloccode tinyint NOT NULL , recbperiodno numeric(6, 0) NOT NULL , recbmlotnum numeric(6, 0) NOT NULL , recbbalenum numeric(8, 0) NOT NULL , recbgdncode char (5) NOT NULL, recbbalewt decimal(8, 2) NOT NULL, luid decimal(5,0) NULL, ludt datetime NULL, primary key (recbcomcode,recbloccode,recbperiodno,recbmlotnum,recbbalenum), index trnrecbales_idx_1 (recbgdncode), foreign key (recbgdncode) references mstgodown (gdncode) ) type = InnoDB; CREATE TABLE trnbthdr ( bthbtnum char (50) NOT NULL , bthcomcode tinyint NOT NULL , bthloccode tinyint NOT NULL , bthperiodno numeric(6, 0) NOT NULL , bthbtdate datetime NOT NULL , bthptycode char (10) NOT NULL , bthptysamno char (10) NULL , bthvarcode char (5) NOT NULL , bthstncode char (4) NOT NULL , bthlimcode char (5) NULL , bthlimstatus char (3) NOT NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (bthcomcode,bthloccode,bthperiodno,bthbtnum) , index trnbthdr_idx_1 (bthvarcode) , foreign key (bthvarcode) references mstvariety (varcode) , index trnbthdr_idx_2 (bthstncode) , foreign key (bthstncode) references mststation (stncode) , index trnbthdr_idx_3 (bthptycode) , foreign key (bthptycode) references mstparty (ptycode) ) type = InnoDB; CREATE TABLE trnbtdtls ( btdbtnum char (50) NOT NULL , btdcomcode tinyint NOT NULL , btdloccode tinyint NOT NULL , btdperiodno numeric(6, 0) NOT NULL , btdparcode char (5) NOT NULL , btdresult decimal(10, 5) NOT NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (btdcomcode,btdloccode,btdperiodno,btdbtnum,btdparcode) , index trnbtdtls_idx_1 (btdcomcode,btdloccode,btdperiodno,btdbtnum) , foreign key (btdcomcode,btdloccode,btdperiodno,btdbtnum) references trnbthdr (bthcomcode,bthloccode,bthperiodno,bthbtnum), index trnbtdtls_idx_2 (btdparcode), foreign key (btdparcode) references mstparameter (parcode) ) type = InnoDB; CREATE TABLE trnissallocation ( issaissnum char (10) NOT NULL , issacomcode tinyint NOT NULL , issaloccode tinyint NOT NULL , issaperiodno numeric(6, 0) NOT NULL , issaissdate datetime NOT NULL , issaretcode char (5) NOT NULL , issaitemcode char (10) NOT NULL , issapercent numeric(5, 2) NULL , issamaxlimit numeric(5, 2) NULL , issamulissnum char (10) NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (issacomcode,issaloccode,issaperiodno,issaissnum,issaretcode,issaitemcode) ) type = InnoDB; CREATE TABLE trnisshdr ( isshissnum char (10) NOT NULL , isshcomcode tinyint NOT NULL , isshloccode tinyint NOT NULL , isshperiodno numeric(6, 0) NOT NULL , isshissdate datetime NOT NULL , isshmixcode char (4) NOT NULL , isshsmix char (4) NOT NULL , isshqty numeric(8, 2) NOT NULL , isshuom char (5) NOT NULL , isshstatus char (1) NOT NULL , isshseltype tinyint NULL , isshisstype char (1) NULL , isshmulissnum char (10) NULL , isshfromdt datetime NULL , isshtodt datetime NULL , isshissues int NULL , isshrejpercent decimal(5,2) NOT NULL default '0.00', luid decimal(5,0) NULL, ludt datetime NULL, primary key (isshcomcode,isshloccode,isshperiodno,isshissnum), index trnisshdr_idx_1 (isshcomcode,isshloccode,isshmixcode,isshsmix), foreign key (isshcomcode,isshloccode,isshmixcode,isshsmix) references mstsubmix (smixcomcode,smixloccode,smixmixcode,smixcode) , index trnisshdr_idx_2 (isshuom), foreign key (isshuom) references mstuom (uomcode) ) type = InnoDB; CREATE TABLE trnissdtls ( issdissnum char (10) NOT NULL , issdcomcode tinyint NOT NULL , issdloccode tinyint NOT NULL , issdperiodno numeric(6, 0) NOT NULL , issdissdate datetime NOT NULL , issdmlotnum numeric(6, 0) NOT NULL , issdbalenum numeric(8, 0) NOT NULL , issdbalewt decimal(8, 2) NOT NULL , issduom char (5) NOT NULL , issdmulissnum char (10) NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (issdcomcode,issdloccode,issdperiodno,issdissnum,issdmlotnum,issdbalenum) , index trnissdtls_idx_1 (issdcomcode,issdloccode,issdperiodno,issdissnum) , foreign key (issdcomcode,issdloccode,issdperiodno,issdissnum) references trnisshdr (isshcomcode,isshloccode,isshperiodno,isshissnum) , index trnissdtls_idx_2 (issdcomcode,issdloccode,issdperiodno,issdmlotnum,issdbalenum) , foreign key (issdcomcode,issdloccode,issdperiodno,issdmlotnum,issdbalenum) references trnrecbales (recbcomcode,recbloccode,recbperiodno,recbmlotnum,recbbalenum) ) type = InnoDB; CREATE TABLE trnissbalelaydown( issbcomcode tinyint NOT NULL , issbloccode tinyint NOT NULL , issbperiodno numeric(6,0) NOT NULL , issbissnum char (10) NOT NULL , issbnoofrows numeric(2,0) NOT NULL , issbnoofcols numeric(2,0) NOT NULL , issbmlotnum numeric(6,0) NOT NULL , issbbalenum numeric(8,0) NOT NULL , issbposition numeric(3,0) NOT NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (issbcomcode,issbloccode,issbperiodno,issbissnum,issbmlotnum,issbbalenum) , index trnissbalelaydown_idx_1 (issbcomcode,issbloccode,issbperiodno,issbissnum,issbmlotnum,issbbalenum) , foreign key (issbcomcode,issbloccode,issbperiodno,issbissnum,issbmlotnum,issbbalenum) references trnissdtls(issdcomcode,issdloccode,issdperiodno,issdissnum,issdmlotnum,issdbalenum) ) type = InnoDB; CREATE TABLE trnissspecification ( isssissnum char (10) NOT NULL , issscomcode tinyint NOT NULL , isssloccode tinyint NOT NULL , isssperiodno numeric(6, 0) NOT NULL , isssissdate datetime NOT NULL , isssparcode char (5) NULL , isssll decimal(10, 5) NULL , isssul decimal(10, 5) NULL , isssuom char (5) NOT NULL , isssmulissnum char (10) NULL , issscategory numeric(2, 0) NULL , isssretrieval char(5) NULL, isssbalesperlot numeric(5, 0) NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (issscomcode,isssloccode,isssperiodno,isssissnum,isssuom) ) type = InnoDB; CREATE TABLE trnlbthdr ( lbthmlotnum numeric(6, 0) NOT NULL , lbthbalenum numeric(8, 0) NOT NULL , lbthcomcode tinyint NOT NULL , lbthloccode tinyint NOT NULL , lbthperiodno numeric(6, 0) NOT NULL , lbthlbtdate datetime NOT NULL , lbthtype char (1) NOT NULL , lbthlimcode char (5) NOT NULL , lbthlimstatus char (3) NOT NULL , lbthmixcode char (4) NOT NULL , lbthsmixcode char (4) NOT NULL , lbthmixstatus char (3) NOT NULL , lbthlbtgrade char (1) NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (lbthcomcode,lbthloccode,lbthperiodno,lbthmlotnum,lbthbalenum) , index trnlbthdr_idx_1 (lbthcomcode,lbthloccode,lbthperiodno,lbthmlotnum,lbthbalenum) , foreign key (lbthcomcode,lbthloccode,lbthperiodno,lbthmlotnum,lbthbalenum) references trnrecbales (recbcomcode,recbloccode,recbperiodno,recbmlotnum,recbbalenum), index trnlbthdr_idx_2 (lbthcomcode,lbthloccode,lbthmixcode,lbthsmixcode), foreign key (lbthcomcode,lbthloccode,lbthmixcode,lbthsmixcode) references mstsubmix (smixcomcode,smixloccode,smixmixcode,smixcode) ) type = InnoDB; CREATE TABLE trnlbtdtls ( lbtdmlotnum numeric(6, 0) NOT NULL , lbtdbalenum numeric(8, 0) NOT NULL , lbtdcomcode tinyint NOT NULL , lbtdloccode tinyint NOT NULL , lbtdperiodno numeric(6, 0) NOT NULL , lbtdparcode char (5) NOT NULL , lbtdresult decimal(10, 5) NOT NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (lbtdcomcode,lbtdloccode,lbtdperiodno,lbtdmlotnum,lbtdbalenum,lbtdparcode) , index trnlbtdtls_idx_1 (lbtdcomcode,lbtdloccode,lbtdperiodno,lbtdmlotnum,lbtdbalenum) , foreign key (lbtdcomcode,lbtdloccode,lbtdperiodno,lbtdmlotnum,lbtdbalenum) references trnlbthdr (lbthcomcode,lbthloccode,lbthperiodno,lbthmlotnum,lbthbalenum) , index trnlbtdtls_idx_2 (lbtdparcode) , foreign key (lbtdparcode) references mstparameter (parcode) ) type = InnoDB; CREATE TABLE trnlthdr ( lthmlotnum numeric(6, 0) NOT NULL , lthbalenum numeric(8, 0) NOT NULL , lthcomcode tinyint NOT NULL , lthloccode tinyint NOT NULL , lthperiodno numeric(6, 0) NOT NULL , lthltdate datetime NOT NULL , lthtype char (1) NOT NULL , lthlimcode char (5) NULL , lthlimstatus char (3) NULL , lthmixcode char (4) NULL , lthsmixcode char (4) NULL , lthmixstatus char (3) NULL , lthltgrade char (1) NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (lthcomcode,lthloccode,lthperiodno,lthmlotnum,lthbalenum) , index trnlthdr_idx_1 (lthcomcode,lthloccode,lthperiodno,lthmlotnum,lthbalenum) , foreign key (lthcomcode,lthloccode,lthperiodno,lthmlotnum,lthbalenum) references trnrecbales (recbcomcode,recbloccode,recbperiodno,recbmlotnum,recbbalenum) ) type = InnoDB; CREATE TABLE trnltdtls ( ltdcomcode tinyint NOT NULL , ltdloccode tinyint NOT NULL , ltdperiodno numeric(6, 0) NOT NULL , ltdmlotnum numeric(6, 0) NOT NULL , ltdbalenum numeric(8, 0) NOT NULL , ltdparcode char (5) NOT NULL , ltdresult decimal(10, 5) NOT NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (ltdcomcode,ltdloccode,ltdperiodno,ltdmlotnum,ltdbalenum,ltdparcode) , index trnltdtls_idx_1 (ltdcomcode,ltdloccode,ltdperiodno,ltdmlotnum,ltdbalenum), foreign key (ltdcomcode,ltdloccode,ltdperiodno,ltdmlotnum,ltdbalenum) references trnlthdr (lthcomcode,lthloccode,lthperiodno,lthmlotnum,lthbalenum), index trnltdtls_idx_2 (ltdparcode), foreign key (ltdparcode) references mstparameter (parcode) ) type = InnoDB; CREATE TABLE trnmilllot ( mlotcomcode tinyint NOT NULL , mlotloccode tinyint NOT NULL , mlotperiodno numeric(6, 0) NOT NULL , mlotmlotnum numeric(6, 0) NOT NULL , mlotrecdt datetime NULL , mlotrateuom char (5) NULL , mlotrate numeric(10, 4) NULL , mlotqtyuom char (5) NULL , mlotqty numeric(8, 2) NOT NULL , mlotcrcode char (3) NOT NULL , mlotvarcode char (5) NOT NULL , mlotconcode char (6) NOT NULL , mlotstacode char (4) NOT NULL , mlotstncode char (4) NOT NULL , mlotptycode char (10) NOT NULL , mlotzone char (4) NULL , mlotcrop char(5) NULL, luid decimal(5,0) NULL, ludt datetime NULL, primary key (mlotcomcode,mlotloccode,mlotperiodno,mlotmlotnum) ) type = InnoDB; CREATE TABLE trnmovissue ( movicomcode tinyint NOT NULL , moviloccode tinyint NOT NULL , moviperiodno numeric(6, 0) NOT NULL , moviissnum char (10) NOT NULL , moviissdate datetime NOT NULL , movimovissdate datetime NOT NULL , movimlotnum numeric(6, 0) NOT NULL , movibalenum numeric(8, 0) NOT NULL , movibalewt decimal(8, 2) NULL , moviuom char (5) NULL , luid decimal(5,0) NULL, ludt datetime NULL, ) type = InnoDB; CREATE TABLE trnpohdr ( pohponum char (10) NOT NULL , pohpodate datetime NOT NULL , pohcomcode tinyint NOT NULL , pohloccode tinyint NOT NULL , pohperiodno numeric(6, 0) NOT NULL , pohptycode char (10) NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (pohcomcode,pohloccode,pohperiodno,pohponum) , index trnpohdr_idx_1 (pohptycode) , foreign key (pohptycode) references mstparty (ptycode) ) type = InnoDB; CREATE TABLE trnpodtls ( podponum char (10) NOT NULL , podcomcode tinyint NOT NULL , podloccode tinyint NOT NULL , podperiodno numeric(6, 0) NOT NULL , podsno numeric(3, 0) NOT NULL , podvarcode char (5) NOT NULL , podstncode char (4) NOT NULL , podptyrefno varchar (20) NULL , podrate numeric(10, 4) NULL , podcrcode char (3) NOT NULL , podrateuom char (5) NOT NULL , podqty numeric(8, 2) NULL , podqtyuom char (5) NOT NULL , luid decimal(5,0) NULL, ludt datetime NULL, primary key (podcomcode,podloccode,podperiodno,podponum,podsno) , index trnpodtls_idx_1 (podcomcode,podloccode,podperiodno,podponum) , foreign key (podcomcode,podloccode,podperiodno,podponum) references trnpohdr (pohcomcode,pohloccode,pohperiodno,pohponum) , index trnpodtls_idx_2 (podvarcode) , foreign key (podvarcode) references mstvariety (varcode) , index trnpodtls_idx_3 (podstncode) , foreign key (podstncode) references mststation (stncode) , index trnpodtls_idx_4 (podcrcode) , foreign key (podcrcode) references mstcurrency (crcode) , index trnpodtls_idx_5 (podrateuom) , foreign key (podrateuom) references mstuom (uomcode) , index trnpodtls_idx_6 (podqtyuom) , foreign key (podqtyuom) references mstuom (uomcode) ) type = InnoDB; CREATE TABLE trnstock ( stkcomcode tinyint NOT NULL , stkloccode tinyint NOT NULL , stkperiodno numeric(6, 0) NOT NULL , stkmlotnum numeric(6, 0) NOT NULL , stkbalenum numeric(8, 0) NOT NULL , stkrecdt datetime NULL , stkwt numeric(8, 2) NOT NULL , stkuom char (5) NULL , stkvalue numeric(10, 4) NOT NULL , stktestnum numeric(6, 0) NULL , stktestdt datetime NULL , stklimnum char (5) NULL , stkmixcode char (4) NULL , stksmixcode char (4) NULL , stkstatus char (3) NULL , stkgrade char (1) NULL , stkissnum char (10) NULL , stkissdt datetime NULL , stkisswt numeric(8, 2) NULL , stkgdncode char (5) NULL , stkstock char (1) NOT NULL , stkmulissnum char (10) NULL , stkbaletag varchar (35) NULL , stkinventory varchar(10) NULL, luid decimal(5,0) NULL, ludt datetime NULL, primary key (stkcomcode,stkloccode,stkperiodno,stkmlotnum,stkbalenum) ) type = InnoDB; CREATE TABLE trntestresults ( resmlotnum char (50) NULL , resbalenum char (50) NULL , rescomcode tinyint NOT NULL , resloccode tinyint NOT NULL , resperiodno numeric(6, 0) NOT NULL , ressl25 decimal(10, 5) NULL , resur decimal(10, 5) NULL , resmic decimal(10, 5) NULL , resstrg decimal(10, 5) NULL , reselg decimal(10, 5) NULL , resamt decimal(10, 5) NULL , resrd decimal(10, 5) NULL , resbplus decimal(10, 5) NULL , rescg char (30) NULL , rescnt decimal(10, 5) NULL , resarea decimal(10, 5) NULL , resleaf decimal(10, 5) NULL , resuhml decimal(10, 5) NULL , resui decimal(10, 5) NULL , rescottyp char (30) NULL , resopnm char (30) NULL , restestdate datetime NULL , restesttime char (15) NULL , resfilename char (40) NULL , resfiledate datetime NULL, ressrno decimal(10,2) NOT NULL, luid decimal(5,0) NULL, ludt datetime NULL, primary key (ressrno) ) type = InnoDB; CREATE TABLE trnlotbalemap ( lbmcomcode tinyint(4) NOT NULL default '0', lbmloccode tinyint(4) NOT NULL default '0', lbmperiodno decimal(6,0) NOT NULL default '0', lbmmlotnum decimal(6,0) NOT NULL default '0', lbmbalenum decimal(8,0) NOT NULL default '0', lbmstrlot varchar(50) NOT NULL, lbmstrbale varchar(50) NOT NULL, luid decimal(5,0) NULL, ludt datetime NULL, PRIMARY KEY (lbmcomcode,lbmloccode,lbmperiodno,lbmmlotnum,lbmbalenum) ) TYPE=InnoDB; INSERT INTO mstcompany VALUES (1,'Premier Polytronics (Pvt.) Ltd.','PPL','304,Singanallur,','Trichy Road,','Coimbatore','641 005','2273939','35-35320573295','premier-1@premier-1.com','www.premier-1.com',30000,2,'2003-01-03 12:43:32'); INSERT INTO mstlocation VALUES (1,1,'Premier Polytronics (Pvt.) Ltd.','PPL',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,30000,2,'2002-12-29 12:14:31'); INSERT INTO mstuom VALUES ('1','Killogram','KG','1',100.000,'2',2,'2002-12-12 16:53:43'); INSERT INTO mstuom VALUES ('2','Bales','Bales','1',0.000,'B',2,'2003-01-04 09:28:11'); INSERT INTO mstuom VALUES ('3','Millimetre','mm','2',NULL,'B',2,'2002-11-18 00:00:00'); INSERT INTO mstuom VALUES ('4','Percentage','%','2',3.000,'3',2,'2002-11-18 00:00:00'); INSERT INTO mstuom VALUES ('5','Candy','Candy','1',350.000,'1',2,'2002-11-18 00:00:00'); INSERT INTO mstuom VALUES ('6','Micronaire','Mic','2',2.000,'3',2,'2002-11-18 00:00:00'); INSERT INTO mstuom VALUES ('7','No Unit','No Unit','2',3.000,'3',2,'2002-11-18 00:00:00'); INSERT INTO mstuom VALUES ('8','g/tex','g/tex','2',0.000,'3',2,'2002-11-30 00:00:00'); INSERT INTO mstcurrency VALUES ('GPB','GPB','GPB',NULL,10.00,NULL,'RS',2,'2002-11-18 00:00:00'); INSERT INTO mstcurrency VALUES ('RS','RS','RS',NULL,NULL,NULL,'B',2,'2002-11-18 00:00:00'); INSERT INTO mstcurrency VALUES ('USD','USD','USD',NULL,25.50,NULL,'RS',2,'2002-11-18 00:00:00'); INSERT INTO mstgensettings VALUES (1,1,'C:\\Hft9000\\DATA','2','RS',1,NULL,NULL,1,1,2,'2002-11-18 00:00:00'); INSERT INTO mstgodown VALUES (1,'Default Godown','DefaultGdn',10000,2,2,'2003-03-28 00:00:00'); INSERT INTO mstcrop VALUES (1,'Default Crop Year','DefaultCrp',2,'2003-04-11 15:00:33'); INSERT INTO mstgraphset VALUES (1,1,'R0001',1,128,0,128,0,100,5,1,0,100,5,1,'A','A','0',2,'2003-04-11 15:00:33'); INSERT INTO mstgraphset VALUES (1,1,'R0002',1,0,128,0,0,100,5,1,0,100,5,1,NULL,'A','0',2,'2003-04-11 15:00:33'); INSERT INTO mstgraphset VALUES (1,1,'R0003',3,100,50,100,NULL,NULL,NULL,NULL,33,37,5,1,NULL,'M','1',2,'2003-04-11 15:00:33'); INSERT INTO mstgraphset VALUES (1,1,'R0004',1,64,0,128,0,100,5,1,0,100,5,1,'A','A','0',2,'2003-04-11 15:00:33'); INSERT INTO mstparameter VALUES ('1','2.5% Span Length','2.5% SL','3',1,'S',NULL,'2.5% Span Length','2.5% SL',2,'2003-04-11 15:00:33'); INSERT INTO mstparameter VALUES ('10','Area','Area','4',10,'S',NULL,'Area','Area',2,'2003-04-11 15:00:33'); INSERT INTO mstparameter VALUES ('11','Leaf Grade','Leaf','',11,'S',NULL,'Leaf Grade','Leaf',2,'2003-04-11 15:00:33'); INSERT INTO mstparameter VALUES ('12','Upper Half Mean Length','UHML','3',12,'S',NULL,'Upper Half Mean Length','UHML',2,'2003-04-11 15:00:33'); INSERT INTO mstparameter VALUES ('13','Uniformity Index','UI','4',13,'S',NULL,'Uniformity Index','UI',2,'2003-04-11 15:00:33'); INSERT INTO mstparameter VALUES ('2','Uniformity Ratio','UR','4',2,'S',NULL,'Uniformity Ratio','UR',2,'2003-04-11 15:00:33'); INSERT INTO mstparameter VALUES ('3','Micronaire','Mic','6',3,'S',NULL,'Micronaire','Mic',2,'2003-04-11 15:00:33'); INSERT INTO mstparameter VALUES ('4','Strength','Str','8',4,'S',NULL,'Strength','Str',2,'2003-04-11 15:00:33'); INSERT INTO mstparameter VALUES ('5','Elongation','El','4',5,'S',NULL,'Elongation','El',2,'2003-04-11 15:00:33'); INSERT INTO mstparameter VALUES ('6','Amount','Amt','6',6,'S',NULL,'Amount','Amt',2,'2003-04-11 15:00:33'); INSERT INTO mstparameter VALUES ('7','Reflectance','Rd','4',7,'S',NULL,'Reflectance','Rd',2,'2003-04-11 15:00:33'); INSERT INTO mstparameter VALUES ('8','Degree of Yellowness','+b','',8,'S',NULL,'Degree of Yellowness','+b',2,'2003-04-11 15:00:33'); INSERT INTO mstparameter VALUES ('9','Count','Cnt','7',9,'S',NULL,'Count','Cnt',2,'2003-04-11 15:00:33'); INSERT INTO mstparameter VALUES ('99','Colour Grade','CG','7',9,'S',NULL,'Colour Grade','CG',2,'2003-04-11 15:00:33'); INSERT INTO mstparamscale VALUES ('R0001','1',30.00,40.00,2.00,2,'2003-04-11 15:00:33'); INSERT INTO mstparamscale VALUES ('R0001','10',56.00,57.00,0.25,2,'2003-04-11 15:00:33'); INSERT INTO mstparamscale VALUES ('R0001','11',4.00,8.00,1.00,2,'2003-04-11 15:00:33'); INSERT INTO mstparamscale VALUES ('R0001','12',30.00,40.00,2.00,2,'2003-04-11 15:00:33'); INSERT INTO mstparamscale VALUES ('R0001','13',80.00,90.00,1.00,2,'2003-04-11 15:00:33'); INSERT INTO mstparamscale VALUES ('R0001','2',50.00,100.00,10.00,2,'2003-04-11 15:00:33'); INSERT INTO mstparamscale VALUES ('R0001','3',5.00,6.00,0.10,2,'2003-04-11 15:00:33'); INSERT INTO mstparamscale VALUES ('R0001','4',30.00,33.00,1.00,2,'2003-04-11 15:00:33'); INSERT INTO mstparamscale VALUES ('R0001','5',3.00,4.10,0.10,2,'2003-04-11 15:00:33'); INSERT INTO mstparamscale VALUES ('R0001','8',10.00,100.00,10.00,2,'2003-04-11 15:00:33'); INSERT INTO mstparamscale VALUES ('R0001','9',0.00,10.00,1.00,2,'2003-04-11 15:00:33'); INSERT INTO mstparamscale VALUES ('R0004','1',30.00,40.00,2.00,2,'2003-04-11 15:00:33'); INSERT INTO mstparamscale VALUES ('R0004','12',30.00,40.00,2.00,2,'2003-04-11 15:00:33'); INSERT INTO mstparamscale VALUES ('R0004','2',80.00,90.00,5.00,2,'2003-04-11 15:00:33'); INSERT INTO mstparamscale VALUES ('R0004','3',3.50,4.20,0.10,2,'2003-04-11 15:00:33'); INSERT INTO mstparamscale VALUES ('R0004','4',30.00,36.00,1.00,2,'2003-04-11 15:00:33'); INSERT INTO mstparamscale VALUES ('R0004','5',3.50,4.20,0.10,2,'2003-04-11 15:00:33'); INSERT INTO mstparamscale VALUES ('R0004','8',30.00,40.00,5.00,2,'2003-04-11 15:00:33'); INSERT INTO mstretrieval VALUES ('CON','COUNTRY','COUNTRY',2,'2002-04-08 00:00:00'); INSERT INTO mstretrieval VALUES ('CRP','CROP YEAR','CROP YEAR',2,'2002-04-08 00:00:00'); INSERT INTO mstretrieval VALUES ('GDN','GODOWN','GODOWN',2,'2002-04-08 00:00:00'); INSERT INTO mstretrieval VALUES ('PTY','SUPPLIER','SUPPLIER',2,'2002-04-08 00:00:00'); INSERT INTO mstretrieval VALUES ('STA','STATE','STATE',2,'2002-04-08 00:00:00'); INSERT INTO mstretrieval VALUES ('STN','STATION','STATION',2,'2002-04-08 00:00:00'); INSERT INTO mstretrieval VALUES ('VAR','VARIETY','VARIETY',2,'2002-04-08 00:00:00'); INSERT INTO mstretrieval VALUES ('ZON','ZONE','ZONE',2,'2002-04-08 00:00:00'); INSERT INTO mstretrieval VALUES ('GRD','GRADE','GRADE',2,'2003-04-22 00:00:00'); INSERT INTO mstrptcntrl VALUES ('R0001','1','0','1','1','1','0','1','1','B','1','1','1','0','0','0','0','0',2,'2003-04-11 15:00:33'); INSERT INTO mstrptcntrl VALUES ('R0002','1','1','1','1','1','1','1','0','B',NULL,NULL,NULL,NULL,NULL,NULL,'0','0',2,'2003-04-11 15:00:33'); INSERT INTO mstrptcntrl VALUES ('R0003','1','0','0','0','0','0','0','0','G','1','0','1','0','0','0','1','1',2,'2003-04-11 15:00:33'); INSERT INTO mstrptcntrl VALUES ('R0004','1','1','0','0','1','0','1','0','G',NULL,NULL,NULL,NULL,NULL,NULL,'0','0',2,'2003-04-11 15:00:33');