<?php
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
$zroot = $_SESSION["zdir"];
$zcomp = $_SESSION["comp_" . $dbname];

$fseries = $_SESSION["series_" . $dbname];

$keycond = "";

$myyear = $_SESSION[$myyear];
mysqli_select_db($conn, $zdb);
$zyear = $myyear;

$vouch = $_GET['vouchno'];

$cond = '';
$lcond = '';
$formname = "Tax Invoice";

$maindb = 'salemain';
$trandb = 'saletran';

$getqry = mysqli_query($conn, "SELECT *, DATE_FORMAT(`vouchdt`, '%d-%m-%Y')as vouchdt   FROM `$maindb` WHERE vouchno='$vouch' $keycond ORDER BY `vouchno`") or die(mysqli_error($conn));
$getdata = mysqli_fetch_array($getqry);

$cmpname = mysqli_query($conn, "SELECT * From $zroot.`company` where `code`='$zcomp' ") or die(mysqli_error($conn));
$getcmpname = mysqli_fetch_array($cmpname);
$init = $getcmpname['init'];

$invoice = $init . "/" . $zyear . "/" . $getdata["vouchno"];

$getparty = mysqli_query($conn, "SELECT * FROM accmast WHERE `accode` = '$getdata[party]'") or die(mysqli_error($conn));
$showparty = mysqli_fetch_array($getparty);

$gettransp = mysqli_query($conn, "SELECT `code`,`name` FROM `transport` WHERE `code`= '$getdata[transporter]'") or die(mysqli_error($conn));
$ltrans = mysqli_fetch_array($gettransp);

$oms = $getdata['oms'];
if ($getdata['prnflag'] == '1') {
    $prnf = 'P';
}
?>

<!DOCTYPE HTML>
<html lang="en-US">


<?php
//        include("includes/files.php");
//        include("includes/tabsuf.php");
?>
<style>
    body {
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        /*background-color: #FAFAFA;*/
        font: 10pt "Verdana";
    }

    .border {
        border: 1px solid black;
    }

    .page {
        width: 207mm;
        min-height: 280mm;
        padding: 2mm;
        /*padding-left: 3%;*/
        margin: 5mm auto;
        /*        border: 1px #D3D3D3 solid;
                        border-radius: 5px;*/
        /*background: white;*/

    }

    /*        .subpage {
                            padding: 0cm;
                                    border: 1px solid;
                            height: 288mm;
                            outline: 2cm #ffffff solid;
                        }*/

    @page {
        size: A4;
        margin: 0;

        page-break-inside: avoid;
    }

    @media print {
        @page {
            size: A4;
            margin: 0;

            page-break-inside: avoid;
        }

        .noprint {
            display: none;
        }

        html,
        body {
            /*                width: 207mm;
                                        height: 280mm;    */
            page-break-before: always;
        }

        .page {
            width: 207mm;
            min-height: 270mm;
            padding: 2mm;
            /*padding-left: 3px;*/
            margin: 2mm auto;
            /*            border: 1px #D3D3D3 solid;
                                border-radius: 5px;*/
            page-break-inside: auto;
            width: 93%;
        }

        /*            .pageBreak{
                                    page-break-inside:  auto ;
                    
                                }*/
    }

    .numeric {
        text-align: right;
    }

    .rnone {
        border-right: none;
    }

    .lnone {
        border-left: none;
    }
</style>
</head>

