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!;");
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);
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>>();
// 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);
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);
//
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);
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"],
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"],
string pe_id = "";
string ps_no = "";
int is_earn = 0;
+ int is_dc = 0;
foreach (ListViewItem item in selected)
{
{
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;
+ }
}
}
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)
string pe_id = "";
string ps_no = "";
int is_earn = 0;
+ int is_dc = 0;
foreach (ListViewItem item in selected)
{
{
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;
+ }
}
}
}
else
{
- result = dbc.updateDisposableIsEarn_log(pe_id, ps_no);
+ result = dbc.updateDisposableIsEarn_log(pe_id, ps_no, 0, is_dc);
}
if (result == 1)