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

BQIIPCFX.m

Go to the documentation of this file.
BQIIPCFX ;GDIT/HS/ALA-Fix IPC ; 02 Jan 2014  12:36 PM
 ;;2.3;ICARE MANAGEMENT SYSTEM;**5**;Apr 18, 2012;Build 17
 ;
 NEW BI,FROW,BQDATE,PRN,PROW
 F BI=1:1:16 S FROW=$P($T(ROW+BI),";;",2) D
 . S BQDATE=$P(FROW,U,1),ROW=$P(FROW,U,2)
 . S PRN=$O(^BQI(90508,1,22,2,3,"B",BQDATE,"")) I PRN="" Q
 . S PROW=$P(^BQI(90508,1,22,2,3,PRN,0),U,2)
 . I PROW'=ROW S $P(^BQI(90508,1,22,2,3,PRN,0),U,2)=ROW
 ;
 NEW ZTDTH,ZTDESC,ZTRTN,ZTIO,ZTSAVE,BQIUPD
 S ZTDTH=$$FMADD^XLFDT($$NOW^XLFDT(),,,3)
 S ZTDESC="IPC Update Compile",ZTRTN="JOB^BQIIPCFX",ZTIO=""
 D ^%ZTLOAD
 S BQIUPD(90508,"1,",11.04)=ZTSK
 D FILE^DIE("","BQIUPD","ERROR")
 Q
 ;
JOB ;EP
 I '$D(^BQI(90508,1,22,2,3,"B",3141100)) D
 . S BQDATE=3141100 D EN^BQIIPMNU
 I '$D(^BQI(90508,1,22,2,3,"B",3141200)) D
 . S BQDATE=3141200 D EN^BQIIPMNU
 I '$D(^BQI(90508,1,22,2,3,"B",3150100)) D IJB^BQINIGH3(3150100)
 ;
