source: WorldVistAEHR/trunk/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCPRAVL.m@ 710

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

initial load of WorldVistAEHR

File size: 4.7 KB
Line 
1PRCPRAVL ;WISC/RFJ-availability list report (option, whse) ;9.9.97
2 ;;5.1;IFCAP;;Oct 20, 2000
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 D ^PRCPUSEL Q:'$G(PRCP("I"))
5 I PRCP("DPTYPE")'="W" D PRIMARY^PRCPRAVP Q
6 ;
7 ; availability list for whse
8 N ACCOUNT,PRCPEND,PRCPSORT,PRCPSTRT,PRCPSUMM,X
9 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)
10 S PRCPSUMM=$$SUMMARY^PRCPURS0 I PRCPSUMM<0 Q
11 I PRCPSUMM S PRCPSORT=1,(ACCOUNT(1),ACCOUNT(2),ACCOUNT(3),ACCOUNT(6),ACCOUNT(8))="" G DEVICE
12 K X S X(1)="Select the type of Sort" W ! D DISPLAY^PRCPUX2(2,40,.X)
13 S PRCPSORT=$$SORTBY^PRCPURS0 I 'PRCPSORT Q
14 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
15 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
16DEVICE W ! S %ZIS="Q" D ^%ZIS Q:POP I $D(IO("Q")) D D ^%ZTLOAD K IO("Q"),ZTSK Q
17 . S ZTDESC="Warehouse Availability Listing",ZTRTN="DQ^PRCPRAVL"
18 . S ZTSAVE("PRCP*")="",ZTSAVE("ACCOUNT*")="",ZTSAVE("ZTREQ")="@"
19 W !!,"<*> please wait <*>"
20DQ ; queue starts here
21 N %I,ACCT,ITEMDA,ITEMDATA,NOW,NSN,PAGE,PRCPFLAG,SALE,SCREEN,TOTINV,TOTNON,TOTSEL,X,Y
22 K ^TMP($J,"PRCPRAVL")
23 S ITEMDA=0 F S ITEMDA=$O(^PRCP(445,PRCP("I"),1,ITEMDA)) Q:'ITEMDA D
24 . S NSN=$$NSN^PRCPUX1(ITEMDA),ACCT=$$ACCT1^PRCPUX1($E(NSN,1,4))
25 . S:NSN="" NSN=" "
26 . I PRCPSORT=1 S:$D(ACCOUNT(ACCT)) ^TMP($J,"PRCPRAVL",ACCT,NSN,ITEMDA)="" Q
27 . I NSN]PRCPSTRT,PRCPEND]NSN S ^TMP($J,"PRCPRAVL",ACCT,NSN,ITEMDA)=""
28 . I $E(NSN,1,$L(PRCPSTRT))=PRCPSTRT!($E(NSN,1,$L(PRCPEND))=PRCPEND) S ^TMP($J,"PRCPRAVL",ACCT,NSN,ITEMDA)=""
29 ; print report
30 D NOW^%DTC S Y=% D DD^%DT S NOW=Y,PAGE=1,SCREEN=$$SCRPAUSE^PRCPUREP U IO D H
31 S ACCT=0 F S ACCT=$O(^TMP($J,"PRCPRAVL",ACCT)) Q:'ACCT!($G(PRCPFLAG)) D
32 . I $Y>(IOSL-6) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG) D H
33 . W:'PRCPSUMM !!?5,"ACCOUNT NUMBER: ",ACCT
34 . 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
35 . . S ITEMDATA=$G(^PRCP(445,PRCP("I"),1,ITEMDA,0))
36 . . W:'PRCPSUMM !!,$TR(NSN,"-"),?15,$E($$DESCR^PRCPUX1(PRCP("I"),ITEMDA),1,23),?39,"[",ITEMDA,"]",?48,$J($$UNIT^PRCPUX1(PRCP("I"),ITEMDA,"/"),8)
37 . . W:'PRCPSUMM ?58,$E($$GROUPNM^PRCPEGRP(+$$GROUPDA^PRCPEGRP(PRCP("I"),ITEMDA)),1,20),?79,$S($P(ITEMDATA,"^",26)="Y":"*",1:"")
38 . . 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)
39 . . 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)
40 . . S %=$P($G(^PRC(441,ITEMDA,2,+$O(^PRC(440,"AC","S",0)),0)),"^",11)
41 . . S SALE=$S($P(ITEMDATA,"^",15)>$P(ITEMDATA,"^",22):$P(ITEMDATA,"^",15),1:$P(ITEMDATA,"^",22))
42 . . W:'PRCPSUMM $J(%,8),$J(SALE,10,3),$J($P(ITEMDATA,"^",22),10,3),$J($P(ITEMDATA,"^",27),12,2)
43 . . S TOTINV(ACCT)=$G(TOTINV(ACCT))+$P(ITEMDATA,"^",27)
44 . . S TOTSEL(ACCT)=$G(TOTSEL(ACCT))+$J(($P(ITEMDATA,"^",7)+$P(ITEMDATA,"^",19))*SALE,0,2)
45 . . S TOTNON(ACCT)=$G(TOTNON(ACCT))+$J($P(ITEMDATA,"^",19)*$P(ITEMDATA,"^",22),0,2)
46 . . I $Y>(IOSL-6) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG) D H
47 . I $G(ZTQUEUED),$$S^%ZTLOAD S PRCPFLAG=1 W !?10,"<<< TASKMANAGER JOB TERMINATED BY USER >>>"
48 I $G(PRCPFLAG) D Q Q
49 I $Y>(IOSL-9) D:SCREEN P^PRCPUREP Q:$D(PRCPFLAG) D H
50 W !?20,$J("ISSUE+NONISSUE",20),$J("ESTIMATED",20)
51 W !?2,"TOTALS :",?20,$J("INVENTORY VALUE",20),$J("NONISSUABLE VALUE",20),$J("SELLING VALUE",20),!?2,"--------",?20,$J("---------------",20),$J("------------------",20),$J("-------------",20)
52 S (TOTINV,TOTNON,TOTSEL)=0 F ACCT=1,2,3,6,8 D
53 . W !?2,"ACCT ",ACCT," :",?20,$J($G(TOTINV(ACCT)),20,2),$J($G(TOTNON(ACCT)),20,2),$J($G(TOTSEL(ACCT)),20,2)
54 . S TOTINV=TOTINV+$G(TOTINV(ACCT)),TOTNON=TOTNON+$G(TOTNON(ACCT)),TOTSEL=TOTSEL+$G(TOTSEL(ACCT))
55 W !?2,"--------",?20,$J("---------------",20),$J("------------------",20),$J("-------------",20)
56 W !?2,"TOTALS :",?20,$J(TOTINV,20,2),$J(TOTNON,20,2),$J(TOTSEL,20,2)
57 D END^PRCPUREP
58Q D ^%ZISC K ^TMP($J,"PRCPRAVL")
59 Q
60 ;
61H S %=NOW_" PAGE "_PAGE,PAGE=PAGE+1 I PAGE'=2!(SCREEN) W @IOF
62 W $C(13),"AVAILABILITY LISTING FOR: ",$E(PRCP("IN"),1,20),?(80-$L(%)),%
63 S %="",$P(%,"-",81)=""
64 I PRCPSUMM W !?1,"*** ONLY SUMMARY OF ITEMS PRINTED ***",!,% Q
65 W !,"NSN",?15,"DESCRIPTION",?40,"MI",$J("UNIT/IS",14),?58,"GROUP CATEGORY",?77,"KWZ",!,%
66 Q
Note: See TracBrowser for help on using the repository browser.