<body id="main_container">
    <div class="book">
        <button class="btn btn-primary goBack noprint" onclick="window.close()"
            style="float: right;width: 150px;height:35px;background-color: white;color:#A0B1BA;">Go Back</button>
        <div class="page" style="page-break-after:always;padding-left:35px;">
            <!--   ************Header************  -->

            <div style="border:solid 1px;border-collapse: collapse" class="col-md-12">

                <table>
                    <tr>
                        <td style="width:15%;padding-left: 1.5%;">
                            <img src="images/logo.png?a=2" alt="Logo" style="height: 111px;width: 126px;">
                        </td>

                        <td style="width:85%;padding-left: 5%">
                            <center><b
                                    style="margin-top:1px;margin-bottom: 5px;font-size: 44px;background-color: #000000;color:#fbaa1a"><? echo $getcmpname['compname']; ?></b><br>
                                <?php
                                $address = $getcmpname['hoadd1'] . ' ' . $getcmpname['hoadd2'] . ' ' . $getcmpname['hoadd3'] . ' ' . $getcmpname['hocity'] . ' ' . $getcmpname['hopin'] . ' ';
                                echo "<b>TRADER | WHOLESALER | MANUFACTURER <br> ALL KINDS OF FOOTWEAR</b><br>";

                                echo $address;
                                ?><br>
                                <? if ($getcmpname['email'] != '') { ?>
                                    <?php
                                    echo "Email :" . $getcmpname['email'];
                                }
                                ?>
                                <?php echo "Contact No :" . $getcmpname['htel'] . ".    GST NO : " . $getcmpname['gstno']; ?>
                                <h3 style="margin-top:2px;margin-bottom: 2px;"><b><?php echo "$formname"; ?></b></h3>
                                <?php if ($prnadd != '') { ?>
                                    <h5 style="margin-top:2px;margin-bottom: 2px;"><b>GST
                                            No:<?php echo $fcmpbrch['gstno']; ?></b></h5>
                                <?php } ?>
                            </center>
                        </td>
                    </tr>
                </table>
            </div>
            <div style="border:solid 1px;border-collapse: collapse" class="col-md-12">

                <table class="table table-border" style="width:100%;border-spacing: 1px">
                    <tr>
                        <td style="text-align: center; width:50%;border:1px solid black"><b>Bill To Party</b></td>
                        <td style="text-align: center; width:50%;border:1px solid black"><b>Ship To Party</b></td>
                    </tr>
                    <tr>
                        <?php
                        if ($getdata["nameprint"] != '') {
                            $printname = $getdata["nameprint"];
                            $printmobile = $getdata["printmobile"];
                        } else {
                            $printname = $showparty['name'];
                            $printmobile = $showparty['mobile'];
                        }

                        if ($getdata["shipgstno"] == $showparty['gstno'] || $getdata['shipgstno'] == '') {
                            $gstno = $showparty['gstno'];
                        } else {
                            $gstno = $getdata['shipgstno'];
                        }
                        ?>

                        <td style="text-align: center; width:50%;border:1px solid black;">
                            <div style="border-collapse: collapse" class="col-md-12">
                                <table class="table table-bordered " style="width:100%;border-spacing: 0px">
                                    <tr>
                                        <td style="text-align: left; width:4%;font-size:12px"><b>M/s.</b></td>
                                        <td style="width:1%">:</td>
                                        <td style="text-align: left; width:95%;font-size:12px">
                                            <?php echo "$printname"; ?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: left; width:4%;font-size:12px">Address</td>
                                        <td style="width:1%">:</td>
                                        <td style="text-align: left; width:95%;font-size:11px">
                                            <?php echo "$showparty[add1]  $showparty[add2]"; ?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: left; width:4%">&nbsp;&nbsp;&nbsp;&nbsp;</td>
                                        <td style="width:1%"></td>
                                        <td style="text-align: left; width:95%;font-size:11px">
                                            <?php echo "$showparty[add3]  $showparty[city] $showparty[pin]"; ?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: left; width:4%">Mobile</td>
                                        <td style="width:1%">:</td>
                                        <td style="text-align: left; width:95%;font-size:12px">
                                            <?php echo "$printmobile"; ?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: left; width:4%;font-size:11px">GST No.</td>
                                        <td style="width:1%">:</td>
                                        <td style="text-align: left; width:95%;font-size:12px">
                                            <?php echo "$showparty[gstno]"; ?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: left; width:4%;font-size:11px">Aadhaar / PAN</td>
                                        <td style="width:1%">:</td>
                                        <td style="text-align: left; width:95%;font-size:12px">
                                            <?php echo "$showparty[pan]"; ?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: left; width:4%">State</td>
                                        <td style="width:1%">:</td>
                                        <td style="text-align: left; width:95%;font-size:12px">
                                            <?php echo "$showparty[state]"; ?> &nbsp;&nbsp;&nbsp;&nbsp;
                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;State Code :
                                            <?php echo "$showparty[statecode]"; ?>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                        <td style="text-align: left; width:50%;border:  1px solid black">
                            <div style="border-collapse: collapse" class="col-md-12">

                                <table class="table table-bordered" style="width:100%;border-spacing: 0px">
                                    <tr>
                                        <td style="text-align: left; width:4%;font-size:12px"><b>M/s.</b></td>
                                        <td style="width:1%">:</td>
                                        <td style="text-align: left; width:95%;font-size:12px">
                                            <?php echo "$getdata[shipname]"; ?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: left; width:4%;font-size:12px">Address</td>
                                        <td style="width:1%">:</td>
                                        <td style="text-align: left; width:95%;font-size:11px">
                                            <?php echo "$getdata[shipadd1]  $getdata[shipadd2]"; ?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: left; width:4%;font-size:12px">&nbsp;&nbsp;&nbsp;&nbsp;
                                        </td>
                                        <td style="width:1%"></td>
                                        <td style="text-align: left; width:95%;font-size:11px">
                                            <?php echo "$getdata[shipadd3]"; ?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: left; width:4%;font-size:12px">Mobile</td>
                                        <td style="width:1%">:</td>
                                        <td style="text-align: left; width:95%;font-size:12px">
                                            <?php echo "$printmobile"; ?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: left; width:4%;font-size:11px">GST No.</td>
                                        <td style="width:1%">:</td>
                                        <td style="text-align: left; width:95%;font-size:12px"><?php echo "$gstno"; ?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: left; width:4%;font-size:11px">Aadhaar / PAN</td>
                                        <td style="width:1%">:</td>
                                        <td style="text-align: left; width:95%;font-size:12px">
                                            <?php echo "$showparty[pan]"; ?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: left; width:4%;font-size:12px">State</td>
                                        <td style="width:1%">:</td>
                                        <td style="text-align: left; width:95%;font-size:12px">
                                            <?php echo "$showparty[state]"; ?> &nbsp;&nbsp;&nbsp;&nbsp;
                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;State Code :
                                            <?php echo "$showparty[statecode]"; ?>
                                        </td>
                                    </tr>

                                </table>
                            </div>
                        </td>
                    </tr>

                    <tr>
                        <td style="text-align: center; width:50%;border:1px solid black;border-right: 1px solid black ">
                            <div style="border-collapse: collapse" class="col-md-12">

                                <table class="table table-bordered table-hover" style="width:100%">
                                    <tr>
                                        <td style="text-align: left; width:25%;font-size:12px"><b>Invoice No.</b></td>
                                        <td style="width:1%">:</td>
                                        <td style="text-align: left; width:74%"><b><?php echo $invoice; ?></b></td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: left; width:25%;font-size:12px"><b>Date</b></td>
                                        <td style="width:1%">:</td>
                                        <td style="text-align: left; width:74%">
                                            <b><?php echo "$getdata[vouchdt]"; ?></b>
                                        </td>
                                    </tr>

                                    <?php
                                    if ($getdata['cashcred'] == "R") {
                                        $paytype = "Credit";
                                    } else {
                                        $paytype = "Cash";
                                    }


                                    if ($getdata['area'] != "") {
                                        ?>
                                        <tr>
                                            <td style="text-align: left; width:25%;font-size:12px"><b>Booking</b></td>
                                            <td style="width:1%">:</td>
                                            <td style="text-align: left; width:74%"><b><?php echo "$getdata[area]"; ?>
                                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                    Paid By : <?php echo $paytype; ?> </b></td>
                                        </tr>
                                    <?php } else { ?>
                                        <tr>
                                            <td style="text-align: left; width:25%;font-size:12px"><b> Paid By </b></td>
                                            <td style="width:1%">:</td>
                                            <td style="text-align: left; width:74%"><b><?php echo "$paytype"; ?> </b></td>
                                        </tr>
                                    <?php } ?>

                                </table>
                            </div>
                        </td>

                        <td style="text-align: center; width:50%;border:1px solid black">
                            <div style="border-collapse: collapse" class="col-md-12">

                                <table class="table table-bordered table-hover" style="width:100%">

                                    <tr>
                                        <td style="text-align: left; width:34%;font-size:12px"><b>E-way Bill No.</b>
                                        </td>
                                        <td style="width:1%">:</td>
                                        <td style="text-align: left; width:65%">
                                            <b><?php echo $getdata["ewaybill"]; ?></b>
                                        </td>
                                    </tr>



                                    <tr>
                                        <td style="text-align: left; width:34%;font-size:12px"><b>Transporter</b></td>
                                        <td style="width:1%">:</td>
                                        <td style="text-align: left; width:65%"><b><?php echo "$ltrans[name]"; ?></b>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td style="text-align: left; width:34%;font-size:12px"><b>Terms of Delivery</b>
                                        </td>
                                        <td style="width:1%">:</td>
                                        <td style="text-align: left; width:65%">
                                            <b><?php echo $getdata['remark1'] . $getdata['remark2']; ?></b>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                    </tr>
                </table>
            </div>

            <div>
                <table border="solid 1px" class="pageBreak" style="border-collapse: collapse; width:100%;">
                    <tr>
                        <th style="width:3%; color:black; text-align: right;"><label>Sr.</label></th>
                        <th style="width:35%; color:black;"><label>Itemname</label></th>
                        <th style="width:10%; color:black;"><label>Hsn</label></th>
                        <th style="width:6%; color:black; text-align: right;"><label>GST %</label></th>
                        <th style="width:9%; color:black; text-align: right;"><label>Qty.</label></th>
                        <th style="width:9%; color:black; text-align: right;"><label>Rate</label></th>
                        <th style="width:11%; color:black; text-align: right;"><label>Amount</label></th>
                        <th style="width:9%; color:black; text-align: right;"><label>Discount</label></th>
                        <th style="width:11%; color:black; text-align: right;"><label>Taxable</label></th>
                    </tr>

                    <?php
                    $ctr = 0;
                    $mctr = 1;
                    $ctab = 0;
                    $totqty = 0;
                    $pname = "";
                    $sqty = 0;
                    $samount = 0;
                    $sdiscount = 0;
                    $ssubtot = 0;
                    $tgrp = "";

                    $gettran = mysqli_query($conn, "SELECT * FROM `$trandb` WHERE `vouchno`='$vouch' $keycond order by srno") or die(mysqli_error($conn));
                    while ($showtran = mysqli_fetch_array($gettran)) {
                        $getitem = mysqli_query($conn, "SELECT `name`,`code`  From `product` WHERE `code` = '$showtran[item]' ") or die(mysqli_error($conn));
                        $showitem = mysqli_fetch_array($getitem);

                        $gstperc = $showtran['cgstrate'] * 2;
                        $gstamt = $showtran['cgstamt'] * 2;

                        $nameprint = $showitem["nameprint"];
                        $name = $showitem["name"];

                        if ($nameprint != '') {
                            $itemname = $nameprint;
                        } else {
                            $itemname = $name;
                        }

                        $a = 0;
                        $pname = $itemname;
                        $sqty = $showtran['qty'];
                        $smrp = $showtran['rate'];

                        $fqty = number_format($sqty, 0);
                        $fmrp = number_format($smrp, 0);

                        $samount = $showtran['qty'] * $showtran['rate'];

                        $sdiscount = $showtran['discount'];
                        $fdiscount = number_format($sdiscount, 2);

                        $ssubtot = $showtran['subtot'];
                        $tgrp = $grp;

                        echo "<tr class=''>";
                        echo "<td style=''>$mctr</td>";
                        echo "<td style=''>$pname</td>";
                        echo "<td style=''>$showtran[hsncode]</td>";
                        if ($oms == '0') {
                            ?>
                            <td class="text-right bor" style=' text-align:right;'><? echo $gstperc ?></td>
                        <?php } else { ?>
                            <td class="text-right bor" style=' text-align:right;'><? echo $showtran['igstrate']; ?></td>
                            <?php
                        }
                        echo "<td style='text-align: right;'>$fqty</td>";
                        echo "<td style=' text-align:right;'>$fmrp</td>";
                        echo "<td style=' text-align:right;'>$samount</td>";
                        echo "<td style=' text-align:right;'>$fdiscount</td>";
                        echo "<td style=' text-align:right;'>$ssubtot</td>";

                        echo "</tr>";
                        $ctab++;

                        $tdisc = $samount - $ssubtot;

                        if ($ctab > 15) {
                            ?>
                            <table border="solid:1px" style="border-collapse: collapse; width:100%">
                                <tr class="" style="height:22px;">
                                    <td></td>
                                </tr>
                                <tr class="" style="height:22px;">
                                    <td></td>
                                </tr>
                                <tr class="" style="height:22px;">
                                    <td></td>
                                </tr>
                                <tr class="" style="height:22px;">
                                    <td></td>
                                </tr>
                                <tr class="" style="height:22px;">
                                    <td></td>
                                </tr>
                                <tr class="" style="height:22px;">
                                    <td></td>
                                </tr>
                                <tr class="" style="height:22px;">
                                    <td></td>
                                </tr>
                                <tr class="" style="height:22px;">
                                    <td></td>
                                </tr>
                            </table>

                            <div>
                                <table border="solid:1px" width='100%'>
                                    <tr>
                                        <td class="border" style="width: 60%;">
                                            <p style="font-size:7px"> I / We hereby certify that my/our
                                                registration certificate under Rule 1 of GST invoice rules
                                                2017 is in force on which the sale of the goods specified in
                                                this tax invoice is made by me/us and that the transaction
                                                of sale covered by this tax invoice has been effected by
                                                me / us and it shall be accounted of in the turnover of sales
                                                while filling of return and the due tax, if any, payable on
                                                the sale has been paid or shall be paid.</p>
                                            <p style="margin-top:1px;margin-bottom: 2px;font-size:10px; "><u>Subject To Mumbai
                                                    Jurisdiction</u></p>
                                        </td>
                                        <td class="border" style="width: 40%">
                                            <?php
                                            //                            require("includes/dbconnect.php");
//                            
                                            ?>
                                            <div style=" text-align:right; font-size: 12px; font-weight: 900">
                                                <? echo "For $getcmpname[compname]"; ?>
                                            </div>
                                            <br>
                                            <br>
                                            <div style=" margin-left: 115px;text-align:right;  font-size: 8px">AUTHORIZED
                                                SIGNATORY</div>
                                        </td>
                                    </tr>
                                </table>
                            </div>

                            <br>
                            <br>

                            <br>
                            <br>
                        </table>

                        <div class="subpage">


                            <div style="border:solid 1px;border-collapse: collapse" class="col-md-12">

                                <table>
                                    <tr>
                                        <td style="width:15%;padding-left: 1.5%;">
                                            <img src="images/logo.png?a=2" alt="Logo" style="height: 111px;width: 126px;">
                                        </td>

                                        <td style="width:85%;padding-left: 5%">
                                            <center><b style="margin-top:1px;margin-bottom: 5px;font-size: 44px">
                                                    <? echo $getcmpname['compname']; ?>
                                                </b><br>
                                                <?php
                                                $address = $getcmpname['hoadd1'] . ' ' . $getcmpname['hoadd2'] . ' ' . $getcmpname['hoadd3'] . ' ' . $getcmpname['hocity'] . ' ' . $getcmpname['hopin'] . ' ';
                                                echo "<b>TRADER | WHOLESALER | MANUFACTURER <br> ALL KINDS OF FOOTWEAR</b><br>";

                                                echo $address;
                                                ?><br>
                                                <? if ($getcmpname['email'] != '') { ?>
                                                    <?php
                                                    echo "Email :" . $getcmpname['email'];
                                                }
                                                ?>
                                                <?php echo "Contact No :" . $getcmpname['htel'] . ".    GST NO : " . $getcmpname['gstno']; ?>
                                                <h3 style="margin-top:2px;margin-bottom: 2px;"><b>
                                                        <?php echo "$formname"; ?>
                                                    </b></h3>
                                                <?php if ($prnadd != '') { ?>
                                                    <h5 style="margin-top:2px;margin-bottom: 2px;"><b>GST
                                                            No:
                                                            <?php echo $fcmpbrch['gstno']; ?>
                                                        </b></h5>
                                                <?php } ?>
                                            </center>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            <div style="border:solid 1px;border-collapse: collapse" class="col-md-12">

                                <table class="table table-border" style="width:100%;border-spacing: 1px">
                                    <tr>
                                        <td style="text-align: center; width:50%;border:1px solid black"><b>Bill To Party</b>
                                        </td>
                                        <td style="text-align: center; width:50%;border:1px solid black"><b>Ship To Party</b>
                                        </td>
                                    </tr>
                                    <tr>
                                        <?php
                                        if ($getdata["nameprint"] != '') {
                                            $printname = $getdata["nameprint"];
                                            $printmobile = $getdata["printmobile"];
                                        } else {
                                            $printname = $showparty['name'];
                                            $printmobile = $showparty['mobile'];
                                        }

                                        if ($getdata["shipgstno"] == $showparty['gstno'] || $getdata['shipgstno'] == '') {
                                            $gstno = $showparty['gstno'];
                                        } else {
                                            $gstno = $getdata['shipgstno'];
                                        }
                                        ?>

                                        <td style="text-align: center; width:50%;border:1px solid black;">
                                            <div style="border-collapse: collapse" class="col-md-12">
                                                <table class="table table-bordered " style="width:100%;border-spacing: 0px">
                                                    <tr>
                                                        <td style="text-align: left; width:4%;font-size:12px"><b>M/s.</b></td>
                                                        <td style="width:1%">:</td>
                                                        <td style="text-align: left; width:95%;font-size:12px">
                                                            <?php echo "$printname"; ?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td style="text-align: left; width:4%;font-size:12px">Address</td>
                                                        <td style="width:1%">:</td>
                                                        <td style="text-align: left; width:95%;font-size:11px">
                                                            <?php echo "$showparty[add1]  $showparty[add2]"; ?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td style="text-align: left; width:4%">&nbsp;&nbsp;&nbsp;&nbsp;</td>
                                                        <td style="width:1%"></td>
                                                        <td style="text-align: left; width:95%;font-size:11px">
                                                            <?php echo "$showparty[add3]  $showparty[city] $showparty[pin]"; ?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td style="text-align: left; width:4%">Mobile</td>
                                                        <td style="width:1%">:</td>
                                                        <td style="text-align: left; width:95%;font-size:12px">
                                                            <?php echo "$printmobile"; ?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td style="text-align: left; width:4%;font-size:11px">GST No.</td>
                                                        <td style="width:1%">:</td>
                                                        <td style="text-align: left; width:95%;font-size:12px">
                                                            <?php echo "$showparty[gstno]"; ?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td style="text-align: left; width:4%;font-size:11px">Aadhaar / PAN</td>
                                                        <td style="width:1%">:</td>
                                                        <td style="text-align: left; width:95%;font-size:12px">
                                                            <?php echo "$showparty[pan]"; ?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td style="text-align: left; width:4%">State</td>
                                                        <td style="width:1%">:</td>
                                                        <td style="text-align: left; width:95%;font-size:12px">
                                                            <?php echo "$showparty[state]"; ?> &nbsp;&nbsp;&nbsp;&nbsp;
                                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;State Code :
                                                            <?php echo "$showparty[statecode]"; ?>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                        </td>
                                        <td style="text-align: left; width:50%;border:  1px solid black">
                                            <div style="border-collapse: collapse" class="col-md-12">

                                                <table class="table table-bordered" style="width:100%;border-spacing: 0px">
                                                    <tr>
                                                        <td style="text-align: left; width:4%;font-size:12px"><b>M/s.</b></td>
                                                        <td style="width:1%">:</td>
                                                        <td style="text-align: left; width:95%;font-size:12px">
                                                            <?php echo "$getdata[shipname]"; ?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td style="text-align: left; width:4%;font-size:12px">Address</td>
                                                        <td style="width:1%">:</td>
                                                        <td style="text-align: left; width:95%;font-size:11px">
                                                            <?php echo "$getdata[shipadd1]  $getdata[shipadd2]"; ?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td style="text-align: left; width:4%;font-size:12px">
                                                            &nbsp;&nbsp;&nbsp;&nbsp;
                                                        </td>
                                                        <td style="width:1%"></td>
                                                        <td style="text-align: left; width:95%;font-size:11px">
                                                            <?php echo "$getdata[shipadd3]"; ?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td style="text-align: left; width:4%;font-size:12px">Mobile</td>
                                                        <td style="width:1%">:</td>
                                                        <td style="text-align: left; width:95%;font-size:12px">
                                                            <?php echo "$printmobile"; ?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td style="text-align: left; width:4%;font-size:11px">GST No.</td>
                                                        <td style="width:1%">:</td>
                                                        <td style="text-align: left; width:95%;font-size:12px">
                                                            <?php echo "$gstno"; ?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td style="text-align: left; width:4%;font-size:11px">Aadhaar / PAN</td>
                                                        <td style="width:1%">:</td>
                                                        <td style="text-align: left; width:95%;font-size:12px">
                                                            <?php echo "$showparty[pan]"; ?>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td style="text-align: left; width:4%;font-size:12px">State</td>
                                                        <td style="width:1%">:</td>
                                                        <td style="text-align: left; width:95%;font-size:12px">
                                                            <?php echo "$showparty[state]"; ?> &nbsp;&nbsp;&nbsp;&nbsp;
                                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;State Code :
                                                            <?php echo "$showparty[statecode]"; ?>
                                                        </td>
                                                    </tr>

                                                </table>
                                            </div>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td
                                            style="text-align: center; width:50%;border:1px solid black;border-right: 1px solid black ">
                                            <div style="border-collapse: collapse" class="col-md-12">

                                                <table class="table table-bordered table-hover" style="width:100%">
                                                    <tr>
                                                        <td style="text-align: left; width:25%;font-size:12px"><b>Invoice
                                                                No.</b></td>
                                                        <td style="width:1%">:</td>
                                                        <td style="text-align: left; width:74%"><b>
                                                                <?php echo $invoice; ?>
                                                            </b></td>
                                                    </tr>
                                                    <tr>
                                                        <td style="text-align: left; width:25%;font-size:12px"><b>Date</b></td>
                                                        <td style="width:1%">:</td>
                                                        <td style="text-align: left; width:74%">
                                                            <b>
                                                                <?php echo "$getdata[vouchdt]"; ?>
                                                            </b>
                                                        </td>
                                                    </tr>

                                                    <?php
                                                    if ($getdata['cashcred'] == "R") {
                                                        $paytype = "Credit";
                                                    } else {
                                                        $paytype = "Cash";
                                                    }


                                                    if ($getdata['area'] != "") {
                                                        ?>
                                                        <tr>
                                                            <td style="text-align: left; width:25%;font-size:12px"><b>Booking</b>
                                                            </td>
                                                            <td style="width:1%">:</td>
                                                            <td style="text-align: left; width:74%"><b>
                                                                    <?php echo "$getdata[area]"; ?>
                                                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                                    Paid By :
                                                                    <?php echo $paytype; ?>
                                                                </b></td>
                                                        </tr>
                                                    <?php } else { ?>
                                                        <tr>
                                                            <td style="text-align: left; width:25%;font-size:12px"><b> Paid By </b>
                                                            </td>
                                                            <td style="width:1%">:</td>
                                                            <td style="text-align: left; width:74%"><b>
                                                                    <?php echo "$paytype"; ?>
                                                                </b></td>
                                                        </tr>
                                                    <?php } ?>

                                                </table>
                                            </div>
                                        </td>

                                        <td style="text-align: center; width:50%;border:1px solid black">
                                            <div style="border-collapse: collapse" class="col-md-12">

                                                <table class="table table-bordered table-hover" style="width:100%">

                                                    <tr>
                                                        <td style="text-align: left; width:34%;font-size:12px"><b>E-way Bill
                                                                No.</b>
                                                        </td>
                                                        <td style="width:1%">:</td>
                                                        <td style="text-align: left; width:65%">
                                                            <b>
                                                                <?php echo $getdata["ewaybill"]; ?>
                                                            </b>
                                                        </td>
                                                    </tr>



                                                    <tr>
                                                        <td style="text-align: left; width:34%;font-size:12px">
                                                            <b>Transporter</b></td>
                                                        <td style="width:1%">:</td>
                                                        <td style="text-align: left; width:65%"><b>
                                                                <?php echo "$ltrans[name]"; ?>
                                                            </b>
                                                        </td>
                                                    </tr>

                                                    <tr>
                                                        <td style="text-align: left; width:34%;font-size:12px"><b>Terms of
                                                                Delivery</b>
                                                        </td>
                                                        <td style="width:1%">:</td>
                                                        <td style="text-align: left; width:65%">
                                                            <b>
                                                                <?php echo $getdata['remark1'] . $getdata['remark2']; ?>
                                                            </b>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>



                            <table border="solid 1px" style="border-collapse: collapse; width:100%">
                                <tr>
                                    <th style="width:3%; color:black; text-align: right;"><label>Sr.</label></th>
                                    <th style="width:30%; color:black;"><label>Itemname</label></th>
                                    <th style="width:10%; color:black;"><label>Hsn</label></th>
                                    <th style="width:11%; color:black; text-align: right;"><label>GST %</label></th>
                                    <th style="width:9%; color:black; text-align: right;"><label>Qty.</label></th>
                                    <th style="width:9%; color:black; text-align: right;"><label>Rate</label></th>
                                    <th style="width:11%; color:black; text-align: right;"><label>Amount</label></th>
                                    <th style="width:9%; color:black; text-align: right;"><label>Discount</label></th>
                                    <th style="width:11%; color:black; text-align: right;"><label>Taxable</label></th>
                                </tr>
                                <?php
                                $ctab = 0;
                        }
                        $totqty = $totqty + $showtran['qty'];
                        $totamt = $totamt + $samount;

                        if ($tdisc > 0) {
                            $totdiscamt = $totdiscamt + $tdisc;
                        }

                        $tot = $tot + $ssubtot;
                        $ctr++;
                        $mctr++;
                    }

                    if ($ctab < 15) {
                        for ($i = $ctab; $i <= 15; $i++) {
                            $ctab = $ctab + 1;
                            ?>
                                <tr style="height:24px;">
                                    <td class="border"></td>
                                    <td class="border"></td>
                                    <td class="border"></td>
                                    <td class="border"></td>
                                    <td class="border"></td>
                                    <td class="border"></td>
                                    <td class="border"></td>
                                    <td class="border"></td>
                                    <td class="border"></td>
                                </tr>
                                <?php
                        }
                    }
                    ?>

                        <tr>
                            <td colspan="2" class="border" style="text-align: right;"></td>
                            <td class="border"></td>
                            <td class="border " style="text-align: right;">Total</td>
                            <td style="text-align: right;" class="border"> <? echo $totqty; ?> </td>
                            <td class="border"></td>
                            <td style="text-align: right;border-left: none;"> <? echo $totamt; ?> </td>
                            <td style="text-align: right;border-left: none;">
                                <? echo number_format($totdiscamt, 2, '.', ''); ?>
                            </td>
                            <td style="text-align: right;border-left: none;"> <? echo $getdata['tottaxamt']; ?> </td>
                        </tr>

                        <tr>
                            <td colspan="4" class="rnone">
                                <table style="border-collapse: collapse; width:100%">
                                    <tbody>
                                        <tr>
                                            <td class="border" style="width:25%;">Account</td>
                                            <td class="border" style="width:75%;">
                                                <?= $getcmpname['compname'] ?>
                                            </td>
                                        </tr>
                                        <tr>

                                            <td class="border" style="width:25%;">Bank</td>
                                            <td class="border" style="width:75%;">
                                                <?= $getcmpname['bankname'] ?>
                                            </td>
                                        </tr>
                                        <tr>

                                            <td class="border" style="width:25%;">Branch</td>
                                            <td class="border" style="width:75%;">
                                                <?= $getcmpname['branchname'] ?>
                                            </td>
                                        </tr>
                                        <tr>

                                            <td class="border" style="width:25%;">Account No.</td>
                                            <td class="border" style="width:75%;">
                                                <?= $getcmpname['acno'] ?>
                                            </td>
                                        </tr>
                                        <tr>

                                            <td class="border" style="width:25%;">IFSC Code</td>
                                            <td class="border" style="width:75%;">
                                                <?= $getcmpname['ifccode'] ?>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </td>

                            <td colspan="5" style="border:none;border-collapse: collapse;">
                                <table border="solid 1px"
                                    style="font-size: 10px;border-collapse: collapse; width:100%;">
                                    <tbody style="border-collapse: collapse;">

                                        <tr>
                                            &nbsp;
                                        </tr>

                                        <tr>
                                            <td style="width:32px;text-align: right">%</td>
                                            <td style="width:89px;text-align: right">CGST</td>
                                            <td style="width:89px;text-align: right">SGST</td>
                                            <td style="width:89px;text-align: right">IGST</td>
                                            <td style="width:99px;">&nbsp;</td>
                                        </tr>
                                        <?php
                                        if ($getdata['totgst5'] > 0) {
                                            echo "<tr style=''>";
                                            echo "<td class='text-right' style='text-align: right;'><b>5%</b></td>";
                                            echo "<td class='text-right' style='text-align: right;'>$getdata[cgst5]</td>";
                                            echo "<td class='text-right' style='text-align: right;'>$getdata[sgst5]</td>";
                                            echo "<td class='text-right' style='text-align: right;'>$getdata[igst5]</td>";
                                            echo "<td class='text-right' style='text-align: right;'>$getdata[totgst5]</td>";
                                            echo "</tr>";
                                        }
                                        if ($getdata['totgst12'] > 0) {
                                            echo "<tr style=''>";
                                            echo "<td class='text-right' style='text-align: right;'><b>12%</b></td>";
                                            echo "<td class='text-right' style='text-align: right;'>$getdata[cgst12]</td>";
                                            echo "<td class='text-right' style='text-align: right;'>$getdata[sgst12]</td>";
                                            echo "<td class='text-right' style='text-align: right;'>$getdata[igst12]</td>";
                                            echo "<td class='text-right' style='text-align: right;'>$getdata[totgst12]</td>";
                                            echo "</tr>";
                                        }

                                        if ($getdata['totgst18'] > 0) {
                                            echo "<tr style=''>";
                                            echo "<td class='text-right' style='text-align: right;'><b>18%</b></td>";
                                            echo "<td class='text-right' style='text-align: right;'>$getdata[cgst18]</td>";
                                            echo "<td class='text-right' style='text-align: right;'>$getdata[sgst18]</td>";
                                            echo "<td class='text-right' style='text-align: right;'>$getdata[igst18]</td>";
                                            echo "<td class='text-right' style='text-align: right;'>$getdata[totgst18]</td>";
                                            echo "</tr>";
                                        }

                                        if ($getdata['totgst28'] > 0) {
                                            echo "<tr style=''>";
                                            echo "<td class='text-right' style='text-align: right;'><b>28%</b></td>";
                                            echo "<td class='text-right' style='text-align: right;'>$getdata[cgst28]</td>";
                                            echo "<td class='text-right' style='text-align: right;'>$getdata[sgst28]</td>";
                                            echo "<td class='text-right' style='text-align: right;'>$getdata[igst28]</td>";
                                            echo "<td class='text-right' style='text-align: right;'>$getdata[totgst28]</td>";
                                            echo "</tr>";
                                        }
                                        $totgst = $getdata['totgst5'] + $getdata['totgst12'] + $getdata['totgst18'] + $getdata['totgst28'];
                                        ?>
                                        <tr>
                                            <td colspan="2">Tax Amt. in Words</td>
                                            <td colspan="3"><b>Rupees
                                                    <?php echo rsword(round($totgst)); ?>
                                                </b></td>

                                        </tr>
                                    </tbody>
                                </table>
                            </td>
                        </tr>

                        <?php
                        if ($getdata['netamt'] > 0) {
                            ?>
                            <tr>
                                <td colspan="5" style="text-align: left; " class="border"><b style="font-size:9px">Rupees
                                        <?php echo rsword(round($getdata['netamt'])); ?>
                                    </b></td>
                                <td style="text-align: right; " colspan="2" class=" border"><b>Net Amount</b></td>
                                <td style="text-align: right; " class="lnone " colspan="2"><b>
                                        <? echo $getdata['netamt']; ?>
                                    </b></td>
                            </tr>
                            <?php
                        }
                        ?>

                    </table>
                </div>

                <div>
                    <table border="solid:1px" width='100%'>
                        <tr>
                            <td class="border" style="width: 60%;">
                                <p style="font-size:7px"> I / We hereby certify that my/our
                                    registration certificate under Rule 1 of GST invoice rules
                                    2017 is in force on which the sale of the goods specified in
                                    this tax invoice is made by me/us and that the transaction
                                    of sale covered by this tax invoice has been effected by
                                    me / us and it shall be accounted of in the turnover of sales
                                    while filling of return and the due tax, if any, payable on
                                    the sale has been paid or shall be paid.</p>
                                <p style="margin-top:1px;margin-bottom: 2px;font-size:10px; "><u>Subject To Mumbai
                                        Jurisdiction</u></p>
                            </td>

                            <td class="border" style="width: 40%">
                                <div style=" text-align:right; font-size: 12px; font-weight: 900">
                                    <? echo "For $getcmpname[compname]"; ?>
                                </div>
                                <br>
                                <br>
                                <div style=" margin-left: 115px;text-align:right;  font-size: 8px">AUTHORIZED SIGNATORY
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>

                <br>
                <br>


            </div>
        </div>
        <?php
        include("includes/linksfoot.php");
        ?>
</body>

</html>