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

ORADDFQT.m

Go to the documentation of this file.
ORADDFQT ; SLC/AGP - Utility report for Order Dialogs ; 10/15/10
 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**337**;DEC 17, 1997;Build 84
 ;
 ; DBIA 5133: reading ^PXRMD file #801.41
 ; 
 Q
 ;
EDIT(IEN,PERQOAR) ;
 N ASKADD,CNT,CONF,DA,DIE,DIK,DR,DRPSIVDG,DUR,EXIT,ERR,ERROR,FDA,FDAIEN
 N IVTYPE,LOC,NAME,NODE,OUTPUT,PSIVDG,PSNODE,TERMIN,USER
 N ADD,ADDIEN,ADDF,ADDFIEN,ADDNAME,ADDV,ORDIALOG,STR
 S EXIT=0,ERROR=0
 N OI,OINAME,PTR,UPDADD,UPDDSG
 S USER=$$ISPERQO^ORINQIV(IEN) I USER>0 D  Q EXIT
 .S NODE=$G(^ORD(101.41,IEN,0))
 .D GETS^DIQ(200,USER_",",".01;9.2","EI","OUTPUT","ERR")
 .I $D(ERR) D AWRITE^ORINQIV(ERR) Q
 .S TERMIN=$G(OUTPUT(200,USER_",",9.2,"I"))
 .I TERMIN>0,TERMIN<DT Q
 .S PERQOAR(OUTPUT(200,USER_",",.01,"E"),$P(NODE,U))=$P(NODE,U,2)
 K ^TMP($J,"OR DESC")
 S UPDDSG="N",UPDADD="N"
 S DA=IEN
 D EN^ORORDDSC(IEN,"OR DESC")
 S CNT=0 F  S CNT=$O(^TMP($J,"OR DESC",IEN,CNT)) Q:CNT'>0  D
 .W !,^TMP($J,"OR DESC",IEN,CNT)
 ;
CONVERT ;
 W !!,"Add additive frequency to the above Quick Order?"
 S UPDDSG=$$ASK^ORINQIV("Add additive fequency?","Y:YES;N:NO",1,"")
 I UPDDSG="Q"!(UPDDSG=U)!(UPDDSG="^^") S EXIT=1 G EDITX
 I UPDDSG'="Y" G EDITX
 ;buidl ORDIALOG array
 D GETQDLG^ORCD(IEN)
 ;find additive
 S ADDIEN=+$P($G(ORDIALOG("B","ADDITIVE")),U,2)
 S CNT=0
 F  S CNT=$O(ORDIALOG(ADDIEN,CNT)) Q:CNT=""  D
 .I +CNT=0 Q
 .S ADD(CNT)=ORDIALOG(ADDIEN,CNT)
 ;
FREQ ;
 N ANS,DEFAULT,EXIT,ORIVTYPE
 S ORIVTYPE="C"
 S CNT=0,EXIT=0 F  S CNT=$O(ADD(CNT)) Q:CNT'>0!(EXIT=1)  D
 .S ADDV=ADD(CNT) Q:ADDV'>0
 .S ADDNAME=$P($G(^ORD(101.43,ADDV,0)),U)
 .W !,"Additive: "_ADDNAME
 .S DEFAULT=$$ADDFRD^ORCDPSIV(.ORDIALOG,CNT,"ADDFREQ")
 .S STR="A:ALL Bags;1:1 Bag/Day;S:See Comments"
 .W !,"Default value: "_DEFAULT
 .S ANS=$$ASK^ORINQIV("Select Additive Frequency",STR,9,DEFAULT)
 .I ANS=U S EXIT=1 Q
 .I ANS="^^"!(ANS="Q") S EXIT=1 Q
 .I ANS="K"!(ANS="N") S EXIT=1 Q
 .S ADDF(CNT)=$S(ANS="A":"ALL Bags",ANS=1:"1 Bag/Day",ANS="S":"See Comments")
 I ANS=U G FREQ
 I ANS="^^"!(ANS="Q") G EDITX
 I ANS="K"!(ANS="N") G EDITX
 ;
CONFIRM ;
 W !!,"Please confirm the selected changes below."
 W !,"If these changes are accepted, the Quick Order will be updated"
 S CNT=0 F  S CNT=$O(ADD(CNT)) Q:CNT=""  D
 .S ADDV=ADD(CNT) Q:ADDV'>0
 .S ADDNAME=$P($G(^ORD(101.43,ADDV,0)),U)
 .W !,"Additive: "_ADDNAME
 .W !,"Additive Frequency: "_$G(ADDF(CNT))
 .W !
 S CONF=$$ASK^ORINQIV("Confirm Changes?","Y:YES;N:NO",4,"")
 I CONF=U G FREQ
 I CONF="^^"!(CONF="Q") S EXIT=1 G EDITX
 I CONF="S"!(CONF="N") G EDITX
 ;
