IDEMPIERE-2665 Accounting Fact Reconcilation (Manual) schema validation missing

This commit is contained in:
tsvikruha 2015-06-08 09:27:47 +02:00
parent 682332d832
commit 1ca7631d78
2 changed files with 28 additions and 14 deletions

View File

@ -94,7 +94,7 @@ implements IFormController, EventListener<Event>, WTableModelListener, ValueChan
private Label labelReconciled = new Label(); private Label labelReconciled = new Label();
private Checkbox isReconciled = new Checkbox(); private Checkbox isReconciled = new Checkbox();
private Label labelAccount = new Label(); private Label labelAccount = new Label();
private Listbox fieldAccount = null; private Listbox fieldAccount = new Listbox();
private Label labelBPartner = new Label(); private Label labelBPartner = new Label();
private WSearchEditor fieldBPartner = null; private WSearchEditor fieldBPartner = null;
@ -252,6 +252,7 @@ implements IFormController, EventListener<Event>, WTableModelListener, ValueChan
fieldAcctSchema = new WTableDirEditor("C_AcctSchema_ID", true, false, true, lookupAS); fieldAcctSchema = new WTableDirEditor("C_AcctSchema_ID", true, false, true, lookupAS);
fieldAcctSchema.setValue(MClient.get(Env.getCtx()).getAcctSchema().getC_AcctSchema_ID()); fieldAcctSchema.setValue(MClient.get(Env.getCtx()).getAcctSchema().getC_AcctSchema_ID());
fieldAcctSchema.addValueChangeListener(this); fieldAcctSchema.addValueChangeListener(this);
m_C_AcctSchema_ID = (Integer)fieldAcctSchema.getValue();
// Organization // Organization
AD_Column_ID = FactReconcile.col_AD_Org_ID; //C_Period.AD_Org_ID (needed to allow org 0) AD_Column_ID = FactReconcile.col_AD_Org_ID; //C_Period.AD_Org_ID (needed to allow org 0)
@ -273,17 +274,25 @@ implements IFormController, EventListener<Event>, WTableModelListener, ValueChan
fieldProduct = new WSearchEditor("M_Product_ID", false, false, true, lookupProduct); fieldProduct = new WSearchEditor("M_Product_ID", false, false, true, lookupProduct);
// Account // Account
loadAccounts();
}
private void loadAccounts(){
fieldAccount.removeAllItems();
Vector<KeyNamePair> vector = getAccount(); Vector<KeyNamePair> vector = getAccount();
KeyNamePair[] listAccount = new KeyNamePair[vector.size()];
for(int i=0;i<vector.size();i++) for(int i=0;i<vector.size();i++)
listAccount[i] = vector.get(i); fieldAccount.addItem(vector.get(i));
fieldAccount = new Listbox(listAccount);
fieldAccount.setMold("select"); fieldAccount.setMold("select");
fieldAccount.setSelectedIndex(0); fieldAccount.setSelectedIndex(0);
} }
public void loadData(){ public void loadData(){
if(fieldAcctSchema.getValue()!=null)
m_C_AcctSchema_ID = (Integer)fieldAcctSchema.getValue();
else
m_C_AcctSchema_ID = 0;
ListItem listAccount = fieldAccount.getSelectedItem(); ListItem listAccount = fieldAccount.getSelectedItem();
int Account_ID = 0; int Account_ID = 0;
if(listAccount!=null){ if(listAccount!=null){
@ -299,11 +308,6 @@ implements IFormController, EventListener<Event>, WTableModelListener, ValueChan
m_AD_Org_ID = (Integer)fieldOrg.getValue(); m_AD_Org_ID = (Integer)fieldOrg.getValue();
else else
m_AD_Org_ID = 0; m_AD_Org_ID = 0;
if(fieldAcctSchema.getValue()!=null)
m_C_AcctSchema_ID = (Integer)fieldAcctSchema.getValue();
else
m_C_AcctSchema_ID = 0;
m_isReconciled = isReconciled.isChecked(); m_isReconciled = isReconciled.isChecked();
@ -375,8 +379,17 @@ implements IFormController, EventListener<Event>, WTableModelListener, ValueChan
@Override @Override
public void valueChange(ValueChangeEvent evt) { public void valueChange(ValueChangeEvent evt) {
// TODO Auto-generated method stub String name = evt.getPropertyName();
Object value = evt.getNewValue();
if (log.isLoggable(Level.CONFIG)) log.config(name + "=" + value);
if (value == null)
return;
if (name.equals("C_AcctSchema_ID")) {
m_C_AcctSchema_ID = ((Integer)value).intValue();
loadAccounts();
}
} }
@Override @Override

View File

@ -260,8 +260,9 @@ public class FactReconcile {
"SELECT ev.C_ElementValue_ID, ev.Value || ' ' || ev.Name FROM C_ElementValue ev", "ev", "SELECT ev.C_ElementValue_ID, ev.Value || ' ' || ev.Name FROM C_ElementValue ev", "ev",
MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO) MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO)
+ "AND ev.IsActive='Y' AND ev.IsSummary='N' " + "AND ev.IsActive='Y' AND ev.IsSummary='N' "
+ "AND ev.C_Element_ID IN (SELECT C_Element_ID FROM C_AcctSchema_Element ase " + "AND EXISTS (SELECT 1 FROM C_AcctSchema_Element ase "
+ "WHERE ase.ElementType='AC' AND ase.AD_Client_ID=" + m_AD_Client_ID + ") " + "WHERE ase.C_Element_ID=ev.C_Element_ID AND ase.ElementType='AC' "
+ "AND ase.C_AcctSchema_ID=" + m_C_AcctSchema_ID + " AND ase.AD_Client_ID=" + m_AD_Client_ID + ") "
+ "ORDER BY 2"; + "ORDER BY 2";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;