report_month.php
来自「CRM 不仅仅是一个管理名词和管理概念」· PHP 代码 · 共 117 行
PHP
117 行
<?
########################################
#OsoonCrm
#费用列表
########################################
include "include/db.inc.php";
include "include/check.inc.php";
include "include/header.inc.php";
include "include/array.inc.php";
include "include/priv.report.inc.php";
?>
<?
// 默认显示当前月报表
if (!$year) $year = date("Y");
if (!$month) $month = date("n");
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="90%">
<tr valign=top>
<td width="201">
<? include "include/left.inc.php"; ?>
</td>
<td align=center>
<br>
<table width="95%" border="0" cellspacing="0" cellpadding="0" height=25>
<tr align="right">
<td>
<a href="report_project.php">项目报表</a>
|
<a href="report_month.php">月 报 表</a>
</td>
</tr>
</table>
<hr>
<table width="95%" border="0" cellspacing="0" cellpadding="3" align="center" bordercolorlight="#ede5d2" bordercolordark="#ffffff">
<form name="form1" method="post" action="">
<tr align=right>
<td> 报表月份:
<input type="text" name="year" size="5" maxlength="4" value="<? echo $year ?>">
年
<select name="month">
<?
for ($i=1; $i<=12; $i++) {
if ($i==$month)
echo "<option value=\"$i\" selected>$i</option>";
else
echo "<option value=\"$i\">$i</option>";
}
?>
</select>月
<input type="submit" name="Submit" value="查看">
</td>
</tr>
</form>
</table>
<table width="95%" border="1" cellspacing="0" cellpadding="3" align="center" bordercolorlight="#ede5d2" bordercolordark="#ffffff">
<tr bgcolor="#ffffff">
<td colspan=10>报表名:月报表<br>月 份:<? echo $year."年".$month."月"; ?></td>
</tr>
<tr bgcolor="#ede5d2" align=right>
<td width="60" align=center><b>序号</b></td>
<td width="120" align=left><b>姓名</b></td>
<td><b>本月项目费用</b></td>
<td><b>本月日常费用</b></td>
<td><b>合计</b></td>
</tr>
<?
$mon_view = "0".$month;
$mon_view = substr($mon_view, -2);
$where = " where UseTime like '%$year"."-".$mon_view."%' ";
$sql = "select distinct UserID from $tbl_crm_expense $where";
//echo $sql;
$res = mysql_query($sql);
$i=0;
$xm_total = 0;
$rc_total = 0;
while ($row=@mysql_fetch_array($res)) {
$uid_list = $row[0];
$sql2 = "select * from $tbl_crm_expense $where and UserID='$uid_list'";
//echo $sql2;
$res2= mysql_query($sql2);
$xm_exp2 = 0;
$rc_exp1 = 0;
while ($row2=@mysql_fetch_array($res2)) {
if ($row2[ProjectExpenseType]==2)
$xm_exp2 += $row2[RealExpense];
if ($row2[ProjectExpenseType]==1)
$rc_exp1 += $row2[RealExpense];
}
$xm_total += $xm_exp2;
$rc_total += $rc_exp1;
$i++;
?>
<tr align=right>
<td align=center><? echo $i ?> </td>
<td align=left><a href="report_user.php?id=<? echo $uid_list ?>&year=<? echo $year ?>&month=<? echo $month ?>" style="color:blue"><? echo $array_crm_id2user[$uid_list] ?></a> </td>
<td><? echo $xm_exp2 ?> </td>
<td><? echo $rc_exp1 ?> </td>
<td><? echo $rc_exp1+$xm_exp2 ?> </td>
</tr>
<?
}
?> <tr align=right>
<td align=center><b>总计</b></td>
<td> </td>
<td><? echo $xm_total ?> </td>
<td><? echo $rc_total ?> </td>
<td><? echo $xm_total+$rc_total ?> </td>
</tr>
</table>
<p></p>
</td>
</tr>
</table>
<? include "include/footer.inc.php"; ?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?