<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Agenda</title>
</head>
<body>
<?php
$monthNames = Array("January", "February", "March", "April", "May", "June", "July",
"August", "September", "October", "November", "December");
?>
<?php
if (!isset($_REQUEST["month"])) $_REQUEST["month"] = date("n");
if (!isset($_REQUEST["year"])) $_REQUEST["year"] = date("Y");
?>
<?php
$cMonth = $_REQUEST["month"];
$cYear = $_REQUEST["year"];
$prev_year = $cYear;
$next_year = $cYear;
$prev_month = $cMonth-1;
$next_month = $cMonth+1;
if ($prev_month == 0 ) {
$prev_month = 12;
$prev_year = $cYear - 1;
}
if ($next_month == 13 ) {
$next_month = 1;
$next_year = $cYear + 1;
}
?>
<table width="200">
<tr align="center">
<td bgcolor="#999999" style="color:#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" align="left"> <a href="<?php echo $_SERVER["PHP_SELF"] . "?month=". $prev_month . "&year=" . $prev_year; ?>" style="color:#FFFFFF">Previous</a></td>
<td width="50%" align="right"><a href="<?php echo $_SERVER["PHP_SELF"] . "?month=". $next_month . "&year=" . $next_year; ?>" style="color:#FFFFFF">Next</a> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center">
<table width="100%" border="0" cellpadding="2" cellspacing="2">
<tr align="center">
<td colspan="7" bgcolor="#999999" style="color:#FFFFFF"><strong><?php echo $monthNames[$cMonth-1].' '.$cYear; ?></strong></td>
</tr>
<tr>
<td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>S</strong></td>
<td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>M</strong></td>
<td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>T</strong></td>
<td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>W</strong></td>
<td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>T</strong></td>
<td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>F</strong></td>
<td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>S</strong></td>
</tr>
<?php
$timestamp = mktime(0,0,0,$cMonth,1,$cYear);
$maxday = date("t",$timestamp);
$thismonth = getdate ($timestamp);
$startday = $thismonth['wday'];
for ($i=0; $i<($maxday+$startday); $i++) {
if(($i % 7) == 0 ) echo "<tr>n";
if($i < $startday) echo "<td></td>n";
else echo "<td align='center' valign='middle' height='20px'>". ($i - $startday + 1) . "</td>n";
if(($i % 7) == 6 ) echo "</tr>n";
}
?>
</table>
</td>
</tr>
</table>
</body>
</html>
-- phpMyAdmin SQL Dump
-- version 3.2.4
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Waktu pembuatan: 16. Oktober 2012 jam 13:32
-- Versi Server: 5.1.41
-- Versi PHP: 5.3.1
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `gedung`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `pesan`
--
CREATE TABLE IF NOT EXISTS `pesan` (
`id` int(5) NOT NULL AUTO_INCREMENT,
`username` varchar(25) CHARACTER SET utf8 NOT NULL,
`instansi` varchar(50) NOT NULL,
`tgltransaksi` varchar(10) CHARACTER SET utf8 NOT NULL,
`acara` varchar(25) CHARACTER SET utf8 NOT NULL,
`tglacara` varchar(10) CHARACTER SET utf8 NOT NULL,
`jmlhari` varchar(3) CHARACTER SET utf8 NOT NULL,
`waktu` varchar(20) CHARACTER SET utf8 NOT NULL,
`totalbayar` varchar(20) NOT NULL,
`grandtotal` varchar(20) NOT NULL,
`dp` varchar(10) NOT NULL,
`sisapembayaran` varchar(15) NOT NULL,
`lunas` varchar(20) NOT NULL,
`ket` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=75 ;
--
-- Dumping data untuk tabel `pesan`
--
INSERT INTO `pesan` (`id`, `username`, `instansi`, `tgltransaksi`, `acara`, `tglacara`, `jmlhari`, `waktu`, `totalbayar`, `grandtotal`, `dp`, `sisapembayaran`, `lunas`, `ket`) VALUES
(1, 'upha', 'ulfa wahyuni', '27-08-2012', 'wisuda', '1-10-2012', '1', '09.00 WIB-15.00 WIB', '2,050,000', '2050000', '1000000', '1050000', 'belum', ''),
(2, 'upha', 'ulfa wahyuni', '27-08-2012', 'seminar', '5-10-2012', '2', '09.00 WIB-12.00 WIB', '400,000', '800000', '500000', '300000', 'belum', ''),
(72, 'ririn', 'sdn kedungombo', '25-09-2012', 'pernikahan', '19-2-1994', '20', '06.00 WIB-Selesai', '2,592,000', '51840000', 'belum', '', 'belum', ''),
(64, 'ririn', 'sdn kedungombo', '21-09-2012', 'wisuda', '18-2-1995', '5', '06.00 WIB-Selesai', '2,540,000', '12700000', 'belum', '', 'belum', ''),
(63, 'ririn', 'sdn kedungombo', '05-09-2012', 'pernikahan', '19-12-2012', '3', '09.00 WIB-Selesai', '3,692,000', '11076000', 'belum', '', 'belum', '');
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
<?php
$timestamp = mktime(0,0,0,$cMonth,1,$cYear);
$maxday = date("t",$timestamp);
$thismonth = getdate ($timestamp);
$startday = $thismonth['wday'];
for ($i=0; $i<($maxday+$startday); $i++) {
if(($i % 7) == 0 ) {
echo "<tr>n";
}
if($i < $startday){
echo "<td></td>n";
}else{
$sql = "select * from pesan where tglacara='".($i - $startday + 1).'-'.$cMonth.'-'.$cYear."'";
$hs = mysql_query($sql);
$jmlAcara = mysql_num_rows($hs);
echo "<td align='center' valign='middle' height='20px'".($jmlAcara > 0 ? " bgcolor='blue'" : '').">";
echo ($i - $startday + 1);
if($jmlAcara > 0){
echo '<ul>';
while($acara = mysql_fetch_array($rs)){
echo '<li>'.$acara['acara'].'</li>';
}
echo '</ul>';
}
echo "</td>n";
}
if(($i % 7) == 6 ){
echo "</tr>n";
}
}
?>
<?php
$timestamp = mktime(0,0,0,$cMonth,1,$cYear);
$maxday = date("t",$timestamp);
$thismonth = getdate ($timestamp);
$startday = $thismonth['wday'];
for ($i=0; $i<($maxday+$startday); $i++) {
if(($i % 7) == 0 ) {
echo "<tr>n";
}
if($i < $startday){
echo "<td></td>n";
}else{
$sql = "select * from pesan where tglacara='".($i - $startday + 1).'-'.$cMonth.'-'.$cYear."'";
$hs = mysql_query($sql);
$jmlAcara = mysql_num_rows($hs);
echo "<td align='center' valign='middle' height='20px'".($jmlAcara > 0 ? " bgcolor='blue'" : '').">";
echo ($i - $startday + 1);
if($jmlAcara > 0){
echo '<ul>';
while($acara = mysql_fetch_array($hs)){
echo '<li style="color:'.($acara['dp'] ? 'red' : 'yellow').'">'.$acara['acara'].'</li>';
}
echo '</ul>';
}
echo "</td>n";
}
if(($i % 7) == 6 ){
echo "</tr>n";
}
}
?>