0byt3m1n1
Path:
C:
/
wamp64
/
www
/
cpms_new
/
ACCOUNTS
/
[
Home
]
File: ac_view_vouchers.php
<?php $MAIN_HEADING = "View Vouchers"; $SUB_HEADING =""; include_once( "../lib/config.php"); //require_once "../model/Notification_mdl.php"; require_once BASE_DIR."/lib/db/connection.php"; require_once "../model/uploader_mdl.php"; require_once "../model/defaultValues_mdl.php"; require_once "ac_models.php"; $project_details = CommonModel::getProjects(); include("include/accountsheader.php"); ?> <?php include("include/alert_message.php"); ?> <form method="post" class="form-horizontal form-label-left" id="form1" data-parsley-validate> <div class="form-group"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">Project Code </label> <div class="col-md-6 col-sm-6 col-xs-12"> <select class="form-control col-md-7 col-xs-12 select2_single" name="project_id" id="project_id"> <option value="0">All</option> <?php if(!empty($project_details)) foreach ($project_details as $j=> $value) { ?> <option value="<?php echo $j; ?>"> <?php echo $value[ 'project_code']; ?> </option> <?php } ?> </select> <ul class="parsley-errors-list filled" id="parsley-id-5"> <li class="parsley-required"> <?php if(isset($error[ 'project_id'])) { echo $error[ 'project_id']; }?> </li> </ul> </div> </div> <div class="form-group"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="date_current">Date </label> <div class="col-md-6 col-sm-6 col-xs-12"> <input id="date_current" readonly type="text" class="form-control col-md-7 col-xs-12" name="date_current" value="<?php if (isset($date_current) && $date_current!="") { echo $date_current; } ?>" /> <ul class="parsley-errors-list filled" id="parsley-id-5"><li class="parsley-required"><?php if(isset($error['date_current'])) { echo $error['date_current']; }?></li></ul> </div> <div class="col-md-2 col-sm-2 col-xs-12"> <label class="control-label " id="reset_date"><i class="fa fa-repeat cursor" data-toggle="tooltip" data-placement="top" title="" data-original-title="Reset date" ></i> </label> </div> </div> <div class="form-group"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">Status </label> <div class="col-md-6 col-sm-6 col-xs-12"> <select class="form-control col-md-7 col-xs-12" required="" name="status" id="status" > <option value="All">All</option> <!-- <option value="PENDING">Pending</option> --> <option value="ACCEPTED">Accpeted</option> <option value="DECLINED">Declined</option> <option value="VERIFIED">Verified</option> </select> <!-- <input type="hidden" name="status" value="VERIFIED"> --> <ul class="parsley-errors-list filled" id="parsley-id-5"><li class="parsley-required"><?php if(isset($error['status'])) { echo $error['status']; }?></li></ul> </div> </div> <div class="form-group"> <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-4"> <button class="btn btn-success" ><i class="fa fa-search"></i> Search</button> </div> </div> </form> <br/> <div class="form-group center" id="spin" style="display:none"><i class="fa fa-refresh fa-spin fa-3x"></i></div> <div class="form-group center" id="error" style="display:none;color:red"></div> </div> </div> </div> <div class="col-md-12 col-sm-12 col-xs-12" id="table" style="display:none"> <div class="x_panel"> <div class="x_title"> <h2>Budget Forms</h2> <div class="clearfix"></div> </div> <div class="x_content"> <table id="datatable-buttons" class="table table-striped table-bordered" > <thead> <tr> <th>Supplier Name</th> <th>Invoice No</th> <th>Invoice Date</th> <th>Amount</th> <th>Project Code</th> <th>Debit Head</th> <th>Date</th> <th>Created By</th> <th>Remarks</th> <th>Status</th> </tr> </thead> <tbody> </tbody> </table> </div> </div> </div> <?php include "include/footer.php"; ?> <script> var t; $(document).ready(function() { $("#reset_date").click(function () { $('#date_current').val(""); }) $(".select2_single").select2({ placeholder: "Select a project code", allowClear: true }); t= $("#datatable-buttons").DataTable({ dom: "Bfrtip", fixedHeader: true, buttons: [ { extend: "excel", className: "btn-sm" }, { extend: "pdfHtml5", className: "btn-sm" }, { extend: "print", className: "btn-sm" }, ], responsive: true }); // $("#form1").on('submit', function(e){ // e.preventDefault(); // var form = $(this); // form.parsley().validate(); // if (form.parsley().isValid()){ // getDebitHeadAjax(form.serializeArray()); // } // }); $("#form1").parsley(); $("#form1").submit(function(e) { e.preventDefault(); getDebitHeadAjax($("#form1").serializeArray()); }); $('#date_current').daterangepicker({ showDropdowns: true, }, function(start, end, label) { }); }); function getDebitHeadAjax(dt) { var table = $("#table"); var spin = $("#spin"); var error = $("#error"); table.hide(); error.hide(); spin.show(); $.ajax({ type: 'POST', url: BASE_URL+"ac_ajax.php", data: { data : dt ,f : "get_budget_forms"} , dataType: 'json', error: function() { spin.hide(); table.hide(); error.show().html("Something went wrong, Try Again"); }, success: function(data) { spin.hide(); if(data.length >0){ table.show(); t.clear().draw(); $("table#datatable-buttons").removeAttr("style"); var tbody = ""; $.each(data,function (k,val) { var color =""; var show_actions = true; switch(val.status){ case "pending" : color= "info"; break; case "accepted" : color= "success"; show_actions= false; break; case "declined" : color= "danger"; show_actions= false ; break; case "verified" : color= "warning"; show_actions= false ; break; default : color= "info"; break; } var status = '<label class="label label-'+color+' " >'+capitalize(val.status)+'<lable>'; if(!show_actions) edit = ""; t.row.add( [ val.sup_name,val.invoice_number,val.invoice_date,val.amount,val.project_code,val.debit_head,val.created_on,val.created_by,val.remarks,status ] ).draw( false ); }); }else{ error.show().html("No details found"); } }, }); } function capitalize(string) { return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase(); } </script>