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

PRCPOPR.m

Go to the documentation of this file.
  1. PRCPOPR ;WISC/RFJ-release distribution order ;27 Sep 93
  1. V ;;5.1;IFCAP;**1,24**;Oct 20, 2000
  1. ;Per VHA Directive 10-93-142, this routine should not be modified.
  1. Q
  1. ;
  1. ;
  1. RELEASEL ; release order - called from list manager
  1. S VALMBCK="R"
  1. N %,ITEMDA,PRCPFLAG
  1. ;
  1. W !!,"CHECKING ITEMS ON ORDER..."
  1. S (ITEMDA,PRCPFLAG)=0 F S ITEMDA=$O(^PRCP(445.3,ORDERDA,1,ITEMDA)) Q:'ITEMDA I $P($G(^(ITEMDA,0)),"^",2),$$ITEMCHK^PRCPOPER(PRCPPRIM,PRCPSECO,ITEMDA)'="" S PRCPFLAG=1 Q
  1. I PRCPFLAG S VALMSG="ORDER CANNOT BE RELEASED - FIX ALL ERRORS FIRST" D CHECKORD^PRCPOPER Q
  1. W " NO ERRORS FOUND !",!
  1. ;
  1. I $$ASKREL(ORDERDA,1)'=1 Q
  1. ;
  1. D RELEASE(ORDERDA)
  1. S VALMSG="ORDER HAS BEEN RELEASED (TO PRIMARY) FOR FILLING"
  1. D HDR^PRCPOPL,VARIABLE^PRCPOPU
  1. Q
  1. ;
  1. ;
  1. RELEASE(ORDERDA) ; release order - update dueouts and dueins, set order status released
  1. N %,ITEMDA,ORDRDATA,PRCPPRIM,PRCPSECO,QUANTITY
  1. S ORDRDATA=$G(^PRCP(445.3,ORDERDA,0)),PRCPPRIM=$P(ORDRDATA,"^",2),PRCPSECO=$P(ORDRDATA,"^",3)
  1. S ITEMDA=0 F S ITEMDA=$O(^PRCP(445.3,ORDERDA,1,ITEMDA)) Q:'ITEMDA S QUANTITY=$P(^(ITEMDA,0),"^",2) I QUANTITY D DUEOUTIN^PRCPOPU(PRCPPRIM,PRCPSECO,ITEMDA,QUANTITY,0)
  1. ;
  1. S $P(^PRCP(445.3,ORDERDA,0),"^",6)="R"
  1. ;
  1. ; if this is a regular order for a supply station secondary, send the
  1. ; order to the supply station and set up field 10.
  1. I $P(^PRCP(445.3,ORDERDA,0),"^",8)="R",$P($G(^PRCP(445,PRCPSECO,5)),"^",1)]"" D
  1. . N FLAG,ITEM
  1. . I $P($G(^PRCP(445.3,ORDERDA,2)),"^",1)]"" D EN^DDIOL("Case Cart or IK Orders are not handled by the supply station.") Q ; CC/IK don't go
  1. . S ITEM=0,FLAG=0
  1. . F S ITEM=$O(^PRCP(445.3,ORDERDA,1,ITEM)) Q:+ITEM=0 D I FLAG Q
  1. . . I $P(^PRC(441,ITEM,0),"^",6)'="S" S FLAG=1
  1. . I 'FLAG D EN^DDIOL("Case Cart or IK Orders are not handled by the supply station.") Q
  1. . D BLDSEG^PRCPHLSO(ORDERDA)
  1. . D NOW^%DTC
  1. . S $P(^PRCP(445.3,ORDERDA,0),"^",10)=%
  1. ;
  1. Q
  1. ;
  1. ASKREL(ORDERDA,%) ; ask to release order, %=defualt
  1. ; returns 1 for yes, 2 for no, 0 for ^
  1. S XP="Is this order READY to be RELEASED to "_$$INVNAME^PRCPUX1(+$P($G(^PRCP(445.3,+ORDERDA,0)),"^",2))_" for FILLING",XH="Enter 'YES' to RELEASE this order for filling, 'NO' or '^' to exit."
  1. W !
  1. Q $$YN^PRCPUYN(%)
  1. ;
  1. ;
  1. ; remove piece 10 from file 445.3 for order sent to supply station
  1. REMFLAG I '$D(PRCP("DPTYPE")) S PRCP("DPTYPE")="P"
  1. D ^PRCPUSEL I '$G(PRCP("I")) Q
  1. N DA,DIE,DIR,DR,ORDERDA,PRCPPRIM,PRCPSEC,PRCPSTOP,REFILL,Y
  1. S PRCPPRIM=PRCP("I")
  1. ; ask order number
  1. S ORDERDA=$$ORDERSEL^PRCPOPUS(PRCPPRIM,0,"R","")
  1. Q:'ORDERDA
  1. S PRCPSEC=$P(^PRCP(445.3,ORDERDA,0),"^",10)
  1. I PRCPSEC']"" D EN^DDIOL("This order is not a supply station order and has no flag to remove.") QUIT
  1. S DIR(0)="Y"
  1. S DIR("A")="Restrict all processing of this order to GIP"
  1. S DIR("A",1)=" "
  1. S DIR("A",2)="WARNING: RESTRICTIONS MAY COMPROMISE THE INTEGRITY OF INVENTORY DATA !!!"
  1. S DIR("A",3)=" "
  1. S DIR("A",4)="Restrict processing ONLY when a supply station or its interface is"
  1. S DIR("A",5)="down for extended periods of time."
  1. S DIR("B")="NO"
  1. D ^DIR
  1. K DIR
  1. I Y'=1 QUIT
  1. S PRCPSTOP=0
  1. S REFILL=$$REFILL^PRCPOPD(+ORDERDA)
  1. I REFILL D I PRCPSTOP QUIT
  1. . N DA,DIR,DR
  1. . S DIR(0)="Y"
  1. . S DIR("A",1)=" "
  1. . S DIR("A",2)="WARNING: The supply station stocked items in this order!!!"
  1. . S DIR("A",3)=" THE STOCKED QUANTITIES WILL BE LOST IF YOU PROCEED."
  1. . S DIR("A",4)=" "
  1. . S DIR("A")="Are you sure you want to process the order in GIP instead"
  1. . S DIR("?")="Enter 'Y' or 'YES' to process the order in GIP."
  1. . S DIR("?",1)="Enter 'N' or 'NO' to process the order in the supply station."
  1. . D ^DIR
  1. . I $D(DUOUT)!$D(DTOUT) S PRCPSTOP=1 Q
  1. . I Y=0 S PRCPSTOP=1 Q
  1. ;
  1. ; DELETE FLAG FROM ORDER
  1. I REFILL D MESSAGE^PRCPOPD(+ORDERDA,2)
  1. S DIE="^PRCP(445.3,"
  1. S DA=ORDERDA
  1. S DR="10///@"
  1. D ^DIE
  1. Q