ok

Mini Shell

Direktori : /home2/selectio/public_html/vijay-gases/modal/
Upload File :
Current File : //home2/selectio/public_html/vijay-gases/modal/purchase-payment.php

<?php include"../config/config.php";
$ids = $_GET['id'];
$statement = $pdo->prepare("SELECT e.*,(tbl_customer.id)as cus_id,(tbl_customer.customer_name)as cus_name,(tbl_customer.address)as cus_address,(tbl_customer.mobile_number)as cus_mobile_no,(tbl_location.name) as location_name  FROM `tbl_purchase` e LEFT JOIN tbl_location ON tbl_location.id=e.location_id LEFT JOIN tbl_customer ON e.supplier=tbl_customer.id where e.id=".$ids);
$statement->execute();
$datas = $statement->fetchAll(PDO::FETCH_ASSOC);
$totalData = $statement->rowCount();

?>
<div class="modal-dialog modal-lg" role="document" id="add_modal" style="overflow-x: hidden; overflow-y: hidden;">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title mt-0" id="myLargeModalLabel"><b>Create Purchase Payment Details</b></h4>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-top: -25px;"><i class="fa fa-times"></i></button>
            </div>
            
            <form id="add_form" method="post">
            <div id="content-div">
           
            <div class="modal-body" style="padding: 20px 40px 20px 40px;">
                <div class="row">
                    <div class="col-md-10"></div>
                    <div class="col-md-2">
                        <?php if($datas[0]['paid_amount']==0){ ?>
                               <span class="btn btn-success">All Payment Pending</span>
                        <?php }elseif($datas[0]['paid_amount']==$datas[0]['total_amount']){ ?>
                        <span class="btn btn-success">Fully Paid</span>
                        <?php }elseif($datas[0]['paid_amount']<$datas[0]['total_amount']){ ?>
                        <span class="btn btn-success">Partialy Paid</span>
                        <?php }elseif($datas[0]['paid_amount']>$datas[0]['total_amount']){ ?>
                        <span class="btn btn-success">Advanced Amount  &nbsp;&nbsp;&nbsp; <b><?=abs($datas[0]['total_amount']-$datas[0]['paid_amount'])?></b></span>
                        <?php } ?>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-6">
                            <div class="row">
                                <div class="col-md-4">
                                    <span>Supplier Name</span>
                                </div>
                                <div class="col-md-1">
                                     <span>:</span>
                                </div>
                                <div class="col-md-7">
                                     <span><?=$datas[0]['cus_name']?></span>
                                </div>
                            </div><br>
                             <div class="row">
                                <div class="col-md-4">
                                    <span>Address</span>
                                </div>
                                <div class="col-md-1">
                                     <span>:</span>
                                </div>
                                <div class="col-md-7">
                                     <span><?=$datas[0]['cus_address']?></span>
                                </div>
                            </div><br>
                            <div class="row">
                                <div class="col-md-4">
                                    <span>Total Amount</span>
                                </div>
                                <div class="col-md-1">
                                     <span>:</span>
                                </div>
                                <div class="col-md-7">
                                     <span><?=$datas[0]['total_amount']?></span>
                                </div>
                            </div><br>
                            <div class="row">
                                <div class="col-md-4">
                                    <span>Balance Amount</span>
                                </div>
                                <div class="col-md-1">
                                     <span>:</span>
                                </div>
                                <div class="col-md-7">
                                     <span><?=$datas[0]['total_amount']-$datas[0]['paid_amount']?></span>
                                </div>
                            </div>
                    </div>
                    <div class="col-md-6">
                            <div class="row">
                                <div class="col-md-4">
                                    <span>Mobile No</span>
                                </div>
                                <div class="col-md-1">
                                     <span>:</span>
                                </div>
                                <div class="col-md-7">
                                     <span><?=$datas[0]['cus_mobile_no']?></span>
                                </div>
                            </div><br>
                             <div class="row">
                                <div class="col-md-4">
                                    <span>Company Name</span>
                                </div>
                                <div class="col-md-1">
                                     <span>:</span>
                                </div>
                                <div class="col-md-7">
                                     <span><?=$datas[0]['location_name']?></span>
                                </div>
                            </div><br>
                            <div class="row">
                                <div class="col-md-4">
                                    <span>Paid Amount</span>
                                </div>
                                <div class="col-md-1">
                                     <span>:</span>
                                </div>
                                <div class="col-md-7">
                                     <span><?=$datas[0]['paid_amount']?></span>
                                </div>
                            </div><br>
                            
                    </div>
                </div><br>
                 <div class="row">
                     <div class="col-md-4">
                         <div class="form-group">
                            <label class="required">Paid Date</label>
                            <input type="date" name="paid_date" id="paid_date" class="form-control" value="<?=date('Y-m-d')?>" required>
                            <input type="hidden" name="sell_id" id="sell_id" class="form-control" value="<?=$_GET['id']?>" required>
                            <input type="hidden" name="cus_id" id="cus_id" class="form-control" value="<?=$datas[0]['cus_id']?>" required>
                        </div>
                     </div>
                     <div class="col-md-4">
                         <div class="form-group">
                            <label class="required">Amount</label>
                            <input type="text" name="paid_amount" id="paid_amount" class="form-control" value="0" onkeypress="return isNumberKey(this, event);" required>
                        </div>
                     </div>
                     <div class="col-md-4">
                         <div class="form-group">
                            <label class="control-label" for="departement_id">Payment Mode</label>
                               <select name="pay_mode" class="form-control select2" style="width:100%" id="pay_mode">
                                    <option value="0">Select Pay Mode</option>
                                    <option value="1">Cash</option>
                                    <option value="2">Online</option>
                                    <option value="3">Cheque</option>
                                    <option value="4">Credit Card</option>
                                </select>
                         </div>
                     </div>
                 </div>   
                 <div class="row">
                      <div class="col-md-4" hidden>
                         <div class="form-group">
                            <label class="control-label" for="departement_id">Payment Type</label>
                               <select name="pay_type" class="form-control select2" style="width:100%" id="pay_type">
                                    <option value="0">Select Payment Type</option>
                                    <option value="1">Fully Paid</option>
                                    <option value="2">Partially Paid</option>
                                    <option value="3">Month Due</option>
                                    <option value="4">Days Due</option>
                                </select>
                         </div>
                     </div>
                 </div><br>
                 
                 <div class="row">
                    <div class="col-md-12">
                        <table style="width:100%;" id="table_sale_payment">
                            <tr>
                                <th class="table_head_data">S.No</th>
                                <th class="table_head_data">Paid Date</th>
                                <th class="table_head_data">Referance No</th>
                                <th class="table_head_data">Amount</th>
                                <th class="table_head_data">Payment Type</th>
                                <th class="table_head_data">Action</th>
                            </tr>
                            <?php
                                       $statement1 = $pdo->prepare("SELECT * FROM tbl_payment h WHERE h.type=1 and h.pay_id=".$ids);
                                       $statement1->execute();
                                       $purchase_pay_data = $statement1->fetchAll(PDO::FETCH_ASSOC);
                                       $s=1;
                                       foreach($purchase_pay_data as $payment_data){
                                       ?>
                            <tr>
                                <td><?=$s?></td>
                                <td><?=date('d-m-Y', strtotime($payment_data["date"]))?></td>
                                <td><?=$payment_data["id"]?></td>
                                <td><?=$payment_data["amount"]?></td>
                                <td> <?php if($payment_data["mode"]==1){ ?> Cash <?php } elseif($payment_data["mode"]==2){ ?> Online <?php }elseif($payment_data["mode"]==3){ ?>Cheque <?php } else { ?>Credit Card <?php } ?></td>
                                <td><center><span class="btn btn-danger btn-sm remove_refill_cylinder" onClick="delete_purchase_payment(<?=$payment_data["id"]?>,<?=$payment_data["amount"]?>,<?=$_GET["id"]?>)" style="width:46%;height:33px;"><i class="fa fa-trash-o" style="font-size:14px;"></i></span></center></td>
                            </tr>
                            <?php $s++; } ?>
                        </table>
                    </div>
                </div>
            </div>
            
            <div class="modal-footer">
                <button type="submit" class="btn btn-primary">Submit</button>
            </div>
            
            
            </div>
            </form>
            
            
            
            <div id="loading-div" style="display: none; padding-bottom: 80px;">
                    <center> <img src="img/loading.gif" style="width: 250px;"><br><b class="blinking">Processing Please Wait...</b></center>
            </div>
            
            
            
        </div>
    </div>
    
    
