source: WorldVistAEHR/trunk/r/ACCOUNTS_RECEIVABLE-PRCA-PRY-RC/RCEVDRV1.m@ 1361

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

initial load of WorldVistAEHR

File size: 1.6 KB
Line 
1RCEVDRV1 ;WASH-ISC@ALTOONA,PA/RGY-Add event to enter file driver #1 ;7/7/95 11:01 AM
2V ;;4.5;Accounts Receivable;**10**;Mar 20, 1995
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4OPEN(TYPE,DEB,DOE,RCDUZ,SITE,ERROR,EVN,BAL) ;Add new event to event file
5 NEW DIC,D0,DIE,DA,X,DLAYGO,DR,DEBT,EVENT,DIS,RCOK
6 S DEBT=$$DEBT^RCEVUTL(DEB),ERROR="",EVN=-1
7 I DEBT<0 S ERROR="Unable to locate or add Debtor '"_DEB_"' (PRCADRV1)" G Q
8 I $O(^RC(341,"AC",DEBT,0,0)) S EVN=0 F S EVN=$O(^RC(341,"AC",DEBT,0,EVN)) Q:EVN="" D DEL(EVN)
9 F EVN=+$P(^RC(341,0),"^",3)+1:1 L +^RC(341,EVN):0 I $T S RCOK=0 D L -^RC(341,EVN) Q:RCOK
10 .I $D(^RC(341,EVN)) Q
11 .S DINUM=EVN,DIC="^RC(341,",DIC(0)="L",DLAYGO=341,X=SITE_"-"_EVN_"-0" K DD,DO D FILE^DICN K DIC,DLAYGO,DO
12 .S DIE="^RC(341,",DR="[RCEV OPEN EVENT]",DA=EVN D ^DIE
13 .S RCOK=1
14 .Q
15Q Q
16CLOSE(EVN,ERR) ;Close event
17 S DIE="^RC(341,",DR="[RCEV CLOSE EVENT]",DA=EVN D ^DIE
18 Q
19DEL(EVN) ;Delete event
20 NEW DIK,DA
21 I $P($G(^RC(341,EVN,0)),"^",11)=1 G Q2
22 S DA=EVN,DIK="^RC(341," D ^DIK
23Q2 Q
24PUR ;Purge events
25 NEW DATE,EVN,EVN2,DEBT,LST,N0,PURDT
26 S DATE=0,EVN2=""
27 F S DATE=$O(^RC(341,"C",DATE)) Q:'DATE S EVN=0 F S EVN=$O(^RC(341,"C",DATE,EVN)) Q:'EVN D
28 .S N0=$G(^RC(341,EVN,0)) Q:N0=""
29 .S DEBT=$P(N0,"^",5) Q:DEBT=""
30 .S LST=$O(^RC(341,"AD",DEBT,2,"")) Q:LST=""
31 .S PURDT=$O(^RC(341,"AD",DEBT,2,LST)) Q:PURDT=""
32 .S EVN2=$O(^RC(341,"AD",DEBT,2,PURDT,EVN2)) Q:EVN2=""!(EVN=EVN2)
33 .S PURDT=9999999.999999-PURDT
34 .Q:DATE>PURDT
35 .I $P(N0,"^",7)<PURDT,$P(N0,"^",2)'=$O(^RC(341.1,"AC",1,0)),EVN'=$P($$LST^RCFN01($P(N0,"^",5),2),"^",2) S DA=EVN,DIK="^RC(341," D ^DIK
36 .Q
37 Q
Note: See TracBrowser for help on using the repository browser.