fixed #262
This commit is contained in:
parent
f358796388
commit
4d05971b50
@ -589,25 +589,23 @@ class Bills extends Controller
|
|||||||
{
|
{
|
||||||
$bill = Bill::find($payment->bill_id);
|
$bill = Bill::find($payment->bill_id);
|
||||||
|
|
||||||
$status = 'received';
|
|
||||||
|
|
||||||
if ($bill->payments()->count() > 1) {
|
if ($bill->payments()->count() > 1) {
|
||||||
$bill->bill_status_code = 'partial';
|
$bill->bill_status_code = 'partial';
|
||||||
|
} else {
|
||||||
|
$bill->bill_status_code = 'received';
|
||||||
}
|
}
|
||||||
|
|
||||||
$bill->bill_status_code = $status;
|
|
||||||
|
|
||||||
$bill->save();
|
$bill->save();
|
||||||
|
|
||||||
$desc_amount = money((float) $payment->amount, (string) $payment->currency_code, true)->format();
|
$desc_amount = money((float) $payment->amount, (string) $payment->currency_code, true)->format();
|
||||||
|
|
||||||
$description = $desc_amount . ' ' . trans_choice('general.payments', 1);
|
$description = $desc_amount . ' ' . trans_choice('general.payments', 1);
|
||||||
|
|
||||||
// Add invoice history
|
// Add bill history
|
||||||
BillHistory::create([
|
BillHistory::create([
|
||||||
'company_id' => $bill->company_id,
|
'company_id' => $bill->company_id,
|
||||||
'invoice_id' => $bill->id,
|
'bill_id' => $bill->id,
|
||||||
'status_code' => $status,
|
'status_code' => $bill->bill_status_code,
|
||||||
'notify' => 0,
|
'notify' => 0,
|
||||||
'description' => trans('messages.success.deleted', ['type' => $description]),
|
'description' => trans('messages.success.deleted', ['type' => $description]),
|
||||||
]);
|
]);
|
||||||
|
@ -722,14 +722,12 @@ class Invoices extends Controller
|
|||||||
{
|
{
|
||||||
$invoice = Invoice::find($payment->invoice_id);
|
$invoice = Invoice::find($payment->invoice_id);
|
||||||
|
|
||||||
$status = 'sent';
|
|
||||||
|
|
||||||
if ($invoice->payments()->count() > 1) {
|
if ($invoice->payments()->count() > 1) {
|
||||||
$status = 'partial';
|
$invoice->invoice_status_code = 'partial';
|
||||||
|
} else {
|
||||||
|
$invoice->invoice_status_code = 'sent';
|
||||||
}
|
}
|
||||||
|
|
||||||
$invoice->invoice_status_code = $status;
|
|
||||||
|
|
||||||
$invoice->save();
|
$invoice->save();
|
||||||
|
|
||||||
$desc_amount = money((float) $payment->amount, (string) $payment->currency_code, true)->format();
|
$desc_amount = money((float) $payment->amount, (string) $payment->currency_code, true)->format();
|
||||||
@ -740,7 +738,7 @@ class Invoices extends Controller
|
|||||||
InvoiceHistory::create([
|
InvoiceHistory::create([
|
||||||
'company_id' => $invoice->company_id,
|
'company_id' => $invoice->company_id,
|
||||||
'invoice_id' => $invoice->id,
|
'invoice_id' => $invoice->id,
|
||||||
'status_code' => $status,
|
'status_code' => $invoice->invoice_status_code,
|
||||||
'notify' => 0,
|
'notify' => 0,
|
||||||
'description' => trans('messages.success.deleted', ['type' => $description]),
|
'description' => trans('messages.success.deleted', ['type' => $description]),
|
||||||
]);
|
]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user