X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=dimensions%2Fincludes%2Fdimensions_ui.inc;h=925d0313137c67c3ef8c8d063fc0792652e34066;hb=a1c1f11e18aa72599123c36521a54a21a2c3d0bc;hp=ae69b98b6ed2bdcf0bfc59f6c5daaea9ba15c584;hpb=e92b9f68f3546455f30d9412c252a189eb5c886e;p=fa-stable.git
diff --git a/dimensions/includes/dimensions_ui.inc b/dimensions/includes/dimensions_ui.inc
index ae69b98b..925d0313 100644
--- a/dimensions/includes/dimensions_ui.inc
+++ b/dimensions/includes/dimensions_ui.inc
@@ -1,71 +1,58 @@
.
+***********************************************************************/
include_once($path_to_root . "/includes/ui.inc");
//--------------------------------------------------------------------------------------
-function display_dimension_payments($id)
+function display_dimension_balance($id, $from, $to)
{
- global $path_to_root, $table_style;
-
- $sql = "SELECT ".TB_PREF."gl_trans.*,".TB_PREF."chart_master.account_name FROM
- ".TB_PREF."gl_trans,".TB_PREF."chart_master WHERE
- ".TB_PREF."gl_trans.account = ".TB_PREF."chart_master.account_code AND
- (dimension_id = $id OR dimension2_id = $id) ORDER BY account,tran_date";
- $result = db_query($sql, "Transactions could not be calculated");
+ global $path_to_root;
- echo "
";
+ $result = get_dimension_balance_all($id, $from, $to);
if (db_num_rows($result) == 0)
{
- display_note(_("There are no transactions for this dimension."));
+ display_note(_("There are no transactions for this dimension for the selected period."));
}
else
{
- display_heading2(_("Transactions for this Dimension"));
- start_table($table_style);
- $th = array(_("Type"), _("#"), _("Account"),
- _("Date"), _("Debit"), _("Credit"));
+ display_heading2(_("Balance for this Dimension"));
+ br();
+ start_table(TABLESTYLE);
+ $th = array(_("Account"), _("Debit"), _("Credit"));
table_header($th);
- $total = $grand_total = $k = 0;
- $account = "";
+ $total = $k = 0;
while ($myrow = db_fetch($result))
{
- if ($account != $myrow["account"])
- {
- if ($account != "")
- {
- start_row();
- label_cell(_("Total"), "colspan=4");
- display_debit_or_credit_cells($total);
- end_row();
- $total = 0;
- }
- $account = $myrow["account"];
- }
-
alt_table_row_color($k);
- label_cell(systypes::name($myrow["type"]));
- label_cell(get_gl_view_str($myrow["type"], $myrow["type_no"], $myrow["type_no"], true));
label_cell($myrow["account"]." ".$myrow['account_name']);
- label_cell(sql2date($myrow["tran_date"]));
- display_debit_or_credit_cells($myrow["amount"]);
-
- $total += $myrow["amount"];
- $grand_total += $myrow["amount"];
-
+ display_debit_or_credit_cells($myrow["amt"]);
+ $total += $myrow["amt"];
end_row();
}
start_row();
- label_cell(_("Total"), "colspan=4");
- display_debit_or_credit_cells($total);
- end_row();
-
- start_row();
- label_cell(_("Grand Total"), "colspan=4");
- display_debit_or_credit_cells($grand_total);
+ label_cell(""._("Balance")."");
+ if ($total >= 0)
+ {
+ amount_cell($total, true);
+ label_cell("");
+ }
+ else
+ {
+ label_cell("");
+ amount_cell(abs($total), true);
+ }
end_row();
end_table();