From 6341d70f363a8f7345981c9e40d1c372319d044d Mon Sep 17 00:00:00 2001 From: kimbokon Date: Sun, 4 Jan 2026 19:19:49 +0900 Subject: [PATCH] =?UTF-8?q?=EC=84=9C=EB=B2=84=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=EB=B2=A0=EC=9D=B4=EC=8A=A4=20=EC=9E=90=EB=8F=99=20?= =?UTF-8?q?=EB=A7=88=EC=9D=B4=EA=B7=B8=EB=A0=88=EC=9D=B4=EC=85=98=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80=20(=EB=88=84=EB=9D=BD?= =?UTF-8?q?=20=EC=BB=AC=EB=9F=BC=20=EC=9E=90=EB=8F=99=20=EC=83=9D=EC=84=B1?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- salesmanagement/api/get_performance.php | 2 +- salesmanagement/api/sales_tenants.php | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/salesmanagement/api/get_performance.php b/salesmanagement/api/get_performance.php index 3a9bb2d..a989045 100644 --- a/salesmanagement/api/get_performance.php +++ b/salesmanagement/api/get_performance.php @@ -50,7 +50,7 @@ try { FROM sales_record WHERE member_id = ? AND status = 'completed' AND contract_date BETWEEN ? AND ? UNION ALL - SELECT p.id, t.name as customer, p.contract_date as contractDate, p.contract_amount as amount + SELECT p.id, t.tenant_name as customer, p.contract_date as contractDate, p.contract_amount as amount FROM sales_tenant_products p JOIN sales_tenants t ON p.tenant_id = t.id WHERE (t.sales_manager_id = ? OR (t.sales_manager_id IS NULL AND t.manager_id = ?)) diff --git a/salesmanagement/api/sales_tenants.php b/salesmanagement/api/sales_tenants.php index 7015450..362f872 100644 --- a/salesmanagement/api/sales_tenants.php +++ b/salesmanagement/api/sales_tenants.php @@ -139,6 +139,24 @@ try { if (!in_array('consultation_type', $cols)) { $pdo->exec("ALTER TABLE `sales_tenant_consultations` ADD COLUMN `consultation_type` varchar(20) DEFAULT 'text' AFTER `attachment_paths` "); } + // 5. sales_tenants 테이블에 sales_manager_id 컬럼 추가 + $check5 = $pdo->query("SHOW COLUMNS FROM `sales_tenants` LIKE 'sales_manager_id'")->fetch(); + if (!$check5) { + $pdo->exec("ALTER TABLE `sales_tenants` ADD COLUMN `sales_manager_id` int(11) DEFAULT NULL AFTER `manager_id` "); + } + + // 6. sales_tenant_products 테이블 컬럼 확인 및 추가 + $prodCols = $pdo->query("SHOW COLUMNS FROM `sales_tenant_products`")->fetchAll(PDO::FETCH_COLUMN); + if (!in_array('operator_confirmed', $prodCols)) { + $pdo->exec("ALTER TABLE `sales_tenant_products` ADD COLUMN `operator_confirmed` tinyint(1) DEFAULT 0 AFTER `contract_date` "); + } + if (!in_array('sub_models', $prodCols)) { + $pdo->exec("ALTER TABLE `sales_tenant_products` ADD COLUMN `sub_models` text DEFAULT NULL AFTER `operator_confirmed` "); + } + if (!in_array('commission_amount', $prodCols)) { + $pdo->exec("ALTER TABLE `sales_tenant_products` ADD COLUMN `commission_amount` decimal(15,2) DEFAULT 0.00 AFTER `commission_rate` "); + } + } catch (Exception $e) { error_log("Migration error: " . $e->getMessage()); }