fill($data); $invoice->save(); $invoice_calc = new InvoiceSum($invoice, $invoice->settings); $invoice->service()->applyNumber()->save(); $invoice = $invoice_calc->build()->getInvoice(); return $invoice; } }