source: WorldVistAEHR/trunk/r/CONTROLLED_SUBSTANCES-PSD/PSDNTTP1.m@ 1722

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

initial load of WorldVistAEHR

File size: 3.3 KB
Line 
1PSDNTTP1 ;BIR/BJW-Transfer Green Sheet - Receive this NAOU ; 7/9/07 10:02am
2 ;;3.0; CONTROLLED SUBSTANCES ;**64**;13 Feb 97;Build 33
3COM ;complete order and transaction
4 S FLAG=0 D NOW^%DTC S PSDT=X,(RECD,Y)=+$E(%,1,12) X ^DD("DD") S RECDT=Y
5 W !!,"Accessing ",PSDRGN," information...",!!
6 I '$D(^PSD(58.8,+AOU,1,+PSDRG,0)) D DRUG
7 W !!,"Updating your records now..."
8DIE ;create the order request in 58.8
9 S:'$D(^PSD(58.8,AOU,1,PSDRG,3,0)) ^(0)="^58.800118A^^"
10 S PSDRN=$P(^PSD(58.8,AOU,1,PSDRG,3,0),"^",3)+1 I $D(^PSD(58.8,AOU,1,PSDRG,3,PSDRN)) S $P(^PSD(58.8,AOU,1,PSDRG,3,0),"^",3)=$P(^PSD(58.8,AOU,1,PSDRG,3,0),"^",3)+1 G DIE
11 W "order..."
12 K DA,DIC,DIE,DD,DR,DO S DIC(0)="L",(DIC,DIE)="^PSD(58.8,"_AOU_",1,"_PSDRG_",3,",DA(2)=AOU,DA(1)=PSDRG,(X,DINUM)=PSDRN D FILE^DICN K DIC
13 S DA=PSDRN,DA(1)=PSDRG,DA(2)=AOU
14 S STAT=$S(+$P($G(^PSD(58.8,AOU,2)),U,5):13,1:4)
15 S DR="16////"_PSDPN_";14////"_PSDSP_";15////"_RECD_";2////"_+PSDS_";6////"_PSDUZ_";7////"_MFG_";8////"_LOT_";9////"_EXP_";10////"_STAT_";19////"_QTY_";20////"_RQTY_";22////"_RQTY
16 D ^DIE K DIE,DR
17 W "transaction..."
18ADD ;find entry number in 58.81
19 F L +^PSD(58.81,0):$S($G(DILOCKTM)>0:DILOCKTM,1:3) I Q
20FIND S PSDREC=$P(^PSD(58.81,0),"^",3)+1 I $D(^PSD(58.81,PSDREC)) S $P(^PSD(58.81,0),"^",3)=PSDREC G FIND
21 K DIC,DLAYGO S DIC(0)="L",(DIC,DLAYGO)=58.81,(X,DINUM)=PSDREC D ^DIC K DIC,DLAYGO
22 L -^PSD(58.81,0)
23EDIT ;edit new transaction in 58.81
24 I $P($G(^PSD(58.81,PSDREC,0)),"^")
25 S STAT=$S(+$P($G(^PSD(58.8,AOU,2)),U,5):13,1:4)
26 S ^PSD(58.81,PSDREC,0)=PSDREC_"^5^"_PSDS_"^"_RECD_"^"_PSDRG_"^"_RQTY_"^^^^^"_STAT_"^^"_MFG_"^"_LOT_"^"_EXP_"^^"_PSDPN_"^"_AOU_"^^"_PSDRN
27 S ^PSD(58.81,PSDREC,1)="^^"_PSDUZ_"^"_RECD_"^^^^"_RQTY
28 S ^PSD(58.81,PSDREC,7)="^^^^^"_PSDA,^PSD(58.81,PSDREC,9)=PAT
29 S ^PSD(58.81,PSDREC,"CS")=1,$P(^PSD(58.81,PSDREC,"CS"),"^",4)=1
30 K DA,DIK S DA=PSDREC,DIK="^PSD(58.81," D IX^DIK K DA,DIK
31 ;update new order and prev trans #
32 S $P(^PSD(58.8,AOU,1,PSDRG,3,PSDRN,0),"^",17)=PSDREC
33 S $P(^PSD(58.81,PSDA,7),"^",4)=RECD,$P(^(7),"^",5)=PSDUZ,$P(^(7),"^",3)=AOU
34BAL ;update naou to balance ; *64 - balance will not change
35COMP ;completed msg
36 W "done.",!!
37 S STAT=$P($G(^PSD(58.81,PSDREC,0)),"^",11)
38 W ?2,!,"*** The status of your Green Sheet #"_PSDPN_" is now",!,?2,$S($P($G(^PSD(58.82,STAT,0)),"^")]"":$P(^(0),"^"),1:"UNKNOWN")_" ***",!
39 G:'FLAG END
40MSG ;send mail message
41 K XMY,^TMP("PSDNTMSG",$J) S ^TMP("PSDNTMSG",$J,1,0)="CS PHARM Transfer Green Sheet between NAOUs",^TMP("PSDNTMSG",$J,2,0)="Transfer In Date: "_RECDT
42 S ^TMP("PSDNTMSG",$J,3,0)=""
43 S ^TMP("PSDNTMSG",$J,4,0)="Drug: "_PSDRGN_" Green Sheet #"_PSDPN
44 S ^TMP("PSDNTMSG",$J,5,0)="Transfer to: "_AOUN
45 S ^TMP("PSDNTMSG",$J,6,0)="",^TMP("PSDNTMSG",$J,7,0)="This drug has been inactivated."
46 S XMSUB="CS PHARM TRANSFER GREEN SHEET INACTIVATE DRUG",XMTEXT="^TMP(""PSDNTMSG"",$J,",XMDUZ="CONTROLLED SUBSTANCES PHARMACY"
47 F JJ=0:0 S JJ=$O(^XUSEC("PSDMGR",JJ)) Q:'JJ S XMY(JJ)=""
48 S:'$D(XMY) XMY(.5)="" D ^XMD K XMY,^TMP("PSDNTMSG",$J)
49END Q
50DRUG ;add drug and inactivate it
51 S:'$D(^PSD(58.8,AOU,1,0)) ^(0)="^58.8001IP^^"
52 K DA,DIC,DIE,DD,DO S (DIC,DIE)="^PSD(58.8,"_AOU_",1,",(X,DINUM)=+PSDRG,DA(1)=AOU,DIC(0)="L" D FILE^DICN K DIC I Y<0 S PSDOUT=1 Q
53 K DA,DR S DA=PSDRG,DA(1)=AOU,DR="13////"_PSDT_";14////O;14.5////TRANSFER FROM ANOTHER NAOU" D ^DIE K DA,DIE,DR
54 S FLAG=1
55 Q
Note: See TracBrowser for help on using the repository browser.