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

ORQOAUIA.m

Go to the documentation of this file.
ORQOAUIA ;EPIP/RTW - DAILY TASK RETRIEVE ASSOCIATED ORDER FOR A QUICK ORDER ; 12/29/17 10:03am
 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**441**;Dec 17, 1997;Build 52
 ;ICR#   Type  Description
 ;-----  ----  -------------------------------------
 ;2053   Sup   FILE^DIE
 ;10103  Sup   $$FMTE^XLFDT
 Q  ;No direct entry
START ; ENTRY POINT
 N ORDAT,ORDAT2,ORDATORD,ORDTQUIC,ORDFN,ORDFNPLS,ORFND,ORI,ORJ,ORJJ,ORJO,ORK,ORKK,ORKK0,ORDITEM,ORQOIFN,ORREPLCD,ORSTOP,ORX,ORX0,ORD1
 S ORDAT=$$FMADD^XLFDT(DT,-30) ; PROCESS RECORDS UP TO 30 DAYS OLD
 I '$D(ZTQUEUED) W !,"Audit#",?10,"Order",?20,"Comment"
 F  S ORDAT=$O(^OR(100.95,"B",ORDAT)) Q:+ORDAT'>0  S ORI=0 F  S ORI=$O(^OR(100.95,"B",ORDAT,ORI)) Q:+ORI'>0  D
 . S ORX0=^OR(100.95,ORI,0),ORQOIFN=$P(ORX0,U,4)
 . Q:$P(ORX0,U,8)>0  ;Quit if entry already has a ORDER NUMBER.
 . Q:ORQOIFN=""  ;NO QUICK ORDER RECORDED
 . ;S ORD1=$O(^ORD(101.41,ORQOIFN,6,"D",4,0))
 . S ORDFN=$P(ORX0,U,3),ORDFNPLS=ORDFN_";DPT("
 . S (ORDAT2,ORSTOP)=0 F  S ORDAT2=$O(^OR(100,"ACT",ORDFNPLS,ORDAT2)) Q:+ORDAT2'>0!(ORSTOP)  S ORJJ=0 F  S ORJJ=$O(^OR(100,"ACT",ORDFNPLS,ORDAT2,ORJJ)) Q:+ORJJ'>0  D
 .. S ORJ=0 F  S ORJ=$O(^OR(100,"ACT",ORDFNPLS,ORDAT2,ORJJ,ORJ)) Q:+ORJ'>0!(ORSTOP)  D
 ... S ORDATORD=$P(^OR(100,ORJ,0),"^",7)+.000099 ;DATE/TIME ORDER ENTERED
 ... S ORDTQUIC=$P(^OR(100.95,ORI,0),"^",1) ;DATE/TIM OFAUDIT RECORD
 ... S ORREPLCD=$P($G(^OR(100,ORJ,3)),U,5) ;REPLACED ORDER number if any.
 ... S ORJO=ORJ D SCAN I 'ORFND,ORREPLCD>0 S ORJO=ORREPLCD D SCAN
 Q
SCAN ;
 ;LOOK FOR AUDIT IFN IN COMMENTS, STORE IFN OF ORDER IN AUDIT FILE
 N DA,DIC,DIE,DLAYGO,DR
 S ORFND=0
 ;
 I $D(^OR(100,ORJO,8,0)) S ORK=0 F  S ORK=$O(^OR(100,ORJO,8,ORK)) Q:+ORK'>0  D
 . I $D(^OR(100,ORJO,8,ORK,.1,0)) S ORKK=0 F  S ORKK=$O(^OR(100,ORJO,8,ORK,.1,ORKK)) Q:ORKK'>0  D
 . . S ORKK0=^OR(100,ORJO,8,ORK,.1,ORKK,0) I ORKK0["** Pharmacy Confirmation",ORKK0[ORI S ORSTOP=1,DA=ORI,DR="7///"_ORJO,DIE="^OR(100.95,",DLAYGO=100.95,DIC(0)="L" D ^DIE
 Q