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

DGBTCE1.m

Go to the documentation of this file.
DGBTCE1 ;ALB/LM - BENEFICIARY TRAVEL CLAIM RE-ENTER/EDIT CONT.; 9/13/89@8:00 ;4/23/91  09:42
 ;;1.0;Beneficiary Travel;**17,20**;September 25, 2001;Build 185
 Q
CONT ; ENTRY POINTS FROM DGBTEE,DGBTCE
 N MOSTENC
 F I=0,"A","C","D","M","R","T" S DGBTVAR(I)=$S($D(^DGBT(392,DGBTDT,I)):^(I),1:"")
 I DGBTDE<0 S DGBTDE=0
 I $G(DGBTCCREQ) S DGBTFLX=" DEDUCTIBLE AMOUNT HAS BEEN CHANGED " I DGBTACCT=4 S DGBTPA=$S(DGBTTC-DGBTDE>0:DGBTTC-DGBTDE,DGBTTC-DGBTDE<0:DGBTTC,1:0)
DIE5 ;S DGBTINFL=$S(DGBTDE=DGBTDCV:$P(DGBTVAR("R"),DGBTFLX)_$P(DGBTVAR("R"),DGBTFLX,2)_" ",DGBTDE'=DGBTDCV&(DGBTVAR("R")'[DGBTFLX):$E(DGBTVAR("R")_DGBTINFL_DGBTFLX,1,79),1:DGBTVAR("R"))
 S MOSTENC=$$GET1^DIQ(392,DGBTDT,8)
 S DGBTPA=$P(DGBTVAR(0),"^",10)
 I $G(DGBTCCREQ) S DGBTPA=$S($G(MOSTENC)>0&(MOSTENC<DGBTPA):MOSTENC,1:DGBTPA),DGBTPA=$S(DGBTPA-$G(DGBTDE)<0:0,1:DGBTPA)   ;$P(DGBTVAR(0),"^",9)
 I '$G(DGBTCCREQ),'$G(MOSTENC) D
 .S DGBTPA=$P(DGBTVAR("C"),"^",2)+$P(DGBTVAR("M"),"^",4)+$P(DGBTVAR("M"),"^",5)
 .I $P(DGBTVAR("M"),"^",3)-$G(DGBTDCV1)>0 S DGBTPA=DGBTPA+(DGBTMLT-$G(DGBTDE))
 .I $P(DGBTVAR("M"),"^",3)-$G(DGBTDCV1)<0 S DGBTPA=DGBTPA
 ;    stuff amount payable
 I DGBTFLAG=2 W !!,"DEDUCTIBLE AMOUNT CAN NOT EXCEED THE TOTAL COSTS FOR THIS CLAIM",! K X S DGBTFLAG=0 G DED1^DGBTCE
 I DGBTFLAG=1 W !!,"DEDUCTIBLE FOR THIS CLAIM CAN NOT EXCEED THE AMOUNT REMAINING FOR THIS MONTH",! K X S DGBTFLAG=0 G DED1^DGBTCE
 ;
 S DIE="^DGBT(392,",DA=DGBTDT,DIE("NO^")="BACK",DR="51"
DIE6 D ^DIE K DIE,DQ,DR I $D(DTOUT)!($D(Y)) S DGBTTOUT=-1 Q
 I ($L(DGBTACCT)=1),("45"[DGBTACCT) D
 .N FDA,ERR
 .S DGBTPA=$$PAYABLE
 .S FDA(392,DGBTDT_",",9)=DGBTDE
 .S FDA(392,DGBTDT_",",10)=DGBTPA
 .D FILE^DIE("E","FDA","ERR")
 .I $D(ERR) S DGBTTOUT=-1
 I $G(DGBTTOUT)=-1 Q
 D QUIT
 D SCREEN^DGBTCD
 Q
QUIT ;KILL VARIABLES
 K DGBTCITY,DGBTSTAT,DGBTWAY,DGBTMILE,DIE,DR,DGBTOWRT,DGBTML,DGBTMLFB,DGBTACCT,DGBTAP,DGBTMAL,DGBTFAB,DGBTME,DGBTMAF,DGBTTC,DGBTDCM,DGBTDPV,DGBTDPM,DGBTDRM,DGBTDCV,DGBTDE,DGBTPA,I,DGBTELIG,DGBTFLAG,DGBTMETC,DGBTMLT,DGBTCP,DGBTMR1
 K DGBTFR1,DGBTFR2,DGBTFR3,DGBTFR4,DGBTTO1,DGBTTO2,DGBTTO3,DGBTTO4,DGBTMR,DGBTRATE,DGBTSCP,DGBTFLX Q
PAYABLE() ;
 N DGBTRAY,FERRIES,MEALS,MILEAGE
 D GETS^DIQ(392,DGBTDT_",","8;33;34;35;55;55.1","EI","DGBTRAY")
 S MEALS=+DGBTRAY(392,DGBTDT_",",34,"I")
 S MILEAGE=+DGBTRAY(392,DGBTDT_",",33,"I")
 S FERRIES=+DGBTRAY(392,DGBTDT_",",35,"I")
 I DGBTDE>MILEAGE S DGBTDE=MILEAGE
 I DGBTRAY(392,DGBTDT_",",55.1,"E")="NO" Q $$COMCARN
 I DGBTRAY(392,DGBTDT_",",55.1,"E")="YES" Q $$COMCARY
 S DGBTPA=MILEAGE+MEALS+FERRIES
 I DGBTDE>DGBTPA Q 0
 Q (DGBTPA-DGBTDE)
 ;
COMCARN() ;CC not required
 N CCFEE,MOSTEC,FDA
 S MOSTEC=+DGBTRAY(392,DGBTDT_",",8,"I")
 I DGBTDE>MILEAGE S DGBTDE=MILEAGE
 I (MOSTEC>0)&(MILEAGE'>0) Q (MOSTEC+MEALS+FERRIES)
 I (MOSTEC>0)&(MOSTEC>MILEAGE) S DGBTPA=(MILEAGE+MEALS+FERRIES)
 I (MOSTEC>0)&(MOSTEC'>MILEAGE) D  Q (MOSTEC+MEALS+FERRIES)
 .S FDA(392,DGBTDT_",",9)=0 S DGBTDE=0
 .D FILE^DIE("E","FDA","ERR")
 I (MOSTEC'>0) S DGBTPA=(MILEAGE+MEALS+FERRIES)
 I DGBTDE>DGBTPA Q 0
 Q (DGBTPA-DGBTDE)
 ;
COMCARY() ; CC required
 N CCFEE,MOSTEC
 S CCFEE=+DGBTRAY(392,DGBTDT_",",55,"I")
 I DGBTDE>MILEAGE S DGBTDE=MILEAGE,MILEAGE=DGBTDE
 S DGBTPA=CCFEE+MILEAGE+MEALS+FERRIES
 S DGBTPA=CCFEE+MEALS+FERRIES+MILEAGE
 I DGBTDE>DGBTPA Q 0
 Q (DGBTPA-DGBTDE)