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

PRCPRAVL.m

Go to the documentation of this file.
PRCPRAVL ;WISC/RFJ-availability list report (option, whse) ;9.9.97
 ;;5.1;IFCAP;;Oct 20, 2000
 ;Per VHA Directive 10-93-142, this routine should not be modified.
 D ^PRCPUSEL Q:'$G(PRCP("I"))
 I PRCP("DPTYPE")'="W" D PRIMARY^PRCPRAVP Q
 ;
 ;  availability list for whse
 N ACCOUNT,PRCPEND,PRCPSORT,PRCPSTRT,PRCPSUMM,X
 K X S X(1)="The Availability Listing will display the current quantity and value of the inventory point items.  The report will sort Warehouse inventory items by Account Code or NSN." D DISPLAY^PRCPUX2(40,79,.X)
 S PRCPSUMM=$$SUMMARY^PRCPURS0 I PRCPSUMM<0 Q
 I PRCPSUMM S PRCPSORT=1,(ACCOUNT(1),ACCOUNT(2),ACCOUNT(3),ACCOUNT(6),ACCOUNT(8))="" G DEVICE
 K X S X(1)="Select the type of Sort" W ! D DISPLAY^PRCPUX2(2,40,.X)
 S PRCPSORT=$$SORTBY^PRCPURS0 I 'PRCPSORT Q
 I PRCPSORT=1 K X S X(1)="Select the Account Codes to display" D DISPLAY^PRCPUX2(2,40,.X),ACCTSEL^PRCPURS0 I '$O(ACCOUNT(0)) Q
 I PRCPSORT=2 K X S X(1)="Select the range of NSNs to display" D DISPLAY^PRCPUX2(2,40,.X),NSNSEL^PRCPURS0 I '$D(PRCPSTRT) Q
DEVICE W ! S %ZIS="Q" D ^%ZIS Q:POP  I $D(IO("Q")) D  D ^%ZTLOAD K IO("Q"),ZTSK Q
 .   S ZTDESC="Warehouse Availability Listing",ZTRTN="DQ^PRCPRAVL"
 .   S ZTSAVE("PRCP*")="",ZTSAVE("ACCOUNT*")="",ZTSAVE("ZTREQ")="@"
 W !!,"<*> please wait <*>"
