 							</tr>
 							<cfset i = i+1>
 						</cfif><!---- end of the list ---->
-					</cfif>
+						---->
 				</cfloop>
+
+				<!----
+
+
+		<tr>
+			<td>
+				<div style="padding-left:#pdg#em;">
+					#p.part_name#
+				</div>
+			</td>
+			<td>#p.part_condition#</td>
+			<td>#p.part_disposition#</td>
+			<td>#p.lot_count#</td>
+			<cfif oneOfUs is 1>
+				<td>#p.label#</td>
+				<td>#p.barcode#</td>
+				<td>#replace(p.FCTree,':','←<wbr>','all')#</td>
+				<cfquery dbtype="query" name="tlp">
+					select * from l_q where transaction_id is not null and collection_object_id=#pid#
+				</cfquery>
+				<td>
+					<cfloop query="tlp">
+						<div>
+							<a href="/Loan.cfm?action=editLoan&transaction_id=#transaction_id#">#loan_number# (#LOAN_STATUS#)</a>
+						</div>
+					</cfloop>
+				</td>
+			</cfif>
+			<td>#p.part_remarks#</td>
+		</tr>
+		<cfquery name="patt" dbtype="query">
+			select
+				attribute_type,
+				attribute_value,
+				attribute_units,
+				determined_date,
+				attribute_remark,
+				agent_name
+			from
+				p_q
+			where
+				attribute_type is not null and
+				part_id=#pid#
+			group by
+				attribute_type,
+				attribute_value,
+				attribute_units,
+				determined_date,
+				attribute_remark,
+				agent_name
+			order by
+				attribute_type,
+				determined_date
+		</cfquery>
+		<cfif patt.recordcount gt 0>
+			<tr>
+				<td colspan="6">
+					<div style="padding-left:#level#em;">
+
+					<table border id="patbl#pid#" class="detailCellSmall sortable">
+						<tr>
+							<th>
+								Attribute
+							</th>
+							<th>
+								Value
+							</th>
+							<th>
+								Date
+							</th>
+							<th>
+								Dtr.
+							</th>
+							<th>
+								Rmk.
+							</th>
+						</tr>
+						<cfloop query="patt">
+							<tr>
+								<td>
+									#attribute_type#
+								</td>
+								<cfif not(oneOfUs) and attribute_type is "location" and one.encumbranceDetail contains "mask part attribute location">
+									<td>masked</td>
+									<td>-</td>
+									<td>-</td>
+									<td>-</td>
+								<cfelse>
+									<td>#attribute_value# <cfif len(attribute_units) gt 0>#attribute_units#</cfif></td>
+									<td>#dateformat(determined_date,'yyyy-mm-dd')#</td>
+									<td>#agent_name#</td>
+									<td>#attribute_remark#</td>
+								</cfif>
+							</tr>
+						</cfloop>
+					</table>
+					</div>
+				</td>
+			</tr>
+		</cfif>
+		---->
+	</cfsavecontent>
+<cfreturn r>
+</cffunction>
+
+
+
+
+
+
+
+
+
+
+
+	<b>Edit #orderedparts.recordcount# Specimen Parts</b>&nbsp;<span class="helpLink" data-helplink="parts">help</span>
+		<br><a href="/findContainer.cfm?collection_object_id=#collection_object_id#">Part Locations</a>
+
+<form name="parts" method="post" action="editParts.cfm">
+			<input type="hidden" name="action" value="saveEdits">
+			<input type="hidden" name="collection_object_id" value="#collection_object_id#">
+
+
+
+			<table border>
+				<cfloop query="orderedparts">
+
+					<cfset zxc=getChildParts(part_id,level,raw,ploan)>
+								#zxc#
+
+
+				</cfloop>
+			</table>
+		</form>
+
+<!----
+
+
+
+		<!--- just parts ---->
+		<cfquery name="partsOnly" dbtype="query">
+			select
+				partID,
+				part_name,
+				coll_obj_disposition,
+				condition,
+				sampled_from_obj_id,
+				lot_count,
+				barcode,
+				label,
+				parentContainerId,
+				partContainerId,
+				coll_object_remarks
+			from
+				raw
+			where
+				partID is not null and
+				sampled_from_obj_id is null
+			group by
+				partID,
+				part_name,
+				coll_obj_disposition,
+				condition,
+				sampled_from_obj_id,
+				lot_count,
+				barcode,
+				label,
+				parentContainerId,
+				partContainerId,
+				coll_object_remarks
+			order by
+				part_name
+		</cfquery>
+		<!--- just the object, no data ---->
+		<cfquery name="getParts" dbtype="query">
+			select
+				'' as ordr,
+				partID,
+				part_name,
+				coll_obj_disposition,
+				condition,
+				sampled_from_obj_id,
+				lot_count,
+				barcode,
+				label,
+				parentContainerId,
+				partContainerId,
+				coll_object_remarks
+			from raw
+			where
+			1=2
+		</cfquery>
+		<cfset rnum=1>
+		<cfloop query="partsOnly">
+			<cfset queryAddRow(getParts)>
+			<cfset querySetCell(getParts,"ordr",rnum,rnum)>
+			<cfset querySetCell(getParts,"partID",partID,rnum)>
+			<cfset querySetCell(getParts,"part_name",part_name,rnum)>
+			<cfset querySetCell(getParts,"coll_obj_disposition",coll_obj_disposition,rnum)>
+			<cfset querySetCell(getParts,"condition",condition,rnum)>
+			<cfset querySetCell(getParts,"sampled_from_obj_id",sampled_from_obj_id,rnum)>
+			<cfset querySetCell(getParts,"lot_count",lot_count,rnum)>
+			<cfset querySetCell(getParts,"barcode",barcode,rnum)>
+			<cfset querySetCell(getParts,"label",label,rnum)>
+			<cfset querySetCell(getParts,"parentContainerId",parentContainerId,rnum)>
+			<cfset querySetCell(getParts,"partContainerId",partContainerId,rnum)>
+			<cfset querySetCell(getParts,"coll_object_remarks",coll_object_remarks,rnum)>
+			<cfset rnum=rnum+1>
+			<cfquery name="thisSS" dbtype="query">
+				select
+					partID,
+					part_name,
+					coll_obj_disposition,
+					condition,
+					sampled_from_obj_id,
+					lot_count,
+					barcode,
+					label,
+					parentContainerId,
+					partContainerId,
+					coll_object_remarks
+				from
+					raw
+				where
+					sampled_from_obj_id=#partID#
+				order by
+					part_name
+			</cfquery>
+			<cfloop query="thisSS">
+				<cfset queryAddRow(getParts)>
+				<cfset querySetCell(getParts,"ordr",rnum,rnum)>
+				<cfset querySetCell(getParts,"partID",partID,rnum)>
+				<cfset querySetCell(getParts,"part_name",part_name,rnum)>
+				<cfset querySetCell(getParts,"coll_obj_disposition",coll_obj_disposition,rnum)>
+				<cfset querySetCell(getParts,"condition",condition,rnum)>
+				<cfset querySetCell(getParts,"sampled_from_obj_id",sampled_from_obj_id,rnum)>
+				<cfset querySetCell(getParts,"lot_count",lot_count,rnum)>
+				<cfset querySetCell(getParts,"barcode",barcode,rnum)>
+				<cfset querySetCell(getParts,"label",label,rnum)>
+				<cfset querySetCell(getParts,"parentContainerId",parentContainerId,rnum)>
+				<cfset querySetCell(getParts,"partContainerId",partContainerId,rnum)>
+				<cfset querySetCell(getParts,"coll_object_remarks",coll_object_remarks,rnum)>
+				<cfset rnum=rnum+1>
+			</cfloop>
+		</cfloop>
+
+	 	<b>Edit #getParts.recordcount# Specimen Parts</b>&nbsp;<span class="helpLink" data-helplink="parts">help</span>
+		<br><a href="/findContainer.cfm?collection_object_id=#collection_object_id#">Part Locations</a>
+		<cfset i = 1>
+		<cfset listedParts = "">
+		<form name="parts" method="post" action="editParts.cfm">
+			<input type="hidden" name="action" value="saveEdits">
+			<input type="hidden" name="collection_object_id" value="#collection_object_id#">
+
+			<cfdump var=#getParts#>
+
+
+			<table border>
+
 				<tr bgcolor="##00CC00">
 					<td colspan="10" align="center">
 						<input type="button" value="Save All Changes" class="savBtn"

			select collection_cde from raw group by collection_cde
		</cfquery>

		<!--- just parts ---->
		<cfquery name="partsOnly" dbtype="query">
			select
				partID,
				part_name,
				coll_obj_disposition,
				condition,
				sampled_from_obj_id,
				lot_count,
				barcode,
				label,
				parentContainerId,
				partContainerId,
				coll_object_remarks
			from
				raw
			where
				partID is not null and
				sampled_from_obj_id is null
			group by
				partID,
				part_name,
				coll_obj_disposition,
				condition,
				sampled_from_obj_id,
				lot_count,
				barcode,
				label,
				parentContainerId,
				partContainerId,
				coll_object_remarks
			order by
				part_name
		</cfquery>
		<!--- just the object, no data ---->
		<cfquery name="getParts" dbtype="query">
			select
				'' as ordr,
				partID,
				part_name,
				coll_obj_disposition,
				condition,
				sampled_from_obj_id,
				lot_count,
				barcode,
				label,
				parentContainerId,
				partContainerId,
				coll_object_remarks
			from raw
			where
			1=2
		</cfquery>
		<cfset rnum=1>
		<cfloop query="partsOnly">
			<cfset queryAddRow(getParts)>
			<cfset querySetCell(getParts,"ordr",rnum,rnum)>
			<cfset querySetCell(getParts,"partID",partID,rnum)>
			<cfset querySetCell(getParts,"part_name",part_name,rnum)>
			<cfset querySetCell(getParts,"coll_obj_disposition",coll_obj_disposition,rnum)>
			<cfset querySetCell(getParts,"condition",condition,rnum)>
			<cfset querySetCell(getParts,"sampled_from_obj_id",sampled_from_obj_id,rnum)>
			<cfset querySetCell(getParts,"lot_count",lot_count,rnum)>
			<cfset querySetCell(getParts,"barcode",barcode,rnum)>
			<cfset querySetCell(getParts,"label",label,rnum)>
			<cfset querySetCell(getParts,"parentContainerId",parentContainerId,rnum)>
			<cfset querySetCell(getParts,"partContainerId",partContainerId,rnum)>
			<cfset querySetCell(getParts,"coll_object_remarks",coll_object_remarks,rnum)>
			<cfset rnum=rnum+1>
			<cfquery name="thisSS" dbtype="query">
				select
					partID,
					part_name,
					coll_obj_disposition,
					condition,
					sampled_from_obj_id,
					lot_count,
					barcode,
					label,
					parentContainerId,
					partContainerId,
					coll_object_remarks
				from
					raw
				where
					sampled_from_obj_id=#partID#
				order by
					part_name
			</cfquery>
			<cfloop query="thisSS">
				<cfset queryAddRow(getParts)>
				<cfset querySetCell(getParts,"ordr",rnum,rnum)>
				<cfset querySetCell(getParts,"partID",partID,rnum)>
				<cfset querySetCell(getParts,"part_name",part_name,rnum)>
				<cfset querySetCell(getParts,"coll_obj_disposition",coll_obj_disposition,rnum)>
				<cfset querySetCell(getParts,"condition",condition,rnum)>
				<cfset querySetCell(getParts,"sampled_from_obj_id",sampled_from_obj_id,rnum)>
				<cfset querySetCell(getParts,"lot_count",lot_count,rnum)>
				<cfset querySetCell(getParts,"barcode",barcode,rnum)>
				<cfset querySetCell(getParts,"label",label,rnum)>
				<cfset querySetCell(getParts,"parentContainerId",parentContainerId,rnum)>
				<cfset querySetCell(getParts,"partContainerId",partContainerId,rnum)>
				<cfset querySetCell(getParts,"coll_object_remarks",coll_object_remarks,rnum)>
				<cfset rnum=rnum+1>
			</cfloop>
		</cfloop>
		<cfquery name="ploan" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
			SELECT
				loan.loan_number,
				loan.transaction_id,

				loan_item.collection_object_id=specimen_part.collection_object_id AND
				specimen_part.derived_from_cat_item=#collection_object_id#
		</cfquery>

