All Latest
6a4d0a18419a9: POST https://beta.jinchangxiao.com/vue/erp-analysis/sales-year-histogram at 2026-07-07 10:15:52 pm by 111.194.208.14

Performance Profiling

Total processing time: 430 ms; Peak memory: 5.422 MB. Show Profiling Timeline

总计77条数据
TimeDurationCategoryInfo
  
22:15:52.34740.5 msyii\db\Command::querySELECT 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.52724.9 msyii\db\Command::querySELECT 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.42224.9 msyii\db\Command::querySELECT 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.59723.3 msyii\db\Command::querySELECT 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.48920.8 msyii\db\Command::querySELECT 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.63320.6 msyii\db\Command::querySELECT 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.45820.5 msyii\db\Command::querySELECT 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.56320.5 msyii\db\Command::querySELECT 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.66420.2 msyii\db\Command::querySELECT 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.39813.5 msyii\db\Command::querySELECT 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.3197.7 msyii\db\Command::querySELECT 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.3287.3 msyii\db\Command::querySELECT 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.2765.7 msyii\db\Connection::openOpening DB connection: pgsql:host=postgresql.server.local;port=5432;dbname=beta
22:15:52.5914.4 msyii\db\Command::querySELECT 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.3113.7 msyii\db\Command::querySELECT 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.6893.6 msyii\db\Command::queryINSERT 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.5143.5 msyii\db\Command::querySELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2020-12-01') AND ("is_settle"=TRUE)
22:15:52.2823.1 msyii\db\Command::querySELECT * FROM "global"."vw_user_login" WHERE "id"=5250
22:15:52.2973.0 msyii\db\Command::querySELECT MIN(bargain_date) FROM "a57be577deb434"."tbl_projects"
22:15:52.3073.0 msyii\db\Command::querySELECT 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.5862.1 msyii\db\Command::querySELECT 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.3932.1 msyii\db\Command::querySELECT 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.2882.0 msyii\db\Command::querySELECT * FROM "a57be577deb434"."tbl_users" WHERE "id"=1001
22:15:52.6562.0 msyii\db\Command::querySELECT 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.6282.0 msyii\db\Command::querySELECT 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.5552.0 msyii\db\Command::querySELECT 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.6252.0 msyii\db\Command::querySELECT 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.4492.0 msyii\db\Command::querySELECT 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.4142.0 msyii\db\Command::querySELECT 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.4521.9 msyii\db\Command::querySELECT 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.3901.9 msyii\db\Command::querySELECT 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.4811.9 msyii\db\Command::querySELECT 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.6591.9 msyii\db\Command::querySELECT 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.5581.9 msyii\db\Command::querySELECT 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.4191.9 msyii\db\Command::querySELECT 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.5191.9 msyii\db\Command::querySELECT 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.4841.9 msyii\db\Command::querySELECT 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.6301.9 msyii\db\Command::querySELECT 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.5891.9 msyii\db\Command::querySELECT 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.3961.9 msyii\db\Command::querySELECT 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.4861.8 msyii\db\Command::querySELECT 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.4551.8 msyii\db\Command::querySELECT 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.5601.8 msyii\db\Command::querySELECT 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.5241.8 msyii\db\Command::querySELECT 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.6621.8 msyii\db\Command::querySELECT 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.4171.8 msyii\db\Command::querySELECT 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.5221.8 msyii\db\Command::querySELECT 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.3050.9 msyii\db\Command::querySELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2025-12-01') AND ("is_settle"=TRUE)
22:15:52.2860.8 msyii\db\Command::querySELECT * FROM "global"."vw_user_login" WHERE "id"=1001
22:15:52.2960.7 msyii\db\Command::querySELECT * FROM "global"."tbl_enterprises" WHERE "id"=2
22:15:52.5840.6 msyii\db\Command::querySELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2018-12-01') AND ("is_settle"=TRUE)
22:15:52.3890.5 msyii\db\Command::querySELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2024-12-01') AND ("is_settle"=TRUE)
22:15:52.5530.5 msyii\db\Command::querySELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2019-12-01') AND ("is_settle"=TRUE)
22:15:52.6210.5 msyii\db\Command::querySELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2017-12-01') AND ("is_settle"=TRUE)
22:15:52.6550.5 msyii\db\Command::querySELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2016-12-01') AND ("is_settle"=TRUE)
22:15:52.4790.5 msyii\db\Command::querySELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2021-12-01') AND ("is_settle"=TRUE)
22:15:52.4480.5 msyii\db\Command::querySELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2022-12-01') AND ("is_settle"=TRUE)
22:15:52.6240.5 msyii\db\Command::querySELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2018-12-01') AND ("is_settle"=TRUE)
22:15:52.5880.5 msyii\db\Command::querySELECT 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.6590.4 msyii\db\Command::querySELECT 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.4520.4 msyii\db\Command::querySELECT 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.3920.4 msyii\db\Command::querySELECT 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.5570.4 msyii\db\Command::querySELECT 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.6270.4 msyii\db\Command::querySELECT 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.4120.4 msyii\db\Command::querySELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2023-12-01') AND ("is_settle"=TRUE)
22:15:52.4480.4 msyii\db\Command::querySELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2023-12-01') AND ("is_settle"=TRUE)
22:15:52.5210.4 msyii\db\Command::querySELECT 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.4160.4 msyii\db\Command::querySELECT 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.4830.4 msyii\db\Command::querySELECT 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.5180.4 msyii\db\Command::querySELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2021-12-01') AND ("is_settle"=TRUE)
22:15:52.3060.4 msyii\db\Command::querySELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2026-12-01') AND ("is_settle"=TRUE)
22:15:52.5850.3 msyii\db\Command::querySELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2019-12-01') AND ("is_settle"=TRUE)
22:15:52.4800.3 msyii\db\Command::querySELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2022-12-01') AND ("is_settle"=TRUE)
22:15:52.5530.3 msyii\db\Command::querySELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2020-12-01') AND ("is_settle"=TRUE)
22:15:52.3900.3 msyii\db\Command::querySELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2025-12-01') AND ("is_settle"=TRUE)
22:15:52.6550.3 msyii\db\Command::querySELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2017-12-01') AND ("is_settle"=TRUE)
22:15:52.4130.3 msyii\db\Command::querySELECT * FROM "a57be577deb434"."tbl_erp_settles" WHERE ("date"='2024-12-01') AND ("is_settle"=TRUE)