1
wtt
2026-02-09 0bb73d4cccd49e09c033ad0378da94f6ebbc280e
DAL/Ó¦¸¶¹ÜÀí/ClsYF_PayMentBill.cs
@@ -31,8 +31,48 @@
        {
            DetailColl = null;
        }
        #endregion   è‡ªå®šä¹‰æ–¹æ³•
        //删除关联
        public override void DeleteRelation(ref string sReturn, Int64 lngBillKey)
        {
            //应收单 å…³è”数量
            try
            {
                if (DetailColl[0].HSourceBillType == "1114")                    //应付单
                {
                    oCn.RunProc("exec h_p_Cg_UpDateRelation_PayableToPayMent_Del " + lngBillKey.ToString());
                }
                else
                {
                }
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
        //新增关联
        public override void AddNewRelation(ref string sReturn, Int64 lngBillKey)
        {
            //应收单 å…³è”数量
            try
            {
                if (DetailColl[0].HSourceBillType == "1114")                    //应付单
                {
                    oCn.RunProc("exec h_p_Cg_UpDateRelation_PayableToPayMent_Add " + lngBillKey.ToString());
                }
                else
                {
                }
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
        //修改单据
        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
        {
@@ -77,10 +117,17 @@
                ",HSumMoneyBB=" + omodel.HSumMoneyBB.ToString() +
                ",HRelSumMoneyBB=" + omodel.HRelSumMoneyBB.ToString() +
                ",HDiscountRate=" + omodel.HDiscountRate.ToString() +
                " where HInterID=" + lngBillKey.ToString());
                //删除关联
                DeleteRelation(ref sReturn, lngBillKey);
                ",HMainSourceInterID=" + omodel.HMainSourceInterID.ToString() +
                ",HMainSourceEntryID=" + omodel.HMainSourceEntryID.ToString() +
                ",HMainSourceBillNo='" + omodel.HMainSourceBillNo.ToString() +
                "',HMainSourceBillType='" + omodel.HMainSourceBillType.ToString() +
                "',HProjectID='" + omodel.HProjectID.ToString() +
                "' where HInterID=" + lngBillKey.ToString());
                if (DetailColl.Count != 0)
                {
                    //删除关联
                    DeleteRelation(ref sReturn, lngBillKey);
                }
                //删除子表
                DeleteBillSub(lngBillKey);
                //插入子表
@@ -94,15 +141,15 @@
                      ",HReceiveBillNo,HReceiveBillInterID,HReceiveBillEntryID,HSourceDate,HSourceMoney" +
                      ",HSourceMoneyBB,HReadyCheckMoney,HUnCheckMoney,HCheckMoney,HCheckMoneyBB,HInovceExRate,HSourceRemark" +
                      ",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
                      ",HPOContractInterID,HPOContractEntryID,HPOContractBillNo,HSeContractInterID,HSeContractEntryID,HSeContractBillNo" +
                      ",HPOContractInterID,HPOContractEntryID,HPOContractBillNo,HSeContractInterID,HSeContractEntryID,HSeContractBillNo,HInvoiceBillNo_Sub" +
                      ") 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.HReceiveBillNo + "'," + oSub.HReceiveBillInterID.ToString() + "," + oSub.HReceiveBillEntryID.ToString() + "," + oSub.HSourceDate.ToString() + "," + oSub.HSourceMoney.ToString() +
                      ",'" + oSub.HReceiveBillNo + "'," + oSub.HReceiveBillInterID.ToString() + "," + oSub.HReceiveBillEntryID.ToString() + ",'" + oSub.HSourceDate.ToString() + "'," + oSub.HSourceMoney.ToString() +
                      "," + oSub.HSourceMoneyBB.ToString() + "," + oSub.HReadyCheckMoney.ToString() + "," + oSub.HUnCheckMoney.ToString() + "," + oSub.HCheckMoney.ToString() + "," + oSub.HCheckMoneyBB.ToString() + "," + oSub.HInovceExRate.ToString() + ",'" + oSub.HSeContractBillNo + "'" +
                      "," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" +
                      "," + oSub.HPOContractInterID.ToString() + "," + oSub.HPOContractEntryID.ToString() + ",'" + oSub.HPOContractBillNo + "'," + oSub.HSeContractInterID.ToString() + "," + oSub.HSeContractEntryID.ToString() + ",'" + oSub.HSeContractBillNo + "'" +
                      "," + oSub.HPOContractInterID.ToString() + "," + oSub.HPOContractEntryID.ToString() + ",'" + oSub.HPOContractBillNo + "'," + oSub.HSeContractInterID.ToString() + "," + oSub.HSeContractEntryID.ToString() + ",'" + oSub.HSeContractBillNo + "'" + ",'" + oSub.HInvoiceBillNo_Sub + "'" +
                      ") ");
                }
                //
@@ -117,6 +164,11 @@
                //        return false;
                //    }
                //}
                if (DetailColl.Count != 0)
                {
                    //更新订单关联数量
                    AddNewRelation(ref sReturn, omodel.HInterID);
                }
                sReturn = "修改单据成功!";
                oCn.Commit();
                return true;
@@ -144,15 +196,16 @@
                ",HAccDate,HSupID,HAccSupID,HSSID,HCurID,HExRate" +
                ",HDeptID,HEmpID,HOrgID,HSumMoney,HBankID,HBankNo,HExplanation" +
                ",HSSNum,HDiscountRate,HRelSumMoney,HSumMoneyBB,HRelSumMoneyBB" +
                ",HInnerBillNo,HCheckMoney,HCheckMoneyFor,HRemainMoney,HCheckStatus,HInvoiceBillNo,HBigMoney,HReason" +
                ",HInnerBillNo,HCheckMoney,HCheckMoneyFor,HRemainMoney,HCheckStatus,HInvoiceBillNo,HBigMoney,HReason,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HProjectID" +
                ") " +
                " 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.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" +
                ",'" + omodel.HAccDate + "'," + omodel.HSupID.ToString() + "," + omodel.HAccSupID.ToString() + "," + omodel.HSSID.ToString() + "," + omodel.HCurID.ToString() + "," + omodel.HExRate.ToString() +
                ", " + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HOrgID + "," + omodel.HSumMoney.ToString() + "," + omodel.HBankID.ToString() + ",'" + omodel.HBankNo + "','" + omodel.HExplanation +"'"+
                ",'" + omodel.HSSNum + "'," + omodel.HDiscountRate.ToString() + "," + omodel.HRelSumMoney.ToString() + "," + omodel.HSumMoneyBB.ToString() + "," + omodel.HRelSumMoneyBB.ToString() + 
                ",'" + omodel.HInnerBillNo + "'," + omodel.HCheckMoney.ToString() + "," + omodel.HCheckMoneyFor.ToString() + "," + omodel.HRemainMoney.ToString() + "," + omodel.HCheckStatus.ToString() + ",'" + omodel.HInvoiceBillNo + "','" + omodel.HBigMoney + "','" + omodel.HReason +
                "') ");
                "'," + omodel.HMainSourceInterID.ToString() + "," + omodel.HMainSourceEntryID.ToString() + ",'" + omodel.HMainSourceBillNo + "','" + omodel.HMainSourceBillType + "','" + omodel.HProjectID + "'" +
                " ) ");
                //插入子表
                foreach (Model.ClsYF_PayMentBillSub oSub in DetailColl)
                {
@@ -163,16 +216,21 @@
                      ",HReceiveBillNo,HReceiveBillInterID,HReceiveBillEntryID,HSourceDate,HSourceMoney" +
                      ",HSourceMoneyBB,HReadyCheckMoney,HUnCheckMoney,HCheckMoney,HCheckMoneyBB,HInovceExRate,HSourceRemark" +
                      ",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
                      ",HPOContractInterID,HPOContractEntryID,HPOContractBillNo,HSeContractInterID,HSeContractEntryID,HSeContractBillNo" +
                      ",HPOContractInterID,HPOContractEntryID,HPOContractBillNo,HSeContractInterID,HSeContractEntryID,HSeContractBillNo,HInvoiceBillNo_Sub" +
                      ") 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.HReceiveBillNo + "'," + oSub.HReceiveBillInterID.ToString() + "," + oSub.HReceiveBillEntryID.ToString() + "," + oSub.HSourceDate.ToString() + "," + oSub.HSourceMoney.ToString() +
                      ",'" + oSub.HReceiveBillNo + "'," + oSub.HReceiveBillInterID.ToString() + "," + oSub.HReceiveBillEntryID.ToString() + ",'" + oSub.HSourceDate.ToString() + "'," + oSub.HSourceMoney.ToString() +
                      "," + oSub.HSourceMoneyBB.ToString() + "," + oSub.HReadyCheckMoney.ToString() + "," + oSub.HUnCheckMoney.ToString() + "," + oSub.HCheckMoney.ToString() + "," + oSub.HCheckMoneyBB.ToString() + "," + oSub.HInovceExRate.ToString() + ",'" + oSub.HSeContractBillNo + "'" +
                      "," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" +
                      "," + oSub.HPOContractInterID.ToString() + "," + oSub.HPOContractEntryID.ToString() + ",'" + oSub.HPOContractBillNo + "'," + oSub.HSeContractInterID.ToString() + "," + oSub.HSeContractEntryID.ToString() + ",'" + oSub.HSeContractBillNo + "'" +
                      "," + oSub.HPOContractInterID.ToString() + "," + oSub.HPOContractEntryID.ToString() + ",'" + oSub.HPOContractBillNo + "'," + oSub.HSeContractInterID.ToString() + "," + oSub.HSeContractEntryID.ToString() + ",'" + oSub.HSeContractBillNo + "'" + ",'" + oSub.HInvoiceBillNo_Sub + "'" +
                      ") ");
                }
                if (DetailColl.Count != 0)
                {
                    //更新订单关联数量
                    AddNewRelation(ref sReturn, omodel.HInterID);
                }
                //
                //foreach (Model.ClsYF_PayMentBillSub oSub in DetailColl)
@@ -237,6 +295,8 @@
                omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]);
                omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim();
                omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim();
                omodel.HProjectID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProjectID"]); ;
                //========================================================
                omodel.HAccDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HAccDate"]);
                omodel.HSupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSupID"]);