updated money package to 5.0 version
This commit is contained in:
@@ -69,7 +69,7 @@ class CreateBankingDocumentTransaction extends Job implements ShouldCreate
|
||||
$this->request['company_id'] = $this->model->company_id;
|
||||
$this->request['currency_code'] = $currency_code;
|
||||
$this->request['paid_at'] = isset($this->request['paid_at']) ? $this->request['paid_at'] : Date::now()->toDateTimeString();
|
||||
$this->request['currency_rate'] = config('money.' . $currency_code . '.rate');
|
||||
$this->request['currency_rate'] = config('money.currencies.' . $currency_code . '.rate');
|
||||
$this->request['account_id'] = isset($this->request['account_id']) ? $this->request['account_id'] : setting('default.account');
|
||||
$this->request['document_id'] = isset($this->request['document_id']) ? $this->request['document_id'] : $this->model->id;
|
||||
$this->request['contact_id'] = isset($this->request['contact_id']) ? $this->request['contact_id'] : $this->model->contact_id;
|
||||
@@ -83,7 +83,7 @@ class CreateBankingDocumentTransaction extends Job implements ShouldCreate
|
||||
$code = $this->request['currency_code'];
|
||||
$rate = $this->request['currency_rate'];
|
||||
|
||||
$precision = config('money.' . $code . '.precision');
|
||||
$precision = config('money.currencies.' . $code . '.precision');
|
||||
|
||||
$amount = $this->request['amount'] = round($this->request['amount'], $precision);
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ class CreateTransfer extends Job implements HasOwner, HasSource, ShouldCreate
|
||||
$currency_rate = $this->request->get($type . '_account_rate');
|
||||
|
||||
if (empty($currency_rate)) {
|
||||
$currency_rate = config('money.' . $this->getCurrencyCode($type) . '.rate');
|
||||
$currency_rate = config('money.currencies.' . $this->getCurrencyCode($type) . '.rate');
|
||||
}
|
||||
|
||||
return $currency_rate;
|
||||
|
||||
@@ -42,7 +42,7 @@ class MatchBankingDocumentTransaction extends Job
|
||||
$code = $this->transaction->currency_code;
|
||||
$rate = $this->transaction->currency_rate;
|
||||
|
||||
$precision = config('money.' . $code . '.precision');
|
||||
$precision = config('money.currencies.' . $code . '.precision');
|
||||
|
||||
$amount = $this->transaction->amount = round($this->transaction->amount, $precision);
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class SplitTransaction extends Job implements ShouldUpdate
|
||||
$total_amount += $item['amount'];
|
||||
}
|
||||
|
||||
$precision = config('money.' . $this->model->currency_code . '.precision');
|
||||
$precision = config('money.currencies.' . $this->model->currency_code . '.precision');
|
||||
|
||||
$compare = bccomp($total_amount, $this->model->amount, $precision);
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class UpdateBankingDocumentTransaction extends Job implements ShouldUpdate
|
||||
$this->request['company_id'] = $this->model->company_id;
|
||||
$this->request['currency_code'] = $currency_code;
|
||||
$this->request['paid_at'] = isset($this->request['paid_at']) ? $this->request['paid_at'] : Date::now()->toDateTimeString();
|
||||
$this->request['currency_rate'] = config('money.' . $currency_code . '.rate');
|
||||
$this->request['currency_rate'] = config('money.currencies.' . $currency_code . '.rate');
|
||||
$this->request['account_id'] = isset($this->request['account_id']) ? $this->request['account_id'] : setting('default.account');
|
||||
$this->request['document_id'] = isset($this->request['document_id']) ? $this->request['document_id'] : $this->model->id;
|
||||
$this->request['contact_id'] = isset($this->request['contact_id']) ? $this->request['contact_id'] : $this->model->contact_id;
|
||||
@@ -82,7 +82,7 @@ class UpdateBankingDocumentTransaction extends Job implements ShouldUpdate
|
||||
$code = $this->request['currency_code'];
|
||||
$rate = $this->request['currency_rate'];
|
||||
|
||||
$precision = config('money.' . $code . '.precision');
|
||||
$precision = config('money.currencies.' . $code . '.precision');
|
||||
|
||||
$amount = $this->request['amount'] = round($this->request['amount'], $precision);
|
||||
|
||||
@@ -92,7 +92,7 @@ class UpdateBankingDocumentTransaction extends Job implements ShouldUpdate
|
||||
$amount = round($converted_amount, $precision);
|
||||
}
|
||||
|
||||
// if you edit transaction before remove transaction amount
|
||||
// if you edit transaction before remove transaction amount
|
||||
$this->model->paid_amount = ($this->model->paid - $this->transaction->amount);
|
||||
event(new PaidAmountCalculated($this->model));
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ class UpdateTransfer extends Job implements ShouldUpdate
|
||||
$currency_rate = $this->request->get($type . '_account_rate');
|
||||
|
||||
if (empty($currency_rate)) {
|
||||
$currency_rate = config('money.' . $this->getCurrencyCode($type) . '.rate');
|
||||
$currency_rate = config('money.currencies.' . $this->getCurrencyCode($type) . '.rate');
|
||||
}
|
||||
|
||||
return $currency_rate;
|
||||
|
||||
@@ -29,7 +29,7 @@ class CreateDocumentItem extends Job implements HasOwner, HasSource, ShouldCreat
|
||||
public function handle(): DocumentItem
|
||||
{
|
||||
$item_id = ! empty($this->request['item_id']) ? $this->request['item_id'] : 0;
|
||||
$precision = config('money.' . $this->document->currency_code . '.precision');
|
||||
$precision = config('money.currencies.' . $this->document->currency_code . '.precision');
|
||||
|
||||
$item_amount = (double) $this->request['price'] * (double) $this->request['quantity'];
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class CreateDocumentItemsAndTotals extends Job implements HasOwner, HasSource, S
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
$precision = config('money.' . $this->document->currency_code . '.precision');
|
||||
$precision = config('money.currencies.' . $this->document->currency_code . '.precision');
|
||||
|
||||
list($sub_total, $actual_total, $discount_amount_total, $taxes) = $this->createItems();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user