IDEMPIERE-392 Redesign payment button

This commit is contained in:
Elaine Tan 2012-10-19 16:35:15 +08:00
parent fb9b7176fa
commit e1778c1501
30 changed files with 1073 additions and 511 deletions

View File

@ -0,0 +1,62 @@
-- Oct 19, 2012 4:08:01 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Failed to create payment',200077,'D','da079a31-b0e8-4e39-8d06-5861235240cd','PaymentNotCreated','Y',TO_DATE('2012-10-19 16:08:00','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-10-19 16:08:00','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 19, 2012 4:08:05 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200077 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Oct 19, 2012 4:08:20 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Failed to cancel payment',200078,'D','147fef6f-7a60-4579-9b20-2bcb1836cbbb','PaymentNotCancelled','Y',TO_DATE('2012-10-19 16:08:20','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-10-19 16:08:20','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 19, 2012 4:08:20 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200078 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Oct 19, 2012 4:09:32 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Failed to create cash',200079,'D','2a395bb4-e2cc-4c5c-ad6c-e5d96bb8b16e','CashNotCancelled','Y',TO_DATE('2012-10-19 16:09:31','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-10-19 16:09:31','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 19, 2012 4:09:32 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200079 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Oct 19, 2012 4:09:57 PM SGT
-- IDEMPIERE-392 Redesign payment button
UPDATE AD_Message SET MsgText='Failed to cancel cash',Updated=TO_DATE('2012-10-19 16:09:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200079
;
-- Oct 19, 2012 4:09:57 PM SGT
-- IDEMPIERE-392 Redesign payment button
UPDATE AD_Message_Trl SET IsTranslated='N' WHERE AD_Message_ID=200079
;
-- Oct 19, 2012 4:10:18 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Failed to create cash',200080,'D','9a1b19b9-03a4-4a94-a4be-3c330e6ef800','CashNotCreated','Y',TO_DATE('2012-10-19 16:10:18','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-10-19 16:10:18','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 19, 2012 4:10:18 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200080 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Oct 19, 2012 4:10:55 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Card not processed',200081,'D','743abddc-b21d-4317-b959-9e7dba185313','CardNotProcessed','Y',TO_DATE('2012-10-19 16:10:55','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-10-19 16:10:55','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 19, 2012 4:10:55 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200081 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
SELECT register_migration_script('940_IDEMPIERE-392.sql') FROM dual
;

View File

@ -0,0 +1,62 @@
-- Oct 19, 2012 4:08:01 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Failed to create payment',200077,'D','da079a31-b0e8-4e39-8d06-5861235240cd','PaymentNotCreated','Y',TO_TIMESTAMP('2012-10-19 16:08:00','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-10-19 16:08:00','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 19, 2012 4:08:05 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200077 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Oct 19, 2012 4:08:20 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Failed to cancel payment',200078,'D','147fef6f-7a60-4579-9b20-2bcb1836cbbb','PaymentNotCancelled','Y',TO_TIMESTAMP('2012-10-19 16:08:20','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-10-19 16:08:20','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 19, 2012 4:08:20 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200078 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Oct 19, 2012 4:09:32 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Failed to create cash',200079,'D','2a395bb4-e2cc-4c5c-ad6c-e5d96bb8b16e','CashNotCancelled','Y',TO_TIMESTAMP('2012-10-19 16:09:31','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-10-19 16:09:31','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 19, 2012 4:09:32 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200079 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Oct 19, 2012 4:09:57 PM SGT
-- IDEMPIERE-392 Redesign payment button
UPDATE AD_Message SET MsgText='Failed to cancel cash',Updated=TO_TIMESTAMP('2012-10-19 16:09:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200079
;
-- Oct 19, 2012 4:09:57 PM SGT
-- IDEMPIERE-392 Redesign payment button
UPDATE AD_Message_Trl SET IsTranslated='N' WHERE AD_Message_ID=200079
;
-- Oct 19, 2012 4:10:18 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Failed to create cash',200080,'D','9a1b19b9-03a4-4a94-a4be-3c330e6ef800','CashNotCreated','Y',TO_TIMESTAMP('2012-10-19 16:10:18','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-10-19 16:10:18','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 19, 2012 4:10:18 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200080 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Oct 19, 2012 4:10:55 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Card not processed',200081,'D','743abddc-b21d-4317-b959-9e7dba185313','CardNotProcessed','Y',TO_TIMESTAMP('2012-10-19 16:10:55','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-10-19 16:10:55','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 19, 2012 4:10:55 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200081 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
SELECT register_migration_script('940_IDEMPIERE-392.sql') FROM dual
;

View File

@ -850,7 +850,10 @@ public final class MPayment extends X_C_Payment
}
}
if (m_mBankAccountProcessor != null)
{
setC_BankAccount_ID (m_mBankAccountProcessor.getC_BankAccount_ID());
setC_PaymentProcessor_ID (m_mBankAccountProcessor.getC_PaymentProcessor_ID());
}
//
return m_mBankAccountProcessor != null;
} // setPaymentProcessor

View File

@ -61,7 +61,7 @@ public class MPaymentProcessor extends X_C_PaymentProcessor
* @param trxName transaction
* @return Array of BankAccount[0] & PaymentProcessor[1] or null
*/
protected static MBankAccountProcessor[] find (Properties ctx,
public static MBankAccountProcessor[] find (Properties ctx,
String tender, String CCType,
int AD_Client_ID, int C_Currency_ID, BigDecimal Amt, String trxName)
{

View File

@ -209,7 +209,7 @@ public class VPaymentFormCash extends PaymentFormCash implements ActionListener
else if (processMsg != null)
ADialog.info(getWindowNo(), dialog, "PaymentCreated", processMsg);
return true;
return ok;
}
@Override

View File

@ -6,6 +6,8 @@ import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Enumeration;
@ -14,6 +16,7 @@ import org.adempiere.plaf.AdempierePLAF;
import org.compiere.apps.ADialog;
import org.compiere.grid.ed.VNumber;
import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor;
import org.compiere.model.MConversionRate;
import org.compiere.model.MPaymentValidate;
import org.compiere.swing.CButton;
@ -24,7 +27,7 @@ import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
public class VPaymentFormCheck extends PaymentFormCheck implements ActionListener {
public class VPaymentFormCheck extends PaymentFormCheck implements ActionListener, FocusListener {
private VPaymentFormDialog dialog;
@ -64,6 +67,7 @@ public class VPaymentFormCheck extends PaymentFormCheck implements ActionListene
sRoutingField.setPreferredSize(new Dimension(70, 21));
sStatus.setText(" ");
sOnline.setText(Msg.getMsg(Env.getCtx(), "Online"));
sOnline.addActionListener(this);
dialog.getPanel().add(sBankAccountLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 0, 2, 0), 0, 0));
dialog.getPanel().add(sBankAccountCombo, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0
@ -76,6 +80,7 @@ public class VPaymentFormCheck extends PaymentFormCheck implements ActionListene
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 5, 0), 0, 0));
dialog.getPanel().add(sAmountField, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 5, 5, 5), 0, 0));
sAmountField.addFocusListener(this);
dialog.getPanel().add(sRoutingLabel, new GridBagConstraints(0, 3, 1, 2, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 2, 0), 0, 0));
dialog.getPanel().add(sRoutingField, new GridBagConstraints(1, 3, 2, 1, 0.0, 0.0
@ -133,19 +138,63 @@ public class VPaymentFormCheck extends PaymentFormCheck implements ActionListene
// Set Selection
if (selectedBankAccount != null)
sBankAccountCombo.setSelectedItem(selectedBankAccount);
boolean exist = isBankAccountProcessorExist(m_C_Currency_ID, (BigDecimal) sAmountField.getValue());
sOnline.setVisible(exist);
if (exist)
updateOnlineButton();
}
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == sCurrencyCombo)
{
int C_Currency_ID = 0;
KeyNamePair pp = (KeyNamePair)sCurrencyCombo.getSelectedItem();
if (pp != null)
C_Currency_ID = pp.getKey();
BigDecimal amt = MConversionRate.convert(Env.getCtx(),
m_Amount, m_C_Currency_ID, pp.getKey(), m_AD_Client_ID, m_AD_Org_ID);
m_Amount, m_C_Currency_ID, C_Currency_ID, m_AD_Client_ID, m_AD_Org_ID);
sAmountField.setValue(amt);
updateOnlineButton();
}
else if (e.getSource() == sOnline)
processOnline();
}
@Override
public void focusGained(FocusEvent e) {
}
@Override
public void focusLost(FocusEvent e) {
if (e.getSource() == sAmountField)
updateOnlineButton();
}
private void updateOnlineButton()
{
int C_Currency_ID = 0;
KeyNamePair pp = (KeyNamePair)sCurrencyCombo.getSelectedItem();
if (pp != null)
C_Currency_ID = pp.getKey();
BigDecimal PayAmt = (BigDecimal) sAmountField.getValue();
if (C_Currency_ID > 0 && PayAmt != null)
{
MBankAccountProcessor bankAccountProcessor = getBankAccountProcessor(C_Currency_ID, PayAmt);
sOnline.setEnabled(bankAccountProcessor != null);
setBankAccountProcessor(bankAccountProcessor);
}
else
{
sOnline.setEnabled(false);
setBankAccountProcessor(null);
}
// else if (e.getSource() == sOnline)
// processOnline();
}
@Override
@ -203,7 +252,7 @@ public class VPaymentFormCheck extends PaymentFormCheck implements ActionListene
else if (processMsg != null)
ADialog.info(getWindowNo(), dialog, "PaymentCreated", m_mPayment.getDocumentNo());
return true;
return ok;
}
@Override

