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

ORY423A.m

Go to the documentation of this file.
ORY423A ;ISP/JLC,RFR - POST-INSTALL FOR PATCH OR*3.0*350 ;06/29/16  06:17
 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**423**;Dec 17, 1997;Build 19
 Q
SQOCONV() ;CONVERT EXISTING OUTPATIENT MEDICATION QUICK ORDERS INTO SUPPLY QUICK ORDERS
 N DG,DLG,ORTEXT
 S DG("OUT")=$O(^ORD(100.98,"B","OUTPATIENT MEDICATIONS",0))
 I +DG("OUT")=0 D  Q 0
 .S ORTEXT(1)="Unable to find the OUTPATIENT MEDICATIONS display group in the DISPLAY GROUP"
 .S ORTEXT(2)="file (#100.98). Please log a Remedy ticket for assistance."
 .D BMES^XPDUTL(.ORTEXT)
 S DG("SUPPLY")=$O(^ORD(100.98,"B","SUPPLIES/DEVICES",0))
 I +DG("SUPPLY")=0 D  Q 0
 .S ORTEXT(1)="Unable to find the SUPPLIES/DEVICES display group in the DISPLAY GROUP file"
 .S ORTEXT(2)="(#100.98). Please log a Remedy ticket for assistance."
 .D BMES^XPDUTL(.ORTEXT)
 S DLG("ORDERABLE ITEM")=+$O(^ORD(101.41,"B","OR GTX ORDERABLE ITEM",0))
 I DLG("ORDERABLE ITEM")=0 D  Q 0
 .S ORTEXT(1)="Unable to find the OR GTX ORDERABLE ITEM dialog in the ORDER DIALOG file"
 .S ORTEXT(2)="(#101.41). Please log a Remedy ticket for assistance."
 N IEN,EXIT
 S IEN=0 F  S IEN=$O(^ORD(101.41,IEN)) Q:+$G(IEN)=0!($G(EXIT))  D
 .;SKIP DISABLED QUICK ORDER (FIELD #3 NOT BLANK)
 .Q:$P(^ORD(101.41,IEN,0),U,3)'=""
 .;SKIP NON-QUICK ORDER
 .Q:$P(^ORD(101.41,IEN,0),U,4)'="Q"
 .;SKIP NON-SUPPLY
 .Q:$P(^ORD(101.41,IEN,0),U,5)'=DG("SUPPLY")
 .;DETERMINE IF THE ORDERABLE ITEM IS A SUPPLY
 .N RIEN,ORPHOI,ORDRGIEN,SET
 .S RIEN=+$O(^ORD(101.41,IEN,6,"D",DLG("ORDERABLE ITEM"),0))
 .Q:RIEN=0
 .S ORPHOI=+$P($G(^ORD(101.41,IEN,6,RIEN,1)),U,1)
 .Q:ORPHOI=0
 .S ORPHOI=$P($G(^ORD(101.43,ORPHOI,0)),U,2)
 .Q:$P(ORPHOI,";",2)'="99PSP"
 .D DRGIEN^PSS50P7(+ORPHOI,,"ORSUPPLY")
 .Q:+^TMP($J,"ORSUPPLY",0)<1
 .S ORDRGIEN=0 F  S ORDRGIEN=$O(^TMP($J,"ORSUPPLY",ORDRGIEN)) Q:'+$G(ORDRGIEN)!($G(EXIT))!($G(SET))  D
 ..D ZERO^PSS50(ORDRGIEN,,,,,"ORDRUG")
 ..Q:+^TMP($J,"ORDRUG",0)<1
 ..I $$ISSUPPLY(ORDRGIEN),'$G(SET) D
 ...;CHANGE THE DISPLAY GROUP
 ...N FDA,ERROR
 ...S FDA(101.41,IEN_",",5)=DG("OUT")
 ...D FILE^DIE("K","FDA","ERROR")
 ...I $D(ERROR) D  Q
 ....D ERROR("Unable to convert quick order IEN #"_IEN,.ERROR)
 ....S EXIT=1
 ...S SET=1
 K ^TMP($J,"ORSUPPLY")
 Q 1
ISSUPPLY(ORDRGIEN) ;DETERMINE IF DRUG IS A SUPPLY ITEM
 ;PARAMETERS: ORDRGIEN=>DRUG IEN IN ^TMP($J,"ORDRUG") GLOBAL
 Q:"^XA^XX^"[(U_$E(^TMP($J,"ORDRUG",ORDRGIEN,2),1,2)_U)!(^TMP($J,"ORDRUG",ORDRGIEN,2)="DX900"&($G(^TMP($J,"ORDRUG",ORDRGIEN,3))["S")) 1
 Q 0
ERROR(TEXT,ERROR) ;OUTPUT FILEMAN ERROR MESSAGE(S)
 N ORMSG,IDX
 S ORMSG(1)=" "
 S ORMSG(2)="ERROR: "_TEXT_"."
 S ORMSG(3)="VA FileMan Error #"_ERROR("DIERR",1)_":"
 F IDX=1:1:+$O(ERROR("DIERR",1,"TEXT","A"),-1) D
 .S ORMSG(IDX+2)=ERROR("DIERR",1,"TEXT",IDX)
 D BMES^XPDUTL(.ORMSG)
 Q