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

AZAMFALL.m

Go to the documentation of this file.
  1. BMEMFALL ;Roster Fall Offs [ 06/11/03 3:29 PM ]
  1. ;
  1. ;This routine $ORDER's through the RPMS Master File &
  1. ;checks for all records who's Still Active Date is not
  1. ;equal to the current month's Download Date. If these
  1. ;patients also do not have a Fall Off Date Recorded
  1. ;The MEDICAID ELIGIBILITY File will be populated/updated
  1. ;with an ending date ONLY if one does not exist for the
  1. ;last entry.
  1. ;
  1. ;
  1. START ;
  1. S FALLCT=0
  1. D AZAG ;Get Last Download Log IEN #
  1. D MAST
  1. D LOG
  1. D END
  1. Q
  1. ;
  1. ;
  1. ;
  1. AZAG ; -- this sets up the device and sets the file name
  1. S AZALSTN="" ;Last Log IEN # for Last File processed
  1. S AZALSTNM="" ;Actual File Name in Log
  1. S AZALSTN=$P($G(^AZAMEDLG(0)),U,3)
  1. I AZALSTN="" W !,"No Date Exists on Last Download Run",! G END
  1. S LOGDT=$P($G(^AZAMEDLG(AZALSTN,0)),U,2) ;Run Stop Date
  1. S LOGDT=$P(LOGDT,".",1) ;Strip Time off Date
  1. ;S AZALSTNM=$P($G(^AZAMEDLG(AZALSTN,0)),U,8)
  1. ;I AZALSTNM="" W !!,"Last File Name does NOT exist in Log. Contact Site Manager!" S AZAERROR=1 Q
  1. S AZAMSTDT=$P($G(^AZAMEDLG(AZALSTN,0)),U,1) ;START DT/TIME
  1. Q:'$G(AZAMSTDT)
  1. S AZAMSTDT=$P(AZAMSTDT,".",1) ;Strip Time off Start Date
  1. Q:AZAMSTDT'=LOGDT ;Quite if Start and Stop Date do not match
  1. ;
  1. ;
  1. Q
  1. ;
  1. ;
  1. ;
  1. MAST ;Begin $O through RPMS Master File ^AZAMASTR(
  1. S MASIEN=0 F S MASIEN=$O(^AZAMASTR(MASIEN)) Q:'MASIEN D
  1. . S RECORD=^AZAMASTR(MASIEN,0)
  1. . S STILLDT=$P(RECORD,U,4) ;Still Eligible Date
  1. . Q:'STILLDT
  1. . S DFN=$P(RECORD,U,1) ;Patient DFN #
  1. . Q:'DFN
  1. . S FALLDT=$P(RECORD,U,5) ; Fall Off Date
  1. . Q:FALLDT'="" ;Quit if a Fall Date already exists
  1. . S LSTENDT=$P(RECORD,U,6) ;Last Roster End Date
  1. . S LSTENDT=$S(LSTENDT'="":LSTENDT,1:DT) ;If No Roster End Date - End with Todays Date
  1. . I STILLDT'=LOGDT D MED
  1. ;
  1. ;
  1. MED ; -- add eligiblity date(s)/data
  1. S IEN=$O(^AUPNMCD("B",DFN,0)) Q:'IEN
  1. Q:'$D(^AUPNMCD(IEN,11,0)) ;Quit if Multiple Zero Node does not exist
  1. S LSTEBD=$P($G(^AUPNMCD(IEN,11,0)),U,3) ;Last Beg Date IEN entered
  1. I LSTEBD'="" D
  1. . S SENDDT=$P($G(^AUPNMCD(IEN,11,LSTEBD,0)),U,2) ;End Date
  1. . I SENDDT="" S DR=".02///"_LSTENDT S DIE="^AUPNMCD("_IEN_",11,",DA(1)=IEN,DA=LSTEBD D ^DIE K DIE,DR,DA,DINUM D FALL^AZAMSTR S FALLCT=FALLCT+1
  1. Q
  1. ;
  1. ;
  1. LOG ;Populate Download Run Log with # of Fall Off's
  1. ;
  1. Q:AZALSTN=""
  1. Q:FALLCT<0
  1. S DIE="^AZAMEDLG(",DA=AZALSTN,DR="2////"_FALLCT
  1. D ^DIE K DIE,DA,DR
  1. Q
  1. ;
  1. ;
  1. END ;End of Run
  1. K AZALSTN,AZALSTNM,LOGDT,MASIEN,RECORD,STILLDT,DFN,FALLDT,LSTEBD,SENDDT,FALLCT
  1. Q