source: FOIAVistA/trunk/r/DRUG_ACCOUNTABILITY-PSA/PSAGIP.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 4.3 KB
Line 
1PSAGIP ;BIR/LTL,JMB-DA receiving from GIP ;7/23/97
2 ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**8,64**; 10/24/97;Build 4
3 Q
4EN(PSAGIP,PSAITEM,PSAQTY,PSAISS,PSAEX,PSATR,PSACOST,PSANDC) ; GIP passes recing data
5 ;PSAGIP=D0 from #445, PSAITEM=D0 from #441,
6 ;PSAQTY=qty rec'd converted to dispensing unit, PSAISS=D0 from #410,
7 ;PSAEX=external form of D0 from either #410 or #442,
8 ;PSATR=D0 from #445.2, PSACOST=total cost of receipt,
9 ;PSANDC=NDC with dashes
10 Q:'$G(PSAQTY)
11 Q:'$O(^PSD(58.8,"P",+$G(PSAGIP),"")) ; GIP not linked to DA location
12 ;check item linked to drug, drug stocked by DA loc, rec fail flag
13 N PSALOC S PSALOC=$O(^PSD(58.8,"P",+$G(PSAGIP),0)),PSADRUG=+$O(^PSDRUG("AB",+$G(PSAITEM),0))
14 S ^TMP("PSAC",$J,+PSALOC)=$G(PSAGIP)_U_$G(PSAEX)
15 I 'PSADRUG,$P($G(^PSD(58.8,+PSALOC,4,+$G(PSAGIP),0)),U,2) S ^TMP("PSAB",$J,+$G(PSAITEM))="#"+$G(PSAITEM)_" "_$$DESCR^PRCPUX1($G(PSAGIP),$G(PSAITEM))_" NOT LINKED." Q
16 I '$D(^PSD(58.8,+PSALOC,1,PSADRUG,0)),$P($G(^PSD(58.8,+PSALOC,4,+$G(PSAGIP),0)),U,2) S ^TMP("PSAB",$J,+$G(PSAITEM))="#"_$G(PSAITEM)_" "_$$DESCR^PRCPUX1($G(PSAGIP),$G(PSAITEM))_" NOT STOCKED." Q
17 Q:'$D(^PSD(58.8,+PSALOC,1,$G(PSADRUG),0))
18 S ^TMP("PSA",$J,$G(PSADRUG))=$G(PSAQTY)_U_$G(PSAISS)_U_$G(PSAEX)_U_$G(PSATR)_U_$G(PSACOST)_U_$G(PSAITEM)_U_$G(PSANDC)
19 Q
20EX N ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTDTH,ZTSK,PSALOC,PSADAT,PSAB,PSAT,PSAGIP
21 Q:'$O(^TMP("PSAC",$J,0))
22 Q:'$O(^TMP("PSA",$J,0))&('$O(^TMP("PSAB",$J,0)))
23 S PSALOC=$O(^TMP("PSAC",$J,0)),PSAGIP=$P($G(^TMP("PSAC",$J,+PSALOC)),U)
24 S ZTDTH=$H,ZTIO="",ZTRTN="TSK^PSAGIP",ZTDESC="GIP/DA Receiving"
25 S ZTSAVE("PSALOC")="",ZTSAVE("PSAGIP")=""
26 S:$O(^TMP("PSA",$J,0)) ZTSAVE("^TMP(""PSA"",$J,")=""
27 S:$O(^TMP("PSAB",$J,0)) ZTSAVE("^TMP(""PSAB"",$J,")=""
28 S ZTSAVE("^TMP(""PSAC"",$J,")=""
29 D ^%ZTLOAD,HOME^%ZIS
30 K IO("Q"),^TMP("PSA",$J),^TMP("PSAB",$J),^TMP("PSAC",$J)
31 Q
32TSK N PSAM
33 S:$P($G(^PSD(58.8,+PSALOC,0)),U,2)="M" PSAM=1
34 F PSADRUG=0:0 S PSADRUG=$O(^TMP("PSA",$J,PSADRUG)) Q:'PSADRUG S PSAQTY=$P($G(^TMP("PSA",$J,PSADRUG)),U),PSAISS=$P($G(^(PSADRUG)),U,2),PSAP=$P($G(^(PSADRUG)),U,3),PSATR=$P($G(^(PSADRUG)),U,4),PSACOST=$P($G(^(PSADRUG)),U,5) D
35 .S PSANDC=$P($G(^TMP("PSA",$J,PSADRUG)),U,7) D ^PSAGIP1
36 .S:'$P(PSAP,"-",3) PSAPO=PSAP
37 .L +^PSD(58.8,+PSALOC,1,+PSADRUG):5
38 .D NOW^%DTC S PSADAT=+$E(%,1,12) K %
39 .S PSAB=$P($G(^PSD(58.8,+PSALOC,1,+PSADRUG,0)),U,4)
40 .S $P(^PSD(58.8,+PSALOC,1,+PSADRUG,0),U,4)=$G(PSAQTY)+PSAB
41 .L -^PSD(58.8,+PSALOC,1,+PSADRUG)
42MON .S:'$D(^PSD(58.8,+PSALOC,1,+PSADRUG,5,0)) ^(0)="^58.801A^^"
43 .I '$D(^PSD(58.8,+PSALOC,1,+PSADRUG,5,$E(DT,1,5)*100,0)) S DIC="^PSD(58.8,+PSALOC,1,+PSADRUG,5,",DIC(0)="LM",DIC("DR")="1////^S X=$G(PSAB)" D
44 ..S (X,DINUM)=$E(DT,1,5)*100,DA(2)=PSALOC,DA(1)=PSADRUG,DLAYGO=58.8 D ^DIC K DIC,DINUM,DLAYGO,X
45 ..S X="T-1M" D ^%DT S DIC="^PSD(58.8,+PSALOC,1,+PSADRUG,5,",DIC(0)="L",(X,DINUM)=$E(Y,1,5)*100,DA(2)=PSALOC,DA(1)=PSADRUG,DLAYGO=58.8 D ^DIC K DIC,DINUM,DLAYGO,X S DA=+Y K Y
46 ..S DIE="^PSD(58.8,+PSALOC,1,+PSADRUG,5,",DA(2)=PSALOC,DA(1)=PSADRUG
47 ..S DR="3////^S X=$G(PSAB)" D ^DIE K DIE,DR
48 .S DIE="^PSD(58.8,+PSALOC,1,+PSADRUG,5,",DA(2)=PSALOC,DA(1)=PSADRUG,DA=$E(DT,1,5)*100,DR="5////^S X=$P($G(^(0)),U,3)+$G(PSAQTY)" D ^DIE K DIE,DR
49TR .F L +^PSD(58.81,0):$S($G(DILOCKTM)>0:DILOCKTM,1:3) I Q
50FIND .D FIND1 S DIC="^PSD(58.81,",DIC(0)="L",DLAYGO=58.81,(DINUM,X)=PSAT D ^DIC K DIC,DINUM,DLAYGO L -^PSD(58.81,0)
51 .S DIE="^PSD(58.81,",DA=PSAT
52 .S DR="1////^S X=$S($E($G(PSATR))=""R"":1,1:9);2////^S X=$G(PSALOC);3////^S X=PSADAT;4////^S X=$G(PSADRUG);5////^S X=$G(PSAQTY);6////^S X=DUZ;7////^S X=$G(PSAISS);8///^S X=$G(PSAPO);9////^S X=PSAB;100////^S X=$G(PSAM)"
53 .D ^DIE K DIE,DR
54 .S:'$D(^PSD(58.8,+PSALOC,1,+PSADRUG,4,0)) ^(0)="^58.800119PA^^"
55 .S DIC="^PSD(58.8,+PSALOC,1,+PSADRUG,4,",DIC(0)="L",(X,DINUM)=PSAT
56 .S DA(2)=PSALOC,DA(1)=PSADRUG,DLAYGO=58.8 D ^DIC K DA,DIC,DLAYGO,DINUM,PSAB,PSAISS,PSANDC,PSAPO,PSAQTY,PSATR
57 K ^TMP("PSA",$J)
58 Q:'$O(^TMP("PSAB",$J,0))
59 S:'$G(PSAP) PSAP=$P($G(^TMP("PSAC",$J,PSALOC)),U,2)
60 S XMDUZ="Failed Receipt Notifier",XMSUB="Failed DA/GIP Receipts - "_PSAP
61 S XMY(DUZ)=""
62 I $P($G(^PSD(58.8,+PSALOC,4,+$G(PSAGIP),0)),U,3)'="" S XX=$P(^(0),"^",3),XXX="G."_XX,XMY(XXX)="" K XX,XXX
63 S XMTEXT="^TMP(""PSAB"",$J,"
64 G:'$D(XMY) QUIT1 D ^XMD
65QUIT1 K XMDUZ,XMSUB,XMTEXT,XMY
66 S:$D(ZTQUEUED) ZTREQ="@" K ^TMP("PSAB",$J)
67QUIT Q
68FIND1 S PSAT=$P(^PSD(58.81,0),U,3)+1 I $D(^PSD(58.81,PSAT)) S $P(^PSD(58.81,0),U,3)=$P(^PSD(58.81,0),U,3)+1 G FIND1
69 Q
Note: See TracBrowser for help on using the repository browser.