
 EXEC P_ALTERPK 'PK_T_ER_PREPAYBILL', 'T_ER_PREPAYBILL', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_PERPAYBILL_FBILLNO') CREATE INDEX IDX_ER_PERPAYBILL_FBILLNO ON T_ER_PREPAYBILL ( FBILLNO );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_PERPAYBILL_FAPPLYERID') CREATE INDEX IDX_ER_PERPAYBILL_FAPPLYERID ON T_ER_PREPAYBILL ( FAPPLIERID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_PERPAYBILL_FCREATORID') CREATE INDEX IDX_ER_PERPAYBILL_FCREATORID ON T_ER_PREPAYBILL ( FCREATORID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_PERPAYBILL_FCOMPANYID') CREATE INDEX IDX_ER_PERPAYBILL_FCOMPANYID ON T_ER_PREPAYBILL ( FCOMPANYID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_PERPAYBILL_FSTATUS') CREATE INDEX IDX_ER_PERPAYBILL_FSTATUS ON T_ER_PREPAYBILL ( FBILLSTATUS );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_PERPAYBILL_FDATE_NO') CREATE INDEX IDX_ER_PERPAYBILL_FDATE_NO ON T_ER_PREPAYBILL ( FBIZDATE ,FBILLNO );


 EXEC P_ALTERPK 'PK_T_ER_PREPAYBILLENTRY', 'T_ER_PREPAYBILLENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_PREPAYENTRY_FSEQ') CREATE INDEX IDX_ER_PREPAYENTRY_FSEQ ON T_ER_PREPAYBILLENTRY ( FID ,FSEQ );


 EXEC P_ALTERPK 'PK_T_ER_PREPAYBILLRECENTRY', 'T_ER_PREPAYBILLRECENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_PREPAYRECENTRY_FSEQ') CREATE INDEX IDX_ER_PREPAYRECENTRY_FSEQ ON T_ER_PREPAYBILLRECENTRY ( FID ,FSEQ );


 EXEC P_ALTERPK 'PK_T_ER_PREPAYBILLPAYENTRY', 'T_ER_PREPAYBILLPAYENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_PAYENTRY_TARGETBILLID') CREATE INDEX IDX_ER_PAYENTRY_TARGETBILLID ON T_ER_PREPAYBILLPAYENTRY ( FTARGETBILLID ,FTARGETBILLNO );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_PAYENTRY_FEQ') CREATE INDEX IDX_ER_PAYENTRY_FEQ ON T_ER_PREPAYBILLPAYENTRY ( FID ,FSEQ );


 EXEC P_ALTERPK 'PK_T_ER_PREPAYBILL_L', 'T_ER_PREPAYBILL_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PREPAYBILL_L_ID') CREATE INDEX IDX_PREPAYBILL_L_ID ON T_ER_PREPAYBILL_L( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_ER_PREPAYBILL_LK', 'T_ER_PREPAYBILL_LK', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_PREPAYBILL_LK_FID') CREATE INDEX IDX_ER_PREPAYBILL_LK_FID ON T_ER_PREPAYBILL_LK ( FID );


 EXEC P_ALTERPK 'PK_T_ER_PREPAYBILL_TC', 'T_ER_PREPAYBILL_TC', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_PREPAYB_TC_FBILLID') CREATE INDEX IDX_ER_PREPAYB_TC_FBILLID ON T_ER_PREPAYBILL_TC ( FTBILLID );


 EXEC P_ALTERPK 'PK_T_ER_PREPAYBILL_WB', 'T_ER_PREPAYBILL_WB', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_PREPAYBILL_WB_FID') CREATE INDEX IDX_ER_PREPAYBILL_WB_FID ON T_ER_PREPAYBILL_WB ( FID );


 EXEC P_ALTERPK 'PK_T_ER_PREPAYBILLENTRY_LK', 'T_ER_PREPAYBILLENTRY_LK', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_PREPAYBILL_LK_FENTRYID') CREATE INDEX IDX_ER_PREPAYBILL_LK_FENTRYID ON T_ER_PREPAYBILLENTRY_LK ( FENTRYID );

