	   <cfset #Request.prefix_db_lookup# = 'hhapowerpath' />
	   <cfset #Request.prefix_db_agency# = 'agency_563' />
	   <cfset agency_id = '563' />
	   <cfquery name="getsupply" datasource="hhapowerpath_prod">
			 SELECT * FROM #Request.prefix_db_agency#.Supply
			 ORDER BY Supply_ID ASC 
		</cfquery>

		<cfquery name="getexisittable" datasource="#Application.DataSrc#">
				SELECT * FROM #Request.prefix_db_agency#.Supply  WHERE Agency_ID = #agency_id# 
		</cfquery>

			<cfif getexisittable.recordcount  EQ 0 >
			<cfloop query="getsupply">
				<cftransaction>
		  			<cftry>		  			    
						<cfset supplystatus = 1>
						<cfif getsupply.active EQ 'Y'>
							<cfset supplystatus = 0>
						</cfif>
						<cfquery name="insertsupply" datasource="#Application.DataSrc#">
								INSERT INTo #Request.prefix_db_agency#.Supply (Agency_ID, Supply, HCPCS, Revenue_Code, Units, Price, QB_Export, active)
								VALUES (
								<cfqueryparam VALUE="#getsupply.Agency_ID#"  cfsqltype="cf_sql_integer">,
			                    <cfqueryparam VALUE="#getsupply.Supply#"  cfsqltype="cf_sql_varchar">,
			                    <cfqueryparam VALUE="#getsupply.HCPCS#"  cfsqltype="cf_sql_varchar">,
			                    <cfqueryparam VALUE="#getsupply.Revenue_Code#"  cfsqltype="cf_sql_varchar">,
			                    <cfqueryparam VALUE="#getsupply.Units#"  cfsqltype="cf_sql_varchar">,
			                    <cfqueryparam VALUE="#getsupply.Price#"  cfsqltype="cf_sql_varchar">,
			                    <cfqueryparam VALUE="#getsupply.QB_Export#"  cfsqltype="cf_sql_integer">,
			                    <cfqueryparam VALUE="#supplystatus#"  cfsqltype="cf_sql_integer">
			                    )
						</cfquery>	
						<cftransaction action="commit" /> 
					   <cfcatch>
				         <cftransaction action="rollback"><cfdump var="#cfcatch#"><cfabort>
					  </cfcatch>
					</cftry>
			   </cftransaction>

				
			</cfloop>
			<cfelse>
					<h3>Some of the supply already existing  </h3>
			</cfif>
		