source: WorldVistAEHR/trunk/r/DRUG_ACCOUNTABILITY-PSA/PSADRU.m@ 1211

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

initial load of WorldVistAEHR

File size: 3.1 KB
RevLine 
[613]1PSADRU ;BIR/LTL-Drugs Not Found in Linked Inventory ;7/23/97
2 ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**15**; 10/24/97
3 ;This routine reports the inventory/DA items.
4 ;References to $$DESCR^PRCPUX1 are covered by IA #259
5 ;References to $$INVNAME^PRCPUX1 are covered by IA #259
6 ;References to ^PSDRUG( are covered by IA #2095
7 ;References to ^PRCP( are covered by IA #214
8 ;
9SETUP N D0,D1,DA,DIE,DIC,DIR,DIRUT,DLAYGO,DR,DTOUT,DUOUT,PSA,PSADRUG,PSAINV,PSAOUT,X,Y
10 ;LOOK UP LOCATION
11LOOK D ^PSADA I '$G(PSALOC) S PSAOUT=1 G QUIT
12 I '$O(^PSD(58.8,+PSALOC,1,0)) W !!,"There are no drugs in ",PSALOCN S PSAOUT=1 G QUIT
13NOINV I '$O(^PSD(58.8,PSALOC,4,0)) W !,$G(PSALOCN)_" is not linked to an Inventory Point.",! D G:$G(PSAOUT) QUIT
14 .S DIR(0)="Y",DIR("A")="Would you like to attempt a link now",DIR("B")="Yes" D ^DIR K DIR S:Y'=1 PSAOUT=1 Q:Y'=1 D I $D(Y) S PSAOUT=1 Q
15INV ..S DIE=58.8,DA=PSALOC,DR="[PSAGIP]" D ^DIE K DIE
16DEV K IO("Q") N %ZIS,IOP,POP S %ZIS="Q" D ^%ZIS I POP W !,"NO DEVICE SELECTED OR REPORT PRINTED!" S PSAOUT=1 G QUIT
17 I $D(IO("Q")) N ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTDTH,ZTSK S ZTRTN="START^PSADRU",ZTDESC="DA Location items not found in Inventory",ZTSAVE("PSA*")="" D ^%ZTLOAD,HOME^%ZIS S PSAOUT=1 G QUIT
18START N %DT,PSALN,PSAIT,PSAL,PSAD,PSAPG,PSARPDT,X,Y S (PSAPG,PSAOUT)=0,Y=DT D DD^%DT S PSARPDT=Y,PSAIT=0
19 S PSA=0
20 D HEADER
21LOOP F S PSA=$O(^PSD(58.8,+PSALOC,1,PSA)) Q:'PSA D:$Y+6>IOSL HEADER Q:PSAOUT D Q:PSAOUT
22 .W !!,$P($G(^PSDRUG(+PSA,0)),U)
23 .S PSA(1)=$O(^PSDRUG(+PSA,441,0))
24 .I 'PSA(1) W !!,"NOT CONNECTED TO THE ITEM MASTER FILE",!,PSALN Q
25 .S PSA(2)=$G(^PSDRUG(+PSA,441,+PSA(1),0)),PSAINV=0
26 .I '$O(^PSDRUG(+PSA,441,+PSA(1))) D Q
27 ..W !!,"CONNECTED TO: (",PSA(2),") ",$$DESCR^PRCPUX1(0,PSA(2))
28 ..I '$O(^PRCP(445,"AE",+PSA(2),0)) W !!,"BUT NOT STOCKED BY AN INVENTORY POINT.",!,PSALN Q
29 ..F S PSAINV=$O(^PRCP(445,"AE",+PSA(2),PSAINV)) Q:'PSAINV W !!,"AND STOCKED BY ",$$INVNAME^PRCPUX1(PSAINV),!,PSALN
30 .W !!,"CONNECTED TO THE FOLLOWING ITEMS:"
31 .S PSA(1)=0
32 .F S PSA(1)=$O(^PSDRUG(+PSA,441,PSA(1))) Q:'PSA(1) D:$Y+6>IOSL HEADER Q:PSAOUT D
33 ..S PSA(2)=$G(^PSDRUG(+PSA,441,+PSA(1),0)),PSAINV=0
34 ..W !!,"(",PSA(2),") ",$$DESCR^PRCPUX1(0,PSA(2))
35 ..I '$O(^PRCP(445,"AE",+PSA(2),0)) W !!,"BUT NOT STOCKED BY AN INVENTORY POINT.",!,PSALN Q
36 ..F S PSAINV=$O(^PRCP(445,"AE",+PSA(2),PSAINV)) Q:'PSAINV W !!,"AND STOCKED BY ",$$INVNAME^PRCPUX1(PSAINV),!,PSALN
37QUIT I $E(IOST)'="C" W @IOF
38 I $E(IOST,1,2)="C-",'$G(PSAOUT) W !! S DIR(0)="EA",DIR("A")="END OF REPORT! Press <RET> to return to the menu." D ^DIR
39 D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@" K IO("Q")
40 K PSAIT Q
41HEADER I $E(IOST,1,2)'="P-",PSAPG S DIR(0)="E" D ^DIR K DIR I 'Y S PSAOUT=1 Q
42 I $$S^%ZTLOAD W !!,"Task #",$G(ZTSK),", ",$G(ZTDESC)," was stopped by ",$P($G(^VA(200,+$G(DUZ),0)),U),"." S PSAOUT=1 Q
43 ;DAVE B found bug in next line while making changes for
44 ;PSA*3*25 because the value is a pointer not free text.
45 D OPSITE^PSAUTL1 S PSAINV(2)=PSAOSITN
46 ;S:$E(PSAINV(2),10)="(" PSAINV(2)=$E(PSAINV(2),1,8)
47 W:$Y @IOF S $P(PSALN,"-",81)="",PSAPG=PSAPG+1 W !,PSAINV(2)_"'S Items Relationship to an Inventory Point",?56,PSARPDT,?70,"PAGE: "_PSAPG,!,PSALN
48 Q
Note: See TracBrowser for help on using the repository browser.