Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 858

Přidáno uživatelem Jiří Sviták před více než 13 roky(ů)

Oprava chyby u strhavani splatek za zarizeni zaclenena do hlavni vetve.

Zobrazit rozdíly:

freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php
'device admins' => 'Správci zařízení',
'device engineers' => 'Technici zařízení',
'device detail' => 'Detail zařízení',
'device fees have been successfully deducted' => 'Splátky zařízení byly úspěšně strženy.',
'device fees have been successfully deducted, %d new transfers created' => 'Splátky zařízení byly úspěšně strženy, vytvořeno %d nových převodů.',
'device has been successfully deleted' => 'Zařízení bylo úspěšně smazáno.',
'device has been successfully saved' => 'Zařízení bylo úspěšně uloženo.',
'device has been successfully updated' => 'Zařízení bylo úspěšně upraveno.',
freenetis/trunk/kohana/application/models/transfer.php
}
/**
* Used for deduction of device repayments.
* @author Jiri Svitak
* @param <type> $ca
* @param <type> $date
* @return <type>
*/
public function get_device_fee_transfers_of_account_and_date($ca, $date)
{
return $this->db->query("SELECT id FROM transfers WHERE type = ".Transfer_Model::$deduct_device_fee."
AND origin_id = $ca->id AND datetime LIKE '%$date%'");
}
/**
* @author Michal Kliment
* Gets all monthly amounts of incoming member payment for stats
* @return MySQL_Result object
freenetis/trunk/kohana/application/controllers/transfers.php
if (!$this->acl_check_new('Accounts_Controller', 'transfers'))
Controller::error(ACCESS);
// preparation
$created_transfers_count = 0;
$creation_datetime = date('Y-m-d H:i:s');
$operating = ORM::factory('account')->where('account_attribute_id', Account_attribute_Model::$operating)->find();
$account_model = new Account_Model();
......
}
// getting boundary date - 15th day in the month
$d = date('Y-m-d', mktime(0, 0, 0, $m, 15, $y));
echo "payments $payments<br>";
//echo "payments $payments<br>";
}
echo "buy date $device->buy_date, current date $date, end date $d<br>";
//echo "buy date $device->buy_date, current date $date, end date $d<br>";
// is current date between buying of device and date of its full repayment?
if ($device->buy_date <= $date && $date <= $d)
$payment_rate += $device->payment_rate;
echo "payment rate $payment_rate<br>";
//echo "payment rate $payment_rate<br>";
}
// is debt still greater than one monthly instalment?
if ($debt > $payment_rate)
......
{
$amount = $debt;
}
echo "<strong>date $date, amount $amount</strong><br>";
//echo "<strong>date $date, amount $amount</strong><br>";
// decrease amount of debt due to size of one instalment
$debt -= $amount;
//$transfer = ORM::factory('transfer')->where(array('type' => Transfer_Model::$deduct_device_fee, 'amount' => $amount,
// 'origin_id' => $ca->id, 'datetime' => $date))->find();
$db = new Database();
$transfers = $db->query("SELECT id FROM transfers WHERE type = ".Transfer_Model::$deduct_device_fee." AND amount = $amount AND origin_id = $ca->id AND datetime LIKE '%$date%'");
$transfers = $db->get_device_fee_transfers_of_account_and_date($ca, $date);
if ($amount > 0 && count($transfers) == 0)
{
Transfer_Model::insert_transfer($ca->id, $operating->id, null, null,
$this->session->get('user_id'), Transfer_Model::$deduct_device_fee,
$date, $creation_datetime, url_lang::lang('texts.Device repayments'), $amount);
$created_transfers_count++;
}
// iterate to next month
$month++;
......
}
}
$db->transaction_commit();
$this->session->set_flash('message', url_lang::lang('texts.Device fees have been successfully deducted.'));
$this->session->set_flash('message', url_lang::lang('texts.Device fees have been successfully deducted, %d new transfers created.', $created_transfers_count));
}
catch (ErrorException $e)
{
freenetis/trunk/kohana/application/controllers/devices.php
//$grid->order_field('segment_name')->label(url_lang::lang('texts.Segment'));
$grid->order_callback_field('ip_address')->label(url_lang::lang('texts.IP address'))->callback('callback::ip_address_field');
$grid->order_callback_field('subnet_name')->label(url_lang::lang('texts.Subnet'))->callback('callback::subnet_field');
//if ($this->acl_check_view(get_class($this),'devices',$user->member_id))
// $grid->action_field('device_id')->label(url_lang::lang('texts.Device'))->url(url_lang::base().'devices/show')->action(url_lang::lang('texts.Show'))->class('center');
if ($this->acl_check_view(get_class($this),'devices',$user->member_id))
$grid->action_field('device_id')->label(url_lang::lang('texts.Device'))->url(url_lang::base().'devices/show')->action(url_lang::lang('texts.Show'))->class('center');
//if ($this->acl_check_edit(get_class($this),'devices',$user->member_id))
// $grid->action_field('id')->label(url_lang::lang('texts.Device'))->url(url_lang::base().'devices/edit')->action(url_lang::lang('texts.Edit'))->class('center');
if ($this->acl_check_delete('Devices_Controller', 'devices', $user->member_id))

Také k dispozici: Unified diff