| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- using SQLData;
- using System.Collections.Generic;
- using System.Data;
- namespace SiteCore.Handler
- {
- public partial class sync
- {
- //拿样导入接口
- public void get_erp_sample()
- {
- DataStruct dStruct = GetPostStruct();
- List<string> lw = new List<string>();
- string tid = GetPostString("tid");
- if (tid.Length > 0) lw.Add(string.Format("tid like '%{0}%'", tid));
- string shopName = GetPostString("shopName");
- if (shopName.Length > 0) lw.Add(string.Format("shopName like '%{0}%'", shopName));
- string SampleUser = GetPostString("SampleUser");
- if (SampleUser.Length > 0) lw.Add(string.Format("SampleUser like '%{0}%'", SampleUser));
- string date1 = GetPostString("date1");
- string date2 = GetPostString("date2");
- string dw = GetDateMinuteWhere("SampleDate", date1, date2);
- if (dw.Length > 0) lw.Add(dw);
- string PayDate1 = GetPostString("PayDate1");
- string PayDate2 = GetPostString("PayDate2");
- string dw2 = GetDateMinuteWhere("pay_time", PayDate1, PayDate2);
- if (dw2.Length > 0) lw.Add(dw2);
- string Payment1 = GetPostString("Payment1");
- if (Payment1.Length > 0) lw.Add(string.Format("payment >= {0}", Payment1));
- string Payment2 = GetPostString("Payment2");
- if (Payment2.Length > 0) lw.Add(string.Format("payment <= {0}", Payment2));
- string ServiceFee1 = GetPostString("ServiceFee1");
- if (ServiceFee1.Length > 0) lw.Add(string.Format("ServiceFee >= {0}", ServiceFee1));
- string ServiceFee2 = GetPostString("ServiceFee2");
- if (ServiceFee2.Length > 0) lw.Add(string.Format("ServiceFee <= {0}", ServiceFee2));
- string LogisticsFee1 = GetPostString("LogisticsFee1");
- if (LogisticsFee1.Length > 0) lw.Add(string.Format("LogisticsFee >= {0}", LogisticsFee1));
- string LogisticsFee2 = GetPostString("LogisticsFee2");
- if (LogisticsFee2.Length > 0) lw.Add(string.Format("LogisticsFee <= {0}", LogisticsFee2));
- string Commission1 = GetPostString("Commission1");
- if (Commission1.Length > 0) lw.Add(string.Format("Commission >= {0}", Commission1));
- string Commission2 = GetPostString("Commission2");
- if (Commission2.Length > 0) lw.Add(string.Format("Commission <= {0}", Commission2));
- dStruct.Order = "ctid desc";
- dStruct.MainWhere = string.Join(" and ", lw.ToArray());
- DataTable dt = WebCache.GetData("view_ErpTradeSample", dStruct);
- writeGridDataTableJson(dStruct.TotalCount, dt);
- }
- //拿样导入那边 上面的统计
- public void get_erp_sample_gather()
- {
- //发货前的统计
- List<string> lw = new List<string>();
- string tid = GetPostString("tid");
- if (tid.Length > 0) lw.Add(string.Format("tid like '%{0}%'", tid));
- string shop = GetPostString("shop");
- if (shop.Length > 0) lw.Add(string.Format("shopName='{0}'", shop));
- string date1 = GetPostString("date1");
- string date2 = GetPostString("date2");
- string dw = GetDateMinuteWhere("SampleDate", date1, date2);
- if (dw.Length > 0) lw.Add(dw);
- string PayDate1 = GetPostString("PayDate1");
- string PayDate2 = GetPostString("PayDate2");
- string dw2 = GetDateMinuteWhere("pay_time", PayDate1, PayDate2);
- if (dw2.Length > 0) lw.Add(dw2);
- string orderWhere = string.Join(" and ", lw.ToArray());
- string sql = "";
- //根据时间 做发货前的统计
- if (orderWhere.Length <= 0)
- {
- sql = string.Format("select count(tid) as countNum,sum(payment) as sumPrice, sum(ServiceFee) as sumService, sum(Commission) as sumCom, sum(LogisticsFee) as sumLogist from view_ErpTradeSample ");
- }
- else
- sql = string.Format("select count(tid) as countNum,sum(payment) as sumPrice, sum(ServiceFee) as sumService, sum(Commission) as sumCom, sum(LogisticsFee) as sumLogist from view_ErpTradeSample where " + orderWhere);
- DataTable dt = DbHelper.DbConn.ExecuteDataset(sql).Tables[0];
- //writeGridDataTableJson(dt.Rows.Count, dt);
- returnSuccess(Utils.Serialization.JsonString.DataTable2MiniAjaxJson(dt));
- }
- }
- }
|