<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://in.compucrete.com/index.php?action=history&amp;feed=atom&amp;title=Query%2FExport_Dispatch_Reports</id>
	<title>Query/Export Dispatch Reports - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://in.compucrete.com/index.php?action=history&amp;feed=atom&amp;title=Query%2FExport_Dispatch_Reports"/>
	<link rel="alternate" type="text/html" href="http://in.compucrete.com/index.php?title=Query/Export_Dispatch_Reports&amp;action=history"/>
	<updated>2026-05-15T17:01:43Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>http://in.compucrete.com/index.php?title=Query/Export_Dispatch_Reports&amp;diff=522&amp;oldid=prev</id>
		<title>WikiAdmin: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="http://in.compucrete.com/index.php?title=Query/Export_Dispatch_Reports&amp;diff=522&amp;oldid=prev"/>
		<updated>2023-07-14T13:00:35Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 13:00, 14 July 2023&lt;/td&gt;
				&lt;/tr&gt;
&lt;!-- diff cache key my_wiki:diff::1.12:old-521:rev-522 --&gt;
&lt;/table&gt;</summary>
		<author><name>WikiAdmin</name></author>
	</entry>
	<entry>
		<id>http://in.compucrete.com/index.php?title=Query/Export_Dispatch_Reports&amp;diff=521&amp;oldid=prev</id>
		<title>Intra&gt;Chanson: /* Dispatch Times Super Mega Query */</title>
		<link rel="alternate" type="text/html" href="http://in.compucrete.com/index.php?title=Query/Export_Dispatch_Reports&amp;diff=521&amp;oldid=prev"/>
		<updated>2020-02-25T15:28:19Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Dispatch Times Super Mega Query&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Dispatch Time Analysis  (03/30/17)&lt;br /&gt;
&lt;br /&gt;
===Dispatch Times Super Mega Query===&lt;br /&gt;
This beast gives you most every time calculation you would want from Plant, Office and Sale ticket history.  Along with some basic ticket header info you get:&lt;br /&gt;
*Actual Times for each status event&lt;br /&gt;
*Target Times for each status event&lt;br /&gt;
*Minutes in Each status&lt;br /&gt;
*Minutes Late for Each Status Event (Negative = Early)&lt;br /&gt;
*Minutes over for each status (Negative = Under)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
plant_no,ticket_no, cust_no,job_po_loc, zone, dr.driver_name,truck_no, &lt;br /&gt;
batch_start_dt, batch_end_dt, leave_plant_dt, arrive_job_dt, begin_pour_dt, end_pour_dt, leave_job_dt, return_plant_dt,&lt;br /&gt;
tgt_batch_start_dt, tgt_batch_end_dt, tgt_leave_plant_dt, tgt_arrive_job_dt, tgt_begin_pour_dt, tgt_end_pour_dt, tgt_leave_job_dt, tgt_return_plant_dt,&lt;br /&gt;
&lt;br /&gt;
floor(1440*(batch_end_DT-cast(ticket_Date as timestamp )-cast (  (60*(ticket_time/100)+ticket_time-100* &lt;br /&gt;
    (ticket_time/100))  as numeric (11,6) ) /1440) ) &amp;quot;TICKET_TO_BATCH_MIN&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
floor(.5 + 1440*(batch_end_dt-batch_start_dt)) &amp;quot;BATCH_MIN&amp;quot;,&lt;br /&gt;
floor(.5 + 1440*(leave_plant_dt-batch_end_dt)) &amp;quot;PLANT_WASH_MIN&amp;quot;,&lt;br /&gt;
floor(.5 + 1440*(arrive_job_dt-leave_plant_dt)) &amp;quot;TO_JOB_MIN&amp;quot;,&lt;br /&gt;
floor(.5 + 1440*(begin_pour_dt-arrive_job_dt)) &amp;quot;JOB_WAIT_MIN&amp;quot;,&lt;br /&gt;
floor(.5 + 1440*(end_pour_dt-begin_pour_dt)) &amp;quot;POUR_MIN&amp;quot;,&lt;br /&gt;
floor(.5 + 1440*(leave_job_dt-end_pour_dt))  &amp;quot;JOB_WASH_MIN&amp;quot;,&lt;br /&gt;
floor(.5 + 1440*(return_plant_dt-leave_job_dt)) &amp;quot;TO_PLANT_MIN&amp;quot;,&lt;br /&gt;
floor(1440*(return_plant_DT-cast(ticket_Date as timestamp )-cast (  (60*(ticket_time/100)+ticket_time-100* &lt;br /&gt;
    (ticket_time/100))  as numeric (11,6) ) /1440 ) )  RTT,&lt;br /&gt;
