File manager - Edit - /var/www/ams.cmtc.ac.th/pages/admin-dues-item.php
Back
<h2>รายการค่าธรรมเนียม</h2> <div align="right"><a href="?op=dues&module=itemgroups" class="btn btn-secondary" role="button"><i class="fa fa-share" aria-hidden="true"></i> ขั้นตอนต่อไป</a> </div> <p>รายการค่าธรรมเนียมทั้งหมดที่จะใช้ในการเรียกเก็บค่าธรรมเนียมจากนักเรียน นักศึกษา ทั้งหมด</p> <div align="right"><button type="button" class="btn btn-success " id="myBtnAdd"><i class="fa fa-plus" aria-hidden="true"></i> เพิ่มรายการ</button></div> <?php $action=$_POST['action']; //echo "action=$action<br>"; if($_POST['action']=="add"){ //echo "<center><img src=\"images/reload.gif\" width=\"48\" height=\"48\" alt=\"\"/><br>บันทึกข้อมูล</center>"; $fcost_subject=$_POST['fcost_subject']; $fcost_var=$_POST['fcost_var']; //echo "$fcost_subject $fcost_var"; insert("NULL,'$fcost_subject','$fcost_var'","cost_item"); insert("NULL,'เพิ่มรายการค่าธรรมเนียม : $fcost_subject $fcost_var บาท','$today $time','$_SESSION[name]'","regis_system_log"); echo "<meta http-equiv=\"refresh\" content=\"0;url=?op=dues&module=item\">"; exit(); } if($_POST['action']=="del"){ global $connect; //echo "<center><img src=\"images/reload.gif\" width=\"48\" height=\"48\" alt=\"\"/><br>บันทึกข้อมูล</center>"; $dcost_item_id=$_POST['dcost_item_id']; $dcost_subject=$_POST['dcost_subject']; $dcost_var=$_POST['dcost_var']; delete("cost_item","where cost_item_id='$dcost_item_id'"); insert("NULL,'ลบรายการค่าธรรมเนียม : $dcost_subject $dcost_var บาท','$today $time','$_SESSION[name]'","regis_system_log"); echo "<meta http-equiv=\"refresh\" content=\"0;url=?op=dues&module=item\">"; exit(); } ?> <?php global $connect; $sql="Select * From cost_item order by cost_item_id ASC"; $db_query=mysqli_query($connect,$sql); $num_rows=mysqli_num_rows($db_query); /* นับ Reccord ที่พบ */ echo "มีจำนวน <b>$num_rows</b> รายการ"; ?> <table class="table table-hover table-striped table-condensed table-sm"> <thead> <tr> <th><center>#</center></th> <th>รายการ</th> <th style="text-align: right">ค่าธรรมเนียม</th> <th style="text-align: center">จัดการข้อมูล</th> </tr> </thead> <tbody> <?php $a=0; while($a < $num_rows) { $result = mysqli_fetch_array($db_query); $cost_item_id=$result['cost_item_id']; $cost_subject=$result['cost_subject']; $cost_var=$result['cost_var']; ?> <tr> <td align="center"><?php echo $a+1;?><a name="d<?=$cost_item_id?>" id="d<?=$cost_item_id?>"></a></td> <td> <?php if($_GET['action']=='edit' and $_GET['id']==$cost_item_id) { echo "<form id=\"mform1\" name=\"mform1\" method=\"post\" action=\"\" >"; echo "<input name=\"fcost_subject\" type=\"text\" id=\"fcost_subject\" value=\"$cost_subject\" class=\"form-control\" />"; } else { echo "$cost_subject"; } ?></td> <td align="right"> <?php if($_GET['action']=='edit' and $_GET['id']==$cost_item_id) { echo "<input name=\"fcost_var\" type=\"text\" id=\"fcost_var\" value=\"$cost_var\" class=\"form-control\" size=\"2\" />"; } else { echo number_format($cost_var); } ?> </td> <td><center> <?php if($_GET['action']=='edit' and $_GET['id']==$cost_item_id) { //echo $_POST['action']; if($_POST['action']=='edit'){ echo " <img src=\"images/reload.gif\" width=\"32\" alt=\"\"/> "; $fcost_subject=$_POST['fcost_subject']; $fcost_var=$_POST['fcost_var']; $id=$_POST['id']; update("cost_item","cost_subject='$fcost_subject',cost_var='$fcost_var' ","where cost_item_id ='$id' "); echo "<meta http-equiv=\"refresh\" content=\"1;url=?op=dues&module=item#d$id\">"; }else{ echo "<button type=\"submit\" class=\"btn btn-sm btn-success\" id=\"btnSave\" ><i class=\"fa fa-save fa-fw\"></i> บันทึก</button>"; } echo "<input name=\"action\" type=\"hidden\" id=\"action\" value=\"edit\" />"; echo "<input name=\"id\" type=\"hidden\" id=\"id\" value=\"$cost_item_id\" />"; echo "</form>"; }else{ ?> <a href="?op=dues&module=item&action=edit&id=<?=$cost_item_id?>#d<?=$cost_item_id?>" class="btn btn-sm btn-info" role="button"><i class="fa fa-pencil" aria-hidden="true"></i> แก้ไข</a><?php } ?> <?php echo"<a data-id=\"$cost_item_id\" class=\"open-AddBookDialog btn btn-danger btn-sm\" data-toggle=\"modal\" data-target=\"#myModalDel$cost_item_id\" onclick=\"setval($cost_item_id);\"><i class=\"fa fa-trash\" aria-hidden=\"true\"></i> ลบ</a>"; ?></center> </td> </tr> <!-- The Modal --> <div class="modal fade" id="myModalDel<?=$cost_item_id?>"> <div class="modal-dialog modal-xl"> <div class="modal-content"> <!-- Modal Header --> <div class="modal-header"> <h5 class="modal-title">ยืนยันการลบรายการ ?</h5> <button type="button" class="close" data-dismiss="modal">×</button> </div> <form action="?op=dues&module=item" method="post" > <!-- Modal body --> <div class="modal-body"> <?php echo "[$cost_item_id] $cost_subject $cost_var บาท"; ?> </div> <!-- Modal footer --> <div class="modal-footer"> <button type="submit" class="btn btn-danger" id="btnDel" ><i class="fa fa-trash" aria-hidden="true"></i> ลบรายการ</button> <button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-reply" aria-hidden="true"></i> ยกเลิก</button> <input name="action" type="hidden" id="action" value="del"> <input name="dcost_subject" type="hidden" id="dcost_subject" value="<?=$cost_subject?>"> <input name="dcost_item_id" type="hidden" id="dcost_item_id" value="<?=$cost_item_id?>"> <input name="dcost_var" type="hidden" id="dcost_var" value="<?=$cost_var?>"> </div> </form> </div> </div> </div> <!-- end --> <?php $a++; } ?> </tbody> </table> <!-- Modal --> <div class="modal fade" id="myModalAdd" role="dialog" align="left"> <div class="modal-dialog modal-lg"> <form action="?op=dues&module=item" method="post" enctype="multipart/form-data" > <!-- Modal content--> <div class="modal-content" > <div class="modal-header" align="left"> <h4 class="modal-title" align="left">เพิ่มรายการ</h4> </div> <div class="modal-body"> <div class="form-group"> <label for="cost_subject">ชื่อรายการ:</label> <input name="fcost_subject" type="text" required="required" class="form-control" id="fcost_subject" placeholder="ชื่อรายการ"> </div> <div class="form-group"> <label for="fcost_var">ค่าธรรมเนียม:</label> <input name="fcost_var" type="text" required="required" class="form-control" id="fcost_var" placeholder="ตัวเลข"> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-success" id="btnAdd" ><i class="fa fa-save fa-fw"></i> บันทึกรายการ</button> <input name="action" type="hidden" id="action" value="add"> <button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-reply" aria-hidden="true"></i> ยกเลิกรายการ</button> </div> </div> </form> </div> </div> <script> $(document).ready(function(){ $("#myBtnAdd").click(function(){ $("#myModalAdd").modal(); }); }); </script>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.4 |
proxy
|
phpinfo
|
Settings