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

ACDDE3C.m

Go to the documentation of this file.
ACDDE3C ;IHS/ADC/EDE/KML - COPY SET FOR CLIENT SERVICES; 
 ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
GENCSM ; EP - MAIN
 N ACDQ,ACDY
 ;//^ACDDE3B
 K ACDCSCS
 S DIR(0)="S^1:Create New Group;2:Edit Existing Group" S DIR("B")="2" K DA D ^DIR K DIR
 Q:'Y
 S ACDY=Y
 S ACDCSPGM=$S(ACDY=1:"^ACDCSCS",1:"GENCSMGC")
 D @ACDCSPGM Q:ACDQ
 D GENCSM2
 K ACDCSCS,ACDCSP
 Q
 ;
GENCSM2 ; GENERATE A COPY SET OF CLIENT SVCS
 D GENCSMCH ;          check copy set for changes
 Q:ACDQ  ;             quit if not good copy set
 D GENCSMCK ;          check copy set for required entries
 Q:ACDQ  ;             quit if not good copy set
 D GENCSMGR ;          generate CS records for copy set
 Q
 ;
GENCSMGC ; GET COPY SET
 S ACDQ=1
 W !
 S DIC="^ACDCSCS(",DIC(0)="AEMQ",DIC("S")="I $P(^(0),U,2)=ACDPGM"
 D DIC^ACDFMC
 Q:Y<0
 S ACDCSCS=+Y
 S ACDQ=0
 Q
 ;
