@extends('layouts.app')
@section('title','Lab Billings')
@section('pages')
    <div id="print_div">
        <input type="hidden" name="finale_name" id="file_name" value="Invoice 2">
        <input type="hidden" name="page_titile" id="page_title" value="2 - Saha Palash">
        <div class="row">
            <div class="col-md-12 col-xs-12 p-1">
                <div class="card border-0">
                    <div class="card-body">
                        <div class="row">
                            <div class="col-12">
                                <table class="table table-borderless report-container">
                                    <thead class="report-header">
                                        <tr>
                                            <th class="report-header-cell">
                                                <div class="row" id="header" style="border: ; padding:0 0 0 0;">
                                                    <div class="col-8" style="line-height: 1.2;padding-bottom:5px">
                                                        <span class="m-0 p-0" style="font-size: 24px">TERESA DIAGNOSTIC CENTER</span><br><p class="m-0 p-0 font-weight-normal font-12">GST NO : , STATE : TRIPURA (16)</p>
                                                        <span class="p-0 m-0 font-weight-normal font-12">Address: Agartala</span>
                                                        <span class="p-0 m-0 font-weight-normal font-12">Agartala, Pin: 799001</span><br>
                                                        <p class="m-0 p-0 font-weight-normal font-12">Mobile : , </p>
                                                        <p class="m-0 p-0 font-weight-normal font-12">Email : , Website : </p>
                                                    </div>
                                                    <div class="col-4 text-right ">
                                                        <img class="img-thumbnail border-0" src="https://master.cloudpatholab.com/uploads/letterheads/images/1/c7ba6041869fc6929fe5e9c6e4be52bf.png" alt="Upload Letter Head Logo" height="90" width="200">
                                                    </div>
                                                </div>
                                            </th>
                                        </tr>
                                    </thead>

                                    <tbody class="report-content">
                                        <tr>
                                            <td class="report-content-cell">
                                                <div class="row border border-dark border-bottom-0" style="border:1px solid #000;padding-top: 0px; padding-bottom: 2px;margin-right:0px;margin-left:0px">
                                                    <div class="col-4 font-12"><b>Invoice Date :</b> 22-09-2023</div>
                                                    <div class="col-4 text-center font-12"><b>Invoice No :</b> 00000011</div>
                                                    <div class="col-4 text-right font-12"><b>Payment Terms :</b> CREDIT</div>
                                                </div>
                                                <div class="row">
                                                    <div class="col-12">
                                                        <div class="row border border-dark" style="padding-top: 2px; padding-bottom: 0px;line-height:1.2; margin-right:0px;margin-left:0px">
                                                            <div class="col-4 border-right border-dark" style="font-size:12px;">
                                                                <span style="font-size: 13px;border-bottom:1px solid #555;">
                                                                Patient Details:
                                                                </span>
                                                                <p class="mb-0 pt-1"><b>Mr. SAHA PALASH (PRN00000041)</b></p>
                                                                <p class="mb-0 "><b>Sex : Male, Age : 326 yrs.</b></p>
                                                                <span>Address: agartala</span>
                                                                <span>M: 9436455813<br></span>
                                                            </div>
                                                            <div class="col-4 border-right border-dark" style="font-size:12px;">
                                                                <span style="font-size: 12px;font-size: 13px;border-bottom:1px solid #555;">
                                                                Reffered By Dr:</span>
                                                                <p class="mb-0 pt-1"><strong>Dr. BIDHAN DAS (DR000000001), MBBS </strong></p>
                                                                <p style="margin:0;padding:0;">ENT, HEAD &amp; NECK ONCO-SURGEON</p>
                                                                <span style="font-size: 12px;">
                                                                <strong>Reff. Lab:</strong> </span>
                                                                <p class="mb-0"><b></b></p>
                                                            </div>
                                                            <div class="col-4 text-center pt-1 pb-1" style="margin-top:0px; padding:5px; float:right; padding-top:0; width:auto !important;">
                                                                <center>
                                                                    <p style="margin-bottom:0px;padding-bottom:0px;"><strong></strong></p>
                                                                    <p style="margin-bottom:1px;padding-bottom:2px;"><!--?xml version="1.0"?--><svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="110" height="60" viewBox="0 0 110 60"><g><rect x="0" y="0" width="110" height="60" fill="white"></rect><g transform="translate(0 5)"><g><rect x="10" y="0" width="2" height="40" fill="black"></rect><rect x="13" y="0" width="1" height="40" fill="black"></rect><rect x="16" y="0" width="3" height="40" fill="black"></rect><rect x="21" y="0" width="4" height="40" fill="black"></rect><rect x="26" y="0" width="1" height="40" fill="black"></rect><rect x="28" y="0" width="3" height="40" fill="black"></rect><rect x="32" y="0" width="2" height="40" fill="black"></rect><rect x="35" y="0" width="2" height="40" fill="black"></rect><rect x="39" y="0" width="2" height="40" fill="black"></rect><rect x="43" y="0" width="2" height="40" fill="black"></rect><rect x="46" y="0" width="2" height="40" fill="black"></rect><rect x="50" y="0" width="2" height="40" fill="black"></rect><rect x="54" y="0" width="2" height="40" fill="black"></rect><rect x="57" y="0" width="2" height="40" fill="black"></rect><rect x="61" y="0" width="2" height="40" fill="black"></rect><rect x="65" y="0" width="2" height="40" fill="black"></rect><rect x="70" y="0" width="1" height="40" fill="black"></rect><rect x="73" y="0" width="1" height="40" fill="black"></rect><rect x="76" y="0" width="3" height="40" fill="black"></rect><rect x="82" y="0" width="1" height="40" fill="black"></rect><rect x="84" y="0" width="2" height="40" fill="black"></rect><rect x="87" y="0" width="2" height="40" fill="black"></rect><rect x="92" y="0" width="3" height="40" fill="black"></rect><rect x="96" y="0" width="1" height="40" fill="black"></rect><rect x="98" y="0" width="2" height="40" fill="black"></rect><text x="55" y="55" text-anchor="middle" font-family="monospace" font-size="18" fill="black">00000011</text></g></g></g></svg></p>
                                                               </center>
                                                           </div>
                                                        </div>
                                                        <table class="table table-borderless table-sm" id="account_to">
                                                            <tbody>
                                                                <tr>
                                                                    
                                                                </tr>
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </div>
                                                <div class="row mt-n3">
                                                    <div class="col-12 text-center">
                                                        <h4 class="text-bold">INVOICE
                                                            <input type="hidden" name="saleid" value="00000011" id="saleid">
                                                        </h4>
                                                    </div>
                                                </div>                                                    
                                                <div class="row">
                                                    <div class="col-12">
                                                        <table class="table table-bordered-print w-100" id="quotation_products">
                                                            <thead>
                                                                <tr>
                                                                    <th>Sl.No</th>
                                                                    <th width="30%">Test/Item Name</th>
                                                                    <th>Report Delivery Date (Approx.)</th>
                                                                    <th>Brand</th>
                                                                    <th>Rate</th>
                                                                    <th>Dis(%)</th>
                                                                    <th>Total</th>
                                                                </tr>
                                                            </thead>
                                                            <tbody><tr>
                                                                <td>1</td><td>DENGUE NS 1 Ag / IgM , IgG (Combo Assay) (DENGUE NS 1 Ag / IgM , IgG (Combo Assay))
                                                                    </td>
                                                                    <td>Saturday, 23-09-2023</td>
                                                                    <td>PATHOLOGY</td>
                                                                    <td>2000.00</td>
                                                                    <td>0.00 (0.00%)
                                                                    </td>
                                                                    <td>2000.00</td>
                                                                </tr>
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </div>
                                                <div class="row mt-n2">
                                                    <div class="col-12">
                                                        <table class="table table-borderless w-100">
                                                            <tbody><tr>
                                                                <td class="pr-4" style="width: 30%!important;">
                                                                    <table class="table">
                                                                        <tbody><tr>
                                                                            <td style="border-top:1px transparent!important;"><b style="font-size:13px">Payment Summary</b></td>

                                                                        </tr>

                                                                        <tr>
                                                                            <td><span style="font-size:13px"><b style="font-size:12px">Total Amount Received</b></span></td>

                                                                        </tr>
                                                                        <tr>
                                                                            <td><span style="font-size:13px"><b style="font-size:12px">Advance/Discount</b></span></td>

                                                                        </tr>
                                                                        <tr>
                                                                            <td><span style="font-size:13px"><b style="font-size:12px">Total Amount Due</b></span></td>

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

                                                                </td><td class="pr-4" style="width: 20%!important;">
                                                                <table class="table tr">
                                                                <tbody><tr>
                                                                <td class="tr" style="border-top:1px transparent!important;text-align:right;"><b style="font-size:13px">Amount</b></td>
                                                                </tr>
                                                                <tr>
                                                                <td class="text-right text-bold" style="font-size:13px">0.00</td>
                                                                </tr>
                                                                <tr>
                                                                <td class="text-right text-bold" style="font-size:13px">0.00</td>
                                                                </tr>
                                                                <tr>
                                                                <td class="text-right text-bold" style="font-size:13px;border: 1px transparent!important;">2000.00</td>
                                                                </tr>
                                                                </tbody></table>
                                                                </td>

                                                                


                                                                <td style="width: 50%!important;">
                                                                    <table class="table tr">
                                                                        <tbody><tr>
                                                                        <td style="border: 1px transparent!important;width:15%!important;"></td>
                                                                        <td class="text-right" style="border: 1px transparent!important;width:20%!important;"><b style="font-size:11px">GRAND TOTAL</b></td>
                                                                        <td class="text-right text-bold" style="font-size:13px;border-top: 1px transparent!important;width:15%!important;">2000.00</td>
                                                                        </tr>

                                                                          <tr>
                                                                              <td style="width:15%!important;"></td>
                                                                            <td class="text-right" style="width:20%!important;"><span style="font-size:11px"><b>SPECIAL DISCOUNT</b></span></td>
                                                                            <td class="text-right" style="font-size:13px;width:15%!important;"><b>0.00</b></td>
                                                                        </tr>

                                                                         <tr>
                                                                             <td style="width:15%!important;"></td>
                                                                            <td class="text-right" style="width:20%!important;"><b style="font-size:11px">FINAL BILLING AMOUNT</b></td>
                                                                            <td class="text-right text-bold" style="font-size:13px;width:15%!important;">2000.00</td>
                                                                        </tr>

                                                                        <tr>
                                                                            <td colspan="3" style="border:1px transparent!important;">
                                                                                <span class="pull-right" style="float: right!important;font-size:8px;"><b>Amount (in words) : Two Thousand  only (Round off)</b></span>
                                                                            </td>
                                                                        </tr>
                                                                    </tbody></table>
                                                                </td>

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

                                    <tfoot class="report-footer">
                                        <tr>
                                            <td class="report-footer-cell">
                                                <span style="font-weight:bold;">[NOTE: ONCE PAID THE (ADVANCE/ BOOKING) AMOUNT IS NON REFUNDABLE]</span>
                                                <div class="row mt-n3">
                                                    <div class="col-5"></div>
                                                    <div class="col-3 text-center align-self-end pb-3"></div>
                                                    <div class="col-4 text-right">
                                                        <table class="table table-borderless" id="company_regards">
                                                            <tbody>
                                                                <tr>
                                                                    <td style="font-size: 16px;padding-bottom: 30px;">
                                                                        <b>TERESA DIAGNOSTIC CENTER</b>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td style="font-size: 12px;">
                                                                        Authorised Signatory
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td style="font-size: 12px;">Note: Digitally Generated Invoice, Signature Not Required</td>
                                                                </tr>
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </tfoot>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection

