X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Fincludes%2Freports_classes.inc;h=db333a0d0279cf9b71020e823f8386bf8e857f0a;hb=33dfc21a26f08e9ac19048bbcf80cce2351a6cfe;hp=9de492e2df6294b619aa44688c11bef542d146fc;hpb=d9b4de9d7e9d3ba77f6ece752fd6cc988effd8f1;p=fa-stable.git
diff --git a/reporting/includes/reports_classes.inc b/reporting/includes/reports_classes.inc
index 9de492e2..db333a0d 100644
--- a/reporting/includes/reports_classes.inc
+++ b/reporting/includes/reports_classes.inc
@@ -47,43 +47,62 @@ class BoxReports
function getDisplay($class=null)
{
- global $path_to_root, $pdf_debug, $Ajax;
+ global $path_to_root, $SysPrefs, $Ajax;
+ if (find_submit('Rep') != -1) {
+ include($path_to_root.'/reporting/prn_redirect.php');
+ return;
+ }
$temp = array_values($this->ar_classes);
$display_class = $class==null ? $temp[0] : $this->ar_classes[$class];
$st_reports = "";
$st_params = "";
$st_classes = "" . _("Report Classes:") . "
";
+
+ if (isset($_GET['Class']))
+ set_focus('class'.$_GET['Class']);
+
+ $cur_class = $_REQUEST['Class'];
+
foreach($this->ar_classes as $class_id => $name)
{
- $style = $class_id==$_REQUEST['Class'] ? '' : "style='display:none'";
-// $cname = access_string($key, true);
-// $style = $_REQUEST['Class']==$cname ? '' : "style='display:none'";
+ if (!isset($this->ar_reports[$class_id]))
+ continue; // e.g. no dimensions
+
$acc = access_string($name);
$st_classes .= "$acc[0]
";
- $st_reports .= "
" . _("Reports For Class: ") . " $name |
$st_classes | "; $st .= "$st_reports | "; $st .= "$st_params | "; @@ -124,7 +122,7 @@ class BoxReports return $st; } - function getOptions($controls) + function getOptions($controls, $id = 0) { $st = ''; if ($controls == null) @@ -139,6 +137,11 @@ class BoxReports if ($ctrl) break; } if ($ctrl == '') { + if (($id == 102 || $id == 202) && $cnt == 3) // set default Show Also Allocated to Yes in aged reports 2014-09-19 Joe Hunt + $_POST['PARAM_'.$cnt] = 1; + + if (isset($_COOKIE['select'][$id][$cnt])) // saved parameters 2010-10-06 Joe Hunt + $_POST['PARAM_'.$cnt] = $_COOKIE['select'][$id][$cnt]; $ctrl = $this->get_ctrl('PARAM_'.$cnt, $type); } if ($ctrl != '') { @@ -164,7 +167,8 @@ class BoxReports // function get_ctrl($name, $type) { - global $path_to_root, $use_date_picker, $pdf_debug, $print_invoice_no; + global $path_to_root, $SysPrefs, + $type_shortcuts; $st = ''; switch ($type) @@ -180,35 +184,43 @@ class BoxReports case 'DATEENDM': case 'DATEBEGINTAX': case 'DATEENDTAX': - if ($type == 'DATEBEGIN') - $date = begin_fiscalyear(); - elseif ($type == 'DATEEND') - $date = end_fiscalyear(); - else - $date = Today(); - if ($type == 'DATEBEGINM') - $date = begin_month($date); - elseif ($type == 'DATEENDM') - $date = end_month($date); - elseif ($type == 'DATEBEGINTAX' || $type == 'DATEENDTAX') + if (!isset($_POST[$name])) { - $row = get_company_prefs(); - $edate = add_months($date, -$row['tax_last']); - $edate = end_month($edate); - if ($type == 'DATEENDTAX') - $date = $edate; + if ($type == 'DATEBEGIN') + $date = begin_fiscalyear(); + elseif ($type == 'DATEEND') + $date = end_fiscalyear(); else + $date = Today(); + if ($type == 'DATEBEGINM') + $date = begin_month($date); + elseif ($type == 'DATEENDM') + $date = end_month($date); + elseif ($type == 'DATEBEGINTAX' || $type == 'DATEENDTAX') { - $bdate = begin_month($edate); - $bdate = add_months($bdate, -$row['tax_prd'] + 1); - $date = $bdate; + $row = get_company_prefs(); + $edate = add_months($date, -$row['tax_last']); + $edate = end_month($edate); + if ($type == 'DATEENDTAX') + $date = $edate; + else + { + $bdate = begin_month($edate); + $bdate = add_months($bdate, -$row['tax_prd'] + 1); + $date = $bdate; + } } } - + else // saved parameters 2010-10-16 Joe Hunt + $date = $_POST[$name]; $st = ""; - if ($use_date_picker) + if (user_use_date_picker()) + { + $calc_image = (file_exists("$path_to_root/themes/".user_theme()."/images/cal.gif")) ? + "$path_to_root/themes/".user_theme()."/images/cal.gif" : "$path_to_root/themes/default/images/cal.gif"; $st .= "" - . " \n"; + . " \n"; + } return $st; break; @@ -216,12 +228,21 @@ class BoxReports return yesno_list($name); case 'PAYMENT_LINK': - $sel = array(_("No payment Link"), "PayPal"); - return array_selector($name, null, $sel); + return payment_services($name, null); case 'DESTINATION': $sel = array(_("PDF/Printer"), "Excel"); - return array_selector($name, null, $sel); + $def = 0; + if (user_def_print_destination() == 1) + $def = 1; + return array_selector($name, $def, $sel); + + case 'ORIENTATION': + $sel = array(_("Portrait"), _("Landscape")); + $def = 0; + if (user_def_print_orientation() == 1) + $def = 1; + return array_selector($name, $def, $sel); case 'COMPARE': $sel = array(_("Accumulated"), _("Period Y-1"), _("Budget")); @@ -242,7 +263,8 @@ class BoxReports return ""; case 'TEXTBOX': - return ""; + $value = (isset($_POST[$name]) ? $_POST[$name] : ""); + return ""; case 'ACCOUNTS': // not used return gl_account_types_list($name, null, _("No Account Group Filter"), true); @@ -278,35 +300,36 @@ class BoxReports case 'CUSTOMERS': $sql = "SELECT debtor_no, name FROM ".TB_PREF."debtors_master"; if ($type == 'CUSTOMERS_NO_FILTER') - return combo_input($name, '', $sql, 'debtor_no', 'name',array('spec_option'=>_("No Customer Filter"),'spec_id'=>ALL_NUMERIC)); -// FIX allitems numeric! -// return customer_list($name, null, _("No Customer Filter")); + return customer_list($name, null, _("No Customer Filter")); else - return combo_input($name, '', $sql, 'debtor_no', 'name', null); -// return customer_list($name); + return customer_list($name); case 'SUPPLIERS_NO_FILTER': case 'SUPPLIERS': $sql = "SELECT supplier_id, supp_name FROM ".TB_PREF."suppliers"; if ($type == 'SUPPLIERS_NO_FILTER') - return combo_input($name, '', $sql, 'supplier_id', 'supp_name',array('spec_option'=>_("No Supplier Filter"),'spec_id'=>ALL_NUMERIC)); -// FIX allitems numeric! -// return supplier_list($name, null, _("No Supplier Filter")); + return supplier_list($name, null, _("No Supplier Filter")); else - return combo_input($name, '', $sql, 'supplier_id', 'supp_name', null); -// return supplier_list($name); + return supplier_list($name); case 'INVOICE': - $IV = _("IV"); - $CN = _("CN"); - $ref = ($print_invoice_no == 1 ? "trans_no" : "reference"); + $IV = $type_shortcuts[ST_SALESINVOICE]; + $ref = ($SysPrefs->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_SALESINVOICE.", ' $IV ', ' $CN '), ".TB_PREF."debtors_master.name) as IName - FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans WHERE (type=".ST_SALESINVOICE." 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"; + ".TB_PREF."debtor_trans.type) AS TNO, concat('$IV ', ".TB_PREF."debtor_trans.$ref,' ', ".TB_PREF."debtors_master.name) as IName + FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans WHERE type=".ST_SALESINVOICE." 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 'CREDIT': + $CN = $type_shortcuts[ST_CUSTCREDIT]; + $ref = ($SysPrefs->print_invoice_no() == 1 ? "trans_no" : "reference"); + $sql = "SELECT concat(".TB_PREF."debtor_trans.trans_no, '-', + ".TB_PREF."debtor_trans.type) AS TNO, concat('$CN ', ".TB_PREF."debtor_trans.$ref,' ', ".TB_PREF."debtors_master.name) as IName + FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans WHERE 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 'DELIVERY': - $DN = _("DN"); + $DN = $type_shortcuts[ST_CUSTDELIVERY]; $sql = "SELECT concat(".TB_PREF."debtor_trans.trans_no, '-', ".TB_PREF."debtor_trans.type) AS TNO, concat(".TB_PREF."debtor_trans.trans_no, ' $DN ', ".TB_PREF."debtors_master.name) as IName @@ -316,7 +339,7 @@ class BoxReports return combo_input($name, '', $sql, 'TNO', 'IName',array('order'=>false)); case 'ORDERS': - $ref = ($print_invoice_no == 1 ? "order_no" : "reference"); + $ref = ($SysPrefs->print_invoice_no() == 1 ? "order_no" : "reference"); $sql = "SELECT ".TB_PREF."sales_orders.order_no, concat(".TB_PREF."sales_orders.$ref, '-', ".TB_PREF."debtors_master.name) as IName FROM ".TB_PREF."debtors_master, ".TB_PREF."sales_orders WHERE ".TB_PREF."debtors_master.debtor_no=".TB_PREF."sales_orders.debtor_no @@ -324,7 +347,7 @@ class BoxReports return combo_input($name, '', $sql, 'order_no', 'IName',array('order'=>false)); case 'QUOTATIONS': - $ref = ($print_invoice_no == 1 ? "order_no" : "reference"); + $ref = ($SysPrefs->print_invoice_no() == 1 ? "order_no" : "reference"); $sql = "SELECT ".TB_PREF."sales_orders.order_no, concat(".TB_PREF."sales_orders.$ref, '-', ".TB_PREF."debtors_master.name) as IName FROM ".TB_PREF."debtors_master, ".TB_PREF."sales_orders WHERE ".TB_PREF."debtors_master.debtor_no=".TB_PREF."sales_orders.debtor_no @@ -332,16 +355,16 @@ class BoxReports return combo_input($name, '', $sql, 'order_no', 'IName',array('order'=>false)); case 'PO': - $ref = ($print_invoice_no == 1 ? "order_no" : "reference"); + $ref = ($SysPrefs->print_invoice_no() == 1 ? "order_no" : "reference"); $sql = "SELECT ".TB_PREF."purch_orders.order_no, concat(".TB_PREF."purch_orders.$ref, '-', ".TB_PREF."suppliers.supp_name) as IName 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"); + $BP = $type_shortcuts[ST_BANKPAYMENT]; + $SP = $type_shortcuts[ST_SUPPAYMENT]; + $CN = $type_shortcuts[ST_SUPPCREDIT]; $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 @@ -349,18 +372,23 @@ class BoxReports 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"); + $BD = $type_shortcuts[ST_BANKDEPOSIT]; + $CP = $type_shortcuts[ST_CUSTPAYMENT]; + $ref = ($SysPrefs->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 + ".TB_PREF."debtor_trans.type) AS TNO, concat(".TB_PREF."debtor_trans.$ref, if (type=".ST_BANKDEPOSIT.", ' $BD ', ' $CP '), ".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); + case 'ITEMS_ALL': + return stock_manufactured_items_list($name, null, true); + + case 'ITEMS_P': + return stock_purchasable_items_list($name, null, true); + case 'WORKORDER': $sql = "SELECT ".TB_PREF."workorders.id, concat(".TB_PREF."workorders.id, '-', ".TB_PREF."stock_master.description) as IName @@ -395,7 +423,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 ''; @@ -459,8 +488,11 @@ function add_custom_reports(&$reports) foreach ($extensions as $ext) if (($ext['active'] && $ext['type'] == 'extension')) { $file = $path_to_root.'/'.$ext['path']."/reporting/reports_custom.php"; - if (file_exists($file)) + if (file_exists($file)) { + set_ext_domain($ext['path']); include_once($file); + set_ext_domain(); + } } } $file = company_path()."/reporting/reports_custom.php"; @@ -468,4 +500,3 @@ function add_custom_reports(&$reports) include_once($file); } -?> \ No newline at end of file