Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PSALOG1

PSALOG1.m

Go to the documentation of this file.
PSALOG1 ;BIR/LTL,JMB-Unposted Procurement History - CONT'D ;7/23/97
 ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;; 10/24/97
 ;This routine prints the pharmacy procurement history Item Totals report
 ;for a selected month. This routine is called by PSALOG.
 ;
TOTALS S (PSAPG,PSACP,PSAIEN)=0,PSAITEM="" D HDR
 I '$D(^TMP("PSA",$J)) W !!,"No items were found for the selected month." G END^PSALOG0
 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
 .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
 ..S PSATMP=$G(^TMP("PSA",$J,PSACP,PSAITEM,PSAIEN))
 ..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")
 ..W !," Vendor: ",$$VENNAME^PRCPUX1($P($G(^PRC(442,+PSAIEN,1)),"^")_"PRC(440")
 ..S PSAUNIT=$$UNITCODE^PRCPUX1($P(PSATMP,"^",3))
 ..I $Y+7>IOSL D HDR Q:PSAOUT
 ..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"
 ..W !!," "_$E($P($G(^PRC(442,+PSAIEN,0)),"^"),5,10) S PSAFCP=$P($G(^(0)),"^",3)
 ..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")
 ..S PSAQTYO=$P(PSATMP,"^",2),PSATQTYO=$G(PSATQTYO)+PSAQTYO
 ..W ?9,PSADATE,$J(PSAQTYO,8)_" ",PSAUNIT
 ..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
 ..S X=$P(PSATMP,"^",9),X2="2$",X3=10 D COMMA^%DTC W ?40,X
 ..S X=PSAQTYO*$P(PSATMP,"^",9),PSATOTO=$G(PSATOTO)+X,X2="2$" D COMMA^%DTC W ?56,X
 ..S X=PSAQTYP*$P(PSATMP,"^",9),PSATOTR=$G(PSATOTR)+X,X2="2$" D COMMA^%DTC W ?70,X
 ..W !,PSASLN
 ..I '$O(^TMP("PSA",$J,PSACP,PSAITEM,PSAIEN)),$G(PSAMORE) D  Q:PSAOUT
 ...I $Y+4>IOSL D HDR Q:PSAOUT
 ...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
 ..K PSAMORE,PSATQTYO,PSATOTP
 ..S:$O(^TMP("PSA",$J,PSACP,PSAITEM,PSAIEN)) PSAMORE=1
 ..I '$O(^TMP("PSA",$J,PSACP,PSAITEM,PSAIEN)) S ^TMP("PSAC",$J,(999999999-PSATOTO),PSAITEM)=PSATOTO_"^"_PSACP K PSATOTO
 G END^PSALOG0
HDR I $E(IOST,1,2)="C-",PSAPG D  Q:PSAOUT
 .S PSASS=22-$Y F PSAKK=1:1:PSASS W !
 .S DIR(0)="E" D ^DIR K DIR S:'Y PSAOUT=1
 I $$S^%ZTLOAD W !!,"Task #",$G(ZTSK),", ",$G(ZTDESC)," was stopped by ",$P($G(^VA(200,+$G(DUZ),0)),"^"),"." S PSAOUT=1 Q
 W:$Y @IOF S PSAPG=PSAPG+1
 W:$E(IOST)'="C" !!,PSARPDT W:$E(IOST,1,2)="C-" !
 W ?20,"DRUG ACCOUNTABILITY/INVENTORY INTERFACE",?72,"PAGE ",$J(PSAPG,2)
 W !?11,"UNPOSTED PHARMACY PROCUREMENTS FOR "_PSAMOYR_" ITEM TOTALS REPORT"
 W:$E(IOST)'="C" ! W !,PSADLN
 Q