Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: RCFMOBR

RCFMOBR.m

Go to the documentation of this file.
  1. RCFMOBR ;WASH-ISC@ALTOONA,PA/RWT-BILL RECONCILIATIONS LIST ;11/20/96 2:30 PM
  1. V ;;4.5;Accounts Receivable;**2,20,40,53,249**;Mar 20, 1995;Build 2
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. EN ;Creates report from OBR data in file 423.6
  1. ;
  1. ; OBR Data Structure used by this routine
  1. ; ^TMP("OBR",$J,SITE,"NOT IN AR")=NextRec^TotalItems^TotalFMSAmt
  1. ; ^TMP("OBR",$J,SITE,"NOT IN FMS")=NextRec^TotalItems^TotalARAmt
  1. ; ^TMP("OBR",$J,SITE,"DISCREPANCY")=NextRec^TotalItems^TotalFMSAmt^TotalARAmt
  1. ; ^TMP("OBR",$J,"BN",BILLNUMBER)=[423.6 rec] <-- x-ref of FMS Bills
  1. ; ^TMP("OBR",$J,"REPORT","1")="LINE 1"
  1. ; ^TMP("OBR",$J","REPORT,"2")="LINE 2"
  1. ;
  1. ; Descriptions of modules:
  1. ; PROCFMS - loop through FMS bills (^PRCF(423.6)) updating
  1. ; global ^TMP("OBR",$J,"BN") while also checking
  1. ; for invalid AR bills
  1. ; PROCAR - loop through all Active AR Bills comparing amounts
  1. ; and looking for Detail bills not found in FMS
  1. ; BUILDRPT - Prepares report in global ^TMP("OBR",$J,"REPORT")
  1. ;
  1. N X,Y,OBR,A0,ERR
  1. K ^TMP("OBR",$J)
  1. ;
  1. I $G(PRCADA) D PROCESS(PRCADA) G Q1
  1. S OBR="OBR-",ERR=-1
  1. F S OBR=$O(^PRCF(423.6,"B",OBR)) Q:OBR=""!(OBR'["OBR-") D
  1. .I $O(^PRCF(423.6,"B",OBR))'["OBR-" D Q
  1. ..S A0=$O(^PRCF(423.6,"B",OBR,0))
  1. ..S ERR=0 D PROCESS(A0)
  1. I ERR D PROCESS(ERR)
  1. Q1 K ^TMP("OBR",$J)
  1. Q
  1. PROCESS(A0) N X,X1,X2,Y,SN,PARENT,XMTEXT,XMSUB,XMSENDER,XMDUZ,ERR,DATE,FMSDATE
  1. S ERR=0 D
  1. .I '$D(^PRCF(423.6,A0,0)) S ERR=-1 Q
  1. .I $E(^PRCF(423.6,A0,0),1,3)'["OBR" S ERR=-1 Q
  1. .S X=$P(^PRCF(423.6,A0,0),"-",2)
  1. .S X=$E(X,5,6)_"-"_$E(X,7,8)_"-"_$E(X,1,4) D ^%DT ;Y is defined
  1. .S PARENT=$P($P(^PRCF(423.6,A0,0),"-",5),U)
  1. .;
  1. .D PROCFMS^RCFMOBR1(A0)
  1. .D PROCAR^RCFMOBR1(A0)
  1. .D BUILDRPT^RCFMOBR2(PARENT)
  1. ;
  1. I '$D(PARENT) S PARENT=$$SITE^RCMSITE
  1. S PARENT=$P(^DIC(4,+$O(^DIC(4,"D",PARENT,0)),0),U)
  1. ;
  1. I '$D(Y) S Y=DT ;Y may be defined from %DT call above
  1. S X1=Y,X2=($E(Y,6,7)+1)*-1 D C^%DTC,YX^%DTC
  1. S FMSDATE=$P(Y,"@"),FMSDATE=$E(FMSDATE,1,4)_$E(FMSDATE,9,12)
  1. D NOW^%DTC S DATE=$E(X,4,5)_"-"_$E(X,6,7)_"-"_$E(X,2,3)
  1. ; - Transmits report via e-mail to FMS mail group
  1. S XMSUB="FMS "_FMSDATE_" RECONCILIATION ("_DATE_") "
  1. S XMSUB=XMSUB_PARENT
  1. I ERR D
  1. .S ^TMP("OBR",$J,"REPORT",1)="Date of Report: "_DATE
  1. .S ^TMP("OBR",$J,"REPORT",2)="NOTE: This report compares your current A/R records with data received from"
  1. .S ^TMP("OBR",$J,"REPORT",3)=" FMS on the last day of the previous accounting period."
  1. .S ^TMP("OBR",$J,"REPORT",4)=""
  1. .S ^TMP("OBR",$J,"REPORT",5)="No FMS data exists to reconcile!"
  1. S XMTEXT="^TMP(""OBR"",$J,""REPORT"","
  1. S XMDUZ="Accounts Receivable Package",XMY("G.FMS")="",XMY(DUZ)="" D ^XMD
  1. Q
  1. EN2 ;Entry point from Regenerate Prior Month OBRs option
  1. N DIR,PRCADA,Y
  1. W !!,"This option will transmit the OBR report(s) to you and members"
  1. W !,"of the G.FMS mail group."
  1. W !!,"NOTE: Depending on the number of active AR bills in your system,"
  1. W !," this may take awhile to run.",!
  1. S DIR(0)="YO",DIR("A")="Are you sure you want to do this",DIR("B")="NO"
  1. D ^DIR Q:Y'=1 S ZTRTN="EN^RCFMOBR",ZTDESC="Prior Month OBRs"
  1. S ZTIO="" D ^%ZTLOAD Q
  1. ;
  1. EN3 ;Deletes OBRs over 60 days old
  1. N A0,A1,A2,DA,DIK,X,X1,X2
  1. S A0="OBR-" F S A0=$O(^PRCF(423.6,"B",A0)) Q:A0=""!(A0'["OBR-") S A1=$E($P(A0,"-",2),1,8),A2=0 F S A2=$O(^PRCF(423.6,"B",A0,A2)) Q:+A2=0 D
  1. .S X1=DT,X2=$$RCDT(A1) D ^%DTC I X>60 S DIK="^PRCF(423.6,",DA=A2 D ^DIK
  1. Q
  1. RCDT(A1) ;Convert yyyymmdd to FM date
  1. N X,Y
  1. S X=A1,X=$E(X,5,6)_" "_$E(X,7,8)_", "_$E(X,1,4)
  1. D ^%DT
  1. Q Y
  1. PURGE ;purge unprocessed document file
  1. N DIR,Y,X,X1,X2,RCDT
  1. S DIR("A")="How many days worth of DATA do you want to retain"
  1. S DIR(0)="N",DIR("?")="This is the number of days entries will remain in the file."
  1. D ^DIR
  1. I +Y<0!(Y="")!($E(Y,1)="^") G POUT
  1. S X1=DT,X2=-(+Y) D C^%DTC S RCDT=X
  1. S ZTRTN="QPURGE^RCFMOBR",ZTSAVE("RCDT")="",ZTDESC="Purge unprocessed document list",ZTIO="" D ^%ZTLOAD
  1. POUT K DIRUT,DIROUT,DTOUT,DUOUT Q
  1. ;
  1. QPURGE N DA,DIK
  1. S DIK="^RC(347,"
  1. Q:'$D(^RC(347))
  1. S DA=0 F S DA=$O(^RC(347,DA)) Q:'DA I $P(^(DA,0),U,5)<RCDT D ^DIK
  1. K RCDT
  1. Q