source: FOIAVistA/trunk/r/DRUG_ACCOUNTABILITY-PSA/PSAUNI.m@ 674

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

initial load of FOIAVistA 6/30/08 version

File size: 2.8 KB
Line 
1PSAUNI ;BIR/LTL-Unlinked Drugs in the ITEM MASTER file ;7/23/97
2 ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**15**; 10/24/97
3 ;
4 ;References to ^PSDRUG("AB" are covered by IA #2095
5 ;References to ^PRC( are covered by IA #214
6 ;
7 ;Check ITEM FILE for unlinked drugs
8 ;This report lists each active drug in the ITEM MASTER FILE that has not
9 ;yet been linked to an entry in the DRUG FILE. If you enter a date from
10 ;which to begin, only items that have been purchased since that date
11 ;will be listed.
12 ;
13 N DIR,PSA,PSADT,X,Y D DT^DICRW
14 S DIR(0)="D^::AEX",DIR("A")="Please enter oldest purchase date to include",DIR("B")="T-12M",DIR("?")="I will check each active drug to make sure it has been purchased since this date" W ! D ^DIR K DIR I 'Y S PSAOUT=1 G END
15 S PSADT=Y X ^DD("DD") S PSADT(1)=Y
16DEV ;asks device and queueing info
17 K I,IO("Q") N %ZIS,DTOUT,DUOUT,IOP,POP,PSAOUT S %ZIS="Q" W ! D ^%ZIS I POP W !,"NO DEVICE SELECTED OR REPORT PRINTED!" S PSAOUT=1 G END
18 I $D(IO("Q")) N ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTDTH,ZTSK S ZTRTN="START^PSAUNI",ZTSAVE("PSA*")="",ZTDESC="Active, Unlinked Drug Report" D ^%ZTLOAD,HOME^%ZIS S PSAOUT=1 G END
19START ;compiles and prints data for report
20 N PSALN,PSAPG S (PSA,PSAPG,PSAOUT)=0 D HEADER
21LOOP F S PSA=$O(^PRC(441,PSA)) G:'PSA!(PSAOUT) END D:$Y+10>IOSL HEADER I $P($G(^PRC(441,+PSA,0)),U,3)=6505,'$G(^PRC(441,+PSA,3)),$O(^PRC(441,+PSA,4,0)),'$O(^PSDRUG("AB",PSA,"")) D
22 .W:$E(IOST,1,2)="C-" "."
23 .S PSA(1)=0
24 .F S PSA(1)=$O(^PRC(441,+PSA,4,PSA(1))) Q:'PSA(1)!('$O(^PRC(441,+PSA,4,PSA(1),1,0))) D Q:$G(PSA(3))
25 ..S PSA(2)=0 F S PSA(2)=$O(^PRC(441,+PSA,4,PSA(1),1,PSA(2))) Q:'PSA(2) I $P($G(^PRC(442,+$G(^PRC(441,+PSA,4,PSA(1),1,PSA(2),0)),1)),U,15)>PSADT D Q
26 ...W !!,"ITEM #: ",PSA," ",$P($G(^PRC(441,+PSA,0)),U,2),!!,"NSN: ",$P($G(^(0)),U,5),?25,"LAST VENDOR ORDERED: ",$E($P($G(^PRC(440,+$P($G(^PRC(441,+PSA,0)),U,4),0)),U),1,30)
27 ...W !!,"NDC: ",$P($G(^PRC(441,+PSA,2,+$P($G(^PRC(441,+PSA,0)),U,4),0)),U,5)
28 ...S PSA(3)=1
29 ...W ?20,"LONG DESCRIPTION: "
30 ...I $L(^PRC(441,+PSA,1,1,0))<40,'$O(^PRC(441,+PSA,1,1)) W $G(^PRC(441,+PSA,1,1,0)),! Q
31 ...K ^UTILITY($J,"W") S DIWL=40,DIWR=80,DIWF="W"
32 ...S PSA(4)=0
33 ...F S PSA(4)=$O(^PRC(441,+PSA,1,PSA(4))) Q:'PSA(4) S X=$G(^PRC(441,+PSA,1,PSA(4),0)) D ^DIWP D ^DIWW
34END I $E(IOST)'="C" W @IOF
35 I $E(IOST,1,2)="C-",'PSAOUT W !! S DIR(0)="EA",DIR("A")="END OF REPORT! Press <RET> to return to the menu." D ^DIR
36 D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@" K IO("Q")
37 Q
38HEADER ;prints header info
39 I $E(IOST,1,2)'="P-",PSAPG S DIR(0)="E" D ^DIR K DIR I 'Y S PSAOUT=1 Q
40 I $$S^%ZTLOAD W !!,"Task #",$G(ZTSK),", ",$G(ZTDESC)," was stopped by ",$P($G(^VA(200,+$G(DUZ),0)),U),"." S PSAOUT=1 Q
41 W:$Y @IOF S $P(PSALN,"-",81)="",PSAPG=PSAPG+1 W !?2,"UNLINKED ITEM MASTER file DRUGS PURCHASED SINCE ",PSADT(1),?70,"PAGE: "_PSAPG,!,PSALN,!!
42 Q
Note: See TracBrowser for help on using the repository browser.