748 lines
37 KiB
PHP
748 lines
37 KiB
PHP
<?php
|
|
$showPieChart = false;
|
|
if(isset($data['Meal']) && !empty($data['Meal']) && !empty($data['GroupExpense'])){
|
|
$showPieChart = true;
|
|
} elseif(!isset($data['Meal']) && isset($data['GroupExpense']) && !empty($data['GroupExpense'])) {
|
|
$showPieChart = true;
|
|
}
|
|
?>
|
|
<script>
|
|
function printPage(){
|
|
window.print();
|
|
}
|
|
</script>
|
|
<style type="text/css">
|
|
.showHideSpan{
|
|
font-size: 14px;
|
|
}
|
|
input[type="checkbox"]{
|
|
width: 20px;height: 18px;
|
|
}
|
|
.displaynone{
|
|
display: none;
|
|
}
|
|
.floatRight{
|
|
float: right;
|
|
}
|
|
#generateCSVBtn{
|
|
padding:10px 50px;
|
|
margin-right: 40px;
|
|
cursor: pointer;
|
|
}
|
|
#generatePdfBtn{
|
|
/* padding:10px 50px; */
|
|
margin-right: 20px;
|
|
cursor: pointer;
|
|
}
|
|
#emailBtn{
|
|
margin-right: 20px;
|
|
cursor: pointer;
|
|
}
|
|
.hideCell{
|
|
display: none;
|
|
}
|
|
table.perticipantTable{
|
|
margin-bottom: 10px !important;
|
|
}
|
|
.print #participantData .participant{
|
|
padding-top:6px;
|
|
padding-left:10px;
|
|
}
|
|
.print #participantData .participant label{
|
|
font-size:15px;
|
|
font-weight: 600;
|
|
}
|
|
.print #participantData .participant select{
|
|
font-size:15px;
|
|
}
|
|
#previewBtn{
|
|
margin:20px 0 0 10px;
|
|
}
|
|
.hideCell{
|
|
display: none !important;
|
|
}
|
|
.description p
|
|
{
|
|
line-height:22px;
|
|
margin-bottom::0;
|
|
padding-bottom:0
|
|
}
|
|
|
|
@media print{
|
|
.hideCell{
|
|
display: none !important;
|
|
}
|
|
.showHideSpan{
|
|
display: none !important;
|
|
}
|
|
.description p
|
|
{
|
|
line-height:22px;
|
|
margin-bottom::0;
|
|
padding-bottom:0
|
|
}
|
|
}
|
|
.my-expenses{
|
|
min-height: auto;
|
|
}
|
|
.my-expenses .submit {
|
|
text-align: right;
|
|
margin-right: 6rem;
|
|
margin-bottom: 1rem;
|
|
margin-top: 1rem;
|
|
}
|
|
</style>
|
|
<div class="wrapper" id="printWrapper">
|
|
|
|
<div class="print" style="overflow: hidden;">
|
|
<form action="<?php echo $this->webroot . 'Expense/printReport/' . $data['Expense']['unique_url']; ?>" class="form-inline hidden-print" id="participantData" method="post">
|
|
<div class="form-group participant">
|
|
<label for="participantId"><?php echo __("LBL_SELECT_PARTICIPANT"); ?> </label>
|
|
<input type="hidden" name="unique_url" value="<?php echo $data['Expense']['unique_url']; ?>">
|
|
<select class="form-control" id="participantId" name="participant_id" placeholder="Select any">
|
|
<option value="" ><?php echo __("LBL_ALL"); ?></option>
|
|
<?php foreach ($data['Participant'] as $participant) { ?>
|
|
<option
|
|
value="<?php echo $participant['participant_id']; ?>"
|
|
<?php if (!empty($participant_id) && $participant_id == $participant['participant_id']) {
|
|
echo "Selected";
|
|
$participant_name = $participant['name'];
|
|
} ?>
|
|
><?php echo $participant['name']; ?></option>
|
|
<?php
|
|
} ?>
|
|
</select>
|
|
</div>
|
|
</form>
|
|
<!-- <button type="submit" class="btn btn-info floatRight hidden-print generate" id="generateCSVBtn"><b>--><?php //echo __("LBL_CSV"); ?><!--</b> <img src="--><?php //echo HTTP_SITE_URL; ?><!--/images/download.png" style="height: 18px;width: 18px;"/></button>-->
|
|
<div class="float-right">
|
|
<button type="submit" class="btn btn-info hidden-print generate" id="generatePdfBtn"><b><?php echo __("LBL_PDF"); ?></b> <img src="<?php echo HTTP_SITE_URL; ?>/images/download.png" style="height: 18px;width: 18px; display: inline;"/></button>
|
|
<!-- <span><?php //echo date("d/m/Y - H:i"); ?></span> -->
|
|
|
|
<!-- EMIAL BUTTON BEGIN -->
|
|
<?php if ($issetParam) { ?>
|
|
<button type="button" class="btn btn-info floatRight hidden-print generate" id="emailBtn" data-toggle="modal" data-target="#myExpenseModal"><b>Send Email</b></button>
|
|
<?php } ?>
|
|
</div>
|
|
<div class="modal fade" id="myExpenseModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<div class="modal-header-inner">
|
|
<h5 class="modal-title" id="exampleModalLabel">Send Email</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div class="modal-body my-expenses">
|
|
<?php //echo $this->Form->create(null, array('id' => 'sendEmailForm'));
|
|
?>
|
|
<form action="<?php echo $this->Html->url(array('controller' => 'Expense', 'action' => 'sendEmailPdf')); ?>" class="form-inline" method="post" id="sendEmailForm">
|
|
<input type="hidden" name="whole_content_email" id="wholeContentEmail">
|
|
<div class="form-group" style="width: 100%;">
|
|
<?php if($isPaid){ ?>
|
|
<label for="email"><?php echo __("LBL_INVITE_EMAIL_ADDRESS"); ?>:</label>
|
|
<?php
|
|
echo $this->Form->input('email', array('label' => false, 'email' => __('LBL_PLEASE_PROVIDE_EMAIL'), 'length' => '200px', 'required' => 'true', 'style' => 'width:240px; height:30px;', 'id' => 'email'));
|
|
}else{
|
|
|
|
echo "This function is for paid user only!";
|
|
}
|
|
?>
|
|
</div>
|
|
<?php if($isPaid){
|
|
echo $this->Form->end('Send Email', array('class' => 'myExpenseSend','style'=>'margin-top:1rem;'));
|
|
}else{
|
|
?>
|
|
<div class="submit" style="margin-top: 3rem;"></div>
|
|
<?php
|
|
echo "</form>";
|
|
}
|
|
?>
|
|
<img id="loadImg1" style="display:none;float: right" src="<?php echo CDN_URL; ?>images/loading.gif" />
|
|
<button type="button" class="btn btn-secondary modal-footer-close" data-dismiss="modal" style="height: 35px; bottom:2rem;">Close</button>
|
|
<?php //} ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- email button End-->
|
|
</div>
|
|
|
|
<div id="exportPrintTable">
|
|
<div class="exportPrintTable-inner">
|
|
|
|
|
|
<div style="width: 100%; overflow: hidden;">
|
|
<div style="width: 40%;float: left; ">
|
|
<!-- <p><a href="<?php echo $this->webroot; ?>"><img src="<?php echo CDN_URL; ?><?php echo __('LBL_LOGO_PDF'); ?>" width="270" height="72" alt=""/></a> </p> -->
|
|
<div class="description">
|
|
<p><strong style="font-size: 20px;"> <?php echo $data['Expense']["title"]; ?></strong><?php if (!empty($data['Expense']["description"])) { echo "<br/>".$data['Expense']["description"]; ?><br/>
|
|
<?php
|
|
}
|
|
$create_date = strtotime($data['Expense']["create_date"]);
|
|
?></p>
|
|
<p><?php echo __("LBL_CREATED_AT"). __("LBL_ON"); ?> <?php echo date('d-M-Y', $create_date); ?></p>
|
|
</div>
|
|
</div>
|
|
<?php if($showPieChart) { ?>
|
|
<div style="width: 60%;float: left; margin-bottom: 10px;">
|
|
<span class="showHideSpan" style=""> (<label for="isChartShow"><?php echo __("LBL_HIDE_SHOW"); ?></label> <input type="checkbox" value="1" id="isChartShow" checked="checked">)</span>
|
|
<div style="border: 1px solid #bbb; margin: 5px 0; " id="chartDiv">
|
|
<script src="<?php echo CDN_URL;?>js/highcharts/highcharts.js"></script>
|
|
<div id="containerPie" style=""></div>
|
|
<script type="text/javascript">
|
|
|
|
// Build the chart
|
|
Highcharts.chart('containerPie', {
|
|
chart: {
|
|
height:280,
|
|
width:540,
|
|
plotBackgroundColor: null,
|
|
plotBorderWidth: null,
|
|
plotShadow: false,
|
|
type: 'pie'
|
|
},
|
|
title: {
|
|
text: 'Participant wise expense ratio'
|
|
},
|
|
tooltip: {
|
|
pointFormat: '<b>{point.percentage:.1f}%</b>'//{series.name}:
|
|
},
|
|
plotOptions: {
|
|
pie: {
|
|
allowPointSelect: true,
|
|
cursor: 'pointer',
|
|
dataLabels: {
|
|
enabled: true,
|
|
format:'<b>{point.percentage:.1f}%</b>'
|
|
},
|
|
showInLegend: true
|
|
}
|
|
},
|
|
series: [{
|
|
name: 'Brands',
|
|
colorByPoint: true,
|
|
data: <?php echo $pieChartDataFinal; ?>
|
|
/*[{
|
|
name: 'Chrome',
|
|
y: 31.41
|
|
}, {
|
|
name: 'Internet Explorer',
|
|
y: 11.84
|
|
}, {
|
|
name: 'Firefox',
|
|
y: 10.85
|
|
}, {
|
|
name: 'Edge',
|
|
y: 4.67
|
|
}, {
|
|
name: 'Safari',
|
|
y: 4.18
|
|
}, {
|
|
name: 'Other',
|
|
y: 7.05
|
|
}]*/
|
|
}],
|
|
legend: {
|
|
// layout: 'vertical',
|
|
backgroundColor: '',
|
|
align: 'right',
|
|
verticalAlign: 'middle',
|
|
// alignColumns:false,
|
|
floating: false,
|
|
itemWidth:100,
|
|
width:200,
|
|
x: 0,
|
|
y: 0,
|
|
|
|
symbolHeight:10,
|
|
symbolWidth:10,
|
|
squareSymbol:true
|
|
},
|
|
credits: {
|
|
enabled:false
|
|
},
|
|
exporting: {
|
|
type: 'image/jpeg',
|
|
enabled:true
|
|
}
|
|
});
|
|
</script></div>
|
|
</div>
|
|
<?php } ?>
|
|
</div>
|
|
|
|
<?php
|
|
// total meal calculation
|
|
$totalMeal = 0;
|
|
if (isset($data['Meal']) && !empty($data['Meal'])) {
|
|
|
|
foreach ($data['Meal'] as $zz => $value) {
|
|
$subtotal = 0;
|
|
$breakfast = 0;
|
|
$lunch = 0;
|
|
$dinner = 0;
|
|
$meal_participants = explode(',', $value['meal_amount']);
|
|
if(!empty($meal_participants)){
|
|
foreach ($meal_participants as $meal_participant) {
|
|
$meal_amounts = explode('|', $meal_participant);
|
|
|
|
if((($current_perticipants != '') && ($current_perticipants == $meal_amounts[0])) || ($current_perticipants == '')){
|
|
$breakfast += $meal_amounts[1];
|
|
$lunch += $meal_amounts[2];
|
|
$dinner += $meal_amounts[3];
|
|
}
|
|
}
|
|
}
|
|
$subtotal = $breakfast + $lunch + $dinner;
|
|
$totalMeal += $subtotal;
|
|
?>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
|
|
|
|
|
|
<span class="showHideSpan" style="width: 100%; "> (<?php echo __("LBL_HIDE_SHOW"); ?>:
|
|
<label for="isWhoPaidShow"><?php echo __("LBL_WHO_PAID"); ?>
|
|
<input type="checkbox" value="1" id="isWhoPaidShow" checked="checked"></label>
|
|
<!-- <label for="isWhatReasonShow">--><?php //echo __("LBL_FOR_WHAT_REASONS"); ?>
|
|
<!-- <input type="checkbox" value="1" id="isWhatReasonShow" checked="checked"></label>-->
|
|
<!-- <label for="isHowMuchShow">--><?php //echo __("LBL_HOW_MUCH"); ?>
|
|
<!-- <input type="checkbox" value="1" id="isHowMuchShow" checked="checked"></label>-->
|
|
|
|
<label for="isWhenShow"><?php echo __("LBL_WHEN"); ?>
|
|
<input type="checkbox" value="1" id="isWhenShow" checked="checked"></label>
|
|
|
|
<label for="isInvolvesShow"><?php echo __("LBL_INVOLVES"); ?>
|
|
<input type="checkbox" value="1" id="isInvolvesShow" checked="checked"></label>
|
|
)
|
|
</span>
|
|
<table class="table printTable perticipantTable" id="exportTable" width="100%">
|
|
<thead>
|
|
<tr>
|
|
<th><?php echo __("LBL_WHO_PAID"); ?></th>
|
|
<th><?php echo __("LBL_FOR_WHAT_REASONS"); ?></th>
|
|
<th><?php echo __("LBL_HOW_MUCH"); ?>?</th>
|
|
<th><?php echo __("LBL_WHEN"); ?></th>
|
|
<th><?php echo __("LBL_INVOLVES"); ?></th>
|
|
<?php if (!empty($participant_id)) { ?>
|
|
<th><?php echo __("LBL_FOR"); ?> <?php echo $participant_name; ?>?</th>
|
|
<?php } ?>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$personal_total_expense = 0;
|
|
$total_expense = 0;
|
|
$settled = 0;
|
|
$advanced = 0;
|
|
$finalExpenseList = array();
|
|
foreach ($data['GroupExpense'] as $key => $value) {
|
|
$extras_value = 0;
|
|
if (isset($value['extras']) && !empty($value['extras'])) {
|
|
$extrasArray = explode('|', $value['extras']);
|
|
$extras_value = $extrasArray[0];
|
|
}
|
|
if ($extras_value == 1 || $value['what'] == 'Balance Expense') {
|
|
$settled++;
|
|
$extras_value = 1;
|
|
} elseif ($extras_value == 2) {
|
|
$advanced++;
|
|
}
|
|
if (!in_array($extras_value, [1,2]) ) {
|
|
|
|
//if ( (isset($data['Meal']) && !empty($data['Meal']) && ($totalMeal > 0)) || (!isset($data['Meal']) && empty($data['Meal'])) ) {
|
|
$finalExpenseList[$key]['participent_name'] = $value["participent_name"];
|
|
$finalExpenseList[$key]['amount'] = $value["amount"];
|
|
$finalExpenseList[$key]['what'] = $value["what"];
|
|
$finalExpenseList[$key]['expense_date_new'] = $value["expense_date_new"];
|
|
$finalExpenseList[$key]['involve_list'] = $value["involve_list"];
|
|
$finalExpenseList[$key]['my_expense'] = 0;
|
|
$finalExpenseList[$key]['currency'] = $data['Expense']["currency"];
|
|
if (!empty($participant_id)) {
|
|
if (!isset($data['Meal']) && empty($data['Meal'])) {
|
|
$finalExpenseList[$key]['my_expense'] = number_format($value["my_expense"], 2);
|
|
}
|
|
}
|
|
|
|
?>
|
|
<tr>
|
|
<td><?php echo $value["participent_name"]; ?></td>
|
|
<td><?php echo $value["what"]; ?></td>
|
|
<td data-sort="<?php echo $value["amount"]; ?>"><?php
|
|
$total_expense = $total_expense + $value["amount"];
|
|
echo number_format($value["amount"], 2) . " " . $data['Expense']["currency"]; ?></td>
|
|
<td data-sort="<?php echo strtotime($value["expense_date_new"]); ?>"><?php echo $value["expense_date_new"]; ?></td>
|
|
<td><?php echo $value["involve_list"]; ?></td>
|
|
<?php if (!empty($participant_id)) { ?>
|
|
<td><?php
|
|
if (is_numeric ($value["my_expense"])) {
|
|
$personal_total_expense = $personal_total_expense + $value["my_expense"];
|
|
echo number_format($value["my_expense"], 2) . " " . $data['Expense']["currency"];
|
|
} else {
|
|
echo $value["my_expense"];
|
|
}
|
|
?></td>
|
|
<?php
|
|
} ?>
|
|
</tr>
|
|
<?php
|
|
}
|
|
}
|
|
|
|
?>
|
|
</tbody>
|
|
<tfoot>
|
|
<?php //if ( (isset($data['Meal']) && !empty($data['Meal']) && ($totalMeal > 0)) || (!isset($data['Meal']) && empty($data['Meal'])) ) { ?>
|
|
<tr style="background: transparent;">
|
|
<?php if (!empty($participant_id)) { ?>
|
|
<td style="border: 0px;"></td>
|
|
<td align="right" style="font-weight: bold;border: 0px;"><?php echo __("LBL_TOTAL"); ?> : </td>
|
|
<td align="left" style="border: 0px;"><?php echo number_format($total_expense, 2) . " " . $data['Expense']["currency"]; ?></td>
|
|
<td style="border:0px;"></td>
|
|
<td align="right" style="font-weight: bold;border: 0px;"><?php echo __("LBL_TOTAL"); ?> : </td>
|
|
<td align="left" style="border: 0px;"><?php echo number_format($personal_total_expense, 2) . " " . $data['Expense']["currency"]; ?></td>
|
|
<?php
|
|
} else { ?>
|
|
<td style="border:0px;"></td>
|
|
<td align="right" style="font-weight: bold; border: 0px;"><?php echo __("LBL_TOTAL"); ?> : </td>
|
|
<td align="left" style="border:0px;"><?php echo number_format($total_expense, 2) . " " . $data['Expense']["currency"]; ?></td>
|
|
<td style="border:0px;"></td>
|
|
<td style="border:0px;"></td>
|
|
<?php } ?>
|
|
</tr>
|
|
<?php
|
|
/* }
|
|
if($totalMeal == 0){
|
|
if (!empty($participant_id)) {
|
|
echo '<tr style="background: transparent;">
|
|
<td colspan="6" style="text-align:center;">No expense found for '.$allParticipant[$participant_id]['name'].'</td></tr>';
|
|
} else {
|
|
echo '<tr style="background: transparent;"><td colspan="5">No expense found for '.$allParticipant[$participant_id]['name'].'</td></tr>';
|
|
}
|
|
}*/
|
|
?>
|
|
</tfoot>
|
|
|
|
</table> <!--expense table end-->
|
|
|
|
<!--Advanced table start-->
|
|
<?php if ($advanced > 0) {
|
|
$check_extras = 2;
|
|
echo $this->element('reports/settled_table', array('check_extras'=>$check_extras)); }
|
|
?><!--Advanced table end -->
|
|
|
|
<!--settled table start-->
|
|
<?php if ($settled > 0) {
|
|
$check_extras = 1;
|
|
echo $this->element('reports/settled_table', array('check_extras'=>$check_extras));
|
|
} ?><!--settled table end -->
|
|
|
|
<?php $finalMealList = array();
|
|
if (isset($data['Meal']) ) { ?>
|
|
<h5 id="summaryHeader" style="text-align: left;" class="meal-report"><?php echo __("LBL_MEALS"); ?>
|
|
<span class="showHideSpan" style=""> (<label for="isMealReportShow"><?php echo __("LBL_HIDE_SHOW"); ?> <input type="checkbox" value="1" name="isMealReportShow" id="isMealReportShow" checked="checked"></label>)</span>
|
|
</h5>
|
|
<table class="table printTable mealTable" id="exportTable" width="100%">
|
|
<thead>
|
|
<tr>
|
|
<th><?php echo __("LBL_DATE"); ?></th>
|
|
<th><?php echo __("LBL_DAY"); ?></th>
|
|
<th><?php echo __("LBL_BREAKFAST"); ?></th>
|
|
<th><?php echo __("LBL_LUNCH"); ?></th>
|
|
<th><?php echo __("LBL_DINNER"); ?></th>
|
|
<th><?php echo __("LBL_TOTAL"); ?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$total = 0; $tempParticipantMeal = array();
|
|
foreach ($data['Meal'] as $zz => $value) {
|
|
|
|
if($totalMeal > 0){
|
|
|
|
$subtotal = 0;
|
|
$breakfast = 0;
|
|
$lunch = 0;
|
|
$dinner = 0;
|
|
$meal_participants = explode(',', $value['meal_amount']);
|
|
if(!empty($meal_participants)){
|
|
foreach ($meal_participants as $meal_participant) {
|
|
$meal_amounts = explode('|', $meal_participant);
|
|
|
|
if((($current_perticipants != '') && ($current_perticipants == $meal_amounts[0])) || ($current_perticipants == '')){
|
|
$breakfast += $meal_amounts[1];
|
|
$lunch += $meal_amounts[2];
|
|
$dinner += $meal_amounts[3];
|
|
if(!isset($tempParticipantMeal[$meal_amounts[0]]['meal'])){
|
|
$tempParticipantMeal[$meal_amounts[0]]['meal'] = 0;
|
|
}
|
|
$tempParticipantMeal[$meal_amounts[0]]['meal'] += $meal_amounts[1] + $meal_amounts[2] + $meal_amounts[3];
|
|
}
|
|
}
|
|
}
|
|
$subtotal = $breakfast + $lunch + $dinner;
|
|
$total += $subtotal;
|
|
|
|
|
|
$finalMealList[$zz]['create_date'] = date('d-M-Y', strtotime($value["date_new"]));
|
|
$finalMealList[$zz]['day'] = date('D', strtotime($value["date_new"]));
|
|
$finalMealList[$zz]['breakfast'] = $breakfast;
|
|
$finalMealList[$zz]['lunch'] = $lunch;
|
|
$finalMealList[$zz]['dinner'] = $dinner;
|
|
$finalMealList[$zz]['subtotal'] = $subtotal;
|
|
|
|
?>
|
|
<tr>
|
|
<td><?php echo date('d-M-Y', strtotime($value["date_new"])); ?></td>
|
|
<td><?php echo date('D', strtotime($value["date_new"])); ?></td>
|
|
<td><?php echo $breakfast; ?></td>
|
|
<td><?php echo $lunch; ?></td>
|
|
<td><?php echo $dinner; ?></td>
|
|
<td><?php echo $subtotal; ?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
}
|
|
$meal_total = $total;
|
|
?>
|
|
</tbody>
|
|
<tfoot>
|
|
<?php if($totalMeal > 0){ ?>
|
|
<tr style="background: transparent;">
|
|
<td style="border: 0px;"></td>
|
|
<td style="border:0px;"></td>
|
|
<td style="border:0px;"></td>
|
|
<td style="border:0px;"></td>
|
|
<td align="right" style="font-weight: bold;border: 0px;"><?php echo __("LBL_TOTAL"); ?> : </td>
|
|
<td style="border:0px;"><?php echo number_format($total, 2); ?></td>
|
|
</tr>
|
|
<?php } else { ?>
|
|
<tr><td style="text-align: center;" colspan="6"><?php echo __("LBL_NO_MEAL_AVAILABLE"); ?></td></tr>
|
|
<?php } ?>
|
|
</tfoot>
|
|
</table>
|
|
<?php } ?>
|
|
|
|
<h5 id="summaryHeader" style="text-align: left;" class="summary-report"><?php echo __("LBL_SUMMARY_REPORT"); ?>
|
|
<span class="showHideSpan" style=""> (<label for="isSummaryReportShow"><?php echo __("LBL_HIDE_SHOW"); ?> <input type="checkbox" value="1" name="isSummaryReportShow" id="isSummaryReportShow" checked="checked"></label>)</span>
|
|
</h5>
|
|
<table class="printTable table" id="exportTableBalance" style="text-align: center;">
|
|
<thead>
|
|
<th style="text-align: center;"><?php echo __("LBL_PARTICIPANTS"); ?></th>
|
|
<th style="text-align: center;"><?php echo __("LBL_CHARGED"); ?></th>
|
|
<th style="text-align: center;"><?php echo __("LBL_PAID"); ?></th>
|
|
<th style="text-align: center;"><?php echo __("LBL_DUE"); ?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$due = 0;
|
|
$count = 1;
|
|
$finalSummaryList = array();
|
|
foreach($allParticipant as $key=>$value) {
|
|
$due = $value["total_paid"] - $value["total_charge"];
|
|
if( (($current_perticipants != '') && ($value['participant_id'] == $current_perticipants)) || ($current_perticipants == '') && !empty($key)) {
|
|
$finalSummaryList[$key]['name'] = $value['name'];
|
|
$finalSummaryList[$key]['total_charge'] = number_format($value['total_charge'], 2, '.', '');
|
|
$finalSummaryList[$key]['total_paid'] = number_format($value['total_paid'], 2, '.', '');
|
|
$finalSummaryList[$key]['currency'] = $value['currency'];
|
|
$finalSummaryList[$key]['due'] = number_format($value["total_paid"] - $value["total_charge"], 2, '.', '');
|
|
?>
|
|
<tr>
|
|
<td><?php echo $value["name"];?></td>
|
|
<td><?php echo number_format($value["total_charge"], 2, '.', '').' '.$value["currency"];?></td>
|
|
<td><?php echo number_format($value["total_paid"], 2, '.', '').' '.$value["currency"];?></td>
|
|
<td><?php echo number_format($due, 2, '.', '').' '.$value["currency"];?></td>
|
|
</tr>
|
|
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
|
|
<!--summary of meal and expense start-->
|
|
<?php if (isset($data['Meal']) && !empty($data['Meal']) ) {
|
|
echo $this->element('reports/balance_expense', array('meal_total'=>$meal_total)); }
|
|
?><!--summary of meal and expense end -->
|
|
|
|
<div style="width: 100%; overflow: hidden;margin-top: 50px;">
|
|
<div class="hidden-print" style="width: 30%;float:left;">
|
|
<a href="#" id="previewBtn" class="btn btn-info"><?php echo __('LBL_PREVIEW_BTN'); ?></a>
|
|
</div>
|
|
<div style="width: 40%;float: right; text-align: right;margin-right: 20px;">
|
|
<?php if (isset($data['Meal'])) : ?>
|
|
<p><a href="<?php echo $this->webroot; ?>"><img src="<?php echo HTTP_SITE_URL; ?>/<?php echo __('LBL_MESS_EXPENSE_LOGO'); ?>" width="270" height="72" alt=""/></a> </p>
|
|
<?php else : ?>
|
|
<p><a href="<?php echo $this->webroot; ?>"><img src="<?php echo HTTP_SITE_URL; ?>/<?php echo __('LBL_GROUP_EXPENSE_LOGO'); ?>" width="270" height="72" alt=""/></a> </p>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<!-- <div class="footerText">To add, delete or comment on the expenses, balance an ExpenseCount or print this page, it is necessary to access the ExpenseCount.com via a traditional browser.<br/>
|
|
click <a href="#" style="cursor:pointer" onclick="printPage()"> here</a> to print the page.</div>-->
|
|
<div class="footer-pdf-print-link hidden-print displaynone">
|
|
<a href="#" onclick="printPage()" class="btn btn-info"><?php echo __("LBL_PRINT"); ?></a>
|
|
<form action="<?php echo $this->Html->url(array('controller' => 'Expense', 'action' => 'generatePdf')); ?>" class="form-inline" method="post" id="generatePdf">
|
|
<input type="hidden" name="whole_content" id="wholeContent">
|
|
<div class="form-group">
|
|
<button type="submit" class="btn btn-info" id="generatePdfBtn2"><?php echo __("LBL_DOWNLOAD"); ?></button>
|
|
</div>
|
|
</form>
|
|
|
|
<!-- <form action="<?php echo $this->Html->url(array('controller' => 'Expense', 'action' => 'sendEmailPdf')); ?>" class="form-inline" method="post" id="sendEmail">
|
|
<input type="hidden" name="whole_content" id="wholeContent">
|
|
<div class="form-group">
|
|
<button type="submit" class="btn btn-info" id="sendEmail"><?php echo __("LBL_DOWNLOAD"); ?></button>
|
|
</div>
|
|
</form> -->
|
|
|
|
<form action="<?php echo $this->Html->url(array('controller'=>'Expense','action'=>'generateCSV'));?>" class="form-inline" method="post" id="generateCSV" style="display: inline-flex;">
|
|
<input type="hidden" name="csv_content" value='<?php echo serialize($finalExpenseList); ?>'>
|
|
<input type="hidden" name="csv_summary_content" value='<?php echo serialize($finalSummaryList); ?>'>
|
|
<input type="hidden" name="csv_meal_content" value='<?php echo serialize($finalMealList); ?>'>
|
|
<input type="hidden" name="hasMeal" value='<?php echo $hasMeal; ?>'>
|
|
<div class="form-group">
|
|
<button type="submit" class="btn btn-info" id="generateCSVBtn2"><?php echo __("LBL_CSV"); ?></button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
</div>
|
|
<script>
|
|
$(document).ready(function(){
|
|
$("#participantId").on('change', function () {
|
|
//alert("selection changed");
|
|
$("form#participantData").submit();
|
|
});
|
|
$('#exportTable').DataTable({
|
|
"paging": false,
|
|
"searching": false,
|
|
"info": false
|
|
});
|
|
$("#generateCSVBtn").on('click', function () {
|
|
$("form#generateCSV").submit();
|
|
});
|
|
|
|
$("#generatePdfBtn").on('click', function () {
|
|
$('.showHideSpan').hide();
|
|
$('input[type="checkbox"]').hide().css('visibility','hidden');
|
|
$('.showHideSpan').remove();
|
|
$('.hideCell').remove();
|
|
var Content = $('#exportPrintTable').html();
|
|
var ContentWrap = '<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body>'+Content+'</body></html>';
|
|
var currentHtml = $("#wholeContent").val(ContentWrap);
|
|
// alert($("#wholeContent").val());
|
|
$("form#generatePdf").submit();
|
|
});
|
|
|
|
|
|
$("#emailBtn").on('click', function () {
|
|
$('.showHideSpan').hide();
|
|
$('input[type="checkbox"]').hide().css('visibility','hidden');
|
|
$('.showHideSpan').remove();
|
|
$('.hideCell').remove();
|
|
var Content = $('#exportPrintTable').html();
|
|
var ContentWrap = '<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body>'+Content+'</body></html>';
|
|
var currentHtml = $("#wholeContentEmail").val(ContentWrap);
|
|
// alert($("#wholeContent").val());
|
|
//$("form#sendEmail").submit();
|
|
});
|
|
|
|
|
|
$("#previewBtn").on('click', function () {
|
|
$('.showHideSpan').hide();
|
|
$('#participantData').hide();
|
|
$('.hidden-print').hide();
|
|
$('.hidden-print.generate').show();
|
|
$(this).hide();
|
|
});
|
|
|
|
$("#isSummaryReportShow").on('click', function () {
|
|
if(this.checked) {
|
|
$('#exportTableBalance').show().removeClass('hideCell');
|
|
$(".summary-report").removeClass('hidden-print');
|
|
} else {
|
|
$('#exportTableBalance').hide().addClass('hideCell');
|
|
$(".summary-report").addClass('hidden-print');
|
|
}
|
|
});
|
|
|
|
$("#isMealReportShow").on('click', function () {
|
|
if(this.checked) {
|
|
$('.mealTable').show().removeClass('hideCell');
|
|
$(".meal-report").removeClass('hidden-print');
|
|
} else {
|
|
$('.mealTable').hide().addClass('hideCell');
|
|
$(".meal-report").addClass('hidden-print');
|
|
}
|
|
});
|
|
|
|
$("#isWhoPaidShow").on('click', function () {
|
|
if(this.checked) {
|
|
$('table.perticipantTable th:nth-child(1)').show().removeClass('hideCell');
|
|
$('table.perticipantTable td:nth-child(1)').show().removeClass('hideCell');
|
|
} else {
|
|
$('table.perticipantTable th:nth-child(1)').hide().addClass('hideCell');
|
|
$('table.perticipantTable td:nth-child(1)').hide().addClass('hideCell');
|
|
}
|
|
});
|
|
|
|
$("#isHowMuchShow").on('click', function () {
|
|
if(this.checked) {
|
|
$('table.perticipantTable th:nth-child(3)').show().removeClass('hideCell');
|
|
$('table.perticipantTable td:nth-child(3)').show().removeClass('hideCell');
|
|
} else {
|
|
$('table.perticipantTable th:nth-child(3)').hide().addClass('hideCell');
|
|
$('table.perticipantTable td:nth-child(3)').hide().addClass('hideCell');
|
|
}
|
|
});
|
|
|
|
$("#isWhatReasonShow").on('click', function () {
|
|
if(this.checked) {
|
|
$('table.perticipantTable th:nth-child(2)').show().removeClass('hideCell');
|
|
$('table.perticipantTable td:nth-child(2)').show().removeClass('hideCell');
|
|
} else {
|
|
$('table.perticipantTable th:nth-child(2)').hide().addClass('hideCell');
|
|
$('table.perticipantTable td:nth-child(2)').hide().addClass('hideCell');
|
|
}
|
|
});
|
|
|
|
$("#isWhenShow").on('click', function () {
|
|
if(this.checked) {
|
|
$('table.perticipantTable th:nth-child(4)').show().removeClass('hideCell');
|
|
$('table.perticipantTable td:nth-child(4)').show().removeClass('hideCell');
|
|
} else {
|
|
$('table.perticipantTable th:nth-child(4)').hide().addClass('hideCell');
|
|
$('table.perticipantTable td:nth-child(4)').hide().addClass('hideCell');
|
|
}
|
|
});
|
|
|
|
$("#isInvolvesShow").on('click', function () {
|
|
if(this.checked) {
|
|
$('table.perticipantTable th:nth-child(5)').show().removeClass('hideCell');
|
|
$('table.perticipantTable td:nth-child(5)').show().removeClass('hideCell');
|
|
} else {
|
|
$('table.perticipantTable th:nth-child(5)').hide().addClass('hideCell');
|
|
$('table.perticipantTable td:nth-child(5)').hide().addClass('hideCell');
|
|
}
|
|
});
|
|
|
|
$("#isChartShow").on('click', function () {
|
|
if(this.checked) {
|
|
$('#chartDiv').show().removeClass('hideCell');
|
|
} else {
|
|
$('#chartDiv').hide().addClass('hideCell');
|
|
}
|
|
});
|
|
});
|
|
</script>
|