<script>

function isNumberKey(txt, evt) {
      var charCode = (evt.which) ? evt.which : evt.keyCode;
      if (charCode == 46) {
        //Check if the text already contains the . character
        if (txt.value.indexOf('.') === -1) {
          return true;
        } else {
          return false;
        }
      } else {
        if (charCode > 31 &&
          (charCode < 48 || charCode > 57))
          return false;
      }
      return true;
    }
    
</script>

<script>
    $('#add_form').on('submit', function(e){
        console.log("Click And Form Working");
                e.preventDefault();
                $('#loading-div').show();
                $('#content-div').hide();
                var formData = new FormData(this);
                formData.append('type', 'purchase_payment');
                            $.ajax({
                            url: 'apis/payment-add-api.php',
                            type: 'post',
                            dataType: 'json',
                            data: formData,
                            cache: false,
                            contentType: false,
                            processData: false,
                            enctype: 'multipart/form-data',
                            success: function (response) {
                                if(response['status']==200){
                                     alert(response['message']);
                                     $("#add_modal .close").click();
                                     $('#add_form').trigger("reset");
                                     emp_datas();
                                     $('#loading-div').hide();
                                     $('#content-div').show();
                                }else{
                                    alert(response['message']);
                                    $('#loading-div').hide();
                                    $('#content-div').show();
                                }
                                
                               
                            }
                        });
                
    });
