ria/app/Views/bankcustomerledger.php
2024-09-11 08:54:25 +05:30

485 lines
15 KiB
PHP
Executable File

<?php
//echo $suppliername;
foreach($openingbalance as $balance)
{
$openbalance=$balance->payment;
}
foreach($financialyear as $item)
{
$finyear = $item->financial_year;
} ?>
<style>
p {
font-family: verdana;
font-size: 14px;
}
</style>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.4.2/css/buttons.dataTables.min.css">
<style>
.dataTables_filter input {padding: 4px;}
.dataTables_filter {
width: 50%;
float: right;
text-align: right;
}
.dataTables_paginate {
width: 50%;
float: right;
text-align: right;
}
div.dt-buttons {
position: relative;
float: right;
}
</style>
<!--<div class="row">
<div class="col-md-12">
<div id="container"></div>
</div>
</div>-->
<div class="content-wrapper">
<section class ="content">
<div class="row">
<!-- Left col -->
<div class="col-md-12">
<!-- TABLE: LATEST ORDERS -->
<div class="box box-info">
<div id="content" > </div>
<div class="modal fade" id="Fileshow" role="dialog">
<div class="modal-dialog">
<!-- Modal. content-->
<form>
<div class="modal-content" style="width:800px;">
<!-- Table to show the line item of po -->
<table class="table table-bordered" id="Inwardgateregistertable1" style="font-size:12px;">
<thead style="background-color:#ffffff;">style="background-color:#ffffff;">
<tr>
<th>SNo</th>
<th>BillNO</th>
<th>PONO</th>
<th>FileName</th>
</tr>
</thead>
<tbody id="tbleAppend1">
</tbody>
</table>
<div class="modal-footer">
<a class="btn btn-success" data-dismiss="modal" value="Cancel">Cancel</a>
</div>
</div>
</form>
</div>
</div>
<!--<div class="box-header with-border">-->
<!--<center><h3 class="box-title"><p style="color: #00d976;"><b>Cashbook Reports</b></p></h3></center>-->
<!--</div>-->
<!-- /.box-header -->
<form method="post" action="<?php echo base_url($this->uri->uri_string()); ?>">
<center><h3 class="box-title"><p style="color: #00d976;; font-size: 18px;">Customer Ledger
&nbsp;&nbsp;<?php if(!empty($fa)){
echo $fa;
}
?>
<?php if(!empty($fa)){
echo '-';
echo $aa;
}
?>
<?php if(!empty($m))
{
echo '/';
echo $m;
}
?>
<?php if(!empty($fdate))
{
echo '/';
echo $fdate;
}
?><?php if(!empty($tdate)){
echo '/';
echo $tdate;
}
?>
</p></h3></center>
<?php
foreach($customerledger as $cl)
{
$clientname=$cl->client_name;
}
?>
<center><h4 style="color: #00d976;"><span><?php echo $clientname;?></span></h4></center>
<p><?php echo $tot_amount; ?></p>
<div class="row">
<div class="col-md-6 col-xs-6">
<input type="hidden" class="form-control required" id="supplier" name="supplier" value="<?php echo $supplierid;?>" ></textarea>
<input type="hidden" class="form-control required" id="suppliername" name="suppliername" value="<?php echo $suppliername;?>" ></textarea>
</div>
</div>
<div class="box-body">
<div class="row">
<div class="col-md-2">
<label for="to_date">
<?php echo 'Year'; ?>
</label>
<div class="input-group">
<select class="form-control" id="financialyear" name="financialyear">
<option value="">Select Year</option>
<?php
foreach($finyear as $item):
{?>
<option value="<?php echo $item->financial_year;?>"><?php echo $item->financial_year ; ?></option>
<?php } endforeach; ?>
</select>
</div>
</div>
<div class="col-md-2">
<label for="to_date">
<?php echo 'Month'; ?>
</label>
<div class="input-group">
<select class="form-control" id="month" name="month">
<option value="">Select Month</option>
<option value="January">January</option>
<option value="February">February</option>
<option value="March">March</option>
<option value="April">April</option>
<option value="May">May</option>
<option value="June">June</option>
<option value="July">July</option>
<option value="August">August</option>
<option value="September">September</option>
<option value="October">October</option>
<option value="November">November</option>
<option value="December">December</option>
</select>
</div>
</div>
<div class="col-md-2">
<label for="from_date">
<?php echo 'From Date'; ?>
</label>
<div class="input-group">
<input name="from_date" id="max-date" class="form-control datepicker">
<span class="input-group-addon">
<i class="fa fa-calendar fa-fw"></i>
</span>
</div>
</div>
<div class="col-md-2">
<label for="to_date">
<?php echo 'To Date'; ?>
</label>
<div class="input-group">
<input name="to_date" id="min-date" class="form-control datepicker">
<span class="input-group-addon">
<i class="fa fa-calendar fa-fw"></i>
</span>
</div>
</div>
<div class="col-md-2" >
<label for="customer">
<?php echo 'Supplier'; ?>
</label>
<select class="form-control" id="Customer" name="Customer">
<option value="">Select Supplier</option>
<?php foreach($getcustomer as $gc):
{?>
<option value="<?php echo $gc->client_id;?>"><?php echo $gc->client_name ;?></option>
<?php } endforeach; ?>
</select>
</div>
<div class="col-md-2" style="margin-top:24px;">
<input type="submit" class="btn btn-success" name="btn_submit"
value="View CusLedger">
</div>
</div>
</form>
<br>
<br>
<?php
$i=1;
$amount_receive=0;
$total_invoice=0;
$balance_due=0;
if(!empty($customerledger)){
foreach($customerledger as $cls)
{
$totalinvoice=$cls->amount;
$total_invoice=$total_invoice+$totalinvoice;
$amountreceived=$cls->payment;
$amount_receive= $amount_receive+$amountreceived;
$balance_due=$total_invoice-$amount_receive;
}
$i++;
?>
<p style="color:green" "font-size:22px";><strong>Opening Balance</strong> &nbsp;&nbsp;&nbsp;: &nbsp;&nbsp;&nbsp;<?php echo $openbalance ?>(&#8377;)</p>
<p style="color:green";><strong>Invoiced Amount </strong>:&nbsp;&nbsp;&nbsp; <?php echo $total_invoice ?>(&#8377;)</p>
<p style="color:green";><strong>Amount Paid </strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :&nbsp;&nbsp;&nbsp; <?php echo $amount_receive?>(&#8377;)</p>
<!--<p style="color:green";><strong>Balance Due </strong> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :&nbsp;&nbsp;&nbsp;<?php echo $balance_due?>(&#8377;)</p>-->
<?php
}
?>
<br>
<br>
<table class="table table-bordered table-hover" id="req" style="table-layout:auto;">
<thead>
<tr>
<th>Date</th>
<th>Transactions</th>
<th>Document No</th>
<th>Amount</th>
<th>Payments(&#8377;)</th>
<th>Balance (&#8377;)</th>
<!--<th>Print</th>-->
</tr>
</thead>
<tbody>
<?php
$tot_amountreceived=0;
$tot_amount=0;
$i=1;
$ti=0.00;
$tvt=0.00;
if(!empty($customerledger)){
foreach($customerledger as $cl)
{
$total=$cl->amount;
$payments=$cl->payment;
$amountreceived=$cl->amountreceived;
$Balance=$total-$amountreceived;
$invoice_status_idcheck=$cl->invoice_status_id;
// $id=$ap->id;
//print_r($ap);
?>
<tr>
<input type="hidden" name="mapid" id="mapid<?php echo $i ?>" value="<?php echo $ap->id; ?>"/>
<input type="hidden" name="bankingbalclear" id="bankingbalclear<?php echo $i ?>" value="<?php echo $ap->Balancetocleared; ?>"/>
<input type="hidden" name="clearbal" id="clearbal<?php echo $i ?>" value="<?php echo $ap->Clearbalance; ?>"/>
<input type="hidden" name="bankingid" id="bankingid<?php echo $i ?>" value="<?php echo $ap->mid; ?>"/>
<td align="left" id="bankdate<?php echo $i ?>"><span><?php echo format_date($cl->date,0,'d-m-Y'); ?></span></td>
<?php
if($invoice_status_idcheck==2)
{
$invoice_status_id='Invoice';
}
else
{
$invoice_status_id=$cl->invoice_status_id;
}
?>
<td align="left" id="sn<?php echo $i ?>"><span><?php echo $invoice_status_id?></span></td>
<td align="left" id="sn<?php echo $i ?>"><span><?php echo $cl->id?></span></td>
<td align="left" id="tpoa<?php echo $i ?>"><span><?php $tot_amount=$tot_amount+round($total)?> <?php echo $total;?></span></td>
<td align="left" id="btp<?php echo $i ?>"><span><?php $tot_amountreceived=$tot_amountreceived+round($payments)?> <?php echo round($payments,2);?></span></td>
<td align="left" id="ap<?php echo $i ?>"><span><?php $tot_balance=$tot_balance+round($Balance)?> <?php echo round($Balance,2)?></span></td>
<!--<td>
<a data-toggle="tooltip" ><i class="fa fa-print" data-toggle="tooltip" title="<?php echo $record->AdjustmentId; ?> - Click here to Delete details" onclick="podelete(<?php echo $i ?>)"></i>&nbsp;&nbsp;&nbsp;</a>
</td> -->
</tr>
<?php
$i++;
}
?>
</tbody>
<tfoot width="100%">
<tr>
<td style="text-align:left;"><strong>Balance Due</strong></td>
<!--<td>&nbsp;</td>-->
<td>&nbsp;</td>
<td>&nbsp;</td>
<td class="amount"><strong>
<?php echo $tot_amount;?>
</strong></td>
<td class="amount"><strong>
<?php echo $tot_amountreceived; ?>
</strong></td>
<td>&nbsp;</td>
</tr>
</tfoot>
<?php
}
?>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
<script src="https://cdn.datatables.net/buttons/1.4.2/js/dataTables.buttons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/1.4.2/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.4.2/js/buttons.colVis.min.js"></script>
<script>
$( function() {
//var dateFormat = "mm/dd/yy",
from = $( "#min-date" )
.datepicker({
dateFormat: "dd-mm-yy",
defaultDate: "+0d",
changeMonth: true,
//numberOfMonths: 1
})
.on( "change", function() {
to.datepicker("option", "minDate", getDate( this ));
}),
to = $( "#max-date" ).datepicker({
dateFormat: "dd-mm-yy",
defaultDate: "+0d",
changeMonth: true,
//numberOfMonths: 1
})
.on( "change", function() {
from.datepicker( "option", "maxDate", getDate( this ) );
});
function getDate( element ) {
var date;
try {
date = $.datepicker.parseDate( dateFormat, element.value );
} catch( error ) {
date = null;
}
return date;
}
} );
$(document).ready(function() {
table = $('#req').DataTable( {
"dom": "<'row'<'col-md-6'l><'col-md-6'Bf>>" +
"<'row'<'col-md-6'><'col-md-6'>>" +
"<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>",
buttons: [
{
extend: 'excelHtml5',
footer: 'true',
messageTop: $('h4').text(),
title: 'Customer Ledger',
exportOptions: {
columns: ':visible'
}
},
'colvis'
]
} );
} );
</script>