DEMO SITE v1.7.20

Subselect and sum row Minimal 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

	$xcrud = Xcrud::get_instance();
    $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();


1Signal Gift StoressLas Vegas71800$0.00 View Edit Remove
2Australian Collectors, Co.Melbourne117300$0.00 View Edit Remove
3La Rochelle GiftsNantes1182002$-118,198.00 View Edit Remove
4Zbyszek Zbyszek PiestrzeniewiczWarszawa1230$0.00 View Edit Remove
5Blauer See Auto, Co.Frankfurt5970075937.76000000001$16,237.76 View Edit Remove
6Mini Wheels Co.San Francisco6460066710.56$2,110.56 View Edit Remove
7Land of Toys Inc.NYC114900107639.94$-7,260.06 View Edit Remove
8Euro+ Shopping ChannelMadrid227600715738.9800000001$488,138.98 View Edit Remove
9Danish Wholesale ImportsKobenhavn83400107446.5$24,046.50 View Edit Remove
10Saveley & Henriot, Co.Lyon123900130305.9$6,405.90 View Edit Remove
Σ  7820630.127666140.750000002$35,840.63 
Add Export into CSV Print Search