|  |  | 
 |  |  | { | 
 |  |  |     public  class ClsOA_InformBill:DBUtility.ClsXt_BaseBill | 
 |  |  |     { | 
 |  |  |         public Model.ClsOA_InformBillMain omodel = new Model.ClsOA_InformBillMain(); | 
 |  |  |         public List<Model.ClsOA_InformBillSub> DetailColl = new List<Model.ClsOA_InformBillSub>(); | 
 |  |  |         public Models.ClsOA_InformBillMain omodel = new Models.ClsOA_InformBillMain(); | 
 |  |  |         public List<Models.ClsOA_InformBillSub> DetailColl = new List<Models.ClsOA_InformBillSub>(); | 
 |  |  |  | 
 |  |  |         public ClsOA_InformBill() | 
 |  |  |         { | 
 |  |  | 
 |  |  |                 //更新主表 | 
 |  |  |                 oCn.RunProc("UpDate OA_InformBillMain set  " + | 
 |  |  |                 " HBillNo='" + omodel.HBillNo + "'" +  //固定赋值=============== | 
 |  |  |                 ",HDate='" + omodel.HDate + "'" + | 
 |  |  |                 ",HYear='" + omodel.HYear.ToString() + "'" + | 
 |  |  |                 ",HPeriod='" + omodel.HPeriod.ToString() + "'" + | 
 |  |  |                 ",HRemark='" + omodel.HRemark + "'" + | 
 |  |  |                 ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" + | 
 |  |  |                 ",HUpDater='" + omodel.HMaker + "'" + | 
 |  |  |                 ",HUpDateDate=getdate()" + | 
 |  |  |                     //======================================== | 
 |  |  |                 ",HContext='" + omodel.HContext + "'" + | 
 |  |  |                 ",HDeptID=" + omodel.HDeptID.ToString() + | 
 |  |  |                 ",HSendMan =" + omodel.HSendMan.ToString() +                 | 
 |  |  |                 ",HSendMan ='" + omodel.HSendMan.ToString()+"'" +                 | 
 |  |  |                 ",HReceiveMan='" + omodel.HReceiveMan + "'" + | 
 |  |  |                 ",HLevel='" + omodel.HLevel + "'" + | 
 |  |  |                 ",HDescription='" + omodel.HDescription + "'" + | 
 |  |  | 
 |  |  |                 DeleteBillSub(lngBillKey); | 
 |  |  |                 //插入子表 | 
 |  |  |                 omodel.HInterID = lngBillKey; | 
 |  |  |                 foreach (Model.ClsOA_InformBillSub oSub in DetailColl) | 
 |  |  |                 foreach (Models.ClsOA_InformBillSub oSub in DetailColl) | 
 |  |  |                 { | 
 |  |  |                     oCn.RunProc("Insert into OA_InformBillSub " + | 
 |  |  |                       " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + | 
 |  |  | 
 |  |  |                       ") values(" | 
 |  |  |                       + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + | 
 |  |  |                       "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + | 
 |  |  |                       "," + oSub.HReceiveMan.ToString() + "," + Convert.ToString(oSub.HReadFlag ? 1 : 0) +  | 
 |  |  |                       ",'" + oSub.HReceiveMan.ToString() + "'," + Convert.ToString(oSub.HReadFlag ? 1 : 0) +  | 
 |  |  |                       ") "); | 
 |  |  |                 } | 
 |  |  |                 // | 
 |  |  | 
 |  |  |                 ",HReceiveMan,HLevel,HDescription" + | 
 |  |  |                 ") " + | 
 |  |  |                 " values('" + this.BillType + "','"  + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + | 
 |  |  |                 "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" + | 
 |  |  |                  ",'" + omodel.HContext + "'," + omodel.HDeptID.ToString() + "," + omodel.HSendMan.ToString() +  | 
 |  |  |                 ",'" + omodel.HReceiveMan + "','" + omodel.HLevel + "','" + omodel.HDescription + "'" + | 
 |  |  |                 "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',getdate()" + | 
 |  |  |                  ",'" + omodel.HContext + "'," + omodel.HDeptID.ToString() + ",'" + omodel.HSendMan.ToString() +  | 
 |  |  |                 "','" + omodel.HReceiveMan + "','" + omodel.HLevel + "','" + omodel.HDescription + "'" + | 
 |  |  |                 ") "); | 
 |  |  |                 //插入子表 | 
 |  |  |                 foreach (Model.ClsOA_InformBillSub oSub in DetailColl) | 
 |  |  |                 foreach (Models.ClsOA_InformBillSub oSub in DetailColl) | 
 |  |  |                 { | 
 |  |  |                     oCn.RunProc("Insert into OA_InformBillSub " + | 
 |  |  |                        " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + | 
 |  |  |                        ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + | 
 |  |  |                        ",HReceiveMan,HReadFlag " + | 
 |  |  |                        ") values(" | 
 |  |  |                        + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + | 
 |  |  |                        + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "',''," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + | 
 |  |  |                        "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + | 
 |  |  |                        "," + oSub.HReceiveMan.ToString() + "," + Convert.ToString(oSub.HReadFlag ? 1 : 0) + | 
 |  |  |                        ",'" + oSub.HReceiveMan.ToString() + "'," + Convert.ToString(oSub.HReadFlag ? 1 : 0) + | 
 |  |  |                        ") "); | 
 |  |  |                 } | 
 |  |  |                 // | 
 |  |  |                 //foreach (Model.ClsOA_InformBillSub oSub in DetailColl) | 
 |  |  |                 //{ | 
 |  |  |                 //    Ds = oCn.RunProcReturn("exec h_p_OA_InformBill_Qty " + oSub.HICMOInterID, ""); | 
 |  |  |                 //    if (Ds.Tables[0].Rows.Count == 0) | 
 |  |  |                 //        return; | 
 |  |  |                 //    if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") | 
 |  |  |                 //    { | 
 |  |  |                 //        sReturn = "汇报数量超过计划数量!不允许保存"; | 
 |  |  |                 //        return false; | 
 |  |  |                 //    } | 
 |  |  |                 //} | 
 |  |  |                 // | 
 |  |  |                 sReturn = "新增单据成功!"; | 
 |  |  |                 oCn.Commit(); | 
 |  |  |                 return true; | 
 |  |  | 
 |  |  |                 omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim(); | 
 |  |  |                 omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim(); | 
 |  |  |                 //======================================================== | 
 |  |  |                 omodel.HSendMan = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSendMan"]); | 
 |  |  |                 omodel.HSendMan =Ds.Tables[0].Rows[0]["HSendMan"].ToString(); | 
 |  |  |                 omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]);                 | 
 |  |  |                 omodel.HContext = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HContext"]); | 
 |  |  |                 omodel.HReceiveMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HReceiveMan"]); | 
 |  |  | 
 |  |  |                 DetailColl.Clear();//清空 | 
 |  |  |                 for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) | 
 |  |  |                 { | 
 |  |  |                     Model.ClsOA_InformBillSub oSub = new Model.ClsOA_InformBillSub(); | 
 |  |  |                     Models.ClsOA_InformBillSub oSub = new Models.ClsOA_InformBillSub(); | 
 |  |  |                     // 固定赋值=============================================== | 
 |  |  |                     oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]); | 
 |  |  |                     oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]); | 
 |  |  | 
 |  |  |                     oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]); | 
 |  |  |                     oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim(); | 
 |  |  |                     //=================================================== | 
 |  |  |                     oSub.HReceiveMan = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HReceiveMan"]); | 
 |  |  |                     oSub.HReceiveMan = DsSub.Tables[0].Rows[i]["HReceiveMan"].ToString(); | 
 |  |  |                     oSub.HReadFlag = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HReadFlag"]); | 
 |  |  |                     DetailColl.Add(oSub); | 
 |  |  |                 } |