		
<html>
<head>
  <title>Districtwise completion Report</title>
  <meta name="csrf-token" content="{{ csrf_token() }}" />
  <link href="https://fonts.googleapis.com/css2?family=Lato&display=swap" rel="stylesheet">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
  <style>
    body{
        font-family: 'Times New Roman';
        font-size: 20px;
    }
    @media print {
      @page {
        size: A4 potrait;
    }
                /*.head_class{
                    position: fixed;
                    }*/
                    .print_action{display: none;}
                    .page-break
                    {
                        page-break-before:always;
                    } 
                }


                button#dashboard {
                    background-color: #008CBA;;
                    padding:10px 24px;
                    border:none;
                    font-weight: normal;
                    margin-top : 10px;
                }


                button#print {
                    margin-top: 10px;
                    background-color: #008CBA;;
                    padding:10px 24px;
                    border:none;
                    text-decoration:none;
                    color:white;
                    cursor:pointer;
                    font-weight: normal;
                }

                .vertical-text {
                    writing-mode: vertical-rl;
                    transform: rotate(-180deg);
                }

                p{
                    font-size: 20px !important;
                    margin-bottom: 0px;
                    font-weight: 500;
                }

                .table-bordered td, .table-bordered th, .table-bordered thead td, .table-bordered thead th{
                    vertical-align: middle;
                    font-size: 15px !important;
                }

                .table{
                  text-align: center;
                }

                .table thead th {
                    border-bottom: 1px solid #000000 !important;
                }

                .table-bordered td, .table-bordered th {
                    border: 1px solid #000000 !important;
                }

                .table-bordered {
                    border: 1px solid #000000 !important;
                }
                .table td, .table th {
               padding: 5px;
                  }

            </style>

        </head>
<body>