<cfquery name="orderedparts" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
	select
		collection_object_id part_id,
 		level,
 		part_name
	from (
 		SELECT
			SAMPLED_FROM_OBJ_ID,
			collection_object_id,
			part_name
		FROM
			specimen_part
 		where
			derived_from_cat_item=#collection_object_id#
 		)
	START WITH SAMPLED_FROM_OBJ_ID is null
	CONNECT BY PRIOR collection_object_id = SAMPLED_FROM_OBJ_ID
	ORDER SIBLINGS BY part_name
</cfquery>











<cffunction name="getChildParts"  returnType="string">
	<!---- build table row(s) for one part and any attributes ---->

	<cfargument name="pid" type="string" required="yes">
	<cfargument name="level" type="string" required="yes">
	<cfargument name="p_q" type="query" required="yes">
	<cfargument name="l_q" type="query" required="yes">



		<cfquery name="ctDisp" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
			select coll_obj_disposition from ctcoll_obj_disp order by coll_obj_disposition
		</cfquery>


	<cfquery name="p" dbtype="query">
		select
		*
		from
			p_q
		where
			part_id=#pid#
	</cfquery>


	<cfsavecontent variable="r">
		<cfset pdg=level-1>



		<cfloop query="p">
			<input type="hidden" name="partID#pid#" id="partID#pid#"  value="#pid#">

							<tr>
								<td>
									<div style="padding-left:#pdg#em;">
									<label for="part_name#i#">
										Part
										<cfif len(sampled_from_obj_id) gt 0>
											Subsample
										</cfif>
										&nbsp;<span class="likeLink" style="font-weight:100" onClick="getCtDoc('ctspecimen_part_name')">[ Define values ]</span>

									</label>
									<input type="text" name="part_name#pid#" id="part_name#pid#" class="reqdClr"
										value="#p.part_name#" size="25"
										onchange="findPart(this.id,this.value,'#thisCollectionCde.collection_cde#');"
										onkeypress="return noenter(event);">
									</div>
								</td>
								<!----
								<td>
									<label for="coll_obj_disposition#i#">Disposition</label>
									<select name="coll_obj_disposition#i#" id="coll_obj_disposition#i#" size="1" class="reqdClr" style="width:150px";>
