ok
Direktori : /home2/selectio/public_html/lilyexpresslive/expense-invoice/ |
Current File : /home2/selectio/public_html/lilyexpresslive/expense-invoice/vendor-invoice-payment.php |
<?php include "header.php"; $ids=$_GET['id']; $inv_no=$_GET['inv_no']; $statement = $pdo->prepare("SELECT *,c.name,c.gst,c.mobile,c.address,(SELECT sum(amount) FROM `tbl_vendor_invoice_items` WHERE type=2 and invoice_id=inv.id) as inv_reduction,(SELECT sum(amount) FROM `tbl_vendor_invoice_payment` WHERE type=1 and invoice_id=inv.id) as paid,(SELECT sum(amount) FROM `tbl_vendor_invoice_payment` WHERE type=2 and invoice_id=inv.id) as reduction FROM `tbl_vendor_invoice` inv inner JOIN tbl_client c on inv.client_id=c.id where inv.id=".$ids); $statement->execute(); $inv_data = $statement->fetchAll(PDO::FETCH_ASSOC); $totalData = $statement->rowCount(); $statement = $pdo->prepare("SELECT * FROM `tbl_vendor_invoice_payment` where invoice_id=".$ids." and type=1"); $statement->execute(); $inv_payment_data = $statement->fetchAll(PDO::FETCH_ASSOC); $totalData_payment = $statement->rowCount(); $statement = $pdo->prepare("SELECT * FROM `tbl_vendor_invoice_payment` where invoice_id=".$ids." and type=2"); $statement->execute(); $inv_payment_reduction_data = $statement->fetchAll(PDO::FETCH_ASSOC); $totalData_payment_reduction = $statement->rowCount(); ?> <div class="content-wrapper" style='background: white;'> <section class="content-header"> <center> <a href="vendor-invoice-add.php" class="btn btn-success btn-sm "><i class="fa fa-plus-circle"></i> Add Invoice</a> <a href="vendor-invoice.php" class="btn btn-success btn-sm "><i class="fa fa-plus-circle"></i> Back to List Invoice</a> <a href="vendor-invoice-view.php?id=<?=$ids?>&inv_no=<?=$inv_no?>" class="btn btn-info btn-sm "><i class="fa fa-plus-circle"></i> Back to Invoice View</a> <a href="vendor-invoice-edit.php?id=<?=$ids?>" title="Edit Invoice" class="btn btn-danger btn-sm"><i class="fa fa-edit"></i> Edit Invoice</a> <a href="vendor-invoice-payment-add.php?id=<?=$ids?>&inv_no=<?=$inv_no?>" class="btn btn-info btn-sm pull-right"><i class="fa fa-plus-circle"></i> Update Payment</a> </center> </section> <section class="content"> <center><a href="vendor-invoice-view-header.php?id=<?=$ids?>&inv_no=<?=$inv_no?>" class="btn btn-info btn-sm "><i class="fa fa-plus-circle"></i> Show With Header Invoice</a> <button class="btn btn-warning btn-sm" onclick="printDiv('printableArea')"><i class="fa fa-print"></i> Print Invoice</button></center> <div class="row" style="margin-left:15%;margin-right:15%;"> <div id="printableArea"> <?php if($totalData==1){ ?> <table> <tr> <td colspan="2"> <img src="img/Letter Head.png" style="width: 925px;"> </td> </tr> </table> <div style="margin-left:1%;margin-right:1%;"> <center style="padding:5px;"><b style="font-size:16px;">INVOICE PAYEMENT DETAILS</b></center> <table width="100%" style="font-weight:600;font-size:14px;"> <tr> <td width="50%" style="padding:2px;border:1px solid black;padding:2px;"> To,<br> <? if($inv_data[0]['name']!="") {echo $inv_data[0]['name']."<br>"; }?> <? if($inv_data[0]['address']!="") {echo nl2br($inv_data[0]['address'])."<br>"; }?> <? if($inv_data[0]['gst']!="") {echo "<b>GST NO : </b>".$inv_data[0]['gst']."<br>"; }?> </td> <td width="50%" style="vertical-align:top;padding:2px;border:1px solid black;padding:2px;"> <table width="100%" style="font-weight:600;font-size:14px;"> <tr> <td width="40%" style="padding:2px;">Invoice Number</td><td>: <?=$inv_data[0]['inv_no']?></td> </tr> <tr> <td width="40%" style="padding:2px;">Period</td><td>: <?=$inv_data[0]['period']?></td> </tr> <tr> <td width="40%" style="padding:2px;">Invoice Date</td><td>: <?=date("d-M-Y", strtotime($inv_data[0]['date']))?></td> </tr><tr> <td width="40%" style="padding:2px;">GST IN No</td><td>: 29ALUPM9087C1ZB</td> </tr> <tr> <td width="40%" style="padding:2px;">PAN NO</td><td>: ALUPM9087C</td> </tr> <tr> <td width="40%" style="padding:2px;">HSN CODE</td><td>: 996812</td> </tr> </table> </td> </tr> </table> <br> <center style="padding:5px;"><b style="font-size:16px;">INVOICE PAYEMENT HISTORY</b></center> <table width="100%" style="font-size:14px;"> <tr> <th colspan="4" style="padding:5px;border:1px solid black;">Payment Information</th> <th colspan="2" style="padding:5px;border:1px solid black;">Reduction Information</th> </tr> <tr> <td colspan="4" style="vertical-align:top;border:1px solid black;"> <table width="100%" style="font-size:14px;"> <tr> <th style="padding:5px;border:1px solid black;">S.no</th> <th style="padding:5px;border:1px solid black;">Payment Mode</th> <th style="padding:5px;border:1px solid black;">Paid Date</th> <th style="padding:5px;border:1px solid black;">Amount</th> </tr> <?php $r=1;foreach($inv_payment_data as $inv_row){ ?> <tr> <td style="padding:3px;text-align:center;border:1px solid black;"><?=$r?></td> <td style="padding:3px;text-align:center;border:1px solid black;"><?=$inv_row['paid_method']?></td> <td style="padding:3px;text-align:center;border:1px solid black;"><?=date('d-m-Y',strtotime($inv_row['paid_date']));?></td> <td style="padding:3px;text-align:center;border:1px solid black;"><?=number_format((float)$inv_row["amount"], 2, '.', '');?></td> </tr> <?php $r++; } ?> </table> </td> <td colspan="2" style="vertical-align:top;border:1px solid black;"> <table width="100%" style="font-size:14px;"> <tr> <th style="padding:5px;border:1px solid black;">S.no</th> <th style="padding:5px;border:1px solid black;">Reduction Details</th> <th style="padding:5px;border:1px solid black;">Amount</th> </tr> <?php if($totalData_payment_reduction){ $r=1;foreach($inv_payment_reduction_data as $inv_row){ ?> <tr> <td style="padding:3px;text-align:center;border:1px solid black;"><?=$r?></td> <td style="padding:3px;text-align:center;border:1px solid black;"><?=$inv_row['paid_method']?></td> <td style="padding:3px;text-align:center;border:1px solid black;"><?=number_format((float)$inv_row["amount"], 2, '.', '');?></td> </tr> <?php $r++; } }else{echo " <td colspan='3' rowspan='".$totalData_payment."' style='padding:3px;text-align:center;border:1px solid black;'>Nill</td>";}?> </table> </td> </tr> </table> <table width="100%" style="font-size:14px;"> <tr> <td colspan="4" style="padding:3px;text-align:right;border:1px solid black;font-weight:700;">Total Invoice Amount : </td> <td style="padding:3px;text-align:right;border:1px solid black;font-weight:700;"><?=number_format((float)$inv_data[0]["invoice_amount"], 2, '.', '');?></td> </tr> <?php if($inv_data[0]['tax_type']==1){ ?> <tr> <td colspan="4" style="padding:3px;text-align:right;border:1px solid black;font-weight:700;">GST <?=$inv_data[0]['gst_percentage']/2?>% : </td> <td style="padding:3px;text-align:right;border:1px solid black;font-weight:700;"><?=number_format((float)($inv_data[0]['final_amount']-$inv_data[0]['invoice_amount']), 2, '.', '')?></td> </tr> <!--<tr> <td colspan="4" style="padding:3px;text-align:right;border:1px solid black;font-weight:700;">CGST <?=$inv_data[0]['gst_percentage']/2?>% : </td> <td style="padding:3px;text-align:right;border:1px solid black;font-weight:700;"><?=number_format((float)($inv_data[0]['invoice_amount']*$inv_data[0]['gst_percentage']/100)/2, 2, '.', '')?></td> </tr>--> <?php }else{ ?> <tr> <td colspan="4" style="padding:3px;text-align:right;border:1px solid black;font-weight:700;">IGST <?=$inv_data[0]['gst_percentage']?>% : </td> <td style="padding:3px;text-align:right;border:1px solid black;font-weight:700;"><?=number_format((float)($inv_data[0]['final_amount']-$inv_data[0]['invoice_amount']), 2, '.', '')?></td> </tr> <?php } ?> <tr> <td colspan="4" style="padding:3px;text-align:right;border:1px solid black;font-weight:700;">Total : </td> <td style="padding:3px;text-align:right;border:1px solid black;font-weight:700;"><?=number_format((float)$inv_data[0]['final_amount'], 2, '.', '')?></td> </tr> <tr> <td colspan="4" style="padding:3px;text-align:right;border:1px solid black;font-weight:700;">Grand Total : </td> <td style="padding:3px;text-align:right;border:1px solid black;font-weight:700;"><?=number_format((float)round($inv_data[0]['final_amount']), 2, '.', '')?></td> </tr> <tr> <td colspan="4" style="padding:3px;text-align:right;border:1px solid black;font-weight:700;">Paid Amount : </td> <td style="padding:3px;text-align:right;border:1px solid black;font-weight:700;"><?=number_format((float)round($inv_data[0]['paid']), 2, '.', '')?></td> </tr> <tr> <td colspan="4" style="padding:3px;text-align:right;border:1px solid black;font-weight:700;">Reduction Amount : </td> <td style="padding:3px;text-align:right;border:1px solid black;font-weight:700;">- <?=number_format((float)round($inv_data[0]['reduction']), 2, '.', '')?></td> </tr> <?php if($inv_data[0]['paid']+$inv_data[0]['reduction']<$inv_data[0]['invoice_amount']){ ?> <tr> <td colspan="4" style="padding:3px;text-align:right;border:1px solid black;font-weight:700;">Pending Amount : </td> <td style="padding:3px;text-align:right;border:1px solid black;font-weight:700;"> <?=number_format((float)round($inv_data[0]['final_amount']-($inv_data[0]['paid']+$inv_data[0]['reduction'])), 2, '.', '')?></td> </tr> <?php } ?> </table> <br><br><br><br><br> <table width="100%"> <tr> <td width="60%"> </td> <td style="text-align:center;font-size:14px;"> <b>THANKING YOU</b><br> <p style="min-height:70px;"> <img src="img/Digital Sign.jpg" style="width: 200px;"> </p> <b>(MURALI.K.REDDY)</b> </td> </tr> </table> </div> <?php }?> </div> </div> </section> </div> <style> </style> <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; } function payment_delete(id){ var result = confirm("Confirm want to delete this payment?"); if (result) { $.ajax({ type: 'POST', url: 'api/delete.php', data: {type:'payment_delete',delete_id:id}, success: function(response) { console.log(response); location.reload(); } }); } } </script> <style> .td,.td{ padding:3px; text-align:center; border:1px solid black; }.th{ background:#00c0ef; padding:5px; border:1px solid black; }.table{ margin:10px; border:1px solid black; } </style> <?php function getIndianCurrency(float $number) { $no = floor($number); $decimal = round($number - $no, 2) * 100; $decimal_part = $decimal; $hundred = null; $hundreds = null; $digits_length = strlen($no); $decimal_length = strlen($decimal); $i = 0; $str = array(); $str2 = array(); $words = array(0 => '', 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', 5 => 'five', 6 => 'six', 7 => 'seven', 8 => 'eight', 9 => 'nine', 10 => 'ten', 11 => 'eleven', 12 => 'twelve', 13 => 'thirteen', 14 => 'fourteen', 15 => 'fifteen', 16 => 'sixteen', 17 => 'seventeen', 18 => 'eighteen', 19 => 'nineteen', 20 => 'twenty', 30 => 'thirty', 40 => 'forty', 50 => 'fifty', 60 => 'sixty', 70 => 'seventy', 80 => 'eighty', 90 => 'ninety'); $digits = array('', 'hundred','thousand','lakh', 'crore'); while( $i < $digits_length ) { $divider = ($i == 2) ? 10 : 100; $number = floor($no % $divider); $no = floor($no / $divider); $i += $divider == 10 ? 1 : 2; if ($number) { $plural = (($counter = count($str)) && $number > 9) ? 's' : null; $hundred = ($counter == 1 && $str[0]) ? ' and ' : null; $str [] = ($number < 21) ? $words[$number].' '. $digits[$counter]. $plural.' '.$hundred:$words[floor($number / 10) * 10].' '.$words[$number % 10]. ' '.$digits[$counter].$plural.' '.$hundred; } else $str[] = null; } $d = 0; while( $d < $decimal_length ) { $divider = ($d == 2) ? 10 : 100; $decimal_number = floor($decimal % $divider); $decimal = floor($decimal / $divider); $d += $divider == 10 ? 1 : 2; if ($decimal_number) { $plurals = (($counter = count($str2)) && $decimal_number > 9) ? 's' : null; $hundreds = ($counter == 1 && $str2[0]) ? ' and ' : null; @$str2 [] = ($decimal_number < 21) ? $words[$decimal_number].' '. $digits[$decimal_number]. $plural.' '.$hundred:$words[floor($decimal_number / 10) * 10].' '.$words[$decimal_number % 10]. ' '.$digits[$counter].$plural.' '.$hundred; } else $str2[] = null; } $Rupees = implode('', array_reverse($str)); $paise = implode('', array_reverse($str2)); $paise = ($decimal_part > 0) ? $paise . ' paise' : ''; return ($Rupees ? $Rupees . 'rupees ' : '') . $paise; } include "footer.php";?>