From 09302ffd04018e5b6958f2a44871980b1bbc454b Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期一, 17 七月 2023 09:59:47 +0800
Subject: [PATCH] 项目管理:数据关联、 项目工程:下推(阶段汇报)、下推(任务汇报)

---
 WebAPI/Controllers/项目管理/工程项目/PM_ProjectBillController.cs  |  108 +++++++++++++++
 WebAPI/Controllers/项目管理/项目阶段/Gy_ProjectStageController.cs |  137 +++++++++++++++---
 WebAPI/Controllers/项目管理/工作任务/PM_WorkTaskBillController.cs |  144 ++++++++++++++++----
 3 files changed, 331 insertions(+), 58 deletions(-)

diff --git "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\344\273\273\345\212\241/PM_WorkTaskBillController.cs" "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\344\273\273\345\212\241/PM_WorkTaskBillController.cs"
index 113e711..041f22e 100644
--- "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\344\273\273\345\212\241/PM_WorkTaskBillController.cs"
+++ "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\344\273\273\345\212\241/PM_WorkTaskBillController.cs"
@@ -801,6 +801,10 @@
         public class PM_WorkTaskReportBill_Main
         {
             public int HInterID;
+            public int HProID;
+            public int HProjectStageID;
+            public string HMainSourceBillNo;
+            public string HMainSourceBillType;
             public string HBillNo;
             public string HDate;
             public string HRemark;
@@ -919,6 +923,10 @@
                 string HBillSubType = "";
                 int HBillStatus = 1;
                 int HInterID = mainList[0].HInterID;
+                int HProID = mainList[0].HProID;
+                int HProjectStageID = mainList[0].HProjectStageID;
+                string HMainSourceBillNo = mainList[0].HMainSourceBillNo;
+                string HMainSourceBillType = mainList[0].HMainSourceBillType;
                 string HBillNo = mainList[0].HBillNo;
                 string HDate = mainList[0].HDate;
                 string HRemark = mainList[0].HRemark;
@@ -996,9 +1004,37 @@
                     //璁板綍鏃ュ織
                     LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",淇敼椤圭洰闃舵娓呭崟:" + HBillNo);
                     oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "淇敼椤圭洰闃舵娓呭崟锛�" + HBillNo + "','LMES-椤圭洰闃舵娓呭崟妯″潡','" + DBUtility.ClsPub.IPAddress + "','淇敼鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
+                }else if(OperationType == 4 && ds.Tables[0].Rows.Count == 0)        //涓嬫帹
+                {
+                    string sql = "insert into PM_WorkTaskReportBillMain" +
+                        "(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate,HBillNo,HBillStatus,HRemark,HMaker,HMakeDate,HOrgID,HReportEmpID,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillType,HMainSourceBillNo) " +
+                        "values(" +
+                        "" + HYear +
+                        "," + HPeriod +
+                        ",'" + HBillType +
+                        "','" + HBillSubType +
+                        "'," + HInterID +
+                        ",'" + HDate +
+                        "','" + HBillNo +
+                        "'," + HBillStatus +
+                        ",'" + HRemark +
+                        "','" + HMaker +
+                        "','" + HMakerDate +
+                        "'," + HOrgID +
+                        "," + HReportEmpID +
+                        "," + HProID +
+                        "," + HProjectStageID +
+                        ",'" + HMainSourceBillType +
+                        "','" + HMainSourceBillNo +
+                        "')";
+
+                    //涓昏〃
+                    oCN.RunProc(sql);
+                    LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",鏂板浠诲姟姹囨姤:" + HBillNo);
+                    oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "鏂板浠诲姟姹囨姤锛�" + HBillNo + "','LMES-浠诲姟姹囨姤妯″潡','" + DBUtility.ClsPub.IPAddress + "','鏂板鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
                 }
                 //淇濆瓨瀛愯〃
-                objJsonResult = AddBillSub_WorkTaskReportBill(msg3, HInterID, HBillNo, OperationType);
+                objJsonResult = AddBillSub_WorkTaskReportBill(msg3, HInterID, HBillNo, OperationType, HProID, HProjectStageID, HMainSourceBillType, HMainSourceBillNo);
 
                 if (objJsonResult.code == "0")
                 {
@@ -1026,44 +1062,88 @@
         }
         #endregion
         #region 娣诲姞椤圭洰闃舵娓呭崟 瀛愯〃
