<?php
$id_orders = $_SESSION['id_orders'];
$sql = "SELECT count(products_id) products, ifnull(sum(amount),0) amount , ifnull(sum(tax_amount),0) tax_amount, ifnull(sum(total),0) total FROM orders_products WHERE orders_id = $id_orders";
$rs = DB::Query($sql);
$data = $rs->fetchAssoc();
$products = $data['products'];
$amount = $data['amount'];
$tax_amount = $data['tax_amount'];
$total = $data['total'];
$sql = "UPDATE  orders 
set product_count = $products , amount_total = $amount , tax_total = $tax_amount , total_total = $total , last_modified = now()
where id_orders = $id_orders";
DB::Exec($sql);
?>