source: FOIAVistA/tag/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCPUUIW.m@ 1806

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

initial load of FOIAVistA 6/30/08 version

File size: 3.2 KB
Line 
1PRCPUUIW ;WISC/RFJ-utility update item whse to prim ;08 Jul 92
2 ;;5.1;IFCAP;;Oct 20, 2000
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 Q
5 ;
6 ;
7ITEM(INVPT,ITEMDA,TRANTYPE,ORDERNO,PRCPDATA) ; update inventory point item
8 ;prcpdata =
9 ; qty) = quantity to add to on-hand
10 ; invval) = total inventory value
11 ; selval) = total sales value
12 ; 2237po) = 2237 or purchase order number
13 ; ref) = reference number
14 ; otherpt) = other inventory point affected (for issues)
15 ; reason) = reason (for adjustments)
16 ; reasoncode)= reason code for other adjustments
17 ; date) = date of transaction (optional)
18 ; tranda) = transaction number for removing due-ins
19 ; pkg) = packaging units on transaction register
20 ; drugacct) = update drug accountability
21 ;
22 ;returns
23 ; prcpid = transaction 445.2 da number
24 ;
25 N %,COSTCNTR,DATE,INVTYPE,ITEMDATA,PRCPUUIW,X,Y
26 D NOW^%DTC S DATE=%
27 I '$D(^PRCP(445.1,INVPT,1,ITEMDA,1,$E(DATE,1,5),0)) D BALANCE^PRCPUBAL(INVPT,ITEMDA,$E(DATE,1,5))
28 I $P($G(^PRCP(445,INVPT,0)),"^",6)="Y" D
29 . K PRCPUUIW F %="DATE","QTY","INVVAL","SELVAL","PKG","REF","2237PO","ISSUE","OTHERPT","REASON","REASONCODE" I $D(PRCPDATA(%)) S PRCPUUIW(%)=PRCPDATA(%)
30 . K PRCPID D ADDTRAN^PRCPUTRX(INVPT,ITEMDA,TRANTYPE,ORDERNO,.PRCPUUIW) K PRCPUUIW S PRCPID=+$G(Y)
31 S INVTYPE=$P(^PRCP(445,INVPT,0),"^",3)
32 I '$D(^PRCP(445,INVPT,1,ITEMDA,0)) Q
33 L +^PRCP(445,INVPT,1,ITEMDA)
34 S ITEMDATA=^PRCP(445,INVPT,1,ITEMDA,0)
35 ; purchase order
36 I PRCPDATA("2237PO")'="",$P(PRCPDATA("2237PO"),"-",3)="" D
37 . I PRCPDATA("QTY") D RECEIPTS^PRCPUSAG(INVPT,ITEMDA,PRCPDATA("QTY"))
38 ;
39 ; 2237 issue
40 I $P(PRCPDATA("2237PO"),"-",3)'="" D
41 . I INVTYPE="W" D
42 . . D ADDUSAG^PRCPUSAG(INVPT,ITEMDA,-PRCPDATA("QTY"),-PRCPDATA("INVVAL"))
43 . . I TRANTYPE="R" D SETOUT^PRCPUDUE(INVPT,ITEMDA,PRCPDATA("QTY"))
44 . I INVTYPE="P" D
45 . . D RECEIPTS^PRCPUSAG(INVPT,ITEMDA,PRCPDATA("QTY"))
46 . . S COSTCNTR=$P($G(^PRCP(445,INVPT,0)),"^",7) I COSTCNTR D COSTCNTR^PRCPUCC(INVPT,PRCPDATA("OTHERPT"),COSTCNTR,PRCPDATA("SELVAL"))
47 ; update drug accountability
48 I INVTYPE="P",$G(PRCPDATA("DRUGACCT")) S %=+$P(ITEMDATA,"^",29) S:'% %=1 D EN^PSAGIP(INVPT,ITEMDA,PRCPDATA("QTY")*%,$G(PRCPDATA("TRANDA")),PRCPDATA("2237PO"),TRANTYPE_ORDERNO,PRCPDATA("INVVAL"))
49 ; update inventory item
50 I '$P(ITEMDATA,"^",27) S $P(ITEMDATA,"^",27)=$J($P(ITEMDATA,"^",7)*$P(ITEMDATA,"^",22),0,2)
51 S $P(ITEMDATA,"^",7)=$P(ITEMDATA,"^",7)+PRCPDATA("QTY")
52 I $D(PRCPDATA("ISSUE")) S $P(ITEMDATA,"^",19)=$P(ITEMDATA,"^",19)-PRCPDATA("QTY")
53 S $P(ITEMDATA,"^",27)=$P(ITEMDATA,"^",27)+PRCPDATA("INVVAL")
54 S $P(ITEMDATA,"^",22)=0,%=$P(ITEMDATA,"^",7)+$P(ITEMDATA,"^",19) I %>0 S $P(ITEMDATA,"^",22)=$J($P(ITEMDATA,"^",27)/%,0,3)
55 I TRANTYPE="RC",$G(PRCPDATA("TRANDA")) D OUTST^PRCPUTRA(INVPT,ITEMDA,PRCPDATA("TRANDA"),-PRCPDATA("QTY"))
56 I TRANTYPE="RC",PRCPDATA("QTY") S $P(ITEMDATA,"^",15)=$J(PRCPDATA("INVVAL")/PRCPDATA("QTY"),0,3),$P(ITEMDATA,"^",3)=$E(DATE,1,7)
57 I PRCPDATA("2237PO")'="",$P(PRCPDATA("2237PO"),"-",3)="",INVTYPE="W",$D(^PRC(441,ITEMDA,2,+$O(^PRC(440,"AC","S",0)),0)) S $P(^(0),"^",2)=$S($P(ITEMDATA,"^",15)>$P(ITEMDATA,"^",22):$P(ITEMDATA,"^",15),1:$P(ITEMDATA,"^",22))
58 S ^PRCP(445,INVPT,1,ITEMDA,0)=ITEMDATA
59 L -^PRCP(445,INVPT,1,ITEMDA)
60 Q
Note: See TracBrowser for help on using the repository browser.