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

ACHSPDC1.m

Go to the documentation of this file.
ACHSPDC1 ; IHS/ITSC/PMF - CONTINUATION OF VIEW/PRINT DOCUMENTS FOR PAITENT ;   [ 10/16/2001   8:16 AM ]
 ;;3.1;CONTRACT HEALTH MGMT SYSTEM;;JUN 11, 2001
 ;
START ;EP - From TaskMan.
 S:$D(ZTQUEUED) ACHSQUIT=0
 D FC^ACHSUF
 I $G(ACHSERR)=1 G K
 S (ACHSTOT,ACHSCANC,ACHSCTOT,ACHSTOT("$"),ACHSDOC)=0
 S ACHST1=$$C^XBFUNC("PATIENT: "_$P(^DPT(DFN,0),U)_"    CHART #: "_$$HRN^ACHS(DFN,DUZ(2)),80)
 S ACHST2=$$C^XBFUNC("For the period "_$$FMTE^XLFDT(ACHSBDT)_" through "_$$FMTE^XLFDT(ACHSEDT),80)
 S ACHSTOS=$P(^DD(9002080.01,3,0),U,3),ACHSSTS=$P(^DD(9002080.01,11,0),U,3),ACHST3=$$C^XBFUNC($S(ACHSRPT:$P($P(ACHSTOS,";",ACHSRPT),":",2)_" documents ONLY",1:"All Documents"),80)
 D BRPT^ACHSFU
 X:$D(IO("S")) ACHSPPO
 D HDR
DUZ2 ;
 K ACHSDVEW
 S ACHSVQIT=0
 D FC
 S ACHSFAC=$P(^AUTTLOC($O(^AUTTLOC("B",DUZ(2),0)),0),U,10)
A ; Main loop.
 S ACHSDOC=$O(^ACHSF(DUZ(2),"PB",DFN,ACHSDOC))
 G END:ACHSDOC=""
 S ACHSDOC0=$G(^ACHSF(DUZ(2),"D",ACHSDOC,0))
 G A:+$P(ACHSDOC0,U,2)<ACHSBDT,A:+$P(ACHSDOC0,U,2)>ACHSEDT,A:(ACHSRPT'="ALL")&(ACHSRPT'=$P(ACHSDOC0,U,4))
 W ACHSFAC,?7,$P(ACHSDOC0,U,14),ACHSFC,$P(ACHSDOC0,U)
 K Y
 I $D(^ACHSF(DUZ(2),"D",ACHSDOC,3)),+$P(^(3),U)>0 S Y=+$P(^(3),U)
 S:'$D(Y) Y=+$P(ACHSDOC0,U,2)
 W ?17,$E(Y,2,7)
 I +$P(ACHSDOC0,U,8),$D(^AUTTVNDR(+$P(ACHSDOC0,U,8),0)) W ?24,$E($P(^(0),U),1,22)
 W ?47,$E($P($P(ACHSTOS,";",$P(ACHSDOC0,U,4)),":",2),1,2)
 I $D(^ACHSF(DUZ(2),"D",ACHSDOC,"PA")) S X=$S($D(^("ZA")):+^("ZA"),1:+^("PA")) G P6
 S X=$S($D(^ACHSF(DUZ(2),"D",ACHSDOC,"PA")):+^("PA"),1:$P(ACHSDOC0,U,9))
 I $P(ACHSDOC0,U,12)=4 S X=0,ACHS=$O(^ACHSF(DUZ(2),"D",ACHSDOC,"T",0)) F  Q:+ACHS=0  S X=+$P(^(ACHS,0),U,4),ACHS=$O(^ACHSF(DUZ(2),"D",ACHSDOC,"T",ACHS))
 I $P(ACHSDOC0,U,12)=4 S ACHSCANC=ACHSCANC+X
P6 ;
 I $P(ACHSDOC0,U,12)]"" W ?52,$P($P(ACHSSTS,";",$P(ACHSDOC0,U,12)+1),":",2)
 S ACHSTOT("$")=ACHSTOT("$")+X,ACHSCTOT=ACHSTOT("$")-ACHSCANC
 W ?69
 S X3=10
 D FMT^ACHS
 W !
 I IOST["C-",$Y>24 G DISPLAY
 ;
 I IOST'["C-",$Y>ACHSBM D CPI^ACHS D RTRN^ACHS G K:$G(ACHSQUIT) D HDR
 S ACHSTOT=ACHSTOT+1
 G A
 ;
END ;
 W ?69,"----------",!,"Total documents seen: ",ACHSTOT,?69
 S X=ACHSTOT("$"),X3=10
 D FMT^ACHS
 W !!?45,"LESS CANCELS",?68
 S X=-ACHSCANC,X3=10
 D FMT^ACHS
 W !?69,"==========",!?69
 S X=ACHSCTOT,X3=10
 D FMT^ACHS
 I IOST["C-",$Y>15 S ACHSVQIT=1 D DISPLAY
 D:IOST'["C-" CPI^ACHS
K ;EP - Kill vars, do ERPT, quit.
 D EN^XBVK("ACHS"),^ACHSVAR
 K DFN
 D ERPT^ACHS
 Q
 ;
HDR ; Print header.
 S ACHSPG=ACHSPG+1
 W @IOF
 D CPI^ACHS:IOST'["C-"
 W !,ACHS("*"),!?22,"CHS DOCUMENTS FOR A SPECIFIC PATIENT",!,ACHSUSR,?71,"Page",$J(ACHSPG,3),!,ACHST1,!,ACHST2,!,ACHST3,!,ACHS("*")
 W !,"FAC",?7,"DOCUMENT",?17,"DATED",?24,"VENDOR",?47,"TYPE",?52,"STATUS",?69,"AMOUNT",!,$$REPEAT^XLFSTR("-",79),!
 Q
 ;
FC ; Set Finance Code.
 S ACHSFC=$P(^AUTTLOC(DUZ(2),0),U,17)
 I $L(ACHSFC)'=3 S ACHSFC="???" Q
 S ACHSFC=$P(^AUTTAREA($P(^AUTTLOC(DUZ(2),0),U,4),0),U,3)_$E(ACHSFC,2,3)
 Q
 ;
DISPLAY ; View document selected from the report.
 K DIR
 S DIR(0)="Y",DIR("A")="Do you want to view one of the documents listed",DIR("B")="NO"
 D ^DIR
 K DIR
 I Y=0,ACHSVQIT=0 D HDR S ACHSTOT=ACHSTOT+1 G A
 I Y=0 Q
 I ACHSVQIT=1,Y=0,ACHSPG>1,$Y>24 G AGAIN
 S ACHSDVEW=0
 D ^ACHSAD
 K DIR
 S DIR(0)="E"
 W !!
 D ^DIR
 G K:Y=0
 I ACHSVQIT'=1 D HDR G A
AGAIN ;
 K DIR
 S DIR(0)="Y",DIR("A")="View document list again",DIR("B")="NO"
 W !!!
 D ^DIR
 I Y=1 S (ACHSVQIT,ACHSTOT,ACHSTOT("$"),ACHSPG)=0,ACHSDOC="" D HDR G A
 G K
 ;