/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\AR_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_AR_VERIFYRECORD', 'T_AR_VERIFYRECORD', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_AR_VR_ORGDATE') CREATE INDEX IDX_AR_VR_ORGDATE ON T_AR_VERIFYRECORD ( FORGID ,FCREATETIME );

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_AR_VR_BILLID') CREATE INDEX IDX_AR_VR_BILLID ON T_AR_VERIFYRECORD ( FBILLID );


 EXEC P_ALTERPK 'PK_T_AR_VERIFYRECORDENTRY', 'T_AR_VERIFYRECORDENTRY', 'FENTRYID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_AR_VRE_BILLID') CREATE INDEX IDX_AR_VRE_BILLID ON T_AR_VERIFYRECORDENTRY ( FBILLID );

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


 EXEC P_ALTERPK 'PK_T_AR_CLOSERECORD', 'T_AR_CLOSERECORD', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_AR_RECORD_ORGDATE') CREATE INDEX IDX_AR_RECORD_ORGDATE ON T_AR_CLOSERECORD ( FORGID ,FCLOSEDATE );


EXEC p_DropIdx 'IDX_AR_ORG_APP', 'T_AR_BALANCE';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_AR_BAL_ORGCLOSEID') CREATE INDEX IDX_AR_BAL_ORGCLOSEID ON T_AR_BALANCE ( FORGID ,FCLOSEID );


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