source: WorldVistAEHR/trunk/r/PROSTHETICS-RMPR-RMPO-RMPS/RMPR4C1.m@ 1605

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

initial load of WorldVistAEHR

File size: 4.8 KB
Line 
1RMPR4C1 ;PHX/HNB,RVD - PURCHASE CARD SUMMARY SHEET ;3/1/1996
2 ;;3.0;PROSTHETICS;**3,20,26**;Feb 09, 1996
3 ;using new data fields
4 W !,"Prosthetics Purchase Card Summary Sheet"
5 W !!
6START K ^TMP($J) D DIV4^RMPRSIT G:$D(X) EX S RMPRCOUN=0 D HOME^%ZIS W !! S %DT("A")="Starting Date: ",%DT="AEPX" D ^%DT S RMPRBDT=Y G:Y<0 EX
7 S %DT("A")="Ending Date: ",%DT="AEX" D ^%DT G:Y<0 EX I RMPRBDT>Y W !,$C(7),"Invalid Date Range Selection!!" G START
8 S RMPREDT=Y,Y=RMPRBDT D DD^%DT S RMPRX=Y,Y=RMPREDT D DD^%DT S RMPRY=Y
9PCRD ;ask purchase card number
10 K DIR S DIR(0)="FO",DIR("A")="Enter PURCHASE CARD NUMBER"
11 S DIR("?")="Enter the 16 Digit Purchase Card Number"
12 D ^DIR K DIR
13 I $D(DTOUT)!($D(DUOUT)) W !,$C(7),$C(7),"Try Later!" G EX
14 I $L(X)>16!($L(X)<16)!(X'?.N) W !,"Must be 16 a Digit Number." G PCRD
15 S RMPRPCRD=Y
16 ;task it
17 S %ZIS="MQ" K IOP D ^%ZIS G:POP EX
18 I '$D(IO("Q")) U IO G PRINT
19 S ZTDESC="PURCHASE CARD SUMMARY",ZTRTN="PRINT^RMPR4C1"
20 S ZTSAVE("RMPRBDT")="",ZTSAVE("RMPREDT")="",ZTSAVE("RMPRX")=""
21 S ZTSAVE("RMPRY")="",ZTSAVE("RMPR(")="",ZTSAVE("RMPRPCRD")=""
22 D ^%ZTLOAD W:$D(ZTSK) !,"REQUEST QUEUED!" H 1 G EX
23PRINT S X1=RMPRBDT,X2=-1 D C^%DTC S RO=X,RP=0,PAGE=1,RMPRCOUN=0,RMPREND=""
24 I $E(IOST)["C" D WAIT^DICD W @IOF
25 F S RO=$O(^RMPR(664,"B",RO)) Q:RO'>0 Q:RO>RMPREDT F S RP=$O(^RMPR(664,"B",RO,RP)) Q:RP'>0 D CK
26 ;TCLCNT, total closed liquidated amount
27 ;CNT, total authorized amount
28 ;ORCNT1, total open transactions
29 ;ORCNT2, total closed transactions
30 S (RP,RMPROBL,CNT,TCLCNT,NL,RMAMTOT)=""
31 S (ORCNT1,ORCNT2)=0
32 F S RMPROBL=$O(^TMP($J,RMPROBL)) Q:RMPROBL'>0 Q:RMPREND=1 F S RP=$O(^TMP($J,RMPROBL,RP)) Q:RP'>0 S RMAST=$G(^(RP)) Q:RMPREND=1 D WRI
33 I $D(RMPREDT)&(RMPRCOUN=0) W @IOF D HDR W $C(7),!!,"NO SELECTIONS MADE DURING THIS DATE RANGE!!"
34 I $D(RMPREDT),RMPRCOUN>0,RMPREND'=1 D
35 .W !,RMPR("L"),!,?26,"TOTALS"
36 .W ?36,$J(NL,9,2)
37 .W ?48,$J(RMAMTOT,7,2)
38 .W ?57,$J(TCLCNT,9,2)
39 .W ?69,$J(CNT,9,2)
40 .W !!,?10," Total liquidated ",$J(TCLCNT,9,2)
41 .W !,?10," Total non-liquidated ",$J(CNT-TCLCNT,9,2)
42 .W !,?10,"Total Cumulative Authorized ",$J(CNT,9,2)
43 .W !!,?10,"Total Open Orders/Transactions ",$J(ORCNT1,5)
44 .W !,?8,"Total Closed Orders/Transactions ",$J(ORCNT2,5)
45 .H 1
46EXIT I $E(IOST)["C"&($Y<20) F W ! Q:$Y>20
47 I $D(RMPREDT),'$D(DTOUT),'$D(DUOUT),$E(IOST)["C",'$D(RMPRFLL),RMPREND'=1 S DIR(0)="E" D ^DIR
48EX K RMPREND,RMPROBL,RMPRFLL,RMPRFLG,DUOUT,DIR,RO,RP,RMPRY,RMPRCOUN,RMPRX,RMPRBDT,RMPREDT,RMPRCK,%DT,X,Y,PAGE,IT,ZTSK,^TMP($J) D ^%ZISC
49 K CNT,DTOUT,ROBL,X1,X2,RMPR,RMSHI,R660T,R660AC,RMAMTOT,RMAST,RMCUM,RMIDA,RMAMEN,CLODT,TCLCNT,NL,ORCNT1,ORCNT2,%ZIS,DCT,RMACS
50 Q
51CK ;check record, apply screen
52 Q:'$D(^RMPR(664,RP,0))
53 ;vendor, purchase card, cancelation date
54 Q:$P(^RMPR(664,RP,0),U,4)=""!($P($G(^(4)),U,1)="")!($P(^(0),U,5)'="")
55 Q:$P(^RMPR(664,RP,0),U,14)'=""&($P(^(0),U,14)'=RMPR("STA"))
56 S ROBL=$P($G(^RMPR(664,RP,4)),U,1)
57 S RMPROBL=$$DEC^RMPR4LI($P(^RMPR(664,RP,4),U,1),$P(^RMPR(664,RP,0),U,9),RP)
58 Q:RMPROBL'=RMPRPCRD
59 S RMAST="",(R660AC,R660T,RMACS)=0,DCT=0 S RMACS=$S($P(^RMPR(664,RP,0),U,11):$P(^RMPR(664,RP,0),U,11),1:$P(^RMPR(664,RP,0),U,10)) S RMSHI=$P(^RMPR(664,RP,0),U,12) I RMSHI S R660T=$P($G(^RMPR(660,RMSHI,0)),U,17) S:+RMACS'=+R660T RMAST="*"
60 I $D(^RMPR(664,RP,2)),$P(^(2),U,6) S DCT=$P(^(2),U,6),DCT=DCT/100
61 F I=0:0 S I=$O(^RMPR(664,RP,1,I)) Q:I'>0 S R660T=$S($P($G(^(I,0)),U,7):$P(^(0),U,7)*$P(^(0),U,4),1:$P(^(0),U,3)*$P(^(0),U,4)) I R660T D
62 .S:DCT R660T=R660T-(R660T*DCT)
63 .S RMIDA=$P($G(^(0)),U,13) I RMIDA S R660AC=$P($G(^RMPR(660,RMIDA,0)),U,16) S:+R660AC'=+R660T RMAST="*"
64 S ^TMP($J,RMPROBL,RP)=RMAST,RMPRCOUN=RMPRCOUN+1
65 Q
66WRI I '$D(RMPRFLG) D HDR
67 W !,$E($P(^DPT($P(^RMPR(664,RP,0),U,2),0),U,1),1,12)
68 W ?14,$E($P(^DPT($P(^RMPR(664,RP,0),U,2),0),U,9),6,9)
69 N RD
70 S RD=$P(^RMPR(664,RP,0),U,1)
71 S RD=$P(RD,"."),RD=$E(RD,4,5)_"/"_$E(RD,6,7)
72 W ?19,RD,?26,$P($G(^RMPR(664,RP,4)),U,5)
73 S (AACNT,CLCNT,RMAMEN)=0
74 ;AACNT, est amount
75 ;RMAMEN, ADJ amount
76 ;CLCNT, closed amount
77 ;CLODT, CLOSE OUT DATE
78 S RMAMEN=$P(^RMPR(664,RP,2),U,9)
79 S AACNT=$P(^RMPR(664,RP,4),U,3)
80 S CLCNT=$P(^RMPR(664,RP,4),U,4)
81 S CLODT=$P(^RMPR(664,RP,0),U,8)
82 I 'RMAMEN S RMAMEN=0
83 E S RMAMEN=RMAMEN-AACNT
84 I $G(CLODT) S ORCNT2=ORCNT2+1
85 E S ORCNT1=ORCNT1+1
86 S NL=NL+AACNT,RMAMTOT=RMAMTOT+RMAMEN
87 S TCLCNT=TCLCNT+CLCNT
88 S RMCUM=$S(CLCNT'="":CLCNT,AACNT'="":AACNT+RMAMEN,1:"")
89 ;S:RMCUM'=R660T RMAST="*"
90 S CNT=CNT+RMCUM
91 W ?36,$J(AACNT,9,2)
92 W ?48,$J(RMAMEN,7,2)
93 W ?57,$J(CLCNT,9,2)
94 W ?69,$J(CNT,9,2)_RMAST
95 S RMPRFLG=1
96 I $E(IOST)["C"&($Y>(IOSL-6)) W ! S DIR(0)="E" D ^DIR S:Y<1 RMPREND=1 Q:Y="" S:Y<1 RMPRFLL=1 Q:Y<1 S:$D(DTOUT) RMPREND=1 Q:$D(DTOUT) D HDR Q
97 I $Y>(IOSL-6) K RMPRFLG
98 Q
99HDR I PAGE'=1 W @IOF
100 W !,RMPRX_"-",RMPRY," "_RMPRPCRD_" Summary "_"STA "_$$STA^RMPRUTIL,?72,"PAGE ",PAGE,! S PAGE=PAGE+1
101 W !,"Patient",?14,"SSN",?19,"Date",?26,"PC #",?37,"Auth Amt",?48,"Adj Amt",?59,"Liq Amt",?71,"Cum Amt",!,RMPR("L")
102 Q
Note: See TracBrowser for help on using the repository browser.