<style>
    @media all {
	.page-break	{ display: none; }
}

@media print {
	.page-break	{ display: block; page-break-bfore: always; }
}
.no-break {
  page-break-inside: avoid;
}
/* force h2 title to display on new page */
h2 {
  page-break-before: always;
}
</style>
<cfdocument format="pdf"  localURL = "yes"   margintop=".75" marginbottom="1.25"   orientation="landscape"  >
	
		<cfdocumentsection>	
		
		
				<cfquery name="Get_Report_2_data_2019" datasource="#Application.DataSrc#">
					SELECT * FROM 
						agency_1070.Coding_Results 
					WHERE 
						Patient_ID=453
						AND Assessment_ID= 490
                        AND ( M0_Item_Medication like '%(M102%' <!---or Order_ID = 28 or Order_ID = 29--->)
                    Order by Results_ID
				</cfquery>	
                <div class="row">
						<table cellpadding="5" border="1" cellspacing="0" width="100%">					
							<tr style="font-family: Arial;" class="no-break">
								<th width="10%" height="40px"></th>
								<th width="25%">User-entered Diagnosis List</th>
								<th width="30%">Goals for CMS485 FL 22</th>
								<th width="30%">Interventions for CMS485 FL 21</th>
							</tr>
							<cfset memo_length = 0>
							<cfset pagenumber = 1 />
							<cfif isdefined('Get_Report_2_data_2019.recordcount') and  Get_Report_2_data_2019.RecordCount GT 0>	
								<cfoutput query="Get_Report_2_data_2019">
								    <tr style="font-family: Arial; font-size: 13px;">
										<td width="10%" valign="top">#Get_Report_2_data_2019.M0_Item_Medication#</td>
										<td width="25%" valign="top">#Get_Report_2_data_2019.Diagnosis#</td>
										<td width="30%" valign="top">#Get_Report_2_data_2019.Memo#</td>
										<td width="30%" valign="top">#Get_Report_2_data_2019.Textfield_12#</td>
									</tr> 
								<cfset memo_length =  memo_length + len(Get_Report_2_data_2019.Memo) />
                                   <cfif (memo_length gte '500' AND pagenumber eq 1) OR memo_length gte '1200'  >
                                      <td  border="0">#memo_length#
                                      <cfdocumentitem type ="pagebreak"></cfdocumentitem>
									   </td>
									   <cfset  memo_length = 0 />
									   <cfset pagenumber = pagenumber + 1 />
									</cfif>
								</cfoutput>
									
                                   

							<cfelse>
								<tr>
									<td align="center" valign="middle" colspan="4" height="50px">
										No Report Found
									</td>
								</tr>
							</cfif>					
						</table>
					</div>						
					<cfdocumentitem type="pagebreak">
            		</cfdocumentitem>
					<div class="row">			
						<div class="row">
							<div>
								<label style="padding-left:0px; font-family: Arial; font-size: 34px;font-weight:bold;">INSERT INTO CMS485</label>
							</div>
						</div>
						<br /> <cfoutput>#Get_Report_2_data_2019.Textfield_9#</cfoutput>
					
						<table class="print-friendly" cellpadding="5" border="1" cellspacing="0" width="100%">
												
							<tr style="font-family: Arial;">
								<th width="50%" height="40px">All Goals for CMS485 FL 22</th>
								<th width="50%">All Interventions for CMS485 FL 21</th>						
							</tr>
							
							<cfif isdefined('Get_Report_2_data_2019.recordcount') and  Get_Report_2_data_2019.RecordCount GT 0>	
								
									<cfoutput query="Get_Report_2_data_2019">
									<tr style="font-family: Arial; font-size: 13px;">
									    <td width="50%" valign="top">
											<cfif #Get_Report_2_data_2019.Memo# neq "">
												#Get_Report_2_data_2019.Memo# <br />
												 
											</cfif>
										</td>
										  <td width="50%" valign="top">
											<cfif #Get_Report_2_data_2019.Textfield_12# neq "">
												#Get_Report_2_data_2019.Textfield_12# <br />
											</cfif>
										</td>
										</tr>
									</cfoutput>									
								
							<cfelse>
								<tr>
									<td align="center" valign="middle" colspan="2" height="50px">
										No Report Found
									</td>
								</tr>
							</cfif>					
						</table>
					</div>	
					<cfdocumentitem type="footer"  evalatprint="true">
				<table cellpadding="0" align="center" style="border-top:: solid 1px black;" cellspacing="0" border="0" height="100px" width="100%">
					<tr>
					  	<td>
							<table align="center" cellpadding="0" cellspacing="0" border="0" width="100%" 
						  style="font-family: font-family: Consolas, 'Andale Mono', 'Lucida Console', 'Lucida Sans Typewriter', Monaco, 'Courier New; font-size: 22px; ">
							  <tr>
								<td height="8px"></td>
							  </tr>	
							  <tr>
								<td align="center" style="font-family: font-family: Consolas, 'Andale Mono', 'Lucida Console', 'Lucida Sans Typewriter', Monaco, 'Courier New;font-size: 26px;"> page <cfoutput>#cfdocument.currentpagenumber#</cfoutput> </td>
							  </tr>
							  <tr>
								<td height="10px"></td>
							  </tr>
							</table>
						</td>
					</tr>
				</table>
			</cfdocumentitem>  
		</cfdocumentsection>
	</cfdocument>
