@extends('backend.header')
@section('index-content')
<style>
  .add-btn{
    width: auto !important;
    height: 31px !important;
    border-radius: 3px !important;
    line-height: 16px !important;
  }
  .table-responsive {
        width: 100%;
        height: 75vh !important;
    }
    /*th,
    td {
        white-space: nowrap;
    }*/
    table tr td:first-child {
        position: sticky;
        width: 50px;
        left: 0;
        background: #fff;
        color: #000;
        z-index: 9;
    }
    table tr td:nth-child(2) {
        position: sticky;
        left: 65px;
        background: #fff;
        color: #000;
        z-index: 9;
    }
    table tr th:first-child {
        position: sticky;
        width: 50px;
        left: 0;
        /*   background: #fff;*/
        color: #000;
        z-index: 10;
    }
    table tr th:nth-child(2) {
        position: sticky;
        left: 65px;
/*        background: #fff !important;*/
        color: #000;
        z-index: 10;
    }
    tr.table-success {
        position: sticky;
        left: 0;
        z-index: 10;
/*        background: #fff !important;*/
    }
    tr.table-success {
        top: 0px !important;
        position: sticky !important;
    }
    tr.table-warning {
         top: 36px !important;
         position: sticky !important;
    }
    tr.table-warning,
    tr.table-success{
         position: sticky;
         left: 0;
         z-index: 10;
/*         background: #fff !important;*/
    }
    .table-success,
    .table-success > td,
    .table-success > th {
        background-color: #c3e6cb !important;
    }
    .table-warning, .table-warning>td, .table-warning>th {
        background-color: #ffeeba !important;
    } 
</style>
<div class="row px-3">
  <section role="main" class="content-body">
    <header class="page-header">
        <div class="row">
          <div class="col-lg-5">

                        @if(session()->get('role')==0 )
                <h2>CCMS Outwards Invoice List</h2>
            @else
                <h2>CCMS Inwards Invoice List</h2>
            @endif

          </div>
        
          <div class="col-lg-5">
              <ol class="breadcrumbs">
              <li>
                <a href="{{url('index')}}">
                  <i class="fa fa-home"></i>
                </a>
              </li>
              <li><a href="{{'armsclamps_view'}}"><span class="active">{{$district->area_name??"Districts"}}</span></a></li>
            </ol>
          </div>
          <div class="col-lg-2">
              <div class="back-btn-div">
            <button class="btn btn-primary back-btn" onclick="window.history.back()" style="margin-right: 25px;">Back</button>
        </div>
          </div>
      </div>
    </header>
      <!-- <header class="page-header">
          <h2>CCMS outwards Invoice List</h2>

      </header>
      <div class="row">
        <div class="col-xs-12">
          <div class="right-wrapper">
            <ol class="breadcrumbs">
              <li>
                <a href="{{url('index')}}">
                  <i class="fa fa-home"></i>
                </a>
              </li>
              <li><a href="{{'armsclamps_view'}}"><span class="active">{{$district->area_name??"Districts"}}</span></a></li>
            </ol>
          </div>
        </div>
        <div class="col-xs-12 mt-3">
          <div>
            <button class="btn btn-primary" onclick="window.history.back()">Back</button>
          </div>
        </div>
      </div> -->


      <!-- start: page -->
          <section class="panel px-1">
          <!--   <header class="panel-heading mb-5">
              <h4 class="my-2">CCMS outwards Invoice List</h4> 
              <div class="add-btn-div">
            <a href="{{url('admin_outwards_ccms')}}" class="btn btn-primary add-btn">Add </a>
          </div> -->
             
            
            </header>
            <div>
             <table class="table table-bordered table-striped mb-none mt-0" id="datatable-default">
               <thead>
                   <tr class="table-success">
          <th>S.NO</th>
          <th class="text-left">Invoice&nbsp;Number</th>
          <th>CCMS&nbsp;Ph&nbsp;Transfer&nbsp;Quantity</th>
          <th>Transfered&nbsp;cable </th>
          <th>Total</th>         
                   </tr>
               </thead>
               <tbody>
               <?php $tw1=0;$tw2=0;$tw3=0;$tw4=0;$tw5=0;$tw6=0; $sum=0; $i=0;?>
           
            @foreach($area_dis as $list)

             <?php $i++;
             $counts=$list['ccmsph']+$list['rcv_cbl']
             // $ex_buf_stock=$counts-$list['buffer_stk'];
             ?>
                <tr>
                  <td data-order="{{$i}}">{{$i}}</td>
                   
                     <td ><a target="blank" href="{{url('outwards_ccmstypes_list')}}?id={{$list['invoice_number']}}&&jilla_id={{$list['jilla_id']}}">{{$list['invoice_number']??'0'}}</a></td>
                     <td>{{$list['ccmsph']??'0'}}</td>
                      <td>{{$list['rcv_cbl']??'0'}}</td>
                      <td>{{$counts??'0'}}</td>
     
                </tr>
                    <?php 
       $tw1=$list['ccmsph']+$tw1;
       $tw2=$list['rcv_cbl']+$tw2;
       $sum=$sum+$counts; ?>
                                
       @endforeach
   </tbody><tfoot>
       <tr>
                 <td data-order="{{$i}}"></td>
        <td><b>Total</b></td>


          <td><b>{{$tw1??'0'}}</b></td>
          <td><b>{{$tw2??'0'}}</b></td>
          <td><b>{{$sum??'0'}}</b></td>     
       </tr>
               
               </tfoot>
           </table>
       </div>
       </section>
        <table class="table table-bordered table-striped mb-none mt-0">
               <thead>
                <tr><th colspan="5">Balance Ccms Vendor </th></tr>
                   <tr class="table-success">
          <th>S.NO</th>
          <th class="text-left">Invoice&nbsp;Number</th>
          <th>CCMS&nbsp;Ph&nbsp;Transfer&nbsp;Quantity</th>
          <th>Transfered&nbsp;cable </th>
          <th>Total</th>         
                   </tr>
               </thead>
               <tbody>
               <?php $tw1=0;$tw2=0;$tw3=0;$tw4=0;$tw5=0;$tw6=0; $sum=0; $i=0;?>
           
            @foreach($balance_view as $list)

             <?php $i++;
             $counts=$list['ccmsph']+$list['rcv_cbl']
             // $ex_buf_stock=$counts-$list['buffer_stk'];
             ?>
                <tr>
                  <td>{{$i}}</td>
                   
                     <td >{{$list['invoice_number']??'0'}}</td>
                     <td>{{$list['ccmsph']??'0'}}</td>
                      <td>{{$list['rcv_cbl']??'0'}}</td>
                      <td>{{$counts??'0'}}</td>
     
                </tr>
                    <?php 
       $tw1=$list['ccmsph']+$tw1;
       $tw2=$list['rcv_cbl']+$tw2;
       $sum=$sum+$counts; ?>
                                
       @endforeach
       <tr>
                 <td></td>
        <td><b>Total</b></td>


          <td><b>{{$tw1??'0'}}</b></td>
          <td><b>{{$tw2??'0'}}</b></td>
          <td><b>{{$sum??'0'}}</b></td>     
       </tr>
               
               </tbody>
           </table>
       </div>
   </section>
 </div>
     @stop