<html >
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <title></title>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700;900&display=swap" rel="stylesheet">
    <style>
        body
        {
            font-size:15px;
            font-family: 'Roboto', sans-serif;
        }
        .table1 {
          border-collapse: collapse;
        }
        
        .table1, .th1, .td1 {
          border: 1px solid black;
        }

        h1,h2,h3,h4,h5,h6,p {
            margin: 5;
        }

        .result-table {
            width: 100%;
            margin-top: 10px;
        }

        .result-table th {
            height: 50px;
            border-bottom: 1px solid #ddd;
            border-left: 1px solid #ddd;
        }

         .result-table td {
            border-bottom: 1px solid #ddd;
            border-left: 1px solid #ddd;
            padding: 5px;
        }
        
        .btn-part {
            
        }

        .btn{
           padding:18px 30px;
           border-color:black;
           background-color:inherit;
           border-radius:40px;
       }
       .btn:hover{
           padding:18px 30px;
           color:white;
           background-color:black;
           border-radius:40px;
           cursor: pointer;
       }
        
        
       @page {
}
    </style>
    <script>
	function printDiv(divName) {
     var printContents = document.getElementById(divName).innerHTML;
     var originalContents = document.body.innerHTML;

     document.body.innerHTML = printContents;

     window.print();

     document.body.innerHTML = originalContents;
     
}
	</script>
    
</head>
<body><center>
    <div class="container">    
        <div id="printableArea" style="height: 100%;" >
            <div style="width:21cm;padding:5px;" >
       
                <!-------------------  HEAD  -------------------------------------->
                <div style="border:double; padding: 10px; width: 100%; float: left;">
                    <table style="width:100%; border-bottom: 2px solid #ddd; padding-bottom:10px;">
                        <tr>
                            @foreach($CompanyDetails as $CompanyDetail)
                            <td style="width: 20%;">
                                <img src="{{asset('storage/CompanyDetail/Logo/'.$CompanyDetail->logo)}}" style="width:150px;">
                            </td>
                            <td style="width:80%;">
                                <h1>{{$CompanyDetail->title}}</h1>
                                <p>{{$CompanyDetail->tagline}}</p>
                                <p>{{$CompanyDetail->address}}</p>
                                <p>{{$CompanyDetail->email}}</p>
                                <p>{{$CompanyDetail->phone}}</p>
                            </td>
                            @endforeach
                        </tr>
                    </table>

                    <table style="width:100%; margin-top:10px; table-layout: fixed; text-align:center; border-bottom:1px double #ddd;">
                    <tr style="text-align:center">
                        <td></td>
                        <td><h2>INVOICE</h2></td>
                        <td></td>
                    </tr>
                       
                        <tr>
                                <td>
                                    <b>Date:</b> {{date_format(date_create($Invoice->dateTime),'d-m-Y')}}
                                </td>
                                <td>
                                </td>
                                <td>
                                    <b>Customer:</b> {{$Invoice->user->name}}
                                </td>
                        </tr>
                        <tr>
                            <td>
                                <b>Invoice Number:</b> {{$Invoice->id}}
                            </td>
                        </tr>
                    </table>
                    <table class="result-table">
                        <thead>
                            <tr>
                                <th>#</th>
                                <th>Product-Services</th>
                                <th>Quantity</th>
                                <th>Amount</th>
                                <th>Total</th>

                            </tr>
                        </thead>
                        <tbody>
                            @php $Slno=0; @endphp
                            @foreach($Invoice->invoicedetails as $InvoiceDetails)
                            @php 
                                $qnty=$InvoiceDetails->quantity;
                                $amt=$InvoiceDetails->amount;
                                $tot=$qnty*$amt;
                            @endphp

                                <tr>
                                    <td>{{++$Slno}}</td>
                                    {{--<td>{{$InvoiceDetails->order_product_service->orderproduct->product->title ." : ". $InvoiceDetails->order_product_service->product_service->servicetype->title}}</td>--}}
                                    <td>{{$InvoiceDetails->name}}</td>
                                    <td>{{$InvoiceDetails->quantity}}</td>
                                    <td>{{$InvoiceDetails->amount}}</td> 
                                    <td>{{$tot}}</td> 
                                </tr>
                            @endforeach
                                <tr>
                                    <td style="border:none;"></td>
                                    <td style="border:none;"></td>
                                    <td style="border:none;"></td>
                                    <td><b>Total:</b></td>
                                    <td><b></b></td>
                                </tr>
                        </tbody>
                    </table>
                   
                </div>


            </div>
        </div>
        <div class="btn-part">
            <input type="button" onclick="printDiv('printableArea')" value="Print Form" class="btn"/>
        </div>
        
    </div>
    
</center></body>
                  


    
        