DAL/ClsPM_WorkPlanMonthBillMain.cs
@@ -33,75 +33,70 @@
        #endregion
        //#region 修改单据
        //public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
        //{
        //    try
        //    {
        //        oCn.BeginTran();
        //        //更新主表
        //        string mainSql = "update PM_WorkPlanMonthBillMain set " +
        //            " HBillNo = '" + omodel.HBillNo +
        //            "', HDate = '" + omodel.HDate +
        //            "', HYear = " + omodel.HYear +
        //            ", HPeriod = " + omodel.HPeriod +
        //            ", HRemark = '" + omodel.HRemark +
        //            "', HUpDater = '" + omodel.HUpDater +
        //            "', HUpDateDate = getdate()" +
        //            //===============================================================
        //            ", HOrgID = " + omodel.HOrgID +
        //            ", HYear = " + omodel.HYear +
        //            ", HWeek = " + omodel.HWeek +
        //            ", HBeginDate = '" + omodel.HBeginDate +
        //            "', HEndDate = '" + omodel.HEndDate +
        //            "', HPlanEmpID = " + omodel.HReportEmpID +
        //            " where HInterID = " + omodel.HInterID;
        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                oCn.BeginTran();
                //更新主表
                string mainSql = "update PM_WorkPlanMonthBillMain set " +
                    " HBillNo = '" + omodel.HBillNo +
                    "', HDate = '" + omodel.HDate +
                    "', HYear = " + omodel.HYear +
                    ", HMonth = " + omodel.HMonth +
                    ", HRemark = '" + omodel.HRemark +
                    "', HUpDater = '" + omodel.HUpDater +
                    "', HUpDateDate = getdate()" +
                    //===============================================================
                    ", HBeginDate = '" + omodel.HBeginDate +
                    "', HEndDate = '" + omodel.HEndDate +
                    "', HPlanEmpID = " + omodel.HPlanEmpID +
                    " where HInterID = " + omodel.HInterID;
        //        //删除关联
        //        DeleteRelation(ref sReturn, lngBillKey);
        //        //删除子表
        //        DeleteBillSub(lngBillKey);
                //删除关联
                DeleteRelation(ref sReturn, lngBillKey);
                //删除子表
                DeleteBillSub(lngBillKey);
        //        ////插入子表
        //        //omodel.HInterID = lngBillKey;
        //        //foreach (Model.ClsPM_WorkTaskWeekBillSub oSub in DetailColl)
        //        //{
        //        //    string subSql = "insert into PM_WorkTaskWeekBillSub" +
        //        //       "(HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
        //        //       ",HWeekDay,HSno,HProjectID,HProjectStageID,HTaskNote,HPlanTimes) " +
        //        //       " values(" +
        //        //       "" + omodel.HInterID.ToString() +
        //        //       "," + oSub.HEntryID.ToString() +
        //        //       ",'" + oSub.HCloseMan +
        //        //       "','" + oSub.HEntryCloseDate +
        //        //       "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) +
        //        //       ",'" + oSub.HRemark +
        //        //       "'," + oSub.HSourceInterID +
        //        //       "," + oSub.HSourceEntryID +
        //        //       ",'" + oSub.HSourceBillNo +
        //        //       "','" + oSub.HSourceBillType +
        //        //       "'," + oSub.HRelationQty +
        //        //       "," + oSub.HRelationMoney +
        //        //       "," + oSub.HWeekDay +
        //        //       "," + oSub.HSno +
        //        //       "," + oSub.HProjectID +
        //        //       "," + oSub.HProjectStageID +
        //        //       ",'" + oSub.HTaskNote +
        //        //       "'," + oSub.HPlanTimes +
        //        //       ")";
        //        //    oCn.RunProc(subSql);
        //        //}
        //        sReturn = "修改单据成功!";
        //        oCn.Commit();
        //        return true;
        //    }
        //    catch (Exception e)
        //    {
        //        sReturn = e.Message;
        //        oCn.RollBack();
        //        throw (e);
        //    }
        //}
                //插入子表
                omodel.HInterID = lngBillKey;
                foreach (Model.ClsPM_WorkPlanMonthBillSub oSub in DetailColl)
                {
                    string subSql = "insert into PM_WorkPlanMonthBillSub" +
                         "" +
                         "" +
                         "" +
                         "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
                         ",HProNumber,HProjectStageID,HRate,HAvgMoney,HCountMoney) " +
                         " values(" +
                         "" + omodel.HInterID.ToString() +
                         "," + oSub.HEntryID.ToString() +
                         "," + oSub.HSourceInterID +
                         "," + oSub.HSourceEntryID +
                         ",'" + oSub.HSourceBillNo +
                         "','" + oSub.HSourceBillType +
                         "','" + oSub.HProNumber +
                         "'," + oSub.HProjectStageID +
                         "," + oSub.HRate +
                         ",'" + oSub.HAvgMoney +
                         "','" + oSub.HCountMoney +
                         "')";
                    oCn.RunProc(subSql);
                }
                sReturn = "修改单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //#endregion
        #region  新增单据