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

  1 neenan 1.3 <!--- 	Name: act_insertPrograms.cfm
  2                	Purpose: This functions as the action file to retreive the organizational information based on the Org ID on the site 
  3            				and input the related information as a new dummy organization. The related contacts,services and programs are 
  4            				inserted as new records in the dummy organization,contact and OrgtoService OrgtoProgramType tables. 
  5            				
  6            		Dated: 03/06/2005
  7                   	Dependancy: URL.Orgid 
  8            		Variables: 	
  9            		Functions: 
 10            		Date changed: 
 11            					03/06/2005	Prabin & Neena  Created & Documentation
 12            					03/22/2005	Neena			updated the file to use cflocation tags to be directed to edit
 13            												organization page with information.
 14            ---> 	
 15            
 16            <P>Agencies and Programs
 17            <!--- <a href="../directories/programs.cfm" class="sublink2"> --->
 18             <!--- <img src="../images/siteimage/dart.gif" border="0"> </a>--->
 19 neenan 1.1 </p>
 20            
 21            
 22            <cfquery name="dorg" datasource="#programsdb#">
 23            Select * from Organization where Orgid = #URL.Orgid#
 24            </cfquery>
 25            
 26            <cfquery name="InsertOrg" datasource="#programsdb#">
 27            Insert Into dOrganization
 28            				(OrganizationName, Phone, Extension, Division, FaxNumber, TimeZone, Address1, EmailName, GeoServiceID, Address2, Hotline, City, StateOrProvince, URL, PostalCode, Country, GraphicURL, Profile)
 29            		Values	('#dorg.OrganizationName#', 
 30            				 '#dorg.Phone#', 
 31            				 '#dorg.Extension#', 
 32            				 '#dorg.Division#', 
 33            				 '#dorg.FaxNumber#', 
 34            				 '#dorg.TimeZone#', 
 35            				 '#dorg.Address1#', 
 36            				 '#dorg.EmailName#', 
 37            				  #dorg.GeoServiceID#, 
 38            				 '#dorg.Address2#', 
 39            				 '#dorg.Hotline#', 				
 40 neenan 1.1 				 '#dorg.City#', 
 41            				 '#dorg.StateOrProvince#', 
 42            				 '#dorg.URL#', 
 43            				 '#dorg.PostalCode#', 
 44            				 '#dorg.Country#', 
 45            				 '#dorg.GraphicURL#', 
 46            				 '#dorg.Profile#'
 47            				 )
 48            </cfquery>
 49            
 50            <cfquery name="getorgid" datasource="#programsdb#">
 51            Select max(orgid) as maxid from dorganization 
 52            </cfquery>
 53            
 54            <cfset maxorgid = getorgid.maxid>
 55            <!--- Associating the dummy table from dcontacts table with the new orgID in the Contacts table - This query will get all the program type id's that have been 
 56            associated with the program type.---> 
 57            
 58            <cfquery name="getcontacts" datasource="#programsdb#">
 59            Select * from contacts where Orgid = #URL.Orgid#
 60            </cfquery>
 61 neenan 1.1 
 62            
 63            <CFLOOP Query="getcontacts">
 64            
 65            <CFQUERY NAME="insertcontacts" DATASOURCE="#programsdb#">
 66            INSERT INTO dContacts(Prefix, FirstName, Middle, LastName, NameSuffix, Title, Primary, WorkPhone, WorkExtension, MobilePhone, FaxNumber, EmailName, Address, City, State, Zip, OrgID)
 67            Values('#Prefix#','#FirstName#','#Middle#','#LastName#','#NameSuffix#','#Title#','#Primary#','#WorkPhone#','#WorkExtension#','#MobilePhone#','#FaxNumber#','#EmailName#','#Address#','#City#','#State#','#Zip#',#getorgid.maxid#)
 68            </cfquery>
 69            </CFLOOP>
 70            
 71            <!--- Associating the program types to the organization  - This query will get all the program type id's that have been 
 72            associated with the program type.---> 
 73            
 74            <cfquery name="getOrgProgtype" datasource="#programsdb#">
 75            Select * from OrgtoProgramtype 
 76            where Orgid = #URL.Orgid#
 77            </cfquery>
 78            
 79            <cfset ProgList = ValueList(getOrgProgtype.ProgramTypeID)>
 80            <cfset ProgTypeArray = ListToArray(ProgList)>
 81            
 82 neenan 1.1 	<cfif GetOrgProgType.recordcount is not 0>
 83            	
 84            		<cfloop from="1" to="#ArrayLen(ProgTypeArray)#" index="x">
 85            			<cfquery datasource="#programsdb#">
 86            				Insert Into dOrgtoprogramtype (OrgID,ProgramTypeID)
 87            				Values(#getorgid.maxID#,  #ProgTypeArray[x]#)
 88            			</cfquery>
 89            		</cfloop>
 90            	</cfif>
 91            
 92            <!-- section for adding services and relate it to the organization ---> 
 93            <cfquery name="getmaxserviceid" datasource="#programsdb#">
 94            SELECT orgid, ServiceID
 95            FROM OrgtoService
 96            </cfquery>
 97            
 98            <cfquery name="getService" datasource="#programsdb#">
 99            SELECT orgid, ServiceID
100            FROM OrgtoService
101            WHERE Orgid=#URL.orgid# And serviceid Not in (select serviceid from service where approved=1);
102            
103 neenan 1.1 </cfquery>
104            
105            <cfset ServiceList = ValueList(getService.ServiceID)>
106            <cfset ServiceArray = ListToArray(ServiceList)>
107            
108            <cfif getService.recordcount is not 0>
109            	<cfloop from="1" to="#ArrayLen(ServiceArray)#" index="x">
110            		<cfquery datasource="#programsdb#">
111            			Insert Into dOrgtoService (OrgID, ServiceID)
112            			Values(#getorgid.maxID#, #ServiceArray[x]#)
113            		</cfquery>
114            	</cfloop>
115            </cfif>
116            <!--- The Query below gets the new unapproved service names entered by the admin/online user and appends 
117            the services and the links in the Service and OrgtoService Tables --->
118            
119            <cfif #URL.fuseaction# is "editservices">
120            
121            	<cfquery name="getNewServices" datasource="#programsdb#">
122            	SELECT ds.service,ds.type,ds.Approved, os.orgid
123            	FROM Service AS ds, Orgtoservice AS os
124 neenan 1.1 	WHERE os.Orgid=#URL.Orgid# and os.serviceid=ds.serviceid and ds.approved=0;
125            	</cfquery> 
126            
127            	<cfset NewServiceList = ValueList(getNewServices.Service)>
128            	<cfset NewTypeList = ValueList(getNewServices.Type)>
129            	<cfset NewServiceArray = ListToArray(NewServiceList)>
130            	<cfset NewTypeArray = ListToArray(NewTypeList)>
131            
132            	<cfif getNewServices.recordcount is not 0>
133            		<cfloop from="1" to="#ArrayLen(NewServiceArray)#" index="x">
134            			<cfquery name="Addnewservice" datasource="#programsdb#">
135            				Insert Into dService(Service,Type,Approved,CenterID)
136            				Values('#NewServiceArray[x]#','#NewTypeArray[x]#',1,7)
137            			</cfquery>
138            			<cfquery name="getserviceid" datasource="#programsdb#">
139            				Select max(serviceid) as maxserviceid from dService
140            			</cfquery>
141            			<cfquery name="link" datasource="#programsdb#">
142            				Insert Into dOrgtoService (OrgID, ServiceID)
143            				Values(#getorgid.maxID#, #getserviceid.maxserviceid#)
144            			</cfquery>
145 neenan 1.1 		</cfloop>
146            	</cfif> 
147            
148            </cfif>
149            
150            <!--- <cfoutput>
151            <input type="hidden" name="mainOrgId" value="URL.mainorgid">
152            <input type="hidden" name="orgid" value="#getorgid.maxid#">
153            </cfoutput>
154             --->
155             
156             
157             <CFIF #URL.fuseaction# IS "GETORG">
158            <cfquery name="provider1" datasource="#programsdb#">
159            			SELECT *
160            			FROM dOrganization
161            			where orgID = #maxOrgID#
162            </cfquery>
163            
164 neenan 1.2 <cflocation url="addeditprograms.cfm?FuseAction=Editorg&OrgID=#maxorgid#" addToken="No">
165            <!--- <cfoutput><input type="hidden" name="OrgID" value="maxorgid"></cfoutput>
166 neenan 1.1 <table width="100%" border="0" cellspacing="0" cellpadding="10" name="text">
167                    <tr> 
168                      <td> 
169                        <p><span class="tableheading">Programs in Region 7</span> <br><br>
170            			<p><cfoutput query="provider1"><a href="details.cfm?orgid=#maxorgid#" class="subheading">#organizationName#</a> 
171            			&nbsp;&nbsp;&nbsp;&nbsp;<a href="addeditprograms.cfm?FuseAction=Editorg&OrgID=#maxorgid#">Edit</a>
172            			
173            			<br><br><!--- </cfoutput> --->
174 neenan 1.2 			</cfoutput> --->
175 neenan 1.1 		
176 neenan 1.2 			<!--- <a href="#top"><img src="../images/SiteImage/top.gif" border="0"></a><br><br>
177 neenan 1.1 
178                    </tr>
179 neenan 1.2 </table> --->
180 neenan 1.1 
181            
182            </CFIF>

CVS Admin
Powered by
ViewCVS 1.0-dev