-        public json AddBillSub_WorkTaskReportBill(string msg3, long HInterID, string HBillNo, int OperationType)
+        public json AddBillSub_WorkTaskReportBill(string msg3, long HInterID, string HBillNo, int OperationType, int HSourceInterID, int HSourceEntryID, string HSourceBillType, string HSourceBillNo)
         {
             List<PM_WorkTaskReportBill_Sub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<PM_WorkTaskReportBill_Sub>>(msg3);
             int i = 0;                                          //浣滀负瀛愯〃鍐呯爜
-            foreach (PM_WorkTaskReportBill_Sub oSub in DetailColl)
-            {
-                i++;                                            //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷
+            if(OperationType == 4) {
+                foreach (PM_WorkTaskReportBill_Sub oSub in DetailColl)
+                {
+                    i++;                                            //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷
 
-                int HEntryID = i;
-                string HProNumber = oSub.HProNumber;
-                int HProjectStageID = oSub.HProjectStageID;
-                string HName = oSub.HName;
-                string HTaskNote = oSub.HTaskNote;
-                string HType = oSub.HType;
-                double HRelTimes = oSub.HRelTimes;
-                string HReportNote = oSub.HReportNote;
-                string HAdv = oSub.HAdv;
-                string HRemark = oSub.HRemarkSub;
+                    int HEntryID = i;
+                    string HProNumber = oSub.HProNumber;
+                    int HProjectStageID = oSub.HProjectStageID;
+                    string HName = oSub.HName;
+                    string HTaskNote = oSub.HTaskNote;
+                    string HType = oSub.HType;
+                    double HRelTimes = oSub.HRelTimes;
+                    string HReportNote = oSub.HReportNote;
+                    string HAdv = oSub.HAdv;
+                    string HRemark = oSub.HRemarkSub;
 
-                string sql = "insert into PM_WorkTaskReportBillSub" +
-                    "(HInterID,HBillNo_bak,HEntryID,HRemark,HProNumber,HProjectStageID,HName,HTaskNote,HType,HRelTimes,HReportNote,HAdv) " +
-                    "values(" +
-                    "" + HInterID +
-                    ",'" + HBillNo +
-                    "'," + HEntryID +
-                    ",'" + HRemark +
-                    "','" + HProNumber +
-                    "'," + HProjectStageID +
-                    ",'" + HName +
-                    "','" + HTaskNote +
-                    "','" + HType +
-                    "'," + HRelTimes +
-                    ",'" + HReportNote +
-                    "','" + HAdv +
-                    "')";
+                    string sql = "insert into PM_WorkTaskReportBillSub" +
+                        "(HInterID,HBillNo_bak,HEntryID,HRemark,HProNumber,HProjectStageID,HName,HTaskNote,HType,HRelTimes,HReportNote,HAdv,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo) " +
+                        "values(" +
+                        "" + HInterID +
+                        ",'" + HBillNo +
+                        "'," + HEntryID +
+                        ",'" + HRemark +
+                        "','" + HProNumber +
+                        "'," + HProjectStageID +
+                        ",'" + HName +
+                        "','" + HTaskNote +
+                        "','" + HType +
+                        "'," + HRelTimes +
+                        ",'" + HReportNote +
+                        "','" + HAdv +
+                        "'," + HSourceInterID +
+                        "," + HSourceEntryID +
+                        ",'" + HSourceBillType +
+                        "','" + HSourceBillNo +
+                        "')";
 
-                oCN.RunProc(sql);
+                    oCN.RunProc(sql);
+                }
             }
+            else
+            {
+                foreach (PM_WorkTaskReportBill_Sub oSub in DetailColl)
+                {
+                    i++;                                            //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷
+
+                    int HEntryID = i;
+                    string HProNumber = oSub.HProNumber;
+                    int HProjectStageID = oSub.HProjectStageID;
+                    string HName = oSub.HName;
+                    string HTaskNote = oSub.HTaskNote;
+                    string HType = oSub.HType;
+                    double HRelTimes = oSub.HRelTimes;
+                    string HReportNote = oSub.HReportNote;
+                    string HAdv = oSub.HAdv;
+                    string HRemark = oSub.HRemarkSub;
+
+                    string sql = "insert into PM_WorkTaskReportBillSub" +
+                        "(HInterID,HBillNo_bak,HEntryID,HRemark,HProNumber,HProjectStageID,HName,HTaskNote,HType,HRelTimes,HReportNote,HAdv) " +
+                        "values(" +
+                        "" + HInterID +
+                        ",'" + HBillNo +
+                        "'," + HEntryID +
+                        ",'" + HRemark +
+                        "','" + HProNumber +
+                        "'," + HProjectStageID +
+                        ",'" + HName +
+                        "','" + HTaskNote +
+                        "','" + HType +
+                        "'," + HRelTimes +
+                        ",'" + HReportNote +
+                        "','" + HAdv +
+                        "')";
+
+                    oCN.RunProc(sql);
+                }
+            }
+            
 
             objJsonResult.code = "1";
             objJsonResult.count = 1;
diff --git "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\347\250\213\351\241\271\347\233\256/PM_ProjectBillController.cs" "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\347\250\213\351\241\271\347\233\256/PM_ProjectBillController.cs"
index a32cf79..2aadcfc 100644
--- "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\347\250\213\351\241\271\347\233\256/PM_ProjectBillController.cs"
+++ "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\347\250\213\351\241\271\347\233\256/PM_ProjectBillController.cs"
@@ -938,5 +938,113 @@
             }
         }
         #endregion
