<?php $__env->startSection("style"); ?>
<head>
    
<style type="text/css">
#container {
  height: 600px;
}

.highcharts-figure, .highcharts-data-table table {
  min-width: 100%;
  max-width: 100%;
  margin: 1em auto;
}

#datatable {
  font-family: Verdana, sans-serif;
  border-collapse: collapse;
  border: 1px solid #EBEBEB;
  margin: 10px auto;
  text-align: center;
  width: 100%;
  max-width: 500px;
}
#datatable caption {
  padding: 1em 0;
  font-size: 1.2em;
  color: #555;
}
#datatable th {
  width: 100%;
	font-weight: 200;
  padding: 0.5em;
}
#datatable td, #datatable th, #datatable caption {
  padding: 0.5em;
}
#datatable thead tr, #datatable tr:nth-child(even) {
  background: #f8f8f8;
}
#datatable tr:hover {
  background: #f1f7ff;
}


</style>
<?php $__env->stopSection(); ?>
<?php $__env->startSection("content"); ?>

  <?php 
      $year = date("Y")+543;
      $LastYear = $year -1;
      $sumLastYear = 0;
      $sumCurrentYear = 0;
      $summountLastYear1 = 0;
      $summountLastYear2 = 0;
      $summountLastYear3 = 0;
      $summountLastYear4 = 0;
      $summountLastYear5 = 0;
      $summountLastYear6 = 0;
      $summountLastYear7 = 0;
      $summountLastYear8 = 0;
      $summountLastYear9 = 0;
      $summountLastYear10 = 0;
      $summountLastYear11 = 0;
      $summountLastYear12 = 0;
      $summountCurrentYear1 = 0;
      $summountCurrentYear2 = 0;
      $summountCurrentYear3 = 0;
      $summountCurrentYear4 = 0;
      $summountCurrentYear5 = 0;
      $summountCurrentYear6 = 0;
      $summountCurrentYear7 = 0;
      $summountCurrentYear8 = 0;
      $summountCurrentYear9 = 0;
      $summountCurrentYear10 = 0;
      $summountCurrentYear11 = 0;
      $summountCurrentYear12 = 0;
  ?>

<div class="row">
  <div class="col-sm-3 mb-12">
  <div class="card" style="background-color:#044755; color: #FFF;">
      <div class="card-body">
        <h5 class="card-title">Revenue <span style="text-align: center; font-size:12px;">/ <?php echo e($year); ?></span></h5> 
        <p class="m-0 font-weight-bold"  style="text-align: center; font-size:42px; color: #FFF;"><?php echo e(number_format($sumtotal[0]->suma), 2); ?> </p>
       
      </div>
    </div>
  </div>
  <div class="col-sm-3 mb-12">
    <div class="card">
      <div class="card-body">
        <h5 class="card-title">Orders <span style="text-align: center; font-size:12px;">/ <?php echo e($year); ?></span></h5>
        <p class="m-0 font-weight-bold"  style="text-align: center; font-size:42px;color: #0F5766;"><?php echo e(number_format($oder[0]->sumorder), 2); ?> </p>
      </div>
    </div>
  </div>
  <div class="col-sm-3 mb-12">
    <a href="pageeditstock">
      <div class="card">
        <div class="card-body">
        <h5 class="card-title">Stock</h5>
          <p class="m-0 font-weight-bold "  style="text-align: center; font-size:42px;color: #7A3311;"><?php echo e(number_format($sumstock[0]->Amount), 2); ?> </p>
        </div>
      </div>
   </a>
  </div>
  <div class="col-sm-3 mb-12">
    <div class="card">
      <div class="card-body">
      <h5 class="card-title">Customers</h5>
        <p class="m-0 font-weight-bold "  style="text-align: center; font-size:42px;color: #7A3311;"><?php echo e(number_format($sumcus[0]->cus), 2); ?> </p>
      </div>
    </div>
  </div>
</div>


<div class="row">
  <!-- <div class="col-lg-6 mb-12" style="padding:10px;font-size: 12px;">
    <div class="card">
          <div class="card-body">
          <figure class="highcharts-figure">
            <div id="container2"></div>
            <p class="highcharts-description">

            </p>
          </figure>
          </div>
    </div>      
  </div> -->

  <div class="col-lg-6 mb-12" style="padding:10px;">
    <div class="card">
        <div class="card-body">
      <figure class="highcharts-figure">
        <div id="container"></div>
        <p class="highcharts-description">
  
        </p>

        <table id="datatable" hidden>
          <thead>
            <tr >
              <th>ชื่อสินค้า</th>
              
              <th align="right">ปี <?php echo e($LastYear); ?></th>
              <th align="right">ปี <?php echo e($year); ?></th> 
               
            </tr>
          </thead>
          <tbody>
          <?php $i = 1;
          ?>
          <?php $__currentLoopData = $cat; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $x): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <tr >
              <th ><?php echo e($x->PdName); ?></th>
              <td align="right"><?php echo e($x->LastYear); ?></td>
              <td align="right"><?php echo e($x->CurrentYear); ?></td>
            </tr>
          <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> 
           
          </tbody>
        </table>
      </figure>
      </div>
      </div>
   </div>



    <div class="col-lg-3 mb-12" style="padding:10px;">
      <div class="card">
          <div class="card-body">
            <h5 class="card-title" style="color:#048E88;">รายการจำนวนสั่งซื้อจากระบบ</h5>
            <table class="table table-sm ">
              <thead>
                <tr style="background-color:#06A890; color: #FFF;font-size:12px;">
                  <th scope="col" >#</th>
                  <th scope="col" >ระบบ</th>
                  <th scope="col" ></th>
                  <th scope="col" style="text-align: right;">จำนวน /รายการ</th>
                </tr>
              </thead>
              <?php
              $i = 1;
              ?>
              <tbody>
              <?php $__currentLoopData = $dataso; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $x): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <tr>
                  <th scope="row" style="font-size: 14px;"><?php echo e($i++); ?>.</th>
                  <td class="text-nowrap"style="text-align: center;"><img src="<?php echo e($x->partImg); ?>" class="rounded" alt="..."></td>
                  <td style="font-size: 12px;"><?php echo e($x->nameSocial); ?></td>
                  <td style="text-align: right; font-size: 16px;"><?php echo e(number_format($x->sumso)); ?></td>
                </tr>
              <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
              </tbody>
              <tfoot>
                <tr style="background-color:#05B59A; color: #FFF;">
                  <td></td>
                  <td style="text-align: right; font-size: 16px;"></td>
                  <td style="text-align: right; font-size: 16px;"></td>
                  <td style="text-align: right; font-size:16px;"></td>
                </tr>
              </tfoot>
            </table>
          </div>
        </div>
    </div>
    <div class="col-lg-3 mb-12" style="padding:10px;">
      <div class="card">
          <div class="card-body">
            <h5 class="card-title" style="color:#048E88;">Top 10 จังหวัดขายดี</h5>
            <table class="table table-sm ">
              <thead>
                <tr style="background-color:#06A890; color: #FFF;font-size:12px;">
                  <th scope="col" >#</th>
                  <th scope="col" >จังหวัด</th>
                  <th scope="col" style="text-align: right;">จำนวน /ลูกค้า</th>
                </tr>
              </thead>
              <?php
              $i = 1;
              ?>
              <tbody>
              <?php $__currentLoopData = $top10pv; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $x): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <tr>
                  <th scope="row" style="font-size: 14px;"><?php echo e($i++); ?>.</th>
                  <td style="font-size: 14px;"><?php echo e($x->PROVINCE_NAME); ?></td>
                  <td style="text-align: right; font-size: 16px;"><?php echo e(number_format($x->sumpc)); ?></td>
                </tr>
              <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
              </tbody>
              <tfoot>
                <tr style="background-color:#05B59A; color: #FFF;">
                  <td></td>
                  <td style="text-align: right; font-size: 16px;"></td>
                  <td style="text-align: right; font-size: 16px;"></td>
                  <td style="text-align: right; font-size:16px;"></td>
                </tr>
              </tfoot>
            </table>
          </div>
        </div>
    </div>
    
    <div class="col-lg-4 mb-12" style="padding:10px;">
      <div class="card">
          <div class="card-body">
            <h5 class="card-title" style="color:#04499C;">เปรียบเทียบยอดขาย /รายปี</h5>
            <table class="table table-sm ">
              <thead>
                <tr style="background-color:#0666A5; color: #FFF;font-size:14px;">
                  <th scope="col" style="font-size: 12px;">#</th>
                  <th scope="col" style="font-size: 12px;">สินค้า</th>
                  <th scope="col" style="text-align: right;font-size: 12px;">ปี <?php echo e($LastYear); ?></th>
                  <th scope="col" style="text-align: right;font-size: 12px;">ปี <?php echo e($year); ?></th>
                </tr>
              </thead>
              <?php
              $i = 1;

              ?>
              <tbody>
              <?php $__currentLoopData = $cat; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $x): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <tr>
                  <th scope="row" style="font-size: 12px;"><?php echo e($i++); ?>.</th>
                  <td style="font-size: 12px;"><?php echo e($x->PdName); ?></td>
                  <td style="text-align: right; font-size: 12px;"><?php echo e(number_format($x->LastYear)); ?></td>
                  <td style="text-align: right; font-size: 12px;"><?php echo e(number_format($x->CurrentYear)); ?></td>
                </tr>
                <?php
                $sumLastYear += $x->LastYear;
                $sumCurrentYear += $x->CurrentYear;
                ?>
              <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
              </tbody>
              <tfoot>
                <tr style="background-color:#087DC8; color: #FFF;">
                  <td></td>
                  <td style="text-align: right; font-size: 14px;">ยอดขายรวม :</td>
                  <td style="text-align: right; font-size:14px;"><?php echo e(number_format($sumLastYear)); ?></td>
                  <td style="text-align: right; font-size:14px;"><?php echo e(number_format($sumCurrentYear)); ?></td>
                </tr>
              </tfoot>
            </table>
          </div>
        </div>
    </div>

  <div class="col-lg-8 mb-12" style="padding:10px;font-size: 12px;">
    <div class="card">
        <div class="card-body">
          <h5 class="card-title" style="color:#04499C;">เปรียบเทียบยอดขาย /รายเดือน</h5>
          <div class="table-responsive" >
          <table class="table table-bordered table-sm ">
            <thead>
              <tr style="background-color:#0666A5; color: #FFF;font-size:12px;">
                <th scope="col" >#</th>
                <th scope="col" >สินค้า</th>
                <th scope="col" style="text-align: right;">01/<?php echo e($LastYear); ?></th>
                <th scope="col" style="text-align: right;">01/<?php echo e($year); ?></th>
                <th scope="col" style="text-align: right;">02/<?php echo e($LastYear); ?></th>
                <th scope="col" style="text-align: right;">02/<?php echo e($year); ?></th>
                <th scope="col" style="text-align: right;">03/<?php echo e($LastYear); ?></th>
                <th scope="col" style="text-align: right;">03/<?php echo e($year); ?></th>
                <th scope="col" style="text-align: right;">04/<?php echo e($LastYear); ?></th>
                <th scope="col" style="text-align: right;">04/<?php echo e($year); ?></th>
                <th scope="col" style="text-align: right;">05/<?php echo e($LastYear); ?></th>
                <th scope="col" style="text-align: right;">05/<?php echo e($year); ?></th>
                <th scope="col" style="text-align: right;">06/<?php echo e($LastYear); ?></th>
                <th scope="col" style="text-align: right;">06/<?php echo e($year); ?></th>
                <th scope="col" style="text-align: right;">07/<?php echo e($LastYear); ?></th>
                <th scope="col" style="text-align: right;">07/<?php echo e($year); ?></th>
                <th scope="col" style="text-align: right;">08/<?php echo e($LastYear); ?></th>
                <th scope="col" style="text-align: right;">08/<?php echo e($year); ?></th>
                <th scope="col" style="text-align: right;">09/<?php echo e($LastYear); ?></th>
                <th scope="col" style="text-align: right;">09/<?php echo e($year); ?></th>
                <th scope="col" style="text-align: right;">10/<?php echo e($LastYear); ?></th>
                <th scope="col" style="text-align: right;">10/<?php echo e($year); ?></th>
                <th scope="col" style="text-align: right;">11/<?php echo e($LastYear); ?></th>
                <th scope="col" style="text-align: right;">11/<?php echo e($year); ?></th>
                <th scope="col" style="text-align: right;">12/<?php echo e($LastYear); ?></th>
                <th scope="col" style="text-align: right;">12/<?php echo e($year); ?></th>
              </tr>
            </thead>
            <?php
            $i = 1;

            ?>
            <tbody>
            <?php $__currentLoopData = $momt; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $x): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
              <tr>
                <th scope="row" ><?php echo e($i++); ?>.</th>
                <td class="text-nowrap" ><?php echo e($x->PdName); ?></td>
                <td style="text-align: right; "><?php echo e(number_format($x->LastYear1)); ?></td>
                <td style="text-align: right;background-color:#EBF2F9; "><?php echo e(number_format($x->CurrentYear1)); ?></td>
                <td style="text-align: right; "><?php echo e(number_format($x->LastYear2)); ?></td>
                <td style="text-align: right; background-color:#EBF2F9; "><?php echo e(number_format($x->CurrentYear2)); ?></td>
                <td style="text-align: right;"><?php echo e(number_format($x->LastYear3)); ?></td>
                <td style="text-align: right; background-color:#EBF2F9; "><?php echo e(number_format($x->CurrentYear3)); ?></td>
                <td style="text-align: right; "><?php echo e(number_format($x->LastYear4)); ?></td>
                <td style="text-align: right; background-color:#EBF2F9; "><?php echo e(number_format($x->CurrentYear4)); ?></td>
                <td style="text-align: right;"><?php echo e(number_format($x->LastYear5)); ?></td>
                <td style="text-align: right; background-color:#EBF2F9; "><?php echo e(number_format($x->CurrentYear5)); ?></td>
                <td style="text-align: right; "><?php echo e(number_format($x->LastYear6)); ?></td>
                <td style="text-align: right;background-color:#EBF2F9;  "><?php echo e(number_format($x->CurrentYear6)); ?></td>
                <td style="text-align: right; "><?php echo e(number_format($x->LastYear7)); ?></td>
                <td style="text-align: right;background-color:#EBF2F9;  "><?php echo e(number_format($x->CurrentYear7)); ?></td>
                <td style="text-align: right; "><?php echo e(number_format($x->LastYear8)); ?></td>
                <td style="text-align: right; background-color:#EBF2F9; "><?php echo e(number_format($x->CurrentYear8)); ?></td>
                <td style="text-align: right; "><?php echo e(number_format($x->LastYear9)); ?></td>
                <td style="text-align: right;background-color:#EBF2F9;  "><?php echo e(number_format($x->CurrentYear9)); ?></td>
                <td style="text-align: right; "><?php echo e(number_format($x->LastYear10)); ?></td>
                <td style="text-align: right;background-color:#EBF2F9;  "><?php echo e(number_format($x->CurrentYear10)); ?></td>
                <td style="text-align: right; "><?php echo e(number_format($x->LastYear11)); ?></td>
                <td style="text-align: right; background-color:#EBF2F9; "><?php echo e(number_format($x->CurrentYear11)); ?></td>
                <td style="text-align: right; "><?php echo e(number_format($x->LastYear12)); ?></td>
                <td style="text-align: right;background-color:#EBF2F9;  "><?php echo e(number_format($x->CurrentYear12)); ?></td>
              </tr>
              <?php
              $summountLastYear1 += $x->LastYear1;
              $summountLastYear2 += $x->LastYear2;
              $summountLastYear3 += $x->LastYear3;
              $summountLastYear4 += $x->LastYear4;
              $summountLastYear5 += $x->LastYear5;
              $summountLastYear6 += $x->LastYear6;
              $summountLastYear7 += $x->LastYear7;
              $summountLastYear8 += $x->LastYear8;
              $summountLastYear9 += $x->LastYear9;
              $summountLastYear10 += $x->LastYear10;
              $summountLastYear11 += $x->LastYear11;
              $summountLastYear12 += $x->LastYear12;

              $summountCurrentYear1 += $x->CurrentYear1;
              $summountCurrentYear2 += $x->CurrentYear2;
              $summountCurrentYear3 += $x->CurrentYear3;
              $summountCurrentYear4 += $x->CurrentYear4;
              $summountCurrentYear5 += $x->CurrentYear5;
              $summountCurrentYear6 += $x->CurrentYear6;
              $summountCurrentYear7 += $x->CurrentYear7;
              $summountCurrentYear8 += $x->CurrentYear8;
              $summountCurrentYear9 += $x->CurrentYear9;
              $summountCurrentYear10 += $x->CurrentYear10;
              $summountCurrentYear11 += $x->CurrentYear11;
              $summountCurrentYear11 += $x->CurrentYear12;
     
              ?>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </tbody>
            <tfoot>
              <tr style="background-color:#087DC8; color: #FFF;font-size:12px;">
                <td></td>
                <td style="text-align: right;">ยอดขายรวม :</td>
                <td style="text-align: right;"><?php echo e(number_format($summountLastYear1)); ?></td>
                <td style="text-align: right;"><?php echo e(number_format($summountCurrentYear1)); ?></td>
                <td style="text-align: right;"><?php echo e(number_format($summountLastYear2)); ?></td>
                <td style="text-align: right;"><?php echo e(number_format($summountCurrentYear2)); ?></td>
                <td style="text-align: right;"><?php echo e(number_format($summountLastYear3)); ?></td>
                <td style="text-align: right;"><?php echo e(number_format($summountCurrentYear3)); ?></td>
                <td style="text-align: right;"><?php echo e(number_format($summountLastYear4)); ?></td>
                <td style="text-align: right;"><?php echo e(number_format($summountCurrentYear4)); ?></td>
                <td style="text-align: right;"><?php echo e(number_format($summountLastYear5)); ?></td>
                <td style="text-align: right;"><?php echo e(number_format($summountCurrentYear5)); ?></td>
                <td style="text-align: right;"><?php echo e(number_format($summountLastYear6)); ?></td>
                <td style="text-align: right;"><?php echo e(number_format($summountCurrentYear6)); ?></td>
                <td style="text-align: right;"><?php echo e(number_format($summountLastYear7)); ?></td>
                <td style="text-align: right; "><?php echo e(number_format($summountCurrentYear7)); ?></td>
                <td style="text-align: right;"><?php echo e(number_format($summountLastYear8)); ?></td>
                <td style="text-align: right;"><?php echo e(number_format($summountCurrentYear8)); ?></td>
                <td style="text-align: right;"><?php echo e(number_format($summountLastYear9)); ?></td>
                <td style="text-align: right; "><?php echo e(number_format($summountCurrentYear9)); ?></td>
                <td style="text-align: right;"><?php echo e(number_format($summountLastYear10)); ?></td>
                <td style="text-align: right;"><?php echo e(number_format($summountCurrentYear10)); ?></td>
                <td style="text-align: right;"><?php echo e(number_format($summountLastYear11)); ?></td>
                <td style="text-align: right; "><?php echo e(number_format($summountCurrentYear11)); ?></td>
                <td style="text-align: right; "><?php echo e(number_format($summountLastYear12)); ?></td>
                <td style="text-align: right;"><?php echo e(number_format($summountCurrentYear12)); ?></td>
              </tr>
            </tfoot>
          </table>
          </div>
        </div>
      </div>
  </div>

 


</div>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('script'); ?>
<script type="text/javascript">

  $( document ).ready(function() {
      console.log( "ready!" );
  });

  function lodedataonmounth(){
    $('#'+id).datepicker({
      format: "dd/mm/yyyy",
      todayBtn: "linked",
      clearBtn: true,
      language: "th",
      daysOfWeekHighlighted: "0",
      autoclose: true,
      todayHighlight: true
    });
  }
</script>

<!-- Highcharts Column -->
    <script type="text/javascript">
     $(document).ready( function () {
        $('#Tablemount').DataTable();
        
      });
        Highcharts.chart('container', {
          data: {
            table: 'datatable'
          },
          chart: {
            type: 'column'
          },
          title: {
            text: 'ยอดขายสินค้ารายปี'
          },
          yAxis: {
            allowDecimals: false,
            title: {
              text: 'บาท'
            }
          },
          tooltip: {
            formatter: function () {
              return '<b>' + this.series.name + '</b><br/>' +
                this.point.y + ' ' + this.point.name.toLowerCase();
            }
          }
    });
  </script>
<!-- Highcharts Column -->
<script type="text/javascript">

      Highcharts.chart('container2', {
      chart: {
        type: 'column'
      },
      title: {
        text: 'กราฟเปรียบเทียบยอดขาย /รายเดือน'
      },
      subtitle: {
      },
      xAxis: {
        categories: [
          'Jan',
          'Feb',
          'Mar',
          'Apr',
          'May',
          'Jun',
          'Jul',
          'Aug',
          'Sep',
          'Oct',
          'Nov',
          'Dec'
        ],
        crosshair: true
      },
      yAxis: {
        min: 0,
        title: {
          text: 'บาท'
        }
      },
      tooltip: {
        headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
        pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
          '<td style="padding:0"><b>{point.y:.1f} mm</b></td></tr>',
        footerFormat: '</table>',
        shared: true,
        useHTML: true
      },
      plotOptions: {
        column: {
          pointPadding: 0.2,
          borderWidth: 0
        }
      },
      series: [{
        name: 'Tokyo',
        data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]

      }, {
        name: 'New York',
        data: [83.6, 78.8, 98.5, 93.4, 106.0, 84.5, 105.0, 104.3, 91.2, 83.5, 106.6, 92.3]

      }, {
        name: 'London',
        data: [48.9, 38.8, 39.3, 41.4, 47.0, 48.3, 59.0, 59.6, 52.4, 65.2, 59.3, 51.2]

      }, {
        name: 'Berlin',
        data: [42.4, 33.2, 34.5, 39.7, 52.6, 75.5, 57.4, 60.4, 47.6, 39.1, 46.8, 51.1]

      }]
    });
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make("layout.menu", \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp7\htdocs\except\resources\views/home/index.blade.php ENDPATH**/ ?>