ok
Direktori : /home2/selectio/www/lilyexpresslive/expense-invoice/ |
Current File : /home2/selectio/www/lilyexpresslive/expense-invoice/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_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="invoice-add.php" class="btn btn-success btn-sm "><i class="fa fa-plus-circle"></i> Add Invoice</a> <a href="invoice.php" class="btn btn-success btn-sm "><i class="fa fa-plus-circle"></i> Back to List Invoice</a> <a href="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="invoice-edit.php?id=<?=$ids?>" title="Edit Invoice" class="btn btn-danger btn-sm"><i class="fa fa-edit"></i> Edit Invoice</a> </center> </section> <section class="content"> <center><a href="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> <p style="min-height:120px;"></p> </div> <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;"> 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>"; }?> <? if($inv_data[0]['po_number']!="") {echo "<b>PO Number : </b>".$inv_data[0]['po_number']."<br>"; }?> <? if($inv_data[0]['po_date']!="" && $inv_data[0]['po_date']!="0000-00-00") {echo "<b>PO Date: </b>".date("d-M-Y", strtotime($inv_data[0]['po_date']))."<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']."/".$inv_data[0]['year']?></td> </tr> <tr> <td width="40%" style="padding:2px;">Invoice 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;">GSTIN </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_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']; } ?> <?php if(count($item_data)>1){ ?> <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 } ?> <?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</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_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 style="margin-top:15px;"> <table style="margin-top:20px;border:1px solid;padding:5px;" width="100%"> <tr> <td colspan="2" style="text-align:center;padding:2px;"><b><u>BANK DETAILS</u></b></td> </tr> <tr> <td style="padding:2px;">Beneficiary Name :<b>LILY EXPRESS SERVICES</b></td> <td style="padding:2px;">Bank Account No :<b>565101000071976</b></td> </tr> <tr> <td style="padding:2px;">Bank Name : <b>UNION BANK OF INDIA</b></td> <td style="padding:2px;">Branch Name :<b>SHANTHINAGAR</b></td> </tr> <tr> <td style="padding:2px;">IFSC Code :<b>UBIN0902225</b></td> <td style="padding:2px;">Account Type : <b>CURRENT ACCOUNT</b></td> </tr> </table> </div> <br><br> <table width="100%" style="padding-top:50px;"> <tr> <td width="60%"> </td> <td style="text-align:center"> <b>For Lily Express Services</b><br> <p style="min-height:120px;"> <!--<img src="img/Digital Sign.jpg" style="width: 200px;">--> </p> <b>Authorized Signature</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; } </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";?>