From: newton-cn Date: Thu, 1 May 2025 02:27:28 +0000 (+0900) Subject: 일회용적립, 매출정보 업데이트 X-Git-Url: https://git.insang.kr/gitweb/?a=commitdiff_plain;h=8ef67aa1e2e85a7a21f3610500617a4938b9375b;p=wevape-lu1_pos.git 일회용적립, 매출정보 업데이트 --- diff --git a/.vs/newton-cn/v16/.suo b/.vs/newton-cn/v16/.suo index 71801c8..20ef7ec 100644 Binary files a/.vs/newton-cn/v16/.suo and b/.vs/newton-cn/v16/.suo differ diff --git a/newton-cn/DBConnector.cs b/newton-cn/DBConnector.cs index 6f321e6..5d31fd3 100644 --- a/newton-cn/DBConnector.cs +++ b/newton-cn/DBConnector.cs @@ -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> getDisposableIsEarn(string selected) { List> result = new List>(); + + + 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 dict = new Dictionary(); - 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 rowDict = new Dictionary(); + + 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> getList(string item) { List> result = new List>(); diff --git a/newton-cn/Form5.Designer.cs b/newton-cn/Form5.Designer.cs index 351acda..4b19713 100644 --- a/newton-cn/Form5.Designer.cs +++ b/newton-cn/Form5.Designer.cs @@ -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 = "이미 수기로 적립하였음"; + this.button3.Text = "즉시할인 후 미적립"; this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.button3_Click); // diff --git a/newton-cn/Form5.cs b/newton-cn/Form5.cs index 11bb6d4..60ec262 100644 --- a/newton-cn/Form5.cs +++ b/newton-cn/Form5.cs @@ -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) diff --git a/newton-cn/bin/Debug/newton-cn.exe b/newton-cn/bin/Debug/newton-cn.exe index 3cabd7d..45981b2 100644 Binary files a/newton-cn/bin/Debug/newton-cn.exe and b/newton-cn/bin/Debug/newton-cn.exe differ diff --git a/newton-cn/bin/Debug/newton-cn.pdb b/newton-cn/bin/Debug/newton-cn.pdb index 364ef46..9937db6 100644 Binary files a/newton-cn/bin/Debug/newton-cn.pdb and b/newton-cn/bin/Debug/newton-cn.pdb differ diff --git a/newton-cn/bin/Release/newton-cn.exe b/newton-cn/bin/Release/newton-cn.exe index 7de6975..4b77901 100644 Binary files a/newton-cn/bin/Release/newton-cn.exe and b/newton-cn/bin/Release/newton-cn.exe differ diff --git a/newton-cn/bin/Release/newton-cn.pdb b/newton-cn/bin/Release/newton-cn.pdb index e671505..2cd624a 100644 Binary files a/newton-cn/bin/Release/newton-cn.pdb and b/newton-cn/bin/Release/newton-cn.pdb differ diff --git a/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferences.cache index 0d1b7db..c1257ac 100644 Binary files a/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/newton-cn/obj/Debug/newton-cn.csproj.AssemblyReference.cache b/newton-cn/obj/Debug/newton-cn.csproj.AssemblyReference.cache index 654fe63..f5e894a 100644 Binary files a/newton-cn/obj/Debug/newton-cn.csproj.AssemblyReference.cache and b/newton-cn/obj/Debug/newton-cn.csproj.AssemblyReference.cache differ diff --git a/newton-cn/obj/Debug/newton-cn.csproj.GenerateResource.cache b/newton-cn/obj/Debug/newton-cn.csproj.GenerateResource.cache index 1d4883f..873ab10 100644 Binary files a/newton-cn/obj/Debug/newton-cn.csproj.GenerateResource.cache and b/newton-cn/obj/Debug/newton-cn.csproj.GenerateResource.cache differ diff --git a/newton-cn/obj/Debug/newton-cn.exe b/newton-cn/obj/Debug/newton-cn.exe index 3cabd7d..45981b2 100644 Binary files a/newton-cn/obj/Debug/newton-cn.exe and b/newton-cn/obj/Debug/newton-cn.exe differ diff --git a/newton-cn/obj/Debug/newton-cn.pdb b/newton-cn/obj/Debug/newton-cn.pdb index 364ef46..9937db6 100644 Binary files a/newton-cn/obj/Debug/newton-cn.pdb and b/newton-cn/obj/Debug/newton-cn.pdb differ diff --git a/newton-cn/obj/Release/newton-cn.csproj.GenerateResource.cache b/newton-cn/obj/Release/newton-cn.csproj.GenerateResource.cache index 1d4883f..d20a9ec 100644 Binary files a/newton-cn/obj/Release/newton-cn.csproj.GenerateResource.cache and b/newton-cn/obj/Release/newton-cn.csproj.GenerateResource.cache differ diff --git a/newton-cn/obj/Release/newton-cn.exe b/newton-cn/obj/Release/newton-cn.exe index 7de6975..4b77901 100644 Binary files a/newton-cn/obj/Release/newton-cn.exe and b/newton-cn/obj/Release/newton-cn.exe differ diff --git a/newton-cn/obj/Release/newton-cn.pdb b/newton-cn/obj/Release/newton-cn.pdb index e671505..2cd624a 100644 Binary files a/newton-cn/obj/Release/newton-cn.pdb and b/newton-cn/obj/Release/newton-cn.pdb differ