MU ;EP Fix MU
 NEW BQIPROV
 S BQIPROV=0
 F  S BQIPROV=$O(^BQIPROV(BQIPROV)) Q:'BQIPROV  D
 . F CODE="MU_5","MU_6","MU_7","MU_8" D
 .. S MPDN=$O(^BQIPROV(BQIPROV,30,"B",CODE,"")) Q:MPDN=""
 .. S MPDT=3121200
 .. F  S MPDT=$O(^BQIPROV(BQIPROV,30,MPDN,1,"B",MPDT)) Q:MPDT=""  D
 ... S BEGDT=$E(MPDT,1,5)_"01",CYR=$E(MPDT,1,3),BQMON=$E(MPDT,4,5)
 ... I $L(BQMON)=1 S BQMON="0"_BQMON
 ... S EDAY="31^"_($$LEAP^XLFDT2(CYR)+28)_"^31^30^31^30^31^31^30^31^30^31"
 ... S ENDT=$E(MPDT,1,5)_$P(EDAY,U,+BQMON)
 ... S BQDATE=MPDT
 ... D MU^BQIIPSNG
 . I MPDN="" Q
 . S BQDATE=3121200
 . F  S BQDATE=$O(^BQIPROV(BQIPROV,30,MPDN,1,"B",BQDATE)) Q:BQDATE=""  D
 .. ; Update the MU bundles
 .. NEW MPRN,IPRN,IPRD,DEN,NUM,MCOD,MPRD,MBUN
 .. S MPRN=$O(^BQIPROV(BQIPROV,30,"B","IPC_WGT",""))
 .. I MPRN'="" S MPRD=$O(^BQIPROV(BQIPROV,30,MPRN,1,"B",BQDATE,""))
 .. K MBUN
 .. F MCOD="MU_8","MU_6","MU_7" D
 ... S IPRN=$O(^BQIPROV(BQIPROV,30,"B",MCOD,"")) I IPRN="" Q
 ... S IPRD=$O(^BQIPROV(BQIPROV,30,IPRN,1,"B",BQDATE,"")) I IPRD="" Q
 ... S DEN=$P(^BQIPROV(BQIPROV,30,IPRN,1,IPRD,0),U,2),NUM=$P(^(0),U,3)
 ... S MBUN(+DEN)=+NUM
 .. S DEN=$O(MBUN(""))
 .. S:DEN="" NUM="" S:DEN'="" NUM=MBUN(DEN)
 .. I MPRN'="",MPRD'="" D
 ... S $P(^BQIPROV(BQIPROV,30,MPRN,1,MPRD,0),U,2)=DEN,$P(^BQIPROV(BQIPROV,30,MPRN,1,MPRD,0),U,3)=NUM
 ;
 F CODE="MU_5","MU_6","MU_7","MU_8","IPC_WGT" D
 . S BPRV=0 K TDEN,TNUM
 . F  S BPRV=$O(^BQIPROV(BPRV)) Q:'BPRV  D
 .. S MPDN=$O(^BQIPROV(BPRV,30,"B",CODE,"")) I MPDN="" Q
 .. S BDT=3131200
 .. F  S BDT=$O(^BQIPROV(BPRV,30,MPDN,1,"B",BDT)) Q:BDT=""  D
 ... S MIEN=$O(^BQIPROV(BPRV,30,MPDN,1,"B",BDT,"")) I MIEN="" Q
 ... S DEN=$P(^BQIPROV(BPRV,30,MPDN,1,MIEN,0),U,2),NUM=$P(^(0),U,3)
 ... S TDEN(BDT)=$G(TDEN(BDT))+DEN,TNUM(BDT)=$G(TNUM(BDT))+NUM
 . S BDT=""
 . F  S BDT=$O(TDEN(BDT)) Q:BDT=""  D
 .. S FAC=$$HME^BQIGPUTL()
 .. D STORF^BQIIPUTL(FAC,CODE,BDT,TDEN(BDT),TNUM(BDT))
 . K TDEN,TNUM
 ;
 NEW BQD,BQX,BQDATE,CODE,PRV,TDEN,TNUM,IPRN,IPRD,DEN,NUM,FAC,Y
 S BQD=3140800
 F  S BQD=$O(^BQI(90508,1,22,2,3,"B",BQD)) Q:BQD=""  S BQX(BQD)=""
 S BQDATE=""
 F  S BQDATE=$O(BQX(BQDATE)) Q:BQDATE=""  D
 . S MSN=0,CRN=2
 . F  S MSN=$O(^BQI(90508,1,22,CRN,1,MSN)) Q:'MSN  D
 .. S IDATA=^BQI(90508,1,22,CRN,1,MSN,0)
 .. S CODE=$P(IDATA,U,1),TYP=$P(IDATA,U,2)
 .. ; If inactive, quit
 .. I $P(IDATA,U,7)=1 Q
 .. ; If type is CRS, update the facility
 .. I TYP'="G" Q
 .. S PRV="",TDEN=0,TNUM=0
 .. F  S PRV=$O(^AUPNPAT("AK",PRV)) Q:PRV=""  D
 ... I $P(^VA(200,PRV,0),U,13)'="" Q
 ... S IPRN=$O(^BQIPROV(PRV,30,"B",CODE,"")) I IPRN="" Q
 ... S IPRD=$O(^BQIPROV(PRV,30,IPRN,1,"B",BQDATE,"")) I IPRD="" Q
 ... S DEN=$P(^BQIPROV(PRV,30,IPRN,1,IPRD,0),U,2),NUM=$P(^(0),U,3)
 ... S TNUM=TNUM+NUM,TDEN=TDEN+DEN
 ... ;W !,PRV,"|",NUM,"|",DEN
 .. ;W !,BQDATE,"|",CODE,"|",TNUM,"|",TDEN
 .. S FAC=$$HME^BQIGPUTL()
 .. D STORF^BQIIPUTL(FAC,CODE,BQDATE,TDEN,TNUM)
 Q
 ;
ROW ;EP
 ;;3130900^62
 ;;3131000^63
 ;;3131100^64
 ;;3131200^65
 ;;3140100^66
 ;;3140200^67
 ;;3140300^68
 ;;3140400^69
 ;;3140500^70
 ;;3140600^71
 ;;3140700^72
 ;;3140800^73
 ;;3140900^74
 ;;3141000^75
 ;;3141100^76
 ;;3141200^77
 Q