| 1 | PSAPROC8 ;BIR/JMB-Process Uploaded Prime Vendor Invoice Data - CONT'D ;7/23/97
 | 
|---|
| 2 |  ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**3,64**; 10/24/97;Build 4
 | 
|---|
| 3 |  ;This routine processes uploaded invoices.
 | 
|---|
| 4 |  ;
 | 
|---|
| 5 | DU ;Prompts Dispense Unit if blank
 | 
|---|
| 6 |  F  L +^PSDRUG(PSAIEN,0):$S($G(DILOCKTM)>0:DILOCKTM,1:3) I  Q
 | 
|---|
| 7 |  S DIE="^PSDRUG(",DA=PSAIEN,DR=14.5 D ^DIE K DIE L -^PSDRUG(PSAIEN,0)
 | 
|---|
| 8 |  I +$P($G(^PSDRUG(PSAIEN,660)),"^",8) D  G DU
 | 
|---|
| 9 |  .F  L +^PSDRUG(PSAIEN,0):$S($G(DILOCKTM)>0:DILOCKTM,1:3) I  Q
 | 
|---|
| 10 |  .S DIE="^PSDRUG(",DA=PSAIEN,DR="14.5///@" D ^DIE K DIE L -^PSDRUG(PSAIEN,0)
 | 
|---|
| 11 |  I $P($G(^PSDRUG(PSAIEN,660)),"^",8)'="" S PSADU=1 Q
 | 
|---|
| 12 |  ;
 | 
|---|
| 13 |  W !,"The dispense units must be entered to change",!,"the status of the invoice to Processed."
 | 
|---|
| 14 |  S DIR(0)="Y",DIR("B")="Y",DIR("A")="Do you want to enter the dispense units now",DIR("?",1)="Enter Yes to return to the DISPENSE UNIT prompt.",DIR("?")="Enter No to bypass entering the dispense units now."
 | 
|---|
| 15 |  S DIR("??")="^D DISPYN^PSAPROC8" D ^DIR K DIR I $G(DIRUT) S PSAOUT=1 Q
 | 
|---|
| 16 |  G:+Y DU
 | 
|---|
| 17 |  Q
 | 
|---|
| 18 |  ;
 | 
|---|
| 19 | DUOU ;Gets Dispense Units per Order Unit
 | 
|---|
| 20 |  W:'$G(PSADU) !,"DISPENSE UNITS: "_$P($G(^PSDRUG(PSAIEN,660)),"^",8)
 | 
|---|
| 21 |  S PSADU=1
 | 
|---|
| 22 |  F  L +^PSDRUG(PSAIEN,0):$S($G(DILOCKTM)>0:DILOCKTM,1:3) I  Q
 | 
|---|
| 23 |  S DIE="^PSDRUG("_PSAIEN_",1,",DA(1)=PSAIEN,DA=+PSASUB,DR=403 D ^DIE K DIE L -^PSDRUG(PSAIEN,0)
 | 
|---|
| 24 |  I $D(Y)!($G(DTOUT)) S PSAOUT=1 Q
 | 
|---|
| 25 |  Q:+$P($G(^PSDRUG(PSAIEN,1,PSASUB,0)),"^",7)
 | 
|---|
| 26 |  ;
 | 
|---|
| 27 |  S DIR(0)="Y",DIR("B")="Y",DIR("A",1)="The dispense units per order unit must be entered to change the ",DIR("A")="status of the invoice to Processed. Do you want to enter the data now"
 | 
|---|
| 28 |  S DIR("?",1)="Enter Yes to return to the "_$P($G(^PSDRUG(PSAIEN,660)),"^",8)_"s per "_$P($G(^DIC(51.5,+$P($P(PSADATA,"^",2),"~",2),0)),"^",2)_" prompt."
 | 
|---|
| 29 |  S DIR("?")="Enter No to bypass entering the dispense units now.",DIR("??")="^D DUOUYN^PSAPROC8"
 | 
