Here is the query to get life time sales of particular customer,
SELECT DISTINCT customer_email, customer_firstname, customer_lastname, SUM( subtotal_invoiced ) AS Total
FROM `sales_flat_order` AS a
WHERE customer_email = 'customer_email'
GROUP BY customer_email
ORDER BY SUM( subtotal_invoiced ) DESC
LIMIT 0 , 30
Here replace customer_email with user's email.
Update:
I wrote a simple module for you,
In your controller, add this method,
public function IndexAction() {
$orders = Mage::getModel('sales/order')->getCollection()
->addAttributeToFilter('customer_email', 'yourmail@gmail.com');
foreach ($orders as $order) {
$total = $order->getGrandTotal();
$sum+= $total;
}
echo $sum ;
}
If you want filter order status,then
->addFieldToFilter('status', 'complete')
Add this filter option in your order collection like this,
$orders = Mage::getModel('sales/order')->getCollection()
->addAttributeToFilter('customer_email', 'yourmail@gmail.com')
->addFieldToFilter('status', 'complete');
Cheers..!