01.
<?
02.
$id
=
$_REQUEST
[
'txtid'
];
03.
$startdate
=
$_GET
[
'txtstart'
];
04.
$enddate
=
$_GET
[
'txtend'
];
05.
$strSQL
= "SELECT SUM(b.iMoney) AS IMONEY,
06.
SUM(b.iQuantity) AS IQTY,
07.
CONVERT(char(10), a.dDate, 103) AS
'months'
08.
FROM SaleBillVouch AS a RIGHT OUTER JOIN
09.
SaleBillVouchs AS b ON a.SBVID = b.SBVID
10.
WHERE (a.dDate BETWEEN
'$startdate'
AND
'$enddate'
)
11.
AND b.cInvCode =
'$id'
12.
GROUP BY CONVERT(char(10), a.dDate, 103)";
13.
$objQuery
= mssql_query(
$strSQL
)
or
die
(
"Error Query ["
.
$strSQL
.
"]"
);
14.
15.
?>
16.
<table width=
"600"
border=
"1"
>
17.
<tr>
18.
<th width=
"91"
> <div align=
"center"
>วันที่เปิดบิล </div></th>
19.
<th width=
"98"
> <div align=
"center"
>ราคาที่ขาย </div></th>
20.
<th width=
"198"
> <div align=
"center"
>จำนวนที่ขาย </div></th>
21.
22.
</tr>
23.
<?
24.
while
(
$objResult
= mssql_fetch_array(
$objQuery
))
25.
{
26.
?>
27.
<tr>
28.
<td><div align=
"center"
><?=
$objResult
[
"months"
];?></div></td>
29.
<td><?=
$objResult
[
"IMONEY"
];?></td>
30.
<td><?=
$objResult
[
"IQTY"
];?></td>
31.
32.
</tr>
33.
<?
34.
}
35.
?>
36.
</table>
37.
<?
38.
mssql_close(
$objConnect
);
39.
?>
40.
</body>
41.
</html>