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

PRCPEITG.m

Go to the documentation of this file.
  1. PRCPEITG ;WOIFO/CC-enter/edit inventory items (On-Demand) ; 11/6/06 9:56am
  1. ;;5.1;IFCAP;**98**;Oct 20, 2000;Build 37
  1. ;Per VHA Directive 2004-038, this routine should not be modified.
  1. Q
  1. ;
  1. ;
  1. ODI(PRCPINPT,PRCPITEM) ; ask On-Demand and reason if appropriate, save data
  1. ;
  1. ; PRCPINPT inventory point ien
  1. ; PRCPITEM ien of the selected item
  1. ;
  1. N DIR,DIRUT,DIROUT,DTOUT,DUOUT,PRCPARRY,PRCPEDIT,PRCPIEN,PRCPONN,PRCPONO,PRCPREAS,Y
  1. S PRCPONO=$P(^PRCP(445,+PRCPINPT,1,+PRCPITEM,0),"^",30) ; O-D Flag
  1. I PRCPONO'="Y" S PRCPONO="N" ; if no value is defined, O-D Flag is No
  1. ; Can user edit this On-Demand setting?
  1. S PRCPEDIT=0
  1. I $D(^PRCP(445,+PRCPINPT,9,"B",DUZ)) S PRCPEDIT=1 ; authorized user
  1. ;
  1. ; Display On-Demand value. If user is not authorized,
  1. ; display << not editable >> , pause and exit
  1. I 'PRCPEDIT D EN^DDIOL("ON-DEMAND: "_$S(PRCPONO="N":"NO",1:"YES")_"// <<may not edit>>") D R^PRCPUREP Q
  1. ; if user can edit value, proceed with prompting
  1. YN S DIR(0)="Y",DIR("A")="ON-DEMAND",DIR("B")=PRCPONO
  1. S DIR("?",1)="Enter 'Y'es for low usage items qualifying to be On-Demand"
  1. S DIR("?")=" 'N'o for routinely used (standard) items"
  1. D ^DIR K DIR
  1. ; prompt user, default to value on file
  1. ; if user up-arrows or times out, exit
  1. I $D(DUOUT)!$D(DTOUT) G NOCHANGE
  1. I Y'=0,Y'=1 W "??" G YN
  1. I Y=1 S PRCPONN="Y"
  1. I Y=0 S PRCPONN="N"
  1. ; if new value agrees with current setting, exit
  1. I PRCPONN=PRCPONO Q ; no additional processing required
  1. ;
  1. ; prompt user for reason
  1. RS S DIR(0)="F^3:30",DIR("A")="REASON FOR CHANGE"
  1. S DIR("?")="Enter 3 - 30 characters with no embedded '^' and no leading spaces"
  1. ; if user enters '^', all spaces or just hits return, tell user setting will not be changed - no reason entered, prompt On-Demand again.
  1. D ^DIR K DIR
  1. I $D(DUOUT)!$D(DTOUT) G NOCHANGE
  1. F Q:$E(Y,1)'=" " S Y=$E(Y,2,$L(Y))
  1. I Y']"" W "??" G RS
  1. S PRCPREAS=Y
  1. ;
  1. ; save new setting, date/time, DUZ, reason in audit file
  1. S PRCPIEN="+1,"_+PRCPITEM_","_+PRCPINPT_","
  1. S PRCPARRY(445.13,PRCPIEN,.01)=$$NOW^XLFDT
  1. S PRCPARRY(445.13,PRCPIEN,1)=DUZ
  1. S PRCPARRY(445.13,PRCPIEN,2)=PRCPREAS
  1. S PRCPARRY(445.13,PRCPIEN,3)=PRCPONN
  1. D UPDATE^DIE("","PRCPARRY")
  1. I $D(^TMP("DIERR",$J)) W "NOTHING SAVED" ; likely system or space err
  1. ;
  1. ; Save new setting into field .8
  1. S PRCPIEN=+PRCPITEM_","_+PRCPINPT_","
  1. K PRCPARRY S PRCPARRY(445.01,PRCPIEN,.8)=PRCPONN
  1. D UPDATE^DIE("","PRCPARRY")
  1. I $D(^TMP("DIERR",$J)) W "NOTHING SAVED" ; likely system or space err
  1. OD Q
  1. ;
  1. NOCHANGE D EN^DDIOL("NO DATA UPDATED. VALID RESPONSE AND/OR REASON NOT ENTERED.")
  1. D R^PRCPUREP
  1. Q