Created
February 26, 2015 18:17
-
-
Save backy22/b5b09c658f24a2fa63cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set('display_errors', 1); | |
$ym=isset($_GET['ym']) ? $_GET['ym'] : date("Y-m"); | |
$timeStamp=strtotime($ym . "-01"); | |
if ($timeStamp===false){ | |
$timeStamp=time(); | |
} | |
$month=date("m",$timeStamp); | |
$nen=date("Y",$timeStamp); | |
/*当月以外へのリンク*/ | |
$prev=date("Y-m",mktime(0,0,0,date("m",$timeStamp)-1,1,date("Y",$timeStamp))); | |
$next=date("Y-m",mktime(0,0,0,date("m",$timeStamp)+1,1,date("Y",$timeStamp))); | |
$lastDay=date("t", $timeStamp); | |
/* dialogformのdata取得 */ | |
$dataArray = array(); | |
$dataFile = 'ss.dat'; | |
$fp = fopen($dataFile, "r"); | |
while (($dataRow = fgetcsv($fp, 0, ",")) !== FALSE) { | |
$dataArray[] = $dataRow; | |
} | |
fclose($fp); | |
// print_r($dataArray); | |
/*dialogform1のdata取得*/ | |
$dataArray1 = array(); | |
$dataFile1 = 'cc.dat'; | |
$fp1 = fopen($dataFile1, "r"); | |
while (($dataRow1 = fgetcsv($fp1, 0, ",")) !== FALSE) { | |
$dataArray1[] = $dataRow1; | |
} | |
// print_r($dataArray1); | |
fclose($fp1); | |
?> | |
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="utf-8"> | |
<title>AirBnB運営管理</title> | |
<link href="jquery-ui.min.css" rel="stylesheet"> | |
<script src="jquery.js"></script> | |
<script src="jquery-ui.min.js"></script> | |
<script> | |
$(function(){ | |
$("#selectable").selectable(); | |
}); | |
</script> | |
<link href="hello.css" rel="stylesheet"> | |
</head> | |
<body> | |
<div id="menu">Kiyoshi's team</div> | |
<table> | |
<thead> | |
<tr> | |
<th><a href="?ym=<?php echo $prev; ?>">«</a></th> | |
<th><?php | |
echo date("Y",$timeStamp)."年".date("m",$timeStamp)."月"; | |
?> | |
</th> | |
<th><a href="?ym=<?php echo $next; ?>">»</a></th> | |
</tr> | |
/<thead> | |
</table> | |
<?php | |
$house[1]="根津"; | |
$house[2]="渋谷"; | |
$house[3]="外苑前"; | |
$house[4]="神楽坂"; | |
?> | |
<?php for($i=1;$i<=4;$i++):?> | |
<table class="tablex"> | |
<caption><?php echo "{$house[$i]}"; ?></caption> | |
<?php | |
$dan = 'dan' . $i; | |
?> | |
<tr> | |
<th>日付</th> | |
<?php | |
for ($day=1; $day<=$lastDay; $day++){ | |
echo "<td class=\"date\">$day</td>"; | |
} | |
?> | |
<td class="cell1">コインランドリー代</td> | |
<td class="cell2">立替費用</td> | |
<td class="cell3">計</td> | |
</tr> | |
<tr> | |
<th>ゲスト</th> | |
<?php | |
for ($day=1; $day<=$lastDay; $day++){ | |
$isEmpty=TRUE; | |
foreach($dataArray1 as $eachData1){ | |
$eachDataA1 = strtotime("$eachData1[3]"); | |
$eachDataA2 = strtotime("$eachData1[4]"); | |
$currentUnixTime = strtotime("$nen-$month-$day"); | |
if( | |
$house[$i] == $eachData1[0] and | |
// eachData1を分割したもの→年が[0]で月が[1]で日が[2 | |
// ] | |
$currentUnixTime >= $eachDataA1 and | |
$currentUnixTime <= $eachDataA2 | |
){ | |
$cleandate="$nen-$month-$day"; | |
echo "<td bgcolor=\"#CCFFFF\" class=\"open1\" data-dan=\"$dan\" data-cleandate=\"$cleandate\"></td>"; | |
$isEmpty = FALSE; | |
break; | |
} | |
} | |
if($isEmpty){ | |
$cleandate="$nen-$month-$day"; | |
echo "<td class=\"open1\" data-dan=\"$dan\" data-cleandate=\"$cleandate\"></td>"; | |
} | |
} | |
?> | |
<td></td><td></td><td></td> | |
</tr> | |
<?php | |
$staff[1]="梅木"; | |
$staff[2]="太田"; | |
$staff[3]="峰"; | |
$staff[4]="新井"; | |
?> | |
<?php for($j=1;$j<=4;$j++):?> | |
<tr> | |
<th><?php echo "{$staff[$j]}"; ?></th> | |
<?php | |
for ($day=1; $day<=$lastDay; $day++){ | |
$isEmpty = TRUE; | |
$row = 'row' . $j; | |
foreach($dataArray as $eachData){ | |
$eachDateArray = explode("-", $eachData[0]); | |
if( | |
$house[$i] == $eachData[1] and | |
$staff[$j] == $eachData[2] and | |
$nen == $eachDateArray[0] and | |
$month == $eachDateArray[1] and | |
$day == $eachDateArray[2] | |
){ | |
$cleandate="$nen-$month-$day"; | |
echo "<td class=\"open\" data-dan=\"$dan\" data-row=\"$row\" data-cleandate=\"$cleandate\">◯</td>"; | |
$isEmpty = FALSE; | |
break; | |
} | |
} | |
if($isEmpty){ | |
$cleandate="$nen-$month-$day"; | |
echo "<td class=\"open\" data-dan=\"$dan\" data-row=\"$row\" data-cleandate=\"$cleandate\"></td>"; | |
} | |
} | |
?> | |
<td> | |
<!-- コインランドリー代の合計値出す --> | |
<?php | |
$sum=0; | |
$timeStamp=strtotime($ym . "-01"); | |
$lastDay=date("t", $timeStamp); | |
foreach($dataArray as $eachData){ | |
$eachDataB = strtotime("$eachData[0]"); | |
$currentUnixTimeB1 = strtotime("$nen-$month-1"); | |
$currentUnixTimeB2 = strtotime("$nen-$month-$lastDay"); | |
if( | |
$currentUnixTimeB1 <= $eachDataB and | |
$currentUnixTimeB2 >= $eachDataB and | |
$house[$i] == $eachData[1] and | |
$staff[$j] == $eachData[2] ) | |
$sum+=$eachData[3];} | |
echo $sum; | |
?> | |
</td> | |
<!-- 立替費用の合計値出す --> | |
<td> | |
<?php | |
$sum=0; | |
foreach($dataArray as $eachData){ | |
$eachDataB = strtotime("$eachData[0]"); | |
$currentUnixTimeB1 = strtotime("$nen-$month-1"); | |
$currentUnixTimeB2 = strtotime("$nen-$month-$lastDay"); | |
if( | |
$currentUnixTimeB1 <= $eachDataB and | |
$currentUnixTimeB2 >= $eachDataB and | |
$house[$i] == $eachData[1] and | |
$staff[$j] == $eachData[2] ) | |
$sum+=$eachData[4];} | |
echo $sum; | |
?> | |
</td> | |
<!-- 計欄の合計値出す --> | |
<td> | |
<?php | |
$sum=0; | |
foreach($dataArray as $eachData){ | |
$eachDataB = strtotime("$eachData[0]"); | |
$currentUnixTimeB1 = strtotime("$nen-$month-1"); | |
$currentUnixTimeB2 = strtotime("$nen-$month-$lastDay"); | |
if( | |
$currentUnixTimeB1 <= $eachDataB and | |
$currentUnixTimeB2 >= $eachDataB and | |
$house[$i] == $eachData[1] and | |
$staff[$j] == $eachData[2] | |
){ | |
$sum+=$eachData[3]+=$eachData[4]; | |
} | |
} | |
echo $sum; | |
?> | |
</td> | |
</tr> | |
<?php endfor;?> | |
</table> | |
<?php endfor;?> | |
<script type="text/javascript" src="hello.js"></script> | |
<div id="dialog-form" title="登録"> | |
<form action="/register.php" method="post"> | |
<table id="form" class="sample"> | |
<tr> | |
<td class="header">日程</td> | |
<td><input class="nittei" type="date" id="cleandate" name="cleandate" value=""></td> | |
<tr> | |
<td class="header">物件名</td> | |
<td><input id="userhouse" type="text" name="userhouse" value="" size="10" maxlength="6"></td> | |
</tr> | |
<tr> | |
<td class="header">名前</td> | |
<td><input id="userid" type="text" name="userid" value="" size="13" maxlength="8"></td> | |
</tr> | |
<tr> | |
<!-- <td class="header">時間</td> | |
<td><input type="time" min="00:00" max="23:00" step="360" id="name" name="name" value=""/></td> | |
<td>~</td> | |
<td><input type="time" min="00:00" max="23:00" step="360" id="name" name="name" value=""/></td> --> | |
</tr> | |
<tr> | |
<td class="header">コインランドリー代</td> | |
<td><input type="text" id="coinlaundry" name="coinlaundry" value="" size="20" maxlength="50"></td> | |
<td>円</td> | |
</tr> | |
<tr> | |
<td class="header">立替費用</td> | |
<td><input type="text" id="cost" name="cost" | |
value="" size="13" maxlength="13"></td> | |
<td>円</td> | |
</tr> | |
</table> | |
</form> | |
</div> | |
<script type="text/javascript" src="hello1.js"></script> | |
<div id="dialog-form1" title="登録"> | |
<form action="/guestdata.php" method="post"> | |
<table id="form1" class="sample"> | |
<tr> | |
<td class="header">物件名</td> | |
<td><input id="userhouse1" type="hidden" name="userhouse1" value="" size="10" maxlength="6"><label id="userhouse1label"></label></td> | |
</tr> | |
<tr> | |
<td class="header">名前</td> | |
<td><input type="text" id="guestname" name="guestname" value="" size="10" maxlength="10"></td> | |
</tr> | |
<tr> | |
<td class="header">人数</td> | |
<td><input type="text" id="people" name="people" | |
value="" size="10" maxlength="25"></td> | |
<td>人</td> | |
</tr> | |
<tr> | |
<td class="header">日程</td> | |
<td><input class="nittei" type="date" id="stay1" name="stay1" value=""></td> | |
<td>〜</td> | |
<td><input class="nittei" type="date" id="stay2" name="stay2" value=""></td> | |
</tr> | |
</table> | |
</form> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment