| | |
| | | { |
| | | public Model.ClsCg_PayableBillMain omodel = new Model.ClsCg_PayableBillMain(); |
| | | public List<Model.ClsCg_PayableSub> DetailColl = new List<Model.ClsCg_PayableSub>(); |
| | | |
| | | public List<Model.ClsCg_PayableSub> DetailCol2 = new List<Model.ClsCg_PayableSub>(); |
| | | public ClsCg_PayableBill() |
| | | { |
| | | base.MvarItemKeySub = "Cg_PayableSub"; |
| | | base.MvarItemKeySub2 = ""; |
| | | base.MvarItemKeySub2 = "Cg_PayableSub_Entry"; |
| | | base.MvarItemKeySub3 = ""; |
| | | base.MvarItemKeySub4 = ""; |
| | | base.MvarItemKey= "Cg_PayableBillMain"; |
| | |
| | | #endregion |
| | | #endregion |
| | | |
| | | //å é¤å
³è |
| | | public override void DeleteRelation(ref string sReturn, Int64 lngBillKey) |
| | | { |
| | | //éè´å
¥åºå éè´è®¢å å
³èæ°é |
| | | try |
| | | { |
| | | if (DetailColl[0].HSourceBillType == "1201") //éè´å
¥åºå |
| | | { |
| | | oCn.RunProc("exec h_p_Cg_UpDateRelation_POStockInToPayable_Del " + lngBillKey.ToString()); |
| | | } |
| | | else if (DetailColl[0].HSourceBillType == "1102") //éè´è®¢å |
| | | { |
| | | oCn.RunProc("exec h_p_Cg_UpDateRelation_POOrderToPayable_Del " + lngBillKey.ToString()); |
| | | } |
| | | else |
| | | { |
| | | |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw (e); |
| | | } |
| | | } |
| | | |
| | | //æ°å¢å
³è |
| | | public override void AddNewRelation(ref string sReturn, Int64 lngBillKey) |
| | | { |
| | | //æ¶æéç¥å éæéç¥å å
³èæ°é |
| | | //éè´å
¥åºå éè´è®¢å å
³èæ°é |
| | | try |
| | | { |
| | | if (DetailColl[0].HSourceBillType == "1201") //éè´å
¥åºå |
| | |
| | | ",HCurID = " + omodel.HCurID + "" + |
| | | ",HExRate = " + omodel.HExRate + "" + |
| | | ",HEmpID = " + omodel.HEmpID + "" + |
| | | ",HManagerID = " + omodel.HManagerID + "" + |
| | | ",HMangerID = " + omodel.HMangerID + "" + |
| | | ",HDeptID = " + omodel.HDeptID + "" + |
| | | ",HExplanation = '" + omodel.HExplanation + "'" + |
| | | ",HInnerBillNo = '" + omodel.HInnerBillNo + "'" + |
| | |
| | | DeleteRelation(ref sReturn, lngBillKey); |
| | | //å é¤å表 |
| | | DeleteBillSub(lngBillKey); |
| | | |
| | | //å é¤å表2 |
| | | DeleteBillSub2(lngBillKey); |
| | | //æå
¥å表 |
| | | omodel.HInterID = lngBillKey; |
| | | //æå
¥å表 |
| | |
| | | } |
| | | //æ´æ°è®¢åå
³èæ°é |
| | | AddNewRelation(ref sReturn, omodel.HInterID); |
| | | //æå
¥å表2 |
| | | foreach (Model.ClsCg_PayableSub oSub in DetailCol2) |
| | | { |
| | | string subSql = "insert into Cg_PayableSub_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); |
| | | } |
| | | //=========================ä¿ååæ§å¶ |
| | | DataSet ds2 = oCn.RunProcReturn("h_p_Cg_PayableBill_AfterSaveCtrl " + omodel.HInterID ,"h_p_Cg_PayableBill_AfterSaveCtrl"); |
| | | if (ds2 == null) |
| | |
| | | string mainSql = "insert into Cg_PayableBillMain" + |
| | | "(HInterID,HBillNo,HDate,HYear,HPeriod,HBillType,HBillSubType" + |
| | | ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType" + |
| | | ",HMaker,HMakeDate,HSSID,HPSStyleID,HReceiveDate,HSupID,HCurID,HExRate,HEmpID,HManagerID,HDeptID,HExplanation,HInnerBillNo,HRemark) " + |
| | | ",HMaker,HMakeDate,HSSID,HPSStyleID,HReceiveDate,HSupID,HCurID,HExRate,HEmpID,HMangerID,HDeptID,HExplanation,HInnerBillNo,HRemark) " + |
| | | "values(" + |
| | | "" + omodel.HInterID + "" + |
| | | ",'" + omodel.HBillNo + "'" + |
| | |
| | | "," + omodel.HCurID + "" + |
| | | "," + omodel.HExRate + "" + |
| | | "," + omodel.HEmpID + "" + |
| | | "," + omodel.HManagerID + "" + |
| | | "," + omodel.HMangerID + "" + |
| | | "," + omodel.HDeptID + "" + |
| | | ",'" + omodel.HExplanation + "'" + |
| | | ",'" + omodel.HInnerBillNo + "'" + |
| | |
| | | foreach (Model.ClsCg_PayableSub oSub in DetailColl) |
| | | { |
| | | string subSql = "insert into Cg_PayableSub" + |
| | | "(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); |
| | | } |
| | | //æå
¥å表Entry |
| | | foreach (Model.ClsCg_PayableSub oSub in DetailCol2) |
| | | { |
| | | string subSql = "insert into Cg_PayableSub_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" + |
| | |
| | | omodel.HCurID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCurID"]); |
| | | omodel.HExRate = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HExRate"]); |
| | | omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]); |
| | | omodel.HManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HManagerID"]); |
| | | omodel.HMangerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMangerID"]); |
| | | omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]); |
| | | |
| | | omodel.HExplanation = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HExplanation"]); |
| | |
| | | |
| | | DetailColl.Add(oSub); |
| | | } |
| | | //å表Entry |
| | | DataSet DsSub2; |
| | | DsSub2 = oCn.RunProcReturn("select * from Cg_PayableSub_Entry where HInterID = " + lngBillKey.ToString() + "order by HEntryID", "Cg_PayableSub_Entry "); |
| | | DetailCol2.Clear();//æ¸
空 |
| | | for (int i = 0; i < DsSub2.Tables[0].Rows.Count; i++) |
| | | { |
| | | Model.ClsCg_PayableSub oSub = new Model.ClsCg_PayableSub(); |
| | | // åºå®èµå¼=============================================== |
| | | 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; |
| | | } |