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

ACHSA44.m

Go to the documentation of this file.
  1. ACHSA44 ; IHS/ADC/GTH - ENTER DOCUMENTS (5/8)-(CAN) ;
  1. ;;3.1;CONTRACT HEALTH MGMT SYSTEM;;JUN 11, 2001
  1. ;
  1. ;Get the common accounting number and validate. That's all
  1. ;
  1. W !!,"in test version",!!
  1. ;
  1. D SETUP
  1. ;
  1. ;if the maintenance is not complete, say so and quit
  1. I 'OK W *7,!!,"CHS COST CENTER TABLE INCOMPLETE.",! W:ACHSF638'="Y" !,"Must have Cost Centers 568, 573, and 574." Q
  1. ;
  1. D MAKLST
  1. I '$D(CANLIST) W *7,!!,"There are no CHS COMMON ACCOUNTING NUMBERs for this facility.",!!,"Please contact your Site Manager.",!,*7 Q
  1. ;
  1. D A1
  1. I $G(ACHSQUIT) Q
  1. ;
  1. G ^ACHSA5
  1. ;
  1. A1 ;EP
  1. ;get the common accounting number
  1. ;
  1. W !!,"Enter last 4 digits of the CAN Number: "
  1. I ACHSCAN,$D(^ACHS(2,ACHSCAN,0)) S ACHSCC=$P($G(^ACHS(2,ACHSCAN,0)),U,2) W $P($G(^ACHS(2,ACHSCAN,0)),U),"// "
  1. D READ^ACHSFU
  1. ;
  1. ;back from read. handle the input.
  1. ;
  1. ;told to quit?
  1. G A3^ACHSA:$D(DUOUT)
  1. I $G(ACHSQUIT) Q
  1. ;
  1. ;asked for list
  1. I Y?1"?".E D LIST G A1
  1. ;
  1. ;no response
  1. I Y="",(ACHSCAN="") W *7," Must Have CAN Number" G A1
  1. ;
  1. ;if they entered four numbers, put the prefix on the front
  1. I Y?4N S Y=ACHSPREF_Y
  1. ;
  1. ;if they entered a sequence number related to the list, get the code
  1. I Y?1N.N,$D(CANLIST(Y)) S Y=$P(CANLIST(Y),U,2)
  1. ;
  1. ;validate the entry
  1. D VALID
  1. ;
  1. ;not okay? try again
  1. I 'OK G A1
  1. ;
  1. Q
  1. ;
  1. VALID ;
  1. ;validate the input
  1. ;
  1. S OK=0
  1. I '$D(CANLIST(0,Y)) W " Invalid entry" Q
  1. S ACHSCAN=$P(CANLIST(0,Y),U,2)
  1. S SEQ=$P(CANLIST(0,Y),U,1),ACHSCC=$P(CANLIST(SEQ),U,3)
  1. S OK=1
  1. ;
  1. Q
  1. ;
  1. LIST ;
  1. W !!,"SEQ NO",?10,"FY",?15,"CAN NUMBER",?30,"DESCRIPTION OF THE CAN NUMBER",!,"------",?10,"--",?15,"----------",?30,"-----------------------------"
  1. S SEQ=0 F S SEQ=$O(CANLIST(SEQ)) Q:SEQ="" D
  1. . S DATA=CANLIST(SEQ)
  1. . W !,?(3-$L(SEQ)),SEQ,?10,$P(DATA,U,1),?15,$P(DATA,U,2),?30,$P(DATA,U,4)
  1. . Q
  1. Q
  1. ;
  1. SETUP ;
  1. ;set some basic vars, and check for the minimum
  1. ;amount of maintenance
  1. K OK
  1. ;
  1. S ACHS573=$O(^ACHS(1,"B",573,0)),ACHS568=$O(^ACHS(1,"B",568,0))
  1. S ACHS574=$O(^ACHS(1,"B",574,0)),ACHS575=$O(^ACHS(1,"B",575,0))
  1. S ACHS533=$O(^ACHS(1,"B",533,0))
  1. S ACHSF638=$P($G(^ACHSF(DUZ(2),0)),U,8)
  1. ;
  1. ;set the prefix for the CANs. This is stored in the AREA data.
  1. ;if you are not used to these globals, this line looks long and
  1. ;confusing, but all it's doing is using the facility code as a
  1. ;subscript to the LOCATION file. It gets the fourth piece of
  1. ;that as a subscript to the AREA file, where piece 4 is the prefix
  1. S ACHSPREF=$P($G(^AUTTAREA($P($G(^AUTTLOC(DUZ(2),0)),U,4),0)),U,4)
  1. ;
  1. ;we have to have at least these three cans, unless we are
  1. ;a 638 facility, in which case we have to have at least one
  1. ;can, regardless of what it is.
  1. I ACHS573,ACHS568,ACHS574 S OK=1
  1. I ACHSF638="Y",$D(^ACHS(1,"B")) S OK=1
  1. Q
  1. ;
  1. MAKLST ;
  1. ;create list of all CAN numbers valid for this case.
  1. ;validity is decided by several factors, including:
  1. ; is the can for this facility, is the year of the can
  1. ; fit the year of the service, does the service type
  1. ; (in, out, dental) match the service ordered.
  1. ;
  1. ;the advantage of this is that if users asks for a list,
  1. ;we are only showing them valid ones, not all CANs defined.
  1. ;It also allows for a much simpler and shorter validation
  1. ;process.
  1. ;
  1. K CANLIST N CSTCEN,YEAR,EIN,DATA,OK,SEQ
  1. ;
  1. ;look through the Fiscal Year cross reference for CANs to
  1. ;validate. The hard part is that some IDIOT changed the
  1. ;format of the fiscal year from 2 digits to 4, but left
  1. ;all of the 2 digit ones out there. So we have to be
  1. ;ready for either format
  1. ;
  1. ;also, we qualify by fiscal year two ways. if we are using
  1. ;multi year CANs (site parm 2,24) or if we don't have the
  1. ;ACHSMGR key, the fiscal year of the can has to be this year
  1. ;or last.
  1. ;
  1. ;the list has two parts.
  1. ; list(0,code1)=seq1_U_...
  1. ; list(0,code2)=seq2_U_...
  1. ; ... and so on
  1. ; list(seq1)=code1_U_...
  1. ; ... and so on
  1. ;
  1. ; the listing by sequence number is used to write the list to the
  1. ; screen. The zero node is used for quick validation of the entry.
  1. ; the list is defined in detail further down
  1. ;
  1. S EIN=0 F S EIN=$O(^ACHS(2,EIN)) Q:EIN="" Q:'EIN D
  1. . S DATA=$G(^ACHS(2,EIN,0)) I DATA="" Q
  1. . ;got a can. first check the facility
  1. . I $P(DATA,U,3)'=DUZ(2) Q
  1. . ;is it expired?
  1. . I $P(DATA,U,4)'="",($P(DATA,U,4)<DT) Q
  1. . ;
  1. . ;if the parm for multi year cans is on, OR
  1. . ;this user does not have security for ACHSZMGR, AND
  1. . ;the fiscal year is more than a year ago, stop
  1. . I $$PARM^ACHS(2,24)="Y"!'($D(^XUSEC("ACHSZMGR",DUZ))) D
  1. .. ;check the year
  1. .. Q
  1. . ;
  1. . S CSTCEN=$P(DATA,U,2)
  1. . I ACHSF638'="Y" S OK=0 D MAKLST1 I 'OK Q
  1. . ;if we got this far, this can is valid
  1. . ;the canlist has this format
  1. . ; canlist(0,CAN) = sequence num^EIN
  1. . ; canlist(sequence number) =
  1. . ; fy^CAN^cc^ccd^expdate^EIN
  1. . ; piece 1 fiscal year
  1. . ; piece 2 CAN number
  1. . ; piece 3 cost center
  1. . ; piece 4 cost center description
  1. . ; piece 5 expiration date
  1. . ; piece 6 subscript for ^ACHS(2,EIN,0)
  1. . ;
  1. . ; not all of these pieces are used right now, but they are
  1. . ; here so as to be handy
  1. . ;
  1. . S CAN=$P(DATA,U,1)
  1. . S SEQ=$G(SEQ)+1,CANLIST(SEQ)=$G(TYEAR)_U_DATA_U_EIN
  1. . ; now go get the cost center description and place into piece 4
  1. . S DATA=$G(^ACHS(1,$P(DATA,U,2),0)),$P(CANLIST(SEQ),U,4)=$P(DATA,U,2)
  1. . ; finally, set the 0 node
  1. . S CANLIST(0,CAN)=SEQ_U_EIN
  1. . Q
  1. Q
  1. ;
  1. MAKLST1 ;
  1. ;if this is not a 638 fac, we come here. now make sure that
  1. ;the cost center matches the service type
  1. I ACHSTYP=1,(CSTCEN'=ACHS573),(CSTCEN'=ACHS575),(CSTCEN'=ACHS533) Q
  1. I ACHSTYP=2,(CSTCEN'=ACHS568) Q
  1. I ACHSTYP=3,(CSTCEN=ACHS568) Q
  1. S OK=1
  1. Q