forked from troyshelton/CCL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OrderCountQuery.prg
121 lines (98 loc) · 3.79 KB
/
OrderCountQuery.prg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/****************************************************************************************************
Author: Larry Canton
Date Written: 8/5/2015
Source File Name: pha_oacnt
Object Name: <Name in CCLQUERY>
Request #: <Optional>
Product: <Product report addresses>
Product Team: Busted Knuckle Code Garage
HNA Version: 500
CCL Version: 2008.05.1.36
Program Purpose: Count and Display Orders Placed
Tables Read: PHA_ORD_ACT_OBS_ST OBS
Tables Updated: NONE
Executing From: DVDEV, EXPLORER MENU
Special Notes: ORIGINAL SOURCE CODE FROM LARRY CANTON, MH PHARMACY IT MANAGER
****************************************************************************************************
****************************************************************************************************
*********************************** MODIFICATION CONTROL LOG ***********************************
****************************************************************************************************
Mod Date Engineer Comment
----------------------------------------------------------------------------------------------------
001 8/5/2015 Lewis Schmidt Review and update, upload to GITHUB
000 8/4/2015 Larry Canton Initial Release
****************************************************************************************************/
drop program pha_rpt_mthtn_drc_oacnt go
create program pha_rpt_mthtn_drc_oacnt
prompt
"Output to File/Printer/MINE" = "MINE" ;* Enter or select the printer or file name to send this report to.
, "Start Date" = "SYSDATE"
, "End Date" = "SYSDATE"
with OUTDEV, SDATE, EDATE
/**************************************************************
; DVDev DECLARED SUBROUTINES
**************************************************************/
/**************************************************************
; DVDev DECLARED VARIABLES
**************************************************************/
declare TCNT = i4 with NoConstant(0),Protect
declare ACNT = i4 with NoConstant(0),Protect
declare PCNT = i4 with NoConstant(0),Protect
declare EDATENUM = i4 with NoConstant(CNVTDATE(CNVTDATETIME($EDATE))),Protect
declare SDATENUM = i4 with NoConstant(CNVTDATE(CNVTDATETIME($SDATE))),Protect
/**************************************************************
; DVDev Start Coding
**************************************************************/
SELECT INTO $OUTDEV
Date1 = format (OBS.ACTION_DT_NBR,"@SHORTDATE4YR"),
Adult = ACNT ,
Pediatric = PCNT ,
Total = TCNT
FROM
PHA_ORD_ACT_OBS_ST OBS
WHERE (OBS.ACTION_DT_TM >= CNVTDATETIME($SDATE))
AND (OBS.ACTION_DT_TM <= CNVTDATETIME($EDATE))
AND (OBS.ACTION_TYPE_CD IN (1166.00,1167.00))
AND (obs.ord_pers_fac_cd+0 IN (5268.00,5023.00,5270.00,5042.00,1686560449.00,718469992.00,5022.00,5026.00,23553239.00))
AND OBS.ORDER_ID+0 > 0.00
AND OBS.PHARM_TYPE_CD IN (0.00, VALUE(UAR_GET_CODE_BY('MEANING', 4500, 'INPATIENT')))
ORDER BY
OBS.ACTION_DT_NBR,
OBS.ORD_PERS_AGE_YEARS
HEAD PAGE
COL 00, "Date",
COL 15, "Adult",
COL 35, "Pediatric"
COL 55, "Total"
ROW + 1
COL 00, "==========",
COL 15, "==========",
COL 35, "==========",
COL 55, "=========="
HEAD OBS.ACTION_DT_NBR
ACNT = 0,
PCNT = 0,
TCNT = 0,
ROW + 1
DETAIL
IF (OBS.ORD_PERS_AGE_YEARS < 18)
PCNT = PCNT + 1
ELSE
ACNT = ACNT + 1
ENDIF
TCNT = TCNT + 1
FOOT OBS.ACTION_DT_NBR
COL 00, Date1,
COL 15, Adult,
COL 35, Pediatric,
COL 55, Total
FOOT REPORT
ROW + 3,
COL 00, "Total Count: ",
COL 15, CURQUAL
WITH FORMAT
/**************************************************************
; DVDev DEFINED SUBROUTINES
**************************************************************/
end
go