IDEMPIERE-5146 Load/Import Bank Statement issues (#1125)
* Add org.compiere.model.MBankStatementLoader.getLastSavedLine() to allow further processing of the saved I_BankStatement record on plugins * Increase size of columns: I_BankStatement.EftMemo -> 4000 I_BankStatement.Memo -> 4000 C_BankStatementLine.EftMemo -> 4000 C_BankStatementLine.Memo -> 4000 I_BankStatement.LineDescription -> 1000 C_BankStatementLine.Description -> 1000 I_BankStatement.EftTrxType -> 255 C_BankStatementLine.EftTrxType -> 255 I_BankStatement.EftReference -> 255 C_BankStatementLine.EftReference -> 255 I_BankStatement.ReferenceNo -> 255 C_BankStatementLine.ReferenceNo -> 255 * Add process "Create Payment" on bank statement header to process all lines with pending payments to create
This commit is contained in:
parent
35d426bb9a
commit
847e2a5238
|
@ -0,0 +1,127 @@
|
|||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- IDEMPIERE-5146 Load/Import Bank Statement issues
|
||||
-- Jan 10, 2022, 8:27:42 PM CET
|
||||
UPDATE AD_Column SET FieldLength=4000,Updated=TO_DATE('2022-01-10 20:27:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=10016
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:27:44 PM CET
|
||||
ALTER TABLE I_BankStatement MODIFY EftMemo VARCHAR2(4000 CHAR) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:28:04 PM CET
|
||||
UPDATE AD_Column SET FieldLength=4000,Updated=TO_DATE('2022-01-10 20:28:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=9293
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:28:08 PM CET
|
||||
ALTER TABLE I_BankStatement MODIFY Memo VARCHAR2(4000 CHAR) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:28:32 PM CET
|
||||
UPDATE AD_Column SET FieldLength=4000,Updated=TO_DATE('2022-01-10 20:28:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=10029
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:28:34 PM CET
|
||||
ALTER TABLE C_BankStatementLine MODIFY EftMemo VARCHAR2(4000 CHAR) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:29:03 PM CET
|
||||
UPDATE AD_Column SET FieldLength=4000,Updated=TO_DATE('2022-01-10 20:29:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=8987
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:29:04 PM CET
|
||||
ALTER TABLE C_BankStatementLine MODIFY Memo VARCHAR2(4000 CHAR) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:30:00 PM CET
|
||||
UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, NumLines=2, IsToolbarButton=NULL,Updated=TO_DATE('2022-01-10 20:30:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=7069
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:30:05 PM CET
|
||||
UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, NumLines=2, IsToolbarButton=NULL,Updated=TO_DATE('2022-01-10 20:30:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6864
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:30:20 PM CET
|
||||
UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, NumLines=5, IsToolbarButton=NULL,Updated=TO_DATE('2022-01-10 20:30:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8365
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:30:33 PM CET
|
||||
UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, NumLines=5, IsToolbarButton=NULL,Updated=TO_DATE('2022-01-10 20:30:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8361
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:31:11 PM CET
|
||||
UPDATE AD_Column SET FieldLength=1000,Updated=TO_DATE('2022-01-10 20:31:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=9299
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:31:13 PM CET
|
||||
ALTER TABLE I_BankStatement MODIFY LineDescription VARCHAR2(1000 CHAR) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:31:28 PM CET
|
||||
UPDATE AD_Column SET FieldLength=1000, SeqNoSelection=10,Updated=TO_DATE('2022-01-10 20:31:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4936
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:31:30 PM CET
|
||||
ALTER TABLE C_BankStatementLine MODIFY Description VARCHAR2(1000 CHAR) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:32:45 PM CET
|
||||
UPDATE AD_Column SET FieldLength=255,Updated=TO_DATE('2022-01-10 20:32:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=10018
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:32:47 PM CET
|
||||
ALTER TABLE I_BankStatement MODIFY EftTrxType VARCHAR2(255 CHAR) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:32:53 PM CET
|
||||
UPDATE AD_Column SET FieldLength=255,Updated=TO_DATE('2022-01-10 20:32:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=10026
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:32:55 PM CET
|
||||
ALTER TABLE C_BankStatementLine MODIFY EftTrxType VARCHAR2(255 CHAR) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:33:49 PM CET
|
||||
UPDATE AD_Column SET FieldLength=255,Updated=TO_DATE('2022-01-10 20:33:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=10017
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:33:50 PM CET
|
||||
ALTER TABLE I_BankStatement MODIFY EftReference VARCHAR2(255 CHAR) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:33:56 PM CET
|
||||
UPDATE AD_Column SET FieldLength=255,Updated=TO_DATE('2022-01-10 20:33:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=10339
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:33:57 PM CET
|
||||
ALTER TABLE C_BankStatementLine MODIFY EftReference VARCHAR2(255 CHAR) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:34:38 PM CET
|
||||
UPDATE AD_Column SET FieldLength=255,Updated=TO_DATE('2022-01-10 20:34:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=9290
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:34:40 PM CET
|
||||
ALTER TABLE I_BankStatement MODIFY ReferenceNo VARCHAR2(255 CHAR) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:34:45 PM CET
|
||||
UPDATE AD_Column SET FieldLength=255,Updated=TO_DATE('2022-01-10 20:34:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=8986
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:34:46 PM CET
|
||||
ALTER TABLE C_BankStatementLine MODIFY ReferenceNo VARCHAR2(255 CHAR) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 10:58:34 PM CET
|
||||
INSERT INTO AD_ToolBarButton (AD_Client_ID,AD_Org_ID,Created,CreatedBy,ComponentName,IsActive,AD_ToolBarButton_ID,Name,Updated,UpdatedBy,IsCustomization,AD_ToolBarButton_UU,Action,AD_Tab_ID,AD_Process_ID,SeqNo,EntityType) VALUES (0,0,TO_DATE('2022-01-10 22:58:33','YYYY-MM-DD HH24:MI:SS'),100,'CreatePayment','Y',200116,'CreatePayment',TO_DATE('2022-01-10 22:58:33','YYYY-MM-DD HH24:MI:SS'),100,'N','106df1bc-ac3b-44a6-92ba-ead2d2171155','W',328,257,10,'D')
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 11:10:31 PM CET
|
||||
UPDATE AD_ToolBarButton SET DisplayLogic='@Processed@=N',Updated=TO_DATE('2022-01-10 23:10:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_ToolBarButton_ID=200116
|
||||
;
|
||||
|
||||
SELECT register_migration_script('202201102035_IDEMPIERE-5146.sql') FROM dual
|
||||
;
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
-- IDEMPIERE-5146 Load/Import Bank Statement issues
|
||||
-- Jan 10, 2022, 8:27:42 PM CET
|
||||
UPDATE AD_Column SET FieldLength=4000,Updated=TO_TIMESTAMP('2022-01-10 20:27:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=10016
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:27:44 PM CET
|
||||
INSERT INTO t_alter_column values('i_bankstatement','EftMemo','VARCHAR(4000)',null,'NULL')
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:28:04 PM CET
|
||||
UPDATE AD_Column SET FieldLength=4000,Updated=TO_TIMESTAMP('2022-01-10 20:28:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=9293
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:28:08 PM CET
|
||||
INSERT INTO t_alter_column values('i_bankstatement','Memo','VARCHAR(4000)',null,'NULL')
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:28:32 PM CET
|
||||
UPDATE AD_Column SET FieldLength=4000,Updated=TO_TIMESTAMP('2022-01-10 20:28:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=10029
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:28:34 PM CET
|
||||
INSERT INTO t_alter_column values('c_bankstatementline','EftMemo','VARCHAR(4000)',null,'NULL')
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:29:03 PM CET
|
||||
UPDATE AD_Column SET FieldLength=4000,Updated=TO_TIMESTAMP('2022-01-10 20:29:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=8987
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:29:04 PM CET
|
||||
INSERT INTO t_alter_column values('c_bankstatementline','Memo','VARCHAR(4000)',null,'NULL')
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:30:00 PM CET
|
||||
UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, NumLines=2, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-01-10 20:30:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=7069
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:30:05 PM CET
|
||||
UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, NumLines=2, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-01-10 20:30:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6864
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:30:20 PM CET
|
||||
UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, NumLines=5, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-01-10 20:30:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8365
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:30:33 PM CET
|
||||
UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, NumLines=5, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-01-10 20:30:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8361
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:31:11 PM CET
|
||||
UPDATE AD_Column SET FieldLength=1000,Updated=TO_TIMESTAMP('2022-01-10 20:31:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=9299
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:31:13 PM CET
|
||||
INSERT INTO t_alter_column values('i_bankstatement','LineDescription','VARCHAR(1000)',null,'NULL')
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:31:28 PM CET
|
||||
UPDATE AD_Column SET FieldLength=1000, SeqNoSelection=10,Updated=TO_TIMESTAMP('2022-01-10 20:31:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4936
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:31:30 PM CET
|
||||
INSERT INTO t_alter_column values('c_bankstatementline','Description','VARCHAR(1000)',null,'NULL')
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:32:45 PM CET
|
||||
UPDATE AD_Column SET FieldLength=255,Updated=TO_TIMESTAMP('2022-01-10 20:32:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=10018
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:32:47 PM CET
|
||||
INSERT INTO t_alter_column values('i_bankstatement','EftTrxType','VARCHAR(255)',null,'NULL')
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:32:53 PM CET
|
||||
UPDATE AD_Column SET FieldLength=255,Updated=TO_TIMESTAMP('2022-01-10 20:32:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=10026
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:32:55 PM CET
|
||||
INSERT INTO t_alter_column values('c_bankstatementline','EftTrxType','VARCHAR(255)',null,'NULL')
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:33:49 PM CET
|
||||
UPDATE AD_Column SET FieldLength=255,Updated=TO_TIMESTAMP('2022-01-10 20:33:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=10017
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:33:50 PM CET
|
||||
INSERT INTO t_alter_column values('i_bankstatement','EftReference','VARCHAR(255)',null,'NULL')
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:33:56 PM CET
|
||||
UPDATE AD_Column SET FieldLength=255,Updated=TO_TIMESTAMP('2022-01-10 20:33:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=10339
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:33:57 PM CET
|
||||
INSERT INTO t_alter_column values('c_bankstatementline','EftReference','VARCHAR(255)',null,'NULL')
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:34:38 PM CET
|
||||
UPDATE AD_Column SET FieldLength=255,Updated=TO_TIMESTAMP('2022-01-10 20:34:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=9290
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:34:40 PM CET
|
||||
INSERT INTO t_alter_column values('i_bankstatement','ReferenceNo','VARCHAR(255)',null,'NULL')
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:34:45 PM CET
|
||||
UPDATE AD_Column SET FieldLength=255,Updated=TO_TIMESTAMP('2022-01-10 20:34:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=8986
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 8:34:46 PM CET
|
||||
INSERT INTO t_alter_column values('c_bankstatementline','ReferenceNo','VARCHAR(255)',null,'NULL')
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 10:58:34 PM CET
|
||||
INSERT INTO AD_ToolBarButton (AD_Client_ID,AD_Org_ID,Created,CreatedBy,ComponentName,IsActive,AD_ToolBarButton_ID,Name,Updated,UpdatedBy,IsCustomization,AD_ToolBarButton_UU,"action",AD_Tab_ID,AD_Process_ID,SeqNo,EntityType) VALUES (0,0,TO_TIMESTAMP('2022-01-10 22:58:33','YYYY-MM-DD HH24:MI:SS'),100,'CreatePayment','Y',200116,'CreatePayment',TO_TIMESTAMP('2022-01-10 22:58:33','YYYY-MM-DD HH24:MI:SS'),100,'N','106df1bc-ac3b-44a6-92ba-ead2d2171155','W',328,257,10,'D')
|
||||
;
|
||||
|
||||
-- Jan 10, 2022, 11:10:31 PM CET
|
||||
UPDATE AD_ToolBarButton SET DisplayLogic='@Processed@=N',Updated=TO_TIMESTAMP('2022-01-10 23:10:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_ToolBarButton_ID=200116
|
||||
;
|
||||
|
||||
SELECT register_migration_script('202201102035_IDEMPIERE-5146.sql') FROM dual
|
||||
;
|
||||
|
|
@ -68,6 +68,8 @@ public class BankStatementPayment extends SvrProcess
|
|||
|
||||
if (Table_ID == X_I_BankStatement.Table_ID)
|
||||
return createPayment (new X_I_BankStatement(getCtx(), Record_ID, get_TrxName()));
|
||||
else if (Table_ID == MBankStatement.Table_ID)
|
||||
return createPayment (new MBankStatement(getCtx(), Record_ID, get_TrxName()));
|
||||
else if (Table_ID == MBankStatementLine.Table_ID)
|
||||
return createPayment (new MBankStatementLine(getCtx(), Record_ID, get_TrxName()));
|
||||
|
||||
|
@ -107,7 +109,28 @@ public class BankStatementPayment extends SvrProcess
|
|||
retString.append(" - @OverUnderAmt@=").append(payment.getOverUnderAmt());
|
||||
return retString.toString();
|
||||
} // createPayment - Import
|
||||
|
||||
|
||||
/**
|
||||
* Create Payment for Bank Statement
|
||||
* Process all lines with TrxAmt+Invoice+BP and no Payment
|
||||
* @param mBankStatement
|
||||
* @return Message
|
||||
* @throws Exception if not successful
|
||||
*/
|
||||
private String createPayment(MBankStatement bs) throws Exception {
|
||||
int count = 0;
|
||||
for (MBankStatementLine line : bs.getLines(false)) {
|
||||
if (line.getC_Payment_ID() == 0
|
||||
&& line.getTrxAmt().signum() > 0
|
||||
&& line.getC_Invoice_ID() > 0
|
||||
&& line.getC_BPartner_ID() > 0) {
|
||||
createPayment(line);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return String.valueOf(count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Payment for BankStatement
|
||||
* @param bsl bank statement Line
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.compiere.model.MBankAccount;
|
|||
import org.compiere.model.MBankStatement;
|
||||
import org.compiere.model.MBankStatementLine;
|
||||
import org.compiere.model.X_I_BankStatement;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
|
@ -96,7 +97,7 @@ public class ImportBankStatement extends SvrProcess
|
|||
{
|
||||
sql = new StringBuilder ("DELETE FROM I_BankStatement ")
|
||||
.append("WHERE I_IsImported='Y'").append (clientCheck);
|
||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
|
||||
if (log.isLoggable(Level.FINE)) log.fine("Delete Old Impored =" + no);
|
||||
}
|
||||
|
||||
|
@ -112,7 +113,7 @@ public class ImportBankStatement extends SvrProcess
|
|||
.append(" I_ErrorMsg = ' ',")
|
||||
.append(" I_IsImported = 'N' ")
|
||||
.append("WHERE I_IsImported<>'Y' OR I_IsImported IS NULL OR AD_Client_ID IS NULL OR AD_Org_ID IS NULL OR AD_Client_ID=0 OR AD_Org_ID=0");
|
||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
|
||||
if (log.isLoggable(Level.INFO)) log.info ("Reset=" + no);
|
||||
|
||||
sql = new StringBuilder ("UPDATE I_BankStatement o ")
|
||||
|
@ -120,7 +121,7 @@ public class ImportBankStatement extends SvrProcess
|
|||
.append("WHERE (AD_Org_ID IS NULL OR AD_Org_ID=0")
|
||||
.append(" OR EXISTS (SELECT * FROM AD_Org oo WHERE o.AD_Org_ID=oo.AD_Org_ID AND (oo.IsSummary='Y' OR oo.IsActive='N')))")
|
||||
.append(" AND I_IsImported<>'Y'").append (clientCheck);
|
||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
|
||||
if (no != 0)
|
||||
log.warning ("Invalid Org=" + no);
|
||||
|
||||
|
@ -134,13 +135,12 @@ public class ImportBankStatement extends SvrProcess
|
|||
.append(" AND a.AD_Client_ID=i.AD_Client_ID ")
|
||||
.append(" AND a.C_Bank_ID=b.C_Bank_ID ")
|
||||
.append(" AND a.AccountNo=i.BankAccountNo ")
|
||||
.append(" AND b.RoutingNo=i.RoutingNo ")
|
||||
.append(" OR b.SwiftCode=i.RoutingNo ")
|
||||
.append(" AND (b.RoutingNo=i.RoutingNo OR b.SwiftCode=i.RoutingNo) ")
|
||||
.append(") ")
|
||||
.append("WHERE i.C_BankAccount_ID IS NULL ")
|
||||
.append("AND i.I_IsImported<>'Y' ")
|
||||
.append("OR i.I_IsImported IS NULL").append(clientCheck);
|
||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
|
||||
if (no != 0)
|
||||
if (log.isLoggable(Level.INFO)) log.info("Bank Account (With Routing No)=" + no);
|
||||
//
|
||||
|
@ -157,7 +157,7 @@ public class ImportBankStatement extends SvrProcess
|
|||
.append("WHERE i.C_BankAccount_ID IS NULL ")
|
||||
.append("AND i.I_isImported<>'Y' ")
|
||||
.append("OR i.I_isImported IS NULL").append(clientCheck);
|
||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
|
||||
if (no != 0)
|
||||
if (log.isLoggable(Level.INFO)) log.info("Bank Account (Without Routing No)=" + no);
|
||||
//
|
||||
|
@ -168,7 +168,7 @@ public class ImportBankStatement extends SvrProcess
|
|||
.append("AND i.BankAccountNo IS NULL ")
|
||||
.append("AND i.I_isImported<>'Y' ")
|
||||
.append("OR i.I_isImported IS NULL").append(clientCheck);
|
||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
|
||||
if (no != 0)
|
||||
if (log.isLoggable(Level.INFO)) log.info("Bank Account=" + no);
|
||||
//
|
||||
|
@ -177,7 +177,7 @@ public class ImportBankStatement extends SvrProcess
|
|||
.append("WHERE C_BankAccount_ID IS NULL ")
|
||||
.append("AND I_isImported<>'Y' ")
|
||||
.append("OR I_isImported IS NULL").append(clientCheck);
|
||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
|
||||
if (no != 0)
|
||||
log.warning("Invalid Bank Account=" + no);
|
||||
|
||||
|
@ -187,7 +187,7 @@ public class ImportBankStatement extends SvrProcess
|
|||
.append(" WHERE i.ISO_Code=c.ISO_Code AND c.AD_Client_ID IN (0,i.AD_Client_ID)) ")
|
||||
.append("WHERE C_Currency_ID IS NULL")
|
||||
.append(" AND I_IsImported<>'Y'").append(clientCheck);
|
||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
|
||||
if (no != 0)
|
||||
if (log.isLoggable(Level.INFO)) log.info("Set Currency=" + no);
|
||||
//
|
||||
|
@ -195,7 +195,7 @@ public class ImportBankStatement extends SvrProcess
|
|||
.append("SET C_Currency_ID=(SELECT C_Currency_ID FROM C_BankAccount WHERE C_BankAccount_ID=i.C_BankAccount_ID) ")
|
||||
.append("WHERE i.C_Currency_ID IS NULL ")
|
||||
.append("AND i.ISO_Code IS NULL").append(clientCheck);
|
||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
|
||||
if (no != 0)
|
||||
if (log.isLoggable(Level.INFO)) log.info("Set Currency=" + no);
|
||||
//
|
||||
|
@ -204,7 +204,7 @@ public class ImportBankStatement extends SvrProcess
|
|||
.append("WHERE C_Currency_ID IS NULL ")
|
||||
.append("AND I_IsImported<>'E' ")
|
||||
.append(" AND I_IsImported<>'Y'").append(clientCheck);
|
||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
|
||||
if (no != 0)
|
||||
log.warning("Invalid Currency=" + no);
|
||||
|
||||
|
@ -214,7 +214,7 @@ public class ImportBankStatement extends SvrProcess
|
|||
.append("SET ChargeAmt=0 ")
|
||||
.append("WHERE ChargeAmt IS NULL ")
|
||||
.append("AND I_IsImported<>'Y'").append(clientCheck);
|
||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
|
||||
if (no != 0)
|
||||
if (log.isLoggable(Level.INFO)) log.info("Charge Amount=" + no);
|
||||
//
|
||||
|
@ -222,7 +222,7 @@ public class ImportBankStatement extends SvrProcess
|
|||
.append("SET InterestAmt=0 ")
|
||||
.append("WHERE InterestAmt IS NULL ")
|
||||
.append("AND I_IsImported<>'Y'").append(clientCheck);
|
||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
|
||||
if (no != 0)
|
||||
if (log.isLoggable(Level.INFO)) log.info("Interest Amount=" + no);
|
||||
//
|
||||
|
@ -230,7 +230,7 @@ public class ImportBankStatement extends SvrProcess
|
|||
.append("SET TrxAmt=StmtAmt - InterestAmt - ChargeAmt ")
|
||||
.append("WHERE TrxAmt IS NULL ")
|
||||
.append("AND I_IsImported<>'Y'").append(clientCheck);
|
||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
|
||||
if (no != 0)
|
||||
if (log.isLoggable(Level.INFO)) log.info("Transaction Amount=" + no);
|
||||
//
|
||||
|
@ -238,7 +238,7 @@ public class ImportBankStatement extends SvrProcess
|
|||
.append("SET I_isImported='E', I_ErrorMsg=I_ErrorMsg||'Err=Invalid Amount, ' ")
|
||||
.append("WHERE TrxAmt + ChargeAmt + InterestAmt <> StmtAmt ")
|
||||
.append("AND I_isImported<>'Y'").append(clientCheck);
|
||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
|
||||
if (no != 0)
|
||||
if (log.isLoggable(Level.INFO)) log.info("Invalid Amount=" + no);
|
||||
|
||||
|
@ -247,7 +247,7 @@ public class ImportBankStatement extends SvrProcess
|
|||
.append("SET ValutaDate=StatementLineDate ")
|
||||
.append("WHERE ValutaDate IS NULL ")
|
||||
.append("AND I_isImported<>'Y'").append(clientCheck);
|
||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
|
||||
if (no != 0)
|
||||
if (log.isLoggable(Level.INFO)) log.info("Valuta Date=" + no);
|
||||
|
||||
|
@ -262,7 +262,7 @@ public class ImportBankStatement extends SvrProcess
|
|||
.append(" AND p.C_Invoice_ID IS NOT NULL ")
|
||||
.append(" AND p.C_Invoice_ID<>i.C_Invoice_ID) ")
|
||||
.append(clientCheck);
|
||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
|
||||
if (no != 0)
|
||||
if (log.isLoggable(Level.INFO)) log.info("Payment<->Invoice Mismatch=" + no);
|
||||
|
||||
|
@ -277,7 +277,7 @@ public class ImportBankStatement extends SvrProcess
|
|||
.append(" AND p.C_BPartner_ID IS NOT NULL ")
|
||||
.append(" AND p.C_BPartner_ID<>i.C_BPartner_ID) ")
|
||||
.append(clientCheck);
|
||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
|
||||
if (no != 0)
|
||||
if (log.isLoggable(Level.INFO)) log.info("Payment<->BPartner Mismatch=" + no);
|
||||
|
||||
|
@ -292,7 +292,7 @@ public class ImportBankStatement extends SvrProcess
|
|||
.append(" AND v.C_BPartner_ID IS NOT NULL ")
|
||||
.append(" AND v.C_BPartner_ID<>i.C_BPartner_ID) ")
|
||||
.append(clientCheck);
|
||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
|
||||
if (no != 0)
|
||||
if (log.isLoggable(Level.INFO)) log.info("Invoice<->BPartner Mismatch=" + no);
|
||||
|
||||
|
@ -307,7 +307,7 @@ public class ImportBankStatement extends SvrProcess
|
|||
.append("WHERE p.C_Invoice_ID<>v.C_Invoice_ID")
|
||||
.append(" AND v.C_BPartner_ID<>p.C_BPartner_ID) ")
|
||||
.append(clientCheck);
|
||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
|
||||
if (no != 0)
|
||||
if (log.isLoggable(Level.INFO)) log.info("Invoice.BPartner<->Payment.BPartner Mismatch=" + no);
|
||||
|
||||
|
@ -503,6 +503,10 @@ public class ImportBankStatement extends SvrProcess
|
|||
imp.saveEx();
|
||||
noInsertLine++;
|
||||
lineNo += 10;
|
||||
} else {
|
||||
imp.setI_IsImported(false);
|
||||
imp.setI_ErrorMsg("Err=Error saving C_BankStatementLine -> "+ CLogger.retrieveErrorString(""));
|
||||
imp.save();
|
||||
}
|
||||
line = null;
|
||||
|
||||
|
@ -523,7 +527,7 @@ public class ImportBankStatement extends SvrProcess
|
|||
sql = new StringBuilder ("UPDATE I_BankStatement ")
|
||||
.append("SET I_IsImported='N', Updated=getDate() ")
|
||||
.append("WHERE I_IsImported<>'Y'").append(clientCheck);
|
||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
|
||||
addLog (0, null, new BigDecimal (no), "@Errors@");
|
||||
//
|
||||
addLog (0, null, new BigDecimal (noInsert), "@C_BankStatement_ID@: @Inserted@");
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.util.logging.Level;
|
|||
|
||||
import org.compiere.model.MBankStatementLoader;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -111,7 +112,7 @@ public class LoadBankStatement extends SvrProcess
|
|||
else
|
||||
{
|
||||
if (log.isLoggable(Level.INFO)) log.info("Imported=" + m_controller.getLoadCount());
|
||||
addLog (0, null, new BigDecimal (m_controller.getLoadCount()), "@Loaded@");
|
||||
addLog (0, null, new BigDecimal (m_controller.getLoadCount()), Msg.getMsg(m_ctx, "Inserted"));
|
||||
message = "@OK@";
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ public interface BankStatementLoaderInterface
|
|||
public String getLastErrorDescription();
|
||||
|
||||
/**
|
||||
* The last time this loader aquired bank statement data.
|
||||
* The last time this loader acquired bank statement data.
|
||||
* For OFX this is the <DTEND> value. This is generally only available\
|
||||
* after loadLines() has been called. If a specific loader class
|
||||
* does not provided this information it is allowed to return null
|
||||
|
|
|
@ -59,7 +59,7 @@ import org.compiere.util.Util;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -4096456424277340847L;
|
||||
private static final long serialVersionUID = 8482717913976119270L;
|
||||
|
||||
/** Number of statement lines imported */
|
||||
private int loadCount = 0;
|
||||
|
@ -81,6 +81,9 @@ import org.compiere.util.Util;
|
|||
|
||||
/** Map of currency ISO-Codes to lookup id */
|
||||
private HashMap<String,Integer> currencyMap;
|
||||
|
||||
/* Last saved line, to be retrieved on loaders */
|
||||
private X_I_BankStatement m_lastSavedLine;
|
||||
|
||||
/**
|
||||
* Create a Statement Loader
|
||||
|
@ -310,6 +313,7 @@ import org.compiere.util.Util;
|
|||
imp.setI_IsImported(false);
|
||||
|
||||
result = imp.save();
|
||||
m_lastSavedLine = imp;
|
||||
if (result)
|
||||
{
|
||||
loadCount ++;
|
||||
|
@ -320,7 +324,15 @@ import org.compiere.util.Util;
|
|||
}
|
||||
imp = null;
|
||||
return result;
|
||||
} // importLine
|
||||
} // saveLine
|
||||
|
||||
/**
|
||||
* Return the last saved line
|
||||
* @return
|
||||
*/
|
||||
public X_I_BankStatement getLastSavedLine() {
|
||||
return m_lastSavedLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the most recent error
|
||||
|
|
Loading…
Reference in New Issue