/* Tool: TMS_Cloud_transaction_report Purpose: Counting transactions for cloud customers Ticket Date(dmy) BY Reason PSCLD-7 08/12/2017 XID new tool PSCLD-111 04/04/2019 XID enhance tool to produce Compliance statistics 08/04/2019 XID add information on compliance totals at the top PSCLD-139 24/07/2019 XID portal */ &if "{1}" = "define" &then define new global shared temp-table tt-trans-TE no-undo field tt-client as char field tt-year as int field tt-month as int field tt-SHSHPC as char /* Carrier */ field tt-shrout as char /* Route */ field tt-shcds1 as char /* country of despatch */ field tt-shcdt1 as char /* country of destination */ field tt-count as int index idx1 tt-client tt-year tt-month tt-SHSHPC tt-shrout tt-shcds1 tt-shcdt1 index idx2 tt-year tt-month tt-SHSHPC index idx3 tt-shshpc tt-year tt-month index idx4 tt-SHSHPC. define new global shared temp-table tt-trans-GTM-int like tt-trans-TE. define new global shared temp-table tt-trans-GTM-dom like tt-trans-TE. define new global shared temp-table tt-trans-PEM no-undo field tt-client as char field tt-year as int field tt-month as INT field tt-count as INT index idx1 tt-year TT-MONTH index idx2 tt-client tt-year tt-month. define new global shared temp-table tt-compliance no-undo field tt-client as char field tt-year as int field tt-month as int field tt-count-compliance as int index idx1 tt-client tt-year tt-month index idx2 tt-year tt-month. define new global shared temp-table tt-json no-undo field tt-heading as char field tt-TE as int field tt-GTM-int as int field tt-GTM-dom as int field tt-PEM as int field tt-compliance as int field tt-year as int field tt-month as int index idx1 tt-year tt-month. def new global shared var wv-version as char no-undo initial "2.0_2019.07.24". def new global shared var wv-log-file as char no-undo. def new global shared var wv-start-date as date label "Start date" no-undo. def new global shared var wv-end-date as date label "End date" no-undo. def new global shared var wv-report-log-by as int initial 1000 no-undo. /* report in the log to see report activity */ def new global shared var wv-db as char no-undo. def new global shared var wv-add-server as char no-undo. def new global shared var wv-add-port as char no-undo. function func_get_month returns char (input pi-month as int) forward. function func_get_route returns char (input pi-route as char) forward. function func_get_route returns char (input pi-route as char) forward. function func_get_country returns char (input pi-ctry as char) forward. function func_get_client_info return char (input pi-client as char) forward. &else /* procedures */ procedure proc_write_stream_log. define input parameter pi-string as char no-undo. def var wv-string as char no-undo. if pi-string = ? then wv-string = "Null string!!!". else wv-string = pi-string. wv-string = string(DATETIME-TZ(TODAY, MTIME, TIMEZONE)) + " :" + wv-string. put unformatted wv-string skip. end procedure. /* proc_close_stream_log */ function func_get_month returns char (input pi-month as int): case pi-month: when 1 then return "January". when 2 then return "February". when 3 then return "March". when 4 then return "April". when 5 then return "May". when 6 then return "June". when 7 then return "July". when 8 then return "August". when 9 then return "September". when 10 then return "October". when 11 then return "November". when 12 then return "December". end case. end function. /* func_get_month */ procedure proc_update_json. define input parameter pi-heading as char no-undo. define input parameter pi-year as int no-undo. define input parameter pi-month as int no-undo. define input parameter pi-TE as int no-undo. define input parameter pi-GTM-int as int no-undo. define input parameter pi-GTM-dom as int no-undo. define input parameter pi-PEM as int no-undo. define input parameter pi-compliance as int no-undo. find first tt-json where tt-json.tt-year = pi-year and tt-json.tt-month = pi-month no-lock no-error. if not available tt-json then do: create tt-json. assign tt-json.tt-heading = pi-heading tt-json.tt-year = pi-year tt-json.tt-month = pi-month. end. else find current tt-json exclusive-lock no-wait no-error. if available tt-json then do: if pi-TE > 0 then tt-json.tt-TE = pi-TE. if pi-GTM-int > 0 then tt-json.tt-GTM-int = pi-GTM-int. if pi-GTM-dom > 0 then tt-json.tt-GTM-dom = pi-GTM-dom. if pi-PEM > 0 then tt-json.tt-PEM = pi-PEM. if pi-compliance > 0 then tt-json.tt-compliance = pi-compliance. release tt-json. end. end procedure. /* proc_update_json */ procedure proc_set_date_range. def var wv-month as int no-undo. def var wv-year as int no-undo. wv-year = year(today). wv-month = month(today). wv-end-date = date(wv-month,1,wv-year) - 1. wv-start-date = date(wv-month,1,wv-year - 1). end procedure. /* proc_set_date */ &endif