Total processing time: 59 ms; Peak memory: 5.139 MB. Show Profiling Timeline
| Time | Duration | Category | Info |
|---|---|---|---|
| 10:19:37.912 | 13.7 ms | yii\db\Command::query | SELECT COUNT(*) FROM (SELECT sc.*, scp.collected, sci.invoiced, (sc.amount - scp.collected) as uncollected, (sc.amount - sci.invoiced) as uninvoiced, (overdue_paid_amount - overdue_collected) as overdue, CASE WHEN od.remind_date IS NOT NULL THEN 0 WHEN (sc.amount - scp.collected) > 0 THEN 1 ELSE 2 END AS status, CASE WHEN sc.amount - scp.collected > 0 THEN ( CASE WHEN overdue_paid_amount - overdue_collected > 0 THEN max_date ELSE min_date END ) ELSE null END AS sort_date FROM "a57be577deb434"."tbl_sales_contracts" "sc" LEFT JOIN "a57be577deb434"."tbl_clients" "c" ON sc.client_id = c.id LEFT JOIN "a57be577deb434"."tbl_sales_group_relationships" "sgr" ON sgr.sales_id = c.sales_rep LEFT JOIN "a57be577deb434"."tbl_projects" "p" ON sc.from_project = p.id LEFT JOIN (SELECT t0.id AS contract_id, t0.erp_settle_amount AS collected FROM "a57be577deb434"."tbl_sales_contracts" "t0" WHERE t0.need_analysis = true GROUP BY "t0"."id") "scp" ON scp.contract_id = sc.id LEFT JOIN (SELECT t0.id AS contract_id, CASE WHEN t0.including_tax = true THEN COALESCE(sum(t1.amount), 0) ELSE t0.amount END AS invoiced FROM "a57be577deb434"."tbl_sales_contracts" "t0" LEFT JOIN "a57be577deb434"."tbl_sales_contract_invoices" "t1" ON t0.id = t1.contract_id WHERE t0.need_analysis = true GROUP BY "t0"."id") "sci" ON sci.contract_id = sc.id LEFT JOIN (SELECT sum(sub.amount) as overdue_paid_amount, sum(sub.paid_amount) as overdue_collected, max(sub.remind_date) as remind_date, max(sub.remind_date) as max_date, sub.id FROM (SELECT scpcrd.amount, COALESCE(scpcrd.paid_amount, 0) as paid_amount, scpcrd.remind_date, scpcrd.contract_id as id FROM "a57be577deb434"."tbl_sales_contract_payment_collection_remind_dates" "scpcrd" WHERE ("remind_date" <= '2026-07-01') AND (COALESCE(scpcrd.paid_amount, 0) < amount)) "sub" GROUP BY "sub"."id") "od" ON od.id = sc.id LEFT JOIN (SELECT sub.id, min(sub.remind_date) min_date FROM (SELECT scpcrd.amount, COALESCE(scpcrd.paid_amount, 0) as paid_amount, scpcrd.remind_date, scpcrd.contract_id as id FROM "a57be577deb434"."tbl_sales_contract_payment_collection_remind_dates" "scpcrd" WHERE ("remind_date" > '2026-07-01') AND (COALESCE(scpcrd.paid_amount, 0) >= amount)) "sub" GROUP BY "sub"."id") "mind" ON mind.id = sc.id WHERE (sc.need_analysis = true) AND (("sales_rep" IN (1001, 5049, 5500, 5301, 5499, 5022, 5209, 5026, 5293, 5309, 5356, 5329, 5299, 5303, 5302, 5332, 5047, 1026, 5096, 5070, 5448, 5420, 1029, 5037, 5087, 1008, 5048, 5043, 5045, 5230, 5031, 5088, 5208, 1003, 5467, 5294, 5357, 5044, 1030, 5076, 5300, 5027, 5089, 5311, 5066, 5069, 5364, 1009, 5295, 1013, 5128, 5203, 1025, 5032, 5075, 5476, 1004, 5072, 5033, 5359, 5412, 5409, 5229, 1005, 5304, 5449, 5358, 1006, 5093)) OR ("sales_rep" IS NULL)) AND ("c"."id"='982') GROUP BY "sc"."id", "scp"."collected", "sci"."invoiced", "od"."overdue_paid_amount", "od"."overdue_collected", "od"."remind_date", "sort_date" ORDER BY "sc"."signed_at" DESC, "sc"."created_at" DESC) "c" |
| 10:19:37.926 | 11.6 ms | yii\db\Command::query | SELECT sc.*, scp.collected, sci.invoiced, (sc.amount - scp.collected) as uncollected, (sc.amount - sci.invoiced) as uninvoiced, (overdue_paid_amount - overdue_collected) as overdue, CASE WHEN od.remind_date IS NOT NULL THEN 0 WHEN (sc.amount - scp.collected) > 0 THEN 1 ELSE 2 END AS status, CASE WHEN sc.amount - scp.collected > 0 THEN ( CASE WHEN overdue_paid_amount - overdue_collected > 0 THEN max_date ELSE min_date END ) ELSE null END AS sort_date FROM "a57be577deb434"."tbl_sales_contracts" "sc" LEFT JOIN "a57be577deb434"."tbl_clients" "c" ON sc.client_id = c.id LEFT JOIN "a57be577deb434"."tbl_sales_group_relationships" "sgr" ON sgr.sales_id = c.sales_rep LEFT JOIN "a57be577deb434"."tbl_projects" "p" ON sc.from_project = p.id LEFT JOIN (SELECT t0.id AS contract_id, t0.erp_settle_amount AS collected FROM "a57be577deb434"."tbl_sales_contracts" "t0" WHERE t0.need_analysis = true GROUP BY "t0"."id") "scp" ON scp.contract_id = sc.id LEFT JOIN (SELECT t0.id AS contract_id, CASE WHEN t0.including_tax = true THEN COALESCE(sum(t1.amount), 0) ELSE t0.amount END AS invoiced FROM "a57be577deb434"."tbl_sales_contracts" "t0" LEFT JOIN "a57be577deb434"."tbl_sales_contract_invoices" "t1" ON t0.id = t1.contract_id WHERE t0.need_analysis = true GROUP BY "t0"."id") "sci" ON sci.contract_id = sc.id LEFT JOIN (SELECT sum(sub.amount) as overdue_paid_amount, sum(sub.paid_amount) as overdue_collected, max(sub.remind_date) as remind_date, max(sub.remind_date) as max_date, sub.id FROM (SELECT scpcrd.amount, COALESCE(scpcrd.paid_amount, 0) as paid_amount, scpcrd.remind_date, scpcrd.contract_id as id FROM "a57be577deb434"."tbl_sales_contract_payment_collection_remind_dates" "scpcrd" WHERE ("remind_date" <= '2026-07-01') AND (COALESCE(scpcrd.paid_amount, 0) < amount)) "sub" GROUP BY "sub"."id") "od" ON od.id = sc.id LEFT JOIN (SELECT sub.id, min(sub.remind_date) min_date FROM (SELECT scpcrd.amount, COALESCE(scpcrd.paid_amount, 0) as paid_amount, scpcrd.remind_date, scpcrd.contract_id as id FROM "a57be577deb434"."tbl_sales_contract_payment_collection_remind_dates" "scpcrd" WHERE ("remind_date" > '2026-07-01') AND (COALESCE(scpcrd.paid_amount, 0) >= amount)) "sub" GROUP BY "sub"."id") "mind" ON mind.id = sc.id WHERE (sc.need_analysis = true) AND (("sales_rep" IN (1001, 5049, 5500, 5301, 5499, 5022, 5209, 5026, 5293, 5309, 5356, 5329, 5299, 5303, 5302, 5332, 5047, 1026, 5096, 5070, 5448, 5420, 1029, 5037, 5087, 1008, 5048, 5043, 5045, 5230, 5031, 5088, 5208, 1003, 5467, 5294, 5357, 5044, 1030, 5076, 5300, 5027, 5089, 5311, 5066, 5069, 5364, 1009, 5295, 1013, 5128, 5203, 1025, 5032, 5075, 5476, 1004, 5072, 5033, 5359, 5412, 5409, 5229, 1005, 5304, 5449, 5358, 1006, 5093)) OR ("sales_rep" IS NULL)) AND ("c"."id"='982') GROUP BY "sc"."id", "scp"."collected", "sci"."invoiced", "od"."overdue_paid_amount", "od"."overdue_collected", "od"."remind_date", "sort_date" ORDER BY "sc"."signed_at" DESC, "sc"."created_at" DESC LIMIT 20 OFFSET 20 |
| 10:19:37.939 | 8.8 ms | yii\db\Command::query | SELECT sum(amount) as amount, sum(uncollected) as uncollected, sum(overdue) as overdue FROM (SELECT sc.*, scp.collected, sci.invoiced, (sc.amount - scp.collected) as uncollected, (sc.amount - sci.invoiced) as uninvoiced, (overdue_paid_amount - overdue_collected) as overdue, CASE WHEN od.remind_date IS NOT NULL THEN 0 WHEN (sc.amount - scp.collected) > 0 THEN 1 ELSE 2 END AS status, CASE WHEN sc.amount - scp.collected > 0 THEN ( CASE WHEN overdue_paid_amount - overdue_collected > 0 THEN max_date ELSE min_date END ) ELSE null END AS sort_date FROM "a57be577deb434"."tbl_sales_contracts" "sc" LEFT JOIN "a57be577deb434"."tbl_clients" "c" ON sc.client_id = c.id LEFT JOIN "a57be577deb434"."tbl_sales_group_relationships" "sgr" ON sgr.sales_id = c.sales_rep LEFT JOIN "a57be577deb434"."tbl_projects" "p" ON sc.from_project = p.id LEFT JOIN (SELECT t0.id AS contract_id, t0.erp_settle_amount AS collected FROM "a57be577deb434"."tbl_sales_contracts" "t0" WHERE t0.need_analysis = true GROUP BY "t0"."id") "scp" ON scp.contract_id = sc.id LEFT JOIN (SELECT t0.id AS contract_id, CASE WHEN t0.including_tax = true THEN COALESCE(sum(t1.amount), 0) ELSE t0.amount END AS invoiced FROM "a57be577deb434"."tbl_sales_contracts" "t0" LEFT JOIN "a57be577deb434"."tbl_sales_contract_invoices" "t1" ON t0.id = t1.contract_id WHERE t0.need_analysis = true GROUP BY "t0"."id") "sci" ON sci.contract_id = sc.id LEFT JOIN (SELECT sum(sub.amount) as overdue_paid_amount, sum(sub.paid_amount) as overdue_collected, max(sub.remind_date) as remind_date, max(sub.remind_date) as max_date, sub.id FROM (SELECT scpcrd.amount, COALESCE(scpcrd.paid_amount, 0) as paid_amount, scpcrd.remind_date, scpcrd.contract_id as id FROM "a57be577deb434"."tbl_sales_contract_payment_collection_remind_dates" "scpcrd" WHERE ("remind_date" <= '2026-07-01') AND (COALESCE(scpcrd.paid_amount, 0) < amount)) "sub" GROUP BY "sub"."id") "od" ON od.id = sc.id LEFT JOIN (SELECT sub.id, min(sub.remind_date) min_date FROM (SELECT scpcrd.amount, COALESCE(scpcrd.paid_amount, 0) as paid_amount, scpcrd.remind_date, scpcrd.contract_id as id FROM "a57be577deb434"."tbl_sales_contract_payment_collection_remind_dates" "scpcrd" WHERE ("remind_date" > '2026-07-01') AND (COALESCE(scpcrd.paid_amount, 0) >= amount)) "sub" GROUP BY "sub"."id") "mind" ON mind.id = sc.id WHERE (sc.need_analysis = true) AND (("sales_rep" IN (1001, 5049, 5500, 5301, 5499, 5022, 5209, 5026, 5293, 5309, 5356, 5329, 5299, 5303, 5302, 5332, 5047, 1026, 5096, 5070, 5448, 5420, 1029, 5037, 5087, 1008, 5048, 5043, 5045, 5230, 5031, 5088, 5208, 1003, 5467, 5294, 5357, 5044, 1030, 5076, 5300, 5027, 5089, 5311, 5066, 5069, 5364, 1009, 5295, 1013, 5128, 5203, 1025, 5032, 5075, 5476, 1004, 5072, 5033, 5359, 5412, 5409, 5229, 1005, 5304, 5449, 5358, 1006, 5093)) OR ("sales_rep" IS NULL)) AND ("c"."id"='982') GROUP BY "sc"."id", "scp"."collected", "sci"."invoiced", "od"."overdue_paid_amount", "od"."overdue_collected", "od"."remind_date", "sort_date" ORDER BY "signed_at" DESC) "sub" |
| 10:19:37.949 | 2.7 ms | yii\db\Command::query | INSERT INTO "global"."tbl_api_log" ("code", "schema", "user_id", "device_type", "url", "request", "response", "php_error", "time", "duration") VALUES (200, 'a57be577deb434', 1001, 5, 'vue/client/un-collected', '{"id":"982","page":"2"}', '{"code":2000,"result":{"list":[],"count":{"amount":"15299587","uncollected":"12812634","overdue":""},"pagenation":{"totalcount":6,"thispage":2,"pagesize":20}},"status":1,"msg":[{"name":"success","success":"\u6210\u529f\u83b7\u53d6\u6570\u636e","error":""}],"mod":0,"ip":"39.156.194.178","ua":"Mozilla\/5.0 (Macintosh; Intel Mac OS X 10.15; rv:152.0) Gecko\/20100101 Firefox\/152.0"}', FALSE, '2026-07-01 10:19:37', 51130112) RETURNING "id" |
| 10:19:37.901 | 0.9 ms | yii\db\Command::query | SELECT * FROM "global"."vw_user_login" WHERE "id"=1001 |
| 10:19:37.904 | 0.7 ms | yii\db\Command::query | SELECT * FROM "a57be577deb434"."tbl_users" WHERE "id"=1001 |
| 10:19:37.901 | 0.4 ms | yii\db\Connection::open | Opening DB connection: pgsql:host=postgresql.server.local;port=5432;dbname=beta |