|---|
| 30 |  D ^DIR K DIR I $G(DTOUT)!($G(DUOUT)) S PSAOUT=1 Q
 | 
|---|
| 31 |  G:+Y DUOU
 | 
|---|
| 32 |  Q
 | 
|---|
| 33 | OK ;
 | 
|---|
| 34 |  S PSACNTOK=PSACNTOK+1,PSAOK(PSACNTOK)=$P(^XTMP("PSAPV",PSACTRL,"IN"),"^",4)_"^"_$P(^("IN"),"^",2)_"^"_PSACTRL_"^"_$P(^("IN"),"^",7)
 | 
|---|
| 35 |  Q
 | 
|---|
| 36 | PRICE ;Price per Order Unit changed
 | 
|---|
| 37 |  S PSAIPR=$L($FN($P(^XTMP("PSAPV",PSACTRL,"IT",PSALINE),"^",3),",",2)),PSAFPR=$L($FN($P($G(^PSDRUG(PSAIEN,1,PSASUB,0)),"^",6),",",2))
 | 
|---|
| 38 |  S PSAJUST=$S(PSAIPR>PSAFPR:PSAIPR,1:PSAFPR)
 | 
|---|
| 39 |  W !!,"Price per Order Unit -- Invoice's: $"_$J($FN($P(^XTMP("PSAPV",PSACTRL,"IT",PSALINE),"^",3),",",2),PSAJUST,2),!?24,"File's   : $"_$J($FN($P($G(^PSDRUG(PSAIEN,1,PSASUB,0)),"^",6),",",2),PSAJUST,2),!
 | 
|---|
| 40 |  S DIR(0)="Y",DIR("A")="Is the invoice's price per order unit correct",DIR("B")="Y",DIR("?",1)="Enter Yes if "_$P(^XTMP("PSAPV",PSACTRL,"IT",PSALINE),"^",3)_" is correct."
 | 
|---|
| 41 |  S DIR("?")="Enter No to keep the file's price per order unit.",DIR("??")="^D PRICEOU^PSAPROC1" D ^DIR K DIR I $G(DIRUT) S PSAOUT=1 Q
 | 
|---|
| 42 |  S $P(^XTMP("PSAPV",PSACTRL,"IT",PSALINE),"^",22)=+Y
 | 
|---|
| 43 |  I '+Y S $P(^XTMP("PSAPV",PSACTRL,"IT",PSALINE),"^",23)=+$P($G(^PSDRUG(PSAIEN,1,PSASUB,0)),"^",6),$P(^XTMP("PSAPV",PSACTRL,"IT",PSALINE),"^",24)=DUZ,$P(^(PSALINE),"^",25)=DT
 | 
|---|
| 44 |  Q
 | 
|---|
| 45 |  ;
 | 
|---|
| 46 | REORDER ;Enter reorder level for drug if the field is blank.
 | 
|---|
| 47 |  W:'$G(PSADU) !,"DISPENSE UNITS: "_$P($G(^PSDRUG(+PSAIEN,660)),"^",8)
 | 
|---|
| 48 |  S PSADU=1,DIR(0)="NO^0:99999",DIR("A")="REORDER LEVEL IN "_$P($G(^PSD(58.8,PSALOC,0)),"^")
 | 
|---|
| 49 |  S DIR("?")="Enter the minimum number of dispense units to keep in the "_$S($P(PSADATA,"^",19)="CS":"master vault.",1:"pharmacy location."),DIR("??")="^D REORD^PSAPROC8"
 | 
|---|
| 50 |  S DIR("B")=$S(+$P(PSADATA,"^",21):+$P(PSADATA,"^",21),+$P($G(^PSD(58.8,PSALOC,1,PSAIEN,0)),"^",5):$P(^PSD(58.8,PSALOC,1,PSAIEN,0),"^",5),1:"")
 | 
|---|
| 51 |  D ^DIR K DIR I $G(DTOUT)!($G(DUOUT)) S PSAOUT=1 Q
 | 
|---|
| 52 |  S $P(^XTMP("PSAPV",PSACTRL,"IT",PSALINE),"^",21)=+Y
 | 
