コード例 #1
0
function displayWithSumRow($business, $loai, $monthFrom, $monthTo, $year)
{
    $str = null;
    $str .= '<table width="70%" border="0" align="center" cellspacing="0" cellpadding="0" id="tblist">';
    $str .= '<tr class="title">';
    $str .= '<td width="30px" align="center">#</td>';
    $str .= '<td width="30px" align="center">';
    $str .= '<input type="checkbox" name="cbAll" id="cbAll" onclick="checkALL()"/></td>';
    $str .= '<td width="70px" align="center">Ngày thu</td>';
    $str .= '<td align="center">Công việc</td>';
    $str .= '<td width="20%">Nhân viên thu</td>';
    $str .= '<td align="right" width="100px">Số tiền</td>';
    $str .= '</tr>';
    for ($i = 0; $i < count($business); $i++) {
        $user = UsersBUS::GetUserByID($business[$i]['nhanvien']);
        $dvTien = DonViTienBUS::selectId($business[$i]['donvi']);
        $str .= '<tr>';
        $str .= '<td align="center">' . ($i + 1) . '</td>';
        $str .= '<td align="center"><input type="checkbox" name="cbId[]" id="cbId[]" value="' . $business[$i]['id'] . '"></td>';
        $str .= '<td align="center">' . $business[$i]["ngay"] . '</td>';
        $str .= '<td>' . $business[$i]["congviec"] . '</td>';
        $str .= '<td>' . $user['hoten'] . '</td>';
        $str .= '<td align="right">' . number_format($business[$i]["sotien"]) . ' ' . $dvTien['ten'] . '</td>';
        $str .= '</tr>';
    }
    $str .= '<tr>';
    $str .= '<td align="right" colspan="5"><b>Tổng thu:</b></td>';
    $sumRow = null;
    if ($monthTo == null && $monthFrom == null && $year == null) {
        $sumRow = ThuChiBUS::SumTongTien($loai);
    } else {
        $sumRow = ThuChiBUS::SumTongTienByMonth($loai, $monthFrom, $monthTo, $year);
    }
    $str .= '<td align="right"><b>' . $sumRow[0] . ' vnd</b></td>';
    $str .= '</tr>';
    $str .= '</table>';
    $str .= "<script>\$(\"table[id='tblist'] tr:even\").css('background-color', '#EFEFEF');</script>";
    return $str;
}
コード例 #2
0
                    break;
                case 4:
                    $thu = ThuChiBUS::SumTongTienByMonth(0, 10, 12, $nam);
                    $chi = ThuChiBUS::SumTongTienByMonth(1, 10, 12, $nam);
                    $thu = $thu == null ? 0 : $thu;
                    $chi = $chi == null ? 0 : $chi;
                    echo ProfitProcessor::display('Thống kê quý ' . $quy . '/' . $nam, $chi, $thu, $thu - $chi);
                    break;
                default:
                    $thu = ThuChiBUS::SumTongTienByMonth(0, 1, 12, $nam);
                    $chi = ThuChiBUS::SumTongTienByMonth(1, 1, 12, $nam);
                    $thu = $thu == null ? 0 : $thu;
                    $chi = $chi == null ? 0 : $chi;
                    echo ProfitProcessor::display('Thống kê năm ' . $nam, $chi, $thu, $thu - $chi);
                    break;
            }
        } else {
            $thu = ThuChiBUS::SumTongTienByMonth(0, 1, 12, $nam);
            $chi = ThuChiBUS::SumTongTienByMonth(1, 1, 12, $nam);
            $thu = $thu == null ? 0 : $thu;
            $chi = $chi == null ? 0 : $chi;
            echo ProfitProcessor::display('Thống kê năm ' . $nam, $chi, $thu, $thu - $chi);
        }
    } else {
        $thu = ThuChiBUS::SumTongTienByMonth(0, 1, 12, date("Y"));
        $chi = ThuChiBUS::SumTongTienByMonth(1, 1, 12, date("Y"));
        $thu = $thu == null ? 0 : $thu;
        $chi = $chi == null ? 0 : $chi;
        echo ProfitProcessor::display('Thống kê năm ' . date("Y"), $chi, $thu, $thu - $chi);
    }
}