This commit is contained in:
cuneytsenturk
2018-03-13 18:53:18 +03:00
parent e0dd01eb71
commit 7cf3b5d909
8 changed files with 15 additions and 77 deletions

View File

@ -589,26 +589,27 @@ class Bills extends Controller
{
$bill = Bill::find($payment->bill_id);
$status = 'received';
if ($bill->payments()->count() > 1) {
$bill->bill_status_code = 'partial';
} else {
$bill->bill_status_code = 'received';
}
$bill->bill_status_code = $status;
$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);
$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',
'status_code' => $status,
'notify' => 0,
'description' => $description,
'description' => trans('messages.success.deleted', ['type' => $description]),
]);
$payment->delete();