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

PSDNBAL.m

Go to the documentation of this file.
PSDNBAL ;EPIP/RTW - Ask CS Remaining Balance ;29 Aug 94
 ;;3.0;CONTROLLED SUBSTANCES NARCOTIC BALANCE;**84,92**;13 Feb 97;Build 3
 ; ICR#   TYPE    DESCRIPTION
 ;-----  -------  ------------------------------------
 ;10026  Support  ^DIR
 ;4986   Support  ^%DTC
 ;1140   Support  ^XMD
 ;---------------------------------------------------------------------
 N PSDNOT S PSDNOT=1 ;p92
 S PSDTRY=1
ENTER ;
 N DIRUT
 S PSDOUT=0
 I PSDNOT D
 . W !,"*** NOTICE: You have 3 valid attempts to enter the correct remaining balance"
 . W !,"            before a message is sent to the CS BALANCE DISCREPANCY mail group.",!
 . S PSDNOT=0
 S DIR(0)="N:^0:999999.99:2"
 S DIR("A")="            Enter the remaining balance (^ to quit)"
 S DIR("T")=DTIME
 S DIR("??")="^D HLPMSG^PSDNBAL"
 D ^DIR K DIR S PSDANS=Y I $D(DIRUT) S PSDOUT=1 G EXIT
 S PSDQDB=(BAL-QTY)
 W:PSDANS=PSDQDB !!,"Balance confirmed, Thank you ",! ;RTW
 S PSDQCHO=$S(PSDANS=PSDQDB:"EXIT",1:"PSDATMPT")
 D @PSDQCHO
 Q
HLPMSG ;
 W !!,"Enter the remaining balance on hand.  The system will compare"
 W !,"against the database.  You will have a total of 3 valid attempts"
 W !,"before a message is sent to the CS BALANCE DISCREPANCY mail"
 W !,"group."
 W !,""
 W !,"Input must be a numeric amount with no more than two decimal"
 W !,"digits.  Invalid attempts will not count against your total"
 W !,"attempts."
 Q
EXIT ;
 K PSDTRY,PSDQCHO,PSDANS,PSDQDB,PSDPHN,XMDUZ,XMY,XMSUB,XMZ,PSDWANS,PSDRN
 K ^TMP($J,"MSG")
 Q
 ;;
PSDATMPT I PSDTRY=1 D MESS1 S PSDTRY=PSDTRY+1 G ENTER
 I PSDTRY=2 D MESS2 S PSDTRY=PSDTRY+1 G ENTER
 I PSDTRY=3 D MESG
 Q
MESS1 W !!,"Sorry the remaining balance you entered does not match the balance",!,"on record in the CS package.",!!,"Please check to ensure you have dispensed the right drug and",!," dispensed the correct quantity.",!
 Q
MESS2 W !!,"This will be the last entry in the remaining balance check.",!!,"If the entry still does not match a message will be sent to the",!,"appropriate person for review."
 W "  You may proceed if you have dispensed the",!,"correct drug in the correct quantity.  Thank you.",!
 Q
MESG ;Ask comment and send message
 S DIR(0)="F"
 S DIR("A")="Enter a comment (^ to quit)"
 S DIR("T")=DTIME
 S DIR("?",1)="Enter comment with any concerns about the balance discrepancy."
 S DIR("?",2)="You are limited to 245 characters."
 S DIR("?")=" "
 D ^DIR K DIR S PSDWANS=Y I $D(DIRUT) G EXIT
 K XMTEXT
 S XMSUB="Possible CS Balance Remaining Discrepancy"
 S XMY(DUZ)="" ;To User
 S XMY("G.CS BALANCE DISCREPANCY")="" ; 
 S ^TMP($J,"MSG","B",1)="There were three failed attempts to enter the current remaining balance for the following drug."
 S ^TMP($J,"MSG","B",2)=" "
 S ^TMP($J,"MSG","B",3)="           Drug  : "_PSDRN
 S ^TMP($J,"MSG","B",4)="           Rx #  : "_RXNUM
 S ^TMP($J,"MSG","B",5)="         Rx Qty  : "_QTY
 S ^TMP($J,"MSG","B",6)="Balance Entered  : "_PSDANS
 S ^TMP($J,"MSG","B",7)="Balance in VistA : "_PSDQDB
 N Y,DIFROM
 D NOW^%DTC S Y=% X ^DD("DD")
 S ^TMP($J,"MSG","B",8)="           Time : "_Y
 S XMDUZ=.5
 S PSDPHN=$P(^VA(200,DUZ,0),"^",1)
 S ^TMP($J,"MSG","B",9)="     Pharmacist : "_PSDPHN
 S ^TMP($J,"MSG","B",10)="       Comment : "_PSDWANS
 S ^TMP($J,"MSG","B",11)=" "
 S ^TMP($J,"MSG","B",12)="Thank you for checking on this possible discrepancy."  ;
 S XMTEXT="^TMP($J,""MSG"",""B"","
 D ^XMD
 W:$D(XMZ) !!,"Message sent to the CS BALANCE DISCREPANCY Mail Group",!!,"                You entered a remaining balance of ",PSDANS
 D EXIT
 Q