/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\ER_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_INVVOUCHERUP')
CREATE TABLE T_ER_INVVOUCHERUP (
                                   FID BIGINT DEFAULT 0 NOT NULL,
                                   FBILLTYPE VARCHAR(255) DEFAULT ' ' NOT NULL,
                                   FBILLNO VARCHAR(255) DEFAULT ' ' NOT NULL,
                                   FBILLID BIGINT DEFAULT 0 NOT NULL,
                                   FACCOUNTDAY DATETIME,
                                   FACCOUNTDATE DATETIME,
                                   FBUSINESSDATE DATETIME,
                                   FVOUCHERNO VARCHAR(255) DEFAULT ' ' NOT NULL,
                                   FVOUCHERID BIGINT DEFAULT 0 NOT NULL,
                                   FUPDATETIME DATETIME,
                                   FUSERID BIGINT DEFAULT 0 NOT NULL,
                                   FSTATUS CHAR(1) DEFAULT ' ' NOT NULL
);



/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\ER_table.sql **/



/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\ER_constraint.sql **/
EXEC P_ALTERPK 'PK_T_ER_INVVOUCHERUP', 'T_ER_INVVOUCHERUP', 'FID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_ER_INVVOUCHERUP' AND KSQL_INDNAME = 'IDX_INVVOUCHER_TYPE') CREATE INDEX IDX_INVVOUCHER_TYPE ON T_ER_INVVOUCHERUP ( FBILLTYPE );

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_ER_INVVOUCHERUP' AND KSQL_INDNAME = 'IDX_INVVOUCHER_BILLNO') CREATE INDEX IDX_INVVOUCHER_BILLNO ON T_ER_INVVOUCHERUP ( FBILLNO );

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_ER_INVVOUCHERUP' AND KSQL_INDNAME = 'IDX_INVVOUCHER_VOUNO') CREATE INDEX IDX_INVVOUCHER_VOUNO ON T_ER_INVVOUCHERUP ( FVOUCHERNO );



/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\ER_constraint.sql **/
