/
home
/
efamember
/
domains
/
efa-member.com
/
public_html
/
backoffice
/
up file
home
<?php include('header.php'); $datenow = date('d/m/Y'); $date_1month = date('d/m/Y', strtotime($now . "-1 months")); ?> <style> .modal { overflow: auto !important; } </style> <body class="top-navigation"> <div id="wrapper" class=""> <div id="page-wrapper" class="gray-bg shadow-sm rounded"> <div class="wrapper wrapper-content animated fadeInRight"> <div class="ibox"> <div class="ibox-title"> <div class="row"> <div class="col-lg-9 mb-2 ml-4"> ใบเสร็จรับเงิน </div> <div class="ibox-tools"> <button type="button" class="btn btn-info btn-sm " onclick="GetModalNewReceipt()"><i class="fa fa-plus"></i> เพิ่มใบเสร็จ</button> <button type="button" class="btn btn-primary btn-sm " onclick="ExportReceipt()"><i class="fa fa-print"></i> Excel</button> </div> </div> </div> <div class="ibox-title"> <div class="row ml-3"> <div class="col-lg-2"> <div class="form-group"> <div class="form-group" id="data_1"> <label class="font-normal">ตั้งแต่</label> <div class="input-group date"> <span class="input-group-addon"><i class="fa fa-calendar"></i></span> <input type="input" class="form-control datepicker" value="<?php echo $date_1month ?>" name="date_start" id="date_start" autocomplete="off"> </div> </div> </div> </div> <div class="col-lg-2"> <div class="form-group"> <div class="form-group" id="data_1"> <label class="font-normal">ถึง</label> <div class="input-group date"> <span class="input-group-addon"><i class="fa fa-calendar"></i></span> <input type="input" class="form-control datepicker" value="<?php echo $datenow ?>" name="date_end" id="date_end" autocomplete="off"> </div> </div> </div> </div> <div class="col-lg-2"> <div class="form-group"> <label class="font-">ระดับ</label> <div class="input-group"> <select class="form-select" id="level" style="width: 100%;"> <option value="x">ทั้งหมด</option> <option value="g9k1s">ทั่วไป</option> <option value="kki22">วิสามัญ</option> <option value="x9fkq">สามัญ</option> </select> </div> </div> </div> <div class="col-lg-2"> <div class="form-group"> <label class="font-">ประเภท</label> <div class="input-group"> <select class="form-select" id="type" style="width: 100%;"> <option value="x">ทั้งหมด</option> <option value="1">นายจ้าง</option> <option value="2">บนจ.</option> <option value="3">Agency</option> <option value="4">แรงงาน</option> </select> </div> </div> </div> <div class="col-lg-2"> <div class="form-group"> <div class="input-group mt-4"> <button type="button" class="btn btn-primary btn-sm w-100 mt-1" onclick="load_table()"><i class="fa fa-search"></i> ค้นหา</button> </div> </div> </div> </div> </div> <div class="ibox-content"> <!----- ตาราง ----> <div id="Loading"> <div class="spiner-example"> <div class="sk-spinner sk-spinner-wave"> <div class="sk-rect1"></div> <div class="sk-rect2"></div> <div class="sk-rect3"></div> <div class="sk-rect4"></div> <div class="sk-rect5"></div> </div> </div> </div> <div id="show_table"></div> <!----- ตาราง ----> </div> </div> </div> </div> </div> <!--- init layout --> <?php include('footer.php'); ?> <div class="modal fade" id="myModal" role="dialog" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content animated fadeIn"> <div class="modal-content"> <div id="showModal"></div> </div> </div> </div> </div> <div class="modal hide fade in" id="myModal2" role="dialog" data-keyboard="false" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered modal-lg" role="document"> <div class="modal-content"> <div id="showModal2"></div> </div> </div> </div> <div class="modal fade" id="myModalPrint" role="dialog" aria-hidden="true"> <div class="modal-dialog modal-md modal-dialog-centered"> <div class="modal-content animated fadeIn"> <div id="showModalPrint"></div> </div> </div> </div> <script> $(document).ready(function() { load_table(); $(".form-select").select2(); }); function load_table() { $('#show_table').hide(); $('#Loading').show(); let type = $("#type").val(); let level = $("#level").val(); let search = $("#search").val(); let date_start = $("#date_start").val(); let date_end = $("#date_end").val(); $.ajax({ type: 'POST', url: 'ajax/account_receipt/get_table_receipt.php', data: { type: type, level: level, search: search, date_start: date_start, date_end: date_end }, dataType: 'html', success: function(response) { $('#show_table').html(response); $('.dataTables-example').DataTable({ ordering: false, pageLength: 50, responsive: true, }); $('#show_table').show(); $('#Loading').hide(); } }); } function GetModalReceiptGroup() { $("#myModal").modal("show"); $("#showModal").load("ajax/account_receipt/modal_receipt_group.php"); } function GetModalNewReceipt() { $("#myModal").modal("show"); $("#showModal").load("ajax/account_receipt/modal_new_receipt.php"); } $.extend({ redirectPost: function(location, args) { let form = ''; $.each(args, function(key, value) { form += '<input type="hidden" name="' + key + '" value="' + value + '">'; }); $('<form action="' + location + '" method="POST">' + form + '</form>').appendTo('body') .submit(); } }); function ExportReceipt() { let type = $("#type").val(); let level = $("#level").val(); let date_start = $("#date_start").val(); let date_end = $("#date_end").val(); let redirect = 'ajax/account_receipt/export_receipt_list.php'; $.redirectPost(redirect, { type: type, level: level, date_start: date_start, date_end: date_end, }); } function GetModalMenber() { let member_name = $("#member_name").val(); if (member_name == '') { swal({ title: 'กรุณากรอกชื่อลูกค้า', text: '', type: 'warning', showConfirmButton: false, timer: 1500 }); return false; } $("#myModal2").modal("show"); $("#showModal2").load("ajax/account_receipt/modal_member_list.php", { member_name: member_name }, function() { $('.dataTables-example2').DataTable({ ordering: false, pageLength: 25, responsive: true, }); }); } function SubmitNewReceipt() { let receipt_date = $("#receipt_date").val(); if (receipt_date == '') { swal({ title: 'กรุณากรอกวันที่ออกใบเสร็จ', text: '', type: 'warning', showConfirmButton: false, timer: 1500 }); return false; } swal({ title: 'กรุณายืนยันเพื่อทำรายการ', type: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', cancelButtonText: 'ยกเลิก', confirmButtonText: 'ยืนยัน', closeOnConfirm: false }, function() { var formData = new FormData($("#frm_newReceipt")[0]); let admin_id = localStorage.getItem('admin_id') formData.append('create_user_id', admin_id); $.ajax({ type: "POST", url: "ajax/account_receipt/add_receipt.php", data: formData, cache: false, contentType: false, processData: false, dataType: "json", success: function(data) { if (data.result == 1) { swal({ title: 'บันทึกข้อมูลสำเร็จ', type: 'success', showConfirmButton: false, timer: 1500 }, function() { swal.close(); load_table(); $("#myModal").modal('hide'); }); } else if (data.result == 0) { swal({ title: 'แจ้งเตือน', text: 'เกิดข้อผิดพลาดระหว่างบันทึก กรุณาลองใหม่อีกครั้ง', type: 'warning', showConfirmButton: false, timer: 1500 }); } else if (data.result == 9) { swal({ title: 'แจ้งเตือน', text: 'ไม่สามารถติดต่อเซิฟเวอร์ได้ กรุณาลองใหม่อีกครั้ง', type: 'warning', showConfirmButton: false, timer: 1500 }); } }, error: function(jqXHR, exception) { var msg = ''; if (jqXHR.status === 0) { msg = 'Not connect. Verify Network.'; } else if (jqXHR.status == 404) { msg = 'Requested page not found. [404]'; } else if (jqXHR.status == 500) { msg = 'Internal Server Error [500].'; } else if (exception === 'parsererror') { msg = 'Requested JSON parse failed.'; } else if (exception === 'timeout') { msg = 'Time out error.'; } else if (exception === 'abort') { msg = 'Ajax request aborted.'; } else { msg = 'Uncaught Error. ' + jqXHR.responseText; } swal({ title: "แจ้งเตือน", text: "พบปัญหาการบันทึก กรุณาติดต่อผู้ดูแลระบบ" + msg, type: "error", showConfirmButton: true }); } }); }) } function GetModalEditHead(receipt_id) { $("#myModal").modal("show"); $("#showModal").load("ajax/account_receipt/modal_edit_head.php", { receipt_id: receipt_id }); } function SubmitEditReceipt() { let receipt_date = $("#receipt_date").val(); if (receipt_date == '') { swal({ title: 'กรุณากรอกวันที่ออกใบเสร็จ', text: '', type: 'warning', showConfirmButton: false, timer: 1500 }); return false; } swal({ title: 'กรุณายืนยันเพื่อทำรายการ', type: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', cancelButtonText: 'ยกเลิก', confirmButtonText: 'ยืนยัน', closeOnConfirm: false }, function() { var formData = new FormData($("#frm_editReceipt")[0]); let admin_id = localStorage.getItem('admin_id') formData.append('create_user_id', admin_id); $.ajax({ type: "POST", url: "ajax/account_receipt/edit_receipt.php", data: formData, cache: false, contentType: false, processData: false, dataType: "json", success: function(data) { if (data.result == 1) { swal({ title: 'บันทึกข้อมูลสำเร็จ', type: 'success', showConfirmButton: false, timer: 1500 }, function() { swal.close(); load_table(); $("#myModal").modal('hide'); }); } else if (data.result == 0) { swal({ title: 'แจ้งเตือน', text: 'เกิดข้อผิดพลาดระหว่างบันทึก กรุณาลองใหม่อีกครั้ง', type: 'warning', showConfirmButton: false, timer: 1500 }); } else if (data.result == 9) { swal({ title: 'แจ้งเตือน', text: 'ไม่สามารถติดต่อเซิฟเวอร์ได้ กรุณาลองใหม่อีกครั้ง', type: 'warning', showConfirmButton: false, timer: 1500 }); } }, error: function(jqXHR, exception) { var msg = ''; if (jqXHR.status === 0) { msg = 'Not connect. Verify Network.'; } else if (jqXHR.status == 404) { msg = 'Requested page not found. [404]'; } else if (jqXHR.status == 500) { msg = 'Internal Server Error [500].'; } else if (exception === 'parsererror') { msg = 'Requested JSON parse failed.'; } else if (exception === 'timeout') { msg = 'Time out error.'; } else if (exception === 'abort') { msg = 'Ajax request aborted.'; } else { msg = 'Uncaught Error. ' + jqXHR.responseText; } swal({ title: "แจ้งเตือน", text: "พบปัญหาการบันทึก กรุณาติดต่อผู้ดูแลระบบ" + msg, type: "error", showConfirmButton: true }); } }); }) } function ModalPrint(receipt_id) { $("#myModalPrint").modal("show"); $("#showModalPrint").load("ajax/account_receipt_view/modal_print.php", { receipt_id: receipt_id }); } function RecriptPrint(receipt_id) { let manuscript = 0; if ($('#manuscript').is(":checked")) { manuscript = $("#manuscript").val(); } let copy = 0; if ($('#copy').is(":checked")) { copy = $("#copy").val(); } if (manuscript == 0 && copy == 0) { $("#manuscript_label").attr("style", "color:red;"); $("#copy_label").attr("style", "color:red;"); $("#warning_print").attr('hidden', false); return false; } window.open('https://efa-member.com/backoffice/print/receipt_new?id=' + receipt_id + '&ma=' + manuscript + '&cp=' + copy, '_blank'); } </script> </body> </html>