ok

Mini Shell

Direktori : /home2/selectio/www/lilyexpresslive/expense-invoice/
Upload File :
Current File : /home2/selectio/www/lilyexpresslive/expense-invoice/vendor-invoice-payment-edit.php

<?php  include "header.php"; 
    $ids=$_GET['id'];
    $id=$_GET['ids'];
    $inv_no=$_GET['inv_no'];
   
    
    
    if(isset($_POST['update_invoice_payment'])){
        try{
                $date = date('Y-m-d h:i:s', time());
            $statement = $pdo->prepare("UPDATE tbl_invoice_payment SET amount=?,type=?,paid_method=?,paid_date=? WHERE id=?");
            $result=$statement->execute(array($_POST['amount'],$_POST['type'],$_POST['payment_method'],$_POST['date'],$_GET['ids']));

                    if($result){
                        $message = 'Invoice Payment Updated successfully!';
                        unset($_POST);      
                    }else{
                        $warning="Something went wrong try again...";
                    }  
                }catch(Exception $e){
                    $error=$e;
                }   
    }
     $statement = $pdo->prepare("SELECT * from tbl_invoice_payment where id=".$id);
    $statement->execute();
    $inv_data = $statement->fetchAll(PDO::FETCH_ASSOC);
    $totalData = $statement->rowCount();
?>
<div class="content-wrapper">
        <section class="content-header">
            <center>
                <a  href="vendor-invoice-payment.php?id=<?=$ids?>&inv_no=<?=$inv_no?>" class="btn btn-info btn-sm "><i class="fa fa-chevron-left"></i> Back to Invoice Payment Histry</a>
            </center>
        </section>
        
         <div class="col-lg-12 alerts">
            <div id="custom-alerts" style="display:none;">
                <div class="alert alert-dismissable">
                    <div class="custom-msg"></div>
                </div>
            </div>
            <?php if ($error)  { ?>
            <div class="alert alert-danger alert-dismissable">
                <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
                <h4><i class="icon fa fa-ban"></i> Error</h4>
                <?= $error; ?>
            </div>
            <?php $error=0;} if ($warning) { ?>
            <div class="alert alert-warning alert-dismissable">
                <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
                <h4><i class="icon fa fa-warning"></i> warning</h4>
                <?= $warning; ?>
            </div>
            <?php  $warning=0;} if ($message) { ?>
            <div class="alert alert-success alert-dismissable">
                <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
                <h4>    <i class="icon fa fa-check"></i> Success</h4>
                <?= $message; ?>
            </div>
            <?php $message=0; } ?>
        </div>
        <div class="clearfix"></div>
        
    <section class="content">
        <div class="row">
        <div class="col-xs-12">
            <div class="box box-primary">
                <div class="box-header">
                    <h3 class="box-title">Please fill in the information below</h3>
                </div>
                <div class="box-body">
                    <div class="col-lg-12">

                        <form action="" class="validation" enctype="multipart/form-data" method="post" accept-charset="utf-8">
                                                                 
                        <div class="row">
                            <div class="col-md-3">
                                <div class="form-group">
                                    <label class="required" for="category">Amount</label><span style="color:green;">Remaining Amount : <?=$rem?></span>                                    
                                    <input type="text" name="amount" value="<?=$inv_data[0]['amount']?>" placeholder="Enter the Amount" class="form-control tip" id="amount"  onkeypress="return isNumberKey(this, event);" required="required" />
                                </div>
                            </div>
                            <div class="col-md-3" hidden>
                                <div class="form-group">
                                    <label class="required" for="location">Payment Mode</label>                                   
                                     <select name="type" class="form-control select2" id="type"  data-placeholder="Payment Method" style="width:100%;">
<option value="1" <?php  if($inv_data[0]['amount']==1){ echo "selected";}?>>Paid</option>
<option value="2" <?php  if($inv_data[0]['amount']==2){ echo "selected";}?>>Reduction</option>
</select>
                                </div>
                            </div>
                            
                             <div class="col-md-3">
                                <div class="form-group">
                                    <label for="email">Select Cash Received Type:</label>                                   
                                     
                            <select class="form-control tip select2" id="payment_method" name="payment_method">
                                        <option value="">Select Cash Received Type</option>
                                        <option value="Cash"  <?php  if($inv_data[0]['paid_method']=="Cash"){ echo "selected";}?>>Cash</option>
                                        <option value="UPI Transfer"  <?php  if($inv_data[0]['paid_method']=="UPI Transfer"){ echo "selected";}?>>UPI Transfer</option>
                                        <option value="Acc Transfer"  <?php  if($inv_data[0]['paid_method']=="Acc Transfer"){ echo "selected";}?>>Acc Transfer</option>
			                </select>
                                </div>
                            </div>
                            <div class="col-md-3">
                                <div class="form-group">
                                    <label class="required" for="name">Date</label>                                    
                                <input type="text" name="date" value="<?=$inv_data[0]['paid_date']?>"  class="form-control datetimepicker" id="date" required="required" />

                                </div>
                            </div>
                            
                        </div>
                        

                        <div class="form-group" style="text-align:center;">
                            <input type="submit" name="update_invoice_payment" value="Update Payment"  class="btn btn-success" />
                        </form>
                        </div>

                    </div>
                        <div class="form-group" style="text-align:center;">
                            <a href="vendor-invoice-payment.php?id=<?=$ids?>&inv_no=<?=$inv_no?>"><button class="btn btn-warning" ><i class="fa fa-chevron-left"></i> Back to List</button></a>
                         </div>
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
    </div>
    </section>
</div>
<script type="text/javascript">
    $(document).ready(function() { 
        
    });
    
    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>
<?php
    include "footer.php";?>

Zerion Mini Shell 1.0