From 46937f401887a93337c0d546db7fcf4c91197ef0 Mon Sep 17 00:00:00 2001 From: Elaine Tan Date: Fri, 12 Apr 2013 11:44:15 +0800 Subject: [PATCH] IDEMPIERE-853 Improvement to Deposit Batch functionality --- .../oracle/201304111547_IDEMPIERE-853.sql | 89 +++++++++++++++++++ .../postgresql/201304111547_IDEMPIERE-853.sql | 89 +++++++++++++++++++ .../org/compiere/model/MDepositBatchLine.java | 4 +- .../apps/form/VStatementCreateFromBatch.java | 2 +- .../apps/form/WStatementCreateFromBatch.java | 2 +- .../apps/form/StatementCreateFromBatch.java | 8 +- .../compiere/grid/CreateFromDepositBatch.java | 7 +- 7 files changed, 190 insertions(+), 11 deletions(-) create mode 100644 migration/i1.0a-release/oracle/201304111547_IDEMPIERE-853.sql create mode 100644 migration/i1.0a-release/postgresql/201304111547_IDEMPIERE-853.sql diff --git a/migration/i1.0a-release/oracle/201304111547_IDEMPIERE-853.sql b/migration/i1.0a-release/oracle/201304111547_IDEMPIERE-853.sql new file mode 100644 index 0000000000..3b3749ab75 --- /dev/null +++ b/migration/i1.0a-release/oracle/201304111547_IDEMPIERE-853.sql @@ -0,0 +1,89 @@ +-- Apr 11, 2013 11:39:53 AM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +INSERT INTO AD_Val_Rule (AD_Client_ID,Code,AD_Val_Rule_ID,EntityType,Name,Type,AD_Val_Rule_UU,CreatedBy,UpdatedBy,Updated,Created,IsActive,AD_Org_ID) VALUES (0,'C_DocType.DocBaseType IN (''ARR'') AND C_DocType.AD_Client_ID=@#AD_Client_ID@',200038,'D','C_DocType Receipts','S','d8daa96e-1130-47a2-8a1e-780910ecca50',100,100,TO_DATE('2013-04-11 11:39:52','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2013-04-11 11:39:52','YYYY-MM-DD HH24:MI:SS'),'Y',0) +; + +-- Apr 11, 2013 11:40:04 AM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Column SET AD_Val_Rule_ID=200038,Updated=TO_DATE('2013-04-11 11:40:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=208413 +; + +-- Apr 11, 2013 11:54:06 AM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +INSERT INTO AD_Val_Rule (AD_Client_ID,Code,AD_Val_Rule_ID,EntityType,Name,Type,AD_Val_Rule_UU,CreatedBy,UpdatedBy,Updated,Created,IsActive,AD_Org_ID) VALUES (0,'C_Payment.IsReconciled=''N'' AND C_Payment.IsReceipt = ''Y'' AND C_Payment.TrxType <> ''X'' AND (C_Payment.C_DepositBatch_ID = 0 OR C_Payment.C_DepositBatch_ID IS NULL)',200039,'D','C_DepositBatchLine C_Payment_ID','S','1c7fa24b-df83-46c8-a455-913dd7690bbc',100,100,TO_DATE('2013-04-11 11:54:05','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2013-04-11 11:54:05','YYYY-MM-DD HH24:MI:SS'),'Y',0) +; + +-- Apr 11, 2013 11:54:15 AM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Column SET AD_Val_Rule_ID=200039,Updated=TO_DATE('2013-04-11 11:54:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=208437 +; + +-- Apr 11, 2013 12:03:49 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Column SET IsToolbarButton='N',Updated=TO_DATE('2013-04-11 12:03:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=208421 +; + +-- Apr 11, 2013 2:59:46 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Column SET AD_Val_Rule_ID=149,Updated=TO_DATE('2013-04-11 14:59:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=208413 +; + +-- Apr 11, 2013 3:00:38 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Window SET Help='The Process Payments Window allows you to enter payments for invoices. If the payment is for a single invoice then it can be processed here.', Name='Payments into Batch', Description='Process Payments',Updated=TO_DATE('2013-04-11 15:00:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=200031 +; + +-- Apr 11, 2013 3:00:38 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Menu SET Name='Payments into Batch', Description='Process Payments', IsActive='Y',Updated=TO_DATE('2013-04-11 15:00:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=200035 +; + +-- Apr 11, 2013 3:07:06 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Process SET Value='C_BankStatement CreateFromBatch',Updated=TO_DATE('2013-04-11 15:07:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=200032 +; + +-- Apr 11, 2013 3:07:20 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Element SET ColumnName='CreateFromBatch',Updated=TO_DATE('2013-04-11 15:07:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=202201 +; + +-- Apr 11, 2013 3:07:21 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Column SET ColumnName='CreateFromBatch', Name='Create From Batch', Description=NULL, Help=NULL WHERE AD_Element_ID=202201 +; + +-- Apr 11, 2013 3:07:22 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Process_Para SET ColumnName='CreateFromBatch', Name='Create From Batch', Description=NULL, Help=NULL, AD_Element_ID=202201 WHERE UPPER(ColumnName)='CREATEFROMBATCH' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL +; + +-- Apr 11, 2013 3:07:22 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Process_Para SET ColumnName='CreateFromBatch', Name='Create From Batch', Description=NULL, Help=NULL WHERE AD_Element_ID=202201 AND IsCentrallyMaintained='Y' +; + +-- Apr 11, 2013 3:07:22 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_InfoColumn SET ColumnName='CreateFromBatch', Name='Create From Batch', Description=NULL, Help=NULL WHERE AD_Element_ID=202201 AND IsCentrallyMaintained='Y' +; + +-- Apr 11, 2013 3:07:45 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +ALTER TABLE C_BankStatement ADD CreateFromBatch CHAR(1) DEFAULT NULL +; + +-- Apr 11, 2013 3:09:19 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Val_Rule SET Code='C_Payment.IsReconciled=''N'' AND C_Payment.TrxType <> ''X'' AND (C_Payment.C_DepositBatch_ID = 0 OR C_Payment.C_DepositBatch_ID IS NULL)',Updated=TO_DATE('2013-04-11 15:09:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=200039 +; + +-- Apr 11, 2013 3:21:20 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Val_Rule SET Code='C_Payment.IsReconciled=''N'' AND C_Payment.TrxType <> ''X'' AND (C_Payment.C_DepositBatch_ID = 0 OR C_Payment.C_DepositBatch_ID IS NULL) AND C_Payment.C_DocType_ID=@C_DocType_ID@',Updated=TO_DATE('2013-04-11 15:21:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=200039 +; + +ALTER TABLE C_BankStatement DROP COLUMN X_CreateFromBatch; + +SELECT register_migration_script('201304111547_IDEMPIERE-853.sql') FROM dual +; \ No newline at end of file diff --git a/migration/i1.0a-release/postgresql/201304111547_IDEMPIERE-853.sql b/migration/i1.0a-release/postgresql/201304111547_IDEMPIERE-853.sql new file mode 100644 index 0000000000..9ce6f0a03e --- /dev/null +++ b/migration/i1.0a-release/postgresql/201304111547_IDEMPIERE-853.sql @@ -0,0 +1,89 @@ +-- Apr 11, 2013 11:39:53 AM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +INSERT INTO AD_Val_Rule (AD_Client_ID,Code,AD_Val_Rule_ID,EntityType,Name,Type,AD_Val_Rule_UU,CreatedBy,UpdatedBy,Updated,Created,IsActive,AD_Org_ID) VALUES (0,'C_DocType.DocBaseType IN (''ARR'') AND C_DocType.AD_Client_ID=@#AD_Client_ID@',200038,'D','C_DocType Receipts','S','d8daa96e-1130-47a2-8a1e-780910ecca50',100,100,TO_TIMESTAMP('2013-04-11 11:39:52','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2013-04-11 11:39:52','YYYY-MM-DD HH24:MI:SS'),'Y',0) +; + +-- Apr 11, 2013 11:40:04 AM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Column SET AD_Val_Rule_ID=200038,Updated=TO_TIMESTAMP('2013-04-11 11:40:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=208413 +; + +-- Apr 11, 2013 11:54:06 AM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +INSERT INTO AD_Val_Rule (AD_Client_ID,Code,AD_Val_Rule_ID,EntityType,Name,Type,AD_Val_Rule_UU,CreatedBy,UpdatedBy,Updated,Created,IsActive,AD_Org_ID) VALUES (0,'C_Payment.IsReconciled=''N'' AND C_Payment.IsReceipt = ''Y'' AND C_Payment.TrxType <> ''X'' AND (C_Payment.C_DepositBatch_ID = 0 OR C_Payment.C_DepositBatch_ID IS NULL)',200039,'D','C_DepositBatchLine C_Payment_ID','S','1c7fa24b-df83-46c8-a455-913dd7690bbc',100,100,TO_TIMESTAMP('2013-04-11 11:54:05','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2013-04-11 11:54:05','YYYY-MM-DD HH24:MI:SS'),'Y',0) +; + +-- Apr 11, 2013 11:54:15 AM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Column SET AD_Val_Rule_ID=200039,Updated=TO_TIMESTAMP('2013-04-11 11:54:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=208437 +; + +-- Apr 11, 2013 12:03:49 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Column SET IsToolbarButton='N',Updated=TO_TIMESTAMP('2013-04-11 12:03:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=208421 +; + +-- Apr 11, 2013 2:59:46 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Column SET AD_Val_Rule_ID=149,Updated=TO_TIMESTAMP('2013-04-11 14:59:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=208413 +; + +-- Apr 11, 2013 3:00:38 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Window SET Help='The Process Payments Window allows you to enter payments for invoices. If the payment is for a single invoice then it can be processed here.', Name='Payments into Batch', Description='Process Payments',Updated=TO_TIMESTAMP('2013-04-11 15:00:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=200031 +; + +-- Apr 11, 2013 3:00:38 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Menu SET Name='Payments into Batch', Description='Process Payments', IsActive='Y',Updated=TO_TIMESTAMP('2013-04-11 15:00:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=200035 +; + +-- Apr 11, 2013 3:07:06 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Process SET Value='C_BankStatement CreateFromBatch',Updated=TO_TIMESTAMP('2013-04-11 15:07:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=200032 +; + +-- Apr 11, 2013 3:07:20 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Element SET ColumnName='CreateFromBatch',Updated=TO_TIMESTAMP('2013-04-11 15:07:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=202201 +; + +-- Apr 11, 2013 3:07:21 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Column SET ColumnName='CreateFromBatch', Name='Create From Batch', Description=NULL, Help=NULL WHERE AD_Element_ID=202201 +; + +-- Apr 11, 2013 3:07:22 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Process_Para SET ColumnName='CreateFromBatch', Name='Create From Batch', Description=NULL, Help=NULL, AD_Element_ID=202201 WHERE UPPER(ColumnName)='CREATEFROMBATCH' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL +; + +-- Apr 11, 2013 3:07:22 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Process_Para SET ColumnName='CreateFromBatch', Name='Create From Batch', Description=NULL, Help=NULL WHERE AD_Element_ID=202201 AND IsCentrallyMaintained='Y' +; + +-- Apr 11, 2013 3:07:22 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_InfoColumn SET ColumnName='CreateFromBatch', Name='Create From Batch', Description=NULL, Help=NULL WHERE AD_Element_ID=202201 AND IsCentrallyMaintained='Y' +; + +-- Apr 11, 2013 3:07:45 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +ALTER TABLE C_BankStatement ADD COLUMN CreateFromBatch CHAR(1) DEFAULT NULL +; + +-- Apr 11, 2013 3:09:19 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Val_Rule SET Code='C_Payment.IsReconciled=''N'' AND C_Payment.TrxType <> ''X'' AND (C_Payment.C_DepositBatch_ID = 0 OR C_Payment.C_DepositBatch_ID IS NULL)',Updated=TO_TIMESTAMP('2013-04-11 15:09:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=200039 +; + +-- Apr 11, 2013 3:21:20 PM SGT +-- IDEMPIERE-853 Improvement to Deposit Batch functionality +UPDATE AD_Val_Rule SET Code='C_Payment.IsReconciled=''N'' AND C_Payment.TrxType <> ''X'' AND (C_Payment.C_DepositBatch_ID = 0 OR C_Payment.C_DepositBatch_ID IS NULL) AND C_Payment.C_DocType_ID=@C_DocType_ID@',Updated=TO_TIMESTAMP('2013-04-11 15:21:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=200039 +; + +ALTER TABLE C_BankStatement DROP COLUMN X_CreateFromBatch; + +SELECT register_migration_script('201304111547_IDEMPIERE-853.sql') FROM dual +; \ No newline at end of file diff --git a/org.adempiere.base/src/org/compiere/model/MDepositBatchLine.java b/org.adempiere.base/src/org/compiere/model/MDepositBatchLine.java index 6bc1d8944f..59de5a017a 100644 --- a/org.adempiere.base/src/org/compiere/model/MDepositBatchLine.java +++ b/org.adempiere.base/src/org/compiere/model/MDepositBatchLine.java @@ -135,8 +135,10 @@ import org.compiere.util.Env; { String sql = "UPDATE C_Payment p SET C_DepositBatch_ID=? WHERE p.C_Payment_ID=?"; DB.executeUpdateEx(sql, new Object[] {getC_DepositBatch_ID(), getC_Payment_ID()}, get_TrxName()); + + MPayment payment = new MPayment(getCtx(), getC_Payment_ID(), get_TrxName()); + setPayment(payment); // set payment amount } - // return true; } // beforeSave diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/form/VStatementCreateFromBatch.java b/org.adempiere.ui.swing/src/org/compiere/apps/form/VStatementCreateFromBatch.java index 623e502036..d2090577be 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/form/VStatementCreateFromBatch.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/form/VStatementCreateFromBatch.java @@ -62,7 +62,7 @@ public class VStatementCreateFromBatch extends StatementCreateFromBatch implemen public void init (int WindowNo, FormFrame frame) { form = new VCreateFromForm(this, frame); - p_WindowNo = WindowNo; + p_WindowNo = frame.getGridTab().getWindowNo();; m_frame = frame; initForm(); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WStatementCreateFromBatch.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WStatementCreateFromBatch.java index 6dfd9c67c2..46896ff838 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WStatementCreateFromBatch.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WStatementCreateFromBatch.java @@ -68,7 +68,7 @@ public class WStatementCreateFromBatch extends StatementCreateFromBatch implemen public WStatementCreateFromBatch() { form = new WCreateFromForm(this); - p_WindowNo = form.getWindowNo(); + p_WindowNo = form.getGridTab().getWindowNo(); } public void initForm() diff --git a/org.adempiere.ui/src/org/compiere/apps/form/StatementCreateFromBatch.java b/org.adempiere.ui/src/org/compiere/apps/form/StatementCreateFromBatch.java index e47c5cb615..2d3eef3e10 100644 --- a/org.adempiere.ui/src/org/compiere/apps/form/StatementCreateFromBatch.java +++ b/org.adempiere.ui/src/org/compiere/apps/form/StatementCreateFromBatch.java @@ -191,7 +191,6 @@ public abstract class StatementCreateFromBatch extends CreateFromForm sql.append(" INNER JOIN C_DepositBatch db ON (py.C_DepositBatch_ID = db.C_DepositBatch_ID) "); sql.append(getSQLWhere(BPartner, DocumentNo, DateFrom, DateTo, AmtFrom, AmtTo, DocType, TenderType, AuthCode)); - sql.append(" AND p.IsReceipt = 'Y'"); sql.append(" AND py.C_DepositBatch_ID <> 0"); sql.append(" AND db.Processed = 'Y'"); @@ -247,7 +246,7 @@ public abstract class StatementCreateFromBatch extends CreateFromForm { // fixed values int C_BankStatement_ID = ((Integer) gridTab.getValue("C_BankStatement_ID")).intValue(); - MBankStatement bs = new MBankStatement (Env.getCtx(), C_BankStatement_ID, null); + MBankStatement bs = new MBankStatement (Env.getCtx(), C_BankStatement_ID, trxName); if (log.isLoggable(Level.CONFIG)) log.config(bs.toString()); StringBuilder sql = new StringBuilder(); @@ -260,7 +259,6 @@ public abstract class StatementCreateFromBatch extends CreateFromForm sql.append(" INNER JOIN C_DepositBatch db ON (py.C_DepositBatch_ID = db.C_DepositBatch_ID)"); sql.append(" LEFT OUTER JOIN C_BPartner bp ON (p.C_BPartner_ID=bp.C_BPartner_ID)"); sql.append(" WHERE p.Processed='Y' AND p.IsReconciled='N'"); - sql.append(" AND p.IsReceipt = 'Y'"); sql.append(" AND py.C_DepositBatch_ID = ?"); sql.append(" AND p.DocStatus IN ('CO','CL','RE','VO') AND p.PayAmt<>0"); sql.append(" AND p.C_BankAccount_ID=?"); @@ -289,7 +287,7 @@ public abstract class StatementCreateFromBatch extends CreateFromForm ResultSet rs = null; try { - pstmt = DB.prepareStatement(sql.toString(), null); + pstmt = DB.prepareStatement(sql.toString(), trxName); pstmt.setTimestamp(1, ts); pstmt.setInt(2, C_DepositBatch_ID); pstmt.setInt(3, C_BankAccount_ID); @@ -304,7 +302,7 @@ public abstract class StatementCreateFromBatch extends CreateFromForm // MBankStatementLine bsl = new MBankStatementLine (bs); bsl.setStatementLineDate(trxDate); - bsl.setPayment(new MPayment(Env.getCtx(), C_Payment_ID, null)); + bsl.setPayment(new MPayment(Env.getCtx(), C_Payment_ID, trxName)); if (!bsl.save()) log.log(Level.SEVERE, "Line not created #" + i); diff --git a/org.adempiere.ui/src/org/compiere/grid/CreateFromDepositBatch.java b/org.adempiere.ui/src/org/compiere/grid/CreateFromDepositBatch.java index cd45a99543..0779a2c778 100644 --- a/org.adempiere.ui/src/org/compiere/grid/CreateFromDepositBatch.java +++ b/org.adempiere.ui/src/org/compiere/grid/CreateFromDepositBatch.java @@ -67,7 +67,8 @@ public abstract class CreateFromDepositBatch extends CreateFromBatch sql.append(" LEFT OUTER JOIN C_BPartner bp ON (p.C_BPartner_ID=bp.C_BPartner_ID) "); sql.append(getSQLWhere(BPartner, DocumentNo, DateFrom, DateTo, AmtFrom, AmtTo, DocType, TenderType, AuthCode)); - sql.append(" AND p.IsReceipt = 'Y'"); + sql.append(" AND py.IsReconciled = 'N'"); + sql.append(" AND py.TrxType <> 'X'"); sql.append(" AND (py.C_DepositBatch_ID = 0 OR py.C_DepositBatch_ID IS NULL)"); sql.append(" ORDER BY p.DateTrx"); @@ -124,7 +125,7 @@ public abstract class CreateFromDepositBatch extends CreateFromBatch { // fixed values int C_DepositBatch_ID = ((Integer) getGridTab().getValue("C_DepositBatch_ID")).intValue(); - MDepositBatch db = new MDepositBatch(Env.getCtx(), C_DepositBatch_ID, null); + MDepositBatch db = new MDepositBatch(Env.getCtx(), C_DepositBatch_ID, trxName); if (log.isLoggable(Level.CONFIG)) log.config(db.toString()); // Lines @@ -144,7 +145,7 @@ public abstract class CreateFromDepositBatch extends CreateFromBatch // MDepositBatchLine dbl = new MDepositBatchLine(db); // dbl.setStatementLineDate(trxDate); - dbl.setPayment(new MPayment(Env.getCtx(), C_Payment_ID, null)); + dbl.setPayment(new MPayment(Env.getCtx(), C_Payment_ID, trxName)); if(!dbl.save()) log.log(Level.SEVERE, "Line not created #" + i); } // if selected