| | |
| | | public class ClsCg_PayableBill : DBUtility.ClsXt_BaseBill |
| | | { |
| | | public Model.ClsCg_PayableBillMain omodel = new Model.ClsCg_PayableBillMain(); |
| | | public List<Model.ClsCg_PayableBillSub> DetailColl = new List<Model.ClsCg_PayableBillSub>(); |
| | | public List<Model.ClsCg_PayableSub> DetailColl = new List<Model.ClsCg_PayableSub>(); |
| | | |
| | | public ClsCg_PayableBill() |
| | | { |
| | | base.MvarItemKeySub = "Cg_PayableBillSub"; |
| | | base.MvarItemKeySub = "Cg_PayableSub"; |
| | | base.MvarItemKeySub2 = ""; |
| | | base.MvarItemKeySub3 = ""; |
| | | base.MvarItemKeySub4 = ""; |
| | |
| | | #endregion |
| | | #endregion |
| | | |
| | | //æ°å¢å
³è |
| | | public override void AddNewRelation(ref string sReturn, Int64 lngBillKey) |
| | | { |
| | | //æ¶æéç¥å éæéç¥å å
³èæ°é |
| | | try |
| | | { |
| | | if (DetailColl[0].HSourceBillType == "1201") //éè´å
¥åºå |
| | | { |
| | | oCn.RunProc("exec h_p_Cg_UpDateRelation_POStockInToPayable_Add " + lngBillKey.ToString()); |
| | | } |
| | | else if (DetailColl[0].HSourceBillType == "1102") //éè´è®¢å |
| | | { |
| | | oCn.RunProc("exec h_p_Cg_UpDateRelation_POOrderToPayable_Add " + lngBillKey.ToString()); |
| | | } |
| | | else |
| | | { |
| | | |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw (e); |
| | | } |
| | | } |
| | | |
| | | #region ä¿®æ¹åæ® |
| | | public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) |
| | | { |
| | | try |
| | | { |
| | | //ä¿ååæ§å¶========================================= |
| | | string HBillNote = ""; |
| | | DataSet ds = oCn.RunProcReturn("Exec h_p_Cg_PayableBill_BeforeSaveCtrl " + omodel.HInterID, "h_p_Cg_PayableBill_BeforeSaveCtrl"); |
| | | if (ds == null) |
| | | { |
| | | sReturn = "ä¿ååå¤æå¤±è´¥ï¼"; |
| | | return false; |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | sReturn = "ä¿å失败ï¼" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | return false; |
| | | } |
| | | //========================================================= |
| | | oCn.BeginTran(); |
| | | //æ´æ°ä¸»è¡¨ |
| | | string mainSql = "update Cg_PayableBillMain set " + |
| | |
| | | ",HCurID = " + omodel.HCurID + "" + |
| | | ",HExRate = " + omodel.HExRate + "" + |
| | | ",HEmpID = " + omodel.HEmpID + "" + |
| | | ",HMangerID = " + omodel.HMangerID + "" + |
| | | ",HManagerID = " + omodel.HManagerID + "" + |
| | | ",HDeptID = " + omodel.HDeptID + "" + |
| | | ",HExplanation = '" + omodel.HExplanation + "'" + |
| | | ",HInnerBillNo = '" + omodel.HInnerBillNo + "'" + |
| | |
| | | //æå
¥å表 |
| | | omodel.HInterID = lngBillKey; |
| | | //æå
¥å表 |
| | | foreach (Model.ClsCg_PayableBillSub oSub in DetailColl) |
| | | 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" + |
| | |
| | | ")"; |
| | | oCn.RunProc(subSql); |
| | | } |
| | | //æ´æ°è®¢åå
³èæ°é |
| | | AddNewRelation(ref sReturn, omodel.HInterID); |
| | | //=========================ä¿ååæ§å¶ |
| | | DataSet ds2 = oCn.RunProcReturn("h_p_Cg_PayableBill_AfterSaveCtrl " + omodel.HInterID ,"h_p_Cg_PayableBill_AfterSaveCtrl"); |
| | | if (ds2 == null) |
| | | { |
| | | sReturn = "ä¿ååæ§å¶å¤æå¤±è´¥ï¼"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | sReturn = "ä¿å失败2ï¼" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]); |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | //============================ |
| | | |
| | | sReturn = "ä¿®æ¹åæ®æåï¼"; |
| | | oCn.Commit(); |
| | |
| | | { |
| | | try |
| | | { |
| | | DataSet ds; |
| | | //DataSet ds; |
| | | |
| | | |
| | | //ä¿ååæ§å¶========================================= |
| | | string HBillNote = ""; |
| | | DataSet ds = oCn.RunProcReturn("Exec h_p_Cg_PayableBill_BeforeSaveCtrl " + omodel.HInterID, "h_p_Cg_PayableBill_BeforeSaveCtrl"); |
| | | if (ds == null) |
| | | { |
| | | sReturn = "ä¿ååå¤æå¤±è´¥ï¼"; |
| | | return false; |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | sReturn = "ä¿å失败ï¼" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | return false; |
| | | } |
| | | //========================================================= |
| | | oCn.BeginTran(); |
| | | |
| | | //æ£æ¥ä¸»è¡¨å
ç æ¯å¦éå¤ï¼è¥éå¤åéæ°çæå¹¶ç»§ç»æ£æ¥ï¼ç´å°ä¸åéå¤ |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | //æå
¥ä¸»è¡¨ |
| | | 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,HMangerID,HDeptID,HExplanation,HInnerBillNo,HRemark) " + |
| | | ",HMaker,HMakeDate,HSSID,HPSStyleID,HReceiveDate,HSupID,HCurID,HExRate,HEmpID,HManagerID,HDeptID,HExplanation,HInnerBillNo,HRemark) " + |
| | | "values(" + |
| | | "" + omodel.HInterID + "" + |
| | | ",'" + omodel.HBillNo + "'" + |
| | |
| | | "," + omodel.HCurID + "" + |
| | | "," + omodel.HExRate + "" + |
| | | "," + omodel.HEmpID + "" + |
| | | "," + omodel.HMangerID + "" + |
| | | "," + omodel.HManagerID + "" + |
| | | "," + omodel.HDeptID + "" + |
| | | ",'" + omodel.HExplanation + "'" + |
| | | ",'" + omodel.HInnerBillNo + "'" + |
| | |
| | | oCn.RunProc(mainSql); |
| | | |
| | | //æå
¥å表 |
| | | foreach (Model.ClsCg_PayableBillSub oSub in DetailColl) |
| | | 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" + |
| | |
| | | ")"; |
| | | oCn.RunProc(subSql); |
| | | } |
| | | //æ´æ°è®¢åå
³èæ°é |
| | | AddNewRelation(ref sReturn, omodel.HInterID); |
| | | //=========================ä¿ååæ§å¶ |
| | | DataSet ds2 = oCn.RunProcReturn("h_p_Cg_PayableBill_AfterSaveCtrl " + omodel.HInterID, "h_p_Cg_PayableBill_AfterSaveCtrl"); |
| | | if (ds2 == null) |
| | | { |
| | | sReturn = "ä¿ååæ§å¶å¤æå¤±è´¥ï¼"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | sReturn = "ä¿å失败2ï¼" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]); |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | //============================ |
| | | sReturn = "æ°å¢åæ®æåï¼"; |
| | | oCn.Commit(); |
| | | return true; |
| | |
| | | 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.HMangerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMangerID"]); |
| | | omodel.HManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HManagerID"]); |
| | | omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]); |
| | | |
| | | omodel.HExplanation = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HExplanation"]); |
| | |
| | | DetailColl.Clear();//æ¸
空 |
| | | for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) |
| | | { |
| | | Model.ClsCg_PayableBillSub oSub = new Model.ClsCg_PayableBillSub(); |
| | | Model.ClsCg_PayableSub oSub = new Model.ClsCg_PayableSub(); |
| | | // åºå®èµå¼=============================================== |
| | | oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]); |
| | | oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]); |