<div class="container-fluid ">
                     <div class="row py-5 my-5 ">
						<div class="col-12 " >
                        <table class="table table-bordered mb-0  ">
                            <thead>
                                <tr>
                                    <th colspan="16">
                                       Abstract of the Submitted completion certificates GP's wise in {{$area_list->area_name??""}} District 
                                    </th>                                    
                                </tr>                              
                              <tr>                                
								<th colspan="3"></th>
								<th colspan="6">Wattage Wise No.of LED Street Lights Installed</th>
								
								<th colspan="4">IDC Items Supllied and Installed</th>
                                <th colspan="2">CCMS data</th> 
								<th colspan="1"></th>                 
                              </tr>
                                <tr>
									<th scope="col" >S.No</th>
									<th scope="col" width="150"> Name of the  Mandal</th>
									<th scope="col" width="150"> Name of the Gram Panchayat</th>
									<th scope="col" >18W</th>
									<th scope="col">35W </th>
									<th scope="col">70W</th>
									<th scope="col">110W </th>
									<th scope="col">190W</th>
									<th scope="col" >Total</th>
									
									<th scope="col">25mm dia arm set</th>
									<th scope="col">32mm dia arm set</th>
									<th scope="col">40mm dia arm set</th>
									<th scope="col">Total</th>
                                    <th scope="col">CCMS</th>
                                     <th scope="col">Cable (1c x 10 sq.mm)</th>
									<th scope="col">Last date of Installation (DD/MM/YYYY)</th>
                               </tr>
                           </thead>



                            <tbody>
                                  <?php $srnum=0; $tw1=0;$tw2=0;$tw3=0;$tw4=0;$tw5=0;$tw6=0; $i=1;$sum=0;
                                 $aw1=0; $aw2=0; $aw3=0;$aw4=0; $aw5=0; $sum1=0; $csum=0; ?>
                                  @foreach($lists as $report)
                                  

                       
                        <?php

							$cable_used2 = DB::select("SELECT cable_user  
								AS sum    
								FROM survey_infos where approve_status=1 and gram_id=".$report->gram_id);
							$cable_used2_count=array_sum(array_column($cable_used2,'sum'));

                             

                               $cable_used3 = DB::select("SELECT install_qty  
                                AS instaaa,cable_used AS cbl_used 
                                FROM ccms_types inner JOIN phases p on p.gram_id=ccms_types.gram_id and p.phase_no=ccms_types.phase_no inner JOIN area_masters m on m.id=ccms_types.district_id  where ccms_types.gram_id=".$report->gram_id." ORDER BY m.area_name  ASC");
                              $cable_used3_count=array_sum(array_column($cable_used3,'instaaa'));
                                $cable_used4_count=array_sum(array_column($cable_used3,'cbl_used'));
							
                        ?>  
                     

                                <tr>
                                    <td>{{$i}}</td>
                                    <td>{{$report->mandal_name}}</td>
                                    <td>{{$report->gram_name}}</td>
                                    <td><?php $w1=isset($report->count_18)?$report->count_18:0?>{{$w1}}</td>
                                    <td><?php $w2=isset($report->count_35)?$report->count_35:0?>{{$w2}}</td>
                                    <td><?php $w3=isset($report->count_70)?$report->count_70:0?>{{$w3}}</td>
                                   <td><?php $w4=isset($report->count_110)?$report->count_110:0?>{{$w4}}</td>
                                    <td><?php $w5=isset($report->count_190)?$report->count_190:0?>{{$w5}}</td>
                                     <td><?php $counts=$w1+$w2+$w3+$w4+$w5;?>{{$counts}}</td>
                                   <!--  <td>{{$report->ccms_types->insta??"0"}}</td>
                                    <td>0</td>
                                    <td>{{$report->ccms_types->cabler??"0"}}</td> -->
                                    <td><?php $a1=isset($report->count_25mm)?$report->count_25mm:0?>{{$a1}}</td>
                                    <td><?php $a2=isset($report->count_32mm)?$report->count_32mm:0?>{{$a2}}</td>
                                    <td><?php $a3=isset($report->count_40mm)?$report->count_40mm:0?>{{$a3}}</td>
                                    <td><?php $armscounts=$a1+$a2+$a3;?>{{$armscounts}}</td>
                                                                   
                                 <td > <?php $w6=isset($cable_used3_count)?$cable_used3_count:0?>{{$w6}}</td>
                                  <td>{{$cable_used4_count}}</td>    
                                                                     
                               
                                    <td  style="border-right: 1px solid #000;border-bottom: 1px solid #000;">{{date('d/m/Y',strtotime($report->created_at))}}</td>
                               
                                </tr>
                            <?php 
                                $tw1=$w1+$tw1;
                                $tw2=$w2+$tw2;
                                $tw3=$w3+$tw3;
                                $tw4=$w4+$tw4;
                                $tw5=$w5+$tw5;
                                $tw6=$w6+$tw6;
                                $sum = $tw1+$tw2+$tw3+$tw4+$tw5;

                                $aw1=$a1+$aw1;
                                $aw2=$a2+$aw2;
                                $aw3=$a3+$aw3;
       
                                $sum1=$aw1+$aw2+$aw3;
                                $csum=$cable_used4_count+$csum;
                                 $i++;
                            ?>
                                @endforeach
                                <tr>
         
          
           <td></td>
           <td><b>Total</b></td>
            <td></td>
          <td><b>{{$tw1}}</b></td>
          <td><b>{{$tw2}}</b></td>
          <td><b>{{$tw3}}</b></td>
          <td><b>{{$tw4}}</b></td>
          <td><b>{{$tw5}}</b></td>
          <td><b>{{$sum}}</b></td>
          <td><b>{{$aw1}}</b></td>
          <td><b>{{$aw2}}</b></td>
          <td><b>{{$aw3}}</b></td>
          <td><b>{{$sum1}}</b></td>
          <td><b>{{$tw6}}</b></td>
           <td><b>{{$csum}}</b></td>
           
         
          
       </tr>                                                           
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            </body>
</html>