source: WorldVistAEHR/trunk/r/PROSTHETICS-RMPR-RMPO-RMPS/RMPOPST0.m@ 1111

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

initial load of WorldVistAEHR

File size: 6.1 KB
Line 
1RMPOPST0 ;EDS/JAM - HOME OXYGEN BILLING TRANSACTIONS/POSTING,Part 1 ;7/24/98
2 ;;3.0;PROSTHETICS;**29,44,47,55**;Feb 09, 1996
3 ;
4 ;This subroutine is part of the billing module. Patient records are
5 ;sorted by fund control point (FCP) and then posted to a 1358 service
6 ;order or Purchase Card order. It calls IFCAP modules to post
7 ; transactions.
8 Q
9 ;
10POST ;main module to post billing transactions to IFCAP
11 N SITE,RVDT,VDR,FIL K ^TMP($J)
12 S FIL=665.72,SITE=RMPOXITE,RVDT=RMPODATE,VDR=RMPOVDR,QUIT=0
13 ;
14 ; P55 see if user wants to post $0 amounts to 2319 or ignore them
15 K DIR
16 S RMPRPZAM=$$ANY2319()
17 I RMPRPZAM="^" W !!,"Posting Cancelled..." D EXIT Q
18 ;
19 D BUILD
20 ;I $O(IFCAP(""))="" W !!,"Nothing to Post..." Q
21 I $O(^TMP($J,""))="" W !!,"Nothing to Post..." Q
22 ;
23 ;Give user last chance to cancell posting
24 W !
25 K DIR S DIR(0)="Y",DIR("A")="Are you Sure you Want to Post Transactions"
26 S DIR("B")="NO",DIR("?")="NO to Cancel Posting or YES to Proceed"
27 W ! D ^DIR
28 I Y'=1!($D(DIRUT)) W !!,"Posting Cancelled..." D EXIT Q
29 K DIR
30 D PROCESS
31 ;
32EXIT D CLEANUP
33 K ^TMP($J),VADM,A,Y,DIRUT,QUIT
34 Q ;EXIT
35 ;
36 ; p55 - prompt if user wants option to post $0 to 2319
37 ; - returns
38 ; 0 if user doesn't want 'the post to 2319' prompt
39 ; "^" on 'time out' or '^'
40 ; 1 if user wants prompting
41ANY2319() ;
42 N DIR,X,Y,RMPRPAM0
43 S RMPRPAM0=0
44 W !
45 S DIR(0)="Y"
46 S DIR("A",1)="If any transactions with $0.00 amounts exist, do you want "
47 S DIR("A")="to be able to post any of them to the 2319"
48 S DIR("B")="NO"
49 S DIR("?")="Enter 'Y' to be prompted to create a 2319 record at each $0 tranasction."
50 S DIR("?",1)="If you don't want ANY $0 transactions to be posted to the 2319"
51 S DIR("?",2)="then enter 'N'"
52 D ^DIR
53 S RMPRPAM0=$S(Y=1:1,Y=0:0,1:"^")
54 W !
55 Q RMPRPAM0
56 ;
57BUILD ;Build array IFCAP with patient transactions to post
58 ;Separate patient individual items by fund control point
59 ;^TMP($J) array
60 ; ^TMP($J,FCP)=FCP total^Post flag^error message^purchase card total
61 ; ^TMP($J,FCP,DFN)=patient tot^pat last name_" "_4 digit SSN^post flag^
62 ; IFCAP error message^pat name
63 ; ^TMP($J,FCP,DFN,ITEM)=item tot
64 N DFN,ITM,ITDT,ITNO,PATNAM,PATSSN,LNAM,PATFLG,ITSTR,FCP,LCK,ITOT
65 S DFN="" F S DFN=$O(DFNS(DFN)) Q:DFN="" D
66 . S PATFLG=^RMPO(FIL,SITE,1,RVDT,1,VDR,"V",DFN,0)
67 . ;check patient accept flag
68 . I $P(PATFLG,U,2)'="Y" Q
69 . ;check patient post flag
70 . I $P(PATFLG,U,3)="Y" Q
71 . D DEM^VADPT S PATNAM=VADM(1),PATSSN=VA("BID") ;patient name & ssn
72 . ;lock patient record
73 . S LCK=$$PATLCK() I 'LCK W !,PATNAM," record locked by another user" Q
74 . ;get items not posted for each patient
75 . S ITM=0
76 . F S ITM=$O(^RMPO(FIL,SITE,1,RVDT,1,VDR,"V",DFN,1,ITM)) Q:'ITM D
77 . . S ITDT=^RMPO(FIL,SITE,1,RVDT,1,VDR,"V",DFN,1,ITM,0)
78 . . K R2319F
79 . . ;check if item posted
80 . . I $P(ITDT,U,10)="Y" Q
81 . . S ITNO=$P(ITDT,U),FCP=$P(ITDT,U,3),ITOT=$P(ITDT,U,6)
82 . .; I ITOT'>0 Q ;no amount to post
83 . . I ITOT'>0 D
84 . . .S RMITEM=$P($G(^RMPR(661,ITNO,0)),U,1)
85 . . .I RMPRPZAM D
86 . . . .W !,"*** Patient: ",$E(PATNAM,1,7)," - Line Item: ",$P($G(^PRC(441,RMITEM,0)),U,2)," has a ZERO DOLLAR amount ***"
87 . . . .S DIR("??")="This is a required field, you must enter Y/N"
88 . . . .S DIR(0)="Y",DIR("A")="Would You like to Post to 2319 (Y/N) "
89 . . . .F D ^DIR I Y=1!(Y=0) S R2319F=Y K DIR Q
90 . . .E D
91 . . . .S R2319F=0
92 . . .I $D(R2319F),(R2319F=0) D
93 . . . .K DIE,DA,DR S DA(4)=RMPOXITE,DA(3)=RMPODATE,DA(2)=RMPOVDR
94 . . . .S DA(1)=DFN,DIK="^RMPO(665.72,"_DA(4)_",1,"_DA(3)_",1,"_DA(2)_",""V"","_DA(1)
95 . . . .S DIK=DIK_",1,",DA=ITM D ^DIK K DIK,DA
96 . . . .S RNEXITEM=$O(^RMPO(665.72,RMPOXITE,1,RMPODATE,1,RMPOVDR,"V",DFN,1,0))
97 . . . .I 'RNEXITEM S DA(3)=RMPOXITE,DA(2)=RMPODATE,DA(1)=RMPOVDR,DA=DFN D
98 . . . . .S DIK="^RMPO(665.72,"_DA(3)_",1,"_DA(2)_",1,"_DA(1)_",""V""," D ^DIK K DIK,DA
99 . . I $D(R2319F),(R2319F=0) Q
100 . . I FCP="" Q ;no fund control point
101 . . ;set ^TMP($J) array
102 . . S ^TMP($J,FCP)=$S('$D(^TMP($J,FCP)):0.00,1:^TMP($J,FCP))+ITOT
103 . . I $G(^TMP($J,FCP,DFN))="" D
104 . . . S LNAM=$E($P(PATNAM,",")_" ",1,7) ;pad/truncate last name
105 . . . S ^TMP($J,FCP,DFN)="^"_LNAM_" "_PATSSN_"^^^"_$E(PATNAM,1,18)
106 . . S $P(^TMP($J,FCP,DFN),U)=+^TMP($J,FCP,DFN)+ITOT,^TMP($J,FCP,DFN,ITM)=ITOT
107 . D UNLKPAT
108 Q ;BUILD
109 ;
110PROCESS ;process FCP data - ask for method of payment
111 N FCP,PAYINF,FCPTOT,IEN442,SRVORD,PCTOT,IENFCP,LCK
112 S FCP="" F S FCP=$O(^TMP($J,FCP)) Q:FCP="" D I QUIT Q
113 . ;PAYINF=payment type^IEN of file 442^service order number^purchase
114 . ;card total^IEN of fund control point transaction
115 . S FCPTOT=+^TMP($J,FCP) W !!,"Fund Control Point: ",FCP
116 . S PAYINF=$$FCP^RMPOBILU(FCP)
117 . I PAYINF="" S $P(^TMP($J,FCP),U,3)="Posting aborted"
118 . Q:QUIT!(PAYINF="") I PAYINF=-1 D Q
119 . . S $P(^TMP($J,FCP),U,2)=0,$P(^TMP($J,FCP),U,3)="Payment type not given"
120 . . ;W " ",$P^TMP($J,FCP),U,3)
121 . S IEN442=$P(PAYINF,U,2),SRVORD=$P(PAYINF,U,3)
122 . S PCTOT=$P(PAYINF,U,4),IENFCP=$P(PAYINF,U,5)
123 . ;W !,"Service Order Number: ",SRVORD
124 . ;check lock on FCP
125 . S LCK=$$FCPLCK() I 'LCK D Q
126 . . S $P(^TMP($J,FCP),U,2)=0,$P(^TMP($J,FCP),U,3)="Locked by another user"
127 . . W " ",$P(^TMP($J,FCP),U,3)
128 . D IFCAP^RMPOPST1 ;process payment to IFCAP
129 . D UNLKFCP ;unlock FCP level
130 Q ;PROCESS
131 ;
132PATLCK() ;Lock patient level in ^RMPO(665.72
133 L +^RMPO(FIL,SITE,1,RVDT,1,VDR,"V",DFN,0):5
134 Q $T ;PATLCK
135 ;
136FCPLCK() ;Lock fund control level in ^RPO(665.72
137 L +^RMPO(FIL,SITE,1,RVDT,2,IENFCP,0):5
138 Q $T ;FCPLCK
139 ;
140UNLKPAT ;Unlock patient level in ^RMPO(665.72
141 L -^RMPO(FIL,SITE,1,RVDT,1,VDR,"V",DFN,0)
142 Q ;UNLKPAT
143 ;
144UNLKFCP ;Unlock fund contrl point level in ^RMPO(665.72
145 L -^RMPO(FIL,SITE,1,RVDT,2,IENFCP,0)
146 Q ;UNLKFCP
147 ;
148CLEANUP ;Display post messages for FCP
149 ;Call line tag to unlock ^RMPO at patient level
150 N DFN,UNLCK,FLG
151 S FCP="",FLG=1
152 F S FCP=$O(^TMP($J,FCP)) Q:FCP="" D
153 . I '$P(^TMP($J,FCP),U,2) D
154 . . I FLG W !!,"FCP Not Posted",?40,"Message" D
155 . . . W !,"---------------",?40,"-------"
156 . . W !,FCP,?40,$P(^TMP($J,FCP),U,3) S FLG=0
157 . S DFN="" F DFN=$O(^TMP($J,FCP,DFN)) Q:DFN="" D
158 . . I '$D(UNLCK(DFN)) D UNLKPAT S UNLCK(DFN)=""
159 W !! I FLG W "All Fund Control Points posted successfully"
160 K DIR S DIR(0)="FO",DIR("A")="Press any Key to Continue" D ^DIR
161 Q ;CLEANUP
Note: See TracBrowser for help on using the repository browser.