Other calculations with multimodelform

Greetings yiiframework community, I have been working for some time with the master details with this beautiful and useful framework, I have used the multimodelform extension, although when I need to do other calculations I have had to use a procedure elaborated by me that does it perfectly, but as it is not pure of yii, then it causes me disadvantages, so I need to do those calculations with the multimodelform extension, I’ll give an example, if I need to calculate a field in the master after filling in the detail, example when adding an amount field In the details and putting the sum in an importetotal field in the master, I can’t do it, that is, if I have three products on an invoice, then when you add up those three products and put it in the master:

$Detallesfacturas->importemn = $Detallesfacturas->PreCUP * $Detallesfacturas->cantidad;
 $importeTotal += $Detallesfacturas->importemn;

Here I calculate the amount of each product and calculate the total amount.

if (!$id) {// - $detalle->descuento
                                $criteria = new CDbCriteria;
                                $criteria->params = array(':nfactura' => $model->nfactura);
                                $factu = Facturas::model()->find($criteria);                               
                                $factu->ImporteTotal = $Importetotalmn;

here I put the total amount in the master (invoice).
The same thing happens to me when I need to fill another model with the fields of the tables of the master detail made.
It is possible to do this with multimodelform, if so how could you do it.
I need this please.