DQ ;  queue starts here
 N %I,ACCT,ITEMDA,ITEMDATA,NOW,NSN,PAGE,PRCPFLAG,SALE,SCREEN,TOTINV,TOTNON,TOTSEL,X,Y
 K ^TMP($J,"PRCPRAVL")
 S ITEMDA=0 F  S ITEMDA=$O(^PRCP(445,PRCP("I"),1,ITEMDA)) Q:'ITEMDA  D
 .   S NSN=$$NSN^PRCPUX1(ITEMDA),ACCT=$$ACCT1^PRCPUX1($E(NSN,1,4))
 .   S:NSN="" NSN=" "
 .   I PRCPSORT=1 S:$D(ACCOUNT(ACCT)) ^TMP($J,"PRCPRAVL",ACCT,NSN,ITEMDA)="" Q
 .   I NSN]PRCPSTRT,PRCPEND]NSN S ^TMP($J,"PRCPRAVL",ACCT,NSN,ITEMDA)=""
 .   I $E(NSN,1,$L(PRCPSTRT))=PRCPSTRT!($E(NSN,1,$L(PRCPEND))=PRCPEND) S ^TMP($J,"PRCPRAVL",ACCT,NSN,ITEMDA)=""
 ;  print report
 D NOW^%DTC S Y=% D DD^%DT S NOW=Y,PAGE=1,SCREEN=$$SCRPAUSE^PRCPUREP U IO D H
 S ACCT=0 F  S ACCT=$O(^TMP($J,"PRCPRAVL",ACCT)) Q:'ACCT!($G(PRCPFLAG))  D
 .   I $Y>(IOSL-6) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG)  D H
 .   W:'PRCPSUMM !!?5,"ACCOUNT NUMBER: ",ACCT
 .   S NSN="" F  S NSN=$O(^TMP($J,"PRCPRAVL",ACCT,NSN)) Q:NSN=""!($G(PRCPFLAG))  S ITEMDA=0 F  S ITEMDA=$O(^TMP($J,"PRCPRAVL",ACCT,NSN,ITEMDA)) Q:'ITEMDA!($G(PRCPFLAG))  D
 .   .   S ITEMDATA=$G(^PRCP(445,PRCP("I"),1,ITEMDA,0))
 .   .   W:'PRCPSUMM !!,$TR(NSN,"-"),?15,$E($$DESCR^PRCPUX1(PRCP("I"),ITEMDA),1,23),?39,"[",ITEMDA,"]",?48,$J($$UNIT^PRCPUX1(PRCP("I"),ITEMDA,"/"),8)
 .   .   W:'PRCPSUMM ?58,$E($$GROUPNM^PRCPEGRP(+$$GROUPDA^PRCPEGRP(PRCP("I"),ITEMDA)),1,20),?79,$S($P(ITEMDATA,"^",26)="Y":"*",1:"")
 .   .   W:'PRCPSUMM !,$J("ONHAND",8),$J("NONISS",8),$J("DUEIN",8),$J("DUEOUT",8),$J("REORDPT",8),$J("ISSMUL",8),$J("SELLCOST",10),$J("AVGCOST",10),$J("TOTVALUE",12)
 .   .   W:'PRCPSUMM !,$J(+$P(ITEMDATA,"^",7),8),$J(+$P(ITEMDATA,"^",19),8),$J($$GETIN^PRCPUDUE(PRCP("I"),ITEMDA),8),$J($$GETOUT^PRCPUDUE(PRCP("I"),ITEMDA),8),$J(+$P(ITEMDATA,"^",10),8)
 .   .   S %=$P($G(^PRC(441,ITEMDA,2,+$O(^PRC(440,"AC","S",0)),0)),"^",11)
 .   .   S SALE=$S($P(ITEMDATA,"^",15)>$P(ITEMDATA,"^",22):$P(ITEMDATA,"^",15),1:$P(ITEMDATA,"^",22))
 .   .   W:'PRCPSUMM $J(%,8),$J(SALE,10,3),$J($P(ITEMDATA,"^",22),10,3),$J($P(ITEMDATA,"^",27),12,2)
 .   .   S TOTINV(ACCT)=$G(TOTINV(ACCT))+$P(ITEMDATA,"^",27)
 .   .   S TOTSEL(ACCT)=$G(TOTSEL(ACCT))+$J(($P(ITEMDATA,"^",7)+$P(ITEMDATA,"^",19))*SALE,0,2)
 .   .   S TOTNON(ACCT)=$G(TOTNON(ACCT))+$J($P(ITEMDATA,"^",19)*$P(ITEMDATA,"^",22),0,2)
 .   .   I $Y>(IOSL-6) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG)  D H
 .   I $G(ZTQUEUED),$$S^%ZTLOAD S PRCPFLAG=1 W !?10,"<<< TASKMANAGER JOB TERMINATED BY USER >>>"
 I $G(PRCPFLAG) D Q Q
 I $Y>(IOSL-9) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG)  D H
 W !?20,$J("ISSUE+NONISSUE",20),$J("ESTIMATED",20)
 W !?2,"TOTALS :",?20,$J("INVENTORY VALUE",20),$J("NONISSUABLE VALUE",20),$J("SELLING VALUE",20),!?2,"--------",?20,$J("---------------",20),$J("------------------",20),$J("-------------",20)
 S (TOTINV,TOTNON,TOTSEL)=0 F ACCT=1,2,3,6,8 D
 .   W !?2,"ACCT ",ACCT," :",?20,$J($G(TOTINV(ACCT)),20,2),$J($G(TOTNON(ACCT)),20,2),$J($G(TOTSEL(ACCT)),20,2)
 .   S TOTINV=TOTINV+$G(TOTINV(ACCT)),TOTNON=TOTNON+$G(TOTNON(ACCT)),TOTSEL=TOTSEL+$G(TOTSEL(ACCT))
 W !?2,"--------",?20,$J("---------------",20),$J("------------------",20),$J("-------------",20)
 W !?2,"TOTALS :",?20,$J(TOTINV,20,2),$J(TOTNON,20,2),$J(TOTSEL,20,2)
 D END^PRCPUREP
Q D ^%ZISC K ^TMP($J,"PRCPRAVL")
 Q
 ;
H S %=NOW_"  PAGE "_PAGE,PAGE=PAGE+1 I PAGE'=2!(SCREEN) W @IOF
 W $C(13),"AVAILABILITY LISTING FOR: ",$E(PRCP("IN"),1,20),?(80-$L(%)),%
 S %="",$P(%,"-",81)=""
 I PRCPSUMM W !?1,"*** ONLY SUMMARY OF ITEMS PRINTED ***",!,% Q
 W !,"NSN",?15,"DESCRIPTION",?40,"MI",$J("UNIT/IS",14),?58,"GROUP CATEGORY",?77,"KWZ",!,%
 Q