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

BGOEDTP2.m

Go to the documentation of this file.
BGOEDTP2 ; IHS/BAO/TMD - EDUCATION TOPIC PREFERENCES MANAGER 2 ;18-Sep-2007 14:42;DKM
 ;;1.1;BGO COMPONENTS;**1,3,4**;Mar 20, 2007
 ; Clone a preference
 ;  INP = Pref IEN (from) ^ Pref IEN (to)
CLONE(RET,INP) ;EP
 D CLONE^BGOPFUTL(.RET,INP,90362.36)
 Q
 ; Execute query to update frequencies
 ;  INP = Category IEN [1] ^ Provider IEN [2] ^ Clinic IEN [3] ^ Provider Class [4] ^ Hospital Location [5] ^
 ;        Start Date [6] ^ End Date [7] ^ Max Hits [8]
QUERY(RET,INP) ;EP
 N CAT,PRV,CLN,CLS,HL,BEGDT,ENDDT,VD,VIEN,VIS,DX,EDT,TXT,CNT,MAX,X
 S RET=""
 S CAT=$P(INP,U)
 S PRV=$P(INP,U,2)
 S CLN=$P(INP,U,3)
 S CLS=$P(INP,U,4)
 S HL=$P(INP,U,5)
 S BEGDT=$P(INP,U,6)
 S ENDDT=$P(INP,U,7)
 S MAX=+$P(INP,U,8)
 I CLN="",CLS="",PRV="",HL="" S RET=$$ERR^BGOUTL(1022) Q
 S RET=$$QRYINIT^BGOPFUTL(90362.36,CAT)
 Q:RET
 S VD=$S(BEGDT:BEGDT,1:DT-20000)
 S:'ENDDT ENDDT=DT
 S CNT=0,ENDDT=ENDDT\1+.9
 F  S VD=$O(^AUPNVSIT("B",VD)) Q:'VD!RET!(VD>ENDDT)  D
 .S VIEN=0
 .F  S VIEN=$O(^AUPNVSIT("B",VD,VIEN)) Q:'VIEN!RET  D
 ..S VIS=$G(^AUPNVSIT(VIEN,0))
 ..Q:VIS=""
 ..I CLN,$P(VIS,U,8)'=CLN Q
 ..I HL,$P(VIS,U,22)'=HL Q
 ..I PRV!CLS,'$$VISPRCL^BGOPFUTL(VIEN,PRV,CLS) Q
 ..S DX=0
 ..F  S DX=$O(^AUPNVPED("AD",VIEN,DX)) Q:'DX!RET  D
 ...S CNT=CNT+1
 ...S:CNT=MAX RET=CNT
 ...S EDT=+$G(^AUPNVPED(DX,0))
 ...Q:'EDT
 ...S TXT=$P($G(^AUTTEDT(EDT,0)),U)
 ...D QRYADD^BGOPFUTL(90362.36,CAT,EDT,TXT)
 S RET=$$QRYDONE^BGOPFUTL(90362.36,CAT)
 Q