IDEMPIERE-1104 Payments all get the same accounting date as the reconciling bank statement regardless of transaction date / IDEMPIERE-480
This commit is contained in:
parent
e978aafe0d
commit
47377261b3
|
@ -0,0 +1,20 @@
|
|||
-- Jun 26, 2013 10:11:04 AM COT
|
||||
-- IDEMPIERE-1104 Payments all get the same accounting date as the reconciling bank statement regardless of transaction date
|
||||
UPDATE AD_Window SET Name='Bank/Cash Statement',Updated=TO_DATE('2013-06-26 10:11:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=194
|
||||
;
|
||||
|
||||
-- Jun 26, 2013 10:11:04 AM COT
|
||||
UPDATE AD_Menu SET Name='Bank/Cash Statement', Description='Process Bank Statements', IsActive='Y',Updated=TO_DATE('2013-06-26 10:11:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=234
|
||||
;
|
||||
|
||||
-- Jun 26, 2013 10:20:39 AM COT
|
||||
UPDATE AD_Field SET IsCentrallyMaintained='N', IsReadOnly='N', Help='The Accounting Date on Bank/Cash Statement Line is used for currency conversion and reporting purposes, the accounting is posted using the header date account.', Description='Accounting Conversion Date', Name='Account Conversion Date',Updated=TO_DATE('2013-06-26 10:20:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4121
|
||||
;
|
||||
|
||||
-- Jun 26, 2013 10:21:25 AM COT
|
||||
UPDATE AD_Tab SET Help='The Bank/Cash Statement Tab defines the Bank/Cash Statement to be reconciled.', Name='Bank/Cash Statement', Description='Bank/Cash Statement',Updated=TO_DATE('2013-06-26 10:21:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=328
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201306261026_IDEMPIERE-1104.sql') FROM dual
|
||||
;
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
-- Jun 26, 2013 10:11:04 AM COT
|
||||
-- IDEMPIERE-1104 Payments all get the same accounting date as the reconciling bank statement regardless of transaction date
|
||||
UPDATE AD_Window SET Name='Bank/Cash Statement',Updated=TO_TIMESTAMP('2013-06-26 10:11:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=194
|
||||
;
|
||||
|
||||
-- Jun 26, 2013 10:11:04 AM COT
|
||||
UPDATE AD_Menu SET Name='Bank/Cash Statement', Description='Process Bank Statements', IsActive='Y',Updated=TO_TIMESTAMP('2013-06-26 10:11:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=234
|
||||
;
|
||||
|
||||
-- Jun 26, 2013 10:20:39 AM COT
|
||||
UPDATE AD_Field SET IsCentrallyMaintained='N', IsReadOnly='N', Help='The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.
|
||||
The Accounting Date on Bank/Cash Statement Line is used for currency conversion and reporting purposes, the accounting is posted using the header date account.', Description='Accounting Conversion Date', Name='Account Conversion Date',Updated=TO_TIMESTAMP('2013-06-26 10:20:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4121
|
||||
;
|
||||
|
||||
-- Jun 26, 2013 10:21:25 AM COT
|
||||
UPDATE AD_Tab SET Help='The Bank/Cash Statement Tab defines the Bank/Cash Statement to be reconciled.', Name='Bank/Cash Statement', Description='Bank/Cash Statement',Updated=TO_TIMESTAMP('2013-06-26 10:21:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=328
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201306261026_IDEMPIERE-1104.sql') FROM dual
|
||||
;
|
||||
|
|
@ -206,9 +206,6 @@ import org.compiere.util.Msg;
|
|||
if (amt.compareTo(getChargeAmt()) != 0)
|
||||
setChargeAmt (amt);
|
||||
//
|
||||
// IDEMPIERE-480
|
||||
setDateAcct(getParent().getDateAcct());
|
||||
|
||||
return true;
|
||||
} // beforeSave
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ import org.compiere.grid.CreateFromDepositBatch;
|
|||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MBankStatement;
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.MDepositBatch;
|
||||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.MPayment;
|
||||
|
@ -170,7 +171,14 @@ public class WCreateFromDepositBatchUI extends CreateFromDepositBatch implements
|
|||
lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 3499, DisplayType.Search);
|
||||
bPartnerLookup = new WSearchEditor ("C_BPartner_ID", false, false, true, lookup);
|
||||
|
||||
Timestamp date = Env.getContextAsDate(Env.getCtx(), p_WindowNo, MBankStatement.COLUMNNAME_StatementDate);
|
||||
Timestamp date = null;
|
||||
if (getGridTab().getAD_Table_ID() == MBankStatement.Table_ID) {
|
||||
date = Env.getContextAsDate(Env.getCtx(), p_WindowNo, MBankStatement.COLUMNNAME_StatementDate);
|
||||
} else if (getGridTab().getAD_Table_ID() == MDepositBatch.Table_ID) {
|
||||
date = Env.getContextAsDate(Env.getCtx(), p_WindowNo, MDepositBatch.COLUMNNAME_DateDoc);
|
||||
} else {
|
||||
date = new Timestamp(System.currentTimeMillis());
|
||||
}
|
||||
dateToField.setValue(date);
|
||||
|
||||
loadBankAccount();
|
||||
|
|
|
@ -106,14 +106,8 @@ public abstract class StatementCreateFromBatch extends CreateFromForm
|
|||
Object AmtFrom, Object AmtTo, Object DocType, Object TenderType, String AuthCode, GridTab gridTab)
|
||||
throws SQLException
|
||||
{
|
||||
// Get StatementDate
|
||||
Timestamp ts = (Timestamp) gridTab.getValue("StatementDate");
|
||||
if (ts == null)
|
||||
ts = new Timestamp(System.currentTimeMillis());
|
||||
|
||||
int index = 1;
|
||||
|
||||
pstmt.setTimestamp(index++, ts);
|
||||
pstmt.setInt(index++, BankAccount != null ? (Integer) BankAccount : (Integer) gridTab.getValue("C_BankAccount_ID"));
|
||||
|
||||
if(DocType != null)
|
||||
|
@ -182,7 +176,7 @@ public abstract class StatementCreateFromBatch extends CreateFromForm
|
|||
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT py.C_DepositBatch_ID, db.DocumentNo, db.DateDeposit, db.C_BankAccount_ID, ba.AccountNo,");
|
||||
sql.append("SUM(currencyConvert(p.PayAmt,p.C_Currency_ID,ba.C_Currency_ID,?,null,p.AD_Client_ID,p.AD_Org_ID)) AS amount,");
|
||||
sql.append("SUM(currencyConvert(p.PayAmt,p.C_Currency_ID,ba.C_Currency_ID,p.DateAcct,p.C_ConversionType_ID,p.AD_Client_ID,p.AD_Org_ID)) AS amount,");
|
||||
sql.append("SUM(p.PayAmt) AS amountoriginal");
|
||||
sql.append(" FROM C_BankAccount ba");
|
||||
sql.append(" INNER JOIN C_Payment_v p ON (p.C_BankAccount_ID=ba.C_BankAccount_ID)");
|
||||
|
@ -251,7 +245,7 @@ public abstract class StatementCreateFromBatch extends CreateFromForm
|
|||
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT p.DateTrx,p.C_Payment_ID,p.DocumentNo, p.C_Currency_ID,c.ISO_Code, p.PayAmt,");
|
||||
sql.append("currencyConvert(p.PayAmt,p.C_Currency_ID,ba.C_Currency_ID,?,null,p.AD_Client_ID,p.AD_Org_ID), bp.Name ");
|
||||
sql.append("currencyConvert(p.PayAmt,p.C_Currency_ID,ba.C_Currency_ID,p.DateAcct,p.C_ConversionType_ID,p.AD_Client_ID,p.AD_Org_ID), bp.Name ");
|
||||
sql.append(" FROM C_BankAccount ba");
|
||||
sql.append(" INNER JOIN C_Payment_v p ON (p.C_BankAccount_ID=ba.C_BankAccount_ID)");
|
||||
sql.append(" INNER JOIN C_Currency c ON (p.C_Currency_ID=c.C_Currency_ID)");
|
||||
|
@ -264,10 +258,6 @@ public abstract class StatementCreateFromBatch extends CreateFromForm
|
|||
sql.append(" AND p.C_BankAccount_ID=?");
|
||||
sql.append(" AND NOT EXISTS (SELECT * FROM C_BankStatementLine l WHERE p.C_Payment_ID=l.C_Payment_ID AND l.StmtAmt <> 0)");
|
||||
|
||||
Timestamp ts = (Timestamp) gridTab.getValue("StatementDate");
|
||||
if(ts == null)
|
||||
ts = new Timestamp(System.currentTimeMillis());
|
||||
|
||||
// Lines
|
||||
for(int i = 0; i < miniTable.getRowCount(); i++)
|
||||
{
|
||||
|
@ -288,24 +278,26 @@ public abstract class StatementCreateFromBatch extends CreateFromForm
|
|||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql.toString(), trxName);
|
||||
pstmt.setTimestamp(1, ts);
|
||||
pstmt.setInt(2, C_DepositBatch_ID);
|
||||
pstmt.setInt(3, C_BankAccount_ID);
|
||||
pstmt.setInt(1, C_DepositBatch_ID);
|
||||
pstmt.setInt(2, C_BankAccount_ID);
|
||||
rs = pstmt.executeQuery();
|
||||
while(rs.next())
|
||||
{
|
||||
Timestamp DateTrx = rs.getTimestamp(1);
|
||||
int C_Payment_ID = rs.getInt(2);
|
||||
int C_Currency_ID = rs.getInt(4);
|
||||
BigDecimal TrxAmt = rs.getBigDecimal(6); // PayAmt
|
||||
BigDecimal TrxAmt = rs.getBigDecimal(7); // ConvertedPayAmt
|
||||
|
||||
if (log.isLoggable(Level.FINE)) log.fine("Line Date=" + trxDate + ", Payment=" + C_Payment_ID + ", Currency=" + C_Currency_ID + ", Amt=" + TrxAmt);
|
||||
//
|
||||
MBankStatementLine bsl = new MBankStatementLine (bs);
|
||||
bsl.setStatementLineDate(trxDate);
|
||||
bsl.setStatementLineDate(DateTrx);
|
||||
bsl.setPayment(new MPayment(Env.getCtx(), C_Payment_ID, trxName));
|
||||
bsl.setTrxAmt(TrxAmt);
|
||||
bsl.setStmtAmt(TrxAmt);
|
||||
bsl.setC_Currency_ID(bs.getBankAccount().getC_Currency_ID());
|
||||
if (!bsl.save())
|
||||
log.log(Level.SEVERE, "Line not created #" + i);
|
||||
|
||||
}
|
||||
}
|
||||
catch(SQLException e)
|
||||
|
|
|
@ -59,7 +59,7 @@ public abstract class CreateFromDepositBatch extends CreateFromBatch
|
|||
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT p.DateTrx,p.C_Payment_ID,p.DocumentNo, p.C_Currency_ID,c.ISO_Code, p.PayAmt,");
|
||||
sql.append("currencyConvert(p.PayAmt,p.C_Currency_ID,ba.C_Currency_ID,?,null,p.AD_Client_ID,p.AD_Org_ID), bp.Name ");
|
||||
sql.append("currencyConvert(p.PayAmt,p.C_Currency_ID,ba.C_Currency_ID,p.DateAcct,p.C_ConversionType_ID,p.AD_Client_ID,p.AD_Org_ID), bp.Name ");
|
||||
sql.append("FROM C_BankAccount ba");
|
||||
sql.append(" INNER JOIN C_Payment_v p ON (p.C_BankAccount_ID=ba.C_BankAccount_ID)");
|
||||
sql.append(" INNER JOIN C_Currency c ON (p.C_Currency_ID=c.C_Currency_ID)");
|
||||
|
|
|
@ -143,7 +143,7 @@ public abstract class CreateFromStatement extends CreateFromBatch
|
|||
|
||||
bsl.setTrxAmt(TrxAmt);
|
||||
bsl.setStmtAmt(TrxAmt);
|
||||
bsl.setC_Currency_ID(C_Currency_ID);
|
||||
bsl.setC_Currency_ID(bs.getBankAccount().getC_Currency_ID());
|
||||
|
||||
if (!bsl.save())
|
||||
log.log(Level.SEVERE, "Line not created #" + i);
|
||||
|
|
Loading…
Reference in New Issue