<?php
  if( !hasPermission($_SESSION['user_detail']['role_id'], 'bill_edit') ) {
    echo '<script>window.location.href="index.php?page=no_permission.php"</script>';die();
  }
  if (isset($_REQUEST['eid']) && !empty($_REQUEST['eid'])){
    $select_update     = "SELECT * FROM billing WHERE invoice_no='".$_REQUEST['eid']."' AND branch_id = '".$_SESSION['branch_id']."' AND company_id = '".$_SESSION['company_id']."'";
    $select_update_res = mysqli_query($conn,$select_update);
    $update_row        = mysqli_fetch_array($select_update_res,MYSQLI_BOTH);
  }
?>
<link rel="stylesheet" href="assets/plugins/toaster/jquery.toast.css">
<link rel="stylesheet" href="assets/plugins/toaster/jquery.toast.min.css">
<script src="assets/plugins/toaster/jquery.toast.js"></script>
<section class="content-header">
  <div class="row">
      <div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 bottom20">
        <h3 class="capital font15 padding5 bold">BILL CONFORMATION</h3>
      </div>
      <div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 text-right bottom20">
        <h3>
          <?php if( hasPermission($_SESSION['user_detail']['role_id'], 'bill_list') ) { ?>
          <a href="index.php?page=bill/list.php" class="btn btn-danger capital bottom10 custome-btn">VIEW BILL DETAILS</a>
          <?php } ?>
        </h3>
      </div>
  </div>
</section>
<hr class="bottom35"> 
<section class="hitz-top-header">
   <div class="row bottom40">
      <div class="col-xs-12">
         <div class="box box-success">
            <div class="box-body">
              <form action="bill/bill_insert.php" method="post" enctype="multipart/form-data" class="common-frm-validation" id="signupForm">
                <div class="row">
                   <div class="col-md-2">
                      <div class="form-group">
                        <label class="capital">INVOICE NO</label><span style="color: red">*</span>
                        <input type="text" size="35" id="invoice_no" name="invoice_no" class="form-control lr_number" autocomplete="off" placeholder="INVOICE NO" value="<?php echo $update_row['invoice_no'];?>" readonly=""/>
                      </div>
                   </div>

                   <div class="col-md-3">
                      <div class="form-group">
                         <label class="capital">NAME</label><span style="color: red">*</span>
                         <input type="text" size="35" id="bill_submited_by" name="bill_submited_by" class="form-control lr_number" autocomplete="off" placeholder="NAME" value="<?php echo $update_row['bill_submited_by'];?>"/>
                      </div>
                   </div>
                   
                   <div class="col-md-2">
                      <div class="form-group">
                          <label class="capital">DATE</label><span style="color: red">*</span>
                          <div class="input-group date date-picker" data-date-format="dd-mm-yyyy">
                            <div class="input-group-addon">
                               <i class="fa fa-calendar"></i>
                            </div>
                            <input type="text" size="35" id="bill_submited_date" name="bill_submited_date" class="form-control date-picker required" placeholder="DATE" autocomplete="off" value="<?php echo risFormatDate($bill_submited_date);?>" />
                          </div>
                      </div>
                   </div>
                </div>
                <div class="row">
                  <input type="hidden" value="<?php echo $_GET['eid'];?>" name="id" id="id">
                  <hr>
                  <div class="row" align="center">
                    <button id="btn" class="btn btn-primary ajax-submit capital" type="submit">UPDATE & SAVE</button>
                    <a href="index.php?page=bill/list.php" class="btn btn-danger capital"> Cancel</a>
                  </div>
                </div>
              </form>
            </div>
         </div>
      </div>
   </div>
</section>
