ok
Direktori : /home2/selectio/public_html/lilyexpresslive/expense-invoice/ |
Current File : /home2/selectio/public_html/lilyexpresslive/expense-invoice/vendor-invoice-view.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 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(); ?> <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 Vendor Invoice</a> <a href="vendor-invoice.php" class="btn btn-success btn-sm "><i class="fa fa-plus-circle"></i> Back to List Vendor Invoice</a> <a href="vendor-invoice-payment.php?id=<?=$ids?>&inv_no=<?=$inv_no?>" class="btn btn-info btn-sm "><i class="fa fa-plus-circle"></i> View Payment Information</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 Vendor Invoice</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){ ?> <div style="margin-left:5%;margin-right:5%;"><br> <center style="padding:5px;"><b style="font-size:20px;">TAX INVOICE</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;"> From,<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> <table width="100%" style="font-weight:600;"> <tr> <td style="text-align:center;border:1px solid black;padding:2px;" width="5%">SL.NO</td> <td style="text-align:center;border:1px solid black;padding:2px;">DESRIPTION</td> <td style="text-align:center;border:1px solid black;padding:2px;" width="25%">AMOUNT</td> </tr> <?php $statement = $pdo->prepare("SELECT * FROM `tbl_vendor_invoice_items` where invoice_id=".$ids." and type=1"); $statement->execute(); $item_data = $statement->fetchAll(PDO::FETCH_ASSOC); $totalitem = $statement->rowCount(); $sn=1;$total=0;foreach($item_data as $item){ ?> <tr> <td style="text-align:center;border:1px solid black;padding:2px;"><?=$sn?></td> <td style="border:1px solid black;padding:2px;"><?=$item['item_name']?></td> <td style="text-align:right;padding-right:10px;border:1px solid black;padding:2px;"><?=number_format((float)$item['amount'], 2, '.', '')?></td> </tr> <?php $sn++;$total=$total+$item['amount']; } ?> <tr> <td colspan="2" style="border:1px solid black;padding:2px;padding-left: 45%;">Total Amount</td> <td style="text-align:right;padding-right:10px;border:1px solid black;padding:2px;"><?=number_format((float)$total, 2, '.', '')?></td> </tr> <?php if($inv_data[0]['tax_type']==1){ ?> <!--<tr> <td colspan="2" style="border:1px solid black;padding:2px;padding-left: 45%;">SGST <?=$inv_data[0]['gst_percentage']/2?>%</td> <td style="text-align:right;padding-right:10px;border:1px solid black;padding:2px;"><?=number_format((float)($inv_data[0]['invoice_amount']*$inv_data[0]['gst_percentage']/100)/2, 2, '.', '')?></td> </tr> <tr> <td colspan="2" style="border:1px solid black;padding:2px;padding-left: 45%;">CGST <?=$inv_data[0]['gst_percentage']/2?>%</td> <td style="text-align:right;padding-right:10px;border:1px solid black;padding:2px;"><?=number_format((float)($inv_data[0]['invoice_amount']*$inv_data[0]['gst_percentage']/100)/2, 2, '.', '')?></td> </tr>--> <tr> <td colspan="2" style="border:1px solid black;padding:2px;padding-left: 45%;">GST <?=$inv_data[0]['gst_percentage']?>%</td> <td style="text-align:right;padding-right:10px;border:1px solid black;padding:2px;"><?=number_format((float)($total*$inv_data[0]['gst_percentage']/100), 2, '.', '')?></td> </tr> <?php }else{ ?> <tr> <td colspan="2" style="border:1px solid black;padding:2px;padding-left: 45%;">IGST <?=$inv_data[0]['gst_percentage']?>%</td> <td style="text-align:right;padding-right:10px;border:1px solid black;padding:2px;"><?=number_format((float)($total*$inv_data[0]['gst_percentage']/100), 2, '.', '')?></td> </tr> <?php } ?> <tr> <td colspan="2" style="border:1px solid black;padding:2px;padding-left: 45%;">Total Amount (Inc Tax)</td> <td style="text-align:right;padding-right:10px;border:1px solid black;padding:2px;"><?=number_format((float)$inv_data[0]['final_amount'], 2, '.', '')?></td> </tr> <?php // $statement = $pdo->prepare("SELECT * FROM `tbl_vendor_invoice_items` where invoice_id=".$ids." and type=2"); // $statement->execute(); // $item_data = $statement->fetchAll(PDO::FETCH_ASSOC); // $totalitem = $statement->rowCount(); // $sn=1;foreach($item_data as $item){ ?> <!-- <tr> <td colspan="2" style="border:1px solid black;padding:2px;text-align:right;"><?=$item['item_name']?></td> <td style="text-align:right;padding-right:10px;border:1px solid black;padding:2px;">(-) <?=number_format((float)$item['amount'], 2, '.', '')?></td> </tr>--> <?php //$sn++; } ?> <?php if(round($inv_data[0]['invoice_amount'])!=0){ ?> <tr> <td colspan="2" style="border:1px solid black;padding:2px;padding-left: 45%;">Round Off</td> <td style="text-align:right;padding-right:10px;border:1px solid black;padding:2px;"><?=number_format((float)round($inv_data[0]['final_amount'])-$inv_data[0]['final_amount'], 2, '.', '')?></td> </tr> <?php } ?> <tr> <td colspan="2" style="border:1px solid black;padding:2px;padding-left: 45%;">Grand Total</td> <td style="text-align:right;padding-right:10px;border:1px solid black;padding:2px;"><?=number_format((float)round($inv_data[0]['final_amount']), 2, '.', '')?></td> </tr> <tr> <td colspan="3" style="border:1px solid black;padding:2px;"><span ><b>Amount In words :-</b> <?=ucfirst(getIndianCurrency(round($inv_data[0]['final_amount'])))." only/-"?></span></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; } </script> <?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) ? '' : 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) ? '' : 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";?>