function sgetSummariesOptions($module) { $options = array(); if ($module != "") { global $current_user; $adb = PearDatabase::getInstance(); $user_privileges_path = 'user_privileges/user_privileges_' . $current_user->id . '.php'; if (file_exists($user_privileges_path)) { require $user_privileges_path; } $relmod_arr = explode("x", $module); if (is_numeric($relmod_arr[0])) { $tabid = $relmod_arr[0]; $module = vtlib_getModuleNameById($tabid); $fieldid = $relmod_arr[1]; $fieldidstr = isset($fieldid) && $fieldid != "" ? $fieldid : ""; } else { $tabid = getTabid($relmod_arr[0]); $fieldid = $fieldidstr = ""; } $fieldidstr = ""; if ($fieldid != "") { $fieldidstr = ":{$fieldid}"; } $result = ITS4YouReports::getColumnsTotalRow($tabid); global $default_charset; $currentModuleName = "ITS4YouReports"; $options = array(); // ITS4YOU-CR SlOl 7. 3. 2014 11:05:30 if (!isset($options[vtranslate("COUNT_GROUP", $currentModuleName)])) { if (vtlib_isModuleActive($module)) { $c_focus = CRMEntity::getInstance($module); // $optionvalue_count = $columntototalrow['tablename'] . ":" . $columntototalrow['columnname'] . ":" . $module . "_" . str_replace(" ", "_", $columntototalrow['fieldlabel']) . ":" . $columntototalrow['fieldname']; $optionvalue_count = "vtiger_crmentity:crmid:" . $module . "_" . 'LBL_RECORDS' . $count_module_lbl . ":" . $module . "_count"; $option_details = explode(":", $optionvalue_count); $option_lbl_arr = explode("_", $option_details[2], 2); $calculation_type = $option_details[4]; $count_module_lbl = ""; $count_module = $option_lbl_arr[0]; $count_module_lbl = " " . vtranslate("LBL_OF", $currentModuleName) . " " . vtranslate($count_module, $count_module); } $options[vtranslate("COUNT_GROUP", $currentModuleName)][] = array("value" => $optionvalue_count . ':V' . $fieldidstr . ':COUNT', "text" => vtranslate("LBL_COUNT", $currentModuleName) . ' ' . vtranslate("LBL_RECORDS", $currentModuleName) . $count_module_lbl); } // ITS4YOU-END 7. 3. 2014 11:05:37 if ($adb->num_rows($result) > 0) { do { $typeofdata = explode("~", $columntototalrow["typeofdata"]); global $current_user; $typeofdata_val = ":" . $typeofdata[0]; $optionvalue = $columntototalrow['tablename'] . ":" . $columntototalrow['columnname'] . ":" . $module . "_" . $columntototalrow['fieldlabel'] . ":" . $columntototalrow['fieldname'] . $typeofdata_val . $fieldidstr; $optionvalue = str_replace("&", "@AMPKO@", html_entity_decode($optionvalue, ENT_QUOTES, $default_charset)); $group_key = vtranslate($columntototalrow['fieldlabel'], $columntototalrow['tablabel']); $options[$group_key][] = array("value" => $optionvalue . ':SUM', "text" => vtranslate("SUM", $currentModuleName) . ' ' . vtranslate("LBL_OF", $currentModuleName) . " " . vtranslate($columntototalrow['fieldlabel'], $columntototalrow['tablabel'])); $options[$group_key][] = array("value" => $optionvalue . ':AVG', "text" => vtranslate("AVG", $currentModuleName) . ' ' . vtranslate("LBL_OF", $currentModuleName) . " " . vtranslate($columntototalrow['fieldlabel'], $columntototalrow['tablabel'])); $options[$group_key][] = array("value" => $optionvalue . ':MIN', "text" => vtranslate("MIN", $currentModuleName) . ' ' . vtranslate("LBL_OF", $currentModuleName) . " " . vtranslate($columntototalrow['fieldlabel'], $columntototalrow['tablabel'])); $options[$group_key][] = array("value" => $optionvalue . ':MAX', "text" => vtranslate("MAX", $currentModuleName) . ' ' . vtranslate("LBL_OF", $currentModuleName) . " " . vtranslate($columntototalrow['fieldlabel'], $columntototalrow['tablabel'])); //} } while ($columntototalrow = $adb->fetch_array($result)); } if (in_array($module, ITS4YouReports::$inventory_modules)) { $fieldtablename = 'vtiger_inventoryproductrel' . $fieldid; $fields = array('listprice' => vtranslate('List Price', $module), 'quantity' => vtranslate('Quantity', $module), 'ps_producttotal' => $module_lbl . " " . vtranslate('LBL_PRODUCT_TOTAL', $currentModuleName), 'discount' => vtranslate('Discount', $module), 'ps_productstotalafterdiscount' => $module_lbl . " " . vtranslate('LBL_PRODUCTTOTALAFTERDISCOUNT', $currentModuleName), 'ps_productvatsum' => $module_lbl . " " . vtranslate('LBL_PRODUCT_VAT_SUM', $currentModuleName), 'ps_producttotalsum' => $module_lbl . " " . vtranslate('LBL_PRODUCT_TOTAL_VAT', $currentModuleName)); $fields_datatype = array('listprice' => 'I', 'quantity' => 'I', 'ps_producttotal' => 'I', 'discount' => 'I', 'ps_productstotalafterdiscount' => 'I', 'ps_productvatsum' => 'I', 'ps_producttotalsum' => 'I'); foreach ($fields as $fieldcolname => $label) { $optionvalue = $fieldtablename . ":" . $fieldcolname . ":" . $module . "_" . $label . ":" . $fieldcolname . ":I" . $fieldidstr; $group_key = vtranslate($module, $module) . ' ' . vtranslate("Product", $module) . ' / ' . vtranslate("Service", $module) . ' - ' . $label; $options[$group_key][] = array("value" => $optionvalue . ':SUM', "text" => vtranslate("SUM", $currentModuleName) . ' ' . vtranslate("LBL_OF", $currentModuleName) . " " . $label); $options[$group_key][] = array("value" => $optionvalue . ':AVG', "text" => vtranslate("AVG", $currentModuleName) . ' ' . vtranslate("LBL_OF", $currentModuleName) . " " . $label); $options[$group_key][] = array("value" => $optionvalue . ':MIN', "text" => vtranslate("MIN", $currentModuleName) . ' ' . vtranslate("LBL_OF", $currentModuleName) . " " . $label); $options[$group_key][] = array("value" => $optionvalue . ':MAX', "text" => vtranslate("MAX", $currentModuleName) . ' ' . vtranslate("LBL_OF", $currentModuleName) . " " . $label); // $options[$group_key][] = array("value"=>$optionvalue.':COUNT'.$fieldidstr,"text"=>'COUNT '.$label); } } } return $options; }