Total processing time: 430 ms; Peak memory: 5.422 MB. Show Profiling Timeline
| Time | Duration | Category | Info |
|---|---|---|---|
| 22:15:52.347 | 40.5 ms | yii\db\Command::query | SELECT sum(amount) as amount FROM ((SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cash_cost_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cash_cost_tickets" "t" ON am.erp_cash_cost_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("t"."is_payment_settle"=TRUE) AND ("t"."created_at" >= '2025-08-08 14:34:58') AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2026-01-01 00:00:00') AND ("t"."created_at" <= '2026-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_cash_cost_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("t"."is_payment_settle"=TRUE) AND ("t"."created_at" >= '2025-08-08 14:34:58') AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2026-01-01 00:00:00') AND ("t"."created_at" <= '2026-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cost_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cost_tickets" "t" ON am.erp_cost_ticket_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2026-01-01 00:00:00') AND ("t"."created_at" <= '2026-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_cost_tickets" "t" ON pd.project_id = t.project_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2026-01-01 00:00:00') AND ("t"."created_at" <= '2026-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cost_convert_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cost_convert_tickets" "t" ON am.erp_cost_convert_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2026-01-01 00:00:00') AND ("t"."created_at" <= '2026-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_cost_convert_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2026-01-01 00:00:00') AND ("t"."created_at" <= '2026-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(eipss.actual_total_amount - eipss.total_amount), 0) as amount FROM "a57be577deb434"."tbl_erp_sales_gifts" "t" LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_gift_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2026-01-01 00:00:00') AND ("t"."created_at" <= '2026-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum((eipss.actual_total_amount - eipss.total_amount) * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_sales_gifts" "t" ON pd.project_id = t.project_id LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_gift_id = t.id WHERE ("t"."status"=2) AND ("t"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2026-01-01 00:00:00') AND ("t"."created_at" <= '2026-12-31 23:59:59') )) "sub" |
| 22:15:52.527 | 24.9 ms | yii\db\Command::query | SELECT sum(amount) as amount FROM ((SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cash_cost_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cash_cost_tickets" "t" ON am.erp_cash_cost_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("t"."is_payment_settle"=TRUE) AND ("t"."created_at" >= '2025-08-08 14:34:58') AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2021-01-01 00:00:00') AND ("t"."created_at" <= '2021-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_cash_cost_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("t"."is_payment_settle"=TRUE) AND ("t"."created_at" >= '2025-08-08 14:34:58') AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2021-01-01 00:00:00') AND ("t"."created_at" <= '2021-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cost_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cost_tickets" "t" ON am.erp_cost_ticket_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2021-01-01 00:00:00') AND ("t"."created_at" <= '2021-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_cost_tickets" "t" ON pd.project_id = t.project_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2021-01-01 00:00:00') AND ("t"."created_at" <= '2021-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cost_convert_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cost_convert_tickets" "t" ON am.erp_cost_convert_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2021-01-01 00:00:00') AND ("t"."created_at" <= '2021-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_cost_convert_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2021-01-01 00:00:00') AND ("t"."created_at" <= '2021-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(eipss.actual_total_amount - eipss.total_amount), 0) as amount FROM "a57be577deb434"."tbl_erp_sales_gifts" "t" LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_gift_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2021-01-01 00:00:00') AND ("t"."created_at" <= '2021-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum((eipss.actual_total_amount - eipss.total_amount) * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_sales_gifts" "t" ON pd.project_id = t.project_id LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_gift_id = t.id WHERE ("t"."status"=2) AND ("t"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2021-01-01 00:00:00') AND ("t"."created_at" <= '2021-12-31 23:59:59') )) "sub" |
| 22:15:52.422 | 24.9 ms | yii\db\Command::query | SELECT sum(amount) as amount FROM ((SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cash_cost_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cash_cost_tickets" "t" ON am.erp_cash_cost_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("t"."is_payment_settle"=TRUE) AND ("t"."created_at" >= '2025-08-08 14:34:58') AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2024-01-01 00:00:00') AND ("t"."created_at" <= '2024-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_cash_cost_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("t"."is_payment_settle"=TRUE) AND ("t"."created_at" >= '2025-08-08 14:34:58') AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2024-01-01 00:00:00') AND ("t"."created_at" <= '2024-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cost_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cost_tickets" "t" ON am.erp_cost_ticket_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2024-01-01 00:00:00') AND ("t"."created_at" <= '2024-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_cost_tickets" "t" ON pd.project_id = t.project_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2024-01-01 00:00:00') AND ("t"."created_at" <= '2024-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cost_convert_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cost_convert_tickets" "t" ON am.erp_cost_convert_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2024-01-01 00:00:00') AND ("t"."created_at" <= '2024-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_cost_convert_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2024-01-01 00:00:00') AND ("t"."created_at" <= '2024-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(eipss.actual_total_amount - eipss.total_amount), 0) as amount FROM "a57be577deb434"."tbl_erp_sales_gifts" "t" LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_gift_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2024-01-01 00:00:00') AND ("t"."created_at" <= '2024-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum((eipss.actual_total_amount - eipss.total_amount) * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_sales_gifts" "t" ON pd.project_id = t.project_id LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_gift_id = t.id WHERE ("t"."status"=2) AND ("t"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2024-01-01 00:00:00') AND ("t"."created_at" <= '2024-12-31 23:59:59') )) "sub" |
| 22:15:52.597 | 23.3 ms | yii\db\Command::query | SELECT sum(amount) as amount FROM ((SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cash_cost_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cash_cost_tickets" "t" ON am.erp_cash_cost_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("t"."is_payment_settle"=TRUE) AND ("t"."created_at" >= '2025-08-08 14:34:58') AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2019-01-01 00:00:00') AND ("t"."created_at" <= '2019-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_cash_cost_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("t"."is_payment_settle"=TRUE) AND ("t"."created_at" >= '2025-08-08 14:34:58') AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2019-01-01 00:00:00') AND ("t"."created_at" <= '2019-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cost_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cost_tickets" "t" ON am.erp_cost_ticket_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2019-01-01 00:00:00') AND ("t"."created_at" <= '2019-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_cost_tickets" "t" ON pd.project_id = t.project_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2019-01-01 00:00:00') AND ("t"."created_at" <= '2019-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cost_convert_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cost_convert_tickets" "t" ON am.erp_cost_convert_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2019-01-01 00:00:00') AND ("t"."created_at" <= '2019-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_cost_convert_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2019-01-01 00:00:00') AND ("t"."created_at" <= '2019-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(eipss.actual_total_amount - eipss.total_amount), 0) as amount FROM "a57be577deb434"."tbl_erp_sales_gifts" "t" LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_gift_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2019-01-01 00:00:00') AND ("t"."created_at" <= '2019-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum((eipss.actual_total_amount - eipss.total_amount) * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_sales_gifts" "t" ON pd.project_id = t.project_id LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_gift_id = t.id WHERE ("t"."status"=2) AND ("t"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2019-01-01 00:00:00') AND ("t"."created_at" <= '2019-12-31 23:59:59') )) "sub" |
| 22:15:52.489 | 20.8 ms | yii\db\Command::query | SELECT sum(amount) as amount FROM ((SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cash_cost_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cash_cost_tickets" "t" ON am.erp_cash_cost_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("t"."is_payment_settle"=TRUE) AND ("t"."created_at" >= '2025-08-08 14:34:58') AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2022-01-01 00:00:00') AND ("t"."created_at" <= '2022-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_cash_cost_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("t"."is_payment_settle"=TRUE) AND ("t"."created_at" >= '2025-08-08 14:34:58') AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2022-01-01 00:00:00') AND ("t"."created_at" <= '2022-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cost_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cost_tickets" "t" ON am.erp_cost_ticket_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2022-01-01 00:00:00') AND ("t"."created_at" <= '2022-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_cost_tickets" "t" ON pd.project_id = t.project_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2022-01-01 00:00:00') AND ("t"."created_at" <= '2022-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cost_convert_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cost_convert_tickets" "t" ON am.erp_cost_convert_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2022-01-01 00:00:00') AND ("t"."created_at" <= '2022-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_cost_convert_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2022-01-01 00:00:00') AND ("t"."created_at" <= '2022-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(eipss.actual_total_amount - eipss.total_amount), 0) as amount FROM "a57be577deb434"."tbl_erp_sales_gifts" "t" LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_gift_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2022-01-01 00:00:00') AND ("t"."created_at" <= '2022-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum((eipss.actual_total_amount - eipss.total_amount) * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_sales_gifts" "t" ON pd.project_id = t.project_id LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_gift_id = t.id WHERE ("t"."status"=2) AND ("t"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2022-01-01 00:00:00') AND ("t"."created_at" <= '2022-12-31 23:59:59') )) "sub" |
| 22:15:52.633 | 20.6 ms | yii\db\Command::query | SELECT sum(amount) as amount FROM ((SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cash_cost_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cash_cost_tickets" "t" ON am.erp_cash_cost_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("t"."is_payment_settle"=TRUE) AND ("t"."created_at" >= '2025-08-08 14:34:58') AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2018-01-01 00:00:00') AND ("t"."created_at" <= '2018-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_cash_cost_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("t"."is_payment_settle"=TRUE) AND ("t"."created_at" >= '2025-08-08 14:34:58') AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2018-01-01 00:00:00') AND ("t"."created_at" <= '2018-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cost_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cost_tickets" "t" ON am.erp_cost_ticket_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2018-01-01 00:00:00') AND ("t"."created_at" <= '2018-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_cost_tickets" "t" ON pd.project_id = t.project_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2018-01-01 00:00:00') AND ("t"."created_at" <= '2018-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cost_convert_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cost_convert_tickets" "t" ON am.erp_cost_convert_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2018-01-01 00:00:00') AND ("t"."created_at" <= '2018-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_cost_convert_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2018-01-01 00:00:00') AND ("t"."created_at" <= '2018-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(eipss.actual_total_amount - eipss.total_amount), 0) as amount FROM "a57be577deb434"."tbl_erp_sales_gifts" "t" LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_gift_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2018-01-01 00:00:00') AND ("t"."created_at" <= '2018-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum((eipss.actual_total_amount - eipss.total_amount) * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_sales_gifts" "t" ON pd.project_id = t.project_id LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_gift_id = t.id WHERE ("t"."status"=2) AND ("t"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2018-01-01 00:00:00') AND ("t"."created_at" <= '2018-12-31 23:59:59') )) "sub" |
| 22:15:52.458 | 20.5 ms | yii\db\Command::query | SELECT sum(amount) as amount FROM ((SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cash_cost_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cash_cost_tickets" "t" ON am.erp_cash_cost_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("t"."is_payment_settle"=TRUE) AND ("t"."created_at" >= '2025-08-08 14:34:58') AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2023-01-01 00:00:00') AND ("t"."created_at" <= '2023-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_cash_cost_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("t"."is_payment_settle"=TRUE) AND ("t"."created_at" >= '2025-08-08 14:34:58') AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2023-01-01 00:00:00') AND ("t"."created_at" <= '2023-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cost_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cost_tickets" "t" ON am.erp_cost_ticket_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2023-01-01 00:00:00') AND ("t"."created_at" <= '2023-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_cost_tickets" "t" ON pd.project_id = t.project_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2023-01-01 00:00:00') AND ("t"."created_at" <= '2023-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cost_convert_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cost_convert_tickets" "t" ON am.erp_cost_convert_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2023-01-01 00:00:00') AND ("t"."created_at" <= '2023-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_cost_convert_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2023-01-01 00:00:00') AND ("t"."created_at" <= '2023-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(eipss.actual_total_amount - eipss.total_amount), 0) as amount FROM "a57be577deb434"."tbl_erp_sales_gifts" "t" LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_gift_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2023-01-01 00:00:00') AND ("t"."created_at" <= '2023-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum((eipss.actual_total_amount - eipss.total_amount) * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_sales_gifts" "t" ON pd.project_id = t.project_id LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_gift_id = t.id WHERE ("t"."status"=2) AND ("t"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2023-01-01 00:00:00') AND ("t"."created_at" <= '2023-12-31 23:59:59') )) "sub" |
| 22:15:52.563 | 20.5 ms | yii\db\Command::query | SELECT sum(amount) as amount FROM ((SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cash_cost_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cash_cost_tickets" "t" ON am.erp_cash_cost_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("t"."is_payment_settle"=TRUE) AND ("t"."created_at" >= '2025-08-08 14:34:58') AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2020-01-01 00:00:00') AND ("t"."created_at" <= '2020-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_cash_cost_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("t"."is_payment_settle"=TRUE) AND ("t"."created_at" >= '2025-08-08 14:34:58') AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2020-01-01 00:00:00') AND ("t"."created_at" <= '2020-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cost_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cost_tickets" "t" ON am.erp_cost_ticket_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2020-01-01 00:00:00') AND ("t"."created_at" <= '2020-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_cost_tickets" "t" ON pd.project_id = t.project_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2020-01-01 00:00:00') AND ("t"."created_at" <= '2020-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cost_convert_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cost_convert_tickets" "t" ON am.erp_cost_convert_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2020-01-01 00:00:00') AND ("t"."created_at" <= '2020-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_cost_convert_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2020-01-01 00:00:00') AND ("t"."created_at" <= '2020-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(eipss.actual_total_amount - eipss.total_amount), 0) as amount FROM "a57be577deb434"."tbl_erp_sales_gifts" "t" LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_gift_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2020-01-01 00:00:00') AND ("t"."created_at" <= '2020-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum((eipss.actual_total_amount - eipss.total_amount) * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_sales_gifts" "t" ON pd.project_id = t.project_id LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_gift_id = t.id WHERE ("t"."status"=2) AND ("t"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2020-01-01 00:00:00') AND ("t"."created_at" <= '2020-12-31 23:59:59') )) "sub" |
| 22:15:52.664 | 20.2 ms | yii\db\Command::query | SELECT sum(amount) as amount FROM ((SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cash_cost_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cash_cost_tickets" "t" ON am.erp_cash_cost_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("t"."is_payment_settle"=TRUE) AND ("t"."created_at" >= '2025-08-08 14:34:58') AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2017-01-01 00:00:00') AND ("t"."created_at" <= '2017-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_cash_cost_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("t"."is_payment_settle"=TRUE) AND ("t"."created_at" >= '2025-08-08 14:34:58') AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2017-01-01 00:00:00') AND ("t"."created_at" <= '2017-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cost_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cost_tickets" "t" ON am.erp_cost_ticket_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2017-01-01 00:00:00') AND ("t"."created_at" <= '2017-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_cost_tickets" "t" ON pd.project_id = t.project_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2017-01-01 00:00:00') AND ("t"."created_at" <= '2017-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cost_convert_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cost_convert_tickets" "t" ON am.erp_cost_convert_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2017-01-01 00:00:00') AND ("t"."created_at" <= '2017-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_cost_convert_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2017-01-01 00:00:00') AND ("t"."created_at" <= '2017-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(eipss.actual_total_amount - eipss.total_amount), 0) as amount FROM "a57be577deb434"."tbl_erp_sales_gifts" "t" LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_gift_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2017-01-01 00:00:00') AND ("t"."created_at" <= '2017-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum((eipss.actual_total_amount - eipss.total_amount) * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_sales_gifts" "t" ON pd.project_id = t.project_id LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_gift_id = t.id WHERE ("t"."status"=2) AND ("t"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2017-01-01 00:00:00') AND ("t"."created_at" <= '2017-12-31 23:59:59') )) "sub" |
| 22:15:52.398 | 13.5 ms | yii\db\Command::query | SELECT sum(amount) as amount FROM ((SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cash_cost_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cash_cost_tickets" "t" ON am.erp_cash_cost_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("t"."is_payment_settle"=TRUE) AND ("t"."created_at" >= '2025-08-08 14:34:58') AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2025-01-01 00:00:00') AND ("t"."created_at" <= '2025-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_cash_cost_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("t"."is_payment_settle"=TRUE) AND ("t"."created_at" >= '2025-08-08 14:34:58') AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2025-01-01 00:00:00') AND ("t"."created_at" <= '2025-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cost_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cost_tickets" "t" ON am.erp_cost_ticket_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2025-01-01 00:00:00') AND ("t"."created_at" <= '2025-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_cost_tickets" "t" ON pd.project_id = t.project_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2025-01-01 00:00:00') AND ("t"."created_at" <= '2025-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_cost_convert_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_cost_convert_tickets" "t" ON am.erp_cost_convert_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2025-01-01 00:00:00') AND ("t"."created_at" <= '2025-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_cost_convert_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2025-01-01 00:00:00') AND ("t"."created_at" <= '2025-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum(eipss.actual_total_amount - eipss.total_amount), 0) as amount FROM "a57be577deb434"."tbl_erp_sales_gifts" "t" LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_gift_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2025-01-01 00:00:00') AND ("t"."created_at" <= '2025-12-31 23:59:59') ) UNION ALL ( SELECT COALESCE(sum((eipss.actual_total_amount - eipss.total_amount) * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_sales_gifts" "t" ON pd.project_id = t.project_id LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_gift_id = t.id WHERE ("t"."status"=2) AND ("t"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2025-01-01 00:00:00') AND ("t"."created_at" <= '2025-12-31 23:59:59') )) "sub" |
| 22:15:52.319 | 7.7 ms | yii\db\Command::query | SELECT sum(actual_total_amount) as actual_total_amount, sum(total_amount) as total_amount FROM ((SELECT COALESCE(sum(eipss.actual_total_amount), 0) as actual_total_amount, COALESCE(sum(eipss.total_amount), 0) as total_amount FROM "a57be577deb434"."tbl_erp_sales_outbounds" "t" LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_outbound_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2026-01-01 00:00:00') AND ("t"."created_at" <= '2026-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(eipss.actual_total_amount * am.pct / 100), 0) as actual_total_amount, COALESCE(sum(eipss.total_amount * am.pct / 100), 0) as total_amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_sales_outbounds" "t" ON pd.project_id = t.project_id LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_outbound_id = t.id WHERE ("t"."status"=2) AND ("t"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2026-01-01 00:00:00') AND ("t"."created_at" <= '2026-12-31 23:59:59') )) "sub" |
| 22:15:52.328 | 7.3 ms | yii\db\Command::query | SELECT sum(amount) as amount FROM ((SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_other_income_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_other_income_tickets" "t" ON am.erp_other_income_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2026-01-01 00:00:00') AND ("t"."created_at" <= '2026-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_other_income_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2026-01-01 00:00:00') AND ("t"."created_at" <= '2026-12-31 23:59:59') )) "sub" |
| 22:15:52.276 | 5.7 ms | yii\db\Connection::open | Opening DB connection: pgsql:host=postgresql.server.local;port=5432;dbname=beta |
| 22:15:52.591 | 4.4 ms | yii\db\Command::query | SELECT sum(amount) as amount FROM ((SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_other_income_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_other_income_tickets" "t" ON am.erp_other_income_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2019-01-01 00:00:00') AND ("t"."created_at" <= '2019-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_other_income_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2019-01-01 00:00:00') AND ("t"."created_at" <= '2019-12-31 23:59:59') )) "sub" |
| 22:15:52.311 | 3.7 ms | yii\db\Command::query | SELECT COALESCE(sum(budget), 0) as budget, COALESCE(sum(cost), 0) as cost, COALESCE(sum(expense), 0) as expense, COALESCE(sum(profit), 0) as profit FROM "a57be577deb434"."tbl_erp_user_profits" "t" WHERE ("t"."created_at" >= '2026-01-01 00:00:00') AND ("t"."created_at" <= '2026-12-31 23:59:59') |
| 22:15:52.689 | 3.6 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/erp-analysis/sales-year-histogram', '{"project_status":"3","alert":"false","web_access_token":"4PRqkvfbFxlQtWIcg4m99LDGwofOdZol"}', '{"code":2000,"result":{"category":{"budgetCategory":["2026\u8d22\u5e74","2025\u8d22\u5e74","2024\u8d22\u5e74","2023\u8d22\u5e74","2022\u8d22\u5e74","2021\u8d22\u5e74","2020\u8d22\u5e74","2019\u8d22\u5e74","2018\u8d22\u5e74","2017\u8d22\u5e74"],"profitsCategory":["2026\u8d22\u5e74","2025\u8d22\u5e74","2024\u8d22\u5e74","2023\u8d22\u5e74","2022\u8d22\u5e74","2021\u8d22\u5e74","2020\u8d22\u5e74","2019\u8d22\u5e74","2018\u8d22\u5e74","2017\u8d22\u5e74"],"clientCategory":["2026\u8d22\u5e74","2025\u8d22\u5e74","2024\u8d22\u5e74","2023\u8d22\u5e74","2022\u8d22\u5e74","2021\u8d22\u5e74","2020\u8d22\u5e74","2019\u8d22\u5e74","2018\u8d22\u5e74","2017\u8d22\u5e74"],"projectCategory":["2026\u8d22\u5e74","2025\u8d22\u5e74","2024\u8d22\u5e74","2023\u8d22\u5e74","2022\u8d22\u5e74","2021\u8d22\u5e74","2020\u8d22\u5e74","2019\u8d22\u5e74","2018\u8d22\u5e74","2017\u8d22\u5e74"]},"seriesBudget":[{"key":"erpfascal2026","name":"2026\u8d22\u5e74","y":"198016896.20"},{"key":"erpfascal2025","name":"2025\u8d22\u5e74","y":"34822861.05"},{"key":"erpfascal2024","name":"2024\u8d22\u5e74","y":"0.00"},{"key":"erpfascal2023","name":"2023\u8d22\u5e74","y":"0.00"},{"key":"erpfascal2022","name":"2022\u8d22\u5e74","y":"0.00"},{"key":"erpfascal2021","name":"2021\u8d22\u5e74","y":"0.00"},{"key":"erpfascal2020","name":"2020\u8d22\u5e74","y":"0.00"},{"key":"erpfascal2019","name":"2019\u8d22\u5e74","y":"0.00"},{"key":"erpfascal2018","name":"2018\u8d22\u5e74","y":"0.00"},{"key":"erpfascal2017","name":"2017\u8d22\u5e74","y":"0.00"}],"seriesProfits":[{"key":"erpfascal2026","name":"2026\u8d22\u5e74","y":"191206790.35"},{"key":"erpfascal2025","name":"2025\u8d22\u5e74","y":"5171012.14"},{"key":"erpfascal2024","name":"2024\u8d22\u5e74","y":"0.00"},{"key":"erpfascal2023","name":"2023\u8d22\u5e74","y":"0.00"},{"key":"erpfascal2022","name":"2022\u8d22\u5e74","y":"0.00"},{"key":"erpfascal2021","name":"2021\u8d22\u5e74","y":"0.00"},{"key":"erpfascal2020","name":"2020\u8d22\u5e74","y":"0.00"},{"key":"erpfascal2019","name":"2019\u8d22\u5e74","y":"0.00"},{"key":"erpfascal2018","name":"2018\u8d22\u5e74","y":"0.00"},{"key":"erpfascal2017","name":"2017\u8d22\u5e74","y":"0.00"}],"seriesClients":[{"key":"erpfascal2026","name":"2026\u8d22\u5e74","y":36},{"key":"erpfascal2025","name":"2025\u8d22\u5e74","y":100},{"key":"erpfascal2024","name":"2024\u8d22\u5e74","y":110},{"key":"erpfascal2023","name":"2023\u8d22\u5e74","y":111},{"key":"erpfascal2022","name":"2022\u8d22\u5e74","y":87},{"key":"erpfascal2021","name":"2021\u8d22\u5e74","y":79},{"key":"erpfascal2020","name":"2020\u8d22\u5e74","y":66},{"key":"erpfascal2019","name":"2019\u8d22\u5e74","y":78},{"key":"erpfascal2018","name":"2018\u8d22\u5e74","y":87},{"key":"erpfascal2017","name":"2017\u8d22\u5e74","y":55}],"seriesProjects":[{"key":"erpfascal2026","name":"2026\u8d22\u5e74","y":44},{"key":"erpfascal2025","name":"2025\u8d22\u5e74","y":237},{"key":"erpfascal2024","name":"2024\u8d22\u5e74","y":254},{"key":"erpfascal2023","name":"2023\u8d22\u5e74","y":205},{"key":"erpfascal2022","name":"2022\u8d22\u5e74","y":156},{"key":"erpfascal2021","name":"2021\u8d22\u5e74","y":139},{"key":"erpfascal2020","name":"2020\u8d22\u5e74","y":146},{"key":"erpfascal2019","name":"2019\u8d22\u5e74","y":167},{"key":"erpfascal2018","name":"2018\u8d22\u5e74","y":205},{"key":"erpfascal2017","name":"2017\u8d22\u5e74","y":140}]},"status":1,"msg":[{"name":"success","success":"\u6210\u529f\u83b7\u53d6\u6570\u636e","error":""}],"mod":0,"ip":"111.194.208.14","ua":"Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/150.0.0.0 Safari\/537.36"}', FALSE, '2026-07-07 22:15:52', 418596864) RETURNING "id" |
| 22:15:52.514 | 3.5 ms | yii\db\Command::query | SELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2020-12-01') AND ("is_settle"=TRUE) |
| 22:15:52.282 | 3.1 ms | yii\db\Command::query | SELECT * FROM "global"."vw_user_login" WHERE "id"=5250 |
| 22:15:52.297 | 3.0 ms | yii\db\Command::query | SELECT MIN(bargain_date) FROM "a57be577deb434"."tbl_projects" |
| 22:15:52.307 | 3.0 ms | yii\db\Command::query | SELECT count(distinct p.client_id) as clients, count(distinct p.id) as projects FROM "a57be577deb434"."tbl_projects" "p" WHERE ("project_status"=3) AND ("p"."created_by" 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)) AND (p.bargain_date IS NOT NULL) AND ("p"."bargain_date" >= '2026-01-01 00:00:00') AND ("p"."bargain_date" <= '2026-12-31 23:59:59') |
| 22:15:52.586 | 2.1 ms | yii\db\Command::query | SELECT count(distinct p.client_id) as clients, count(distinct p.id) as projects FROM "a57be577deb434"."tbl_projects" "p" WHERE ("project_status"=3) AND ("p"."created_by" 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)) AND (p.bargain_date IS NOT NULL) AND ("p"."bargain_date" >= '2019-01-01 00:00:00') AND ("p"."bargain_date" <= '2019-12-31 23:59:59') |
| 22:15:52.393 | 2.1 ms | yii\db\Command::query | SELECT sum(actual_total_amount) as actual_total_amount, sum(total_amount) as total_amount FROM ((SELECT COALESCE(sum(eipss.actual_total_amount), 0) as actual_total_amount, COALESCE(sum(eipss.total_amount), 0) as total_amount FROM "a57be577deb434"."tbl_erp_sales_outbounds" "t" LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_outbound_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2025-01-01 00:00:00') AND ("t"."created_at" <= '2025-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(eipss.actual_total_amount * am.pct / 100), 0) as actual_total_amount, COALESCE(sum(eipss.total_amount * am.pct / 100), 0) as total_amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_sales_outbounds" "t" ON pd.project_id = t.project_id LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_outbound_id = t.id WHERE ("t"."status"=2) AND ("t"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2025-01-01 00:00:00') AND ("t"."created_at" <= '2025-12-31 23:59:59') )) "sub" |
| 22:15:52.288 | 2.0 ms | yii\db\Command::query | SELECT * FROM "a57be577deb434"."tbl_users" WHERE "id"=1001 |
| 22:15:52.656 | 2.0 ms | yii\db\Command::query | SELECT count(distinct p.client_id) as clients, count(distinct p.id) as projects FROM "a57be577deb434"."tbl_projects" "p" WHERE ("project_status"=3) AND ("p"."created_by" 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)) AND (p.bargain_date IS NOT NULL) AND ("p"."bargain_date" >= '2017-01-01 00:00:00') AND ("p"."bargain_date" <= '2017-12-31 23:59:59') |
| 22:15:52.628 | 2.0 ms | yii\db\Command::query | SELECT sum(actual_total_amount) as actual_total_amount, sum(total_amount) as total_amount FROM ((SELECT COALESCE(sum(eipss.actual_total_amount), 0) as actual_total_amount, COALESCE(sum(eipss.total_amount), 0) as total_amount FROM "a57be577deb434"."tbl_erp_sales_outbounds" "t" LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_outbound_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2018-01-01 00:00:00') AND ("t"."created_at" <= '2018-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(eipss.actual_total_amount * am.pct / 100), 0) as actual_total_amount, COALESCE(sum(eipss.total_amount * am.pct / 100), 0) as total_amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_sales_outbounds" "t" ON pd.project_id = t.project_id LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_outbound_id = t.id WHERE ("t"."status"=2) AND ("t"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2018-01-01 00:00:00') AND ("t"."created_at" <= '2018-12-31 23:59:59') )) "sub" |
| 22:15:52.555 | 2.0 ms | yii\db\Command::query | SELECT count(distinct p.client_id) as clients, count(distinct p.id) as projects FROM "a57be577deb434"."tbl_projects" "p" WHERE ("project_status"=3) AND ("p"."created_by" 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)) AND (p.bargain_date IS NOT NULL) AND ("p"."bargain_date" >= '2020-01-01 00:00:00') AND ("p"."bargain_date" <= '2020-12-31 23:59:59') |
| 22:15:52.625 | 2.0 ms | yii\db\Command::query | SELECT count(distinct p.client_id) as clients, count(distinct p.id) as projects FROM "a57be577deb434"."tbl_projects" "p" WHERE ("project_status"=3) AND ("p"."created_by" 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)) AND (p.bargain_date IS NOT NULL) AND ("p"."bargain_date" >= '2018-01-01 00:00:00') AND ("p"."bargain_date" <= '2018-12-31 23:59:59') |
| 22:15:52.449 | 2.0 ms | yii\db\Command::query | SELECT count(distinct p.client_id) as clients, count(distinct p.id) as projects FROM "a57be577deb434"."tbl_projects" "p" WHERE ("project_status"=3) AND ("p"."created_by" 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)) AND (p.bargain_date IS NOT NULL) AND ("p"."bargain_date" >= '2023-01-01 00:00:00') AND ("p"."bargain_date" <= '2023-12-31 23:59:59') |
| 22:15:52.414 | 2.0 ms | yii\db\Command::query | SELECT count(distinct p.client_id) as clients, count(distinct p.id) as projects FROM "a57be577deb434"."tbl_projects" "p" WHERE ("project_status"=3) AND ("p"."created_by" 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)) AND (p.bargain_date IS NOT NULL) AND ("p"."bargain_date" >= '2024-01-01 00:00:00') AND ("p"."bargain_date" <= '2024-12-31 23:59:59') |
| 22:15:52.452 | 1.9 ms | yii\db\Command::query | SELECT sum(actual_total_amount) as actual_total_amount, sum(total_amount) as total_amount FROM ((SELECT COALESCE(sum(eipss.actual_total_amount), 0) as actual_total_amount, COALESCE(sum(eipss.total_amount), 0) as total_amount FROM "a57be577deb434"."tbl_erp_sales_outbounds" "t" LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_outbound_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2023-01-01 00:00:00') AND ("t"."created_at" <= '2023-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(eipss.actual_total_amount * am.pct / 100), 0) as actual_total_amount, COALESCE(sum(eipss.total_amount * am.pct / 100), 0) as total_amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_sales_outbounds" "t" ON pd.project_id = t.project_id LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_outbound_id = t.id WHERE ("t"."status"=2) AND ("t"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2023-01-01 00:00:00') AND ("t"."created_at" <= '2023-12-31 23:59:59') )) "sub" |
| 22:15:52.390 | 1.9 ms | yii\db\Command::query | SELECT count(distinct p.client_id) as clients, count(distinct p.id) as projects FROM "a57be577deb434"."tbl_projects" "p" WHERE ("project_status"=3) AND ("p"."created_by" 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)) AND (p.bargain_date IS NOT NULL) AND ("p"."bargain_date" >= '2025-01-01 00:00:00') AND ("p"."bargain_date" <= '2025-12-31 23:59:59') |
| 22:15:52.481 | 1.9 ms | yii\db\Command::query | SELECT count(distinct p.client_id) as clients, count(distinct p.id) as projects FROM "a57be577deb434"."tbl_projects" "p" WHERE ("project_status"=3) AND ("p"."created_by" 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)) AND (p.bargain_date IS NOT NULL) AND ("p"."bargain_date" >= '2022-01-01 00:00:00') AND ("p"."bargain_date" <= '2022-12-31 23:59:59') |
| 22:15:52.659 | 1.9 ms | yii\db\Command::query | SELECT sum(actual_total_amount) as actual_total_amount, sum(total_amount) as total_amount FROM ((SELECT COALESCE(sum(eipss.actual_total_amount), 0) as actual_total_amount, COALESCE(sum(eipss.total_amount), 0) as total_amount FROM "a57be577deb434"."tbl_erp_sales_outbounds" "t" LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_outbound_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2017-01-01 00:00:00') AND ("t"."created_at" <= '2017-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(eipss.actual_total_amount * am.pct / 100), 0) as actual_total_amount, COALESCE(sum(eipss.total_amount * am.pct / 100), 0) as total_amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_sales_outbounds" "t" ON pd.project_id = t.project_id LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_outbound_id = t.id WHERE ("t"."status"=2) AND ("t"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2017-01-01 00:00:00') AND ("t"."created_at" <= '2017-12-31 23:59:59') )) "sub" |
| 22:15:52.558 | 1.9 ms | yii\db\Command::query | SELECT sum(actual_total_amount) as actual_total_amount, sum(total_amount) as total_amount FROM ((SELECT COALESCE(sum(eipss.actual_total_amount), 0) as actual_total_amount, COALESCE(sum(eipss.total_amount), 0) as total_amount FROM "a57be577deb434"."tbl_erp_sales_outbounds" "t" LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_outbound_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2020-01-01 00:00:00') AND ("t"."created_at" <= '2020-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(eipss.actual_total_amount * am.pct / 100), 0) as actual_total_amount, COALESCE(sum(eipss.total_amount * am.pct / 100), 0) as total_amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_sales_outbounds" "t" ON pd.project_id = t.project_id LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_outbound_id = t.id WHERE ("t"."status"=2) AND ("t"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2020-01-01 00:00:00') AND ("t"."created_at" <= '2020-12-31 23:59:59') )) "sub" |
| 22:15:52.419 | 1.9 ms | yii\db\Command::query | SELECT sum(amount) as amount FROM ((SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_other_income_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_other_income_tickets" "t" ON am.erp_other_income_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2024-01-01 00:00:00') AND ("t"."created_at" <= '2024-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_other_income_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2024-01-01 00:00:00') AND ("t"."created_at" <= '2024-12-31 23:59:59') )) "sub" |
| 22:15:52.519 | 1.9 ms | yii\db\Command::query | SELECT count(distinct p.client_id) as clients, count(distinct p.id) as projects FROM "a57be577deb434"."tbl_projects" "p" WHERE ("project_status"=3) AND ("p"."created_by" 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)) AND (p.bargain_date IS NOT NULL) AND ("p"."bargain_date" >= '2021-01-01 00:00:00') AND ("p"."bargain_date" <= '2021-12-31 23:59:59') |
| 22:15:52.484 | 1.9 ms | yii\db\Command::query | SELECT sum(actual_total_amount) as actual_total_amount, sum(total_amount) as total_amount FROM ((SELECT COALESCE(sum(eipss.actual_total_amount), 0) as actual_total_amount, COALESCE(sum(eipss.total_amount), 0) as total_amount FROM "a57be577deb434"."tbl_erp_sales_outbounds" "t" LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_outbound_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2022-01-01 00:00:00') AND ("t"."created_at" <= '2022-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(eipss.actual_total_amount * am.pct / 100), 0) as actual_total_amount, COALESCE(sum(eipss.total_amount * am.pct / 100), 0) as total_amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_sales_outbounds" "t" ON pd.project_id = t.project_id LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_outbound_id = t.id WHERE ("t"."status"=2) AND ("t"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2022-01-01 00:00:00') AND ("t"."created_at" <= '2022-12-31 23:59:59') )) "sub" |
| 22:15:52.630 | 1.9 ms | yii\db\Command::query | SELECT sum(amount) as amount FROM ((SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_other_income_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_other_income_tickets" "t" ON am.erp_other_income_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2018-01-01 00:00:00') AND ("t"."created_at" <= '2018-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_other_income_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2018-01-01 00:00:00') AND ("t"."created_at" <= '2018-12-31 23:59:59') )) "sub" |
| 22:15:52.589 | 1.9 ms | yii\db\Command::query | SELECT sum(actual_total_amount) as actual_total_amount, sum(total_amount) as total_amount FROM ((SELECT COALESCE(sum(eipss.actual_total_amount), 0) as actual_total_amount, COALESCE(sum(eipss.total_amount), 0) as total_amount FROM "a57be577deb434"."tbl_erp_sales_outbounds" "t" LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_outbound_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2019-01-01 00:00:00') AND ("t"."created_at" <= '2019-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(eipss.actual_total_amount * am.pct / 100), 0) as actual_total_amount, COALESCE(sum(eipss.total_amount * am.pct / 100), 0) as total_amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_sales_outbounds" "t" ON pd.project_id = t.project_id LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_outbound_id = t.id WHERE ("t"."status"=2) AND ("t"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2019-01-01 00:00:00') AND ("t"."created_at" <= '2019-12-31 23:59:59') )) "sub" |
| 22:15:52.396 | 1.9 ms | yii\db\Command::query | SELECT sum(amount) as amount FROM ((SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_other_income_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_other_income_tickets" "t" ON am.erp_other_income_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2025-01-01 00:00:00') AND ("t"."created_at" <= '2025-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_other_income_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2025-01-01 00:00:00') AND ("t"."created_at" <= '2025-12-31 23:59:59') )) "sub" |
| 22:15:52.486 | 1.8 ms | yii\db\Command::query | SELECT sum(amount) as amount FROM ((SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_other_income_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_other_income_tickets" "t" ON am.erp_other_income_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2022-01-01 00:00:00') AND ("t"."created_at" <= '2022-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_other_income_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2022-01-01 00:00:00') AND ("t"."created_at" <= '2022-12-31 23:59:59') )) "sub" |
| 22:15:52.455 | 1.8 ms | yii\db\Command::query | SELECT sum(amount) as amount FROM ((SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_other_income_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_other_income_tickets" "t" ON am.erp_other_income_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2023-01-01 00:00:00') AND ("t"."created_at" <= '2023-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_other_income_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2023-01-01 00:00:00') AND ("t"."created_at" <= '2023-12-31 23:59:59') )) "sub" |
| 22:15:52.560 | 1.8 ms | yii\db\Command::query | SELECT sum(amount) as amount FROM ((SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_other_income_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_other_income_tickets" "t" ON am.erp_other_income_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2020-01-01 00:00:00') AND ("t"."created_at" <= '2020-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_other_income_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2020-01-01 00:00:00') AND ("t"."created_at" <= '2020-12-31 23:59:59') )) "sub" |
| 22:15:52.524 | 1.8 ms | yii\db\Command::query | SELECT sum(amount) as amount FROM ((SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_other_income_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_other_income_tickets" "t" ON am.erp_other_income_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2021-01-01 00:00:00') AND ("t"."created_at" <= '2021-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_other_income_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2021-01-01 00:00:00') AND ("t"."created_at" <= '2021-12-31 23:59:59') )) "sub" |
| 22:15:52.662 | 1.8 ms | yii\db\Command::query | SELECT sum(amount) as amount FROM ((SELECT COALESCE(sum(am.amount), 0) as amount FROM "a57be577deb434"."tbl_erp_other_income_ticket_handlers" "am" LEFT JOIN "a57be577deb434"."tbl_erp_other_income_tickets" "t" ON am.erp_other_income_ticket_id = t.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND (("sc"."from_project" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (sales_contract_id is null)) AND ("t"."created_at" >= '2017-01-01 00:00:00') AND ("t"."created_at" <= '2017-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(t.amount * am.pct / 100), 0) as amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_sales_contracts" "sc" ON sc.from_project = pd.project_id LEFT JOIN "a57be577deb434"."tbl_erp_other_income_tickets" "t" ON sc.id = t.sales_contract_id WHERE ("t"."status"=2) AND ("pd"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2017-01-01 00:00:00') AND ("t"."created_at" <= '2017-12-31 23:59:59') )) "sub" |
| 22:15:52.417 | 1.8 ms | yii\db\Command::query | SELECT sum(actual_total_amount) as actual_total_amount, sum(total_amount) as total_amount FROM ((SELECT COALESCE(sum(eipss.actual_total_amount), 0) as actual_total_amount, COALESCE(sum(eipss.total_amount), 0) as total_amount FROM "a57be577deb434"."tbl_erp_sales_outbounds" "t" LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_outbound_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2024-01-01 00:00:00') AND ("t"."created_at" <= '2024-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(eipss.actual_total_amount * am.pct / 100), 0) as actual_total_amount, COALESCE(sum(eipss.total_amount * am.pct / 100), 0) as total_amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_sales_outbounds" "t" ON pd.project_id = t.project_id LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_outbound_id = t.id WHERE ("t"."status"=2) AND ("t"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2024-01-01 00:00:00') AND ("t"."created_at" <= '2024-12-31 23:59:59') )) "sub" |
| 22:15:52.522 | 1.8 ms | yii\db\Command::query | SELECT sum(actual_total_amount) as actual_total_amount, sum(total_amount) as total_amount FROM ((SELECT COALESCE(sum(eipss.actual_total_amount), 0) as actual_total_amount, COALESCE(sum(eipss.total_amount), 0) as total_amount FROM "a57be577deb434"."tbl_erp_sales_outbounds" "t" LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_outbound_id = t.id WHERE ("t"."status"=2) AND (("t"."project_id" NOT IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) OR (t.project_id is null)) AND ("t"."created_at" >= '2021-01-01 00:00:00') AND ("t"."created_at" <= '2021-12-31 23:59:59')) UNION ALL ( SELECT COALESCE(sum(eipss.actual_total_amount * am.pct / 100), 0) as actual_total_amount, COALESCE(sum(eipss.total_amount * am.pct / 100), 0) as total_amount FROM "a57be577deb434"."tbl_erp_profit_distribute_pcts" "am" LEFT JOIN "a57be577deb434"."tbl_erp_profit_distributes" "pd" ON am.erp_profit_distribute_id = pd.id LEFT JOIN "a57be577deb434"."tbl_erp_sales_outbounds" "t" ON pd.project_id = t.project_id LEFT JOIN "a57be577deb434"."tbl_erp_inventory_product_spents" "eipss" ON eipss.erp_sales_outbound_id = t.id WHERE ("t"."status"=2) AND ("t"."project_id" IN (SELECT t.project_id FROM "a57be577deb434"."tbl_erp_profit_distributes" "t" WHERE ("t"."status"=2) AND (t.project_id IS NOT NULL) GROUP BY "t"."project_id")) AND ("t"."created_at" >= '2021-01-01 00:00:00') AND ("t"."created_at" <= '2021-12-31 23:59:59') )) "sub" |
| 22:15:52.305 | 0.9 ms | yii\db\Command::query | SELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2025-12-01') AND ("is_settle"=TRUE) |
| 22:15:52.286 | 0.8 ms | yii\db\Command::query | SELECT * FROM "global"."vw_user_login" WHERE "id"=1001 |
| 22:15:52.296 | 0.7 ms | yii\db\Command::query | SELECT * FROM "global"."tbl_enterprises" WHERE "id"=2 |
| 22:15:52.584 | 0.6 ms | yii\db\Command::query | SELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2018-12-01') AND ("is_settle"=TRUE) |
| 22:15:52.389 | 0.5 ms | yii\db\Command::query | SELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2024-12-01') AND ("is_settle"=TRUE) |
| 22:15:52.553 | 0.5 ms | yii\db\Command::query | SELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2019-12-01') AND ("is_settle"=TRUE) |
| 22:15:52.621 | 0.5 ms | yii\db\Command::query | SELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2017-12-01') AND ("is_settle"=TRUE) |
| 22:15:52.655 | 0.5 ms | yii\db\Command::query | SELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2016-12-01') AND ("is_settle"=TRUE) |
| 22:15:52.479 | 0.5 ms | yii\db\Command::query | SELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2021-12-01') AND ("is_settle"=TRUE) |
| 22:15:52.448 | 0.5 ms | yii\db\Command::query | SELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2022-12-01') AND ("is_settle"=TRUE) |
| 22:15:52.624 | 0.5 ms | yii\db\Command::query | SELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2018-12-01') AND ("is_settle"=TRUE) |
| 22:15:52.588 | 0.5 ms | yii\db\Command::query | SELECT COALESCE(sum(budget), 0) as budget, COALESCE(sum(cost), 0) as cost, COALESCE(sum(expense), 0) as expense, COALESCE(sum(profit), 0) as profit FROM "a57be577deb434"."tbl_erp_user_profits" "t" WHERE ("t"."created_at" >= '2019-01-01 00:00:00') AND ("t"."created_at" <= '2019-12-31 23:59:59') |
| 22:15:52.659 | 0.4 ms | yii\db\Command::query | SELECT COALESCE(sum(budget), 0) as budget, COALESCE(sum(cost), 0) as cost, COALESCE(sum(expense), 0) as expense, COALESCE(sum(profit), 0) as profit FROM "a57be577deb434"."tbl_erp_user_profits" "t" WHERE ("t"."created_at" >= '2017-01-01 00:00:00') AND ("t"."created_at" <= '2017-12-31 23:59:59') |
| 22:15:52.452 | 0.4 ms | yii\db\Command::query | SELECT COALESCE(sum(budget), 0) as budget, COALESCE(sum(cost), 0) as cost, COALESCE(sum(expense), 0) as expense, COALESCE(sum(profit), 0) as profit FROM "a57be577deb434"."tbl_erp_user_profits" "t" WHERE ("t"."created_at" >= '2023-01-01 00:00:00') AND ("t"."created_at" <= '2023-12-31 23:59:59') |
| 22:15:52.392 | 0.4 ms | yii\db\Command::query | SELECT COALESCE(sum(budget), 0) as budget, COALESCE(sum(cost), 0) as cost, COALESCE(sum(expense), 0) as expense, COALESCE(sum(profit), 0) as profit FROM "a57be577deb434"."tbl_erp_user_profits" "t" WHERE ("t"."created_at" >= '2025-01-01 00:00:00') AND ("t"."created_at" <= '2025-12-31 23:59:59') |
| 22:15:52.557 | 0.4 ms | yii\db\Command::query | SELECT COALESCE(sum(budget), 0) as budget, COALESCE(sum(cost), 0) as cost, COALESCE(sum(expense), 0) as expense, COALESCE(sum(profit), 0) as profit FROM "a57be577deb434"."tbl_erp_user_profits" "t" WHERE ("t"."created_at" >= '2020-01-01 00:00:00') AND ("t"."created_at" <= '2020-12-31 23:59:59') |
| 22:15:52.627 | 0.4 ms | yii\db\Command::query | SELECT COALESCE(sum(budget), 0) as budget, COALESCE(sum(cost), 0) as cost, COALESCE(sum(expense), 0) as expense, COALESCE(sum(profit), 0) as profit FROM "a57be577deb434"."tbl_erp_user_profits" "t" WHERE ("t"."created_at" >= '2018-01-01 00:00:00') AND ("t"."created_at" <= '2018-12-31 23:59:59') |
| 22:15:52.412 | 0.4 ms | yii\db\Command::query | SELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2023-12-01') AND ("is_settle"=TRUE) |
| 22:15:52.448 | 0.4 ms | yii\db\Command::query | SELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2023-12-01') AND ("is_settle"=TRUE) |
| 22:15:52.521 | 0.4 ms | yii\db\Command::query | SELECT COALESCE(sum(budget), 0) as budget, COALESCE(sum(cost), 0) as cost, COALESCE(sum(expense), 0) as expense, COALESCE(sum(profit), 0) as profit FROM "a57be577deb434"."tbl_erp_user_profits" "t" WHERE ("t"."created_at" >= '2021-01-01 00:00:00') AND ("t"."created_at" <= '2021-12-31 23:59:59') |
| 22:15:52.416 | 0.4 ms | yii\db\Command::query | SELECT COALESCE(sum(budget), 0) as budget, COALESCE(sum(cost), 0) as cost, COALESCE(sum(expense), 0) as expense, COALESCE(sum(profit), 0) as profit FROM "a57be577deb434"."tbl_erp_user_profits" "t" WHERE ("t"."created_at" >= '2024-01-01 00:00:00') AND ("t"."created_at" <= '2024-12-31 23:59:59') |
| 22:15:52.483 | 0.4 ms | yii\db\Command::query | SELECT COALESCE(sum(budget), 0) as budget, COALESCE(sum(cost), 0) as cost, COALESCE(sum(expense), 0) as expense, COALESCE(sum(profit), 0) as profit FROM "a57be577deb434"."tbl_erp_user_profits" "t" WHERE ("t"."created_at" >= '2022-01-01 00:00:00') AND ("t"."created_at" <= '2022-12-31 23:59:59') |
| 22:15:52.518 | 0.4 ms | yii\db\Command::query | SELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2021-12-01') AND ("is_settle"=TRUE) |
| 22:15:52.306 | 0.4 ms | yii\db\Command::query | SELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2026-12-01') AND ("is_settle"=TRUE) |
| 22:15:52.585 | 0.3 ms | yii\db\Command::query | SELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2019-12-01') AND ("is_settle"=TRUE) |
| 22:15:52.480 | 0.3 ms | yii\db\Command::query | SELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2022-12-01') AND ("is_settle"=TRUE) |
| 22:15:52.553 | 0.3 ms | yii\db\Command::query | SELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2020-12-01') AND ("is_settle"=TRUE) |
| 22:15:52.390 | 0.3 ms | yii\db\Command::query | SELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2025-12-01') AND ("is_settle"=TRUE) |
| 22:15:52.655 | 0.3 ms | yii\db\Command::query | SELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2017-12-01') AND ("is_settle"=TRUE) |
| 22:15:52.413 | 0.3 ms | yii\db\Command::query | SELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2024-12-01') AND ("is_settle"=TRUE) |