<?php include 'topmost.php';?>
<!DOCTYPE html><html lang="en"><head>
<meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><meta name="description" content="">
<meta name="author" content="">

    <title>My Outlet</title>
    <?php  include 'toplinks.php';  ?>
</head>
<body id="page-top"><div id="wrapper"><?php  include 'menus.php';  ?>

        

<?php include 'top.php';   ?>



                <!-- End of Topbar -->

                <!-- Begin Page Content -->
                <div class="container-fluid">

                    <!-- Page Heading -->
                    <div class="d-sm-flex align-items-center justify-content-between mb-4">
<?php  include 'greet.php';  ?><?php  include 'process.php';  ?>

                       <!--  <a href="#" class="d-none d-sm-inline-block btn btn-sm btn-primary shadow-sm"><i
                                class="fas fa-download fa-sm text-white-50"></i> Generate Report</a> -->
                    </div>

                    <!-- Content Row -->


<?php include 'top_stats.php'; ?>

                    <div class="row">

                        
                            <div class="card shadow mb-4 col-md-12">
                                <!-- Card Header - Dropdown -->
 <div class="card-header py-3 d-flex flex-row align-items-center justify-content-between bg-primary text-white"><h6 class="m-0 font-weight-bold text-white">WAYBILL INFORMATION</h6></div></div>
                            
<?php $addAmt=0; $count=1; foreach(QueryDB("SELECT * FROM payment WHERE type=2 and pay_status=1 order by id desc")as $tycom){
            $item = explode(',',$tycom['item']);
            $sPrice = explode(',',$tycom['s_price']);
            $bulkPrice = explode(',',$tycom['bulk_price']);
            $qty = explode(',',$tycom['qty']);
            $biller =@getBiller($tycom['id']);
            $bill_org =@explode(',',$biller['organization']);
    ?>
<div class="col-md-4">
<div class="card shadow mb-4" style="box-shadow:5px 5px 30px gray;">
  <div class="card-header <?php if($tycom['pay_status']==1){ echo 'bg-secondary'; }else{
    echo 'bg-danger';
  }  ?> text-white" style="height:70px;">
<div class="row">
<div class="col-md-8 small"><h6 class="m-0 font-weight-bold text-white">  
 <i class="fa fa-user"></i> <?php  echo get_cus_Name($tycom['cus_id']); echo '<br/>'.date('d, M Y h:i:s A',$tycom['time_paid']);  ?></h6></div> 
  <div class="col-md-4 small"><p><b>Status: </b>
<?php   if($tycom['pay_status']==1){  echo '<span class="text-white">Paid</span>';
}else{echo '<span class="text-warning">Pending</span><br/>';
echo $tycom['day'];} ?></p></div></div></div>
<div class="card-body">
<div class="row">
<?php  for($a=0;$a<count($item);$a++){ $viewProduct = getProduct($item[$a]);?>
<div class="col-md-12 font-weight-bold"><?php  echo getProductName($item[$a]).' '.$sized_by[$viewProduct['size']].' '.$colored_by[$viewProduct['color']].','.$company[$viewProduct['company']].' - '.$brand[$viewProduct['brand']];  ?></div> 
<div class="col-md-6"><b>Price: </b><?php echo $sPrice[$a]; ?></div>
<div class="col-md-6"><b>Qty: </b><?php echo $qty[$a]; ?>x</div>
<div class="col-md-12"><b>Total: &#8358;</b><?php echo number_format($bulkPrice[$a],2);
$addAmt+=$bulkPrice[$a];
 ?></div>
<div style="height:1px;border:1px solid gray;width:100%;" class="mb-2 mt-2 col-md-12"></div>
<?php  } ?>
<div class="col-md-12 text-right text-danger"><span><b>TOTAL: &#8358;</b></span><?php echo number_format($addAmt,2);  $addAmt=0;?>  </div>
</div>
<div class="row">
    <div class="col-md-12 text-success"><strong>WAYBILL</strong></div>
<div class="col-md-12"><b>Receiver:</b> <?php  echo @$bill_org[0];  ?> (<?php  echo @$bill_org[3];  ?>)</div>
<div class="col-md-6"><?php  echo @$bill_org[1];  ?></div>
<div class="col-md-6"><?php  echo @$bill_org[2];  ?></div>
<div class="col-md-12"><?php  echo @$bill_org[7].' '.@$bill_org[6].' '.@$bill_org[5].','.@$bill_org[4];?></div>
<div class="col-md-12"><strong>Notes:</strong> <?php  echo @$bill_org[8];  ?></div> 
<div class="col-md-12"><strong>Status:</strong> <?php  echo getBillerAll($tycom['id']);  ?></div>   
<div class="col-md-12 text-right"><button data-toggle="modal" data-target="#filterPay<?php echo $count; ?>" class="btn btn-warning btn-sm"><i class="fa fa-wrench text-dark"> Change Status</i></button></div>

<div class="modal fade" id="filterPay<?php echo $count; ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"><div class="modal-dialog modal-center modal-sm" role="document"><div class="modal-content"><div class="modal-header bg-secondary text-white"><h5 class="modal-title " id="exampleModalLabel">#Change Status</h5><button class="close" type="button" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button></div><div class="modal-body">
<form action="" method="POST">
    <input type="hidden" name="where" value="<?php echo $tycom['id']; ?>">
<div class="form-group col-md-12 col-12 mt-3"><select class="form-control" name="pay_status"><option value="">-Status-</option><option value="Pending">Pending</option><option value="Dispatched">Dispatched</option><option value="Delivered">Delivered</option> <option value="Refunded">Refunded</option>
<option value="Returned">Returned</option> <option value="Refunded">Refunded</option>
</select></div>
<div class="form-group col-md-12 col-12 mt-3"><input type="submit" value="Submit" name="change_status_waybill" class="form-control btn btn-primary"></div>
</form></div></div></div></div>




</div>

</div>  

<div class="card-footer bg-success">
    <div class="row">
<div class="col-md-12"><h5 class="text-white">Trnx ID: <?php echo $tycom['receipt_id'];  ?></h5></div>
<div class="col-md-9 col-9"><p class="text-white">Method: <?php echo @pay_MTH($tycom['pay_mth']);  ?> </p> </div>

<div class="col-md-3 col-3">



    <?php if($tycom['pay_status']==1){
echo '<a href="../receeipts?no='.$tycom['receipt_id'].'"><i class="fa fa-print text-white"></i></a></td>
';}else{?>
<a class="text-white btn btn-primary btn-sm" href="?apprPay=<?php echo $tycom['id']; ?>&rep_id=<?php echo $tycom['receipt_id']; ?>" onclick="return confirm('Are you sure of this payment?');">Appr</a>
<?php }  ?></div>

    </div>
   
 
</div>



</div></div><!--/col-md-4-->


<?php $count++; } ?>     

</div><!-- Content Row Mobile-->

               

                </div>
                <!-- /.container-fluid -->

            </div>
            <!-- End of Main Content -->

            <!-- Footer -->
        <?php  include 'bottom_most.php'; ?>




<script src="../js/jquery.table2excel.min.js"></script>
<script type="text/javascript">
     $(function() {
        var classVal = "online payments for <?php echo date('Y-m-d');   ?>.xls";
      $("#export").on("click",function(e){e.preventDefault();
        $(".table2excel").table2excel({
          exclude: ".noExl",
          name: "File Export",
          filename:  classVal,
          fileext: ".xls",
          exclude_img: true,
          exclude_links: true,
          exclude_inputs: true
        });
      });
    });
</script>
</body>
</html>