riainvoice/application/modules/payments/views/editform.php
2023-05-27 19:26:12 +05:30

274 lines
9.1 KiB
PHP

<?php
$receiptno='';
$totalpaid='';
//print_r($invoicedetails);
if(!empty($invoicedetails))
{
foreach($invoicedetails as $inv)
{
$inv_id= $inv->invoice_id;
$receiptno=$inv->receipt_no;
$clientsname=$inv->client_name;
$clientphone= $inv->client_phone;
$clientemail= $inv->client_email;
$client_address_1=$inv->client_address_1;
$client_address_2=$inv->client_address_2;
$client_city=$inv->client_city;
$client_state= $inv->client_state;
$client_zip= $inv->client_zip;
$pdt=new DateTime($inv->payment_date,new DateTimeZone('Asia/Kolkata'));
$paydt=$pdt->format('d-m-Y');
$Paymethod=$inv->payment_method_name;
}
}
if(!empty($viewpayment))
{
foreach($viewpayment as $view)
{
$inv_id= $view->invoice_id;
$invoice_paid= $view->invoice_paid;
$client = $view->client_name;
$idt=new DateTime($view->invoice_date_created,new DateTimeZone('Asia/Kolkata'));
$invdt=$idt->format('d-m-Y');
$pdt=new DateTime($view->payment_date,new DateTimeZone('Asia/Kolkata'));
$paydt=$pdt->format('d-m-Y');
$note= $view->payment_note;
$paymentmethod = $view->payment_method_name;
$payment_note= $view->payment_note;
}
}
if(!empty($PaymentLineDetails))
{
foreach($PaymentLineDetails as $Pay)
{
$invoiceid= $Pay->invoice_id;
$invoiceno= $Pay->invoice_number;
$invqty= $Pay->item_quantity;
$qtydescription= $Pay->item_description;
$invsubtotal= $Pay->invoice_item_subtotal;
$invtax= $Pay->invoice_item_tax_total;
$invtotal= $Pay->invoice_total;
$invbalance= $Pay->invoice_balance;
$invpaid=$invtotal-$invbalance;
}
}
?>
<script type="text/javascript">
</script>
<div id="headerbar">
<h1 class="headerbar-title"><?php _trans('Receipt'); ?> #<?php echo $receiptno; ?></h1>
<div class="headerbar-item pull-right">
<div class="btn-group btn-group-sm">
</div>
</div>
</div>
<div id="content">
<?php echo $this->layout->load_view('layout/alerts'); ?>
<form id="invoice_form" class="form-horizontal">
<div class="invoice">
<div class="row">
<div class="col-xs-12 col-md-9 clearfix">
<div class="pull-left">
<h5><?php echo "Client Name" ?></h5>
<div class="client-address">
<?php echo $clientsname;?><br>
<?php echo $client_address_1?><br>
<?php echo $client_address_2?><br>
<?php echo $client_city?><br>
<?php echo $client_state ." - " .$client_zip?>
</div>
<br><br>
<?php if ($clientphone!='') { ?>
<span>
<strong><?php _trans('phone'); ?>:</strong>
<?php echo $clientphone; ?>
</span><br>
<?php } ?>
<?php if ($clientemail!='') { ?>
<span>
<strong><?php _trans('email'); ?>:</strong>
<?php echo $clientemail; ?>
</span>
<?php } ?>
</div>
</div>
<div class="col-xs-12 col-md-3">
<table class="table table-bordered">
<tr>
<td><?php _trans('Payment Date:'); ?></td>
<td><?php echo $paydt; ?></td>
</tr>
<tr>
<td><?php _trans('Receipt Method:'); ?></td>
<td><?php echo $Paymethod;?></td>
</tr>
<tr>
<td><?php _trans('Note:'); ?></td>
<td><?php echo $payment_note;?></td>
</tr>
</table>
</div>
</div>
<br/>
<div class="table-responsive">
<table class="table table-striped table-condensed no-margin" id="tab">
<thead>
<tr>
<th class="amount"><?php echo trans('Invoice No'); ?></th>
<th class="amount"><?php echo trans('Item Description'); ?></th>
<th class="amount"><?php echo trans('Qty'); ?></th>
<th class="amount"><?php echo trans('sales_with_tax'); ?></th>
<th style="text-align: right;" ><?php echo trans('Amount Paid'); ?></th>
</tr>
</thead>
<tbody id="table_value">
<?php if($invoice_paid){
?>
<?php foreach($PaymentLineDetails as $Pay)
{?>
<tr>
<td style="text-align: right;"><?php echo $Pay->invoice_number;?></td>
<td style="text-align: right;"><?php echo $Pay->item_description;?></td>
<td style="text-align: right;"><?php echo $Pay->item_quantity?></td>
<td style="text-align: right;"><?php echo $Pay->invoice_total?></td>
<td style="text-align: right;"><?php echo $Pay->payment_amount;?></td>
<?php $totalpaid=$totalpaid+$Pay->payment_amount;?>
<?}?>
</tr>
<?php }?>
<!-- <tr><td class="amount">0100</td><td class="amount">10000</td><td class="amount">50000</td><td class="amount">2500</td><td class="amount">52500</td><td class="amount" contenteditable="true"></td></tr>
<tr><td class="amount">0102</td><td class="amount">20000</td><td class="amount">35000</td><td class="amount">300</td><td class="amount">56500</td><td class="amount" contenteditable="true"></td></tr>
<tr><td class="amount">0125</td><td class="amount">15000</td><td class="amount">58000</td><td class="amount">3500</td><td class="amount">562500</td><td class="amount" contenteditable="true"></td></tr> -->
<tr><td class="amount"></td><td class="amount"></td><td class="amount"></td><td class="amount"></td><td class="amount"></td><td class="amount" contenteditable="true"></td></tr>
</tbody>
<tfoot width="100%">
<tr>
<td style="text-align:right;" colspan="4.5"><strong>Total</strong></td>
<td class="amount"><strong>
<!-- 4545 -->
<?php if($invoice_paid ==0)
{?>
<input type="text" id="invoicetotal" name="invoicetotal">
<?php }
else{?>
<input type="text" id="invoicetotaledit" name="invoicetotaledit" value="<?php echo $totalpaid;?>" disabled>
<?}?>
</strong>
</td>
<!-- <td class="amount"><strong>
454545
</strong>
</td> -->
<!-- <td class="amount">
<strong>
445654
</strong>
</td> -->
</tr>
</tfoot>
</table>
</div>
<a style="float:right;" class="btn btn-success ajax-loader" ID="Saveedit" onclick="Save()" >&nbsp;&nbsp;<span class="bold">Send Mail</span></a>
<input type="hidden" name="Recid" id="Recid" value="<?php echo $receiptno;?>">
</div>
</form>
</div>
<script type="text/javascript">
function Save()
{
pid=$('#Recid').val();
//alert(pid)
$.ajax({
data:{pid:pid},
type:"post",
url:"<?php echo base_url()?>index.php/payments/Show_PaymentSlip",
success:function(data){
location.reload();
},
error:function(){
alert('error');
}
});
}
</script>