function render($id, $title)
 {
     global $path_to_root, $systypes_array;
     include_once $path_to_root . "/includes/ui.inc";
     $start_date = add_days(Today(), -$this->days_past);
     $end_date = add_days(Today(), $this->days_future);
     $result = get_bank_trans_for_bank_account($this->bank_act, $start_date, $end_date);
     start_table(TABLESTYLE, 'width=98%');
     $th = array(_("#"), _("Date"), _("Receipt"), _("Payment"), _("Balance"), _("Person/Item"), _("Memo"), "");
     table_header($th);
     $bfw = get_balance_before_for_bank_account($this->bank_act, $start_date);
     $credit = $debit = 0;
     start_row("class='inquirybg' style='font-weight:bold'");
     label_cell(_("Opening Balance") . " - " . $start_date, "colspan=4");
     display_debit_or_credit_cells($bfw);
     label_cell("");
     label_cell("", "colspan=2");
     end_row();
     $running_total = $bfw;
     if ($bfw > 0) {
         $debit += $bfw;
     } else {
         $credit += $bfw;
     }
     $j = 1;
     $k = 0;
     //row colour counter
     while ($myrow = db_fetch($result)) {
         alt_table_row_color($k);
         $running_total += $myrow["amount"];
         label_cell(get_trans_view_str($myrow["type"], $myrow["trans_no"]));
         $trandate = sql2date($myrow["trans_date"]);
         label_cell($trandate);
         display_debit_or_credit_cells($myrow["amount"]);
         amount_cell($running_total);
         label_cell(payment_person_name($myrow["person_type_id"], $myrow["person_id"]));
         label_cell(get_comments_string($myrow["type"], $myrow["trans_no"]));
         label_cell(get_gl_view_str($myrow["type"], $myrow["trans_no"]));
         end_row();
         if ($myrow["amount"] > 0) {
             $debit += $myrow["amount"];
         } else {
             $credit += $myrow["amount"];
         }
         if ($j == 12) {
             $j = 1;
             table_header($th);
         }
         $j++;
     }
     //end of while loop
     start_row("class='inquirybg' style='font-weight:bold'");
     label_cell(_("Ending Balance") . " - " . $end_date, "colspan=4");
     amount_cell($debit + $credit);
     label_cell("");
     label_cell("", "colspan=2");
     end_row();
     end_table(2);
 }
Exemplo n.º 2
0
submit_cells('Show', _("Show"), '', '', 'default');
end_row();
end_table();
end_form();
//------------------------------------------------------------------------------------------------
if (!isset($_POST['bank_account'])) {
    $_POST['bank_account'] = "";
}
$result = get_bank_trans_for_bank_account($_POST['bank_account'], $_POST['TransAfterDate'], $_POST['TransToDate']);
div_start('trans_tbl');
$act = get_bank_account($_POST["bank_account"]);
display_heading($act['bank_account_name'] . " - " . $act['bank_curr_code']);
start_table(TABLESTYLE);
$th = array(_("Type"), _("#"), _("Reference"), _("Date"), _("Debit"), _("Credit"), _("Balance"), _("Person/Item"), _("Memo"), "");
table_header($th);
$bfw = get_balance_before_for_bank_account($_POST['bank_account'], $_POST['TransAfterDate']);
$credit = $debit = 0;
start_row("class='inquirybg' style='font-weight:bold'");
label_cell(_("Opening Balance") . " - " . $_POST['TransAfterDate'], "colspan=4");
display_debit_or_credit_cells($bfw);
label_cell("");
label_cell("", "colspan=2");
end_row();
$running_total = $bfw;
if ($bfw > 0) {
    $debit += $bfw;
} else {
    $credit += $bfw;
}
$j = 1;
$k = 0;
    table_section(2);
    table_section_title(_("Deduction"));
    label_row(_(" Provident Fund:"), $pf, null, 30, 30);
    label_row(_(" LOP Amount:"), $lop_amount, null, 30, 30);
    label_row(_(" Monthly Amount:"), $staff_loan, null, 30, 30);
    label_row(_(" Other Deduction:"), $tds, null, 30, 30);
    label_row(_(" Total Deductions"), $total_ded, 'style="color:#f55; background-color:#fed;"', 'style="color:#f55; background-color:#fed;"');
    label_row(_(" "), '', null, 30, 30);
    label_row(_(" Net Salary Payable:"), $total_net, 'style="color:#107B0F; background-color:#B7DBC1;"', 'style="color:#107B0F; background-color:#B7DBC1;"');
    end_outer_table(1);
    if (!db_has_employee_payslip($_POST['year'], $_POST['month'], $_POST['empl_id'])) {
        start_table(TABLESTYLE2);
        echo '<tr>';
        $from = Today();
        $from = add_days($from, 1);
        $bal = get_balance_before_for_bank_account(1, $from);
        //echo $trans_no = kv_get_next_trans_no(99) + 1;
        if ($total_net <= $bal) {
            submit_cells('pay_salary', _("Process Payout"), '', _('Show Results'), 'default');
        } else {
            display_warning(" Your Current Account Balance is lower than the payout!.");
        }
        echo '</tr>';
        end_table();
    } else {
        display_warning(" Paid Already!.");
    }
    div_end();
}
end_form();
if (get_post('RefreshInquiry')) {
 function bank_balance_row($bank_acc, $parms = '')
 {
     global $path_to_root;
     $to = add_days(Today(), 1);
     $bal = get_balance_before_for_bank_account($bank_acc, $to);
     $this->label_row(_("Bank Balance:"), "<a target='_blank' " . ($bal < 0 ? 'class="redfg"' : '') . "href='{$path_to_root}/gl/inquiry/bank_inquiry.php?bank_account=" . $bank_acc . "'" . " onclick=\"javascript:openWindow(this.href,this.target); return false;\" >&nbsp;" . price_format($bal) . "</a>", $parms);
 }