source: WorldVistAEHR/trunk/r/CONTROLLED_SUBSTANCES-PSD/PSDCOR1.m@ 949

Last change on this file since 949 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.5 KB
Line 
1PSDCOR1 ;BIR/JPW-CS Correction Action (cont'd) ; 6 July 94
2 ;;3.0; CONTROLLED SUBSTANCES ;**66**;13 Feb 97;Build 3
3 S PSDS=$P(PSDSITE,U,3),PSDSN=$P(PSDSITE,U,4) G:$P(PSDSITE,U,5) GS
4ASKD ;ask disp site
5 K DA,DIC W ! S DIC=58.8,DIC(0)="QEA",DIC("A")="Select Dispensing Site: ",DIC("S")="I $P(^(0),""^"",3)=+PSDSITE,$S($P(^(0),""^"",2)=""M"":1,$P(^(0),""^"",2)=""S"":1,1:0)"
6 S DIC("B")=PSDSN
7 D ^DIC K DIC G:Y<0 END S PSDS=+Y,PSDSN=$P(Y,"^",2)
8 S $P(PSDSITE,U,3)=+Y,$P(PSDSITE,U,4)=PSDSN
9GS ;select green sheet #
10 W $C(7),!!,?15,"** NOTE **"
11 W !,"Your Green Sheet selection is limited to those Green Sheets added using the"
12 W !,"Add Existing Green Sheets option. The Green Sheet status must still be",!,"DELIVERED - ACTIVELY ON NAOU for you to make this correction.",!!
13 W ! K DA,DIC S DIC("A")="Select the Green Sheet #: ",DIC=58.81,DIC(0)="QEASZ",D="D"
14 S DIC("S")="I $P(^(0),""^"",2)=12,$P(^(0),""^"",3)=+PSDS,$P(^(0),""^"",11)=4"
15 D IX^DIC K DIC G:Y<0 END S PSDA=+Y
16 I $D(^PSD(58.81,PSDA,7)) W $C(7),!!,"This Green Sheet has been transferred between NAOUs.",!,"You may not delete this Green Sheet.",! G END
17 S STAT=+$P(Y(0),"^",11),PSDPN=$P(Y(0),"^",17),STATN="" I STAT S STATN=$P($G(^PSD(58.82,STAT,0)),"^")
18 S ORD=+$P(Y(0),"^",20),NAOU=+$P(Y(0),"^",18),NAOUN=$P($G(^PSD(58.8,NAOU,0)),"^"),PSDR=+$P(Y(0),"^",5)
19 S PHARM=$P($G(^PSD(58.81,PSDA,1)),"^"),PSDT=$P(Y(0),"^",4),QTY=$P(Y(0),"^",6) I $D(^PSD(58.81,PSDA,4)),$P(^(4),"^",3) S QTY=$P(^(4),"^",3)
20 I '$D(^PSD(58.8,NAOU,1,PSDR,3,ORD,0)) W $C(7),!!,"There's no data on ",NAOUN," for Green Sheet # ",PSDPN,".",!,"Contact your Pharmacy Coordinator for assistance.",! G END
21 I STAT'=4 W $C(7),!!,"This Green Sheet has a status of "_$S(STATN]"":STATN,1:"UNKNOWN")_".",!,"Please select another Green Sheet.",! G GS
22ASK W !!,"This action will delete Green Sheet #",PSDPN,"."
23 W ! K DA,DIR,DIRUT S DIR(0)="Y",DIR("A")="Are you sure",DIR("B")="NO"
24 S DIR("?",1)="Answer 'YES' to delete the Green Sheet or",DIR("?")="answer 'NO' to quit and the Green Sheet data will not be deleted."
25 D ^DIR K DIR I 'Y W !!,"No action taken. The Green Sheet data still exists.",!! G END
26COM ;complete correction
27 D NOW^%DTC S RECDT=+$E(%,1,12)
28 W !!,"Accessing Green Sheet #",PSDPN," information...",!!
29 F L +^PSD(58.87,0):$S($G(DILOCKTM)>0:DILOCKTM,1:3) I Q
30FIND S PSDCOR=$P(^PSD(58.87,0),"^",3)+1 I $D(^PSD(58.87,PSDCOR)) S $P(^PSD(58.87,0),"^",3)=PSDCOR G FIND
31 K DA,DIC,DLAYGO S (DIC,DLAYGO)=58.87,DIC(0)="L",X=PSDCOR D ^DIC K DIC,DLAYGO
32 L -^PSD(58.87,0)
33 K DA,DIE,DR S DIE=58.87,DA=PSDCOR,DR="1////"_RECDT_";2////"_PSDUZ_";3////"_PSDPN_";4////"_PSDR_";5////"_NAOU_";7////"_PSDT_";8////"_ORD_";9////"_PHARM_";10////"_QTY_";11////"_TYPE_";12////"_PSDS
34 D ^DIE K DA,DIE,DR
35 W !!,"Updating your records now..."
36 ;update transaction file (58.81)
37 K DA,DIE,DR S DIDEL=58.81,DA=PSDA,DIE=58.81,DR=".01////@" D ^DIE K DA,DIE,DR,DIDEL
38 I $D(Y)!$D(DTOUT) W $C(7),!!,"** THIS GREEN SHEET HAS NOT BEEN CORRECTED **",!!,"The status remains "_STATN,! G END
39 K DA,DIE,DR S DIDEL=58.800119,DA=PSDA,DA(1)=PSDR,DA(2)=+PSDS,DIE="^PSD(58.8,"_DA(2)_",1,"_DA(1)_",4,",DR=".01////@" D ^DIE K DA,DIE,DR,DIDEL
40 K DA,DIE,DR S DIDEL=58.800118,DA=ORD,DA(1)=PSDR,DA(2)=NAOU,DIE="^PSD(58.8,"_DA(2)_",1,"_DA(1)_",3,",DR=".01////@" D ^DIE K DA,DIE,DR,DIDEL
41 W ?2,!,"*** Your Green Sheet #"_PSDPN_" has been deleted. ***",!,"If you wish to add this Green Sheet again,",!,"please use the 'Add Existing Green Sheets' option.",!
42END K %,%DT,%H,%I,D,DA,DIC,DIDEL,DIE,DIR,DIROUT,DIRUT,DR,DTOUT,DUOUT
43 K NAOU,NAOUN,OK,ORD,PHARM,PSDA,PSDCOR,PSDPN,PSDR,PSDS,PSDSN,PSDT,PSDUZ,QTY,RECDT,STAT,STATN,TYPE,X,Y
44 Q
Note: See TracBrowser for help on using the repository browser.