Skip to content

Instantly share code, notes, and snippets.

@backy22
Created February 23, 2015 19:37
Show Gist options
  • Save backy22/e7a074539d807fc0f1c9 to your computer and use it in GitHub Desktop.
Save backy22/e7a074539d807fc0f1c9 to your computer and use it in GitHub Desktop.
<?php
ini_set('display_errors', 1);
/* data取得 */
$dataArray = array();
$dataFile = 'ss.dat';
$fp = fopen($dataFile, "r");
while (($dataRow = fgetcsv($fp, 0, ",")) !== FALSE) {
$dataArray[] = $dataRow;
}
fclose($fp);
$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>
<p id="title_month">2015年2月</p>
<?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
$y = date("Y");
$m = date("n");
$d = 1;
while (checkdate($m, $d, $y)) {
echo "<td class=\"date\">$d</td>";
$d++;
}
?>
<td class="cell1">コインランドリー代</td>
<td class="cell2">立替費用</td>
<td class="cell3">計</td>
</tr>
<tr>
<th>ゲスト</th>
<?php
$y = date("Y");
$m = date("n");
$d = 1;
while (checkdate($m, $d, $y)) {
echo "<td class=\"open1\" data-dan=\"$dan\"></td>";
$d++;
}
?>
<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
$y = date("Y");
$m = date("n");
$d = 1;
while (checkdate($m, $d, $y)) {
/* $house, $staff, $dが一致したら◯を出力 */
$isEmpty = TRUE;
$row = 'row' . $j;
foreach($dataArray as $eachData){
$eachDateArray = explode("-", $eachData[0]);
if(
$house[$i] == $eachData[1] and
$staff[$j] == $eachData[2] and
$d == $eachDateArray[2]
){
echo "<td class=\"open\" data-dan=\"$dan\" data-row=\"$row\">◯</td>";
$isEmpty = FALSE;
break;
}
}
if($isEmpty){
echo "<td class=\"open\" data-dan=\"$dan\" data-row=\"$row\"></td>";
}
$d++;
}
?>
<td>
<?php
$sum=0;
foreach($dataArray as $eachData){
if(
$house[$i] == $eachData[1] and
$staff[$j] == $eachData[2] )
$sum+=$eachData[3];}
echo $sum;
?>
</td>
<td>
<?php
$sum=0;
foreach($dataArray as $eachData){
if(
$house[$i] == $eachData[1] and
$staff[$j] == $eachData[2] )
$sum+=$eachData[4];}
echo $sum;
?>
</td>
<td>
<?php
$sum=0;
foreach($dataArray as $eachData){
if(
$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="text" name="userhouse1" value="" size="10" maxlength="6"></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