- source_graphic($today, $title, $source, $pg, ($type == 0 ? _("Sales") : _("Value")));
+ source_graphic($today, $title, $source, $pg, ($type == 0 ? _("Sales") : _("Amount")),
+ ($type == 0 ? _("Costs") : null));
$title = supplier_top($today, 3, 66, $pg);
source_graphic($today, $title, _("Supplier"), $pg, _("Purchases"));
$title = stock_top($today, 3, 66, 0, $pg);
$title = supplier_top($today, 3, 66, $pg);
source_graphic($today, $title, _("Supplier"), $pg, _("Purchases"));
$title = stock_top($today, 3, 66, 0, $pg);
- source_graphic($today, $title, _("Stock"), $pg, _("Sales"));
+ source_graphic($today, $title, _("Items"), $pg, _("Sales"), _("Costs"));
table_two();
dimension_top($today, 3, 66);
$title = gl_top($today, 66, $pg);
table_two();
dimension_top($today, 3, 66);
$title = gl_top($today, 66, $pg);
$th = array(_("Customer"), _("Amount"));
start_table(TABLESTYLE, "width='$width%'");
$th = array(_("Customer"), _("Amount"));
start_table(TABLESTYLE, "width='$width%'");
$th = array(_("Supplier"), _("Amount"));
start_table(TABLESTYLE, "width='$width%'");
$th = array(_("Supplier"), _("Amount"));
start_table(TABLESTYLE, "width='$width%'");
if ($type == 0)
{
$sql = "SELECT SUM((trans.unit_price * trans.quantity) * d.rate) AS total, s.stock_id, s.description,
if ($type == 0)
{
$sql = "SELECT SUM((trans.unit_price * trans.quantity) * d.rate) AS total, s.stock_id, s.description,
".TB_PREF."debtor_trans_details AS trans, ".TB_PREF."stock_master AS s, ".TB_PREF."debtor_trans AS d
WHERE trans.stock_id=s.stock_id AND trans.debtor_trans_type=d.type AND trans.debtor_trans_no=d.trans_no
AND (d.type = ".ST_SALESINVOICE." OR d.type = ".ST_CUSTCREDIT.") ";
".TB_PREF."debtor_trans_details AS trans, ".TB_PREF."stock_master AS s, ".TB_PREF."debtor_trans AS d
WHERE trans.stock_id=s.stock_id AND trans.debtor_trans_type=d.type AND trans.debtor_trans_no=d.trans_no
AND (d.type = ".ST_SALESINVOICE." OR d.type = ".ST_CUSTCREDIT.") ";
- $sql .= "AND tran_date >= '$begin1' AND tran_date <= '$today1' GROUP by s.stock_id ORDER BY total DESC, s.stock_id
+ if ($type != 2)
+ $sql .= "AND tran_date >= '$begin1' ";
+ $sql .= "AND tran_date <= '$today1' GROUP by s.stock_id ORDER BY total DESC, s.stock_id
- $th = array(_("Item"), _("Amount"), _("Quantity"));
+ display_title($title);
+ if ($type == 0)
+ $th = array(_("Item"), _("Sales"), _("Costs"), _("Quantity"));
+ else
+ $th = array(_("Item"), _("Amount"), _("Quantity"));
t.tran_date >= '$begin1' AND t.tran_date <= '$today1' GROUP BY d.id ORDER BY total DESC LIMIT $limit";
$result = db_query($sql, "Transactions could not be calculated");
$title = _("Top $limit Dimensions in fiscal year");
t.tran_date >= '$begin1' AND t.tran_date <= '$today1' GROUP BY d.id ORDER BY total DESC LIMIT $limit";
$result = db_query($sql, "Transactions could not be calculated");
$title = _("Top $limit Dimensions in fiscal year");
$th = array(_("Dimension"), _("Amount"));
start_table(TABLESTYLE, "width='$width%'");
$th = array(_("Dimension"), _("Amount"));
start_table(TABLESTYLE, "width='$width%'");
AND tran_date <= '$today1' GROUP BY c.cid ORDER BY c.cid";
$result = db_query($sql, "Transactions could not be calculated");
$title = _("Class Balances");
AND tran_date <= '$today1' GROUP BY c.cid ORDER BY c.cid";
$result = db_query($sql, "Transactions could not be calculated");
$title = _("Class Balances");
function source_graphic($today, $title, $x_axis, $pg, $graphic1, $graphic2=null, $type=2)
{
function source_graphic($today, $title, $x_axis, $pg, $graphic1, $graphic2=null, $type=2)
{
AND DATEDIFF('$today', trans.due_date) > 0 ORDER BY days DESC";
$result = db_query($sql);
$title = db_num_rows($result) . _(" overdue Sales Invoices");
AND DATEDIFF('$today', trans.due_date) > 0 ORDER BY days DESC";
$result = db_query($sql);
$title = db_num_rows($result) . _(" overdue Sales Invoices");
$th = array("#", _("Ref."), _("Date"), _("Due Date"), _("Customer"), _("Branch"), _("Currency"),
_("Total"), _("Remainder"), _("Days"));
start_table(TABLESTYLE);
table_header($th);
$th = array("#", _("Ref."), _("Date"), _("Due Date"), _("Customer"), _("Branch"), _("Currency"),
_("Total"), _("Remainder"), _("Days"));
start_table(TABLESTYLE);
table_header($th);
$th = array(_("Description"), _("Template No"),_("Customer"),_("Branch")."/"._("Group"),_("Next invoice"));
start_table(TABLESTYLE, "width=70%");
$th = array(_("Description"), _("Template No"),_("Customer"),_("Branch")."/"._("Group"),_("Next invoice"));
start_table(TABLESTYLE, "width=70%");
AND DATEDIFF('$today', trans.due_date) > 0 ORDER BY days DESC";
$result = db_query($sql);
$title = db_num_rows($result) . _(" overdue Purchase Invoices");
AND DATEDIFF('$today', trans.due_date) > 0 ORDER BY days DESC";
$result = db_query($sql);
$title = db_num_rows($result) . _(" overdue Purchase Invoices");
$th = array("#", _("Ref."), _("Date"), _("Due Date"), _("Supplier"), _("Currency"), _("Total"),
_("Remainder"), _("Days"));
start_table(TABLESTYLE);
$th = array("#", _("Ref."), _("Date"), _("Due Date"), _("Supplier"), _("Currency"), _("Total"),
_("Remainder"), _("Days"));
start_table(TABLESTYLE);
function bank_balance($today, $width)
{
$today = date2sql($today);
function bank_balance($today, $width)
{
$today = date2sql($today);
- $sql = "SELECT bank_act, bank_account_name, SUM(amount) balance FROM ".TB_PREF."bank_trans bt
+ $sql = "SELECT bank_act, bank_account_name, bank_curr_code, SUM(amount) balance FROM ".TB_PREF."bank_trans bt
ORDER BY bank_account_name";
$result = db_query($sql);
$title = _("Bank Account Balances");
ORDER BY bank_account_name";
$result = db_query($sql);
$title = _("Bank Account Balances");
- br(1);
- display_heading($title);
- br();
- $th = array(_("Account"), _("Balance"));
+ display_title($title);
+ $th = array(_("Account"), _("Currency"), _("Balance"));
start_table(TABLESTYLE, "width='$width%'");
table_header($th);
$k = 0; //row colour counter
start_table(TABLESTYLE, "width='$width%'");
table_header($th);
$k = 0; //row colour counter