Example #1
0
 function render($id, $title)
 {
     global $path_to_root;
     include_once $path_to_root . "/includes/ui.inc";
     $today = date2sql(Today());
     $sql = "SELECT bank_act, bank_account_name, SUM(amount) balance FROM " . TB_PREF . "bank_trans bt" . " INNER JOIN " . TB_PREF . "bank_accounts ba ON bt.bank_act = ba.id" . " WHERE trans_date <= '{$today}'" . " AND inactive <> 1";
     if ($this->data_filter != '') {
         $sql .= ' AND ' . $this->data_filter;
     }
     $sql .= " GROUP BY bank_act, bank_account_name" . " ORDER BY bank_account_name";
     $result = db_query($sql);
     br();
     $th = array(_("Account"), _("Balance"));
     start_table(TABLESTYLE, "width=98%");
     table_header($th);
     $k = 0;
     //row colour counter
     while ($myrow = db_fetch($result)) {
         alt_table_row_color($k);
         label_cell(viewer_link($myrow["bank_account_name"], 'gl/inquiry/bank_inquiry.php?bank_account=' . $myrow["bank_act"]));
         amount_cell($myrow['balance']);
         end_row();
     }
     end_table(1);
 }
Example #2
0
 function render($id, $title)
 {
     global $path_to_root;
     include_once $path_to_root . "/includes/ui.inc";
     include_once $path_to_root . "/reporting/includes/class.graphic.inc";
     if (!defined('FLOAT_COMP_DELTA')) {
         define('FLOAT_COMP_DELTA', 0.004);
     }
     if (!isset($this->top)) {
         $this->top = 10;
     }
     $begin = begin_fiscalyear();
     $today = Today();
     $begin1 = date2sql($begin);
     $today1 = date2sql($today);
     $sql = "SELECT SUM((trans.ov_amount + trans.ov_discount) * rate) AS total, s.supplier_id, s.supp_name FROM\n            " . TB_PREF . "supp_trans AS trans, " . TB_PREF . "suppliers AS s WHERE trans.supplier_id=s.supplier_id\n            AND (trans.type = " . ST_SUPPINVOICE . " OR trans.type = " . ST_SUPPCREDIT . ")\n            AND tran_date >= '{$begin1}' AND tran_date <= '{$today1}' ";
     if ($this->data_filter != '') {
         $sql .= ' AND ' . $this->data_filter;
     }
     $sql .= "GROUP by s.supplier_id ORDER BY total DESC, s.supplier_id " . " LIMIT " . $this->top;
     $result = db_query($sql);
     if ($this->graph_type == 'Table') {
         $th = array(null, _("Supplier"), _("Amount"));
         start_table(TABLESTYLE, "width=98%");
         table_header($th);
         $k = 0;
         //row colour counter
         while ($myrow = db_fetch($result)) {
             alt_table_row_color($k);
             label_cell(viewer_link($myrow["supplier_id"], 'purchasing/inquiry/supplier_inquiry.php?supplier_id=' . $myrow["supplier_id"]));
             label_cell(viewer_link($myrow["supp_name"], 'purchasing/inquiry/supplier_inquiry.php?supplier_id=' . $myrow["supplier_id"]));
             amount_cell($myrow['total']);
             end_row();
         }
         end_table(1);
     } else {
         $pg = new graph();
         $i = 0;
         while ($myrow = db_fetch($result)) {
             $name = $myrow["supplier_id"] . " " . $myrow["supp_name"];
             $pg->x[$i] = $name;
             $pg->y[$i] = $myrow['total'];
             $i++;
         }
         $pg->title = $title;
         $pg->axis_x = _("Supplier");
         $pg->axis_y = _("Amount");
         $pg->graphic_1 = $today;
         $pg->type = 2;
         $pg->skin = 1;
         $pg->built_in = false;
         $filename = company_path() . "/pdf_files/" . uniqid("") . ".png";
         $pg->display($filename, true);
         echo "<img src='{$filename}' border='0' alt='{$title}' style='max-width:100%'>";
     }
 }
Example #3
0
    echo "</td>\n";
    echo "</tr\n";
}
$dim = get_company_pref('use_dimension');
start_form(false, false, "", "accrual");
start_table(TABLESTYLE2);
date_row(_("Date"), 'date_', _('First date of Accruals'), true, 0, 0, 0, null, true);
start_row();
label_cell(_("Accrued Balance Account"), "class='label'");
gl_all_accounts_list_cells(null, 'acc_act', null, true, false, false, true);
end_row();
gl_all_accounts_list_row(_("Revenue / Cost Account"), 'res_act', null, true);
if ($dim >= 1) {
    dimensions_list_row(_("Dimension"), 'dimension_id', null, true, " ", false, 1);
}
if ($dim > 1) {
    dimensions_list_row(_("Dimension") . " 2", 'dimension2_id', null, true, " ", false, 2);
}
$url = "gl/view/accrual_trans.php?act=" . get_post('acc_act') . "&date=" . get_post('date_');
amount_row(_("Amount"), 'amount', null, null, viewer_link(_("Search Amount"), $url, "", "", ICON_VIEW));
frequency_list_row(_("Frequency"), 'freq', null);
text_row(_("Periods"), 'periods', null, 3, 3);
textarea_row(_("Memo"), 'memo_', null, 35, 3);
end_table(1);
submit_center_first('show', _("Show GL Rows"));
//,true,false,'process',ICON_SUBMIT);
submit_center_last('go', _("Process Accruals"));
//,true,false,'process',ICON_SUBMIT);
submit_js_confirm('go', _("Are you sure you want to post accruals?"));
end_form();
end_page();