/// <summary> /// Create Payment Line on run tab of dunning run window. /// </summary> /// <param name="C_Payment_ID">Payment ID.</param> /// <param name="C_Currency_ID">Currency ID.</param> /// <param name="PayAmt">Amount.</param> /// <param name="openAmt">Open.</param> /// <param name="C_BPartner_ID">Business Partner ID.</param> private bool CreatePaymentLine(int C_Payment_ID, int C_Currency_ID, Decimal PayAmt, Decimal openAmt, int C_BPartner_ID) { MDunningRunEntry entry = _run.GetEntry(C_BPartner_ID, _C_Currency_ID, _SalesRep_ID); if (entry.Get_ID() == 0) { if (!entry.Save()) { // Change by mohit to pick error message from last error in mclass. //throw new Exception(GetRetrievedError(entry, "Cannot save MDunningRunEntry")); //throw new Exception("Cannot save MDunningRunEntry"); //log.SaveError("Cannot save MDunningRunEntry", ""); ValueNamePair vp = VLogger.RetrieveError(); if (vp != null) { string val = vp.GetName(); log.SaveError(Msg.GetMsg(GetCtx(), "NotSaveDunRunEntry"), val); } else { log.SaveError(Msg.GetMsg(GetCtx(), "NotSaveDunRunEntry"), ""); } return(false); } } // MDunningRunLine line = new MDunningRunLine(entry); line.SetPayment(C_Payment_ID, C_Currency_ID, PayAmt, openAmt); if (!line.Save()) { // Change by mohit to pick error message from last error in mclass. //throw new Exception(GetRetrievedError(line, "Cannot save MDunningRunLine")); //throw new Exception("Cannot save MDunningRunLine"); ValueNamePair vp = VLogger.RetrieveError(); if (vp != null) { log.SaveError(Msg.GetMsg(GetCtx(), "NotSaveDunRunLine"), vp.GetName()); } else { log.SaveError(Msg.GetMsg(GetCtx(), "NotSaveDunRunLine"), ""); } return(false); } return(true); }
/// <summary> /// Create Payment Line /// </summary> /// <param name="C_Payment_ID">payment</param> /// <param name="C_Currency_ID">currency</param> /// <param name="PayAmt">amount</param> /// <param name="openAmt">open</param> /// <param name="C_BPartner_ID">bp</param> private void CreatePaymentLine(int C_Payment_ID, int C_Currency_ID, Decimal PayAmt, Decimal openAmt, int C_BPartner_ID) { MDunningRunEntry entry = _run.GetEntry(C_BPartner_ID, _C_Currency_ID, _SalesRep_ID); if (entry.Get_ID() == 0) { if (!entry.Save()) { throw new Exception("Cannot save MDunningRunEntry"); } } // MDunningRunLine line = new MDunningRunLine(entry); line.SetPayment(C_Payment_ID, C_Currency_ID, PayAmt, openAmt); if (!line.Save()) { throw new Exception("Cannot save MDunningRunLine"); } }