From b10fa0437484fb4c388fa64291b97568679da025 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期二, 24 十月 2023 13:06:14 +0800
Subject: [PATCH] 销售订单:新增、编辑、删除、刷新、审核/反审核、关闭/反关闭、作废/反作废

---
 DAL/销售管理/ClsXs_SeOrderBill.cs |  281 +++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 219 insertions(+), 62 deletions(-)

diff --git "a/DAL/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBill.cs" "b/DAL/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBill.cs"
index 4843688..c2d9886 100644
--- "a/DAL/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBill.cs"
+++ "b/DAL/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBill.cs"
@@ -37,9 +37,34 @@
             try
             {
                 //
+                //oCn.BeginTran();
+                ////鏇存柊涓昏〃
+                //oCn.RunProc("UpDate Xs_SeOrderBillMain set  " +
+                //" HBillNo='" + omodel.HBillNo + "'" +  //鍥哄畾璧嬪��===============
+                //",HDate='" + omodel.HDate + "'" +
+                //",HYear='" + omodel.HYear.ToString() + "'" +
+                //",HPeriod='" + omodel.HPeriod.ToString() + "'" +
+                //",HRemark='" + omodel.HRemark + "'" +
+                //",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
+                //",HUpDateDate=getdate()" +
+                //    //========================================
+                //",HSSDate='" + omodel.HSSDate.ToShortDateString() + "'" +
+                //",HAddress='" + omodel.HAddress + "'" +
+                //",HSSID=" + omodel.HSSID.ToString() +
+                //",HSellSID=" + omodel.HSellSID.ToString() +
+                //",HCusID=" + omodel.HCusID.ToString() +
+                //",HCurID=" + omodel.HCurID.ToString() +
+                //",HExRate=" + omodel.HExRate.ToString() +
+                //",HEmpID=" + omodel.HEmpID.ToString() +
+                //",HManagerID=" + omodel.HManagerID.ToString() +
+                //",HDeptID=" + omodel.HDeptID.ToString() +
+                //",HExplanation='" + omodel.HExplanation + "'" +
+                //",HInnerBillNo='" + omodel.HInnerBillNo + "'" +
+                //" where HInterID=" + lngBillKey.ToString());
+
+
                 oCn.BeginTran();
-                //鏇存柊涓昏〃
-                oCn.RunProc("UpDate Xs_SeOrderBillMain set  " +
+                string mainSql = "UpDate Xs_SeOrderBillMain set  " +
                 " HBillNo='" + omodel.HBillNo + "'" +  //鍥哄畾璧嬪��===============
                 ",HDate='" + omodel.HDate + "'" +
                 ",HYear='" + omodel.HYear.ToString() + "'" +
@@ -47,20 +72,23 @@
                 ",HRemark='" + omodel.HRemark + "'" +
                 ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
                 ",HUpDateDate=getdate()" +
-                    //========================================
-                ",HSSDate='" + omodel.HSSDate.ToShortDateString() + "'" +
+                //========================================
+                ",HInnerBillNo='" + omodel.HInnerBillNo + "'" +
                 ",HAddress='" + omodel.HAddress + "'" +
-                ",HSSID=" + omodel.HSSID.ToString() +
-                ",HSellSID=" + omodel.HSellSID.ToString() +
+                ",HDeptID=" + omodel.HDeptID.ToString() +
                 ",HCusID=" + omodel.HCusID.ToString() +
+                ",HEmpID=" + omodel.HEmpID.ToString() +
                 ",HCurID=" + omodel.HCurID.ToString() +
                 ",HExRate=" + omodel.HExRate.ToString() +
-                ",HEmpID=" + omodel.HEmpID.ToString() +
                 ",HManagerID=" + omodel.HManagerID.ToString() +
-                ",HDeptID=" + omodel.HDeptID.ToString() +
+                ",HSellSID=" + omodel.HSellSID.ToString() +
+                ",HSSID=" + omodel.HSSID.ToString() +
+                ",HSSDate='" + omodel.HSSDate.ToShortDateString() + "'" +
+                ",HPayCusID=" + omodel.HPayCusID +
                 ",HExplanation='" + omodel.HExplanation + "'" +
-                ",HInnerBillNo='" + omodel.HInnerBillNo + "'" +
-                " where HInterID=" + lngBillKey.ToString());
+                " where HInterID=" + lngBillKey.ToString();
+
+                oCn.RunProc(mainSql);
                 //鍒犻櫎鍏宠仈
                 DeleteRelation(ref sReturn, lngBillKey);
                 //鍒犻櫎瀛愯〃
@@ -69,19 +97,50 @@
                 omodel.HInterID = lngBillKey;
                 foreach (Model.ClsXs_SeOrderBillSub oSub in DetailColl)
                 {
-                    oCn.RunProc("Insert into Xs_SeOrderBillSub " +
-                      " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
-                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
-                      ",HMaterID,HUnitID,HQty,HPrice,HMoney,HTaxRate" +
-                      ",HTaxMoney,HlineTotal,HlineTotalBB,HDate" +
-                      ",HTaxPrice,HDiscountRate,HRelTaxPrice,HOutStockQty,HInvoiceQty" +
-                      ") 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.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HTaxRate.ToString() +
-                      "," + oSub.HTaxMoney.ToString() + "," + oSub.HlineTotal.ToString() + "," + oSub.HlineTotalBB.ToString() + ",'" + oSub.HDate.ToShortDateString() + "'" +
-                      "," + oSub.HTaxPrice.ToString() + "," + oSub.HDiscountRate.ToString() + "," + oSub.HRelTaxPrice.ToString() + "," + oSub.HOutStockQty.ToString() + "," + oSub.HInvoiceQty.ToString() + 
-                      ") ");
+                    //oCn.RunProc("Insert into Xs_SeOrderBillSub " +
+                    //  " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
+                    //  ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
+                    //  ",HMaterID,HUnitID,HQty,HPrice,HMoney,HTaxRate" +
+                    //  ",HTaxMoney,HlineTotal,HlineTotalBB,HDate" +
+                    //  ",HTaxPrice,HDiscountRate,HRelTaxPrice,HOutStockQty,HInvoiceQty" +
+                    //  ") 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.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HTaxRate.ToString() +
+                    //  "," + oSub.HTaxMoney.ToString() + "," + oSub.HlineTotal.ToString() + "," + oSub.HlineTotalBB.ToString() + ",'" + oSub.HDate.ToShortDateString() + "'" +
+                    //  "," + oSub.HTaxPrice.ToString() + "," + oSub.HDiscountRate.ToString() + "," + oSub.HRelTaxPrice.ToString() + "," + oSub.HOutStockQty.ToString() + "," + oSub.HInvoiceQty.ToString() + 
+                    //  ") ");
+
+                    string subSql = "Insert into Xs_SeOrderBillSub" +
+                        "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney,HMaterID,HUnitID,HQty,HPrice,HTaxPrice,HMoney" +
+                        ",HDiscountRate,HRelTaxPrice,HTaxRate,HTaxMoney,HlineTotal,HlineTotalBB,HDate,HOutStockQty,HInvoiceQty,HRemark) " +
+                        "values(" +
+                        "" + omodel.HInterID +
+                        "," + oSub.HEntryID +
+                        "," + oSub.HSourceInterID +
+                        "," + oSub.HSourceEntryID +
+                        ",'" + (oSub.HSourceBillNo == null ? "" : oSub.HSourceBillNo) +
+                        "','" + (oSub.HSourceBillType == null ? "" : oSub.HSourceBillType) +
+                        "'," + oSub.HRelationQty +
+                        "," + oSub.HRelationMoney +
+                        "," + oSub.HMaterID +
+                        "," + oSub.HUnitID +
+                        "," + oSub.HQty +
+                        "," + oSub.HPrice +
+                        "," + oSub.HTaxPrice +
+                        "," + oSub.HMoney +
+                        "," + oSub.HDiscountRate +
+                        "," + oSub.HRelTaxPrice +
+                        "," + oSub.HTaxRate +
+                        "," + oSub.HTaxMoney +
+                        "," + oSub.HlineTotal +
+                        "," + oSub.HlineTotalBB +
+                        ",'" + oSub.HDate +
+                        "'," + oSub.HOutStockQty +
+                        "," + oSub.HInvoiceQty +
+                        ",'" + oSub.HRemark +
+                        "')";
+                    oCn.RunProc(subSql);
                 }
                 //
                 //foreach (Model.ClsXs_SeOrderBillSub oSub in DetailColl)
@@ -111,48 +170,144 @@
         {
             try
             {
-                //寰楀埌mainid
-                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
-                omodel.HBillNo = DBUtility.ClsPub.CreateBillCode(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
-                //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
-                if (IsExistBillNo(ref DBUtility.ClsPub.sExeReturnInfo, omodel.HBillNo, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew, omodel.HInterID))
-                {
-                    omodel.HBillNo = DBUtility.ClsPub.CreateBillCode(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
-                }
-                if (IsExistMainID(ref DBUtility.ClsPub.sExeReturnInfo, omodel.HInterID, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew))
-                {
-                    omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
-                }
-                //
+                DataSet ds;
+
+                ////寰楀埌mainid
+                //omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
+                //omodel.HBillNo = DBUtility.ClsPub.CreateBillCode(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
+                ////鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
+                //if (IsExistBillNo(ref DBUtility.ClsPub.sExeReturnInfo, omodel.HBillNo, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew, omodel.HInterID))
+                //{
+                //    omodel.HBillNo = DBUtility.ClsPub.CreateBillCode(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
+                //}
+                //if (IsExistMainID(ref DBUtility.ClsPub.sExeReturnInfo, omodel.HInterID, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew))
+                //{
+                //    omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
+                //}
+                ////
+                //oCn.BeginTran();
+                ////涓昏〃
+                //oCn.RunProc("Insert Into Xs_SeOrderBillMain   " +
+                //"(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
+                //",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
+                //",HAddress,HSSID,HSellSID,HCusID,HCurID,HExRate,HSSDate" +
+                //",HEmpID,HManagerID,HDeptID,HExplanation,HInnerBillNo" +
+                //") " +
+                //" 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.HAddress + "'," + omodel.HSSID.ToString() + "," + omodel.HSellSID.ToString() + "," + omodel.HCusID.ToString() + "," + omodel.HCurID.ToString() + "," + omodel.HExRate.ToString() + ",'" + omodel.HSSDate.ToShortDateString() + "'" +
+                //", " + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'"+
+                //") ");
+
                 oCn.BeginTran();
-                //涓昏〃
-                oCn.RunProc("Insert Into Xs_SeOrderBillMain   " +
-                "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
-                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
-                ",HAddress,HSSID,HSellSID,HCusID,HCurID,HExRate,HSSDate" +
-                ",HEmpID,HManagerID,HDeptID,HExplanation,HInnerBillNo" +
-                ") " +
-                " 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.HAddress + "'," + omodel.HSSID.ToString() + "," + omodel.HSellSID.ToString() + "," + omodel.HCusID.ToString() + "," + omodel.HCurID.ToString() + "," + omodel.HExRate.ToString() + ",'" + omodel.HSSDate.ToShortDateString() + "'" +
-                ", " + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'"+
-                ") ");
+
+                //妫�鏌ヤ富琛ㄥ唴鐮佹槸鍚﹂噸澶嶏紝鑻ラ噸澶嶅垯閲嶆柊鐢熸垚骞剁户缁鏌ワ紝鐩村埌涓嶅啀閲嶅
+                while (true)
+                {
+                    ds = oCn.RunProcReturn("select * from Xs_SeOrderBillMain where HInterID = " + omodel.HInterID, "Xs_SeOrderBillMain");
+                    if (ds != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
+                    }
+                    else
+                    {
+                        break;
+                    }
+                }
+
+                //鎻掑叆涓昏〃
+                string mainSql = "Insert Into Xs_SeOrderBillMain" +
+                    "(HYear,HPeriod,HBillType,HBillSubType,HBillStatus,HExplanation" +
+                    ",HInterID,HBillNo,HDate,HInnerBillNo,HAddress,HDeptID,HCusID,HEmpID,HCurID,HExRate,HManagerID,HSellSID,HSSID,HSSDate,HPayCusID,HRemark,HOrgID,HMaker,HMakeDate" +
+                    ",HERPInterID,HERPBillType,HSALEORGID,HSALEGROUPID,HRECEIVEID,HSETTLEID,HCHARGEID,HHEADLOCID,HRECCONTACTID,HCORRESPONDORGID,HBUSINESSTYPE) " +
+                    "values(" +
+                    "" + omodel.HYear +
+                    "," + omodel.HPeriod +
+                    ",'" + this.BillType +
+                    "','" + this.HBillSubType +
+                    "'," + omodel.HBillStatus +
+                    ",'" + omodel.HExplanation +
+
+                    "'," + omodel.HInterID +
+                    ",'" + omodel.HBillNo +
+                    "','" + omodel.HDate +
+                    "','" + omodel.HInnerBillNo +
+                    "','" + omodel.HAddress +
+                    "'," + omodel.HDeptID +
+                    "," + omodel.HCusID +
+                    "," + omodel.HEmpID +
+                    "," + omodel.HCurID +
+                    "," + omodel.HExRate +
+                    "," + omodel.HManagerID +
+                    "," + omodel.HSellSID +
+                    "," + omodel.HSSID +
+                    ",'" + omodel.HSSDate +
+                    "'," + omodel.HPayCusID +
+                    ",'" + omodel.HRemark +
+                    "'," + omodel.HOrgID +
+                    ",'" + omodel.HMaker +
+                    "','" + omodel.HMakeDate +
+
+                    "'," + omodel.HERPInterID +
+                    ",'" + omodel.HERPBillType +
+                    "'," + omodel.HSALEORGID +
+                    "," + omodel.HSALEGROUPID +
+                    "," + omodel.HRECEIVEID +
+                    "," + omodel.HSETTLEID +
+                    "," + omodel.HCHARGEID +
+                    "," + omodel.HHEADLOCID +
+                    "," + omodel.HRECCONTACTID +
+                    "," + omodel.HCORRESPONDORGID +
+                    ",'" + omodel.HBUSINESSTYPE +
+                    "')";
+                    
+                oCn.RunProc(mainSql);
                 //鎻掑叆瀛愯〃
                 foreach (Model.ClsXs_SeOrderBillSub oSub in DetailColl)
                 {
-                    oCn.RunProc("Insert into Xs_SeOrderBillSub " +
-                      " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
-                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
-                      ",HMaterID,HUnitID,HQty,HPrice,HMoney,HTaxRate" +
-                      ",HTaxMoney,HlineTotal,HlineTotalBB,HDate" +
-                      ",HTaxPrice,HDiscountRate,HRelTaxPrice,HOutStockQty,HInvoiceQty" +
-                      ") 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.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HTaxRate.ToString() +
-                      "," + oSub.HTaxMoney.ToString() + "," + oSub.HlineTotal.ToString() + "," + oSub.HlineTotalBB.ToString() + ",'" + oSub.HDate.ToShortDateString() + "'" +
-                      "," + oSub.HTaxPrice.ToString() + "," + oSub.HDiscountRate.ToString() + "," + oSub.HRelTaxPrice.ToString() + "," + oSub.HOutStockQty.ToString() + "," + oSub.HInvoiceQty.ToString() + 
-                      ") ");
+                    //oCn.RunProc("Insert into Xs_SeOrderBillSub " +
+                    //  " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
+                    //  ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
+                    //  ",HMaterID,HUnitID,HQty,HPrice,HMoney,HTaxRate" +
+                    //  ",HTaxMoney,HlineTotal,HlineTotalBB,HDate" +
+                    //  ",HTaxPrice,HDiscountRate,HRelTaxPrice,HOutStockQty,HInvoiceQty" +
+                    //  ") 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.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HTaxRate.ToString() +
+                    //  "," + oSub.HTaxMoney.ToString() + "," + oSub.HlineTotal.ToString() + "," + oSub.HlineTotalBB.ToString() + ",'" + oSub.HDate.ToShortDateString() + "'" +
+                    //  "," + oSub.HTaxPrice.ToString() + "," + oSub.HDiscountRate.ToString() + "," + oSub.HRelTaxPrice.ToString() + "," + oSub.HOutStockQty.ToString() + "," + oSub.HInvoiceQty.ToString() +
+                    //  ") ");
+                    string subSql = "Insert into Xs_SeOrderBillSub" +
+                        "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney,HMaterID,HUnitID,HQty,HPrice,HTaxPrice,HMoney" +
+                        ",HDiscountRate,HRelTaxPrice,HTaxRate,HTaxMoney,HlineTotal,HlineTotalBB,HDate,HOutStockQty,HInvoiceQty,HRemark) " +
+                        "values(" +
+                        "" + omodel.HInterID +
+                        "," + oSub.HEntryID +
+                        "," + oSub.HSourceInterID +
+                        "," + oSub.HSourceEntryID +
+                        ",'" + (oSub.HSourceBillNo==null?"":oSub.HSourceBillNo) +
+                        "','" + (oSub.HSourceBillType==null?"":oSub.HSourceBillType) +
+                        "'," + oSub.HRelationQty +
+                        "," + oSub.HRelationMoney +
+                        "," + oSub.HMaterID +
+                        "," + oSub.HUnitID +
+                        "," + oSub.HQty +
+                        "," + oSub.HPrice +
+                        "," + oSub.HTaxPrice +
+                        "," + oSub.HMoney +
+                        "," + oSub.HDiscountRate +
+                        "," + oSub.HRelTaxPrice +
+                        "," + oSub.HTaxRate +
+                        "," + oSub.HTaxMoney +
+                        "," + oSub.HlineTotal +
+                        "," + oSub.HlineTotalBB +
+                        ",'" + oSub.HDate +
+                        "'," + oSub.HOutStockQty +
+                        "," + oSub.HInvoiceQty +
+                        ",'" + oSub.HRemark +
+                        "')";
+                    oCn.RunProc(subSql);
                 }
                 //
                 //foreach (Model.ClsXs_SeOrderBillSub oSub in DetailColl)
@@ -232,8 +387,10 @@
                 omodel.HExplanation = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HExplanation"]);
                 omodel.HInnerBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInnerBillNo"]);
                 omodel.HSSDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HSSDate"]);
+                omodel.HOrgID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HOrgID"]);
+                omodel.HPayCusID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPayCusID"]);
                 //
-                
+
                 //寰幆
                 DataSet DsSub ;
                 DsSub = oCn.RunProcReturn("Select * from Xs_SeOrderBillSub Where HInterID=" + lngBillKey.ToString(), "Xs_SeOrderBillSub");

--
Gitblit v1.9.1