refs #252
This commit is contained in:
parent
78386a9175
commit
bf39faf1ef
@ -589,9 +589,7 @@ class Bills extends Controller
|
|||||||
{
|
{
|
||||||
$bill = Bill::find($payment->bill_id);
|
$bill = Bill::find($payment->bill_id);
|
||||||
|
|
||||||
if ($bill->payments()->paid() == $bill->amount) {
|
if ($bill->payments()->count() > 1) {
|
||||||
$bill->bill_status_code = 'paid';
|
|
||||||
} elseif ($bill->payments()->count() > 1) {
|
|
||||||
$bill->bill_status_code = 'partial';
|
$bill->bill_status_code = 'partial';
|
||||||
} else {
|
} else {
|
||||||
$bill->bill_status_code = 'received';
|
$bill->bill_status_code = 'received';
|
||||||
@ -599,13 +597,18 @@ class Bills extends Controller
|
|||||||
|
|
||||||
$bill->save();
|
$bill->save();
|
||||||
|
|
||||||
|
$desc_amount = money((float) $payment->amount, (string) $payment->currency_code, true)->format();
|
||||||
|
|
||||||
|
$description = trans('general.delete') . ' ';
|
||||||
|
$description .= $desc_amount . ' ' . trans_choice('general.payments', 1);
|
||||||
|
|
||||||
// Add invoice history
|
// Add invoice history
|
||||||
BillHistory::create([
|
BillHistory::create([
|
||||||
'company_id' => $bill->company_id,
|
'company_id' => $bill->company_id,
|
||||||
'invoice_id' => $bill->id,
|
'invoice_id' => $bill->id,
|
||||||
'status_code' => 'delete',
|
'status_code' => 'delete',
|
||||||
'notify' => 0,
|
'notify' => 0,
|
||||||
'description' => trans('general.delete') . ' ' . $payment->description,
|
'description' => $description,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$payment->delete();
|
$payment->delete();
|
||||||
|
@ -722,9 +722,7 @@ class Invoices extends Controller
|
|||||||
{
|
{
|
||||||
$invoice = Invoice::find($payment->invoice_id);
|
$invoice = Invoice::find($payment->invoice_id);
|
||||||
|
|
||||||
if ($invoice->payments()->paid() == $invoice->amount) {
|
if ($invoice->payments()->count() > 1) {
|
||||||
$invoice->invoice_status_code = 'paid';
|
|
||||||
} elseif ($invoice->payments()->count() > 1) {
|
|
||||||
$invoice->invoice_status_code = 'partial';
|
$invoice->invoice_status_code = 'partial';
|
||||||
} else {
|
} else {
|
||||||
$invoice->invoice_status_code = 'sent';
|
$invoice->invoice_status_code = 'sent';
|
||||||
@ -732,13 +730,18 @@ class Invoices extends Controller
|
|||||||
|
|
||||||
$invoice->save();
|
$invoice->save();
|
||||||
|
|
||||||
|
$desc_amount = money((float) $payment->amount, (string) $payment->currency_code, true)->format();
|
||||||
|
|
||||||
|
$description = trans('general.delete') . ' ';
|
||||||
|
$description .= $desc_amount . ' ' . trans_choice('general.payments', 1);
|
||||||
|
|
||||||
// Add invoice history
|
// Add invoice history
|
||||||
InvoiceHistory::create([
|
InvoiceHistory::create([
|
||||||
'company_id' => $invoice->company_id,
|
'company_id' => $invoice->company_id,
|
||||||
'invoice_id' => $invoice->id,
|
'invoice_id' => $invoice->id,
|
||||||
'status_code' => 'delete',
|
'status_code' => 'delete',
|
||||||
'notify' => 0,
|
'notify' => 0,
|
||||||
'description' => trans('general.delete') . ' ' . $payment->description,
|
'description' => $description,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$payment->delete();
|
$payment->delete();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user