function newaiinit($fields, $mode) { global $common_html, $html_etc; global $return_sql_line, $db; global $action_add, $action_model; global $_POST, $_GET, $ROWS_PAGE, $mark; global $merge, $childnums, $childsums, $child_filter; global $SYSTEM_ADD_SQL; $fields = newaiinit_value($fields); if ($merge) { $fields = newai_merge($fields, $merge); } if ($childnums) { $fields = newai_childnums($fields, $childnums); } if ($childsums) { $fields = newai_childsums($fields, $childsums); } global $tablewidth; $tablewidth = $tablewidth != "" ? $tablewidth : 450; //增加对高级搜索支持 if ($_GET['actionadv'] == "exportadv_default") { newai_search($fields); } table_begin($tablewidth); show_search_element($mark); //“新建”按钮查询按钮的控制函数,此函数在newai.php中定义 newaiinit_view($fields); UserDefineFunction(); UserSumFunction($fields); //print_R($_REQUEST); if ($_GET['action'] == "") { $_GET['action'] = "init_default"; } if ($_REQUEST['action'] != "") { $_GET['action'] = $_REQUEST['action']; } //print_R($_GET); newaiinit_bottommemo(); newaiinit_bottom($fields['other']['rc'], $fields['other']['pageid'], $fields['other']['pagenums'], $ROWS_PAGE, $add = 'action', $add_var = $_GET['action']); table_end(); }
function newaiReport($fields, $list, $mode) { global $html_etc, $tablename, $common_html, $custom_type; global $db, $return_sql_line, $columns; global $_POST, $_GET, $returnmodel, $primarykey_index; global $action_submit, $merge, $form_attribute; //列表及数组转化区 global $showlistfieldlist, $showlistfieldfilter; $showlistfieldlistArray = explode(',', $showlistfieldlist); $showlistfieldfilterArray = explode(',', $showlistfieldfilter); //SQL语句初始化区 $fields['other']['title'] = $common_html['common_html'][$mode]; $_GET[$primarykey_index] = $list; $return_sql_line = return_sql_line($fields); $SQL = $return_sql_line['select_sql']; //print $SQL; //多项数据搜索部分 如果定义了外部SQL语句,即结果集为多数据时采用外部SQL语句 global $NEWAI_REPORT_SEARCH_SYSTEM; if (strlen($NEWAI_REPORT_SEARCH_SYSTEM) > 10 && $mode == "Multiple") { $SQL = $NEWAI_REPORT_SEARCH_SYSTEM; } //定义要显示的结果集,默认为30个结果集 global $totalnumber; $totalnumber == "" ? $totalnumber = 30 : ''; //执行SQL语言部分 $result = $db->CacheSelectLimit(15, $SQL, $totalnumber, 0); $rs_array = $result->GetArray(); //数据显示区,其含数据过滤部分 for ($h = 0; $h < sizeof($rs_array); $h++) { $ReportData = $rs_array[$h]; //数据过滤区 - Begin ################################################# for ($f = 0; $f < sizeof($showlistfieldlistArray); $f++) { $filterIndex = $showlistfieldlistArray[$f]; //索引列表值 $filterType = $showlistfieldfilterArray[$f]; //过滤列表值 $filterName = $columns[$filterIndex]; //列表名称 $TypeNameFilterArray = explode(':', $filterType); //对应的过滤数组 switch ($TypeNameFilterArray[0]) { case 'input': break; case 'boolean': $ReportData[$filterName] = returnboolean($ReportData[$filterName]); break; case 'tablefilter': $filterTableName = $TypeNameFilterArray[1]; $filterTableColumns = returntablecolumn($filterTableName); $filterTableFieldID = $filterTableColumns[(string) $TypeNameFilterArray[2]]; $filterTableFieldName = $filterTableColumns[(string) $TypeNameFilterArray[3]]; $filterResultText = returntablefield($filterTableName, $filterTableFieldID, $ReportData[$filterName], $filterTableFieldName); $ReportData[$filterName] = $filterResultText; break; case 'userdefine': $filtervalue = $fields['value'][$counter][$list_index]; $functionName = $TypeNameFilterArray[1]; $fileName = $functionName . ".php"; $fileName0 = "userdefine/{$fileName}"; $fileName = "../../Enginee/userdefine/{$fileName}"; if (file_exists($fileName0)) { require_once $fileName0; $functionName = $functionName . "_Value"; if (function_exists($functionName)) { $ReportData[$filterName] = $functionName($fields['value'][$counter][$list_index], $fields, $counter); } } else { if (file_exists($fileName)) { require_once $fileName; $functionName = $functionName . "_Value"; if (function_exists($functionName)) { $ReportData[$filterName] = $functionName($fields['value'][$counter][$list_index], $fields, $counter); } else { print "函数名称[{$functionName}]不存在!"; } } else { print "没有相应文件,文件名:{$fileName}"; } } break; } } //数据过滤区 - End ################################################## print "<BR>"; table_begin("80%"); print "<TR class=TableHeader>"; print "<TD noWrap colspan=4>" . $html_etc[$tablename][$tablename] . $common_html['common_html']['report'] . " </TD>"; print "</TR>"; $Counter = 0; for ($i = 0; $i < sizeof($showlistfieldlistArray); $i += 2) { $fieldName1 = (string) $columns[(string) $showlistfieldlistArray[$i]]; $k = $i + 1; $fieldName2 = (string) $columns[(string) $showlistfieldlistArray[$k]]; print "<TR class=TableData>"; print "<TD noWrap width=15%>" . $html_etc[$tablename][$fieldName1] . " </TD>"; print "<TD width=35%>" . $ReportData[$fieldName1] . " </TD>"; print "<TD noWrap width=15%>" . $html_etc[$tablename][$fieldName2] . " </TD>"; print "<TD width=35%>" . $ReportData[$fieldName2] . " </TD>"; print "</TR>"; } table_end(); } //end of rs_array //############################################################################## //实现子目录列表 global $child_tablename, $child_showlistfieldlist; global $child_partent, $child_showlistfieldfilter; //子目录列表开始 if ($child_tablename != "" && $child_showlistfieldlist != "") { $child_columns = returntablecolumn($child_tablename); $child_html_etc = returnsystemlang($child_tablename); table_begin("80%"); print "<TR class=TableHeader>"; print "<TD noWrap width=100% colspan=32>" . $child_html_etc[$child_tablename]["list" . $child_tablename] . " </td>"; print "</TR>"; print "<TR class=TableHeader>"; $child_showlistfieldlist_Array = explode(",", $child_showlistfieldlist); $child_showlistfieldfilter_Array = explode(",", $child_showlistfieldfilter); for ($i = 0; $i < sizeof($child_showlistfieldlist_Array); $i++) { $child_index = $child_showlistfieldlist_Array[$i]; $indexName = $child_columns[$child_index]; print "<TD noWrap>" . $child_html_etc[$child_tablename][$indexName] . " </td>"; } print "</TR>"; //子表与父表关联部分 $child_partent_Array = explode(":", $child_partent); $sql = "select * from {$child_tablename} where " . $child_columns[(string) $child_partent_Array[0]] . "='" . $list . "'"; $rs = $db->CacheExecute(150, $sql); $rs_a = $rs->GetArray(); for ($i = 0; $i < sizeof($rs_a); $i++) { print "<TR class=TableData>"; for ($j = 0; $j < sizeof($child_showlistfieldlist_Array); $j++) { $child_index = $child_showlistfieldlist_Array[$j]; $indexName = $child_columns[$child_index]; $ChildValue = $rs_a[$i][$indexName]; $filterType = $child_showlistfieldfilter_Array[$j]; $TypeNameFilterArray = explode(":", $filterType); switch ($TypeNameFilterArray[0]) { case 'input': break; case 'boolean': $ChildValue = returnboolean($ChildValue); break; case 'tablefilter': $filterTableName = $TypeNameFilterArray[1]; $filterTableColumns = returntablecolumn($filterTableName); $filterTableFieldID = $filterTableColumns[(string) $TypeNameFilterArray[2]]; $filterTableFieldName = $filterTableColumns[(string) $TypeNameFilterArray[3]]; $filterResultText = returntablefield($filterTableName, $filterTableFieldID, $ChildValue, $filterTableFieldName); $ChildValue = $filterResultText; break; } print "<TD noWrap>" . $ChildValue . " </td>"; } print "</TR>"; } UserDefineFunction($list); table_end(); print "<BR>"; print "<hr width=\"80%\" height=\"1\" align=\"{$align}\" color=\"white\">"; print "<BR>"; } //子目录列表结束 //############################################################################## }