File: /var/www/grapossconnect/admin-dash/invoice_template.php
<?php
include_once('_dbconfig.php');
global $wpdb;
$id = $_REQUEST['id'];
$invoiceQry = $conn->query("SELECT invoice_id, from_domain, transaction_type, product_mrp, igst_amount, cgst_amount, sgst_amount, taxable_amount, net_amount, customer_name, customer_address, customer_gstin, customer_state_name, customer_state_id, transaction_id1, transaction_date, year_extn FROM grp_gepl_invoice where invoice_id=$id");
$result = $invoiceQry->fetch_assoc();
if ($result['customer_state_id'] == 36) {
$grand_amount = round(($result['taxable_amount']) + ($result['cgst_amount']) + ($result['sgst_amount']));
} else {
$grand_amount = round(($result['taxable_amount']) + ($result['igst_amount']));
}
?>
<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>
<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="assets/img/print-icon.jpg" 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="assets/img/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($result['transaction_date'])); ?></td>
</tr>
<tr>
<td class="mob">GSTIN : 07AAECG4440M1ZH</td>
<td class="align_right tran">TRANSACTION ID : <?php echo $result['transaction_id1']; ?></td>
</tr>
<tr>
<td class="mob">CIN : U80301DL2011PTC226155</td>
<td class="align_right invoice">INVOICE : <?php echo $result['invoice_id']; ?> <?php if($result['year_extn']){ echo '/'.$result['year_extn']; } ?></td>
</tr>
</table>
<h4 class="title2">TAX INVOICE</h4>
<h4 class="ltd"><?php echo $result['customer_name']; ?></h4>
<p class="address"><?php echo $result['customer_address']; ?></p>
<table>
<tr>
<th class="font_size">GSTIN : <?php echo $result['customer_gstin']; ?></th>
<th class="font_size2 supply">Place of Supply : <?php echo $result['customer_state_name']; ?></th>
</tr>
</table>
<table class="marmob">
<tr class="table_row">
<th class="center_border">QTY</th>
<th class="center_border">DOMAIN NAME</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 $result['from_domain']; ?></td>
<td class="center_border"><?php echo $result['transaction_type']; ?></td>
<td class="center_border"><?php echo "999293"; ?> </td>
<td style="border-right:none;" class="center_border"><?php echo $result['product_mrp']; ?></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 $result['taxable_amount']; ?></td>
<td class="center_border"><?php echo $result['sgst_amount']; ?></td>
<td class="center_border"><?php echo $result['cgst_amount']; ?></td>
<td class="center_border"><?php echo $result['igst_amount']; ?></td>
<td style="border-right:none;" class="center_border"><?php echo $grand_amount; ?></td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
<table>
<tr>
<th></th>
</tr>
</table>
<h4 class="total">Total In Words: <?php echo convertToIndianCurrency($grand_amount); ?>
<?php
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";
}
?>
</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="https://lh3.googleusercontent.com/-tHsyXr6i2N4/Wv1eVDs8QoI/AAAAAAAABdQ/8mIbm77Ql3kZg4nmfb16Ih3Z46K04RFlgCL0BGAYYCw/h76/2018-05-17.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, 1/22, 2nd Floor, Asaf Ali road, New Delhi - 110002</h4>
<h4 class="footer_title2">Phone Number: 011-41038474 / 49066459</h4>
<div>
</div>
</div>
</div>
</div>