X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Fincludes%2Freports_classes.inc;h=cffe6cb3e793f6fab0f85100fb0a51bcf7171fc0;hb=c5dc92bf60148463852a81f74284117ce3fd1e92;hp=e7df6a73c6b59d1443bf00a85ba539d0f18bc6e5;hpb=72e83370cc900ce93330226b353b4f0c7fd4c2fd;p=fa-stable.git diff --git a/reporting/includes/reports_classes.inc b/reporting/includes/reports_classes.inc index e7df6a73..cffe6cb3 100644 --- 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 . ***********************************************************************/ + +// 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 { - var $ar_classes; + var $ar_classes; // report class names + var $ar_reports; var $ctrl_handlers = array(); function ReportClasses() @@ -19,55 +30,58 @@ class BoxReports $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) { - global $table_style2, $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]; - $class_counter = 0; - $rep_counter = 0; $st_reports = ""; $st_params = ""; $st_classes = "" . _("Report Classes:") . "
"; - foreach($this->ar_classes as $key=>$value) + foreach($this->ar_classes as $class_id => $name) { - $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 .= "$acc[0]
"; - $st_reports .= "\n"; - foreach($value as $report) + ." onclick='return showClass(\"$class_id\");'$acc[1]>$acc[0]
"; + $st_reports .= "
" . _("Reports For Class: ") . " $key
\n"; + foreach($this->ar_reports[$class_id] as $rep_id => $report) { $acc = access_string($report->name); $st_reports .= "
" . _("Reports For Class: ") . " $name
id'" + .$_SERVER['PHP_SELF']."?Class=$class_id&rep_id=$report->id'" ." id='".default_focus()."'" ."$acc[1]>$acc[0]
\n"; if (isset($_REQUEST['rep_id']) && $_REQUEST['rep_id']==$report->id) { $action = $path_to_root.'/reporting/prn_redirect.php'; - $st_params = "
\n" + $st_params = "
\n" . "
\n"; - $st_params .= hidden('REP_ID', $report->id, false); $st_params .= submit('Rep'.$report->id, _("Display: ") . access_string($report->name, true), - false, '', $pdf_debug ? false : 'default') . '

'; + false, '', $pdf_debug ? false : 'default process') . hidden('REP_ID', $report->id, false).'

'; $st_params .= $this->getOptions($report->get_controls()); $st_params .= "\n
\n"; set_focus('Rep'.$report->id); @@ -75,7 +89,6 @@ class BoxReports } } $st_reports .= "
"; - $class_counter++; } $st_params = "
". @@ -84,9 +97,11 @@ class BoxReports $st = " "; - $st .= ""; + $st .= "
"; $st .= ""; - $st .= ""; + $st .= ""; $st .= ""; $st .= "
$st_classes$st_reports$st_reports$st_params

"; @@ -149,7 +164,7 @@ class BoxReports // 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) @@ -206,7 +221,10 @@ class BoxReports 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")); @@ -230,8 +248,6 @@ class BoxReports return ""; case 'ACCOUNTS': // not used -// $sql = "SELECT id, name FROM ".TB_PREF."chart_types"; -// return combo_input($name, '', $sql, 'id', 'name',array('spec_option'=>_("No Account Group Filter"),'spec_id'=>ALL_NUMERIC)); return gl_account_types_list($name, null, _("No Account Group Filter"), true); case 'ACCOUNTS_NO_FILTER': // not used @@ -325,6 +341,26 @@ class BoxReports FROM ".TB_PREF."suppliers, ".TB_PREF."purch_orders WHERE ".TB_PREF."suppliers.supplier_id=".TB_PREF."purch_orders.supplier_id ORDER BY ".TB_PREF."purch_orders.order_no DESC"; return combo_input($name, '', $sql, 'order_no', 'IName',array('order'=>false)); + case 'REMITTANCE': + $BP = _("BP"); + $SP = _("SP"); + $CN = _("CN"); + $ref = ($print_invoice_no == 1 ? "trans_no" : "reference"); + $sql = "SELECT concat(".TB_PREF."supp_trans.trans_no, '-', + ".TB_PREF."supp_trans.type) AS TNO, concat(".TB_PREF."supp_trans.$ref, if (type=".ST_BANKPAYMENT.", ' $BP ', if (type=".ST_SUPPAYMENT.", ' $SP ', ' $CN ')), ".TB_PREF."suppliers.supp_name) as IName + FROM ".TB_PREF."suppliers, ".TB_PREF."supp_trans WHERE (type=".ST_BANKPAYMENT." OR type=".ST_SUPPAYMENT." OR type=".ST_SUPPCREDIT.") AND ".TB_PREF."suppliers.supplier_id=".TB_PREF."supp_trans.supplier_id ORDER BY ".TB_PREF."supp_trans.trans_no DESC"; + return combo_input($name, '', $sql, 'TNO', 'IName',array('order'=>false)); + + case 'RECEIPT': + $BD = _("BD"); + $CP = _("CP"); + $CN = _("CN"); + $ref = ($print_invoice_no == 1 ? "trans_no" : "reference"); + $sql = "SELECT concat(".TB_PREF."debtor_trans.trans_no, '-', + ".TB_PREF."debtor_trans.type) AS TNO, concat(".TB_PREF."debtor_trans.$ref, if (type=".ST_BANKDEPOSIT.", ' $BD ', if (type=".ST_CUSTPAYMENT.", ' $CP ', ' $CN ')), ".TB_PREF."debtors_master.name) as IName + FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans WHERE (type=".ST_BANKDEPOSIT." OR type=".ST_CUSTPAYMENT." OR type=".ST_CUSTCREDIT.") AND ".TB_PREF."debtors_master.debtor_no=".TB_PREF."debtor_trans.debtor_no ORDER BY ".TB_PREF."debtor_trans.trans_no DESC"; + return combo_input($name, '', $sql, 'TNO', 'IName',array('order'=>false)); + case 'ITEMS': return stock_manufactured_items_list($name); @@ -362,7 +398,8 @@ class BoxReports $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 ''; @@ -412,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) { - 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) - 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 = $comp_path.'/'.user_company()."/reporting/reports_custom.php"; + $file = company_path()."/reporting/reports_custom.php"; if (file_exists($file)) include_once($file); }