File manager - Edit - /var/www/ams.cmtc.ac.th/pages/admin-dues-itemgroups.php
Back
<h2>กลุ่มรายการค่าธรรมเนียม</h2> <div align="right"><a href="?op=groups&module=select" 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_name=$_POST['fcost_name']; insert("NULL,'$fcost_name','0'","cost_name"); insert("NULL,'เพิ่มกลุ่มค่าธรรมเนียม : $fcost_name ','$today $time','$_SESSION[name]'","regis_system_log"); echo "<meta http-equiv=\"refresh\" content=\"1;url=?op=dues&module=itemgroups\">"; exit(); } if($_POST['action']=="del"){ echo "<center><img src=\"images/reload.gif\" width=\"48\" height=\"48\" alt=\"\"/><br>ลบกลุ่มค่าธรรมเนียมและรายการในกลุ่ม</center>"; $dcost_item_id=$_POST['dcost_name']; $dcost_id=$_POST['dcost_id']; delete("cost_name","where cost_id='$dcost_id'"); //ลบรายการค่าธรรเนียมในกลุ่มที่ลบ global $connect; $sql2="Select * From cost_item_list where cost_item_list.cost_id='$dcost_id' "; $db_query2=mysqli_query($connect,$sql2); $num_rows2=mysqli_num_rows($db_query2); /* นับ Reccord ที่พบ */ //echo "มีจำนวน <b>$num_rows2</b> รายการ"; $a2=0; while($a2 < $num_rows2) { $result2 = mysqli_fetch_array($db_query2); $id2=$result2['id']; delete("cost_item_list","where id='$id2'"); $a2++; } insert("NULL,'ลบกลุ่มค่าธรรมเนียม : $dcost_subject $dcost_var บาท','$today $time','$_SESSION[name]'","regis_system_log"); echo "<meta http-equiv=\"refresh\" content=\"1;url=?op=dues&module=itemgroups\">"; exit(); } ?> <?php global $connect; $sql="Select * From cost_name order by cost_id ASC"; $db_query=mysqli_query($connect,$sql); $num_rows=mysqli_num_rows($db_query); /* นับ Reccord ที่พบ */ echo "มีจำนวน <b>$num_rows</b> รายการ <font color=\"#9E0002\">คลิก ปุ่มรายละเอียด เพิ่มรายการค่าธรรมเนียมต่าง ๆ </font>"; ?> <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: 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_id=$result['cost_id']; $cost_name=$result['cost_name']; $cost_value=$result['cost_value']; $num_item=num_record("cost_item_list","where cost_id='$cost_id'"); //echo num_item; ?> <tr> <td align="center"><?php echo $a+1;?><a name="<?=$cost_id?>" id="<?=$cost_id?>"></a></td> <td> <?php if($_GET['id']==$cost_id){ echo"<i class=\"fa fa-check fa-2x\" aria-hidden=\"true\" style=\"color:green\"></i> ";} if($_GET['action']=='edit' and $_GET['id']==$cost_id) { echo "<form id=\"mform1\" name=\"mform1\" method=\"post\" action=\"\" >"; echo "<input name=\"fcost_name\" type=\"text\" id=\"fcost_name\" value=\"$cost_name\" class=\"form-control\" />"; } else { echo "$cost_name"; } ?></td> <td align="right"><?=$num_item?> รายการ</td> <td align="right"> <?php echo number_format($cost_value); echo " บาท"; ?> </td> <td><center> <?php if($_GET['action']=='edit' and $_GET['id']==$cost_id) { //echo $_POST['action']; if($_POST['action']=='edit'){ echo " <img src=\"images/reload.gif\" width=\"32\" alt=\"\"/> "; $fcost_name=$_POST['fcost_name']; $fcost_value=$_POST['fcost_value']; $id=$_POST['id']; update("cost_name","cost_name='$fcost_name' ","where cost_id ='$id' "); echo "<meta http-equiv=\"refresh\" content=\"1;url=?op=dues&module=itemgroups#$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_id\" />"; echo "</form>"; }else{ ?> <a href="?op=dues&module=itemgroups&action=edit&id=<?=$cost_id?>#<?=$cost_id?>" class="btn btn-sm btn-info" role="button"><i class="fa fa-pencil" aria-hidden="true"></i> แก้ไข</a><?php } ?> <a href="?op=dues&module=itemgroups&detail=show&id=<?=$cost_id?>#data" class="btn btn-sm btn-primary" role="button"><i class="fa fa-list-ol" aria-hidden="true"></i> รายละเอียด</a> <?php echo"<a data-id=\"$cost_id\" class=\"open-AddBookDialog btn btn-danger btn-sm\" data-toggle=\"modal\" data-target=\"#myModalDel$cost_id\" onclick=\"setval($cost_id);\"><i class=\"fa fa-trash\" aria-hidden=\"true\"></i> ลบ</a>"; ?></center> </td> </tr> <!-- The Modal --> <div class="modal fade" id="myModalDel<?=$cost_id?>"> <div class="modal-dialog modal-xl"> <div class="modal-content"> <!-- Modal Header --> <div class="modal-header"> <h5 class="modal-title">ยืนยันการลบรายการ <?php echo "<h4>กลุ่ม : $cost_name ($cost_value บาท)</h4>"; ?></h5> <button type="button" class="close" data-dismiss="modal">×</button> </div> <form action="?op=dues&module=itemgroups" method="post" > <!-- Modal body --> <div class="modal-body"> <?php global $connect; $sql2="Select * From cost_item_list,cost_item where cost_item_list.cost_id='$cost_id' and cost_item_list.cost_item_id=cost_item.cost_item_id order by cost_item_list.id ASC"; $db_query2=mysqli_query($connect,$sql2); $num_rows2=mysqli_num_rows($db_query2); /* นับ Reccord ที่พบ */ echo "มีจำนวน <b>$num_rows2</b> รายการ"; $a2=0; echo "<ui>"; while($a2 < $num_rows2) { $result2 = mysqli_fetch_array($db_query2); $cost_item_id2=$result2['cost_item_id']; $cost_subject2=$result2['cost_subject']; $cost_var2=$result2['cost_var']; echo "<li>$cost_subject2 $cost_var2 บาท</li>"; $a2++; } echo "</ui>"; echo "<div class=\"alert alert-warning\"> <strong>Warning!</strong> เมื่อลบกลุ่ม รายการจะถูกลบออกทั้งหมด. </div>"; ?> </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_name" type="hidden" id="dcost_name" value="<?=$cost_name?>"> <input name="dcost_id" type="hidden" id="dcost_id" value="<?=$cost_id?>"> </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=itemgroups" method="post" > <!-- 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="fcost_name">ชื่อกลุ่ม:</label> <input name="fcost_name" type="text" required="required" class="form-control" id="fcost_name" 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> <a name="data" id="data"></a> <?php if($_GET['detail']=="show"){ //echo $_GET['detail']; include("admin-dues-item-show.php"); } ?> </div>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.7 |
proxy
|
phpinfo
|
Settings