+
+        #region 宸ョ▼椤圭洰 涓嬫帹(闃舵姹囨姤)-椤甸潰鏄剧ず
+        [Route("PM_ProjectBill/set_ProjectReport")]
+        [HttpGet]
+        public object ProjectBill_ProjectReport(string HInterID, string HProjectStageID, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                List<DataTable> tables = new List<DataTable>();
+                //鏌ョ湅鏉冮檺
+                //if (!DBUtility.ClsPub.Security_Log("Gy_ProjectStage_Query", 1, false, user))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+                //鑾峰彇琛ㄥご淇℃伅
+                string sql = "exec h_p_PM_ProjectBill_setProjectReport " + HInterID + "," + HProjectStageID;
+                ds = oCN.RunProcReturn(sql, "h_p_PM_ProjectBill_setProjectReport");
+                tables.Add(ds.Tables[0]);
+                tables.Add(ds.Tables[1]);
+                if (ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "瀵瑰簲椤圭洰闃舵涓嶅瓨鍦紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[1].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = tables;
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 宸ョ▼椤圭洰 涓嬫帹(浠诲姟姹囨姤)-椤甸潰鏄剧ず
+        [Route("PM_ProjectBill/set_WorkTaskReport")]
+        [HttpGet]
+        public object ProjectBill_WorkTaskReport(string HInterID, string HProjectStageID, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                List<DataTable> tables = new List<DataTable>();
+                //鏌ョ湅鏉冮檺
+                //if (!DBUtility.ClsPub.Security_Log("Gy_ProjectStage_Query", 1, false, user))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+                //鑾峰彇琛ㄥご淇℃伅
+                string sql = "exec h_p_PM_ProjectBill_setWorkTaskReport " + HInterID + "," + HProjectStageID;
+                ds = oCN.RunProcReturn(sql, "h_p_PM_ProjectBill_setWorkTaskReport");
+                tables.Add(ds.Tables[0]);
+                tables.Add(ds.Tables[1]);
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[1].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = tables;
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
     }
 }
\ No newline at end of file
diff --git "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\351\241\271\347\233\256\351\230\266\346\256\265/Gy_ProjectStageController.cs" "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\351\241\271\347\233\256\351\230\266\346\256\265/Gy_ProjectStageController.cs"
index 992eec1..cf3e5c9 100644
--- "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\351\241\271\347\233\256\351\230\266\346\256\265/Gy_ProjectStageController.cs"
+++ "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\351\241\271\347\233\256\351\230\266\346\256\265/Gy_ProjectStageController.cs"
@@ -1321,7 +1321,10 @@
             public int HInterID;
             public string HBillNo;
             public string HDate;
+            public int HProID;
             public string HProNumber;
+            public string HMainSourceBillNo;
+            public string HMainSourceBillType;
             public int HProjectStageID;
             public string HProjectStageName;
             public string HStageNote;
@@ -1434,6 +1437,9 @@
                         objJsonResult.data = null;
                         return objJsonResult;
                     }
