[Vtigercrm-commits] [vtiger-commits] r5594 - /vtigercrm/trunk/modules/Reports/
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Sat Apr 29 13:06:57 EDT 2006
Author: don
Date: Sat Apr 29 11:06:37 2006
New Revision: 5594
Log:
New UI has been integrated for Reports
Added:
vtigercrm/trunk/modules/Reports/ChangeFolder.php
vtigercrm/trunk/modules/Reports/ReportsAjax.php
Modified:
vtigercrm/trunk/modules/Reports/AdvancedFilter.php
vtigercrm/trunk/modules/Reports/CreatePDF.php
vtigercrm/trunk/modules/Reports/CreateXL.php
vtigercrm/trunk/modules/Reports/Delete.php
vtigercrm/trunk/modules/Reports/DeleteReportFolder.php
vtigercrm/trunk/modules/Reports/ListView.php
vtigercrm/trunk/modules/Reports/NewReport0.php
vtigercrm/trunk/modules/Reports/NewReport1.php
vtigercrm/trunk/modules/Reports/Report.js
vtigercrm/trunk/modules/Reports/ReportColumns.php
vtigercrm/trunk/modules/Reports/ReportColumnsTotal.php
vtigercrm/trunk/modules/Reports/ReportFilters.php
vtigercrm/trunk/modules/Reports/ReportGrouping.php
vtigercrm/trunk/modules/Reports/ReportRun.php
vtigercrm/trunk/modules/Reports/ReportType.php
vtigercrm/trunk/modules/Reports/Reports.php
vtigercrm/trunk/modules/Reports/Save.php
vtigercrm/trunk/modules/Reports/SaveAndRun.php
vtigercrm/trunk/modules/Reports/SaveReportFolder.php
vtigercrm/trunk/modules/Reports/StandardFilter.php
Modified: vtigercrm/trunk/modules/Reports/AdvancedFilter.php
==============================================================================
--- vtigercrm/trunk/modules/Reports/AdvancedFilter.php (original)
+++ vtigercrm/trunk/modules/Reports/AdvancedFilter.php Sat Apr 29 11:06:37 2006
@@ -8,80 +8,52 @@
* All Rights Reserved.
*
********************************************************************************/
-require_once('XTemplate/xtpl.php');
-require_once("data/Tracker.php");
-require_once('themes/'.$theme.'/layout_utils.php');
-require_once('include/logging.php');
-require_once('include/utils/utils.php');
-require_once('modules/Reports/Reports.php');
-require_once('include/database/PearDatabase.php');
-
-global $app_strings;
-global $app_list_strings;
-global $mod_strings;
-$current_module_strings = return_module_language($current_language, 'Reports');
-
-global $list_max_entries_per_page;
-global $urlPrefix;
-
-$log = LoggerManager::getLogger('adv_report');
-
-global $currentModule;
-global $image_path;
-global $theme;
-
-global $adv_filter_options;
-
-$adv_report=new XTemplate ('modules/Reports/AdvancedFilter.html');
-$adv_report->assign("MOD", $mod_strings);
-$adv_report->assign("APP", $app_strings);
-
if(isset($_REQUEST["record"]))
{
$reportid = $_REQUEST["record"];
-$oReport = new Reports();
+$oReport = new Reports($reportid);
$oReport->getAdvancedFilterList($reportid);
-$BLOCK1 = getPrimaryColumns_AdvFilterHTML($primarymodule,$oReport->advft_column[0]);
-$BLOCK1 .= getSecondaryColumns_AdvFilterHTML($secondarymodule,$oReport->advft_column[0]);
-$adv_report->assign("BLOCK1", $BLOCK1);
+$BLOCK1 = getPrimaryColumns_AdvFilterHTML($oReport->primodule,$oReport->advft_column[0]);
+$BLOCK1 .= getSecondaryColumns_AdvFilterHTML($oReport->secmodule,$oReport->advft_column[0]);
+$report_std_filter->assign("BLOCK1", $BLOCK1);
-$BLOCK2 = getPrimaryColumns_AdvFilterHTML($primarymodule,$oReport->advft_column[1]);
-$BLOCK2 .= getSecondaryColumns_AdvFilterHTML($secondarymodule,$oReport->advft_column[1]);
-$adv_report->assign("BLOCK2", $BLOCK2);
+$BLOCK2 = getPrimaryColumns_AdvFilterHTML($oReport->primodule,$oReport->advft_column[1]);
+$BLOCK2 .= getSecondaryColumns_AdvFilterHTML($oReport->secmodule,$oReport->advft_column[1]);
+$report_std_filter->assign("BLOCK2", $BLOCK2);
-$BLOCK3 = getPrimaryColumns_AdvFilterHTML($primarymodule,$oReport->advft_column[2]);
-$BLOCK3 .= getSecondaryColumns_AdvFilterHTML($secondarymodule,$oReport->advft_column[2]);
-$adv_report->assign("BLOCK3", $BLOCK3);
+$BLOCK3 = getPrimaryColumns_AdvFilterHTML($oReport->primodule,$oReport->advft_column[2]);
+$BLOCK3 .= getSecondaryColumns_AdvFilterHTML($oReport->secmodule,$oReport->advft_column[2]);
+$report_std_filter->assign("BLOCK3", $BLOCK3);
-$BLOCK4 = getPrimaryColumns_AdvFilterHTML($primarymodule,$oReport->advft_column[3]);
-$BLOCK4 .= getSecondaryColumns_AdvFilterHTML($secondarymodule,$oReport->advft_column[3]);
-$adv_report->assign("BLOCK4", $BLOCK4);
+$BLOCK4 = getPrimaryColumns_AdvFilterHTML($oReport->primodule,$oReport->advft_column[3]);
+$BLOCK4 .= getSecondaryColumns_AdvFilterHTML($oReport->secmodule,$oReport->advft_column[3]);
+$report_std_filter->assign("BLOCK4", $BLOCK4);
-$BLOCK5 = getPrimaryColumns_AdvFilterHTML($primarymodule,$oReport->advft_column[4]);
-$BLOCK5 .= getSecondaryColumns_AdvFilterHTML($secondarymodule,$oReport->advft_column[4]);
-$adv_report->assign("BLOCK5", $BLOCK5);
+$BLOCK5 = getPrimaryColumns_AdvFilterHTML($oReport->primodule,$oReport->advft_column[4]);
+$BLOCK5 .= getSecondaryColumns_AdvFilterHTML($oReport->secmodule,$oReport->advft_column[4]);
+$report_std_filter->assign("BLOCK5", $BLOCK5);
$FILTEROPTION1 = getAdvCriteriaHTML($oReport->advft_option[0]);
-$adv_report->assign("FOPTION1",$FILTEROPTION1);
+$report_std_filter->assign("FOPTION1",$FILTEROPTION1);
$FILTEROPTION2 = getAdvCriteriaHTML($oReport->advft_option[1]);
-$adv_report->assign("FOPTION2",$FILTEROPTION2);
+$report_std_filter->assign("FOPTION2",$FILTEROPTION2);
$FILTEROPTION3 = getAdvCriteriaHTML($oReport->advft_option[2]);
-$adv_report->assign("FOPTION3",$FILTEROPTION3);
+$report_std_filter->assign("FOPTION3",$FILTEROPTION3);
$FILTEROPTION4 = getAdvCriteriaHTML($oReport->advft_option[3]);
-$adv_report->assign("FOPTION4",$FILTEROPTION4);
+$report_std_filter->assign("FOPTION4",$FILTEROPTION4);
$FILTEROPTION5 = getAdvCriteriaHTML($oReport->advft_option[4]);
-$adv_report->assign("FOPTION5",$FILTEROPTION5);
+$report_std_filter->assign("FOPTION5",$FILTEROPTION5);
-$adv_report->assign("VALUE1",$oReport->advft_value[0]);
-$adv_report->assign("VALUE2",$oReport->advft_value[1]);
-$adv_report->assign("VALUE3",$oReport->advft_value[2]);
-$adv_report->assign("VALUE4",$oReport->advft_value[3]);
-$adv_report->assign("VALUE5",$oReport->advft_value[4]);
+$report_std_filter->assign("VALUE1",$oReport->advft_value[0]);
+$report_std_filter->assign("VALUE2",$oReport->advft_value[1]);
+$report_std_filter->assign("VALUE3",$oReport->advft_value[2]);
+$report_std_filter->assign("VALUE4",$oReport->advft_value[3]);
+$report_std_filter->assign("VALUE5",$oReport->advft_value[4]);
}else
{
@@ -89,11 +61,11 @@
$secondarymodule = $_REQUEST["secondarymodule"];
$BLOCK1 = getPrimaryColumns_AdvFilterHTML($primarymodule);
$BLOCK1 .= getSecondaryColumns_AdvFilterHTML($secondarymodule);
-$adv_report->assign("BLOCK1", $BLOCK1);
-$adv_report->assign("BLOCK2", $BLOCK1);
-$adv_report->assign("BLOCK3", $BLOCK1);
-$adv_report->assign("BLOCK4", $BLOCK1);
-$adv_report->assign("BLOCK5", $BLOCK1);
+$report_std_filter->assign("BLOCK1", $BLOCK1);
+$report_std_filter->assign("BLOCK2", $BLOCK1);
+$report_std_filter->assign("BLOCK3", $BLOCK1);
+$report_std_filter->assign("BLOCK4", $BLOCK1);
+$report_std_filter->assign("BLOCK5", $BLOCK1);
}
@@ -108,9 +80,7 @@
global $ogReport;
global $app_list_strings;
global $current_language;
-
$mod_strings = return_module_language($current_language,$module);
-
foreach($ogReport->module_list[$module] as $key=>$value)
{
$shtml .= "<optgroup label=\"".$app_list_strings['moduleList'][$module]." ".$key."\" class=\"select\" style=\"border:none\">";
@@ -223,7 +193,5 @@
return $shtml;
}
-$adv_report->parse("main");
-$adv_report->out("main");
?>
Modified: vtigercrm/trunk/modules/Reports/CreatePDF.php
==============================================================================
--- vtigercrm/trunk/modules/Reports/CreatePDF.php (original)
+++ vtigercrm/trunk/modules/Reports/CreatePDF.php Sat Apr 29 11:06:37 2006
@@ -370,7 +370,7 @@
$count = 0;
foreach($arr_val[0] as $key=>$value)
{
- $headerHTML .= '<td width="'.$col_width[$count].'" bgcolor="#a2c8f3">'.$key.'</td>';
+ $headerHTML .= '<td width="'.$col_width[$count].'" bgcolor="#DDDDDD">'.$key.'</td>';
$count = $count + 1;
}
Modified: vtigercrm/trunk/modules/Reports/CreateXL.php
==============================================================================
--- vtigercrm/trunk/modules/Reports/CreateXL.php (original)
+++ vtigercrm/trunk/modules/Reports/CreateXL.php Sat Apr 29 11:06:37 2006
@@ -33,8 +33,10 @@
# Write out the data
$reportid = $_REQUEST["record"];
$oReport = new Reports($reportid);
-$filtercolumn = $stdDateFilterField;
-$filter = $stdDateFilter;
+$filtercolumn = $_REQUEST['stdDateFilterField'];
+$filter = $_REQUEST['stdDateFilter'];
+$startdate = $_REQUEST['startdate'];
+$enddate = $_REQUEST['enddate'];
$oReportRun = new ReportRun($reportid);
$filterlist = $oReportRun->RunTimeFilter($filtercolumn,$filter,$startdate,$enddate);
Modified: vtigercrm/trunk/modules/Reports/Delete.php
==============================================================================
--- vtigercrm/trunk/modules/Reports/Delete.php (original)
+++ vtigercrm/trunk/modules/Reports/Delete.php Sat Apr 29 11:06:37 2006
@@ -12,16 +12,29 @@
require_once('include/logging.php');
require_once('include/database/PearDatabase.php');
-global $adb;
+if(isset($_REQUEST['idlist']) && $_REQUEST['idlist']!= '')
+{
+ $id_array = Array();
+ $id_array = explode(':',$_REQUEST['idlist']);
+ for($i = 0;$i < count($id_array)-1;$i++)
+ {
+ DeleteReport($id_array[$i]);
+ }
+ header("Location: index.php?action=ReportsAjax&file=ListView&mode=ajax&module=Reports");
+}elseif(isset($_REQUEST['record']) && $_REQUEST['record']!= '')
+{
+ $id = $_REQUEST["record"];
+ DeleteReport($id);
+ header("Location: index.php?action=ReportsAjax&file=ListView&mode=ajaxdelete&module=Reports");
+}
-$reportid = $_REQUEST["record"];
-if($reportid != "")
+function DeleteReport($reportid)
{
+ global $adb;
$idelreportsql = "delete from selectquery where queryid=".$reportid;
$idelreportsqlresult = $adb->query($idelreportsql);
$ireportsql = "delete from report where reportid=".$reportid;
- $ireportsqlresult = $adb->query($ireportsql);
+ $ireportsqlresult = $adb->query($ireportsql);
}
-header("Location: index.php?action=index&module=Reports");
?>
Modified: vtigercrm/trunk/modules/Reports/DeleteReportFolder.php
==============================================================================
--- vtigercrm/trunk/modules/Reports/DeleteReportFolder.php (original)
+++ vtigercrm/trunk/modules/Reports/DeleteReportFolder.php Sat Apr 29 11:06:37 2006
@@ -8,29 +8,20 @@
* All Rights Reserved.
*
********************************************************************************/
-require_once('modules/Reports/Reports.php');
require_once('include/logging.php');
require_once('include/database/PearDatabase.php');
global $adb;
$local_log =& LoggerManager::getLogger('index');
-$focus = new Reports();
-
$rfid = $_REQUEST['record'];
-
-if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") $return_module = $_REQUEST['return_module'];
-else $return_module = "Reports";
-if(isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "") $return_action = $_REQUEST['return_action'];
-else $return_action = "index";
-
if($rfid != "")
{
$sql .= "delete from reportfolder where folderid=".$rfid;
$result = $adb->query($sql);
if($result!=false)
{
- header("Location: index.php?action=$return_action&module=$return_module");
+ header("Location: index.php?action=ReportsAjax&mode=ajax&file=ListView&module=Reports");
}else
{
include('themes/'.$theme.'/header.php');
Modified: vtigercrm/trunk/modules/Reports/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Reports/ListView.php (original)
+++ vtigercrm/trunk/modules/Reports/ListView.php Sat Apr 29 11:06:37 2006
@@ -8,8 +8,8 @@
* All Rights Reserved.
*
********************************************************************************/
-require_once('XTemplate/xtpl.php');
require_once("data/Tracker.php");
+require_once('Smarty_setup.php');
require_once('themes/'.$theme.'/layout_utils.php');
require_once('include/logging.php');
require_once('include/utils/utils.php');
@@ -31,26 +31,40 @@
global $image_path;
global $theme;
+global $theme;
+$theme_path="themes/".$theme."/";
+$image_path=$theme_path."images/";
// focus_list is the means of passing data to a ListView.
global $focus_list;
-$list_report_form=new XTemplate ('modules/Reports/ListView.html');
+$list_report_form = new vtigerCRM_Smarty;
$list_report_form->assign("MOD", $mod_strings);
$list_report_form->assign("APP", $app_strings);
-
+$list_report_form->assign("APPLIST", $app_list_strings);
$list_report_form->assign("IMAGE_PATH", $image_path);
-//report creation button
-$newrpt_button = '<input type="button" class="button" name="newReport" value="'.$mod_strings[LBL_REP_BUTTON].'" onclick=invokeAction("newReport") >';
-//report folder creation button
-$newrpt_fldr_button = '<input type="button" class="button" name="newReportFolder" value="'.$mod_strings[LBL_REP_FOLDER_BUTTON].'" onclick=invokeAction("newReportFolder") >';
-
+$list_report_form->assign("CATEGORY",getParentTab());
+$list_report_form->assign("MODULE",$currentModule);
$list_report_form->assign("NEWRPT_BUTTON",$newrpt_button);
$list_report_form->assign("NEWRPT_FLDR_BUTTON",$newrpt_fldr_button);
$repObj = new Reports ();
-$list_report_form->assign("REPT_FLDR_BLK",$repObj->sgetRptFldr());
-$list_report_form->assign("JAVASCRIPT","<script language='Javascript'>".$repObj->sgetJsRptFldr()."</script>");
-$list_report_form->parse("main");
-$list_report_form->out("main");
+$list_report_form->assign("REPT_FLDR",$repObj->sgetRptFldr('SAVED'));
+$cusFldrDtls = Array();
+$cusFldrDtls = $repObj->sgetRptFldr('CUSTOMIZED');
+$list_report_form->assign("REPT_CUSFLDR",$cusFldrDtls);
+foreach($cusFldrDtls as $entries)
+{
+ $fldrids_lists [] =$entries['id'];
+}
+if(count($fldrids_lists) > 0)
+ $list_report_form->assign("FOLDE_IDS",implode(',',$fldrids_lists));
+$list_report_form->assign("REPT_MODULES",getReportsModuleList());
+$list_report_form->assign("REPT_FOLDERS",$repObj->sgetRptFldr());
+if($_REQUEST['mode'] == 'ajax')
+ $list_report_form->display("ReportsCustomize.tpl");
+elseif($_REQUEST['mode'] == 'ajaxdelete')
+ $list_report_form->display("ReportContents.tpl");
+else
+ $list_report_form->display("Reports.tpl");
?>
Modified: vtigercrm/trunk/modules/Reports/NewReport0.php
==============================================================================
--- vtigercrm/trunk/modules/Reports/NewReport0.php (original)
+++ vtigercrm/trunk/modules/Reports/NewReport0.php Sat Apr 29 11:06:37 2006
@@ -8,7 +8,7 @@
* All Rights Reserved.
*
********************************************************************************/
-require_once('XTemplate/xtpl.php');
+require_once('Smarty_setup.php');
require_once("data/Tracker.php");
require_once('themes/'.$theme.'/layout_utils.php');
require_once('include/logging.php');
@@ -27,90 +27,21 @@
global $theme;
global $focus_list;
-echo get_module_title($mod_strings['LBL_MODULE_NAME'],$mod_strings['LBL_CREATE_REPORT'], true);
-echo "\n<BR>\n";
-
-/** Function to get the primary module list in reports
- * This function generates the list of primary modules in reports
- * and returns the module in a combo HTML values
- */
-
-function getPrimaryModuleList()
-{
- global $adb;
- global $app_list_strings;
- global $report_modules;
- global $mod_strings;
-
- $count_flag = 0;
- foreach($app_list_strings['moduleList'] as $key=>$value)
- {
- for($i=0;$i<count($report_modules);$i++)
- {
- if($key == $report_modules[$i])
- {
- if(isPermitted($key,'index') == "yes")
- {
- $count_flag = 1;
- $shtml .= "<option value=\"$key\">$value</option>";
- }
- }
- }
-
- }
- if($count_flag == 0)
- {
- $shtml .= "<option value=\"\">".$mod_strings['LBL_NO_PERMISSION']."</option>";
- }
- return $shtml;
-}
-
-/** Function to get the Related module list in reports
- * This function generates the list of secondary modules in reports
- * and returns the related module in a combo HTML values
- */
-
-function getRelatedModuleList()
-{
- global $app_list_strings;
- global $related_modules;
- global $mod_strings;
-
- foreach($related_modules as $key_module=>$rel_modules)
- {
- if(isPermitted($key_module,'index') == "yes")
- {
- $shtml .= "<select id='".$key_module."relatedmodule' name='".$key_module."relatedmodule[]' class='select' style='width:150;'>";
- $shtml .= "<option value=''>--None--</option>";
-
- $optionhtml = "";
- foreach($rel_modules as $rep_key=>$rep_value)
- {
- if($rep_value != '')
- {
- if(isPermitted($rep_value,'index') == "yes")
- {
- $optionhtml .= "<option value='".$rep_value."'>".$app_list_strings['moduleList'][$rep_value]."</option>";
- }
- }
- }
- $shtml .= $optionhtml."</select>";
- }
- }
-
- return $shtml;
-}
-
-$primary_module_html = getPrimaryModuleList();
-$related_module_html = getRelatedModuleList();
-$list_report_form=new XTemplate ('modules/Reports/NewReport0.html');
+$theme_path="themes/".$theme."/";
+$image_path=$theme_path."images/";
+require_once($theme_path.'layout_utils.php');
+$list_report_form = new vtigerCRM_Smarty;
$list_report_form->assign("MOD", $mod_strings);
$list_report_form->assign("APP", $app_strings);
-$list_report_form->assign("PRIMARYMODULE",$primary_module_html);
-$list_report_form->assign("RELATEDMODULES",$related_module_html);
+if($_REQUEST['reportmodule'] != '')
+{
+ $list_report_form->assign("RELATEDMODULES",getReportRelatedModules($_REQUEST['reportmodule']));
+ $list_report_form->assign("REP_MODULE",$_REQUEST['reportmodule']);
+}
+$repObj = new Reports ();
+$list_report_form->assign("REP_FOLDERS",$repObj->sgetRptFldr());
$list_report_form->assign("IMAGE_PATH", $image_path);
$list_report_form->assign("ERROR_MSG", $mod_strings['LBL_NO_PERMISSION']);
-$list_report_form->parse("main");
-$list_report_form->out("main");
+$list_report_form->display("ReportsStep0.tpl");
?>
Modified: vtigercrm/trunk/modules/Reports/NewReport1.php
==============================================================================
--- vtigercrm/trunk/modules/Reports/NewReport1.php (original)
+++ vtigercrm/trunk/modules/Reports/NewReport1.php Sat Apr 29 11:06:37 2006
@@ -8,12 +8,12 @@
* All Rights Reserved.
*
********************************************************************************/
-require_once('XTemplate/xtpl.php');
require_once("data/Tracker.php");
require_once('themes/'.$theme.'/layout_utils.php');
require_once('include/logging.php');
require_once('include/utils/utils.php');
require_once('modules/Reports/Reports.php');
+require_once('Smarty_setup.php');
global $app_strings;
global $app_list_strings;
@@ -29,19 +29,16 @@
// focus_list is the means of passing data to a ListView.
global $focus_list;
-if(isset($_REQUEST["record"]))
-{
- echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_CUSTOMIZE_REPORT'], true);
- echo "\n<BR>\n";
-}else
-{
- echo get_module_title($mod_strings['LBL_MODULE_NAME'],$mod_strings['LBL_CREATE_REPORT'], true);
- echo "\n<BR>\n";
-
-}
+$theme_path="themes/".$theme."/";
+$image_path=$theme_path."images/";
+require_once($theme_path.'layout_utils.php');
+$list_report_form = new vtigerCRM_Smarty;
+$list_report_form->assign("MOD", $mod_strings);
+$list_report_form->assign("APP", $app_strings);
if(isset($_REQUEST["record"]))
{
$reportid = $_REQUEST["record"];
+ $list_report_form->assign('REPORT_ID',$reportid);
$oReport = new Reports($reportid);
$primarymodule = $oReport->primodule;
$secondarymodule = $oReport->secmodule;
@@ -54,201 +51,20 @@
$ogReport->getSecModuleColumnsList($oReport->secmodule);
}else
{
- $primarymodule=$_REQUEST["primarymodule"];
- $secondarymodule=$_REQUEST["secondarymodule"];
+ $primarymodule = $_REQUEST["primarymodule"];
+ $secondarymodule = $_REQUEST["secondarymodule"];
+ $reportname = $_REQUEST["reportname"];
+ $reportdescription = $_REQUEST["reportdes"];
+ $folderid = $_REQUEST["reportfolder"];
$ogReport = new Reports();
$ogReport->getPriModuleColumnsList($primarymodule);
$ogReport->getSecModuleColumnsList($secondarymodule);
}
+$list_report_form->assign('PRI_MODULE',$primarymodule);
+$list_report_form->assign('SEC_MODULE',$secondarymodule);
+$list_report_form->assign('REPORT_NAME',$reportname);
+$list_report_form->assign('REPORT_DESC',$reportdescription);
+$list_report_form->assign('FOLDERID',$folderid);
+$list_report_form->assign("IMAGE_PATH", $image_path);
+$list_report_form->display("ReportsStep1.tpl");
?>
-<script language="JavaScript" type="text/JavaScript" src="include/js/general.js"></script>
-<script language="JavaScript" type="text/JavaScript">
- function switchToStep( num )
- {
- if( num == 1 )
- {
- document.StepOne.submit();
- }
- }
-
- function hideTabs(hide)
- {
- if(hide == true)
- {
- getObj("tab3").style.display = "none";
- }
- else
- {
- getObj("tab3").style.display = "block";
- }
- }
-
- function showSaveDialog()
- {
- url = "index.php?module=Reports&action=SaveReport";
- window.open(url,"Save_Report","width=550,height=350,top=20,left=20;toolbar=no,status=no,menubar=no,directories=no,resizable=yes,scrollbar=no")
- }
-
- function saveAndRunReport()
- {
- if(selectedColumnsObj.options.length == 0)
- {
- alert("Selected Columns cannot be empty");
- return false;
- }
-
- formSelectColumnString();
- if( trim(getObj( 'record' ).value) == "" )
- {
- showSaveDialog();
- document.NewReport.action = "index.php?action=Save&module=Reports";
- }
- else
- {
- document.NewReport.submit();
- }
- }
-
- function saveAsNewAndRunReport()
- {
- formSelectColumnString();
- showSaveDialog();
- }
-
- function cancelWizard()
- {
- document.location.href = "index.php?module=Reports&action=index";
- }
- function updateYAxisFields( colToTotalField, value, bool )
- {
- }
-
- function updateXAxisFields( value, label )
- {
- }
-
- function displayStep( num )
- {
- if( num == 3 || num == 6 )
- {
- var typeObj = getObj( 'reportType' );
- if( typeObj[0].checked == true )
- {
- return;
- }
- }
-
- for( i=1; i <= 5; i++ )
- {
- var stepId = "step" + i;
- var tabId = "tab" + i;
- if( i != num )
- {
- //getObj( tabId ).className= "tabOff"
- getObj( stepId ).style.display = "none";
- }
- else
- {
- //getObj( tabId ).className = "tabOn";
- getObj( stepId ).style.display = "block";
- }
- }
- }
- </script>
-<style>
- .step1, .step2 {
- padding: 5;
- font-family: Verdana, Arial, Helvetica, Sans-serif;
- font-size: 11px;
- font-weight: bold;
- color: #999;
- background-color: #E9E9E9;
- }
- .step2 {
- color: #000;
- background-color: #FC6;
- }
- </style>
-
-<div style="margin:10 0 10 0"><?php echo $mod_strings['LBL_NEW_REP1_HDR1']; ?></div>
-<form method='post' name="NewReport" action='index.php'>
- <input type="hidden" name='modulesString' value=''/>
- <input type="hidden" name='primarymodule' value="<?php echo $primarymodule?>"/>
- <input type="hidden" name='secondarymodule' value="<?php echo $secondarymodule?>"/>
- <input type="hidden" name='record' value="<?php echo $reportid?>"/>
- <input type="hidden" name='module' value='Reports'/>
- <input type="hidden" name='reload' value='true'/>
- <input type="hidden" name='action' value='Save'/>
- <input type="hidden" name='reportName' value="<?php echo $reportname?>"/>
- <input type="hidden" name='reportDesc' value="<?php echo $reportdescription?>"/>
- <input type="hidden" name='folder' value="<?php echo $folderid?>"/>
- <table width="80%" border="0" cellspacing="0" cellpadding="2" class="formOuterBorder" id='tab1'>
- <tr>
- <td class="formSecHeader"><a href="javascript:displayStep(1)" class="tabLink"><?php echo $mod_strings['LBL_REPORT_TYPE']; ?></a></td>
- </tr>
- </table>
- <table width="80%" border="0" cellspacing="0" cellpadding="2" class="formOuterBorder" id='step1' style="display:block">
- <tr>
- <td>
- <?php include("modules/Reports/ReportType.php");?>
- </td>
- </table>
- <table width="80%" border="0" cellspacing="0" cellpadding="2" class="formOuterBorder" id='tab2' style="margin-top:1px;">
- <tr>
- <td class="formSecHeader"><a href="javascript:displayStep(2)" class="tabLink"><?php echo $mod_strings['LBL_SELECT_COLUMNS']; ?></a></td>
- </tr>
- </table>
- <table width="80%" border="0" cellspacing="0" cellpadding="2" class="formOuterBorder" id='step2' style="display:none">
- <tr>
- <td>
- <?php include("modules/Reports/ReportColumns.php");?>
- </td>
- </table>
- <table width="80%" border="0" cellspacing="0" cellpadding="2" class="formOuterBorder" id='tab3' style="margin-top:1px;">
- <tr>
- <td class="formSecHeader"><a href="javascript:displayStep(3)" class="tabLink"><?php echo $mod_strings['LBL_SPECIFY_GROUPING']; ?></a></td>
- </tr>
- </table>
- <table width="80%" border="0" cellspacing="0" cellpadding="2" class="formOuterBorder" id='step3' style="display:none">
- <tr>
- <td>
- <?php include("modules/Reports/ReportGrouping.php");?>
- </td>
- </table>
- <table width="80%" border="0" cellspacing="0" cellpadding="2" class="formOuterBorder" id='tab4' style="margin-top:1px;">
- <tr>
- <td class="formSecHeader"><a href="javascript:displayStep(4)" class="tabLink"><?php echo $mod_strings['LBL_COLUMNS_TO_TOTAL']; ?></a></td>
- </tr>
- </table>
- <table width="80%" border="0" cellspacing="0" cellpadding="2" class="formOuterBorder" id='step4' style="display:none">
- <tr>
- <td>
- <?php include("modules/Reports/ReportColumnsTotal.php");?>
- </td>
- </table>
- <table width="80%" border="0" cellspacing="0" cellpadding="2" class="formOuterBorder" id='tab5' style="margin-top:1px;">
- <tr>
- <td class="formSecHeader"><a href="javascript:displayStep(5)" class="tabLink"><?php echo $mod_strings['LBL_SPECIFY_CRITERIA'];?></a></td>
- </tr>
- </table>
- <table width="80%" border="0" cellspacing="0" cellpadding="2" class="formOuterBorder" id='step5' style="display:none">
- <tr>
- <td>
- <?php include("modules/Reports/ReportFilters.php");?>
- </td>
- </table>
- <table width="80%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td> <div align="center"><br>
- <input name="btnSaveAndRun" class="button" type="button" value="<?php echo $mod_strings['LBL_SAVERUN_BUTTON'];?>" onclick='saveAndRunReport()'/>
- <input name="cancel" class="button" type="button" value="<?php echo $app_strings['LBL_CANCEL_BUTTON_LABEL'];?>" onClick="cancelWizard()">
- </div></td>
- </tr>
- </table>
-</form>
-<script>
- displayStep(1);
- setObjects();
- var obj = getObj( "reportType" );
- hideTabs( obj[0].checked );
-</script>
Modified: vtigercrm/trunk/modules/Reports/Report.js
==============================================================================
--- vtigercrm/trunk/modules/Reports/Report.js (original)
+++ vtigercrm/trunk/modules/Reports/Report.js Sat Apr 29 11:06:37 2006
@@ -141,25 +141,8 @@
goToURL( "?module=Reports&action=NewReport0&return_module=Reports&return_action=index" );
return;
}
- if( actionName == "newReportFolder" )
- {
- goToURL( "?module=Reports&action=NewReportFolder&return_module=Reports&return_action=index" );
- return;
- }
goToURL( "/crm/ScheduleReport.do?step=showAllSchedules" );
}
-function showRelatedModules(currmodule)
- {
- for (i=0;i<getObj("primarymodule").length;i++)
- {
- var moduleopt=getObj("primarymodule")[i].value
- if (currmodule==i)
- getObj(moduleopt+"relatedmodule").style.display="block"
- else
- getObj(moduleopt+"relatedmodule").style.display="none"
- }
- }
-
function verify_data(form) {
var isError = false;
var errorMessage = "";
@@ -339,15 +322,16 @@
if( !emptyCheck( "reportName", "Report Name" ) )
return false;
- var repNameObj = getOpenerObj( "reportName" );
- var repDescObj = getOpenerObj( "reportDesc" );
- var folderObj = getOpenerObj( "folder" );
- var actionObj = getOpenerObj( "actionItem" );
- var formObj = getOpenerObj( "NewReport" );
+ var repNameObj = getObj( "reportName" );
+ var repDescObj = getObj( "reportDesc" );
+ var folderObj = getObj( "folder" );
+ var actionObj = getObj( "actionItem" );
+ var formObj = getObj( "NewReport" );
+ alert(repNameObj+'=='+repDescObj+'=='+folderObj+'=='+actionObj+'=='+formObj);
if( dlgType == "save" )
{
- formObj = getOpenerObj( "NewReport" );
- if( getOpenerObj( 'reportId' ) != null )
+ formObj = getObj( "NewReport" );
+ if( getObj( 'reportId' ) != null )
{
formObj.removeChild( getOpenerObj( 'reportId' ) );
}
@@ -366,4 +350,191 @@
window.self.close();
return false;
}
-
+ function switchToStep( num )
+ {
+ if( num == 1 )
+ {
+ document.StepOne.submit();
+ }
+ }
+
+ function hideTabs()
+ {
+ var objreportType = getObj('reportType');
+ if(objreportType[0].checked == true)
+ {
+ divarray = new Array('step1','step2','step4','step5');
+ }
+ else
+ {
+ divarray = new Array('step1','step2','step3','step4','step5');
+ }
+ }
+
+ function showSaveDialog()
+ {
+ url = "index.php?module=Reports&action=SaveReport";
+ window.open(url,"Save_Report","width=550,height=350,top=20,left=20;toolbar=no,status=no,menubar=no,directories=no,resizable=yes,scrollbar=no")
+ }
+
+ function saveAndRunReport()
+ {
+ if(selectedColumnsObj.options.length == 0)
+ {
+ alert("Selected Columns cannot be empty");
+ return false;
+ }
+
+ formSelectColumnString();
+ if( trim(getObj( 'record' ).value) == "" )
+ {
+ saveReport( 'save' );
+ }
+ else
+ {
+ document.NewReport.submit();
+ }
+ }
+
+ function saveAsNewAndRunReport()
+ {
+ formSelectColumnString();
+ showSaveDialog();
+ }
+
+ function cancelWizard()
+ {
+ document.location.href = "index.php?module=Reports&action=index";
+ }
+ function updateYAxisFields( colToTotalField, value, bool )
+ {
+ }
+
+ function updateXAxisFields( value, label )
+ {
+ }
+
+ function displayStep( num )
+ {
+ if( num == 3 || num == 6 )
+ {
+ var typeObj = getObj( 'reportType' );
+ if( typeObj[0].checked == true )
+ {
+ return;
+ }
+ }
+
+ for( i=1; i <= 5; i++ )
+ {
+ var stepId = "step" + i;
+ var tabId = "tab" + i;
+ if( i != num )
+ {
+ getObj( stepId ).style.display = "none";
+ }
+ else
+ {
+ getObj( stepId ).style.display = "block";
+ }
+ }
+ }
+
+function changeSteps1()
+{
+ if(getObj('step5').style.display != 'none')
+ {
+ saveAndRunReport();
+ }else
+ {
+ for(i = 0; i < divarray.length ;i++)
+ {
+ if(getObj(divarray[i]).style.display != 'none')
+ {
+ hide(divarray[i]);
+ show(divarray[i+1]);
+ tableid = divarray[i]+'label';
+ newtableid = divarray[i+1]+'label';
+ getObj(tableid).className = 'lvtCol';
+ getObj(newtableid).className = 'lvtSel';
+ break;
+ }
+
+ }
+ }
+}
+function changeStepsback1()
+{
+ if(getObj('step1').style.display != 'none')
+ {
+ window.history.back();
+ }else
+ {
+ for(i = 0; i < divarray.length ;i++)
+ {
+ if(getObj(divarray[i]).style.display != 'none')
+ {
+ hide(divarray[i]);
+ show(divarray[i-1]);
+ tableid = divarray[i]+'label';
+ newtableid = divarray[i-1]+'label';
+ getObj(tableid).className = 'lvtCol';
+ getObj(newtableid).className = 'lvtSel';
+ break;
+ }
+
+ }
+ }
+}
+function saveAndRunReport()
+{
+ if(selectedColumnsObj.options.length == 0)
+ {
+ alert("Selected Columns cannot be empty");
+ return false;
+ }
+ formSelectColumnString();
+ document.NewReport.submit();
+}
+function changeSteps()
+{
+ if(getObj('step1').style.display != 'none')
+ {
+ if (trim(NewRep.reportname.value) == "")
+ {
+ alert("Missing Folder Name");
+ }else
+ {
+ hide('step1');
+ show('step2');
+ getObj('back_rep').disabled = false;
+ getObj('step1label').className = 'lvtCol';
+ getObj('step2label').className = 'lvtSel';
+ }
+ }
+ else
+ {
+ document.NewRep.submit();
+ }
+}
+function changeStepsback()
+{
+ hide('step2');
+ show('step1');
+ getObj('back_rep').disabled = true
+ getObj('step1label').className = 'lvtSel';
+ getObj('step2label').className = 'lvtCol';
+}
+function editReport(id)
+{
+ var arg = 'index.php?module=Reports&action=ReportsAjax&file=NewReport1&record='+id;
+ fnPopupWin(arg);
+}
+function CreateReport(module)
+{
+ var arg ='index.php?module=Reports&action=ReportsAjax&file=NewReport0&reportmodule='+module;
+ fnPopupWin(arg);
+}
+function fnPopupWin(winName){
+ window.open(winName, "ReportWindow","width=740px,height=620px");
+}
Modified: vtigercrm/trunk/modules/Reports/ReportColumns.php
==============================================================================
--- vtigercrm/trunk/modules/Reports/ReportColumns.php (original)
+++ vtigercrm/trunk/modules/Reports/ReportColumns.php Sat Apr 29 11:06:37 2006
@@ -8,7 +8,7 @@
* All Rights Reserved.
*
********************************************************************************/
-require_once('XTemplate/xtpl.php');
+require_once('Smarty_setup.php');
require_once("data/Tracker.php");
require_once('themes/'.$theme.'/layout_utils.php');
require_once('include/logging.php');
@@ -29,7 +29,7 @@
global $currentModule;
global $image_path;
global $theme;
-$report_column=new XTemplate('modules/Reports/ReportColumns.html');
+$report_column=new vtigerCRM_Smarty;
$report_column->assign("MOD", $mod_strings);
$report_column->assign("APP", $app_strings);
$report_column->assign("IMAGE_PATH",$image_path);
@@ -126,7 +126,6 @@
return $shtml;
}
-$report_column->parse("main");
-$report_column->out("main");
+$report_column->display("ReportColumns.tpl");
?>
Modified: vtigercrm/trunk/modules/Reports/ReportColumnsTotal.php
==============================================================================
--- vtigercrm/trunk/modules/Reports/ReportColumnsTotal.php (original)
+++ vtigercrm/trunk/modules/Reports/ReportColumnsTotal.php Sat Apr 29 11:06:37 2006
@@ -8,8 +8,8 @@
* All Rights Reserved.
*
********************************************************************************/
-require_once('XTemplate/xtpl.php');
require_once("data/Tracker.php");
+require_once('Smarty_setup.php');
require_once('themes/'.$theme.'/layout_utils.php');
require_once('include/logging.php');
require_once('include/utils/utils.php');
@@ -29,7 +29,7 @@
global $currentModule;
global $image_path;
global $theme;
-$report_column_tot=new XTemplate('modules/Reports/ReportColumnsTotal.html');
+$report_column_tot=new vtigerCRM_Smarty;
$report_column_tot->assign("MOD", $mod_strings);
$report_column_tot->assign("APP", $app_strings);
$report_column_tot->assign("IMAGE_PATH",$image_path);
@@ -39,16 +39,14 @@
$recordid = $_REQUEST["record"];
$oReport = new Reports($recordid);
$BLOCK1 = $oReport->sgetColumntoTotalSelected($oReport->primodule,$oReport->secmodule,$recordid);
- $report_column_tot->assign("BLOCK1",$BLOCK1);
+ $report_column_tot->assign("BLOCK1",$BLOCK1);
}else
{
$primarymodule = $_REQUEST["primarymodule"];
$secondarymodule = $_REQUEST["secondarymodule"];
$oReport = new Reports();
$BLOCK1 = $oReport->sgetColumntoTotal($primarymodule,$secondarymodule);
- $report_column_tot->assign("BLOCK1",$BLOCK1);
+ $report_column_tot->assign("BLOCK1",$BLOCK1);
}
-
-$report_column_tot->parse("main");
-$report_column_tot->out("main");
+$report_column_tot->display('ReportColumnsTotal.tpl');
?>
Modified: vtigercrm/trunk/modules/Reports/ReportFilters.php
==============================================================================
--- vtigercrm/trunk/modules/Reports/ReportFilters.php (original)
+++ vtigercrm/trunk/modules/Reports/ReportFilters.php Sat Apr 29 11:06:37 2006
@@ -7,39 +7,37 @@
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
- ********************************************************************************/
+ *****************************************************>***************************/
+
+require_once('Smarty_setup.php');
+require_once("data/Tracker.php");
+require_once('themes/'.$theme.'/layout_utils.php');
+require_once('include/logging.php');
+require_once('include/utils/utils.php');
+require_once('modules/Reports/Reports.php');
+require_once('include/database/PearDatabase.php');
+
+
+global $app_strings;
+global $app_list_strings;
global $mod_strings;
+$current_module_strings = return_module_language($current_language, 'Reports');
+global $list_max_entries_per_page;
+global $urlPrefix;
+
+$log = LoggerManager::getLogger('report_type');
+global $currentModule;
+global $image_path;
+global $theme;
+
+$report_std_filter = new vtigerCRM_Smarty;
+$report_std_filter->assign("MOD", $mod_strings);
+$report_std_filter->assign("APP", $app_strings);
+$report_std_filter->assign("IMAGE_PATH",$image_path);
+
+include("modules/Reports/StandardFilter.php");
+include("modules/Reports/AdvancedFilter.php");
+
+
+$report_std_filter->display('ReportFilters.tpl');
?>
-<html>
-<head>
-<title></title>
-<!--meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"-->
-</head>
-<body>
-<table width="100%" cellspacing="0" cellpadding="0">
- <tr>
- <td>
- <br>
- <table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">
- <tr>
- <td class="uline"><strong><?php echo $mod_strings['LBL_STANDARD_FILTER'];?>:</strong></td>
- </tr>
- <tr><td>
- <?php include("modules/Reports/StandardFilter.php"); ?>
- </td></tr>
- </table>
- <br>
- <table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">
- <tr>
- <td class="uline"><strong><?php echo $mod_strings['LBL_ADVANCED_FILTER'];?>:</strong></td>
- </tr>
- <tr><td>
- <?php include("modules/Reports/AdvancedFilter.php");?>
- </tr></td>
- </table>
- <br>
- </td>
- </tr>
-</table>
-</body>
-</html>
Modified: vtigercrm/trunk/modules/Reports/ReportGrouping.php
==============================================================================
--- vtigercrm/trunk/modules/Reports/ReportGrouping.php (original)
+++ vtigercrm/trunk/modules/Reports/ReportGrouping.php Sat Apr 29 11:06:37 2006
@@ -8,7 +8,7 @@
* All Rights Reserved.
*
********************************************************************************/
-require_once('XTemplate/xtpl.php');
+require_once('Smarty_setup.php');
require_once("data/Tracker.php");
require_once('themes/'.$theme.'/layout_utils.php');
require_once('include/logging.php');
@@ -29,41 +29,40 @@
global $currentModule;
global $image_path;
global $theme;
-$report_group=new XTemplate('modules/Reports/ReportGrouping.html');
+$report_group=new vtigerCRM_Smarty;
$report_group->assign("MOD", $mod_strings);
$report_group->assign("APP", $app_strings);
$report_group->assign("IMAGE_PATH",$image_path);
if(isset($_REQUEST["record"]))
{
+ $reportid = $_REQUEST["record"];
+ $oReport = new Reports($reportid);
+ $list_array = $oReport->getSelctedSortingColumns($reportid);
-$reportid = $_REQUEST["record"];
-$oReport = new Reports($reportid);
-$list_array = $oReport->getSelctedSortingColumns($reportid);
+ $BLOCK1 = getPrimaryColumns_GroupingHTML($oReport->primodule,$list_array[0]);
+ $BLOCK1 .= getSecondaryColumns_GroupingHTML($oReport->secmodule,$list_array[0]);
+ $report_group->assign("BLOCK1",$BLOCK1);
-$BLOCK1 = getPrimaryColumns_GroupingHTML($primarymodule,$list_array[0]);
-$BLOCK1 .= getSecondaryColumns_GroupingHTML($secondarymodule,$list_array[0]);
-$report_group->assign("BLOCK1",$BLOCK1);
+ $BLOCK2 = getPrimaryColumns_GroupingHTML($oReport->primodule,$list_array[1]);
+ $BLOCK2 .= getSecondaryColumns_GroupingHTML($oReport->secmodule,$list_array[1]);
+ $report_group->assign("BLOCK2",$BLOCK2);
-$BLOCK2 = getPrimaryColumns_GroupingHTML($primarymodule,$list_array[1]);
-$BLOCK2 .= getSecondaryColumns_GroupingHTML($secondarymodule,$list_array[1]);
-$report_group->assign("BLOCK2",$BLOCK2);
+ $BLOCK3 = getPrimaryColumns_GroupingHTML($oReport->primodule,$list_array[2]);
+ $BLOCK3 .= getSecondaryColumns_GroupingHTML($oReport->secmodule,$list_array[2]);
+ $report_group->assign("BLOCK3",$BLOCK3);
-$BLOCK3 = getPrimaryColumns_GroupingHTML($primarymodule,$list_array[2]);
-$BLOCK3 .= getSecondaryColumns_GroupingHTML($secondarymodule,$list_array[2]);
-$report_group->assign("BLOCK3",$BLOCK3);
-
-$sortorder = $oReport->ascdescorder;
+ $sortorder = $oReport->ascdescorder;
}else
{
-$primarymodule = $_REQUEST["primarymodule"];
-$secondarymodule = $_REQUEST["secondarymodule"];
-$BLOCK1 = getPrimaryColumns_GroupingHTML($primarymodule);
-$BLOCK1 .= getSecondaryColumns_GroupingHTML($secondarymodule);
-$report_group->assign("BLOCK1",$BLOCK1);
-$report_group->assign("BLOCK2",$BLOCK1);
-$report_group->assign("BLOCK3",$BLOCK1);
+ $primarymodule = $_REQUEST["primarymodule"];
+ $secondarymodule = $_REQUEST["secondarymodule"];
+ $BLOCK1 = getPrimaryColumns_GroupingHTML($primarymodule);
+ $BLOCK1 .= getSecondaryColumns_GroupingHTML($secondarymodule);
+ $report_group->assign("BLOCK1",$BLOCK1);
+ $report_group->assign("BLOCK2",$BLOCK1);
+ $report_group->assign("BLOCK3",$BLOCK1);
}
@@ -190,7 +189,6 @@
<option selected value='Descending'>Descending</option>";
}
$report_group->assign("ASCDESC3",$shtml);
+$report_group->display("ReportGrouping.tpl");
-$report_group->parse("main");
-$report_group->out("main");
?>
Modified: vtigercrm/trunk/modules/Reports/ReportRun.php
==============================================================================
--- vtigercrm/trunk/modules/Reports/ReportRun.php (original)
+++ vtigercrm/trunk/modules/Reports/ReportRun.php Sat Apr 29 11:06:37 2006
@@ -71,7 +71,6 @@
$columnslist[$fieldcolname] = $querycolumns;
}
}
- //print_r($columnslist);
$log->info("ReportRun :: Successfully returned getQueryColumnsList".$reportid);
return $columnslist;
}
@@ -79,14 +78,6 @@
function getEscapedColumns($selectedfields)
{
$fieldname = $selectedfields[3];
- /*if($fieldname == "assigned_user_id")
- {
- $querycolumn = "usersRel.user_name"." ".$selectedfields[2];
- }*/
- /*if($fieldname == "account_id")
- {
- $querycolumn = "accountRel.accountname"." ".$selectedfields[2];
- }*/
if($fieldname == "parent_id")
{
if($this->primarymodule == "HelpDesk")
@@ -102,22 +93,6 @@
$querycolumn = "case crmentityRelActivities.setype when 'Accounts' then accountRelActivities.accountname when 'Leads' then leaddetailsRelActivities.lastname when 'Potentials' then potentialRelActivities.potentialname when 'Quotes' then quotesRelActivities.subject when 'PurchaseOrder' then purchaseorderRelActivities.subject when 'Invoice' then invoiceRelActivities.subject End"." '".$selectedfields[2]."', crmentityRelActivities.setype 'Entity_type'";
}
}
- /*if($fieldname == "contact_id")
- {
- $querycolumn = "contactdetailsRel.lastname"." ".$selectedfields[2];
- }*/
- /*if($fieldname == "vendor_id")
- {
- $querycolumn = "vendorRel.name"." ".$selectedfields[2];
- }
- if($fieldname == "potential_id")
- {
- $querycolumn = "potentialRel.potentialname"." ".$selectedfields[2];
- }
- if($fieldname == "assigned_user_id1")
- {
- $querycolumn = "usersRel1.user_name"." ".$selectedfields[2];
- }*/
return $querycolumn;
}
@@ -584,7 +559,6 @@
$datevalue[1] = "";
}
- //$log->info("ReportRun :: Successfully returned getQueryColumnsList".$reportid);
return $datevalue;
}
@@ -632,7 +606,6 @@
global $adb;
global $modules;
global $log;
- //$modules = array("Leads_", "Accounts_", "Potentials_", "Contacts_","_");
$sreportsortsql = "select reportsortcol.* from report";
$sreportsortsql .= " inner join reportsortcol on report.reportid = reportsortcol.reportid";
@@ -961,7 +934,6 @@
function getReportsQuery($module)
{
global $log;
- //echo $this->secondarymodule."<br>";
if($module == "Leads")
{
$query = "from leaddetails
@@ -991,6 +963,7 @@
$query = "from contactdetails
inner join crmentity as crmentityContacts on crmentityContacts.crmid = contactdetails.contactid
inner join contactaddress on contactdetails.contactid = contactaddress.contactaddressid
+ inner join customerdetails on customerdetails.customerid = contactdetails.contactid
inner join contactsubdetails on contactdetails.contactid = contactsubdetails.contactsubscriptionid
inner join contactscf on contactdetails.contactid = contactscf.contactid
left join contactdetails as contactdetailsContacts on contactdetailsContacts.contactid = contactdetails.reportsto
@@ -1220,7 +1193,7 @@
for ($x=0; $x<$y; $x++)
{
$fld = $adb->field_name($result, $x);
- $header .= "<td class='rptHead'>".str_replace($modules," ",$fld->name)."</td>";
+ $header .= "<td class='rptCellLabel'>".str_replace($modules," ",$fld->name)."</td>";
}
$noofrows = $adb->num_rows($result);
@@ -1308,37 +1281,23 @@
$arr_val[] = $arraylists;
}while($custom_field_values = $adb->fetch_array($result));
-
- $totalhtml = '
- <tr>
- <td colspan='.($y+1).' class="rptTotal">'.$mod_strings['LBL_GRAND_TOTAL'].': '.$noofrows.' Records</td>
- </tr>';
-
- $sHTML = '<html>
- <head></head>
- <body>
- <table cellpadding="0" cellspacing="0" border="0" class="rptTable">
- <tr>
- <td class="rptTitle" colspan="'.$y.'">'.$this->reportname.'</td>
- </tr>
+ $sHTML ='<table cellpadding="5" cellspacing="0" align="center" class="rptTable">
<tr>'.
$header
.'<!-- BEGIN values -->
<tr>'.
$valtemplate
- .'</tr>'
- .$totalhtml.
- '</table>
- </body>
- </html>';
+ .'</tr>
+ </table>';
//<<<<<<<<construct HTML>>>>>>>>>>>>
- return $sHTML;
+ $return_data[] = $sHTML;
+ $return_data[] = $noofrows;
+ return $return_data;
}
}elseif($outputformat == "PDF")
{
$sSQL = $this->sGetSQLforReport($this->reportid,$filterlist);
- //$modules = array("Leads_", "Accounts_", "Potentials_", "Contacts_","_");
$result = $adb->query($sSQL);
$y=$adb->num_fields($result);
@@ -1346,8 +1305,6 @@
{
$noofrows = $adb->num_rows($result);
$custom_field_values = $adb->fetch_array($result);
-
- //$modules = array("Leads_", "Accounts_", "Potentials_", "Contacts_","_");
do
{
@@ -1373,14 +1330,13 @@
$sSQL = $this->sGetSQLforReport($this->reportid,$filterlist,"COLUMNSTOTOTAL");
if(isset($this->totallist))
{
- //print_r($this->totallist);
if($sSQL != "")
{
$result = $adb->query($sSQL);
$y=$adb->num_fields($result);
$custom_field_values = $adb->fetch_array($result);
- $coltotalhtml .= "<table width='60%' cellpadding='0' cellspacing='0' border='0' class='formOuterBorder'><tr><td class='rptHead'>Totals</td><td class='rptHead'>SUM</td><td class='rptHead'>AVG</td><td class='rptHead'>MIN</td><td class='rptHead'>MAX</td></tr>";
+ $coltotalhtml .= "<table align='center' width='60%' cellpadding='3' cellspacing='0' border='0' class='rptTable'><tr><td class='rptCellLabel'>Totals</td><td class='rptCellLabel'>SUM</td><td class='rptCellLabel'>AVG</td><td class='rptCellLabel'>MIN</td><td class='rptCellLabel'>MAX</td></tr>";
foreach($this->totallist as $key=>$value)
{
@@ -1436,7 +1392,6 @@
$coltotalhtml .= '<tr>';
}
-// print_r($keyhdr);
$coltotalhtml .= "</table>";
}
}
Modified: vtigercrm/trunk/modules/Reports/ReportType.php
==============================================================================
--- vtigercrm/trunk/modules/Reports/ReportType.php (original)
+++ vtigercrm/trunk/modules/Reports/ReportType.php Sat Apr 29 11:06:37 2006
@@ -8,13 +8,12 @@
* All Rights Reserved.
*
********************************************************************************/
-require_once('XTemplate/xtpl.php');
require_once("data/Tracker.php");
-require_once('themes/'.$theme.'/layout_utils.php');
require_once('include/logging.php');
require_once('include/utils/utils.php');
require_once('modules/Reports/Reports.php');
require_once('include/database/PearDatabase.php');
+require_once('Smarty_setup.php');
global $app_strings;
global $app_list_strings;
@@ -29,10 +28,13 @@
global $currentModule;
global $image_path;
global $theme;
-$report_type=new XTemplate('modules/Reports/ReportType.html');
-$report_type->assign("MOD", $mod_strings);
-$report_type->assign("APP", $app_strings);
-$report_type->assign("IMAGE_PATH",$image_path);
+$theme_path="themes/".$theme."/";
+$image_path=$theme_path."images/";
+require_once($theme_path.'layout_utils.php');
+$list_report_form = new vtigerCRM_Smarty;
+$list_report_form->assign("MOD", $mod_strings);
+$list_report_form->assign("APP", $app_strings);
+$list_report_form->assign("IMAGE_PATH",$image_path);
if(isset($_REQUEST["record"]))
{
$recordid = $_REQUEST["record"];
@@ -42,27 +44,6 @@
{
$selectedreporttype = "tabular";
}
-if($selectedreporttype == "tabular")
-{
- $shtml = '<input checked type="radio" name="reportType" value="tabular" onclick="hideTabs( true )">';
-}else
-{
- $shtml = '<input type="radio" name="reportType" value="tabular" onclick="hideTabs( true )">';
-}
-
-$report_type->assign("REPORT_TAB_TYPE",$shtml);
-
-if($selectedreporttype == "summary")
-{
- $sumhtml = '<input type="radio" checked name="reportType" value="summary" onclick="hideTabs( false )">';
-}else
-{
- $sumhtml = '<input type="radio" name="reportType" value="summary" onclick="hideTabs( false )">';
-}
-
-$report_type->assign("REPORT_SUM_TYPE",$sumhtml);
-
-$report_type->parse("main");
-
-$report_type->out("main");
+$list_report_form->assign("REPORT_TYPE",$selectedreporttype);
+$list_report_form->display("ReportsType.tpl");
?>
Modified: vtigercrm/trunk/modules/Reports/Reports.php
==============================================================================
--- vtigercrm/trunk/modules/Reports/Reports.php (original)
+++ vtigercrm/trunk/modules/Reports/Reports.php Sat Apr 29 11:06:37 2006
@@ -23,7 +23,7 @@
global $related_modules;
global $profileList;
-$profileList = getCurrentUserProfileList();
+//$profileList = getCurrentUserProfileList();
$adv_filter_options = array("e"=>"equals",
"n"=>"not equal to",
"s"=>"starts with",
@@ -39,7 +39,7 @@
'HelpDesk','Quotes','PurchaseOrder','Invoice','Activities'
);
-$related_modules = Array('Leads'=>Array(''),
+$related_modules = Array('Leads'=>Array(),
'Accounts'=>Array('Potentials','Contacts','Products','Quotes','Invoice'),
'Contacts'=>Array('Accounts','Potentials','Quotes','PurchaseOrder'),
'Potentials'=>Array('Accounts','Contacts','Quotes'),
@@ -153,51 +153,45 @@
* contains HTML
*/
- function sgetRptFldr()
+ function sgetRptFldr($mode='')
{
global $adb;
global $log;
-
+ $returndata = Array();
$sql = "select * from reportfolder order by folderid";
$result = $adb->query($sql);
$reportfldrow = $adb->fetch_array($result);
- $x = 0;
- do
- {
- $reporttempid = $reportfldrow["folderid"]."RptFldr";
- $reporttempidjs[$x] = "'".$reportfldrow["folderid"]."RptFldr'";
-
- $shtml .= "<br><table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
- <tr>
- <td width=\"15\" nowrap>
- <div align=\"center\">
- <a href=\"javascript:toggleReports('".$reporttempid."')\"><img id=\"".$reporttempid."img\" src=\"".$image_path."collapse.gif\" border=\"0\" align=\"absmiddle\"></a>
- </div>
- </td>
- <td height=\"20\" class=\"uline\">
- <a class=\"relListHead\" href=\"javascript:toggleReports('".$reporttempid."')\">".$reportfldrow["foldername"]."</a>";
- if($reportfldrow["state"]=="SAVED")
- {
- $shtml .="";
- }else
- {
- $shtml .=" [ <a href=\"index.php?module=Reports&action=NewReportFolder&record=".$reportfldrow["folderid"] ."\" class=\"link\">Edit Folder</a>
- <span class=\"sep\">|</span>
- <a onclick=\"return window.confirm('Are you sure?');\" href=\"index.php?module=Reports&action=DeleteReportFolder&record=".$reportfldrow["folderid"] ."\" class=\"link\">Del Folder</a> ]";
- }
- $shtml .="
- </td>
- </tr>
- </table>";
- $shtml .= $this->sgetRptsforFldr($reportfldrow["folderid"]);
- $x = $x + 1;
-
- }while($reportfldrow = $adb->fetch_array($result));
- $this->srptfldridjs = implode(",",$reporttempidjs);
+ if($mode != '')
+ {
+ do
+ {
+ if($reportfldrow["state"] == $mode)
+ {
+ $details = Array();
+ $details['state'] = $reportfldrow["state"];
+ $details['id'] = $reportfldrow["folderid"];
+ $details['name'] = $reportfldrow["foldername"];
+ $details['description'] = $reportfldrow["description"];
+ $details['details'] = $this->sgetRptsforFldr($reportfldrow["folderid"]);
+ $returndata[] = $details;
+ }
+ }while($reportfldrow = $adb->fetch_array($result));
+ }else
+ {
+ do
+ {
+ $details = Array();
+ $details['state'] = $reportfldrow["state"];
+ $details['id'] = $reportfldrow["folderid"];
+ $details['name'] = $reportfldrow["foldername"];
+ $details['description'] = $reportfldrow["description"];
+ $returndata[] = $details;
+ }while($reportfldrow = $adb->fetch_array($result));
+ }
$log->info("Reports :: ListView->Successfully returned report folder HTML");
- return $shtml;
+ return $returndata;
}
/** Function to get the Reports inside each modules
@@ -212,6 +206,7 @@
global $adb;
global $log;
global $mod_strings;
+ $returndata = Array();
require_once('include/utils/UserInfoUtil.php');
@@ -221,72 +216,23 @@
$report = $adb->fetch_array($result);
if(count($report)>0)
{
- $srptdetails .= '<div id="'.$rpt_fldr_id.'RptFldr" style="display:block">
- <table width="95%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td width="15"> </td>
- <td>
- <table border="0" width="100%" cellspacing="0" cellpadding="0" class="formOuterBorder">
- <tr>
- <td width="15%" nowrap height="21" class="moduleListTitle" style="padding:0px 3px 0px 3px;"></td>
- <td width="30%" nowrap height="21" class="moduleListTitle" style="padding:0px 3px 0px 3px;">Report Name</td>
- <td width="55%" nowrap height="21" class="moduleListTitle" style="padding:0px 3px 0px 3px;">Description</td>
- </tr>';
- $rowcnt = 1;
- $count_flag = 0;
do
{
- /* if(isPermitted($report['primarymodule'],'index') == "yes" && (isPermitted($report['secondarymodules'],'index')== "yes" || $report['secondarymodules'] == ''))
- {*/
- $count_flag = 1;
- if ($rowcnt%2 == 0)
- $srptdetails .= '<tr class="evenListRow">';
- else
- $srptdetails .= '<tr class="oddListRow">';
-
- $srptdetails .= '<td height="21" style="padding:0px 3px 0px 3px;">
- <div align="center">';
- if($report["customizable"]==1)
- {
- $srptdetails .= '<a class="link" href="index.php?module=Reports&action=NewReport1&record='.$report["reportid"] .'&primarymodule='.$report["primarymodule"].'&secondarymodule='.$report["secondarymodules"].'">Customize</a>';
- }
-
- if($report["state"] !="SAVED")
- {
- $srptdetails .= " <span class=\"sep\">|</span> <a class=\"link\" onclick=\"return window.confirm('Are you sure?');\" href=\"index.php?module=Reports&action=Delete&record=".$report["reportid"]."\">Del</a>";
- }
- $srptdetails .='</div>
- </td>
- <td height="21" style="padding:0px 3px 0px 3px;" nowrap><a class="link" href="index.php?module=Reports&action=SaveAndRun&record='.$report["reportid"].'">'.$report["reportname"].'</a></td>
- <td height="21" style="padding:0px 3px 0px 3px;">'.$report["description"].'</td>
- </tr>';
- $rowcnt++;
- // }
+ $report_details = Array();
+ $report_details ['customizable'] = $report["customizable"];
+ $report_details ['reportid'] = $report["reportid"];
+ $report_details ['primarymodule'] = $report["primarymodule"];
+ $report_details ['secondarymodules'] = $report["secondarymodules"];
+ $report_details ['state'] = $report["state"];
+ $report_details ['description'] = $report["description"];
+ $report_details ['reportname'] = $report["reportname"];
+
+ $returndata []=$report_details;
}while($report = $adb->fetch_array($result));
- /* if($count_flag == 0)
- {
- $srptdetails .= "<tr><td colspan=3 align='center'>".$mod_strings['LBL_NO_PERMISSION']."</td></tr>";
- }
-*/
- $srptdetails .= '</table>
- </td>
- </tr>
- </table>
- </div>';
- }else
- {
- $srptdetails .= '<div id="'.$rpt_fldr_id.'RptFldr" style="display:block">
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td width="15"></td>
- <td height="21">No reports in this folder</td>
- </tr>
- </table>
- </div>';
}
$log->info("Reports :: ListView->Successfully returned report details HTML");
- return $srptdetails;
+ return $returndata;
}
/** Function to get the array of ids
@@ -504,7 +450,6 @@
$tabid = getTabid($module);
global $profile_id;
-
foreach($this->module_list[$module] as $key=>$blockid)
{
$blockids[] = $blockid;
@@ -846,9 +791,7 @@
global $adb;
global $modules;
global $log;
-
- $ssql = "select relcriteria.* from report inner join selectquery on relcriteria.queryid = report.queryid";
- $ssql.= " left join relcriteria on relcriteria.queryid = selectquery.queryid";
+ $ssql = 'select relcriteria.* from report inner join relcriteria on relcriteria.queryid = report.queryid left join selectquery on relcriteria.queryid = selectquery.queryid';
$ssql.= " where report.reportid =".$reportid." order by relcriteria.columnindex";
$result = $adb->query($ssql);
@@ -897,17 +840,17 @@
function sgetColumntoTotal($primarymodule,$secondarymodule)
{
- $shtml = $this->sgetColumnstoTotalHTML($primarymodule,0);
+ $options = Array();
+ $options []= $this->sgetColumnstoTotalHTML($primarymodule,0);
if($secondarymodule != "")
{
$secondarymodule = explode(":",$secondarymodule);
for($i=0;$i < count($secondarymodule) ;$i++)
{
- $shtml .= $this->sgetColumnstoTotalHTML($secondarymodule[$i],($i+1));
- }
- }
-
- return $shtml;
+ $options []= $this->sgetColumnstoTotalHTML($secondarymodule[$i],($i+1));
+ }
+ }
+ return $options;
}
/** Function to get the selected columns of total fields in Reports
@@ -921,7 +864,7 @@
{
global $adb;
global $log;
-
+ $options = Array();
if($reportid != "")
{
$ssql = "select reportsummary.* from reportsummary inner join report on report.reportid = reportsummary.reportsummaryid where report.reportid=".$reportid;
@@ -937,18 +880,18 @@
}while($reportsummaryrow = $adb->fetch_array($result));
}
}
- $shtml = $this->sgetColumnstoTotalHTML($primarymodule,0);
+ $options []= $this->sgetColumnstoTotalHTML($primarymodule,0);
if($secondarymodule != "")
{
$secondarymodule = explode(":",$secondarymodule);
for($i=0;$i < count($secondarymodule) ;$i++)
{
- $shtml .= $this->sgetColumnstoTotalHTML($secondarymodule[$i],($i+1));
+ $options []= $this->sgetColumnstoTotalHTML($secondarymodule[$i],($i+1));
}
}
$log->info("Reports :: Successfully returned sgetColumntoTotalSelected");
- return $shtml;
+ return $options;
}
@@ -979,22 +922,14 @@
}
$result = $adb->query($ssql);
$columntototalrow = $adb->fetch_array($result);
- $n = 0;
+ $options_list = Array();
do
{
$typeofdata = explode("~",$columntototalrow["typeofdata"]);
-
- if($typeofdata[0] == "N" || $typeofdata[0] == "I")
- {
-
- if(($n % 2) == 0)
- {
- $shtml .= '<tr class="evenListRow">';
- }else
- {
- $shtml .= '<tr class="oddListRow">';
- }
-
+
+ if($typeofdata[0] == "N" || $typeofdata[0] == "I")
+ {
+ $options = Array();
if(isset($this->columnssummary))
{
$selectedcolumn = "";
@@ -1017,72 +952,101 @@
}
$columntototalrow['fieldlabel'] = str_replace(" ","_",$columntototalrow['fieldlabel']);
- $shtml .= '<td nowrap height="21" style="padding:0px 3px 0px 3px;">'.$columntototalrow['tablabel'].' - '.$columntototalrow['fieldlabel'].'</td>
- <td height="21" style="padding:0px 3px 0px 3px;"><div align="center">';
-
+ $options []= $columntototalrow['tablabel'].' - '.$columntototalrow['fieldlabel'];
if($selectedcolumn1[2] == "cb:".$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel']."_SUM:2")
{
- $shtml .= '<input checked name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_SUM:2" type="checkbox" value="">'; }else
+ $options []= '<input checked name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_SUM:2" type="checkbox" value="">';
+ }else
{
- $shtml .= '<input name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_SUM:2" type="checkbox" value="">';
+ $options []= '<input name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_SUM:2" type="checkbox" value="">';
}
- $shtml .= '</div></td>
- <td height="21" style="padding:0px 3px 0px 3px;"><div align="center">';
if($selectedcolumn1[3] == "cb:".$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel']."_AVG:3")
{
- $shtml .= '<input checked name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_AVG:3" type="checkbox" value="">';
+ $options []= '<input checked name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_AVG:3" type="checkbox" value="">';
}else
{
- $shtml .= '<input name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_AVG:3" type="checkbox" value="">';
+ $options []= '<input name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_AVG:3" type="checkbox" value="">';
}
- $shtml .= '</div></td>
- <td height="21" style="padding:0px 3px 0px 3px;"><div align="center">';
if($selectedcolumn1[4] == "cb:".$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel']."_MIN:4")
{
- $shtml .= '<input checked name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MIN:4" type="checkbox" value="">';
+ $options []= '<input checked name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MIN:4" type="checkbox" value="">';
}else
{
- $shtml .= '<input name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MIN:4" type="checkbox" value="">';
+ $options []= '<input name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MIN:4" type="checkbox" value="">';
}
- $shtml .= '</div></td>
- <td height="21" style="padding:0px 3px 0px 3px;"><div align="center">';
if($selectedcolumn1[5] == "cb:".$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel']."_MAX:5")
{
- $shtml .= '<input checked name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MAX:5" type="checkbox" value="">';
+ $options []= '<input checked name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MAX:5" type="checkbox" value="">';
}else
{
- $shtml .= '<input name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MAX:5" type="checkbox" value="">';
+ $options []= '<input name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MAX:5" type="checkbox" value="">';
}
-
- $shtml .= '</div></td>
- </tr>';
- $n = $n + 1;
-
}else
{
- $shtml .= '<td nowrap height="21" style="padding:0px 3px 0px 3px;">'.$columntototalrow['tablabel'].' - '.$columntototalrow['fieldlabel'].'</td>
- <td height="21" style="padding:0px 3px 0px 3px;"><div align="center">
- <input name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_SUM:2" type="checkbox" value="">
- </div></td>
- <td height="21" style="padding:0px 3px 0px 3px;"><div align="center">
- <input name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_AVG:3" type="checkbox" value="" >
- </div></td>
- <td height="21" style="padding:0px 3px 0px 3px;"><div align="center">
- <input name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MIN:4"type="checkbox" value="" >
- </div></td>
- <td height="21" style="padding:0px 3px 0px 3px;"><div align="center">
- <input name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MAX:5" type="checkbox" value="" >
- </div></td>
- </tr>';
- $n = $n + 1;
+ $options []= $columntototalrow['tablabel'].' - '.$columntototalrow['fieldlabel'];
+ $options []= '<input name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_SUM:2" type="checkbox" value="">';
+ $options []= '<input name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_AVG:3" type="checkbox" value="" >';
+ $options []= '<input name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MIN:4"type="checkbox" value="" >';
+ $options [] ='<input name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MAX:5" type="checkbox" value="" >';
}
+ $options_list [] = $options;
}
}while($columntototalrow = $adb->fetch_array($result));
$log->info("Reports :: Successfully returned sgetColumnstoTotalHTML");
- return $shtml;
- }
+ return $options_list;
+ }
+}
+
+/** Function to get the primary module list in reports
+ * This function generates the list of primary modules in reports
+ * and returns an array of permitted modules
+ */
+
+function getReportsModuleList()
+{
+ global $adb;
+ global $app_list_strings;
+ global $report_modules;
+ global $mod_strings;
+ $modules = Array();
+ foreach($app_list_strings['moduleList'] as $key=>$value)
+ {
+ for($i=0;$i<count($report_modules);$i++)
+ {
+ if($key == $report_modules[$i])
+ {
+ if(isPermitted($key,'index') == "yes")
+ {
+ $count_flag = 1;
+ $modules [] = $value;
+ }
+ }
+ }
+
+ }
+ return $modules;
+}
+/** Function to get the Related module list in reports
+ * This function generates the list of secondary modules in reports
+ * and returns the related module as an Array
+ */
+
+function getReportRelatedModules($module)
+{
+ global $app_list_strings;
+ global $related_modules;
+ global $mod_strings;
+ $optionhtml = Array();
+ foreach($related_modules[$module] as $rel_modules)
+ {
+ if(isPermitted($rel_modules,'index') == "yes")
+ {
+ $optionhtml []= $rel_modules;
+ }
+ }
+ return $optionhtml;
}
?>
Modified: vtigercrm/trunk/modules/Reports/Save.php
==============================================================================
--- vtigercrm/trunk/modules/Reports/Save.php (original)
+++ vtigercrm/trunk/modules/Reports/Save.php Sat Apr 29 11:06:37 2006
@@ -190,13 +190,13 @@
</ul></B></font> <br>" ;
echo $errormessage;
}
- header("Location: index.php?action=SaveAndRun&module=Reports&record=$genQueryId");
+ echo '<script>window.opener.location.href =window.opener.location.href;self.close();</script>';
}
}else
{
if($reportid != "")
{
- if($selectedcolumnstring != "")
+ if($selectedcolumnstring != "")
{
$idelcolumnsql = "delete from selectcolumn where queryid=".$reportid;
$idelcolumnsqlresult = $adb->query($idelcolumnsql);
@@ -212,7 +212,7 @@
}
}
}
-
+
$ireportsql = "update report set";
$ireportsql .= " REPORTNAME='".$reportname."',";
$ireportsql .= " DESCRIPTION='".$reportdescription."',";
@@ -268,29 +268,29 @@
$ireportsummarysql = "insert into reportsummary (REPORTSUMMARYID,SUMMARYTYPE,COLUMNNAME) values (".$reportid.",".$i.",'".$columnstototal[$i]."')";
$ireportsummaryresult = $adb->query($ireportsummarysql);
}
- $log->info("Reports :: Save->Successfully saved reportsummary");
+ $log->info("Reports :: Save->Successfully saved reportsummary");
//<<<<step4 columnstototal>>>>>>>
//<<<<step5 advancedfilter>>>>>>>
- $idelrelcriteriasql = "delete from relcriteria where queryid=".$reportid;
- $idelrelcriteriasqlresult = $adb->query($idelrelcriteriasql);
-
- for ($i=0;$i<count($adv_filter_col);$i++)
- {
- $irelcriteriasql = "insert into relcriteria(QUERYID,COLUMNINDEX,COLUMNNAME,COMPARATOR,VALUE) values (".$reportid.",".$i.",'".$adv_filter_col[$i]."','".$adv_filter_option[$i]."','".$adv_filter_value[$i]."')";
- $irelcriteriaresult = $adb->query($irelcriteriasql);
- }
- $log->info("Reports :: Save->Successfully saved relcriteria");
+ $idelrelcriteriasql = "delete from relcriteria where queryid=".$reportid;
+ $idelrelcriteriasqlresult = $adb->query($idelrelcriteriasql);
+
+ for ($i=0;$i<count($adv_filter_col);$i++)
+ {
+ $irelcriteriasql = "insert into relcriteria(QUERYID,COLUMNINDEX,COLUMNNAME,COMPARATOR,VALUE) values (".$reportid.",".$i.",'".$adv_filter_col[$i]."','".$adv_filter_option[$i]."','".$adv_filter_value[$i]."')";
+ $irelcriteriaresult = $adb->query($irelcriteriasql);
+ }
+ $log->info("Reports :: Save->Successfully saved relcriteria");
//<<<<step5 advancedfilter>>>>>>>
}else
{
include('themes/'.$theme.'/header.php');
$errormessage = "<font color='red'><B>Error Message<ul>
- <li><font color='red'>Error while inserting the record</font>
- </ul></B></font> <br>" ;
+ <li><font color='red'>Error while inserting the record</font>
+ </ul></B></font> <br>" ;
echo $errormessage;
}
}else
@@ -301,6 +301,6 @@
</ul></B></font> <br>" ;
echo $errormessage;
}
- header("Location: index.php?action=SaveAndRun&module=Reports&record=$reportid");
+ echo '<script>window.opener.location.href =window.opener.location.href;self.close();</script>';
}
?>
Modified: vtigercrm/trunk/modules/Reports/SaveAndRun.php
==============================================================================
--- vtigercrm/trunk/modules/Reports/SaveAndRun.php (original)
+++ vtigercrm/trunk/modules/Reports/SaveAndRun.php Sat Apr 29 11:06:37 2006
@@ -18,13 +18,13 @@
require_once('include/database/PearDatabase.php');
require_once("modules/Reports/ReportRun.php");
require_once('include/utils/utils.php');
-include('themes/'.$theme.'/header.php');
+require_once('Smarty_setup.php');
global $adb;
global $mod_strings;
$reportid = $_REQUEST["record"];
-
+$folderid = $_REQUEST["folderid"];
$filtercolumn = $_REQUEST["stdDateFilterField"];
$filter = $_REQUEST["stdDateFilter"];
$startdate = $_REQUEST["startdate"];
@@ -45,74 +45,145 @@
$totalhtml = $oReportRun->GenerateReport("TOTALHTML",$filterlist);
if(isPermitted($primarymodule,'index') == "yes" && (isPermitted($secondarymodule,'index')== "yes"))
{
-?>
-<script language="JavaScript" type="text/javascript" src="include/js/general.js"></script>
-<script type="text/javascript" language="JavaScript">
- function goToURL( url )
- {
- document.location.href = url;
- }
-</script>
-<?php
-echo get_module_title($mod_strings['LBL_MODULE_NAME'], $ogReport->reportname, false);
-?>
-<br>
-<form name="NewReport" action="index.php" method="POST">
- <table width="90%" border="0" cellspacing="0" cellpadding="0" class="formOuterBorder">
- <tr>
- <td class="formSecHeader"><?php echo $mod_strings['LBL_FILTER_OPTIONS'];?>:</td>
- </tr>
- <tr>
- <td>
- <?php include("modules/Reports/StandardFilter.php");?>
- </td>
- </tr>
- </table>
-<!--Code given by Ceaser for Reports Standard Filter -->
-<SCRIPT LANGUAGE=JavaScript>
-function CrearEnlace(tipo,id){
-return "index.php?module=Reports&action="+tipo+"&record="+id+"&stdDateFilterField="+document.NewReport.stdDateFilterField.options [document.NewReport.stdDateFilterField.selectedIndex].value+"&stdDateFilter="+document.NewReport.stdDateFilter.options[document.NewReport.stdDateFilter.selectedIndex].value+"&startdate="+document.NewReport.startdate.value+"&enddate="+document.NewReport.enddate.value;
-}
-</SCRIPT>
-<!--end of code given by Ceaser-->
- <input type="hidden" name="booleanoperator" value="5"/>
- <input type="hidden" name="record" value="<?php echo $reportid?>"/>
- <input type="hidden" name="reload" value=""/>
- <input type="hidden" name="module" value="Reports"/>
- <input type="hidden" name="action" value="SaveAndRun"/>
-<br>
- <table align='center' border="0" cellspacing="2" cellpadding="2">
- <tr><td>
-<!--Code for Reports Filter by Ceaser-->
- <input id="btnExport" name="btnExport" value="<?php echo $mod_strings['LBL_EXPORTPDF_BUTTON']?>" class="button" type="button" onClick="goToURL(CrearEnlace('CreatePDF',<?php echo $reportid; ?>));" title="<?php echo $mod_strings['LBL_EXPORTPDF_BUTTON']?>">
+ $list_report_form = new vtigerCRM_Smarty;
+ $ogReport->getSelectedStandardCriteria($reportid);
- <input id="btnExport" name="btnExport" value="<?php echo $mod_strings['LBL_EXPORTXL_BUTTON']?>" class="button" type="button" onClick="goToURL(CrearEnlace('CreateXL',<?php echo $reportid; ?>));" title="<?php echo $mod_strings['LBL_EXPORTXL_BUTTON']?>">
-<!--end of code by Ceaser-->
- <input value="<?php echo $mod_strings['LBL_CUSTOMIZE_BUTTON'];?>" class="button" type="button" onClick="goToURL( 'index.php?module=Reports&action=NewReport1&record=<?php echo $reportid; ?>' )" title="<?php echo $mod_strings['LBL_CUSTOMIZE_BUTTON'];?>">
+ $BLOCK1 = getPrimaryStdFilterHTML($ogReport->primodule,$ogReport->stdselectedcolumn);
+ $BLOCK1 .= getSecondaryStdFilterHTML($ogReport->secmodule,$ogReport->stdselectedcolumn);
+ $list_report_form->assign("BLOCK1",$BLOCK1);
+ $BLOCKJS = $ogReport->getCriteriaJS();
+ $list_report_form->assign("BLOCKJS",$BLOCKJS);
- <input value="<?php echo $mod_strings['LBL_APPLYFILTER_BUTTON'];?>" class="button" type="submit" title="<?php echo $mod_strings['LBL_APPLYFILTER_BUTTON'];?>"/>
+ $BLOCKCRITERIA = $ogReport->getSelectedStdFilterCriteria($ogReport->stdselectedfilter);
+ $list_report_form->assign("BLOCKCRITERIA",$BLOCKCRITERIA);
- </td></tr>
- </table>
-<br>
-<table>
-<tr>
- <td class='bodyText'>
- <?php echo $sshtml; ?><br>
- <?php echo $totalhtml; ?>
- </td>
-</tr>
-</table>
- <input type="hidden" name="dlgType" value="saveAs"/>
- <input type="hidden" name="reportName"/>
- <input type="hidden" name="reportDesc"/>
- <input type="hidden" name="folder"/>
-</form>
-<br>
-<?
+ $startdate = $ogReport->startdate;
+ $list_report_form->assign("STARTDATE",$startdate);
+
+ $enddate = $ogReport->enddate;
+ $list_report_form->assign("ENDDATE",$enddate);
+
+ $list_report_form->assign("MOD", $mod_strings);
+ $list_report_form->assign("APP", $app_strings);
+ $list_report_form->assign("IMAGE_PATH", $image_path);
+ $list_report_form->assign("REPORTID", $reportid);
+ $list_report_form->assign("REPORTNAME", $ogReport->reportname);
+ $list_report_form->assign("REPORTHTML", $sshtml);
+ $list_report_form->assign("REPORTTOTHTML", $totalhtml);
+ $list_report_form->assign("FOLDERID", $folderid);
+ if($_REQUEST['mode'] != 'ajax')
+ {
+ $list_report_form->assign("REPINFOLDER", getReportsinFolder($folderid));
+ include('themes/'.$theme.'/header.php');
+ $list_report_form->display('ReportRun.tpl');
+ }
+ else
+ {
+ $list_report_form->display('ReportRunContents.tpl');
+ }
}
else
{
echo $mod_strings['LBL_NO_PERMISSION']." ".$primarymodule." ".$secondarymodule;
}
+function getPrimaryStdFilterHTML($module,$selected="")
+{
+ global $app_list_strings;
+ global $ogReport;
+ global $current_language;
+
+ $mod_strings = return_module_language($current_language,$module);
+
+ $result = $ogReport->getStdCriteriaByModule($module);
+
+ if(isset($result))
+ {
+ foreach($result as $key=>$value)
+ {
+ if(isset($mod_strings[$value]))
+ {
+ if($key == $selected)
+ {
+ $shtml .= "<option selected value=\"".$key."\">".$app_list_strings['moduleList'][$module]." - ".$mod_strings[$value]."</option>";
+ }else
+ {
+ $shtml .= "<option value=\"".$key."\">".$app_list_strings['moduleList'][$module]." - ".$mod_strings[$value]."</option>";
+ }
+ }else
+ {
+ if($key == $selected)
+ {
+ $shtml .= "<option selected value=\"".$key."\">".$app_list_strings['moduleList'][$module]." - ".$value."</option>";
+ }else
+ {
+ $shtml .= "<option value=\"".$key."\">".$app_list_strings['moduleList'][$module]." - ".$value."</option>";
+ }
+ }
+ }
+ }
+
+ return $shtml;
+}
+
+function getSecondaryStdFilterHTML($module,$selected="")
+{
+ global $app_list_strings;
+ global $ogReport;
+ global $current_language;
+
+ if($module != "")
+ {
+ $secmodule = explode(":",$module);
+ for($i=0;$i < count($secmodule) ;$i++)
+ {
+ $result = $ogReport->getStdCriteriaByModule($secmodule[$i]);
+ $mod_strings = return_module_language($current_language,$secmodule[$i]);
+ if(isset($result))
+ {
+ foreach($result as $key=>$value)
+ {
+ if(isset($mod_strings[$value]))
+ {
+ if($key == $selected)
+ {
+ $shtml .= "<option selected value=\"".$key."\">".$app_list_strings['moduleList'][$secmodule[$i]]." - ".$mod_strings[$value]."</option>";
+ }else
+ {
+ $shtml .= "<option value=\"".$key."\">".$app_list_strings['moduleList'][$secmodule[$i]]." - ".$mod_strings[$value]."</option>";
+ }
+ }else
+ {
+ if($key == $selected)
+ {
+ $shtml .= "<option selected value=\"".$key."\">".$app_list_strings['moduleList'][$secmodule[$i]]." - ".$value."</option>";
+ }else
+ {
+ $shtml .= "<option value=\"".$key."\">".$app_list_strings['moduleList'][$secmodule[$i]]." - ".$value."</option>";
+ }
+ }
+ }
+ }
+
+ }
+ }
+ return $shtml;
+}
+function getReportsinFolder($folderid)
+{
+ global $adb;
+ $query = 'select reportid,reportname from report where folderid='.$folderid;
+ $result = $adb->query($query);
+ $reports_array = Array();
+ for($i=0;$i < $adb->num_rows($result);$i++)
+ {
+ $reportid = $adb->query_result($result,$i,'reportid');
+ $reportname = $adb->query_result($result,$i,'reportname');
+ $reports_array[$reportid] = $reportname;
+ }
+ if(count($reports_array) > 0)
+ return $reports_array;
+ else
+ return false;
+}
+?>
Modified: vtigercrm/trunk/modules/Reports/SaveReportFolder.php
==============================================================================
--- vtigercrm/trunk/modules/Reports/SaveReportFolder.php (original)
+++ vtigercrm/trunk/modules/Reports/SaveReportFolder.php Sat Apr 29 11:06:37 2006
@@ -18,16 +18,11 @@
$focus = new Reports();
$rfid = $_REQUEST['record'];
-$mode = $_REQUEST['mode'];
-$foldername = addslashes($_REQUEST["folderName"]);
-$folderdesc = addslashes($_REQUEST["folderDesc"]);
-//echo $id.$mode."1".$foldername."2".$folderdesc;
-
-if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") $return_module = $_REQUEST['return_module'];
-else $return_module = "Reports";
-if(isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "") $return_action = $_REQUEST['return_action'];
-else $return_action = "index";
-
+$mode = $_REQUEST['savemode'];
+$foldername = addslashes($_REQUEST["foldername"]);
+$folderdesc = addslashes($_REQUEST["folderdesc"]);
+$foldername = str_replace('*amp*','&',$foldername);
+$folderdesc = str_replace('*amp*','&',$folderdesc);
if($mode=="Save")
{
if($rfid=="")
@@ -38,7 +33,7 @@
$result = $adb->query($sql);
if($result!=false)
{
- header("Location: index.php?action=$return_action&module=$return_module");
+ header("Location: index.php?action=ReportsAjax&file=ListView&mode=ajax&module=Reports");
}else
{
include('themes/'.$theme.'/header.php');
@@ -59,7 +54,7 @@
$result = $adb->query($sql);
if($result!=false)
{
- header("Location: index.php?action=$return_action&module=$return_module");
+ header("Location: index.php?action=ReportsAjax&file=ListView&mode=ajax&module=Reports");
}else
{
include('themes/'.$theme.'/header.php');
Modified: vtigercrm/trunk/modules/Reports/StandardFilter.php
==============================================================================
--- vtigercrm/trunk/modules/Reports/StandardFilter.php (original)
+++ vtigercrm/trunk/modules/Reports/StandardFilter.php Sat Apr 29 11:06:37 2006
@@ -8,31 +8,6 @@
* All Rights Reserved.
*
********************************************************************************/
-require_once('XTemplate/xtpl.php');
-require_once("data/Tracker.php");
-require_once('themes/'.$theme.'/layout_utils.php');
-require_once('include/logging.php');
-require_once('include/utils/utils.php');
-require_once('modules/Reports/Reports.php');
-require_once('include/database/PearDatabase.php');
-
-global $app_strings;
-global $app_list_strings;
-global $mod_strings;
-$current_module_strings = return_module_language($current_language, 'Reports');
-
-global $list_max_entries_per_page;
-global $urlPrefix;
-
-$log = LoggerManager::getLogger('report_type');
-
-global $currentModule;
-global $image_path;
-global $theme;
-$report_std_filter=new XTemplate('modules/Reports/StandardFilter.html');
-$report_std_filter->assign("MOD", $mod_strings);
-$report_std_filter->assign("APP", $app_strings);
-$report_std_filter->assign("IMAGE_PATH",$image_path);
if(isset($_REQUEST["record"]) == false)
{
@@ -43,11 +18,11 @@
$BLOCK1 = getPrimaryStdFilterHTML($primarymodule);
$BLOCK1 .= getSecondaryStdFilterHTML($secondarymodule);
- $report_std_filter->assign("BLOCK1",$BLOCK1);
+ $report_std_filter->assign("BLOCK1_STD",$BLOCK1);
$BLOCKJS = $oReport->getCriteriaJS();
- $report_std_filter->assign("BLOCKJS",$BLOCKJS);
+ $report_std_filter->assign("BLOCKJS_STD",$BLOCKJS);
$BLOCKCRITERIA = $oReport->getSelectedStdFilterCriteria();
- $report_std_filter->assign("BLOCKCRITERIA",$BLOCKCRITERIA);
+ $report_std_filter->assign("BLOCKCRITERIA_STD",$BLOCKCRITERIA);
}elseif(isset($_REQUEST["record"]) == true)
{
@@ -55,21 +30,21 @@
$oReport = new Reports($reportid);
$oReport->getSelectedStandardCriteria($reportid);
- $BLOCK1 = getPrimaryStdFilterHTML($primarymodule,$oReport->stdselectedcolumn);
- $BLOCK1 .= getSecondaryStdFilterHTML($secondarymodule,$oReport->stdselectedcolumn);
- $report_std_filter->assign("BLOCK1",$BLOCK1);
+ $BLOCK1 = getPrimaryStdFilterHTML($oReport->primodule,$oReport->stdselectedcolumn);
+ $BLOCK1 .= getSecondaryStdFilterHTML($oReport->secmodule,$oReport->stdselectedcolumn);
+ $report_std_filter->assign("BLOCK1_STD",$BLOCK1);
$BLOCKJS = $oReport->getCriteriaJS();
- $report_std_filter->assign("BLOCKJS",$BLOCKJS);
+ $report_std_filter->assign("BLOCKJS_STD",$BLOCKJS);
$BLOCKCRITERIA = $oReport->getSelectedStdFilterCriteria($oReport->stdselectedfilter);
- $report_std_filter->assign("BLOCKCRITERIA",$BLOCKCRITERIA);
+ $report_std_filter->assign("BLOCKCRITERIA_STD",$BLOCKCRITERIA);
$startdate = $oReport->startdate;
- $report_std_filter->assign("STARTDATE",$startdate);
+ $report_std_filter->assign("STARTDATE_STD",$startdate);
$enddate = $oReport->enddate;
- $report_std_filter->assign("ENDDATE",$enddate);
+ $report_std_filter->assign("ENDDATE_STD",$enddate);
}
@@ -117,7 +92,6 @@
global $app_list_strings;
global $ogReport;
global $current_language;
-
if($module != "")
{
$secmodule = explode(":",$module);
@@ -155,7 +129,5 @@
}
return $shtml;
}
-$report_std_filter->parse("main");
-$report_std_filter->out("main");
?>
More information about the vtigercrm-commits
mailing list