mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 04:01:10 -04:00
solve payment issue
This commit is contained in:
@ -442,7 +442,7 @@ class Payment extends Model implements HasMedia
|
|||||||
|
|
||||||
$serial = (new SerialNumberFormatter())
|
$serial = (new SerialNumberFormatter())
|
||||||
->setModel(new Payment())
|
->setModel(new Payment())
|
||||||
->setCompany(request()->header('company'))
|
->setCompany($invoice->company_id)
|
||||||
->setCustomer($invoice->customer_id)
|
->setCustomer($invoice->customer_id)
|
||||||
->setNextNumbers();
|
->setNextNumbers();
|
||||||
|
|
||||||
@ -455,7 +455,7 @@ class Payment extends Model implements HasMedia
|
|||||||
$data['exchange_rate'] = $invoice->exchange_rate;
|
$data['exchange_rate'] = $invoice->exchange_rate;
|
||||||
$data['base_amount'] = $data['amount'] * $data['exchange_rate'];
|
$data['base_amount'] = $data['amount'] * $data['exchange_rate'];
|
||||||
$data['currency_id'] = $invoice->currency_id;
|
$data['currency_id'] = $invoice->currency_id;
|
||||||
$data['company_id'] = request()->header('company');
|
$data['company_id'] = $invoice->company_id;
|
||||||
$data['transaction_id'] = $transaction->id;
|
$data['transaction_id'] = $transaction->id;
|
||||||
|
|
||||||
$payment = Payment::create($data);
|
$payment = Payment::create($data);
|
||||||
|
|||||||
@ -36,6 +36,11 @@ class PaymentMethod extends Model
|
|||||||
return $this->belongsTo(Company::class);
|
return $this->belongsTo(Company::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function scopeWhereCompanyId($query, $id)
|
||||||
|
{
|
||||||
|
$query->where('company_id', $id);
|
||||||
|
}
|
||||||
|
|
||||||
public function scopeWhereCompany($query)
|
public function scopeWhereCompany($query)
|
||||||
{
|
{
|
||||||
$query->where('company_id', request()->header('company'));
|
$query->where('company_id', request()->header('company'));
|
||||||
@ -48,7 +53,7 @@ class PaymentMethod extends Model
|
|||||||
|
|
||||||
public function scopeWhereSearch($query, $search)
|
public function scopeWhereSearch($query, $search)
|
||||||
{
|
{
|
||||||
$query->where('name', 'LIKE', '%' . $search . '%');
|
$query->where('name', 'LIKE', '%'.$search.'%');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeApplyFilters($query, array $filters)
|
public function scopeApplyFilters($query, array $filters)
|
||||||
@ -88,8 +93,7 @@ class PaymentMethod extends Model
|
|||||||
|
|
||||||
public static function getSettings($id)
|
public static function getSettings($id)
|
||||||
{
|
{
|
||||||
$settings = PaymentMethod::whereCompany()
|
$settings = PaymentMethod::find($id)
|
||||||
->find($id)
|
|
||||||
->settings;
|
->settings;
|
||||||
|
|
||||||
return $settings;
|
return $settings;
|
||||||
|
|||||||
Reference in New Issue
Block a user