﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	db_engine	os_version
2321	Updates to the SQL for order_wizard_get_packet_label	Pete Cyr	Gary Kinard	"In support of the AdCom barcodes/labels subcommittee please implement these three updates to the SQL for order_wizard_get_packet_label.  Below are suggestions for SQL that worked in prototype development (all line numbers are in reference to the SQL Server SQL code for order_wizard_get_packet_label currently in production on npgsWeb server):

1) To support proper collating of order items per order request line 5 should be changed from:

  ,Row_number() Over (ORDER BY (select name from taxonomy_species ts WHERE ts.taxonomy_species_id = a.taxonomy_species_id), inventory_number_part1, inventory_number_part2) AS office_use

to:

  ,Row_number() Over (PARTITION BY oi.order_request_id ORDER BY oi.order_request_id, (select name from taxonomy_species ts WHERE ts.taxonomy_species_id = a.taxonomy_species_id), inventory_number_part1, inventory_number_part2, inventory_number_part3) AS office_use

2) To support order items with quantity_shipped less than 1 change line 62 from:

AND oi.quantity_shipped >= 1

to:

AND oi.quantity_shipped > 0

3) To support use of a 'universal' packet label that uses the site long name in the packet label header (instead of a 'hard coded' site name) insert this line below line 19:

  ,(SELECT s.site_long_name FROM site s WHERE s.site_id = (SELECT c.site_id FROM cooperator c WHERE c.cooperator_id = o.owned_by)) AS site_long_name

"	enhancement	closed	medium		Dataviews (CT)	N/A		fixed		lisa.burke@… david.peters@… stacey.estrada@…	N/A	N/A
