This package formats a HTML document and emails it out to the appropriate docks.   


This is considered to be a critical notification used by the docks.   It uses the so_dtl_aud table to find the notifications to send out:


select
so_dtl_aud_id
,h.so_hdr_key
,so_dtl_key
,in_prod_key
,in_prod_desc
,so_dtl_shpws
,so_dtl_shpws_o
,so_dtl_ordqt
,so_dtl_ordqt_o
,so_dtl_shsdt
,so_dtl_shsdt_o
,en_carr_desc
,(case when so_dtl_stats = 'CN' or so_dtl_stats = 'CL' then 'Canceled'
when so_dtl_shpws_o is null then 'Added' else 'Changed' end) as lineStatus
,en_ship_name
,im_adres_line1
,im_adres_line2
,im_adres_city
,im_adres_state
,im_adres_pczip
, getdate() as datetopost from so_dtl_aud with (NOLOCK)
join en_prod_tbl with (NOLOCK) on en_prod_key = in_prod_key
join so_hdr_tbl h with (NOLOCK) on so_dtl_aud.so_hdr_key = h.so_hdr_key
left outer join en_ship_address v with (NOLOCK) on v.en_ship_key = h.ar_ship_key

left outer join en_carr_tbl r with (NOLOCK) on r.en_carr_key = h.en_carr_key
where (so_dtl_sent <> 'Y' or so_dtl_sent is Null)
and (so_dtl_shpws_o is NULL or
(so_dtl_ordqt <> so_dtl_ordqt_o or
so_dtl_shpws <> so_dtl_shpws_o or
so_dtl_shsdt <> so_dtl_shsdt_o)
or (so_dtl_stats = 'CN' or so_dtl_stats = 'CL'))
and en_prod_shipf = 1

order by so_dtl_shpws, so_dtl_aud.so_hdr_key, so_dtl_aud.so_dtl_key


It has been in place a number of years without incident so it is best viewed as "hardened" code.


This is a handled completely on SQL server.  This is not a scheduled report.