source: WorldVistAEHR/trunk/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCVFMS2.m@ 1800

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

initial load of WorldVistAEHR

File size: 1.7 KB
Line 
1PRCVFMS2 ;WOIFO/LKG-GENERATE SV FROM COTS INV TRANS ;4/12/05 14:11
2 ;;5.1;IFCAP;**81**;Oct 20, 2000
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 Q
5 ; Assuming handoff via ^TMP globals of structure
6 ; ^TMP(PRCNODE,$J,1)=Station#^BatchID^Trancode^DocAction^Transdate^Userid
7 ; ^TMP(PRCNODE,$J,2)=SellerFCP^BuyerFCP^BuyerCostCenter^BuyerSubCostCenter
8 ; ^TMP(PRCNODE,$J,3,0)=NumberOfItems
9 ; ^TMP(PRCNODE,$J,3,counter,0)=FMSLineID^AccntCode^BOC^InventoryValue^SalesValue^ReasonCode
10 ; PRCNODE = First subscript of ^TMP global containing the data
11 ; assumed Transdate is date stored in VA FileMan format
12 ;
13ENT(PRCNODE) ;Entrance point for generating SV from COTS inventory transaction
14 N ACCT,BFY,DATA,EFY,FUND,GECSFMS,INVCOST,INVPT,LINE,LINEDOC,PRCPFMS,PRCPSEC1,REASON,SIGN,STACKDA,TABLE,TOTAL,TRANDA,TRANID,TRANDATE,XPROG
15 N PRCPWBFY,PRCPWSTA,PRCPWFCP,PRCTMP1,PRCFY,PRC,GECSDATA,D,DIC
16 S PRCTMP1=$G(^TMP(PRCNODE,$J,1))
17 I $P(PRCTMP1,"^",3)'="SV" Q
18 S TRANDATE=$P(PRCTMP1,"^",5),PRCFY=$S($E(TRANDATE,4,5)<10:$E(TRANDATE,2,3),1:$E(101+$E(TRANDATE,2,3),2,3))
19 S PRCPWSTA=$P(PRCTMP1,"^"),PRCPWFCP=$P($G(^TMP(PRCNODE,$J,2)),"^")
20 S PRCPWBFY=$$BBFY^PRCSUT(PRCPWSTA,PRCFY,PRCPWFCP,1)
21 S TRANDA=0,INVPT=""
22 F S TRANDA=$O(^PRCP(445,"AC","W",TRANDA)) Q:+TRANDA'=TRANDA I $P($P($G(^PRCP(445,TRANDA,0)),"^"),"-")=PRCPWSTA S INVPT=TRANDA Q
23 Q:INVPT'>0
24 S TRANID="A"_$$ORDERNO^PRCPUTRX(INVPT)
25 S TRANDA=0,TOTAL=0
26 F S TRANDA=$O(^TMP(PRCNODE,$J,3,TRANDA)) Q:+TRANDA'=TRANDA D
27 . N X S X=$G(^TMP(PRCNODE,$J,3,TRANDA,0)) Q:X=""
28 . S INVCOST=$P(X,"^",4) Q:+INVCOST=0
29 . S ACCT=$P(X,"^",2),REASON=$P(X,"^",6) Q:ACCT="" Q:REASON=""
30 . S TOTAL=TOTAL+INVCOST,PRCPFMS(ACCT,REASON)=INVCOST
31 D SVCOTS^PRCPSFSV
32 Q $S($G(GECSFMS("DA"))>0:1,1:0)
Note: See TracBrowser for help on using the repository browser.