/** * Recalculate */ public function onRecalculate($recordId = null, $context = null) { $Invoice = new Invoice(); $Invoice->saleId = $recordId; $Invoice->opRecalculate(); $this->vars['invoice'] = $Invoice->get(); $this->vars['invoiceStatus'] = Sale::find($recordId)->status; $this->asExtension('FormController')->update($recordId, $context); }
public function setTotal() { $Sale = Sale::find($this->saleId); $Sale->total = $this->opTotal(); $Sale->save(); }