001.
Code
002.
<body>
003.
<?php
include
(
'config.php'
);?>
004.
<form action=
""
method=
"post"
name=
"adminForm"
id=
"adminForm"
>
005.
<table width=
"57%"
height=
"32"
border=
"0"
align=
"left"
cellpadding=
"0"
cellspacing=
"0"
id=
"gridview"
>
006.
<tr style=
"font-family:Arial, Helvetica, sans-serif;font-style:normal;font-weight:normal; font-size:13px;color:black"
>
007.
<td width=
"62"
align=
"center"
> <span
class
=
"ff2"
>
Date
: </span></td>
008.
<td width=
"155"
>
009.
<input type=
"text"
id=
"datepicker"
name=
"date_start"
value=
"<?=$_POST['date_start'];?>"
010.
size=
"10"
style=
"width:150px;"
onchange=
"document.adminForm.submit();"
></td>
011.
<td width=
"87"
align=
"right"
class
=
"ff2"
> Until
Date
: </td>
012.
<td width=
"460"
align=
"left"
class
=
"ff2"
>
013.
<input type=
"text"
id=
"datepicker2"
name=
"date_stop"
value=
"<?=$_POST['date_stop'];?>"
014.
size=
"10"
style=
"width:150px;"
onchange=
"document.adminForm.submit();"
/></td>
015.
</tr> </table>
016.
</form>
017.
<table width=
"64%"
align=
"left"
border=
"1"
cellpadding=
"0"
cellspacing=
"0"
>
018.
<thead>
019.
<tr>
020.
<th colspan=
"7"
align=
"left"
class
=
"bb2"
style=
"font-family:Arial, Helvetica, sans-serif;font-style:normal; font-size:13px;color:blackgray"
>Monthly Report</th>
021.
</tr>
022.
<tr bgcolor=
"#C3C3C3"
style=
"font-family:Arial, Helvetica, sans-serif;font-style:normal;font-weight:normal; font-size:13px;color:black"
>
023.
<th width=
"9%"
> Customer </th>
024.
<th width=
"7%"
height=
"29"
><span
class
=
"adminlist55"
><span
class
=
"gf222"
><span
class
=
"ff2"
> Credit</span></span></span></th>
025.
<th width=
"6%"
><span
class
=
"adminlist55"
><span
class
=
"gf222"
><span
class
=
"ff2"
> Room</span></span></span></th>
026.
<th width=
"6%"
><span
class
=
"ff2"
>Cash </span></th>
027.
<th width=
"6%"
><span
class
=
"ff2"
>Package</span></th>
028.
<th width=
"6%"
>House used</th>
029.
<th width=
"6%"
>TOTAL</th>
030.
</tr>
031.
</thead>
032.
033.
<?php
034.
$sql_show
="SELECT ots_table.customeragency,chargedby,IF(chargedby=
'Credit'
,amount,
''
) AS price1,IF(chargedby=
'Room'
,amount,
''
) AS price2,
035.
IF(chargedby=
'Cash'
,amount,
''
) AS price3, IF(chargedby=
'Package'
,amount,
''
) AS price4,IF(chargedby=
'House used'
,amount,
''
) AS price5
036.
FROM ots_table INNER JOIN charge_by_table ON ots_table.chargedby =charge_by_table.charge_by ";
037.
038.
if
(
$_POST
)
039.
{
040.
$Credit
=
"Credit"
;
041.
$Room
=
"Room"
;
042.
$Cash
=
"Cash"
;
043.
$Package
=
"Package"
;
044.
$House
=
"House used"
;
045.
$sql_show
.=
" where (ots_table.pickup_start_date between '"
.
$_POST
['date_start
']."'
and
'".$_POST['
date_stop
']."'
)
046.
and
ots_table.chargedby in (
'".$Room."'
,
'".$Credit."'
,
'".$Cash."'
,
'".$Package."'
,
'".$House."'
)
047.
ORDER BY ots_table.pickup_start_date between
'".$_POST['
date_start
']."'
and
'".$_POST['
date_stop
']."'
,
048.
ots_table.chargedby like charge_by_table.charge_by ASC";
049.
}
050.
$result_show
= mysql_query(
$sql_show
)
or
die
(mysql_error());
051.
$RoomSum
= 0;
052.
$CreditSum
= 0;
053.
$CashSum
= 0;
054.
$PackageSum
= 0;
055.
while
(
$rs
= mysql_fetch_array(
$result_show
))
056.
{
057.
$id
=
$rs
[
"id"
];
058.
$Credit
=
$rs
[
"price1"
];
059.
$Room
=
$rs
[
"price2"
];
060.
$Cash
=
$rs
[
"price3"
];
061.
$Package
=
$rs
[
"price4"
];
062.
$House
=
$rs
[
"price5"
];
063.
$customer
=
$rs
[
"customeragency"
];
064.
065.
$Total
=
$Credit
+
$Room
+
$Cash
+
$Package
+
$House
;
066.
$CreditTotal
+=
$Credit
;
067.
$RoomTotal
+=
$Room
;
068.
$CashTotal
+=
$Cash
;
069.
$PackageTotal
+=
$Package
;
070.
$HouseTotal
+=
$House
;
071.
$GrandTotal
+=
$Total
;
072.
?>
073.
<tr align=
"center"
>
074.
<td height=
"38"
><?
echo
$customer
;?></td>
075.
<td height=
"38"
><?
echo
$Credit
;?></td>
076.
<td height=
"38"
><?
echo
$Room
;?></td>
077.
<td height=
"38"
><?
echo
$Cash
;?></td>
078.
<td height=
"38"
><?
echo
$Package
;?></td>
079.
<td height=
"38"
><?
echo
$House
;?></td>
080.
<td><?
echo
$Total
;?></td>
081.
</tr>
082.
<? } ?>
083.
<tr bgcolor=
"#C3C3C3"
style=
"font-family:Arial, Helvetica, sans-serif;font-style:normal;font-weight:normal; font-size:13px;color:black"
>
084.
<th width=
"9%"
>Grand Total</th>
085.
<th width=
"7%"
height=
"29"
><?
echo
$CreditTotal
;?></th>
086.
<th width=
"6%"
><?
echo
$RoomTotal
;?></th>
087.
<th width=
"6%"
><?
echo
$CashTotal
;?></th>
088.
<th width=
"6%"
><?
echo
$PackageTotal
;?></th>
089.
<th width=
"6%"
><?
echo
$HouseTotal
;?></th>
090.
<th width=
"6%"
><?
echo
$GrandTotal
;?></th>
091.
</tr>
092.
</table>
093.
<p> </p>
094.
</body>
095.
<script type=
"text/javascript"
>
096.
$(
function
(){
097.
$(
"#datepicker"
).datepicker({ dateFormat:
"yy-mm-dd"
}).val(
'<? $date = date("1-m-Y");echo $date?>'
)
098.
$(
"#datepicker2"
).datepicker({ dateFormat:
"yy-mm-dd"
}).val(
'<? $date = date("31-m-Y");echo $date?>'
)
099.
});
100.
</script>