+                }else if (OperationType == 4)
+                {
+
                 }
 
                 msg2 = "[" + msg2.ToString() + "]";
@@ -1448,7 +1454,10 @@
                 int HInterID = mainList[0].HInterID;
                 string HBillNo = mainList[0].HBillNo;
                 string HDate = mainList[0].HDate;
+                int HProID = mainList[0].HProID;
                 string HProNumber = mainList[0].HProNumber;
+                string HMainSourceBillNo = mainList[0].HMainSourceBillNo;
+                string HMainSourceBillType = mainList[0].HMainSourceBillType;
                 int HProjectStageID = mainList[0].HProjectStageID;
                 string HStageNote = mainList[0].HStageNote;
                 string HRelationGoods = mainList[0].HRelationGoods;
@@ -1465,7 +1474,7 @@
                 string HMakerDate = mainList[0].HMakerDate;
                 string HUpdater = mainList[0].HUpdater;
                 string HUpdaterDate = mainList[0].HUpdaterDate;
-
+                
 
                 if (OperationType == 2)
                 {
@@ -1552,9 +1561,48 @@
                     //璁板綍鏃ュ織
                     LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",淇敼椤圭洰闃舵姹囨姤:" + HBillNo);
                     oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "淇敼椤圭洰闃舵姹囨姤锛�" + HBillNo + "','LMES-椤圭洰闃舵姹囨姤妯″潡','" + DBUtility.ClsPub.IPAddress + "','淇敼鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
+                }else if(OperationType == 4 && ds.Tables[0].Rows.Count == 0 )           //涓嬫帹-鏂板
+                {
+                    string sql = "insert into PM_ProjectReportBillMain" +
+                        "(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate,HBillNo,HBillStatus,HRemark,HMaker,HMakeDate" +
+                        ",HProNumber,HProjectStageID,HStageNote,HRelationGoods,HIsKey,HReportEmpID,HReportNote,HReportGoods,HReceiveEmp,HCopyEmp,HRate,HOrgID,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillType,HMainSourceBillNo) " +
+                        "values(" +
+                        "" + HYear +
+                        "," + HPeriod +
+                        ",'" + HBillType +
+                        "','" + HBillSubType +
+                        "'," + HInterID +
+                        ",'" + HDate +
+                        "','" + HBillNo +
+                        "'," + HBillStatus +
+                        ",'" + HRemark +
+                        "','" + HMaker +
+                        "','" + HMakerDate +
+                        "','" + HProNumber +
+                        "'," + HProjectStageID +
+                        ",'" + HStageNote +
+                        "','" + HRelationGoods +
+                        "'," + HIsKey +
+                        "," + HReportEmpID +
+                        ",'" + HReportNote +
+                        "','" + HReportGoods +
+                        "','" + HReceiveEmp +
+                        "','" + HCopyEmp +
+                        "'," + HRate +
+                        "," + HOrgID +
+                        "," + HProID +
+                        "," + HProjectStageID +
+                        ",'" + HMainSourceBillType +
+                        "','" + HMainSourceBillNo +
+                        "')";
+
+                    //涓昏〃
+                    oCN.RunProc(sql);
+                    LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",鏂板椤圭洰闃舵姹囨姤:" + HBillNo);
+                    oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "鏂板椤圭洰闃舵姹囨姤锛�" + HBillNo + "','LMES-椤圭洰闃舵姹囨姤妯″潡','" + DBUtility.ClsPub.IPAddress + "','鏂板鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
                 }
                 //淇濆瓨瀛愯〃
-                objJsonResult = AddBillSub_ProjectReportBill(msg3, HInterID, HBillNo, OperationType);
+                objJsonResult = AddBillSub_ProjectReportBill(msg3, HInterID, HBillNo, OperationType,HProID, HProjectStageID, HMainSourceBillType, HMainSourceBillNo);
 
                 if (objJsonResult.code == "0")
                 {
@@ -1582,36 +1630,73 @@
         }
         #endregion
         #region 娣诲姞椤圭洰闃舵娓呭崟 瀛愯〃