&lt;br /&gt;
floor(.5 + 1440*(batch_start_dt-tgt_batch_start_dt)) BATCH_START_LATE,&lt;br /&gt;
floor(.5 + 1440*(batch_end_dt-tgt_batch_end_dt)) BATCH_END_LATE,&lt;br /&gt;
floor(.5 + 1440*(leave_plant_dt-tgt_leave_plant_dt)) LEAVE_PLANT_LATE,&lt;br /&gt;
floor(.5 + 1440*(arrive_job_dt-tgt_arrive_job_dt)) ARRIVE_JOB_LATE,&lt;br /&gt;
floor(.5 + 1440*(begin_pour_dt-tgt_begin_pour_dt)) BEGIN_POUR_LATE,&lt;br /&gt;
floor(.5 + 1440*(end_pour_dt-tgt_end_pour_dt)) END_POUR_LATE,&lt;br /&gt;
floor(.5 + 1440*(leave_job_dt-tgt_leave_job_dt)) LEAVE_JOB_LATE,&lt;br /&gt;
floor(.5 + 1440*(return_plant_dt-tgt_return_plant_dt)) RETURN_PLANT_LATE,&lt;br /&gt;
&lt;br /&gt;
floor(.5 + 1440*((batch_end_dt-batch_start_dt)-(tgt_batch_end_dt-tgt_batch_start_dt))) &amp;quot;BATCH_OVR&amp;quot;,&lt;br /&gt;
floor(.5 + 1440*((leave_plant_dt-batch_end_dt)- (tgt_leave_plant_dt-tgt_batch_end_dt))) &amp;quot;PLANT_WASH_OVR&amp;quot;,&lt;br /&gt;
floor(.5 + 1440*((arrive_job_dt-leave_plant_dt)-(tgt_arrive_job_dt-tgt_leave_plant_dt))) &amp;quot;TO_JOB_OVR&amp;quot;,&lt;br /&gt;
floor(.5 + 1440*((begin_pour_dt-arrive_job_dt)-(tgt_begin_pour_dt-tgt_arrive_job_dt))) &amp;quot;JOB_WAIT_OVR&amp;quot;,&lt;br /&gt;
floor(.5 + 1440*((end_pour_dt-begin_pour_dt)-(tgt_end_pour_dt-tgt_begin_pour_dt))) &amp;quot;POUR_OVR&amp;quot;,&lt;br /&gt;
floor(.5 + 1440*((leave_job_dt-end_pour_dt)-(tgt_leave_job_dt-tgt_end_pour_dt)))  &amp;quot;JOB_WASH_OVR&amp;quot;,&lt;br /&gt;
floor(.5 + 1440*((return_plant_dt-leave_job_dt)-(tgt_return_plant_dt-tgt_leave_job_dt))) &amp;quot;TO_PLANT_OVR&amp;quot;,&lt;br /&gt;
order_load_no &amp;quot;LD_NO&amp;quot;,&lt;br /&gt;
extract (hour from batch_start_dt) &amp;quot;BAT_STRT_HR&amp;quot;,&lt;br /&gt;
QTY_SOLD,th.elapsed_time,&lt;br /&gt;
TICKET_DATE ,TICKET_TIME,order_code&lt;br /&gt;
FROM DIP_TICKETHISTORY &lt;br /&gt;
('Y','Y','Y','Y',:BEG_DATE,:END_DATE,null,null,NULL,NULL,NULL,NULL,null,null) th&lt;br /&gt;
left outer join artdriv dr on dr.driver_code = th.driver&lt;br /&gt;
order by plant_no,ticket_no&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(Corrected OVR fields on 02/25/20)&lt;br /&gt;
&lt;br /&gt;
If you need to ID first loads you can add this to your field list...&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
,&lt;br /&gt;
(SELECT &lt;br /&gt;
'*' FROM DIP_TICKETHISTORY &lt;br /&gt;
('Y','Y','Y','Y',TH.TICKET_DATE,TH.TICKET_DATE,TH.CUST_NO,TH.CUST_NO,NULL,NULL,NULL,NULL,TH.PLANT_NO,TH.PLANT_NO) thX&lt;br /&gt;
WHERE THX.ORDER_CODE=TH.ORDER_CODE&lt;br /&gt;
having min(order_load_no)=th.order_load_no) &amp;quot;Firsty&amp;quot;&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
DIP_TICKETHISTORY Parameters:&lt;br /&gt;
*'''INC_CUR_TIX''' Plant tickets&lt;br /&gt;
*'''INC_EXP_TIX''' Exported Plant tickets&lt;br /&gt;
*'''INC_OFF_TIX''' Office tickets&lt;br /&gt;
*'''INC_INV_TIX''' Sales&lt;br /&gt;
*'''LODATE''' Ticket Date Begin&lt;br /&gt;
*'''HIDATE''' Ticket Date End&lt;br /&gt;
*'''LOCUST''' Begin Customer&lt;br /&gt;
*'''HICUST''' End Customer&lt;br /&gt;
*'''LOCCLS''' Low Cust Class&lt;br /&gt;
*'''HICCLS''' High Cust Class&lt;br /&gt;
*'''LOPCLS''' Low Product Class&lt;br /&gt;
*'''HIPCLS''' Hight Product Class&lt;br /&gt;
*'''LOPLANT''' Begin Plant&lt;br /&gt;
*'''HIPLANT''' End Plant&lt;br /&gt;
&lt;br /&gt;
Use these parameters and not a where clause whenever possible.   This is much more efficient.  (e.g. if you put a where clause for plant rather than use the parameter, the procedure will first process data for all plants and then filter out all the unselected plants).&lt;br /&gt;
&lt;br /&gt;
===Dispatch Ticket Yardage Report===&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
select h.cust_no,h.job_po_loc,h.tax_authority,h.ticket_date,h.ticket_no,h.plant_no,h.product_code,h.description,h.qty_sold,h.tax_code,&lt;br /&gt;
     h.void_flag,source_table STATUS  from &lt;br /&gt;