View File

@ -6,11 +6,15 @@ import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.math.BigDecimal;
import org.compiere.apps.ADialog;
import org.compiere.grid.ed.VNumber;
import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor;
import org.compiere.model.MPaymentProcessor;
import org.compiere.swing.CButton;
import org.compiere.swing.CComboBox;
import org.compiere.swing.CLabel;
@ -19,7 +23,7 @@ import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.ValueNamePair;
public class VPaymentFormCreditCard extends PaymentFormCreditCard implements ActionListener {
public class VPaymentFormCreditCard extends PaymentFormCreditCard implements ActionListener, FocusListener {
private VPaymentFormDialog dialog;
@ -65,6 +69,7 @@ public class VPaymentFormCreditCard extends PaymentFormCreditCard implements Act
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 2, 0), 0, 0));
dialog.getPanel().add(kTypeCombo, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
kTypeCombo.addActionListener(this);
dialog.getPanel().add(kNumberLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 2, 0), 0, 0));
dialog.getPanel().add(kNumberField, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0
@ -81,6 +86,7 @@ public class VPaymentFormCreditCard extends PaymentFormCreditCard implements Act
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 5, 0), 0, 0));
dialog.getPanel().add(kAmountField, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 5, 5, 5), 0, 0));
kAmountField.addFocusListener(this);
dialog.getPanel().add(kApprovalLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 0), 0, 0));
dialog.getPanel().add(kApprovalField, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0
@ -124,12 +130,66 @@ public class VPaymentFormCreditCard extends PaymentFormCreditCard implements Act
// Set Selection
if (selectedCreditCard != null)
kTypeCombo.setSelectedItem(selectedCreditCard);
if (m_mPayment.isApproved())
{
kOnline.setVisible(true);
kOnline.setEnabled(false);
MBankAccountProcessor bankAccountProcessor = new MBankAccountProcessor(m_mPayment.getCtx(), m_mPayment.getC_BankAccount_ID(), m_mPayment.getC_PaymentProcessor_ID(), null);
setBankAccountProcessor(bankAccountProcessor);
}
else
{
boolean exist = isBankAccountProcessorExist("", (BigDecimal) kAmountField.getValue());
kOnline.setVisible(exist);
if (exist)
updateOnlineButton();
}
}
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == kOnline)
processOnline();
else if (e.getSource() == kTypeCombo)
updateOnlineButton();
}
@Override
public void focusGained(FocusEvent e) {
}
@Override
public void focusLost(FocusEvent e) {
if (e.getSource() == kAmountField)
updateOnlineButton();
}
private void updateOnlineButton()
{
String CCType = null;
ValueNamePair vp = (ValueNamePair)kTypeCombo.getSelectedItem();
if (vp != null)
CCType = vp.getValue();
BigDecimal PayAmt = (BigDecimal) kAmountField.getValue();
if (CCType != null && PayAmt != null)
{
MBankAccountProcessor bankAccountProcessor = getBankAccountProcessor(CCType, PayAmt);
kOnline.setEnabled(bankAccountProcessor != null);
setBankAccountProcessor(bankAccountProcessor);
MPaymentProcessor paymentProcessor = new MPaymentProcessor(Env.getCtx(), bankAccountProcessor.getC_PaymentProcessor_ID(), null);
kApprovalField.setReadWrite(paymentProcessor.isRequireVV());
}
else
{
kOnline.setEnabled(false);
setBankAccountProcessor(null);
}
}
@Override
@ -150,7 +210,7 @@ public class VPaymentFormCreditCard extends PaymentFormCreditCard implements Act
else if (processMsg != null)
ADialog.info(getWindowNo(), dialog, "PaymentCreated", processMsg);
return true;
return ok;
}

View File

@ -0,0 +1,141 @@
package org.compiere.grid;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import org.adempiere.plaf.AdempierePLAF;
import org.compiere.apps.ADialog;
import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor;
import org.compiere.swing.CButton;
import org.compiere.swing.CComboBox;
import org.compiere.swing.CLabel;
import org.compiere.swing.CTextField;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
public abstract class VPaymentFormDirect extends PaymentFormDirect implements ActionListener {
private VPaymentFormDialog dialog;
private CLabel tAccountLabel = new CLabel();
private CComboBox tAccountCombo = new CComboBox();
private CButton tOnline = new CButton();
private CTextField tRoutingField = new CTextField();
private CTextField tNumberField = new CTextField();
private CLabel tStatus = new CLabel();
private CLabel tRoutingText = new CLabel();
private CLabel tNumberText = new CLabel();
public VPaymentFormDirect(int windowNo, GridTab mTab, boolean isDebit) {
super(windowNo, mTab, isDebit);
dialog = new VPaymentFormDialog(this, windowNo);
init();
}
public void init() {
GridBagLayout tPanelLayout = new GridBagLayout();
dialog.getPanel().setLayout(tPanelLayout);
tAccountLabel.setText(Msg.translate(Env.getCtx(), "C_BP_BankAccount_ID"));
tRoutingField.setColumns(8);
tNumberField.setColumns(10);
tRoutingText.setText(Msg.translate(Env.getCtx(), "RoutingNo"));
tNumberText.setText(Msg.translate(Env.getCtx(), "AccountNo"));
tOnline.setText(Msg.getMsg(Env.getCtx(), "Online"));
tOnline.addActionListener(this);
tStatus.setText(" ");
dialog.getPanel().add(tAccountLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 0), 0, 0));
dialog.getPanel().add(tAccountCombo, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
dialog.getPanel().add(tRoutingField, new GridBagConstraints(1, 1, 2, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0));
dialog.getPanel().add(tNumberField, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0));
dialog.getPanel().add(tStatus, new GridBagConstraints(0, 3, 2, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
dialog.getPanel().add(tRoutingText, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 0), 0, 0));
dialog.getPanel().add(tNumberText, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 0), 0, 0));
dialog.getPanel().add(tOnline, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
}
@Override
public void loadData() {
if (m_C_Payment_ID != 0)
{
tRoutingField.setText(m_mPayment.getRoutingNo());
tNumberField.setText(m_mPayment.getAccountNo());
tStatus.setText(m_mPayment.getR_PnRef());
}
ArrayList<KeyNamePair> list = getBPBankAccountList();
for (KeyNamePair pp : list)
tAccountCombo.addItem(pp);
boolean exist = isBankAccountProcessorExist();
tOnline.setVisible(exist);
MBankAccountProcessor bankAccountProcessor = getBankAccountProcessor();
setBankAccountProcessor(bankAccountProcessor);
}
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == tOnline)
processOnline();
}
@Override
public boolean checkMandatory() {
/***********************
* Mandatory Data Check
*/
boolean dataOK = true;
KeyNamePair bpba = (KeyNamePair)tAccountCombo.getSelectedItem();
if (bpba == null)
{
tAccountCombo.setBackground(AdempierePLAF.getFieldBackground_Error());
ADialog.error(getWindowNo(), dialog, "PaymentBPBankNotFound");
dataOK = false;
}
//
log.config("OK=" + dataOK);
return dataOK;
}
@Override
public boolean saveChangesInTrx(String trxName) {
boolean ok = save(0, tRoutingField.getText(), tNumberField.getText());
if (!ok)
ADialog.error(getWindowNo(), dialog, "PaymentError", processMsg);
else if (processMsg != null)
ADialog.info(getWindowNo(), dialog, "PaymentCreated", m_mPayment.getDocumentNo());
return ok;
}
@Override
public void showWindow()
{
dialog.setVisible(true);
}
@Override
public void closeWindow()
{
dialog.dispose();
}
@Override
public Object getWindow() {
return dialog;
}
}

View File

