-- Project Name : noname -- Date/Time : 2017/04/28 18:49:40 -- Author : yamauchi -- RDBMS Type : MySQL -- Application : A5:SQL Mk-2 -- ‹âs‰c‹Æ“úƒ}ƒXƒ^ drop table if exists bankbusinessdaymaster cascade; create table bankbusinessdaymaster ( YEARMONTH decimal(6,0) default '0' not null comment '”NŒŽ' , BANKBUSINESSDAY decimal(2,0) default '0' not null comment '‹âs‰c‹Æ“ú' , NOTE varchar(120) comment '”õl' , DELETEFLG decimal(1,0) comment '휃tƒ‰ƒO' , ENTRYDATE datetime comment '“o˜^”NŒŽ“ú' , UPDATEDATE datetime comment 'XV”NŒŽ“ú' , constraint bankbusinessdaymaster_PKC primary key (YEARMONTH,BANKBUSINESSDAY) ) comment '‹âs‰c‹Æ“úƒ}ƒXƒ^' ; -- ‹ÆŽÒ¿‹ƒf[ƒ^ drop table if exists billingdata cascade; create table billingdata ( COMPANYCODE decimal(8,0) default '0' not null comment '‹¦—͉ïŽÐƒR[ƒh' , TARGETDATE decimal(6,0) default '0' not null comment '‘ÎÛ”NŒŽ' , SEQNO decimal(3,0) default '0' not null comment '˜A”Ô' , BILLPRICE decimal(10,0) comment '¿‹‹àŠz' , ENTRYDATE datetime comment '“o˜^”NŒŽ“ú' , UPDATEDATE datetime comment 'XV”NŒŽ“ú' , constraint billingdata_PKC primary key (COMPANYCODE,TARGETDATE,SEQNO) ) comment '‹ÆŽÒ¿‹ƒf[ƒ^' ; -- ‹ÆŽÒ¿‹–¾×ƒf[ƒ^ drop table if exists billingdatadetail cascade; create table billingdatadetail ( COMPANYCODE decimal(8,0) default '0' not null comment '‹¦—͉ïŽÐƒR[ƒh' , TARGETDATE decimal(6,0) default '0' not null comment '‘ÎÛ”NŒŽ' , SEQNO decimal(3,0) default '0' not null comment '˜A”Ô' , LINECOUNT decimal(3,0) default '0' not null comment 's”Ô†' , CONSTRUCTIONCODE decimal(10,0) comment 'HŽ–”Ô†' , FIELDNAME varchar(120) comment 'Œ»ê–¼' , BILLPRICE decimal(10,0) comment '¿‹‹àŠz' , HIGHWPRICE decimal(10,0) comment '‚‘¬‘ã' , HARDWPRICE decimal(10,0) comment '‹à•¨‘ã' , INDSWASTETAX decimal(10,0) comment 'ŽY”pÅ' , NOTE varchar(120) comment '”õl' , ENTRYDATE datetime comment '“o˜^”NŒŽ“ú' , UPDATEDATE datetime comment 'XV”NŒŽ“ú' , constraint billingdatadetail_PKC primary key (COMPANYCODE,TARGETDATE,SEQNO,LINECOUNT) ) comment '‹ÆŽÒ¿‹–¾×ƒf[ƒ^' ; -- ‹ÆŽÒ¿‹Žx•¥ƒTƒ}ƒŠ[ƒf[ƒ^ drop table if exists billingpaymentsummary cascade; create table billingpaymentsummary ( COMPANYCODE decimal(8,0) default '0' not null comment '‹¦—͉ïŽÐƒR[ƒh' , TARGETDATE decimal(6,0) default '0' not null comment '‘ÎÛ”NŒŽ' , CHARGEPAYMENTKIND decimal(1,0) default '0' not null comment '¿‹Žx•¥‹æ•ª' , PAYDAY date comment 'Žx•¥“ú' , BILLPRICESTOTAL decimal(10,0) comment '¿‹‹àŠz¬Œv' , CONSUMPTIONTAXRATE decimal(6,3) comment 'Á”ïÅ—¦' , CONSUMPTIONTAXPRICE decimal(10,0) comment 'Á”ïÅŠz' , HIGHWPRICESTOTAL decimal(10,0) comment '‚‘¬‘㬌v' , HARDWPRICESTOTAL decimal(10,0) comment '‹à•¨‘㬌v' , INDSWASTETAXSTOTAL decimal(10,0) comment 'ŽY”pŬŒv' , CNSTRPRICERATE decimal(6,3) comment '‹¦—Í‹à”ä—¦' , CNSTRPRICESTOTAL decimal(10,0) comment '‹¦—͋ଌv' , BILLINGPRICETOTAL decimal(10,0) comment '¿‹‹àŠz‡Œv' , ENTRYDATE datetime comment '“o˜^”NŒŽ“ú' , UPDATEDATE datetime comment 'XV”NŒŽ“ú' , constraint billingpaymentsummary_PKC primary key (COMPANYCODE,TARGETDATE,CHARGEPAYMENTKIND) ) comment '‹ÆŽÒ¿‹Žx•¥ƒTƒ}ƒŠ[ƒf[ƒ^' ; -- HŽ–Ž‘Þî•ñ drop table if exists constructionmaterialinfo cascade; create table constructionmaterialinfo ( CONSTRUCTIONCODE int(10) unsigned default 0 not null comment 'HŽ–”Ô†' , MATERIALITEMCODE smallint(5) unsigned default 0 not null comment 'Ž‘Þ•i–ÚƒR[ƒh' , RENTCOUNT smallint(5) unsigned comment '‘Ýo”' , REPAYCOUNT smallint(5) unsigned comment '•Ô‹p”' , COMPLETEFLG tinyint(3) unsigned comment 'Š®—¹ƒtƒ‰ƒO' , ENTRYDATE datetime comment '“o˜^“ú•t' , UPDATEDATE datetime comment 'XV“ú•t' , constraint constructionmaterialinfo_PKC primary key (CONSTRUCTIONCODE,MATERIALITEMCODE) ) comment 'HŽ–Ž‘Þî•ñ' ; -- ’÷“úƒ}ƒXƒ^ drop table if exists deadlinemaster cascade; create table deadlinemaster ( LABOURKIND decimal(1,0) default '0' not null comment 'ŽèŠÔ‹ÆŽÒ‹æ•ª' , DEADLINE decimal(2,0) comment '’÷“ú' , PAYDAY decimal(2,0) comment 'Žx•¥“ú' , NOTE varchar(120) comment '”õl' , DELETEFLG decimal(1,0) comment '휃tƒ‰ƒO' , ENTRYDATE datetime comment '“o˜^“ú•t' , UPDATEDATE datetime comment 'XV“ú•t' , constraint deadlinemaster_PKC primary key (LABOURKIND) ) comment '’÷“úƒ}ƒXƒ^' ; -- “ü‹àŠm”F³”Fƒf[ƒ^ drop table if exists depositapprovalinfo cascade; create table depositapprovalinfo ( ORDERERSDIVISION decimal(5,0) not null comment '”­’ŽÒ‹æ•ª' , ORDERERSCODE decimal(5,0) not null comment '”­’ŽÒƒR[ƒh' , TARGETDATE decimal(6,0) not null comment '‘ÎÛ”NŒŽ' , SEQNO decimal(3,0) not null comment '˜A”Ô' , LINECOUNT decimal(3,0) not null comment 's”Ô†' , APPROVALNO decimal(3,0) not null comment '³”F‡˜' , APPROVALPERSON decimal(8,0) comment '³”FŽÒƒR[ƒh' , APPROVALPERSONNAME varchar(20) comment '³”FŽÒ–¼' , APPROVALAUTHORITY decimal(1,0) comment '³”FŒ ŒÀ‹æ•ª' , APPROVALDATE date comment '³”F“ú•t' , ENTRYDATE datetime comment '“o˜^“ú•t' , UPDATEDATE datetime comment 'XV“ú•t' , constraint depositapprovalinfo_PKC primary key (ORDERERSDIVISION,ORDERERSCODE,TARGETDATE,SEQNO,LINECOUNT,APPROVALNO) ) comment '“ü‹àŠm”F³”Fƒf[ƒ^' ; -- “ü‹àƒf[ƒ^ drop table if exists depositdata cascade; create table depositdata ( ORDERERSDIVISION decimal(5,0) not null comment '”­’ŽÒ‹æ•ª' , ORDERERSCODE decimal(5,0) not null comment '”­’ŽÒƒR[ƒh' , TARGETDATE decimal(6,0) not null comment '‘ÎÛ”NŒŽ' , SEQNO decimal(3,0) not null comment '˜A”Ô' , BusinessPeriod decimal(4,0) comment '‰c‹ÆŠú' , DEPOSITDATE date comment '“ü‹à“ú' , DepositAmount decimal(12,0) comment '“ü‹à‹àŠz' , DEPOSITAMOUNTCASH decimal(10,0) comment '“ü‹à‹àŠziŒ»‹àj' , DEPOSITAMOUNTBILL decimal(10,0) comment '“ü‹à‹àŠziŽèŒ`j' , ENTRYDATE datetime comment '“o˜^“ú•t' , UPDATEDATE datetime comment 'XV“ú•t' , constraint depositdata_PKC primary key (ORDERERSDIVISION,ORDERERSCODE,TARGETDATE,SEQNO) ) comment '“ü‹àƒf[ƒ^' ; -- “ü‹à–¾×ƒf[ƒ^ drop table if exists depositdatadetail cascade; create table depositdatadetail ( ORDERERSDIVISION decimal(5,0) not null comment '”­’ŽÒ‹æ•ª' , ORDERERSCODE decimal(5,0) not null comment '”­’ŽÒƒR[ƒh' , TARGETDATE decimal(6,0) not null comment '‘ÎÛ”NŒŽ' , SEQNO decimal(3,0) not null comment '˜A”Ô' , LINECOUNT decimal(3,0) not null comment 's”Ô†' , REQUESTNO decimal(10,0) comment '¿‹No' , ORDERNO decimal(2,0) comment 'Žó•t”Ô†' , DEPOSITAMOUNT decimal(10,0) comment '“ü‹à‹àŠz' , DISCOUNTAMOUNT decimal(10,0) comment '’lˆø‚«‹àŠz' , CNSTRPRICE decimal(10,0) comment '‹¦—Í‹à' , FEES decimal(10,0) comment 'Žè”—¿' , OTHERADJUSTMENTS decimal(10,0) comment '‚»‚Ì‘¼’²®' , CARRYAMOUNT decimal(10,0) comment 'ŒJ‰z‹àŠz' , APPROVALPERSONCODE decimal(8,0) comment '³”F’S“–ŽÒƒR[ƒh' , APPROVALDATE date comment '’S“–ŽÒ³”F“ú•t' , APPROVALENDFLG decimal(1,0) comment '³”FŠ®—¹ƒtƒ‰ƒO' , ENTRYDATE datetime comment '“o˜^“ú•t' , UPDATEDATE datetime comment 'XV“ú•t' , constraint depositdatadetail_PKC primary key (ORDERERSDIVISION,ORDERERSCODE,TARGETDATE,SEQNO,LINECOUNT) ) comment '“ü‹à–¾×ƒf[ƒ^' ; -- ¿‹‘ƒf[ƒ^ drop table if exists invoicedata cascade; create table invoicedata ( INVOICENO decimal(9,0) not null comment '¿‹‘No' , ORDERERSDIVISION decimal(5,0) not null comment '”­’ŽÒ‹æ•ª' , ORDERERSCODE decimal(5,0) not null comment '”­’ŽÒƒR[ƒh' , REQUESTMONTH decimal(6,0) not null comment '¿‹ŒŽ' , SEQNO decimal(2,0) not null comment '˜A”Ô' , CRETATEDATE date not null comment '쬓ú' , REQUESTDATE date not null comment '¿‹“ú' , REQUESTNAME varchar(120) comment '¿‹æ–¼' , TOTALAMOUNT decimal(10,0) comment 'Åž‚݇Œv‹àŠz' , TAXAMOUNT decimal(10,0) comment 'Á”ïÅ‹àŠz' , COMMENT1 varchar(60) comment 'ƒRƒƒ“ƒg1' , COMMENT2 varchar(60) comment 'ƒRƒƒ“ƒg2' , COMMENT3 varchar(60) not null comment 'ƒRƒƒ“ƒg3' , COMMENT4 varchar(60) not null comment 'ƒRƒƒ“ƒg4' , COMMENT5 varchar(60) not null comment 'ƒRƒƒ“ƒg5' , COMPLETEFLG decimal(1,0) default '0' not null comment 'Š®—¹ƒtƒ‰ƒO' , ENTRYDATE datetime not null comment '“o˜^”NŒŽ“ú' , UPDATEDATE datetime not null comment 'XV”NŒŽ“ú' , constraint invoicedata_PKC primary key (INVOICENO) ) comment '¿‹‘ƒf[ƒ^' ; alter table invoicedata add unique ORDERERSDIVISION (ORDERERSDIVISION,ORDERERSCODE,REQUESTMONTH,SEQNO) ; -- Ž‘Þî•ñ drop table if exists materialinfo cascade; create table materialinfo ( MATERIALITEMCODE smallint(5) unsigned default 0 not null comment 'Ž‘Þ•i–ÚƒR[ƒh' , MATERIALCOUNT smallint(5) unsigned comment 'Ž‘Þ”' , RENTCOUNT smallint(5) unsigned comment '‘Ýo‰Â”\”' , DELETEFLG smallint(5) unsigned comment '휃tƒ‰ƒO' , ENTRYDATE datetime comment '“o˜^“ú•t' , UPDATEDATE datetime comment 'XV“ú•t' , constraint materialinfo_PKC primary key (MATERIALITEMCODE) ) comment 'Ž‘Þî•ñ' ; -- Ž‘Þ•i–Úƒ}ƒXƒ^ drop table if exists materialitemmaster cascade; create table materialitemmaster ( MATERIALITEMCODE smallint(5) unsigned default 0 not null comment 'Ž‘Þ•i–ÚƒR[ƒh' , MATERIALKINDCODE smallint(5) unsigned comment 'Ž‘ÞŽí—ÞƒR[ƒh' , MATERIALITEMNAME varchar(40) comment 'Ž‘Þ•i–Ú–¼Ì' , DISPLAYORDER smallint(5) unsigned comment '•\Ž¦‡' , DELETEFLG tinyint(3) unsigned comment '휃tƒ‰ƒO' , ENTRYDATE datetime comment '“o˜^“ú•t' , UPDATEDATE datetime comment 'XV“ú•t' , constraint materialitemmaster_PKC primary key (MATERIALITEMCODE) ) comment 'Ž‘Þ•i–Úƒ}ƒXƒ^' ; -- Ž‘ÞŽí—Þƒ}ƒXƒ^ drop table if exists materialkindmaster cascade; create table materialkindmaster ( MATERIALKINDCODE smallint(5) unsigned default 0 not null comment 'Ž‘ÞŽí—ÞƒR[ƒh' , MATERIALKINDNAME varchar(40) comment 'Ž‘ÞŽí—Þ–¼Ì' , DISPLAYORDER smallint(5) unsigned comment '•\Ž¦‡' , DELETEFLG tinyint(3) unsigned comment '휃tƒ‰ƒO' , ENTRYDATE datetime comment '“o˜^“ú•t' , UPDATEDATE datetime comment 'XV“ú•t' , constraint materialkindmaster_PKC primary key (MATERIALKINDCODE) ) comment 'Ž‘ÞŽí—Þƒ}ƒXƒ^' ; -- Ž‘Þ—š—ðî•ñ drop table if exists materialrecordinfo cascade; create table materialrecordinfo ( MATERIALITEMCODE smallint(5) unsigned default 0 not null comment 'Ž‘Þ•i–ÚƒR[ƒh' , PROCESSDATE date default '0000-00-00' not null comment 'ˆ—”NŒŽ“ú' , SEQNO smallint(5) unsigned default 0 not null comment '˜A”Ô' , RECKIND tinyint(3) unsigned comment 'ƒŒƒR[ƒh‹æ•ª' , CONSTRUCTIONCODE int(10) unsigned comment 'HŽ–”Ô†' , PERSONCODE int(10) unsigned comment '’S“–ŽÒƒR[ƒh' , MATERIALCOUNT smallint(5) unsigned comment 'Ž‘Þ”' , REPAYPLANDATE date comment '•Ô‹p—\’è”NŒŽ“ú' , COMMENTTEXT varchar(80) comment 'ƒRƒƒ“ƒg' , ENTRYDATE datetime comment '“o˜^“ú•t' , UPDATEDATE datetime comment 'XV“ú•t' , constraint materialrecordinfo_PKC primary key (MATERIALITEMCODE,PROCESSDATE,SEQNO) ) comment 'Ž‘Þ—š—ðî•ñ' ; -- Žx•¥³”Fî•ñƒf[ƒ^ drop table if exists paymentapprovalinfo cascade; create table paymentapprovalinfo ( COMPANYCODE decimal(8,0) default '0' not null comment '‹¦—͉ïŽÐƒR[ƒh' , TARGETDATE decimal(6,0) default '0' not null comment '‘ÎÛ”NŒŽ' , SEQNO decimal(3,0) default '0' not null comment '˜A”Ô' , LINECOUNT decimal(3,0) default '0' not null comment 's”Ô†' , APPROVALNO decimal(3,0) default '0' not null comment '³”F‡˜' , APPROVALPERSON decimal(8,0) comment '³”FŽÒƒR[ƒh' , APPROVALPERSONNAME varchar(20) comment '³”FŽÒ–¼' , APPROVALAUTHORITY decimal(1,0) comment '³”FŒ ŒÀ‹æ•ª' , APPROVALDATE date comment '³”F“ú•t' , ENTRYDATE datetime comment '“o˜^“ú•t' , UPDATEDATE datetime comment 'XV“ú•t' , constraint paymentapprovalinfo_PKC primary key (COMPANYCODE,TARGETDATE,SEQNO,LINECOUNT,APPROVALNO) ) comment 'Žx•¥³”Fî•ñƒf[ƒ^' ; -- Žx•¥–¾×ƒf[ƒ^ drop table if exists paymentdatadetail cascade; create table paymentdatadetail ( COMPANYCODE decimal(8,0) default '0' not null comment '‹¦—͉ïŽÐƒR[ƒh' , TARGETDATE decimal(6,0) default '0' not null comment '‘ÎÛ”NŒŽ' , SEQNO decimal(3,0) default '0' not null comment '˜A”Ô' , LINECOUNT decimal(3,0) default '0' not null comment 's”Ô†' , BILLPRICE decimal(10,0) comment '¿‹‹àŠz' , DISCOUNTPRICE decimal(10,0) comment '’lˆø‚«‹àŠz' , OFFSETPRICE decimal(10,0) comment '‘ŠŽE‹àŠz' , NEXTCOPRICE decimal(10,0) comment 'ŽŸ‰ñŒJ‰z' , HIGHWPRICE decimal(10,0) comment '‚‘¬‘ã' , HARDWPRICE decimal(10,0) comment '‹à•¨‘ã' , INDSWASTETAX decimal(10,0) comment 'ŽY”pÅ' , CNSTRPRICE decimal(10,0) comment '‹¦—Í‹à' , CNSTRPRICEEXIST decimal(1,0) comment '‹¦—Í‹à—L–³' , APPROVALPERSONCODE decimal(8,0) comment '³”F’S“–ŽÒƒR[ƒh' , APPROVALDATE date comment '’S“–ŽÒ³”F“ú•t' , APPROVALENDFLG decimal(1,0) comment '³”FŠ®—¹ƒtƒ‰ƒO' , ENTRYDATE datetime comment '“o˜^“ú•t' , UPDATEDATE datetime comment 'XV“ú•t' , constraint paymentdatadetail_PKC primary key (COMPANYCODE,TARGETDATE,SEQNO,LINECOUNT) ) comment 'Žx•¥–¾×ƒf[ƒ^' ; -- ¿‹ƒf[ƒ^ drop table if exists requestdata cascade; create table requestdata ( REQUESTNO decimal(9,0) not null comment '¿‹No' , MAINCONSTRUCTIONCODE decimal(10,0) not null comment '–{HŽ–”Ô†' , CONSTRUCTIONNAME varchar(120) not null comment 'HŽ–Œ–¼' , CONTRACTAMOUNT decimal(10,0) not null comment '¿•‰‹àŠz' , PAIDAMOUNT decimal(10,0) not null comment '¿‹Ï‹àŠz' , REQUESTAMOUNT0 decimal(10,0) not null comment '¿‹‹àŠz‚O' , REQUESTAMOUNT1 decimal(10,0) not null comment '¿‹‹àŠz‚P' , REQUESTAMOUNT2 decimal(10,0) comment '¿‹‹àŠz‚Q' , REQUESTAMOUNT3 decimal(10,0) comment '¿‹‹àŠz‚R' , REQUESTAMOUNT4 decimal(10,0) comment '¿‹‹àŠz‚S' , REQUESTAMOUNT5 decimal(10,0) comment '¿‹‹àŠz‚T' , REQUESTAMOUNT6 decimal(10,0) comment '¿‹‹àŠz‚U' , UNCLAIMEDAMOUNT decimal(10,0) not null comment '¿‹Žc‹àŠz' , UNPAIDAMOUNT decimal(10,0) not null comment '–¢“ü‹à‹àŠz' , TAXAMOUNT decimal(10,0) not null comment 'Á”ïÅ' , NOTE varchar(120) not null comment '”õl' , ENTRYDATE datetime not null comment '“o˜^”NŒŽ“ú' , UPDATEDATE datetime not null comment 'XV”NŒŽ“ú' , constraint requestdata_PKC primary key (REQUESTNO,MAINCONSTRUCTIONCODE) ) comment '¿‹ƒf[ƒ^' ; -- ¿‹ƒf[ƒ^–¾× drop table if exists requestdatadetail cascade; create table requestdatadetail ( REQUESTNO decimal(9,0) not null comment '¿‹No' , MAINCONSTRUCTIONCODE decimal(10,0) not null comment '–{HŽ–”Ô†' , CONSTRUCTIONCODE decimal(10,0) not null comment 'HŽ–”Ô†' , CONSTRUCTIONKIND decimal(1,0) not null comment 'HŽ–‹æ•ª' , REQUESTAMOUNT decimal(10,0) not null comment '¿‹‹àŠz' , TAXAMOUNT decimal(10,0) not null comment 'Á”ïÅ' , ENTRYDATE datetime not null comment '“o˜^”NŒŽ“ú' , UPDATEDATE datetime not null comment 'XV”NŒŽ“ú' , constraint requestdatadetail_PKC primary key (REQUESTNO,MAINCONSTRUCTIONCODE,CONSTRUCTIONCODE,CONSTRUCTIONKIND) ) comment '¿‹ƒf[ƒ^–¾×' ; -- ¿‹ƒwƒbƒ_ drop table if exists requesthead cascade; create table requesthead ( REQUESTNO decimal(9,0) not null comment '¿‹No' , REQCONSTRUCTIONCODE decimal(10,0) not null comment '¿‹HŽ–”Ô†' , ORDERNO decimal(2,0) not null comment 'Žó•t”Ô†' , REQUESTMONTH decimal(6,0) not null comment '¿‹ŒŽ' , ORDERERSDIVISION decimal(5,0) not null comment '”­’ŽÒ‹æ•ª' , ORDERERSCODE decimal(5,0) not null comment '”­’ŽÒƒR[ƒh' , ORDERERSNAME varchar(120) not null comment '”­’ŽÒæ–¼' , REQCONSTRUCTIONNAME varchar(120) not null comment '¿‹HŽ–Œ–¼' , REQUESTTOTALAMOUNT decimal(10,0) not null comment '¿‹‹àŠz‡Œv' , REQUESTAMOUNT decimal(10,0) not null comment '¿‹‹àŠz' , TAXAMOUNT decimal(10,0) not null comment 'Á”ïÅ' , UNPAIDAMOUNT decimal(10,0) comment '–¢“ü‹à' , NOTE varchar(120) comment '”õl' , ASSIGNEDFLG decimal(1,0) comment 'Š„“–σtƒ‰ƒO' , INVOICENO decimal(9,0) not null comment '¿‹‘No' , ENTRYDATE datetime not null comment '“o˜^”NŒŽ“ú' , UPDATEDATE datetime not null comment 'XV”NŒŽ“ú' , constraint requesthead_PKC primary key (REQUESTNO) ) comment '¿‹ƒwƒbƒ_' ; alter table requesthead add unique REQCONSTRUCTIONCODE (REQCONSTRUCTIONCODE,ORDERNO) ;