source: FOIAVistA/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IB20PT85.m@ 1608

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

initial load of FOIAVistA 6/30/08 version

File size: 4.6 KB
Line 
1IB20PT85 ;ALB/CPM - EXPORT ROUTINE 'DGPTTS3' ; 14-FEB-94
2 ;;Version 2.0 ; INTEGRATED BILLING ;; 21-MAR-94
3 ;
4DGPTTS3 ;ALB/MJK - Physical Mvt ; MAY 04, 1990
5 ;;5.3;Registration;**26**;Aug 13, 1993
6 ;
7EN ; -- entry used to update PTF rec
8 ; input: PTF := PTF#
9 ; DFN := pt#
10 ; DGPMCA := adm mvt #
11 ; DGDT := d/c date
12 ;
13 S DGPTIFN=PTF
14 D FDT^DGPTUTL G ENQ:$S(DGDT:DGDT,1:DT)<Y
15 W:'$D(ZTQUEUED) !,"Now updating ward CDR information..."
16 S (DGBEG,DGSTART,DGLAST)=Y-.0000001
17 S X=Y I $E(X,6,7)="00" S X1=X,X2=-1 D C^%DTC
18 S DGPFYDT=$P(X,".")_".2359" ; last date/time in previous FY
19 D KILL
20 N DGRT S DGRT="^DGPM(""APCA"",DFN,DGPMCA)"
21 ;
22 ; -- build ward table
23 S DGDATA="",DGADM0=$S($D(^DGPM(DGPMCA,0)):^(0),1:"")
24 I DGADM0,DGADM0'>DGSTART S DGT=DGPFYDT D ^DGINPW I +DG1 S $P(DGXFR0,U,4)=+DG1 D TABLE
25 I DGADM0,DGADM0>DGSTART S $P(DGXFR0,U,4)=$P(DGADM0,U,6),DGBEG=+DGADM0 D TABLE
26 F DGXDT=DGSTART:0 S DGXDT=$O(@DGRT@(DGXDT)) Q:'DGXDT F DGMVT=0:0 S DGMVT=$O(@DGRT@(DGXDT,DGMVT)) Q:'DGMVT I $D(^DGPM(DGMVT,0)) S X=^(0) I $P(X,U,2)=2 S DGXFR0=$P(X,U,18)_"^^^"_$P(X,U,6) D TABLE
27 G ENQ:DGDATA=""
28 S DGEND=$S(DGDT:DGDT,1:DT) D DAYS S DGXDT=($S(DGDT:DGDT,1:"")),$P(DGDATA,U,3,4)=LEAVE_U_PASS,$P(DGDATA,U,7)=1 D CREATE
29 ;
30ENQ I $D(DGSACNT),DGSACNT>25 D FLCHK
31 S L=DGPTIFN
32 K DGRT,DGADM0,DG1,DGDATA,DGMDT,DGPTIFN,DGXFR0,DGXDT,DGM,X,DGM0,LEAVE,PASS,DGBEG,DGEND,DGSTART,DGWD,DGCDR,DGSP,DGADM0,DGPFYDT,DGT,DGA1,DGSAFTF,DGSACNT,DGWI,DGI
33 Q
34 ;
35TABLE ; -- setup 535 node data
36 ; DGDATA := 1:ward cdr ^ 2:ward specialty ^ 3:leave days ^ 4:pass days ^ ^ 6:ward ^ ^ ^ ^ 10:mvt date/time
37 ;
38 S DGWD=+$P(DGXFR0,U,4)
39 G TABLEQ:'$D(^DIC(42,DGWD,0)) S DGSP=+$P(^(0),U,12)
40 G TABLEQ:'$D(^DIC(42.4,DGSP,0)) S DGCDR=$P(^(0),U,6)
41 ; -- create CDR mvt if ward cdr changes
42 I DGDATA]"",+DGDATA'=DGCDR S DGEND=DGXDT D DAYS S $P(DGDATA,U,3,4)=LEAVE_U_PASS D CREATE S DGDATA=DGCDR_"^"_DGSP_"^^^^"_DGWD,DGLAST=DGBEG,DGBEG=DGEND
43 I DGDATA="",DGCDR]"" S DGDATA=DGCDR_"^"_DGSP_"^^^^"_DGWD
44TABLEQ Q
45 ;
46CREATE ; -- create CDR mvt
47 L ^DGPT(DGPTIFN,535) S Y=^DGPT(DGPTIFN,535,0),I=$P(Y,U,3)
48L S I=I+1 G L:$D(^DGPT(DGPTIFN,535,I))
49 S $P(^DGPT(DGPTIFN,535,0),U,3,4)=I_U_($P(Y,U,4)+1)
50 S X=DGDATA,^DGPT(DGPTIFN,535,I,0)=I_U_$P(X,U,2)_U_$P(X,U,3)_U_$P(X,U,4)_"^^"_$P(X,U,6)_"^"_$P(X,U,7)_"^^^"_DGXDT L
51 K DA S DA=I,DA(1)=DGPTIFN,DIK="^DGPT("_DGPTIFN_",535," D IX1^DIK
52CREATEQ S DGSACNT=I
53 K DA,I,DIK Q
54 ;
55KILL ; -- clean out ward mvts
56 F DGWI=0:0 S DGWI=$O(^DGPT(DGPTIFN,535,DGWI)) Q:'DGWI S:$P(^(DGWI,0),U,17)="n" DGSAFTF(DGWI)=^(0) K DA S DA(1)=DGPTIFN,DA=DGWI,DIK="^DGPT("_DGPTIFN_",535," D ^DIK K DA
57 S:'$D(^DGPT(DGPTIFN,535,0)) ^(0)="^45.0535^"
58 K DIK,DGWI,DA Q
59 ;
60T ; -- test tag
61 S DIC(0)="AEMQZ",DIC=45,DIC("S")="I $P(^(0),U,11)=1" D ^DIC K DIC Q:Y<0
62PTF S PTF=+Y,DGDT=$S($D(^DGPT(L,70)):+^(70),1:0),DFN=+Y(0) D PM^DGPTUTL,EN:DGPMCA
63 Q
64 ;
65DAYS ; -- calc leave and pass days from DGBEG to DGEND
66 ; -- if last 501 date is after last 535 date then
67 ; calc from last 535 mvt d/t to last 501 mvt d/t
68 ;
69 ; 535 501 501 535
70 ; |------------|------|----------|
71 ; <<<<<<<<<<< total >>>>>>>>>>
72 ; <<<<<<< diff >>>>>>+<< pass >>
73 ;
74 S (PASS,LEAVE,DGDIFP,DGDIFL)=0 D MVT
75 I DGMDT>DGBEG S DGE=DGEND,DGEND=DGMDT D DAYS0 S DGDIFL=LEAVE,DGDIFP=PASS,DGEND=DGE
76 ; -- calc from last 535 mvt d/t to new 535 mvt d/t
77 S (PASS,LEAVE)=0 D DAYS0
78 ; -- substract 'diff' from 'total'
79 S PASS=PASS-DGDIFP,LEAVE=LEAVE-DGDIFL
80 K DGDIFL,DGDIFP,DGE Q
81 ;
82DAYS0 ;
83 N DGMVT
84 F DGMVTDT=(DGBEG-.0000001):0 S DGMVTDT=$O(@DGRT@(DGMVTDT)) Q:'DGMVTDT F DGMVT=0:0 S DGMVT=$O(@DGRT@(DGMVTDT,DGMVT)) Q:'DGMVT I $D(^DGPM(DGMVT,0)),$P(^(0),U,2)=2 S C=$P(^(0),U,18) I C=1!(C=2)!(C=3) D NEXT,DAYS1
85 K DGMVTDT Q
86 ;
87DAYS1 S I=DGMVTDT,X2=$S(I<DGBEG:DGBEG,1:I),X1=$S(Y>DGBEG&(Y'>DGEND):Y,Y>DGEND!('Y):DGEND,1:X2)
88 I X1>X2 D ^%DTC S:C=1 PASS=PASS+X S:C=2 LEAVE=LEAVE+X
89 K C,X,Y,X1,X2,I
90 Q
91 ;
92NEXT ; -- find next x-ref date
93 N DGMVT
94 F Y=DGMVTDT:0 S Y=$O(@DGRT@(Y)) Q:'Y F DGMVT=0:0 S DGMVT=$O(@DGRT@(Y,DGMVT)) Q:'DGMVT I $D(^DGPM(DGMVT,0)),$P(^(0),U,2)=2 G NEXTQ
95NEXTQ Q
96 ;
97MVT ; -- find last 501 mvt d/t since the last 535 mvt d/t
98 ; and before the new 535 mvt d/t
99 S DGMDT=""
100 F M=DGLAST:0 S M=$O(^DGPT(DGPTIFN,"M","AM",M)) Q:'M!(M>DGEND) S DGMDT=M
101 K M Q
102 ;
103FLCHK ; -- check if more than 25 535s, then re-set x-mit flags
104 I '$D(DGSACNT) G FLQ
105 I DGSACNT<25 G FLQ
106 S DGF1=0
107 F DGWI=0:0 S DGWI=$O(DGSAFTF(DGWI)) Q:'DGWI!('$D(^DGPT(DGPTIFN,535,+DGWI,0))) F DGI=1,2,10,16 S:$P(^(0),U,DGI)'=$P(DGSAFTF(DGWI),U,DGI) DGF1=1
108 I 'DGF1,'DGWI F DGWI=0:0 S DGWI=$O(DGSAFTF(DGWI)) Q:'DGWI S DA=DGWI,DA(1)=DGPTIFN,DIE="^DGPT("_DGPTIFN_",535,",DR="17///n" D ^DIE
109FLQ K DGI,DGF1,DGWI,DGSAFTF,DGSACNT,DR,DA,DIE
110 Q
111 ;
Note: See TracBrowser for help on using the repository browser.