</script>
<script type="text/javascript">

function delete_purchase_payment(id,amount,purchae_id){
            var result = confirm("Confirm Want to Delete This Payment?");
            if (result) {
                    $.ajax({
                    type: 'POST',
                    url: 'api/delete.php',
                    data: {type:'purchase_payment_delete',delete_id:id,table:'tbl_payment',del_amount:amount,del_purchase_id:purchae_id},                  
                    success: function(response) {
                        console.log(response); 
                        $("#add_modal .close").click();
                        $('#add_form').trigger("reset");
                        emp_datas();
                    }
                });
            }
         }
</script>
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
<style>
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: rgb(228, 228, 228);
    box-sizing: border-box;
    display: inline-block;
    margin-left: 5px;
    margin-top: 5px;
    position: relative;
    max-width: 100%;
    text-overflow: ellipsis;
    vertical-align: bottom;
    white-space-collapse: collapse;
    text-wrap: nowrap;
    border-width: 1px;
    border-style: solid;
    border-color: rgb(170, 170, 170);
    border-image: initial;
    border-radius: 4px;
    padding: 0px 10px 0px 20px;
    overflow: hidden;
    color: black;
    font-weight: 800;
}
.select2-container--default .select2-selection--multiple {
    background-color: white;
    border: 1px solid #aaa;
    border-radius: 4px;
    cursor: text;
    height: 100px;
    padding-bottom: 5px;
    padding-right: 5px;
    position: relative;
}
</style>
<script>
    $(document).ready(function(){
        $(".select2").select2();
    });
</script>
<style>
    #table_sale_payment {
  border-collapse: collapse;
  width: 100%;
  padding-right:4%;
  
}

tr:nth-child(even){background-color: #f2f2f2}
.table_head_data{
        background-color: #b34923;
        color: white;
        text-align: center;
        padding-top: 5px;
        padding-bottom: 5px;
        
}
td{
    padding:10px;
}
tr:hover{
    background-color:#cccc69;
}
</style>

Zerion Mini Shell 1.0