DIP_TICKETHISTORY ('Y','Y','Y','Y',:BEG_DATE,:END_DATE,'','z',NULL,NULL,NULL,NULL,:&amp;quot;Begin Plant&amp;quot;,:&amp;quot;End Plant&amp;quot;) h&lt;br /&gt;
  where ticket_date between :beg_date and :end_date AND LINE_NO=1 and void_flag='N'&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Old Style&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
select h.cust_no,h.job_po_loc,h.tax_authority,h.ticket_date,h.ticket_no,h.plant_no,d.product_code,d.description,d.qty_sold,d.tax_code,&lt;br /&gt;
     h.void_flag,h.closed_flag,'D' STATUS from artptkhd h&lt;br /&gt;
  inner join artptkdt d on  d.session_no=h.session_no and d.trans_no=h.trans_no  &lt;br /&gt;
  where ticket_date between :beg_date and :end_date AND D.LINE_NO=1 AND PLANT_NO BETWEEN :Beg_Plant and :End_Plant and void_flag='N'Union&lt;br /&gt;
select h.cust_no,h.job_po_loc,h.tax_authority,h.ticket_date,h.ticket_no,h.plant_no,d.product_code,d.description,d.qty_sold,d.tax_code,h.void_flag,'N','T' STATUS&lt;br /&gt;
 from arttckhd h&lt;br /&gt;
inner join arttckdt d on  d.session_no=h.session_no and d.trans_no=h.trans_no&lt;br /&gt;
where ticket_date between :beg_date and :end_date AND D.LINE_NO=1 AND PLANT_NO BETWEEN :Beg_Plant and :End_Plant and void_flag='N' UNION&lt;br /&gt;
select h.cust_no,h.job_po_loc,h.tax_authority,h.ticket_date,h.ticket_no,h.plant_no,d.product_code,d.description,d.qty_sold,d.tax_code,h.void_flag,'N','S' STATUS&lt;br /&gt;
 from artSLShd h&lt;br /&gt;
