/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\AP_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_AP_EASSETTLERECORD', 'T_AP_EASSETTLERECORD', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_AP_EASSETTLERECORD' AND KSQL_INDNAME = 'IDX_AP_EASSETTLE_FORGID') CREATE INDEX IDX_AP_EASSETTLE_FORGID ON T_AP_EASSETTLERECORD ( FORGID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_AP_EASSETTLERECORD' AND KSQL_INDNAME = 'IDX_AP_EASSETTLE_FXHSTATUS') CREATE INDEX IDX_AP_EASSETTLE_FXHSTATUS ON T_AP_EASSETTLERECORD ( FXHRECORDSTATUS );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_AP_EASSETTLERECORD' AND KSQL_INDNAME = 'IDX_AP_EASSETTLE_FSETTLEDATE') CREATE INDEX IDX_AP_EASSETTLE_FSETTLEDATE ON T_AP_EASSETTLERECORD ( FSETTLEDATE );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_AP_EASSETTLERECORD' AND KSQL_INDNAME = 'IDX_AP_EASSETTLE_FORIGINTYPE') CREATE INDEX IDX_AP_EASSETTLE_FORIGINTYPE ON T_AP_EASSETTLERECORD ( FORIGINTYPE );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_AP_EASSETTLERECORD' AND KSQL_INDNAME = 'IDX_AP_EASSETTLE_FSRCSYSID') CREATE INDEX IDX_AP_EASSETTLE_FSRCSYSID ON T_AP_EASSETTLERECORD ( FSRCSYSBILLID );


 EXEC P_ALTERPK 'PK_T_AP_EASSETTLERECORDENTRY', 'T_AP_EASSETTLERECORDENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_AP_EASSETTLERECORDENTRY' AND KSQL_INDNAME = 'IDX_AP_EASSETTLEENTRY_FID') CREATE INDEX IDX_AP_EASSETTLEENTRY_FID ON T_AP_EASSETTLERECORDENTRY ( FID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_AP_EASSETTLERECORDENTRY' AND KSQL_INDNAME = 'IDX_AP_EASSETTLEENTRY_FBILLID') CREATE INDEX IDX_AP_EASSETTLEENTRY_FBILLID ON T_AP_EASSETTLERECORDENTRY ( FBILLID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_AP_EASSETTLERECORDENTRY' AND KSQL_INDNAME = 'IDX_AP_EASSETTLEENTRY_FBILENID') CREATE INDEX IDX_AP_EASSETTLEENTRY_FBILENID ON T_AP_EASSETTLERECORDENTRY ( FBILLENTRYID );



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