if ($contract['cancel_date'] == 0) { $expire = _CONTRACT_EXPIRE . ThaiDate::Full($contract['expire_date']); } elseif ($contract['cancel_date'] != 0 && $contract['cancel_date'] > time()) { $expire = _CONTRACT_EXPIRE . ThaiDate::Full($contract['cancel_date']); } else { $expire = _CONTRACT_CANCELED . ThaiDate::Full($contract['cancel_date']); } $name = explode(' ', $customer['fullname']); $text = _CONTRACT_PRINT_FIRSTNAME . $name[0] . _CONTRACT_PRINT_LASTNAME . $name[1] . _CONTRACT_PRINT_ADDRESS . $customer['address'] . _CONTRACT_PRINT_TELE . $customer['telephone']; $text .= '<br /> ' . _CONTRACT_PRINT_TEXT1; $idObject = $object['object_id']; while (strlen($idObject) < 3) { $idObject = '0' . $idObject; } $text .= '<br/><br/><span style="margin-left:35px;">' . _CONTRACT_PRINT_TEXT2 . $type['type_name'] . _CONTRACT_PRINT_IDOBJECT . $type['type_id'] . $idObject; $text .= _CONTRACT_PRINT_SIGNUP . ThaiDate::Mid($contract['signup_date']) . _CONTRACT_PRINT_TO . ThaiDate::Mid($contract['expire_date']) . _CONTRACT_PRINT_EXPIRE; $text .= _CONTRACT_PRINT_RENT . number_format($contract['cost'], 0) . _CONTRACT_PRINT_BAHT . _CONTRACT_PRINT_TEXT3; $text .= '</span><br/>'; $text .= '<span style="margin-left:35px;">' . _CONTRACT_PRINT_TEXT4 . '</span><br/>'; $text .= '<span style="margin-left:35px;">' . _CONTRACT_PRINT_TEXT5 . '</span><br/>'; $text .= '<span style="margin-left:35px;">' . _CONTRACT_PRINT_TEXT6 . '</span><br/>'; $text .= '<span style="margin-left:35px;">' . _CONTRACT_PRINT_TEXT7_1 . number_format($contract['deposite'], 0) . _CONTRACT_PRINT_TEXT7_2 . '</span><br/>'; $text .= '<span style="margin-left:35px;">' . _CONTRACT_PRINT_TEXT8 . '</span><br/>'; $text .= '<span style="margin-left:35px;">' . _CONTRACT_PRINT_TEXT9 . '</span><br/>'; $text .= '<span style="margin-left:35px;">' . _CONTRACT_PRINT_TEXT10 . '</span><br/>'; $text .= '<span style="margin-left:35px;">' . _CONTRACT_PRINT_TEXT11 . '</span><br/>'; $text .= '<span style="margin-left:35px;">' . _CONTRACT_PRINT_TEXT12 . '</span><br/>'; $data = array('id' => _CONTRACT_PASS . $contract['cus_id'] . $contract['object_id'] . $contract['emp_id'] . '-' . $contract['contract_id'], 'head' => _CONTRACT_PRINT_HEAD, 'singup' => _CONTRACT_TIME . ThaiDate::Full($contract['signup_date']), 'expire' => $expire, 'contract_type' => _CONTRACT_HEAD . $type['type_name'], 'text' => $text, 'personal' => _CONTRACT_PRINT_PERSONAL, 'own' => _CONTRACT_PRINT_OWN); $printButton = '<div style="position:fixed;top:10px;right:10px;"><input type="button" name="print" value="Print" onClick="javascript:window.print()"> <input type="button" name="close" value="Close" onClick="javascript:window.close()"></div>'; $content = site::Content('contract', $data);
<td width="80" align="center">เวลาที่สอบ</td> </tr> <?php foreach ($database->Query("SELECT * FROM exam WHERE type='E' AND finish_date>={$isTime};") as $exam) { $isLesson = $database->Query("SELECT * FROM lesson_unit WHERE unit_id='{$exam['unit_id']}' LIMIT 1;"); ?> <tr height="28"> <td><strong><span style="margin-left:5px;"><a href="do_exam.php?opt=<?php echo $exam['exam_id']; ?> ">หน่วยการเรียนรู้ที่ <?php echo $exam['unit_id'] . ' ' . $isLesson['unit_name']; ?> </a></span></strong></td> <td><?php echo ThaiDate::Mid($exam['start_date']); ?> </td> <td align="center"> <?php $isStartTime = getdate($exam['start_date']); $isFinsihTime = getdate($exam['finish_date']); if (strlen($isStartTime['hours']) == 1) { echo '0'; } echo $isStartTime['hours'] . '.'; if (strlen($isStartTime['minutes']) == 1) { echo '0'; } echo $isStartTime['minutes'] . ' - '; if (strlen($isFinsihTime['hours']) == 1) {
foreach ($database->Select('object_rental', array('type_id' => $type['type_id']), 0) as $object) { foreach ($database->Select('contract', array('object_id' => $object['object_id']), 0) as $contract) { $selectDate = explode('-', $key); $getDate = getdate($contract['cancel_date']); if ($selectDate[0] == $getDate['mon'] && $selectDate[1] == $getDate['year'] && $contract['canceled'] == 1) { $number++; $customer = $database->Value('customer', array('cus_id' => $contract['cus_id']), 0); $idObject = $contract['object_id']; while (strlen($idObject) < 3) { $idObject = '0' . $idObject; } $tableConteact .= '<tr><td>' . $number . '</td><td>' . $customer['fullname'] . '</td>'; $tableConteact .= '<td align="center">' . $contract['cus_id'] . $contract['object_id'] . $contract['emp_id'] . '-' . $contract['contract_id'] . '</td>'; $tableConteact .= '<td align="center">' . $type['type_id'] . $idObject . '</td>'; $tableConteact .= '<td>' . ThaiDate::Mid($contract['signup_date']) . '</td>'; $tableConteact .= '<td>' . ThaiDate::Mid($contract['expire_date']) . '</td>'; $tableConteact .= '</tr>'; } } } $tableConteact .= '</table>'; $data = array('head' => _CONTRACT_PRINT_HEAD, 'date' => _REPORT4_DATE . ThaiDate::Full(time()), 'report_type' => _REPORT1_HEAD1 . $type['type_name'] . _REPORT3_HEAD2 . $date, 'text' => $tableConteact, 'personal' => _REPORT_SIGN); $content = site::Content('report1', $data); $targetDirectory = "document/"; $fileName = 'report3_' . $type['type_id'] . '-' . $key . '.html'; $isFile = fopen($targetDirectory . $fileName, 'w'); fputs($isFile, $printButton); fputs($isFile, $content); fclose($isFile); } // Report 4
$beginPath = $database->Query("SELECT * FROM place WHERE place_id={$path['begin_id']} LIMIT 1"); $endPath = $database->Query("SELECT * FROM place WHERE place_id={$path['finish_id']} LIMIT 1"); ?> <table width="550" border="0" cellspacing="0" cellpadding="3"> <tr> <td width="20" align="right"> </td> <td width="250"><?php echo $beginPath['place'] . '-' . $endPath['place']; ?> </td> <td width="80" align="center">ที่นั่ง <?php echo $list['seat']; ?> </td> <td width="200"><?php echo ThaiDate::Mid($list['traveldate']); ?> </td> </tr> </table><?php $travel = $database->Query("SELECT * FROM travel WHERE travel_id={$list['travel_id']} LIMIT 1;"); $price += $travel['fare']; } ?> <hr width="550" align="left" /> <table width="550" border="0" cellspacing="0" cellpadding="3"> <tr> <td width="400" align="right"><strong>ราคารวม : </strong></td> <td width="50" align="right"><?php echo number_format($price, 2); ?>
<?php $database = new SyncDatabase(); foreach ($database->Query("SELECT * FROM old_list WHERE user_id={$_COOKIE['USER']} AND view=1;") as $list) { ?> <table align="center" width="550" border="0" cellspacing="0" cellpadding="2"> <tr> <td align="left" width="300"><a style="color:#900;" onclick="delOldList(<?php echo $list['old_id']; ?> )"><strong>x</strong></a> <?php echo ThaiDate::Mid($list['time']); ?> </td> <td align="center" width="170"><?php $path = $database->Query("SELECT * FROM path WHERE path_id=(SELECT path_id FROM travel WHERE travel_id={$list['travel_id']}) LIMIT 1"); $beginPath = $database->Query("SELECT * FROM place WHERE place_id={$path['begin_id']} LIMIT 1"); $endPath = $database->Query("SELECT * FROM place WHERE place_id={$path['finish_id']} LIMIT 1"); $car = $database->Query("SELECT * FROM car WHERE car_id=(SELECT car_id FROM travel WHERE travel_id={$list['travel_id']}) LIMIT 1"); echo $beginPath['place'] . '-' . $endPath['place']; ?> </td> <td align="center" width="80"><?php echo $car['regis']; ?> </td> </tr> </table><?php } ?> <table width="100%" align="center" border="0" cellspacing="0" cellpadding="10" style="border-top:#E6E6E6 solid 1px;">
} if ($colorRow % 2 == 0) { $style = 'style="background-color:#F7F7F7;"'; } else { $style = ''; } echo '<a href="?contract=edit&id=' . $contract['contract_id'] . '">'; echo '<table align="right" width="100%" border="0" cellspacing="0" cellpadding="3" id="list-user" ' . $style . '>'; echo '<tr style="height:30px" class="list-select">'; echo '<td align="right"><div style="width:100px;"><strong>' . $idContract . '</strong></div></td>'; echo '<td align="center"><div style="width:140px;">' . $customer['fullname'] . '</div></td>'; echo '<td align="center"><div style="width:50px;">' . $objectType['type_name'] . '</div></td>'; echo '<td align="right"><div style="width:80px;">' . number_format($contract['cost'], 2) . '</div></td>'; echo '<td align="right"><div style="width:80px;">' . number_format($costCharge, 2) . '</div></td>'; echo '<td align="right"><div style="width:120px;">' . ThaiDate::Mid($contract['signup_date']) . '</div></td>'; echo '<td align="right"><div style="width:120px;">' . ThaiDate::Mid($contract['expire_date']) . '</div></td>'; echo '<td align="center"><div style="width:20px;"><a href="?object=view&id=' . $contract['object_id'] . '">'; if ($contract['canceled'] != 1) { echo '<img src="images/thumbnail_large.gif" width="14" height="14" border="0" align="absmiddle" />'; } echo '</a></div></td></tr></table></a>'; $colorRow++; } if ($database->Count('contract', 0, 0) == 0) { echo '<table align="right" width="100%" border="0" cellspacing="0" cellpadding="3" id="list-user"><tr style="height:30px"><td align="center" align="center" colspan="8">'; echo '<strong>' . _REGISTER_NONE . '</strong>'; echo '</td></tr></table>'; } ?> </td> </tr>