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

ACDPCCL4.m

Go to the documentation of this file.
ACDPCCL4 ;IHS/ADC/EDE/KML - PCC LINK;
 ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
 ;
GENBILL ; EP-GENERATE HARDCOPY BILL
 ;//^ACDPCCL
 W !,"Generating hardcopy for billing",!
 D GETDEV
 I POP W !,"No hardcopy generated",! Q
 D WRTBILL
 D EOJ
 Q
 ;
GETDEV ; EP-GET DEVICE FOR HARDCOPY OUTPUT
 S ACDDEV=$P($G(^ACDF5PI(ACDPGM,11)),U,4)
 S:ACDDEV]"" ACDDEV=$P($G(^%ZIS(1,ACDDEV,0)),U,2)
 S:ACDDEV]"" %ZIS("B")=ACDDEV
 D DEV^ACDDEU
 Q
 ;
WRTBILL ; WRITE HARDCOPY BILL
 I $D(IO("Q")) D  Q
 . S ZTRTN="WRTBILLQ^ACDPCCL4",ZTDESC="CDMIS HARDCOPY BILL",ZTDTH=$H,ZTSAVE("ACDEV")=""
 . D ^%ZTLOAD
 . Q
 D WRTBILLQ
 U 0
 Q
 ;
WRTBILLQ ; EP - FOR TASKMAN
 I $D(ACDSLAVE) S IOP=ACDSLAVE D ^%ZIS
 U IO
 D WRTBILLP
 K ACDPDD
 I $D(ACDSLAVE) W @IOF D ^%ZISC Q
 W:IOST["P-" @IOF
 I $D(ZTQUEUED) D ^ACDKILL S ZTREQ="@"
 D:IOST["P-" ^%ZISC
 Q
 ;
WRTBILLP ; EP
 ;//^ACDBILLP
 D GETPDATA
 S (ACDCSDTE,ACDLOC)=0 ;                so they exists if not 'CS'
 I ACDEV("TC")'="CS" D  Q
 . D HDR,WRTDATA
 . Q
 S ACDCSDTE=0
 F  S ACDCSDTE=$O(ACDEV("PROC",ACDCSDTE)) Q:ACDCSDTE=""  S ACDLOC=0 F  S ACDLOC=$O(ACDEV("PROC",ACDCSDTE,ACDLOC)) Q:'ACDLOC  D
 . S ACDEV("V DATE")=ACDCSDTE
 . S ACDEV("CS LOC")=ACDEV("PROC",ACDCSDTE,ACDLOC,"CS LOC")
 . S X=$G(ACDEV("PROC",ACDCSDTE,ACDLOC,"PCC LOC"))
 . I X S ACDEV("LOCATION")=X
 . S X=0
 . F Y=0:0 S Y=$O(ACDEV("PROC",ACDCSDTE,ACDLOC,Y)) Q:'Y  S X=X+ACDEV("PROC",ACDCSDTE,ACDLOC,Y,"TIME")
 . S ACDEV("TIME")=X
 . D HDR
 . D WRTDATA
 . Q
 Q
 ;
GETPDATA ;
 K ACDPDD
 S DIC=9000001,DR=".01;1101.2;1102.2;1107.2;1602.2:1606.2",DA=ACDEV("PAT"),DIQ="ACDPDD("
 D DIQ1^ACDFMC
 S ACDPDD(9000001,ACDEV("PAT"),1102.2)=$$DD^ACDFUNC(ACDPDD(9000001,ACDEV("PAT"),1102.2))
 S X=ACDPDD(9000001,ACDEV("PAT"),1107.2) I X]"",X'["-" S ACDPDD(9000001,ACDEV("PAT"),1107.2)=$E(X,1,3)_"-"_$E(X,4,5)_"-"_$E(X,6,9)
 Q
 ;
HDR ; WRITE HEADER
 W @IOF
 D CONF^ACDDEU
 Q
 ;
WRTDATA ;
 I $D(ACDMODEE) W "***** MODIFICATION OF PREVIOUS BILL *****",!
 W !,"PATIENT NAME:",?40,ACDPDD(9000001,ACDEV("PAT"),.01)
 W !,"  SEX:",?40,ACDPDD(9000001,ACDEV("PAT"),1101.2)
 W !,"  DOB:",?40,ACDPDD(9000001,ACDEV("PAT"),1102.2)
 W !,"  SSN:",?40,ACDPDD(9000001,ACDEV("PAT"),1107.2)
 W !,"  PHONE:",?40,ACDPDD(9000001,ACDEV("PAT"),1606.2)
 W !,"  ADDRESS:",?40,ACDPDD(9000001,ACDEV("PAT"),1602.2)
 W !,"  ",?40,ACDPDD(9000001,ACDEV("PAT"),1603.2),"  ",ACDPDD(9000001,ACDEV("PAT"),1604.2),"  ",ACDPDD(9000001,ACDEV("PAT"),1605.2)
 S X=ACDEV("PRI PROV"),Y="" I X,$D(^VA(200,X,0)) S Y=$P($G(^VA(200,X,"PS")),U,5),X=$P(^VA(200,X,0),U) I Y S Y=$P($G(^DIC(7,Y,0)),U,2)
 ;S X=ACDEV("PRI PROV"),Y="" I X,$D(^DIC(6,X,0)) S Y=$P(^DIC(6,X,0),U,4),X=$P(^DIC(16,X,0),U) I Y S Y=$P($G(^DIC(7,Y,0)),U,2)
 W !!,"PRIMARY PROVIDER:",?40,X,"  ",Y
 W !!,"VISIT DATE:",?40,$$DD^ACDFUNC(ACDEV("V DATE"))
 D PFTV^XBPFTV(9002170.1,ACDEV("COMP CODE"),.X)
 W !,"  COMPONENT CODE:",?40,X
 W !,"  COMPONENT TYPE:",?40,$$EXTSET^XBFUNC(9002172.1,5,ACDEV("COMP TYPE"))
 W !,"  TYPE CONTACT:",?40,$$EXTSET^XBFUNC(9002172.1,3,ACDEV("TC"))
 D PFTV^XBPFTV(9999999.06,ACDEV("LOCATION"),.X)
 W !,"  LOCATION:",?40,X
 I $G(ACDEV("CS LOC")) S X=$P($G(^ACDLOT(ACDEV("CS LOC"),0)),U) I X]"" W !,"  CLIENT SVC LOCATION:",?40,X
 W !,"  CLINIC:",?40,$P(^DIC(40.7,ACDEV("CLINIC"),0),U)
 W !,"  SERVICE CATEGORY:",?40,$$EXTSET^XBFUNC(9000010,.07,ACDEV("SVC CAT"))
 W !,"  TIME:",?40,ACDEV("TIME")_" MINUTES"
 W !,"  THIRD PARTY COVERAGE:"
 S ACDY=0
 I $$MCR^AUPNPAT(ACDEV("PAT"),ACDEV("V DATE")) S ACDY=1 W ?40,"MEDICARE",!
 I $$MCD^AUPNPAT(ACDEV("PAT"),ACDEV("V DATE")) S ACDY=1,ACDX=$$MCDPN^AUPNPAT(ACDEV("PAT"),ACDEV("V DATE"),"E") S:ACDX="" ACDX="MEDICAID PLAN UNKNOWN" W ?40,ACDX,!
 I $$PI^AUPNPAT(ACDEV("PAT"),ACDEV("V DATE")) S ACDY=1,ACDX=$$PIN^AUPNPAT(ACDEV("PAT"),ACDEV("V DATE"),"E") S:ACDX="" ACDX="PLAN UNKNOWN" W ?40,ACDX,!
 I 'ACDY W ?40,"NONE"
 S ACDY=0
 F  S ACDY=$O(ACDEV("POV",ACDY)) Q:'ACDY  D
 . S ACDX=ACDEV("POV",ACDY)
 . D F W !!,"PURPOSE OF VISIT:",?20,$P(ACDX,":",2),!,?20,$P(ACDX,":",3)
 . Q
 S ACDY=0
 F  S ACDY=$O(ACDEV("PROC",ACDCSDTE,ACDLOC,ACDY)) Q:'ACDY  D
 . S ACDX=ACDEV("PROC",ACDCSDTE,ACDLOC,ACDY,"NARR")
 . D F W !!,"SERVICE:",?20,$P(ACDX,":",2),?40,"(",ACDEV("PROC",ACDCSDTE,ACDLOC,ACDY,"TIME")_" MINUTES)",!,?20,$P(ACDX,":",3)
 . Q
 S ACDPROV=0
 F  S ACDPROV=$O(ACDEV("PROC",ACDCSDTE,ACDLOC,"PROV",ACDPROV)) Q:'ACDPROV  D
 . S X=ACDPROV,Y="" I X,$D(^VA(200,X,0)) S Y=$P($G(^VA(200,X,"PS")),U,5),X=$P(^VA(200,X,0),U) I Y S Y=$P($G(^DIC(7,Y,0)),U,2)
 .;S X=ACDPROV,Y="" I X,$D(^DIC(6,X,0)) S Y=$P(^DIC(6,X,0),U,4),X=$P(^DIC(16,X,0),U) I Y S Y=$P($G(^DIC(7,Y,0)),U,2)
 . D F W !!,"PROVIDER:",?20,X,"  ",Y
 . Q
 W !!,"..........................................",!
 I IO=IO(0) D PAUSE^ACDDEU
 Q
 ;
F ;Form feed
 I $Y+4>IOSL D
 . I IO=IO(0) D PAUSE^ACDDEU
 . D HDR
 . Q
 Q
 ;
EOJ ; EP
 ;//^ACDBILLP
 K ACDCSDTE,ACDDEV,ACDLOC,ACDPDD,ACDPROV,ACDSLAVE,ACDX,ACDY
 Q