X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;ds=inline;f=reporting%2Fincludes%2Freports_classes.inc;h=dd2e069f223ce9396a1852f5e226e52284aed02b;hb=7561718ee5113232ce917f63085d272884b0929c;hp=995a39d73c7a535481c3678fd155ecb1e765958a;hpb=c09be0dad6b05131e240349a375af7a4b7bf3444;p=fa-stable.git
diff --git a/reporting/includes/reports_classes.inc b/reporting/includes/reports_classes.inc
index 995a39d7..dd2e069f 100644
--- a/reporting/includes/reports_classes.inc
+++ b/reporting/includes/reports_classes.inc
@@ -1,133 +1,182 @@
.
+***********************************************************************/
+
+// 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()
+ function ReportClasses()
{
$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)
{
- $this->ar_classes[$class_name][] = 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_style2;
+ 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];
- $class_counter = 0;
- $rep_counter = 0;
$st_reports = "";
$st_params = "";
$st_classes = "" . _("Report Classes:") . "
";
- foreach($this->ar_classes as $key=>$value)
+
+ if (isset($_GET['Class']))
+ set_focus('class'.$_GET['Class']);
+
+ $cur_class = $_REQUEST['Class'];
+
+ foreach($this->ar_classes as $class_id => $name)
{
- $style = $class_counter==0 ? '' : $style = "style='display:none'";
- $st_classes .= "$key
";
- $st_reports .= "
" . _("Reports For Class: ") . " $key |
";
- foreach($value as $report)
+ if (!isset($this->ar_reports[$class_id]))
+ continue; // e.g. no dimensions
+
+ $acc = access_string($name);
+ $st_classes .= "$acc[0]
";
+
+ $style = $class_id==$cur_class ? '' : "style='display:none'";
+ $st_reports .= "";
}
- $st = "
- ";
- $st .= "";
+ $st_params = "".
+ "$st_params
";
+
+ $st = "";
$st .= "$st_classes | ";
- $st .= "$st_reports | ";
+ $st .= "$st_reports | ";
$st .= "$st_params | ";
$st .= "
";
return $st;
}
-}
-class Report
-{
- var $id;
- var $name;
- var $ar_params;
-
- function Report($id, $name, $ar_params)
- {
- $this->id = $id;
- $this->name = $name;
- $this->ar_params = $ar_params;
- }
- function getDisplay()
+ function getOptions($controls, $id = 0)
{
- 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 .= "
";
- $dummy = "";
- if ($this->ar_params==null)
- return "";
- foreach($this->ar_params as $index=>$param)
- {
- $st .= $param->param_name . ':
';
- switch ($param->param_type)
+
+ //
+ // Register additional control handler
+ // $handle - name of global function f($name, $type) returning html code for control
+ function register_controls($handler) {
+ $this->ctrl_handlers[] = $handler;
+ }
+ //
+ // Returns html code for input control $name of type $type
+ //
+ function get_ctrl($name, $type)
+ {
+ global $path_to_root, $SysPrefs,
+ $type_shortcuts;
+
+ $st = '';
+ switch ($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"));
- break;
+ $sql = "SELECT curr_abrev, concat(curr_abrev,' - ', currency) AS name FROM ".TB_PREF."currencies";
+ return combo_input($name, '', $sql, 'curr_abrev', 'name',array('spec_option'=>_("No Currency Filter"),'spec_id'=>ALL_TEXT,'order'=>false));
+
case 'DATE':
case 'DATEBEGIN':
case 'DATEEND':
@@ -135,289 +184,319 @@ class Report
case 'DATEENDM':
case 'DATEBEGINTAX':
case 'DATEENDTAX':
- if ($param->param_type == 'DATEBEGIN')
- $date = begin_fiscalyear();
- elseif ($param->param_type == 'DATEEND')
- $date = end_fiscalyear();
- else
- $date = Today();
- if ($param->param_type == 'DATEBEGINM')
- $date = begin_month($date);
- elseif ($param->param_type == 'DATEENDM')
- $date = end_month($date);
- elseif ($param->param_type == 'DATEBEGINTAX' || $param->param_type == 'DATEENDTAX')
+ if (!isset($_POST[$name]))
{
- $row = get_company_prefs();
- $edate = add_months($date, -$row['tax_last']);
- $edate = end_month($edate);
- if ($param->param_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 = add_months($edate, -$row['tax_prd'] + 1);
- $date = begin_month($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;
+ }
}
- }
- $name = "RP_" . $this->id . "_$index";
- //$st .= "";
- $st .= "";
- if ($use_date_picker)
+ }
+ else // saved parameters 2010-10-16 Joe Hunt
+ $date = $_POST[$name];
+ $st = "";
+ 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";
-
- break;
- case 'YES_NO':
- $sel = array(_('No'), _("Yes"));
- $st .= dup_simple_name_list("RP_" . $this->id . "_$index", $sel);
- break;
- case 'PAYMENT_LINK':
- $sel = array(_("No Payment Link"), "PayPal");
- $st .= dup_simple_name_list("RP_" . $this->id . "_$index", $sel);
+ . "
\n";
+ }
+ return $st;
break;
+
+ case 'YES_NO':
+ return yesno_list($name);
+
+ case 'PAYMENT_LINK':
+ return payment_services($name, null);
+
+ case 'DESTINATION':
+ $sel = array(_("PDF/Printer"), "Excel");
+ $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"));
- $st .= dup_simple_name_list("RP_" . $this->id . "_$index", $sel);
- break;
+ return array_selector($name, null, $sel);
+
case 'GRAPHIC':
- $sel = array(_("No Graphics"), _("Vertical bars"), _("Horizontal bars"), _("Dots"), _("Lines"), _("Pie"), _("Donut"));
- $st .= dup_simple_name_list("RP_" . $this->id . "_$index", $sel);
- break;
+ $sel = array(_("No Graphics"), _("Vertical bars"), _("Horizontal bars"),
+ _("Dots"), _("Lines"), _("Pie"), _("Donut"));
+ return array_selector($name, null, $sel);
+
case 'SYS_TYPES':
- $st .= dup_systypes_list("RP_" . $this->id . "_$index", $dummy, true, _("No Type Filter"), true);
- break;
+ return gl_systypes_list($name, null, _("No Type Filter"));
+
+ case 'SYS_TYPES_ALL':
+ return systypes_list($name, null, _("No Type Filter"));
+
case 'TEXT':
- $st .= "";
- break;
+ return "";
+
case 'TEXTBOX':
- $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);
- break;
+ $value = (isset($_POST[$name]) ? $_POST[$name] : "");
+ return "";
+
+ case 'ACCOUNTS': // not used
+ return gl_account_types_list($name, null, _("No Account Group Filter"), true);
+
+ case 'ACCOUNTS_NO_FILTER': // not used
+ return gl_account_types_list($name);
+
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);
- break;
+ return gl_all_accounts_list($name);
+
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);
- break;
+ return bank_accounts_list($name);
+
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);
- break;
+ return dimensions_list($name, null, false, ' ', false, true, 0);
+
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);
- break;
+ return dimensions_list($name, null, true, _("No Dimension Filter"), false, true, 0);
+
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);
- break;
+ return dimensions_list($name, null, false, ' ', false, true, 1);
+
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);
- break;
+ return dimensions_list($name, null, true, _("No Dimension Filter"), false, true, 1);
+
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);
- break;
+ return dimensions_list($name, null, false, ' ', false, true, 2);
+
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);
- break;
+ return dimensions_list($name, null, true, _("No Dimension Filter"), false, true, 2);
+
case 'CUSTOMERS_NO_FILTER':
case 'CUSTOMERS':
- $sql = "SELECT debtor_no, name FROM ".TB_PREF."debtors_master ORDER BY name";
- 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);
- break;
+ $sql = "SELECT debtor_no, name FROM ".TB_PREF."debtors_master";
+ if ($type == 'CUSTOMERS_NO_FILTER')
+ return customer_list($name, null, _("No Customer Filter"));
+ else
+ return customer_list($name);
+
case 'SUPPLIERS_NO_FILTER':
case 'SUPPLIERS':
- $sql = "SELECT supplier_id, supp_name FROM ".TB_PREF."suppliers ORDER BY supp_name";
- 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);
- break;
+ $sql = "SELECT supplier_id, supp_name FROM ".TB_PREF."suppliers";
+ if ($type == 'SUPPLIERS_NO_FILTER')
+ return supplier_list($name, null, _("No Supplier Filter"));
+ else
+ return supplier_list($name);
+
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);
- break;
+ $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('$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");
- $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=".
+ $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
+ 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);
- break;
+ return combo_input($name, '', $sql, 'TNO', 'IName',array('order'=>false));
+
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);
- break;
+ $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
+ AND ".TB_PREF."sales_orders.trans_type=".ST_SALESORDER." ORDER BY ".TB_PREF."sales_orders.order_no DESC";
+ return combo_input($name, '', $sql, 'order_no', 'IName',array('order'=>false));
+
+ case 'QUOTATIONS':
+ $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
+ AND ".TB_PREF."sales_orders.trans_type=".ST_SALESQUOTE." ORDER BY ".TB_PREF."sales_orders.order_no DESC";
+ return combo_input($name, '', $sql, 'order_no', 'IName',array('order'=>false));
+
case 'PO':
- $sql = "SELECT ".TB_PREF."purch_orders.order_no, concat(".TB_PREF."purch_orders.order_no, '-',
- ".TB_PREF."suppliers.supp_name) as IName
+ $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";
- $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy);
- break;
+ return combo_input($name, '', $sql, 'order_no', 'IName',array('order'=>false));
+
+ case 'REMITTANCE':
+ $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
+ 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 = $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 ', ' $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':
- $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);
- break;
+ 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
+ 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";
+ return combo_input($name, '', $sql, 'id', 'IName',array('order'=>false));
+
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);
- break;
+ return locations_list($name, null, _("No Location Filter"));
+
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);
- break;
+ return stock_categories_list($name, null, _("No Category Filter"));
+
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);
- break;
+ return sales_types_list($name);
+
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);
- break;
+ return sales_areas_list($name);
+
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);
- break;
+ return sales_persons_list($name, null, _("No Sales Folk Filter"));
+
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);
- 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);
- break;
+ return fiscalyears_list($name);
- }
- $st .= "
";
- }
- return $st;
- }
-}
+ case 'USERS':
+ $sql = "SELECT id, user_id FROM ".TB_PREF."users";
+ return combo_input($name, '', $sql, 'id', 'user_id',array('spec_option'=>_("No Users Filter"),'spec_id'=>ALL_NUMERIC));
-class ReportParam
-{
- var $param_name;
- var $param_type;
+ case 'ACCOUNTTAGS':
+ case 'DIMENSIONTAGS':
+ if ($type == 'ACCOUNTTAGS')
+ $tag_type = TAG_ACCOUNT;
+ else
+ $tag_type = TAG_DIMENSION;
+ //return tag_list($name, 5, $tag_type, true, false, _("No tags"));
+ return tag_list($name, 5, $tag_type, true);
- function ReportParam($param_name, $param_type)
- {
- $this->param_name = $param_name;
- $this->param_type = $param_type;
+ }
+ return '';
}
}
-function dup_simple_codeandname_list($sql, $name, &$selected_id,
- $all_option=false, $all_option_name=null, $all_option_numeric=false,
- $submit_on_change=false)
+class Report
{
- if ($submit_on_change == true)
- $st = "