@ -2,10 +2,10 @@ package org.compiere.grid;
import org.compiere.model.GridTab;
public class VPaymentFormDirectDebit extends VPaymentFormDirectDeposit {
public class VPaymentFormDirectDebit extends VPaymentFormDirect {
public VPaymentFormDirectDebit(int WindowNo, GridTab mTab) {
super(WindowNo, mTab);
public VPaymentFormDirectDebit(int windowNo, GridTab mTab) {
super(windowNo, mTab, true);
}
}

View File

@ -1,125 +1,10 @@
package org.compiere.grid;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.util.ArrayList;
import org.adempiere.plaf.AdempierePLAF;
import org.compiere.apps.ADialog;
import org.compiere.model.GridTab;
import org.compiere.swing.CButton;
import org.compiere.swing.CComboBox;
import org.compiere.swing.CLabel;
import org.compiere.swing.CTextField;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
public class VPaymentFormDirectDeposit extends PaymentFormDirectDeposit {
public class VPaymentFormDirectDeposit extends VPaymentFormDirect {
private VPaymentFormDialog dialog;
private CLabel tAccountLabel = new CLabel();
private CComboBox tAccountCombo = new CComboBox();
private CButton tOnline = new CButton();
private CTextField tRoutingField = new CTextField();
private CTextField tNumberField = new CTextField();
private CLabel tStatus = new CLabel();
private CLabel tRoutingText = new CLabel();
private CLabel tNumberText = new CLabel();
public VPaymentFormDirectDeposit(int windowNo, GridTab mTab) {
super(windowNo, mTab);
dialog = new VPaymentFormDialog(this, windowNo);
init();
}
public void init() {
GridBagLayout tPanelLayout = new GridBagLayout();
dialog.getPanel().setLayout(tPanelLayout);
tAccountLabel.setText(Msg.translate(Env.getCtx(), "C_BP_BankAccount_ID"));
tRoutingField.setColumns(8);
tNumberField.setColumns(10);
tRoutingText.setText(Msg.translate(Env.getCtx(), "RoutingNo"));
tNumberText.setText(Msg.translate(Env.getCtx(), "AccountNo"));
tOnline.setText(Msg.getMsg(Env.getCtx(), "Online"));
tStatus.setText(" ");
dialog.getPanel().add(tAccountLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 0), 0, 0));
dialog.getPanel().add(tAccountCombo, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
dialog.getPanel().add(tRoutingField, new GridBagConstraints(1, 1, 2, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0));
dialog.getPanel().add(tNumberField, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0));
dialog.getPanel().add(tStatus, new GridBagConstraints(0, 3, 2, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
dialog.getPanel().add(tRoutingText, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 0), 0, 0));
dialog.getPanel().add(tNumberText, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 0), 0, 0));
dialog.getPanel().add(tOnline, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
}
@Override
public void loadData() {
if (m_C_Payment_ID != 0)
{
tRoutingField.setText(m_mPayment.getRoutingNo());
tNumberField.setText(m_mPayment.getAccountNo());
tStatus.setText(m_mPayment.getR_PnRef());
}
ArrayList<KeyNamePair> list = getBankAccountList();
for (KeyNamePair pp : list)
tAccountCombo.addItem(pp);
}
@Override
public boolean checkMandatory() {
/***********************
* Mandatory Data Check
*/
boolean dataOK = true;
KeyNamePair bpba = (KeyNamePair)tAccountCombo.getSelectedItem();
if (bpba == null)
{
tAccountCombo.setBackground(AdempierePLAF.getFieldBackground_Error());
ADialog.error(getWindowNo(), dialog, "PaymentBPBankNotFound");
dataOK = false;
}
//
log.config("OK=" + dataOK);
return dataOK;
}
@Override
public boolean saveChangesInTrx(String trxName) {
boolean ok = save();
if (!ok)
ADialog.error(getWindowNo(), dialog, "PaymentError", processMsg);
else if (processMsg != null)
ADialog.info(getWindowNo(), dialog, "PaymentCreated", m_mPayment.getDocumentNo());
return true;
}
@Override
public void showWindow()
{
dialog.setVisible(true);
}
@Override
public void closeWindow()
{
dialog.dispose();
}
@Override
public Object getWindow() {
return dialog;
super(windowNo, mTab, false);
}
}

View File

@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.logging.Level;
import org.compiere.model.GridTab;
import org.compiere.model.MInvoice;
import org.compiere.util.CLogger;
public class VPaymentFormFactory {
@ -27,13 +28,13 @@ public class VPaymentFormFactory {
{
// Register defaults:
s_registeredClasses = new HashMap<String, Class<? extends IPaymentForm>>();
s_registeredClasses.put(PaymentFormCash.PAYMENTRULE, VPaymentFormCash.class);
s_registeredClasses.put(PaymentFormCheck.PAYMENTRULE, VPaymentFormCheck.class);
s_registeredClasses.put(PaymentFormCreditCard.PAYMENTRULE, VPaymentFormCreditCard.class);
s_registeredClasses.put(PaymentFormDirectDebit.PAYMENTRULE, VPaymentFormDirectDebit.class);
s_registeredClasses.put(PaymentFormDirectDeposit.PAYMENTRULE, VPaymentFormDirectDeposit.class);
s_registeredClasses.put(PaymentFormMixedPOS.PAYMENTRULE, VPaymentFormMixedPOS.class);
s_registeredClasses.put(PaymentFormOnCredit.PAYMENTRULE, VPaymentFormOnCredit.class);
s_registeredClasses.put(MInvoice.PAYMENTRULE_Cash, VPaymentFormCash.class);
s_registeredClasses.put(MInvoice.PAYMENTRULE_Check, VPaymentFormCheck.class);
s_registeredClasses.put(MInvoice.PAYMENTRULE_CreditCard, VPaymentFormCreditCard.class);
s_registeredClasses.put(MInvoice.PAYMENTRULE_DirectDebit, VPaymentFormDirectDebit.class);
s_registeredClasses.put(MInvoice.PAYMENTRULE_DirectDeposit, VPaymentFormDirectDeposit.class);
s_registeredClasses.put(MInvoice.PAYMENTRULE_MixedPOSPayment, VPaymentFormMixedPOS.class);
s_registeredClasses.put(MInvoice.PAYMENTRULE_OnCredit, VPaymentFormOnCredit.class);
}
public static IPaymentForm create (int windowNo, GridTab mTab, String paymentRule)

View File

@ -224,7 +224,7 @@ public class WPaymentFormCash extends PaymentFormCash implements EventListener<E
else if (processMsg != null)
FDialog.info(getWindowNo(), window, "PaymentCreated", processMsg);
return true;
return ok;
}
@Override

View File

@ -14,6 +14,7 @@ import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListItem;
import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.ListboxFactory;
import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox;
@ -21,14 +22,17 @@ import org.adempiere.webui.editor.WNumberEditor;
import org.adempiere.webui.window.FDialog;
import org.compiere.grid.PaymentFormCheck;
import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor;
import org.compiere.model.MConversionRate;
import org.compiere.model.MPaymentValidate;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
import org.zkoss.zk.au.out.AuEcho;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zul.Cell;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Space;
public class WPaymentFormCheck extends PaymentFormCheck implements EventListener<Event> {
@ -39,6 +43,7 @@ public class WPaymentFormCheck extends PaymentFormCheck implements EventListener
private Listbox sBankAccountCombo = ListboxFactory.newDropdownListbox();
private Label sCurrencyLabel = new Label();
private Listbox sCurrencyCombo = ListboxFactory.newDropdownListbox();
private Space sCurrencySpace = new Space();
private Label sAmountLabel = new Label();
private WNumberEditor sAmountField = new WNumberEditor();
private Label sRoutingLabel = new Label();
@ -49,6 +54,7 @@ public class WPaymentFormCheck extends PaymentFormCheck implements EventListener
private Label sCheckLabel = new Label();
private Button sOnline = new Button();
private Label sStatus = new Label();
private Panel customizePanel = new Panel();
public WPaymentFormCheck(int windowNo, GridTab mTab) {
super(windowNo, mTab);
@ -71,7 +77,7 @@ public class WPaymentFormCheck extends PaymentFormCheck implements EventListener
sStatus.setText(" ");
sOnline.setLabel(Msg.getMsg(Env.getCtx(), "Online"));
LayoutUtils.addSclass("action-text-button", sOnline);
// sOnline.addActionListener(this);
sOnline.addActionListener(this);
window.getPanel().setId("sPanel");
Columns columns = new Columns();
@ -79,15 +85,11 @@ public class WPaymentFormCheck extends PaymentFormCheck implements EventListener
Column column = new Column();
columns.appendChild(column);
column.setWidth("30%");
column.setWidth("40%");
column = new Column();
columns.appendChild(column);
column.setWidth("50%");
column = new Column();
columns.appendChild(column);
column.setWidth("20%");
column.setWidth("60%");
sAmountField.getComponent().setWidth("150px");
@ -95,38 +97,37 @@ public class WPaymentFormCheck extends PaymentFormCheck implements EventListener
Row row = rows.newRow();
row.appendChild(sBankAccountLabel.rightAlign());
row.appendChild(sBankAccountCombo);
row.appendChild(new Space());
row = rows.newRow();
row.appendChild(sCurrencyLabel.rightAlign());
row.appendChild(sCurrencyCombo);
row.appendChild(new Space());
row = rows.newRow();
row.appendChild(sAmountLabel.rightAlign());
row.appendChild(sAmountField.getComponent());
row.appendChild(new Space());
sAmountField.getComponent().addEventListener(Events.ON_BLUR, this);
row = rows.newRow();
row.appendChild(sRoutingLabel.rightAlign());
row.appendChild(sRoutingField);
row.appendChild(new Space());
row = rows.newRow();
row.appendChild(sNumberLabel.rightAlign());
row.appendChild(sNumberField);
row.appendChild(new Space());
row = rows.newRow();
row.appendChild(sCheckLabel.rightAlign());
row.appendChild(sCheckField);
row = rows.newRow();
row.appendCellChild(customizePanel, 2);
row = rows.newRow();
row.appendChild(new Space());
row.appendChild(sOnline);
row = rows.newRow();
Cell cell = new Cell();
row.appendChild(cell);
cell.appendChild(sStatus);
cell.setColspan(3);
row.appendCellChild(sStatus, 2);
}
@Override
@ -159,6 +160,7 @@ public class WPaymentFormCheck extends PaymentFormCheck implements EventListener
{
sCurrencyLabel.setVisible(false); // Check
sCurrencyCombo.setVisible(false);
sCurrencySpace.setVisible(false);
}
ArrayList<KeyNamePair> list = getBankAccountList();
@ -168,21 +170,59 @@ public class WPaymentFormCheck extends PaymentFormCheck implements EventListener
// Set Selection
if (selectedBankAccount != null)
sBankAccountCombo.setSelectedKeyNamePair(selectedBankAccount);
boolean exist = isBankAccountProcessorExist(m_C_Currency_ID, (BigDecimal) sAmountField.getValue());
sOnline.setVisible(exist);
if (exist)
updateOnlineButton();
}
public void onEvent(Event e)
{
if (e.getTarget() == sCurrencyCombo)
if (e.getTarget() == sCurrencyCombo || e.getTarget() == sAmountField)
{
int C_Currency_ID = 0;
KeyNamePair pp = sCurrencyCombo.getSelectedItem().toKeyNamePair();
BigDecimal amt = MConversionRate.convert(Env.getCtx(),
m_Amount, m_C_Currency_ID, pp.getKey(), m_AD_Client_ID, m_AD_Org_ID);
sAmountField.setValue(amt);
if (pp != null)
C_Currency_ID = pp.getKey();
if (e.getTarget() == sCurrencyCombo)
{
BigDecimal amt = MConversionRate.convert(Env.getCtx(),
m_Amount, m_C_Currency_ID, C_Currency_ID, m_AD_Client_ID, m_AD_Org_ID);
sAmountField.setValue(amt);
}
updateOnlineButton();
}
else if (e.getTarget() == sOnline)
{
window.lockUI();
Clients.response(new AuEcho(window, "runProcessOnline", null));
}
}
private void updateOnlineButton()
{
int C_Currency_ID = 0;
KeyNamePair pp = sCurrencyCombo.getSelectedItem().toKeyNamePair();
if (pp != null)
C_Currency_ID = pp.getKey();
BigDecimal PayAmt = (BigDecimal) sAmountField.getValue();
if (C_Currency_ID > 0 && PayAmt != null)
{
MBankAccountProcessor bankAccountProcessor = getBankAccountProcessor(C_Currency_ID, PayAmt);
sOnline.setEnabled(bankAccountProcessor != null);
setBankAccountProcessor(bankAccountProcessor);
}
else
{
sOnline.setEnabled(false);
setBankAccountProcessor(null);
}
// else if (e.getTarget() == sOnline) {
// window.lockUI();
// Clients.response(new AuEcho(window, "runProcessOnline", null));
// }
}
@Override
@ -240,7 +280,7 @@ public class WPaymentFormCheck extends PaymentFormCheck implements EventListener
else if (processMsg != null)
FDialog.info(getWindowNo(), window, "PaymentCreated", m_mPayment.getDocumentNo());
return true;
return ok;
}
@Override
@ -257,4 +297,9 @@ public class WPaymentFormCheck extends PaymentFormCheck implements EventListener
public Object getWindow() {
return window;
}
@Override
public Object getCustomizePanel() {
return customizePanel;
}
}

