X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=reporting%2Fincludes%2Freports_classes.inc;h=bb24fb2d4d29bb73b6dc95c2132b0398cd6150ce;hb=2ee78c3d4c435036e71a0d19c5883173e0ef8f55;hp=96372d1c0bf62329cddf8f58dc9e7e805049ec1d;hpb=d735235be078e107597bad3fbcfef25943076a5f;p=fa-stable.git
diff --git a/reporting/includes/reports_classes.inc b/reporting/includes/reports_classes.inc
index 96372d1c..bb24fb2d 100644
--- a/reporting/includes/reports_classes.inc
+++ b/reporting/includes/reports_classes.inc
@@ -18,6 +18,7 @@ define('RC_MANUFACTURE', 3);
define('RC_DIMENSIONS', 4);
define('RC_BANKING', 5);
define('RC_GL', 6);
+define('RC_FIXEDASSETS', 7);
class BoxReports
{
@@ -25,7 +26,7 @@ class BoxReports
var $ar_reports;
var $ctrl_handlers = array();
- function ReportClasses()
+ function __construct()
{
$this->ar_classes = array();
}
@@ -33,7 +34,7 @@ class BoxReports
function addReportClass($class_name, $class_id=null)
{
if (!$class_id)
- $class_id = count($this->ar_classes);
+ $class_id = count_array($this->ar_classes);
$this->ar_classes[$class_id] = $class_name;
return $class_id;
@@ -99,7 +100,7 @@ class BoxReports
. "
\n";
@@ -169,7 +170,9 @@ class BoxReports
{
global $path_to_root, $SysPrefs,
$type_shortcuts;
-
+ $day_range = get_company_pref("max_days_in_docs");
+ if (!$day_range)
+ $day_range = 180;
$st = '';
switch ($type)
{
@@ -211,7 +214,7 @@ class BoxReports
}
}
}
- else // saved parameters 2010-10-16 Joe Hunt
+ else // saved parameters
$date = $_POST[$name];
$st = "";
if (user_use_date_picker())
@@ -219,7 +222,7 @@ class BoxReports
$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;
@@ -250,7 +253,7 @@ class BoxReports
case 'GRAPHIC':
$sel = array(_("No Graphics"), _("Vertical bars"), _("Horizontal bars"),
- _("Dots"), _("Lines"), _("Pie"), _("Donut"));
+ _("Dots"), _("Lines"), _("Pie"), _("Donut"), _("Half Donut"), _("Splines"));
return array_selector($name, null, $sel);
case 'SYS_TYPES':
@@ -264,7 +267,7 @@ class BoxReports
case 'TEXTBOX':
$value = (isset($_POST[$name]) ? $_POST[$name] : "");
- return "";
+ return "";
case 'ACCOUNTS': // not used
return gl_account_types_list($name, null, _("No Account Group Filter"), true);
@@ -275,9 +278,13 @@ class BoxReports
case 'GL_ACCOUNTS':
return gl_all_accounts_list($name);
+ case 'BANK_ACCOUNTS_NO_FILTER':
case 'BANK_ACCOUNTS':
- return bank_accounts_list($name);
-
+ if ($type == 'BANK_ACCOUNTS_NO_FILTER')
+ return bank_accounts_list($name, null, false, _("All"));
+ else
+ return bank_accounts_list($name);
+
case 'DIMENSION':
return dimensions_list($name, null, false, ' ', false, true, 0);
@@ -298,7 +305,6 @@ class BoxReports
case 'CUSTOMERS_NO_FILTER':
case 'CUSTOMERS':
- $sql = "SELECT debtor_no, name FROM ".TB_PREF."debtors_master";
if ($type == 'CUSTOMERS_NO_FILTER')
return customer_list($name, null, _("No Customer Filter"));
else
@@ -306,7 +312,6 @@ class BoxReports
case 'SUPPLIERS_NO_FILTER':
case 'SUPPLIERS':
- $sql = "SELECT supplier_id, supp_name FROM ".TB_PREF."suppliers";
if ($type == 'SUPPLIERS_NO_FILTER')
return supplier_list($name, null, _("No Supplier Filter"));
else
@@ -315,50 +320,69 @@ class BoxReports
case 'INVOICE':
$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";
+ $sql = "SELECT concat(debtor_trans.trans_no, '-', debtor_trans.type) AS TNO,
+ concat('$IV ', debtor_trans.$ref,' ', debtor.name) as IName
+ FROM ".TB_PREF."debtors_master debtor,"
+ .TB_PREF."debtor_trans debtor_trans LEFT JOIN ".TB_PREF."voided AS vd ON debtor_trans.type=vd.type AND
+ debtor_trans.trans_no=vd.id
+ WHERE debtor_trans.type=".ST_SALESINVOICE." AND debtor.debtor_no=debtor_trans.debtor_no AND ISNULL(vd.id)
+ AND debtor_trans.tran_date > SUBDATE(CURRENT_DATE, INTERVAL $day_range DAY)
+ ORDER BY 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";
+ $sql = "SELECT concat(debtor_trans.trans_no, '-', debtor_trans.type) AS TNO,
+ concat('$CN ', debtor_trans.$ref,' ', debtor.name) as IName
+ FROM ".TB_PREF."debtors_master debtor,"
+ .TB_PREF."debtor_trans debtor_trans LEFT JOIN ".TB_PREF."voided AS vd ON debtor_trans.type=vd.type AND
+ debtor_trans.trans_no=vd.id
+ WHERE debtor_trans.type=".ST_CUSTCREDIT." AND debtor.debtor_no=debtor_trans.debtor_no AND ISNULL(vd.id)
+ AND debtor_trans.tran_date > SUBDATE(CURRENT_DATE, INTERVAL $day_range DAY)
+ ORDER BY debtor_trans.trans_no DESC";
return combo_input($name, '', $sql, 'TNO', 'IName',array('order'=>false));
case 'DELIVERY':
$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";
+ $sql = "SELECT concat(debtor_trans.trans_no, '-', debtor_trans.type) AS TNO,
+ concat(debtor_trans.trans_no, ' $DN ', debtor.name) as IName
+ FROM ".TB_PREF."debtors_master debtor,"
+ .TB_PREF."debtor_trans debtor_trans LEFT JOIN ".TB_PREF."voided AS vd ON debtor_trans.type=vd.type AND
+ debtor_trans.trans_no=vd.id
+ WHERE debtor_trans.type=".ST_CUSTDELIVERY." AND debtor.debtor_no=debtor_trans.debtor_no AND ISNULL(vd.id)
+ AND debtor_trans.tran_date > SUBDATE(CURRENT_DATE, INTERVAL $day_range DAY)
+ ORDER BY debtor_trans.trans_no DESC";
return combo_input($name, '', $sql, 'TNO', 'IName',array('order'=>false));
case 'ORDERS':
$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";
+ $sql = "SELECT sorder.order_no, concat(sorder.$ref, '-', debtor.name) as IName
+ FROM ".TB_PREF."debtors_master debtor,"
+ .TB_PREF."sales_orders sorder
+ WHERE debtor.debtor_no=sorder.debtor_no AND sorder.trans_type=".ST_SALESORDER."
+ AND sorder.ord_date > SUBDATE(CURRENT_DATE, INTERVAL $day_range DAY)
+ ORDER BY sorder.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";
+ $sql = "SELECT sorder.order_no, concat(sorder.$ref, '-', debtor.name) as IName
+ FROM ".TB_PREF."debtors_master debtor,"
+ .TB_PREF."sales_orders sorder
+ WHERE debtor.debtor_no=sorder.debtor_no AND sorder.trans_type=".ST_SALESQUOTE."
+ AND sorder.ord_date > SUBDATE(CURRENT_DATE, INTERVAL $day_range DAY)
+ ORDER BY sorder.order_no DESC";
return combo_input($name, '', $sql, 'order_no', 'IName',array('order'=>false));
case 'PO':
$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";
+ $sql = "SELECT po.order_no, concat(po.$ref, '-', supplier.supp_name) as IName
+ FROM ".TB_PREF."suppliers supplier,"
+ .TB_PREF."purch_orders po
+ WHERE supplier.supplier_id=po.supplier_id
+ AND po.ord_date > SUBDATE(CURRENT_DATE, INTERVAL $day_range DAY)
+ ORDER BY po.order_no DESC";
return combo_input($name, '', $sql, 'order_no', 'IName',array('order'=>false));
case 'REMITTANCE':
@@ -366,18 +390,30 @@ class BoxReports
$SP = $type_shortcuts[ST_SUPPAYMENT];
$CN = $type_shortcuts[ST_SUPPCREDIT];
$ref = ($SysPrefs->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";
+ $sql = "SELECT concat(trans.trans_no, '-',trans.type) AS TNO,
+ concat(trans.$ref, IF(trans.type=".ST_BANKPAYMENT.", ' $BP ', IF(trans.type=".ST_SUPPAYMENT.", ' $SP ',
+ ' $CN ')),
+ supplier.supp_name) as IName
+ FROM ".TB_PREF."suppliers supplier, "
+ .TB_PREF."supp_trans trans LEFT JOIN ".TB_PREF."voided AS vd ON trans.type=vd.type AND trans.trans_no=vd.id
+ WHERE trans.type IN(".ST_BANKPAYMENT.",".ST_SUPPAYMENT.",".ST_SUPPCREDIT.") AND
+ supplier.supplier_id=trans.supplier_id AND ISNULL(vd.id)
+ AND trans.tran_date > SUBDATE(CURRENT_DATE, INTERVAL $day_range DAY)
+ ORDER BY 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";
+ $sql = "SELECT concat(trans.trans_no, '-', trans.type) AS TNO,
+ concat(trans.$ref, IF(trans.type=".ST_BANKDEPOSIT.", ' $BD ', ' $CP '), debtor.name) as IName
+ FROM ".TB_PREF."debtors_master debtor,"
+ .TB_PREF."debtor_trans trans LEFT JOIN ".TB_PREF."voided AS vd ON trans.type=vd.type AND trans.trans_no=vd.id
+ WHERE trans.type IN(".ST_BANKDEPOSIT.",".ST_CUSTPAYMENT.",".ST_CUSTCREDIT.") AND
+ debtor.debtor_no=trans.debtor_no AND ISNULL(vd.id)
+ AND trans.tran_date > SUBDATE(CURRENT_DATE, INTERVAL $day_range DAY)
+ ORDER BY trans.trans_no DESC";
return combo_input($name, '', $sql, 'TNO', 'IName',array('order'=>false));
case 'ITEMS':
@@ -390,22 +426,31 @@ class BoxReports
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";
+ $sql = "SELECT wo.id, concat(wo.id, '-', item.description) as IName
+ FROM ".TB_PREF."stock_master item,"
+ .TB_PREF."workorders wo
+ LEFT JOIN ".TB_PREF."voided v ON wo.id=v.id and v.type=".ST_WORKORDER."
+ WHERE ISNULL(v.id)
+ AND item.stock_id=wo.stock_id
+ ORDER BY wo.id DESC";
return combo_input($name, '', $sql, 'id', 'IName',array('order'=>false));
case 'LOCATIONS':
return locations_list($name, null, _("No Location Filter"));
+ case 'FLOCATIONS':
+ return locations_list($name, null, _("No Location Filter"), false, true);
case 'CATEGORIES':
return stock_categories_list($name, null, _("No Category Filter"));
-
+ case 'FCATEGORIES':
+ return stock_categories_list($name, null, _("No Category Filter"), false, true);
+ case 'FCLASS':
+ return fixed_asset_classes_list($name, null, _("No Class Filter"), false);
case 'SALESTYPES':
return sales_types_list($name);
case 'AREAS':
- return sales_areas_list($name);
+ return sales_areas_list($name, null, _("No Areas Filter"));
case 'SALESMEN':
return sales_persons_list($name, null, _("No Sales Folk Filter"));
@@ -423,7 +468,6 @@ class BoxReports
$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);
}
@@ -438,7 +482,7 @@ class Report
var $ar_params;
var $controls;
- function Report($id, $name, $ar_params = null)
+ function __construct($id, $name, $ar_params = null)
{
$this->id = $id;
$this->name = $name;