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

APSPDRX.m

Go to the documentation of this file.
  1. APSPDRX ; IHS/DSD/ENM/PLS - DAILY RX LOG;11-Jun-2013 18:05;PLS
  1. ;;7.0;IHS PHARMACY MODIFICATIONS;**1008,1016**;Sep 23, 2004;Build 74
  1. EP ;ENTRY POINT
  1. INIT ;
  1. D:'$D(PSOPAR) ^PSOLSET I '$D(PSOPAR) W !,"No Site Param's Defined!..quitting." Q
  1. N APSPBD,APSPED,APSBDF,APSPEDF,APSPDIV
  1. ;S APSPDIV=$S($D(^PS(59,PSOSITE,0)):$P(^(0),U,6),1:"") ;SITE NBR
  1. W @IOF
  1. W "Pharmacy Daily Rx Report",!!
  1. D ASKDATES^APSPUTIL(.APSPBD,.APSPED,.APSPQ,DT,DT)
  1. Q:APSPQ
  1. S APSPBDF=$P($TR($$FMTE^XLFDT(APSPBD,"5Z"),"@"," "),":",1,2)
  1. S APSPEDF=$P($TR($$FMTE^XLFDT(APSPED,"5Z"),"@"," "),":",1,2)
  1. S APSPBD=APSPBD-.01,APSPED=APSPED+.99
  1. ;SELECT DIVISION
  1. S APSPDIV=$$DIR^APSPUTIL("Y","Would you like all pharmacy divisions","Yes",,.APSPQ)
  1. Q:APSPQ
  1. I APSPDIV D
  1. .S APSPDIV="*"
  1. E D Q:APSPQ
  1. .S APSPDIV=$$GETIEN^APSPUTIL(59,"Select Pharmacy Division: ",.APSPQ)
  1. Q:APSPQ
  1. D DEV
  1. Q
  1. DEV ;
  1. N XBRP,XBNS
  1. S XBRP="OUT^APSPDRX"
  1. S XBNS="APS*"
  1. D ^XBDBQUE
  1. Q
  1. OUT N APSPG,APSPDT,APSPRN,APSPLN,FTYPE,APSPOUT,APSPRX
  1. N APSPDFN,APSPDG,APSPNM,APSPPRV,DIV,APSPSTN,QTY
  1. U IO
  1. K ^TMP($J,"APSPX")
  1. S APSPG=0,APSPOUT=""
  1. S APSPDT=APSPBD F S APSPDT=$O(^PSRX("ZAL",APSPDT)) Q:'APSPDT!(APSPDT>APSPED) D PRT
  1. D PRNT W !!,"End of Report"
  1. Q
  1. PRT ;
  1. S RXIEN=0 F S RXIEN=$O(^PSRX("ZAL",APSPDT,RXIEN)) Q:'RXIEN D PR1
  1. Q
  1. PR1 S APSPLN=0 F S APSPLN=$O(^PSRX("ZAL",APSPDT,RXIEN,APSPLN)) Q:'APSPLN D PR2
  1. Q
  1. PR2 S FTYPE="" F S FTYPE=$O(^PSRX("ZAL",APSPDT,RXIEN,APSPLN,FTYPE)) Q:FTYPE="" D DSET
  1. Q
  1. DSET ;
  1. N NXT
  1. S NXT=$O(^TMP($J,"DATA",$C(1)),-1)
  1. S NXT=NXT+1
  1. S APSPRX=$P($G(^PSRX(RXIEN,0)),U)
  1. S APSPDFN=$P($G(^(0)),U,2)
  1. S APSPDG=$P($G(^(0)),U,6)
  1. S APSPDRG=$P($G(^PSDRUG(APSPDG,0)),U)
  1. S APSPPRV=$$GET1^DIQ($S(FTYPE="P":52.2,FTYPE="R":52.1,1:52),$S("PR"[FTYPE:APSPLN_","_RXIEN_",",1:RXIEN),$S(FTYPE="P":6,FTYPE="R":15,1:4),"I")
  1. S DIV=$$GET1^DIQ($S(FTYPE="P":52.2,FTYPE="R":52.1,1:52),$S("PR"[FTYPE:APSPLN_","_RXIEN_",",1:RXIEN),$S(FTYPE="P":.09,FTYPE="R":8,1:20),"I") ; Pharmacy Division IEN
  1. S QTY=$$GET1^DIQ($S(FTYPE="P":52.2,FTYPE="R":52.1,1:52),$S("PR"[FTYPE:APSPLN_","_RXIEN_",",1:RXIEN),$S(FTYPE="P":.04,FTYPE="R":1,1:7))
  1. Q:'$$DIVVRY(DIV,APSPDIV)
  1. ;S APSPCN=$$HRN^AUPNPAT(APSPDFN,$$GET1^DIQ(59,DIV,.06,"I"))
  1. S APSPCN=$$HRN^AUPNPAT(APSPDFN,$$GET1^DIQ(59,DIV,100,"I")) ;IHS/MSC/PLS - 06/11/13
  1. S ^TMP($J,"APSPX",DIV,APSPDT,APSPRX,NXT)=""
  1. S ^TMP($J,"DATA",NXT)=APSPRX_U_APSPDFN_U_APSPDRG_U_APSPPRV_U_QTY_U_APSPCN_U_FTYPE
  1. Q
  1. ; Return boolean flag indicating valid pharmacy division
  1. DIVVRY(RXDIV,RPTDIV) ;EP
  1. Q:RPTDIV="*" 1
  1. Q RXDIV=RPTDIV
  1. PRNT S (APSPDP,APSPZX)="" D HDR,DSPL
  1. Q
  1. DSPL ;GET DATA FROM TMP GBL
  1. N DIV,DIVNM,APSP,APSPDT,APSPRX,APSPNM,NXT
  1. S DIV="" F S DIV=$O(^TMP($J,"APSPX",DIV)) Q:'DIV D ;GET DIVISION
  1. .S DIVNM=$$GET1^DIQ(59,DIV,.01)
  1. .S APSPDT=0 F S APSPDT=$O(^TMP($J,"APSPX",DIV,APSPDT)) Q:'APSPDT!($G(APSPOUT)) D
  1. ..S APSPRX="" F S APSPRX=$O(^TMP($J,"APSPX",DIV,APSPDT,APSPRX)) Q:'$L(APSPRX)!($G(APSPOUT)) D
  1. ...S NXT=0 F S NXT=$O(^TMP($J,"APSPX",DIV,APSPDT,APSPRX,NXT)) Q:'NXT D DSPS Q:$G(APSPOUT)
  1. Q
  1. DSPS S APSP=^TMP($J,"DATA",NXT)
  1. S APSPNM=$$GET1^DIQ(2,+$P(APSP,U,2),.01)
  1. S APSPP=$P(APSP,U,4)
  1. S APSPQ=$P(APSP,U,5)
  1. S APSPCN=$P(APSP,U,6)
  1. S FTYPE=$P(APSP,U,7)
  1. D:$Y+4>IOSL HDR Q:$G(APSPOUT)
  1. S APSPTYP=$S(FTYPE="N":"NEW RX",FTYPE="R":"REFILL",FTYPE="P":"PARTIAL",1:"")
  1. W !,"Rx #: "_APSPRX,?17,"Name: "_APSPNM,?54,"Chart #: "_$P(APSP,U,6)
  1. W !,"DRUG: "_$P(APSP,U,3),?37,"Qty: "_$P(APSP,U,5),?47,"Provider: "_$$GET1^DIQ(200,$P(APSP,U,4),.01)
  1. W !,"Division: "_DIVNM,?37,APSPTYP,?53,"D/Time: "_$TR($$FMTE^XLFDT($E(APSPDT,1,12),"5Z"),"@"," ")
  1. W !
  1. Q
  1. HDR I APSPG,$E(IOST)="C" K DIR S DIR(0)="FO",DIR("A")="Press Return to Continue or ""^"" to Exit" D ^DIR I X["^" S APSPOUT=1 Q
  1. S APSPG=APSPG+1
  1. W @IOF,?38,"(",APSPG,")",!,"DAILY PRESCRIPTION ACTIVITY REPORT"
  1. W ?51,"Print Date: ",?59,$TR($$FMTE^XLFDT($E($$NOW^XLFDT(),1,12),"5Z"),"@"," "),!
  1. W ?5,"Pharmacy Division: "_$S(APSPDIV:$$GET1^DIQ(59,APSPDIV,.01),1:"All"),!
  1. F I=1:1:80 W "."
  1. W !,?10,"For Rx's dispensed from "_APSPBDF_" to "_APSPEDF,!!
  1. Q