using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using System.Data;
|
|
namespace DAL
|
{
|
public class ClsCB_ItemMoneyBill_Tmp:DBUtility.ClsXt_BaseBill
|
{
|
public Model.CB_ItemMoneyBill_TmpMain omodel = new Model.CB_ItemMoneyBill_TmpMain();
|
|
public ClsCB_ItemMoneyBill_Tmp()
|
{
|
base.MvarItemKeySub = "CB_ItemMoneyBill_Tmp";
|
base.MvarItemKeySub2 = "";
|
base.MvarItemKeySub3 = "";
|
base.MvarItemKeySub4 = "";
|
base.MvarItemKey = "CB_ItemMoneyBill_Tmp";
|
base.MvarReportTitle = "费用单明细记录";
|
base.BillType = "18020";
|
}
|
|
#region 固定代码
|
|
~ClsCB_ItemMoneyBill_Tmp()
|
{
|
|
}
|
|
#endregion 自定义方法
|
//修改单据
|
public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
//
|
oCn.BeginTran();
|
//更新主表
|
oCn.RunProc("UpDate CB_ItemMoneyBill_Tmp set " +
|
"HRoomID=" + omodel.HRoomID.ToString() +
|
",HItMoneyID=" + omodel.HItMoneyID.ToString() +
|
",HDate='" + omodel.HDate.ToShortDateString() + "'" +
|
",HBeginDate='" + omodel.HBeginDate.ToShortDateString() + "'" +
|
",HEndDate='" + omodel.HEndDate.ToShortDateString() + "'" +
|
",HQty=" + omodel.HQty.ToString() +
|
",HPrice=" + omodel.HPrice.ToString() +
|
",HMoney=" + omodel.HMoney.ToString() +
|
",HWaster=" + omodel.HWaster.ToString() +
|
",HBeginBalance=" + omodel.HBeginBalance.ToString() +
|
",HEndBalance=" + omodel.HEndBalance.ToString() +
|
",HTimes=" + omodel.HTimes.ToString() +
|
",HRelationQty=" + omodel.HRelationQty.ToString() +
|
",HRelationMoney=" + omodel.HRelationMoney.ToString() +
|
",HUpDater='" + omodel.HUpDater + "'" +
|
",HUpDateDate='" + omodel.HUpDateDate + "'" +
|
",HExplanation='" + omodel.HExplanation + "'" +
|
",HRemark='" + omodel.HRemark + "'" +
|
" where HItemID=" + lngBillKey.ToString());
|
//删除关联
|
DeleteRelation(ref sReturn, lngBillKey);
|
//
|
sReturn = "修改单据成功!";
|
oCn.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCn.RollBack();
|
throw (e);
|
}
|
}
|
|
public bool DeleteBill(Int64 lngBillKey, Int64 HYear, Int64 HPeriod, string HBillSubType, ref string sReturn)
|
{
|
try
|
{
|
oCn.BeginTran();
|
//删除重复记录
|
oCn.RunProc("Delete From CB_ItemMoneyBill_Tmp where HYear=" + HYear.ToString() + " and HPeriod=" + HPeriod.ToString() + " and HBillSubType='" + HBillSubType + "'");
|
sReturn = "删除单据成功!";
|
oCn.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCn.RollBack();
|
throw (e);
|
}
|
}
|
|
//新增单据
|
public override bool AddBill(ref string sReturn)
|
{
|
try
|
{
|
//得到mainid
|
//omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
|
omodel.HInterID = 0;
|
//若MAINDI重复则重新获取
|
oCn.BeginTran();
|
//主表
|
oCn.RunProc("Insert Into CB_ItemMoneyBill_Tmp " +
|
"(HBillType,HInterID,HDate,HBeginDate,HEndDate" +
|
",HYear,HPeriod,HBillSubType" +
|
",HMaker,HMakedate,HRoomID,HItMoneyID" +
|
",HQty,HPrice,HMoney,HWaster"+
|
",HBeginBalance,HEndBalance,HTimes" +
|
",HRelationQty,HRelationMoney" +
|
",HRemark,HExplanation" +
|
") " +
|
" values('" + this.BillType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HDate.ToShortDateString() + "','" + omodel.HBeginDate.ToShortDateString() + "','" + omodel.HEndDate.ToShortDateString() + "'" +
|
"," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HBillSubType + "'" +
|
",'" + DBUtility.ClsPub.CurUserName + "',getdate()," + omodel.HRoomID.ToString() + "," + omodel.HItMoneyID.ToString() +
|
"," + omodel.HQty.ToString() + "," + omodel.HPrice.ToString() + "," + omodel.HMoney.ToString() + "," + omodel.HWaster.ToString() +
|
"," + omodel.HBeginBalance.ToString() + "," + omodel.HEndBalance.ToString() + "," + omodel.HTimes.ToString() +
|
"," + omodel.HRelationQty.ToString() + "," + omodel.HRelationMoney.ToString() +
|
",'" + omodel.HRemark + "','" + omodel.HExplanation + "'" +
|
") ");
|
//
|
sReturn = "新增单据成功!";
|
oCn.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCn.RollBack();
|
throw (e);
|
}
|
}
|
//显示单据
|
public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
//查询主表
|
DataSet Ds ;
|
Ds = oCn.RunProcReturn("Select * from CB_ItemMoneyBill_Tmp Where HItemID=" + lngBillKey.ToString(), "CB_ItemMoneyBill_Tmp");
|
if(Ds.Tables[0].Rows.Count==0)
|
{
|
sReturn = "单据未找到!";
|
return false;
|
}
|
//赋值
|
omodel.HItemID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HItemID"]);
|
omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]);
|
omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]);
|
omodel.HDate = Convert.ToDateTime(Ds.Tables[0].Rows[0]["HDate"]);
|
omodel.HRemark = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
|
omodel.HExplanation = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HExplanation"]);
|
|
omodel.HBeginDate = Convert.ToDateTime(Ds.Tables[0].Rows[0]["HBeginDate"]);
|
omodel.HEndDate = Convert.ToDateTime(Ds.Tables[0].Rows[0]["HEndDate"]);
|
omodel.HItMoneyID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]);
|
omodel.HRoomID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HRoomID"]);
|
|
omodel.HQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HQty"]);
|
omodel.HPrice = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HPrice"]);
|
omodel.HMoney = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HMoney"]);
|
omodel.HWaster = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HWaster"]);
|
omodel.HBeginBalance = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HBeginBalance"]);
|
omodel.HEndBalance = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HEndBalance"]);
|
omodel.HTimes = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HTimes"]);
|
omodel.HRelationQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HRelationQty"]);
|
omodel.HRelationMoney = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HRelationMoney"]);
|
//
|
omodel.HMaker = Ds.Tables[0].Rows[0]["HMaker"].ToString().Trim();
|
omodel.HMakeDate = Ds.Tables[0].Rows[0]["HMakeDate"].ToString().Trim();
|
omodel.HBackDate = Ds.Tables[0].Rows[0]["HBackDate"].ToString().Trim();
|
omodel.HBacker = Ds.Tables[0].Rows[0]["HBacker"].ToString().Trim();
|
omodel.HUpDateDate = Ds.Tables[0].Rows[0]["HUpDateDate"].ToString().Trim();
|
omodel.HUpDater = Ds.Tables[0].Rows[0]["HUpDater"].ToString().Trim();
|
omodel.HCheckDate = Ds.Tables[0].Rows[0]["HCheckDate"].ToString().Trim();
|
omodel.HChecker = Ds.Tables[0].Rows[0]["HChecker"].ToString().Trim();
|
omodel.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim();
|
omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim();
|
omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim();
|
omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim();
|
//
|
sReturn = "显示单据成功!";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
throw (e);
|
}
|
}
|
|
|
}
|
|
}
|