[Vtigercrm-commits] [vtiger-commits] r7275 - in /vtigercrm/trunk: Smarty/templates/ modules/Reports/
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Mon Jun 19 19:13:36 EDT 2006
Author: saraj
Date: Mon Jun 19 17:13:26 2006
New Revision: 7275
Log:
issues in reports has been fixed
Modified:
vtigercrm/trunk/Smarty/templates/ReportFilters.tpl
vtigercrm/trunk/modules/Reports/Delete.php
vtigercrm/trunk/modules/Reports/Report.js
vtigercrm/trunk/modules/Reports/ReportColumns.php
vtigercrm/trunk/modules/Reports/ReportRun.php
vtigercrm/trunk/modules/Reports/Reports.php
vtigercrm/trunk/modules/Reports/Save.php
vtigercrm/trunk/modules/Reports/SaveAndRun.php
Modified: vtigercrm/trunk/Smarty/templates/ReportFilters.tpl
==============================================================================
--- vtigercrm/trunk/Smarty/templates/ReportFilters.tpl (original)
+++ vtigercrm/trunk/Smarty/templates/ReportFilters.tpl Mon Jun 19 17:13:26 2006
@@ -159,7 +159,7 @@
</tbody>
</table>
</td></tr>
- <tr><td colspan="2" height="63"> </td></tr>
+ <tr><td colspan="2" height="40"> </td></tr>
</tbody>
</table>
{literal}
Modified: vtigercrm/trunk/modules/Reports/Delete.php
==============================================================================
--- vtigercrm/trunk/modules/Reports/Delete.php (original)
+++ vtigercrm/trunk/modules/Reports/Delete.php Mon Jun 19 17:13:26 2006
@@ -34,7 +34,7 @@
$idelreportsql = "delete from vtiger_selectquery where queryid=".$reportid;
$idelreportsqlresult = $adb->query($idelreportsql);
- $ireportsql = "delete from vtiger_report where vtiger_reportid=".$reportid;
+ $ireportsql = "delete from vtiger_report where reportid=".$reportid;
$ireportsqlresult = $adb->query($ireportsql);
}
?>
Modified: vtigercrm/trunk/modules/Reports/Report.js
==============================================================================
--- vtigercrm/trunk/modules/Reports/Report.js (original)
+++ vtigercrm/trunk/modules/Reports/Report.js Mon Jun 19 17:13:26 2006
@@ -7,7 +7,6 @@
* All Rights Reserved.
*
********************************************************************************/
-
var typeofdata = new Array();
typeofdata['V'] = ['e','n','s','c','k'];
typeofdata['N'] = ['e','n','l','g','m','h'];
@@ -159,287 +158,184 @@
}
function setObjects()
- {
- availListObj=getObj("availList")
- selectedColumnsObj=getObj("selectedColumns")
-
- moveupLinkObj=getObj("moveup_link")
- moveupDisabledObj=getObj("moveup_disabled")
- movedownLinkObj=getObj("movedown_link")
- movedownDisabledObj=getObj("movedown_disabled")
- }
-
- function addColumn()
- {
- for (i=0;i<selectedColumnsObj.length;i++)
- {
- selectedColumnsObj.options[i].selected=false
- }
-
- for (i=0;i<availListObj.length;i++)
- {
- if (availListObj.options[i].selected==true)
- {
- for (j=0;j<selectedColumnsObj.length;j++)
- {
- if (selectedColumnsObj.options[j].value==availListObj.options[i].value)
- {
- var rowFound=true
- var existingObj=selectedColumnsObj.options[j]
- break
- }
- }
-
- if (rowFound!=true)
- {
- var newColObj=document.createElement("OPTION")
- newColObj.value=availListObj.options[i].value
- if (browser_ie) newColObj.innerText=availListObj.options[i].innerText
- else if (browser_nn4 || browser_nn6) newColObj.text=availListObj.options[i].text
- selectedColumnsObj.appendChild(newColObj)
- availListObj.options[i].selected=false
- newColObj.selected=true
- rowFound=false
- }
- else
- {
- existingObj.selected=true
- }
- }
- }
- }
-
- function delColumn()
- {
- for (i=0;i<=selectedColumnsObj.options.length;i++)
- {
- if (selectedColumnsObj.options.selectedIndex>=0)
- selectedColumnsObj.remove(selectedColumnsObj.options.selectedIndex)
- }
- }
-
- function formSelectColumnString()
- {
- var selectedColStr = "";
- for (i=0;i<selectedColumnsObj.options.length;i++)
- {
- selectedColStr += selectedColumnsObj.options[i].value + ";";
- }
- document.NewReport.selectedColumnsString.value = selectedColStr;
- }
+{
+ availListObj=getObj("availList")
+ selectedColumnsObj=getObj("selectedColumns")
+
+ moveupLinkObj=getObj("moveup_link")
+ moveupDisabledObj=getObj("moveup_disabled")
+ movedownLinkObj=getObj("movedown_link")
+ movedownDisabledObj=getObj("movedown_disabled")
+}
+
+function addColumn()
+{
+ for (i=0;i<selectedColumnsObj.length;i++)
+ {
+ selectedColumnsObj.options[i].selected=false
+ }
+
+ for (i=0;i<availListObj.length;i++)
+ {
+ if (availListObj.options[i].selected==true)
+ {
+ for (j=0;j<selectedColumnsObj.length;j++)
+ {
+ if (selectedColumnsObj.options[j].value==availListObj.options[i].value)
+ {
+ var rowFound=true
+ var existingObj=selectedColumnsObj.options[j]
+ break
+ }
+ }
+
+ if (rowFound!=true)
+ {
+ var newColObj=document.createElement("OPTION")
+ newColObj.value=availListObj.options[i].value
+ if (browser_ie) newColObj.innerText=availListObj.options[i].innerText
+ else if (browser_nn4 || browser_nn6) newColObj.text=availListObj.options[i].text
+ selectedColumnsObj.appendChild(newColObj)
+ availListObj.options[i].selected=false
+ newColObj.selected=true
+ rowFound=false
+ }
+ else
+ {
+ existingObj.selected=true
+ }
+ }
+ }
+}
+
+function delColumn()
+{
+ for (i=0;i<=selectedColumnsObj.options.length;i++)
+ {
+ if (selectedColumnsObj.options.selectedIndex>=0)
+ selectedColumnsObj.remove(selectedColumnsObj.options.selectedIndex)
+ }
+}
+
+function formSelectColumnString()
+{
+ var selectedColStr = "";
+ for (i=0;i<selectedColumnsObj.options.length;i++)
+ {
+ selectedColStr += selectedColumnsObj.options[i].value + ";";
+ }
+ document.NewReport.selectedColumnsString.value = selectedColStr;
+}
+
+function moveUp()
+{
+ var currpos=selectedColumnsObj.options.selectedIndex
+ if (currpos>0)
+ {
+ var prevpos=selectedColumnsObj.options.selectedIndex-1
+
+ if (browser_ie)
+ {
+ temp=selectedColumnsObj.options[prevpos].innerText
+ selectedColumnsObj.options[prevpos].innerText=selectedColumnsObj.options[currpos].innerText
+ selectedColumnsObj.options[currpos].innerText=temp
+ }
+ else if (browser_nn4 || browser_nn6)
+ {
+ temp=selectedColumnsObj.options[prevpos].text
+ selectedColumnsObj.options[prevpos].text=selectedColumnsObj.options[currpos].text
+ selectedColumnsObj.options[currpos].text=temp
+ }
+ temp=selectedColumnsObj.options[prevpos].value
+ selectedColumnsObj.options[prevpos].value=selectedColumnsObj.options[currpos].value
+ selectedColumnsObj.options[currpos].value=temp
+
+ selectedColumnsObj.options[prevpos].selected=true
+ selectedColumnsObj.options[currpos].selected=false
+ }
+}
+
+function moveDown()
+{
+ var currpos=selectedColumnsObj.options.selectedIndex
+ if (currpos<selectedColumnsObj.options.length-1)
+ {
+ var nextpos=selectedColumnsObj.options.selectedIndex+1
+
+ if (browser_ie)
+ {
+ temp=selectedColumnsObj.options[nextpos].innerText
+ selectedColumnsObj.options[nextpos].innerText=selectedColumnsObj.options[currpos].innerText
+ selectedColumnsObj.options[currpos].innerText=temp
+ }
+ else if (browser_nn4 || browser_nn6)
+ {
+ temp=selectedColumnsObj.options[nextpos].text
+ selectedColumnsObj.options[nextpos].text=selectedColumnsObj.options[currpos].text
+ selectedColumnsObj.options[currpos].text=temp
+ }
+ temp=selectedColumnsObj.options[nextpos].value
+ selectedColumnsObj.options[nextpos].value=selectedColumnsObj.options[currpos].value
+ selectedColumnsObj.options[currpos].value=temp
+
+ selectedColumnsObj.options[nextpos].selected=true
+ selectedColumnsObj.options[currpos].selected=false
+ }
+}
+
+function disableMove()
+{
+ var cnt=0
+ for (i=0;i<selectedColumnsObj.options.length;i++)
+ {
+ if (selectedColumnsObj.options[i].selected==true)
+ cnt++
+ }
+
+ if (cnt>1)
+ {
+ moveupLinkObj.style.display=movedownLinkObj.style.display="none"
+ moveupDisabledObj.style.display=movedownDisabledObj.style.display="block"
+ }
+ else
+ {
+ moveupLinkObj.style.display=movedownLinkObj.style.display="block"
+ moveupDisabledObj.style.display=movedownDisabledObj.style.display="none"
+ }
+}
+
+
+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 moveUp()
- {
- var currpos=selectedColumnsObj.options.selectedIndex
- if (currpos>0)
- {
- var prevpos=selectedColumnsObj.options.selectedIndex-1
-
- if (browser_ie)
- {
- temp=selectedColumnsObj.options[prevpos].innerText
- selectedColumnsObj.options[prevpos].innerText=selectedColumnsObj.options[currpos].innerText
- selectedColumnsObj.options[currpos].innerText=temp
- }
- else if (browser_nn4 || browser_nn6)
- {
- temp=selectedColumnsObj.options[prevpos].text
- selectedColumnsObj.options[prevpos].text=selectedColumnsObj.options[currpos].text
- selectedColumnsObj.options[currpos].text=temp
- }
- temp=selectedColumnsObj.options[prevpos].value
- selectedColumnsObj.options[prevpos].value=selectedColumnsObj.options[currpos].value
- selectedColumnsObj.options[currpos].value=temp
-
- selectedColumnsObj.options[prevpos].selected=true
- selectedColumnsObj.options[currpos].selected=false
- }
- }
-
- function moveDown()
- {
- var currpos=selectedColumnsObj.options.selectedIndex
- if (currpos<selectedColumnsObj.options.length-1)
- {
- var nextpos=selectedColumnsObj.options.selectedIndex+1
-
- if (browser_ie)
- {
- temp=selectedColumnsObj.options[nextpos].innerText
- selectedColumnsObj.options[nextpos].innerText=selectedColumnsObj.options[currpos].innerText
- selectedColumnsObj.options[currpos].innerText=temp
- }
- else if (browser_nn4 || browser_nn6)
- {
- temp=selectedColumnsObj.options[nextpos].text
- selectedColumnsObj.options[nextpos].text=selectedColumnsObj.options[currpos].text
- selectedColumnsObj.options[currpos].text=temp
- }
- temp=selectedColumnsObj.options[nextpos].value
- selectedColumnsObj.options[nextpos].value=selectedColumnsObj.options[currpos].value
- selectedColumnsObj.options[currpos].value=temp
-
- selectedColumnsObj.options[nextpos].selected=true
- selectedColumnsObj.options[currpos].selected=false
- }
- }
-
- function disableMove()
- {
- var cnt=0
- for (i=0;i<selectedColumnsObj.options.length;i++)
- {
- if (selectedColumnsObj.options[i].selected==true)
- cnt++
- }
-
- if (cnt>1)
- {
- moveupLinkObj.style.display=movedownLinkObj.style.display="none"
- moveupDisabledObj.style.display=movedownDisabledObj.style.display="block"
- }
- else
- {
- moveupLinkObj.style.display=movedownLinkObj.style.display="block"
- moveupDisabledObj.style.display=movedownDisabledObj.style.display="none"
- }
- }
+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();
+ document.NewReport.submit();
+}
- function selectAction( url )
- {
- formSelectColumnString();
- document.NewReport.action = url;
- document.NewReport.submit();
- }
-
-function getOpenerObj(n) {
-
- return getObj(n,opener.document)
-
-}
-function saveReport( dlgType )
- {
- if( !emptyCheck( "reportName", "Report Name" ) )
- return false;
-
- 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 = getObj( "NewReport" );
- if( getObj( 'reportId' ) != null )
- {
- formObj.removeChild( getOpenerObj( 'reportId' ) );
- }
- }
- else
- {
-// formObj = getOpenerObj( "SaveAsForm" );
- actionObj.value = "saveAs";
- }
-
- repNameObj.value = document.NewReport.reportName.value;
- repDescObj.value = document.NewReport.reportDesc.value;
- folderObj.value = document.NewReport.folder.value;
- formObj.submit();
-
- 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')
@@ -486,16 +382,6 @@
}
}
}
-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')
Modified: vtigercrm/trunk/modules/Reports/ReportColumns.php
==============================================================================
--- vtigercrm/trunk/modules/Reports/ReportColumns.php (original)
+++ vtigercrm/trunk/modules/Reports/ReportColumns.php Mon Jun 19 17:13:26 2006
@@ -35,21 +35,21 @@
$report_column->assign("IMAGE_PATH",$image_path);
if(isset($_REQUEST["record"]))
{
- $recordid = $_REQUEST["record"];
- $oReport = new Reports($recordid);
+ $recordid = $_REQUEST["record"];
+ $oReport = new Reports($recordid);
$BLOCK1 = getPrimaryColumnsHTML($oReport->primodule);
$BLOCK1 .= getSecondaryColumnsHTML($oReport->secmodule);
- $BLOCK2 = $oReport->getSelectedColumnsList($recordid);
+ $BLOCK2 = $oReport->getSelectedColumnsList($recordid);
$report_column->assign("BLOCK1",$BLOCK1);
$report_column->assign("BLOCK2",$BLOCK2);
}else
{
$primarymodule = $_REQUEST["primarymodule"];
- $secondarymodule = $_REQUEST["secondarymodule"];
+ $secondarymodule = $_REQUEST["secondarymodule"];
$BLOCK1 = getPrimaryColumnsHTML($primarymodule);
$BLOCK1 .= getSecondaryColumnsHTML($secondarymodule);
$report_column->assign("BLOCK1",$BLOCK1);
-
+
}
/** Function to formulate the vtiger_fields for the primary modules
@@ -60,28 +60,28 @@
function getPrimaryColumnsHTML($module)
{
- global $ogReport;
+ 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\">";
- if(isset($ogReport->pri_module_columnslist[$module][$key]))
- {
- foreach($ogReport->pri_module_columnslist[$module][$key] as $field=>$fieldlabel)
+ {
+ if(isset($ogReport->pri_module_columnslist[$module][$key]))
{
- if(isset($mod_strings[$fieldlabel]))
+ $shtml .= "<optgroup label=\"".$app_list_strings['moduleList'][$module]." ".$key."\" class=\"select\" style=\"border:none\">";
+ foreach($ogReport->pri_module_columnslist[$module][$key] as $field=>$fieldlabel)
{
- $shtml .= "<option value=\"".$field."\">".$mod_strings[$fieldlabel]."</option>";
- }else
- {
- $shtml .= "<option value=\"".$field."\">".$fieldlabel."</option>";
+ if(isset($mod_strings[$fieldlabel]))
+ {
+ $shtml .= "<option value=\"".$field."\">".$mod_strings[$fieldlabel]."</option>";
+ }else
+ {
+ $shtml .= "<option value=\"".$field."\">".$fieldlabel."</option>";
+ }
}
}
- }
- }
+ }
return $shtml;
}
@@ -100,30 +100,30 @@
if($module != "")
{
- $secmodule = explode(":",$module);
- for($i=0;$i < count($secmodule) ;$i++)
- {
- $mod_strings = return_module_language($current_language,$secmodule[$i]);
- foreach($ogReport->module_list[$secmodule[$i]] as $key=>$value)
- {
- $shtml .= "<optgroup label=\"".$app_list_strings['moduleList'][$secmodule[$i]]." ".$key."\" class=\"select\" style=\"border:none\">";
- if(isset($ogReport->sec_module_columnslist[$secmodule[$i]][$key]))
+ $secmodule = explode(":",$module);
+ for($i=0;$i < count($secmodule) ;$i++)
+ {
+ $mod_strings = return_module_language($current_language,$secmodule[$i]);
+ foreach($ogReport->module_list[$secmodule[$i]] as $key=>$value)
{
- foreach($ogReport->sec_module_columnslist[$secmodule[$i]][$key] as $field=>$fieldlabel)
+ if(isset($ogReport->sec_module_columnslist[$secmodule[$i]][$key]))
{
- if(isset($mod_strings[$fieldlable]))
+ $shtml .= "<optgroup label=\"".$app_list_strings['moduleList'][$secmodule[$i]]." ".$key."\" class=\"select\" style=\"border:none\">";
+ foreach($ogReport->sec_module_columnslist[$secmodule[$i]][$key] as $field=>$fieldlabel)
{
- $shtml .= "<option value=\"".$field."\">".$mod_strings[$fieldlabel]."</option>";
- }else
- {
- $shtml .= "<option value=\"".$field."\">".$fieldlabel."</option>";
+ if(isset($mod_strings[$fieldlable]))
+ {
+ $shtml .= "<option value=\"".$field."\">".$mod_strings[$fieldlabel]."</option>";
+ }else
+ {
+ $shtml .= "<option value=\"".$field."\">".$fieldlabel."</option>";
+ }
}
}
}
- }
+ }
}
- }
- return $shtml;
+ return $shtml;
}
$report_column->display("ReportColumns.tpl");
Modified: vtigercrm/trunk/modules/Reports/ReportRun.php
==============================================================================
--- vtigercrm/trunk/modules/Reports/ReportRun.php (original)
+++ vtigercrm/trunk/modules/Reports/ReportRun.php Mon Jun 19 17:13:26 2006
@@ -30,7 +30,7 @@
var $selectcolumns;
var $groupbylist;
- var $reporttype;
+ var $reporttype;
var $reportname;
var $totallist;
@@ -43,7 +43,7 @@
$this->reporttype = $oReport->reporttype;
$this->reportname = $oReport->reportname;
}
-
+
function getQueryColumnsList($reportid)
{
global $adb;
@@ -51,11 +51,11 @@
global $log;
$ssql = "select vtiger_selectcolumn.* from vtiger_report inner join vtiger_selectquery on vtiger_selectquery.queryid = vtiger_report.queryid";
- $ssql .= " left join vtiger_selectcolumn on vtiger_selectcolumn.queryid = vtiger_selectquery.queryid";
+ $ssql .= " left join vtiger_selectcolumn on vtiger_selectcolumn.queryid = vtiger_selectquery.queryid";
$ssql .= " where vtiger_report.reportid =".$reportid;
- $ssql .= " order by vtiger_selectcolumn.columnindex";
-
- $result = $adb->query($ssql);
+ $ssql .= " order by vtiger_selectcolumn.columnindex";
+
+ $result = $adb->query($ssql);
while($columnslistrow = $adb->fetch_array($result))
{
@@ -95,18 +95,18 @@
}
return $querycolumn;
}
-
+
function getSelectedColumnsList($reportid)
{
-
+
global $adb;
global $modules;
global $log;
-
+
$ssql = "select vtiger_selectcolumn.* from vtiger_report inner join vtiger_selectquery on vtiger_selectquery.queryid = vtiger_report.queryid";
$ssql .= " left join vtiger_selectcolumn on vtiger_selectcolumn.queryid = vtiger_selectquery.queryid where vtiger_report.reportid =".$reportid;
$ssql .= " order by vtiger_selectcolumn.columnindex";
-
+
$result = $adb->query($ssql);
$noofrows = $adb->num_rows($result);
@@ -114,7 +114,7 @@
{
$sSQL .= $this->orderbylistsql.", ";
}
-
+
for($i=0; $i<$noofrows; $i++)
{
$fieldcolname = $adb->query_result($result,$i,"columnname");
@@ -140,69 +140,69 @@
}
}
$sSQL .= implode(",",$sSQLList);
-
- $log->info("ReportRun :: Successfully returned getSelectedColumnsList".$reportid);
+
+ $log->info("ReportRun :: Successfully returned getSelectedColumnsList".$reportid);
return $sSQL;
}
-
+
function getAdvComparator($comparator,$value)
- {
+ {
global $log,$adb;
if($comparator == "e")
- {
- if(trim($value) != "")
+ {
+ if(trim($value) != "")
{
$rtvalue = " = ".$adb->quote($value);
}else
{
$rtvalue = " is NULL";
}
- }
- if($comparator == "n")
- {
- if(trim($value) != "")
+ }
+ if($comparator == "n")
+ {
+ if(trim($value) != "")
{
$rtvalue = " <> ".$adb->quote($value);
}else
{
$rtvalue = " is NOT NULL";
}
- }
- if($comparator == "s")
- {
- $rtvalue = " like ".$adb->quote($value."%");
- }
- if($comparator == "c")
- {
- $rtvalue = " like ".$adb->quote("%".$value."%");
- }
- if($comparator == "k")
- {
- $rtvalue = " not like ".$adb->quote("%".$value."%");
- }
- if($comparator == "l")
- {
- $rtvalue = " < ".$adb->quote($value);
- }
- if($comparator == "g")
- {
- $rtvalue = " > ".$adb->quote($value);
- }
- if($comparator == "m")
- {
- $rtvalue = " <= ".$adb->quote($value);
- }
- if($comparator == "h")
- {
- $rtvalue = " >= ".$adb->quote($value);
- }
-
- $log->info("ReportRun :: Successfully returned getAdvComparator");
+ }
+ if($comparator == "s")
+ {
+ $rtvalue = " like ".$adb->quote($value."%");
+ }
+ if($comparator == "c")
+ {
+ $rtvalue = " like ".$adb->quote("%".$value."%");
+ }
+ if($comparator == "k")
+ {
+ $rtvalue = " not like ".$adb->quote("%".$value."%");
+ }
+ if($comparator == "l")
+ {
+ $rtvalue = " < ".$adb->quote($value);
+ }
+ if($comparator == "g")
+ {
+ $rtvalue = " > ".$adb->quote($value);
+ }
+ if($comparator == "m")
+ {
+ $rtvalue = " <= ".$adb->quote($value);
+ }
+ if($comparator == "h")
+ {
+ $rtvalue = " >= ".$adb->quote($value);
+ }
+
+ $log->info("ReportRun :: Successfully returned getAdvComparator");
return $rtvalue;
- }
-
+ }
+
function getAdvFilterList($reportid)
{
global $adb;
@@ -211,37 +211,37 @@
$advfiltersql = "select vtiger_relcriteria.* from vtiger_report";
$advfiltersql .= " inner join vtiger_selectquery on vtiger_selectquery.queryid = vtiger_report.queryid";
- $advfiltersql .= " left join vtiger_relcriteria on vtiger_relcriteria.queryid = vtiger_selectquery.queryid";
- $advfiltersql .= " where vtiger_report.reportid =".$reportid;
- $advfiltersql .= " order by vtiger_relcriteria.columnindex";
-
+ $advfiltersql .= " left join vtiger_relcriteria on vtiger_relcriteria.queryid = vtiger_selectquery.queryid";
+ $advfiltersql .= " where vtiger_report.reportid =".$reportid;
+ $advfiltersql .= " order by vtiger_relcriteria.columnindex";
+
$result = $adb->query($advfiltersql);
while($advfilterrow = $adb->fetch_array($result))
{
- $fieldcolname = $advfilterrow["columnname"];
- $comparator = $advfilterrow["comparator"];
- $value = $advfilterrow["value"];
-
- if($fieldcolname != "" && $comparator != "")
- {
- $selectedfields = explode(":",$fieldcolname);
- $valuearray = explode(",",trim($value));
- if(isset($valuearray) && count($valuearray) > 1)
- {
- $advorsql = "";
- for($n=0;$n<count($valuearray);$n++)
- {
- $advorsql[] = $selectedfields[0].".".$selectedfields[1].$this->getAdvComparator($comparator,trim($valuearray[$n]));
- }
- $advorsqls = implode(" or ",$advorsql);
- $fieldvalue = " (".$advorsqls.") ";
- }else
- {
- $fieldvalue = $selectedfields[0].".".$selectedfields[1].$this->getAdvComparator($comparator,trim($value));
- }
- $advfilterlist[$fieldcolname] = $fieldvalue;
- }
-
+ $fieldcolname = $advfilterrow["columnname"];
+ $comparator = $advfilterrow["comparator"];
+ $value = $advfilterrow["value"];
+
+ if($fieldcolname != "" && $comparator != "")
+ {
+ $selectedfields = explode(":",$fieldcolname);
+ $valuearray = explode(",",trim($value));
+ if(isset($valuearray) && count($valuearray) > 1)
+ {
+ $advorsql = "";
+ for($n=0;$n<count($valuearray);$n++)
+ {
+ $advorsql[] = $selectedfields[0].".".$selectedfields[1].$this->getAdvComparator($comparator,trim($valuearray[$n]));
+ }
+ $advorsqls = implode(" or ",$advorsql);
+ $fieldvalue = " (".$advorsqls.") ";
+ }else
+ {
+ $fieldvalue = $selectedfields[0].".".$selectedfields[1].$this->getAdvComparator($comparator,trim($value));
+ }
+ $advfilterlist[$fieldcolname] = $fieldvalue;
+ }
+
}
$log->info("ReportRun :: Successfully returned getAdvFilterList".$reportid);
return $advfilterlist;
@@ -269,21 +269,21 @@
if($fieldcolname != "none")
{
if($datefilter == "custom")
- {
- if($startdate != "0000-00-00" && $enddate != "0000-00-00")
- {
- $selectedfields = explode(":",$fieldcolname);
- $stdfilterlist[$fieldcolname] = $selectedfields[0].".".$selectedfields[1]." between '".$startdate."' and '".$enddate."'";
- }
- }else
- {
- $selectedfields = explode(":",$fieldcolname);
- $startenddate = $this->getStandarFiltersStartAndEndDate($datefilter);
- if($startenddate[0] != "" && $startenddate[1] != "")
- {
- $stdfilterlist[$fieldcolname] = $selectedfields[0].".".$selectedfields[1]." between '".$startenddate[0]." 00:00:00' and '".$startenddate[1]." 23:59:00'";
- }
- }
+ {
+ if($startdate != "0000-00-00" && $enddate != "0000-00-00")
+ {
+ $selectedfields = explode(":",$fieldcolname);
+ $stdfilterlist[$fieldcolname] = $selectedfields[0].".".$selectedfields[1]." between '".$startdate."' and '".$enddate."'";
+ }
+ }else
+ {
+ $selectedfields = explode(":",$fieldcolname);
+ $startenddate = $this->getStandarFiltersStartAndEndDate($datefilter);
+ if($startenddate[0] != "" && $startenddate[1] != "")
+ {
+ $stdfilterlist[$fieldcolname] = $selectedfields[0].".".$selectedfields[1]." between '".$startenddate[0]." 00:00:00' and '".$startenddate[1]." 23:59:00'";
+ }
+ }
}
}
@@ -304,13 +304,13 @@
}else
{
if($startdate != "" && $enddate != "")
- {
- $selectedfields = explode(":",$filtercolumn);
- $startenddate = $this->getStandarFiltersStartAndEndDate($filter);
- if($startenddate[0] != "" && $startenddate[1] != "")
- {
- $stdfilterlist[$filtercolumn] = $selectedfields[0].".".$selectedfields[1]." between '".$startenddate[0]." 00:00:00' and '".$startenddate[1]." 23:59:00'";
- }
+ {
+ $selectedfields = explode(":",$filtercolumn);
+ $startenddate = $this->getStandarFiltersStartAndEndDate($filter);
+ if($startenddate[0] != "" && $startenddate[1] != "")
+ {
+ $stdfilterlist[$filtercolumn] = $selectedfields[0].".".$selectedfields[1]." between '".$startenddate[0]." 00:00:00' and '".$startenddate[1]." 23:59:00'";
+ }
}
}
@@ -327,17 +327,17 @@
$sreportstdfiltersql = "select vtiger_reportdatefilter.* from vtiger_report";
$sreportstdfiltersql .= " inner join vtiger_reportdatefilter on vtiger_report.reportid = vtiger_reportdatefilter.datefilterid";
$sreportstdfiltersql .= " where vtiger_report.reportid =".$reportid;
-
+
$result = $adb->query($sreportstdfiltersql);
$noofrows = $adb->num_rows($result);
-
+
for($i=0; $i<$noofrows; $i++)
{
$fieldcolname = $adb->query_result($result,$i,"datecolumnname");
$datefilter = $adb->query_result($result,$i,"datefilter");
$startdate = $adb->query_result($result,$i,"startdate");
$enddate = $adb->query_result($result,$i,"enddate");
-
+
if($fieldcolname != "none")
{
if($datefilter == "custom")
@@ -358,208 +358,208 @@
}
}
}
- $log->info("ReportRun :: Successfully returned getStandardCriterialSql".$reportid);
+ $log->info("ReportRun :: Successfully returned getStandardCriterialSql".$reportid);
return $sSQL;
}
function getStandarFiltersStartAndEndDate($type)
{
- $today = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d"), date("Y")));
- $tomorrow = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+1, date("Y")));
- $yesterday = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-1, date("Y")));
-
- $currentmonth0 = date("Y-m-d",mktime(0, 0, 0, date("m"), "01", date("Y")));
- $currentmonth1 = date("Y-m-t");
- $lastmonth0 = date("Y-m-d",mktime(0, 0, 0, date("m")-1, "01", date("Y")));
- $lastmonth1 = date("Y-m-t", strtotime("-1 Month"));
- $nextmonth0 = date("Y-m-d",mktime(0, 0, 0, date("m")+1, "01", date("Y")));
- $nextmonth1 = date("Y-m-t", strtotime("+1 Month"));
-
- $lastweek0 = date("Y-m-d",strtotime("-2 week Sunday"));
- $lastweek1 = date("Y-m-d",strtotime("-1 week Saturday"));
-
- $thisweek0 = date("Y-m-d",strtotime("-1 week Sunday"));
- $thisweek1 = date("Y-m-d",strtotime("this Saturday"));
-
- $nextweek0 = date("Y-m-d",strtotime("this Sunday"));
- $nextweek1 = date("Y-m-d",strtotime("+1 week Saturday"));
-
- $next7days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+6, date("Y")));
- $next30days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+29, date("Y")));
- $next60days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+59, date("Y")));
- $next90days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+89, date("Y")));
- $next120days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+119, date("Y")));
-
- $last7days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-6, date("Y")));
- $last30days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-29, date("Y")));
- $last60days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-59, date("Y")));
- $last90days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-89, date("Y")));
- $last120days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-119, date("Y")));
-
- $currentFY0 = date("Y-m-d",mktime(0, 0, 0, "01", "01", date("Y")));
- $currentFY1 = date("Y-m-t",mktime(0, 0, 0, "12", date("d"), date("Y")));
- $lastFY0 = date("Y-m-d",mktime(0, 0, 0, "01", "01", date("Y")-1));
- $lastFY1 = date("Y-m-t", mktime(0, 0, 0, "12", date("d"), date("Y")-1));
- $nextFY0 = date("Y-m-d",mktime(0, 0, 0, "01", "01", date("Y")+1));
- $nextFY1 = date("Y-m-t", mktime(0, 0, 0, "12", date("d"), date("Y")+1));
-
- if($type == "today" )
- {
-
+ $today = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d"), date("Y")));
+ $tomorrow = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+1, date("Y")));
+ $yesterday = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-1, date("Y")));
+
+ $currentmonth0 = date("Y-m-d",mktime(0, 0, 0, date("m"), "01", date("Y")));
+ $currentmonth1 = date("Y-m-t");
+ $lastmonth0 = date("Y-m-d",mktime(0, 0, 0, date("m")-1, "01", date("Y")));
+ $lastmonth1 = date("Y-m-t", strtotime("-1 Month"));
+ $nextmonth0 = date("Y-m-d",mktime(0, 0, 0, date("m")+1, "01", date("Y")));
+ $nextmonth1 = date("Y-m-t", strtotime("+1 Month"));
+
+ $lastweek0 = date("Y-m-d",strtotime("-2 week Sunday"));
+ $lastweek1 = date("Y-m-d",strtotime("-1 week Saturday"));
+
+ $thisweek0 = date("Y-m-d",strtotime("-1 week Sunday"));
+ $thisweek1 = date("Y-m-d",strtotime("this Saturday"));
+
+ $nextweek0 = date("Y-m-d",strtotime("this Sunday"));
+ $nextweek1 = date("Y-m-d",strtotime("+1 week Saturday"));
+
+ $next7days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+6, date("Y")));
+ $next30days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+29, date("Y")));
+ $next60days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+59, date("Y")));
+ $next90days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+89, date("Y")));
+ $next120days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+119, date("Y")));
+
+ $last7days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-6, date("Y")));
+ $last30days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-29, date("Y")));
+ $last60days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-59, date("Y")));
+ $last90days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-89, date("Y")));
+ $last120days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-119, date("Y")));
+
+ $currentFY0 = date("Y-m-d",mktime(0, 0, 0, "01", "01", date("Y")));
+ $currentFY1 = date("Y-m-t",mktime(0, 0, 0, "12", date("d"), date("Y")));
+ $lastFY0 = date("Y-m-d",mktime(0, 0, 0, "01", "01", date("Y")-1));
+ $lastFY1 = date("Y-m-t", mktime(0, 0, 0, "12", date("d"), date("Y")-1));
+ $nextFY0 = date("Y-m-d",mktime(0, 0, 0, "01", "01", date("Y")+1));
+ $nextFY1 = date("Y-m-t", mktime(0, 0, 0, "12", date("d"), date("Y")+1));
+
+ if($type == "today" )
+ {
+
$datevalue[0] = $today;
$datevalue[1] = $today;
- }
- elseif($type == "yesterday" )
- {
-
+ }
+ elseif($type == "yesterday" )
+ {
+
$datevalue[0] = $yesterday;
$datevalue[1] = $yesterday;
- }
- elseif($type == "tomorrow" )
- {
-
+ }
+ elseif($type == "tomorrow" )
+ {
+
$datevalue[0] = $tomorrow;
$datevalue[1] = $tomorrow;
- }
- elseif($type == "thisweek" )
- {
-
+ }
+ elseif($type == "thisweek" )
+ {
+
$datevalue[0] = $thisweek0;
$datevalue[1] = $thisweek1;
- }
- elseif($type == "lastweek" )
- {
-
+ }
+ elseif($type == "lastweek" )
+ {
+
$datevalue[0] = $lastweek0;
$datevalue[1] = $lastweek1;
- }
- elseif($type == "nextweek" )
- {
-
+ }
+ elseif($type == "nextweek" )
+ {
+
$datevalue[0] = $nextweek0;
$datevalue[1] = $nextweek1;
- }
- elseif($type == "thismonth" )
- {
-
+ }
+ elseif($type == "thismonth" )
+ {
+
$datevalue[0] =$currentmonth0;
$datevalue[1] = $currentmonth1;
- }
-
- elseif($type == "lastmonth" )
- {
-
+ }
+
+ elseif($type == "lastmonth" )
+ {
+
$datevalue[0] = $lastmonth0;
$datevalue[1] = $lastmonth1;
- }
- elseif($type == "nextmonth" )
- {
-
+ }
+ elseif($type == "nextmonth" )
+ {
+
$datevalue[0] = $nextmonth0;
$datevalue[1] = $nextmonth1;
- }
- elseif($type == "next7days" )
- {
-
+ }
+ elseif($type == "next7days" )
+ {
+
$datevalue[0] = $today;
$datevalue[1] = $next7days;
- }
- elseif($type == "next30days" )
- {
-
+ }
+ elseif($type == "next30days" )
+ {
+
$datevalue[0] =$today;
$datevalue[1] =$next30days;
- }
- elseif($type == "next60days" )
- {
-
+ }
+ elseif($type == "next60days" )
+ {
+
$datevalue[0] = $today;
$datevalue[1] = $next60days;
- }
- elseif($type == "next90days" )
- {
-
+ }
+ elseif($type == "next90days" )
+ {
+
$datevalue[0] = $today;
$datevalue[1] = $next90days;
- }
- elseif($type == "next120days" )
- {
-
+ }
+ elseif($type == "next120days" )
+ {
+
$datevalue[0] = $today;
$datevalue[1] = $next120days;
- }
- elseif($type == "last7days" )
- {
-
+ }
+ elseif($type == "last7days" )
+ {
+
$datevalue[0] = $last7days;
$datevalue[1] = $today;
- }
- elseif($type == "last30days" )
- {
-
+ }
+ elseif($type == "last30days" )
+ {
+
$datevalue[0] = $last30days;
$datevalue[1] = $today;
- }
- elseif($type == "last60days" )
- {
-
+ }
+ elseif($type == "last60days" )
+ {
+
$datevalue[0] = $last60days;
$datevalue[1] = $today;
- }
- else if($type == "last90days" )
- {
-
+ }
+ else if($type == "last90days" )
+ {
+
$datevalue[0] = $last90days;
$datevalue[1] = $today;
- }
- elseif($type == "last120days" )
- {
-
+ }
+ elseif($type == "last120days" )
+ {
+
$datevalue[0] = $last120days;
$datevalue[1] = $today;
- }
- elseif($type == "thisfy" )
- {
-
+ }
+ elseif($type == "thisfy" )
+ {
+
$datevalue[0] = $currentFY0;
$datevalue[1] = $currentFY1;
- }
- elseif($type == "prevfy" )
- {
-
+ }
+ elseif($type == "prevfy" )
+ {
+
$datevalue[0] = $lastFY0;
$datevalue[1] = $lastFY1;
- }
- elseif($type == "nextfy" )
- {
-
+ }
+ elseif($type == "nextfy" )
+ {
+
$datevalue[0] = $nextFY0;
$datevalue[1] = $nextFY1;
- }
- elseif($type == "nextfq" )
- {
-
+ }
+ elseif($type == "nextfq" )
+ {
+
$datevalue[0] = "2005-07-01";
$datevalue[1] = "2005-09-30";
- }
- elseif($type == "prevfq" )
- {
-
+ }
+ elseif($type == "prevfq" )
+ {
+
$datevalue[0] = "2005-01-01";
$datevalue[1] = "2005-03-31";
- }
- elseif($type == "thisfq" )
- {
+ }
+ elseif($type == "thisfq" )
+ {
$datevalue[0] = "2005-04-01";
$datevalue[1] = "2005-06-30";
- }
- else
- {
+ }
+ else
+ {
$datevalue[0] = "";
$datevalue[1] = "";
- }
-
- return $datevalue;
+ }
+
+ return $datevalue;
}
function getGroupingList($reportid)
@@ -569,16 +569,16 @@
global $log;
$sreportsortsql = "select vtiger_reportsortcol.* from vtiger_report";
- $sreportsortsql .= " inner join vtiger_reportsortcol on vtiger_report.reportid = vtiger_reportsortcol.reportid";
- $sreportsortsql .= " where vtiger_report.reportid =".$reportid." order by vtiger_reportsortcol.sortcolid";
-
+ $sreportsortsql .= " inner join vtiger_reportsortcol on vtiger_report.reportid = vtiger_reportsortcol.reportid";
+ $sreportsortsql .= " where vtiger_report.reportid =".$reportid." order by vtiger_reportsortcol.sortcolid";
+
$result = $adb->query($sreportsortsql);
while($reportsortrow = $adb->fetch_array($result))
{
$fieldcolname = $reportsortrow["columnname"];
$sortorder = $reportsortrow["sortorder"];
-
+
if($sortorder == "Ascending")
{
$sortorder = "ASC";
@@ -587,7 +587,7 @@
{
$sortorder = "DESC";
}
-
+
if($fieldcolname != "none")
{
$selectedfields = explode(":",$fieldcolname);
@@ -596,29 +596,29 @@
$this->groupbylist[$fieldcolname] = $selectedfields[0].".".$selectedfields[1]." ".$selectedfields[2];
}
}
- $log->info("ReportRun :: Successfully returned getGroupingList".$reportid);
+ $log->info("ReportRun :: Successfully returned getGroupingList".$reportid);
return $grouplist;
}
function getSelectedOrderbyList($reportid)
{
-
+
global $adb;
global $modules;
global $log;
-
+
$sreportsortsql = "select vtiger_reportsortcol.* from vtiger_report";
$sreportsortsql .= " inner join vtiger_reportsortcol on vtiger_report.reportid = vtiger_reportsortcol.reportid";
$sreportsortsql .= " where vtiger_report.reportid =".$reportid." order by vtiger_reportsortcol.sortcolid";
-
+
$result = $adb->query($sreportsortsql);
$noofrows = $adb->num_rows($result);
-
+
for($i=0; $i<$noofrows; $i++)
{
$fieldcolname = $adb->query_result($result,$i,"columnname");
$sortorder = $adb->query_result($result,$i,"sortorder");
-
+
if($sortorder == "Ascending")
{
$sortorder = "ASC";
@@ -627,7 +627,7 @@
{
$sortorder = "DESC";
}
-
+
if($fieldcolname != "none")
{
$this->orderbylistcolumns[] = $fieldcolname;
@@ -655,43 +655,45 @@
if($secmodule == "Accounts")
{
$query = "left join vtiger_account on vtiger_account.accountid = vtiger_contactdetails.accountid
- left join vtiger_crmentity as vtiger_crmentityAccounts on vtiger_crmentityAccounts.crmid=vtiger_account.accountid
- left join vtiger_accountbillads on vtiger_account.accountid=vtiger_accountbillads.accountaddressid
- left join vtiger_accountshipads on vtiger_account.accountid=vtiger_accountshipads.accountaddressid
- left join vtiger_accountscf on vtiger_account.accountid = vtiger_accountscf.accountid
- left join vtiger_account as vtiger_accountAccounts on vtiger_accountAccounts.accountid = vtiger_account.parentid
- left join vtiger_users as vtiger_usersAccounts on vtiger_usersAccounts.id = vtiger_crmentityAccounts.smownerid ";
+ left join vtiger_crmentity as vtiger_crmentityAccounts on vtiger_crmentityAccounts.crmid=vtiger_account.accountid
+ left join vtiger_accountbillads on vtiger_account.accountid=vtiger_accountbillads.accountaddressid
+ left join vtiger_accountshipads on vtiger_account.accountid=vtiger_accountshipads.accountaddressid
+ left join vtiger_accountscf on vtiger_account.accountid = vtiger_accountscf.accountid
+ left join vtiger_account as vtiger_accountAccounts on vtiger_accountAccounts.accountid = vtiger_account.parentid
+ left join vtiger_users as vtiger_usersAccounts on vtiger_usersAccounts.id = vtiger_crmentityAccounts.smownerid ";
}
if($secmodule == "Potentials")
{
$query = "left join vtiger_potential on vtiger_potential.accountid = vtiger_contactdetails.accountid
- left join vtiger_crmentity as vtiger_crmentityPotentials on vtiger_crmentityPotentials.crmid=vtiger_potential.potentialid
- left join vtiger_account as vtiger_accountPotentials on vtiger_potential.accountid = vtiger_accountPotentials.accountid
- left join vtiger_potentialscf on vtiger_potentialscf.potentialid = vtiger_potential.potentialid
- left join vtiger_users as vtiger_usersPotentials on vtiger_usersPotentials.id = vtiger_crmentityPotentials.smownerid ";
+ left join vtiger_crmentity as vtiger_crmentityPotentials on vtiger_crmentityPotentials.crmid=vtiger_potential.potentialid
+ left join vtiger_account as vtiger_accountPotentials on vtiger_potential.accountid = vtiger_accountPotentials.accountid
+ left join vtiger_potentialscf on vtiger_potentialscf.potentialid = vtiger_potential.potentialid
+ left join vtiger_users as vtiger_usersPotentials on vtiger_usersPotentials.id = vtiger_crmentityPotentials.smownerid ";
}
if($secmodule == "Quotes")
- {
- $query = "left join vtiger_quotes on vtiger_quotes.contactid = vtiger_contactdetails.contactid
- left join vtiger_crmentity as vtiger_crmentityQuotes on vtiger_crmentityQuotes.crmid=vtiger_quotes.quoteid
- left join vtiger_quotesbillads on vtiger_quotes.quoteid=vtiger_quotesbillads.quotebilladdressid
- left join vtiger_quotesshipads on vtiger_quotes.quoteid=vtiger_quotesshipads.quoteshipaddressid
- left join vtiger_users as vtiger_usersQuotes on vtiger_usersQuotes.id = vtiger_crmentityQuotes.smownerid
- left join vtiger_users as vtiger_usersRel1 on vtiger_usersRel1.id = vtiger_quotes.inventorymanager
- left join vtiger_potential as vtiger_potentialRel on vtiger_potentialRel.potentialid = vtiger_quotes.potentialid
- left join vtiger_contactdetails as vtiger_contactdetailsQuotes on vtiger_contactdetailsQuotes.contactid = vtiger_quotes.contactid
- left join vtiger_account as vtiger_accountQuotes on vtiger_accountQuotes.accountid = vtiger_quotes.accountid ";
- }
- if($secmodule == "PurchaseOrder")
- {
- $query = "left join vtiger_purchaseorder on vtiger_purchaseorder.contactid = vtiger_contactdetails.contactid
- left join vtiger_crmentity as vtiger_crmentityPurchaseOrder on vtiger_crmentityPurchaseOrder.crmid=vtiger_purchaseorder.purchaseorderid
- left join vtiger_pobillads on vtiger_purchaseorder.purchaseorderid=vtiger_pobillads.pobilladdressid
- left join vtiger_poshipads on vtiger_purchaseorder.purchaseorderid=vtiger_poshipads.poshipaddressid
- left join vtiger_users as vtiger_usersPurchaseOrder on vtiger_usersPurchaseOrder.id = vtiger_crmentityPurchaseOrder.smownerid
- left join vtiger_vendor as vtiger_vendorRel on vtiger_vendorRel.vendorid = vtiger_purchaseorder.vendorid
- left join vtiger_contactdetails as vtiger_contactdetailsPurchaseOrder on vtiger_contactdetailsPurchaseOrder.contactid = vtiger_purchaseorder.contactid ";
- }
+ {
+ $query = "left join vtiger_quotes on vtiger_quotes.contactid = vtiger_contactdetails.contactid
+ left join vtiger_quotescf on vtiger_quotes.quoteid = vtiger_quotescf.quoteid
+ left join vtiger_crmentity as vtiger_crmentityQuotes on vtiger_crmentityQuotes.crmid=vtiger_quotes.quoteid
+ left join vtiger_quotesbillads on vtiger_quotes.quoteid=vtiger_quotesbillads.quotebilladdressid
+ left join vtiger_quotesshipads on vtiger_quotes.quoteid=vtiger_quotesshipads.quoteshipaddressid
+ left join vtiger_users as vtiger_usersQuotes on vtiger_usersQuotes.id = vtiger_crmentityQuotes.smownerid
+ left join vtiger_users as vtiger_usersRel1 on vtiger_usersRel1.id = vtiger_quotes.inventorymanager
+ left join vtiger_potential as vtiger_potentialRel on vtiger_potentialRel.potentialid = vtiger_quotes.potentialid
+ left join vtiger_contactdetails as vtiger_contactdetailsQuotes on vtiger_contactdetailsQuotes.contactid = vtiger_quotes.contactid
+ left join vtiger_account as vtiger_accountQuotes on vtiger_accountQuotes.accountid = vtiger_quotes.accountid ";
+ }
+ if($secmodule == "PurchaseOrder")
+ {
+ $query = "left join vtiger_purchaseorder on vtiger_purchaseorder.contactid = vtiger_contactdetails.contactid
+ left join vtiger_purchaseordercf on vtiger_purchaseorder.purchaseorderid = vtiger_purchaseordercf.purchaseorderid
+ left join vtiger_crmentity as vtiger_crmentityPurchaseOrder on vtiger_crmentityPurchaseOrder.crmid=vtiger_purchaseorder.purchaseorderid
+ left join vtiger_pobillads on vtiger_purchaseorder.purchaseorderid=vtiger_pobillads.pobilladdressid
+ left join vtiger_poshipads on vtiger_purchaseorder.purchaseorderid=vtiger_poshipads.poshipaddressid
+ left join vtiger_users as vtiger_usersPurchaseOrder on vtiger_usersPurchaseOrder.id = vtiger_crmentityPurchaseOrder.smownerid
+ left join vtiger_vendor as vtiger_vendorRel on vtiger_vendorRel.vendorid = vtiger_purchaseorder.vendorid
+ left join vtiger_contactdetails as vtiger_contactdetailsPurchaseOrder on vtiger_contactdetailsPurchaseOrder.contactid = vtiger_purchaseorder.contactid ";
+ }
}
@@ -700,125 +702,131 @@
if($secmodule == "Potentials")
{
$query = "left join vtiger_potential on vtiger_potential.accountid = vtiger_account.accountid
- left join vtiger_crmentity as vtiger_crmentityPotentials on vtiger_crmentityPotentials.crmid=vtiger_potential.potentialid
- left join vtiger_potentialscf on vtiger_potentialscf.potentialid = vtiger_potential.potentialid
- left join vtiger_users as vtiger_usersPotentials on vtiger_usersPotentials.id = vtiger_crmentityPotentials.smownerid ";
+ left join vtiger_crmentity as vtiger_crmentityPotentials on vtiger_crmentityPotentials.crmid=vtiger_potential.potentialid
+ left join vtiger_potentialscf on vtiger_potentialscf.potentialid = vtiger_potential.potentialid
+ left join vtiger_users as vtiger_usersPotentials on vtiger_usersPotentials.id = vtiger_crmentityPotentials.smownerid ";
}
if($secmodule == "Contacts")
{
$query = "left join vtiger_contactdetails on vtiger_contactdetails.accountid = vtiger_account.accountid
- left join vtiger_crmentity as vtiger_crmentityContacts on vtiger_crmentityContacts.crmid = vtiger_contactdetails.contactid
- left join vtiger_contactaddress on vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid
- left join vtiger_contactsubdetails on vtiger_contactdetails.contactid = vtiger_contactsubdetails.contactsubscriptionid
- left join vtiger_contactdetails as vtiger_contactdetailsContacts on vtiger_contactdetailsContacts.contactid = vtiger_contactdetails.reportsto
- left join vtiger_account as vtiger_accountContacts on vtiger_accountContacts.accountid = vtiger_contactdetails.accountid
- left join vtiger_contactscf on vtiger_contactdetails.contactid = vtiger_contactscf.contactid
- left join vtiger_users as vtiger_usersContacts on vtiger_usersContacts.id = vtiger_crmentityContacts.smownerid ";
+ left join vtiger_crmentity as vtiger_crmentityContacts on vtiger_crmentityContacts.crmid = vtiger_contactdetails.contactid
+ left join vtiger_contactaddress on vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid
+ left join vtiger_contactsubdetails on vtiger_contactdetails.contactid = vtiger_contactsubdetails.contactsubscriptionid
+ left join vtiger_contactdetails as vtiger_contactdetailsContacts on vtiger_contactdetailsContacts.contactid = vtiger_contactdetails.reportsto
+ left join vtiger_customerdetails on vtiger_customerdetails.customerid = vtiger_contactdetails.contactid
+ left join vtiger_account as vtiger_accountContacts on vtiger_accountContacts.accountid = vtiger_contactdetails.accountid
+ left join vtiger_contactscf on vtiger_contactdetails.contactid = vtiger_contactscf.contactid
+ left join vtiger_users as vtiger_usersContacts on vtiger_usersContacts.id = vtiger_crmentityContacts.smownerid ";
}
if($secmodule == "Quotes")
{
$query = "left join vtiger_quotes on vtiger_quotes.accountid = vtiger_account.accountid
- left join vtiger_crmentity as vtiger_crmentityQuotes on vtiger_crmentityQuotes.crmid=vtiger_quotes.quoteid
- left join vtiger_quotesbillads on vtiger_quotes.quoteid=vtiger_quotesbillads.quotebilladdressid
- left join vtiger_quotesshipads on vtiger_quotes.quoteid=vtiger_quotesshipads.quoteshipaddressid
- left join vtiger_users as vtiger_usersQuotes on vtiger_usersQuotes.id = vtiger_crmentityQuotes.smownerid
- left join vtiger_users as vtiger_usersRel1 on vtiger_usersRel1.id = vtiger_quotes.inventorymanager
- left join vtiger_potential as vtiger_potentialRel on vtiger_potentialRel.potentialid = vtiger_quotes.potentialid
- left join vtiger_contactdetails as vtiger_contactdetailsQuotes on vtiger_contactdetailsQuotes.contactid = vtiger_quotes.contactid
- left join vtiger_account as vtiger_accountQuotes on vtiger_accountQuotes.accountid = vtiger_quotes.accountid ";
+ left join vtiger_quotescf on vtiger_quotes.quoteid = vtiger_quotescf.quoteid
+ left join vtiger_crmentity as vtiger_crmentityQuotes on vtiger_crmentityQuotes.crmid=vtiger_quotes.quoteid
+ left join vtiger_quotesbillads on vtiger_quotes.quoteid=vtiger_quotesbillads.quotebilladdressid
+ left join vtiger_quotesshipads on vtiger_quotes.quoteid=vtiger_quotesshipads.quoteshipaddressid
+ left join vtiger_users as vtiger_usersQuotes on vtiger_usersQuotes.id = vtiger_crmentityQuotes.smownerid
+ left join vtiger_users as vtiger_usersRel1 on vtiger_usersRel1.id = vtiger_quotes.inventorymanager
+ left join vtiger_potential as vtiger_potentialRel on vtiger_potentialRel.potentialid = vtiger_quotes.potentialid
+ left join vtiger_contactdetails as vtiger_contactdetailsQuotes on vtiger_contactdetailsQuotes.contactid = vtiger_quotes.contactid
+ left join vtiger_account as vtiger_accountQuotes on vtiger_accountQuotes.accountid = vtiger_quotes.accountid ";
}
if($secmodule == "PurchaseOrder")
{
$query = "left join vtiger_purchaseorder on vtiger_purchaseorder.accountid = vtiger_account.accountid
- left join vtiger_crmentity as vtiger_crmentityPurchaseOrder on vtiger_crmentityPurchaseOrder.crmid=vtiger_purchaseorder.purchaseorderid
- left join vtiger_pobillads on vtiger_purchaseorder.purchaseorderid=vtiger_pobillads.pobilladdressid
- left join vtiger_poshipads on vtiger_purchaseorder.purchaseorderid=vtiger_poshipads.poshipaddressid
- left join vtiger_users as vtiger_usersPurchaseOrder on vtiger_usersPurchaseOrder.id = vtiger_crmentityPurchaseOrder.smownerid
- left join vtiger_vendor as vtiger_vendorRel on vtiger_vendorRel.vendorid = vtiger_purchaseorder.vendorid
- left join vtiger_contactdetails as vtiger_contactdetailsPurchaseOrder on vtiger_contactdetailsPurchaseOrder.contactid = vtiger_purchaseorder.contactid ";
+ left join vtiger_purchaseordercf on vtiger_purchaseorder.purchaseorderid = vtiger_purchaseordercf.purchaseorderid
+ left join vtiger_crmentity as vtiger_crmentityPurchaseOrder on vtiger_crmentityPurchaseOrder.crmid=vtiger_purchaseorder.purchaseorderid
+ left join vtiger_pobillads on vtiger_purchaseorder.purchaseorderid=vtiger_pobillads.pobilladdressid
+ left join vtiger_poshipads on vtiger_purchaseorder.purchaseorderid=vtiger_poshipads.poshipaddressid
+ left join vtiger_users as vtiger_usersPurchaseOrder on vtiger_usersPurchaseOrder.id = vtiger_crmentityPurchaseOrder.smownerid
+ left join vtiger_vendor as vtiger_vendorRel on vtiger_vendorRel.vendorid = vtiger_purchaseorder.vendorid
+ left join vtiger_contactdetails as vtiger_contactdetailsPurchaseOrder on vtiger_contactdetailsPurchaseOrder.contactid = vtiger_purchaseorder.contactid ";
}
if($secmodule == "Invoice")
{
$query = "left join vtiger_invoice on vtiger_invoice.accountid = vtiger_account.accountid
- left join vtiger_crmentity as vtiger_crmentityInvoice on vtiger_crmentityInvoice.crmid=vtiger_invoice.invoiceid
- left join vtiger_invoicebillads on vtiger_invoice.invoiceid=vtiger_invoicebillads.invoicebilladdressid
- left join vtiger_invoiceshipads on vtiger_invoice.invoiceid=vtiger_invoiceshipads.invoiceshipaddressid
- left join vtiger_users as vtiger_usersInvoice on vtiger_usersInvoice.id = vtiger_crmentityInvoice.smownerid
- left join vtiger_account as vtiger_accountInvoice on vtiger_accountInvoice.accountid = vtiger_invoice.accountid ";
+ left join vtiger_invoicecf on vtiger_invoice.invoiceid = vtiger_invoicecf.invoiceid
+ left join vtiger_crmentity as vtiger_crmentityInvoice on vtiger_crmentityInvoice.crmid=vtiger_invoice.invoiceid
+ left join vtiger_invoicebillads on vtiger_invoice.invoiceid=vtiger_invoicebillads.invoicebilladdressid
+ left join vtiger_invoiceshipads on vtiger_invoice.invoiceid=vtiger_invoiceshipads.invoiceshipaddressid
+ left join vtiger_users as vtiger_usersInvoice on vtiger_usersInvoice.id = vtiger_crmentityInvoice.smownerid
+ left join vtiger_account as vtiger_accountInvoice on vtiger_accountInvoice.accountid = vtiger_invoice.accountid ";
}
if($secmodule == "Products")
{
$query = "left join vtiger_seproductsrel on vtiger_seproductsrel.crmid = vtiger_account.accountid
- left join vtiger_products on vtiger_products.productid = vtiger_seproductsrel.productid
- left join vtiger_crmentity as vtiger_crmentityProducts on vtiger_crmentityProducts.crmid=vtiger_products.productid
- left join vtiger_productcf on vtiger_products.productid = vtiger_productcf.productid
- left join vtiger_users as vtiger_usersProducts on vtiger_usersProducts.id = vtiger_crmentityProducts.smownerid
- left join vtiger_contactdetails as vtiger_contactdetailsProducts on vtiger_contactdetailsProducts.contactid = vtiger_products.contactid
- left join vtiger_vendor as vtiger_vendorRel on vtiger_vendorRel.vendorid = vtiger_products.vendor_id
- left join vtiger_crmentity as vtiger_crmentityRel on vtiger_crmentityRel.crmid = vtiger_seproductsrel.crmid
- left join vtiger_account as vtiger_accountRel on vtiger_accountRel.accountid=crmentityRel.crmid
- left join vtiger_leaddetails as vtiger_leaddetailsRel on vtiger_leaddetailsRel.leadid = vtiger_crmentityRel.crmid
- left join vtiger_potential as vtiger_potentialRel on vtiger_potentialRel.potentialid = vtiger_crmentityRel.crmid ";
+ left join vtiger_products on vtiger_products.productid = vtiger_seproductsrel.productid
+ left join vtiger_crmentity as vtiger_crmentityProducts on vtiger_crmentityProducts.crmid=vtiger_products.productid
+ left join vtiger_productcf on vtiger_products.productid = vtiger_productcf.productid
+ left join vtiger_users as vtiger_usersProducts on vtiger_usersProducts.id = vtiger_crmentityProducts.smownerid
+ left join vtiger_contactdetails as vtiger_contactdetailsProducts on vtiger_contactdetailsProducts.contactid = vtiger_products.contactid
+ left join vtiger_vendor as vtiger_vendorRel on vtiger_vendorRel.vendorid = vtiger_products.vendor_id
+ left join vtiger_crmentity as vtiger_crmentityRel on vtiger_crmentityRel.crmid = vtiger_seproductsrel.crmid
+ left join vtiger_account as vtiger_accountRel on vtiger_accountRel.accountid=crmentityRel.crmid
+ left join vtiger_leaddetails as vtiger_leaddetailsRel on vtiger_leaddetailsRel.leadid = vtiger_crmentityRel.crmid
+ left join vtiger_potential as vtiger_potentialRel on vtiger_potentialRel.potentialid = vtiger_crmentityRel.crmid ";
}
}
if($module == "Quotes")
{
if($secmodule == "Accounts")
- {
- $query = "left join vtiger_account on vtiger_account.accountid = vtiger_quotes.accountid
- left join vtiger_crmentity as vtiger_crmentityAccounts on vtiger_crmentityAccounts.crmid=vtiger_account.accountid
- left join vtiger_accountbillads on vtiger_account.accountid=vtiger_accountbillads.accountaddressid
- left join vtiger_accountshipads on vtiger_account.accountid=vtiger_accountshipads.accountaddressid
- left join vtiger_accountscf on vtiger_account.accountid = vtiger_accountscf.accountid
- left join vtiger_account as vtiger_accountAccounts on vtiger_accountAccounts.accountid = vtiger_account.parentid
- left join vtiger_users as vtiger_usersAccounts on vtiger_usersAccounts.id = vtiger_crmentityAccounts.smownerid ";
- }
+ {
+ $query = "left join vtiger_account on vtiger_account.accountid = vtiger_quotes.accountid
+ left join vtiger_crmentity as vtiger_crmentityAccounts on vtiger_crmentityAccounts.crmid=vtiger_account.accountid
+ left join vtiger_accountbillads on vtiger_account.accountid=vtiger_accountbillads.accountaddressid
+ left join vtiger_accountshipads on vtiger_account.accountid=vtiger_accountshipads.accountaddressid
+ left join vtiger_accountscf on vtiger_account.accountid = vtiger_accountscf.accountid
+ left join vtiger_account as vtiger_accountAccounts on vtiger_accountAccounts.accountid = vtiger_account.parentid
+ left join vtiger_users as vtiger_usersAccounts on vtiger_usersAccounts.id = vtiger_crmentityAccounts.smownerid ";
+ }
if($secmodule == "Potentials")
- {
- $query = "left join vtiger_potential on vtiger_potential.potentialid = vtiger_quotes.potentialid
- left join vtiger_crmentity as vtiger_crmentityPotentials on vtiger_crmentityPotentials.crmid=vtiger_potential.potentialid
- left join vtiger_potentialscf on vtiger_potentialscf.potentialid = vtiger_potential.potentialid
- left join vtiger_users as vtiger_usersPotentials on vtiger_usersPotentials.id = vtiger_crmentityPotentials.smownerid ";
-
- }
+ {
+ $query = "left join vtiger_potential on vtiger_potential.potentialid = vtiger_quotes.potentialid
+ left join vtiger_crmentity as vtiger_crmentityPotentials on vtiger_crmentityPotentials.crmid=vtiger_potential.potentialid
+ left join vtiger_potentialscf on vtiger_potentialscf.potentialid = vtiger_potential.potentialid
+ left join vtiger_users as vtiger_usersPotentials on vtiger_usersPotentials.id = vtiger_crmentityPotentials.smownerid ";
+
+ }
if($secmodule == "Contacts")
- {
- $query = "left join vtiger_contactdetails on vtiger_contactdetails.contactid = vtiger_quotes.contactid
- left join vtiger_crmentity as vtiger_crmentityContacts on vtiger_crmentityContacts.crmid = vtiger_contactdetails.contactid
- left join vtiger_contactaddress on vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid
- left join vtiger_contactsubdetails on vtiger_contactdetails.contactid = vtiger_contactsubdetails.contactsubscriptionid
- left join vtiger_contactdetails as vtiger_contactdetailsContacts on vtiger_contactdetailsContacts.contactid = vtiger_contactdetails.reportsto
- left join vtiger_account as vtiger_accountContacts on vtiger_accountContacts.accountid = vtiger_contactdetails.accountid
-
- left join vtiger_contactscf on vtiger_contactdetails.contactid = vtiger_contactscf.contactid
- left join vtiger_users as vtiger_usersContacts on vtiger_usersContacts.id = vtiger_crmentityContacts.smownerid ";
- }
+ {
+ $query = "left join vtiger_contactdetails on vtiger_contactdetails.contactid = vtiger_quotes.contactid
+ left join vtiger_crmentity as vtiger_crmentityContacts on vtiger_crmentityContacts.crmid = vtiger_contactdetails.contactid
+ left join vtiger_contactaddress on vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid
+ left join vtiger_contactsubdetails on vtiger_contactdetails.contactid = vtiger_contactsubdetails.contactsubscriptionid
+ left join vtiger_contactdetails as vtiger_contactdetailsContacts on vtiger_contactdetailsContacts.contactid = vtiger_contactdetails.reportsto
+ left join vtiger_customerdetails on vtiger_customerdetails.customerid = vtiger_contactdetails.contactid
+ left join vtiger_account as vtiger_accountContacts on vtiger_accountContacts.accountid = vtiger_contactdetails.accountid
+
+ left join vtiger_contactscf on vtiger_contactdetails.contactid = vtiger_contactscf.contactid
+ left join vtiger_users as vtiger_usersContacts on vtiger_usersContacts.id = vtiger_crmentityContacts.smownerid ";
+ }
}
if($module == "PurchaseOrder")
{
if($secmodule == "Accounts")
- {
- $query = "left join vtiger_account on vtiger_account.accountid = vtiger_purchaseorder.accountid
- left join vtiger_crmentity as vtiger_crmentityAccounts on vtiger_crmentityAccounts.crmid=vtiger_account.accountid
- left join vtiger_accountbillads on vtiger_account.accountid=vtiger_accountbillads.accountaddressid
- left join vtiger_accountshipads on vtiger_account.accountid=vtiger_accountshipads.accountaddressid
- left join vtiger_accountscf on vtiger_account.accountid = vtiger_accountscf.accountid
- left join vtiger_account as vtiger_accountAccounts on vtiger_accountAccounts.accountid = vtiger_account.parentid
- left join vtiger_users as vtiger_usersAccounts on vtiger_usersAccounts.id = vtiger_crmentityAccounts.smownerid ";
- }
+ {
+ $query = "left join vtiger_account on vtiger_account.accountid = vtiger_purchaseorder.accountid
+ left join vtiger_crmentity as vtiger_crmentityAccounts on vtiger_crmentityAccounts.crmid=vtiger_account.accountid
+ left join vtiger_accountbillads on vtiger_account.accountid=vtiger_accountbillads.accountaddressid
+ left join vtiger_accountshipads on vtiger_account.accountid=vtiger_accountshipads.accountaddressid
+ left join vtiger_accountscf on vtiger_account.accountid = vtiger_accountscf.accountid
+ left join vtiger_account as vtiger_accountAccounts on vtiger_accountAccounts.accountid = vtiger_account.parentid
+ left join vtiger_users as vtiger_usersAccounts on vtiger_usersAccounts.id = vtiger_crmentityAccounts.smownerid ";
+ }
if($secmodule == "Contacts")
{
$query = "left join vtiger_contactdetails on vtiger_contactdetails.contactid = vtiger_purchaseorder.contactid
- left join vtiger_crmentity as vtiger_crmentityContacts on vtiger_crmentityContacts.crmid = vtiger_contactdetails.contactid
- left join vtiger_contactaddress on vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid
- left join vtiger_contactsubdetails on vtiger_contactdetails.contactid = vtiger_contactsubdetails.contactsubscriptionid
- left join vtiger_contactdetails as vtiger_contactdetailsContacts on vtiger_contactdetailsContacts.contactid = vtiger_contactdetails.reportsto
- left join vtiger_account as vtiger_accountContacts on vtiger_accountContacts.accountid = vtiger_contactdetails.accountid
-
- left join vtiger_contactscf on vtiger_contactdetails.contactid = vtiger_contactscf.contactid
- left join vtiger_users as vtiger_usersContacts on vtiger_usersContacts.id = vtiger_crmentityContacts.smownerid ";
+ left join vtiger_crmentity as vtiger_crmentityContacts on vtiger_crmentityContacts.crmid = vtiger_contactdetails.contactid
+ left join vtiger_contactaddress on vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid
+ left join vtiger_contactsubdetails on vtiger_contactdetails.contactid = vtiger_contactsubdetails.contactsubscriptionid
+ left join vtiger_contactdetails as vtiger_contactdetailsContacts on vtiger_contactdetailsContacts.contactid = vtiger_contactdetails.reportsto
+ left join vtiger_customerdetails on vtiger_customerdetails.customerid = vtiger_contactdetails.contactid
+ left join vtiger_account as vtiger_accountContacts on vtiger_accountContacts.accountid = vtiger_contactdetails.accountid
+
+ left join vtiger_contactscf on vtiger_contactdetails.contactid = vtiger_contactscf.contactid
+ left join vtiger_users as vtiger_usersContacts on vtiger_usersContacts.id = vtiger_crmentityContacts.smownerid ";
}
}
if($module == "Invoice")
@@ -826,75 +834,77 @@
if($secmodule == "Accounts")
{
$query = "left join vtiger_account on vtiger_account.accountid = vtiger_invoice.accountid
- left join vtiger_crmentity as vtiger_crmentityAccounts on vtiger_crmentityAccounts.crmid=vtiger_account.accountid
- left join vtiger_accountbillads on vtiger_account.accountid=vtiger_accountbillads.accountaddressid
- left join vtiger_accountshipads on vtiger_account.accountid=vtiger_accountshipads.accountaddressid
- left join vtiger_accountscf on vtiger_account.accountid = vtiger_accountscf.accountid
- left join vtiger_account as vtiger_accountAccounts on vtiger_accountAccounts.accountid = vtiger_account.parentid
- left join vtiger_users as vtiger_usersAccounts on vtiger_usersAccounts.id = vtiger_crmentityAccounts.smownerid ";
+ left join vtiger_crmentity as vtiger_crmentityAccounts on vtiger_crmentityAccounts.crmid=vtiger_account.accountid
+ left join vtiger_accountbillads on vtiger_account.accountid=vtiger_accountbillads.accountaddressid
+ left join vtiger_accountshipads on vtiger_account.accountid=vtiger_accountshipads.accountaddressid
+ left join vtiger_accountscf on vtiger_account.accountid = vtiger_accountscf.accountid
+ left join vtiger_account as vtiger_accountAccounts on vtiger_accountAccounts.accountid = vtiger_account.parentid
+ left join vtiger_users as vtiger_usersAccounts on vtiger_usersAccounts.id = vtiger_crmentityAccounts.smownerid ";
}
}
if($module == "Products")
{
if($secmodule == "Accounts")
- {
- $query = "left join vtiger_account on vtiger_account.accountid = vtiger_crmentityRel.crmid
- left join vtiger_crmentity as vtiger_crmentityAccounts on vtiger_crmentityAccounts.crmid=vtiger_account.accountid
- left join vtiger_accountbillads on vtiger_account.accountid=vtiger_accountbillads.accountaddressid
- left join vtiger_accountshipads on vtiger_account.accountid=vtiger_accountshipads.accountaddressid
- left join vtiger_accountscf on vtiger_account.accountid = vtiger_accountscf.accountid
- left join vtiger_account as vtiger_accountAccounts on vtiger_accountAccounts.accountid = vtiger_account.parentid
- left join vtiger_users as vtiger_usersAccounts on vtiger_usersAccounts.id = vtiger_crmentityAccounts.smownerid ";
- }
+ {
+ $query = "left join vtiger_account on vtiger_account.accountid = vtiger_crmentityRel.crmid
+ left join vtiger_crmentity as vtiger_crmentityAccounts on vtiger_crmentityAccounts.crmid=vtiger_account.accountid
+ left join vtiger_accountbillads on vtiger_account.accountid=vtiger_accountbillads.accountaddressid
+ left join vtiger_accountshipads on vtiger_account.accountid=vtiger_accountshipads.accountaddressid
+ left join vtiger_accountscf on vtiger_account.accountid = vtiger_accountscf.accountid
+ left join vtiger_account as vtiger_accountAccounts on vtiger_accountAccounts.accountid = vtiger_account.parentid
+ left join vtiger_users as vtiger_usersAccounts on vtiger_usersAccounts.id = vtiger_crmentityAccounts.smownerid ";
+ }
if($secmodule == "Contacts")
- {
- $query = "left join vtiger_contactdetails on vtiger_contactdetails.contactid = vtiger_products.contactid
- left join vtiger_crmentity as vtiger_crmentityContacts on vtiger_crmentityContacts.crmid = vtiger_contactdetails.contactid
- left join vtiger_contactaddress on vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid
- left join vtiger_contactsubdetails on vtiger_contactdetails.contactid = vtiger_contactsubdetails.contactsubscriptionid
- left join vtiger_contactdetails as vtiger_contactdetailsContacts on vtiger_contactdetailsContacts.contactid = vtiger_contactdetails.reportsto
- left join vtiger_account as vtiger_accountContacts on vtiger_accountContacts.accountid = vtiger_contactdetails.accountid
- left join vtiger_contactscf on vtiger_contactdetails.contactid = vtiger_contactscf.contactid
- left join vtiger_users as vtiger_usersContacts on vtiger_usersContacts.id = vtiger_crmentityContacts.smownerid ";
-
- }
+ {
+ $query = "left join vtiger_contactdetails on vtiger_contactdetails.contactid = vtiger_products.contactid
+ left join vtiger_crmentity as vtiger_crmentityContacts on vtiger_crmentityContacts.crmid = vtiger_contactdetails.contactid
+ left join vtiger_contactaddress on vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid
+ left join vtiger_contactsubdetails on vtiger_contactdetails.contactid = vtiger_contactsubdetails.contactsubscriptionid
+ left join vtiger_contactdetails as vtiger_contactdetailsContacts on vtiger_contactdetailsContacts.contactid = vtiger_contactdetails.reportsto
+ left join vtiger_customerdetails on vtiger_customerdetails.customerid = vtiger_contactdetails.contactid
+ left join vtiger_account as vtiger_accountContacts on vtiger_accountContacts.accountid = vtiger_contactdetails.accountid
+ left join vtiger_contactscf on vtiger_contactdetails.contactid = vtiger_contactscf.contactid
+ left join vtiger_users as vtiger_usersContacts on vtiger_usersContacts.id = vtiger_crmentityContacts.smownerid ";
+
+ }
}
if($module == "Potentials")
{
if($secmodule == "Accounts")
- {
- $query = "left join vtiger_account on vtiger_account.accountid = vtiger_potential.accountid
- left join vtiger_crmentity as vtiger_crmentityAccounts on vtiger_crmentityAccounts.crmid=vtiger_account.accountid
- left join vtiger_accountbillads on vtiger_account.accountid=vtiger_accountbillads.accountaddressid
- left join vtiger_accountshipads on vtiger_account.accountid=vtiger_accountshipads.accountaddressid
- left join vtiger_accountscf on vtiger_account.accountid = vtiger_accountscf.accountid
- left join vtiger_account as vtiger_accountAccounts on vtiger_accountAccounts.accountid = vtiger_account.parentid
- left join vtiger_users as vtiger_usersAccounts on vtiger_usersAccounts.id = vtiger_crmentityAccounts.smownerid ";
- }
+ {
+ $query = "left join vtiger_account on vtiger_account.accountid = vtiger_potential.accountid
+ left join vtiger_crmentity as vtiger_crmentityAccounts on vtiger_crmentityAccounts.crmid=vtiger_account.accountid
+ left join vtiger_accountbillads on vtiger_account.accountid=vtiger_accountbillads.accountaddressid
+ left join vtiger_accountshipads on vtiger_account.accountid=vtiger_accountshipads.accountaddressid
+ left join vtiger_accountscf on vtiger_account.accountid = vtiger_accountscf.accountid
+ left join vtiger_account as vtiger_accountAccounts on vtiger_accountAccounts.accountid = vtiger_account.parentid
+ left join vtiger_users as vtiger_usersAccounts on vtiger_usersAccounts.id = vtiger_crmentityAccounts.smownerid ";
+ }
if($secmodule == "Contacts")
{
$query = "left join vtiger_contactdetails on vtiger_contactdetails.accountid = vtiger_potential.accountid
- left join vtiger_crmentity as vtiger_crmentityContacts on vtiger_crmentityContacts.crmid = vtiger_contactdetails.contactid
- left join vtiger_contactaddress on vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid
- left join vtiger_contactsubdetails on vtiger_contactdetails.contactid = vtiger_contactsubdetails.contactsubscriptionid
- left join vtiger_contactdetails as vtiger_contactdetailsContacts on vtiger_contactdetailsContacts.contactid = vtiger_contactdetails.reportsto
- left join vtiger_account as vtiger_accountContacts on vtiger_accountContacts.accountid = vtiger_contactdetails.accountid
- left join vtiger_contactscf on vtiger_contactdetails.contactid = vtiger_contactscf.contactid
- left join vtiger_users as vtiger_usersContacts on vtiger_usersContacts.id = vtiger_crmentityContacts.smownerid ";
+ left join vtiger_crmentity as vtiger_crmentityContacts on vtiger_crmentityContacts.crmid = vtiger_contactdetails.contactid
+ left join vtiger_contactaddress on vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid
+ left join vtiger_customerdetails on vtiger_customerdetails.customerid = vtiger_contactdetails.contactid
+ left join vtiger_contactsubdetails on vtiger_contactdetails.contactid = vtiger_contactsubdetails.contactsubscriptionid
+ left join vtiger_contactdetails as vtiger_contactdetailsContacts on vtiger_contactdetailsContacts.contactid = vtiger_contactdetails.reportsto
+ left join vtiger_account as vtiger_accountContacts on vtiger_accountContacts.accountid = vtiger_contactdetails.accountid
+ left join vtiger_contactscf on vtiger_contactdetails.contactid = vtiger_contactscf.contactid
+ left join vtiger_users as vtiger_usersContacts on vtiger_usersContacts.id = vtiger_crmentityContacts.smownerid ";
}
if($secmodule == "Quotes")
{
$query = "left join vtiger_quotes on vtiger_quotes.potentialid = vtiger_potential.potentialid
- left join vtiger_crmentity as vtiger_crmentityQuotes on vtiger_crmentityQuotes.crmid=vtiger_quotes.quoteid
- left join vtiger_quotesbillads on vtiger_quotes.quoteid=vtiger_quotesbillads.quotebilladdressid
- left join vtiger_quotesshipads on vtiger_quotes.quoteid=vtiger_quotesshipads.quoteshipaddressid
- left join vtiger_users as vtiger_usersQuotes on vtiger_usersQuotes.id = vtiger_crmentityQuotes.smownerid
- left join vtiger_users as vtiger_usersRel1 on vtiger_usersRel1.id = vtiger_quotes.inventorymanager
- left join vtiger_potential as vtiger_potentialRel on vtiger_potentialRel.potentialid = vtiger_quotes.potentialid
- left join vtiger_contactdetails as vtiger_contactdetailsQuotes on vtiger_contactdetailsQuotes.contactid = vtiger_quotes.contactid
- left join vtiger_account as vtiger_accountQuotes on vtiger_accountQuotes.accountid = vtiger_quotes.accountid ";
+ left join vtiger_crmentity as vtiger_crmentityQuotes on vtiger_crmentityQuotes.crmid=vtiger_quotes.quoteid
+ left join vtiger_quotesbillads on vtiger_quotes.quoteid=vtiger_quotesbillads.quotebilladdressid
+ left join vtiger_quotesshipads on vtiger_quotes.quoteid=vtiger_quotesshipads.quoteshipaddressid
+ left join vtiger_users as vtiger_usersQuotes on vtiger_usersQuotes.id = vtiger_crmentityQuotes.smownerid
+ left join vtiger_users as vtiger_usersRel1 on vtiger_usersRel1.id = vtiger_quotes.inventorymanager
+ left join vtiger_potential as vtiger_potentialRel on vtiger_potentialRel.potentialid = vtiger_quotes.potentialid
+ left join vtiger_contactdetails as vtiger_contactdetailsQuotes on vtiger_contactdetailsQuotes.contactid = vtiger_quotes.contactid
+ left join vtiger_account as vtiger_accountQuotes on vtiger_accountQuotes.accountid = vtiger_quotes.accountid ";
}
}
if($module == "HelpDesk")
@@ -902,30 +912,31 @@
if($secmodule == "Products")
{
$query = "left join vtiger_products on vtiger_products.productid = vtiger_troubletickets.product_id
- left join vtiger_crmentity as vtiger_crmentityProducts on vtiger_crmentityProducts.crmid=vtiger_products.productid
- left join vtiger_productcf on vtiger_products.productid = vtiger_productcf.productid
- left join vtiger_users as vtiger_usersProducts on vtiger_usersProducts.id = vtiger_crmentityProducts.smownerid
- left join vtiger_contactdetails as vtiger_contactdetailsProducts on vtiger_contactdetailsProducts.contactid = vtiger_products.contactid
- left join vtiger_vendor as vtiger_vendorRel on vtiger_vendorRel.vendorid = vtiger_products.vendor_id
- left join vtiger_seproductsrel on vtiger_seproductsrel.productid = vtiger_products.productid
- left join vtiger_crmentity as vtiger_crmentityRelProducts on vtiger_crmentityRelProducts.crmid = vtiger_seproductsrel.crmid
- left join vtiger_account as vtiger_accountRelProducts on vtiger_accountRelProducts.accountid=vtiger_seproductsrel.crmid
- left join vtiger_leaddetails as vtiger_leaddetailsRelProducts on vtiger_leaddetailsRelProducts.leadid = vtiger_seproductsrel.crmid
- left join vtiger_potential as vtiger_potentialRelProducts on vtiger_potentialRelProducts.potentialid = vtiger_seproductsrel.crmid ";
+ left join vtiger_crmentity as vtiger_crmentityProducts on vtiger_crmentityProducts.crmid=vtiger_products.productid
+ left join vtiger_productcf on vtiger_products.productid = vtiger_productcf.productid
+ left join vtiger_users as vtiger_usersProducts on vtiger_usersProducts.id = vtiger_crmentityProducts.smownerid
+ left join vtiger_contactdetails as vtiger_contactdetailsProducts on vtiger_contactdetailsProducts.contactid = vtiger_products.contactid
+ left join vtiger_vendor as vtiger_vendorRel on vtiger_vendorRel.vendorid = vtiger_products.vendor_id
+ left join vtiger_seproductsrel on vtiger_seproductsrel.productid = vtiger_products.productid
+ left join vtiger_crmentity as vtiger_crmentityRelProducts on vtiger_crmentityRelProducts.crmid = vtiger_seproductsrel.crmid
+ left join vtiger_account as vtiger_accountRelProducts on vtiger_accountRelProducts.accountid=vtiger_seproductsrel.crmid
+ left join vtiger_leaddetails as vtiger_leaddetailsRelProducts on vtiger_leaddetailsRelProducts.leadid = vtiger_seproductsrel.crmid
+ left join vtiger_potential as vtiger_potentialRelProducts on vtiger_potentialRelProducts.potentialid = vtiger_seproductsrel.crmid ";
}
}
if($module == "Activities")
{
if($secmodule == "Contacts")
{
- $query = "left join vtiger_contactdetails on vtiger_contactdetails.contactid = vtiger_cntactivityrel.contactid
- left join vtiger_crmentity as vtiger_crmentityContacts on vtiger_crmentityContacts.crmid = vtiger_contactdetails.contactid
- left join vtiger_contactaddress on vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid
- left join vtiger_contactsubdetails on vtiger_contactdetails.contactid = vtiger_contactsubdetails.contactsubscriptionid
- left join vtiger_contactdetails as vtiger_contactdetailsContacts on vtiger_contactdetailsContacts.contactid = vtiger_contactdetails.reportsto
- left join vtiger_account as vtiger_accountContacts on vtiger_accountContacts.accountid = vtiger_contactdetails.accountid
- left join vtiger_contactscf on vtiger_contactdetails.contactid = vtiger_contactscf.contactid
- left join vtiger_users as vtiger_usersContacts on vtiger_usersContacts.id = vtiger_crmentityContacts.smownerid ";
+ $query = "left join vtiger_contactdetails on vtiger_contactdetails.contactid = vtiger_cntactivityrel.contactid
+ left join vtiger_crmentity as vtiger_crmentityContacts on vtiger_crmentityContacts.crmid = vtiger_contactdetails.contactid
+ left join vtiger_contactaddress on vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid
+ left join vtiger_customerdetails on vtiger_customerdetails.customerid = vtiger_contactdetails.contactid
+ left join vtiger_contactsubdetails on vtiger_contactdetails.contactid = vtiger_contactsubdetails.contactsubscriptionid
+ left join vtiger_contactdetails as vtiger_contactdetailsContacts on vtiger_contactdetailsContacts.contactid = vtiger_contactdetails.reportsto
+ left join vtiger_account as vtiger_accountContacts on vtiger_accountContacts.accountid = vtiger_contactdetails.accountid
+ left join vtiger_contactscf on vtiger_contactdetails.contactid = vtiger_contactscf.contactid
+ left join vtiger_users as vtiger_usersContacts on vtiger_usersContacts.id = vtiger_crmentityContacts.smownerid ";
}
}
$log->info("ReportRun :: Successfully returned getRelatedModulesQuery".$secmodule);
@@ -944,9 +955,8 @@
left join vtiger_users as vtiger_usersLeads on vtiger_usersLeads.id = vtiger_crmentityLeads.smownerid
where vtiger_crmentityLeads.deleted=0 and vtiger_leaddetails.converted=0";
}
-
if($module == "Accounts")
- {
+ {
$query = "from vtiger_account
inner join vtiger_crmentity as vtiger_crmentityAccounts on vtiger_crmentityAccounts.crmid=vtiger_account.accountid
inner join vtiger_accountbillads on vtiger_account.accountid=vtiger_accountbillads.accountaddressid
@@ -959,7 +969,7 @@
}
if($module == "Contacts")
- {
+ {
$query = "from vtiger_contactdetails
inner join vtiger_crmentity as vtiger_crmentityContacts on vtiger_crmentityContacts.crmid = vtiger_contactdetails.contactid
inner join vtiger_contactaddress on vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid
@@ -983,7 +993,7 @@
".$this->getRelatedModulesQuery($module,$this->secondarymodule)."
where vtiger_crmentityPotentials.deleted=0 ";
}
-
+
if($module == "Products")
{
$query = "from vtiger_products
@@ -1007,7 +1017,7 @@
inner join vtiger_crmentity as vtiger_crmentityHelpDesk
on vtiger_crmentityHelpDesk.crmid=vtiger_troubletickets.ticketid
inner join vtiger_ticketcf on vtiger_ticketcf.ticketid = vtiger_troubletickets.ticketid
- left join vtiger_crmentity as vtiger_crmentityRelHelpDesk on vtiger_crmentityRelHelpDesk.crmid = vtiger_troubletickets.parent_id
+ left join vtiger_crmentity as vtiger_crmentityRelHelpDesk on vtiger_crmentityRelHelpDesk.crmid = vtiger_troubletickets.parent_id
left join vtiger_account as vtiger_accountRelHelpDesk on vtiger_accountRelHelpDesk.accountid=crmentityRelHelpDesk.crmid
left join vtiger_contactdetails as vtiger_contactdetailsRelHelpDesk on vtiger_contactdetailsRelHelpDesk.contactid= vtiger_crmentityRelHelpDesk.crmid
left join vtiger_products as vtiger_productsRel on vtiger_productsRel.productid = vtiger_crmentityRelHelpDesk.crmid
@@ -1025,7 +1035,7 @@
left join vtiger_users as vtiger_usersActivities on vtiger_usersActivities.id = vtiger_crmentityActivities.smownerid
left join vtiger_seactivityrel on vtiger_seactivityrel.activityid = vtiger_activity.activityid
left join vtiger_crmentity as vtiger_crmentityRelActivities on vtiger_crmentityRelActivities.crmid = vtiger_seactivityrel.crmid
- left join vtiger_account as vtiger_accountRelActivities on vtiger_accountRelActivities.accountid=crmentityRelActivities.crmid
+ left join vtiger_account as vtiger_accountRelActivities on vtiger_accountRelActivities.accountid=vtiger_crmentityRelActivities.crmid
left join vtiger_leaddetails as vtiger_leaddetailsRelActivities on vtiger_leaddetailsRelActivities.leadid = vtiger_crmentityRelActivities.crmid
left join vtiger_potential as vtiger_potentialRelActivities on vtiger_potentialRelActivities.potentialid = vtiger_crmentityRelActivities.crmid
left join vtiger_quotes as vtiger_quotesRelActivities on vtiger_quotesRelActivities.quoteid = vtiger_crmentityRelActivities.crmid
@@ -1034,13 +1044,14 @@
".$this->getRelatedModulesQuery($module,$this->secondarymodule)."
WHERE vtiger_crmentityActivities.deleted=0 and (vtiger_activity.activitytype = 'Meeting' or vtiger_activity.activitytype='Call' or vtiger_activity.activitytype='Task')";
}
-
+
if($module == "Quotes")
{
$query = "from vtiger_quotes
inner join vtiger_crmentity as vtiger_crmentityQuotes on vtiger_crmentityQuotes.crmid=vtiger_quotes.quoteid
inner join vtiger_quotesbillads on vtiger_quotes.quoteid=vtiger_quotesbillads.quotebilladdressid
- inner join vtiger_quotesshipads on vtiger_quotes.quoteid=vtiger_quotesshipads.quoteshipaddressid
+ inner join vtiger_quotesshipads on vtiger_quotes.quoteid=vtiger_quotesshipads.quoteshipaddressid
+ left join vtiger_quotescf on vtiger_quotes.quoteid = vtiger_quotescf.quoteid
left join vtiger_users as vtiger_usersQuotes on vtiger_usersQuotes.id = vtiger_crmentityQuotes.smownerid
left join vtiger_users as vtiger_usersRel1 on vtiger_usersRel1.id = vtiger_quotes.inventorymanager
left join vtiger_potential as vtiger_potentialRel on vtiger_potentialRel.potentialid = vtiger_quotes.potentialid
@@ -1049,13 +1060,14 @@
".$this->getRelatedModulesQuery($module,$this->secondarymodule)."
where vtiger_crmentityQuotes.deleted=0";
}
-
+
if($module == "PurchaseOrder")
{
$query = "from vtiger_purchaseorder
inner join vtiger_crmentity as vtiger_crmentityPurchaseOrder on vtiger_crmentityPurchaseOrder.crmid=vtiger_purchaseorder.purchaseorderid
inner join vtiger_pobillads on vtiger_purchaseorder.purchaseorderid=vtiger_pobillads.pobilladdressid
inner join vtiger_poshipads on vtiger_purchaseorder.purchaseorderid=vtiger_poshipads.poshipaddressid
+ left join vtiger_purchaseordercf on vtiger_purchaseorder.purchaseorderid = vtiger_purchaseordercf.purchaseorderid
left join vtiger_users as vtiger_usersPurchaseOrder on vtiger_usersPurchaseOrder.id = vtiger_crmentityPurchaseOrder.smownerid
left join vtiger_vendor as vtiger_vendorRel on vtiger_vendorRel.vendorid = vtiger_purchaseorder.vendorid
left join vtiger_contactdetails as vtiger_contactdetailsPurchaseOrder on vtiger_contactdetailsPurchaseOrder.contactid = vtiger_purchaseorder.contactid
@@ -1069,11 +1081,28 @@
inner join vtiger_crmentity as vtiger_crmentityInvoice on vtiger_crmentityInvoice.crmid=vtiger_invoice.invoiceid
inner join vtiger_invoicebillads on vtiger_invoice.invoiceid=vtiger_invoicebillads.invoicebilladdressid
inner join vtiger_invoiceshipads on vtiger_invoice.invoiceid=vtiger_invoiceshipads.invoiceshipaddressid
+ left join vtiger_invoicecf on vtiger_invoice.invoiceid = vtiger_invoicecf.invoiceid
left join vtiger_users as vtiger_usersInvoice on vtiger_usersInvoice.id = vtiger_crmentityInvoice.smownerid
left join vtiger_account as vtiger_accountInvoice on vtiger_accountInvoice.accountid = vtiger_invoice.accountid
".$this->getRelatedModulesQuery($module,$this->secondarymodule)."
where vtiger_crmentityInvoice.deleted=0";
}
+ if($module == "SalesOrder")
+ {
+ $query = "from vtiger_salesorder
+ inner join vtiger_crmentity as vtiger_crmentitySalesOrder on vtiger_crmentitySalesOrder.crmid=vtiger_salesorder.salesorderid
+ inner join vtiger_sobillads on vtiger_salesorder.salesorderid=vtiger_sobillads.sobilladdressid
+ inner join vtiger_soshipads on vtiger_salesorder.salesorderid=vtiger_soshipads.soshipaddressid
+ left join vtiger_salesordercf on vtiger_salesorder.salesorderid = vtiger_salesordercf.salesorderid
+ left join vtiger_contactdetails as vtiger_contactdetailsSalesOrder on vtiger_contactdetailsSalesOrder.contactid = vtiger_salesorder.contactid
+ left join vtiger_quotes as vtiger_quotesSalesOrder on vtiger_quotesSalesOrder.quoteid = vtiger_salesorder.quoteid
+ left join vtiger_account as vtiger_accountSalesOrder on vtiger_accountSalesOrder.accountid = vtiger_salesorder.accountid
+ left join vtiger_potential as vtiger_potentialRel on vtiger_potentialRel.potentialid = vtiger_salesorder.potentialid
+ left join vtiger_users as vtiger_usersSalesOrder on vtiger_usersSalesOrder.id = vtiger_crmentitySalesOrder.smownerid
+ where vtiger_crmentitySalesOrder.deleted=0";
+
+
+ }
$log->info("ReportRun :: Successfully returned getReportsQuery".$module);
return $query;
}
@@ -1114,13 +1143,12 @@
{
$groupsquery = implode(", ",$groupslist);
}
-
+
//standard list
if(isset($stdfilterlist))
{
$stdfiltersql = implode(", ",$stdfilterlist);
}
- //print_r($filterlist);
if(isset($filterlist))
{
$stdfiltersql = implode(", ",$filterlist);
@@ -1128,7 +1156,7 @@
//columns to total list
if(isset($columnstotallist))
{
- $columnstotalsql = implode(", ",$columnstotallist);
+ $columnstotalsql = implode(", ",$columnstotallist);
}
//advanced filterlist
if(isset($advfilterlist))
@@ -1141,11 +1169,11 @@
}
if($advfiltersql != "")
{
- $wheresql .= " and ".$advfiltersql;
- }
-
+ $wheresql .= " and ".$advfiltersql;
+ }
+
$reportquery = $this->getReportsQuery($this->primarymodule);
-
+
if($type == 'COLUMNSTOTOTAL')
{
if(trim($groupsquery) != "")
@@ -1178,9 +1206,9 @@
function GenerateReport($outputformat,$filterlist)
{
- global $adb;
- global $modules;
- global $mod_strings;
+ global $adb;
+ global $modules;
+ global $mod_strings;
if($outputformat == "HTML")
{
@@ -1195,7 +1223,7 @@
$fld = $adb->field_name($result, $x);
$header .= "<td class='rptCellLabel'>".str_replace($modules," ",$fld->name)."</td>";
}
-
+
$noofrows = $adb->num_rows($result);
$custom_field_values = $adb->fetch_array($result);
$groupslist = $this->getGroupingList($this->reportid);
@@ -1213,18 +1241,18 @@
}elseif(count($groupslist) == 3)
{
$newvalue = $custom_field_values[0];
- $snewvalue = $custom_field_values[1];
+ $snewvalue = $custom_field_values[1];
$tnewvalue = $custom_field_values[2];
}
-
+
if($newvalue == "") $newvalue = "-";
if($snewvalue == "") $snewvalue = "-";
if($tnewvalue == "") $tnewvalue = "-";
-
+
$valtemplate .= "<tr>";
-
+
for ($i=0; $i<$y; $i++)
{
$fld = $adb->field_name($result, $i);
@@ -1273,22 +1301,22 @@
$valtemplate .= "<td class='rptGrpHead'>".$fieldvalue."</td>";
}
}
- }
- $valtemplate .= "</tr>";
- $lastvalue = $newvalue;
- $secondvalue = $snewvalue;
- $thirdvalue = $tnewvalue;
- $arr_val[] = $arraylists;
+ }
+ $valtemplate .= "</tr>";
+ $lastvalue = $newvalue;
+ $secondvalue = $snewvalue;
+ $thirdvalue = $tnewvalue;
+ $arr_val[] = $arraylists;
}while($custom_field_values = $adb->fetch_array($result));
-
- $sHTML ='<table cellpadding="5" cellspacing="0" align="center" class="rptTable">
- <tr>'.
- $header
- .'<!-- BEGIN values -->
- <tr>'.
- $valtemplate
- .'</tr>
- </table>';
+
+ $sHTML ='<table cellpadding="5" cellspacing="0" align="center" class="rptTable">
+ <tr>'.
+ $header
+ .'<!-- BEGIN values -->
+ <tr>'.
+ $valtemplate
+ .'</tr>
+ </table>';
//<<<<<<<<construct HTML>>>>>>>>>>>>
$return_data[] = $sHTML;
$return_data[] = $noofrows;
@@ -1297,7 +1325,7 @@
}
}elseif($outputformat == "PDF")
{
-
+
$sSQL = $this->sGetSQLforReport($this->reportid,$filterlist);
$result = $adb->query($sSQL);
$y=$adb->num_fields($result);
@@ -1306,7 +1334,7 @@
{
$noofrows = $adb->num_rows($result);
$custom_field_values = $adb->fetch_array($result);
-
+
do
{
$arraylists = Array();
@@ -1316,7 +1344,7 @@
$fieldvalue = $custom_field_values[$i];
if($fieldvalue == "" )
{
- $fieldvalue = "-";
+ $fieldvalue = "-";
}
$arraylists[str_replace($modules," ",$fld->name)] = $fieldvalue;
}
@@ -1352,7 +1380,7 @@
}
foreach($totclmnflds as $key=>$value)
{
-
+
$coltotalhtml .= '<tr class="rptGrpHead" valign=top><td class="rptData">'.str_replace($modules," ",$value).'</td>';
$arraykey = trim($value).'_SUM';
if(isset($keyhdr[$arraykey]))
@@ -1399,7 +1427,7 @@
return $coltotalhtml;
}
}
-
+
//<<<<<<<new>>>>>>>>>>
function getColumnsTotal($reportid)
{
@@ -1408,34 +1436,34 @@
global $log;
$coltotalsql = "select vtiger_reportsummary.* from vtiger_report";
- $coltotalsql .= " inner join vtiger_reportsummary on vtiger_report.reportid = vtiger_reportsummary.reportsummaryid";
- $coltotalsql .= " where vtiger_report.reportid =".$reportid;
-
- $result = $adb->query($coltotalsql);
-
+ $coltotalsql .= " inner join vtiger_reportsummary on vtiger_report.reportid = vtiger_reportsummary.reportsummaryid";
+ $coltotalsql .= " where vtiger_report.reportid =".$reportid;
+
+ $result = $adb->query($coltotalsql);
+
while($coltotalrow = $adb->fetch_array($result))
{
$fieldcolname = $coltotalrow["columnname"];
-
+
if($fieldcolname != "none")
{
- $fieldlist = explode(":",$fieldcolname);
- if($fieldlist[4] == 2)
- {
- $stdfilterlist[$fieldcolname] = "sum(".$fieldlist[1].".".$fieldlist[2].") ".$fieldlist[3];
- }
- if($fieldlist[4] == 3)
- {
- $stdfilterlist[$fieldcolname] = "avg(".$fieldlist[1].".".$fieldlist[2].") ".$fieldlist[3];
- }
- if($fieldlist[4] == 4)
- {
- $stdfilterlist[$fieldcolname] = "min(".$fieldlist[1].".".$fieldlist[2].") ".$fieldlist[3];
- }
- if($fieldlist[4] == 5)
- {
- $stdfilterlist[$fieldcolname] = "max(".$fieldlist[1].".".$fieldlist[2].") ".$fieldlist[3];
- }
+ $fieldlist = explode(":",$fieldcolname);
+ if($fieldlist[4] == 2)
+ {
+ $stdfilterlist[$fieldcolname] = "sum(".$fieldlist[1].".".$fieldlist[2].") ".$fieldlist[3];
+ }
+ if($fieldlist[4] == 3)
+ {
+ $stdfilterlist[$fieldcolname] = "avg(".$fieldlist[1].".".$fieldlist[2].") ".$fieldlist[3];
+ }
+ if($fieldlist[4] == 4)
+ {
+ $stdfilterlist[$fieldcolname] = "min(".$fieldlist[1].".".$fieldlist[2].") ".$fieldlist[3];
+ }
+ if($fieldlist[4] == 5)
+ {
+ $stdfilterlist[$fieldcolname] = "max(".$fieldlist[1].".".$fieldlist[2].") ".$fieldlist[3];
+ }
}
}
$log->info("ReportRun :: Successfully returned getColumnsTotal".$reportid);
@@ -1452,14 +1480,14 @@
$sreportstdfiltersql = "select vtiger_reportsummary.* from vtiger_report";
$sreportstdfiltersql .= " inner join vtiger_reportsummary on vtiger_report.reportid = vtiger_reportsummary.reportsummaryid";
$sreportstdfiltersql .= " where vtiger_report.reportid =".$reportid;
-
+
$result = $adb->query($sreportstdfiltersql);
$noofrows = $adb->num_rows($result);
-
+
for($i=0; $i<$noofrows; $i++)
{
$fieldcolname = $adb->query_result($result,$i,"columnname");
-
+
if($fieldcolname != "none")
{
$fieldlist = explode(":",$fieldcolname);
Modified: vtigercrm/trunk/modules/Reports/Reports.php
==============================================================================
--- vtigercrm/trunk/modules/Reports/Reports.php (original)
+++ vtigercrm/trunk/modules/Reports/Reports.php Mon Jun 19 17:13:26 2006
@@ -36,7 +36,7 @@
);
$report_modules = Array('Leads','Accounts','Contacts','Potentials','Products',
- 'HelpDesk','Quotes','PurchaseOrder','Invoice','Activities'
+ 'HelpDesk','Quotes','PurchaseOrder','Invoice','Activities','SalesOrder'
);
$related_modules = Array('Leads'=>Array(),
@@ -48,6 +48,7 @@
'HelpDesk'=>Array('Products'),
'Quotes'=>Array('Accounts','Contacts','Potentials'),
'PurchaseOrder'=>Array('Contacts'),
+ 'SalesOrder'=>Array(),
'Invoice'=>Array('Accounts')
);
@@ -61,12 +62,12 @@
-/**
- * This class has the informations for Reports and inherits class CRMEntity and
- * has the variables required to generate,save,restore vtiger_reports
- * and also the required functions for the same
- * Contributor(s): ______________________________________..
- */
+ /**
+ * This class has the informations for Reports and inherits class CRMEntity and
+ * has the variables required to generate,save,restore vtiger_reports
+ * and also the required functions for the same
+ * Contributor(s): ______________________________________..
+ */
var $srptfldridjs;
@@ -102,28 +103,29 @@
var $sec_module_columnslist;
var $advft_column;
- var $advft_option;
- var $advft_value;
-
- var $module_list = Array("Leads"=>Array("Information"=>13,"Address"=>15,"Description"=>16,"Custom Information"=>5),
- "Contacts"=>Array("Information"=>4,"- Portal Information"=>6,"Address"=>7,"Description"=>8,"Custom Information"=>5),
- "Accounts"=>Array("Information"=>9,"Address"=>11,"Description"=>12,"Custom Information"=>5),
- "Potentials"=>Array("Information"=>1,"Description"=>3,"Custom Information"=>5),
- "Activities"=>Array("Information"=>19,"Description"=>20),
- "Products"=>Array("Information"=>31,"Description"=>36,"Custom Information"=>5),
- "Notes"=>Array("Information"=>17,"Description"=>18),
- "Emails"=>Array("Information"=>1,"Description"=>24),
- "HelpDesk"=>Array("Information"=>'25,26',"Custom Information"=>5,"Description"=>28,"Solution"=>29),//patch2
- "Quotes"=>Array("Information"=>51,"Address"=>53,"Description"=>56,"Custom Information"=>5),
- "PurchaseOrder"=>Array("Information"=>57,"Address"=>59,"Description"=>61,"Custom Information"=>5),
- "Invoice"=>Array("Information"=>69,"Address"=>71,"Description"=>74,"Custom Information"=>5)
- );
-
-/** Function to set primodule,secmodule,reporttype,reportname,reportdescription,folderid for given vtiger_reportid
- * This function accepts the vtiger_reportid as argument
- * It sets primodule,secmodule,reporttype,reportname,reportdescription,folderid for the given vtiger_reportid
- */
-
+ var $advft_option;
+ var $advft_value;
+
+ var $module_list = Array("Leads"=>Array("Information"=>13,"Address"=>15,"Description"=>16,"Custom Information"=>14),
+ "Contacts"=>Array("Information"=>4,"- Portal Information"=>6,"Address"=>7,"Description"=>8,"Custom Information"=>5),
+ "Accounts"=>Array("Information"=>9,"Address"=>11,"Description"=>12,"Custom Information"=>10),
+ "Potentials"=>Array("Information"=>1,"Description"=>3,"Custom Information"=>2),
+ "Activities"=>Array("Information"=>19,"Description"=>20),
+ "Products"=>Array("Information"=>31,"Description"=>36,"Custom Information"=>34),
+ "Notes"=>Array("Information"=>17,"Description"=>18),
+ "Emails"=>Array("Information"=>21,"Description"=>24),
+ "HelpDesk"=>Array("Information"=>'25,26',"Custom Information"=>27,"Description"=>28,"Solution"=>29),//patch2
+ "Quotes"=>Array("Information"=>51,"Address"=>53,"Description"=>56,"Custom Information"=>52),
+ "PurchaseOrder"=>Array("Information"=>57,"Address"=>59,"Description"=>61,"Custom Information"=>58),
+ "SalesOrder"=>Array("Information"=>63,"Address"=>65,"Description"=>68,"Custom Information"=>64),
+ "Invoice"=>Array("Information"=>69,"Address"=>71,"Description"=>74,"Custom Information"=>70)
+ );
+
+ /** Function to set primodule,secmodule,reporttype,reportname,reportdescription,folderid for given vtiger_reportid
+ * This function accepts the vtiger_reportid as argument
+ * It sets primodule,secmodule,reporttype,reportname,reportdescription,folderid for the given vtiger_reportid
+ */
+
function Reports($reportid="")
{
global $adb;
@@ -133,7 +135,7 @@
$ssql = "select vtiger_reportmodules.*,vtiger_report.* from vtiger_report inner join vtiger_reportmodules on vtiger_report.reportid = vtiger_reportmodules.reportmodulesid";
$ssql .= " where vtiger_report.reportid =".$reportid;
$result = $adb->query($ssql);
- $reportmodulesrow = $adb->fetch_array($result);
+ $reportmodulesrow = $adb->fetch_array($result);
if($reportmodulesrow)
{
$this->primodule = $reportmodulesrow["primarymodule"];
@@ -147,12 +149,12 @@
}
-/** Function to get the Listview of Reports
- * This function accepts no argument
- * This generate the Reports view page and returns a string
- * contains HTML
- */
-
+ /** Function to get the Listview of Reports
+ * This function accepts no argument
+ * This generate the Reports view page and returns a string
+ * contains HTML
+ */
+
function sgetRptFldr($mode='')
{
@@ -194,11 +196,11 @@
return $returndata;
}
-/** Function to get the Reports inside each modules
- * This function accepts the folderid
- * This Generates the Reports under each Reports module
- * This Returns a HTML sring
- */
+ /** Function to get the Reports inside each modules
+ * This function accepts the folderid
+ * This Generates the Reports under each Reports module
+ * This Returns a HTML sring
+ */
function sgetRptsforFldr($rpt_fldr_id)
{
@@ -207,53 +209,53 @@
global $log;
global $mod_strings;
$returndata = Array();
-
+
require_once('include/utils/UserInfoUtil.php');
-
+
$sql = "select vtiger_report.*, vtiger_reportmodules.* from vtiger_report inner join vtiger_reportfolder on vtiger_reportfolder.folderid = vtiger_report.folderid";
$sql .= " inner join vtiger_reportmodules on vtiger_reportmodules.reportmodulesid = vtiger_report.reportid where vtiger_reportfolder.folderid=".$rpt_fldr_id;
$result = $adb->query($sql);
$report = $adb->fetch_array($result);
if(count($report)>0)
{
- do
- {
- $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));
- }
-
+ do
+ {
+ $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));
+ }
+
$log->info("Reports :: ListView->Successfully returned vtiger_report details HTML");
return $returndata;
}
-/** Function to get the array of ids
- * This function forms the array for the ExpandCollapse
- * Javascript
- * It returns the array of ids
- * Array('1RptFldr','2RptFldr',........,'9RptFldr','10RptFldr')
- */
+ /** Function to get the array of ids
+ * This function forms the array for the ExpandCollapse
+ * Javascript
+ * It returns the array of ids
+ * Array('1RptFldr','2RptFldr',........,'9RptFldr','10RptFldr')
+ */
function sgetJsRptFldr()
{
$srptfldr_js = "var ReportListArray=new Array(".$this->srptfldridjs.")
- setExpandCollapse()";
+ setExpandCollapse()";
return $srptfldr_js;
}
-/** Function to set the Primary module vtiger_fields for the given Report
- * This function sets the primary module columns for the given Report
- * It accepts the Primary module as the argument and set the vtiger_fields of the module
- * to the varialbe pri_module_columnslist and returns true if sucess
- */
+ /** Function to set the Primary module vtiger_fields for the given Report
+ * This function sets the primary module columns for the given Report
+ * It accepts the Primary module as the argument and set the vtiger_fields of the module
+ * to the varialbe pri_module_columnslist and returns true if sucess
+ */
function getPriModuleColumnsList($module)
{
@@ -265,121 +267,125 @@
return true;
}
-/** Function to set the Secondary module fileds for the given Report
- * This function sets the secondary module columns for the given module
- * It accepts the module as the argument and set the vtiger_fields of the module
- * to the varialbe sec_module_columnslist and returns true if sucess
- */
-
+ /** Function to set the Secondary module fileds for the given Report
+ * This function sets the secondary module columns for the given module
+ * It accepts the module as the argument and set the vtiger_fields of the module
+ * to the varialbe sec_module_columnslist and returns true if sucess
+ */
+
function getSecModuleColumnsList($module)
- {
- if($module != "")
- {
- $secmodule = explode(":",$module);
- for($i=0;$i < count($secmodule) ;$i++)
- {
- foreach($this->module_list[$secmodule[$i]] as $key=>$value)
- {
- $ret_module_list[$secmodule[$i]][$key] = $this->getColumnsListbyBlock($secmodule[$i],$value);
- }
+ {
+ if($module != "")
+ {
+ $secmodule = explode(":",$module);
+ for($i=0;$i < count($secmodule) ;$i++)
+ {
+ foreach($this->module_list[$secmodule[$i]] as $key=>$value)
+ {
+ $ret_module_list[$secmodule[$i]][$key] = $this->getColumnsListbyBlock($secmodule[$i],$value);
}
- $this->sec_module_columnslist = $ret_module_list;
- }
- return true;
- }
-
-/** Function to get vtiger_fields for the given module and block
- * This function gets the vtiger_fields for the given module
- * It accepts the module and the block as arguments and
- * returns the array column lists
- * Array module_columnlist[ vtiger_fieldtablename:fieldcolname:module_fieldlabel1:fieldname:fieldtypeofdata]=fieldlabel
- */
+ }
+ $this->sec_module_columnslist = $ret_module_list;
+ }
+ return true;
+ }
+
+ /** Function to get vtiger_fields for the given module and block
+ * This function gets the vtiger_fields for the given module
+ * It accepts the module and the block as arguments and
+ * returns the array column lists
+ * Array module_columnlist[ vtiger_fieldtablename:fieldcolname:module_fieldlabel1:fieldname:fieldtypeofdata]=fieldlabel
+ */
function getColumnsListbyBlock($module,$block)
{
- global $adb;
- global $log;
- global $profileList;
- global $current_user;
-
-
- $tabid = getTabid($module);
-
- //Security Check
- if($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] ==0)
- {
- $sql = "select * from vtiger_field where vtiger_field.uitype != 50 and vtiger_field.tabid=".$tabid." and vtiger_field.block in (".$block .") and vtiger_field.displaytype in (1,2) order by sequence";
- }
- else
- {
-
- $sql = "select * from vtiger_field inner join vtiger_profile2field on vtiger_profile2field.fieldid=vtiger_field.fieldid inner join vtiger_def_org_field on vtiger_def_org_field.fieldid=vtiger_field.fieldid where vtiger_field.uitype != 50 and vtiger_field.tabid=".$tabid." and vtiger_field.block in (".$block .") and vtiger_field.displaytype in (1,2) and vtiger_profile2field.visible=0 and vtiger_def_org_field.visible=0 and vtiger_profile2field.profileid in ".$profileList." group by vtiger_field.fieldid order by sequence";
- }
- $result = $adb->query($sql);
- $noofrows = $adb->num_rows($result);
- for($i=0; $i<$noofrows; $i++)
- {
- $fieldtablename = $adb->query_result($result,$i,"tablename");
- $fieldcolname = $adb->query_result($result,$i,"columnname");
+ global $adb;
+ global $log;
+ global $profileList;
+ global $current_user;
+
+
+ $tabid = getTabid($module);
+
+ //Security Check
+ if($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] ==0)
+ {
+ $sql = "select * from vtiger_field where vtiger_field.uitype != 50 and vtiger_field.tabid=".$tabid." and vtiger_field.block in (".$block .") and vtiger_field.displaytype in (1,2) order by sequence";
+ }
+ else
+ {
+
+ $sql = "select * from vtiger_field inner join vtiger_profile2field on vtiger_profile2field.fieldid=vtiger_field.fieldid inner join vtiger_def_org_field on vtiger_def_org_field.fieldid=vtiger_field.fieldid where vtiger_field.uitype != 50 and vtiger_field.tabid=".$tabid." and vtiger_field.block in (".$block .") and vtiger_field.displaytype in (1,2) and vtiger_profile2field.visible=0 and vtiger_def_org_field.visible=0 and vtiger_profile2field.profileid in ".$profileList." group by vtiger_field.fieldid order by sequence";
+ }
+ $result = $adb->query($sql);
+ $noofrows = $adb->num_rows($result);
+ for($i=0; $i<$noofrows; $i++)
+ {
+ $fieldtablename = $adb->query_result($result,$i,"tablename");
+ $fieldcolname = $adb->query_result($result,$i,"columnname");
$fieldname = $adb->query_result($result,$i,"fieldname");
$fieldtype = $adb->query_result($result,$i,"typeofdata");
$fieldtype = explode("~",$fieldtype);
$fieldtypeofdata = $fieldtype[0];
-
- if($fieldtablename == "crmentity")
- {
- $fieldtablename = $fieldtablename.$module;
- }
+ if($fieldtablename == "vtiger_crmentity")
+ {
+ $fieldtablename = $fieldtablename.$module;
+ }
if($fieldname == "assigned_user_id")
{
- $fieldtablename = "users".$module;
- $fieldcolname = "user_name";
+ $fieldtablename = "vtiger_users".$module;
+ $fieldcolname = "user_name";
}
if($fieldname == "account_id")
{
- $fieldtablename = "account".$module;
+ $fieldtablename = "vtiger_account".$module;
$fieldcolname = "accountname";
}
if($fieldname == "contact_id")
{
- $fieldtablename = "contactdetails".$module;
+ $fieldtablename = "vtiger_contactdetails".$module;
$fieldcolname = "lastname";
}
if($fieldname == "parent_id")
{
- $fieldtablename = "crmentityRel".$module;
- $fieldcolname = "setype";
+ $fieldtablename = "vtiger_crmentityRel".$module;
+ $fieldcolname = "setype";
}
if($fieldname == "vendor_id")
- {
- $fieldtablename = "vendorRel";
+ {
+ $fieldtablename = "vtiger_vendorRel";
$fieldcolname = "vendorname";
- }
- if($fieldname == "potential_id")
- {
- $fieldtablename = "potentialRel";
- $fieldcolname = "potentialname";
- }
- if($fieldname == "assigned_user_id1")
- {
- $fieldtablename = "usersRel1";
- $fieldcolname = "user_name";
- }
-
- $fieldlabel = $adb->query_result($result,$i,"fieldlabel");
- $fieldlabel1 = str_replace(" ","_",$fieldlabel);
- $optionvalue = $fieldtablename.":".$fieldcolname.":".$module."_".$fieldlabel1.":".$fieldname.":".$fieldtypeofdata;
+ }
+ if($fieldname == "potential_id")
+ {
+ $fieldtablename = "vtiger_potentialRel";
+ $fieldcolname = "potentialname";
+ }
+ if($fieldname == "assigned_user_id1")
+ {
+ $fieldtablename = "vtiger_usersRel1";
+ $fieldcolname = "user_name";
+ }
+ if($fieldname == 'quote_id')
+ {
+ $fieldtablename = "vtiger_quotes".$module;
+ $fieldcolname = "subject";
+ }
+
+ $fieldlabel = $adb->query_result($result,$i,"fieldlabel");
+ $fieldlabel1 = str_replace(" ","_",$fieldlabel);
+ $optionvalue = $fieldtablename.":".$fieldcolname.":".$module."_".$fieldlabel1.":".$fieldname.":".$fieldtypeofdata;
$module_columnlist[$optionvalue] = $fieldlabel;
}
- $log->info("Reports :: FieldColumns->Successfully returned ColumnslistbyBlock".$module.$block);
+ $log->info("Reports :: FieldColumns->Successfully returned ColumnslistbyBlock".$module.$block);
return $module_columnlist;
}
-
-/** Function to set the standard filter vtiger_fields for the given vtiger_report
- * This function gets the standard filter vtiger_fields for the given vtiger_report
- * and set the values to the corresponding variables
- * It accepts the repordid as argument
- */
+
+ /** Function to set the standard filter vtiger_fields for the given vtiger_report
+ * This function gets the standard filter vtiger_fields for the given vtiger_report
+ * and set the values to the corresponding variables
+ * It accepts the repordid as argument
+ */
function getSelectedStandardCriteria($reportid)
{
@@ -390,8 +396,8 @@
$selectedstdfilter = $adb->fetch_array($result);
$this->stdselectedcolumn = $selectedstdfilter["datecolumnname"];
- $this->stdselectedfilter = $selectedstdfilter["datefilter"];
-
+ $this->stdselectedfilter = $selectedstdfilter["datefilter"];
+
if($selectedstdfilter["datefilter"] == "custom")
{
if($selectedstdfilter["startdate"] != "0000-00-00")
@@ -405,26 +411,26 @@
}
}
-/** Function to get the combo values for the standard filter
- * This function get the combo values for the standard filter for the given vtiger_report
- * and return a HTML string
- */
+ /** Function to get the combo values for the standard filter
+ * This function get the combo values for the standard filter for the given vtiger_report
+ * and return a HTML string
+ */
function getSelectedStdFilterCriteria($selecteddatefilter = "")
{
-
+
$datefiltervalue = Array("custom","prevfy","thisfy","nextfy","prevfq","thisfq","nextfq",
- "yesterday","today","tomorrow","lastweek","thisweek","nextweek","lastmonth","thismonth",
- "nextmonth","last7days","last30days", "last60days","last90days","last120days",
- "next30days","next60days","next90days","next120days"
- );
-
+ "yesterday","today","tomorrow","lastweek","thisweek","nextweek","lastmonth","thismonth",
+ "nextmonth","last7days","last30days", "last60days","last90days","last120days",
+ "next30days","next60days","next90days","next120days"
+ );
+
$datefilterdisplay = Array("Custom","Previous FY", "Current FY","Next FY","Previous FQ","Current FQ","Next FQ","Yesterday",
- "Today","Tomorrow","Last Week","Current Week","Next Week","Last Month","Current Month",
- "Next Month","Last 7 Days","Last 30 Days","Last 60 Days","Last 90 Days","Last 120 Days",
- "Next 7 Days","Next 30 Days","Next 60 Days","Next 90 Days","Next 120 Days"
- );
-
+ "Today","Tomorrow","Last Week","Current Week","Next Week","Last Month","Current Month",
+ "Next Month","Last 7 Days","Last 30 Days","Last 60 Days","Last 90 Days","Last 120 Days",
+ "Next 7 Days","Next 30 Days","Next 60 Days","Next 90 Days","Next 120 Days"
+ );
+
for($i=0;$i<count($datefiltervalue);$i++)
{
if($selecteddatefilter == $datefiltervalue[$i])
@@ -435,15 +441,15 @@
$sshtml .= "<option value='".$datefiltervalue[$i]."'>".$datefilterdisplay[$i]."</option>";
}
}
-
+
return $sshtml;
}
-/** Function to get the selected standard filter columns
- * This function returns the selected standard filter criteria
- * which is selected for vtiger_reports as an array
- * Array stdcriteria_list[fieldtablename:fieldcolname:module_fieldlabel1]=fieldlabel
- */
+ /** Function to get the selected standard filter columns
+ * This function returns the selected standard filter criteria
+ * which is selected for vtiger_reports as an array
+ * Array stdcriteria_list[fieldtablename:fieldcolname:module_fieldlabel1]=fieldlabel
+ */
function getStdCriteriaByModule($module)
{
@@ -460,270 +466,270 @@
$blockids = implode(",",$blockids);
if($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0)
- {
+ {
$sql = "select * from vtiger_field where vtiger_field.tabid=".$tabid." and (vtiger_field.uitype =5 or vtiger_field.displaytype=2) and vtiger_field.block in (".$blockids.") order by vtiger_field.sequence";
}
else
{
$profileList = getCurrentUserProfileList();
$sql = "select * from vtiger_field inner join vtiger_tab on vtiger_tab.tabid = vtiger_field.tabid inner join vtiger_profile2field on vtiger_profile2field.fieldid=vtiger_field.fieldid inner join vtiger_def_org_field on vtiger_def_org_field.fieldid=vtiger_field.fieldid where vtiger_field.tabid=".$tabid." and (vtiger_field.uitype =5 or vtiger_field.displaytype=2) and vtiger_profile2field.visible=0 and vtiger_def_org_field.visible=0 and vtiger_field.block in (".$blockids.") and vtiger_profile2field.profileid in ".$profileList." order by vtiger_field.sequence";
-
- }
-
- $result = $adb->query($sql);
-
- while($criteriatyperow = $adb->fetch_array($result))
- {
+
+ }
+
+ $result = $adb->query($sql);
+
+ while($criteriatyperow = $adb->fetch_array($result))
+ {
$fieldtablename = $criteriatyperow["tablename"];
- $fieldcolname = $criteriatyperow["columnname"];
- $fieldlabel = $criteriatyperow["fieldlabel"];
-
- if($fieldtablename == "crmentity")
- {
- $fieldtablename = $fieldtablename.$module;
- }
- $fieldlabel1 = str_replace(" ","_",$fieldlabel);
- $optionvalue = $fieldtablename.":".$fieldcolname.":".$module."_".$fieldlabel1;
+ $fieldcolname = $criteriatyperow["columnname"];
+ $fieldlabel = $criteriatyperow["fieldlabel"];
+
+ if($fieldtablename == "vtiger_crmentity")
+ {
+ $fieldtablename = $fieldtablename.$module;
+ }
+ $fieldlabel1 = str_replace(" ","_",$fieldlabel);
+ $optionvalue = $fieldtablename.":".$fieldcolname.":".$module."_".$fieldlabel1;
$stdcriteria_list[$optionvalue] = $fieldlabel;
}
-
+
$log->info("Reports :: StdfilterColumns->Successfully returned Stdfilter for".$module);
return $stdcriteria_list;
-
- }
-
-/** Function to form a javascript to determine the start date and end date for a standard filter
- * This function is to form a javascript to determine
- * the start date and End date from the value selected in the combo lists
- */
+
+ }
+
+ /** Function to form a javascript to determine the start date and end date for a standard filter
+ * This function is to form a javascript to determine
+ * the start date and End date from the value selected in the combo lists
+ */
function getCriteriaJS()
{
$today = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d"), date("Y")));
$tomorrow = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+1, date("Y")));
$yesterday = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-1, date("Y")));
-
+
$currentmonth0 = date("Y-m-d",mktime(0, 0, 0, date("m"), "01", date("Y")));
$currentmonth1 = date("Y-m-t");
$lastmonth0 = date("Y-m-d",mktime(0, 0, 0, date("m")-1, "01", date("Y")));
$lastmonth1 = date("Y-m-t", strtotime("-1 Month"));
$nextmonth0 = date("Y-m-d",mktime(0, 0, 0, date("m")+1, "01", date("Y")));
$nextmonth1 = date("Y-m-t", strtotime("+1 Month"));
-
+
$lastweek0 = date("Y-m-d",strtotime("-2 week Sunday"));
$lastweek1 = date("Y-m-d",strtotime("-1 week Saturday"));
-
+
$thisweek0 = date("Y-m-d",strtotime("-1 week Sunday"));
$thisweek1 = date("Y-m-d",strtotime("this Saturday"));
-
+
$nextweek0 = date("Y-m-d",strtotime("this Sunday"));
$nextweek1 = date("Y-m-d",strtotime("+1 week Saturday"));
-
+
$next7days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+6, date("Y")));
$next30days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+29, date("Y")));
$next60days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+59, date("Y")));
$next90days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+89, date("Y")));
$next120days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+119, date("Y")));
-
+
$last7days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-6, date("Y")));
$last30days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-29, date("Y")));
$last60days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-59, date("Y")));
$last90days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-89, date("Y")));
$last120days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-119, date("Y")));
-
+
$currentFY0 = date("Y-m-d",mktime(0, 0, 0, "01", "01", date("Y")));
$currentFY1 = date("Y-m-t",mktime(0, 0, 0, "12", date("d"), date("Y")));
$lastFY0 = date("Y-m-d",mktime(0, 0, 0, "01", "01", date("Y")-1));
$lastFY1 = date("Y-m-t", mktime(0, 0, 0, "12", date("d"), date("Y")-1));
$nextFY0 = date("Y-m-d",mktime(0, 0, 0, "01", "01", date("Y")+1));
$nextFY1 = date("Y-m-t", mktime(0, 0, 0, "12", date("d"), date("Y")+1));
-
+
$sjsStr = '<script language="JavaScript" type="text/javaScript">
- function showDateRange( type )
- {
- if (type!="custom")
- {
- document.NewReport.startdate.readOnly=true
- document.NewReport.enddate.readOnly=true
- getObj("jscal_trigger_date_start").style.visibility="hidden"
- getObj("jscal_trigger_date_end").style.visibility="hidden"
- }
- else
- {
- document.NewReport.startdate.readOnly=false
- document.NewReport.enddate.readOnly=false
- getObj("jscal_trigger_date_start").style.visibility="visible"
- getObj("jscal_trigger_date_end").style.visibility="visible"
- }
- if( type == "today" )
- {
-
- document.NewReport.startdate.value = "'.$today.'";
- document.NewReport.enddate.value = "'.$today.'";
- }
- else if( type == "yesterday" )
- {
-
- document.NewReport.startdate.value = "'.$yesterday.'";
- document.NewReport.enddate.value = "'.$yesterday.'";
- }
- else if( type == "tomorrow" )
- {
-
- document.NewReport.startdate.value = "'.$tomorrow.'";
- document.NewReport.enddate.value = "'.$tomorrow.'";
+ function showDateRange( type )
+ {
+ if (type!="custom")
+ {
+ document.NewReport.startdate.readOnly=true
+ document.NewReport.enddate.readOnly=true
+ getObj("jscal_trigger_date_start").style.visibility="hidden"
+ getObj("jscal_trigger_date_end").style.visibility="hidden"
+ }
+ else
+ {
+ document.NewReport.startdate.readOnly=false
+ document.NewReport.enddate.readOnly=false
+ getObj("jscal_trigger_date_start").style.visibility="visible"
+ getObj("jscal_trigger_date_end").style.visibility="visible"
+ }
+ if( type == "today" )
+ {
+
+ document.NewReport.startdate.value = "'.$today.'";
+ document.NewReport.enddate.value = "'.$today.'";
+ }
+ else if( type == "yesterday" )
+ {
+
+ document.NewReport.startdate.value = "'.$yesterday.'";
+ document.NewReport.enddate.value = "'.$yesterday.'";
+ }
+ else if( type == "tomorrow" )
+ {
+
+ document.NewReport.startdate.value = "'.$tomorrow.'";
+ document.NewReport.enddate.value = "'.$tomorrow.'";
+ }
+ else if( type == "thisweek" )
+ {
+
+ document.NewReport.startdate.value = "'.$thisweek0.'";
+ document.NewReport.enddate.value = "'.$thisweek1.'";
+ }
+ else if( type == "lastweek" )
+ {
+
+ document.NewReport.startdate.value = "'.$lastweek0.'";
+ document.NewReport.enddate.value = "'.$lastweek1.'";
+ }
+ else if( type == "nextweek" )
+ {
+
+ document.NewReport.startdate.value = "'.$nextweek0.'";
+ document.NewReport.enddate.value = "'.$nextweek1.'";
+ }
+
+ else if( type == "thismonth" )
+ {
+
+ document.NewReport.startdate.value = "'.$currentmonth0.'";
+ document.NewReport.enddate.value = "'.$currentmonth1.'";
+ }
+
+ else if( type == "lastmonth" )
+ {
+
+ document.NewReport.startdate.value = "'.$lastmonth0.'";
+ document.NewReport.enddate.value = "'.$lastmonth1.'";
+ }
+ else if( type == "nextmonth" )
+ {
+
+ document.NewReport.startdate.value = "'.$nextmonth0.'";
+ document.NewReport.enddate.value = "'.$nextmonth1.'";
+ }
+ else if( type == "next7days" )
+ {
+
+ document.NewReport.startdate.value = "'.$today.'";
+ document.NewReport.enddate.value = "'.$next7days.'";
+ }
+ else if( type == "next30days" )
+ {
+
+ document.NewReport.startdate.value = "'.$today.'";
+ document.NewReport.enddate.value = "'.$next30days.'";
+ }
+ else if( type == "next60days" )
+ {
+
+ document.NewReport.startdate.value = "'.$today.'";
+ document.NewReport.enddate.value = "'.$next60days.'";
+ }
+ else if( type == "next90days" )
+ {
+
+ document.NewReport.startdate.value = "'.$today.'";
+ document.NewReport.enddate.value = "'.$next90days.'";
+ }
+ else if( type == "next120days" )
+ {
+
+ document.NewReport.startdate.value = "'.$today.'";
+ document.NewReport.enddate.value = "'.$next120days.'";
+ }
+ else if( type == "last7days" )
+ {
+
+ document.NewReport.startdate.value = "'.$last7days.'";
+ document.NewReport.enddate.value = "'.$today.'";
+ }
+ else if( type == "last30days" )
+ {
+
+ document.NewReport.startdate.value = "'.$last30days.'";
+ document.NewReport.enddate.value = "'.$today.'";
+ }
+ else if( type == "last60days" )
+ {
+
+ document.NewReport.startdate.value = "'.$last60days.'";
+ document.NewReport.enddate.value = "'.$today.'";
+ }
+ else if( type == "last90days" )
+ {
+
+ document.NewReport.startdate.value = "'.$last90days.'";
+ document.NewReport.enddate.value = "'.$today.'";
+ }
+ else if( type == "last120days" )
+ {
+
+ document.NewReport.startdate.value = "'.$last120days.'";
+ document.NewReport.enddate.value = "'.$today.'";
+ }
+ else if( type == "thisfy" )
+ {
+
+ document.NewReport.startdate.value = "'.$currentFY0.'";
+ document.NewReport.enddate.value = "'.$currentFY1.'";
+ }
+ else if( type == "prevfy" )
+ {
+
+ document.NewReport.startdate.value = "'.$lastFY0.'";
+ document.NewReport.enddate.value = "'.$lastFY1.'";
+ }
+ else if( type == "nextfy" )
+ {
+
+ document.NewReport.startdate.value = "'.$nextFY0.'";
+ document.NewReport.enddate.value = "'.$nextFY1.'";
+ }
+ else if( type == "nextfq" )
+ {
+
+ document.NewReport.startdate.value = "2005-07-01";
+ document.NewReport.enddate.value = "2005-09-30";
+ }
+ else if( type == "prevfq" )
+ {
+
+ document.NewReport.startdate.value = "2005-01-01";
+ document.NewReport.enddate.value = "2005-03-31";
+ }
+ else if( type == "thisfq" )
+ {
+ document.NewReport.startdate.value = "2005-04-01";
+ document.NewReport.enddate.value = "2005-06-30";
+ }
+ else
+ {
+ document.NewReport.startdate.value = "";
+ document.NewReport.enddate.value = "";
+ }
}
- else if( type == "thisweek" )
- {
-
- document.NewReport.startdate.value = "'.$thisweek0.'";
- document.NewReport.enddate.value = "'.$thisweek1.'";
- }
- else if( type == "lastweek" )
- {
-
- document.NewReport.startdate.value = "'.$lastweek0.'";
- document.NewReport.enddate.value = "'.$lastweek1.'";
- }
- else if( type == "nextweek" )
- {
-
- document.NewReport.startdate.value = "'.$nextweek0.'";
- document.NewReport.enddate.value = "'.$nextweek1.'";
- }
-
- else if( type == "thismonth" )
- {
-
- document.NewReport.startdate.value = "'.$currentmonth0.'";
- document.NewReport.enddate.value = "'.$currentmonth1.'";
- }
-
- else if( type == "lastmonth" )
- {
-
- document.NewReport.startdate.value = "'.$lastmonth0.'";
- document.NewReport.enddate.value = "'.$lastmonth1.'";
- }
- else if( type == "nextmonth" )
- {
-
- document.NewReport.startdate.value = "'.$nextmonth0.'";
- document.NewReport.enddate.value = "'.$nextmonth1.'";
- }
- else if( type == "next7days" )
- {
-
- document.NewReport.startdate.value = "'.$today.'";
- document.NewReport.enddate.value = "'.$next7days.'";
- }
- else if( type == "next30days" )
- {
-
- document.NewReport.startdate.value = "'.$today.'";
- document.NewReport.enddate.value = "'.$next30days.'";
- }
- else if( type == "next60days" )
- {
-
- document.NewReport.startdate.value = "'.$today.'";
- document.NewReport.enddate.value = "'.$next60days.'";
- }
- else if( type == "next90days" )
- {
-
- document.NewReport.startdate.value = "'.$today.'";
- document.NewReport.enddate.value = "'.$next90days.'";
- }
- else if( type == "next120days" )
- {
-
- document.NewReport.startdate.value = "'.$today.'";
- document.NewReport.enddate.value = "'.$next120days.'";
- }
- else if( type == "last7days" )
- {
-
- document.NewReport.startdate.value = "'.$last7days.'";
- document.NewReport.enddate.value = "'.$today.'";
- }
- else if( type == "last30days" )
- {
-
- document.NewReport.startdate.value = "'.$last30days.'";
- document.NewReport.enddate.value = "'.$today.'";
- }
- else if( type == "last60days" )
- {
-
- document.NewReport.startdate.value = "'.$last60days.'";
- document.NewReport.enddate.value = "'.$today.'";
- }
- else if( type == "last90days" )
- {
-
- document.NewReport.startdate.value = "'.$last90days.'";
- document.NewReport.enddate.value = "'.$today.'";
- }
- else if( type == "last120days" )
- {
-
- document.NewReport.startdate.value = "'.$last120days.'";
- document.NewReport.enddate.value = "'.$today.'";
- }
- else if( type == "thisfy" )
- {
-
- document.NewReport.startdate.value = "'.$currentFY0.'";
- document.NewReport.enddate.value = "'.$currentFY1.'";
- }
- else if( type == "prevfy" )
- {
-
- document.NewReport.startdate.value = "'.$lastFY0.'";
- document.NewReport.enddate.value = "'.$lastFY1.'";
- }
- else if( type == "nextfy" )
- {
-
- document.NewReport.startdate.value = "'.$nextFY0.'";
- document.NewReport.enddate.value = "'.$nextFY1.'";
- }
- else if( type == "nextfq" )
- {
-
- document.NewReport.startdate.value = "2005-07-01";
- document.NewReport.enddate.value = "2005-09-30";
- }
- else if( type == "prevfq" )
- {
-
- document.NewReport.startdate.value = "2005-01-01";
- document.NewReport.enddate.value = "2005-03-31";
- }
- else if( type == "thisfq" )
- {
- document.NewReport.startdate.value = "2005-04-01";
- document.NewReport.enddate.value = "2005-06-30";
- }
- else
- {
- document.NewReport.startdate.value = "";
- document.NewReport.enddate.value = "";
- }
- }
</script>';
-
+
return $sjsStr;
}
-/** Function to set the order of grouping and to find the columns responsible
- * to the grouping
- * This function accepts the vtiger_reportid as variable,sets the variable ascdescorder[] to the sort order and
- * returns the array array_list which has the column responsible for the grouping
- * Array array_list[0]=columnname
- */
+ /** Function to set the order of grouping and to find the columns responsible
+ * to the grouping
+ * This function accepts the vtiger_reportid as variable,sets the variable ascdescorder[] to the sort order and
+ * returns the array array_list which has the column responsible for the grouping
+ * Array array_list[0]=columnname
+ */
function getSelctedSortingColumns($reportid)
@@ -732,7 +738,7 @@
global $adb;
global $log;
- $sreportsortsql = "select vtiger_reportsortcol.* from vtiger_report";
+ $sreportsortsql = "select vtiger_reportsortcol.* from vtiger_report";
$sreportsortsql .= " inner join vtiger_reportsortcol on vtiger_report.reportid = vtiger_reportsortcol.reportid";
$sreportsortsql .= " where vtiger_report.reportid =".$reportid." order by vtiger_reportsortcol.sortcolid";
@@ -746,22 +752,22 @@
$this->ascdescorder[] = $sort_values;
$array_list[] = $fieldcolname;
}
-
+
$log->info("Reports :: Successfully returned getSelctedSortingColumns");
return $array_list;
}
-
-/** Function to get the selected columns list for a selected vtiger_report
- * This function accepts the vtiger_reportid as the argument and get the selected columns
- * for the given vtiger_reportid and it forms a combo lists and returns
- * HTML of the combo values
- */
+
+ /** Function to get the selected columns list for a selected vtiger_report
+ * This function accepts the vtiger_reportid as the argument and get the selected columns
+ * for the given vtiger_reportid and it forms a combo lists and returns
+ * HTML of the combo values
+ */
function getSelectedColumnsList($reportid)
{
global $adb;
- global $modules;
+ global $modules;
global $log;
$ssql = "select vtiger_selectcolumn.* from vtiger_report inner join vtiger_selectquery on vtiger_selectquery.queryid = vtiger_report.queryid";
@@ -785,14 +791,14 @@
return $shtml;
}
-/** Function to Set the selected columns for the advanced filter for the vtiger_report
- * This function accepts the vtiger_reportid as the argument and get the selected columns
- * in the advanced filter and sets the values
- * $this->advft_column[] = The column name
- * $this->advft_option[] = The filter option
- * $this->advft_value[] = The value to be compared
- * and returns true in sucess
- */
+ /** Function to Set the selected columns for the advanced filter for the vtiger_report
+ * This function accepts the vtiger_reportid as the argument and get the selected columns
+ * in the advanced filter and sets the values
+ * $this->advft_column[] = The column name
+ * $this->advft_option[] = The filter option
+ * $this->advft_value[] = The value to be compared
+ * and returns true in sucess
+ */
//<<<<<<<<advanced filter>>>>>>>>>>>>>>
function getAdvancedFilterList($reportid)
@@ -816,13 +822,13 @@
return true;
}
//<<<<<<<<advanced filter>>>>>>>>>>>>>>
-
-/** Function to get the list of vtiger_report folders when Save and run the vtiger_report
- * This function gets the vtiger_report folders from database and form
- * a combo values of the folders and return
- * HTML of the combo values
- */
-
+
+ /** Function to get the list of vtiger_report folders when Save and run the vtiger_report
+ * This function gets the vtiger_report folders from database and form
+ * a combo values of the folders and return
+ * HTML of the combo values
+ */
+
function sgetRptFldrSaveReport()
{
global $adb;
@@ -832,20 +838,20 @@
$result = $adb->query($sql);
$reportfldrow = $adb->fetch_array($result);
$x = 0;
- do
+ do
{
$shtml .= "<option value='".$reportfldrow['folderid']."'>".$reportfldrow['foldername']."</option>";
}while($reportfldrow = $adb->fetch_array($result));
-
+
$log->info("Reports :: Successfully returned sgetRptFldrSaveReport");
return $shtml;
}
-/** Function to get the column to total vtiger_fields in Reports
- * This function gets columns to total vtiger_field
- * and generated the html for that vtiger_fields
- * It returns the HTML of the vtiger_fields along with the check boxes
- */
+ /** Function to get the column to total vtiger_fields in Reports
+ * This function gets columns to total vtiger_field
+ * and generated the html for that vtiger_fields
+ * It returns the HTML of the vtiger_fields along with the check boxes
+ */
function sgetColumntoTotal($primarymodule,$secondarymodule)
{
@@ -861,14 +867,14 @@
}
return $options;
}
-
-/** Function to get the selected columns of total vtiger_fields in Reports
- * This function gets selected columns of total vtiger_field
- * and generated the html for that vtiger_fields
- * It returns the HTML of the vtiger_fields along with the check boxes
- */
-
-
+
+ /** Function to get the selected columns of total vtiger_fields in Reports
+ * This function gets selected columns of total vtiger_field
+ * and generated the html for that vtiger_fields
+ * It returns the HTML of the vtiger_fields along with the check boxes
+ */
+
+
function sgetColumntoTotalSelected($primarymodule,$secondarymodule,$reportid)
{
global $adb;
@@ -881,11 +887,11 @@
if($result)
{
$reportsummaryrow = $adb->fetch_array($result);
-
+
do
{
$this->columnssummary[] = $reportsummaryrow["columnname"];
-
+
}while($reportsummaryrow = $adb->fetch_array($result));
}
}
@@ -898,19 +904,19 @@
$options []= $this->sgetColumnstoTotalHTML($secondarymodule[$i],($i+1));
}
}
-
+
$log->info("Reports :: Successfully returned sgetColumntoTotalSelected");
return $options;
}
-/** Function to form the HTML for columns to total
- * This function formulates the HTML format of the
- * vtiger_fields along with four checkboxes
- * It returns the HTML of the vtiger_fields along with the check boxes
- */
-
-
+ /** Function to form the HTML for columns to total
+ * This function formulates the HTML format of the
+ * vtiger_fields along with four checkboxes
+ * It returns the HTML of the vtiger_fields along with the check boxes
+ */
+
+
function sgetColumnstoTotalHTML($module)
{
//retreive the vtiger_tabid
@@ -935,15 +941,15 @@
do
{
$typeofdata = explode("~",$columntototalrow["typeofdata"]);
-
- if($typeofdata[0] == "N" || $typeofdata[0] == "I")
+
+ if($typeofdata[0] == "N" || $typeofdata[0] == "I")
{
$options = Array();
if(isset($this->columnssummary))
{
$selectedcolumn = "";
$selectedcolumn1 = "";
-
+
for($i=0;$i < count($this->columnssummary) ;$i++)
{
$selectedcolumnarray = explode(":",$this->columnssummary[$i]);
@@ -957,41 +963,41 @@
{
$selectedcolumn1[$selectedcolumnarray[4]] = $this->columnssummary[$i];
}
-
- }
-
-$columntototalrow['fieldlabel'] = str_replace(" ","_",$columntototalrow['fieldlabel']);
+
+ }
+
+ $columntototalrow['fieldlabel'] = str_replace(" ","_",$columntototalrow['fieldlabel']);
$options []= $columntototalrow['tablabel'].' - '.$columntototalrow['fieldlabel'];
- if($selectedcolumn1[2] == "cb:".$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel']."_SUM:2")
- {
- $options []= '<input checked name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_SUM:2" type="checkbox" value="">';
- }else
- {
- $options []= '<input name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_SUM:2" type="checkbox" value="">';
- }
- if($selectedcolumn1[3] == "cb:".$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel']."_AVG:3")
- {
- $options []= '<input checked name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_AVG:3" type="checkbox" value="">';
- }else
- {
- $options []= '<input name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_AVG:3" type="checkbox" value="">';
- }
-
- if($selectedcolumn1[4] == "cb:".$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel']."_MIN:4")
- {
- $options []= '<input checked name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MIN:4" type="checkbox" value="">';
- }else
- {
- $options []= '<input name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MIN:4" type="checkbox" value="">';
- }
-
- if($selectedcolumn1[5] == "cb:".$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel']."_MAX:5")
- {
- $options []= '<input checked name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MAX:5" type="checkbox" value="">';
- }else
- {
- $options []= '<input name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MAX:5" type="checkbox" value="">';
- }
+ if($selectedcolumn1[2] == "cb:".$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel']."_SUM:2")
+ {
+ $options []= '<input checked name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_SUM:2" type="checkbox" value="">';
+ }else
+ {
+ $options []= '<input name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_SUM:2" type="checkbox" value="">';
+ }
+ if($selectedcolumn1[3] == "cb:".$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel']."_AVG:3")
+ {
+ $options []= '<input checked name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_AVG:3" type="checkbox" value="">';
+ }else
+ {
+ $options []= '<input name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_AVG:3" type="checkbox" value="">';
+ }
+
+ if($selectedcolumn1[4] == "cb:".$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel']."_MIN:4")
+ {
+ $options []= '<input checked name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MIN:4" type="checkbox" value="">';
+ }else
+ {
+ $options []= '<input name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MIN:4" type="checkbox" value="">';
+ }
+
+ if($selectedcolumn1[5] == "cb:".$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel']."_MAX:5")
+ {
+ $options []= '<input checked name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MAX:5" type="checkbox" value="">';
+ }else
+ {
+ $options []= '<input name="cb:'.$columntototalrow['tablename'].':'.$columntototalrow['columnname'].':'.$columntototalrow['fieldlabel'].'_MAX:5" type="checkbox" value="">';
+ }
}else
{
$options []= $columntototalrow['tablabel'].' - '.$columntototalrow['fieldlabel'];
@@ -1003,7 +1009,7 @@
$options_list [] = $options;
}
}while($columntototalrow = $adb->fetch_array($result));
-
+
$log->info("Reports :: Successfully returned sgetColumnstoTotalHTML");
return $options_list;
}
Modified: vtigercrm/trunk/modules/Reports/Save.php
==============================================================================
--- vtigercrm/trunk/modules/Reports/Save.php (original)
+++ vtigercrm/trunk/modules/Reports/Save.php Mon Jun 19 17:13:26 2006
@@ -11,10 +11,8 @@
require_once('modules/Reports/Reports.php');
require_once('include/logging.php');
require_once('include/database/PearDatabase.php');
-
global $adb;
global $log;
-
$reportid = $_REQUEST["record"];
//<<<<<<<selectcolumn>>>>>>>>>
@@ -96,7 +94,7 @@
{
$iquerysql = "insert into vtiger_selectquery (QUERYID,STARTINDEX,NUMOFOBJECTS) values (".$genQueryId.",0,0)";
$iquerysqlresult = $adb->query($iquerysql);
- $log->info("Reports :: Save->Successfully saved vtiger_selectquery");
+ $log->info("Reports :: Save->Successfully saved vtiger_selectquery");
if($iquerysqlresult!=false)
{
//<<<<step2 vtiger_selectcolumn>>>>>>>>
@@ -112,14 +110,12 @@
$log->info("Reports :: Save->Successfully saved vtiger_selectcolumn");
//<<<<step2 vtiger_selectcolumn>>>>>>>>
- //$genReportMId = $adb->getUniqueID("reportmodules");
-
- if($genQueryId != "")
- {
+ if($genQueryId != "")
+ {
$ireportsql = "insert into vtiger_report (REPORTID,FOLDERID,REPORTNAME,DESCRIPTION,REPORTTYPE,QUERYID,STATE)";
$ireportsql .= " values (".$genQueryId.",".$folderid.",'".$reportname."','".$reportdescription."','".$reporttype."',".$genQueryId.",'CUSTOM')";
$ireportresult = $adb->query($ireportsql);
- $log->info("Reports :: Save->Successfully saved vtiger_report");
+ $log->info("Reports :: Save->Successfully saved vtiger_report");
if($ireportresult!=false)
{
//<<<<reportmodules>>>>>>>
@@ -163,32 +159,30 @@
//<<<<step4 columnstototal>>>>>>>
//<<<<step5 advancedfilter>>>>>>>
- for ($i=0;$i<count($adv_filter_col);$i++)
- {
- $irelcriteriasql = "insert into vtiger_relcriteria(QUERYID,COLUMNINDEX,COLUMNNAME,COMPARATOR,VALUE) values (".$genQueryId.",".$i.",'".$adv_filter_col[$i]."','".$adv_filter_option[$i]."','".$adv_filter_value[$i]."')";
- //echo $irelcriteriasql;
-
- $irelcriteriaresult = $adb->query($irelcriteriasql);
- }
+ for ($i=0;$i<count($adv_filter_col);$i++)
+ {
+ $irelcriteriasql = "insert into vtiger_relcriteria(QUERYID,COLUMNINDEX,COLUMNNAME,COMPARATOR,VALUE) values (".$genQueryId.",".$i.",'".$adv_filter_col[$i]."','".$adv_filter_option[$i]."','".$adv_filter_value[$i]."')";
+ $irelcriteriaresult = $adb->query($irelcriteriasql);
+ }
$log->info("Reports :: Save->Successfully saved vtiger_relcriteria");
- //<<<<step5 advancedfilter>>>>>>>
+ //<<<<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;
+ die;
}
- }
+ }
}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;
+ die;
}
echo '<script>window.opener.location.href =window.opener.location.href;self.close();</script>';
}
@@ -200,7 +194,6 @@
{
$idelcolumnsql = "delete from vtiger_selectcolumn where queryid=".$reportid;
$idelcolumnsqlresult = $adb->query($idelcolumnsql);
- //echo $idelcolumnsql;
if($idelcolumnsqlresult != false)
{
$selectedcolumns = explode(";",$selectedcolumnstring);
@@ -208,7 +201,6 @@
{
$icolumnsql = "insert into vtiger_selectcolumn (QUERYID,COLUMNINDEX,COLUMNNAME) values (".$reportid.",".$i.",'".$selectedcolumns[$i]."')";
$icolumnsqlresult = $adb->query($icolumnsql);
- //echo $icolumnsql;
}
}
}
@@ -220,12 +212,10 @@
$ireportsql .= " where REPORTID=".$reportid;
$ireportresult = $adb->query($ireportsql);
$log->info("Reports :: Save->Successfully saved vtiger_report");
- //echo $ireportsql;
-
- $idelreportsortcolsql = "delete from vtiger_reportsortcol where vtiger_reportid=".$reportid;
+
+ $idelreportsortcolsql = "delete from vtiger_reportsortcol where reportid=".$reportid;
$idelreportsortcolsqlresult = $adb->query($idelreportsortcolsql);
$log->info("Reports :: Save->Successfully deleted vtiger_reportsortcol");
- //echo $idelreportsortcolsql;
if($idelreportsortcolsqlresult!=false)
{
@@ -234,7 +224,6 @@
{
$sort_by1sql = "insert into vtiger_reportsortcol (SORTCOLID,REPORTID,COLUMNNAME,SORTORDER) values (1,".$reportid.",'".$sort_by1."','".$sort_order1."')";
$sort_by1result = $adb->query($sort_by1sql);
- //echo $sort_by1sql;
}
if($sort_by2 != "")
{
@@ -251,7 +240,6 @@
$idelreportdatefiltersql = "delete from vtiger_reportdatefilter where datefilterid=".$reportid;
$idelreportdatefiltersqlresult = $adb->query($idelreportdatefiltersql);
- //echo $idelreportsortcolsql;
//<<<<step5 standarfilder>>>>>>>
$ireportmodulesql = "insert into vtiger_reportdatefilter (DATEFILTERID,DATECOLUMNNAME,DATEFILTER,STARTDATE,ENDDATE) values (".$reportid.",'".$stdDateFilterField."','".$stdDateFilter."','".$startdate."','".$enddate."')";
@@ -260,7 +248,7 @@
//<<<<step5 standarfilder>>>>>>>
//<<<<step4 columnstototal>>>>>>>
- $idelreportsummarysql = "delete from vtiger_reportsummary where vtiger_reportsummaryid=".$reportid;
+ $idelreportsummarysql = "delete from vtiger_reportsummary where reportsummaryid=".$reportid;
$idelreportsummarysqlresult = $adb->query($idelreportsummarysql);
for ($i=0;$i<count($columnstototal);$i++)
@@ -287,20 +275,20 @@
}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>" ;
echo $errormessage;
+ die;
}
}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;
+ die;
}
- echo '<script>window.opener.location.href =window.opener.location.href;self.close();</script>';
+ 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 Mon Jun 19 17:13:26 2006
@@ -176,11 +176,11 @@
function getReportsinFolder($folderid)
{
global $adb;
- $query = 'select vtiger_reportid,reportname from vtiger_report where folderid='.$folderid;
+ $query = 'select reportid,reportname from vtiger_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;
More information about the vtigercrm-commits
mailing list