function testDates() { $ee = new getDate(); $dateArray4 = $ee->getDateHandler('2013-08-30', '2013-08-31'); $dateToday = date("Y-m-d"); $beginDate4 = $dateArray4[0]; $endDate4 = $dateArray4[1]; $this->assertEqual('2013-08-30 00:00:00', $beginDate4); $this->assertEqual('2013-08-31 23:59:59', $endDate4); }
<?php include_once $_SERVER['DOCUMENT_ROOT'] . "/ABC/model/connectDatabase.php"; include_once $_SERVER['DOCUMENT_ROOT'] . "/ABC/model/getDate.php"; // cac dong thong bao, trang thai ben trang nguoi dung $noti = ""; $state = "Đăng ký ăn"; $warn = ""; // ket noi den csdl $db = new PDOData(); // nhan ve va thay doi format cua ngay mai $d = new getDate(); $tomorrow = $d->getTomorrowForDatabase(); $tomorrow2 = $d->getTomorrowForPrint(); $temp = $d->getWeeksOfYear(1); $dayForDatabase = $d->getDaysOfWeek(1); if ($temp % 2 === 0) { $dayForDatabase += 7; } // gan id cua nguoi dung dang dang nhap $clientId = $_SESSION['idClient']; // kiem tra de huy dang ky an voi ngay da dang ky $resu = $db->getData("SELECT * FROM dangkycuthe WHERE idTAIKHOAN= {$clientId} AND ngay= '{$tomorrow}';"); if (sizeof($resu) > 0) { $warn = "Bạn đã đăng ký cho suất ăn cho {$tomorrow2}.</br></br>Để hủy đăng ký, vui lòng tick vào ô bên dưới và ấn xác nhận..."; $state = "Hủy đăng ký"; } else { $warn = "Bạn chưa đăng ký cho suất ăn cho {$tomorrow2}.</br></br>Để đăng ký, vui lòng tick vào ô bên dưới và ấn xác nhận..."; $state = "Đăng ký ăn"; } //$warn= $resu;
<?php include_once $_SERVER['DOCUMENT_ROOT'] . "/ABC/model/getDate.php"; include_once $_SERVER['DOCUMENT_ROOT'] . "/ABC/model/connectDatabase.php"; // ket noi csdl $db = new PDOData(); $d = new getDate(); // lay ve ngay $toda = $d->getNextDaysForPrint(0); $todayForDatabase = $d->getNextDaysForDatabase(0); // lay ve thu tu ngay trong tuan $spaceOfDays = $d->getDaysOfWeek(0); $data = $db->getData("SELECT tk.idTAIKHOAN, ten, maNhanVien, hoTen FROM taikhoan AS tk, thongtintaikhoan AS tttk WHERE tttk.idTAIKHOAN IN (SELECT DISTINCT idTAIKHOAN FROM dangkycuthe WHERE ngay= '{$todayForDatabase}') AND tk.idTAIKHOAN IN (SELECT DISTINCT idTAIKHOAN FROM dangkycuthe WHERE ngay= '{$todayForDatabase}') AND tk.idTAIKHOAN= tttk.idTAIKHOAN"); if (isset($_POST['submit'])) { foreach ($data as $spe) { // lay ra nhung thong bao co thay doi // ghep lai ten cua check box $idtk = $spe['idTAIKHOAN']; $aidtk = "a" . $idtk; if (isset($_POST[$idtk])) { $db->editData("UPDATE dangkycuthe SET denAnThucTe= 0 WHERE idTAIKHOAN= {$idtk}"); } } $noti = "Thêm thành công các tài khoản không đến ăn ngày {$toda}..."; echo "<script type='text/javascript'>alert('{$noti}'); window.location= 'index.php';</script>"; }
<?php include_once $_SERVER['DOCUMENT_ROOT'] . "/ABC/model/connectDatabase.php"; include_once $_SERVER['DOCUMENT_ROOT'] . "/ABC/model/getDate.php"; // nhan ve va thay doi format cua ngay mai $d = new getDate(); $db = new PDOData(); $days = array(); $oneDayLater = $d->getTomorrowForPrint(); $twoDaysLater = $d->getNextDaysForPrint(2); $threeDaysLater = $d->getNextDaysForPrint(3); $fourDaysLater = $d->getNextDaysForPrint(4); $fiveDaysLater = $d->getNextDaysForPrint(5); $sixDaysLater = $d->getNextDaysForPrint(6); $sevenDaysLater = $d->getNextDaysForPrint(7); $selected = 0; $data = ""; // su kien nut random if (isset($_POST["change"]) && isset($_POST["randomButton"])) { $countt = 0; $dbArr1 = array(); $tempArr = $db->getData("SELECT idMONAN FROM monan WHERE idLOAIMONAN= 1"); $lengthOfArr1 = count($tempArr); foreach ($tempArr as $s1) { $dbArr1[$countt] = $s1['idMONAN']; $countt++; } $countt = 0; $dbArr2 = array(); $tempArr = $db->getData("SELECT * FROM monan WHERE idLOAIMONAN= 2"); $lengthOfArr2 = count($tempArr);
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "../../php/cashRegisterConfig.php"; require_once 'connect.php'; require_once 'class_getdate.php'; $gd = new getDate(); $beginDate = isset($_GET['startdate']) ? $_GET['startdate'] : ''; $endDate = isset($_GET['enddate']) ? $_GET['enddate'] : ''; $datesReturned = $gd->getDateHandler($beginDate, $endDate); $startDate = $datesReturned[0]; $stopDate = $datesReturned[1]; $sql = "select t1.pluID, sum(t1.amount) as sales, sum(t1.Tax) as taxAmount, t2.name as itemName from transaction as t1, department as t2 where t1.deptId=t2.id and (date BETWEEN \"{$startDate}\" AND \"{$stopDate}\") group by t1.deptId"; $result = mysql_query($sql); if (mysql_error() != "") { echo "Problem with query " . $sql . " error message is " . mysql_error(); quit; } ?> <!DOCTYPE html> <html> <head> <title>Virtual Cash Register Sales Report</title> <?php //include_once("meta.inc"); ?> </head> <body> <div data-role=page id="mainPage" data-theme="b"/>
<?php include_once $_SERVER['DOCUMENT_ROOT'] . "/ABC/model/connectDatabase.php"; include_once $_SERVER['DOCUMENT_ROOT'] . "/ABC/model/getDate.php"; // nhan ve va thay doi format cua ngay mai $d = new getDate(); // ket noi den csdl $db = new PDOData(); // cac bien danh cho su kien DANG KY // cac dong thong bao, trang thai ben trang nguoi dung $noti = ""; $state = "Đăng ký ăn"; $warn = ""; // bien su dung cho alert phan dang ky $menuDay = $d->getTomorrowForPrint(); // dayForRegisterDatabase de gan gia tri cua $_SESSION['dayForRegisterDatabase'] $dayForRegisterDatabase = $d->getTomorrowForDatabase(); $days = array(); $oneDayLater = $d->getTomorrowForPrint(); $twoDaysLater = $d->getNextDaysForPrint(2); $threeDaysLater = $d->getNextDaysForPrint(3); $fourDaysLater = $d->getNextDaysForPrint(4); $fiveDaysLater = $d->getNextDaysForPrint(5); $sixDaysLater = $d->getNextDaysForPrint(6); $sevenDaysLater = $d->getNextDaysForPrint(7); $selected = 0; $data = ""; // kiem tra xem nut duoc bam vao la nut nao if (isset($_GET['d'])) { // khoi dong lai session cho ajax session_start();
echo "<tr>"; echo "<th style= 'width:10%; text-align: left;'>STT</th>"; echo "<th style= 'width:25%; text-align: left;'>Ngày đăng ký</th>"; echo "<th style= 'width:25%; text-align: left;'>Giá tiền</th>"; echo "<th style= 'text-align: left;'>Đến ăn thực tế</th>"; echo "</tr>"; $bdk = 0; $bda = 0; $ddk = 0; foreach ($arr as $spe) { $day = $spe['day']; $month = $spe['month']; $year = $spe['year']; // lay ve ngay hien tai de so sanh xem ngay nao den an thuc te // ngay nao moi chi dang ky thoi, chua co du lieu cu the $d = new getDate(); $today = $d->getToday(); $todayD = date('d', $today); $todayM = date('m', $today); // hien thi ra xem do la ngay nao // chuyen sang int $dayInt = (int) $day; $monthInt = (int) $month; $todayDInt = (int) $todayD; $todayMInt = (int) $todayM; // gan mac dinh $datt = is_null($spe['denAnThucTe']) ? "Có" : "Không"; // kiem tra de co the co thay doi if ($monthInt === $todayMInt && $dayInt > $todayDInt) { $datt = "Chưa có dữ liệu"; $ddk++;