<html>

<head>
    <link href='{{ asset(' fonts/fontstyle.css ') }}' rel='stylesheet'>

    <link href="{{ asset('css/bootstrap4.min.css') }}" rel="stylesheet" />
    <link href="{{ asset('fontawsome/css/all.min.css') }}" rel="stylesheet" />
</head>

<style>
     body::-webkit-scrollbar {
  width: 1em;
}
 
body::-webkit-scrollbar-track {
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
}
.headertable td, .headertable th {
    padding: .2rem !important;
    vertical-align: top !important;
}
 
body::-webkit-scrollbar-thumb {
  background-color: darkgrey;
  outline: 1px solid slategrey;
}

    ol {
        padding-left: 1.8em;
    }
    .detail-footer{
        font-size: 12px;
    }
    .table-bordered > tbody > tr > td, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > td, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > thead > tr > th {
    border: 1px solid #000000; //your desired color
    font-size:14px;
}
.invoice-table{
    font-size:16px;
}

    .subhead {
        color: gray;
        font-size: 12px;
        font-family: 'Montserrat';
    }

    .companyName {
        font-weight: 600;
        font-size:38px;
    }

    .address {
        font-weight: 300;
        font-size: 16px;
    }

    .card-header {
    color: black !important;
    background-color: #D1D1D1 !important;
    }
    html {
        font-size: 14px;
        font-family: 'Montserrat';
    }

    .table-condensed {
        font-size: 14px;
        font-family: 'Montserrat';
    }

    .card-footer {
        background-color: white;
    }

    div.subheading {
        font-weight: 500;
        line-height: .5;
        font-family: 'Montserrat';
    }

    .thin {
        /* Montserrat Thin = 100 */
        font-weight: 500;
        font-family: "Montserrat";
    }

    p {
        line-height: 1.2;
        margin-bottom: .4rem;
    }

    hr{
        border-top: 1px solid #848484;
    }
   

    li {
    list-style-type: none;
}
ul{
    padding: 0;
    margin-block-end:0;
}

    body {
    border: solid #000000;
    border-width: 1px;
        background-color: white;
        font-weight: 400;
        -webkit-print-color-adjust: exact;
        font-family: "Montserrat";
    }



    /* Styles go here */

.page-header, .page-header-space {
  height: 200px;
}

.page-footer, .page-footer-space {
  height: 190px;

}
.blank_row{
    height:550px;
}
.gstNo{
    font-size:16px;
}
.border-right {
    border-right: 1px solid #000000!important;
}

.border-left {
    border-left: 1px solid #000000!important;
}

.border-top {
    border-top: 1px solid #000000!important;
}
.border-bottom {
    border-bottom: 1px solid #000000!important;
}
.border {
    border: 1px solid #000000!important;
}

.page-footer {
  position: fixed;
  bottom: 0;
  width: 100%;
}

.page-header {
  position: fixed;
  top: 0;
  width: 100%;
  border-bottom: 1px solid #848484; /* for demo */
}


.page {
  page-break-after: always;
}

@page {
  margin: 2mm
}

@media print {
    .table-bordered > tbody > tr > td, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > td, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > thead > tr > th {
    border: 1px solid #000000; //your desired color
    font-size:14px;
}
   thead {display: table-header-group;} 
   tfoot {display: table-footer-group;}
   
   button {display: none;}
   
   body {margin: 0;}
}
  
   
   
</style>

