[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [14245] more on controller
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [14245] more on controller |
Date: |
Thu, 29 Oct 2015 16:59:55 +0000 |
Revision: 14245
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14245
Author: sigurdne
Date: 2015-10-29 16:59:55 +0000 (Thu, 29 Oct 2015)
Log Message:
-----------
more on controller
Modified Paths:
--------------
trunk/controller/inc/class.uicomponent.inc.php
trunk/controller/setup/phpgw_no.lang
trunk/controller/templates/base/component.xsl
Modified: trunk/controller/inc/class.uicomponent.inc.php
===================================================================
--- trunk/controller/inc/class.uicomponent.inc.php 2015-10-29 00:35:31 UTC
(rev 14244)
+++ trunk/controller/inc/class.uicomponent.inc.php 2015-10-29 16:59:55 UTC
(rev 14245)
@@ -268,6 +268,12 @@
'toolbar' => array(
'item' => array(
array('type' =>
'filter',
+ 'name' =>
'report_type',
+ 'text' =>
lang('report type'),
+ 'list' =>
array(array('id' => 'components', 'name' => lang('components')), array('id' =>
'summary', 'name' => lang('summary'))),
+ 'onchange'
=> 'update_table();'
+ ),
+ array('type' =>
'filter',
'name' =>
'entity_group_id',
'text' =>
lang('entity group'),
'list' =>
execMethod('property.bogeneric.get_list',array('type' => 'entity_group',
'selected' => phpgw::get_var('entity_group_id'), 'add_empty' => true)),
@@ -463,6 +469,7 @@
$all_items = phpgw::get_var('all_items', 'bool');
$user_only = phpgw::get_var('user_only', 'bool');
$filter_status = phpgw::get_var('status', 'string');
+ $report_type = phpgw::get_var('report_type', 'string');
if($filter_component_str =
phpgw::get_var('filter_component', 'string'))
{
$filter_component_arr = explode('_',
$filter_component_str);
@@ -827,6 +834,15 @@
unset($component_id);
unset($component);
+ if($report_type == 'summary')
+ {
+ return array(
+ 'components' => null,
+ 'summary' =>
$this->get_summary($values),
+ 'location_filter' => $location_filter
+ );
+ }
+
$choose_master = false;
if($all_components && count($all_components))
{
@@ -990,7 +1006,11 @@
$result['checkall'] = '';
}
- return $result;
+ return array(
+ 'components' => $result,
+ 'summary' => null,
+ 'location_filter' => $location_filter
+ );
}
private function translate_calendar_info($param = array(),
$year, $month, $filter_status = '', &$found_at_least_one = false,
$keep_only_assigned_to)
@@ -1116,6 +1136,167 @@
return
"{$repeat_type}<br/>{$link}<br/>{$assigned_to}<br/>{$time}";
}
+ private function get_summary($data)
+ {
+
+
+ $summary = array(
+ "CONTROL_NOT_DONE" => array(
+ 'name' => 'Ikke utført',
+ 'img' => "<img height=\"15\"
src=\"controller/images/status_icon_red_cross.png\" title=\"Ikke utført\"/>"
+ ),
+ "CONTROL_REGISTERED" => array(
+ 'name' => 'Registrert',
+ 'img' => "<img height=\"15\"
src=\"controller/images/status_icon_yellow_ring.png\" title=\"Registrert\"/>"
+ ),
+ "CONTROL_PLANNED" => array(
+ 'name' => 'Planlagt',
+ 'img' => "<img height=\"15\"
src=\"controller/images/status_icon_yellow.png\" title=\"Planlagt\"/>"
+ ),
+ "CONTROL_NOT_DONE_WITH_PLANNED_DATE" => array(
+ 'name' => 'Forsinket, Ikke utført',
+ 'img' => "<img height=\"15\"
src=\"controller/images/status_icon_red_cross.png\" title=\"Forsinket, Ikke
utført\"/>"
+ ),
+ "CONTROL_DONE_OVER_TIME_WITHOUT_ERRORS" =>
array(
+ 'name' => 'Senere enn planagt',
+ 'img' => "<img height=\"15\"
src=\"controller/images/status_icon_light_green.png\" title=\"Senere enn
planagt\"/>"
+ ),
+ "CONTROL_DONE_IN_TIME_WITHOUT_ERRORS" => array(
+ 'name' => 'Utført uten avvik',
+ 'img' => "<img height=\"15\"
src=\"controller/images/status_icon_dark_green.png\" title=\"Utført uten
avvik\"/>"
+ ),
+ "CONTROL_DONE_WITH_ERRORS" => array(
+ 'name' => 'Utført med åpne avvik',
+ 'img' => "<img height=\"15\"
src=\"controller/images/status_icon_red_empty.png\" title=\"Utført med åpne
avvik\"/>"
+ ),
+ "CONTROL_CANCELED" => array(
+ 'name' => 'kansellert',
+ 'img' => "<img height=\"15\"
src=\"controller/images/status_icon_black_cross.png\" title=\"kansellert\"/>"
+ )
+ );
+
+
+ foreach($data as $entry)
+ {
+
+ for ( $_month=1; $_month < 13; $_month++ )
+ {
+ if(isset($entry[$_month]['status']))
+ {
+
$summary[$entry[$_month]['status']][$_month]['count'] +=1;
+
$summary[$entry[$_month]['status']][$_month]['billable_hours'] +=
$entry[$_month]['info']['billable_hours'];
+ }
+
+ }
+ }
+
+ $sum = array();
+ $fields = $this->get_fields();
+ $html = <<<HTML
+
+ <table id="summary">
+ <thead>
+ <tr>
+ <th>
+ </th>
+ <th>
+
+ </th>
+ <th>
+ Status
+ </th>
+HTML;
+
+ foreach($fields as $field)
+ {
+ if((int) $field['key'])
+ {
+ $html .= <<<HTML
+
+ <th>
+ {$field['label']}
+ </th>
+HTML;
+ }
+ }
+ $html .= <<<HTML
+
+ </tr>
+ </thead>
+ <tbody>
+HTML;
+ unset($_month);
+ foreach($summary as $status => $values)
+ {
+ $html .= <<<HTML
+
+ <tr>
+ <td>
+ {$values['img']}
+ </td>
+ <td>
+ Antall:</br>Tidsbruk:
+ </td>
+ <td>
+ {$values['name']}
+ </td>
+HTML;
+ for ( $_month=1; $_month < 13; $_month++ )
+ {
+ $value = '';
+ if(isset($values[$_month]))
+ {
+ $value =
"{$values[$_month]['count']}</br>{$values[$_month]['billable_hours']}";
+ $sum[$_month]['count'] +=
$values[$_month]['count'];
+ $sum[$_month]['billable_hours']
+= $values[$_month]['billable_hours'];
+ }
+ $html .= <<<HTML
+
+ <td>
+ {$value}
+ </td>
+HTML;
+ }
+
+ }
+ $html .= <<<HTML
+
+ </tr>
+ </tbody>
+HTML;
+ $html .= <<<HTML
+ <tfoot>
+ <tr>
+ <td>
+ </td>
+ <td>
+ Totalt
+ </td>
+ <td>
+ </td>
+HTML;
+ foreach($fields as $field)
+ {
+ if((int) $field['key'])
+ {
+ $html .= <<<HTML
+
+ <td>
+
{$sum[$field['key']]['count']}</br>{$sum[$field['key']]['billable_hours']}
+ </td>
+HTML;
+ }
+ }
+ $html .= <<<HTML
+ </tr>
+ </tfoot>
+
+ </table>
+HTML;
+
+ return $html;
+ }
+
function get_start_month_for_control($control)
{
// Checks if control starts in the year that is
displayed
Modified: trunk/controller/setup/phpgw_no.lang
===================================================================
--- trunk/controller/setup/phpgw_no.lang 2015-10-29 00:35:31 UTC (rev
14244)
+++ trunk/controller/setup/phpgw_no.lang 2015-10-29 16:59:55 UTC (rev
14245)
@@ -386,4 +386,7 @@
controle time common no Kontrolltid
service time common no Servicetid
total time common no Totaltid
-request ical event controller no Send MøteInnkalling
\ No newline at end of file
+request ical event controller no Send MøteInnkalling
+summary common no Sammendrag
+components controller no Komponenter
+report type controller no Rapport type
\ No newline at end of file
Modified: trunk/controller/templates/base/component.xsl
===================================================================
--- trunk/controller/templates/base/component.xsl 2015-10-29 00:35:31 UTC
(rev 14244)
+++ trunk/controller/templates/base/component.xsl 2015-10-29 16:59:55 UTC
(rev 14245)
@@ -173,6 +173,31 @@
color: #000000;
background-color: #EAF2D3;
}
+#summary {
+ font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
+ width: 100%;
+ border-collapse: collapse;
+}
+
+#summary td, #summary th {
+ font-size: 1em;
+ border: 1px solid #98bf21;
+ padding: 3px 7px 2px 7px;
+}
+
+#summary th {
+ font-size: 1.1em;
+ text-align: left;
+ padding-top: 5px;
+ padding-bottom: 4px;
+ background-color: green;
+ color: #ffffff;
+}
+
+#summary tr.alt td {
+ color: #000000;
+ background-color: #EAF2D3;
+}
</style>
<xsl:call-template name="datasource-definition" />
@@ -273,26 +298,8 @@
success: function(data) {
if( data != null)
{
- $("#tbody").html(data.tbody);
- var time_sum = data.time_sum;
- var time_sum_actual =
data.time_sum_actual;
-
-
$("#checkall").html(data.checkall);
-
$("#total_records").html(data.total_records);
- $("#sum_text").html('Sum');
- $("#month0").html(time_sum[0] +
'/' + time_sum_actual[0]);
- $("#month1").html(time_sum[1] +
'/' + time_sum_actual[1]);
- $("#month2").html(time_sum[2] +
'/' + time_sum_actual[2]);
- $("#month3").html(time_sum[3] +
'/' + time_sum_actual[3]);
- $("#month4").html(time_sum[4] +
'/' + time_sum_actual[4]);
- $("#month5").html(time_sum[5] +
'/' + time_sum_actual[5]);
- $("#month6").html(time_sum[6] +
'/' + time_sum_actual[6]);
- $("#month7").html(time_sum[7] +
'/' + time_sum_actual[7]);
- $("#month8").html(time_sum[8] +
'/' + time_sum_actual[8]);
- $("#month9").html(time_sum[9] +
'/' + time_sum_actual[9]);
- $("#month10").html(time_sum[10]
+ '/' + time_sum_actual[10]);
- $("#month11").html(time_sum[11]
+ '/' + time_sum_actual[11]);
- $("#month12").html(time_sum[12]
+ '/' + time_sum_actual[12]);
+ var components_data =
data.components;
+ var summary_data = data.summary;
if(data.location_filter)
{
var obj =
data.location_filter;
@@ -325,6 +332,43 @@
$("#location_id").html(
htmlString );
}
+
+ if(components_data !==null)
+ {
+
$("#tbody").html(components_data.tbody);
+ var time_sum =
components_data.time_sum;
+ var time_sum_actual =
components_data.time_sum_actual;
+
+
$("#checkall").html(components_data.checkall);
+
$("#total_records").html(components_data.total_records);
+
$("#sum_text").html('Sum');
+
$("#month0").html(time_sum[0] + '/' + time_sum_actual[0]);
+
$("#month1").html(time_sum[1] + '/' + time_sum_actual[1]);
+
$("#month2").html(time_sum[2] + '/' + time_sum_actual[2]);
+
$("#month3").html(time_sum[3] + '/' + time_sum_actual[3]);
+
$("#month4").html(time_sum[4] + '/' + time_sum_actual[4]);
+
$("#month5").html(time_sum[5] + '/' + time_sum_actual[5]);
+
$("#month6").html(time_sum[6] + '/' + time_sum_actual[6]);
+
$("#month7").html(time_sum[7] + '/' + time_sum_actual[7]);
+
$("#month8").html(time_sum[8] + '/' + time_sum_actual[8]);
+
$("#month9").html(time_sum[9] + '/' + time_sum_actual[9]);
+
$("#month10").html(time_sum[10] + '/' + time_sum_actual[10]);
+
$("#month11").html(time_sum[11] + '/' + time_sum_actual[11]);
+
$("#month12").html(time_sum[12] + '/' + time_sum_actual[12]);
+ }
+
+ if(summary_data !== null)
+ {
+ $( "#status_summary"
).show();
+ $( "#components"
).hide();
+ $(
"#status_summary").html(summary_data);
+ }
+ else
+ {
+ $( "#status_summary"
).hide();
+ $( "#components"
).show();
+
+ }
}
}
@@ -364,7 +408,7 @@
success: function(data) {
if( data != null)
{
-console.log(data);
+//console.log(data);
var message = data.message;
htmlString = "";
@@ -450,5 +494,8 @@
</thead>
<tbody id="tbody"></tbody>
</table>
+ <div id="status_summary">
+
+ </div>
</xsl:template>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [14245] more on controller,
Sigurd Nes <=