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

RMPOPST0.m

Go to the documentation of this file.
  1. RMPOPST0 ;EDS/JAM - HOME OXYGEN BILLING TRANSACTIONS/POSTING,Part 1 ;7/24/98
  1. ;;3.0;PROSTHETICS;**29,44,47,55**;Feb 09, 1996
  1. ;
  1. ;This subroutine is part of the billing module. Patient records are
  1. ;sorted by fund control point (FCP) and then posted to a 1358 service
  1. ;order or Purchase Card order. It calls IFCAP modules to post
  1. ; transactions.
  1. Q
  1. ;
  1. POST ;main module to post billing transactions to IFCAP
  1. N SITE,RVDT,VDR,FIL K ^TMP($J)
  1. S FIL=665.72,SITE=RMPOXITE,RVDT=RMPODATE,VDR=RMPOVDR,QUIT=0
  1. ;
  1. ; P55 see if user wants to post $0 amounts to 2319 or ignore them
  1. K DIR
  1. S RMPRPZAM=$$ANY2319()
  1. I RMPRPZAM="^" W !!,"Posting Cancelled..." D EXIT Q
  1. ;
  1. D BUILD
  1. ;I $O(IFCAP(""))="" W !!,"Nothing to Post..." Q
  1. I $O(^TMP($J,""))="" W !!,"Nothing to Post..." Q
  1. ;
  1. ;Give user last chance to cancell posting
  1. W !
  1. K DIR S DIR(0)="Y",DIR("A")="Are you Sure you Want to Post Transactions"
  1. S DIR("B")="NO",DIR("?")="NO to Cancel Posting or YES to Proceed"
  1. W ! D ^DIR
  1. I Y'=1!($D(DIRUT)) W !!,"Posting Cancelled..." D EXIT Q
  1. K DIR
  1. D PROCESS
  1. ;
  1. EXIT D CLEANUP
  1. K ^TMP($J),VADM,A,Y,DIRUT,QUIT
  1. Q ;EXIT
  1. ;
  1. ; p55 - prompt if user wants option to post $0 to 2319
  1. ; - returns
  1. ; 0 if user doesn't want 'the post to 2319' prompt
  1. ; "^" on 'time out' or '^'
  1. ; 1 if user wants prompting
  1. ANY2319() ;
  1. N DIR,X,Y,RMPRPAM0
  1. S RMPRPAM0=0
  1. W !
  1. S DIR(0)="Y"
  1. S DIR("A",1)="If any transactions with $0.00 amounts exist, do you want "
  1. S DIR("A")="to be able to post any of them to the 2319"
  1. S DIR("B")="NO"
  1. S DIR("?")="Enter 'Y' to be prompted to create a 2319 record at each $0 tranasction."
  1. S DIR("?",1)="If you don't want ANY $0 transactions to be posted to the 2319"
  1. S DIR("?",2)="then enter 'N'"
  1. D ^DIR
  1. S RMPRPAM0=$S(Y=1:1,Y=0:0,1:"^")
  1. W !
  1. Q RMPRPAM0
  1. ;
  1. BUILD ;Build array IFCAP with patient transactions to post
  1. ;Separate patient individual items by fund control point
  1. ;^TMP($J) array
  1. ; ^TMP($J,FCP)=FCP total^Post flag^error message^purchase card total
  1. ; ^TMP($J,FCP,DFN)=patient tot^pat last name_" "_4 digit SSN^post flag^
  1. ; IFCAP error message^pat name
  1. ; ^TMP($J,FCP,DFN,ITEM)=item tot
  1. N DFN,ITM,ITDT,ITNO,PATNAM,PATSSN,LNAM,PATFLG,ITSTR,FCP,LCK,ITOT
  1. S DFN="" F S DFN=$O(DFNS(DFN)) Q:DFN="" D
  1. . S PATFLG=^RMPO(FIL,SITE,1,RVDT,1,VDR,"V",DFN,0)
  1. . ;check patient accept flag
  1. . I $P(PATFLG,U,2)'="Y" Q
  1. . ;check patient post flag
  1. . I $P(PATFLG,U,3)="Y" Q
  1. . D DEM^VADPT S PATNAM=VADM(1),PATSSN=VA("BID") ;patient name & ssn
  1. . ;lock patient record
  1. . S LCK=$$PATLCK() I 'LCK W !,PATNAM," record locked by another user" Q
  1. . ;get items not posted for each patient
  1. . S ITM=0
  1. . F S ITM=$O(^RMPO(FIL,SITE,1,RVDT,1,VDR,"V",DFN,1,ITM)) Q:'ITM D
  1. . . S ITDT=^RMPO(FIL,SITE,1,RVDT,1,VDR,"V",DFN,1,ITM,0)
  1. . . K R2319F
  1. . . ;check if item posted
  1. . . I $P(ITDT,U,10)="Y" Q
  1. . . S ITNO=$P(ITDT,U),FCP=$P(ITDT,U,3),ITOT=$P(ITDT,U,6)
  1. . .; I ITOT'>0 Q ;no amount to post
  1. . . I ITOT'>0 D
  1. . . .S RMITEM=$P($G(^RMPR(661,ITNO,0)),U,1)
  1. . . .I RMPRPZAM D
  1. . . . .W !,"*** Patient: ",$E(PATNAM,1,7)," - Line Item: ",$P($G(^PRC(441,RMITEM,0)),U,2)," has a ZERO DOLLAR amount ***"
  1. . . . .S DIR("??")="This is a required field, you must enter Y/N"
  1. . . . .S DIR(0)="Y",DIR("A")="Would You like to Post to 2319 (Y/N) "
  1. . . . .F D ^DIR I Y=1!(Y=0) S R2319F=Y K DIR Q
  1. . . .E D
  1. . . . .S R2319F=0
  1. . . .I $D(R2319F),(R2319F=0) D
  1. . . . .K DIE,DA,DR S DA(4)=RMPOXITE,DA(3)=RMPODATE,DA(2)=RMPOVDR
  1. . . . .S DA(1)=DFN,DIK="^RMPO(665.72,"_DA(4)_",1,"_DA(3)_",1,"_DA(2)_",""V"","_DA(1)
  1. . . . .S DIK=DIK_",1,",DA=ITM D ^DIK K DIK,DA
  1. . . . .S RNEXITEM=$O(^RMPO(665.72,RMPOXITE,1,RMPODATE,1,RMPOVDR,"V",DFN,1,0))
  1. . . . .I 'RNEXITEM S DA(3)=RMPOXITE,DA(2)=RMPODATE,DA(1)=RMPOVDR,DA=DFN D
  1. . . . . .S DIK="^RMPO(665.72,"_DA(3)_",1,"_DA(2)_",1,"_DA(1)_",""V""," D ^DIK K DIK,DA
  1. . . I $D(R2319F),(R2319F=0) Q
  1. . . I FCP="" Q ;no fund control point
  1. . . ;set ^TMP($J) array
  1. . . S ^TMP($J,FCP)=$S('$D(^TMP($J,FCP)):0.00,1:^TMP($J,FCP))+ITOT
  1. . . I $G(^TMP($J,FCP,DFN))="" D
  1. . . . S LNAM=$E($P(PATNAM,",")_" ",1,7) ;pad/truncate last name
  1. . . . S ^TMP($J,FCP,DFN)="^"_LNAM_" "_PATSSN_"^^^"_$E(PATNAM,1,18)
  1. . . S $P(^TMP($J,FCP,DFN),U)=+^TMP($J,FCP,DFN)+ITOT,^TMP($J,FCP,DFN,ITM)=ITOT
  1. . D UNLKPAT
  1. Q ;BUILD
  1. ;
  1. PROCESS ;process FCP data - ask for method of payment
  1. N FCP,PAYINF,FCPTOT,IEN442,SRVORD,PCTOT,IENFCP,LCK
  1. S FCP="" F S FCP=$O(^TMP($J,FCP)) Q:FCP="" D I QUIT Q
  1. . ;PAYINF=payment type^IEN of file 442^service order number^purchase
  1. . ;card total^IEN of fund control point transaction
  1. . S FCPTOT=+^TMP($J,FCP) W !!,"Fund Control Point: ",FCP
  1. . S PAYINF=$$FCP^RMPOBILU(FCP)
  1. . I PAYINF="" S $P(^TMP($J,FCP),U,3)="Posting aborted"
  1. . Q:QUIT!(PAYINF="") I PAYINF=-1 D Q
  1. . . S $P(^TMP($J,FCP),U,2)=0,$P(^TMP($J,FCP),U,3)="Payment type not given"
  1. . . ;W " ",$P^TMP($J,FCP),U,3)
  1. . S IEN442=$P(PAYINF,U,2),SRVORD=$P(PAYINF,U,3)
  1. . S PCTOT=$P(PAYINF,U,4),IENFCP=$P(PAYINF,U,5)
  1. . ;W !,"Service Order Number: ",SRVORD
  1. . ;check lock on FCP
  1. . S LCK=$$FCPLCK() I 'LCK D Q
  1. . . S $P(^TMP($J,FCP),U,2)=0,$P(^TMP($J,FCP),U,3)="Locked by another user"
  1. . . W " ",$P(^TMP($J,FCP),U,3)
  1. . D IFCAP^RMPOPST1 ;process payment to IFCAP
  1. . D UNLKFCP ;unlock FCP level
  1. Q ;PROCESS
  1. ;
  1. PATLCK() ;Lock patient level in ^RMPO(665.72
  1. L +^RMPO(FIL,SITE,1,RVDT,1,VDR,"V",DFN,0):5
  1. Q $T ;PATLCK
  1. ;
  1. FCPLCK() ;Lock fund control level in ^RPO(665.72
  1. L +^RMPO(FIL,SITE,1,RVDT,2,IENFCP,0):5
  1. Q $T ;FCPLCK
  1. ;
  1. UNLKPAT ;Unlock patient level in ^RMPO(665.72
  1. L -^RMPO(FIL,SITE,1,RVDT,1,VDR,"V",DFN,0)
  1. Q ;UNLKPAT
  1. ;
  1. UNLKFCP ;Unlock fund contrl point level in ^RMPO(665.72
  1. L -^RMPO(FIL,SITE,1,RVDT,2,IENFCP,0)
  1. Q ;UNLKFCP
  1. ;
  1. CLEANUP ;Display post messages for FCP
  1. ;Call line tag to unlock ^RMPO at patient level
  1. N DFN,UNLCK,FLG
  1. S FCP="",FLG=1
  1. F S FCP=$O(^TMP($J,FCP)) Q:FCP="" D
  1. . I '$P(^TMP($J,FCP),U,2) D
  1. . . I FLG W !!,"FCP Not Posted",?40,"Message" D
  1. . . . W !,"---------------",?40,"-------"
  1. . . W !,FCP,?40,$P(^TMP($J,FCP),U,3) S FLG=0
  1. . S DFN="" F DFN=$O(^TMP($J,FCP,DFN)) Q:DFN="" D
  1. . . I '$D(UNLCK(DFN)) D UNLKPAT S UNLCK(DFN)=""
  1. W !! I FLG W "All Fund Control Points posted successfully"
  1. K DIR S DIR(0)="FO",DIR("A")="Press any Key to Continue" D ^DIR
  1. Q ;CLEANUP