View File

@ -12,6 +12,7 @@ import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListItem;
import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.ListboxFactory;
import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox;
@ -19,12 +20,15 @@ import org.adempiere.webui.editor.WNumberEditor;
import org.adempiere.webui.window.FDialog;
import org.compiere.grid.PaymentFormCreditCard;
import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor;
import org.compiere.model.MPaymentProcessor;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.ValueNamePair;
import org.zkoss.zk.au.out.AuEcho;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Space;
@ -44,6 +48,7 @@ public class WPaymentFormCreditCard extends PaymentFormCreditCard implements Eve
private Textbox kApprovalField = new Textbox();
private Button kOnline = new Button();
private Label kStatus = new Label();
private Panel customizePanel = new Panel();
public WPaymentFormCreditCard(int windowNo, GridTab mTab) {
super(windowNo, mTab);
@ -73,15 +78,11 @@ public class WPaymentFormCreditCard extends PaymentFormCreditCard implements Eve
Column column = new Column();
columns.appendChild(column);
column.setWidth("30%");
column.setWidth("40%");
column = new Column();
columns.appendChild(column);
column.setWidth("50%");
column = new Column();
columns.appendChild(column);
column.setWidth("20%");
column.setWidth("60%");
kAmountField.getComponent().setWidth("150px");
@ -89,30 +90,34 @@ public class WPaymentFormCreditCard extends PaymentFormCreditCard implements Eve
Row row = rows.newRow();
row.appendChild(kTypeLabel.rightAlign());
row.appendChild(kTypeCombo);
row.appendChild(new Space());
kTypeCombo.addEventListener(Events.ON_SELECT, this);
row = rows.newRow();
row.appendChild(kNumberLabel.rightAlign());
row.appendChild(kNumberField);
row.appendChild(new Space());
row = rows.newRow();
row.appendChild(kExpLabel.rightAlign());
row.appendChild(kExpField);
row.appendChild(new Space());
row = rows.newRow();
row.appendChild(kAmountLabel.rightAlign());
row.appendChild(kAmountField.getComponent());
row.appendChild(new Space());
kAmountField.getComponent().addEventListener(Events.ON_BLUR, this);
row = rows.newRow();
row.appendChild(kApprovalLabel.rightAlign());
row.appendChild(kApprovalField);
row = rows.newRow();
row.appendCellChild(customizePanel, 2);
row = rows.newRow();
row.appendChild(new Space());
row.appendChild(kOnline);
row = rows.newRow();
row.appendCellChild(kStatus, 3);
row.appendCellChild(kStatus, 2);
}
@Override
@ -146,6 +151,23 @@ public class WPaymentFormCreditCard extends PaymentFormCreditCard implements Eve
// Set Selection
if (selectedCreditCard != null)
kTypeCombo.setSelectedValueNamePair(selectedCreditCard);
if (m_mPayment.isApproved())
{
kOnline.setVisible(true);
kOnline.setEnabled(false);
MBankAccountProcessor bankAccountProcessor = new MBankAccountProcessor(m_mPayment.getCtx(), m_mPayment.getC_BankAccount_ID(), m_mPayment.getC_PaymentProcessor_ID(), null);
setBankAccountProcessor(bankAccountProcessor);
}
else
{
boolean exist = isBankAccountProcessorExist("", (BigDecimal) kAmountField.getValue());
kOnline.setVisible(exist);
if (exist)
updateOnlineButton();
}
}
public void onEvent(Event e)
@ -154,6 +176,34 @@ public class WPaymentFormCreditCard extends PaymentFormCreditCard implements Eve
window.lockUI();
Clients.response(new AuEcho(window, "runProcessOnline", null));
}
else if (e.getTarget() == kTypeCombo || e.getTarget() == kAmountField)
updateOnlineButton();
}
private void updateOnlineButton()
{
String CCType = null;
ListItem selected = kTypeCombo.getSelectedItem();
ValueNamePair vp = selected != null ? selected.toValueNamePair() : null;
if (vp != null)
CCType = vp.getValue();
BigDecimal PayAmt = (BigDecimal) kAmountField.getValue();
if (CCType != null && PayAmt != null)
{
MBankAccountProcessor bankAccountProcessor = getBankAccountProcessor(CCType, PayAmt);
kOnline.setEnabled(bankAccountProcessor != null);
setBankAccountProcessor(bankAccountProcessor);
MPaymentProcessor paymentProcessor = new MPaymentProcessor(Env.getCtx(), bankAccountProcessor.getC_PaymentProcessor_ID(), null);
kApprovalField.setReadonly(!paymentProcessor.isRequireVV());
}
else
{
kOnline.setEnabled(false);
setBankAccountProcessor(null);
}
}
@Override
@ -175,7 +225,7 @@ public class WPaymentFormCreditCard extends PaymentFormCreditCard implements Eve
else if (processMsg != null)
FDialog.info(getWindowNo(), window, "PaymentCreated", processMsg);
return true;
return ok;
}
@Override
@ -190,7 +240,7 @@ public class WPaymentFormCreditCard extends PaymentFormCreditCard implements Eve
boolean ok = processOnline(CCType, kNumberField.getText(), kExpField.getText());
if (!ok)
FDialog.error(getWindowNo(), window, "PaymentError", processMsg);
FDialog.error(getWindowNo(), window, "PaymentNotProcessed", processMsg);
else if (processMsg != null)
FDialog.info(getWindowNo(), window, "PaymentProcessed", processMsg);
} // online
@ -209,4 +259,9 @@ public class WPaymentFormCreditCard extends PaymentFormCreditCard implements Eve
public Object getWindow() {
return window;
}
@Override
public Object getCustomizePanel() {
return customizePanel;
}
}

View File

