3 <title>Packing List (Shipment)</title>
4 <name>PackingList-Shipment</name>
5 <description>Non-Hybrid version - driven only by shiphead_id parameter - Packing List showing the contents of a particular shipment - Shows RA# if SO is a replacement order for and RA</description>
6 <parameter default="324" active="true" listtype="static" type="string" name="shiphead_id">
7 <description></description>
17 <topmargin>25</topmargin>
18 <bottommargin>25</bottommargin>
19 <rightmargin>25</rightmargin>
20 <leftmargin>25</leftmargin>
23 <sql>SELECT shiphead_number, 'S/O #:' AS ordertype,
24 cohead_number AS ordernumber,
25 formatsobarcode(cohead_id) AS order_barcode,
26 COALESCE(shiphead_shipvia, cohead_shipvia) AS shipvia,
27 cohead_shiptophone AS shiptophone,
29 formatDate(cohead_orderdate) AS orderdate,
30 cohead_shipcomments AS shipcomments,
31 cohead_billtoname AS billtoname,
32 formataddr(cohead_billtoaddress1, cohead_billtoaddress2,
33 cohead_billtoaddress3,
34 (cohead_billtocity || ' ' || cohead_billtostate ||
35 ' ' || cohead_billtozipcode), cohead_billtocountry) AS billing_address,
36 cohead_shiptoname AS shiptoname,
37 formataddr(cohead_shiptoaddress1, cohead_shiptoaddress2,
38 cohead_shiptoaddress3,
39 (cohead_shiptocity || ' ' || cohead_shiptostate ||
40 ' ' || cohead_shiptozipcode), cohead_shiptocountry) AS shipping_address,
43 trim(cntct_first_name || ' ' || cntct_last_name) AS cust_contact,
44 cntct_phone AS cust_phone,
47 JOIN cohead ON (cohead_id=shiphead_order_id)
48 JOIN custinfo ON (cohead_cust_id=cust_id)
49 JOIN terms ON (cohead_terms_id=terms_id)
50 LEFT OUTER JOIN cntct ON (cust_cntct_id=cntct_id)
51 LEFT OUTER JOIN addr ON (cntct_addr_id=addr_id)
52 WHERE (shiphead_id=<? value("shiphead_id") ?>)
54 <? if exists("MultiWhs") ?>
56 SELECT shiphead_number, 'T/O #:' AS ordertype,
57 tohead_number AS ordernumber,
58 formattobarcode(tohead_id) AS order_barcode,
59 shiphead_shipvia AS shipvia,
60 tohead_destphone AS shiptophone,
61 TEXT(' ') AS cohead_custponumber,
62 formatDate(tohead_orderdate) AS orderdate,
63 tohead_shipcomments AS shipcomments,
64 tohead_srcname AS billtoname,
65 formataddr(tohead_srcaddress1, tohead_srcaddress2,
67 (tohead_srccity || ' ' || tohead_srcstate ||
68 ' ' || tohead_srcpostalcode), tohead_srccountry) AS billing_address,
69 tohead_destname AS shiptoname,
70 formataddr(tohead_destaddress1, tohead_destaddress2,
72 (tohead_destcity || ' ' || tohead_deststate ||
73 ' ' || tohead_destpostalcode), tohead_destcountry) AS shipping_address,
74 'Transfer Order' AS cust_number,
75 tohead_destcntct_name AS cust_contact,
76 tohead_destphone AS cust_phone,
79 WHERE ((tohead_id=shiphead_order_id)
80 AND (shiphead_order_type='TO')
81 AND (shiphead_id=<? value("shiphead_id") ?>)
86 <name>scheddate</name>
87 <sql>SELECT formatDate(MIN(coitem_scheddate)) AS scheddate
89 WHERE ((coitem_status <> 'X')
90 AND (coitem_id=shipitem_orderitem_id)
91 AND (shipitem_shiphead_id=<? value("shiphead_id") ?>));</sql>
95 <sql>SELECT 1 AS groupby,
96 coitem_linenumber AS sortline, coitem_subnumber AS sortsubline,
97 formatsolinenumber(coitem_id) AS linenumber,
99 CASE WHEN (coitem_custpn != '') THEN coitem_custpn
102 formatitemsitebarcode(itemsite_id) AS item_barcode,
103 formatsoitembarcode(coitem_id) AS orderitem_barcode,
104 -- In 2.3 replaced the next line:
107 (select uom_name from uom where uom_id = coitem_qty_uom_id) AS uom_name,
108 itemsellinguom(item_id) AS shipuom,
109 CASE WHEN (coitem_custpn != '' AND itemalias_usedescrip=TRUE) THEN itemalias_descrip1
111 END AS item_descrip1,
112 CASE WHEN (coitem_custpn != '' AND itemalias_usedescrip=TRUE) THEN itemalias_descrip2
114 END AS item_descrip2,
116 formatQty(coitem_qtyord) AS ordered,
117 (SELECT formatQty(SUM(shipitem_qty)) FROM shipitem WHERE ((shipitem_shiphead_id=<? value("shiphead_id") ?>) AND (shipitem_orderitem_id=coitem_id))) AS shipped,
119 CASE WHEN (coitem_status='O' AND (SELECT cust_creditstatus
121 WHERE coitem_cohead_id=cohead_id
122 AND (cust_id=cohead_cust_id))='H') THEN 'H'
123 WHEN (coitem_status='O' AND ((SELECT SUM(invcitem_billed)
124 FROM cohead, invchead, invcitem
125 WHERE ((invchead_ordernumber=cohead_number)
126 AND (invcitem_invchead_id=invchead_id)
127 AND (invcitem_item_id=item_id)
128 AND (invcitem_warehous_id=itemsite_warehous_id)
129 AND (invcitem_linenumber=coitem_linenumber)
130 AND (cohead_id=coitem_cohead_id))) >= coitem_qtyord)) THEN 'I'
131 WHEN (coitem_status='O' AND ((SELECT SUM(invcitem_billed)
132 FROM cohead, invchead, invcitem
133 WHERE ((invchead_ordernumber=cohead_number)
134 AND (invcitem_invchead_id=invchead_id)
135 AND (invcitem_item_id=item_id)
136 AND (invcitem_warehous_id=itemsite_warehous_id)
137 AND (invcitem_linenumber=coitem_linenumber)
138 AND (cohead_id=coitem_cohead_id))) > 0)) THEN 'P'
139 WHEN (coitem_status='O' AND (qtyNetable(itemsite_id) - qtyAllocated(itemsite_id, CURRENT_DATE)
140 + qtyOrdered(itemsite_id, CURRENT_DATE))
141 >= (coitem_qtyord - coitem_qtyshipped + coitem_qtyreturned)) THEN 'R'
145 WHEN (getPacklistItemLotSerial(shipitem_shiphead_id, coitem_id) = '') THEN
148 'Serial #/Lot Information:'
149 END AS lotserial_title,
150 getPacklistItemLotSerial(shipitem_shiphead_id, coitem_id) AS lotserial,
152 WHEN (getPacklistCharName(shipitem_shiphead_id, coitem_id) = '') THEN
157 getPacklistCharName(shipitem_shiphead_id, coitem_id) AS char_name,
158 getPacklistCharValue(shipitem_shiphead_id, coitem_id) AS char_value
160 JOIN coitem ON (coitem_id=shipitem_orderitem_id)
161 JOIN itemsite ON (itemsite_id=coitem_itemsite_id)
162 JOIN item ON (item_id=itemsite_item_id)
163 JOIN uom ON (uom_id=item_inv_uom_id)
164 LEFT OUTER JOIN itemalias ON (itemalias_item_id=item_id AND itemalias_number=coitem_custpn)
165 WHERE ( (coitem_status <> 'X')
166 AND (shipitem_shiphead_id=<? value("shiphead_id") ?>)
168 <? if exists("MultiWhs") ?>
171 toitem_linenumber AS sortline, 0 AS sortsubline,
172 CAST(toitem_linenumber AS text) AS linenumber,
173 toitem_notes AS memo,
175 formatitemsitebarcode(itemsite_id) AS item_barcode,
176 formattoitembarcode(toitem_id) AS orderitem_barcode,
178 itemsellinguom(item_id) AS shipuom,
182 formatQty(toitem_qty_ordered) AS ordered,
184 (SELECT formatQty(SUM(shipitem_qty))
186 WHERE ((shipitem_shiphead_id=<? value("shiphead_id") ?>)
187 AND (shipitem_orderitem_id=toitem_id))
190 toitem_status AS f_status,
192 WHEN (getPacklistItemLotSerial(shiphead_id, toitem_id) = '') THEN
195 'Serial #/Lot Information:'
196 END AS lotserial_title,
197 getPacklistItemLotSerial(shiphead_id, toitem_id) AS lotserial,
201 FROM itemsite, item, toitem, tohead, shipitem, shiphead, uom
202 WHERE ((toitem_item_id=item_id)
203 AND (item_inv_uom_id=uom_id)
204 AND (item_id=itemsite_item_id)
205 AND (toitem_tohead_id=tohead_id)
206 AND (toitem_status <> 'X')
207 AND (tohead_src_warehous_id=itemsite_warehous_id)
208 AND (toitem_id=shipitem_orderitem_id)
209 AND (shipitem_shiphead_id=shiphead_id)
210 AND (shiphead_order_type='TO')
211 AND (shiphead_id=<? value("shiphead_id") ?>)
214 ORDER BY sortline, sortsubline;</sql>
218 <sql>SELECT image_data
220 WHERE ((image_name='logo'));</sql>
223 <name>so_ra_relation</name>
224 <sql>--added in 2.3 to show RA link to S/O if the SO
225 --was created as the result of a replacement RA
226 <? if exists("EnableReturnAuth") ?>
231 rahead, cohead, shiphead
233 rahead_new_cohead_id = cohead_id
234 and cohead_id = shiphead_order_id
235 and shiphead_id = <? value("shiphead_id") ?>;
254 <column>image_data</column>
267 <weight>normal</weight>
273 <column>ordernumber</column>
286 <weight>bold</weight>
290 <string>Shipment Packing List</string>
302 <weight>bold</weight>
306 <string>Item Description</string>
318 <weight>normal</weight>
322 <string>Shipment #:</string>
334 <weight>bold</weight>
338 <string>Verified</string>
350 <weight>normal</weight>
356 <column>cust_number</column>
366 <format>3of9</format>
367 <maxlength>20</maxlength>
369 <narrowBarWidth>0.01</narrowBarWidth>
372 <column>cohead_custponumber</column>
385 <weight>normal</weight>
389 <string>Terms:</string>
401 <weight>normal</weight>
407 <column>shiptoname</column>
427 <weight>normal</weight>
431 <string>Customer P/O #:</string>
443 <weight>normal</weight>
447 <string>Sched. Date:</string>
459 <weight>normal</weight>
463 <string>Order Date:</string>
475 <weight>normal</weight>
479 <string>Attention:</string>
488 <format>3of9</format>
489 <maxlength>10</maxlength>
491 <narrowBarWidth>0.01</narrowBarWidth>
494 <column>cust_number</column>
507 <weight>normal</weight>
513 <column>shiphead_number</column>
526 <weight>normal</weight>
531 <query>so_ra_relation</query>
532 <column>ratext</column>
545 <weight>normal</weight>
551 <column>ordertype</column>
564 <weight>bold</weight>
577 <bottompad>10</bottompad>
581 <weight>normal</weight>
587 <column>shipping_address</column>
600 <weight>normal</weight>
604 <string>Bill To:</string>
616 <weight>normal</weight>
622 <column>shipvia</column>
635 <weight>normal</weight>
641 <column>terms_descrip</column>
654 <weight>normal</weight>
660 <column>orderdate</column>
673 <weight>normal</weight>
679 <column>cohead_custponumber</column>
699 <weight>normal</weight>
703 <string>Ship Via:</string>
715 <weight>bold</weight>
719 <string>Order Line</string>
731 <weight>bold</weight>
735 <string>Ordered</string>
745 <maxlength>10</maxlength>
747 <narrowBarWidth>0.01</narrowBarWidth>
750 <column>order_barcode</column>
763 <weight>normal</weight>
769 <column>billtoname</column>
782 <weight>normal</weight>
787 <query>scheddate</query>
788 <column>scheddate</column>
801 <weight>bold</weight>
805 <string>Shipped</string>
817 <weight>bold</weight>
821 <string>Item Number</string>
833 <weight>normal</weight>
838 <query>so_ra_relation</query>
839 <column>rahead_number</column>
852 <weight>normal</weight>
856 <string>Ship To:</string>
868 <weight>normal</weight>
874 <column>cust_contact</column>
884 <bottompad>10</bottompad>
888 <weight>normal</weight>
894 <column>billing_address</column>
907 <weight>normal</weight>
911 <string>Customer #:</string>
917 <name>characteristic</name>
918 <column>linenumber</column>
928 <bottompad>14</bottompad>
932 <weight>normal</weight>
937 <query>detail</query>
938 <column>char_name</column>
948 <bottompad>14</bottompad>
952 <weight>normal</weight>
957 <query>detail</query>
958 <column>char_title</column>
968 <bottompad>14</bottompad>
972 <weight>normal</weight>
977 <query>detail</query>
978 <column>char_value</column>
984 <name>lotserial</name>
985 <column>linenumber</column>
995 <bottompad>14</bottompad>
999 <weight>normal</weight>
1004 <query>detail</query>
1005 <column>lotserial_title</column>
1015 <bottompad>14</bottompad>
1019 <weight>normal</weight>
1024 <query>detail</query>
1025 <column>lotserial</column>
1032 <column>linenumber</column>
1045 <weight>normal</weight>
1049 <string>Status:</string>
1061 <weight>normal</weight>
1066 <query>detail</query>
1067 <column>shipped</column>
1077 <bottompad>14</bottompad>
1081 <weight>normal</weight>
1086 <query>detail</query>
1087 <column>memo</column>
1100 <weight>bold</weight>
1105 <query>detail</query>
1106 <column>item_number</column>
1110 <xstart>545</xstart>
1126 <weight>normal</weight>
1131 <query>detail</query>
1132 <column>uom_name</column>
1145 <weight>normal</weight>
1150 <query>detail</query>
1151 <column>ordered</column>
1164 <weight>normal</weight>
1169 <query>detail</query>
1170 <column>item_descrip2</column>
1183 <weight>normal</weight>
1188 <query>detail</query>
1189 <column>f_status</column>
1199 <format>128</format>
1200 <maxlength>15</maxlength>
1202 <narrowBarWidth>0.01</narrowBarWidth>
1204 <query>detail</query>
1205 <column>item_barcode</column>
1218 <weight>normal</weight>
1223 <query>detail</query>
1224 <column>item_descrip1</column>
1237 <weight>bold</weight>
1242 <query>detail</query>
1243 <column>linenumber</column>
1256 <weight>normal</weight>
1260 <string>Notes:</string>
1266 <query>detail</query>
1272 <name>packlist</name>
1285 <bottompad>14</bottompad>
1289 <weight>normal</weight>
1295 <column>shipcomments</column>
1319 <weight>normal</weight>
1325 <column>ordernumber</column>
1338 <weight>normal</weight>
1342 <string>Page:</string>
1354 <weight>normal</weight>
1358 <string>Print Date: </string>
1370 <weight>normal</weight>
1375 <query>Context Query</query>
1376 <column>page_number</column>
1389 <weight>normal</weight>
1394 <query>Context Query</query>
1395 <column>report_date</column>
1408 <weight>normal</weight>
1414 <column>ordertype</column>
1430 <weight>bold</weight>
1434 <string>Completed By:</string>
1437 <xstart>540</xstart>
1453 <weight>bold</weight>
1457 <string>Checked By:</string>
1460 <xstart>160</xstart>