inner join artSLSdt d on  d.session_no=h.session_no and d.trans_no=h.trans_no&lt;br /&gt;
where ticket_date between :beg_date and :end_date AND D.LINE_NO=1 AND PLANT_NO BETWEEN :Beg_Plant and :End_Plant and void_flag='N'&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Ticket Detail Report===&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
select h.cust_no,h.job_po_loc,h.tax_authority,h.ticket_date,h.ticket_no,h.plant_no,h.product_code,h.description,h.qty_sold,h.tax_code,h.void_flag,h.source_table STATUS  from &lt;br /&gt;
DIP_TICKETHISTORY ('Y','Y','Y','Y',:BEG_DATE,:END_DATE,'','z',NULL,NULL,NULL,NULL,:&amp;quot;Begin Plant&amp;quot;,:&amp;quot;End Plant&amp;quot;) h&lt;br /&gt;
  where ticket_date between :beg_date and :end_date AND LINE_NO=1 and void_flag='N'&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Old Style:&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
select h.cust_no,h.job_po_loc,h.tax_authority,h.ticket_date,h.ticket_no,h.plant_no,d.product_code,d.description,d.qty_sold,d.tax_code,h.void_flag,h.closed_flag,'D' STATUS from artptkhd h&lt;br /&gt;
inner join artptkdt d on  d.session_no=h.session_no and d.trans_no=h.trans_no&lt;br /&gt;
where ticket_date between :beg_date and :end_date&lt;br /&gt;
Union&lt;br /&gt;
select h.cust_no,h.job_po_loc,h.tax_authority,h.ticket_date,h.ticket_no,h.plant_no,d.product_code,d.description,d.qty_sold,d.tax_code,h.void_flag,'N','T' STATUS&lt;br /&gt;
 from arttckhd h&lt;br /&gt;
inner join arttckdt d on  d.session_no=h.session_no and d.trans_no=h.trans_no&lt;br /&gt;
where ticket_date between :beg_date and :end_date&lt;br /&gt;
 UNION&lt;br /&gt;
select h.cust_no,h.job_po_loc,h.tax_authority,h.ticket_date,h.ticket_no,h.plant_no,d.product_code,d.description,d.qty_sold,d.tax_code,h.void_flag,'N','S' STATUS&lt;br /&gt;
 from artSLShd h&lt;br /&gt;
inner join artSLSdt d on  d.session_no=h.session_no and d.trans_no=h.trans_no&lt;br /&gt;
where ticket_date between :beg_date and :end_date&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tickets by Order Code&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
select h.cust_no,h.job_po_loc,h.tax_authority,h.ticket_date,h.ticket_no,h.plant_no,d.product_code,d.description,d.qty_sold,d.tax_code,h.void_flag,h.closed_flag,'D' STATUS from artptkhd h&lt;br /&gt;
inner join artptkdt d on  d.session_no=h.session_no and d.trans_no=h.trans_no&lt;br /&gt;
where h.order_code=:order_code&lt;br /&gt;
Union&lt;br /&gt;
select h.cust_no,h.job_po_loc,h.tax_authority,h.ticket_date,h.ticket_no,h.plant_no,d.product_code,d.description,d.qty_sold,d.tax_code,h.void_flag,'N','T' STATUS&lt;br /&gt;
 from arttckhd h&lt;br /&gt;
inner join arttckdt d on  d.session_no=h.session_no and d.trans_no=h.trans_no&lt;br /&gt;
where h.order_code=:order_code&lt;br /&gt;
 UNION&lt;br /&gt;
select h.cust_no,h.job_po_loc,h.tax_authority,h.ticket_date,h.ticket_no,h.plant_no,d.product_code,d.description,d.qty_sold,d.tax_code,h.void_flag,'N','S' STATUS&lt;br /&gt;
 from artSLShd h&lt;br /&gt;
inner join artSLSdt d on  d.session_no=h.session_no and d.trans_no=h.trans_no&lt;br /&gt;
where h.order_code=:order_code&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&amp;lt;/DIV&amp;gt;&lt;/div&gt;</summary>
		<author><name>Intra&gt;Chanson</name></author>
	</entry>
</feed>