/**Begin D:\scm_code\PDM_UPGRADE_1.3\PDM_UPGRADE_1.3\PDM_UPGRADE\pdm2\RIM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_RIM_INV_ELECTRIC') 
 CREATE TABLE T_RIM_INV_ELECTRIC (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(36) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(2) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FINVOICE_NO NVARCHAR(32) DEFAULT ' ' NOT NULL,
FINVOICE_DATE DATETIME,
FSALER_NAME NVARCHAR(120) DEFAULT ' ' NOT NULL,
FSALER_TAX_NO NVARCHAR(20) DEFAULT ' ' NOT NULL,
FBUYER_NAME NVARCHAR(120) DEFAULT ' ' NOT NULL,
FBUYER_TAX_NO NVARCHAR(20) DEFAULT ' ' NOT NULL,
FINVOICE_AMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTOTAL_TAX_AMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTOTAL_AMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(400) DEFAULT ' ' NOT NULL,
FMACHINE_NO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPROXY_MARK NVARCHAR(4) DEFAULT ' ' NOT NULL,
FDRAWER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FREVIEWER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FINVOICE_STATUS NVARCHAR(2) DEFAULT ' ' NOT NULL,
FTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FORIGINAL_INVOICE_CODE NVARCHAR(32) DEFAULT ' ' NOT NULL,
FORIGINAL_INVOICE_NO NVARCHAR(32) DEFAULT ' ' NOT NULL,
FINVALID_DATE DATETIME,
FTENANT_NO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FTAX_ORG BIGINT DEFAULT 0 NOT NULL,
FORG_ID BIGINT DEFAULT 0 NOT NULL,
FINVOICE_TYPE BIGINT DEFAULT 0 NOT NULL,
FRESOURCE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FEXPENSE_STATUS NVARCHAR(2) DEFAULT ' ' NOT NULL,
FORIGINAL_STATE NVARCHAR(2) DEFAULT ' ' NOT NULL,
FACCOUNT_DATE DATETIME,
FSPLIT NVARCHAR(50) DEFAULT ' ' NOT NULL,
FAUTHENTICATE_FLAG NVARCHAR(2) DEFAULT ' ' NOT NULL,
FAUTHENTICATE_TIME DATETIME,
FSELECT_TIME DATETIME,
FTAX_PERIOD DATETIME,
FEFFECTIVE_TAX_AMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDEDUCTION_PURPOSE NVARCHAR(2) DEFAULT ' ' NOT NULL,
FDEDUCTION_FLAG NVARCHAR(2) DEFAULT ' ' NOT NULL,
FMANAGE_STATUS NVARCHAR(2) DEFAULT ' ' NOT NULL,
FSERIAL_NO NVARCHAR(36) DEFAULT ' ' NOT NULL,
FMAIN_GOODS_NAME NVARCHAR(200) DEFAULT ' ' NOT NULL,
FAWS_SERIAL_NO NVARCHAR(36) DEFAULT ' ' NOT NULL,
FDELETE NVARCHAR(4) DEFAULT ' ' NOT NULL,
FPROJECT BIGINT DEFAULT 0 NOT NULL,
FPROXY_SALER_NAME NVARCHAR(120) DEFAULT ' ' NOT NULL,
FPROXY_SALER_TAX_NO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FTOTAL_DEDUCT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FAVAIL_DEDUCT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCURRENT_DEDUCT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREMAIN_DEDUCT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FNOT_DEDUCTIBLE_TYPE NVARCHAR(2) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_RIM_INV_ELECTRIC_ITEM') 
 CREATE TABLE T_RIM_INV_ELECTRIC_ITEM (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FGOODS_NAME NVARCHAR(200) DEFAULT ' ' NOT NULL,
FGOODS_CODE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FSPEC_MODEL NVARCHAR(100) DEFAULT ' ' NOT NULL,
FUNIT_PRICE DECIMAL(30,18) DEFAULT 0 NOT NULL,
FNUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAX_RATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNIT NVARCHAR(20) DEFAULT ' ' NOT NULL,
FDETAIL_AMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAX_AMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDISCOUNT_TYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FZEROTAXRATE_FLAG NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPREFERENTIAL_POLICY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FVAT_EXCEPTION NVARCHAR(50) DEFAULT ' ' NOT NULL,
FVERSION_NO NVARCHAR(16) DEFAULT ' ' NOT NULL
);



/**End D:\scm_code\PDM_UPGRADE_1.3\PDM_UPGRADE_1.3\PDM_UPGRADE\pdm2\RIM_table.sql **/