@section('js')

<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.4/jspdf.min.js"></script>

<script>
    $(document).ready(function() {
        var page_title = $('#page_title').val();
        $("title").html(page_title);
        $('#btn_print').click(function(event) {
            event.preventDefault();
            $('#print_div').printThis({
                importStyle: true,
            });
        });

        $('#btn_pdf').click(function(e) {
            html2canvas($('#print_div'), {
                background: "#ffffff",
                onrendered: function(canvas) {
                    var myImage = canvas.toDataURL("image/png", 1.0);
                    // Adjust width and height
                    var imgWidth = (canvas.width * 43) / 250;
                    var imgHeight = (canvas.height * 48) / 250;
                    // jspdf changes
                    var pdf = new jsPDF('p', 'mm', 'a4');
                    pdf.addImage(myImage, 'png', 5, 5, imgWidth, imgHeight); // 2: 19
                    pdf.save(`${$('#page_title').val()}.pdf`);
                }
            });
        });
    });

    function PrintPanel() {
        var quotation = $('#saleid').val();
        var PrevHeader = document.getElementById("print_div");
        var panel = document.getElementById("print_div");
        var printWindow = window.open('', '', 'height=750px,width=960px');
        printWindow.document.write('<html><head><Title>' + quotation + '</Title>');
        printWindow.document.write('<link rel="stylesheet" href="../assets/css/print.css" type="text/css">');
        printWindow.document.write('<link rel="stylesheet" href="../assets/css/bootstrap.min.css" type="text/css">');
        printWindow.document.write('</head><body>');
        printWindow.document.write('<style>@page {size: auto;}</style>');
        printWindow.document.write(panel.outerHTML);
        printWindow.document.write('</body></html>');
        printWindow.document.close();
        setTimeout(function() {
            printWindow.print();
        }, 500);
    }
</script>
@endsection