Implement FR [2840458] - Credit checking problem
https://sourceforge.net/tracker/?func=detail&aid=2840458&group_id=176962&atid=879335
This commit is contained in:
parent
2dcb50c9b7
commit
88d302f2b0
|
@ -1050,28 +1050,34 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
// Credit Check
|
||||
if (isSOTrx() && !isReversal())
|
||||
{
|
||||
MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), get_TrxName());
|
||||
if (MBPartner.SOCREDITSTATUS_CreditStop.equals(bp.getSOCreditStatus()))
|
||||
{
|
||||
m_processMsg = "@BPartnerCreditStop@ - @TotalOpenBalance@="
|
||||
+ bp.getTotalOpenBalance()
|
||||
+ ", @SO_CreditLimit@=" + bp.getSO_CreditLimit();
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
if (MBPartner.SOCREDITSTATUS_CreditHold.equals(bp.getSOCreditStatus()))
|
||||
{
|
||||
m_processMsg = "@BPartnerCreditHold@ - @TotalOpenBalance@="
|
||||
+ bp.getTotalOpenBalance()
|
||||
+ ", @SO_CreditLimit@=" + bp.getSO_CreditLimit();
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
BigDecimal notInvoicedAmt = MBPartner.getNotInvoicedAmt(getC_BPartner_ID());
|
||||
if (MBPartner.SOCREDITSTATUS_CreditHold.equals(bp.getSOCreditStatus(notInvoicedAmt)))
|
||||
{
|
||||
m_processMsg = "@BPartnerOverSCreditHold@ - @TotalOpenBalance@="
|
||||
+ bp.getTotalOpenBalance() + ", @NotInvoicedAmt@=" + notInvoicedAmt
|
||||
+ ", @SO_CreditLimit@=" + bp.getSO_CreditLimit();
|
||||
return DocAction.STATUS_Invalid;
|
||||
I_C_Order order = getC_Order();
|
||||
if (order != null && MDocType.DOCSUBTYPESO_PrepayOrder.equals(order.getC_DocType().getDocSubTypeSO())
|
||||
&& !MSysConfig.getBooleanValue("CHECK_CREDIT_ON_PREPAY_ORDER", true, getAD_Client_ID(), getAD_Org_ID())) {
|
||||
// ignore -- don't validate Prepay Orders depending on sysconfig parameter
|
||||
} else {
|
||||
MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), get_TrxName());
|
||||
if (MBPartner.SOCREDITSTATUS_CreditStop.equals(bp.getSOCreditStatus()))
|
||||
{
|
||||
m_processMsg = "@BPartnerCreditStop@ - @TotalOpenBalance@="
|
||||
+ bp.getTotalOpenBalance()
|
||||
+ ", @SO_CreditLimit@=" + bp.getSO_CreditLimit();
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
if (MBPartner.SOCREDITSTATUS_CreditHold.equals(bp.getSOCreditStatus()))
|
||||
{
|
||||
m_processMsg = "@BPartnerCreditHold@ - @TotalOpenBalance@="
|
||||
+ bp.getTotalOpenBalance()
|
||||
+ ", @SO_CreditLimit@=" + bp.getSO_CreditLimit();
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
BigDecimal notInvoicedAmt = MBPartner.getNotInvoicedAmt(getC_BPartner_ID());
|
||||
if (MBPartner.SOCREDITSTATUS_CreditHold.equals(bp.getSOCreditStatus(notInvoicedAmt)))
|
||||
{
|
||||
m_processMsg = "@BPartnerOverSCreditHold@ - @TotalOpenBalance@="
|
||||
+ bp.getTotalOpenBalance() + ", @NotInvoicedAmt@=" + notInvoicedAmt
|
||||
+ ", @SO_CreditLimit@=" + bp.getSO_CreditLimit();
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.adempiere.exceptions.FillMandatoryException;
|
|||
import org.compiere.print.ReportEngine;
|
||||
import org.compiere.process.DocAction;
|
||||
import org.compiere.process.DocumentEngine;
|
||||
import org.compiere.report.MReportTree;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
|
@ -1219,30 +1218,39 @@ public class MOrder extends X_C_Order implements DocAction
|
|||
// Credit Check
|
||||
if (isSOTrx())
|
||||
{
|
||||
MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), get_TrxName());
|
||||
if (MBPartner.SOCREDITSTATUS_CreditStop.equals(bp.getSOCreditStatus()))
|
||||
{
|
||||
m_processMsg = "@BPartnerCreditStop@ - @TotalOpenBalance@="
|
||||
+ bp.getTotalOpenBalance()
|
||||
+ ", @SO_CreditLimit@=" + bp.getSO_CreditLimit();
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
if (MBPartner.SOCREDITSTATUS_CreditHold.equals(bp.getSOCreditStatus()))
|
||||
{
|
||||
m_processMsg = "@BPartnerCreditHold@ - @TotalOpenBalance@="
|
||||
+ bp.getTotalOpenBalance()
|
||||
+ ", @SO_CreditLimit@=" + bp.getSO_CreditLimit();
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
BigDecimal grandTotal = MConversionRate.convertBase(getCtx(),
|
||||
getGrandTotal(), getC_Currency_ID(), getDateOrdered(),
|
||||
getC_ConversionType_ID(), getAD_Client_ID(), getAD_Org_ID());
|
||||
if (MBPartner.SOCREDITSTATUS_CreditHold.equals(bp.getSOCreditStatus(grandTotal)))
|
||||
{
|
||||
m_processMsg = "@BPartnerOverOCreditHold@ - @TotalOpenBalance@="
|
||||
+ bp.getTotalOpenBalance() + ", @GrandTotal@=" + grandTotal
|
||||
+ ", @SO_CreditLimit@=" + bp.getSO_CreditLimit();
|
||||
return DocAction.STATUS_Invalid;
|
||||
if ( MDocType.DOCSUBTYPESO_POSOrder.equals(dt.getDocSubTypeSO())
|
||||
&& PAYMENTRULE_Cash.equals(getPaymentRule())
|
||||
&& !MSysConfig.getBooleanValue("CHECK_CREDIT_ON_CASH_POS_ORDER", true, getAD_Client_ID(), getAD_Org_ID())) {
|
||||
// ignore -- don't validate for Cash POS Orders depending on sysconfig parameter
|
||||
} else if (MDocType.DOCSUBTYPESO_PrepayOrder.equals(dt.getDocSubTypeSO())
|
||||
&& !MSysConfig.getBooleanValue("CHECK_CREDIT_ON_PREPAY_ORDER", true, getAD_Client_ID(), getAD_Org_ID())) {
|
||||
// ignore -- don't validate Prepay Orders depending on sysconfig parameter
|
||||
} else {
|
||||
MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), get_TrxName());
|
||||
if (MBPartner.SOCREDITSTATUS_CreditStop.equals(bp.getSOCreditStatus()))
|
||||
{
|
||||
m_processMsg = "@BPartnerCreditStop@ - @TotalOpenBalance@="
|
||||
+ bp.getTotalOpenBalance()
|
||||
+ ", @SO_CreditLimit@=" + bp.getSO_CreditLimit();
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
if (MBPartner.SOCREDITSTATUS_CreditHold.equals(bp.getSOCreditStatus()))
|
||||
{
|
||||
m_processMsg = "@BPartnerCreditHold@ - @TotalOpenBalance@="
|
||||
+ bp.getTotalOpenBalance()
|
||||
+ ", @SO_CreditLimit@=" + bp.getSO_CreditLimit();
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
BigDecimal grandTotal = MConversionRate.convertBase(getCtx(),
|
||||
getGrandTotal(), getC_Currency_ID(), getDateOrdered(),
|
||||
getC_ConversionType_ID(), getAD_Client_ID(), getAD_Org_ID());
|
||||
if (MBPartner.SOCREDITSTATUS_CreditHold.equals(bp.getSOCreditStatus(grandTotal)))
|
||||
{
|
||||
m_processMsg = "@BPartnerOverOCreditHold@ - @TotalOpenBalance@="
|
||||
+ bp.getTotalOpenBalance() + ", @GrandTotal@=" + grandTotal
|
||||
+ ", @SO_CreditLimit@=" + bp.getSO_CreditLimit();
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
-- Aug 19, 2009 12:05:23 PM COT
|
||||
-- FR 2840458 - Credit checking problem
|
||||
INSERT INTO AD_SysConfig (AD_Client_ID,AD_Org_ID,AD_SysConfig_ID,ConfigurationLevel,Created,CreatedBy,Description,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,50029,'O',TO_DATE('2009-08-19 12:05:21','YYYY-MM-DD HH24:MI:SS'),100,'Check credit on Cash POS Order','D','Y','CHECK_CREDIT_ON_CASH_POS_ORDER',TO_DATE('2009-08-19 12:05:21','YYYY-MM-DD HH24:MI:SS'),100,'Y')
|
||||
;
|
||||
|
||||
-- Aug 19, 2009 12:05:38 PM COT
|
||||
-- FR 2840458 - Credit checking problem
|
||||
INSERT INTO AD_SysConfig (AD_Client_ID,AD_Org_ID,AD_SysConfig_ID,ConfigurationLevel,Created,CreatedBy,Description,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,50030,'O',TO_DATE('2009-08-19 12:05:37','YYYY-MM-DD HH24:MI:SS'),100,'Check credit on Prepay Order','D','Y','CHECK_CREDIT_ON_PREPAY_ORDER',TO_DATE('2009-08-19 12:05:37','YYYY-MM-DD HH24:MI:SS'),100,'Y')
|
||||
;
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
-- Aug 19, 2009 12:05:23 PM COT
|
||||
-- FR 2840458 - Credit checking problem
|
||||
INSERT INTO AD_SysConfig (AD_Client_ID,AD_Org_ID,AD_SysConfig_ID,ConfigurationLevel,Created,CreatedBy,Description,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,50029,'O',TO_TIMESTAMP('2009-08-19 12:05:21','YYYY-MM-DD HH24:MI:SS'),100,'Check credit on Cash POS Order','D','Y','CHECK_CREDIT_ON_CASH_POS_ORDER',TO_TIMESTAMP('2009-08-19 12:05:21','YYYY-MM-DD HH24:MI:SS'),100,'Y')
|
||||
;
|
||||
|
||||
-- Aug 19, 2009 12:05:38 PM COT
|
||||
-- FR 2840458 - Credit checking problem
|
||||
INSERT INTO AD_SysConfig (AD_Client_ID,AD_Org_ID,AD_SysConfig_ID,ConfigurationLevel,Created,CreatedBy,Description,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,50030,'O',TO_TIMESTAMP('2009-08-19 12:05:37','YYYY-MM-DD HH24:MI:SS'),100,'Check credit on Prepay Order','D','Y','CHECK_CREDIT_ON_PREPAY_ORDER',TO_TIMESTAMP('2009-08-19 12:05:37','YYYY-MM-DD HH24:MI:SS'),100,'Y')
|
||||
;
|
||||
|
Loading…
Reference in New Issue