Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1473

Přidáno uživatelem Ondřej Fibich před asi 12 roky(ů)

Oprava:
- chybne zaokrouhlovani u vykazu (#201)

Zobrazit rozdíly:

freenetis/branches/network/application/helpers/callback.php
echo $item->$name.'%';
}
/**
* Round value by first argument. If first argument is lower than 0,
* value is rouded right from decimal point, left otherwise.
*
* @author Ondrej Fibich
* @param object $item
* @param name $name
* @param array $args
*/
public static function round($item, $name, $args = array())
{
$precision = isset($args[0]) ? intval($args[0]) : 2;
echo round($item->$name, $precision);
}
/************** Callbacks for using in special ocations *******************/
/**
freenetis/branches/network/application/controllers/work_reports.php
$grid->order_callback_field('type')
->callback('callback::work_report_type');
$grid->order_field('hours');
$grid->order_callback_field('hours')
->callback('callback::round');
$grid->order_field('km');
$grid->order_callback_field('km')
->callback('callback::round');
$grid->order_callback_field('suggest_amount')
->callback('callback::money');
......
->link('users/show', 'uname')
->label('Worker');
$grid->order_field('description')
->label(__('Description'));
$grid->order_field('description');
$grid->order_callback_field('type')
->callback('callback::work_report_type');
$grid->order_field('hours')
->label(__('Hours'));
$grid->order_callback_field('hours')
->callback('callback::round');
$grid->order_field('km')
->label(__('Km'));
$grid->order_callback_field('km')
->callback('callback::round');
$grid->order_callback_field('suggest_amount')
->callback('callback::money');
$grid->order_callback_field('rating')
->label(__('Rating'))
->callback('callback::work_report_rating');
// access control
......
->link('users/show', 'uname')
->label('Worker');
$grid->order_field('description')
->label(__('Description'));
$grid->order_field('description');
$grid->order_callback_field('type')
->callback('callback::work_report_type');
$grid->order_field('hours')
->label(__('Hours'));
$grid->order_callback_field('hours')
->callback('callback::round');
$grid->order_field('km')
->label(__('Km'));
$grid->order_callback_field('km')
->callback('callback::round');
$grid->order_callback_field('suggest_amount')
->label(__('Suggest amount'))
->callback('callback::money');
$actions = $grid->grouped_action_field();
......
$concept_stats['suggest_amount'] += $concept->suggest_amount;
}
$concept_stats['hours'] = round($concept_stats['hours'], 2);
$concept_stats['kms'] = round($concept_stats['kms'], 2);
$grid_concepts = new Grid('work_reports/show_by_user' . $user->id, '', array
(
'use_paginator' => false,
......
$grid_concepts->callback_field('type')
->callback('callback::work_report_type');
$grid_concepts->field('hours');
$grid_concepts->callback_field('hours')
->callback('callback::round');
$grid_concepts->field('km');
$grid_concepts->callback_field('km')
->callback('callback::round');
$grid_concepts->callback_field('suggest_amount')
->callback('callback::money');
......
$pending_stats['suggest_amount'] += $pend->suggest_amount;
}
$pending_stats['hours'] = round($pending_stats['hours'], 2);
$pending_stats['kms'] = round($pending_stats['kms'], 2);
$grid_pending = new Grid('work_reports/show_by_user' . $user->id, '', array
(
'use_paginator' => false,
......
$grid_pending->callback_field('type')
->callback('callback::work_report_type');
$grid_pending->field('hours');
$grid_pending->callback_field('hours')
->callback('callback::round');
$grid_pending->field('km');
$grid_pending->callback_field('km')
->callback('callback::round');
$grid_pending->callback_field('suggest_amount')
->callback('callback::money');
......
$approved_stats['suggest_amount'] += $approve->rating;
}
$approved_stats['hours'] = round($approved_stats['hours']);
$approved_stats['kms'] = round($approved_stats['kms']);
$grid_approved = new Grid('work_reports/show_by_user' . $user->id, '', array
(
'use_paginator' => false,
......
$grid_approved->callback_field('type')
->callback('callback::work_report_type');
$grid_approved->field('hours');
$grid_approved->callback_field('hours')
->callback('callback::round');
$grid_approved->field('km');
$grid_approved->callback_field('km')
->callback('callback::round');
$grid_approved->callback_field('suggest_amount')
->callback('callback::money');
......
$pending_stats['suggest_amount'] += $reject->suggest_amount;
}
$pending_stats['hours'] = round($pending_stats['hours'], 2);
$pending_stats['kms'] = round($pending_stats['kms'], 2);
$grid_rejected = new Grid('work_reports/show_by_user' . $user->id, '', array
(
'use_paginator' => false,
......
$grid_rejected->callback_field('type')
->callback('callback::work_report_type');
$grid_rejected->field('hours');
$grid_rejected->callback_field('hours')
->callback('callback::round');
$grid_rejected->field('km');
$grid_rejected->callback_field('km')
->callback('callback::round');
$grid_rejected->callback_field('suggest_amount')
->callback('callback::money');
......
$works_grid->callback_field('description')
->callback('callback::limited_text');
$works_grid->field('hours');
$works_grid->callback_field('hours')
->callback('callback::round');
$works_grid->field('km');
$works_grid->callback_field('km')
->callback('callback::round');
$works_grid->callback_field('suggest_amount')
->callback('callback::money');
freenetis/branches/network/application/views/js/work_reports_show.php
$('#work_report__show_descr').click(function ()
{
$('#work_reports__show_grid tbody tr td:nth-child(2) .help').each(function (i)
var $tr = $('#work_reports__show_grid tbody tr');
$tr.find('td:nth-child(2) .help, td:nth-child(3) .help').each(function (i, e)
{
var shortcut = $(this).text();
var title = $(this).attr('title');
var shortcut = $(e).text();
var title = $(e).attr('title');
$(this).text(title);
$(this).attr('title', shortcut);
$(e).text(title).attr('title', shortcut);
});
work_report__show_descr__state = !work_report__show_descr__state;

Také k dispozici: Unified diff