Merge branch '1.3-dev' of github.com:akaunting/akaunting into tax-rate

This commit is contained in:
cuneytsenturk
2018-11-07 11:19:52 +03:00
25 changed files with 290 additions and 92 deletions

View File

@ -267,7 +267,7 @@ class Bills extends Controller
$excel->sheet('bills', function ($sheet) use ($bills) {
$sheet->fromModel($bills->makeHidden([
'company_id', 'parent_id', 'created_at', 'updated_at', 'deleted_at', 'attachment', 'discount', 'items', 'histories', 'payments', 'totals', 'media'
'company_id', 'parent_id', 'created_at', 'updated_at', 'deleted_at', 'attachment', 'discount', 'items', 'histories', 'payments', 'totals', 'media', 'paid'
]));
});

View File

@ -279,7 +279,7 @@ class Invoices extends Controller
$excel->sheet('invoices', function ($sheet) use ($invoices) {
$sheet->fromModel($invoices->makeHidden([
'company_id', 'parent_id', 'created_at', 'updated_at', 'deleted_at', 'attachment', 'discount', 'items', 'histories', 'payments', 'totals', 'media'
'company_id', 'parent_id', 'created_at', 'updated_at', 'deleted_at', 'attachment', 'discount', 'items', 'histories', 'payments', 'totals', 'media', 'paid'
]));
});

View File

@ -104,7 +104,7 @@ class TaxSummary extends Controller
private function setAmount(&$items, &$totals, $rows, $type, $date_field)
{
foreach ($rows as $row) {
if ($row['table'] == 'bill_payments' || $row['table'] == 'invoice_payments') {
if ($row->getTable() == 'bill_payments' || $row->getTable() == 'invoice_payments') {
$type_row = $row->$type;
$row->category_id = $type_row->category_id;
@ -127,7 +127,14 @@ class TaxSummary extends Controller
continue;
}
$amount = $this->convert($row_total->amount, $row->currency_code, $row->currency_rate);
if ($date_field == 'paid_at') {
$rate = ($row->amount * 100) / $type_row->amount;
$row_amount = ($row_total->amount / 100) * $rate;
} else {
$row_amount = $row_total->amount;
}
$amount = $this->convert($row_amount, $row->currency_code, $row->currency_rate);
$items[$row_total->name][$date]['amount'] += $amount;

View File

@ -181,17 +181,17 @@ class Settings extends Controller
protected function oneCompany($key, $value)
{
switch ($key) {
case 'company_name':
Installer::updateEnv(['MAIL_FROM_NAME' => '"' . $value . '"']);
break;
case 'company_email':
Installer::updateEnv(['MAIL_FROM_ADDRESS' => $value]);
break;
case 'default_locale':
// Change default locale
Installer::updateEnv([
'APP_LOCALE' => $value
]);
Installer::updateEnv(['APP_LOCALE' => $value]);
break;
case 'session_handler':
// Change session handler
Installer::updateEnv([
'SESSION_DRIVER' => $value
]);
Installer::updateEnv(['SESSION_DRIVER' => $value]);
break;
}
}