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

ORDEA02.m

Go to the documentation of this file.
ORDEA02 ;ISL/JLC - DEA PROVIDER REPORT ; 9/13/17 2:24pm
 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**371,465**;Dec 17, 1997;Build 7
 ;
 ;DBIA reference section
 ;10017 ^DD("DD"
 ;10003 DD^%DT
 ;10063 $$S^%ZTLOAD
 ;10015 EN^DIQ1
 ;10103 $$NOW^XLFDT
 ;10070 ^XMD
 ; 4820 RX^PSO52API
 ;
 Q
EN ;TaskMan entry point
 N YR,MN,ORREPH,ORREP,ORPROV,BL,S1,S3,ORRX,DATA0,DATA1,DATA3,DATA5,ORPNM,ORDRUG,ORDEA,ORCNT,ORISS,Y,ORDT,DIC,DA,DR,DIQ,ORS,ORIFN
 S ZTSTOP=0 K ^TMP($J,"CS BY PROV")
 S DT=$$NOW^XLFDT,YR=$E(DT,1,3)+1700,MN=$E(100+$E(DT,4,5)-1,2,99) I MN<1 S MN=12,YR=YR-1
 S Y=YR-1700_MN D DD^%DT S ORREPH=Y,ORREP=YR-1700_$E(MN+100,2,3),ORPROV=0,$P(BL," ",99)=""
 F  S ORPROV=$O(^ORPA(101.52,"C",ORPROV)) Q:'ORPROV  D  I ZTSTOP Q
 . S S1=ORREP K ^TMP($J,"CS BY PROV") S ORCNT=0
 . F  S S1=$O(^ORPA(101.52,"C",ORPROV,S1)) Q:'S1  I $E(S1,1,5)=ORREP D
 .. S S3=0
 .. F  S S3=$O(^ORPA(101.52,"C",ORPROV,S1,S3)) Q:'S3  D
 ... S DATA0=$G(^ORPA(101.52,S3,0)),DATA1=$G(^(1)),DATA3=$G(^(3)),DATA5=$G(^(5))
 ... S ORIFN=$P(DATA0,"^"),ORRX=$P(DATA0,"^",2)
 ... I ORRX="" S DA=$P(^OR(100,ORIFN,3),"^",3) S DIC=100.01,DR=.01,DIQ="ORS" D EN^DIQ1 S ORRX=ORS(100.01,DA,.01)
 ... I ORRX S ORRX=$$RXNUM($P(DATA5,"^",2),ORRX)
 ... S ORRX=ORRX_BL,ORPNM=$P(DATA5,"^")_BL,ORDRUG=$E($P(DATA1,"^",2),1,22)_BL,ORDEA=$E($P(DATA1,"^",4))_BL
 ... I 'ORCNT D
 .... S ORCNT=ORCNT+1,^TMP($J,"CS BY PROV",ORCNT,0)=$E(BL,1,16)_"Monthly Controlled Substances Issued by Provider"
 .... S ORCNT=ORCNT+1,^TMP($J,"CS BY PROV",ORCNT,0)="Report for: "_ORREPH_" for "_$P(DATA3,"^",3)
 .... S ORCNT=ORCNT+1,^TMP($J,"CS BY PROV",ORCNT,0)=" "
 .... S ORCNT=ORCNT+1,^TMP($J,"CS BY PROV",ORCNT,0)=$E("PATIENT NAME"_BL,1,25)_$E("DRUG NAME"_BL,1,25)_"SCH  "_$E("ISSUE DATE"_BL,1,13)_$E("RX #"_BL,1,12)
 .... S ORCNT=ORCNT+1,^TMP($J,"CS BY PROV",ORCNT,0)=" "
 ... S Y=$P(DATA1,"^") X ^DD("DD") S ORISS=Y_BL
 ... S ORCNT=ORCNT+1,^TMP($J,"CS BY PROV",ORCNT,0)=$E(ORPNM,1,23)_"  "_$E(ORDRUG,1,24)_" "_$E(ORDEA)_"    "_$E(ORISS,1,13)_$E(ORRX,1,11)
 . D SEND K ^TMP($J)
 . S ZTSTOP=$$REQ2STOP()
 S ZTREQ="@" Q
SEND ;
 Q:'$D(^TMP($J,"CS BY PROV"))  N XMY,XMDUZ,XMSUB,XMTEXT
 S XMDUZ="CPRS,REPORT",XMY(ORPROV)="",XMSUB="MONTHLY CONTROLLED SUBSTANCES REPORT",XMTEXT="^TMP("_$J_",""CS BY PROV"","
 D ^XMD Q
REQ2STOP() ;
 ; Check for task stop request
 ; Returns 1 if stop request made.
 N STATUS,X
 S STATUS=0
 I '$D(ZTQUEUED) Q 0
 S X=$$S^%ZTLOAD()
 I X D  ;
 . S STATUS=1
 . S X=$$S^%ZTLOAD("Received shutdown request")
 ;
 Q STATUS
RXNUM(DFN,RXIEN) N RXNUM K ^TMP($J,"RX")
 S RXIEN=+$G(RXIEN)
 D RX^PSO52API(DFN,"RX",RXIEN,,0)
 S RXNUM=$G(^TMP($J,"RX",DFN,RXIEN,.01))
 K ^TMP($J,"RX")
 Q RXNUM