GENCSMCH ; CHECK COPY SET FOR CHANGES
 S ACDQ=0
 ; place copy set into acdcscs array
 S X=^ACDCSCS(ACDCSCS,0)
 S ACDCSCS(.01)=$P(X,U),X=$P(X,U,3),ACDCSCS(.03)=X D PFTV^XBPFTV(9002170.8,X,.Z) S ACDCSCS(.03,Z)=""
 S Y=0 F ACDY=1:1 S Y=$O(^ACDCSCS(ACDCSCS,11,Y)) Q:'Y  S X=^(Y,0) D
 . S ACDCSCS(ACDY,.01)=$P(X,U),ACDCSCS(ACDY,.02)=$P(X,U,2) D PFTV^XBPFTV(9002170.6,$P(X,U),.Z) S ACDCSCS(ACDY,.01,Z)=""
 .;F ACDY2=0:0 S ACDY2=$O(^ACDCSCS(ACDCSCS,11,Y,11,ACDY2)) Q:'ACDY2  S X=^(ACDY2,0),ACDCSCS(ACDY,1100,ACDY2)=$P(X,U) D PFTV^XBPFTV(6,$P(X,U),.Z) S ACDCSCS(ACDY,1100,ACDY2,Z)=""
 . F ACDY2=0:0 S ACDY2=$O(^ACDCSCS(ACDCSCS,11,Y,11,ACDY2)) Q:'ACDY2  S X=^(ACDY2,0),ACDCSCS(ACDY,1100,ACDY2)=$P(X,U),Z=$P($G(^VA(200,$P(X,U),0)),U) S:Z="" Z=$P(X,U) S ACDCSCS(ACDY,1100,ACDY2,Z)=""
 . Q
 ;
 W ! S DIC="^ACDCSCS(",DA=ACDCSCS D DIQ^ACDFMC,PAUSE^ACDDEU
 W ! S DIR(0)="Y",DIR("A")="Accept copy set as is",DIR("B")="Y" K DA D ^DIR K DIR
 Q:Y  ;                 quit if ok as is
 W ! S DIR(0)="9002172.7,.03",DIR("B")=$O(ACDCSCS(.03,"")) K DA D ^DIR K DIR
 Q:Y["^"
 I +Y'=ACDCSCS(.03) K ACDCSCS(.03) S ACDCSCS(.03)=+Y,ACDCSCS(.03,Y(0,0))=""
 W ! F ACDY=1:1 Q:'$D(ACDCSCS(ACDY))  S X=$O(ACDCSCS(ACDY,.01,"")) W !,"SVC/ACT: ",X,?41,"HOURS: ",ACDCSCS(ACDY,.02),! D  D GENCSMED
 . F ACDY2=1:1 Q:'$D(ACDCSCS(ACDY,1100,ACDY2))  S X=$O(ACDCSCS(ACDY,1100,ACDY2,"")) W ?5,"PROVIDER: ",X,!
 . Q
 Q
 ;
GENCSMCK ; CHECK COPY SET FOR REQUIRED ENTRIES
 I '$O(ACDCSCS(.99)) S ACDQ=2 W !,IORVON,"No Client Services in Copy Set",IORVOFF,! D PAUSE^ACDDEU Q
 F Y=.99:0 S Y=$O(ACDCSCS(Y)) Q:'Y  I '$O(ACDCSCS(Y,1100,0)) S ACDQ=2,Z=$O(ACDCSCS(Y,.01,"")) W !,IORVON,"No Providers for svc/act ",Z,IORVOFF,!
 D:ACDQ PAUSE^ACDDEU
 Q
 ;
GENCSMED ; EDIT COPY SET
 S DIR(0)="S^1:Accept Client Service;2:Edit Client Service;3:Delete Client Service",DIR("B")="1" K DA D ^DIR K DIR
 W !
 Q:Y=1  ;                     quit if accepted
 I Y=3 K ACDCSCS(ACDY) Q  ;   Delete CS and quit
 ; must be 2 (Edit Client Service)
 S DIR(0)="9002172.711,.01",DIR("B")=$O(ACDCSCS(ACDY,.01,"")) K DA D ^DIR K DIR
 I +Y'=ACDCSCS(ACDY,.01) K ACDCSCS(ACDY,.01) S ACDCSCS(ACDY,.01)=+Y,ACDCSCS(ACDY,.01,Y(0,0))=""
 S DIR(0)="9002172.711,.02",DIR("B")=ACDCSCS(ACDY,.02) K DA D ^DIR K DIR
 I +Y'=ACDCSCS(ACDY,.02) K ACDCSCS(ACDY,.02) S ACDCSCS(ACDY,.02)=+Y
 ;
 F ACDY2=1:1 Q:'$D(ACDCSCS(ACDY,1100,ACDY2))  S DIR(0)="9002172.71111,.01",DIR("B")=$O(ACDCSCS(ACDY,1100,ACDY2,"")) K DA D ^DIR K DIR D
 . I $E(X)="@" K ACDCSCS(ACDY,1100,ACDY2) Q
 . I +Y'=ACDCSCS(ACDY,1100,ACDY2) K ACDCSCS(ACDY,1100,ACDY2) S ACDCSCS(ACDY,1100,ACDY2)=+Y,ACDCSCS(ACDY,1100,ACDY2,Y(0,0))=""
 . Q
 F ACDY2=ACDY2:1 D  Q:'Y
 . S DIR(0)="9002172.71111,.01" K DA D ^DIR K DIR
 . Q:'+Y
 . S ACDCSCS(ACDY,1100,ACDY2)=+Y,ACDCSCS(ACDY,1100,ACDY2,Y(0,0))=""
 . Q
 W !
 Q
 ;
GENCSMGR ; GENERATE CS RECORDS FOR COPY SET
 S ACDCSP=$P(^DD(9002172,100,0),U,2)
 S DIR(0)="9002172,.01" K DA D ^DIR K DIR
 I +Y<1!(+Y>31) S ACDQ=1 Q
 S ACDCSDAY=+Y
 W !
 F ACDY=.99:0 S ACDY=$O(ACDCSCS(ACDY)) Q:'ACDY  D  Q:ACDQ
 . S X=$O(ACDCSCS(ACDY,.01,"")) W "Adding CS ",X,!
 . S DIC="^ACDCS(",DIC(0)="L",DLAYGO=9002172,X=ACDCSDAY
 . S DIC("DR")="1////"_ACDCSCS(ACDY,.01)_";2////"_ACDCSCS(.03)_";3////"_ACDCSCS(ACDY,.02)_";7////"_DUZ_";99.99////"_ACDVIEN
 . D FILE^ACDFMC
 . I Y<0 W !,IORVON,"Creation of CDMIS CLIENT SVCS record failed.  Notify programmer.",IORVOFF,!! S ACDQ=1 S:$D(^%ZOSF("$ZE")) X="CDMIS CLIENT SVCS",@^("$ZE") D @^%ZOSF("ERRTN") D PAUSE^ACDDEU Q
 . S ACDCS(+Y)=""
 . S ACDCSIEN=+Y
 . F ACDY2=0:0 S ACDY2=$O(ACDCSCS(ACDY,1100,ACDY2)) Q:'ACDY2  D  Q:ACDQ
 .. S DIC="^ACDCS("_ACDCSIEN_",1,",DIC(0)="L",DIC("P")=ACDCSP,DA(1)=ACDY
 .. S X=ACDCSCS(ACDY,1100,ACDY2)
 .. D FILE^ACDFMC
 .. I Y<0 W !,IORVON,"Addition of provider to CLIENT SVCS record failed.  Notify programmer.",IORVOFF,!! S ACDQ=1 S:$D(^%ZOSF("$ZE")) X="CDMIS CLIENT SVCS PROVIDER",@^("$ZE") D @^%ZOSF("ERRTN") D PAUSE^ACDDEU Q
 .. Q
 . Q
 K ACDCSDAY,ACDCSIEN,ACDCSP
 Q