OCXOCMPA ;SLC/RJS,CLA - ORDER CHECK CODE COMPILER (Convert Constant Values to internal format) ;10/29/98 12:37
;;3.0;ORDER ENTRY/RESULTS REPORTING;**32**;Dec 17,1997
;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
;
Q
;
EXT2INT(OCXDT,OCXVAL) ;
;
I (OCXDT="DATE/TIME") D
.N X,%DT
.I (OCXVAL="TOMORROW") S OCXVAL="T+1" Q
.I (OCXVAL="YESTERDAY") S OCXVAL="T-1" Q
.I (OCXVAL["TODAY") S OCXVAL=$P(OCXVAL,"TODAY",1)_"T"_$P(OCXVAL,"TODAY",2) Q
.I (OCXVAL["NOW") S OCXVAL=$P(OCXVAL,"NOW",1)_"N"_$P(OCXVAL,"NOW",2) Q
.Q:(OCXVAL="N") Q:(OCXVAL?1"N+".N) Q:(OCXVAL?1"N-".N)
.Q:(OCXVAL="T") Q:(OCXVAL?1"T+".N) Q:(OCXVAL?1"T-".N)
.S X=OCXVAL,%DT="T" D ^%DT S:(Y>0) OCXVAL=+Y
;
Q $$QT(OCXVAL)
;
QT(X) ;
I ($E(X,1)="""") Q X
I (+X=X) Q X
S X=""""_X_""""
Q X
;
INT2DT(OCXDT) ; This Local Extrinsic Function converts an OCX internal format
; date into an Externl Format (Human Readable) date.
;
Q:'$L($G(OCXDT)) ""
N OCXYR,OCXLPYR,OCXMON,OCXDAY,OCXHR,OCXMIN,OCXSEC
S (OCXYR,OCXLPYR,OCXMON,OCXDAY,OCXHR,OCXMIN,OCXSEC,OCXAP)=""
S OCXSEC=$E(OCXDT#60+100,2,3),OCXDT=OCXDT\60
S OCXMIN=$E(OCXDT#60+100,2,3),OCXDT=OCXDT\60
S OCXHR=$E(OCXDT#24+100,2,3),OCXDT=OCXDT\24
S OCXYR=(OCXDT\1461)*4+1841,OCXDT=OCXDT#1461
S OCXLPYR=(OCXDT\365),OCXDT=OCXDT-(OCXLPYR*365),OCXYR=OCXYR+OCXLPYR
S OCXCNT="031^059^090^120^151^181^212^243^273^304^334^365"
S:(OCXLPYR=3) OCXCNT="031^060^091^121^152^182^213^244^274^305^335^366"
F OCXMON=1:1:12 Q:(OCXDT<$P(OCXCNT,U,OCXMON))
S OCXDAY=OCXDT-$P(OCXCNT,U,OCXMON-1)+1
S OCXMON=$P("January^February^March^April^May^June^July^August^September^October^November^December",U,OCXMON)
S OCXAP=$S('OCXHR:"Midnight",(OCXHR=12):"Noon",(OCXHR<12):"AM",1:"PM")
S OCXHR=OCXHR#12 S:'OCXHR OCXHR=12
Q:(OCXHR+OCXMIN+OCXSEC) OCXMON_" "_OCXDAY_","_OCXYR_" at "_OCXHR_":"_OCXMIN_"."_OCXSEC_" "_OCXAP
Q OCXMON_" "_OCXDAY_","_OCXYR
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HOCXOCMPA 1926 printed Oct 16, 2024@18:25:23 Page 2
OCXOCMPA ;SLC/RJS,CLA - ORDER CHECK CODE COMPILER (Convert Constant Values to internal format) ;10/29/98 12:37
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**32**;Dec 17,1997
+2 ;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
+3 ;
+4 QUIT
+5 ;
EXT2INT(OCXDT,OCXVAL) ;
+1 ;
+2 IF (OCXDT="DATE/TIME")
Begin DoDot:1
+3 NEW X,%DT
+4 IF (OCXVAL="TOMORROW")
SET OCXVAL="T+1"
QUIT
+5 IF (OCXVAL="YESTERDAY")
SET OCXVAL="T-1"
QUIT
+6 IF (OCXVAL["TODAY")
SET OCXVAL=$PIECE(OCXVAL,"TODAY",1)_"T"_$PIECE(OCXVAL,"TODAY",2)
QUIT
+7 IF (OCXVAL["NOW")
SET OCXVAL=$PIECE(OCXVAL,"NOW",1)_"N"_$PIECE(OCXVAL,"NOW",2)
QUIT
+8 if (OCXVAL="N")
QUIT
if (OCXVAL?1"N+".N)
QUIT
if (OCXVAL?1"N-".N)
QUIT
+9 if (OCXVAL="T")
QUIT
if (OCXVAL?1"T+".N)
QUIT
if (OCXVAL?1"T-".N)
QUIT
+10 SET X=OCXVAL
SET %DT="T"
DO ^%DT
if (Y>0)
SET OCXVAL=+Y
End DoDot:1
+11 ;
+12 QUIT $$QT(OCXVAL)
+13 ;
QT(X) ;
+1 IF ($EXTRACT(X,1)="""")
QUIT X
+2 IF (+X=X)
QUIT X
+3 SET X=""""_X_""""
+4 QUIT X
+5 ;
INT2DT(OCXDT) ; This Local Extrinsic Function converts an OCX internal format
+1 ; date into an Externl Format (Human Readable) date.
+2 ;
+3 if '$LENGTH($GET(OCXDT))
QUIT ""
+4 NEW OCXYR,OCXLPYR,OCXMON,OCXDAY,OCXHR,OCXMIN,OCXSEC
+5 SET (OCXYR,OCXLPYR,OCXMON,OCXDAY,OCXHR,OCXMIN,OCXSEC,OCXAP)=""
+6 SET OCXSEC=$EXTRACT(OCXDT#60+100,2,3)
SET OCXDT=OCXDT\60
+7 SET OCXMIN=$EXTRACT(OCXDT#60+100,2,3)
SET OCXDT=OCXDT\60
+8 SET OCXHR=$EXTRACT(OCXDT#24+100,2,3)
SET OCXDT=OCXDT\24
+9 SET OCXYR=(OCXDT\1461)*4+1841
SET OCXDT=OCXDT#1461
+10 SET OCXLPYR=(OCXDT\365)
SET OCXDT=OCXDT-(OCXLPYR*365)
SET OCXYR=OCXYR+OCXLPYR
+11 SET OCXCNT="031^059^090^120^151^181^212^243^273^304^334^365"
+12 if (OCXLPYR=3)
SET OCXCNT="031^060^091^121^152^182^213^244^274^305^335^366"
+13 FOR OCXMON=1:1:12
if (OCXDT<$PIECE(OCXCNT,U,OCXMON))
QUIT
+14 SET OCXDAY=OCXDT-$PIECE(OCXCNT,U,OCXMON-1)+1
+15 SET OCXMON=$PIECE("January^February^March^April^May^June^July^August^September^October^November^December",U,OCXMON)
+16 SET OCXAP=$SELECT('OCXHR:"Midnight",(OCXHR=12):"Noon",(OCXHR<12):"AM",1:"PM")
+17 SET OCXHR=OCXHR#12
if 'OCXHR
SET OCXHR=12
+18 if (OCXHR+OCXMIN+OCXSEC)
QUIT OCXMON_" "_OCXDAY_","_OCXYR_" at "_OCXHR_":"_OCXMIN_"."_OCXSEC_" "_OCXAP
+19 QUIT OCXMON_" "_OCXDAY_","_OCXYR
+20 ;