-        public json AddBillSub_ProjectReportBill(string msg3, long HInterID, string HBillNo, int OperationType)
+        public json AddBillSub_ProjectReportBill(string msg3, long HInterID, string HBillNo, int OperationType, int HSourceInterID, int HSourceEntryID, string HSourceBillType, string HSourceBillNo)
         {
             List<PM_ProjectReportBill_Sub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<PM_ProjectReportBill_Sub>>(msg3);
             int i = 0;                                          //浣滀负瀛愯〃鍐呯爜
-            foreach (PM_ProjectReportBill_Sub oSub in DetailColl)
+            if(OperationType == 4)
             {
-                i++;                                            //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷
+                foreach (PM_ProjectReportBill_Sub oSub in DetailColl)
+                {
+                    i++;                                            //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷
 
-                int HEntryID = i;
-                int HEmpID = oSub.HEmpID;
-                int HIsPM = oSub.HIsPM?1:0;
-                double HRate = oSub.HRate;
-                double HAvgMoney = oSub.HAvgMoney;
-                double HCountMoney = oSub.HCountMoney;
-                string HRemarkSub = oSub.HRemarkSub;
-                string sql = "insert into PM_ProjectReportBillSub" +
-                    "(HInterID,HBillNo_bak,HEntryID,HRemark,HEmpID,HIsPM,HRate,HAvgMoney,HCountMoney) " +
-                    "values(" +
-                    "" + HInterID +
-                    ",'" + HBillNo +
-                    "'," + HEntryID +
-                    ",'" + HRemarkSub +
-                    "'," + HEmpID +
-                    "," + HIsPM +
-                    "," + HRate +
-                    "," + HAvgMoney +
-                    "," + HCountMoney +
-                    ")";
-                oCN.RunProc(sql);
+                    int HEntryID = i;
+                    int HEmpID = oSub.HEmpID;
+                    int HIsPM = oSub.HIsPM ? 1 : 0;
+                    double HRate = oSub.HRate;
+                    double HAvgMoney = oSub.HAvgMoney;
+                    double HCountMoney = oSub.HCountMoney;
+                    string HRemarkSub = oSub.HRemarkSub;
+                    string sql = "insert into PM_ProjectReportBillSub" +
+                        "(HInterID,HBillNo_bak,HEntryID,HRemark,HEmpID,HIsPM,HRate,HAvgMoney,HCountMoney,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo) " +
+                        "values(" +
+                        "" + HInterID +
+                        ",'" + HBillNo +
+                        "'," + HEntryID +
+                        ",'" + HRemarkSub +
+                        "'," + HEmpID +
+                        "," + HIsPM +
+                        "," + HRate +
+                        "," + HAvgMoney +
+                        "," + HCountMoney +
+                        "," + HSourceInterID + 
+                        "," + HSourceEntryID +
+                        ",'" + HSourceBillType + 
+                        "','" + HSourceBillNo +
+                        "')";
+                    oCN.RunProc(sql);
+                }
             }
+            else
+            {
+                foreach (PM_ProjectReportBill_Sub oSub in DetailColl)
+                {
+                    i++;                                            //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷
+
+                    int HEntryID = i;
+                    int HEmpID = oSub.HEmpID;
+                    int HIsPM = oSub.HIsPM ? 1 : 0;
+                    double HRate = oSub.HRate;
+                    double HAvgMoney = oSub.HAvgMoney;
+                    double HCountMoney = oSub.HCountMoney;
+                    string HRemarkSub = oSub.HRemarkSub;
+                    string sql = "insert into PM_ProjectReportBillSub" +
+                        "(HInterID,HBillNo_bak,HEntryID,HRemark,HEmpID,HIsPM,HRate,HAvgMoney,HCountMoney) " +
+                        "values(" +
+                        "" + HInterID +
+                        ",'" + HBillNo +
+                        "'," + HEntryID +
+                        ",'" + HRemarkSub +
+                        "'," + HEmpID +
+                        "," + HIsPM +
+                        "," + HRate +
+                        "," + HAvgMoney +
+                        "," + HCountMoney +
+                        ")";
+                    oCN.RunProc(sql);
+                }
+            }
+            
 
             objJsonResult.code = "1";
             objJsonResult.count = 1;

--
Gitblit v1.9.1