mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-11 18:51:31 +00:00
resolved conflicts
This commit is contained in:
+243
@@ -0,0 +1,243 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet"
|
||||
type="text/css" />
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet"
|
||||
type="text/css" />
|
||||
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">{{ __('finance.budgets') }}</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> Home</a></li>
|
||||
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> Finance Home</a></li>
|
||||
<li class="active"><i class="fa fa-file"></i> {{ __('finance.budgets') }}</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- @include('budgets::budgets.menu')
|
||||
@include('flash::message') --}}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="white-box">
|
||||
@php
|
||||
$period_months = getMonthsList();
|
||||
$columns = ['Account', 'Budget Total', 'Actual Total', 'Percentage Variance <br> Actual vs Budget', 'Actual Variance <br> Actual vs Budget'];
|
||||
switch ($budget->period)
|
||||
{
|
||||
case 'months':
|
||||
$period = "Months";
|
||||
$budget_start_date = strtotime($budget->period_start);//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". $budget->period_count - 1 ." month", $budget_start_date));
|
||||
$period_range = date("M-Y", $budget_start_date) . " to " . date("M-Y", strtotime($budget_end_date));
|
||||
$interval = DateInterval::createFromDateString('1 month');
|
||||
$period = new DatePeriod(new DateTime($budget->period_start), $interval, new DateTime(date("Y-m-d",
|
||||
strtotime("+". $budget->period_count ." month", $budget_start_date))));
|
||||
foreach ($period as $dt) $months_data[] = $dt->format("M-Y");
|
||||
$collength = count($columns);
|
||||
|
||||
break;
|
||||
|
||||
case 'quarters':
|
||||
$period = "Quarters";
|
||||
$other_columns =[];$quarter_start_dates =['-01-01', '-04-01', '-07-01', '-10-01']; //m-d
|
||||
$budget_start_date = $budget->period_start;//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". ($budget->period_count-1) * 3 ." month", strtotime('-1 day', strtotime($budget_start_date))));
|
||||
$quarters_data = get_quarters($budget_start_date, $budget_end_date);
|
||||
for($y =0; $y < count($quarters_data); $y++) $other_columns[]=$quarters_data[$y]->period;
|
||||
$period_range = $other_columns[0] . " to " . $other_columns[count($other_columns)-1];
|
||||
$collength = count($columns);
|
||||
|
||||
break;
|
||||
|
||||
case 'years':
|
||||
$period = "Years";
|
||||
$year=date('Y', strtotime($budget->period_start));
|
||||
// $period_range = $budget_start_date . " to " . $budget_end_date;
|
||||
$sec = substr($year, -2);
|
||||
$years_data = [$year.'/'. ++$sec];
|
||||
for ($i = 1; $i <$budget->period_count; $i++) array_push($years_data, $year + $i .'/'. ++$sec);
|
||||
$period_range = $years_data[0] . " to " . $years_data[count($years_data)-1];
|
||||
$collength = count($columns);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@endphp
|
||||
<div class="row">
|
||||
@if(isset($other_budgets))
|
||||
<div class="dropdown col-md-2">
|
||||
<a href="#" class="btn btn-success btn-rounded dropdown-toggle" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Select Previous budget</a>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
{{ Form::open(['method' => 'POST', 'route' => ['budgets.performance','summary'], 'id' =>'budgetPerformance']) }}
|
||||
<input type="hidden" name="budget_id" id="budget_id" />
|
||||
@php
|
||||
foreach($other_budgets as $other_budget){
|
||||
echo '<a class="dropdown-item" onclick="performance_budget(this)" href="#" data-href="'.$other_budget->id.'">'.$other_budget->name.'</a>';
|
||||
}
|
||||
@endphp
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<div class='col-md-6'></div>
|
||||
<div class="col-md-2">
|
||||
<a href="#" onclick="download_table_as_csv('table', '{{ __('budgets.performance') . ': ' . $budget->name }}');"
|
||||
title="Download CSV of budget" class="btn btn-success btn-rounded"><span class="glyphicon glyphicon-download"></span> Download CSV</a>
|
||||
|
||||
</div>
|
||||
{{ Form::open(['method' => 'POST', 'route' => 'budgets.print_reports', 'id' =>'budgetPrint']) }}
|
||||
<input type="hidden" name="budget" id="budget" value='{{ json_encode($budget) }}' />
|
||||
<input type="hidden" name="options" id="options" value='{{ json_encode($options) }}' />
|
||||
<input type="hidden" name="data" id="data" value='{{ json_encode($data) }}' />
|
||||
<input type="hidden" name="type" id="type" value='summary' />
|
||||
<input type="hidden" name="range" id="range" value='{{ $period_range }}' />
|
||||
<div class='col-md-2'>
|
||||
<button title= '{{ __('budgets.performance_detail') . ": print to pdf " }}' type='submit' class='btn btn-rounded btn-success'><span class="glyphicon glyphicon-print"></span> Print Report</button>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-12'>
|
||||
<hr />
|
||||
<div class="row text-center m-t-10">
|
||||
<div class="col-md-12">
|
||||
<p>
|
||||
<h4>{{ __('budgets.performance') . ": " . $budget->name }}</h4>
|
||||
</p>
|
||||
<p>
|
||||
<h4>{{ "Period(" . ucfirst($budget->period) . "): " . $period_range }}</h4>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<table id="table" class="table color-bordered-table success-bordered-table">
|
||||
<thead>
|
||||
<tr style='display:none;'>
|
||||
<td colspan='<?php echo count($columns); ?>'>
|
||||
Budget Name: {{ ucfirst($budget->name) .' - Period('. ucfirst($budget->period) .'): '.$period_range }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@php
|
||||
for ($i = 0; $i < count($columns); $i++) echo '<th>' .$columns[$i].'</th>';
|
||||
$actual_totals = $totals_budgets = $summary_colums = $income_column_totals=[];
|
||||
$expense_column_totals=[];$cost_of_goods_column_totals=[];
|
||||
@endphp
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($options as $option)
|
||||
<tr>
|
||||
<td colspan='<?php echo $collength; ?>'>
|
||||
<h5><strong>{{ $option['section_header'] }}</strong></h5>
|
||||
</td>
|
||||
</tr>
|
||||
@foreach ($option['entries'] as $entry )
|
||||
<tr>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$sum=0;
|
||||
for ($j=0; $j < count($entry['account_entries']); $j++) $sum +=(int)$entry['account_entries'][$j]; $col_percent=($entry['actual_entry']>0)? round(((($entry['actual_entry'] - $sum) / $entry['actual_entry']) * 100),2).'%' : 'N/A';
|
||||
|
||||
if ($i==0) echo '<td>' .$entry['name']. '</td>' ;
|
||||
else if ($i == 1) echo "<td>" . ugandan_shillings($sum) . "</td>" ;//Budget Total
|
||||
else if ($i == 2) echo "<td>" . ugandan_shillings($entry['actual_entry']) . "</td>" ; //Actual Total
|
||||
else if ($i == 3) echo "<td>" . $col_percent . "</td>" ; //Percentage variance
|
||||
else if ($i == 4) echo "<td>" . ugandan_shillings($entry['actual_entry'] - $sum) . "</td>" ; //Actual Variance
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
{{-- Budget Section column Totals --}}
|
||||
<tr class="total">
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$budget_total_section = $columnTotal_section = 0;
|
||||
if ($i==0) echo '<td>' .$option['total_header']. '</td>' ;
|
||||
else if ($i==1){ //Budget totals
|
||||
for($k=0; $k < $budget->period_count; $k++){
|
||||
$columnTotal = 0;
|
||||
for ($m = 0; $m < count($option['entries']); $m++) $columnTotal +=(int)($option['entries'][$m]['account_entries'][$k]);
|
||||
$budget_total_section +=$columnTotal;
|
||||
}
|
||||
array_push($totals_budgets, $budget_total_section);
|
||||
echo "<td>" . ugandan_shillings($budget_total_section) . "</td>" ;
|
||||
} else if ($i==2) {
|
||||
array_push($actual_totals, $option['actual']);
|
||||
echo "<td>" . ugandan_shillings($option['actual']) . "</td>" ; //Actual Total
|
||||
} else if ($i==3) {
|
||||
$percent=($option['actual'] != 0)? round(((($option['actual'] - $totals_budgets[count($totals_budgets) - 1]) / $option['actual'] ) * 100),2) .'%' : 'N/A';
|
||||
echo "<td>" . $percent . "</td>" ; //Percentage variance
|
||||
}
|
||||
else if ($i == 4) echo "<td>" .ugandan_shillings($option['actual'] - $totals_budgets[count($totals_budgets) - 1]). "</td>" ; //Actual Variance
|
||||
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
{{-- Overall Budget Performance --}}
|
||||
<tr class="total">
|
||||
@php
|
||||
$overall_projection = $totals_budgets[0] - $totals_budgets[1] - $totals_budgets[2];
|
||||
array_push($summary_colums, $overall_projection);
|
||||
$total_actual = $data['accrual_net_income'] + $data['cash_net_income'];
|
||||
array_push($summary_colums, $total_actual);
|
||||
$overall_percentage = ($summary_colums[1] != 0)? round(((($summary_colums[1] - $summary_colums[0]) / $summary_colums[1]) * 100),2) .'%' : 'N/A';
|
||||
@endphp
|
||||
<td>Performance</td>
|
||||
<td> {{ ugandan_shillings($overall_projection) }} </td> {{-- Budget Projection --}}
|
||||
<td> {{ ugandan_shillings($total_actual) }} </td> {{-- Actual Total --}}
|
||||
<td> {{ $overall_percentage }} </td> {{-- Percentage variance --}}
|
||||
<td> {{ ugandan_shillings($summary_colums[1] - $summary_colums[0]) }} </td> {{-- Actual Variance --}}
|
||||
</tr>
|
||||
|
||||
|
||||
<tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
@php
|
||||
for ($i = 0; $i < count($columns); $i++) echo '<th>' .$columns[$i].'</th>';
|
||||
@endphp
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
{{-- </div> --}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
|
||||
<script src="{{ asset('js/streamline_functions.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
function performance_budget(data) {
|
||||
var cell = data.getAttribute('data-href');
|
||||
$('#budget_id').val(cell);
|
||||
$("#budgetPerformance").submit();
|
||||
}
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
+284
@@ -0,0 +1,284 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet"
|
||||
type="text/css" />
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet"
|
||||
type="text/css" />
|
||||
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<style type="text/css">
|
||||
td {
|
||||
min-width: 140px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">{{ __('finance.budgets') }}</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> Home</a></li>
|
||||
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> Finance Home</a></li>
|
||||
<li class="active"><i class="fa fa-file"></i> {{ __('finance.budgets') }}</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- @include('budgets::budgets.menu')
|
||||
@include('flash::message') --}}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="white-box">
|
||||
@php
|
||||
$period_months = getMonthsList();
|
||||
$column_1 = ['Account'];
|
||||
$colum_2 = ['Budget Total', 'Actual Total', 'Percentage Variance <br> (Actual vs Budget)', 'Actual Variance <br> (Actual vs Budget)'];
|
||||
switch ($budget->period)
|
||||
{
|
||||
case 'months':
|
||||
$period = "Months";
|
||||
$budget_start_date = strtotime($budget->period_start);//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". $budget->period_count - 1 ." month", $budget_start_date));
|
||||
$period_range = date("M-Y", $budget_start_date) . " to " . date("M-Y", strtotime($budget_end_date));
|
||||
$interval = DateInterval::createFromDateString('1 month');
|
||||
$period = new DatePeriod(new DateTime($budget->period_start), $interval, new DateTime(date("Y-m-d",
|
||||
strtotime("+". $budget->period_count ." month", $budget_start_date))));
|
||||
foreach ($period as $dt) $months_data[] = $dt->format("M-Y");
|
||||
$columns = array_merge($column_1, $months_data);
|
||||
$counter = count($columns);
|
||||
$columns = array_merge($columns, $colum_2);
|
||||
$collength = count($columns);
|
||||
|
||||
break;
|
||||
|
||||
case 'quarters':
|
||||
$period = "Quarters";
|
||||
$other_columns =[];$quarter_start_dates =['-01-01', '-04-01', '-07-01', '-10-01']; //m-d
|
||||
$budget_start_date = $budget->period_start;//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". ($budget->period_count-1) * 3 ." month", strtotime('-1 day', strtotime($budget_start_date))));
|
||||
$quarters_data = get_quarters($budget_start_date, $budget_end_date);
|
||||
for($y =0; $y < count($quarters_data); $y++) $other_columns[]=$quarters_data[$y]->period;
|
||||
$period_range = $other_columns[0] . " to " . $other_columns[count($other_columns)-1];
|
||||
$columns = array_merge($column_1, $other_columns);
|
||||
$counter = count($columns);
|
||||
$columns = array_merge($columns, $colum_2);
|
||||
$collength = count($columns);
|
||||
|
||||
break;
|
||||
|
||||
case 'years':
|
||||
$period = "Years";
|
||||
$year=date('Y', strtotime($budget->period_start));
|
||||
// $period_range = $budget_start_date . " to " . $budget_end_date;
|
||||
$sec = substr($year, -2);
|
||||
$years_data = [$year.'/'. ++$sec];
|
||||
for ($i = 1; $i <$budget->period_count; $i++) array_push($years_data, $year + $i .'/'. ++$sec);
|
||||
$period_range = $years_data[0] . " to " . $years_data[count($years_data)-1];
|
||||
$columns = array_merge($column_1, $years_data);
|
||||
$counter = count($columns);
|
||||
$columns = array_merge($columns, $colum_2);
|
||||
$collength = count($columns);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@endphp
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<a href="#" onclick="download_table_as_csv('table', '{{ __('budgets.performance_detail') . ': ' . $budget->name }}');"
|
||||
title="Download CSV of budget" class="btn btn-success btn-rounded"><span
|
||||
class="glyphicon glyphicon-download"></span> Download CSV</a>
|
||||
</div>
|
||||
{{ Form::open(['method' => 'POST', 'route' => 'budgets.print_reports', 'id' =>'budgetPrint']) }}
|
||||
<input type="hidden" name="budget" id="budget" value='{{ json_encode($budget, true) }}' />
|
||||
<input type="hidden" name="options" id="options" value='{{ json_encode($options, true) }}' />
|
||||
<input type="hidden" name="data" id="data" value='{{ json_encode($data, true) }}' />
|
||||
<input type="hidden" name="range" id="range" value='{{ $period_range }}' />
|
||||
<input type="hidden" name="type" id="type" value='detail' />
|
||||
<div class='col-md-2'>
|
||||
<button title= '{{ __('budgets.performance_detail') . ": print to pdf " }}' type='submit' class='btn btn-rounded btn-success'><span class="glyphicon glyphicon-print"></span> Print Report</button>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
@if(isset($other_budgets))
|
||||
<div class="dropdown col-md-2">
|
||||
<a href="#" class="btn btn-success btn-rounded dropdown-toggle" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Select Previous budget</a>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
{{ Form::open(['method' => 'POST', 'route' => ['budgets.performance','detail'], 'id' =>'budgetPerformance']) }}
|
||||
<input type="hidden" name="budget_id" id="budget_id" />
|
||||
@php
|
||||
foreach($other_budgets as $other_budget){
|
||||
echo '<a class="dropdown-item" onclick="performance_budget(this)" href="#" data-href="'.$other_budget->id.'">'.$other_budget->name.'</a>';
|
||||
}
|
||||
@endphp
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<div class='col-md-6'></div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-12'>
|
||||
<hr />
|
||||
<div class="row text-center m-t-10">
|
||||
<div class="col-md-12">
|
||||
<p>
|
||||
<h4>{{ __('budgets.performance_detail') . ": " . $budget->name }}</h4>
|
||||
</p>
|
||||
<p>
|
||||
<h4>{{ "Period(" .ucfirst($budget->period) . "): " . $period_range }}</h4>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<table id="table" class="table color-bordered-table table-responsive success-bordered-table">
|
||||
<thead>
|
||||
<tr style='display:none;'>
|
||||
<td colspan='<?php echo count($columns); ?>'>
|
||||
Budget Name: {{ ucfirst($budget->name) .' - Period('. ucfirst($budget->period) .'): '.$period_range }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@php
|
||||
for ($i = 0; $i < count($columns); $i++) echo '<th>' .$columns[$i].'</th>';
|
||||
$actual_totals = $totals_budgets = $summary_colums = $income_column_totals=[];
|
||||
$expense_column_totals = $cost_of_goods_column_totals=[];
|
||||
@endphp
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($options as $option)
|
||||
<tr>
|
||||
<td colspan='<?php echo $collength; ?>'>
|
||||
<h5><strong>{{ $option['section_header'] }}</strong></h5>
|
||||
</td>
|
||||
</tr>
|
||||
@foreach ($option['entries'] as $entry)
|
||||
<tr>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$sum=0;
|
||||
for ($j=0; $j < count($entry['account_entries']); $j++) $sum +=(int)$entry['account_entries'][$j]; $col_percent=($entry['actual_entry']>0)? round(((($entry['actual_entry'] - $sum) / $entry['actual_entry']) * 100),2).'%' : 'N/A';
|
||||
|
||||
if ($i==0) echo '<td>' .$entry['name']. '</td>' ;
|
||||
else if ($i === $counter) echo "<td>" . ugandan_shillings($sum) . "</td>" ;//Budget Total
|
||||
else if ($i == $counter + 1) echo "<td>" . ugandan_shillings($entry['actual_entry']) . "</td>" ; //Actual Total
|
||||
else if ($i == $counter + 2) echo "<td>" . $col_percent . "</td>" ; //Percentage variance
|
||||
else if ($i == $counter + 3) echo "<td>" . ugandan_shillings($entry['actual_entry'] - $sum) . "</td>" ; //Actual Variance
|
||||
else {
|
||||
echo "<td>" .ugandan_shillings($entry['account_entries'][$i - 1]). "</td>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
{{-- Budget Section column Totals --}}
|
||||
<tr class="total">
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$budget_total_section = $columnTotal_section = 0;
|
||||
if ($i==0) echo '<td>' .$option['total_header']. '</td>' ;
|
||||
else if ($i == $counter){ //Budget totals
|
||||
for($k=0; $k < $budget->period_count; $k++){
|
||||
$columnTotal = 0;
|
||||
for ($m = 0; $m < count($option['entries']); $m++) $columnTotal +=(int)($option['entries'][$m]['account_entries'][$k]);
|
||||
$budget_total_section +=$columnTotal;
|
||||
}
|
||||
array_push($totals_budgets, $budget_total_section);
|
||||
echo "<td>" . ugandan_shillings($budget_total_section) . "</td>" ;
|
||||
} else if ($i == $counter + 1) {
|
||||
array_push($actual_totals, $option['actual']);
|
||||
echo "<td>" . ugandan_shillings($option['actual']) . "</td>" ; //Actual Total
|
||||
} else if ($i== $counter+2) {
|
||||
$percent=($option['actual']> 0)? round(((($option['actual'] - $totals_budgets[count($totals_budgets) - 1]) / $option['actual'] ) * 100),2) .'%' : 'N/A';
|
||||
echo "<td>" . $percent . "</td>" ; //Percentage variance
|
||||
}
|
||||
else if ($i == $counter+3) echo "<td>" .ugandan_shillings($option['actual'] - $totals_budgets[count($totals_budgets) - 1]). "</td>" ; //Actual Variance
|
||||
else {
|
||||
for ($b=0; $b < count($option['entries']); $b++) {
|
||||
$columnTotal_section +=(int)($option['entries'][$b]['account_entries'][$i - 1]);
|
||||
}
|
||||
//Push to column total arrays
|
||||
if($entry['type'] == 'Income') array_push($income_column_totals, $columnTotal_section);
|
||||
else if($entry['type'] == 'Expense') array_push($expense_column_totals, $columnTotal_section);
|
||||
else array_push($cost_of_goods_column_totals, $columnTotal_section);
|
||||
|
||||
echo "<td>" .ugandan_shillings($columnTotal_section). "</td>" ;
|
||||
}
|
||||
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
{{-- Overall Budget Performance --}}
|
||||
|
||||
<tr class="total">
|
||||
@php
|
||||
$overall_projection = $totals_budgets[0] - $totals_budgets[1] - $totals_budgets[2];
|
||||
array_push($summary_colums, $overall_projection);
|
||||
$total_actual = $data['accrual_net_income'] + $data['cash_net_income'];
|
||||
array_push($summary_colums, $total_actual);
|
||||
$overall_percentage = ($summary_colums[1] > 0)? round(((($summary_colums[1] - $summary_colums[0]) / $summary_colums[1]) * 100),2) .'%' : 'N/A';
|
||||
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
if ($i==0) echo '<td>Summary</td>' ;
|
||||
else if ($i == $counter){ //Budget Totals
|
||||
echo "<td>" . ugandan_shillings($overall_projection) . "</td>" ;
|
||||
} else if ($i == $counter + 1) {
|
||||
echo "<td>" . ugandan_shillings($total_actual) . "</td>" ;
|
||||
} else if ($i == $counter + 2) {
|
||||
echo "<td>" . $overall_percentage . "</td>" ;
|
||||
} else if ($i == $counter + 3) {
|
||||
echo "<td>" . ugandan_shillings($summary_colums[1] - $summary_colums[0]) . "</td>" ;
|
||||
} else {
|
||||
$columnTotal_projection=$income_column_totals[$i-1] - $expense_column_totals[$i-1] - $cost_of_goods_column_totals[$i-1];
|
||||
echo "<td>".ugandan_shillings($columnTotal_projection). "</td>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
|
||||
<tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
@php
|
||||
for ($i = 0; $i < count($columns); $i++) echo '<th>' .$columns[$i].'</th>';
|
||||
@endphp
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
{{-- </div> --}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
|
||||
<script src="{{ asset('js/streamline_functions.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
function performance_budget(data) {
|
||||
var cell = data.getAttribute('data-href');
|
||||
$('#budget_id').val(cell);
|
||||
$("#budgetPerformance").submit();
|
||||
}
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
File diff suppressed because it is too large
Load Diff
+1000
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,243 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet"
|
||||
type="text/css" />
|
||||
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">{{ __('finance.budgets') }}</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> Home</a></li>
|
||||
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> Finance Home</a></li>
|
||||
<li><a href="{{ route('budgets.index') }}"><i class="fa fa-book"></i> {{ __('budgets.budgets') }}</a></li>
|
||||
<li class="active"><i class="fa fa-undo"></i> Inactive Budgets </li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- @include('budgets::budgets.menu') --}}
|
||||
|
||||
<div class="white-box">
|
||||
{{ Form::open(['route' => 'budgets.search']) }}
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
{{ Form::label('created_by', "Staff member") }}
|
||||
{{ Form::select('created_by', $created_by, null, ['class' => 'form-control compulsory','required']) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
{{ Form::label('date_range', "Select the date") }}
|
||||
<div class="input-group">
|
||||
<select class="form-control compulsory required" id="dates" name="dates" required>
|
||||
<option value="ALL">ALL DATES</option>
|
||||
<option value="today">TODAY</option>
|
||||
<option value="yesterday">YESTERDAY</option>
|
||||
<option value="week">LAST 7 DAYS</option>
|
||||
<option value="month">LAST 30 DAYS</option>
|
||||
<option value="custom-date">CUSTOM DAY</option>
|
||||
<option value="custom-range">DATE RANGE</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3" style="display: none;" id="start-date-div">
|
||||
<div class="form-group">
|
||||
{{ Form::label('start_date', "Date From") }}
|
||||
<div class="input-group">
|
||||
{{ Form::text('start_date','',['class' => 'form-control compulsory',
|
||||
'required','readonly','id'=>'datepicker-from']) }}
|
||||
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3" style="display: none;" id="end-date-div">
|
||||
<div class="form-group">
|
||||
{{ Form::label('end_date', "Date To") }}
|
||||
<div class="input-group">
|
||||
{{ Form::text('end_date','',['class' => 'form-control compulsory',
|
||||
'required','readonly','id'=>'datepicker-to']) }}
|
||||
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-11"></div>
|
||||
<div class="col-md-1">
|
||||
{{ Form::button("Search", ['type'=>'submit','style'=>"border-radius: 5px;", 'class'=>'btn btn-success
|
||||
waves-effect waves-light m-r-10'])
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
@include('flash::message')
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="white-box">
|
||||
{{-- <p class="text-muted m-b-30">{{ __('finance.export_data_to_copy_csv_pdf_print') }}</p> --}}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Budget Breakdown</th>
|
||||
<th>Period</th>
|
||||
<th>Created By</th>
|
||||
<th>Date & Time Created</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@if(count($budgets) > 0)
|
||||
@foreach($budgets as $budget)
|
||||
@php
|
||||
$period = "N/A";
|
||||
$period_count = $budget->period_count;
|
||||
$period_start = $budget->period_start;
|
||||
$period_range = "N/A";
|
||||
|
||||
switch ($budget->period) {
|
||||
case 'months':
|
||||
$period = "Months";
|
||||
|
||||
$period_months = getMonthsList();
|
||||
if (isset($period_months[$period_start]) && isset($period_months[$period_start +
|
||||
$period_count])) {
|
||||
$period_range = $period_months[$period_start] . " - " . $period_months[$period_start +
|
||||
$period_count];
|
||||
}
|
||||
break;
|
||||
|
||||
case 'quarters':
|
||||
$period = "Quarters";
|
||||
|
||||
$period_quarters = array("First", "Second", "Third", "Fourth");
|
||||
if (isset($period_quarters[$period_start]) && isset($period_quarters[$period_start +
|
||||
$period_count])) {
|
||||
$period_range = $period_quarters[$period_start] . " - " . $period_quarters[$period_start +
|
||||
$period_count];
|
||||
}
|
||||
break;
|
||||
|
||||
case 'years':
|
||||
$period = "Years";
|
||||
|
||||
if (is_numeric($period_start)) {
|
||||
$period_range = $period_start . " - " . ($period_start + $period_count);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@endphp
|
||||
<tr>
|
||||
<td>{{ $budget->name }}</td>
|
||||
<td>{{ ucfirst($budget->period) }}</td>
|
||||
<td>{{ $period_range }}</td>
|
||||
<td>{{ get_full_name($budget->created_by, 'id', 'first_name', 'last_name', 'users') }}
|
||||
</td>
|
||||
<td>{{ streamline_date_time_short($budget->created_at) }}</td>
|
||||
|
||||
<td>
|
||||
@if( Auth::user()->can('budget-delete'))
|
||||
{{ Form::model($budget->id ,['method' => 'POST', 'route' => ['budgets.activate',
|
||||
$budget->id]]) }}
|
||||
<button type="submit" class="btn btn-sm btn-warning btn-rounded"
|
||||
onclick="return confirm('Are you sure you want to activate this budget?')"><i
|
||||
class="fa fa-check"></i> {{ __('budgets.activate') }}</button>
|
||||
{{ Form::close() }}
|
||||
@endif
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
</tbody>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Budget Breakdown</th>
|
||||
<th>Period</th>
|
||||
<th>Created By</th>
|
||||
<th>Date & Time Created</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
|
||||
|
||||
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
$('.table').DataTable({
|
||||
responsive: true,
|
||||
order: []
|
||||
});
|
||||
|
||||
function show(id) {
|
||||
if (document.getElementById(id).style.display === 'none') {
|
||||
document.getElementById(id).style.display = '';
|
||||
}
|
||||
}
|
||||
|
||||
function hide(id) {
|
||||
document.getElementById(id).style.display = 'none';
|
||||
}
|
||||
</script>
|
||||
|
||||
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('#datepicker-from, #datepicker-to').datepicker({
|
||||
autoclose: true,
|
||||
todayHighlight: true,
|
||||
format: 'dd-mm-yyyy',
|
||||
});
|
||||
|
||||
$('#dates').change(function() {
|
||||
var val = $(this).val();
|
||||
switch (val) {
|
||||
case 'custom-date':
|
||||
$('#end-date-div').hide();
|
||||
$('#start-date-div').show();
|
||||
break;
|
||||
case 'custom-range':
|
||||
$('#end-date-div').show();
|
||||
$('#start-date-div').show();
|
||||
break;
|
||||
default:
|
||||
$('#end-date-div').hide();
|
||||
$('#start-date-div').hide();
|
||||
break;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,309 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet"
|
||||
type="text/css" />
|
||||
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">{{ __('finance.budgets') }}</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> Home</a></li>
|
||||
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> Finance Home</a></li>
|
||||
<li class="active"><i class="fa fa-file"></i> {{ __('finance.budgets') }}</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('budgets::budgets.menu')
|
||||
|
||||
<div class="white-box">
|
||||
{{ Form::open(['route' => 'budgets.search']) }}
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
{{ Form::label('created_by', "Staff member") }}
|
||||
{{ Form::select('created_by', $created_by, null, ['class' => 'form-control compulsory','required']) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
{{ Form::label('date_range', "Select the date") }}
|
||||
<div class="input-group">
|
||||
<select class="form-control compulsory required" id="dates" name="dates" required>
|
||||
<option value="ALL">ALL DATES</option>
|
||||
<option value="today">TODAY</option>
|
||||
<option value="yesterday">YESTERDAY</option>
|
||||
<option value="week">LAST 7 DAYS</option>
|
||||
<option value="month">LAST 30 DAYS</option>
|
||||
<option value="custom-date">CUSTOM DAY</option>
|
||||
<option value="custom-range">DATE RANGE</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
{{ Form::label('active_state', "Select Active/Inactive Budgets") }}
|
||||
<div class="input-group">
|
||||
<select class="form-control" id="active_state" name="active_state">
|
||||
<option value="active">ACTIVE</option>
|
||||
<option value="inactive">INACTIVE</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6"></div>
|
||||
<div class="col-md-3" style="display: none;" id="start-date-div">
|
||||
<div class="form-group">
|
||||
{{ Form::label('start_date', "Date From") }}
|
||||
<div class="input-group">
|
||||
{{ Form::text('start_date','',['class' => 'form-control compulsory',
|
||||
'required','readonly','id'=>'datepicker-from']) }}
|
||||
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3" style="display: none;" id="end-date-div">
|
||||
<div class="form-group">
|
||||
{{ Form::label('end_date', "Date To") }}
|
||||
<div class="input-group">
|
||||
{{ Form::text('end_date','',['class' => 'form-control compulsory',
|
||||
'required','readonly','id'=>'datepicker-to']) }}
|
||||
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-11"></div>
|
||||
<div class="col-md-1">
|
||||
{{ Form::hidden('query_active', 'active') }}
|
||||
{{ Form::button("Search", ['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
|
||||
</div>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
|
||||
@include('flash::message')
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="white-box">
|
||||
<p class="text-muted m-b-30">{{ __('finance.export_data_to_copy_csv_pdf_print') }}</p>
|
||||
{{-- <div class="table-responsive"> --}}
|
||||
<table class="table table-striped table-responsive">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Budget Breakdown</th>
|
||||
<th>Period</th>
|
||||
<th>Income</th>
|
||||
<th>Cost of Goods</th>
|
||||
<th>Expense</th>
|
||||
<th>Projected Net Income</th>
|
||||
<th>Created By</th>
|
||||
<th>Date Created</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@if(!empty($budgets))
|
||||
@foreach($budgets as $budget)
|
||||
@php
|
||||
$period = "N/A";
|
||||
$period_count = $budget->period_count;
|
||||
$period_start = $budget->period_start;
|
||||
$period_range = "N/A";
|
||||
|
||||
$arr3 = json_decode($budget->entries, true);
|
||||
$income =[]; $expense=[]; $cost_of_goods =[];
|
||||
$income_total=0;$expense_total=0;$cost_of_goods_total = 0;
|
||||
foreach ($arr3 as $rkey => $resource){
|
||||
if ($resource['type'] == 'Income') $income[] = $resource;
|
||||
else if ($resource['type'] == 'Cost Of Goods') $cost_of_goods[] = $resource;
|
||||
else $expense[] = $resource;
|
||||
}
|
||||
if(!empty($income)) {
|
||||
for($counter =0; $counter < count($income); $counter++ ) if(!empty($income[$counter]['account_entries'])) $income_total +=array_sum($income[$counter]['account_entries']);
|
||||
}
|
||||
if(!empty($expense)) {
|
||||
for($counter =0; $counter < count($expense); $counter++ ) if(!empty($expense[$counter]['account_entries'])) $expense_total +=array_sum($expense[$counter]['account_entries']);
|
||||
}
|
||||
if(!empty($cost_of_goods)) {
|
||||
for($counter =0; $counter < count($cost_of_goods); $counter++ ) if(!empty($cost_of_goods[$counter]['account_entries'])) $cost_of_goods_total +=array_sum($cost_of_goods[$counter]['account_entries']);
|
||||
}
|
||||
$projection_total = $income_total - $expense_total - $cost_of_goods_total;
|
||||
|
||||
switch ($budget->period) {
|
||||
case 'months':
|
||||
$period = "Months";
|
||||
|
||||
$period_months = getMonthsList();
|
||||
$budget_start_date = strtotime($budget->period_start);//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". $budget->period_count - 1 ." month", $budget_start_date));
|
||||
$period_range = date("M-Y", $budget_start_date) . " to " . date("M-Y", strtotime($budget_end_date));
|
||||
|
||||
break;
|
||||
|
||||
case 'quarters':
|
||||
$period = "Quarters";
|
||||
$other_columns =[];$quarter_start_dates =['-01-01', '-04-01', '-07-01', '-10-01']; //m-d
|
||||
$budget_start_date = $budget->period_start;//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". ($budget->period_count-1) * 3 ." month", strtotime('-1 day', strtotime($budget_start_date))));
|
||||
$quarters_data = get_quarters($budget_start_date, $budget_end_date);
|
||||
for($y =0; $y < count($quarters_data); $y++) $other_columns[] = $quarters_data[$y]->period;
|
||||
$period_range = $other_columns[0] . " to " . $other_columns[count($other_columns)-1];
|
||||
break;
|
||||
|
||||
case 'years':
|
||||
$period = "Years";
|
||||
$year=date('Y', strtotime($budget->period_start));
|
||||
$sec = substr($year, -2);
|
||||
$years_data = [$year.'/'. ++$sec];
|
||||
for ($i = 1; $i <$budget->period_count; $i++) array_push($years_data, $year + $i .'/'. ++$sec);
|
||||
$period_range = $years_data[0] . " to " . $years_data[count($years_data)-1];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@endphp
|
||||
<tr>
|
||||
<td>{{ $budget->name }}</td>
|
||||
<td>{{ $period }}</td>
|
||||
<td>{{ $period_range }}</td>
|
||||
<td>{{ ugandan_shillings($income_total) }}</td>
|
||||
<td>{{ ugandan_shillings($cost_of_goods_total) }}</td>
|
||||
<td>{{ ugandan_shillings($expense_total) }}</td>
|
||||
<td>{{ ugandan_shillings($projection_total) }}</td>
|
||||
{{-- <td>{{ get_full_name($budget->created_by, 'id', 'first_name', 'last_name', 'users') }}</td> --}}
|
||||
<td>{{ $budget->user_by }}</td>
|
||||
<td>{{ streamline_date_time_short($budget->created_at) }}</td>
|
||||
|
||||
<td>
|
||||
@if( Auth::user()->can('budget-view'))
|
||||
<a class="btn btn-sm btn-rounded btn-info"
|
||||
href="{{ route('budgets.show',$budget->id) }}"><i class="fa fa-info-circle"></i> {{
|
||||
__('budgets.view') }}</a>
|
||||
@endif
|
||||
|
||||
@if( Auth::user()->can('budget-edit'))
|
||||
<a class="btn btn-sm btn-warning btn-rounded"
|
||||
href="{{ route('budgets.edit',$budget->id) }}"><i class="fa fa-pencil"></i> {{
|
||||
__('budgets.edit') }}</a>
|
||||
@endif
|
||||
|
||||
@if( Auth::user()->can('budget-delete'))
|
||||
{{ Form::model($budget->id ,['method' => 'DELETE', 'route' => ['budgets.destroy',
|
||||
$budget->id], 'style'=>'display:inline']) }}
|
||||
<button type="submit" class="btn btn-sm btn-rounded btn-danger"
|
||||
onclick="return confirm('<?php echo __('budgets.are_you_sure') ?>')"><i
|
||||
class="fa fa-trash"></i> {{ __('budgets.delete') }}</button>
|
||||
{{ Form::close() }}
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
</tbody>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Budget Breakdown</th>
|
||||
<th>Period</th>
|
||||
<th>Income</th>
|
||||
<th>Cost of Goods</th>
|
||||
<th>Expense</th>
|
||||
<th>Projected Net Income</th>
|
||||
<th>Created By</th>
|
||||
<th>Date Created</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
{{-- </div> --}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
|
||||
|
||||
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
|
||||
{{-- <script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script> --}}
|
||||
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
$('.table').DataTable({
|
||||
responsive: true,
|
||||
dom: 'Bfrtip',
|
||||
buttons: [
|
||||
'copy', 'csv', 'excel', 'pdf', 'print'
|
||||
],
|
||||
pageLength: 5,
|
||||
order: [],
|
||||
});
|
||||
|
||||
function show(id) {
|
||||
if (document.getElementById(id).style.display === 'none') {
|
||||
document.getElementById(id).style.display = '';
|
||||
}
|
||||
}
|
||||
|
||||
function hide(id) {
|
||||
document.getElementById(id).style.display = 'none';
|
||||
}
|
||||
</script>
|
||||
|
||||
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('#datepicker-from, #datepicker-to').datepicker({
|
||||
autoclose: true,
|
||||
todayHighlight: true,
|
||||
format: 'dd-mm-yyyy',
|
||||
});
|
||||
|
||||
$('#dates').change(function() {
|
||||
var val = $(this).val();
|
||||
switch (val) {
|
||||
case 'custom-date':
|
||||
$('#end-date-div').hide();
|
||||
$('#start-date-div').show();
|
||||
break;
|
||||
case 'custom-range':
|
||||
$('#end-date-div').show();
|
||||
$('#start-date-div').show();
|
||||
break;
|
||||
default:
|
||||
$('#end-date-div').hide();
|
||||
$('#start-date-div').hide();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
function clone_budget(data) {
|
||||
var cell = data.getAttribute('data-href').split("_");
|
||||
if (confirm(`Are you sure you want to clone ${cell[1]}?`) == true)
|
||||
window.location.href = cell[2];
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,25 @@
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
@if( Auth::user()->can('budget-list'))
|
||||
<a href="{{ route('budgets.index') }}" class="nav-item btn btn-info" style="border-radius: 5px;"><i class="fa fa-eye" aria-hidden="true"></i> <span style="margin-left: 5px">{{ __('budgets.view_budgets') }}</span></a>
|
||||
@endif
|
||||
@if( Auth::user()->can('budget-create') )
|
||||
<a href="{{ route('budgets.create') }}" class="nav-item btn btn-success" title='Create new Budget' style="border-radius: 5px;"><i class="fa fa-plus" aria-hidden="true"></i> <span style="margin-left: 5px">{{ __('budgets.add_new_budget') }}</span></a>
|
||||
@if(isset($budgets))
|
||||
<div class="dropdown" style="display: inline-block !important;" title='Create from Previous Budgets'>
|
||||
<a href="#" class="btn btn-success dropdown-toggle" id="dropdownMenuButton" style="border-radius: 5px;" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span style="margin-left: 5px">Clone Previous budget</span></a>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
@php
|
||||
foreach($budgets as $budget){
|
||||
echo '<a class="dropdown-item" onclick="clone_budget(this)" href="#" data-href="'.$budget->id.'_'.$budget->name.'_'.route('budgets.clone',$budget->id).'">'.$budget->name.'</a>';
|
||||
}
|
||||
@endphp
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
@if( Auth::user()->can('budget-delete'))
|
||||
<a href="{{ route('budgets.inactive') }}" class="nav-item btn btn-danger" title='Deleted Budgets' style="border-radius: 5px;"><i class="fa fa-undo" aria-hidden="true"></i> <span style="margin-left: 5px">{{ __('budgets.view_inactive_budgets') }}</span></a>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,314 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ app()->getLocale() }}">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
<!-- CSRF Token -->
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
|
||||
<link rel="icon" type="image/png" sizes="16x16"
|
||||
href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
|
||||
<title>{{ config('app.name', 'Streamline') }}</title>
|
||||
<!-- Bootstrap Core CSS -->
|
||||
<link href="{{ asset('elite/bootstrap/dist/css/bootstrap.min.css') }}" rel="stylesheet">
|
||||
<!-- Custom CSS -->
|
||||
<link href="{{ asset('elite/css/style.css') }}" rel="stylesheet">
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
tr {
|
||||
page-break-before: always;
|
||||
page-break-after: always;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Preloader -->
|
||||
<div class="preloader">
|
||||
<div class="cssload-speeding-wheel"></div>
|
||||
</div>
|
||||
<div class="white-box">
|
||||
<div class='col-md-12'>
|
||||
@php
|
||||
$second_col = "Account"; $end_col = "Budget Total";
|
||||
$hospital_info = \Streamline\Models\HospitalInformation::find(1);
|
||||
switch ($budget->period)
|
||||
{
|
||||
case 'months':
|
||||
$period = "Months";
|
||||
$budget_start_date = strtotime($budget->period_start);//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". $budget->period_count - 1 ." month", $budget_start_date));
|
||||
$period_range = date("M-Y", $budget_start_date) . " to " . date("M-Y", strtotime($budget_end_date));
|
||||
$interval = DateInterval::createFromDateString('1 month');
|
||||
$period = new DatePeriod(new DateTime($budget->period_start), $interval, new DateTime(date("Y-m-d", strtotime("+". $budget->period_count ." month", $budget_start_date))));
|
||||
foreach ($period as $dt) $months_data[] = $dt->format("M-Y");
|
||||
|
||||
$column_1 = [$second_col];
|
||||
$columns = array_merge($column_1, $months_data);
|
||||
array_push($columns, $end_col);
|
||||
$collength = count($columns);
|
||||
|
||||
break;
|
||||
|
||||
case 'quarters':
|
||||
$period = "Quarters";
|
||||
$other_columns =[];$quarter_start_dates =['-01-01', '-04-01', '-07-01', '-10-01']; //m-d
|
||||
$budget_start_date = $budget->period_start;//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". ($budget->period_count-1) * 3 ." month", strtotime('-1 day', strtotime($budget_start_date))));
|
||||
$quarters_data = get_quarters($budget_start_date, $budget_end_date);
|
||||
for($y =0; $y < count($quarters_data); $y++) $other_columns[] = $quarters_data[$y]->period;
|
||||
$period_range = $other_columns[0] . " to " . $other_columns[count($other_columns)-1];
|
||||
|
||||
$column_1 = [$second_col];
|
||||
$columns = array_merge($column_1, $other_columns);
|
||||
array_push($columns, $end_col);
|
||||
$collength = count($columns);
|
||||
break;
|
||||
|
||||
case 'years':
|
||||
$period = "Years";
|
||||
$year=date('Y', strtotime($budget->period_start));
|
||||
// if (is_numeric($year)) $period_range = $year . " to " . ($year + $budget->period_count-1);
|
||||
|
||||
$sec = substr($year, -2);
|
||||
$years_data = [$year.'/'. ++$sec];
|
||||
for ($i = 1; $i <$budget->period_count; $i++) array_push($years_data, $year + $i .'/'. ++$sec);
|
||||
$period_range = $years_data[0] . " to " . $years_data[count($years_data)-1];
|
||||
$column_1 = [$second_col];
|
||||
$columns = array_merge($column_1, $years_data);
|
||||
array_push($columns, $end_col);
|
||||
$collength = count($columns);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@endphp
|
||||
|
||||
@if(is_null($hospital_info->pdf_print_header))
|
||||
<img style="max-width: 300px; max-height: 100px;" src="{{ asset($hospital_info->logo) }}" class="mx-auto d-block mx-3" alt="Responsive image">
|
||||
<p class="h6 text-center mt-0 font-weight-bold">
|
||||
{{ $hospital_info->name . ' | ' . $hospital_info->phone_number . ' | ' .
|
||||
$hospital_info->email . ' | ' . $hospital_info->address . ' ' .
|
||||
$hospital_info->country }}
|
||||
</p>
|
||||
@else
|
||||
<img style="max-height: 150px;" src="{{ asset($hospital_info->pdf_print_header) }}" class="mx-auto d-block mx-3" alt="Responsive image">
|
||||
@endif
|
||||
<div class="row text-center m-t-10">
|
||||
<div class="col-md-12">
|
||||
<p><h4>{{ __('budgets.budget_name') . ": " . $budget->name }}</h4></p>
|
||||
<p><h4>{{ "Period(" .ucfirst($budget->period) . "): " . $period_range }}</h4></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table color-bordered-table success-bordered-table">
|
||||
<thead>
|
||||
<tr style='display:none;'>
|
||||
<td colspan='<?php echo count($columns); ?>'>
|
||||
Budget Name: {{ ucfirst($budget->name) . " - Period(" .ucfirst($budget->period) . "): " . $period_range }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@php
|
||||
for ($i = 0; $i < count($columns); $i++) echo '<th>' .$columns[$i].'</th>';
|
||||
$totals_budgets = $sub_accounts = $totals_budgets_colums = $income_column_totals = $expense_column_totals = $cost_of_goods_column_totals = [];
|
||||
$sub_account_total= 0;
|
||||
@endphp
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($options as $option)
|
||||
<tr>
|
||||
<td colspan='<?php echo $collength; ?>'>
|
||||
<h5><strong>{{ $option['section_header'] }}</strong></h5>
|
||||
</td>
|
||||
</tr>
|
||||
{{-- @foreach ($option['sub_accounts'] as $sub_account)
|
||||
<tr>
|
||||
<td colspan='<?php echo $collength; ?>'>
|
||||
<h5>{{ get_name(key($option['sub_accounts']), 'id', 'name','chart_of_accounts') }}</h5>
|
||||
</td>
|
||||
</tr>
|
||||
@foreach ($sub_account as $sub_account_entry)
|
||||
<tr>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$sum=0;
|
||||
for ($j=0; $j < count($sub_account_entry['account_entries']); $j++) $sum +=(int)$sub_account_entry['account_entries'][$j];
|
||||
if ($i==0) echo '<td>' .$sub_account_entry['name']. '</td>' ;
|
||||
else if ($i==$collength - 1) echo "<td style='background-color: #34394D !important; color: #fff !important;'>" . ugandan_shillings($sum) . "</td>" ;
|
||||
else echo "<td>" .ugandan_shillings($sub_account_entry['account_entries'][$i - 1]). "</td>" ;
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach --}}
|
||||
{{-- Sub Account Section column Totals --}}
|
||||
{{-- <tr style='background-color: rgba(0, 0, 0, 0.075) !important;'>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$sub_account_total_section = $sub_account_columnTotal_section=0; $keys = array_keys($option['sub_accounts']);
|
||||
if ($i==0) echo '<td>'. get_name(key($option['sub_accounts']), 'id', 'name','chart_of_accounts') . ' Total</td>' ;
|
||||
else if ($i==$collength - 1){ //Sub account totals
|
||||
for($k=0; $k < $budget->period_count; $k++){
|
||||
$columnTotal = 0;
|
||||
for ($m = 0; $m < count($option['sub_accounts']); $m++) {
|
||||
for ($l = 0; $l < count($option['sub_accounts'][$keys[$m]]); $l++) $columnTotal +=(int)($option['sub_accounts'][$keys[$m]][$l]['account_entries'][$k]);
|
||||
}
|
||||
$sub_account_total_section += $columnTotal;
|
||||
}
|
||||
echo "<td>" .ugandan_shillings($sub_account_total_section) . "</td>" ;
|
||||
} else {
|
||||
for ($b=0; $b < count($option['sub_accounts']); $b++) {
|
||||
for ($l = 0; $l < count($option['sub_accounts'][$keys[$b]]); $l++) $sub_account_columnTotal_section +=(int)($option['sub_accounts'][$keys[$b]][$l]['account_entries'][$i - 1]);
|
||||
|
||||
}
|
||||
echo "<td>" .ugandan_shillings($sub_account_columnTotal_section). "</td>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach --}}
|
||||
{{-- @if (!empty($option['sub_accounts']))
|
||||
<tr>
|
||||
<td colspan='<?php echo $collength; ?>'>
|
||||
<h5>{{ 'Other '. $option['section_header'] }}</h5>
|
||||
</td>
|
||||
</tr>
|
||||
@endif --}}
|
||||
@foreach ($option['entries'] as $entry )
|
||||
<tr>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$sum=0;
|
||||
for ($j=0; $j < count($entry['account_entries']); $j++) $sum +=(int)$entry['account_entries'][$j];
|
||||
$total=ugandan_shillings($sum);
|
||||
|
||||
if ($i==0) echo '<td>' .$entry['name']. '</td>' ;
|
||||
else if ($i==$collength - 1) echo "<td style='background-color: #34394D !important; color: #fff !important;'>" .$total. "</td>" ;
|
||||
else echo "<td>" .ugandan_shillings($entry['account_entries'][$i - 1]). "</td>" ;
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
{{-- Other income Section column Totals --}}
|
||||
{{-- @if (!empty($option['sub_accounts']))
|
||||
|
||||
<tr style='background-color: rgba(0, 0, 0, 0.075) !important;'>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$budget_total_section=0; $columnTotal_section=0;
|
||||
if ($i==0) echo '<td> Other '.$option['total_header']. '</td>' ;
|
||||
else if ($i==$collength - 1){ //Budget totals for
|
||||
for($k=0; $k < $budget->period_count; $k++){
|
||||
$columnTotal = 0;
|
||||
for ($m = 0; $m < count($option['entries']); $m++) {
|
||||
$columnTotal +=(int)($option['entries'][$m]['account_entries'][$k]);
|
||||
}
|
||||
$budget_total_section +=$columnTotal;
|
||||
}
|
||||
echo "<td>" .ugandan_shillings($budget_total_section) . "</td>" ;
|
||||
}
|
||||
else {
|
||||
for ($b=0; $b < count($option['entries']); $b++) {
|
||||
$columnTotal_section +=(int)($option['entries'][$b]['account_entries'][$i - 1]);
|
||||
}
|
||||
|
||||
echo "<td>" .ugandan_shillings($columnTotal_section). "</td>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endif --}}
|
||||
{{-- Operating Budget Section Totals --}}
|
||||
<tr style='background-color: #34394D !important; color: #fff !important;'>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$budget_total_section=0; $columnTotal_section=0;
|
||||
if ($i==0) echo '<td class="font-weight-bold">'.$option['total_header']. '</td>' ;
|
||||
else if ($i==$collength - 1){ //Budget totals for
|
||||
for($k=0; $k < $budget->period_count; $k++){
|
||||
$columnTotal = 0;
|
||||
for ($m = 0; $m < count($option['entries']); $m++) {
|
||||
$columnTotal +=(int)($option['entries'][$m]['account_entries'][$k]);
|
||||
}
|
||||
$budget_total_section +=$columnTotal;
|
||||
}
|
||||
array_push($totals_budgets, $budget_total_section);
|
||||
echo "<td>" .ugandan_shillings($budget_total_section) . "</td>" ;
|
||||
} else {
|
||||
for ($b=0; $b < count($option['entries']); $b++) {
|
||||
$columnTotal_section +=(int)($option['entries'][$b]['account_entries'][$i - 1]);
|
||||
}
|
||||
//Push to column total arrays
|
||||
if($entry['type'] == 'Income') array_push($income_column_totals, $columnTotal_section);
|
||||
else if($entry['type'] == 'Expense') array_push($expense_column_totals, $columnTotal_section);
|
||||
else array_push($cost_of_goods_column_totals, $columnTotal_section);
|
||||
|
||||
echo "<td>" .ugandan_shillings($columnTotal_section). "</td>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
{{-- Budget Projections --}}
|
||||
<tr style='background-color: #34394D !important; color: #fff !important;'>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
if ($i==0) echo '<td>Projected Net Income</td>' ;
|
||||
else if ($i==$collength - 1){ //Budget Totals
|
||||
$overall_projection = $totals_budgets[0] - $totals_budgets[1] - $totals_budgets[2];
|
||||
echo "<td>" . ugandan_shillings($overall_projection) . "</td>" ;
|
||||
} else {
|
||||
$columnTotal_projection=$income_column_totals[$i-1] - $expense_column_totals[$i-1] - $cost_of_goods_column_totals[$i-1];
|
||||
echo "<td>".ugandan_shillings($columnTotal_projection). "</td>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
<tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
@php
|
||||
for ($i = 0; $i < count($columns); $i++) echo '<th>' .$columns[$i].'</th>';
|
||||
@endphp
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<!-- /#wrapper -->
|
||||
<!-- jQuery -->
|
||||
<script src="{{ asset('elite/bower_components/jquery/dist/jquery.min.js') }}"></script>
|
||||
<!-- Bootstrap Core JavaScript -->
|
||||
<script src="{{ asset('elite/bootstrap/dist/js/tether.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/bootstrap/dist/js/bootstrap.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/bower_components/sidebar-nav/src/metisMenu.js') }}"></script>
|
||||
<!--slimscroll JavaScript -->
|
||||
<script src="{{ asset('elite/js/jquery.slimscroll.js') }}"></script>
|
||||
<!-- Custom Theme JavaScript -->
|
||||
<script src="{{ asset('elite/js/custom.min.js') }}"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
+222
@@ -0,0 +1,222 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ app()->getLocale() }}">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
<!-- CSRF Token -->
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
|
||||
<link rel="icon" type="image/png" sizes="16x16"
|
||||
href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
|
||||
<title>{{ config('app.name', 'Streamline') }}</title>
|
||||
<!-- Bootstrap Core CSS -->
|
||||
<link href="{{ asset('elite/bootstrap/dist/css/bootstrap.min.css') }}" rel="stylesheet">
|
||||
<!-- Custom CSS -->
|
||||
<link href="{{ asset('elite/css/style.css') }}" rel="stylesheet">
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-size: 14px;
|
||||
/* line-height: 1.2; */
|
||||
}
|
||||
|
||||
strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
tr {
|
||||
page-break-before: always;
|
||||
page-break-after: always;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
.total {
|
||||
background-color: #34394D !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Preloader -->
|
||||
<div class="preloader">
|
||||
<div class="cssload-speeding-wheel"></div>
|
||||
</div>
|
||||
<div class="white-box">
|
||||
<div class='col-md-12'>
|
||||
@php
|
||||
$hospital_info = \Streamline\Models\HospitalInformation::find(1);
|
||||
$period_months = getMonthsList();
|
||||
$columns = ['Account', 'Budget Total', 'Actual Total', 'Percentage Variance <br> Actual vs Budget', 'Actual Variance <br> Actual vs Budget'];
|
||||
switch ($budget->period)
|
||||
{
|
||||
case 'months':
|
||||
$period = "Months";
|
||||
$budget_start_date = strtotime($budget->period_start);//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". $budget->period_count - 1 ." month", $budget_start_date));
|
||||
$period_range = date("M-Y", $budget_start_date) . " to " . date("M-Y", strtotime($budget_end_date));
|
||||
$interval = DateInterval::createFromDateString('1 month');
|
||||
$period = new DatePeriod(new DateTime($budget->period_start), $interval, new DateTime(date("Y-m-d",
|
||||
strtotime("+". $budget->period_count ." month", $budget_start_date))));
|
||||
foreach ($period as $dt) $months_data[] = $dt->format("M-Y");
|
||||
$collength = count($columns);
|
||||
|
||||
break;
|
||||
|
||||
case 'quarters':
|
||||
$period = "Quarters";
|
||||
$other_columns =[];$quarter_start_dates =['-01-01', '-04-01', '-07-01', '-10-01']; //m-d
|
||||
$budget_start_date = $budget->period_start;//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". ($budget->period_count-1) * 3 ." month", strtotime('-1 day', strtotime($budget_start_date))));
|
||||
$quarters_data = get_quarters($budget_start_date, $budget_end_date);
|
||||
for($y =0; $y < count($quarters_data); $y++) $other_columns[]=$quarters_data[$y]->period;
|
||||
$period_range = $other_columns[0] . " to " . $other_columns[count($other_columns)-1];
|
||||
$collength = count($columns);
|
||||
|
||||
break;
|
||||
|
||||
case 'years':
|
||||
$period = "Years";
|
||||
$year=date('Y', strtotime($budget->period_start));
|
||||
// $period_range = $range;
|
||||
$sec = substr($year, -2);
|
||||
$years_data = [$year.'/'. ++$sec];
|
||||
for ($i = 1; $i <$budget->period_count; $i++) array_push($years_data, $year + $i .'/'. ++$sec);
|
||||
$period_range = $years_data[0] . " to " . $years_data[count($years_data)-1];
|
||||
$columns = array_merge($column_1, $years_data);
|
||||
$collength = count($columns);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@endphp
|
||||
|
||||
@if(is_null($hospital_info->pdf_print_header))
|
||||
<img style="max-width: 300px; max-height: 100px;" src="{{ asset($hospital_info->logo) }}" class="mx-auto d-block mx-3" alt="Responsive image">
|
||||
<p class="h6 text-center mt-0 font-weight-bold">
|
||||
{{ $hospital_info->name . ' | ' . $hospital_info->phone_number . ' | ' .
|
||||
$hospital_info->email . ' | ' . $hospital_info->address . ' ' .
|
||||
$hospital_info->country }}
|
||||
</p>
|
||||
@else
|
||||
<img style="max-height: 150px;" src="{{ asset($hospital_info->pdf_print_header) }}" class="mx-auto d-block mx-3" alt="Responsive image">
|
||||
@endif
|
||||
<div class="row text-center m-t-10">
|
||||
<div class="col-md-12">
|
||||
<p><h4>{{ __('budgets.budget_name') . ": " . $budget->name }}</h4></p>
|
||||
<p><h4>Period: {{ ucfirst($budget->period) . " (" . $period_range . ") " }}</h4></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<table class="table color-bordered-table success-bordered-table">
|
||||
<thead>
|
||||
<tr>
|
||||
@php
|
||||
for ($i = 0; $i < count($columns); $i++) echo '<th>' .$columns[$i].'</th>';
|
||||
$actual_totals = $totals_budgets = $summary_colums = $income_column_totals=[];
|
||||
$expense_column_totals=[];$cost_of_goods_column_totals=[];
|
||||
@endphp
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($options as $option)
|
||||
<tr>
|
||||
<td colspan='<?php echo $collength; ?>'>
|
||||
<h5><strong>{{ $option['section_header'] }}</strong></h5>
|
||||
</td>
|
||||
</tr>
|
||||
@foreach ($option['entries'] as $entry )
|
||||
<tr>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$sum=0;
|
||||
for ($j=0; $j < count($entry['account_entries']); $j++) $sum +=(int)$entry['account_entries'][$j]; $col_percent=($entry['actual_entry']>0)? round(((($entry['actual_entry'] - $sum) / $entry['actual_entry']) * 100),2).'%' : 'N/A';
|
||||
|
||||
if ($i==0) echo '<td>' .$entry['name']. '</td>' ;
|
||||
else if ($i == 1) echo "<td>" . ugandan_shillings($sum) . "</td>" ;//Budget Total
|
||||
else if ($i == 2) echo "<td>" . ugandan_shillings($entry['actual_entry']) . "</td>" ; //Actual Total
|
||||
else if ($i == 3) echo "<td>" . $col_percent . "</td>" ; //Percentage variance
|
||||
else if ($i == 4) echo "<td>" . ugandan_shillings($entry['actual_entry'] - $sum) . "</td>" ; //Actual Variance
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
{{-- Budget Section column Totals --}}
|
||||
<tr class="total">
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$budget_total_section = $columnTotal_section = 0;
|
||||
if ($i==0) echo '<td>' .$option['total_header']. '</td>' ;
|
||||
else if ($i==1){ //Budget totals
|
||||
for($k=0; $k < $budget->period_count; $k++){
|
||||
$columnTotal = 0;
|
||||
for ($m = 0; $m < count($option['entries']); $m++) $columnTotal +=(int)($option['entries'][$m]['account_entries'][$k]);
|
||||
$budget_total_section +=$columnTotal;
|
||||
}
|
||||
array_push($totals_budgets, $budget_total_section);
|
||||
echo "<td>" . ugandan_shillings($budget_total_section) . "</td>" ;
|
||||
} else if ($i==2) {
|
||||
array_push($actual_totals, $option['actual']);
|
||||
echo "<td>" . ugandan_shillings($option['actual']) . "</td>" ; //Actual Total
|
||||
} else if ($i==3) {
|
||||
$percent=($option['actual']> 0)? round(((($option['actual'] - $totals_budgets[count($totals_budgets) - 1]) / $option['actual'] ) * 100),2) .'%' : 'N/A';
|
||||
echo "<td>" . $percent . "</td>" ; //Percentage variance
|
||||
}
|
||||
else if ($i == 4) echo "<td>" .ugandan_shillings($option['actual'] - $totals_budgets[count($totals_budgets) - 1]). "</td>" ; //Actual Variance
|
||||
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
{{-- Overall Budget Performance --}}
|
||||
<tr class="total">
|
||||
@php
|
||||
$overall_projection = $totals_budgets[0] - $totals_budgets[1] - $totals_budgets[2];
|
||||
array_push($summary_colums, $overall_projection);
|
||||
$total_actual = $data['accrual_net_income'] + $data['cash_net_income'];
|
||||
array_push($summary_colums, $total_actual);
|
||||
$overall_percentage = ($summary_colums[1] > 0)? round(((($summary_colums[1] - $summary_colums[0]) / $summary_colums[1]) * 100),2) .'%' : 'N/A';
|
||||
@endphp
|
||||
<td>Performance</td>
|
||||
<td> {{ ugandan_shillings($overall_projection) }} </td> {{-- Budget Projection --}}
|
||||
<td> {{ ugandan_shillings($total_actual) }} </td> {{-- Actual Total --}}
|
||||
<td> {{ $overall_percentage }} </td> {{-- Percentage variance --}}
|
||||
<td> {{ ugandan_shillings($summary_colums[1] - $summary_colums[0]) }} </td> {{-- Actual Variance --}}
|
||||
</tr>
|
||||
|
||||
|
||||
<tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
@php
|
||||
for ($i = 0; $i < count($columns); $i++) echo '<th>' .$columns[$i].'</th>';
|
||||
@endphp
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- /#wrapper -->
|
||||
<!-- jQuery -->
|
||||
<script src="{{ asset('elite/bower_components/jquery/dist/jquery.min.js') }}"></script>
|
||||
<!-- Bootstrap Core JavaScript -->
|
||||
<script src="{{ asset('elite/bootstrap/dist/js/tether.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/bootstrap/dist/js/bootstrap.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/bower_components/sidebar-nav/src/metisMenu.js') }}"></script>
|
||||
<!--slimscroll JavaScript -->
|
||||
<script src="{{ asset('elite/js/jquery.slimscroll.js') }}"></script>
|
||||
<!-- Custom Theme JavaScript -->
|
||||
<script src="{{ asset('elite/js/custom.min.js') }}"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
+258
@@ -0,0 +1,258 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ app()->getLocale() }}">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
<!-- CSRF Token -->
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
|
||||
<link rel="icon" type="image/png" sizes="16x16"
|
||||
href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
|
||||
<title>{{ config('app.name', 'Streamline') }}</title>
|
||||
<!-- Bootstrap Core CSS -->
|
||||
<link href="{{ asset('elite/bootstrap/dist/css/bootstrap.min.css') }}" rel="stylesheet">
|
||||
<!-- Custom CSS -->
|
||||
<link href="{{ asset('elite/css/style.css') }}" rel="stylesheet">
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-size: 14px;
|
||||
/* line-height: 1.2; */
|
||||
}
|
||||
|
||||
strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.total {
|
||||
background-color: #34394D !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
tr {
|
||||
page-break-before: always;
|
||||
page-break-after: always;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Preloader -->
|
||||
<div class="preloader">
|
||||
<div class="cssload-speeding-wheel"></div>
|
||||
</div>
|
||||
<div class="white-box">
|
||||
<div class='col-md-12'>
|
||||
@php
|
||||
$hospital_info = \Streamline\Models\HospitalInformation::find(1);
|
||||
$period_months = getMonthsList();
|
||||
$column_1 = ['Account'];
|
||||
$colum_2 = ['Budget Total', 'Actual Total', 'Percentage Variance <br> (Actual vs Budget)', 'Actual Variance <br> (Actual vs Budget)'];
|
||||
switch ($budget->period)
|
||||
{
|
||||
case 'months':
|
||||
$period = "Months";
|
||||
$budget_start_date = strtotime($budget->period_start);//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". $budget->period_count - 1 ." month", $budget_start_date));
|
||||
$period_range = date("M-Y", $budget_start_date) . " to " . date("M-Y", strtotime($budget_end_date));
|
||||
$interval = DateInterval::createFromDateString('1 month');
|
||||
$period = new DatePeriod(new DateTime($budget->period_start), $interval, new DateTime(date("Y-m-d",
|
||||
strtotime("+". $budget->period_count ." month", $budget_start_date))));
|
||||
foreach ($period as $dt) $months_data[] = $dt->format("M-Y");
|
||||
$columns = array_merge($column_1, $months_data);
|
||||
$counter = count($columns);
|
||||
$columns = array_merge($columns, $colum_2);
|
||||
$collength = count($columns);
|
||||
|
||||
break;
|
||||
|
||||
case 'quarters':
|
||||
$period = "Quarters";
|
||||
$other_columns =[];$quarter_start_dates =['-01-01', '-04-01', '-07-01', '-10-01']; //m-d
|
||||
$budget_start_date = $budget->period_start;//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". ($budget->period_count-1) * 3 ." month", strtotime('-1 day', strtotime($budget_start_date))));
|
||||
$quarters_data = get_quarters($budget_start_date, $budget_end_date);
|
||||
for($y =0; $y < count($quarters_data); $y++) $other_columns[]=$quarters_data[$y]->period;
|
||||
$period_range = $other_columns[0] . " to " . $other_columns[count($other_columns)-1];
|
||||
$columns = array_merge($column_1, $other_columns);
|
||||
$counter = count($columns);
|
||||
$columns = array_merge($columns, $colum_2);
|
||||
$collength = count($columns);
|
||||
|
||||
break;
|
||||
|
||||
case 'years':
|
||||
$period = "Years";
|
||||
$year=date('Y', strtotime($budget->period_start));
|
||||
// $period_range = $range;
|
||||
$sec = substr($year, -2);
|
||||
$years_data = [$year.'/'. ++$sec];
|
||||
for ($i = 1; $i <$budget->period_count; $i++) array_push($years_data, $year + $i .'/'. ++$sec);
|
||||
$period_range = $years_data[0] . " to " . $years_data[count($years_data)-1];
|
||||
$columns = array_merge($column_1, $years_data);
|
||||
$counter = count($columns);
|
||||
$columns = array_merge($columns, $colum_2);
|
||||
$collength = count($columns);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@endphp
|
||||
|
||||
@if(is_null($hospital_info->pdf_print_header))
|
||||
<img style="max-width: 300px; max-height: 100px;" src="{{ asset($hospital_info->logo) }}" class="mx-auto d-block mx-3" alt="Responsive image">
|
||||
<p class="h6 text-center mt-0 font-weight-bold">
|
||||
{{ $hospital_info->name . ' | ' . $hospital_info->phone_number . ' | ' .
|
||||
$hospital_info->email . ' | ' . $hospital_info->address . ' ' .
|
||||
$hospital_info->country }}
|
||||
</p>
|
||||
@else
|
||||
<img style="max-height: 150px;" src="{{ asset($hospital_info->pdf_print_header) }}" class="mx-auto d-block mx-3" alt="Responsive image">
|
||||
@endif
|
||||
<div class="row text-center m-t-10">
|
||||
<div class="col-md-12">
|
||||
<p><h4>{{ __('budgets.budget_name') . ": " . $budget->name }}</h4></p>
|
||||
<p><h4>Period: {{ ucfirst($budget->period) . " (" . $period_range . ") " }}</h4></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<table class="table color-bordered-table table-responsive success-bordered-table">
|
||||
<thead>
|
||||
<tr>
|
||||
@php
|
||||
for ($i = 0; $i < count($columns); $i++) echo '<th>' .$columns[$i].'</th>';
|
||||
$actual_totals = $totals_budgets = $summary_colums = $income_column_totals=[];
|
||||
$expense_column_totals = $cost_of_goods_column_totals=[];
|
||||
@endphp
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($options as $option)
|
||||
<tr>
|
||||
<td colspan='<?php echo $collength; ?>'>
|
||||
<h5><strong>{{ $option['section_header'] }}</strong></h5>
|
||||
</td>
|
||||
</tr>
|
||||
@foreach ($option['entries'] as $entry)
|
||||
<tr>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$sum=0;
|
||||
for ($j=0; $j < count($entry['account_entries']); $j++) $sum +=(int)$entry['account_entries'][$j]; $col_percent=($entry['actual_entry']>0)? round(((($entry['actual_entry'] - $sum) / $entry['actual_entry']) * 100),2).'%' : 'N/A';
|
||||
|
||||
if ($i==0) echo '<td>' .$entry['name']. '</td>' ;
|
||||
else if ($i === $counter) echo "<td>" . ugandan_shillings($sum) . "</td>" ;//Budget Total
|
||||
else if ($i == $counter + 1) echo "<td>" . ugandan_shillings($entry['actual_entry']) . "</td>" ; //Actual Total
|
||||
else if ($i == $counter + 2) echo "<td>" . $col_percent . "</td>" ; //Percentage variance
|
||||
else if ($i == $counter + 3) echo "<td>" . ugandan_shillings($entry['actual_entry'] - $sum) . "</td>" ; //Actual Variance
|
||||
else {
|
||||
echo "<td>" .ugandan_shillings($entry['account_entries'][$i - 1]). "</td>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
{{-- Budget Section column Totals --}}
|
||||
<tr class="total">
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$budget_total_section = $columnTotal_section = 0;
|
||||
if ($i==0) echo '<td>' .$option['total_header']. '</td>' ;
|
||||
else if ($i == $counter){ //Budget totals
|
||||
for($k=0; $k < $budget->period_count; $k++){
|
||||
$columnTotal = 0;
|
||||
for ($m = 0; $m < count($option['entries']); $m++) $columnTotal +=(int)($option['entries'][$m]['account_entries'][$k]);
|
||||
$budget_total_section +=$columnTotal;
|
||||
}
|
||||
array_push($totals_budgets, $budget_total_section);
|
||||
echo "<td>" . ugandan_shillings($budget_total_section) . "</td>" ;
|
||||
} else if ($i == $counter + 1) {
|
||||
array_push($actual_totals, $option['actual']);
|
||||
echo "<td>" . ugandan_shillings($option['actual']) . "</td>" ; //Actual Total
|
||||
} else if ($i== $counter+2) {
|
||||
$percent=($option['actual']> 0)? round(((($option['actual'] - $totals_budgets[count($totals_budgets) - 1]) / $option['actual'] ) * 100),2) .'%' : 'N/A';
|
||||
echo "<td>" . $percent . "</td>" ; //Percentage variance
|
||||
}
|
||||
else if ($i == $counter+3) echo "<td>" .ugandan_shillings($option['actual'] - $totals_budgets[count($totals_budgets) - 1]). "</td>" ; //Actual Variance
|
||||
else {
|
||||
for ($b=0; $b < count($option['entries']); $b++) {
|
||||
$columnTotal_section +=(int)($option['entries'][$b]['account_entries'][$i - 1]);
|
||||
}
|
||||
//Push to column total arrays
|
||||
if($entry['type'] == 'Income') array_push($income_column_totals, $columnTotal_section);
|
||||
else if($entry['type'] == 'Expense') array_push($expense_column_totals, $columnTotal_section);
|
||||
else array_push($cost_of_goods_column_totals, $columnTotal_section);
|
||||
|
||||
echo "<td>" .ugandan_shillings($columnTotal_section). "</td>" ;
|
||||
}
|
||||
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
{{-- Overall Budget Performance --}}
|
||||
|
||||
<tr class="total">
|
||||
@php
|
||||
$overall_projection = $totals_budgets[0] - $totals_budgets[1] - $totals_budgets[2];
|
||||
array_push($summary_colums, $overall_projection);
|
||||
$total_actual = $data['accrual_net_income'] + $data['cash_net_income'];
|
||||
array_push($summary_colums, $total_actual);
|
||||
$overall_percentage = ($summary_colums[1] > 0)? round(((($summary_colums[1] - $summary_colums[0]) / $summary_colums[1]) * 100),2) .'%' : 'N/A';
|
||||
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
if ($i==0) echo '<td>Summary</td>' ;
|
||||
else if ($i == $counter){ //Budget Totals
|
||||
echo "<td>" . ugandan_shillings($overall_projection) . "</td>" ;
|
||||
} else if ($i == $counter + 1) {
|
||||
echo "<td>" . ugandan_shillings($total_actual) . "</td>" ;
|
||||
} else if ($i == $counter + 2) {
|
||||
echo "<td>" . $overall_percentage . "</td>" ;
|
||||
} else if ($i == $counter + 3) {
|
||||
echo "<td>" . ugandan_shillings($summary_colums[1] - $summary_colums[0]) . "</td>" ;
|
||||
} else {
|
||||
$columnTotal_projection=$income_column_totals[$i-1] - $expense_column_totals[$i-1] - $cost_of_goods_column_totals[$i-1];
|
||||
echo "<td>".ugandan_shillings($columnTotal_projection). "</td>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
|
||||
<tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
@php
|
||||
for ($i = 0; $i < count($columns); $i++) echo '<th>' .$columns[$i].'</th>';
|
||||
@endphp
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- /#wrapper -->
|
||||
<!-- jQuery -->
|
||||
<script src="{{ asset('elite/bower_components/jquery/dist/jquery.min.js') }}"></script>
|
||||
<!-- Bootstrap Core JavaScript -->
|
||||
<script src="{{ asset('elite/bootstrap/dist/js/tether.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/bootstrap/dist/js/bootstrap.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/bower_components/sidebar-nav/src/metisMenu.js') }}"></script>
|
||||
<!--slimscroll JavaScript -->
|
||||
<script src="{{ asset('elite/js/jquery.slimscroll.js') }}"></script>
|
||||
<!-- Custom Theme JavaScript -->
|
||||
<script src="{{ asset('elite/js/custom.min.js') }}"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,353 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet"
|
||||
type="text/css" />
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet"
|
||||
type="text/css" />
|
||||
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<style type="text/css">
|
||||
td {
|
||||
min-width: 130px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">{{ __('finance.budgets') }}</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> Home</a></li>
|
||||
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> Finance Home</a></li>
|
||||
<li class="active"><i class="fa fa-file"></i> {{ __('finance.budgets') }}</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('budgets::budgets.menu')
|
||||
@include('flash::message')
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="white-box">
|
||||
<div class="row">
|
||||
<div class='col-md-2'>
|
||||
<div id="divCloneBudget" style='margin-top: 20px;'>
|
||||
<a id="add_item" title='Create a new budget from this one'
|
||||
href="{{ route('budgets.clone',$budget->id) }}" class='btn btn-rounded btn-success'><span
|
||||
class="glyphicon glyphicon-copy"></span> Clone Budget</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class='col-md-2'>
|
||||
<div id="editBudget" style='margin-top: 20px;'>
|
||||
<a id="edit_item" title='Edit this Budget' href="{{ route('budgets.edit',$budget->id) }}"
|
||||
class='btn btn-rounded btn-warning'><span class="glyphicon glyphicon-edit"></span> Edit
|
||||
Budget</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div style="margin-top: 20px;">
|
||||
<a href="#" onclick="download_table_as_csv('table', '<?php echo ucfirst($budget->name);?>');"
|
||||
title="Download CSV of budget" class="btn btn-success btn-rounded"><span
|
||||
class="glyphicon glyphicon-download"></span> Download CSV</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- <div class="col-md-2">
|
||||
<div style="margin-top: 20px;">
|
||||
<a href="#" onclick="print_div('divToPrint')" title="Print to Pdf"
|
||||
class="btn btn-success btn-rounded"> <span class="glyphicon glyphicon-print"></span> Web
|
||||
Print</a>
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
<div class='col-md-2'>
|
||||
<div id="divPrintBudget" style='margin-top: 20px;'>
|
||||
<a title='Print this Budget to pdf' target="_blank"
|
||||
href="{{ route('budgets.print',$budget->id) }}" class='btn btn-rounded btn-success'><span
|
||||
class="glyphicon glyphicon-print"></span> Print Budget</a>
|
||||
</div>
|
||||
</div>
|
||||
@php
|
||||
$period_months = getMonthsList();
|
||||
$second_col = "Account"; $end_col = "Budget Total";
|
||||
switch ($budget->period)
|
||||
{
|
||||
case 'months':
|
||||
$period = "Months";
|
||||
$budget_start_date = strtotime($budget->period_start);//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". $budget->period_count - 1 ." month", $budget_start_date));
|
||||
$period_range = date("M-Y", $budget_start_date) . " to " . date("M-Y", strtotime($budget_end_date));
|
||||
$interval = DateInterval::createFromDateString('1 month');
|
||||
$period = new DatePeriod(new DateTime($budget->period_start), $interval, new DateTime(date("Y-m-d", strtotime("+". $budget->period_count ." month", $budget_start_date))));
|
||||
foreach ($period as $dt) $months_data[] = $dt->format("M-Y");
|
||||
|
||||
$column_1 = [$second_col];
|
||||
$columns = array_merge($column_1, $months_data);
|
||||
array_push($columns, $end_col);
|
||||
$collength = count($columns);
|
||||
|
||||
break;
|
||||
|
||||
case 'quarters':
|
||||
$period = "Quarters";
|
||||
$other_columns =[];$quarter_start_dates =['-01-01', '-04-01', '-07-01', '-10-01']; //m-d
|
||||
$budget_start_date = $budget->period_start;//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". ($budget->period_count-1) * 3 ." month", strtotime('-1 day', strtotime($budget_start_date))));
|
||||
$quarters_data = get_quarters($budget_start_date, $budget_end_date);
|
||||
for($y =0; $y < count($quarters_data); $y++) $other_columns[] = $quarters_data[$y]->period;
|
||||
$period_range = $other_columns[0] . " to " . $other_columns[count($other_columns)-1];
|
||||
|
||||
$column_1 = [$second_col];
|
||||
$columns = array_merge($column_1, $other_columns);
|
||||
array_push($columns, $end_col);
|
||||
$collength = count($columns);
|
||||
break;
|
||||
|
||||
case 'years':
|
||||
$period = "Years";
|
||||
$year=date('Y', strtotime($budget->period_start));
|
||||
$sec = substr($year, -2);
|
||||
$years_data = [$year.'/'. ++$sec];
|
||||
for ($i = 1; $i <$budget->period_count; $i++) array_push($years_data, $year + $i .'/'. ++$sec);
|
||||
$period_range = $years_data[0] . " to " . $years_data[count($years_data)-1];
|
||||
$column_1 = [$second_col];
|
||||
$columns = array_merge($column_1, $years_data);
|
||||
array_push($columns, $end_col);
|
||||
$collength = count($columns);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@endphp
|
||||
|
||||
<div class='col-md-4'></div>
|
||||
</div>
|
||||
<div id='divToPrint'>
|
||||
<div class='row'>
|
||||
<div class='col-md-12'>
|
||||
<hr />
|
||||
<div class="row text-center m-t-10">
|
||||
<div class="col-md-12">
|
||||
<p>
|
||||
<h4>{{ __('budgets.budget_name') . ": " . $budget->name }}</h4>
|
||||
</p>
|
||||
<p>
|
||||
<h4>{{ "Period(" .ucfirst($budget->period) . "): " . $period_range }}</h4>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row table-responsive">
|
||||
<table class="table color-bordered-table success-bordered-table" id="table">
|
||||
<thead>
|
||||
<tr style='display:none;'>
|
||||
<td colspan='<?php echo count($columns); ?>'>
|
||||
Budget Name: {{ ucfirst($budget->name) .' - Period('. ucfirst($budget->period) .'): '.$period_range }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@php
|
||||
for ($i = 0; $i < count($columns); $i++) echo '<th>' .$columns[$i].'</th>';
|
||||
$totals_budgets = $sub_accounts = $totals_budgets_colums = $income_column_totals = $expense_column_totals = $cost_of_goods_column_totals = [];
|
||||
$sub_account_total= 0;
|
||||
@endphp
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($options as $option)
|
||||
<tr>
|
||||
<td colspan='<?php echo $collength; ?>'>
|
||||
<h5><strong>{{ $option['section_header'] }}</strong></h5>
|
||||
</td>
|
||||
</tr>
|
||||
{{-- @foreach ($option['sub_accounts'] as $keyid => $sub_account) --}}
|
||||
{{-- <tr>
|
||||
<td class='other' data-section='{{ 'other-rows-'.$keyid }}' onclick='toggler(this);' colspan='<?php echo $collength; ?>'>
|
||||
<h5>{{ get_name($keyid, 'id', 'name','chart_of_accounts') }} <span id={{ 'other-rows-'.$keyid }}>-</span></h5>
|
||||
</td>
|
||||
</tr> --}}
|
||||
{{-- @foreach ($sub_account as $sub_account_entry)
|
||||
<tr class={{ 'other-rows-'.$keyid }}>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$sum=0;
|
||||
for ($j=0; $j < count($sub_account_entry['account_entries']); $j++) $sum +=(int)$sub_account_entry['account_entries'][$j];
|
||||
if ($i==0) echo '<td>' .$sub_account_entry['name']. '</td>' ;
|
||||
else if ($i==$collength - 1) echo "<td style='background-color: #34394D !important; color: #fff !important;'>" . ugandan_shillings($sum) . "</td>" ;
|
||||
else echo "<td>" .ugandan_shillings($sub_account_entry['account_entries'][$i - 1]). "</td>" ;
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach --}}
|
||||
{{-- Sub Account Section column Totals --}}
|
||||
{{-- <tr class={{ 'other-rows-'.$keyid }} style='background-color: rgba(0, 0, 0, 0.075) !important;'>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$sub_account_total_section = $sub_account_columnTotal_section=0; $keys = array_keys($option['sub_accounts']);
|
||||
if ($i==0) echo '<td>'. get_name($keyid, 'id', 'name','chart_of_accounts') . ' Total</td>' ;
|
||||
else if ($i==$collength - 1){ //Sub account totals
|
||||
for($k=0; $k < $budget->period_count; $k++){
|
||||
$columnTotal = 0;
|
||||
for ($m = 0; $m < count($option['sub_accounts'][$keyid]); $m++) {
|
||||
$columnTotal +=(int)($option['sub_accounts'][$keyid][$m]['account_entries'][$k]);
|
||||
}
|
||||
$sub_account_total_section += $columnTotal;
|
||||
}
|
||||
echo "<td>" .ugandan_shillings($sub_account_total_section) . "</td>" ;
|
||||
} else {
|
||||
for ($b=0; $b < count($option['sub_accounts'][$keyid]); $b++) {
|
||||
$sub_account_columnTotal_section +=(int)($option['sub_accounts'][$keyid][$b]['account_entries'][$i - 1]);
|
||||
|
||||
}
|
||||
echo "<td>" .ugandan_shillings($sub_account_columnTotal_section). "</td>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
</tr> --}}
|
||||
{{-- @endforeach
|
||||
@if (!empty($option['sub_accounts']))
|
||||
<tr>
|
||||
<td class='other' data-section='{{ 'other-rows-'.$option['section_header'] }}' onclick='toggler(this);' colspan='<?php echo $collength; ?>'>
|
||||
<h5>{{ 'Other '. $option['section_header'] }} <span id={{ 'other-rows-'.$option['section_header'] }}>-</span></h5>
|
||||
</td>
|
||||
</tr>
|
||||
@endif --}}
|
||||
@foreach ($option['entries'] as $entry )
|
||||
<tr class={{ 'other-rows-'.$option['section_header'] }}>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$sum=0;
|
||||
for ($j=0; $j < count($entry['account_entries']); $j++) $sum +=(int)$entry['account_entries'][$j];
|
||||
$total=ugandan_shillings($sum);
|
||||
|
||||
if ($i==0) echo '<td>' .$entry['name']. '</td>' ;
|
||||
else if ($i==$collength - 1) echo "<td style='background-color: #34394D !important; color: #fff !important;'>" .$total. "</td>" ;
|
||||
else echo "<td>" .ugandan_shillings($entry['account_entries'][$i - 1]). "</td>" ;
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
{{-- Other income Section column Totals --}}
|
||||
{{-- @if (!empty($option['sub_accounts']))
|
||||
|
||||
<tr class={{ 'other-rows-'.$option['section_header'] }} style='background-color: rgba(0, 0, 0, 0.075) !important;'>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$budget_total_section=0; $columnTotal_section=0;
|
||||
if ($i==0) echo '<td> Other '.$option['section_header']. ' total</td>' ;
|
||||
else if ($i==$collength - 1){ //Budget totals for
|
||||
for($k=0; $k < $budget->period_count; $k++){
|
||||
$columnTotal = 0;
|
||||
for ($m = 0; $m < count($option['entries']); $m++) {
|
||||
$columnTotal +=(int)($option['entries'][$m]['account_entries'][$k]);
|
||||
}
|
||||
$budget_total_section +=$columnTotal;
|
||||
}
|
||||
echo "<td>" .ugandan_shillings($budget_total_section) . "</td>" ;
|
||||
}
|
||||
else {
|
||||
for ($b=0; $b < count($option['entries']); $b++) {
|
||||
$columnTotal_section +=(int)($option['entries'][$b]['account_entries'][$i - 1]);
|
||||
}
|
||||
|
||||
echo "<td>" .ugandan_shillings($columnTotal_section). "</td>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endif --}}
|
||||
{{-- Operating Budget Section Totals --}}
|
||||
<tr style='background-color: #34394D !important; color: #fff !important;'>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$budget_total_section=0; $columnTotal_section=0;
|
||||
if ($i==0) echo '<td class="font-weight-bold">'.$option['total_header']. '</td>' ;
|
||||
else if ($i==$collength - 1){ //Budget totals for
|
||||
for($k=0; $k < $budget->period_count; $k++){
|
||||
$columnTotal = 0;
|
||||
for ($m = 0; $m < count($option['entries']); $m++) {
|
||||
$columnTotal +=(int)($option['entries'][$m]['account_entries'][$k]);
|
||||
}
|
||||
$budget_total_section +=$columnTotal;
|
||||
}
|
||||
array_push($totals_budgets, $budget_total_section);
|
||||
echo "<td>" .ugandan_shillings($budget_total_section) . "</td>" ;
|
||||
} else {
|
||||
for ($b=0; $b < count($option['entries']); $b++) {
|
||||
$columnTotal_section +=(int)($option['entries'][$b]['account_entries'][$i - 1]);
|
||||
}
|
||||
//Push to column total arrays
|
||||
if($entry['type'] == 'Income') array_push($income_column_totals, $columnTotal_section);
|
||||
else if($entry['type'] == 'Expense') array_push($expense_column_totals, $columnTotal_section);
|
||||
else array_push($cost_of_goods_column_totals, $columnTotal_section);
|
||||
|
||||
echo "<td>" .ugandan_shillings($columnTotal_section). "</td>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
{{-- Budget Projections --}}
|
||||
<tr style='background-color: #34394D !important; color: #fff !important;'>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
if ($i==0) echo '<td class="font-weight-bold">Projected Net Income</td>' ;
|
||||
else if ($i==$collength - 1){ //Budget Totals
|
||||
$overall_projection = $totals_budgets[0] - $totals_budgets[1] - $totals_budgets[2];
|
||||
echo "<td>" . ugandan_shillings($overall_projection) . "</td>" ;
|
||||
} else {
|
||||
$columnTotal_projection=$income_column_totals[$i-1] - $expense_column_totals[$i-1] - $cost_of_goods_column_totals[$i-1];
|
||||
echo "<td>".ugandan_shillings($columnTotal_projection). "</td>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
<tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
@php
|
||||
for ($i = 0; $i < count($columns); $i++) echo '<th>' .$columns[$i].'</th>';
|
||||
@endphp
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
|
||||
<script src="{{ asset('js/streamline_functions.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
function toggler(data){
|
||||
let section = data.getAttribute('data-section'); console.log(section);
|
||||
$('#'+section).text(function(_, value){return value=='-'?'+':'-'});
|
||||
$('.' + section).toggle(1000);
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
Reference in New Issue
Block a user