Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 701

Přidáno uživatelem Michal Kliment před asi 14 roky(ů)

Samotne finalni schvaleni (zamitnuti) vykazu jiz funguje. Jeste zbyva doresit
zobrazeni vykazu, editaci, vypis vsech schvalenych/zamitnutych vykazu, atd.

Zobrazit rozdíly:

freenetis/trunk/kohana/application/models/transfer.php
da.id AS da_id,
da.name AS da_name,
u.name, u.surname,
j.id AS job_id, j.description AS job_description
j.id AS job_id, j.description AS job_description,
jr.id AS job_report_id, jr.description AS job_report_description
FROM transfers t
LEFT JOIN accounts oa ON oa.id = t.origin_id
LEFT JOIN accounts da ON da.id = t.destination_id
LEFT JOIN users u ON t.user_id = u.id
LEFT JOIN jobs j ON j.transfer_id = t.id
WHERE t.id = $trans_id"
LEFT JOIN job_reports jr ON jr.id = j.job_report_id
WHERE t.id = $trans_id
GROUP BY t.id"
)->current();
}
freenetis/trunk/kohana/application/controllers/work_reports.php
if ($work_report->state > 1)
{
$link_back = '';
$state = '';
}
else
{
......
$approval_template_item_model = new Approval_template_item_Model();
$state = 0;
$amount = 0;
$approved_works_ids = array();
$rejected_works_ids = array();
$pending_works_ids = array();
foreach ($post_votes as $id => $post_vote)
{
$work = $work_model->where('id',$id)->find();
......
// set up state of work
$work->state = Votes_Controller::get_state($work, Vote_Model::$work);
$state = $work->state;
$work->save();
$work->save();
switch ($work->state)
{
case 1:
$pending_works_ids[] = $work->id;
break;
case 2:
$rejected_works_ids[] = $work->id;
break;
case 3:
$approved_works_ids[] = $work->id;
$amount += $work->suggest_amount;
break;
}
}
}
if (!count($pending_works_ids))
{
if (count($approved_works_ids))
{
if (count($rejected_works_ids))
{
$rejected_work_report = new Job_report_Model();
$rejected_work_report->description = $work_report->description;
$rejected_work_report->save();
foreach ($rejected_works_ids as $rejected_work_id)
{
$rejected_work = new Job_Model($rejected_work_id);
$rejected_work->job_report_id = $rejected_work_report->id;
$rejected_work->save();
}
}
// creates new transfer
$account_model = new Account_Model();
$transfer = new Transfer_Model();
// finding of operating account
$operating_account = $account_model->where('account_attribute_id', Account_attribute_Model::$operating)->find();
$transfer->origin_id = $operating_account->id;
// findind of account of member
$member_account = $account_model->where('member_id', $work->user->member_id)->where('account_attribute_id', Account_attribute_Model::$credit)->find();
$transfer->destination_id = $member_account->id;
$transfer->datetime = date('Y-m-d');
$transfer->creation_datetime = date('Y-m-d H:i:s');
$transfer->text = url_lang::lang('texts.Work report approval');
$transfer->amount = $amount;
$transfer->user_id = $this->session->get('user_id');
$transfer->save();
foreach ($approved_works_ids as $approved_work_id)
{
$approved_work = new Job_Model($approved_work_id);
$approved_work->transfer_id = $transfer->id;
$approved_work->save();
}
}
}
}
url::redirect(url::base().url::current(TRUE));
}
freenetis/trunk/kohana/application/views/transfers_show.php
<td><?php echo html::anchor(url_lang::base().'users/show/'.$transfer->user_id, $transfer->name.' '.$transfer->surname) ?></td>
</tr>
<?php } ?>
<?php if (isset($transfer->job_id)) { ?>
<?php if (isset($transfer->job_report_id)) { ?>
<tr>
<th><?php echo url_lang::lang('texts.Work report') ?></th>
<td><?php echo html::anchor(url_lang::base().'work_reports/show/'.$transfer->job_report_id, $transfer->job_report_description) ?></td>
</tr>
<?php } else if (isset($transfer->job_id)) { ?>
<tr>
<th><?php echo url_lang::lang('texts.Work') ?></th>
<td><?php echo html::anchor(url_lang::base().'works/show/'.$transfer->job_id, $transfer->job_description) ?></td>
</tr>

Také k dispozici: Unified diff