]> insang Git - newton-cn_pos.git/commitdiff
일회용적립, 매출정보 업데이트
authornewton-cn <insang@kakao.com>
Thu, 1 May 2025 02:27:28 +0000 (11:27 +0900)
committernewton-cn <insang@kakao.com>
Thu, 1 May 2025 02:27:28 +0000 (11:27 +0900)
16 files changed:
.vs/newton-cn/v16/.suo
newton-cn/DBConnector.cs
newton-cn/Form5.Designer.cs
newton-cn/Form5.cs
newton-cn/bin/Debug/newton-cn.exe
newton-cn/bin/Debug/newton-cn.pdb
newton-cn/bin/Release/newton-cn.exe
newton-cn/bin/Release/newton-cn.pdb
newton-cn/obj/Debug/DesignTimeResolveAssemblyReferences.cache
newton-cn/obj/Debug/newton-cn.csproj.AssemblyReference.cache
newton-cn/obj/Debug/newton-cn.csproj.GenerateResource.cache
newton-cn/obj/Debug/newton-cn.exe
newton-cn/obj/Debug/newton-cn.pdb
newton-cn/obj/Release/newton-cn.csproj.GenerateResource.cache
newton-cn/obj/Release/newton-cn.exe
newton-cn/obj/Release/newton-cn.pdb

index 71801c8c41c93e9f020c323cc3b3b290a7cfb901..20ef7ecdb22ba2654d46367f442819e8fe392540 100644 (file)
Binary files a/.vs/newton-cn/v16/.suo and b/.vs/newton-cn/v16/.suo differ
index 6f321e68ea2a03805a2743cced1e66b441279acb..5d31fd32bd531aa5f5b05e5db6480d8eb3325442 100644 (file)
@@ -32,7 +32,7 @@ namespace newton_cn
 
             return result;
         }
