diff --git a/TradeManageNew/DataNew.cs b/TradeManageNew/DataNew.cs index 9184336..8076bb6 100644 --- a/TradeManageNew/DataNew.cs +++ b/TradeManageNew/DataNew.cs @@ -31429,6 +31429,185 @@ where c.SKU1=@SKU"; } #endregion + + #region 保存 + public static int Save_CustomFee(HT_CustomFee Model) + { + string tsql = @" +if @id>0 +begin +Update [HT_CustomFee] set [customname]=@customname,[htdate]=@htdate,[htcode]=@htcode,[yjprice]=@yjprice,[rmbprice]=@rmbprice,[usdprice]=@usdprice,[njprice]=@njprice,[hyprice]=@hyprice,[hlrate]=@hlrate,[llrate]=@llrate,[totalrmbprice]=@totalrmbprice,[totalusdprice]=@totalusdprice,[yfprice]=@yfprice,[lxprice]=@lxprice,[inname]=@inname,[indate]=@indate,[state]=@state where id=@id +end +else +begin +INSERT INTO [HT_CustomFee]([customname],[htdate],[htcode],[yjprice],[rmbprice],[usdprice],[njprice],[hyprice],[hlrate],[llrate],[totalrmbprice],[totalusdprice],[yfprice],[lxprice],[inname],[indate],[state])values(@customname,@htdate,@htcode,@yjprice,@rmbprice,@usdprice,@njprice,@hyprice,@hlrate,@llrate,@totalrmbprice,@totalusdprice,@yfprice,@lxprice,@inname,@indate,@state) +set @id=SCOPE_IDENTITY() +end +select @id"; + Database db = DatabaseFactory.CreateDatabase(); + DbCommand cmd = db.GetSqlStringCommand(tsql); + db.AddInParameter(cmd, "@id", DbType.Int32, Model.id); + db.AddInParameter(cmd, "@customname", DbType.String, Model.customname); + db.AddInParameter(cmd, "@htdate", DbType.DateTime, Model.htdate); + db.AddInParameter(cmd, "@htcode", DbType.String, Model.htcode); + db.AddInParameter(cmd, "@yjprice", DbType.Decimal, Model.yjprice); + db.AddInParameter(cmd, "@rmbprice", DbType.Decimal, Model.rmbprice); + db.AddInParameter(cmd, "@usdprice", DbType.Decimal, Model.usdprice); + db.AddInParameter(cmd, "@njprice", DbType.Decimal, Model.njprice); + db.AddInParameter(cmd, "@hyprice", DbType.Decimal, Model.hyprice); + db.AddInParameter(cmd, "@hlrate", DbType.Decimal, Model.hlrate); + db.AddInParameter(cmd, "@llrate", DbType.Decimal, Model.llrate); + db.AddInParameter(cmd, "@totalrmbprice", DbType.Decimal, Model.totalrmbprice); + db.AddInParameter(cmd, "@totalusdprice", DbType.Decimal, Model.totalusdprice); + db.AddInParameter(cmd, "@yfprice", DbType.Decimal, Model.yfprice); + db.AddInParameter(cmd, "@lxprice", DbType.Decimal, Model.lxprice); + db.AddInParameter(cmd, "@inname", DbType.String, Model.inname); + db.AddInParameter(cmd, "@indate", DbType.DateTime, Model.indate); + db.AddInParameter(cmd, "@state", DbType.Int32, Model.state); + int a = Convert.ToInt32(db.ExecuteScalar(cmd)); + return a; + } + #endregion + #region 删除 + public static void Delete_CustomFee(int id) + { + string tsql = @" + delete from HT_CustomFee where id=@id"; + Database db = DatabaseFactory.CreateDatabase(); + DbCommand cmd = db.GetSqlStringCommand(tsql); + db.AddInParameter(cmd, "@id", DbType.Int32, id); + db.ExecuteNonQuery(cmd); + } + #endregion + #region 返回Model + public static HT_CustomFee GetModel_CustomFee(int id) + { + HT_CustomFee model = null; + //string tsql = "select a.id,a.customname,a.htdate,a.htcode,a.yjprice,a.rmbprice,a.usdprice,a.njprice,a.hyprice,a.hlrate,a.llrate,a.totalrmbprice,a.totalusdprice,a.yfprice,a.lxprice,a.inname,a.indate,a.state from HT_CustomFee"; + string tsql = @" + select * from HT_CustomFee where id=@id"; + Database db = DatabaseFactory.CreateDatabase(); + DbCommand cmd = db.GetSqlStringCommand(tsql); + db.AddInParameter(cmd, "@id", DbType.Int32, id); + DataSet ds = db.ExecuteDataSet(cmd); + if (ds.Tables[0].Rows.Count > 0) + { + model = ds.Tables[0].Rows[0].ToModel(); + } + return model; + } + #endregion + + + #region 返回列表 + public static List GetListCustomFee() + { + //string tsql = "select a.id,a.customname,a.htdate,a.htcode,a.yjprice,a.rmbprice,a.usdprice,a.njprice,a.hyprice,a.hlrate,a.llrate,a.totalrmbprice,a.totalusdprice,a.yfprice,a.lxprice,a.inname,a.indate,a.state from HT_CustomFee"; + string tsql = "select * from HT_CustomFee"; + Database db = DatabaseFactory.CreateDatabase(); + DbCommand cmd = db.GetSqlStringCommand(tsql); + DataTable tb = db.ExecuteDataTable(cmd); + List ListModel = tb.ToList(); + return ListModel; + } + #endregion + + + #region 分页动态条件查询 + public static List GetListCustomFee(string where, int PageIndex, int PageSize, string Sort, out int RowCount) + { + QueryService2 ser = new QueryService2(); + ser.Tsql = "select id=cast(a.id as int),a.customname,a.htdate,a.htcode,a.yjprice,a.rmbprice,a.usdprice,a.njprice,a.hyprice,a.hlrate,a.llrate,a.totalrmbprice,a.totalusdprice,a.yfprice,a.lxprice,a.inname,a.indate,a.state from HT_CustomFee a"; + ser.Tsql += " " + ser.Filter(where); + ser.PageIndex = PageIndex; + ser.PageSize = PageSize; + if (string.IsNullOrEmpty(Sort) == true) { ser.Sort = "a.id desc"; } + else { ser.Sort = Sort; } + string tsql = ser.GetText(); + List ListModel = null; + Database db = DatabaseFactory.CreateDatabase(); + DbCommand cmd = db.GetSqlStringCommand(tsql); + db.AddOutParameter(cmd, "@RowCount", DbType.Int32, 4); + DataTable tb = db.ExecuteDataTable(cmd); + RowCount = Convert.ToInt32(cmd.Parameters["@RowCount"].Value); + ListModel = tb.ToList(); + return ListModel; + } + #endregion + + #region 保存 + public static int Save_CustomFeeDetail(HT_CustomFeeDetail Model) + { + string tsql = @" +if @id>0 +begin +Update [HT_CustomFeeDetail] set [feeid]=@feeid,[feedate]=@feedate,[feermbprice]=@feermbprice,[feeusdprice]=@feeusdprice,[hlrate]=@hlrate,[feetype]=@feetype,[jsbprice]=@jsbprice,[jslxprice]=@jslxprice where id=@id +end +else +begin +INSERT INTO [HT_CustomFeeDetail]([feeid],[feedate],[feermbprice],[feeusdprice],[hlrate],[feetype],[jsbprice],[jslxprice])values(@feeid,@feedate,@feermbprice,@feeusdprice,@hlrate,@feetype,@jsbprice,@jslxprice) +set @id=SCOPE_IDENTITY() +end +select @id"; + Database db = DatabaseFactory.CreateDatabase(); + DbCommand cmd = db.GetSqlStringCommand(tsql); + db.AddInParameter(cmd, "@id", DbType.Int32, Model.id); + db.AddInParameter(cmd, "@feeid", DbType.Int32, Model.feeid); + db.AddInParameter(cmd, "@feedate", DbType.DateTime, Model.feedate); + db.AddInParameter(cmd, "@feermbprice", DbType.Decimal, Model.feermbprice); + db.AddInParameter(cmd, "@feeusdprice", DbType.Decimal, Model.feeusdprice); + db.AddInParameter(cmd, "@hlrate", DbType.Decimal, Model.hlrate); + db.AddInParameter(cmd, "@feetype", DbType.Int32, Model.feetype); + db.AddInParameter(cmd, "@jsbprice", DbType.Decimal, Model.jsbprice); + db.AddInParameter(cmd, "@jslxprice", DbType.Decimal, Model.jslxprice); + int a = Convert.ToInt32(db.ExecuteScalar(cmd)); + return a; + } + #endregion + #region 删除 + public static void Delete_CustomFeeDetail(int id) + { + string tsql = @" + delete from HT_CustomFeeDetail where id=@id"; + Database db = DatabaseFactory.CreateDatabase(); + DbCommand cmd = db.GetSqlStringCommand(tsql); + db.AddInParameter(cmd, "@id", DbType.Int32, id); + db.ExecuteNonQuery(cmd); + } + #endregion + #region 返回Model + public static HT_CustomFeeDetail GetModel_CustomFeeDetail(int id) + { + HT_CustomFeeDetail model = null; + //string tsql = "select a.id,a.feeid,a.feedate,a.feermbprice,a.feeusdprice,a.hlrate,a.feetype,a.jsbprice,a.jslxprice from HT_CustomFeeDetail"; + string tsql = @" + select * from HT_CustomFeeDetail where id=@id"; + Database db = DatabaseFactory.CreateDatabase(); + DbCommand cmd = db.GetSqlStringCommand(tsql); + db.AddInParameter(cmd, "@id", DbType.Int32, id); + DataSet ds = db.ExecuteDataSet(cmd); + if (ds.Tables[0].Rows.Count > 0) + { + model = ds.Tables[0].Rows[0].ToModel(); + } + return model; + } + #endregion + + #region 返回列表 + public static List GetListCustomFeeDetail(int feeid) + { + //string tsql = "select a.id,a.feeid,a.feedate,a.feermbprice,a.feeusdprice,a.hlrate,a.feetype,a.jsbprice,a.jslxprice from HT_CustomFeeDetail"; + string tsql = "select * from HT_CustomFeeDetail where feeid=@feeid order by a.feedate"; + Database db = DatabaseFactory.CreateDatabase(); + DbCommand cmd = db.GetSqlStringCommand(tsql); + db.AddInParameter(cmd, "@feeid", DbType.Int32, feeid); + DataTable tb = db.ExecuteDataTable(cmd); + List ListModel = tb.ToList(); + return ListModel; + } + #endregion + } - + } \ No newline at end of file diff --git a/TradeManageNew/ModelNew.cs b/TradeManageNew/ModelNew.cs index ede31a7..d6bf0fc 100644 --- a/TradeManageNew/ModelNew.cs +++ b/TradeManageNew/ModelNew.cs @@ -11427,4 +11427,120 @@ namespace TradeManageNew public Decimal? cb { get; set; } public Decimal? hwsf { get; set; } } + + public class HT_CustomFee + { + /// + /// id + /// + public Int32? id { get; set; } + /// + /// 客户 + /// + public String customname { get; set; } + /// + /// 合同日期 + /// + public DateTime? htdate { get; set; } + /// + /// htcode + /// + public String htcode { get; set; } + /// + /// 佣金 + /// + public Decimal? yjprice { get; set; } + /// + /// rmbprice + /// + public Decimal? rmbprice { get; set; } + /// + /// usdprice + /// + public Decimal? usdprice { get; set; } + /// + /// 内际金额 + /// + public Decimal? njprice { get; set; } + /// + /// 海运费 + /// + public Decimal? hyprice { get; set; } + /// + /// 汇率 + /// + public Decimal? hlrate { get; set; } + /// + /// 利率 + /// + public Decimal? llrate { get; set; } + /// + /// totalrmbprice + /// + public Decimal? totalrmbprice { get; set; } + /// + /// totalusdprice + /// + public Decimal? totalusdprice { get; set; } + /// + /// 已付多少 + /// + public Decimal? yfprice { get; set; } + /// + /// 累计利息多少 + /// + public Decimal? lxprice { get; set; } + /// + /// inname + /// + public String inname { get; set; } + /// + /// indate + /// + public DateTime? indate { get; set; } + /// + /// 0 未结清 1已结清 + /// + public Int32? state { get; set; } + public List ListModel { get; set; } + } + public class HT_CustomFeeDetail + { + /// + /// id + /// + public Int32? id { get; set; } + /// + /// feeid + /// + public Int32? feeid { get; set; } + /// + /// 支付日期 + /// + public DateTime? feedate { get; set; } + /// + /// feermbprice + /// + public Decimal? feermbprice { get; set; } + /// + /// feeusdprice + /// + public Decimal? feeusdprice { get; set; } + /// + /// 结算汇率 + /// + public Decimal? hlrate { get; set; } + /// + /// 1人民币结算 2美金结算 + /// + public Int32? feetype { get; set; } + /// + /// 结算时欠费金额 + /// + public Decimal? jsbprice { get; set; } + /// + /// 结算时产生的总利息 + /// + public Decimal? jslxprice { get; set; } + } } \ No newline at end of file