projects
/
fa-stable.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rerun
[fa-stable.git]
/
reporting
/
includes
/
reports_classes.inc
diff --git
a/reporting/includes/reports_classes.inc
b/reporting/includes/reports_classes.inc
index f9fa8696934174b212ccde8e0f1e613f5f74532d..cffe6cb3e793f6fab0f85100fb0a51bcf7171fc0 100644
(file)
--- a/
reporting/includes/reports_classes.inc
+++ b/
reporting/includes/reports_classes.inc
@@
-9,9
+9,20
@@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
***********************************************************************/
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
***********************************************************************/
+
+// Standard report classess
+define('RC_CUSTOMER', 0);
+define('RC_SUPPLIER', 1);
+define('RC_INVENTORY', 2);
+define('RC_MANUFACTURE', 3);
+define('RC_DIMENSIONS', 4);
+define('RC_BANKING', 5);
+define('RC_GL', 6);
+
class BoxReports
{
class BoxReports
{
- var $ar_classes;
+ var $ar_classes; // report class names
+ var $ar_reports;
var $ctrl_handlers = array();
function ReportClasses()
var $ctrl_handlers = array();
function ReportClasses()
@@
-19,43
+30,47
@@
class BoxReports
$this->ar_classes = array();
}
$this->ar_classes = array();
}
- function addReportClass($class_name)
+ function addReportClass($class_name
, $class_id=null
)
{
{
- $this->ar_classes[$class_name] = array();
+ if (!$class_id)
+ $class_id = count($this->ar_classes);
+ $this->ar_classes[$class_id] = $class_name;
+
+ return $class_id;
}
}
- function addReport($class
_name
, $id, $rep_name, $params=null)
+ function addReport($class, $id, $rep_name, $params=null)
{
{
- unset($this->ar_
classes[$class_name
][$id]); // unset std report if any
- $this->ar_
classes[$class_name
][$id] = new Report($id, $rep_name, $params);
+ unset($this->ar_
reports[$class
][$id]); // unset std report if any
+ $this->ar_
reports[$class
][$id] = new Report($id, $rep_name, $params);
}
function getDisplay($class=null)
{
}
function getDisplay($class=null)
{
- global $
table_style, $comp_path, $
path_to_root, $pdf_debug, $Ajax;
+ global $path_to_root, $pdf_debug, $Ajax;
$temp = array_values($this->ar_classes);
$display_class = $class==null ? $temp[0] : $this->ar_classes[$class];
$temp = array_values($this->ar_classes);
$display_class = $class==null ? $temp[0] : $this->ar_classes[$class];
- $class_counter = 0;
- $rep_counter = 0;
$st_reports = "";
$st_params = "";
$st_classes = "<b>" . _("Report Classes:") . "</b><br>";
$st_reports = "";
$st_params = "";
$st_classes = "<b>" . _("Report Classes:") . "</b><br>";
- foreach($this->ar_classes as $
key=>$valu
e)
+ foreach($this->ar_classes as $
class_id => $nam
e)
{
{
- $style = $class_counter==$_REQUEST['Class'] ? '' : "style='display:none'";
- $acc = access_string($key);
+ $style = $class_id==$_REQUEST['Class'] ? '' : "style='display:none'";
+// $cname = access_string($key, true);
+// $style = $_REQUEST['Class']==$cname ? '' : "style='display:none'";
+ $acc = access_string($name);
$st_classes .= "<a href='"
$st_classes .= "<a href='"
- .$_SERVER['PHP_SELF']."?Class=$class_
counter
'"
+ .$_SERVER['PHP_SELF']."?Class=$class_
id
'"
." class='menu_option' id='".default_focus()."'"
." class='menu_option' id='".default_focus()."'"
- ." onclick='return showClass(
$class_counter
);'$acc[1]>$acc[0]</a> <br>";
- $st_reports .= "<table
id='TAB_" . $class_counter ."' $style cellpadding=0 cellspacing=0 width='100%'><tr><td><b>" . _("Reports For Class: ") . " $key
</b></td></tr>\n";
- foreach($
value as
$report)
+ ." onclick='return showClass(
\"$class_id\"
);'$acc[1]>$acc[0]</a> <br>";
+ $st_reports .= "<table
class='repclass' id='TAB_" . $class_id ."' $style cellpadding=0 cellspacing=0 border=0 width='100%'><tr><td><b>" . _("Reports For Class: ") . " $name
</b></td></tr>\n";
+ foreach($
this->ar_reports[$class_id] as $rep_id =>
$report)
{
$acc = access_string($report->name);
$st_reports .= "<tr><td><a class='printlink' href='"
{
$acc = access_string($report->name);
$st_reports .= "<tr><td><a class='printlink' href='"
- .$_SERVER['PHP_SELF']."?Class=$class_
counter
&rep_id=$report->id'"
+ .$_SERVER['PHP_SELF']."?Class=$class_
id
&rep_id=$report->id'"
." id='".default_focus()."'"
."$acc[1]>$acc[0]</a><tr><td>\n";
if (isset($_REQUEST['rep_id']) && $_REQUEST['rep_id']==$report->id) {
." id='".default_focus()."'"
."$acc[1]>$acc[0]</a><tr><td>\n";
if (isset($_REQUEST['rep_id']) && $_REQUEST['rep_id']==$report->id) {
@@
-66,7
+81,7
@@
class BoxReports
. "<form method='POST' action='$action' target='_blank'>\n";
$st_params .= submit('Rep'.$report->id,
_("Display: ") . access_string($report->name, true),
. "<form method='POST' action='$action' target='_blank'>\n";
$st_params .= submit('Rep'.$report->id,
_("Display: ") . access_string($report->name, true),
- false, '', $pdf_debug ? false : 'default') . hidden('REP_ID', $report->id, false).'<br><br>';
+ false, '', $pdf_debug ? false : 'default
process
') . hidden('REP_ID', $report->id, false).'<br><br>';
$st_params .= $this->getOptions($report->get_controls());
$st_params .= "\n</form></td></tr></table>\n";
set_focus('Rep'.$report->id);
$st_params .= $this->getOptions($report->get_controls());
$st_params .= "\n</form></td></tr></table>\n";
set_focus('Rep'.$report->id);
@@
-74,7
+89,6
@@
class BoxReports
}
}
$st_reports .= "</table>";
}
}
$st_reports .= "</table>";
- $class_counter++;
}
$st_params = "<div id='rep_form'>".
}
$st_params = "<div id='rep_form'>".
@@
-83,9
+97,11
@@
class BoxReports
$st = "<script language='javascript'>
function showClass(pClass) {
$st = "<script language='javascript'>
function showClass(pClass) {
- for(i=0; i<$class_counter; i++) {
- document.getElementById(\"TAB_\" + i).style.display=
- i==pClass ? \"block\" : \"none\";
+ var classes = document.getElementsBySelector('.repclass');
+ for(var i in classes) {
+ cl = classes[i];
+ cl.style.display=
+ (cl.id==('TAB_'+pClass)) ? \"block\" : \"none\";
}
document.getElementById('rep_form').innerHTML = '';
// document.getElementById('rep_form').style.display = 'none';
}
document.getElementById('rep_form').innerHTML = '';
// document.getElementById('rep_form').style.display = 'none';
@@
-148,7
+164,7
@@
class BoxReports
//
function get_ctrl($name, $type)
{
//
function get_ctrl($name, $type)
{
- global $path_to_root, $use_date_picker, $pdf_debug, $print_invoice_no;
+ global $path_to_root, $use_date_picker, $pdf_debug, $print_invoice_no
, $def_print_destination
;
$st = '';
switch ($type)
$st = '';
switch ($type)
@@
-205,7
+221,10
@@
class BoxReports
case 'DESTINATION':
$sel = array(_("PDF/Printer"), "Excel");
case 'DESTINATION':
$sel = array(_("PDF/Printer"), "Excel");
- return array_selector($name, null, $sel);
+ $def = 0;
+ if (isset($def_print_destination) && $def_print_destination == 1)
+ $def = 1;
+ return array_selector($name, $def, $sel);
case 'COMPARE':
$sel = array(_("Accumulated"), _("Period Y-1"), _("Budget"));
case 'COMPARE':
$sel = array(_("Accumulated"), _("Period Y-1"), _("Budget"));
@@
-379,7
+398,8
@@
class BoxReports
$tag_type = TAG_ACCOUNT;
else
$tag_type = TAG_DIMENSION;
$tag_type = TAG_ACCOUNT;
else
$tag_type = TAG_DIMENSION;
- return tag_list($name, 5, $tag_type, true, _("No tags"));
+ //return tag_list($name, 5, $tag_type, true, false, _("No tags"));
+ return tag_list($name, 5, $tag_type, true);
}
return '';
}
return '';
@@
-429,23
+449,25
@@
function gl_systypes_list($name, $value=null, $spec_opt=false)
)
);
}
)
);
}
-
+/*
+ Add extension/custom reports to report manager.
+*/
function add_custom_reports(&$reports)
{
function add_custom_reports(&$reports)
{
- global $installed_extensions, $path_to_root
, $comp_path
;
+ global $installed_extensions, $path_to_root;
// include reports installed inside extension modules
if (count($installed_extensions) > 0)
{
$extensions = $installed_extensions;
foreach ($extensions as $ext)
// include reports installed inside extension modules
if (count($installed_extensions) > 0)
{
$extensions = $installed_extensions;
foreach ($extensions as $ext)
- if (($ext['active'] && $ext['type'] == '
module
')) {
+ if (($ext['active'] && $ext['type'] == '
extension
')) {
$file = $path_to_root.'/'.$ext['path']."/reporting/reports_custom.php";
if (file_exists($file))
include_once($file);
}
}
$file = $path_to_root.'/'.$ext['path']."/reporting/reports_custom.php";
if (file_exists($file))
include_once($file);
}
}
- $file =
$comp_path.'/'.user_company
()."/reporting/reports_custom.php";
+ $file =
company_path
()."/reporting/reports_custom.php";
if (file_exists($file))
include_once($file);
}
if (file_exists($file))
include_once($file);
}