wtt
2024-07-30 17b3900f801d84984520352b9de05c42fa86f283
DAL/ÏúÊÛ¹ÜÀí/ClsXs_ReceivableBill.cs
@@ -9,11 +9,11 @@
    {
        public Model.ClsXs_ReceivableBillMain omodel = new Model.ClsXs_ReceivableBillMain();
        public List<Model.ClsXs_ReceivableBillSub> DetailColl = new List<Model.ClsXs_ReceivableBillSub>();
        public List<Model.ClsXs_ReceivableBillSub> DetailCol2 = new List<Model.ClsXs_ReceivableBillSub>();//子表二
        public ClsXs_ReceivableBill()
        {
            base.MvarItemKeySub = "Xs_ReceivableBillSub";
            base.MvarItemKeySub2 = "";
            base.MvarItemKeySub2 = "Xs_ReceivableBillSub_Entry";
            base.MvarItemKeySub3 = "";
            base.MvarItemKeySub4 = "";
            base.MvarItemKey= "Xs_ReceivableBillMain";
@@ -115,6 +115,7 @@
                    ",HExplanation = '" + omodel.HExplanation + "'" +
                    ",HInnerBillNo = '" + omodel.HInnerBillNo + "'" +
                    ",HRemark = '" + omodel.HRemark + "'" +
                    ",HPriceType = '" + omodel.HPriceType + "'" +
                    " where HInterID = " + omodel.HInterID;
                oCn.RunProc(mainSql);
@@ -122,7 +123,8 @@
                DeleteRelation(ref sReturn, lngBillKey);
                //删除子表
                DeleteBillSub(lngBillKey);
                //删除子表2
                DeleteBillSub2(lngBillKey);
                //插入子表
                omodel.HInterID = lngBillKey;
                //插入子表
@@ -172,6 +174,51 @@
                //更新订单关联数量
                AddNewRelation(ref sReturn, omodel.HInterID);
                //插入子表Entry
                foreach (Model.ClsXs_ReceivableBillSub oSub in DetailCol2)
                {
                    string subSql = "insert into Xs_ReceivableBillSub_Entry" +
                        "(HInterID,HEntryID,HBillNo_bak,HMaterID,HUnitID,HQty,HPrice,HTaxPrice,HDiscountRate,HRelTaxPrice,HTaxRate,HTaxMoney" +
                        ",HlineTotal,HlineTotalBB,HMoney,HMoneyBB,HRemark" +
                        ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                        ",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" +
                        ",HSeOrderTaxPrice,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo) " +
                        " values(" +
                       "" + omodel.HInterID + "" +
                       "," + oSub.HEntryID + "" +
                       ",'" + omodel.HBillNo + "'" +
                       "," + oSub.HMaterID + "" +
                       "," + oSub.HUnitID + "" +
                       "," + oSub.HQty + "" +
                       "," + oSub.HPrice + "" +
                       "," + oSub.HTaxPrice + "" +
                       "," + oSub.HDiscountRate + "" +
                       "," + oSub.HRelTaxPrice + "" +
                       "," + oSub.HTaxRate + "" +
                       "," + oSub.HTaxMoney + "" +
                       "," + oSub.HlineTotal + "" +
                       "," + oSub.HlineTotalBB + "" +
                       "," + oSub.HMoney + "" +
                       "," + oSub.HMoneyBB + "" +
                       ",'" + oSub.HRemark + "'" +
                       "," + oSub.HSourceInterID + "" +
                       "," + oSub.HSourceEntryID + "" +
                       ",'" + oSub.HSourceBillNo + "'" +
                       ",'" + oSub.HSourceBillType + "'" +
                       "," + oSub.HRelationQty + "" +
                       "," + oSub.HRelationMoney + "" +
                       "," + oSub.HPOOrderInterID + "" +
                       "," + oSub.HPOOrderEntryID + "" +
                       ",'" + oSub.HPOOrderBillNo + "'" +
                       "," + oSub.HSeOrderTaxPrice + "" +
                       "," + oSub.HSeOrderInterID + "" +
                       "," + oSub.HSeOrderEntryID + "" +
                       ",'" + oSub.HSeOrderBillNo + "'" +
                        ")";
                    oCn.RunProc(subSql);
                }
                sReturn = "修改单据成功!";
                oCn.Commit();
                return true;
@@ -213,7 +260,7 @@
                string mainSql = "insert into Xs_ReceivableBillMain" +
                    "(HInterID,HBillNo,HDate,HYear,HPeriod,HBillType,HBillSubType" +
                    ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType" +
                    ",HMaker,HMakeDate,HSSID,HSellSID,HReceiveDate,HCusID,HCurID,HExRate,HEmpID,HMangerID,HDeptID,HExplanation,HInnerBillNo,HRemark) " +
                    ",HMaker,HMakeDate,HSSID,HSellSID,HReceiveDate,HCusID,HCurID,HExRate,HEmpID,HMangerID,HDeptID,HExplanation,HInnerBillNo,HRemark,HPriceType) " +
                    "values(" +
                    "" + omodel.HInterID + "" +
                    ",'" + omodel.HBillNo + "'" +
@@ -240,6 +287,7 @@
                    ",'" + omodel.HExplanation + "'" +
                    ",'" + omodel.HInnerBillNo + "'" +
                    ",'" + omodel.HRemark + "'" +
                    ",'" + omodel.HPriceType + "'" +
                    ")";
                oCn.RunProc(mainSql);
@@ -290,6 +338,50 @@
                //更新订单关联数量
                AddNewRelation(ref sReturn, omodel.HInterID);
                //插入子表Entry
                foreach (Model.ClsXs_ReceivableBillSub oSub in DetailCol2)
                {
                    string subSql = "insert into Xs_ReceivableBillSub_Entry" +
                        "(HInterID,HEntryID,HBillNo_bak,HMaterID,HUnitID,HQty,HPrice,HTaxPrice,HDiscountRate,HRelTaxPrice,HTaxRate,HTaxMoney" +
                        ",HlineTotal,HlineTotalBB,HMoney,HMoneyBB,HRemark" +
                        ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                        ",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" +
                        ",HSeOrderTaxPrice,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo) " +
                        " values(" +
                       "" + omodel.HInterID + "" +
                       "," + oSub.HEntryID + "" +
                       ",'" + omodel.HBillNo + "'" +
                       "," + oSub.HMaterID + "" +
                       "," + oSub.HUnitID + "" +
                       "," + oSub.HQty + "" +
                       "," + oSub.HPrice + "" +
                       "," + oSub.HTaxPrice + "" +
                       "," + oSub.HDiscountRate + "" +
                       "," + oSub.HRelTaxPrice + "" +
                       "," + oSub.HTaxRate + "" +
                       "," + oSub.HTaxMoney + "" +
                       "," + oSub.HlineTotal + "" +
                       "," + oSub.HlineTotalBB + "" +
                       "," + oSub.HMoney + "" +
                       "," + oSub.HMoneyBB + "" +
                       ",'" + oSub.HRemark + "'" +
                       "," + oSub.HSourceInterID + "" +
                       "," + oSub.HSourceEntryID + "" +
                       ",'" + oSub.HSourceBillNo + "'" +
                       ",'" + oSub.HSourceBillType + "'" +
                       "," + oSub.HRelationQty + "" +
                       "," + oSub.HRelationMoney + "" +
                       "," + oSub.HPOOrderInterID + "" +
                       "," + oSub.HPOOrderEntryID + "" +
                       ",'" + oSub.HPOOrderBillNo + "'" +
                       "," + oSub.HSeOrderTaxPrice + "" +
                       "," + oSub.HSeOrderInterID + "" +
                       "," + oSub.HSeOrderEntryID + "" +
                       ",'" + oSub.HSeOrderBillNo + "'" +
                        ")";
                    oCn.RunProc(subSql);
                }
                sReturn = "新增单据成功!";
                oCn.Commit();
@@ -423,6 +515,57 @@
                    DetailColl.Add(oSub);
                }
                //循环
                DataSet DsSub2;
                DsSub2 = oCn.RunProcReturn("select * from Xs_ReceivableBillSub_Entry where HInterID = " + lngBillKey.ToString() + "order by HEntryID", "Xs_ReceivableBillSub_Entry");
                DetailCol2.Clear();//清空
                for (int i = 0; i < DsSub2.Tables[0].Rows.Count; i++)
                {
                    Model.ClsXs_ReceivableBillSub oSub = new Model.ClsXs_ReceivableBillSub();
                    // å›ºå®šèµ‹å€¼===============================================
                    oSub.HInterID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HInterID"]);
                    oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HEntryID"]);
                    oSub.HBillNo_bak = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HBillNo_bak"]);
                    oSub.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HCloseMan"]);
                    oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub2.Tables[0].Rows[i]["HCloseType"]);
                    oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub2.Tables[0].Rows[i]["HEntryCloseDate"]);
                    oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HSourceInterID"]);
                    oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HSourceEntryID"]);
                    oSub.HSourceBillType = DsSub2.Tables[0].Rows[i]["HSourceBillType"].ToString().Trim();
                    oSub.HSourceBillNo = DsSub2.Tables[0].Rows[i]["HSourceBillNo"].ToString().Trim();
                    oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub2.Tables[0].Rows[i]["HRelationQty"]);
                    oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub2.Tables[0].Rows[i]["HRelationMoney"]);
                    oSub.HRemark = DsSub2.Tables[0].Rows[i]["HRemark"].ToString().Trim();
                    //===================================================
                    oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HMaterID"]);
                    oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HUnitID"]);
                    oSub.HQty = DBUtility.ClsPub.isDoule(DsSub2.Tables[0].Rows[0]["HQty"]);
                    oSub.HPrice = DBUtility.ClsPub.isDoule(DsSub2.Tables[0].Rows[0]["HPrice"]);
                    oSub.HTaxPrice = DBUtility.ClsPub.isDoule(DsSub2.Tables[0].Rows[0]["HTaxPrice"]);
                    oSub.HDiscountRate = DBUtility.ClsPub.isDoule(DsSub2.Tables[0].Rows[0]["HDiscountRate"]);
                    oSub.HRelTaxPrice = DBUtility.ClsPub.isDoule(DsSub2.Tables[0].Rows[0]["HRelTaxPrice"]);
                    oSub.HTaxRate = DBUtility.ClsPub.isDoule(DsSub2.Tables[0].Rows[0]["HTaxRate"]);
                    oSub.HTaxMoney = DBUtility.ClsPub.isDoule(DsSub2.Tables[0].Rows[0]["HTaxMoney"]);
                    oSub.HMoney = DBUtility.ClsPub.isDoule(DsSub2.Tables[0].Rows[0]["HMoney"]);
                    oSub.HMoneyBB = DBUtility.ClsPub.isDoule(DsSub2.Tables[0].Rows[0]["HMoneyBB"]);
                    oSub.HlineTotal = DBUtility.ClsPub.isDoule(DsSub2.Tables[0].Rows[0]["HlineTotal"]);
                    oSub.HlineTotalBB = DBUtility.ClsPub.isDoule(DsSub2.Tables[0].Rows[0]["HlineTotalBB"]);
                    oSub.HPOOrderInterID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[0]["HPOOrderInterID"]);
                    oSub.HPOOrderEntryID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[0]["HPOOrderEntryID"]);
                    oSub.HPOOrderBillNo = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[0]["HPOOrderBillNo"]);
                    oSub.HSeOrderTaxPrice = DBUtility.ClsPub.isDoule(DsSub2.Tables[0].Rows[0]["HSeOrderTaxPrice"]);
                    oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[0]["HSeOrderInterID"]);
                    oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[0]["HSeOrderEntryID"]);
                    oSub.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[0]["HSeOrderBillNo"]);
                    DetailCol2.Add(oSub);
                }
                sReturn = "显示单据成功!";
                return true;
            }