Merge branch 'master' into feature/add-tests
This commit is contained in:
@ -282,7 +282,7 @@ class Users extends Controller
|
||||
}
|
||||
|
||||
// Redirect to items
|
||||
return redirect('items/items');
|
||||
return redirect('common/items');
|
||||
}
|
||||
|
||||
public function autocomplete(ARequest $request)
|
||||
|
@ -66,9 +66,15 @@ class Bills extends Controller
|
||||
$paid = 0;
|
||||
|
||||
foreach ($bill->payments as $item) {
|
||||
$item->default_currency_code = $bill->currency_code;
|
||||
$amount = $item->amount;
|
||||
|
||||
$paid += $item->getDynamicConvertedAmount();
|
||||
if ($bill->currency_code != $item->currency_code) {
|
||||
$item->default_currency_code = $bill->currency_code;
|
||||
|
||||
$amount = $item->getDynamicConvertedAmount();
|
||||
}
|
||||
|
||||
$paid += $amount;
|
||||
}
|
||||
|
||||
$bill->paid = $paid;
|
||||
@ -607,7 +613,7 @@ class Bills extends Controller
|
||||
for ($i = 0; $i < $currency->precision; $i++) {
|
||||
$multiplier *= 10;
|
||||
}
|
||||
|
||||
|
||||
$amount *= $multiplier;
|
||||
$total_amount *= $multiplier;
|
||||
|
||||
@ -713,9 +719,15 @@ class Bills extends Controller
|
||||
$paid = 0;
|
||||
|
||||
foreach ($bill->payments as $item) {
|
||||
$item->default_currency_code = $bill->currency_code;
|
||||
$amount = $item->amount;
|
||||
|
||||
$paid += $item->getDynamicConvertedAmount();
|
||||
if ($bill->currency_code != $item->currency_code) {
|
||||
$item->default_currency_code = $bill->currency_code;
|
||||
|
||||
$amount = $item->getDynamicConvertedAmount();
|
||||
}
|
||||
|
||||
$paid += $amount;
|
||||
}
|
||||
|
||||
$bill->paid = $paid;
|
||||
|
@ -675,9 +675,15 @@ class Invoices extends Controller
|
||||
$paid = 0;
|
||||
|
||||
foreach ($invoice->payments as $item) {
|
||||
$item->default_currency_code = $invoice->currency_code;
|
||||
$amount = $item->amount;
|
||||
|
||||
$paid += $item->getDynamicConvertedAmount();
|
||||
if ($invoice->currency_code != $item->currency_code) {
|
||||
$item->default_currency_code = $invoice->currency_code;
|
||||
|
||||
$amount = $item->getDynamicConvertedAmount();
|
||||
}
|
||||
|
||||
$paid += $amount;
|
||||
}
|
||||
|
||||
$amount = $invoice->amount - $paid;
|
||||
@ -691,7 +697,7 @@ class Invoices extends Controller
|
||||
$request['payment_method'] = setting('general.default_payment_method', 'offlinepayment.cash.1');
|
||||
$request['currency_code'] = $invoice->currency_code;
|
||||
$request['amount'] = $amount;
|
||||
$request['paid_at'] = Date::now();
|
||||
$request['paid_at'] = Date::now()->format('Y-m-d');
|
||||
$request['_token'] = csrf_token();
|
||||
|
||||
$this->payment($request);
|
||||
|
@ -101,6 +101,12 @@ class ExpenseSummary extends Controller
|
||||
private function setAmount(&$graph, &$totals, &$expenses, $items, $type, $date_field)
|
||||
{
|
||||
foreach ($items as $item) {
|
||||
if ($item['table'] == 'bill_payments') {
|
||||
$bill = $item->bill;
|
||||
|
||||
$item->category_id = $bill->category_id;
|
||||
}
|
||||
|
||||
$date = Date::parse($item->$date_field)->format('F');
|
||||
|
||||
if (!isset($expenses[$item->category_id])) {
|
||||
|
@ -138,6 +138,12 @@ class IncomeExpenseSummary extends Controller
|
||||
private function setAmount(&$graph, &$totals, &$compares, $items, $type, $date_field)
|
||||
{
|
||||
foreach ($items as $item) {
|
||||
if ($item['table'] == 'bill_payments' || $item['table'] == 'invoice_payments') {
|
||||
$type_item = $item->$type;
|
||||
|
||||
$item->category_id = $type_item->category_id;
|
||||
}
|
||||
|
||||
$date = Date::parse($item->$date_field)->format('F');
|
||||
|
||||
$group = (($type == 'invoice') || ($type == 'revenue')) ? 'income' : 'expense';
|
||||
|
@ -101,6 +101,12 @@ class IncomeSummary extends Controller
|
||||
private function setAmount(&$graph, &$totals, &$incomes, $items, $type, $date_field)
|
||||
{
|
||||
foreach ($items as $item) {
|
||||
if ($item['table'] == 'invoice_payments') {
|
||||
$invoice = $item->invoice;
|
||||
|
||||
$item->category_id = $invoice->category_id;
|
||||
}
|
||||
|
||||
$date = Date::parse($item->$date_field)->format('F');
|
||||
|
||||
if (!isset($incomes[$item->category_id])) {
|
||||
|
@ -155,6 +155,12 @@ class ProfitLoss extends Controller
|
||||
private function setAmount(&$totals, &$compares, $items, $type, $date_field)
|
||||
{
|
||||
foreach ($items as $item) {
|
||||
if ($item['table'] == 'bill_payments' || $item['table'] == 'invoice_payments') {
|
||||
$type_item = $item->$type;
|
||||
|
||||
$item->category_id = $type_item->category_id;
|
||||
}
|
||||
|
||||
$date = Date::parse($item->$date_field)->quarter;
|
||||
|
||||
$group = (($type == 'invoice') || ($type == 'revenue')) ? 'income' : 'expense';
|
||||
|
@ -103,6 +103,12 @@ 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') {
|
||||
$type_row = $row->$type;
|
||||
|
||||
$row->category_id = $type_row->category_id;
|
||||
}
|
||||
|
||||
$date = Date::parse($row->$date_field)->format('M');
|
||||
|
||||
if ($date_field == 'paid_at') {
|
||||
|
@ -36,9 +36,14 @@ class Info
|
||||
{
|
||||
return phpversion();
|
||||
}
|
||||
|
||||
public static function mysqlVersion()
|
||||
{
|
||||
if(env('DB_CONNECTION') === 'mysql')
|
||||
{
|
||||
return DB::selectOne('select version() as mversion')->mversion;
|
||||
}
|
||||
|
||||
public static function mysqlVersion()
|
||||
{
|
||||
return DB::selectOne('select version() as mversion')->mversion;
|
||||
}
|
||||
return "N/A";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user