| 1 | RCFMDRV1 ;WASH-ISC@ALTOONA,PA/RGY-Add FMS document ;8/18/94  11:36 AM
 | 
|---|
| 2 | V ;;4.5;Accounts Receivable;;Mar 20, 1995
 | 
|---|
| 3 |  ;;Per VHA Directive 10-93-142, this routine should not be modified.
 | 
|---|
| 4 | OPEN(DOC,TYPE,ID,ENT,ERROR,BILL,EVN,BAT) ;Add event to FMS document file
 | 
|---|
| 5 |  NEW DIC,D0,DIE,DA,X,DLAYGO,DR,DEBT,DIS,DINUM,RCOK
 | 
|---|
| 6 |  S ERROR="",ENT=-1
 | 
|---|
| 7 |  I $G(DOC)="" S ERROR="FMS Document number undefined" Q
 | 
|---|
| 8 |  I $G(ID)]"",$D(^RC(347,"D",ID)) S ERROR="Duplicate Identifier requested" Q
 | 
|---|
| 9 |  I '$D(^RC(347.1,+$G(TYPE),0)) S ERROR="Unknown type of document" Q
 | 
|---|
| 10 |  I $G(BILL)]"",'$D(^PRCA(430,BILL,0)) S ERROR="Bill number does not exist" Q
 | 
|---|
| 11 |  I $G(EVN)]"",'$D(^PRCA(433,EVN,0)) S ERROR="Event number does not exist" Q
 | 
|---|
| 12 |  ;S:DOC["-" DOC=$P(DOC,"-")_$P(DOC,"-",2) ;CLH - to allowfull fms number to be entered
 | 
|---|
| 13 |  F ENT=+$P(^RC(347,0),"^",3)+1:1 L +^RC(347,ENT):0 I $T S RCOK=0 D  L -^RC(347,ENT) Q:RCOK
 | 
|---|
| 14 |    .I $D(^RC(347,ENT)) Q
 | 
|---|
| 15 |    .S DINUM=ENT,DIC="^RC(347,",DIC(0)="L",DLAYGO=347,X=ENT
 | 
|---|
| 16 |    .K DD,DO D FILE^DICN K DIC,DLAYGO,DO
 | 
|---|
| 17 |    .I Y<0 S ERROR="Unable to add bill to bill file!" Q
 | 
|---|
| 18 |    .S DIE="^RC(347,",DR="[RCFM OPEN DOCUMENT]",(ENT,DA)=+Y D ^DIE
 | 
|---|
| 19 |    .S RCOK=1
 | 
|---|
| 20 |    .Q
 | 
|---|
| 21 | Q Q
 | 
|---|