Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: IBYAPT1

IBYAPT1.m

Go to the documentation of this file.
  1. IBYAPT1 ;ALB/CPM - PATCH IB*2*28 INSURANCE CLEAN-UP ; 30-JAN-95
  1. ;;Version 2.0 ; INTEGRATED BILLING ;**28**; 21-MAR-94
  1. ;
  1. BKG ; Queue off a background job to clean up various insurance files.
  1. W !!,">>> Queuing off a job to clean up various insurance files..."
  1. W !," (You'll get a message when the job is completed)",!
  1. S ZTRTN="FIX^IBYAPT1",ZTDTH=$H,ZTIO=""
  1. S ZTDESC="IB - PATCH IB*2*28 POST INIT - INSURANCE CLEAN-UP"
  1. D ^%ZTLOAD
  1. W !?4,$S($D(ZTSK):"The job has been queued. The task number is "_ZTSK_".",1:"Unable to queue this job. Please run FIX^IBYAPT1 at any time.")
  1. K ZTSK
  1. Q
  1. ;
  1. ;
  1. FIX ; Perform clean-up of Insurance Company files.
  1. ;
  1. D NOW^%DTC S IBBDT=%
  1. ;
  1. D PLAN ; Clean up x-refs in file #355.3
  1. D AB ; Delete errant Annual Benefits from file #355.4
  1. D BU ; Delete errant Benefits Used from file #355.5
  1. D RIDER ; Delete errant Riders from file #355.7
  1. D IR ; Repoint 'Insurance Company Contacted' for
  1. ; Insurance Reviews in file 356.2
  1. ;
  1. D NOW^%DTC S IBEDT=%
  1. ;
  1. D MAIL ; send out results
  1. K IBBDT,IBEDT,IBR,IBC,IBV,IBP,IBPD,IBV1,IBCT,IBT,IBX,XMSUB,XMTEXT,XMDUZ,XMY,Y
  1. Q
  1. ;
  1. ;
  1. ;
  1. PLAN ; Clean up the 'AGNU' and 'AGNA' x-refs in file #355.3
  1. F IBR="AGNA","AGNU" D
  1. .S IBC=0 F S IBC=$O(^IBA(355.3,IBR,IBC)) Q:'IBC D
  1. ..S IBV="" F S IBV=$O(^IBA(355.3,IBR,IBC,IBV)) Q:IBV="" D
  1. ...S IBP=0 F S IBP=$O(^IBA(355.3,IBR,IBC,IBV,IBP)) Q:'IBP D
  1. ....S IBPD=$G(^IBA(355.3,IBP,0))
  1. ....S IBV1=$P(IBPD,"^",$S(IBR="AGNA":3,1:4))
  1. ....I +IBPD'=IBC!(IBV'=IBV1) S IBCT(IBR)=$G(IBCT(IBR))+1 K ^IBA(355.3,IBR,IBC,IBV,IBP)
  1. Q
  1. ;
  1. AB ; Delete errant Annual benefits from file #355.4
  1. S IBC=0 F S IBC=$O(^IBA(355.4,IBC)) Q:'IBC S IBX=$G(^(IBC,0)) D
  1. .S IBV=0 I '$P(IBX,"^",2) S IBV=1
  1. .I 'IBV,'$D(^IBA(355.3,+$P(IBX,"^",2),0)) S IBV=1
  1. .I IBV S DA=IBC,DIK="^IBA(355.4,",DIDEL=355.4 D ^DIK S IBCT("AB")=$G(IBCT("AB"))+1
  1. Q
  1. ;
  1. BU ; Delete errant Benefits Used from file #355.5
  1. S IBC=0 F S IBC=$O(^IBA(355.5,IBC)) Q:'IBC S IBX=$G(^(IBC,0)) D
  1. .S IBV=0 I 'IBX S IBV=1
  1. .I 'IBV,'$D(^IBA(355.3,+IBX,0)) S IBV=1
  1. .I 'IBV,$P($G(^DPT(+$P(IBX,"^",2),.312,+$P(IBX,"^",17),0)),"^",18)'=+IBX S IBV=1
  1. .I IBV S DA=IBC,DIK="^IBA(355.5,",DIDEL=355.5 D ^DIK S IBCT("BU")=$G(IBCT("BU"))+1
  1. Q
  1. ;
  1. RIDER ; Delete errant Riders from file #355.7
  1. S IBC=0 F S IBC=$O(^IBA(355.7,IBC)) Q:'IBC S IBX=$G(^(IBC,0)) D
  1. .S IBV=0 I '$D(^DPT(+$P(IBX,"^",2),.312,+$P(IBX,"^",3),0)) S IBV=1
  1. .I IBV S DA=IBC,DIK="^IBA(355.7,",DIDEL=355.7 D ^DIK S IBCT("RD")=$G(IBCT("RD"))+1
  1. Q
  1. ;
  1. IR ; Repoint Insurance Reviews in file #356.2
  1. S IBC=0 F S IBC=$O(^IBT(356.2,IBC)) Q:'IBC S IBX=$G(^(IBC,0)),IBX1=$G(^(1)) D
  1. .S IBCDFN=+$P(IBX1,"^",5),IBCDFND=$G(^DPT(+$P(IBX,"^",5),.312,IBCDFN,0))
  1. .K IBVAL
  1. .I IBCDFN,IBCDFND,+$P(IBX,"^",8)'=+IBCDFND S IBVAL=+IBCDFND
  1. .I IBCDFN,'IBCDFND S IBVAL=0
  1. .I $G(IBVAL)]"" D
  1. ..I IBVAL S DA=IBC,DR=".08////"_+IBCDFND,DIE="^IBT(356.2," D ^DIE K DIE,DA,DR
  1. ..I 'IBVAL S $P(^IBT(356.2,IBC,1),"^",5)=""
  1. ..S IBCT("IR")=$G(IBCT("IR"))+1
  1. K IBX1,IBCDFN,IBCDFND,IBVAL
  1. Q
  1. ;
  1. MAIL ; Send results out.
  1. S XMSUB="Patch IB*2*28 Insurance Clean-up Completion"
  1. S XMDUZ="INTEGRATED BILLING PACKAGE",XMTEXT="IBT(",XMY(DUZ)=""
  1. ;
  1. K IBT
  1. S IBT(1)="The Insurance Files clean-up job has completed."
  1. S IBT(2)=" "
  1. S Y=IBBDT D D^DIQ S IBT(3)="Job Start Time: "_Y
  1. S Y=IBEDT D D^DIQ S IBT(4)=" Job End Time: "_Y
  1. S IBT(5)=" "
  1. S IBT(6)=" Number of AGNA cross references in file #355.3 deleted: "_+$G(IBCT("AGNA"))
  1. S IBT(7)=" Number of AGNU cross references in file #355.3 deleted: "_+$G(IBCT("AGNU"))
  1. S IBT(8)="Number of errant Annual Benefits in file #355.4 deleted: "_+$G(IBCT("AB"))
  1. S IBT(9)=" Number of errant Benefits Used in file #355.5 deleted: "_+$G(IBCT("BU"))
  1. S IBT(10)="Number of errant Personal Riders in file #355.7 deleted: "_+$G(IBCT("RD"))
  1. S IBT(11)=" Number of Insurance Reviews in file #356.2 repointed: "_+$G(IBCT("IR"))
  1. ;
  1. D ^XMD
  1. Q