@ -0,0 +1,178 @@
package org.adempiere.webui.apps.form;
import java.util.ArrayList;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.Column;
import org.adempiere.webui.component.Columns;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridFactory;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListItem;
import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.ListboxFactory;
import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.window.FDialog;
import org.compiere.grid.PaymentFormDirect;
import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
import org.zkoss.zk.au.out.AuEcho;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Space;
public abstract class WPaymentFormDirect extends PaymentFormDirect implements EventListener<Event> {
private WPaymentFormWindow window;
private Label tAccountLabel = new Label();
private Listbox tAccountCombo = ListboxFactory.newDropdownListbox();
private Button tOnline = new Button();
private Textbox tRoutingField = new Textbox();
private Textbox tNumberField = new Textbox();
private Label tStatus = new Label();
private Label tRoutingText = new Label();
private Label tNumberText = new Label();
private Panel customizePanel = new Panel();
public WPaymentFormDirect(int windowNo, GridTab mTab, boolean isDebit) {
super(windowNo, mTab, isDebit);
window = new WPaymentFormWindow(this, windowNo);
init();
}
public void init() {
Grid tPanelLayout = GridFactory.newGridLayout();
window.getPanel().appendChild(tPanelLayout);
tAccountLabel.setText(Msg.translate(Env.getCtx(), "C_BP_BankAccount_ID"));
tRoutingField.setCols(8);
tNumberField.setCols(10);
tRoutingText.setText(Msg.translate(Env.getCtx(), "RoutingNo"));
tNumberText.setText(Msg.translate(Env.getCtx(), "AccountNo"));
tOnline.setLabel(Msg.getMsg(Env.getCtx(), "Online"));
LayoutUtils.addSclass("action-text-button", tOnline);
tOnline.addActionListener(this);
tStatus.setText(" ");
window.getPanel().setId("tPanel");
Columns columns = new Columns();
tPanelLayout.appendChild(columns);
Column column = new Column();
columns.appendChild(column);
column.setWidth("40%");
column = new Column();
columns.appendChild(column);
column.setWidth("60%");
Rows rows = tPanelLayout.newRows();
Row row = rows.newRow();
row.appendChild(tAccountLabel.rightAlign());
row.appendChild(tAccountCombo);
row = rows.newRow();
row.appendChild(tRoutingText.rightAlign());
row.appendChild(tRoutingField);
row = rows.newRow();
row.appendChild(tNumberText.rightAlign());
row.appendChild(tNumberField);
row = rows.newRow();
row.appendCellChild(customizePanel, 2);
row = rows.newRow();
row.appendChild(new Space());
row.appendChild(tOnline);
row = rows.newRow();
row.appendCellChild(tStatus, 2);
}
@Override
public void loadData() {
if (m_C_Payment_ID != 0)
{
tRoutingField.setText(m_mPayment.getRoutingNo());
tNumberField.setText(m_mPayment.getAccountNo());
tStatus.setText(m_mPayment.getR_PnRef());
}
ArrayList<KeyNamePair> list = getBPBankAccountList();
for (KeyNamePair pp : list)
tAccountCombo.addItem(pp);
boolean exist = isBankAccountProcessorExist();
tOnline.setVisible(exist);
MBankAccountProcessor bankAccountProcessor = getBankAccountProcessor();
setBankAccountProcessor(bankAccountProcessor);
}
public void onEvent(Event e)
{
if (e.getTarget() == tOnline)
{
window.lockUI();
Clients.response(new AuEcho(window, "runProcessOnline", null));
}
}
@Override
public boolean checkMandatory() {
/***********************
* Mandatory Data Check
*/
boolean dataOK = true;
ListItem selected = tAccountCombo.getSelectedItem();
KeyNamePair bpba = selected != null ? selected.toKeyNamePair() : null;
if (bpba == null)
{
FDialog.error(getWindowNo(), window, "PaymentBPBankNotFound");
dataOK = false;
}
//
log.config("OK=" + dataOK);
return dataOK;
}
@Override
public boolean saveChangesInTrx(final String trxName) {
boolean ok = save(0, tRoutingField.getText(), tNumberField.getText());
if (!ok)
FDialog.error(getWindowNo(), window, "PaymentError", processMsg);
else if (processMsg != null)
FDialog.info(getWindowNo(), window, "PaymentCreated", m_mPayment.getDocumentNo());
return ok;
}
@Override
public void showWindow() {
window.setVisible(true);
}
@Override
public void closeWindow() {
window.dispose();
}
@Override
public Object getWindow() {
return window;
}
@Override
public Object getCustomizePanel() {
return customizePanel;
}
}

View File

