Skip to content

Instantly share code, notes, and snippets.

<!--- Verify that the treatmentplan creates successfully --->
<cfif treatmentplan.save()>
<!--- Loop through all the patient's teeth --->
<cfloop collection="#params.as_values_treatmentplandetail.treatment#" item="tooth">
<!--- Loop through all the treatment plans selected --->
<cfloop list="#params.as_values_treatmentplandetail.treatment[tooth]#" index="treatmentId">
<!--- Find the selected treatment (HUGE DB IMPACT) --->
<cfset treatment = model("Treatment").findByKey(treatmentId)>
<!--- Insert a new treatment detail in the plan --->
<cfset treatmentplan.createTreatmentPlanDetail(toothId=tooth, treatment=treatment.name, price=treatment.price)>