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

BQIMUMON.m

Go to the documentation of this file.
BQIMUMON ;GDIT/HS/ALA-MU Monthly ; 16 Sep 2011  9:47 AM
 ;;2.3;ICARE MANAGEMENT SYSTEM;**1,3,4**;Apr 18, 2012;Build 66
 ;
 ;
EN(BQDATE) ;EP - MU calculations
 ; 
 S QFL=0
 ; If passing a date in
 I $G(BQDATE)'="" D
 . S BQMON=$E(BQDATE,4,5),CYR=$E(BQDATE,1,3),PYR=CYR-1
 . S BQDTE=$P($T(BQM+BQMON),";;",2)
 . S BQMON=$P(BQDTE,U,1)
 . I $L(BQMON)=1 S BQMON="0"_BQMON
 . S BTMFRM=@($P(BQDTE,U,4))_$P(BQDTE,U,3)_"01"
 . S BEGDT=@($P(BQDTE,U,2))_$P(BQDTE,U,1)_"01"
 . S EDAY="31^"_($$LEAP^XLFDT2(CYR)+28)_"^31^30^31^30^31^31^30^31^30^31"
 . S ENDT=@($P(BQDTE,U,2))_$P(BQDTE,U,1)_$P(EDAY,U,+$P(BQDTE,U,1))
 . S ETMFRM=ENDT
 . S BQDATE=@($P(BQDTE,U,2))_$P(BQDTE,U,1)_"00"
 ; If no date, then if not the first of the month, quit
 I $G(BQDATE)="" D  Q:QFL
 . I $E(DT,6,7)'="01" D CHK Q:QFL
 . I $D(^XTMP("BQIMMON")),$O(^XTMP("BQIMMON",""),-1)<DT S ^XTMP("BQIMMON",DT)="",^XTMP("BQIMMONP",DT)="",QFL=1 Q
 . I $D(^XTMP("BQIMMON",DT)),$D(^XTMP("BQIMMONP",DT)) S QFL=1 Q
 . S BQMON=$E(DT,4,5),CYR=$E(DT,1,3),PYR=CYR-1
 . S BQDTE=$P($T(BQM+BQMON),";;",2)
 . S BQMON=$P(BQDTE,U,1)
 . I $L(BQMON)=1 S BQMON="0"_BQMON
 . S BTMFRM=@($P(BQDTE,U,4))_$P(BQDTE,U,3)_"01"
 . S BEGDT=@($P(BQDTE,U,2))_$P(BQDTE,U,1)_"01"
 . S EDAY="31^"_($$LEAP^XLFDT2(CYR)+28)_"^31^30^31^30^31^31^30^31^30^31"
 . S ENDT=@($P(BQDTE,U,2))_$P(BQDTE,U,1)_$P(EDAY,U,+$P(BQDTE,U,1))
 . S ETMFRM=ENDT
 . S BQDATE=@($P(BQDTE,U,2))_$P(BQDTE,U,1)_"00"
 ;
 I $G(^BQI(90508,1,19,0))="" S ^BQI(90508,1,19,0)="^90508.019^^"
 NEW DA,X,IENS,DIC,DLAYGO
 S DA(1)=1,DIC="^BQI(90508,"_DA(1)_",19,",X=$$FMTE^BQIUL1(BQDATE),DIC(0)="LZ",DLAYGO=90508.019
 D ^DIC
 S DA=+Y I DA=-1 K DO,DD D FILE^DICN S DA=+Y
 S IENS=$$IENS^DILF(.DA)
 S BQIUPD(90508.019,IENS,.01)=$$FMTE^BQIUL1(BQDATE)
 S BQIUPD(90508.019,IENS,.02)=BEGDT,BQIUPD(90508.019,IENS,.03)=ENDT
 S BQIUPD(90508.019,IENS,.04)=30,BQIUPD(90508.019,IENS,.05)=1
 D FILE^DIE("","BQIUPD","ERROR")
 S FAC=$O(^BQIFAC(0))
 I FAC="" D
 . S FAC=$$HME^BQIGPUTL()
 . S ^BQIFAC(FAC,0)=FAC,^BQIFAC("B",FAC,FAC)=""
 Q
 ;
CQ(BQDATE) ;EP - Set up Task for CQ
 NEW BQMON,CYR,PYR,YR,QFL,BEGDT,ENDT,EDAY,BQDTE,XX,TMFRAME
 NEW BGPPROV,I,V,Y,BTMFRM,ETMFRM
 D EN(BQDATE) Q:QFL
 S BQIUPD(90508,"1,",12.08)=BEGDT,BQIUPD(90508,"1,",12.09)=ENDT
 D FILE^DIE("","BQIUPD","ERROR")
 ;
 S ZTDTH=$$FMADD^XLFDT($$NOW^XLFDT(),,,3)
 S ZTDESC="MU CQ Monthly Compile",ZTRTN="NIN^BQITASK6",ZTIO=""
 D ^%ZTLOAD
 S BQIUPD(90508,"1,",12.05)=ZTSK
 D FILE^DIE("","BQIUPD","ERROR")
 K ZTDESC,ZTRTN,ZTIO,ZTDTH,ZTSK
 Q
 ;