<body class="">


    <div class="page-header" style="text-align: center">
            <h1 class="companyName">{{$companyDetail->name}}</h1>
            <p class="address">{!! $companyDetail->address !!}</p>
            
        <div class="row px-3">
            <div class="col-md-3">
                    <ul style="text-align:left; width:100%;">
                            <li style="font-size:14px;"><i class="fas fa-cloud fa-md text-secondary mr-2"></i>{!! $companyDetail->web_address !!}</li>
                            <li><i class="fas fa-envelope fa-md text-secondary mr-2"></i>{!! $companyDetail->email !!}</li>
                            <li><i class="fas fa-envelope fa-md text-secondary mr-1"></i>{!! $companyDetail->email1 !!}</li>                            
                        </ul>
            </div>
            <div class="col-md-6">
                    
                </div>
            <div class="col-md-3">
                    <ul style="text-align:right">
                        <li><i class="fas fa-phone-alt fa-md text-secondary mr-2"></i>{!! $companyDetail->phone1 !!}</li>
                        <li><i class="fas fa-phone-alt fa-md text-secondary mr-2"></i>{!! $companyDetail->phone2 !!}</li>
                        <li><i class="fas fa-phone-alt fa-md text-secondary mr-2"></i>{!! $companyDetail->phone3 !!}</li>
                    </ul>
            </div>
        </div>                        
            <div class="col-12">
                <div class="text-center">
                    <div class="subheading">                    
                        <p class="gstNo"><strong>GST No: {!! $companyDetail->gstNo !!}</strong></p>
                    </div>
                </div>
            </div>
        </div>
      </div>

     


      <div class="page-footer">
         
        <div class="row px-3 border-bottom border-top">
            <div class="w-50 border-right p-0 px-2">
                <div>
                    <div class="">
                        <h6>Terms Conditions </h6>
                        {!! $companyDetail->tnc !!}
                    </div>
                </div>
            </div>
            <div class="w-25 border-right p-0 m-0 px-2">
                <div>
                    <div class="">
                        <h6>Bank Details</h6>
                        <p>{!! $companyDetail->bank_detail !!}</p>
                    </div>
                </div>
            </div>
            <div class="w-25  p-0 m-0">

                <div class="col-xs-12" style="height:60px;"></div>
                <div class="">
                    <p class="text-center">{!! $companyDetail->signature_footer !!}</p>
                </div>

            </div>
        </div>

        <div class="row px-3 border_bottom">
                <div class="w-100 p-0 px-2">
                        <div>
                            <div class="text-center detail-footer">
                                Manufacturer of Gangsaw Segments, Multi Blade segements, Cutter segements and all kind of diamond tools <br>
                                This is a computer generated invoice
                            </div>
                        </div>
                    </div>
         </div> 
      </div>
    
      <table style="width:100%">
      <thead>
        <tr>
          <td>
            <!--place holder for the fixed-position header-->
            <div class="page-header-space"></div>
          </td>
        </tr>
        

      </thead>
      <tbody>
            <tr>
                <td >
                        <div class="row card-header">
                                <div class="col-md-4 p-0 m-0 pl-1">
                                   
                                </div>
                                <div class="col-md-4 p-0 m-0 pl-1">
                                    <div class="text-center">
                                        <strong>TAX INVOICE</strong>
                                    </div>
                                </div>
                                <div class="col-md-4 p-0 m-0 pl-1">
                                   
                                </div>
                         </div>
                         
                         
                </td>
            </tr>
            <tr>
                <td>
                        <div class="row px-1">
                                <div class="image"></div>
                                <div class="col-md-6">
                                <h6 class="mb-3">Party Detail</h6>
                                <hr>
                                   <div>
                                        <strong>{!! $invoice->account->name !!}</strong>
                                    </div>
                                    @if(!empty($invoice->account->billing_address))
                                    <div>{!! $invoice->account->billing_address !!}</div>
                                    @endif
                                    @if(!isset($invoice->account->contact_person))
                                    <div>{!! $invoice->account->contact_person !!}</div>
                                    @endIf
                                    @if(!empty($invoice->account->phoneNo))
                                                <div>{!! $invoice->account->phoneNo !!}</div>
                                    @endIf
                                    
                                    @if(!empty($invoice->account->gstNo))
                                    <div>GST No : <strong>{!! $invoice->account->gstNo !!}</strong></div>
                                    @endIf
                                    @if(!empty($invoice->account->state))
                                    <div>State Name/Code : <strong>{!! $invoice->account->state->name !!}/{!! $invoice->account->state->code !!}</strong></div>
                                    @endIf
                                </div>

                                <div class="col-md-6">
                                        <h6 class="mb-3">Invoice Detail</h6>
                                        <hr>

                                        <table style="width:100%" class="headertable">
                                            <tr>
                                                <th width="40%">Invoice Date</th>
                                                <td> {!! $invoice->invoice_date!!}</td>
                                            </tr>
                                            <tr>
                                                <th>Invoice Number</th>
                                                <td> {!! $invoice->invoice_number!!}</td>
                                            </tr>

                                            <tr>
                                                    <th>Place of Supply</th>
                                                    <td> {!! $invoice->place_of_supply!!}</td>
                                                </tr>
                                                <tr>
                                                        <tr>
                                                                <th>State/Code</th>
                                                                <td> Rajasthan/08</td>
                                                            </tr>
                                                            <tr>
                                                        <th>EWay Bill No</th>
                                                        <td> {!! $invoice->eway_bill_no!!}</td>
                                                    </tr>
                                                    <tr>
                                                            <th>Transport</th>
                                                            <td> {!! $invoice->transport_number!!}</td>
                                                        </tr>
                                                        <tr>
                                                                <th>Tracking/Vehicle No</th>
                                                                <td> {!! $invoice->tracking_number!!}</td>
                                                            </tr>
                                        </table>

                                        
                                </div>


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

            <tr>
                <td>
                        <div class="row card-header pt-2">
                                <div class="col-md-4 p-0 m-0 pl-1">
                                </div>
                                <div class="col-md-4 p-0 m-0 pl-1">
                                    <div class="text-center">
                                        <strong>PARTICULAR ITEMS</strong>
                                    </div>
                                </div>
                                <div class="col-md-4 p-0 m-0 pl-1">
                                </div>
                         </div>
                </td>
            </tr>

            <tr>
                    <td>
                            <div class="page">
                            <div class="row px-4" >
                                    
                                    <div class="table-responsive-sm " style="width:100%;">
            
                                        <table class="table table-bordered table-condensed invoice-table" >
                                            <thead>
                                                <tr>
                                                    <th class="center" width="4%">SN</th>
                                                    <th width="35%">Item</th>
                                                    <th width="6%">HSN</th>
                                                    <th width="6%">Qty</th>
                                                    <th width="4%">UnitPrice</th>
                                                    @if(!empty($invoice->discount) && $invoice->discount > 0)
                                                    <th>Dis</th>
                                                    @endif
                                                    <th>Amt</th>
                                                    @if(!empty($invoice->sgst) && $invoice->sgst>0)
                                                    <th colspan="2" class="text-center">SGST</th>
                                                    @endif @if(!empty($invoice->cgst) && $invoice->cgst>0)
                                                    <th colspan="2" class="text-center">CGST</th>
                                                    @endif @if(!empty($invoice->igst) && $invoice->igst>0)
                                                    <th colspan="2" class="text-center"> IGST</th>
                                                    @endif
                                                    <th class="text-right">Net Amount</th>
                                                </tr>
                                            </thead>
            
                                            <tbody>
                                                @php $i = 1 
                                                @endphp 
                                                
                                                @foreach($invoice->pendingInvoiceDetail as $id) 
                                                @php $pd = $id->packingDetail; 
                                                $bondData = $pd->getBondData($pd->packing_id);
                                                
                                                @endphp

                                                <td class="center">{!! $i !!}</td>
                                                <td class="center">
                                                    {!! $bondData->product_name !!} Spec ({!! $bondData->size !!})
                                                    <p>{!! $bondData->category !!} PKID ({!! $pd->packing_id !!})</p>
                                                </td>
                                                <td class="center">
                                                        {!! $bondData->hsn_code !!}
                                                </td>
                                                <td class="center">{!! $id->qty !!}</td>
                                                <td class="center">{!! $id->unit_price !!}</td>
            
                                                @if(!empty($id->discount) && $id->discount > 0)
                                                <td>{!! $id->discount !!}</td>
                                                <td class="text-right">{!! $id->discount_val!!}</td>
                                                @endif
                                                <td class="text-right"> {!! $id->amount !!}</td>
                                                @if(!empty($id->sgst) && $id->sgst>0)
                                                <td width="1%">{!! $id->sgst!!}%</td>
                                                <td class="text-right">{!! $id->sgst_value!!}</td>
                                                @endif @if(!empty($id->cgst) && $id->cgst>0)
                                                <td width="1%">{!! $id->cgst!!}%</td>
                                                <td class="text-right">{!! $id->cgst_value!!}</td>
                                                @endif @if(!empty($id->igst) && $id->igst>0)
                                                <td width="1%">{!! $id->igst!!}%</td>
                                                <td class="text-right">{!! $id->igst_value!!}</td>
                                                @endif
            
                                                <td class="text-right">{!! $id->net_amount !!}</td>
                                                @endforeach
                                                
                                                <tr class="blank_row">
                                                    <td></td>
                                                    <td></td>
                                                    <td></td>
                                                    <td></td>
                                                    <td></td>
                                                    <td></td>
                                                    <td></td>
                                                    <td></td>
                                                    <td></td>
                                                    <td></td>
                                                    <td></td>
                                                </tr> 
                                               
                                                   
                                            </tbody>
                                            <tfoot align="right">
                                                <tr>
                                                    @php 
                                                    $dVisible = (!empty($id->discount) && $id->discount>0); 
                                                    $cVisible = (!empty($id->cgst) && $id->cgst>0); 
                                                    $sVisible =(!empty($id->sgst) && $id->sgst>0); 
                                                    $iVisible = (!empty($id->igst) && $id->igst>0);
                                                    $colspan = 4; 
                                                    $totalColSpan = 12; 
                                                    $totalColSpan =(!$dVisible)? ($totalColSpan-1):$totalColSpan;
                                                    $totalColSpan =(!$cVisible)? ($totalColSpan-1):$totalColSpan; $totalColSpan =(!$sVisible)?
                                                    ($totalColSpan-1):$totalColSpan; $totalColSpan =(!$iVisible)? ($totalColSpan-1):$totalColSpan;
                                                    $colspan = (!$dVisible)? ($colspan+1):$colspan; 
            @endphp
                                                    <th class="text-right" colspan="{!! $colspan !!}">Total</th>
            
                                                    @if(!empty($id->discount) && $id->discount > 0)
                                                    <th>{!! $id->discount !!}</th>
                                                    @endif
            
                                                    <th>&#8377; {!! $id->amount !!}</th>
            
                                                    @if(!empty($id->sgst_value) && $id->sgst_value>0)
                                                    <th colspan= "2">&#8377; {!! $id->sgst_value!!}</th>
                                                    @endif @if(!empty($id->cgst_value) && $id->cgst_value>0)
                                                    <th colspan= "2">&#8377; {!! $id->cgst_value!!}</th>
                                                    @endif @if(!empty($id->igst_value) && $id->igst_value>0)
                                                    <th colspan= "2">&#8377; {!! $id->igst_value!!}</th>
                                                    @endif
            
                                                    <th class="text-right">&#8377; {!! $id->net_amount!!}</th>
                                                </tr>
                                                <tr>
                                                    <th class="text-right" colspan="{!! $totalColSpan !!}">Total</th>
                                                    <th>&#8377; {!! $invoice->totalAmount!!}</th>
                                                </tr>
            
                                                @if(isset($invoice->packing_charge) && $invoice->packing_charge>0)
                                                <tr>
                                                    <th class="text-right" colspan="{!! $totalColSpan !!}">Packing Charges</th>
                                                    <th>&#8377; {!! $invoice->packing_charge!!}</th>
                                                </tr>
                                                @endIf @if(isset($invoice->transport) && $invoice->transport>0)
                                                <tr>
                                                    <th class="text-right" colspan="{!! $totalColSpan !!}">Transport Charges</th>
                                                    <th>&#8377; {!! $invoice->transport!!}</th>
                                                </tr>
                                                @endIf @if((isset($invoice->transport) && $invoice->transport>0) || (isset($invoice->packing_charge) && $invoice->packing_charge>0))
                                                <tr>
                                                    <th class="text-right" colspan="{!! $totalColSpan !!}">Total</th>
                                                    <th>&#8377;  {!! $invoice->totalAmount!!}</th>
                                                </tr>
                                                @endIf
            
                                                <tr>
                                                    <td colspan="{!! $totalColSpan+1 !!}">Net Payable Amount in words :<strong> &#8377; {!! BladeUtil::getIndianCurrency($invoice->totalAmount) !!}</strong></td>
                                                </tr>
            
                                            </tfoot>
                                        </table>
                                    </div>
                                </div>
                            </div>       
                    </td>

                </tr>
                <tfoot>
                    <tr>
                        <td>
                                <div class="row px-3">
                                        <div class="w-50 p-0 px-2">
                                                <div>
                                                    <div class="">
                                                        {!! $companyDetail->declaration_note !!}
                                                    </div>
                                                </div>
                                            </div>
                                 </div> 
                        </td>
                    </tr>
                </tfoot>
      </tbody>
      </table>

</body>
</html>