(file) Return to act_updateservices.cfm CVS log (file) (dir) Up to [Development] / p2rx-programs

File: [Development] / p2rx-programs / act_updateservices.cfm (download)
Revision: 1.1, Wed Mar 9 03:18:14 2005 UTC (4 years, 8 months ago) by neenan
Branch: MAIN
CVS Tags: HEAD
*** empty log message ***

<!--- 	Name:  act_updateservices.cfm
    	Purpose: This functions as the action file to update the services information that was earlier selected by the user.
				This file is used while editing the organization information. Each time this page is called,the field values 
				are first deleted from the dOrgToService table using a query.Fresh records are then inserted for each of 
				the services that the user had selected in the dsp_editservices form. The "Other" new services are also 
				inserted in the dservice table and dorgtoservice table respectively.
		Date created: 02/24/2005
       	Dependancy: URL.Orgid 
		Variables: 	
					
		Functions: 
		Date changed: 
					02/24/2005			Prabin & Neena  Created & Documentation
---> 

<cfquery name="deletepg" datasource="#Programsdb#">
delete 
from   dOrgToService
Where  OrgID = #URL.ORGID#
</cfquery> 

<cfset Array = #ListToArray(form.ServiceID)#>

<cfloop from="1" to="#ArrayLen(Array)#" index="x">
		<cfquery datasource="#Programsdb#">
			Insert Into dOrgtoService (OrgID, ServiceID)
			Values(#URL.OrgID#, #Array[x]#)
		</cfquery>
</cfloop>
		
<cfif IsDefined("form.OtherExpertise")>
	<cfif #form.OtherExpertise# is true>
		<cfquery name="newExp" datasource="#Programsdb#">
			Insert into dService(Service,Type, Approved,CenterID)
			Values('#form.Other1#','Expertise',1,7)
		</cfquery>
		
		<Cfquery name="getmaxServiceID" datasource="#Programsdb#">
				Select Max(serviceid) as maxSid from dService
		</Cfquery>
		
		<cfquery name="newOrgToService" datasource="#Programsdb#">
			Insert into dOrgtoService (OrgID, ServiceID)
			Values(#URL.OrgID#, #getMaxServiceid.maxSid#)
		</cfquery> 
	</cfif>

<cfelseif IsDefined("form.OtherResources")>
		<cfif #form.OtherResources# is true>
			<cfquery name="newRes" datasource="#Programsdb#">
				Insert into dService(Service,Type, Approved,CenterID)
				 Values('#form.Other2#','Resources',1,7)
			</cfquery>
			<Cfquery name="getmaxServiceID" datasource="#Programsdb#">
				Select Max(serviceid) as maxSid from dService
			</Cfquery>
			
			<cfquery name="newOrgToService" datasource="#Programsdb#">
				Insert into dOrgtoService (OrgID, ServiceID)
				Values(#URL.OrgID#, #getMaxServiceid.maxSid#)
			</cfquery> 
		</cfif>
<cfelseif IsDefined("form.OtherClients")>
		<cfif #form.OtherClients# is true>
			<cfquery name="newClient" datasource="#Programsdb#">
				Insert into dService(Service,Type, Approved,CenterID)
	 			Values('#form.Other3#','Clients',1,7)
			</cfquery>
			
			<Cfquery name="getmaxServiceID" datasource="#Programsdb#">
				Select Max(serviceid) as maxSid from dService
			</Cfquery>
		
			<cfquery name="newOrgToService" datasource="#Programsdb#">
				Insert into dOrgtoService (OrgID, ServiceID)
				Values(#URL.OrgID#, #getMaxServiceid.maxSid#)
			</cfquery> 
		</cfif>
</cfif>

CVS Admin
Powered by
ViewCVS 1.0-dev