diff --git a/public_html/lib/user_process.php b/public_html/lib/user_process.php
index 28b23df..2ec9028 100644
--- a/public_html/lib/user_process.php
+++ b/public_html/lib/user_process.php
@@ -951,7 +951,6 @@ if ($actionStr == "DAILYRECORD") {
$columns[] = "h_balance_g";
$columns[] = "h_balance_e";
$columns[] = "h_balance_t";
- $columns[] = "h_createddate";
$columns[] = "h_comment";
$columns[] = "h_druid";
@@ -972,7 +971,6 @@ if ($actionStr == "DAILYRECORD") {
$h_balance_t = floatval($h_balance_o) + floatval($h_balance_in) - floatval($h_balance_r) - floatval($h_balance_out);
$values[] = $h_balance_t;
- $values[] = date("YmdHis");;
$values[] = str_replace("\\", "", trim($h_comment));
$values[] = $h_druid;
@@ -983,14 +981,32 @@ if ($actionStr == "DAILYRECORD") {
//exit;
if($mode == "create") {
- $jdb->iQuery("tbl_memberhis", $columns, $values);
- $msg = "Saved successfully.";
-
- $urlSTR = "/index_intranet.php?view=order_list&".$goStr;
- $func -> modalMsg ($msg, $urlSTR);
- exit();
- }
-
+
+ // 중복 체크 (h_date + h_druid) → 있으면 update 로 전환
+ $qry_dup = "SELECT h_uid FROM tbl_memberhis
+ WHERE h_date = '$h_date'
+ AND h_druid = '$h_druid'
+ ORDER BY h_uid DESC
+ LIMIT 1";
+ $rt_dup = $jdb->fQuery($qry_dup, "record query error");
+
+ if (!empty($rt_dup['h_uid'])) {
+ // 기존 레코드 update
+ $jdb->uQuery("tbl_memberhis", $columns, $values, " where h_uid = '".$rt_dup['h_uid']."' ");
+ $msg = "Updated successfully.";
+ } else {
+ $columns[] = "h_createddate";
+ $values[] = date("YmdHis");
+
+ // 신규 insert
+ $jdb->iQuery("tbl_memberhis", $columns, $values);
+ $msg = "Saved successfully.";
+ }
+
+ $urlSTR = "/index_intranet.php?view=order_list&".$goStr;
+ $func -> modalMsg ($msg, $urlSTR);
+ exit();
+ }
else if($mode == "update") {
$jdb->uQuery("tbl_memberhis", $columns, $values, " where h_uid = '$h_uid' ORDER BY h_uid DESC LIMIT 1 ");
$msg = "Updated successfully.";