File: //var/www/selfanalyse/accounts-admin/invoice-page.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', 'ON');
include("../wp-config.php");
global $wpdb;
$PSY_INVOICE = $wpdb->prefix . PSY_INVOICE;
$oId = $_REQUEST['oId'];
$type = $_REQUEST['type'];
$getInvoice = $wpdb->get_row("SELECT id,type,order_amount,transaction_id,name,email,address,state_id,gstin,gst_name,year_extn,txn_date,issue_date FROM $PSY_INVOICE where order_id='$oId' and type_extn='$type'");
$invId = $getInvoice->id;
if($invId != '' && $invId != '0') {
$type = $getInvoice->type;
$order_amount = $getInvoice->order_amount;
$transaction_id = $getInvoice->transaction_id;
$name = $getInvoice->name;
$email = $getInvoice->email;
$address = $getInvoice->address;
$state_id = $getInvoice->state_id;
$gstin = $getInvoice->gstin;
$gst_name = $getInvoice->gst_name;
$year_extn = $getInvoice->year_extn;
$txn_date = $getInvoice->txn_date;
$issue_date = $getInvoice->issue_date;
if ($state_id == 'Delhi') {
$amount = $order_amount;
$total_amount = round(($amount / 118 * 100), 2);
$igst_amount = 0;
$cgst_amount = round(($total_amount * 9 / 100), 2);
$sgst_amount = round(($total_amount * 9 / 100), 2);
$grand_amount = round((($amount / 118 * 100) + ($total_amount * 9 / 100) + ($total_amount * 9 / 100)), 2);
} else {
$cgst_amount = 0;
$sgst_amount = 0;
$amount = $order_amount;
$total_amount = round(($amount / 118 * 100), 2);
$igst_amount = round(($total_amount * 18 / 100), 2);
$grand_amount = round((($amount / 118 * 100) + ($total_amount * 18 / 100)), 2);
}
function convertToIndianCurrency($number)
{
$no = round($number);
$decimal = round($number - ($no = floor($number)), 2) * 100;
$digits_length = strlen($no);
$i = 0;
$str = 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;
$str[] = ($number < 21) ? $words[$number] . ' ' . $digits[$counter] . $plural : $words[floor($number / 10) * 10] . ' ' . $words[$number % 10] . ' ' . $digits[$counter] . $plural;
} else {
$str[] = null;
}
}
$Rupees = implode(' ', array_reverse($str));
$paise = ($decimal) ? "And Paise " . ($words[$decimal - $decimal % 10]) . " " . ($words[$decimal % 10]) : '';
return ($Rupees ? 'Rupees ' . $Rupees : '') . $paise . " Only";
}
?>
<script type="text/javascript">
function printReport(divName) {
var printContents = document.getElementById(divName).innerHTML;
document.title = "\u00A0";
var disp_setting = "toolbar=no,location=no,directories=no,menubar=no,";
disp_setting += "scrollbars=no,left=0,top=0,resizable=yes,width=950, height=650,";
var docprint = window.open("", "", disp_setting);
docprint.document.open();
docprint.document.write('<html dir="<%=_direction %>"><head><title></title>');
//For Adding the proper StyleSheet
docprint.document.write('</head><body>');
docprint.document.write(printContents);
docprint.document.write("</b" + "ody></html>");
docprint.print();
docprint.close();
window.close();
}
</script>
<link rel="icon" type="image/png" sizes="32x32" href="/wp-content/themes/psychometrics/images/favicon.png"/>
<title>
Invoice
</title>
<body>
<table width="100%" border="0">
<tr>
<td style=" text-align:right;">
<a href="#" class="btn btn-primary no-print" name="print" onClick="printReport('print_area')">
<img src="/counselor/assets/images/downlaod-icon.webp" alt="print-icon" />
</a>
</td>
</tr>
</table>
<div id="print_area">
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
@media only screen and (max-width: 600px) {
.mob {
min-width: 100px;
}
.center_border {}
}
td,
th {
text-align: left;
padding: 4px;
font-size: 11px;
}
@media only screen and (max-width: 600px) {
.box {
width: 100% !important;
margin: auto !important;
}
}
.box {
border: 1px solid #000;
background: #f1f1f1;
width: 90%;
margin: 0 auto;
}
.image {
padding: 2px 0 0;
display: block;
margin-left: auto;
width: 16%;
margin-right: auto;
}
.title {
text-align: center;
margin-bottom: 0.5em;
margin-top: 10px;
text-transform: uppercase;
background: #fff;
padding: 5px 0;
border-top: 2px solid #000;
font-family: arial;
font-size: 15px;
letter-spacing: 1px;
border-bottom: 2px solid #000;
color: #000;
}
.title2 {
text-align: center;
margin-bottom: 0.5em;
margin-top: 10px;
text-transform: uppercase;
background: #fff;
padding: 5px 0;
border-top: 2px solid #000;
font-family: arial;
font-size: 15px;
letter-spacing: 1px;
border-bottom: 2px solid #000;
color: #000;
}
@media only screen and (max-width: 600px) {
.align_right {
position: absolute;
top: 16em;
left: 10px;
}
.total {
font-size: 10px !important;
}
.title {
text-align: center;
font-size: 14px;
}
.title2 {
text-align: center;
font-size: 16px;
margin-top: 5.5em;
}
.image {
padding: 8px 10px 0;
display: block;
width: 20%;
}
.invoice {
position: absolute;
top: 20em;
left: 10px;
}
.supply {
position: absolute;
left: 0.7em;
top: 33.5em;
}
.state {
position: absolute;
left: 13.9em;
top: 33.5em;
}
.marmob {
margin-top: 2em;
}
.marmob2 {
margin-top: 0em;
}
.indat {
position: absolute;
top: 18em;
left: 9.6em;
}
.tran {
position: absolute;
top: 18em;
left: 10px;
}
.trandat {
position: absolute;
top: 16em;
left: 9.6em;
}
.datdat {
position: absolute;
top: 14em;
left: 9.6em;
}
.tax_invoice {
position: absolute !important;
left: 3em !important;
top: 16.9em !important;
}
.line {
margin-top: 7em !important;
}
.linetwo {
margin-top: 1em !important;
}
}
.align_right {
text-align: right;
}
.pad {
text-align: right;
padding-right: 6px;
}
.tax_invoice {
font-family: arial;
display: inline-block;
background: #fff;
padding: 5px 5em;
position: absolute;
top: 13.4em;
left: 29em;
border: 3px solid #000;
}
.line {
height: 4px;
background: #000;
margin-top: 1em;
}
.linetwo {
height: 2px;
background: #000;
margin-top: 1em;
}
.ltd {
margin-top: 0px;
margin-bottom: 0px;
font-size: 12px;
font-family: arial;
padding-left: 9px;
}
.address {
margin-top: 5px;
font-size: 11px;
font-family: arial;
padding: 0 8px;
}
.font_size {
font-size: 11px;
}
.font_size2 {
float: right;
font-size: 11px;
}
.table_row {
border-top: 1px solid #000;
border-bottom: 1px solid #000;
color: #000;
}
.center {
font-size: 12px;
text-align: center;
padding: 10px;
}
.second_row {
background: #e0d6d6;
font-weight: bolder;
}
.center_border {
border-bottom: 1px solid;
font-size: 12px;
border-right: 1px solid;
text-align: center;
padding: 10px;
}
.third_row {
font-weight: bolder;
}
.weight {
font-weight: 100;
text-align: right;
padding: 10px;
}
.bolder {
font-weight: bolder;
}
.total {
margin-bottom: 10px;
text-align: right;
padding-right: 5px;
font-family: arial;
font-size: 10px;
margin-top: -10px;
}
.weight_100 {
font-weight: 100;
}
.footer_title {
margin-bottom: 0px;
text-align: center;
text-transform: uppercase;
padding-right: 5px;
font-family: arial;
font-size: 15px;
margin-top: -8px;
}
.footer_title2 {
text-align: center;
text-transform: capitalize;
padding-right: 5px;
font-family: arial;
font-size: 12px;
margin-top: 5px;
margin-bottom: 0px;
}
.sign {
margin-bottom: -10px;
text-align: right;
font-weight: 200;
padding-right: 5px;
font-family: arial;
font-size: 15px;
margin-top: 0px;
}
.signi {
width: 100px;
padding: 10px;
}
.sign2 {
padding: 0;
border-right: none;
float: right;
}
#print_area {
width: 100%;
}
td img {
position: absolute;
right: 23em;
top: 16px;
width: 50px;
}
</style>
<div class="box">
<div>
<img class="image" src="/counselor/assets/images/sarkaripariksha_logo.png">
<h4 class="title">graposs edutech private limited</h4>
<table>
<tr>
<td class="mob">PAN No. : AAECG4440M</td>
<td class="align_right">DATE : <?php echo date('d-M-Y', strtotime($txn_date)); ?></td>
</tr>
<tr>
<td class="mob">GSTIN : 07AAECG4440M1ZH</td>
<td class="align_right tran">TRANSACTION ID : <?php echo $transaction_id; ?></td>
</tr>
<tr>
<td class="mob">CIN : U80301DL2011PTC226155</td>
<td class="align_right invoice">INVOICE : <?php echo $invId . " / " . $year_extn; ?></td>
</tr>
</table>
<h4 class="title2">TAX INVOICE</h4>
<h4 class="ltd"><?php echo $name; ?></h4>
<p class="address"><?php echo $address; ?></p>
<table>
<tr>
<th class="font_size">GSTIN : <?php echo $gstin; ?></th>
<th class="font_size2 supply">Place of Supply : <?php echo $state_id; ?></th>
</tr>
</table>
<table class="marmob">
<tr class="table_row">
<th class="center_border">QTY</th>
<th class="center_border">DESCRIPTION</th>
<th class="center_border">SAC</th>
<th style="border-right:none;" class="center_border">TOTAL</th>
</tr>
<tr class="second_row">
<td class="center_border">1</td>
<td class="center_border"><?php echo $type; ?></td>
<td class="center_border"> </td>
<td style="border-right:none;" class="center_border"><?php echo number_format($total_amount, 2); ?></td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
<table class="marmob2">
<tr class="table_row">
<th class="center_border">TAXABLE VALUE</th>
<th class="center_border">SGST<br>@9%</th>
<th class="center_border">CGST<br>@9%</th>
<th class="center_border">IGST<br>@18%</th>
<th style="border-right:none;" class="center_border">GRAND TOTAL</th>
</tr>
<tr class="second_row">
<td class="center_border"><?php echo number_format($total_amount, 2); ?></td>
<td class="center_border"><?php echo number_format($sgst_amount, 2); ?></td>
<td class="center_border"><?php echo number_format($cgst_amount, 2); ?></td>
<td class="center_border"><?php echo number_format($igst_amount, 2); ?></td>
<td style="border-right:none;" class="center_border"><?php echo number_format($grand_amount, 2); ?></td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
<table>
<tr>
<th></th>
</tr>
</table>
<h4 class="total">Total In Words: <?php echo convertToIndianCurrency($grand_amount); ?></h4>
<!--
<h4 class="total">
<span class="weight_100">For</span> Graposs Edutech Pvt. Ltd.</h4> -->
<table>
<tr>
<th></th>
<th></th>
<th></th>
<th class="sign2"><img class="signi" src="/counselor/assets/images/invoice-sign.png"></th>
</tr>
</table>
<h4 class="sign">
<!-- <img class="signi" src="https://mail.google.com/mail/u/0?ui=2&ik=a8c5826bd0&attid=0.1.1&permmsgid=msg-f:1600707380328931942&th=1636dae1a9da2266&view=fimg&sz=w1600-h1000&attbid=ANGjdJ_bOSkQUwKuuVIfSrfWU4mHzM-DlKHtW2LP11erWlixyGCcGzgEwwzYd12_TG047Sl48qL8bBzz_-dpqBSkQ4JBYfVgXCbEaACCz38Nh-PiuTJiWVd4MhP2a_8&disp=emb"> -->
Authorized Signatory
</h4>
<hr class="linetwo">
<h4 class="footer_title">
Graposs edutech private limited</h4>
<h4 class="footer_title2">
regd. office: graposs edutech private limited, s-5, anupam plaza, opp. azad apartments new delhi-110016</h4>
<h4 class="footer_title2">
Phone Number: 011-41038474 / 49066459</h4>
<div>
</div>
</div>
</div>
</div>
<?php } else { echo "No data of this invoice"; } ?>