|---|
| 53 |  Q
 | 
|---|
| 54 |  ;
 | 
|---|
| 55 | STOCK ;Enter stock level for drug if the field is blank.
 | 
|---|
| 56 |  W:'$G(PSADU) !,"DISPENSE UNITS: "_$P($G(^PSDRUG(+PSAIEN,660)),"^",8)
 | 
|---|
| 57 |  S PSADU=1,DIR(0)="NO^0:99999",DIR("A")="STOCK LEVEL IN "_$P($G(^PSD(58.8,+PSALOC,0)),"^")
 | 
|---|
| 58 |  S DIR("?")="Enter the minimum number of dispense units to keep on the shelf",DIR("??")="^D STKLEVEL^PSAPROC8"
 | 
|---|
| 59 |  S DIR("B")=$S(+$P(PSADATA,"^",27):+$P(PSADATA,"^",27),+$P($G(^PSD(58.8,PSALOC,1,PSAIEN,0)),"^",3):$P(^PSD(58.8,PSALOC,1,PSAIEN,0),"^",3),1:"")
 | 
|---|
| 60 |  D ^DIR K DIR I $G(DTOUT)!($G(DUOUT)) S PSAOUT=1 Q
 | 
|---|
| 61 |  Q:$G(DIRUT)
 | 
|---|
| 62 |  S:+Y $P(^XTMP("PSAPV",PSACTRL,"IT",PSALINE),"^",27)=+Y
 | 
|---|
| 63 |  Q
 | 
|---|
| 64 |  ;
 | 
|---|
| 65 | DISPYN ;Extended help to enter dispense units
 | 
|---|
| 66 |  W !?5,"Enter Yes if you want to enter the dispense units now.",!!?5,"Enter No to bypass entering the dispense units. The invoice will not",!?5,"be placed in a Processed status if the dispense units are not entered."
 | 
|---|
| 67 |  Q
 | 
|---|
| 68 | DUOUYN ;Extended help to enter dispense units per order units
 | 
|---|
| 69 |  W !?5,"Enter Yes if you want to enter the dispense units per order unit now.",!!?5,"Enter No to bypass entering the dispense units per order unit. The"
 | 
|---|
| 70 |  W !?5,"invoice will not be placed in a "_$S($D(PSABEFOR):"Verified",1:"Processed")_" status if the dispense units",!?5,"are not entered."
 | 
|---|
| 71 |  Q
 | 
|---|
| 72 | PRICEOU ;Extended help to 'Is invoice's price per order unit correct'
 | 
|---|
| 73 |  W !?5,"Enter Yes if the invoice's price per order unit is correct. The",!?5,"invoice's price per order unit will be entered into the DRUG file."
 | 
|---|
| 74 |  W !!?5,"Enter No if the invoice's price per order unit is not correct.",!?5,"The DRUG file's price per order unit will remain the same."
 | 
|---|
| 75 |  Q
 | 
|---|
| 76 | REORD ;Extended help for 'Reorder level'
 | 
|---|
| 77 |  W !?5,"Enter the lowest amount of "_$P($G(^PSDRUG(PSAIEN,660)),"^",8)_"s to keep in the "_$S($P(PSADATA,"^",19)="CS":"master vault",1:"pharmacy location")_"."
 | 
|---|
| 78 |  W !!?5,"When the amount on hand is lower than the reorder level, a mail",!?5,"message will be sent showing the drug name, reorder level, and",!?5,"quantity on hand."
 | 
|---|
| 79 |  Q
 | 
|---|
| 80 | STKLEVEL ;Extended help for 'Stock level'
 | 
|---|
| 81 |  W !?5,"Enter the ideal number of dispense units to keep on the shelf. When the",!?5,"number of dispense units is equal to or less than the reorder level, the"
 | 
|---|
| 82 |  W !?5,"amount to order is determined by subtracting the current number of dispense",!?5,"units from the stock level."
 | 
|---|
| 83 |  Q
 | 
|---|