Fixed fav reports to include paid status.
authorNik Okuntseff <support@anuko.com>
Sun, 21 Jan 2018 22:13:23 +0000 (22:13 +0000)
committerNik Okuntseff <support@anuko.com>
Sun, 21 Jan 2018 22:13:23 +0000 (22:13 +0000)
WEB-INF/lib/ttFavReportHelper.class.php
WEB-INF/lib/ttReportHelper.class.php
WEB-INF/templates/footer.tpl

index a1ea8bc..06b745c 100644 (file)
@@ -80,8 +80,8 @@ class ttFavReportHelper {
     $mdb2 = getConnection();
 
     $sql = "insert into tt_fav_reports (name, user_id, client_id, cf_1_option_id, project_id, task_id,
-      billable, invoice, users, period, period_start, period_end,
-      show_client, show_invoice,
+      billable, invoice, paid_status, users, period, period_start, period_end,
+      show_client, show_invoice, show_paid,
       show_project, show_start, show_duration, show_cost,
       show_task, show_end, show_note, show_custom_field_1,
       group_by, show_totals_only)
@@ -90,9 +90,10 @@ class ttFavReportHelper {
       $mdb2->quote($fields['client']).", ".$mdb2->quote($fields['option']).", ".
       $mdb2->quote($fields['project']).", ".$mdb2->quote($fields['task']).", ".
       $mdb2->quote($fields['billable']).", ".$mdb2->quote($fields['invoice']).", ".
+      $mdb2->quote($fields['paid_status']).", ".
       $mdb2->quote($fields['users']).", ".$mdb2->quote($fields['period']).", ".
       $mdb2->quote($fields['from']).", ".$mdb2->quote($fields['to']).", ".
-      $fields['chclient'].", ".$fields['chinvoice'].", ".
+      $fields['chclient'].", ".$fields['chinvoice'].", ".$fields['chpaid'].", ".
       $fields['chproject'].", ".$fields['chstart'].", ".$fields['chduration'].", ".$fields['chcost'].", ".
       $fields['chtask'].", ".$fields['chfinish'].", ".$fields['chnote'].", ".$fields['chcf_1'].", ".
       $mdb2->quote($fields['group_by']).", ".$fields['chtotalsonly'].")";
@@ -120,12 +121,14 @@ class ttFavReportHelper {
       "task_id = ".$mdb2->quote($fields['task']).", ".
       "billable = ".$mdb2->quote($fields['billable']).", ".
       "invoice = ".$mdb2->quote($fields['invoice']).", ".
+      "paid_status = ".$mdb2->quote($fields['paid_status']).", ".
       "users = ".$mdb2->quote($fields['users']).", ".
       "period = ".$mdb2->quote($fields['period']).", ".
       "period_start = ".$mdb2->quote($fields['from']).", ".
       "period_end = ".$mdb2->quote($fields['to']).", ".
       "show_client = ".$fields['chclient'].", ".
       "show_invoice = ".$fields['chinvoice'].", ".
+      "show_paid = ".$fields['chpaid'].", ".
       "show_project = ".$fields['chproject'].", ".
       "show_start = ".$fields['chstart'].", ".
       "show_duration = ".$fields['chduration'].", ".
@@ -152,6 +155,7 @@ class ttFavReportHelper {
     //  Later in this function we use it to construct $fields array to update database.
     if (!$bean->getAttribute('chclient')) $bean->setAttribute('chclient', 0);
     if (!$bean->getAttribute('chinvoice')) $bean->setAttribute('chinvoice', 0);
+    if (!$bean->getAttribute('chpaid')) $bean->setAttribute('chpaid', 0);
     if (!$bean->getAttribute('chproject')) $bean->setAttribute('chproject', 0);
     if (!$bean->getAttribute('chstart')) $bean->setAttribute('chstart', 0);
     if (!$bean->getAttribute('chduration')) $bean->setAttribute('chduration', 0);
@@ -198,12 +202,14 @@ class ttFavReportHelper {
       'task'=>$bean->getAttribute('task'),
       'billable'=>$bean->getAttribute('include_records'),
       'invoice'=>$bean->getAttribute('invoice'),
+      'paid_status'=>$bean->getAttribute('paid_status'),
       'users'=>$users,
       'period'=>$bean->getAttribute('period'),
       'from'=>$from,
       'to'=>$to,
       'chclient'=>$bean->getAttribute('chclient'),
       'chinvoice'=>$bean->getAttribute('chinvoice'),
+      'chpaid'=>$bean->getAttribute('chpaid'),
       'chproject'=>$bean->getAttribute('chproject'),
       'chstart'=>$bean->getAttribute('chstart'),
       'chduration'=>$bean->getAttribute('chduration'),
@@ -249,6 +255,7 @@ class ttFavReportHelper {
       $bean->setAttribute('task', $val['task_id']);
       $bean->setAttribute('include_records', $val['billable']);
       $bean->setAttribute('invoice', $val['invoice']);
+      $bean->setAttribute('paid_status', $val['paid_status']);
       if ($val['users'])
         $bean->setAttribute('users', explode(',', $val['users']));
       else {
@@ -272,6 +279,7 @@ class ttFavReportHelper {
       }
       $bean->setAttribute('chclient', $val['show_client']);
       $bean->setAttribute('chinvoice', $val['show_invoice']);
+      $bean->setAttribute('chpaid', $val['show_paid']);
       $bean->setAttribute('chproject', $val['show_project']);
       $bean->setAttribute('chstart', $val['show_start']);
       $bean->setAttribute('chduration', $val['show_duration']);
index 41ddd0f..2e2113d 100644 (file)
@@ -98,6 +98,8 @@ class ttReportHelper {
     if ($report['billable']=='2') $dropdown_parts .= ' and l.billable = 0';
     if ($report['invoice']=='1') $dropdown_parts .= ' and l.invoice_id is not NULL';
     if ($report['invoice']=='2') $dropdown_parts .= ' and l.invoice_id is NULL';
+    if ($report['paid_status']=='1') $dropdown_parts .= ' and l.paid = 1';
+    if ($report['paid_status']=='2') $dropdown_parts .= ' and l.paid = 0';
 
     // Prepare user list part.
     $userlist = -1;
@@ -1448,6 +1450,8 @@ class ttReportHelper {
         $body .= '<td style="'.$tableHeader.'">'.$i18n->getKey('label.note').'</td>';
       if ($report['show_cost'])
         $body .= '<td style="'.$tableHeaderCentered.'" width="5%">'.$i18n->getKey('label.cost').'</td>';
+      if ($report['show_paid'])
+        $body .= '<td style="'.$tableHeaderCentered.'" width="5%">'.$i18n->getKey('label.paid').'</td>';
       if ($report['show_invoice'])
         $body .= '<td style="'.$tableHeader.'">'.$i18n->getKey('label.invoice').'</td>';
       $body .= '</tr>';
@@ -1489,6 +1493,7 @@ class ttReportHelper {
                 $body .= ($user->canManageTeam() || $user->isClient()) ? $subtotals[$prev_grouped_by]['cost'] : $subtotals[$prev_grouped_by]['expenses'];
                 $body .= '</td>';
               }
+              if ($report['show_paid']) $body .= '<td></td>';
               if ($report['show_invoice']) $body .= '<td></td>';
               $body .= '</tr>';
               $body .= '<tr><td>&nbsp;</td></tr>';
@@ -1521,6 +1526,11 @@ class ttReportHelper {
             $body .= '<td style="'.$cellLeftAligned.'">'.htmlspecialchars($record['note']).'</td>';
           if ($report['show_cost'])
             $body .= '<td style="'.$cellRightAligned.'">'.$record['cost'].'</td>';
+          if ($report['show_paid']) {
+            $body .= '<td style="'.$cellRightAligned.'">';
+            $body .= $record['paid'] == 1 ? $i18n->getKey('label.yes') : $i18n->getKey('label.no');
+            $body .= '</td>';
+          }
           if ($report['show_invoice'])
             $body .= '<td style="'.$cellRightAligned.'">'.htmlspecialchars($record['invoice']).'</td>';
           $body .= '</tr>';
@@ -1550,6 +1560,7 @@ class ttReportHelper {
           $body .= ($user->canManageTeam() || $user->isClient()) ? $subtotals[$cur_grouped_by]['cost'] : $subtotals[$cur_grouped_by]['expenses'];
           $body .= '</td>';
         }
+        if ($report['show_paid']) $body .= '<td></td>';
         if ($report['show_invoice']) $body .= '<td></td>';
         $body .= '</tr>';
       }
@@ -1572,6 +1583,7 @@ class ttReportHelper {
         $body .= ($user->canManageTeam() || $user->isClient()) ? $totals['cost'] : $totals['expenses'];
         $body .= '</td>';
       }
+      if ($report['show_paid']) $body .= '<td></td>';
       if ($report['show_invoice']) $body .= '<td></td>';
       $body .= '</tr>';
 
index 1df0523..bbe6e90 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.16.0.3773 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.16.0.3774 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>