BBnepal-Accounts/account/application/views/inventory/purchases/view.php
Sampanna Rimal 16246fbdeb changes
2024-08-11 17:29:32 +05:45

112 lines
6.1 KiB
PHP

<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<!-- <button class="btn btn-primary btn-xs float-right" style="margin-left: 2px;" onclick="printDiv('printableArea')"><i class="fas fa-print"></i></button> -->
<h5 class="m-0"><?php echo $pageTitle; ?> <?php showCreateButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/add","Create New ".$pageTitle); ?></h5>
</div>
<div id="printableArea">
<div class="card-body">
<div class="row bill-header">
<div class="col text-center">
<h2>Purchase Details</h2>
</div>
</div>
<div class="row bill-details">
<div class="col">
<p><strong>Bill Number:</strong> <?php echo $Purchase->purchase_id; ?></p>
<p><strong>Date:</strong> <?php echo dbDate($Purchase->purchase_date); ?></p>
<p><strong>Vendor:</strong> <?php echo $this->myaccounts->getAccountDetails($Purchase->accounts_id)->account_name; ?></p>
</div>
</div>
<div class="row bill-items">
<div class="col">
<div class="item-row">
<div class="row">
<div class="col">
<p><strong>Item</strong></p>
</div>
<div class="col">
<p><strong>Quantity</strong></p>
</div>
<div class="col">
<p class="text-right"><strong>Price</strong></p>
</div>
<div class="col">
<p class="text-right"><strong>Total</strong></p>
</div>
</div>
</div>
<?php $total=0; foreach($PurchaseDetails as $PurchaseDetail):?>
<div class="item-row">
<div class="row">
<div class="col">
<p><?php echo getFieldfromValue("tbl_items","title","item_id",$PurchaseDetail->items_id); ?></p>
</div>
<div class="col">
<p><?php $qty=$PurchaseDetail->qty; echo $qty; ?></p>
</div>
<div class="col">
<p><?php $rate=$PurchaseDetail->rate; echo myCurrency($rate); ?></p>
</div>
<div class="col">
<p><?php $ltotal=$rate*$qty; $total+=$ltotal; echo myCurrency($ltotal); ?></p>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<?php $discount = $Purchase->discount ?>
<div class="row bill-footer">
<div class="col text-right">
<p><strong>Subtotal:</strong> <?php echo myCurrency($total,true); ?></p>
<?php $discounted = 0; ?>
<?php if($discount > 0): ?>
<p><strong>Discount percent:</strong> <?php echo myCurrency($discount,true); ?></p>
<?php $discounted = ($total*$discount/100) ?>
<p><strong>Discount amount:</strong> <?php echo myCurrency($discounted,true); ?></p>
<?php endif; ?>
<?php $taxable = $total - $discounted ?>
<?php $tax = 0; ?>
<?php //print_r($Purchase->vatToggle);die; ?>
<?php if($Purchase->vatToggle != 1): ?>
<p><strong>Taxable amount:</strong> <?php echo myCurrency($taxable,true); ?></p>
<p><strong>Tax (13%):</strong> <?php echo myCurrency($tax=($taxable*13)/100,true); ?></p>
<?php endif; ?>
<p><strong>Total:</strong> <?php echo myCurrency(($taxable+$tax),true); ?></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
function printDiv(divName) {
var printContents = document.getElementById(divName).innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
}
</script>