index d2a27b385c727c46ed9201b8d8f28c32e90a1848..06d46808a29d0450127ba050c1ee33b4a4be4d93 100644 (file)
Binary files a/.vs/newton-cn/v16/.suo and b/.vs/newton-cn/v16/.suo differ
+ SqlCommand cmd_select = new SqlCommand(sql, conn);
+
+ int result = cmd_select.ExecuteNonQuery();
+
+ return result;
+ }
+ public List<Dictionary<string, string>> getDisposableIsEarn(string selected)
+ {
+ List<Dictionary<string, string>> result = new List<Dictionary<string, string>>();
+#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, 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= '1099')), 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= '1099'))
+ 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= '1099')), 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= '1099'))
+ 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')
+ where
+ a1.ps_prcode in (
+ select pr_code from pr where kind_code= '1099'
+ )
+ and a1.ps_date between '" + selected + @"' and dateadd(day, 1, '" + selected + @"')
+ order by
+ a1.pe_id desc;
+
+ create table disposable_earn_point_status(
+ pe_id varchar,
+ ps_no varchar,
+ is_earn bit default 0,
+ udate datetime default getdate()
+ );
+ ";
+
+ SqlCommand cmd_select = new SqlCommand(sql, conn);
+
+ SqlDataReader rd = cmd_select.ExecuteReader();
+
+ while (rd.Read())
+ {
+ 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);
+ }
+
+ return result;
+ }
public List<Dictionary<string, string>> getList(string item)
{
List<Dictionary<string, string>> result = new List<Dictionary<string, string>>();
index acf3fac466934322ca990db58beee4c516308271..6229883aa305a64b158bd226deebc03344d71fae 100644 (file)
Binary files a/newton-cn/bin/Debug/newton-cn.exe and b/newton-cn/bin/Debug/newton-cn.exe differ
index 6f5b658f5cf29f7fe244737e186a19da3d9f0aac..2569670350dd6af20593014a37977b9973aee122 100644 (file)
Binary files a/newton-cn/bin/Debug/newton-cn.pdb and b/newton-cn/bin/Debug/newton-cn.pdb differ
index 328c5ac9bad0bbb82b826103e50179c57e0c0868..8c45cb42fd47b55612edf07c9e36ad965212d48d 100644 (file)
Binary files a/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ
index fa65fa58e3f5cc8753643e1b3f2a87bd969e30e0..0b3325a0627d9207340c90439346d4333385aad9 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 acf3fac466934322ca990db58beee4c516308271..6229883aa305a64b158bd226deebc03344d71fae 100644 (file)
Binary files a/newton-cn/obj/Debug/newton-cn.exe and b/newton-cn/obj/Debug/newton-cn.exe differ
index 6f5b658f5cf29f7fe244737e186a19da3d9f0aac..2569670350dd6af20593014a37977b9973aee122 100644 (file)
Binary files a/newton-cn/obj/Debug/newton-cn.pdb and b/newton-cn/obj/Debug/newton-cn.pdb differ