X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Fincludes%2Freports_classes.inc;h=5ff1c72a0ad8dc6adb9186581e542437b96ac5ae;hb=a73365128653d7c172874ec53a6da3b4fac69123;hp=995a39d73c7a535481c3678fd155ecb1e765958a;hpb=4e8059dc88b25b27dfbe08e99fc882a214802083;p=fa-stable.git
diff --git a/reporting/includes/reports_classes.inc b/reporting/includes/reports_classes.inc
index 995a39d7..5ff1c72a 100644
--- a/reporting/includes/reports_classes.inc
+++ b/reporting/includes/reports_classes.inc
@@ -1,26 +1,37 @@
.
+***********************************************************************/
+class BoxReports
{
var $ar_classes;
- function ReportClasses()
+ function ReportClasses()
{
$this->ar_classes = array();
}
- function addReportClass($class_name)
+ function addReportClass($class_name)
{
$this->ar_classes[$class_name] = array();
}
- function addReport($class_name, $id, $rep_name, $params=null)
+ function addReport($class_name, $id, $rep_name, $params=null)
{
$this->ar_classes[$class_name][] = new Report($id,$rep_name,$params);
}
- function getDisplay($class=null)
+ function getDisplay($class=null)
{
- global $table_style2;
+ global $table_style2, $comp_path, $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;
@@ -28,36 +39,61 @@ class BoxReports
$st_reports = "";
$st_params = "";
$st_classes = "" . _("Report Classes:") . "
";
- foreach($this->ar_classes as $key=>$value)
+ foreach($this->ar_classes as $key=>$value)
{
- $style = $class_counter==0 ? '' : $style = "style='display:none'";
- $st_classes .= "$key
";
- $st_reports .= "
" . _("Reports For Class: ") . " $key |
";
- foreach($value as $report)
+ $style = $class_counter==$_REQUEST['Class'] ? '' : "style='display:none'";
+ $acc = access_string($key);
+ $st_classes .= "
";
+ $st_reports .= "" . _("Reports For Class: ") . " $key |
\n";
+ foreach($value as $report)
{
- $st_reports .= "" . $report->name . " |
";
- $st_params .= "";
- $st_params .= "" . $report->getDisplay() . " |
";
+ $acc = access_string($report->name);
+ $st_reports .= "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";
+ set_focus('Rep'.$report->id);
+ $Ajax->addUpdate(true, 'rep_form', $st_params);
+ }
}
$st_reports .= " |
";
+ $class_counter++;
}
+ $st_params = "".
+ "$st_params
";
+
+
$st = "
";
@@ -71,62 +107,35 @@ class BoxReports
}
}
-class Report
+class Report
{
var $id;
var $name;
var $ar_params;
- function Report($id, $name, $ar_params)
+ function Report($id, $name, $ar_params)
{
$this->id = $id;
$this->name = $name;
$this->ar_params = $ar_params;
}
- function getDisplay()
+
+ function getDisplay()
{
- global $comp_path, $path_to_root, $use_date_picker;
-
- $rep_file = $comp_path.'/'.user_company().
- "/reporting/rep".$this->id.".php";
- if (!file_exists($rep_file))
- $rep_file = $path_to_root ."/reporting/rep".$this->id.".php";
-
- $st = "
-
- ";
- $st .= "
";
+ $st = '';
$dummy = "";
- if ($this->ar_params==null)
+ if ($this->ar_params==null)
return "";
- foreach($this->ar_params as $index=>$param)
+ foreach($this->ar_params as $index=>$param)
{
$st .= $param->param_name . ':
';
- switch ($param->param_type)
+ switch ($param->param_type)
{
case 'CURRENCY':
- $sql = "SELECT curr_abrev, concat(curr_abrev,' - ', currency) FROM ".TB_PREF."currencies";
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy, true, _("No Currency Filter"));
+ $sql = "SELECT curr_abrev, concat(curr_abrev,' - ', currency) AS name FROM ".TB_PREF."currencies";
+ $st .= combo_input("PARAM_$index", '', $sql, 'curr_abrev', 'name',array('spec_option'=>_("No Currency Filter"),'spec_id'=>ALL_TEXT,'order'=>false));
break;
case 'DATE':
case 'DATEBEGIN':
@@ -154,157 +163,196 @@ class Report
$date = $edate;
else
{
- $bdate = add_months($edate, -$row['tax_prd'] + 1);
- $date = begin_month($bdate);
+ $bdate = begin_month($edate);
+ $bdate = add_months($bdate, -$row['tax_prd'] + 1);
+ $date = $bdate;
}
- }
- $name = "RP_" . $this->id . "_$index";
- //$st .= "";
+ }
+ $name = "PARAM_$index";
+
$st .= "";
if ($use_date_picker)
$st .= ""
. "
\n";
-
+
break;
- case 'YES_NO':
+ case 'YES_NO':
$sel = array(_('No'), _("Yes"));
- $st .= dup_simple_name_list("RP_" . $this->id . "_$index", $sel);
+ $st .= dup_simple_name_list("PARAM_$index", $sel);
break;
- case 'PAYMENT_LINK':
+ case 'PAYMENT_LINK':
$sel = array(_("No Payment Link"), "PayPal");
- $st .= dup_simple_name_list("RP_" . $this->id . "_$index", $sel);
+ $st .= dup_simple_name_list("PARAM_$index", $sel);
+ break;
+ case 'DESTINATION':
+ $sel = array(_("PDF/Printer"), "Excel");
+ $st .= dup_simple_name_list("PARAM_$index", $sel);
break;
case 'COMPARE':
$sel = array(_("Accumulated"), _("Period Y-1"), _("Budget"));
- $st .= dup_simple_name_list("RP_" . $this->id . "_$index", $sel);
+ $st .= dup_simple_name_list("PARAM_$index", $sel);
break;
case 'GRAPHIC':
$sel = array(_("No Graphics"), _("Vertical bars"), _("Horizontal bars"), _("Dots"), _("Lines"), _("Pie"), _("Donut"));
- $st .= dup_simple_name_list("RP_" . $this->id . "_$index", $sel);
+ $st .= dup_simple_name_list("PARAM_$index", $sel);
break;
case 'SYS_TYPES':
- $st .= dup_systypes_list("RP_" . $this->id . "_$index", $dummy, true, _("No Type Filter"), true);
- break;
+ case 'SYS_TYPES_ALL':
+ $st .= dup_systypes_list("PARAM_$index", $dummy, true, _("No Type Filter"), ($param->param_type=='SYS_TYPES_ALL'));
+ break;
case 'TEXT':
- $st .= "";
+ $st .= "";
break;
case 'TEXTBOX':
- $st .= "";
+ $st .= "";
break;
case 'ACCOUNTS':
- $sql = "SELECT id, name FROM ".TB_PREF."chart_types ORDER BY name";
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy, true, _("No Account Group Filter"), true);
+ $sql = "SELECT id, name FROM ".TB_PREF."chart_types";
+ $st .= combo_input("PARAM_$index", '', $sql, 'id', 'name',array('spec_option'=>_("No Account Group Filter"),'spec_id'=>ALL_NUMERIC));
+ break;
+ case 'ACCOUNTS_NO_FILTER':
+ $sql = "SELECT id, name FROM ".TB_PREF."chart_types";
+ $st .= combo_input("PARAM_$index", '', $sql, 'id', 'name', null);
break;
case 'GL_ACCOUNTS':
- $sql = "SELECT account_code, concat(account_code, ' - ', account_name) as account_name FROM ".TB_PREF."chart_master ORDER BY account_code";
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy);
+ $sql = "SELECT chart.account_code, chart.account_name, type.name, chart.inactive, type.id
+ FROM ".TB_PREF."chart_master chart,".TB_PREF."chart_types type WHERE chart.account_type=type.id";
+ $st .= combo_input("PARAM_$index", '', $sql, 'chart.account_code', 'chart.account_name',
+ array('format' => '_format_account','order' => array('type.id','account_code'),'async' => false,'category' => 2));
break;
case 'BANK_ACCOUNTS':
- $sql = "SELECT ".TB_PREF."bank_accounts.account_code, concat(bank_account_name, if (bank_curr_code=curr_default,'', concat(' - ', bank_curr_code))) FROM ".TB_PREF."bank_accounts, ".TB_PREF."chart_master, ".TB_PREF."company
- WHERE ".TB_PREF."bank_accounts.account_code=".TB_PREF."chart_master.account_code";
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy);
+ $sql = "SELECT ".TB_PREF."bank_accounts.id, concat(bank_account_name, if (bank_curr_code=curr_default,'', concat(' - ', bank_curr_code))) AS name FROM ".TB_PREF."bank_accounts, ".TB_PREF."company";
+ $st .= combo_input("PARAM_$index", '', $sql, 'id', 'name',array('order'=>array('id')));
break;
case 'DIMENSION':
- $sql = "SELECT reference, concat(reference, ' - ', name) AS DimName FROM ".TB_PREF."dimensions ORDER BY reference";
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy);
+ $sql = "SELECT id, concat(reference, ' - ', name) AS DimName FROM ".TB_PREF."dimensions";
+ $st .= combo_input("PARAM_$index", '', $sql, 'id', 'DimName',array('order'=>array('reference')));
break;
case 'DIMENSIONS':
- $sql = "SELECT reference, concat(reference, ' - ', name) as DimName FROM ".TB_PREF."dimensions ORDER BY reference";
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy, true, _("No Dimension Filter"), true);
+ $sql = "SELECT id, concat(reference, ' - ', name) as DimName FROM ".TB_PREF."dimensions";
+ $st .= combo_input("PARAM_$index", '', $sql, 'id', 'DimName',array('spec_option'=>_("No Dimension Filter"),'spec_id'=>ALL_NUMERIC,'order'=>array('reference')));
break;
case 'DIMENSION1':
- $sql = "SELECT reference, concat(reference, ' - ', name) AS DimName FROM ".TB_PREF."dimensions WHERE type_=1 ORDER BY reference";
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy);
+ $sql = "SELECT id, concat(reference, ' - ', name) AS DimName FROM ".TB_PREF."dimensions WHERE type_=1";
+ $st .= combo_input("PARAM_$index", '', $sql, 'id', 'DimName',array('order'=>array('reference')));
break;
case 'DIMENSIONS1':
- $sql = "SELECT reference, concat(reference, ' - ', name) as DimName FROM ".TB_PREF."dimensions WHERE type_=1 ORDER BY reference";
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy, true, _("No Dimension Filter"), true);
+ $sql = "SELECT id, concat(reference, ' - ', name) as DimName FROM ".TB_PREF."dimensions WHERE type_=1";
+ $st .= combo_input("PARAM_$index", '', $sql, 'id', 'DimName',array('spec_option'=>_("No Dimension Filter"),'spec_id'=>ALL_NUMERIC,'order'=>array('reference')));
break;
case 'DIMENSION2':
- $sql = "SELECT reference, concat(reference, ' - ', name) AS DimName FROM ".TB_PREF."dimensions WHERE type_=2 ORDER BY reference";
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy);
+ $sql = "SELECT id, concat(reference, ' - ', name) AS DimName FROM ".TB_PREF."dimensions WHERE type_=2";
+ $st .= combo_input("PARAM_$index", '', $sql, 'id', 'DimName',array('order'=>array('reference')));
break;
case 'DIMENSIONS2':
- $sql = "SELECT reference, concat(reference, ' - ', name) as DimName FROM ".TB_PREF."dimensions WHERE type_=2 ORDER BY reference";
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy, true, _("No Dimension Filter"), true);
+ $sql = "SELECT id, concat(reference, ' - ', name) as DimName FROM ".TB_PREF."dimensions WHERE type_=2";
+ $st .= combo_input("PARAM_$index", '', $sql, 'id', 'DimName',array('spec_option'=>_("No Dimension Filter"),'spec_id'=>ALL_NUMERIC,'order'=>array('reference')));
break;
case 'CUSTOMERS_NO_FILTER':
case 'CUSTOMERS':
- $sql = "SELECT debtor_no, name FROM ".TB_PREF."debtors_master ORDER BY name";
+ $sql = "SELECT debtor_no, name FROM ".TB_PREF."debtors_master";
if ($param->param_type == 'CUSTOMERS_NO_FILTER')
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy, true, _("No Customer Filter"), true);
- else
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy);
+ $st .= combo_input("PARAM_$index", '', $sql, 'debtor_no', 'name',array('spec_option'=>_("No Customer Filter"),'spec_id'=>ALL_NUMERIC));
+ else
+ $st .= combo_input("PARAM_$index", '', $sql, 'debtor_no', 'name', null);
break;
case 'SUPPLIERS_NO_FILTER':
case 'SUPPLIERS':
- $sql = "SELECT supplier_id, supp_name FROM ".TB_PREF."suppliers ORDER BY supp_name";
+ $sql = "SELECT supplier_id, supp_name FROM ".TB_PREF."suppliers";
if ($param->param_type == 'SUPPLIERS_NO_FILTER')
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy, true, _("No Supplier Filter"), true);
- else
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy);
+ $st .= combo_input("PARAM_$index", '', $sql, 'supplier_id', 'supp_name',array('spec_option'=>_("No Supplier Filter"),'spec_id'=>ALL_NUMERIC));
+ else
+ $st .= combo_input("PARAM_$index", '', $sql, 'supplier_id', 'supp_name', null);
break;
case 'INVOICE':
$IV = _("IV");
$CN = _("CN");
- $sql = "SELECT concat(".TB_PREF."debtor_trans.trans_no, '-',
- ".TB_PREF."debtor_trans.type) AS TNO, concat(".TB_PREF."debtor_trans.trans_no, if (type=10, ' $IV ', ' $CN '), ".TB_PREF."debtors_master.name) as IName
- FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans WHERE (type=10 OR type=11) AND ".TB_PREF."debtors_master.debtor_no=".TB_PREF."debtor_trans.debtor_no ORDER BY ".TB_PREF."debtor_trans.trans_no DESC";
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy);
+ if ($print_invoice_no == 1)
+ $sql = "SELECT concat(".TB_PREF."debtor_trans.trans_no, '-',
+ ".TB_PREF."debtor_trans.type) AS TNO, concat(".TB_PREF."debtor_trans.trans_no, 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";
+ else
+ $sql = "SELECT concat(".TB_PREF."debtor_trans.trans_no, '-',
+ ".TB_PREF."debtor_trans.type) AS TNO, concat(".TB_PREF."debtor_trans.reference, 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";
+ $st .= combo_input("PARAM_$index", '', $sql, 'TNO', 'IName',array('order'=>false));
break;
case 'DELIVERY':
$DN = _("DN");
- $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
- FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans
- WHERE type=13 AND ".TB_PREF."debtors_master.debtor_no=".
+ $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
+ FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans
+ WHERE type=".ST_CUSTDELIVERY." AND ".TB_PREF."debtors_master.debtor_no=".
TB_PREF."debtor_trans.debtor_no ORDER BY ".TB_PREF."debtor_trans.trans_no DESC";
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy);
+ $st .= combo_input("PARAM_$index", '', $sql, 'TNO', 'IName',array('order'=>false));
break;
case 'ORDERS':
- $sql = "SELECT ".TB_PREF."sales_orders.order_no, concat(".TB_PREF."sales_orders.order_no, '-',
- ".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 ORDER BY ".TB_PREF."sales_orders.order_no DESC";
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy);
+ $sql = "SELECT ".TB_PREF."sales_orders.order_no, concat(".TB_PREF."sales_orders.order_no, '-',
+ ".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
+ AND ".TB_PREF."sales_orders.trans_type=".ST_SALESORDER." ORDER BY ".TB_PREF."sales_orders.order_no DESC";
+ $st .= combo_input("PARAM_$index", '', $sql, 'order_no', 'IName',array('order'=>false));
+ break;
+ case 'QUOTATIONS':
+ $sql = "SELECT ".TB_PREF."sales_orders.order_no, concat(".TB_PREF."sales_orders.order_no, '-',
+ ".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
+ AND ".TB_PREF."sales_orders.trans_type=".ST_SALESQUOTE." ORDER BY ".TB_PREF."sales_orders.order_no DESC";
+ $st .= combo_input("PARAM_$index", '', $sql, 'order_no', 'IName',array('order'=>false));
break;
case 'PO':
- $sql = "SELECT ".TB_PREF."purch_orders.order_no, concat(".TB_PREF."purch_orders.order_no, '-',
- ".TB_PREF."suppliers.supp_name) as IName
+ $sql = "SELECT ".TB_PREF."purch_orders.order_no, concat(".TB_PREF."purch_orders.order_no, '-',
+ ".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";
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy);
+ $st .= combo_input("PARAM_$index", '', $sql, 'order_no', 'IName',array('order'=>false));
break;
case 'ITEMS':
- $sql = "SELECT stock_id, concat(stock_id, '-', description) as name FROM ".TB_PREF."stock_master WHERE (mb_flag='A' OR mb_flag='M') ORDER BY stock_id";
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy);
+ $sql = "SELECT stock_id, concat(stock_id, '-', description) as name FROM ".TB_PREF."stock_master WHERE (mb_flag='A' OR mb_flag='M')";
+ $st .= combo_input("PARAM_$index", '', $sql, 'stock_id', 'name',array('order'=>array('stock_id')));
+ break;
+ case 'WORKORDER':
+ $sql = "SELECT ".TB_PREF."workorders.id, concat(".TB_PREF."workorders.id, '-',
+ ".TB_PREF."stock_master.description) as IName
+ FROM ".TB_PREF."stock_master, ".TB_PREF."workorders WHERE ".TB_PREF."stock_master.stock_id=".TB_PREF."workorders.stock_id ORDER BY ".TB_PREF."workorders.id DESC";
+ $st .= combo_input("PARAM_$index", '', $sql, 'id', 'IName',array('order'=>false));
break;
case 'LOCATIONS':
- $sql = "SELECT loc_code, location_name FROM ".TB_PREF."locations ORDER BY location_name";
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy, true, _("No Location Filter"), false);
+ $sql = "SELECT loc_code, location_name FROM ".TB_PREF."locations";
+ $st .= combo_input("PARAM_$index", '', $sql, 'loc_code', 'location_name',array('spec_option'=>_("No Location Filter"),'spec_id'=>ALL_TEXT));
break;
case 'CATEGORIES':
- $sql = "SELECT category_id, description FROM ".TB_PREF."stock_category ORDER BY description";
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy, true, _("No Category Filter"), true);
+ $sql = "SELECT category_id, description FROM ".TB_PREF."stock_category";
+ $st .= combo_input("PARAM_$index", '', $sql, 'category_id', 'description',array('spec_option'=>_("No Category Filter"),'spec_id'=>ALL_NUMERIC));
break;
case 'SALESTYPES':
- $sql = "SELECT id, sales_type FROM ".TB_PREF."sales_types ORDER BY sales_type";
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy);
+ $sql = "SELECT id, sales_type FROM ".TB_PREF."sales_types";
+ $st .= combo_input("PARAM_$index", '', $sql, 'id', 'sales_type', null);
break;
case 'AREAS':
- $sql = "SELECT area_code, description FROM ".TB_PREF."areas ORDER BY description";
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy, true, _("No Area Filter"), true);
+ $sql = "SELECT area_code, description FROM ".TB_PREF."areas";
+ $st .= combo_input("PARAM_$index", '', $sql, 'area_code', 'description',array('spec_option'=>_("No Area Filter"),'spec_id'=>ALL_NUMERIC));
break;
case 'SALESMEN':
- $sql = "SELECT salesman_code, salesman_name FROM ".TB_PREF."salesman ORDER BY salesman_name";
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy, true, _("No Sales Folk Filter"), true);
+ $sql = "SELECT salesman_code, salesman_name FROM ".TB_PREF."salesman";
+ $st .= combo_input("PARAM_$index", '', $sql, 'salesman_code', 'salesman_name',array('spec_option'=>_("No Sales Folk Filter"),'spec_id'=>ALL_NUMERIC));
break;
case 'TRANS_YEARS':
- $sql = "SELECT DISTINCT YEAR(tran_date), YEAR(tran_date) FROM ".TB_PREF."gl_trans";
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy);
+ $sql = "SELECT DISTINCT YEAR(tran_date) AS tran_date, YEAR(tran_date) AS tran_date2 FROM ".TB_PREF."gl_trans";
+ $st .= combo_input("PARAM_$index", '', $sql, 'tran_date', 'tran_date2',array('order'=>array('tran_date')));
break;
- case 'ACCOUNTS_NO_FILTER':
- $sql = "SELECT id, name FROM ".TB_PREF."chart_types ORDER BY name";
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy);
+ case 'USERS':
+ $sql = "SELECT id, user_id FROM ".TB_PREF."users";
+ $st .= combo_input("PARAM_$index", '', $sql, 'id', 'user_id',array('spec_option'=>_("No Users Filter"),'spec_id'=>ALL_NUMERIC));
+ break;
+ case 'ACCOUNTTAGS':
+ case 'DIMENSIONTAGS':
+ if ($param->param_type == 'ACCOUNTTAGS')
+ $type = TAG_ACCOUNT;
+ else
+ $type = TAG_DIMENSION;
+ $sql = "SELECT id, name FROM ".TB_PREF."tags WHERE type=$type";
+ $st .= combo_input("PARAM_$index", '', $sql, 'id', 'name',array('spec_option'=>_("No tags"),'spec_id' => ALL_NUMERIC,'multi'=>true,'height'=>5));
break;
}
@@ -314,74 +362,18 @@ class Report
}
}
-class ReportParam
+class ReportParam
{
var $param_name;
var $param_type;
- function ReportParam($param_name, $param_type)
+ function ReportParam($param_name, $param_type)
{
$this->param_name = $param_name;
$this->param_type = $param_type;
}
}
-function dup_simple_codeandname_list($sql, $name, &$selected_id,
- $all_option=false, $all_option_name=null, $all_option_numeric=false,
- $submit_on_change=false)
-{
- if ($submit_on_change == true)
- $st = "