PF(BQDATE) ;EP - MU Performance
 NEW BQMON,CYR,PYR,YR,QFL,BEGDT,ENDT,EDAY,BQDTE,XX,TMFRAME
 NEW BGPPROV,I,V,Y,BTMFRM,ETMFRM
 D EN(BQDATE) Q:QFL
 S BQIUPD(90508,"1,",9.01)=BEGDT,BQIUPD(90508,"1,",9.02)=ENDT
 D FILE^DIE("","BQIUPD","ERROR")
 ;
 ; Providers
 S ZTDTH=$$FMADD^XLFDT($$NOW^XLFDT(),,,30)
 S ZTDESC="MU Performance Monthly Compile",ZTRTN="NIN^BQITASK7",ZTIO=""
 D ^%ZTLOAD
 S BQIUPD(90508,"1,",12.06)=ZTSK
 D FILE^DIE("","BQIUPD","ERROR")
 K ZTDESC,ZTRTN,ZTIO,ZTDTH,ZTSK
 Q
 ;
PRVC ;EP Providers for CQ
 S BGPPROV=""
 F  S BGPPROV=$O(^BQI(90508,1,14,"B",BGPPROV)) Q:BGPPROV=""  D
 . I $G(^BQIPROV(BGPPROV,0))="" S ^BQIPROV(BGPPROV,0)=BGPPROV,^BQIPROV("B",BGPPROV,BGPPROV)=""
 . I $G(^BQIPROV(BGPPROV,50,0))="" S ^BQIPROV(BGPPROV,50,0)="^90505.44D^^"
 . NEW DA,X,IENS
 . S DA(1)=BGPPROV,DIC="^BQIPROV("_DA(1)_",50,",X=BQDATE,DIC(0)="LNZ",DLAYGO=90505.45,DIC("P")=DLAYGO
 . D ^DIC
 . S DA=+Y I DA=-1 Q
 I $D(BQIUPD) D FILE^DIE("","BQIUPD","ERROR")
 Q
 ;
PRVP ;EP Providers for performance
 S BGPPROV=""
 F  S BGPPROV=$O(^BQI(90508,1,14,"B",BGPPROV)) Q:BGPPROV=""  D
 . I $G(^BQIPROV(BGPPROV,0))="" S ^BQIPROV(BGPPROV,0)=BGPPROV,^BQIPROV("B",BGPPROV,BGPPROV)=""
 . I $G(^BQIPROV(BGPPROV,40,0))="" S ^BQIPROV(BGPPROV,40,0)="^90505.45D^^"
 . S DA(1)=BGPPROV,DIC="^BQIPROV("_DA(1)_",40,",X=BQDATE,DIC(0)="LNZ",DLAYGO=90505.44,DIC("P")=DLAYGO
 . D ^DIC
 . S DA=+Y I DA=-1 Q
 I $D(BQIUPD) D FILE^DIE("","BQIUPD","ERROR")
 Q
 ;
CHK ; EP - check whether month ran or not
 NEW BQMON,CYR,PYR,BQDTE,BQMON,BQDATE,BQMMON
 S QFL=0
 S BQMON=$E(DT,4,5),CYR=$E(DT,1,3),PYR=CYR-1
 S BQDTE=$P($T(BQM+BQMON),";;",2)
 S BQMON=$P(BQDTE,U,1)
 I $L(BQMON)=1 S BQMON="0"_BQMON
 S BQDATE=@($P(BQDTE,U,2))_$P(BQDTE,U,1)_"00"
 S BQMMON=$$FMTE^BQIUL1(BQDATE)
 I $D(^BQI(90508,1,19,"B",BQMMON)) S QFL=1 Q
 S BQMMON=$E(DT,1,5)_"01"
 S ^XTMP("BQIMMON",BQMMON)="",QFL=1
 Q
 ;
BQM ;
 ;;12^PYR^10^PYR
 ;;01^CYR^11^PYR
 ;;02^CYR^12^PYR
 ;;03^CYR^01^CYR
 ;;04^CYR^02^CYR
 ;;05^CYR^03^CYR
 ;;06^CYR^04^CYR
 ;;07^CYR^05^CYR
 ;;08^CYR^06^CYR
 ;;09^CYR^07^CYR
 ;;10^CYR^08^CYR
 ;;11^CYR^09^CYR