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

OCXOCMPA.m

Go to the documentation of this file.
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
 ;