UPDATES ;Do updates
 W !
 N FDA,IENS
 N UPD,INT,VALUE
 S UPD=3,INT=0
 S PTR=$$PTR^ORMBLDPS("ADDITIVE FREQUENCY") Q:PTR'>0
 S CNT=0 F  S CNT=$O(ADDF(CNT)) Q:CNT=""  D
 .S UPD=UPD+1,INT=INT+1
 .S VALUE=ADDF(CNT) Q:VALUE=""
 .S IENS="?+"_UPD_","_IEN_","
 .S FDA(101.416,IENS,.01)=40
 .S FDA(101.416,IENS,.02)=PTR
 .S FDA(101.416,IENS,.03)=INT
 .S FDA(101.416,IENS,1)=VALUE
 .D UPDATE^DIE("","FDA","FDAIEN","ERR")
 .I $D(ERR) D AWRITE^ORINQIV("ERR") S ERROR=1
 I ERROR=1 W !,"Due to the errors in conversion please valiate the quick order in the editor."
 ;
 ;Call the QO editor
 W !
 D QCK0^ORCMEDT1(IEN)
EDITX ;
 K ^TMP($J,"OR DESC")
 Q EXIT
 ;
EN ;
 K ^TMP($J,"OR REMMDLG")
 N DIR,DSGPAR,DSGRP,EXIT,NANSC,ODIEN,PERQOAR,QOIEN,Y
 ;
 D HELP^ORINQIV(7)
 ;Build a list of Display Groups that contains the default dialog of
 ;PSJI OR PAT FLUID OE
 S ODIEN=$O(^ORD(101.41,"AB","PSJI OR PAT FLUID OE","")) Q:ODIEN=""
 S DSGRP=0 F  S DSGRP=$O(^ORD(100.98,DSGRP)) Q:DSGRP'>0  D
 .I $P(^ORD(100.98,DSGRP,0),U,4)=ODIEN S DSGPAR(DSGRP)=""
 ;
 S DIR(0)="S^A:QO ASSIGNED TO ORDER MENUS, ORDER SETS, OR REMINDER DIALOGS;N:QO NOT ASSIGNED TO ANY OF THESE ITEMS;S:SPECIFIC QUICK ORDER;Q:QUIT THE UPDATE UTILITY"
 S DIR("A")="Which QO to convert?"
 S DIR("??")="^D HELP^ORINQIV(5)"
 D ^DIR
 I Y=U!(Y="^^")!(Y="Q") Q
 I Y="S" D IND(.DSGPAR) Q
 S NANSC=Y
 D FQOIRDLG^ORINQIV
 ;
 S OIIEN=$O(^ORD(101.41,"B","OR GTX ORDERABLE ITEM","")) Q:OIIEN'>0
 S EXIT=0
 S QOIEN=0 F  S QOIEN=$O(^ORD(101.41,QOIEN)) Q:QOIEN'>0!(EXIT=1)  D
 .I $$ISVALID(QOIEN,NANSC,.DSGPAR)=0 Q
 .S EXIT=$$EDIT(QOIEN,.PERQOAR)
UTLEXIT ;
 I $D(PERQOAR) D BLDMSG^ORINQIV(.PERQOAR)
 K ^TMP($J,"OR REMDLG")
 Q
 ;
IND(DSGPAR) ;
 N DIC,DIR,EXIT,PERQOAR
 S DIC="^ORD(101.41,",DIC(0)="AEMQZ"
 S DIC("S")="I $$ISVALID^ORADDFQT(Y,""S"",.DSGPAR)=1"
 D ^DIC
 I +$P(Y,U)'>0 Q
 S EXIT=$$EDIT($P(Y,U),.PERQOAR)
 I EXIT=1 Q
 W !
 S DIR(0)="Y"
 S DIR("A")="Convert another Quick Order?"
 D ^DIR
 I Y=1 D IND(.DSGPAR)
 I $D(PERQOAR) D BLDMSG^ORINQIV(.PERQOAR)
 Q
 ;
ISVALID(IEN,NANSC,DSGPAR) ;
 N CONT,NODE,QODSG,PSNODE,RESULT
 S NODE=$G(^ORD(101.41,IEN,0))
 ;Quit if not a quick order
 I $P(NODE,U,4)'="Q" Q 0
 ;Disregard order dialog entry does not contain a valid display group
 S QODSG=$P(NODE,U,5) I QODSG="" Q 0
 I '$D(DSGPAR(QODSG)) Q 0
 ;
 S CONT=$S($O(^ORD(101.41,"AD",IEN,0)):1,$D(^TMP($J,"OR REMDLG",IEN)):1,1:0)
 ;
 ;S CONT=$$ISCONT^ORINQIV(IEN)
 I NANSC="A",CONT=0 Q 0
 I NANSC="N",CONT=1 Q 0
 N TYPE,ORDIALOG
 S ORTYPE="Z"
 D GETQDLG^ORCD(IEN)
 ; determine if a continuous IV Order
 S TYPE=+$P($G(ORDIALOG("B","TYPE")),U,2) I TYPE'>0 Q 0
 I $G(ORDIALOG(TYPE,1))'="C" Q 0
 I $$IVADFCHK^ORWDXM3(.ORDIALOG)=0 Q 1
 Q 0
 ;