DEMO SITE v1.7.20

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 
1Muscle Machine IncNYC138500$0.00 View Edit Remove
2Diecast Classics Inc.Allentown100600$0.00 View Edit Remove
3Technics Stores Inc.Burlingame84600$0.00 View Edit Remove
4Gift Depot Inc.Bridgewater84300$0.00 View Edit Remove
5Osaka Souveniers Co.Kita-ku81200$0.00 View Edit Remove
6Vitachrome Inc.NYC764001$-76,399.00 View Edit Remove
7Toys of Finland, Co.Helsinki96500135$-96,365.00 View Edit Remove
8AV Stores, Co.Manchester136800$0.00 View Edit Remove
9Clover Collections, Co.Dublin69400$0.00 View Edit Remove
10Auto-Moto Classics Inc.Brickhaven23000$0.00 View Edit Remove
Σ  6334555.124823326.960000001$-513,273.16