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

PRCPRDO1.m

Go to the documentation of this file.
PRCPRDO1 ;WISC/RFJ-distribution duein and dueout reports ; 7/9/99 3:39pm
V ;;5.1;IFCAP;;Oct 20, 2000
 ;Per VHA Directive 10-93-142, this routine should not be modified.
 Q
 ;
 ;
DQ ;  queue comes here
 N %,%I,D,DATA,INVPT,ITEMDA,ITEMDATA,NOW,ORDDATA,ORDERDA,PAGE,PRCPFLAG,PRIMARDA,QTY,SCREEN,SECONDA,TOTAL,VDA,VDATA,XREF,X,Y
 K ^TMP($J,"PRCPRDOR")
 S XREF="AC" I PRCP("DPTYPE")="S" S XREF="AD"
 S ORDERDA=0 F  S ORDERDA=$O(^PRCP(445.3,XREF,PRCP("I"),ORDERDA)) Q:'ORDERDA  D
 .   I $G(UPDATE) L +^PRCP(445.3,ORDERDA)
 .   S ORDDATA=$G(^PRCP(445.3,ORDERDA,0))
 .   I $P(ORDDATA,"^",6)=""!($P(ORDDATA,"^",6)="P") L -^PRCP(445.3,ORDERDA) Q
 .   S PRIMARDA=+$P(ORDDATA,"^",2),SECONDA=+$P(ORDDATA,"^",3)
 .   S ITEMDA=0 F  S ITEMDA=$O(^PRCP(445.3,ORDERDA,1,ITEMDA)) Q:'ITEMDA  S ITEMDATA=$G(^PRCP(445.3,ORDERDA,1,ITEMDA,0)) I ITEMDATA'="" D
 .   .   S QTY=$P(ITEMDATA,"^",2)
 .   .   S VDATA=$$GETVEN^PRCPUVEN(SECONDA,ITEMDA,PRIMARDA_";PRCP(445,",1)
 .   .   S ^TMP($J,"PRCPRDOR",ITEMDA,ORDERDA)=PRIMARDA_"^"_SECONDA_"^"_(QTY*$P(VDATA,"^",4))_"^"_QTY_"^"_$$UNIT^PRCPUX1(PRIMARDA,ITEMDA,"/")_"^"_$$UNIT^PRCPUX1(SECONDA,ITEMDA,"/")_"^"_$P(VDATA,"^",4)
 .   I $G(UPDATE) L -^PRCP(445.3,ORDERDA)
 ;
 ;  print report from tmp global
 K ^TMP($J,"PRCPUPDATE")
 D NOW^%DTC S Y=% D DD^%DT S NOW=Y,PAGE=1,SCREEN=$$SCRPAUSE^PRCPUREP U IO D H
 S ITEMDA=0 F  S ITEMDA=$O(^TMP($J,"PRCPRDOR",ITEMDA)) Q:'ITEMDA!($G(PRCPFLAG))  D
 .   S ITEMDATA=$G(^PRCP(445,PRCP("I"),1,ITEMDA,0))
 .   S QTY=$S(TYPE="IN":$$GETIN^PRCPUDUE(PRCP("I"),ITEMDA),1:$$GETOUT^PRCPUDUE(PRCP("I"),ITEMDA))
 .   W !!,$E($$DESCR^PRCPUX1(PRCP("I"),ITEMDA),1,25),?27,"#",ITEMDA,?35,$J($$UNIT^PRCPUX1(PRCP("I"),ITEMDA,"/"),9),$J(+$P(ITEMDATA,"^",7),15),$J(QTY,21)
 .   S (ORDERDA,TOTAL)=0 F  S ORDERDA=$O(^TMP($J,"PRCPRDOR",ITEMDA,ORDERDA)) Q:'ORDERDA!($G(PRCPFLAG))  S DATA=^(ORDERDA) D
 .   .   S D=$G(^PRCP(445.3,ORDERDA,0)),Y=$P($P(D,"^",4),".") S:'Y Y="?" D DD^%DT
 .   .   W !?5,$P(D,"^"),?12,Y,?24,$S($P(D,"^",8)="R":"REGU",$P(D,"^",8)="C":"CALL",$P(D,"^",8)="E":"EMER",1:"----"),?29,$S($P(D,"^",6)="R":"RELE",$P(D,"^",6)="B":"BACK",1:"----")
 .   .   S INVPT=$P(DATA,"^") I TYPE="OUT" S INVPT=$P(DATA,"^",2)
 .   .   W ?36,$E($P($$INVNAME^PRCPUX1(INVPT),"-",2),1,16)
 .   .   I TYPE="OUT" W ?69,$J(+$P(DATA,"^",4),11) S TOTAL=TOTAL+$P(DATA,"^",4)
 .   .   I TYPE="IN" W ?53,$J($P(DATA,"^",6),9),$J($P(DATA,"^",7),7),$J(+$P(DATA,"^",3),11) S TOTAL=TOTAL+$P(DATA,"^",3)
 .   .   I $Y>(IOSL-5) D:SCREEN P^PRCPUREP Q:$G(PRCPFLAG)  D H
 .   I $G(PRCPFLAG) Q
 .   I +TOTAL'=+QTY W !?5,"** CURRENT QUANTITY DUE-",TYPE,$S($G(UPDATE):" IS NOW EQUAL TO",1:" DOES NOT MATCH")," CALCULATED QUANTITY DUE-",TYPE," **"
 .   I $G(UPDATE) S ^TMP($J,"PRCPUPDATE",ITEMDA)=TOTAL
 .   I $Y>(IOSL-5) D:SCREEN P^PRCPUREP Q:$G(PRCPFLAG)  D H
 ;
 ;  update dueins or dueouts
 I $G(UPDATE) S ITEMDA=0 F  S ITEMDA=$O(^PRCP(445,PRCP("I"),1,ITEMDA)) Q:'ITEMDA  I $D(^(ITEMDA,0)) D
 .   ;  subtract off current qty duein,out to reset to zero
 .   S QTY=$G(^TMP($J,"PRCPUPDATE",ITEMDA))-$S(TYPE="IN":$$GETIN^PRCPUDUE(PRCP("I"),ITEMDA),1:$$GETOUT^PRCPUDUE(PRCP("I"),ITEMDA))
 .   I TYPE="IN" D SETIN^PRCPUDUE(PRCP("I"),ITEMDA,QTY) Q
 .   D SETOUT^PRCPUDUE(PRCP("I"),ITEMDA,QTY)
 ;
 I '$G(PRCPFLAG) D END^PRCPUREP
 D ^%ZISC
 K ^TMP($J,"PRCPRDOR"),^TMP($J,"PRCPUDPATE")
 Q
 ;
 ;
H S %=NOW_"  PAGE "_PAGE,PAGE=PAGE+1 I PAGE'=2!(SCREEN) W @IOF
 W $C(13),"DUE-",TYPE," ITEM REPORT FOR ",PRCP("IN"),?(80-$L(%)),%
 W !,"ITEM DESCRIPTION",?27,"#MI",?35,$J("UNIT/IS",9),$J("QTY ON-HAND",15),$J("QTY DUE-"_TYPE,21)
 W !?5,"ORD#",?12,"DATE ORD",?24,"TYPE",?29,"STAT",?36,$S(TYPE="IN":"FROM",1:"TO")," INVPT"
 I TYPE="OUT" W ?69,"QTY DUE-OUT"
 I TYPE="IN" W ?55,"UNIT/REC",?67,"CF",?70,"QTY DUE-IN"
 S %="",$P(%,"-",81)="" W !,%
 Q