This commit is contained in:
cuneytsenturk 2018-03-13 15:44:59 +03:00
parent 78386a9175
commit bf39faf1ef
2 changed files with 14 additions and 8 deletions

View File

@ -589,9 +589,7 @@ class Bills extends Controller
{
$bill = Bill::find($payment->bill_id);
if ($bill->payments()->paid() == $bill->amount) {
$bill->bill_status_code = 'paid';
} elseif ($bill->payments()->count() > 1) {
if ($bill->payments()->count() > 1) {
$bill->bill_status_code = 'partial';
} else {
$bill->bill_status_code = 'received';
@ -599,13 +597,18 @@ class Bills extends Controller
$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
BillHistory::create([
'company_id' => $bill->company_id,
'invoice_id' => $bill->id,
'status_code' => 'delete',
'notify' => 0,
'description' => trans('general.delete') . ' ' . $payment->description,
'description' => $description,
]);
$payment->delete();

View File

@ -722,9 +722,7 @@ class Invoices extends Controller
{
$invoice = Invoice::find($payment->invoice_id);
if ($invoice->payments()->paid() == $invoice->amount) {
$invoice->invoice_status_code = 'paid';
} elseif ($invoice->payments()->count() > 1) {
if ($invoice->payments()->count() > 1) {
$invoice->invoice_status_code = 'partial';
} else {
$invoice->invoice_status_code = 'sent';
@ -732,13 +730,18 @@ class Invoices extends Controller
$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
InvoiceHistory::create([
'company_id' => $invoice->company_id,
'invoice_id' => $invoice->id,
'status_code' => 'delete',
'notify' => 0,
'description' => trans('general.delete') . ' ' . $payment->description,
'description' => $description,
]);
$payment->delete();