PHP Warning: Module 'soap' already loaded in Unknown on line 0 Warning: Module 'soap' already loaded in Unknown on line 0 Psy Shell v0.9.12 (PHP 7.3.33 — cli) by Justin Hileman New version is available (current: v0.9.12, latest: v0.12.24) >>> echo "===SALES-DISTINCT-CURRENCIES==="; ===SALES-DISTINCT-CURRENCIES===⏎ >>> $sc = DB::select("SELECT currency, COUNT(*) as cnt, SUM(order_amount) as total FROM sales GROUP BY currency"); => [ {#1025 +"currency": "USD", +"cnt": 25524, +"total": "5406301.58", }, {#1026 +"currency": "EUR", +"cnt": 21, +"total": "1296.94", }, {#1027 +"currency": "SAR", +"cnt": 10324, +"total": "585947.45", }, {#1028 +"currency": "TRY", +"cnt": 113, +"total": "7620.31", }, {#1029 +"currency": "EGP", +"cnt": 2360316, +"total": "42212975.96", }, {#1030 +"currency": null, +"cnt": 2611, +"total": "224533.90", }, {#1031 +"currency": "AED", +"cnt": 34, +"total": "117057.27", }, {#1032 +"currency": "MYR", +"cnt": 1, +"total": "232.27", }, {#1033 +"currency": "UAH", +"cnt": 1, +"total": "14.16", }, {#1034 +"currency": "KWD", +"cnt": 1, +"total": "139.29", }, ] >>> foreach($sc as $r) { echo $r->currency."|".$r->cnt."|".$r->total." ... "; } USD|25524|5406301.58 EUR|21|1296.94 SAR|10324|585947.45 TRY|113|7620.31 EGP|2360316|42212975.96 |2611|224533.90 AED|34|117057.27 MYR|1|232.27 UAH|1|14.16 KWD|1|139.29 >>> echo "===USER-PAYOUTS-DISTINCT-LOCAL-CURRENCY==="; ===USER-PAYOUTS-DISTINCT-LOCAL-CURRENCY===⏎ >>> $pc = DB::select("SELECT local_currency, COUNT(*) as cnt, SUM(amount) as usd_total, SUM(local_amount) as local_total FROM user_payouts GROUP BY local_currency"); => [ {#1043 +"local_currency": "USD", +"cnt": 228, +"usd_total": "104960.70", +"local_total": "104930.70", }, {#1044 +"local_currency": "EGP", +"cnt": 9104, +"usd_total": "2159494.38", +"local_total": "57118819.01", }, ] >>> foreach($pc as $r) { echo $r->local_currency."|".$r->cnt."|".$r->usd_total."|".$r->local_total." ... "; } USD|228|104960.70|104930.70 EGP|9104|2159494.38|57118819.01 >>> echo "===USER-PAYOUTS-SAMPLE-WITH-CURRENCY==="; ===USER-PAYOUTS-SAMPLE-WITH-CURRENCY===⏎ >>> $ps = DB::select("SELECT id, amount, local_currency, local_amount, currency_rate, amount_egp, amount_sar, amount_aed, amount_kwd FROM user_payouts LIMIT 5"); => [ {#1022 +"id": 1, +"amount": "5.00", +"local_currency": "USD", +"local_amount": "5.00", +"currency_rate": 1.0, +"amount_egp": "78.60", +"amount_sar": "18.75", +"amount_aed": "18.35", +"amount_kwd": "1.55", }, {#1021 +"id": 2, +"amount": "2.00", +"local_currency": "USD", +"local_amount": "2.00", +"currency_rate": 1.0, +"amount_egp": "31.44", +"amount_sar": "7.50", +"amount_aed": "7.34", +"amount_kwd": "0.62", }, {#1017 +"id": 3, +"amount": "5.00", +"local_currency": "USD", +"local_amount": "5.00", +"currency_rate": 1.0, +"amount_egp": "78.60", +"amount_sar": "18.75", +"amount_aed": "18.35", +"amount_kwd": "1.55", }, {#1046 +"id": 4, +"amount": "25.00", +"local_currency": "USD", +"local_amount": "25.00", +"currency_rate": 1.0, +"amount_egp": "393.00", +"amount_sar": "93.75", +"amount_aed": "91.75", +"amount_kwd": "7.75", }, {#1016 +"id": 8, +"amount": "6.00", +"local_currency": "USD", +"local_amount": "6.00", +"currency_rate": 1.0, +"amount_egp": "94.32", +"amount_sar": "22.50", +"amount_aed": "22.02", +"amount_kwd": "1.86", }, ] >>> foreach($ps as $r) { echo json_encode($r)." ... "; } {"id":1,"amount":"5.00","local_currency":"USD","local_amount":"5.00","currency_rate":1,"amount_egp":"78.60","amount_sar":"18.75","amount_aed":"18.35","amount_kwd":"1.55"} {"id":2,"amount":"2.00","local_currency":"USD","local_amount":"2.00","currency_rate":1,"amount_egp":"31.44","amount_sar":"7.50","amount_aed":"7.34","amount_kwd":"0.62"} {"id":3,"amount":"5.00","local_currency":"USD","local_amount":"5.00","currency_rate":1,"amount_egp":"78.60","amount_sar":"18.75","amount_aed":"18.35","amount_kwd":"1.55"} {"id":4,"amount":"25.00","local_currency":"USD","local_amount":"25.00","currency_rate":1,"amount_egp":"393.00","amount_sar":"93.75","amount_aed":"91.75","amount_kwd":"7.75"} {"id":8,"amount":"6.00","local_currency":"USD","local_amount":"6.00","currency_rate":1,"amount_egp":"94.32","amount_sar":"22.50","amount_aed":"22.02","amount_kwd":"1.86"} >>> echo "===BALANCES-LOCAL-VS-USD==="; ===BALANCES-LOCAL-VS-USD===⏎ >>> $bl = DB::select("SELECT SUM(confirmed_balance) as usd_conf, SUM(confirmed_local_balance) as local_conf, SUM(pending_balance) as usd_pend, SUM(pending_local_balance) as local_pend FROM users")[0]; => {#1024 +"usd_conf": "387533.10", +"local_conf": "3869298.90", +"usd_pend": "1509677.86", +"local_pend": "21768595.40", } >>> echo "usd_confirmed: ".$bl->usd_conf." ... "; usd_confirmed: 387533.10 >>> echo "local_confirmed: ".$bl->local_conf." ... "; local_confirmed: 3869298.90 >>> echo "usd_pending: ".$bl->usd_pend." ... "; usd_pending: 1509677.86 >>> echo "local_pending: ".$bl->local_pend." ... "; local_pending: 21768595.40 >>> echo "===DONE==="; ===DONE===⏎ >>> exit; Exit: Goodbye