Merge branch 'master' of https://github.com/brkcvn/akaunting into code-clean
This commit is contained in:
@@ -204,7 +204,7 @@ class DocumentTransactions extends Controller
|
||||
|
||||
$response['redirect'] = route($route . '.show', $document->id);
|
||||
|
||||
$message = trans('messages.success.added', ['type' => trans_choice('general.payments', 1)]);
|
||||
$message = trans('messages.success.updated', ['type' => trans_choice('general.payments', 1)]);
|
||||
|
||||
flash($message)->success();
|
||||
} else {
|
||||
|
||||
@@ -69,10 +69,10 @@ class Document extends FormRequest
|
||||
|
||||
if ($items) {
|
||||
foreach ($items as $key => $item) {
|
||||
$size = 5;
|
||||
$size = 10;
|
||||
|
||||
if (Str::contains($item['quantity'], ['.', ','])) {
|
||||
$size = 7;
|
||||
$size = 12;
|
||||
}
|
||||
|
||||
$rules['items.' . $key . '.quantity'] = 'required|max:' . $size;
|
||||
|
||||
@@ -7,7 +7,7 @@ use Illuminate\Support\Str;
|
||||
|
||||
class DocumentItem extends FormRequest
|
||||
{
|
||||
protected $quantity_size = 5;
|
||||
protected $quantity_size = 10;
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
@@ -17,7 +17,7 @@ class DocumentItem extends FormRequest
|
||||
public function rules()
|
||||
{
|
||||
if (Str::contains($this->request->get('quantity'), ['.', ','])) {
|
||||
$this->quantity_size = 7;
|
||||
$this->quantity_size = 12;
|
||||
}
|
||||
|
||||
return [
|
||||
|
||||
@@ -56,14 +56,14 @@ class UpdateBankingDocumentTransaction extends Job implements ShouldUpdate
|
||||
|
||||
protected function prepareRequest(): void
|
||||
{
|
||||
if (!isset($this->request['amount'])) {
|
||||
if (! isset($this->request['amount'])) {
|
||||
$this->model->paid_amount = $this->model->paid;
|
||||
event(new PaidAmountCalculated($this->model));
|
||||
|
||||
$this->request['amount'] = $this->model->amount - $this->model->paid_amount;
|
||||
}
|
||||
|
||||
$currency_code = !empty($this->request['currency_code']) ? $this->request['currency_code'] : $this->model->currency_code;
|
||||
$currency_code = ! empty($this->request['currency_code']) ? $this->request['currency_code'] : $this->model->currency_code;
|
||||
|
||||
$this->request['company_id'] = $this->model->company_id;
|
||||
$this->request['currency_code'] = isset($this->request['currency_code']) ? $this->request['currency_code'] : $this->model->currency_code;
|
||||
@@ -92,7 +92,8 @@ class UpdateBankingDocumentTransaction extends Job implements ShouldUpdate
|
||||
$amount = round($converted_amount, $precision);
|
||||
}
|
||||
|
||||
$this->model->paid_amount = $this->model->paid;
|
||||
// if you edit transaction before remove transaction amount
|
||||
$this->model->paid_amount = ($this->model->paid - $this->transaction->amount);
|
||||
event(new PaidAmountCalculated($this->model));
|
||||
|
||||
$total_amount = round($this->model->amount - $this->model->paid_amount, $precision);
|
||||
|
||||
@@ -53,10 +53,17 @@ class CashFlow extends Widget
|
||||
->setDataset(trans('general.outgoing'), 'column', $expense)
|
||||
->setDataset(trans_choice('general.profits', 1), 'line', $profit);
|
||||
|
||||
$incoming_amount = money(array_sum($income), setting('default.currency'), true);
|
||||
$outgoing_amount = money(abs(array_sum($expense)), setting('default.currency'), true);
|
||||
$profit_amount = money(array_sum($profit), setting('default.currency'), true);
|
||||
|
||||
$totals = [
|
||||
'incoming' => money(array_sum($income), setting('default.currency'), true),
|
||||
'outgoing' => money(abs(array_sum($expense)), setting('default.currency'), true),
|
||||
'profit' => money(array_sum($profit), setting('default.currency'), true),
|
||||
'incoming_exact' => $incoming_amount->format(),
|
||||
'incoming_for_humans' => $incoming_amount->formatForHumans(),
|
||||
'outgoing_exact' => $outgoing_amount->format(),
|
||||
'outgoing_for_humans' => $outgoing_amount->formatForHumans(),
|
||||
'profit_exact' => $profit_amount->format(),
|
||||
'profit_for_humans' => $profit_amount->formatForHumans(),
|
||||
];
|
||||
|
||||
return $this->view('widgets.cash_flow', [
|
||||
|
||||
Reference in New Issue
Block a user