-        public int updateDisposableIsEarn_log(string pe_id, string ps_no)
+        public int updateDisposableIsEarn_log(string pe_id, string ps_no, double addPoint, int is_dc)
         {
 #if DEBUG
             SqlConnection conn = new SqlConnection("Data Source=newton-cn1.iptime.org, 1818; Initial Catalog=food; User ID=newton; Password=newton123!;");
@@ -43,7 +43,7 @@ namespace newton_cn
 
             string sql = "";
             sql += @"
-                insert into disposable_earn_point_status (pe_id, ps_no, is_earn) values('" + pe_id + @"', '" + ps_no + @"', 1)
+                insert into disposable_earn_point_status (pe_id, ps_no, is_earn) values('" + pe_id + @"', '" + ps_no + @"', 1, '" + addPoint + @"', '" + is_dc + @"')
             ";
 
             SqlCommand cmd_select = new SqlCommand(sql, conn);
@@ -75,96 +75,44 @@ namespace newton_cn
         public List<Dictionary<string, string>> getDisposableIsEarn(string selected)
         {
             List<Dictionary<string, string>> result = new List<Dictionary<string, string>>();
+
+
+            string procedure = "usp_GetProductSalesDetailsByDate";
 #if DEBUG
             SqlConnection conn = new SqlConnection("Data Source=newton-cn1.iptime.org, 1818; Initial Catalog=food; User ID=newton; Password=newton123!;");
 #else
             SqlConnection conn = new SqlConnection("Data Source=localhost; Initial Catalog=food; User ID=newton; Password=newton123!;");
 #endif
-            
             conn.Open();
 
-            string sql = "";
-            sql += @"
-                select
-                    CONVERT(CHAR(19), a1.ps_date, 20) as ps_date,
-                    a2.ct_code,
-                    a2.ct_name + '(' + a5.ct_phone + ')' as ct_name,
-                    a1.ps_prname,
-                    cast(a1.ps_qty as int) ps_qty,
-                    cast(
-                        a1.ps_up
-                        +
-                        case when (
-                            isnull(
-                                (
-                                    isnull((select sum(ps_up * ps_qty) from ps where pe_id = a1.pe_id and ps_prcode not in (select pr_code from pr where kind_code = '1100') and ps_prcode not in (select pr_code from pr where kind_code in ('1099', '1105', '1106', '1107', '1108'))), 0)
-                                    +
-                                    (
-                                        select
-                                            sum(ps_up * ps_qty) / (select count(pe_id) from ps where pe_id = a1.pe_id and ps_prcode not in (select pr_code from pr where kind_code = '1100') and ps_prcode in (select pr_code from pr where kind_code in ('1099', '1105', '1106', '1107', '1108')))
-                                        from
-                                            ps
-                                        where
-                                            ps_prcode in (select pr_code from pr where kind_code = '1100') and pe_id = a1.pe_id
-                                    )
-                                )
-                            , 0)
-                        ) < 0 then
-                        isnull(
-                            (
-                                isnull((select sum(ps_up * ps_qty) from ps where pe_id = a1.pe_id and ps_prcode not in (select pr_code from pr where kind_code = '1100') and ps_prcode not in (select pr_code from pr where kind_code in ('1099', '1105', '1106', '1107', '1108'))), 0)
-                                +
-                                (
-                                    select
-                                        sum(ps_up * ps_qty) / (select count(pe_id) from ps where pe_id = a1.pe_id and ps_prcode not in (select pr_code from pr where kind_code = '1100') and ps_prcode in (select pr_code from pr where kind_code in ('1099', '1105', '1106', '1107', '1108')))
-                                    from
-                                        ps
-                                    where
-                                        ps_prcode in (select pr_code from pr where kind_code = '1100') and pe_id = a1.pe_id
-                                )
-                            )
-                        , 0) else
-                        0 end
-                    as int) as pe_bamt,
-                    a1.pe_id,
-                    a1.ps_no,
-                    isnull(a3.is_earn, 0) as is_earn
-                from
-                    ps a1
-                    join pe a2 on a1.pe_id = a2.pe_id and a2.ct_code != ''
-                    left join disposable_earn_point_status a3 on a3.pe_id = a1.pe_id and a3.ps_no = a1.ps_no
-                    join ac a4 on a4.pe_id = a1.pe_id and a4.ac_fncd2 not in ('01', '00')
-                    join ct a5 on a5.ct_code = a2.ct_code
-                where 
-                    a1.ps_prcode in (
-                        select pr_code from pr where kind_code in ('1099', '1105', '1106', '1107', '1108')
-                    )
-                    and a1.ps_date between '" + selected + @"' and dateadd(day, 1, '" + selected + @"')
-                order by
-                    a1.pe_id desc
-            ";
 
-            SqlCommand cmd_select = new SqlCommand(sql, conn);
+            SqlCommand cmd_select = new SqlCommand(procedure, conn);
+            cmd_select.CommandType = CommandType.StoredProcedure;
 
-            SqlDataReader rd = cmd_select.ExecuteReader();
+            cmd_select.Parameters.Add(new SqlParameter("@SelectedDate", SqlDbType.NVarChar, 50)).Value = selected;
 
-            while (rd.Read())
+            SqlDataAdapter dataAdapter = new SqlDataAdapter(cmd_select);
+            DataTable resultTable = new DataTable();
+            dataAdapter.Fill(resultTable);
+
+            foreach (DataRow row in resultTable.Rows)
             {
-                Dictionary<string, string> dict = new Dictionary<string, string>();
-                dict["ps_date"] = rd["ps_date"].ToString();
-                dict["ct_code"] = rd["ct_code"].ToString();
-                dict["ct_name"] = rd["ct_name"].ToString();
-                dict["ps_prname"] = rd["ps_prname"].ToString();
-                dict["ps_qty"] = rd["ps_qty"].ToString();
-                dict["pe_bamt"] = rd["pe_bamt"].ToString();
-                dict["pe_id"] = rd["pe_id"].ToString();
-                dict["ps_no"] = rd["ps_no"].ToString();
-                dict["is_earn"] = rd["is_earn"].ToString();
-                result.Add(dict);
+                Dictionary<string, string> rowDict = new Dictionary<string, string>();
+
+                foreach (DataColumn col in resultTable.Columns)
+                {
+                    object value = row[col];
+                    rowDict[col.ColumnName] = value != DBNull.Value ? value.ToString() : string.Empty;
+                }
+
+                result.Add(rowDict);
             }
 
+            conn.Close();
+
             return result;
         }
+        
         public List<Dictionary<string, string>> getList(string item)
         {
             List<Dictionary<string, string>> result = new List<Dictionary<string, string>>();
index 351acda825280e7ddb11c3d3c61200ed6b2742c1..4b1971364d758811d8eaee42f3639f054686de1b 100644 (file)
@@ -82,7 +82,7 @@ namespace newton_cn
             // button2
             // 
             this.button2.Font = new System.Drawing.Font("굴림", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
-            this.button2.ForeColor = System.Drawing.Color.Black;
+            this.button2.ForeColor = System.Drawing.Color.Red;
             this.button2.Location = new System.Drawing.Point(532, 358);
             this.button2.Name = "button2";
             this.button2.Size = new System.Drawing.Size(105, 39);
@@ -96,19 +96,21 @@ namespace newton_cn
             this.label2.AutoSize = true;
             this.label2.Font = new System.Drawing.Font("굴림", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
             this.label2.ForeColor = System.Drawing.Color.Red;
-            this.label2.Location = new System.Drawing.Point(36, 51);
+            this.label2.Location = new System.Drawing.Point(122, 52);
             this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(571, 21);
+            this.label2.Size = new System.Drawing.Size(393, 21);
             this.label2.TabIndex = 5;
-            this.label2.Text = "# 이 화면은 회원 결제건중 일회용 현금구매 내역만 나옴";
+            this.label2.Text = "# 회원 결제건중 일회용 현금구매 내역";
             // 
             // button3
             // 
+            this.button3.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
+            this.button3.ForeColor = System.Drawing.SystemColors.MenuHighlight;
             this.button3.Location = new System.Drawing.Point(285, 358);
             this.button3.Name = "button3";
             this.button3.Size = new System.Drawing.Size(165, 39);
             this.button3.TabIndex = 6;
-            this.button3.Text = "ì\9d´ë¯¸ ì\88\98기ë¡\9c ì \81립í\95\98ì\98\80ì\9d\8c";
+            this.button3.Text = "ì¦\89ì\8b\9cí\95 ì\9d¸ í\9b\84 ë¯¸ì \81립";
             this.button3.UseVisualStyleBackColor = true;
             this.button3.Click += new System.EventHandler(this.button3_Click);
             // 
index 11bb6d437b584899356e4080e5fb796a5af2185d..60ec262db27bd21a7120040abdf44620dfde6c2a 100644 (file)
@@ -30,10 +30,11 @@ namespace newton_cn
 
             listView1.Columns.Add("구매일시", 160);
             listView1.Columns.Add("회원명", 105);
-            listView1.Columns.Add("상품명", 170);
+            listView1.Columns.Add("상품명", 160);
             listView1.Columns.Add("갯수", 50);
             listView1.Columns.Add("대상금액", 70);
-            listView1.Columns.Add("적립여부", 70);
+            listView1.Columns.Add("적립", 40);
+            listView1.Columns.Add("할인", 40);
             listView1.Columns.Add("pe_id", 70);
             listView1.Columns.Add("ps_no", 70);
             listView1.Columns.Add("ct_code", 70);
@@ -56,6 +57,7 @@ namespace newton_cn
                     list[i]["ps_qty"],
                     list[i]["pe_bamt"],
                     Convert.ToBoolean(list[i]["is_earn"]) ? "O" : "X",
+                    list[i]["is_dc"],
                     list[i]["pe_id"],
                     list[i]["ps_no"],
                     list[i]["ct_code"],
@@ -89,6 +91,7 @@ namespace newton_cn
                     list[i]["ps_qty"],
                     list[i]["pe_bamt"],
                     Convert.ToBoolean(list[i]["is_earn"]) ? "O" : "X",
+                    list[i]["is_dc"],
                     list[i]["pe_id"],
                     list[i]["ps_no"],
                     list[i]["ct_code"],
@@ -112,6 +115,7 @@ namespace newton_cn
             string pe_id = "";
             string ps_no = "";
             int is_earn = 0;
+            int is_dc = 0;
             foreach (ListViewItem item in selected)
             {
 
@@ -129,18 +133,22 @@ namespace newton_cn
                     {
                         is_earn = item.SubItems[i].Text == "X" ? 0 : 1;
                     }
-                    else if (i == 6)
+                    else if (i == 7)
                     {
                         pe_id = item.SubItems[i].Text;
                     }
-                    else if (i == 7)
+                    else if (i == 8)
                     {
                         ps_no = item.SubItems[i].Text;
                     }
-                    else if (i == 8)
+                    else if (i == 9)
                     {
                         ct_code = item.SubItems[i].Text;
                     }
+                    else if (i == 6)
+                    {
+                        is_dc = item.SubItems[i].Text == "X" ? 0 : 1;
+                    }
                 }
             }
 
@@ -163,7 +171,7 @@ namespace newton_cn
 
             if (result == 1)
             {
-                result = dbc.updateDisposableIsEarn_log(pe_id, ps_no);
+                result = dbc.updateDisposableIsEarn_log(pe_id, ps_no, addPoint, is_dc);
             }
 
             if (result == 1)
@@ -179,6 +187,7 @@ namespace newton_cn
             string pe_id = "";
             string ps_no = "";
             int is_earn = 0;
+            int is_dc = 0;
 
             foreach (ListViewItem item in selected)
             {
@@ -190,14 +199,18 @@ namespace newton_cn
                     {
                         is_earn = item.SubItems[i].Text == "X" ? 0 : 1;
                     }
-                    else if (i == 6)
+                    else if (i == 7)
                     {
                         pe_id = item.SubItems[i].Text;
                     }
-                    else if (i == 7)
+                    else if (i == 8)
                     {
                         ps_no = item.SubItems[i].Text;
                     }
+                    else if (i == 6)
+                    {
+                        is_dc = item.SubItems[i].Text == "X" ? 0 : 1;
+                    }
 
                 }
             }
@@ -218,7 +231,7 @@ namespace newton_cn
             }
             else
             {
-                result = dbc.updateDisposableIsEarn_log(pe_id, ps_no);
+                result = dbc.updateDisposableIsEarn_log(pe_id, ps_no, 0, is_dc);
             }
 
             if (result == 1)
index 3cabd7ded2584dc975cf0ed47b5d486973cc6c91..45981b2b355c92402fd0a0987b1b4502a6d92c85 100644 (file)
Binary files a/newton-cn/bin/Debug/newton-cn.exe and b/newton-cn/bin/Debug/newton-cn.exe differ
index 364ef462d77729d6ce1f4e1a1fc79d9ad9a603d3..9937db620cfb6a3158d50156075bd78c4a9a1f1b 100644 (file)
Binary files a/newton-cn/bin/Debug/newton-cn.pdb and b/newton-cn/bin/Debug/newton-cn.pdb differ
index 7de6975f439d0dae0dd05ca71196e61c7d2a4c9d..4b77901432ed236c62e0ab539f9cb6564ee5f8f7 100644 (file)
Binary files a/newton-cn/bin/Release/newton-cn.exe and b/newton-cn/bin/Release/newton-cn.exe differ
index e671505fd295ce5c109d4c87568fd8c19ca282ce..2cd624afbc2bbcb4aae2de79a4a0affeb0a5b253 100644 (file)
Binary files a/newton-cn/bin/Release/newton-cn.pdb and b/newton-cn/bin/Release/newton-cn.pdb differ
index 0d1b7dbb92109d8a1887ec45cd7a678305f5a39a..c1257ac84767f333b9be35b43858523e04b1fc60 100644 (file)
Binary files a/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ
index 654fe63c3d45a2e8165502122afabf3ee530b55b..f5e894aea93a73e58fa9d4feab241bc197ee1a40 100644 (file)
Binary files a/newton-cn/obj/Debug/newton-cn.csproj.AssemblyReference.cache and b/newton-cn/obj/Debug/newton-cn.csproj.AssemblyReference.cache differ
index 1d4883f3caeffb4f2b1ff2b6b081f279c156b6c6..873ab10c0dfa266fada9c843339b51f5aca20085 100644 (file)
Binary files a/newton-cn/obj/Debug/newton-cn.csproj.GenerateResource.cache and b/newton-cn/obj/Debug/newton-cn.csproj.GenerateResource.cache differ
index 3cabd7ded2584dc975cf0ed47b5d486973cc6c91..45981b2b355c92402fd0a0987b1b4502a6d92c85 100644 (file)
Binary files a/newton-cn/obj/Debug/newton-cn.exe and b/newton-cn/obj/Debug/newton-cn.exe differ
index 364ef462d77729d6ce1f4e1a1fc79d9ad9a603d3..9937db620cfb6a3158d50156075bd78c4a9a1f1b 100644 (file)
Binary files a/newton-cn/obj/Debug/newton-cn.pdb and b/newton-cn/obj/Debug/newton-cn.pdb differ
index 1d4883f3caeffb4f2b1ff2b6b081f279c156b6c6..d20a9ecbacdbc5eec20d2e768c82daaddd181d91 100644 (file)
Binary files a/newton-cn/obj/Release/newton-cn.csproj.GenerateResource.cache and b/newton-cn/obj/Release/newton-cn.csproj.GenerateResource.cache differ
index 7de6975f439d0dae0dd05ca71196e61c7d2a4c9d..4b77901432ed236c62e0ab539f9cb6564ee5f8f7 100644 (file)
Binary files a/newton-cn/obj/Release/newton-cn.exe and b/newton-cn/obj/Release/newton-cn.exe differ
index e671505fd295ce5c109d4c87568fd8c19ca282ce..2cd624afbc2bbcb4aae2de79a4a0affeb0a5b253 100644 (file)
Binary files a/newton-cn/obj/Release/newton-cn.pdb and b/newton-cn/obj/Release/newton-cn.pdb differ