source: WorldVistAEHR/trunk/r/DRUG_ACCOUNTABILITY-PSA/PSALOG1.m@ 1581

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

initial load of WorldVistAEHR

File size: 2.9 KB
RevLine 
[613]1PSALOG1 ;BIR/LTL,JMB-Unposted Procurement History - CONT'D ;7/23/97
2 ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;; 10/24/97
3 ;This routine prints the pharmacy procurement history Item Totals report
4 ;for a selected month. This routine is called by PSALOG.
5 ;
6TOTALS S (PSAPG,PSACP,PSAIEN)=0,PSAITEM="" D HDR
7 I '$D(^TMP("PSA",$J)) W !!,"No items were found for the selected month." G END^PSALOG0
8 F PSAC=0:1 S PSACP=$O(^TMP("PSA",$J,PSACP)) Q:'PSACP!(PSAOUT) D:PSAC HDR G:PSAOUT END^PSALOG0 W !," << STATION/CP: "_PSACP_" >>" D G:PSAOUT END^PSALOG0
9 .F S PSAITEM=$O(^TMP("PSA",$J,PSACP,PSAITEM)) Q:PSAOUT!(PSAITEM']"") D:$Y+6>IOSL HDR Q:PSAOUT F S PSAIEN=$O(^TMP("PSA",$J,PSACP,PSAITEM,PSAIEN)) Q:PSAOUT!('PSAIEN) D:$Y+4>IOSL HDR Q:PSAOUT D
10 ..S PSATMP=$G(^TMP("PSA",$J,PSACP,PSAITEM,PSAIEN))
11 ..W:'$G(PSAMORE) !,$E(PSAITEM,1,50),$S($P(PSATMP,"^",5):" ("_$P(PSATMP,"^",5)_")",1:""),?60,"NDC: ",$P(PSATMP,"^",15),!," DRUG file: ",$S($P($G(^PSDRUG(+$O(^PSDRUG("AB",+$P(PSATMP,"^",5),0)),0)),"^")]"":$P($G(^(0)),"^"),1:"Not connected yet")
12 ..W !," Vendor: ",$$VENNAME^PRCPUX1($P($G(^PRC(442,+PSAIEN,1)),"^")_"PRC(440")
13 ..S PSAUNIT=$$UNITCODE^PRCPUX1($P(PSATMP,"^",3))
14 ..I $Y+7>IOSL D HDR Q:PSAOUT
15 ..W:'$G(PSAMORE) !!," PO#",?9,"DATE",?21,"QTY",?32,"QTY",?44,"$/",PSAUNIT,?60,"TOTAL",?74,"TOTAL",!?21,"ORD",?31,"REC'D",?60,"ORD",?74,"REC'D"
16 ..W !!," "_$E($P($G(^PRC(442,+PSAIEN,0)),"^"),5,10) S PSAFCP=$P($G(^(0)),"^",3)
17 ..S Y=$P($G(^PRC(442,+PSAIEN,1)),"^",15) X ^DD("DD") S PSADATE=$S($L(Y)=10:$E(Y,1,5),$L(Y)=11:$E(Y,1,6),1:"UNKNOWN")
18 ..S PSAQTYO=$P(PSATMP,"^",2),PSATQTYO=$G(PSATQTYO)+PSAQTYO
19 ..W ?9,PSADATE,$J(PSAQTYO,8)_" ",PSAUNIT
20 ..S PSAQTYP=$P($G(^PRC(442,+PSAIEN,2,+$O(^PRC(442,+PSAIEN,2,"B",+$P(PSATMP,"^"),0)),2)),"^",8),PSATOTP=$G(PSATOTP)+PSAQTYP W $J(PSAQTYP,8)_" ",PSAUNIT
21 ..S X=$P(PSATMP,"^",9),X2="2$",X3=10 D COMMA^%DTC W ?40,X
22 ..S X=PSAQTYO*$P(PSATMP,"^",9),PSATOTO=$G(PSATOTO)+X,X2="2$" D COMMA^%DTC W ?56,X
23 ..S X=PSAQTYP*$P(PSATMP,"^",9),PSATOTR=$G(PSATOTR)+X,X2="2$" D COMMA^%DTC W ?70,X
24 ..W !,PSASLN
25 ..I '$O(^TMP("PSA",$J,PSACP,PSAITEM,PSAIEN)),$G(PSAMORE) D Q:PSAOUT
26 ...I $Y+4>IOSL D HDR Q:PSAOUT
27 ...W !?6,"TOTALS=>",$J(PSATQTYO,8),?25,$J(PSATOTP,8) S X=PSATOTO,X2="2$" D COMMA^%DTC W ?55,X S X=PSATOTR,X2="2$" D COMMA^%DTC W ?70,X,!,PSADLN
28 ..K PSAMORE,PSATQTYO,PSATOTP
29 ..S:$O(^TMP("PSA",$J,PSACP,PSAITEM,PSAIEN)) PSAMORE=1
30 ..I '$O(^TMP("PSA",$J,PSACP,PSAITEM,PSAIEN)) S ^TMP("PSAC",$J,(999999999-PSATOTO),PSAITEM)=PSATOTO_"^"_PSACP K PSATOTO
31 G END^PSALOG0
32HDR I $E(IOST,1,2)="C-",PSAPG D Q:PSAOUT
33 .S PSASS=22-$Y F PSAKK=1:1:PSASS W !
34 .S DIR(0)="E" D ^DIR K DIR S:'Y PSAOUT=1
35 I $$S^%ZTLOAD W !!,"Task #",$G(ZTSK),", ",$G(ZTDESC)," was stopped by ",$P($G(^VA(200,+$G(DUZ),0)),"^"),"." S PSAOUT=1 Q
36 W:$Y @IOF S PSAPG=PSAPG+1
37 W:$E(IOST)'="C" !!,PSARPDT W:$E(IOST,1,2)="C-" !
38 W ?20,"DRUG ACCOUNTABILITY/INVENTORY INTERFACE",?72,"PAGE ",$J(PSAPG,2)
39 W !?11,"UNPOSTED PHARMACY PROCUREMENTS FOR "_PSAMOYR_" ITEM TOTALS REPORT"
40 W:$E(IOST)'="C" ! W !,PSADLN
41 Q
Note: See TracBrowser for help on using the repository browser.