From 5fd6816a0567b31414492712d5002d3ecc9f52a2 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Sun, 21 Jan 2018 16:52:27 +0000 Subject: [PATCH] Added paid column as an optional output on displayed reports. --- WEB-INF/lib/ttReportHelper.class.php | 4 ++++ WEB-INF/templates/footer.tpl | 2 +- WEB-INF/templates/report.tpl | 5 +++++ WEB-INF/templates/reports.tpl | 3 +++ reports.php | 6 ++++-- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/WEB-INF/lib/ttReportHelper.class.php b/WEB-INF/lib/ttReportHelper.class.php index 7b7808cb..fe81a575 100644 --- a/WEB-INF/lib/ttReportHelper.class.php +++ b/WEB-INF/lib/ttReportHelper.class.php @@ -276,6 +276,10 @@ class ttReportHelper { array_push($fields, "cast(l.billable * coalesce(upb.rate, 0) * time_to_sec(l.duration)/3600 as decimal(10,2)) as cost"); // Use project rate for user. array_push($fields, "null as expense"); } + // Add paid status. + if ($user->canManageTeam() && $bean->getAttribute('chpaid')) + array_push($fields, 'l.paid as paid'); + // Add invoice name if it is selected. if (($user->canManageTeam() || $user->isClient()) && $bean->getAttribute('chinvoice')) array_push($fields, 'i.name as invoice'); diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index c08ed940..9820f54d 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- {/if} {if $bean->getAttribute('chnote')}{/if} {if $bean->getAttribute('chcost')}{/if} + {if $bean->getAttribute('chpaid')}{/if} {if $bean->getAttribute('chinvoice')}{/if} {foreach $report_items as $item} @@ -66,6 +67,7 @@ {if $bean->getAttribute('chduration')}{/if} {if $bean->getAttribute('chnote')}{/if} {if $bean->getAttribute('chcost')}{/if} + {if $bean->getAttribute('chpaid')}{/if} {if $bean->getAttribute('chinvoice')}{/if} @@ -88,6 +90,7 @@ {if $bean->getAttribute('chduration')}{/if} {if $bean->getAttribute('chnote')}{/if} {if $bean->getAttribute('chcost')}{/if} + {if $bean->getAttribute('chpaid')} {if $use_checkboxes} @@ -113,6 +116,7 @@ {if $bean->getAttribute('chduration')}{/if} {if $bean->getAttribute('chnote')}{/if} {if $bean->getAttribute('chcost')}{/if} + {if $bean->getAttribute('chpaid')}{/if} {if $bean->getAttribute('chinvoice')}{/if} {/if} @@ -130,6 +134,7 @@ {if $bean->getAttribute('chduration')}{/if} {if $bean->getAttribute('chnote')}{/if} {if $bean->getAttribute('chcost')}{/if} + {if $bean->getAttribute('chpaid')}{/if} {if $bean->getAttribute('chinvoice')}{/if} {/if} diff --git a/WEB-INF/templates/reports.tpl b/WEB-INF/templates/reports.tpl index 0f9b129f..c851a1c2 100644 --- a/WEB-INF/templates/reports.tpl +++ b/WEB-INF/templates/reports.tpl @@ -251,6 +251,9 @@ function handleCheckboxes() { {/if} {if ($user->canManageTeam() || $user->isClient()) && $user->isPluginEnabled('iv')} + {/if} + {if ($user->canManageTeam() && $user->isPluginEnabled('ps'))} + {/if} {/if} diff --git a/reports.php b/reports.php index 710de524..80e1e903 100644 --- a/reports.php +++ b/reports.php @@ -122,7 +122,7 @@ $form->addInput(array('type'=>'combobox', 'data'=>$include_options, 'empty'=>array(''=>$i18n->getKey('dropdown.all')))); -if ($user->isPluginEnabled('ps')) { +if ($user->canManageTeam() && $user->isPluginEnabled('ps')) { $form->addInput(array('type'=>'combobox', 'name'=>'paid_status', 'style'=>'width: 250px;', @@ -202,7 +202,8 @@ if (defined('COST_ON_REPORTS') && isTrue(COST_ON_REPORTS)) // If we have a custom field - add a checkbox for it. if ($custom_fields && $custom_fields->fields[0]) $form->addInput(array('type'=>'checkbox','name'=>'chcf_1')); - +if ($user->canManageTeam() && $user->isPluginEnabled('ps')) + $form->addInput(array('type'=>'checkbox','name'=>'chpaid')); // Add group by control. $group_by_options['no_grouping'] = $i18n->getKey('form.reports.group_by_no'); $group_by_options['date'] = $i18n->getKey('form.reports.group_by_date'); @@ -247,6 +248,7 @@ if ($request->isGet() && !$bean->isSaved()) { $form->setValueByElement('chfinish', '1'); $form->setValueByElement('chnote', '1'); $form->setValueByElement('chcf_1', '0'); + $form->setValueByElement('chpaid', '0'); $form->setValueByElement('chtotalsonly', '0'); } -- 2.20.1
 Anuko Time Tracker 1.15.2.3765 | Copyright © Anuko | +  Anuko Time Tracker 1.15.2.3766 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/report.tpl b/WEB-INF/templates/report.tpl index a05618db..432159d4 100644 --- a/WEB-INF/templates/report.tpl +++ b/WEB-INF/templates/report.tpl @@ -46,6 +46,7 @@ {if $bean->getAttribute('chduration')}{$i18n.label.duration}{$i18n.label.note}{$i18n.label.cost}{$i18n.label.paid}{$i18n.label.invoice}
{$subtotals[$prev_grouped_by]['time']}{if $user->canManageTeam() || $user->isClient()}{$subtotals[$prev_grouped_by]['cost']}{else}{$subtotals[$prev_grouped_by]['expenses']}{/if}
 
{$item.duration}{$item.note|escape}{if $user->canManageTeam() || $user->isClient()}{$item.cost}{else}{$item.expense}{/if}{if $item.paid == 1}{$i18n.label.yes}{else}{$i18n.label.no}{/if}{/if} {if $bean->getAttribute('chinvoice')} {$item.invoice|escape}{$subtotals[$cur_grouped_by]['time']}{if $user->canManageTeam() || $user->isClient()}{$subtotals[$cur_grouped_by]['cost']}{else}{$subtotals[$cur_grouped_by]['expenses']}{/if}
{$totals['time']}{$user->currency|escape} {if $user->canManageTeam() || $user->isClient()}{$totals['cost']}{else}{$totals['expenses']}{/if}