DEMO SITE v1.7.28

Subselect and sum row Bootstrap 4.5 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
#CustomernameCityCreditlimitPaidProfit
Actions
1La Rochelle GiftsNantes118200$0.00 View Edit Remove
2Baane Mini ImportsStavern81700222495.52$140,795.52 View Edit Remove
3Mini Gifts Distributors Ltd.San Rafael210500$0.00 View Edit Remove
4Havel & Zbyszek CoWarszawa0$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.NYC114900490$-114,410.00 View Edit Remove
8Euro+ Shopping ChannelMadrid227600104408.29000000001$-123,191.71 View Edit Remove
9Volvo Model Replicas, CoLula531007674.94$-45,425.06 View Edit Remove
10Danish Wholesale ImportsKobenhavn83400107446.5$24,046.50 View Edit Remove
Σ  8044300.127093433.7200000025$-622,166.40 
showing_records 1 to 10 of 128
Search
 
slot thailand
slot thailand slot gacor
slot gacor