@extends('layouts.master')
@section('title')
    {{trans_choice('general.budget',1)}} {{trans_choice('general.report',1)}}
@endsection
@section('content')
    <style type="text/css">
        .style-0 {
            empty-cells: show;
            table-layout: fixed;
            width: 1315pt
        }

        .style-1 {
            color: white;
            padding-left: 10pt;
            font-size: 14pt;
            font-family: "Arial";
            font-weight: bold;
            font-style: normal;
            text-decoration: none;
            text-align: left;
            word-spacing: 0pt;
            letter-spacing: 0pt;

            background-color: #339933
        }

        .style-10 {
            color: black;
            padding-right: 1pt;
            font-size: 8pt;
            font-family: "Arial";
            font-weight: bold;
            font-style: normal;
            text-decoration: none;
            text-align: center;
            word-spacing: 0pt;
            letter-spacing: 0pt;

            background-color: #f2f1f1
        }

        .style-11 {
            border-top: 2pt solid black
        }

        .style-12 {
            color: black;
            padding-right: 1pt;
            font-size: 8pt;
            font-family: "Arial";
            font-weight: bold;
            font-style: normal;
            text-decoration: none;
            text-align: left;
            word-spacing: 0pt;
            letter-spacing: 0pt;

            border-bottom: 2pt solid black
        }

        .style-13 {
            color: black;
            padding-right: 1pt;
            font-size: 8pt;
            font-family: "Arial";
            font-weight: bold;
            font-style: normal;
            text-decoration: none;
            text-align: center;
            word-spacing: 0pt;
            letter-spacing: 0pt;

            border-bottom: 2pt solid black
        }

        .style-14 {
            color: black;
            padding-right: 1pt;
            font-size: 8pt;
            font-family: "Arial";
            font-weight: bold;
            font-style: normal;
            text-decoration: none;
            text-align: center;
            word-spacing: 0pt;
            letter-spacing: 0pt;

            border-bottom: 2pt solid black;
            background-color: #cccccc
        }

        .style-15 {
            color: black;
            padding-right: 1pt;
            font-size: 8pt;
            font-family: "Arial";
            font-weight: bold;
            font-style: normal;
            text-decoration: none;
            text-align: center;
            word-spacing: 0pt;
            letter-spacing: 0pt;

            border-bottom: 2pt solid black;
            background-color: #f2f1f1
        }

        .style-16 {
            color: black;
            padding-right: 1pt;
            font-size: 8pt;
            font-family: "Arial Narrow";
            font-weight: normal;
            font-style: normal;
            text-decoration: none;
            text-align: center;
            word-spacing: 0pt;
            letter-spacing: 0pt;
           
        }

        .style-17 {
            color: black;
            padding-right: 1pt;
            font-size: 8pt;
            font-family: "Arial Narrow";
            font-weight: normal;
            font-style: normal;
            text-decoration: none;
            text-align: right;
            word-spacing: 0pt;
            letter-spacing: 0pt;

            background-color: #cccccc
        }

        .style-18 {
            color: black;
            padding-right: 1pt;
            font-size: 8pt;
            font-family: "Arial Narrow";
            font-weight: normal;
            font-style: normal;
            text-decoration: none;
            text-align: right;
            word-spacing: 0pt;
            letter-spacing: 0pt;

            background-color: #f2f1f1
        }

        .style-19 {
            color: black;
            padding-right: 1pt;
            font-size: 8pt;
            font-family: "Arial";
            font-weight: bold;
            font-style: normal;
            text-decoration: none;
            text-align: left;
            word-spacing: 0pt;
            letter-spacing: 0pt;

            border-top: 2pt solid black
        }

        .style-2 {
            color: black;
            padding-right: 5pt;
            font-size: 8pt;
            font-family: "Arial";
            font-weight: bold;
            font-style: normal;
            text-decoration: none;
            text-align: left;
            word-spacing: 0pt;
            letter-spacing: 0pt;
           
        }

        .style-20 {
            color: black;
            padding-right: 2pt;
            font-size: 8pt;
            font-family: "Arial Narrow";
            font-weight: normal;
            font-style: normal;
            text-decoration: none;
            text-align: right;
            word-spacing: 0pt;
            letter-spacing: 0pt;

            border-top: 2pt solid black
        }

        .style-21 {
            color: black;
            padding-right: 1pt;
            font-size: 8pt;
            font-family: "Arial Narrow";
            font-weight: normal;
            font-style: normal;
            text-decoration: none;
            text-align: right;
            word-spacing: 0pt;
            letter-spacing: 0pt;

            border-top: 2pt solid black;
            background-color: #cccccc
        }

        .style-16 {
            color: black;
            padding-right: 1pt;
            font-size: 8pt;
            font-family: "Arial Narrow";
            font-weight: normal;
            font-style: normal;
            text-decoration: none;
            text-align: center;
            word-spacing: 0pt;
            letter-spacing: 0pt;

            border-top: 2pt solid black;
            border-bottom: 2pt solid black;
            background-color: #f2f1f1
        }

        .style-23 {
            color: black;
            font-size: 10pt;
            font-family: serif;
            font-weight: normal;
            font-style: normal;
            text-decoration: none;
            text-align: left;
            word-spacing: 0pt;
            letter-spacing: 0pt;
           
        }

        .style-24 {
            width: 50px;
            height: 50px
        }

        .style-3 {
            color: #2f2c35;
            padding-right: 5pt;
            font-size: 8pt;
            font-family: "Arial";
            font-weight: bold;
            font-style: normal;
            text-decoration: none;
            text-align: left;
            word-spacing: 0pt;
            letter-spacing: 0pt;
           
        }

        .style-4 {
            color: #2f2c35;
            font-size: 8pt;
            font-family: "Arial Narrow";
            font-weight: normal;
            font-style: normal;
            text-decoration: none;
            text-align: right;
            word-spacing: 0pt;
            letter-spacing: 0pt;
           
        }

        .style-5 {
            color: black;
            padding-right: 2pt;
            font-size: 8pt;
            font-family: "Arial Narrow";
            font-weight: normal;
            font-style: normal;
            text-decoration: none;
            text-align: center;
            word-spacing: 0pt;
            letter-spacing: 0pt;
           
        }

        .style-6 {
            color: black;
            font-size: 8pt;
            font-family: "Arial Narrow";
            font-weight: normal;
            font-style: normal;
            text-decoration: none;
            text-align: right;
            word-spacing: 0pt;
            letter-spacing: 0pt;
           
        }

        .style-7 {
            color: black;
            padding-right: 2pt;
            font-size: 8pt;
            font-family: "Arial Narrow";
            font-weight: normal;
            font-style: normal;
            text-decoration: none;
            text-align: left;
            word-spacing: 0pt;
            letter-spacing: 0pt;
           
        }

        .style-8 {
            color: black;
            padding-right: 1pt;
            font-size: 8pt;
            font-family: "Arial";
            font-weight: bold;
            font-style: normal;
            text-decoration: none;
            text-align: center;
            word-spacing: 0pt;
            letter-spacing: 0pt;

        }

        .style-9 {
            color: black;
            padding-right: 1pt;
            font-size: 8pt;
            font-family: "Arial";
            font-weight: bold;
            font-style: normal;
            text-decoration: none;
            text-align: center;
            word-spacing: 0pt;
            letter-spacing: 0pt;

            background-color: #cccccc
        }

    </style>
    <div class="box box-primary">
        <div class="box-header with-border">
            <h3 class="box-title">
                {{trans_choice('general.budget',1)}} {{trans_choice('general.report',1)}}
                @if(!empty($year))
                    for year: <b> {{$year}}</b>
                @endif
            </h3>

            <div class="box-tools pull-right">

            </div>
        </div>
        <div class="box-body hidden-print">
            <form method="post" action="{{Request::url()}}" class="form-horizontal" enctype="multipart/form-data">
                {{csrf_field()}}
                <div class="form-group">
                    <label for="year"
                           class="control-label col-md-2">{{trans_choice('general.year',1)}}</label>
                    <div class="col-md-3">
                        <input type="text" name="year" class="form-control year-picker"
                               value="{{$year}}"
                               required id="year" data-max="{{date("Y")}}">
                    </div>
                </div>
                <div class="form-group">
                    <label for="office_id"
                           class="control-label col-md-2">{{trans_choice('general.office',1)}}</label>
                    <div class="col-md-3">
                        <select name="office_id" class="form-control select2" id="office_id" required>
                            <option value="0"
                                    @if($office_id=="0") selected @endif>{{trans_choice('general.all',1)}}</option>
                            @foreach(\App\Models\Office::all() as $key)
                                <option value="{{$key->id}}"
                                        @if($office_id==$key->id) selected @endif>{{$key->name}}</option>
                            @endforeach
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label for=""
                           class="control-label col-md-2"></label>
                    <div class="col-md-4">
                        <button type="submit" class="btn btn-success">{{trans_choice('general.search',1)}}!
                        </button>

                        <a href="{{Request::url()}}"
                           class="btn btn-danger">{{trans_choice('general.reset',1)}}!</a>

                        <div class="btn-group">
                            <button type="button" class="btn bg-blue dropdown-toggle legitRipple"
                                    data-toggle="dropdown">{{trans_choice('general.download',1)}} {{trans_choice('general.report',1)}}
                                <span class="caret"></span></button>
                            <ul class="dropdown-menu dropdown-menu-right">
                                <li>
                                    <a href="{{url('expense/budget/report/pdf?year='.$year.'&office_id='.$office_id)}}"
                                       target="_blank"><i
                                                class="icon-file-pdf"></i> {{trans_choice('general.download',1)}} {{trans_choice('general.to',1)}} {{trans_choice('general.pdf',1)}}
                                    </a></li>
                                <li>
                                    <a href="{{url('expense/budget/report/excel?year='.$year.'&office_id='.$office_id)}}"
                                       target="_blank"><i
                                                class="icon-file-excel"></i> {{trans_choice('general.download',1)}} {{trans_choice('general.to',1)}} {{trans_choice('general.excel',1)}}
                                    </a></li>
                                <li>
                                    <a href="{{url('expense/budget/report/csv?year='.$year.'&office_id='.$office_id)}}"
                                       target="_blank"><i
                                                class="icon-download"></i> {{trans_choice('general.download',1)}} {{trans_choice('general.to',1)}} {{trans_choice('general.csv',1)}}
                                    </a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </form>

        </div>

    </div>
    <!-- /.box -->
    @if(!empty($year))
        <div class="box box-primary">
            <div class="panel-body table-responsive ">
                <table cellspacing="0" cellpadding="0" class="style-0">

                    <tbody>
                    <tr style="height: 25pt" class="style-1">
                        <td colspan="29"> {{trans_choice('general.budget',1)}} {{trans_choice('general.report',1)}}</td>
                    </tr>
                    <tr style="height: 13pt">
                        <td colspan="4">{{trans_choice('general.report',1)}} {{trans_choice('general.run',1)}} {{trans_choice('general.date',1)}}
                            :
                        </td>
                        <td colspan="3"> {{date("Y-m-d H:i:s")}}</td>
                        <td colspan="22"></td>
                    </tr>
                    <tr style="height: 23pt">
                        <td colspan="3" valign="middle" class="style-2">{{trans_choice('general.office',1)}} :</td>
                        <td colspan="3" valign="middle" class="style-7">
                            @if($office_id!=0)
                                {{\App\Models\Office::find($office_id)->name}}
                            @endif
                        </td>
                        <td colspan="23"></td>
                    </tr>
                    <tr style="height: 23pt">
                        <td colspan="3" valign="middle" class="style-2">{{trans_choice('general.year',1)}} :</td>
                        <td colspan="3" valign="middle" class="style-7">{{$year}}</td>
                        <td colspan="23"></td>
                    </tr>
                    <tr style="height: 13pt">
                        <td valign="middle" class="style-16">#</td>
                        <td valign="middle" class="style-16" colspan="2">{{trans_choice('general.type',1)}}</td>
                        <td valign="middle" class="style-16" colspan="2">{{trans_choice('general.january',1)}}</td>
                        <td valign="middle" class="style-16" colspan="2">{{trans_choice('general.february',1)}}</td>
                        <td valign="middle" class="style-16" colspan="2">{{trans_choice('general.march',1)}}</td>
                        <td valign="middle" class="style-16" colspan="2">{{trans_choice('general.april',1)}}</td>
                        <td valign="middle" class="style-16" colspan="2">{{trans_choice('general.may',1)}}</td>
                        <td valign="middle" class="style-16" colspan="2">{{trans_choice('general.june',1)}}</td>
                        <td valign="middle" class="style-16" colspan="2">{{trans_choice('general.july',1)}}</td>
                        <td valign="middle" class="style-16" colspan="2">{{trans_choice('general.august',1)}}</td>
                        <td valign="middle" class="style-16" colspan="2">{{trans_choice('general.september',1)}}</td>
                        <td valign="middle" class="style-16" colspan="2">{{trans_choice('general.october',1)}}</td>
                        <td valign="middle" class="style-16" colspan="2">{{trans_choice('general.november',1)}}</td>
                        <td valign="middle" class="style-16" colspan="2">{{trans_choice('general.december',1)}}</td>
                        <td class="style-16">{{trans_choice('general.budget',1)}}</td>
                        <td class="style-16">{{trans_choice('general.expense',2)}}</td>
                    </tr>
                    <tr style="height: 13pt">
                        <td valign="middle" class="style-16" colspan="3"></td>
                        <td class="style-16">{{trans_choice('general.budget',1)}}</td>
                        <td class="style-16">{{trans_choice('general.expense',2)}}</td>
                        <td class="style-16">{{trans_choice('general.budget',1)}}</td>
                        <td class="style-16">{{trans_choice('general.expense',2)}}</td>
                        <td class="style-16">{{trans_choice('general.budget',1)}}</td>
                        <td class="style-16">{{trans_choice('general.expense',2)}}</td>
                        <td class="style-16">{{trans_choice('general.budget',1)}}</td>
                        <td class="style-16">{{trans_choice('general.expense',2)}}</td>
                        <td class="style-16">{{trans_choice('general.budget',1)}}</td>
                        <td class="style-16">{{trans_choice('general.expense',2)}}</td>
                        <td class="style-16">{{trans_choice('general.budget',1)}}</td>
                        <td class="style-16">{{trans_choice('general.expense',2)}}</td>
                        <td class="style-16">{{trans_choice('general.budget',1)}}</td>
                        <td class="style-16">{{trans_choice('general.expense',2)}}</td>
                        <td class="style-16">{{trans_choice('general.budget',1)}}</td>
                        <td class="style-16">{{trans_choice('general.expense',2)}}</td>
                        <td class="style-16">{{trans_choice('general.budget',1)}}</td>
                        <td class="style-16">{{trans_choice('general.expense',2)}}</td>
                        <td class="style-16">{{trans_choice('general.budget',1)}}</td>
                        <td class="style-16">{{trans_choice('general.expense',2)}}</td>
                        <td class="style-16">{{trans_choice('general.budget',1)}}</td>
                        <td class="style-16">{{trans_choice('general.expense',2)}}</td>
                        <td class="style-16">{{trans_choice('general.budget',1)}}</td>
                        <td class="style-16">{{trans_choice('general.expense',2)}}</td>
                        <td valign="middle" class="style-16" colspan="2"></td>
                    </tr>
                    <?php
                    $total_year_budget = 0;
                    $total_year_expenses = 0;
                    $total_jan_budget = 0;
                    $total_jan_expenses = 0;
                    $total_feb_budget = 0;
                    $total_feb_expenses = 0;
                    $total_mar_budget = 0;
                    $total_mar_expenses = 0;
                    $total_apr_budget = 0;
                    $total_apr_expenses = 0;
                    $total_may_budget = 0;
                    $total_may_expenses = 0;
                    $total_jun_budget = 0;
                    $total_jun_expenses = 0;
                    $total_jul_budget = 0;
                    $total_jul_expenses = 0;
                    $total_aug_budget = 0;
                    $total_aug_expenses = 0;
                    $total_sep_budget = 0;
                    $total_sep_expenses = 0;
                    $total_oct_budget = 0;
                    $total_oct_expenses = 0;
                    $total_nov_budget = 0;
                    $total_nov_expenses = 0;
                    $total_dec_budget = 0;
                    $total_dec_expenses = 0;
                    $total_budget = 0;
                    $total_expenses = 0;
                    $count = 0;
                    ?>
                    @foreach($data as $key)
                        <?php
                        $count++;
                        $jan_budget = \App\Models\ExpenseBudget::when($office_id, function ($query) use ($office_id) {
                            if ($office_id != 0) {
                                $query->where('office_id', '=', $office_id);
                            }
                        })->where('year', $year)->where('month', "01")->sum("amount");
                        $jan_expenses = \App\Models\Expense::when($office_id, function ($query) use ($office_id) {
                            if ($office_id != 0) {
                                $query->where('office_id', '=', $office_id);
                            }
                        })->where('year', $year)->where('month', "01")->sum("amount");
                        $total_jan_budget = $total_jan_budget + $jan_budget;
                        $total_jan_expenses = $total_jan_expenses + $jan_expenses;

                        $feb_budget = \App\Models\ExpenseBudget::when($office_id, function ($query) use ($office_id) {
                            if ($office_id != 0) {
                                $query->where('office_id', '=', $office_id);
                            }
                        })->where('year', $year)->where('month', "02")->sum("amount");
                        $feb_expenses = \App\Models\Expense::when($office_id, function ($query) use ($office_id) {
                            if ($office_id != 0) {
                                $query->where('office_id', '=', $office_id);
                            }
                        })->where('year', $year)->where('month', "02")->sum("amount");
                        $total_feb_budget = $total_feb_budget + $feb_budget;
                        $total_feb_expenses = $total_feb_expenses + $feb_expenses;

                        $mar_budget = \App\Models\ExpenseBudget::when($office_id, function ($query) use ($office_id) {
                            if ($office_id != 0) {
                                $query->where('office_id', '=', $office_id);
                            }
                        })->where('year', $year)->where('month', "03")->sum("amount");
                        $mar_expenses = \App\Models\Expense::when($office_id, function ($query) use ($office_id) {
                            if ($office_id != 0) {
                                $query->where('office_id', '=', $office_id);
                            }
                        })->where('year', $year)->where('month', "03")->sum("amount");
                        $total_mar_budget = $total_mar_budget + $mar_budget;
                        $total_mar_expenses = $total_mar_expenses + $mar_expenses;

                        $apr_budget = \App\Models\ExpenseBudget::when($office_id, function ($query) use ($office_id) {
                            if ($office_id != 0) {
                                $query->where('office_id', '=', $office_id);
                            }
                        })->where('year', $year)->where('month', "04")->sum("amount");
                        $apr_expenses = \App\Models\Expense::when($office_id, function ($query) use ($office_id) {
                            if ($office_id != 0) {
                                $query->where('office_id', '=', $office_id);
                            }
                        })->where('year', $year)->where('month', "04")->sum("amount");
                        $total_apr_budget = $total_apr_budget + $apr_budget;
                        $total_apr_expenses = $total_apr_expenses + $apr_expenses;

                        $may_budget = \App\Models\ExpenseBudget::when($office_id, function ($query) use ($office_id) {
                            if ($office_id != 0) {
                                $query->where('office_id', '=', $office_id);
                            }
                        })->where('year', $year)->where('month', "05")->sum("amount");
                        $may_expenses = \App\Models\Expense::when($office_id, function ($query) use ($office_id) {
                            if ($office_id != 0) {
                                $query->where('office_id', '=', $office_id);
                            }
                        })->where('year', $year)->where('month', "05")->sum("amount");
                        $total_may_budget = $total_may_budget + $may_budget;
                        $total_may_expenses = $total_may_expenses + $may_expenses;

                        $jun_budget = \App\Models\ExpenseBudget::when($office_id, function ($query) use ($office_id) {
                            if ($office_id != 0) {
                                $query->where('office_id', '=', $office_id);
                            }
                        })->where('year', $year)->where('month', "06")->sum("amount");
                        $jun_expenses = \App\Models\Expense::when($office_id, function ($query) use ($office_id) {
                            if ($office_id != 0) {
                                $query->where('office_id', '=', $office_id);
                            }
                        })->where('year', $year)->where('month', "06")->sum("amount");
                        $total_jun_budget = $total_jun_budget + $jun_budget;
                        $total_jun_expenses = $total_jun_expenses + $jun_expenses;

                        $jul_budget = \App\Models\ExpenseBudget::when($office_id, function ($query) use ($office_id) {
                            if ($office_id != 0) {
                                $query->where('office_id', '=', $office_id);
                            }
                        })->where('year', $year)->where('month', "07")->sum("amount");
                        $jul_expenses = \App\Models\Expense::when($office_id, function ($query) use ($office_id) {
                            if ($office_id != 0) {
                                $query->where('office_id', '=', $office_id);
                            }
                        })->where('year', $year)->where('month', "07")->sum("amount");
                        $total_jul_budget = $total_jul_budget + $jul_budget;
                        $total_jul_expenses = $total_jul_expenses + $jul_expenses;

                        $aug_budget = \App\Models\ExpenseBudget::when($office_id, function ($query) use ($office_id) {
                            if ($office_id != 0) {
                                $query->where('office_id', '=', $office_id);
                            }
                        })->where('year', $year)->where('month', "08")->sum("amount");
                        $aug_expenses = \App\Models\Expense::when($office_id, function ($query) use ($office_id) {
                            if ($office_id != 0) {
                                $query->where('office_id', '=', $office_id);
                            }
                        })->where('year', $year)->where('month', "08")->sum("amount");
                        $total_aug_budget = $total_aug_budget + $aug_budget;
                        $total_aug_expenses = $total_aug_expenses + $aug_expenses;

                        $sep_budget = \App\Models\ExpenseBudget::when($office_id, function ($query) use ($office_id) {
                            if ($office_id != 0) {
                                $query->where('office_id', '=', $office_id);
                            }
                        })->where('year', $year)->where('month', "09")->sum("amount");
                        $sep_expenses = \App\Models\Expense::when($office_id, function ($query) use ($office_id) {
                            if ($office_id != 0) {
                                $query->where('office_id', '=', $office_id);
                            }
                        })->where('year', $year)->where('month', "09")->sum("amount");
                        $total_sep_budget = $total_sep_budget + $sep_budget;
                        $total_sep_expenses = $total_sep_expenses + $sep_expenses;

                        $oct_budget = \App\Models\ExpenseBudget::when($office_id, function ($query) use ($office_id) {
                            if ($office_id != 0) {
                                $query->where('office_id', '=', $office_id);
                            }
                        })->where('year', $year)->where('month', "10")->sum("amount");
                        $oct_expenses = \App\Models\Expense::when($office_id, function ($query) use ($office_id) {
                            if ($office_id != 0) {
                                $query->where('office_id', '=', $office_id);
                            }
                        })->where('year', $year)->where('month', "10")->sum("amount");
                        $total_oct_budget = $total_oct_budget + $oct_budget;
                        $total_oct_expenses = $total_oct_expenses + $oct_expenses;

                        $nov_budget = \App\Models\ExpenseBudget::when($office_id, function ($query) use ($office_id) {
                            if ($office_id != 0) {
                                $query->where('office_id', '=', $office_id);
                            }
                        })->where('year', $year)->where('month', "11")->sum("amount");
                        $nov_expenses = \App\Models\Expense::when($office_id, function ($query) use ($office_id) {
                            if ($office_id != 0) {
                                $query->where('office_id', '=', $office_id);
                            }
                        })->where('year', $year)->where('month', "11")->sum("amount");
                        $total_nov_budget = $total_nov_budget + $nov_budget;
                        $total_nov_expenses = $total_nov_expenses + $nov_expenses;

                        $dec_budget = \App\Models\ExpenseBudget::when($office_id, function ($query) use ($office_id) {
                            if ($office_id != 0) {
                                $query->where('office_id', '=', $office_id);
                            }
                        })->where('year', $year)->where('month', "12")->sum("amount");
                        $dec_expenses = \App\Models\Expense::when($office_id, function ($query) use ($office_id) {
                            if ($office_id != 0) {
                                $query->where('office_id', '=', $office_id);
                            }
                        })->where('year', $year)->where('month', "12")->sum("amount");
                        $total_dec_budget = $total_dec_budget + $dec_budget;
                        $total_dec_expenses = $total_dec_expenses + $dec_expenses;
                        $total_year_budget = $total_year_budget + $jan_budget + $feb_budget + $mar_budget + $apr_budget + $may_budget + $jun_budget + $jul_budget + $aug_budget + $sep_budget + $oct_budget + $nov_budget + $dec_budget;
                        $total_year_expenses = $total_year_expenses + $jan_expenses + $feb_expenses + $mar_expenses + $apr_expenses + $may_expenses + $jun_expenses + $jul_expenses + $aug_expenses + $sep_expenses + $oct_expenses + $nov_expenses + $dec_expenses;
                        $total_expenses = $total_expenses + $total_year_expenses;
                        $total_budget = $total_budget + $total_year_budget;
                        ?>
                        <tr style="height: 13pt">
                            <td class="style-5">{{$count++}}</td>
                            <td class="style-5" colspan="2">{{$key->name}}</td>
                            <td class="style-5">{{number_format($jan_budget,2)}}</td>
                            <td class="style-5">{{number_format($jan_expenses,2)}}</td>
                            <td class="style-5">{{number_format($feb_budget,2)}}</td>
                            <td class="style-5">{{number_format($feb_expenses,2)}}</td>
                            <td class="style-5">{{number_format($mar_budget,2)}}</td>
                            <td class="style-5">{{number_format($mar_expenses,2)}}</td>
                            <td class="style-5">{{number_format($apr_budget,2)}}</td>
                            <td class="style-5">{{number_format($apr_expenses,2)}}</td>
                            <td class="style-5">{{number_format($may_budget,2)}}</td>
                            <td class="style-5">{{number_format($may_expenses,2)}}</td>
                            <td class="style-5">{{number_format($jun_budget,2)}}</td>
                            <td class="style-5">{{number_format($jun_expenses,2)}}</td>
                            <td class="style-5">{{number_format($jul_budget,2)}}</td>
                            <td class="style-5">{{number_format($jul_expenses,2)}}</td>
                            <td class="style-5">{{number_format($aug_budget,2)}}</td>
                            <td class="style-5">{{number_format($aug_expenses,2)}}</td>
                            <td class="style-5">{{number_format($sep_budget,2)}}</td>
                            <td class="style-5">{{number_format($sep_expenses,2)}}</td>
                            <td class="style-5">{{number_format($oct_budget,2)}}</td>
                            <td class="style-5">{{number_format($oct_expenses,2)}}</td>
                            <td class="style-5">{{number_format($nov_budget,2)}}</td>
                            <td class="style-5">{{number_format($nov_expenses,2)}}</td>
                            <td class="style-5">{{number_format($dec_budget,2)}}</td>
                            <td class="style-5">{{number_format($dec_expenses,2)}}</td>
                            <td class="style-5">{{number_format($total_year_budget,2)}}</td>
                            @if($total_year_expenses>$total_year_budget)
                                <td class="style-5" style="color: red">{{number_format($total_year_expenses,2)}}</td>
                            @else
                                <td class="style-5">{{number_format($total_year_expenses,2)}}</td>
                            @endif

                        </tr>
                    @endforeach
                    <tr style="height: 13pt">
                        <td class="style-16" colspan="3"></td>
                        <td class="style-16">{{number_format($total_jan_budget,2)}}</td>
                        <td class="style-16">{{number_format($total_jan_expenses,2)}}</td>
                        <td class="style-16">{{number_format($total_feb_budget,2)}}</td>
                        <td class="style-16">{{number_format($total_feb_expenses,2)}}</td>
                        <td class="style-16">{{number_format($total_mar_budget,2)}}</td>
                        <td class="style-16">{{number_format($total_mar_expenses,2)}}</td>
                        <td class="style-16">{{number_format($total_apr_budget,2)}}</td>
                        <td class="style-16">{{number_format($total_apr_expenses,2)}}</td>
                        <td class="style-16">{{number_format($total_may_budget,2)}}</td>
                        <td class="style-16">{{number_format($total_may_expenses,2)}}</td>
                        <td class="style-16">{{number_format($total_jun_budget,2)}}</td>
                        <td class="style-16">{{number_format($total_jun_expenses,2)}}</td>
                        <td class="style-16">{{number_format($total_jul_budget,2)}}</td>
                        <td class="style-16">{{number_format($total_jul_expenses,2)}}</td>
                        <td class="style-16">{{number_format($total_aug_budget,2)}}</td>
                        <td class="style-16">{{number_format($total_aug_expenses,2)}}</td>
                        <td class="style-16">{{number_format($total_sep_budget,2)}}</td>
                        <td class="style-16">{{number_format($total_sep_expenses,2)}}</td>
                        <td class="style-16">{{number_format($total_oct_budget,2)}}</td>
                        <td class="style-16">{{number_format($total_oct_expenses,2)}}</td>
                        <td class="style-16">{{number_format($total_nov_budget,2)}}</td>
                        <td class="style-16">{{number_format($total_nov_expenses,2)}}</td>
                        <td class="style-16">{{number_format($total_dec_budget,2)}}</td>
                        <td class="style-16">{{number_format($total_dec_expenses,2)}}</td>
                        <td class="style-16">{{number_format($total_budget,2)}}</td>
                        @if($total_year_expenses>$total_year_budget)
                            <td class="style-16" style="color: red">{{number_format($total_expenses,2)}}</td>
                        @else
                            <td class="style-16">{{number_format($total_expenses,2)}}</td>
                        @endif

                    </tr>
                    </tbody>
                </table>

            </div>
        </div>
        <script>
            $(document).ready(function () {
                $("body").addClass('sidebar-xs sidebar-collapse');
            });
        </script>
    @endif
@endsection
@section('footer-scripts')

@endsection
