📄 reportcreator.php
字号:
// read back in new data for next screen (will set defaults as defined in the db) $sql = "SELECT * FROM ".DBReports." WHERE id='".$ReportID."'"; $Result=DB_query($sql,$db,'','',false,true); $myrow = DB_fetch_array($Result); $FormParams = PrepStep('3'); break; case RPT_BTN_CONT: // fetch the report information and go to the page setup screen $success = UpdatePageFields($ReportID); // read in the data for the next form $sql = "SELECT table1, table2, table2criteria, table3, table3criteria, table4, table4criteria, table5, table5criteria, table6, table6criteria, reportname FROM " . DBReports . " WHERE id='".$ReportID."'"; $Result=DB_query($sql,$db,'','',false,true); $myrow = DB_fetch_array($Result); $numrows = DB_num_rows($Result); $FormParams = PrepStep('4'); break; case RPT_BTN_BACK: default: // bail to reports home $DropDownString = RetrieveReports(); $FormParams = PrepStep('1'); } break; case "step5": // entered from dbsetup page switch ($_POST['todo']) { case RPT_BTN_BACK: $sql = "SELECT * FROM ".DBReports." WHERE id='".$ReportID."'"; $Result=DB_query($sql,$db,'','',false,true); $myrow = DB_fetch_array($Result); $FormParams = PrepStep('3'); break; case RPT_BTN_UPDATE: case RPT_BTN_CONT: // fetch the report information and go to the page setup screen if ($_POST['Table1']) { $sql = "SELECT table1 FROM ".DBReports." WHERE id='".$ReportID."'"; $Result=DB_query($sql,$db,'','',false,true); $myrow = DB_fetch_row($Result); if ($myrow[0] != $_POST['Table1']) { unset($_POST['Table2']); unset($_POST['Table2Criteria']); unset($_POST['Table3']); unset($_POST['Table3Criteria']); unset($_POST['Table4']); unset($_POST['Table4Criteria']); unset($_POST['Table5']); unset($_POST['Table5Criteria']); unset($_POST['Table6']); unset($_POST['Table6Criteria']); } } $success = UpdateDBFields($ReportID); if (!$success OR $_POST['todo']==RPT_BTN_UPDATE) { // update fields and stay on this form if (!$success) $usrMsg[] = array('message'=>RPT_DUPDB, 'level'=>'error'); // read back in new data for next screen (will set defaults as defined in the db) $sql = "SELECT table1, table2, table2criteria, table3, table3criteria, table4, table4criteria, table5, table5criteria, table6, table6criteria, reportname FROM ".DBReports." WHERE id='".$ReportID."'"; $Result=DB_query($sql,$db,'','',false,true); $myrow = DB_fetch_array($Result); $FormParams = PrepStep('4'); break; } // read in fields and continue to next form $reportname = $_POST['ReportName']; $FieldListings = RetrieveFields('fieldlist'); $FormParams = PrepStep('5'); break; default: // bail to reports home $DropDownString = RetrieveReports(); $FormParams = PrepStep('1'); } break; case "step6": // entered from field setup page if (!isset($_POST['todo'])) { // then a sequence image button was pushed $SeqNum = $_POST['SeqNum']; //fetch the sequence number if (isset($_POST['up_x'])) { // the shift up button was pushed, check for not at first sequence if ($SeqNum<>1) $success = ChangeSequence($SeqNum, 'fieldlist', 'up'); $FieldListings = RetrieveFields('fieldlist'); } elseif (isset($_POST['dn_x'])) { // the shift down button was pushed $sql = "SELECT seqnum FROM ".DBRptFields." WHERE reportid = ".$ReportID." AND entrytype = 'fieldlist';"; $Result=DB_query($sql,$db,'','',false,true); if ($SeqNum<DB_num_rows($Result)) $success = ChangeSequence($SeqNum, 'fieldlist', 'down'); $FieldListings = RetrieveFields('fieldlist'); } elseif (isset($_POST['ed_x'])) { // the sequence edit button was pushed // pre fill form with the field to edit and change button name $FieldListings = RetrieveFields('fieldlist'); $sql = "SELECT * FROM ".DBRptFields." WHERE reportid = ".$ReportID." AND entrytype = 'fieldlist' AND seqnum=".$SeqNum.";"; $Result=DB_query($sql,$db,'','',false,true); $FieldListings['defaults'] = DB_fetch_array($Result); $FieldListings['defaults']['buttonvalue'] = RPT_BTN_CHANGE; } elseif (isset($_POST['rm_x'])) { // the sequence remove button was pushed $success = DeleteSequence($_POST['SeqNum'], 'fieldlist'); $FieldListings = RetrieveFields('fieldlist'); } $reportname = $_POST['ReportName']; $FormParams = PrepStep('5'); } else { switch ($_POST['todo']) { case RPT_BTN_BACK: $sql = "SELECT table1, table2, table2criteria, table3, table3criteria, table4, table4criteria, table5, table5criteria, table6, table6criteria, reportname FROM ".DBReports." WHERE id='".$ReportID."'"; $Result=DB_query($sql,$db,'','',false,true); $myrow = DB_fetch_array($Result); $FormParams = PrepStep('4'); break; case RPT_BTN_ADDNEW: case RPT_BTN_CHANGE: // error check input $IsValidField = ValidateField($ReportID, $_POST['FieldName'], $_POST['DisplayDesc']); if (!$IsValidField) { // then user entered a bad fieldname or description, error and reload $usrMsg[] = array('message'=>RPT_BADFLD, 'level'=>'error'); // reload form with bad data entered as field defaults, ready to be editted $FieldListings = RetrieveFields('fieldlist'); $FieldListings['defaults']['seqnum']=$_POST['SeqNum']; $FieldListings['defaults']['fieldname']=$_POST['FieldName']; $FieldListings['defaults']['displaydesc']=$_POST['DisplayDesc']; $FieldListings['defaults']['columnbreak']=$_POST['ColumnBreak']; $FieldListings['defaults']['visible']=$_POST['Visible']; $FieldListings['defaults']['params']=$_POST['Params']; if ($_POST['todo']==RPT_BTN_ADDNEW) { // add new so insert $FieldListings['defaults']['buttonvalue'] = RPT_BTN_ADDNEW; } else { // exists, so update it. $FieldListings['defaults']['buttonvalue'] = RPT_BTN_CHANGE; } $reportname = $_POST['ReportName']; $FormParams = PrepStep('5'); break; } if ($_POST['todo']==RPT_BTN_ADDNEW) { // add new so insert $_POST['SeqNum'] = InsertSequence($_POST['SeqNum'], 'fieldlist'); } else { // exists, so update it. $success = UpdateSequence('fieldlist'); } if ($Type<>'frm') { $FieldListings = RetrieveFields('fieldlist'); $reportname = $_POST['ReportName']; $FormParams = PrepStep('5'); break; } // Go to the properties screen for the field just entered case RPT_BTN_PROP: // Enter the properties of a given field // see what form needs to be loaded and load based on index stored in params variable $SeqNum = $_POST['SeqNum']; $sql = "SELECT id, displaydesc, params FROM ".DBRptFields." WHERE reportid = ".$ReportID." AND entrytype='fieldlist' AND seqnum = ".$SeqNum.";"; $Result = DB_query($sql,$db,'','',false,true); $myrow = DB_fetch_assoc($Result); $Params = unserialize($myrow['params']); $reportname = $_POST['ReportName']; $ButtonValue = RPT_BTN_ADDNEW; // default the field button to Add New for form entry $FormParams = PrepStep('prop'); $FormParams['id'] = $myrow['id']; $DisplayName = $myrow['displaydesc']; break; case RPT_BTN_CONT: // fetch the report information and go to the page setup screen $DateListings = RetrieveFields('dateselect'); $DateListings = $DateListings['lists'][0]; // only need the first field $TruncListings = RetrieveFields('trunclong'); $TruncListings = $TruncListings['lists'][0]; // only need the first field $SortListings = RetrieveFields('sortlist'); $GroupListings = RetrieveFields('grouplist'); $CritListings = RetrieveFields('critlist'); $reportname = $_POST['ReportName']; $FormParams = PrepStep('6'); break; default: // bail to reports home $DropDownString = RetrieveReports(); $FormParams = PrepStep('1'); break; } } break; case "step6a": // entered from properties page for fields $ButtonValue = RPT_BTN_ADDNEW; // default the field button to Add New unless overidden by the edit image pressed $reportname = $_POST['ReportName']; $SeqNum = $_POST['SeqNum']; // first fetch the original Params $sql = "SELECT id, params FROM ".DBRptFields." WHERE reportid = ".$ReportID." AND entrytype='fieldlist' AND seqnum = ".$SeqNum.";"; $Result = DB_query($sql,$db,'','',false,true); $myrow = DB_fetch_assoc($Result); $Params = unserialize($myrow['params']); if (!isset($_POST['todo'])) { // then a sequence image button was pushed, we must be in form table entry $success = ModFormTblEntry($Params); if (!$success) { // check for errors $usrMsg[] = array('message'=>RPT_BADDATA, 'level'=>'error'); } else { // update the database $sql = "UPDATE ".DBRptFields." SET params='".serialize($Params)."' WHERE id = ".$_POST['ID'].";"; $Result=DB_query($sql,$db,'','',false,true); if ($success=='edit') { // then the edit button was pressed, change button name from Add New to Change $ButtonValue = RPT_BTN_CHANGE; } } // Update field properties $FormParams = PrepStep('prop'); $FormParams['id'] = $myrow['id']; } else { // fetch the choices with the form post data foreach ($_POST as $key=>$value) $Params[$key]=$value; // check for what button or image was pressed switch ($_POST['todo']) { case RPT_BTN_CANCEL: $FieldListings = RetrieveFields('fieldlist'); $FormParams = PrepStep('5'); break; case RPT_BTN_ADD: case RPT_BTN_REMOVE: // For the total parameters gather the list of fieldnames // Process the button pushed if ($_POST['todo']==RPT_BTN_REMOVE) { // the remove button was pressed $Index = $_POST['FieldIndex']; if ($Index<>'') $Params['Seq'] = array_merge(array_slice($Params['Seq'],0,$Index),array_slice($Params['Seq'],$Index+1)); } else { // it's the add button, error check if ($_POST['TotalField']=='') { $usrMsg[] = array('message'=>RPT_BADFLD, 'level'=>'error'); // reload form with bad data entered as field defaults, ready to be editted $DisplayName =$_POST['DisplayName'];
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -