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

PSGMAR2.m

Go to the documentation of this file.
PSGMAR2 ;BIR/CML3-PRINT 24 HOUR MAR(UD) ;14 Oct 98 / 4:28 PM
 ;;5.0; INPATIENT MEDICATIONS ;**20,111,131,145**;16 DEC 97;Build 17
 ;
S1 I PSGMARB'=2 S:PSGMARS'=2 (PST,OPST)="C" D:PSGMARS'=2 HEADER^PSGMAR3,BOT^PSGMAR3 S:PSGMARS'=1 (PST,OPST)="P" D:PSGMARS'=1 HEADER^PSGMAR3,BOT^PSGMAR3 Q:PSGMARB=1
 D NOW^%DTC S PSGDT=%,(PST,OPST)=""
 S PSGMPG=0,PSGMPGN="PAGE: "
 I PSGSS="P"!(PSGSS="C")!(PSGSS="L") D P Q
 D W
 Q
 ;
P ;***Print on Patient order
 ;
 ;
 I $O(^TMP($J,PN,PWDN,0))'["C" S (PST,OPST)="C" D HEADER^PSGMAR3,BOT^PSGMAR3 S (PST,OPST)=""
 F  S PST=$O(^TMP($J,PN,PWDN,PST)) Q:PST=""  D:$E(OPST)'=$E(PST) BOT^PSGMAR3:OPST]"",HEADER^PSGMAR3 S OPST=PST,DAO="" D
 . F  S DAO=$O(^TMP($J,PN,PWDN,PST,DAO)) Q:DAO=""  S PSGMARTS=^TMP($J,PN,PWDN,PST,DAO) D PRT
 I $O(^TMP($J,PN,PWDN,"CV6"))="" D BOT^PSGMAR3 S (PST,OPST)="O" D HEADER^PSGMAR3
 S PSGMPGN="LAST PAGE: " D BOT^PSGMAR3
 Q
 ;
W ;***Print Ward/Ward group
 ;DAM 5-01-07  Utilize the XTMP global while reverses patient name and location
 I $S(PSGRBPPN="P":$O(^XTMP(PSGREP,TM,PN,WDN,RB,0)),1:$O(^TMP($J,TM,WDN,RB,PN,0)))'["C" S (PST,OPST)="C" D HEADER^PSGMAR3,BOT^PSGMAR3 S (PST,OPST)=""
 ;
 D:PSGRBPPN="P" PPN D:PSGRBPPN="R" RB
 Q
 ;
PPN ;***Sort by Patient
 ;
 ;DAM - 5-01-07 Utilize the XTMP global set up in PSGMAR0 when printing by WARD/PATIENT or WARD GROUP/PATIENT 
 F  S PST=$O(^XTMP(PSGREP,TM,PN,WDN,RB,PST)) Q:PST=""  D:$E(OPST)'=$E(PST) BOT^PSGMAR3:OPST]"",HEADER^PSGMAR3 S OPST=PST,DAO="" D
 . F  S DAO=$O(^XTMP(PSGREP,TM,PN,WDN,RB,PST,DAO)) Q:DAO=""  S PSGMARTS=^(DAO) D PRT
 I $O(^XTMP(PSGREP,TM,PN,WDN,RB,"CV6"))="" D BOT^PSGMAR3 S (PST,OPST)="O" D HEADER^PSGMAR3
 S PSGMPGN="LAST PAGE: " D BOT^PSGMAR3
 ;
 Q
 ;
RB ;***Sort by Room bed
 F  S PST=$O(^TMP($J,TM,WDN,RB,PN,PST)) Q:PST=""  D:$E(OPST)'=$E(PST) BOT^PSGMAR3:OPST]"",HEADER^PSGMAR3 S OPST=PST,DAO="" D
 . F  S DAO=$O(^TMP($J,TM,WDN,RB,PN,PST,DAO)) Q:DAO=""  S PSGMARTS=^(DAO) D PRT
 I $O(^TMP($J,TM,WDN,RB,PN,"CV6"))="" D BOT^PSGMAR3 S (PST,OPST)="O" D HEADER^PSGMAR3
 S PSGMPGN="LAST PAGE: " D BOT^PSGMAR3
 Q
 ;
PRT ; order info
 NEW MARLB,DRUGNAME,NAME
 S ON=$P(DAO,U,2) D ONHOLD^PSGMMAR2
 I +PSGMSORT,$S(ON["V":1,ON["P":$P($G(^PS(53.1,+ON,0)),U,4)="F",1:0) D PRT^PSGMIV Q
 D:PSGMAROC>5 ENB^PSGMAR3,HEADER^PSGMAR3 I PST["V" D PRT^PSGMIV Q
 S TMSTR=$P(PSGMARTS,"^",2),PSGMARTS=$P(PSGMARTS,"^"),PSGORD=$P(DAO,U,2) S:PSGORD["P" PSJPSTO=PST,PST=$S(+PSGMSORT:"CZ",1:PST) D ^PSGLOI,TS^PSGMAR3(PSGMARTS),MARLB^PSGMUTL(47)
 I (PSGMAROC>4&(MARLB>6))!(TS/6>6)!((TS/6+PSGMAROC)>6) D BOT^PSGMAR3,HEADER^PSGMAR3
 S PSGMAROC=PSGMAROC+1
 NEW PSGX F PSGX=1:1:MARLB W !,MARLB(PSGX) W:PST["C" ?48,"|",$G(TS(PSGX)) D PRT2
 I $D(PSJPSTO) S PST=PSJPSTO K PSJPSTO
 Q
PRT2 ;
 W ?55,"|"
 I PSGX=3,(PST'["Z"),(PST["C") D TMSTR^PSGMAR3
 I PSGMAROC>5,(TS/6>7) D
 . S MSG1="*** CONTINUE ON NEXT PAGE ***"
 . D BOT^PSGMAR3,HEADER^PSGMAR3
 I PSGX#6=0 W:PSGMAROC<6 !?7,LN2 S:PSGX'=MARLB PSGMAROC=PSGMAROC+1
 Q