DEMO SITE v1.7.31

Subselect and sum row Default theme

Subselect() will create a new column with some value from other (or current) table. You can use any columns from current tables as parameters. Subselect will be called for each row

HIDE CODE
<?php
	$xcrud = Xcrud::get_instance();
    $xcrud->table('customers');
    $xcrud->columns('customerName,city,creditLimit,Paid,Profit'); // specify only some columns
    $xcrud->subselect('Paid','SELECT SUM(amount) FROM payments WHERE customerNumber = {customerNumber}'); // other table
    $xcrud->subselect('Profit','{Paid}-{creditLimit}'); // current table
    $xcrud->sum('creditLimit,Paid,Profit'); // sum row(), receives data from full table (ignores pagination)
    $xcrud->change_type('Profit','price','0',array('prefix'=>'$')); // number format
    echo $xcrud->render();
?>

Customers

Add Export into CSV Print
Search

#CustomernameCityCreditlimitPaidProfit
Actions
1uyt 7to7y87 y087y 87t 087y87y 087y087y pjhuy 8'04000$4,000.00 View Edit Remove
2La Rochelle GiftNantes118200$0.00 View Edit Remove
3Baane Mini ImportsStavern81700274.52$-81,425.48 View Edit Remove
4Mini Gifts Distributors Ltd.San Rafael210500$0.00 View Edit Remove
5Blauer See Auto, Co.Frankfurt59700111$-59,589.00 View Edit Remove
6Mini Wheels Co.San Francisco646000$-64,600.00 View Edit Remove
7Land of Toys Inc.NYC1149000$-114,900.00 View Edit Remove
8Danish Wholesale ImportsKobenhavn83400$0.00 View Edit Remove
9Saveley & Henriot, Co.Lyon123900$0.00 View Edit Remove
10Dragon Souveniers, Ltd.Singapore103800$0.00 View Edit Remove
Σ  7557000.125561170.450000001$-1,161,329.67