⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rcfunctions.inc

📁 java开源项目源代码
💻 INC
📖 第 1 页 / 共 3 页
字号:
<?php/* $Revision: 1.7 $ */// Include functions needed for ReportCreator.phpfunction PrepStep($StepNum) {	// This function sets the titles and include information to prepare for the defined step number	switch ($StepNum) {		case '1': // home form with form listings		default:			$FormParams['title'] = RPT_RPRBLDR.RPT_STEP1; 			$FormParams['heading'] = RPT_ADMIN; 			$FormParams['IncludePage'] = 'forms/ReportsHome.html';			break;		case '2': // id, copy, new report name form			$FormParams['title'] = RPT_RPRBLDR.RPT_STEP2; 			$FormParams['heading'] = RPT_RPTID;			$FormParams['IncludePage'] = 'forms/ReportsID.html';			break;		case '3': // page setup form			$FormParams['title'] = RPT_RPRBLDR.RPT_STEP3; 			$FormParams['heading'] = RPT_RPTFRM;			$FormParams['IncludePage'] = 'forms/ReportsPageSetup.html';			break;		case '4': // db setup form			$FormParams['title'] = RPT_RPRBLDR.RPT_STEP4; 			$FormParams['heading'] = RPT_RPTFRM;			$FormParams['IncludePage'] = 'forms/ReportsDBSetup.html';			break;		case '5': // field setup form			$FormParams['title'] = RPT_RPRBLDR.RPT_STEP5; 			$FormParams['heading'] = RPT_RPTFRM;			$FormParams['IncludePage'] = 'forms/ReportsFieldSetup.html';			break;		case 'prop': // Form field properties form			global $Params; // we need the form type from the Params variable to load the correct form			$FormParams['title'] = RPT_RPRBLDR.RPT_BTN_PROP; 			$FormParams['heading'] = RPT_RPTFRM;			$FormParams['IncludePage'] = 'forms/TplFrm'.$Params['index'].'.html';			break;		case '6': // criteria setup form			$FormParams['title'] = RPT_RPRBLDR.RPT_STEP6; 			$FormParams['heading'] = RPT_RPTFRM;			$FormParams['IncludePage'] = 'forms/ReportsCritSetup.html';			break;		case 'imp': // import form			$FormParams['title'] = RPT_RPRBLDR.RPT_RPTIMPORT; 			$FormParams['heading'] = RPT_RPTIMPORT; 			$FormParams['IncludePage'] = 'forms/ReportsImport.html';			break;	} // end switch $StepNum	return $FormParams;}function RetrieveReports() {	global $db, $ReportGroups, $FormGroups;		$OutputString = '';	foreach ($ReportGroups as $key=>$GName) {		$OutputString .= '<tr bgcolor="#CCCCCC"><td colspan="2" align="center">'.$GName.'</td></tr>';		$OutputString .= '<tr><td align="center">'.RPT_REPORTS.'</td><td align="center">'.RPT_FORMS.'</td></tr>';		$OutputString .= '<tr><td width="250" valign="top">';		$sql= "SELECT id, reportname FROM ".DBReports." 			WHERE defaultreport='1' AND reporttype='rpt' AND groupname='".$key."' 			ORDER BY reportname";		$Result=DB_query($sql,$db,'','',false,true);		while ($Temp = DB_fetch_array($Result)) $OutputString .= '<input type="radio" name="ReportID" value="'.$Temp['id'].'">'.$Temp['reportname'].'<br>';		$sql= "SELECT id, reportname FROM ".DBReports." 			WHERE defaultreport='0' AND reporttype='rpt' AND groupname='".$key."' 			ORDER BY reportname";		$Result=DB_query($sql,$db,'','',false,true);		if (DB_num_rows($Result)>0) $OutputString .= '<u>'.RPT_CUSTRPT.'</u><br>';		while ($Temp = DB_fetch_array($Result)) $OutputString .= '<input type="radio" name="ReportID" value="'.$Temp['id'].'">'.$Temp['reportname'].'<br>';		$OutputString .= '</td>'.chr(10).'<td width="250" valign="top">';		$sql= "SELECT id, groupname, reportname FROM ".DBReports." 			WHERE defaultreport='1' AND reporttype='frm' 			ORDER BY groupname, reportname";		$Result=DB_query($sql,$db,'','',false,true);		$FormList = '';		while ($Temp = DB_fetch_array($Result)) $FormList[] = $Temp;		foreach ($FormGroups as $index=>$value) {			$Group=explode(':',$index); // break into main group and form group array			if ($Group[0]==$key AND $FormList<>'') { // then it's a part of the group we're showing				$WriteOnce = true;				foreach ($FormList as $Entry) {					if ($Entry['groupname']==$index) { // then it's part of this listing						if ($WriteOnce) { $OutputString .= $value.'<br>'; $WriteOnce=false; }						$OutputString .= '&nbsp;&nbsp;<input type="radio" name="ReportID" value="'.$Entry['id'].'">'.$Entry['reportname'].'<br>';					}				}			}		}		$OutputString .= '</td></tr>';	}	return $OutputString;}function RetrieveFields($EntryType) {	global $db, $ReportID;	$FieldListings['fields'] = '';	$sql= "SELECT *	FROM ".DBRptFields." 		WHERE reportid = ".$ReportID." AND entrytype = '".$EntryType."'		ORDER BY seqnum";	$Result=DB_query($sql,$db,'','',false,true);	if (DB_num_rows($Result)>0) {		while ($FieldValues = DB_fetch_array($Result)) { 			$FieldListings['lists'][] = $FieldValues; 		}	}	// set the form field defaults	$FieldListings['defaults']['seqnum'] = '';	$FieldListings['defaults']['fieldname'] = '';	$FieldListings['defaults']['displaydesc'] = '';	$FieldListings['defaults']['visible'] = '';	$FieldListings['defaults']['columnbreak'] = '';	$FieldListings['defaults']['params'] = '';	$FieldListings['defaults']['buttonvalue'] = RPT_BTN_ADDNEW;	return $FieldListings;}function UpdatePageFields($ReportID) {	global $db, $Type;	// For both reports and forms start sql string	$sql = "UPDATE ".DBReports." SET 			papersize = '".$_POST['PaperSize']."',			paperorientation = '".$_POST['PaperOrientation']."',			margintop = ".$_POST['MarginTop'].",			marginbottom = ".$_POST['MarginBottom'].",			marginleft = ".$_POST['MarginLeft'].",			marginright = ".$_POST['MarginRight'];	// the checkboxes to false if not checked	if ($Type<>'frm') { // then it's a report, ad more info		if (!isset($_POST['CoyNameShow'])) $_POST['CoyNameShow'] = '0';		if (!isset($_POST['Title1Show'])) $_POST['Title1Show'] = '0';		if (!isset($_POST['Title2Show'])) $_POST['Title2Show'] = '0';		$sql .= ", coynamefont = '".$_POST['CoyNameFont']."',				coynamefontsize = ".$_POST['CoyNameFontSize'].",				coynamefontcolor = '".$_POST['CoyNameFontColor']."',				coynamealign = '".$_POST['CoyNameAlign']."',				coynameshow = '".$_POST['CoyNameShow']."',				title1desc = '".DB_escape_string($_POST['Title1Desc'])."',				title1font = '".$_POST['Title1Font']."',				title1fontsize = ".$_POST['Title1FontSize'].",				title1fontcolor = '".$_POST['Title1FontColor']."',				title1fontalign = '".$_POST['Title1FontAlign']."',				title1show = '".$_POST['Title1Show']."',				title2desc = '".DB_escape_string($_POST['Title2Desc'])."',				title2font = '".$_POST['Title2Font']."',				title2fontsize = ".$_POST['Title2FontSize'].",				title2fontcolor = '".$_POST['Title2FontColor']."',				title2fontalign = '".$_POST['Title2FontAlign']."',				title2show = '".$_POST['Title2Show']."',				filterfont = '".$_POST['FilterFont']."',				filterfontsize = ".$_POST['FilterFontSize'].",				filterfontcolor = '".$_POST['FilterFontColor']."',				filterfontalign = '".$_POST['FilterFontAlign']."',				datafont = '".$_POST['DataFont']."',				datafontsize = ".$_POST['DataFontSize'].",				datafontcolor = '".$_POST['DataFontColor']."',				datafontalign = '".$_POST['DataFontAlign']."',				totalsfont = '".$_POST['TotalsFont']."',				totalsfontsize = ".$_POST['TotalsFontSize'].",				totalsfontcolor = '".$_POST['TotalsFontColor']."',				totalsfontalign = '".$_POST['TotalsFontAlign']."',				col1width = ".$_POST['Col1Width'].",				col2width = ".$_POST['Col2Width'].",				col3width = ".$_POST['Col3Width'].",				col4width = ".$_POST['Col4Width'].",				col5width = ".$_POST['Col5Width'].",				col6width = ".$_POST['Col6Width'].",				col7width = ".$_POST['Col7Width'].",				col8width = ".$_POST['Col8Width'];	}	$sql .=" WHERE id =".$ReportID.";";	$Result=DB_query($sql,$db,'','',false,true);	return true;}function UpdateCritFields($ReportID, $DateString) {	global $db, $Type;	$sql = "UPDATE ".DBRptFields." SET 		reportid = '".$ReportID."',		entrytype = 'dateselect',		fieldname = '".DB_escape_string($_POST['DateField'])."',		displaydesc = '".$DateString."',		params = '".$_POST['DefDate']."'		WHERE reportid = ".$ReportID." AND entrytype = 'dateselect';";	$Result=DB_query($sql,$db,'','',false,true);	if ($Type<>'frm') { // then write specifics for a report		// write the truncate long descriptions choice		$sql = "UPDATE ".DBRptFields." SET 			reportid = '".$ReportID."',			entrytype = 'trunclong',			params = '".$_POST['TruncLongDesc']."',			displaydesc = ''			WHERE reportid = ".$ReportID." AND entrytype = 'trunclong';";		$Result=DB_query($sql,$db,'','',false,true);	} else { // it's a form update the page break info		// write the form page break fieldname		$sql = "UPDATE ".DBRptFields." SET 			reportid = '".$ReportID."',			entrytype = 'grouplist',			seqnum = 1,			fieldname = '".$_POST['FormBreakField']."',			params = '',			displaydesc = ''			WHERE reportid = ".$ReportID." AND entrytype = 'grouplist';";		$Result=DB_query($sql,$db,'','',false,true);	}	return true;}function UpdateDBFields($ReportID) {	global $db;	// Test inputs to see if they are valid	$strTable = DB_escape_string($_POST['Table1']);	if ($_POST['Table2']) $strTable .= ' INNER JOIN '.DB_escape_string($_POST['Table2']).' ON '.DB_escape_string($_POST['Table2Criteria']);	if ($_POST['Table3']) $strTable .= ' INNER JOIN '.DB_escape_string($_POST['Table3']).' ON '.DB_escape_string($_POST['Table3Criteria']);	if ($_POST['Table4']) $strTable .= ' INNER JOIN '.DB_escape_string($_POST['Table4']).' ON '.DB_escape_string($_POST['Table4Criteria']);	if ($_POST['Table5']) $strTable .= ' INNER JOIN '.DB_escape_string($_POST['Table5']).' ON '.DB_escape_string($_POST['Table5Criteria']);	if ($_POST['Table6']) $strTable .= ' INNER JOIN '.DB_escape_string($_POST['Table6']).' ON '.DB_escape_string($_POST['Table6Criteria']);	$sql = "SELECT * FROM ".$strTable." LIMIT 1";	$Result=DB_query($sql,$db,'','',false,false);	// if we have a row, sql was valid	if (DB_num_rows($Result)==0) return false;	$sql = "UPDATE ".DBReports." SET 			table1 = '".DB_escape_string($_POST['Table1'])."',			table2 = '".DB_escape_string($_POST['Table2'])."',			table2criteria = '".DB_escape_string($_POST['Table2Criteria'])."',			table3 = '".DB_escape_string($_POST['Table3'])."',			table3criteria = '".DB_escape_string($_POST['Table3Criteria'])."',			table4 = '".DB_escape_string($_POST['Table4'])."',			table4criteria = '".DB_escape_string($_POST['Table4Criteria'])."',			table5 = '".DB_escape_string($_POST['Table5'])."',			table5criteria = '".DB_escape_string($_POST['Table5Criteria'])."',			table6 = '".DB_escape_string($_POST['Table6'])."',			table6criteria = '".DB_escape_string($_POST['Table6Criteria'])."'		WHERE id =".$ReportID.";";	$Result=DB_query($sql,$db,'','',false,true);	return true;}function UpdateSequence($EntryType) {	global $db, $ReportID, $Type;	if (!isset($_POST['Visible'])) $_POST['Visible'] = '0';	if (!isset($_POST['ColumnBreak'])) $_POST['ColumnBreak'] = '0';	if (!isset($_POST['Params'])) $Params = '0'; else $Params = $_POST['Params'];	$sql = "UPDATE ".DBRptFields." SET 			fieldname = '".DB_escape_string($_POST['FieldName'])."',			displaydesc = '".DB_escape_string($_POST['DisplayDesc'])."',			visible = '".$_POST['Visible']."',			columnbreak = '".$_POST['ColumnBreak']."' ";	// Only update params if not a form (cannot update params once initially set)	if ($Type<>'frm') $sql .= ", params = '".$Params."' ";	$sql .= "WHERE reportid = ".$ReportID." AND entrytype = '".$EntryType."' AND seqnum = ".$_POST['SeqNum'].";";	$Result=DB_query($sql,$db,'','',false,true);	return true;}function ChangeSequence($SeqNum, $EntryType, $UpDown) {	global $db, $ReportID;	// find the id of the row to move	$sql = "SELECT id FROM ".DBRptFields." 		WHERE reportid = ".$ReportID." AND entrytype = '".$EntryType."' AND seqnum = ".$SeqNum.";";	$Result=DB_query($sql,$db,'','',false,true);	$myrow = DB_fetch_row($Result);	$OrigID = $myrow[0];	if ($UpDown=='up') $NewSeqNum = $SeqNum-1; else $NewSeqNum = $SeqNum+1;	// first move affected sequence to seqnum, then seqnum to new position	$sql = "UPDATE ".DBRptFields." SET seqnum='".$SeqNum."' 		WHERE reportid = ".$ReportID." AND entrytype = '".$EntryType."' AND seqnum = ".$NewSeqNum.";";	$Result=DB_query($sql,$db,'','',false,true);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -