<html>
    <head>

    </head>
    <body>
        @foreach($employees as $key => $employee)
            <table class="waffle" cellspacing="0" cellpadding="0">
                <tbody>
                    <tr style="height: 16px;">
                    <td class="s3" style="
                                width:50px;
      border-bottom: 2px SOLID #000000;
      border-right: 2px SOLID #000000;
      background-color: #2f5496;
      text-align: center;
      font-weight: bold;
      color: #ffffff;
      font-family: Verdana;
      font-size: 20pt;
      vertical-align: middle;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;
      " dir="ltr" colspan="2" rowspan="{{ count($products)+1 }}" >{{ $employee->name }}</td>
                    @foreach ($months as $keyMonth=>$month)
                        <td class="s4" style="
                                width:50px;
      border-bottom: 2px SOLID #000000;
      border-right: 2px SOLID #000000;
      background-color:{{ end($months) == $month ? '#a8d08d' : '#ffffff' }};
      text-align: center;
      font-weight: bold;
      font-style: italic;
      color: #000000;
      font-family: Verdana;
      font-size: 16pt;
      vertical-align: middle;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;
      " rowspan="{{ count($products)+1 }}">{{ __('targets.months_short.'.$month) }} - {{ $year }}</td>
                        <td class="s5" style="
                                width:50px;
      border-bottom: 2px SOLID #000000;
      border-right: 2px SOLID #000000;
      background-color: #ffffff;
      text-align: center;
      font-weight: bold;
      color: #000000;
      font-family: Verdana;
      font-size: 9pt;
      vertical-align: bottom;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;
      ">Product</td>
                        <td class="s5" style="
                                width:50px;
      border-bottom: 2px SOLID #000000;
      border-right: 2px SOLID #000000;
      background-color: #ffffff;
      text-align: center;
      font-weight: bold;
      color: #000000;
      font-family: Verdana;
      font-size: 9pt;
      vertical-align: bottom;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;
      ">Contribution</td>
                    @endforeach
                    </tr>


                    @foreach ($products as $keyProduct=>$product)
                        <tr style="height: 15px">
                            @foreach ($months as $month)
                                <td class="s11" style="
                                width:50px;
      border-bottom: 1px SOLID #000000;
      border-right: 1px SOLID #000000;
      background-color: {{ $keyProduct % 2 == 0 ? '#2f5496' : '#ff3399'  }};
      text-align: center;
      font-style: italic;
      color: #ffffff;
      font-family: Verdana;
      font-size: 8pt;
      vertical-align: bottom;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;
      " >{{ $product->title }}</td>
                                <td class="s12" style="
                                width:50px;
      border-bottom: 2px SOLID #000000;
      border-right: 2px SOLID #000000;
      background-color: #ffff00;
      text-align: center;
      font-weight: bold;
      font-style: italic;
      color: #171616;
      font-family: Verdana;
      font-size: 8pt;
      vertical-align: bottom;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;
      ">{{ number_format($product->percentAcheived($year,$month,$employee->id),2) }}%</td>
                            @endforeach
                        </tr>
                    @endforeach

                    <tr style="height: 21px">
                    <td class="s5" style="
                                width:50px;
      border-bottom: 2px SOLID #000000;
      border-right: 2px SOLID #000000;
      background-color: #ffffff;
      text-align: center;
      font-weight: bold;
      color: #000000;
      font-family: Verdana;
      font-size: 9pt;
      vertical-align: bottom;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;">Product</td>
                    <td class="s19" style="
                                width:50px;
      border-bottom: 2px SOLID #000000;
      border-right: 2px SOLID #000000;
      background-color: #ffffff;
      text-align: left;
      font-weight: bold;
      font-style: italic;
      color: #000000;
      font-family: Verdana;
      font-size: 10pt;
      vertical-align: middle;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;
      ">AB FY {{ $year }}</td>

                    @foreach ($months as $month)
                        <td class="s20" style="
                                width:50px;
      border-bottom: 2px SOLID #000000;
      border-right: 1px SOLID transparent;
      background-color: #ffffff;
      text-align: center;
      font-weight: bold;
      font-style: italic;
      color: #000000;
      font-family: Verdana;
      font-size: 10pt;
      vertical-align: bottom;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;
      ">AB (AED)</td>
                        <td class="s20" style="
                                width:50px;
      border-bottom: 2px SOLID #000000;
      border-right: 1px SOLID transparent;
      background-color: #ffffff;
      text-align: center;
      font-weight: bold;
      font-style: italic;
      color: #000000;
      font-family: Verdana;
      font-size: 10pt;
      vertical-align: bottom;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;
      ">REA (AED)</td>
                        <td class="s21" style="
                                width:50px;
      border-bottom: 2px SOLID #000000;
      border-right: 2px SOLID #000000;
      background-color: #ffffff;
      text-align: center;
      font-weight: bold;
      font-style: italic;
      color: #000000;
      font-family: Verdana;
      font-size: 10pt;
      vertical-align: bottom;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;
      ">Achieved %</td>
                    @endforeach
                    </tr>

                    @foreach ($products as $product)
                        <tr style="height: 19px">
                            <td class="s29" style="
                                width:50px;
      border-bottom: 1px SOLID transparent;
      border-right: 2px SOLID #000000;
      background-color: #ffffff;
      text-align: left;
      color: #000000;
      font-family: Verdana;
      font-size: 10pt;
      vertical-align: bottom;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;
      ">{{ $product->title }}</td>
                            <td class="s44" style="
                                width:50px;
      border-bottom: 1px SOLID transparent;
      border-right: 2px SOLID #000000;
      background-color: #ffff00;
      text-align: center;
      color: #000000;
      font-family: Verdana;
      font-size: 10pt;
      vertical-align: bottom;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;
      ">{{ number_format ($product->targetYear($year,$employee->id) , 2) }}</td>
                            @foreach ($months as $month)
                                @php
                                    $target = $product->targetEmp($year,$month ,$employee->id);
                                    $sales = $product->salesEmp($year,$month,$employee->id);
                                @endphp
                                <td class="s45" style="
                                width:50px;
      border-bottom: 1px SOLID transparent;
      border-right: 1px SOLID transparent;
      background-color: #ffffff;
      text-align: center;
      font-style: italic;
      color: #000000;
      font-family: Verdana;
      font-size: 10pt;
      vertical-align: bottom;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;
      ">{{ number_format($target,2) }}</td>
                                <td class="s46" style="
                                width:50px;
      border-right: 1px SOLID transparent;
      background-color: #ffffff;
      text-align: center;
      color: #000000;
      font-family: docs-Calibri, Arial;
      font-size: 11pt;
      vertical-align: bottom;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;
      ">{{ number_format($sales,2) }}</td>

                                <td class="s32" style="
                                width:50px;
      border-bottom: 1px SOLID transparent;
      border-right: 2px SOLID #000000;
      background-color: #ffffff;
      text-align: center;
      font-weight: bold;
      font-style: italic;
      color: #000000;
      font-family: Verdana;
      font-size: 10pt;
      vertical-align: bottom;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;
      ">{{ number_format($target == 0 & $sales == 0 ? 0 : ($sales != 0 && $target == 0 ? 100 : ($sales / $target) * 100) , 2) }}%</td>
                            @endforeach
                        </tr>
                    @endforeach


                    <tr style="height: 35px">
                    <td class="s59" style="
                                width:50px;
      border-bottom: 2px SOLID #000000;
      border-right: 2px SOLID #000000;
      background-color: #ffffff;
      text-align: left;
      font-weight: bold;
      font-style: italic;
      color: #333f4f;
      font-family: Verdana;
      font-size: 12pt;
      vertical-align: middle;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;
      ">Total Sales</td>
                    <td class="s60" style="
                                width:50px;
      border-bottom: 2px SOLID #000000;
      border-right: 2px SOLID #000000;
      background-color: #ffffff;
      text-align: center;
      font-weight: bold;
      font-style: italic;
      color: #000000;
      font-family: Verdana;
      font-size: 12pt;
      vertical-align: middle;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;">{{ number_format($employee->totalSales($year),2) }}</td>
                    @foreach ($months as $month)
                        @php
                            $target = $employee->targetEmp($year,$month);
                            $sales = $employee->salesEmp($year,$month);
                        @endphp
                        <td class="s61" style="
                                width:50px;
      border-bottom: 2px SOLID #000000;
      background-color: #ffffff;
      text-align: center;
      font-weight: bold;
      font-style: italic;
      color: #000000;
      font-family: Verdana;
      font-size: 12pt;
      vertical-align: middle;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;
      ">{{ number_format($target,2) }}</td>
                        <td class="s62" style="
                                width:50px;
      border-bottom: 2px SOLID #000000;
      border-right: 1px SOLID transparent;
      background-color: #ffffff;
      text-align: center;
      font-weight: bold;
      font-style: italic;
      color: #000000;
      font-family: Verdana;
      font-size: 12pt;
      vertical-align: middle;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;
      ">{{ number_format($sales,2) }}</td>
                        <td class="s60" style="
                                width:50px;
      border-bottom: 2px SOLID #000000;
      border-right: 2px SOLID #000000;
      background-color: #ffffff;
      text-align: center;
      font-weight: bold;
      font-style: italic;
      color: #000000;
      font-family: Verdana;
      font-size: 12pt;
      vertical-align: middle;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;
      ">{{ number_format($target == 0 & $sales == 0 ? 0 : ($sales != 0 && $target == 0 ? 100 : ($sales / $target) * 100) , 2) }}%</td>
                    @endforeach
                    </tr>

                </tbody>
            </table>
            <table >
                <tr >
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                    <td style="background-color:#ededed"></td>
                </tr>
            </table>
        @endforeach

        <table>
            <tbody>
                <tr style="height: 19px">
                    <td class="s72" style="
                                width:50px;
      background-color: #ffffff;
      text-align: left;
      font-weight: bold;
      color: #000000;
      font-family: docs-Calibri, Arial;
      font-size: 11pt;
      vertical-align: bottom;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;
      ">REA </td>
                    <td class="s73 softmerge" style="
                                width:50px;
      border-right: none;
      background-color: #ffffff;
      text-align: left;
      color: #000000;
      font-family: docs-Calibri, Arial;
      font-size: 11pt;
      vertical-align: bottom;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;
      ">
                        <div class="softmerge-inner" style="width:281px;left:-1px">Revenue Expected to achieve </div>
                    </td>
                </tr>
                <tr style="height: 19px">
                    <td class="s72" style="
                                width:50px;
      background-color: #ffffff;
      text-align: left;
      font-weight: bold;
      color: #000000;
      font-family: docs-Calibri, Arial;
      font-size: 11pt;
      vertical-align: bottom;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;">AB</td>
                    <td class="s71" style="
                                width:50px;
      background-color: #ffffff;
      text-align: left;
      color: #000000;
      font-family: docs-Calibri, Arial;
      font-size: 11pt;
      vertical-align: bottom;
      white-space: nowrap;
      direction: ltr;
      padding: 0px 3px 0px 3px;">Actual Booked </td>
                </tr>

            </tbody>
        </table>
    </body>
</html>
