<?php
$idfactura = $_SESSION['IDFACTURA'];
$sql = "SELECT sum(Valor) total FROM linea_factura where factura_idfactura = $idfactura";
$rs = DB::Query($sql);
$data = $rs->fetchAssoc();
$total = $data['total'];
$sql = "update factura set TotalFactura = $total where idfactura = $idfactura";
DB::Exec($sql);
?>