@ -2,9 +2,9 @@ package org.adempiere.webui.apps.form;
import org.compiere.model.GridTab;
public class WPaymentFormDirectDebit extends WPaymentFormDirectDeposit {
public class WPaymentFormDirectDebit extends WPaymentFormDirect {
public WPaymentFormDirectDebit(int windowNo, GridTab mTab) {
super(windowNo, mTab);
super(windowNo, mTab, true);
}
}

View File

@ -1,150 +1,10 @@
package org.adempiere.webui.apps.form;
import java.util.ArrayList;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.Column;
import org.adempiere.webui.component.Columns;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridFactory;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListItem;
import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.ListboxFactory;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.window.FDialog;
import org.compiere.grid.PaymentFormDirectDeposit;
import org.compiere.model.GridTab;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
import org.zkoss.zul.Space;
public class WPaymentFormDirectDeposit extends PaymentFormDirectDeposit {
private WPaymentFormWindow window;
private Label tAccountLabel = new Label();
private Listbox tAccountCombo = ListboxFactory.newDropdownListbox();
private Button tOnline = new Button();
private Textbox tRoutingField = new Textbox();
private Textbox tNumberField = new Textbox();
private Label tStatus = new Label();
private Label tRoutingText = new Label();
private Label tNumberText = new Label();
public class WPaymentFormDirectDeposit extends WPaymentFormDirect {
public WPaymentFormDirectDeposit(int windowNo, GridTab mTab) {
super(windowNo, mTab);
window = new WPaymentFormWindow(this, windowNo);
init();
}
public void init() {
Grid tPanelLayout = GridFactory.newGridLayout();
window.getPanel().appendChild(tPanelLayout);
tAccountLabel.setText(Msg.translate(Env.getCtx(), "C_BP_BankAccount_ID"));
tRoutingField.setCols(8);
tNumberField.setCols(10);
tRoutingText.setText(Msg.translate(Env.getCtx(), "RoutingNo"));
tNumberText.setText(Msg.translate(Env.getCtx(), "AccountNo"));
tOnline.setLabel(Msg.getMsg(Env.getCtx(), "Online"));
LayoutUtils.addSclass("action-text-button", tOnline);
tStatus.setText(" ");
window.getPanel().setId("tPanel");
Columns columns = new Columns();
tPanelLayout.appendChild(columns);
Column column = new Column();
columns.appendChild(column);
column.setWidth("30%");
column = new Column();
columns.appendChild(column);
column.setWidth("50%");
column = new Column();
columns.appendChild(column);
column.setWidth("20%");
Rows rows = tPanelLayout.newRows();
Row row = rows.newRow();
row.appendChild(tAccountLabel.rightAlign());
row.appendChild(tAccountCombo);
row.appendChild(new Space());
row = rows.newRow();
row.appendChild(tRoutingText.rightAlign());
row.appendChild(tRoutingField);
row.appendChild(new Space());
row = rows.newRow();
row.appendChild(tNumberText.rightAlign());
row.appendChild(tNumberField);
row.appendChild(tOnline);
row = rows.newRow();
row.appendCellChild(tStatus, 3);
}
@Override
public void loadData() {
if (m_C_Payment_ID != 0)
{
tRoutingField.setText(m_mPayment.getRoutingNo());
tNumberField.setText(m_mPayment.getAccountNo());
tStatus.setText(m_mPayment.getR_PnRef());
}
ArrayList<KeyNamePair> list = getBankAccountList();
for (KeyNamePair pp : list)
tAccountCombo.addItem(pp);
}
@Override
public boolean checkMandatory() {
/***********************
* Mandatory Data Check
*/
boolean dataOK = true;
ListItem selected = tAccountCombo.getSelectedItem();
KeyNamePair bpba = selected != null ? selected.toKeyNamePair() : null;
if (bpba == null)
{
FDialog.error(getWindowNo(), window, "PaymentBPBankNotFound");
dataOK = false;
}
//
log.config("OK=" + dataOK);
return dataOK;
}
@Override
public boolean saveChangesInTrx(final String trxName) {
boolean ok = save();
if (!ok)
FDialog.error(getWindowNo(), window, "PaymentError", processMsg);
else if (processMsg != null)
FDialog.info(getWindowNo(), window, "PaymentCreated", m_mPayment.getDocumentNo());
return true;
}
@Override
public void showWindow() {
window.setVisible(true);
}
@Override
public void closeWindow() {
window.dispose();
}
@Override
public Object getWindow() {
return window;
super(windowNo, mTab, false);
}
}

View File

@ -4,14 +4,8 @@ import java.util.HashMap;
import java.util.logging.Level;
import org.compiere.grid.IPaymentForm;
import org.compiere.grid.PaymentFormCash;
import org.compiere.grid.PaymentFormCheck;
import org.compiere.grid.PaymentFormCreditCard;
import org.compiere.grid.PaymentFormDirectDebit;
import org.compiere.grid.PaymentFormDirectDeposit;
import org.compiere.grid.PaymentFormMixedPOS;
import org.compiere.grid.PaymentFormOnCredit;
import org.compiere.model.GridTab;
import org.compiere.model.MInvoice;
import org.compiere.util.CLogger;
public class WPaymentFormFactory {
@ -36,13 +30,13 @@ public class WPaymentFormFactory {
{
// Register defaults:
s_registeredClasses = new HashMap<String, Class<? extends IPaymentForm>>();
s_registeredClasses.put(PaymentFormCash.PAYMENTRULE, WPaymentFormCash.class);
s_registeredClasses.put(PaymentFormCheck.PAYMENTRULE, WPaymentFormCheck.class);
s_registeredClasses.put(PaymentFormCreditCard.PAYMENTRULE, WPaymentFormCreditCard.class);
s_registeredClasses.put(PaymentFormDirectDebit.PAYMENTRULE, WPaymentFormDirectDebit.class);
s_registeredClasses.put(PaymentFormDirectDeposit.PAYMENTRULE, WPaymentFormDirectDeposit.class);
s_registeredClasses.put(PaymentFormMixedPOS.PAYMENTRULE, WPaymentFormMixedPOS.class);
s_registeredClasses.put(PaymentFormOnCredit.PAYMENTRULE, WPaymentFormOnCredit.class);
s_registeredClasses.put(MInvoice.PAYMENTRULE_Cash, WPaymentFormCash.class);
s_registeredClasses.put(MInvoice.PAYMENTRULE_Check, WPaymentFormCheck.class);
s_registeredClasses.put(MInvoice.PAYMENTRULE_CreditCard, WPaymentFormCreditCard.class);
s_registeredClasses.put(MInvoice.PAYMENTRULE_DirectDebit, WPaymentFormDirectDebit.class);
s_registeredClasses.put(MInvoice.PAYMENTRULE_DirectDeposit, WPaymentFormDirectDeposit.class);
s_registeredClasses.put(MInvoice.PAYMENTRULE_MixedPOSPayment, WPaymentFormMixedPOS.class);
s_registeredClasses.put(MInvoice.PAYMENTRULE_OnCredit, WPaymentFormOnCredit.class);
}
public static IPaymentForm create(int windowNo, GridTab mTab, String paymentRule)

View File

@ -59,6 +59,9 @@ public class WPaymentFormWindow extends Window implements EventListener<Event>,
Center center = new Center();
mainLayout.appendChild(center);
center.appendChild(centerPanel = getPanel());
centerPanel.setHflex("1");
centerPanel.setVflex("1");
center.setAutoscroll(true);
//
South south = new South();
south.setStyle("border: none");

View File

@ -803,12 +803,12 @@ div.simileAjax-bubble-container {
background-color: transparent !important;
}
.grid-layout .z-row-inner {
.grid-layout .z-row-inner, .grid-layout .z-cell {
border: none !important;
background-color: transparent !important;
}
.grid-layout tr.z-row-over>td.z-row-inner {
.grid-layout tr.z-row-over>td.z-row-inner, .grid-layout tr.z-row-over>.z-cell {
border: none !important;
}

View File

@ -1,5 +1,7 @@
package org.compiere.grid;
import org.compiere.model.MBankAccountProcessor;
public interface IPaymentForm {
public boolean checkMandatory();
@ -13,4 +15,10 @@ public interface IPaymentForm {
public void closeWindow();
public Object getWindow();
public Object getCustomizePanel();
public void setCustomizeValues();
public void setBankAccountProcessor(MBankAccountProcessor bankAccountProcessor);
}

View File

@ -6,17 +6,21 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Hashtable;
import java.util.Properties;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor;
import org.compiere.model.MCashLine;
import org.compiere.model.MPayment;
import org.compiere.model.MPaymentProcessor;
import org.compiere.model.MSysConfig;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
import org.compiere.util.Trx;
import org.compiere.util.TrxRunnable;
@ -198,6 +202,9 @@ public abstract class PaymentForm implements IPaymentForm {
};
try {
Trx.run(r);
} catch (AdempiereException ae) {
success[0] = false;
throw ae;
} catch (Throwable e) {
success[0] = false;
throw new AdempiereException("PaymentError", e);
@ -277,7 +284,43 @@ public abstract class PaymentForm implements IPaymentForm {
public void processOnline()
{
throw new AdempiereException(Msg.getMsg(Env.getCtx(), "ActionNotSupported"));
}
public boolean isBankAccountProcessorExist(Properties ctx, String tender, String CCType, int AD_Client_ID, int C_Currency_ID, BigDecimal PayAmt, String trxName)
{
MBankAccountProcessor[] m_mBankAccountProcessors = MPaymentProcessor.find(ctx, tender, CCType, AD_Client_ID, C_Currency_ID, PayAmt, trxName);
// Relax Amount
if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0)
m_mBankAccountProcessors = MPaymentProcessor.find(ctx, tender, CCType, AD_Client_ID, C_Currency_ID, Env.ZERO, trxName);
if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0)
return false;
return true;
}
public MBankAccountProcessor getBankAccountProcessor(Properties ctx, String tender, String CCType, int AD_Client_ID, int C_Currency_ID, BigDecimal PayAmt, String trxName)
{
MBankAccountProcessor[] m_mBankAccountProcessors = MPaymentProcessor.find(ctx, tender, CCType, AD_Client_ID, C_Currency_ID, PayAmt, trxName);
// Relax Amount
if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0)
m_mBankAccountProcessors = MPaymentProcessor.find(ctx, tender, CCType, AD_Client_ID, C_Currency_ID, Env.ZERO, trxName);
if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0)
return null;
MBankAccountProcessor m_mBankAccountProcessor = null;
// Find the first right one
for (int i = 0; i < m_mBankAccountProcessors.length; i++)
{
MBankAccountProcessor bankAccountProcessor = m_mBankAccountProcessors[i];
MPaymentProcessor paymentProcessor = new MPaymentProcessor(bankAccountProcessor.getCtx(), bankAccountProcessor.getC_PaymentProcessor_ID(), bankAccountProcessor.get_TrxName());
if (paymentProcessor.accepts (tender, CCType))
{
m_mBankAccountProcessor = m_mBankAccountProcessors[i];
break;
}
}
//
return m_mBankAccountProcessor;
}
public GridTab getGridTab()
@ -299,4 +342,19 @@ public abstract class PaymentForm implements IPaymentForm {
{
return m_WindowNo;
}
public Object getCustomizePanel()
{
return null;
}
public void setCustomizeValues()
{
}
public void setBankAccountProcessor(MBankAccountProcessor bankAccountProcessor)
{
}
}

View File

@ -8,6 +8,7 @@ import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.GridTab;
import org.compiere.model.MCash;
import org.compiere.model.MCashLine;
@ -20,10 +21,11 @@ import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
import org.compiere.util.TimeUtil;
public abstract class PaymentFormCash extends PaymentForm {
public static final String PAYMENTRULE = MInvoice.PAYMENTRULE_Cash;
private final String PAYMENTRULE = MInvoice.PAYMENTRULE_Cash;
public PaymentFormCash(int WindowNo, GridTab mTab) {
super(WindowNo, mTab);
@ -116,7 +118,6 @@ public abstract class PaymentFormCash extends PaymentForm {
public boolean save(int newC_BankAccount_ID, int newC_CashBook_ID, Timestamp newDateAcct, BigDecimal newAmount, String trxName)
{
processMsg = null;
boolean error = false;
int newC_CashLine_ID = m_C_CashLine_ID;
/***********************
@ -134,8 +135,8 @@ public abstract class PaymentFormCash extends PaymentForm {
log.config( "CashCancelled");
else
{
processMsg = "CashNotCancelled";
error = true;
processMsg = Msg.getMsg(Env.getCtx(), "CashNotCancelled");
throw new AdempiereException(processMsg);
}
}
newC_CashLine_ID = 0; // reset
@ -177,8 +178,8 @@ public abstract class PaymentFormCash extends PaymentForm {
if (C_Invoice_ID == 0 && order == null)
{
log.config("No Invoice!");
processMsg = "CashNotCreated";
error = false;
processMsg = Msg.getMsg(Env.getCtx(), "CashNotCreated");
throw new AdempiereException(processMsg);
}
else
{
@ -219,7 +220,7 @@ public abstract class PaymentFormCash extends PaymentForm {
if (cash == null || cash.get_ID() == 0)
{
processMsg = CLogger.retrieveErrorString("CashNotCreated");
error = true;
throw new AdempiereException(processMsg);
}
else
{
@ -290,8 +291,8 @@ public abstract class PaymentFormCash extends PaymentForm {
processMsg = m_mPayment.getDocumentNo();
else
{
processMsg = "PaymentNotCreated";
error = true;
processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCreated");
throw new AdempiereException(processMsg);
}
}
else
@ -321,6 +322,6 @@ public abstract class PaymentFormCash extends PaymentForm {
else
getGridTab().setValue("C_CashLine_ID", new Integer(newC_CashLine_ID));
}
return !error;
return true;
}
}

View File

@ -7,7 +7,9 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor;
import org.compiere.model.MInvoice;
import org.compiere.model.MOrder;
import org.compiere.model.MPayment;
@ -16,9 +18,10 @@ import org.compiere.process.DocAction;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
public abstract class PaymentFormCheck extends PaymentForm {
public static final String PAYMENTRULE = MInvoice.PAYMENTRULE_Check;
private final String PAYMENTRULE = MInvoice.PAYMENTRULE_Check;
public PaymentFormCheck(int WindowNo, GridTab mTab) {
super(WindowNo, mTab);
@ -68,7 +71,6 @@ public abstract class PaymentFormCheck extends PaymentForm {
public boolean save(int newC_BankAccount_ID, String routing, String number, String check, BigDecimal amount)
{
processMsg = null;
boolean error = false;
String payTypes = m_Cash_As_Payment ? "KTSDB" : "KTSD";
/***********************
@ -85,11 +87,11 @@ public abstract class PaymentFormCheck extends PaymentForm {
boolean ok = m_mPaymentOriginal.processIt(DocAction.ACTION_Reverse_Correct);
m_mPaymentOriginal.saveEx();
if (ok)
log.info( "Payment Canecelled - " + m_mPaymentOriginal);
log.info( "Payment Cancelled - " + m_mPaymentOriginal);
else
{
processMsg = "PaymentNotCancelled " + m_mPaymentOriginal.getDocumentNo();
error = true;
processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCancelled") + " " + m_mPaymentOriginal.getDocumentNo();
throw new AdempiereException(processMsg);
}
m_mPayment.resetNew();
}
@ -111,8 +113,8 @@ public abstract class PaymentFormCheck extends PaymentForm {
}
else
{
processMsg = "PaymentNotCancelled " + m_mPayment.getDocumentNo();
error = true;
processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCancelled") + " " + m_mPayment.getDocumentNo();
throw new AdempiereException(processMsg);
}
}
}
@ -163,6 +165,7 @@ public abstract class PaymentFormCheck extends PaymentForm {
}
m_mPayment.setDateTrx(m_DateAcct);
m_mPayment.setDateAcct(m_DateAcct);
setCustomizeValues();
m_mPayment.saveEx();
// Save/Post
@ -174,8 +177,8 @@ public abstract class PaymentFormCheck extends PaymentForm {
processMsg = m_mPayment.getDocumentNo();
else
{
processMsg = "PaymentNotCreated";
error = true;
processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCreated");
throw new AdempiereException(processMsg);
}
}
else
@ -193,6 +196,16 @@ public abstract class PaymentFormCheck extends PaymentForm {
else
getGridTab().setValue("C_Payment_ID", new Integer(m_mPayment.getC_Payment_ID()));
}
return !error;
return true;
}
public boolean isBankAccountProcessorExist(int C_Currency_ID, BigDecimal PayAmt)
{
return isBankAccountProcessorExist(Env.getCtx(), MPayment.TENDERTYPE_Check, "", Env.getAD_Client_ID(Env.getCtx()), C_Currency_ID, PayAmt, null);
}
public MBankAccountProcessor getBankAccountProcessor(int C_Currency_ID, BigDecimal PayAmt)
{
return getBankAccountProcessor(Env.getCtx(), MPayment.TENDERTYPE_Check, "", Env.getAD_Client_ID(Env.getCtx()), C_Currency_ID, PayAmt, null);
}
}

View File

@ -2,17 +2,20 @@ package org.compiere.grid;
import java.math.BigDecimal;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor;
import org.compiere.model.MInvoice;
import org.compiere.model.MOrder;
import org.compiere.model.MPayment;
import org.compiere.process.DocAction;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.ValueNamePair;
public abstract class PaymentFormCreditCard extends PaymentForm {
public static final String PAYMENTRULE = MInvoice.PAYMENTRULE_CreditCard;
private final String PAYMENTRULE = MInvoice.PAYMENTRULE_CreditCard;
public PaymentFormCreditCard(int WindowNo, GridTab mTab) {
super(WindowNo, mTab);
}
@ -34,7 +37,6 @@ public abstract class PaymentFormCreditCard extends PaymentForm {
public boolean save(String newCCType, String newCCNumber, String newCCExp, BigDecimal newAmount)
{
processMsg = null;
boolean error = false;
String payTypes = m_Cash_As_Payment ? "KTSDB" : "KTSD";
/***********************
@ -51,11 +53,11 @@ public abstract class PaymentFormCreditCard extends PaymentForm {
boolean ok = m_mPaymentOriginal.processIt(DocAction.ACTION_Reverse_Correct);
m_mPaymentOriginal.saveEx();
if (ok)
log.info( "Payment Canecelled - " + m_mPaymentOriginal);
log.info( "Payment Cancelled - " + m_mPaymentOriginal);
else
{
processMsg = "PaymentNotCancelled " + m_mPaymentOriginal.getDocumentNo();
error = true;
processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCancelled") + " " + m_mPaymentOriginal.getDocumentNo();
throw new AdempiereException(processMsg);
}
m_mPayment.resetNew();
}
@ -77,8 +79,8 @@ public abstract class PaymentFormCreditCard extends PaymentForm {
}
else
{
processMsg = "PaymentNotCancelled " + m_mPayment.getDocumentNo();
error = true;
processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCancelled") + " " + m_mPayment.getDocumentNo();
throw new AdempiereException(processMsg);
}
}
}
@ -130,6 +132,14 @@ public abstract class PaymentFormCreditCard extends PaymentForm {
}
m_mPayment.setDateTrx(m_DateAcct);
m_mPayment.setDateAcct(m_DateAcct);
setCustomizeValues();
if (!m_mPayment.isApproved())
{
processMsg = Msg.getMsg(Env.getCtx(), "CardNotProcessed");
throw new AdempiereException(processMsg);
}
m_mPayment.saveEx();
// Save/Post
@ -141,8 +151,8 @@ public abstract class PaymentFormCreditCard extends PaymentForm {
processMsg = m_mPayment.getDocumentNo();
else
{
processMsg = "PaymentNotCreated";
error = true;
processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCreated");
throw new AdempiereException(processMsg);
}
}
else
@ -161,7 +171,7 @@ public abstract class PaymentFormCreditCard extends PaymentForm {
getGridTab().setValue("C_Payment_ID", new Integer(m_mPayment.getC_Payment_ID()));
}
return !error;
return true;
}
public boolean processOnline(String CCType, String CCNumber, String CCExp)
@ -188,8 +198,9 @@ public abstract class PaymentFormCreditCard extends PaymentForm {
m_mPayment.setDateTrx(m_DateAcct);
// Set Amount
m_mPayment.setAmount(m_C_Currency_ID, m_Amount);
setCustomizeValues();
if (!m_mPayment.save()) {
processMsg = "PaymentNotCreated";
processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCreated");
return false;
} else {
approved = m_mPayment.processOnline();
@ -205,7 +216,7 @@ public abstract class PaymentFormCreditCard extends PaymentForm {
processMsg = info + "\n" + m_mPayment.getDocumentNo();
else
{
processMsg = "PaymentNotCreated";
processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCreated");
error = true;
}
saveChanges();
@ -218,4 +229,14 @@ public abstract class PaymentFormCreditCard extends PaymentForm {
}
return !error;
}
public boolean isBankAccountProcessorExist(String CCType, BigDecimal PayAmt)
{
return isBankAccountProcessorExist(Env.getCtx(), MPayment.TENDERTYPE_CreditCard, CCType, Env.getAD_Client_ID(Env.getCtx()), m_C_Currency_ID, PayAmt, null);
}
public MBankAccountProcessor getBankAccountProcessor(String CCType, BigDecimal PayAmt)
{
return getBankAccountProcessor(Env.getCtx(), MPayment.TENDERTYPE_CreditCard, CCType, Env.getAD_Client_ID(Env.getCtx()), m_C_Currency_ID, PayAmt, null);
}
}

View File

@ -0,0 +1,204 @@
package org.compiere.grid;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor;
import org.compiere.model.MInvoice;
import org.compiere.model.MOrder;
import org.compiere.model.MPayment;
import org.compiere.process.DocAction;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
public abstract class PaymentFormDirect extends PaymentForm {
private String PAYMENTRULE;
public PaymentFormDirect(int WindowNo, GridTab mTab, boolean isDebit) {
super(WindowNo, mTab);
PAYMENTRULE = isDebit ? MInvoice.PAYMENTRULE_DirectDebit : MInvoice.PAYMENTRULE_DirectDeposit;
}
public ArrayList<KeyNamePair> getBPBankAccountList() {
ArrayList<KeyNamePair> list = new ArrayList<KeyNamePair>();
/**
* Load Accounts
*/
String SQL = "SELECT a.C_BP_BankAccount_ID, NVL(b.Name, ' ')||'_'||NVL(a.AccountNo, ' ') AS Acct "
+ "FROM C_BP_BankAccount a"
+ " LEFT OUTER JOIN C_Bank b ON (a.C_Bank_ID=b.C_Bank_ID) "
+ "WHERE C_BPartner_ID=?"
+ "AND a.IsActive='Y' AND a.IsACH='Y'";
try
{
PreparedStatement pstmt = DB.prepareStatement(SQL, null);
pstmt.setInt(1, m_C_BPartner_ID);
ResultSet rs = pstmt.executeQuery();
while (rs.next())
{
int key = rs.getInt(1);
String name = rs.getString(2);
KeyNamePair pp = new KeyNamePair(key, name);
list.add(pp);
}
rs.close();
pstmt.close();
}
catch (SQLException eac)
{
log.log(Level.SEVERE, SQL, eac);
}
return list;
}
public String processMsg;
public boolean save(int newC_BankAccount_ID, String routing, String number)
{
processMsg = null;
String payTypes = m_Cash_As_Payment ? "KTSDB" : "KTSD";
/***********************
* Changed PaymentRule
*/
if (!PAYMENTRULE.equals(m_PaymentRule))
{
log.fine("Changed PaymentRule: " + m_PaymentRule + " -> " + PAYMENTRULE);
// We had a change in Payment type (e.g. Check to CC)
if (payTypes.indexOf(m_PaymentRule) != -1 && payTypes.indexOf(PAYMENTRULE) != -1 && m_mPaymentOriginal != null)
{
log.fine("Old Payment(1) - " + m_mPaymentOriginal);
m_mPaymentOriginal.setDocAction(DocAction.ACTION_Reverse_Correct);
boolean ok = m_mPaymentOriginal.processIt(DocAction.ACTION_Reverse_Correct);
m_mPaymentOriginal.saveEx();
if (ok)
log.info( "Payment Cancelled - " + m_mPaymentOriginal);
else
{
processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCancelled") + " " + m_mPaymentOriginal.getDocumentNo();
throw new AdempiereException(processMsg);
}
m_mPayment.resetNew();
}
// We had a Payment and something else (e.g. Check to Cash)
else if (payTypes.indexOf(m_PaymentRule) != -1 && payTypes.indexOf(PAYMENTRULE) == -1)
{
log.fine("Old Payment(2) - " + m_mPaymentOriginal);
if (m_mPaymentOriginal != null)
{
m_mPaymentOriginal.setDocAction(DocAction.ACTION_Reverse_Correct);
boolean ok = m_mPaymentOriginal.processIt(DocAction.ACTION_Reverse_Correct);
m_mPaymentOriginal.saveEx();
if (ok) // Cancel Payment
{
log.fine("PaymentCancelled " + m_mPayment.getDocumentNo ());
getGridTab().getTableModel().dataSave(true);
m_mPayment.resetNew();
m_mPayment.setAmount(m_C_Currency_ID, m_Amount);
}
else
{
processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCancelled") + " " + m_mPayment.getDocumentNo();
throw new AdempiereException(processMsg);
}
}
}
}
// Get Order and optionally Invoice
int C_Order_ID = Env.getContextAsInt(Env.getCtx(), getWindowNo(), "C_Order_ID");
int C_Invoice_ID = Env.getContextAsInt(Env.getCtx(), getWindowNo(), "C_Invoice_ID");
if (C_Invoice_ID == 0 && m_DocStatus.equals("CO"))
C_Invoice_ID = getInvoiceID (C_Order_ID);
// Amount sign negative, if ARC (Credit Memo) or API (AP Invoice)
boolean negateAmt = false;
MInvoice invoice = null;
if (C_Invoice_ID != 0)
{
invoice = new MInvoice (Env.getCtx(), C_Invoice_ID, null);
negateAmt = invoice.isCreditMemo();
}
MOrder order = null;
if (invoice == null && C_Order_ID != 0)
order = new MOrder (Env.getCtx(), C_Order_ID, null);
BigDecimal payAmount = m_Amount;
if (negateAmt)
payAmount = m_Amount.negate();
// Info
log.config("C_Order_ID=" + C_Order_ID + ", C_Invoice_ID=" + C_Invoice_ID + ", NegateAmt=" + negateAmt);
/***********************
* Payments
*/
m_mPayment.setBankACH(newC_BankAccount_ID, m_isSOTrx, PAYMENTRULE, routing, number);
m_mPayment.setAmount(m_C_Currency_ID, payAmount);
m_mPayment.setC_BPartner_ID(m_C_BPartner_ID);
m_mPayment.setC_Invoice_ID(C_Invoice_ID);
if (order != null)
{
m_mPayment.setC_Order_ID(C_Order_ID);
m_needSave = true;
}
m_mPayment.setDateTrx(m_DateAcct);
m_mPayment.setDateAcct(m_DateAcct);
setCustomizeValues();
m_mPayment.saveEx();
// Save/Post
if (m_mPayment.get_ID() > 0 && MPayment.DOCSTATUS_Drafted.equals(m_mPayment.getDocStatus()))
{
boolean ok = m_mPayment.processIt(DocAction.ACTION_Complete);
m_mPayment.saveEx();
if (ok)
processMsg = m_mPayment.getDocumentNo();
else
{
processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCreated");
throw new AdempiereException(processMsg);
}
}
else
log.fine("NotDraft " + m_mPayment);
/**********************
* Save Values to mTab
*/
log.config("Saving changes");
// Set Payment
if (m_mPayment.getC_Payment_ID() != m_C_Payment_ID)
{
if (m_mPayment.getC_Payment_ID() == 0)
getGridTab().setValue("C_Payment_ID", null);
else
getGridTab().setValue("C_Payment_ID", new Integer(m_mPayment.getC_Payment_ID()));
}
return true;
}
public boolean isBankAccountProcessorExist()
{
String tender = PAYMENTRULE.equals(MInvoice.PAYMENTRULE_DirectDebit) ? MPayment.TENDERTYPE_DirectDebit : MPayment.TENDERTYPE_DirectDeposit;
return isBankAccountProcessorExist(Env.getCtx(), tender, "", Env.getAD_Client_ID(Env.getCtx()), m_C_Currency_ID, m_Amount, null);
}
public MBankAccountProcessor getBankAccountProcessor()
{
String tender = PAYMENTRULE.equals(MInvoice.PAYMENTRULE_DirectDebit) ? MPayment.TENDERTYPE_DirectDebit : MPayment.TENDERTYPE_DirectDeposit;
return getBankAccountProcessor(Env.getCtx(), tender, "", Env.getAD_Client_ID(Env.getCtx()), m_C_Currency_ID, m_Amount, null);
}
}

View File

@ -1,12 +0,0 @@
package org.compiere.grid;
import org.compiere.model.GridTab;
import org.compiere.model.MInvoice;
public abstract class PaymentFormDirectDebit extends PaymentFormDirectDeposit {
public static final String PAYMENTRULE = MInvoice.PAYMENTRULE_DirectDebit;
public PaymentFormDirectDebit(int WindowNo, GridTab mTab) {
super(WindowNo, mTab);
}
}

View File

@ -1,125 +0,0 @@
package org.compiere.grid;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import org.compiere.model.GridTab;
import org.compiere.model.MInvoice;
import org.compiere.process.DocAction;
import org.compiere.util.DB;
import org.compiere.util.KeyNamePair;
public abstract class PaymentFormDirectDeposit extends PaymentForm {
public static final String PAYMENTRULE = MInvoice.PAYMENTRULE_DirectDeposit;
public PaymentFormDirectDeposit(int WindowNo, GridTab mTab) {
super(WindowNo, mTab);
}
public ArrayList<KeyNamePair> getBankAccountList() {
ArrayList<KeyNamePair> list = new ArrayList<KeyNamePair>();
/**
* Load Accounts
*/
String SQL = "SELECT a.C_BP_BankAccount_ID, NVL(b.Name, ' ')||'_'||NVL(a.AccountNo, ' ') AS Acct "
+ "FROM C_BP_BankAccount a"
+ " LEFT OUTER JOIN C_Bank b ON (a.C_Bank_ID=b.C_Bank_ID) "
+ "WHERE C_BPartner_ID=?"
+ "AND a.IsActive='Y' AND a.IsACH='Y'";
try
{
PreparedStatement pstmt = DB.prepareStatement(SQL, null);
pstmt.setInt(1, m_C_BPartner_ID);
ResultSet rs = pstmt.executeQuery();
while (rs.next())
{
int key = rs.getInt(1);
String name = rs.getString(2);
KeyNamePair pp = new KeyNamePair(key, name);
list.add(pp);
}
rs.close();
pstmt.close();
}
catch (SQLException eac)
{
log.log(Level.SEVERE, SQL, eac);
}
return list;
}
public String processMsg;
public boolean save()
{
processMsg = null;
boolean error = false;
String payTypes = m_Cash_As_Payment ? "KTSDB" : "KTSD";
/***********************
* Changed PaymentRule
*/
if (!PAYMENTRULE.equals(m_PaymentRule))
{
log.fine("Changed PaymentRule: " + m_PaymentRule + " -> " + PAYMENTRULE);
// We had a change in Payment type (e.g. Check to CC)
if (payTypes.indexOf(m_PaymentRule) != -1 && payTypes.indexOf(PAYMENTRULE) != -1 && m_mPaymentOriginal != null)
{
log.fine("Old Payment(1) - " + m_mPaymentOriginal);
m_mPaymentOriginal.setDocAction(DocAction.ACTION_Reverse_Correct);
boolean ok = m_mPaymentOriginal.processIt(DocAction.ACTION_Reverse_Correct);
m_mPaymentOriginal.saveEx();
if (ok)
log.info( "Payment Canecelled - " + m_mPaymentOriginal);
else
{
processMsg = "PaymentNotCancelled " + m_mPaymentOriginal.getDocumentNo();
error = true;
}
m_mPayment.resetNew();
}
// We had a Payment and something else (e.g. Check to Cash)
else if (payTypes.indexOf(m_PaymentRule) != -1 && payTypes.indexOf(PAYMENTRULE) == -1)
{
log.fine("Old Payment(2) - " + m_mPaymentOriginal);
if (m_mPaymentOriginal != null)
{
m_mPaymentOriginal.setDocAction(DocAction.ACTION_Reverse_Correct);
boolean ok = m_mPaymentOriginal.processIt(DocAction.ACTION_Reverse_Correct);
m_mPaymentOriginal.saveEx();
if (ok) // Cancel Payment
{
log.fine("PaymentCancelled " + m_mPayment.getDocumentNo ());
getGridTab().getTableModel().dataSave(true);
m_mPayment.resetNew();
m_mPayment.setAmount(m_C_Currency_ID, m_Amount);
}
else
{
processMsg = "PaymentNotCancelled " + m_mPayment.getDocumentNo();
error = true;
}
}
}
}
/**********************
* Save Values to mTab
*/
log.config("Saving changes");
// Set Payment
if (m_mPayment.getC_Payment_ID() != m_C_Payment_ID)
{
if (m_mPayment.getC_Payment_ID() == 0)
getGridTab().setValue("C_Payment_ID", null);
else
getGridTab().setValue("C_Payment_ID", new Integer(m_mPayment.getC_Payment_ID()));
}
return !error;
}
}

View File

@ -1,10 +1,8 @@
package org.compiere.grid;
import org.compiere.model.GridTab;
import org.compiere.model.MInvoice;
public abstract class PaymentFormMixedPOS extends PaymentForm {
public static final String PAYMENTRULE = MInvoice.PAYMENTRULE_MixedPOSPayment;
public PaymentFormMixedPOS(int WindowNo, GridTab mTab) {
super(WindowNo, mTab);

View File

@ -7,13 +7,11 @@ import java.util.ArrayList;
import java.util.logging.Level;
import org.compiere.model.GridTab;
import org.compiere.model.MInvoice;
import org.compiere.model.MRole;
import org.compiere.util.DB;
import org.compiere.util.KeyNamePair;
public abstract class PaymentFormOnCredit extends PaymentForm {
public static final String PAYMENTRULE = MInvoice.PAYMENTRULE_OnCredit;
/** Start Payment Term */
public int m_C_PaymentTerm_ID = 0;