IMMREX7
<?php $__env->startSection('content'); ?>
<div class="row clearfix">
<div class="col-sm-12">
<div class="card">
<div class="header">
<h2><strong>Purchase Order List</strong></h2>
</div>
<div class="body table-responsive">
<?php echo Form::open(['method' => 'GET', 'action' => ['School\Stock\PurchaseOrderController@viewPO'], 'class' => 'form-horizontal']); ?>
<div class="row clearfix">
<div class="col-sm-2"></div>
<div class="col-sm-2 form-control-label">
<label for="classname">Financial Year</label>
</div>
<div class="col-sm-3">
<div class="form-group">
<?php echo Form::select('idFinancialYear',fys(),null,['class' => 'form-control show-tick ms']); ?>
</div>
</div>
<div class="col-sm-2">
<?php echo Form::submit('Search',['class' => 'btn btn-raised btn-primary btn-round waves-effect']); ?>
</div>
</div>
<?php echo Form::close(); ?>
<br>
<table class="table table-bordered table-striped table-hover dataTable js-exportable">
<thead>
<tr>
<th>S. No.</th>
<th>Date</th>
<th>Purchase Order No.</th>
<th>Reference</th>
<th>Product</th>
<th>Vendor Name</th>
<th>Status</th>
<!--<th>Billed Status</th>-->
<th>Amount</th>
<!--<th>Expected Delivery</th>-->
<th>Action</th>
</tr>
</thead>
<tbody>
<?php $i = 1; ?>
<?php $__currentLoopData = $purchase_orders; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $var): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<th scope="row"><?php echo e($i); ?></th>
<td><?php echo e($var->purchaseDate); ?></td>
<td><?php echo e($var->poNo); ?></td>
<td><?php echo e($var->reference); ?></td>
<?php $products = \App\PurchaseOrderDetail::join('products','purchase_order_details.idProduct','=','products.idProduct')->where('idPurchaseOrder',$var->idPurchaseOrder)->get(); ?>
<td>
<?php $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<p><?php echo e($product->productName); ?> - x(<?php echo e($product->quantity); ?>)</p>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</td>
<td><?php echo e($var->supplier->bussinessName); ?></td>
<td><?php echo e($var->status); ?></td>
<td>
<?php
$received = \App\ProductReceived::where('idPurchaseOrder', '=', $var->idPurchaseOrder)
->first();
if ($received) {
$pr_payment = \App\ProductPayment::where('idProductReceived', '=', $received->idProductReceived)
->select(DB::raw('SUM(amountPaid) as amountPaid'))->first();
if ($pr_payment) {
$balance = $var->totalAmount - $pr_payment->amountPaid;
}
}
?>
<?php echo e($var->totalAmount); ?>
</td>
<td>
<a href="https://web.whatsapp.com/send?phone=+91<?php echo e($var->supplier->contactNo); ?>&text=<?php echo e(urlencode('Hello, Good day . Please here is the purchase order in this link https://online-login.online/api/po/PO201'.$var->idPurchaseOrder.'. We await your quick response. Kind Regards, Team')); ?>" target="_blank" class="btn btn-raised btn-warning waves-effect btn-round">Send on WhatsApp</a>
<a href="<?php echo e(url('school/purchaseorder/'.$var->idPurchaseOrder)); ?>" target="_blank" class="btn btn-sm btn-success btn-round">Print</a>
<button class="btn btn-raised btn-danger waves-effect btn-round js-sweetalert" data-id="<?php echo e($var->idPurchaseOrder); ?>" data-type="confirm">Delete</button>
</td>
</tr>
<?php $i++; ?>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script>
$(document).on('click', '.js-sweetalert', function (e) {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
e.preventDefault();
var id = $(this).data('id');
swal({
title: "Are you sure?",
text: "Are You sure you want to delete this Purchase Order!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, delete it!",
closeOnConfirm: true
},
function() {
// console.log('here');
$.ajax({
type: "DELETE",
url: "<?php echo e(url('/school/purchaseorder/')); ?>" +"/"+id
})
.done(function(data) {
if(data.success == "FAILED"){
swal({
title: "Cannot be deleted",
text: "Failed to delete PO as relation exists",
type: "error"
},function() {
});
}else{
swal({
title: "Deleted",
text: "Quotation has been successfully deleted",
type: "success"
},function() {
location.reload();
});
}
})
.error(function(data) {
swal("Oops", "We couldn't connect to the server!", "error");
});
return false;
});
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('schools.school_layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
Copyright © 2021 -