IDEMPIERE-764 Some tablenames starts with X whereas they have centralized IDs / ASU_1099Box

This commit is contained in:
Carlos Ruiz 2013-03-18 13:50:27 -05:00
parent aee784cc57
commit 8225c2a935
14 changed files with 450 additions and 135 deletions

View File

@ -1,4 +1,4 @@
CREATE OR REPLACE FUNCTION asu_get1099bucket (
CREATE OR REPLACE FUNCTION get1099bucket (
p_cbpartner_id IN NUMBER,
p_cut_date IN DATE,
p_bucket IN NUMBER
@ -7,7 +7,7 @@ CREATE OR REPLACE FUNCTION asu_get1099bucket (
IS
tmpvar NUMBER;
/******************************************************************************
NAME: asu_get1099bucket
NAME: get1099bucket
PURPOSE:
REVISIONS:
@ -26,10 +26,10 @@ BEGIN
) -- +API->AP Invoice / -APC->AP Credit Memo
)
INTO tmpvar
FROM C_INVOICE i, C_INVOICELINE il, ASU_1099BOX b, C_DOCTYPE dt
FROM C_INVOICE i, C_INVOICELINE il, C_1099BOX b, C_DOCTYPE dt
WHERE i.c_invoice_id = il.c_invoice_id
AND i.issotrx = 'N'
AND il.asu_1099box_id = b.asu_1099box_id
AND il.c_1099box_id = b.c_1099box_id
AND i.dateacct BETWEEN TRUNC (p_cut_date, 'YEAR') AND p_cut_date
AND c_bpartner_id = p_cbpartner_id
AND b.bucket = p_bucket
@ -37,6 +37,6 @@ BEGIN
AND i.docstatus IN ('CO', 'CL');
RETURN tmpvar;
END asu_get1099bucket;
END get1099bucket;
/

View File

@ -1,4 +1,4 @@
CREATE OR REPLACE FUNCTION asu_get1099bucket (
CREATE OR REPLACE FUNCTION get1099bucket (
p_cbpartner_id IN numeric,
p_cut_date IN timestamp with time zone,
p_bucket IN numeric
@ -9,7 +9,7 @@ $BODY$
DECLARE
tmpvar numeric;
/******************************************************************************
NAME: asu_get1099bucket
NAME: get1099bucket
PURPOSE:
REVISIONS:
@ -26,10 +26,10 @@ BEGIN
END)
) -- +API->AP Invoice / -APC->AP Credit Memo
INTO tmpvar
FROM C_INVOICE i, C_INVOICELINE il, ASU_1099BOX b, C_DOCTYPE dt
FROM C_INVOICE i, C_INVOICELINE il, C_1099BOX b, C_DOCTYPE dt
WHERE i.c_invoice_id = il.c_invoice_id
AND i.issotrx = 'N'
AND il.asu_1099box_id = b.asu_1099box_id
AND il.c_1099box_id = b.c_1099box_id
AND i.dateacct BETWEEN TRUNC (p_cut_date, 'YEAR') AND p_cut_date
AND c_bpartner_id = p_cbpartner_id
AND b.bucket = p_bucket

View File

@ -0,0 +1,162 @@
-- IDEMPIERE-764 Some tablenames starts with X whereas they have centralized IDs
ALTER TABLE C_INVOICELINE RENAME COLUMN ASU_1099BOX_ID TO C_1099BOX_ID
;
ALTER TABLE I_INVOICE RENAME COLUMN ASU_1099BOX_ID TO C_1099BOX_ID
;
ALTER TABLE I_INVOICE RENAME COLUMN ASU_1099BOX_VALUE TO C_1099BOX_VALUE
;
ALTER TABLE ASU_1099BOX RENAME TO C_1099BOX
;
ALTER TABLE C_1099BOX RENAME COLUMN ASU_1099BOX_ID TO C_1099BOX_ID
;
ALTER TABLE C_1099BOX RENAME COLUMN ASU_1099BOX_UU TO C_1099BOX_UU
;
-- Mar 18, 2013 1:26:33 PM COT
UPDATE AD_Sequence SET Description='Table C_1099Box', Name='C_1099Box',Updated=TO_DATE('2013-03-18 13:26:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Sequence_ID=200064
;
-- Mar 18, 2013 1:28:05 PM COT
UPDATE AD_Table SET TableName='C_1099Box',Updated=TO_DATE('2013-03-18 13:28:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=200069
;
-- Mar 18, 2013 1:28:22 PM COT
UPDATE AD_Element SET ColumnName='C_1099Box_ID',Updated=TO_DATE('2013-03-18 13:28:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=202246
;
-- Mar 18, 2013 1:28:23 PM COT
UPDATE AD_Column SET ColumnName='C_1099Box_ID', Name='1099 Box', Description=NULL, Help=NULL WHERE AD_Element_ID=202246
;
-- Mar 18, 2013 1:28:23 PM COT
UPDATE AD_Process_Para SET ColumnName='C_1099Box_ID', Name='1099 Box', Description=NULL, Help=NULL, AD_Element_ID=202246 WHERE UPPER(ColumnName)='C_1099BOX_ID' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Mar 18, 2013 1:28:23 PM COT
UPDATE AD_Process_Para SET ColumnName='C_1099Box_ID', Name='1099 Box', Description=NULL, Help=NULL WHERE AD_Element_ID=202246 AND IsCentrallyMaintained='Y'
;
-- Mar 18, 2013 1:28:23 PM COT
UPDATE AD_InfoColumn SET ColumnName='C_1099Box_ID', Name='1099 Box', Description=NULL, Help=NULL WHERE AD_Element_ID=202246 AND IsCentrallyMaintained='Y'
;
-- Mar 18, 2013 1:28:37 PM COT
UPDATE AD_Element SET ColumnName='C_1099Box_UU', Name='C_1099Box_UU', PrintName='C_1099Box_UU',Updated=TO_DATE('2013-03-18 13:28:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=202247
;
-- Mar 18, 2013 1:28:37 PM COT
UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=202247
;
-- Mar 18, 2013 1:28:37 PM COT
UPDATE AD_Column SET ColumnName='C_1099Box_UU', Name='C_1099Box_UU', Description=NULL, Help=NULL WHERE AD_Element_ID=202247
;
-- Mar 18, 2013 1:28:37 PM COT
UPDATE AD_Process_Para SET ColumnName='C_1099Box_UU', Name='C_1099Box_UU', Description=NULL, Help=NULL, AD_Element_ID=202247 WHERE UPPER(ColumnName)='C_1099BOX_UU' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Mar 18, 2013 1:28:37 PM COT
UPDATE AD_Process_Para SET ColumnName='C_1099Box_UU', Name='C_1099Box_UU', Description=NULL, Help=NULL WHERE AD_Element_ID=202247 AND IsCentrallyMaintained='Y'
;
-- Mar 18, 2013 1:28:37 PM COT
UPDATE AD_InfoColumn SET ColumnName='C_1099Box_UU', Name='C_1099Box_UU', Description=NULL, Help=NULL WHERE AD_Element_ID=202247 AND IsCentrallyMaintained='Y'
;
-- Mar 18, 2013 1:28:37 PM COT
UPDATE AD_Field SET Name='C_1099Box_UU', Description=NULL, Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=202247) AND IsCentrallyMaintained='Y'
;
-- Mar 18, 2013 1:28:37 PM COT
UPDATE AD_PrintFormatItem SET PrintName='C_1099Box_UU', Name='C_1099Box_UU' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=AD_PrintFormatItem.AD_Column_ID AND c.AD_Element_ID=202247)
;
-- Mar 18, 2013 1:28:43 PM COT
UPDATE AD_Element SET ColumnName='C_1099Box_Value',Updated=TO_DATE('2013-03-18 13:28:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=202251
;
-- Mar 18, 2013 1:28:43 PM COT
UPDATE AD_Column SET ColumnName='C_1099Box_Value', Name='1099 Box Value', Description=NULL, Help=NULL WHERE AD_Element_ID=202251
;
-- Mar 18, 2013 1:28:43 PM COT
UPDATE AD_Process_Para SET ColumnName='C_1099Box_Value', Name='1099 Box Value', Description=NULL, Help=NULL, AD_Element_ID=202251 WHERE UPPER(ColumnName)='C_1099BOX_VALUE' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Mar 18, 2013 1:28:43 PM COT
UPDATE AD_Process_Para SET ColumnName='C_1099Box_Value', Name='1099 Box Value', Description=NULL, Help=NULL WHERE AD_Element_ID=202251 AND IsCentrallyMaintained='Y'
;
-- Mar 18, 2013 1:28:43 PM COT
UPDATE AD_InfoColumn SET ColumnName='C_1099Box_Value', Name='1099 Box Value', Description=NULL, Help=NULL WHERE AD_Element_ID=202251 AND IsCentrallyMaintained='Y'
;
DROP FUNCTION asu_get1099bucket
;
CREATE OR REPLACE FUNCTION get1099bucket (
p_cbpartner_id IN NUMBER,
p_cut_date IN DATE,
p_bucket IN NUMBER
)
RETURN NUMBER
IS
tmpvar NUMBER;
/******************************************************************************
NAME: get1099bucket
PURPOSE:
REVISIONS:
Ver Date Author Description
--------- ---------- --------------- ------------------------------------
1.0 04/01/2008 Carlos Ruiz 1. Created this function.
******************************************************************************/
BEGIN
SELECT SUM ( (NVL (linenetamt, 0) + NVL (taxamt, 0))
* DECODE
(docbasetype,
'API', 1,
'APC', -1,
0
) -- +API->AP Invoice / -APC->AP Credit Memo
)
INTO tmpvar
FROM C_INVOICE i, C_INVOICELINE il, C_1099BOX b, C_DOCTYPE dt
WHERE i.c_invoice_id = il.c_invoice_id
AND i.issotrx = 'N'
AND il.c_1099box_id = b.c_1099box_id
AND i.dateacct BETWEEN TRUNC (p_cut_date, 'YEAR') AND p_cut_date
AND c_bpartner_id = p_cbpartner_id
AND b.bucket = p_bucket
AND i.c_doctype_id = dt.c_doctype_id
AND i.docstatus IN ('CO', 'CL');
RETURN tmpvar;
END get1099bucket;
/
-- Mar 18, 2013 1:41:45 PM COT
-- IDEMPIERE-764 Some tablenames starts with X whereas they have centralized IDs
UPDATE AD_Column SET IsSelectionColumn='N',Updated=TO_DATE('2013-03-18 13:41:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2813
;
-- Mar 18, 2013 1:42:12 PM COT
-- IDEMPIERE-764 Some tablenames starts with X whereas they have centralized IDs
UPDATE AD_Column SET IsSelectionColumn='Y',Updated=TO_DATE('2013-03-18 13:42:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4656
;
-- Mar 18, 2013 1:42:36 PM COT
-- IDEMPIERE-764 Some tablenames starts with X whereas they have centralized IDs
UPDATE AD_Process SET Classname='org.adempiere.process.Fill1099Extract',Updated=TO_DATE('2013-03-18 13:42:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=200034
;
SELECT register_migration_script('201303181330_IDEMPIERE-764.sql') FROM dual
;

View File

@ -0,0 +1,165 @@
-- IDEMPIERE-764 Some tablenames starts with X whereas they have centralized IDs
ALTER TABLE c_invoiceline RENAME asu_1099box_id TO c_1099box_id
;
ALTER TABLE i_invoice RENAME asu_1099box_id TO c_1099box_id
;
ALTER TABLE i_invoice RENAME asu_1099box_value TO c_1099box_value
;
ALTER TABLE asu_1099box RENAME TO c_1099box
;
ALTER TABLE c_1099box RENAME asu_1099box_id TO c_1099box_id
;
ALTER TABLE c_1099box RENAME asu_1099box_uu TO c_1099box_uu
;
-- Mar 18, 2013 1:26:33 PM COT
UPDATE AD_Sequence SET Description='Table C_1099Box', Name='C_1099Box',Updated=TO_TIMESTAMP('2013-03-18 13:26:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Sequence_ID=200064
;
-- Mar 18, 2013 1:28:05 PM COT
UPDATE AD_Table SET TableName='C_1099Box',Updated=TO_TIMESTAMP('2013-03-18 13:28:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=200069
;
-- Mar 18, 2013 1:28:22 PM COT
UPDATE AD_Element SET ColumnName='C_1099Box_ID',Updated=TO_TIMESTAMP('2013-03-18 13:28:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=202246
;
-- Mar 18, 2013 1:28:23 PM COT
UPDATE AD_Column SET ColumnName='C_1099Box_ID', Name='1099 Box', Description=NULL, Help=NULL WHERE AD_Element_ID=202246
;
-- Mar 18, 2013 1:28:23 PM COT
UPDATE AD_Process_Para SET ColumnName='C_1099Box_ID', Name='1099 Box', Description=NULL, Help=NULL, AD_Element_ID=202246 WHERE UPPER(ColumnName)='C_1099BOX_ID' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Mar 18, 2013 1:28:23 PM COT
UPDATE AD_Process_Para SET ColumnName='C_1099Box_ID', Name='1099 Box', Description=NULL, Help=NULL WHERE AD_Element_ID=202246 AND IsCentrallyMaintained='Y'
;
-- Mar 18, 2013 1:28:23 PM COT
UPDATE AD_InfoColumn SET ColumnName='C_1099Box_ID', Name='1099 Box', Description=NULL, Help=NULL WHERE AD_Element_ID=202246 AND IsCentrallyMaintained='Y'
;
-- Mar 18, 2013 1:28:37 PM COT
UPDATE AD_Element SET ColumnName='C_1099Box_UU', Name='C_1099Box_UU', PrintName='C_1099Box_UU',Updated=TO_TIMESTAMP('2013-03-18 13:28:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=202247
;
-- Mar 18, 2013 1:28:37 PM COT
UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=202247
;
-- Mar 18, 2013 1:28:37 PM COT
UPDATE AD_Column SET ColumnName='C_1099Box_UU', Name='C_1099Box_UU', Description=NULL, Help=NULL WHERE AD_Element_ID=202247
;
-- Mar 18, 2013 1:28:37 PM COT
UPDATE AD_Process_Para SET ColumnName='C_1099Box_UU', Name='C_1099Box_UU', Description=NULL, Help=NULL, AD_Element_ID=202247 WHERE UPPER(ColumnName)='C_1099BOX_UU' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Mar 18, 2013 1:28:37 PM COT
UPDATE AD_Process_Para SET ColumnName='C_1099Box_UU', Name='C_1099Box_UU', Description=NULL, Help=NULL WHERE AD_Element_ID=202247 AND IsCentrallyMaintained='Y'
;
-- Mar 18, 2013 1:28:37 PM COT
UPDATE AD_InfoColumn SET ColumnName='C_1099Box_UU', Name='C_1099Box_UU', Description=NULL, Help=NULL WHERE AD_Element_ID=202247 AND IsCentrallyMaintained='Y'
;
-- Mar 18, 2013 1:28:37 PM COT
UPDATE AD_Field SET Name='C_1099Box_UU', Description=NULL, Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=202247) AND IsCentrallyMaintained='Y'
;
-- Mar 18, 2013 1:28:37 PM COT
UPDATE AD_PrintFormatItem SET PrintName='C_1099Box_UU', Name='C_1099Box_UU' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=AD_PrintFormatItem.AD_Column_ID AND c.AD_Element_ID=202247)
;
-- Mar 18, 2013 1:28:43 PM COT
UPDATE AD_Element SET ColumnName='C_1099Box_Value',Updated=TO_TIMESTAMP('2013-03-18 13:28:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=202251
;
-- Mar 18, 2013 1:28:43 PM COT
UPDATE AD_Column SET ColumnName='C_1099Box_Value', Name='1099 Box Value', Description=NULL, Help=NULL WHERE AD_Element_ID=202251
;
-- Mar 18, 2013 1:28:43 PM COT
UPDATE AD_Process_Para SET ColumnName='C_1099Box_Value', Name='1099 Box Value', Description=NULL, Help=NULL, AD_Element_ID=202251 WHERE UPPER(ColumnName)='C_1099BOX_VALUE' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Mar 18, 2013 1:28:43 PM COT
UPDATE AD_Process_Para SET ColumnName='C_1099Box_Value', Name='1099 Box Value', Description=NULL, Help=NULL WHERE AD_Element_ID=202251 AND IsCentrallyMaintained='Y'
;
-- Mar 18, 2013 1:28:43 PM COT
UPDATE AD_InfoColumn SET ColumnName='C_1099Box_Value', Name='1099 Box Value', Description=NULL, Help=NULL WHERE AD_Element_ID=202251 AND IsCentrallyMaintained='Y'
;
DROP FUNCTION asu_get1099bucket (in p_cbpartner_id numeric, in p_cut_date timestamptz, in p_bucket numeric)
;
CREATE OR REPLACE FUNCTION get1099bucket (
p_cbpartner_id IN numeric,
p_cut_date IN timestamp with time zone,
p_bucket IN numeric
)
RETURNS numeric
AS
$BODY$
DECLARE
tmpvar numeric;
/******************************************************************************
NAME: get1099bucket
PURPOSE:
REVISIONS:
Ver Date Author Description
--------- ---------- --------------- ------------------------------------
1.0 04/01/2008 Carlos Ruiz 1. Created this function.
******************************************************************************/
BEGIN
SELECT SUM ( (COALESCE (linenetamt, 0) + COALESCE (taxamt, 0))
* (CASE WHEN docbasetype = 'API' THEN 1
WHEN docbasetype = 'APC' THEN -1
ELSE 0
END)
) -- +API->AP Invoice / -APC->AP Credit Memo
INTO tmpvar
FROM C_INVOICE i, C_INVOICELINE il, C_1099BOX b, C_DOCTYPE dt
WHERE i.c_invoice_id = il.c_invoice_id
AND i.issotrx = 'N'
AND il.c_1099box_id = b.c_1099box_id
AND i.dateacct BETWEEN TRUNC (p_cut_date, 'YEAR') AND p_cut_date
AND c_bpartner_id = p_cbpartner_id
AND b.bucket = p_bucket
AND i.c_doctype_id = dt.c_doctype_id
AND i.docstatus IN ('CO', 'CL');
RETURN tmpvar;
END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100
;
-- Mar 18, 2013 1:41:45 PM COT
-- IDEMPIERE-764 Some tablenames starts with X whereas they have centralized IDs
UPDATE AD_Column SET IsSelectionColumn='N',Updated=TO_TIMESTAMP('2013-03-18 13:41:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2813
;
-- Mar 18, 2013 1:42:12 PM COT
-- IDEMPIERE-764 Some tablenames starts with X whereas they have centralized IDs
UPDATE AD_Column SET IsSelectionColumn='Y',Updated=TO_TIMESTAMP('2013-03-18 13:42:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4656
;
-- Mar 18, 2013 1:42:36 PM COT
-- IDEMPIERE-764 Some tablenames starts with X whereas they have centralized IDs
UPDATE AD_Process SET Classname='org.adempiere.process.Fill1099Extract',Updated=TO_TIMESTAMP('2013-03-18 13:42:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=200034
;
SELECT register_migration_script('201303181330_IDEMPIERE-764.sql') FROM dual
;

View File

@ -478,19 +478,19 @@ public class ImportInvoice extends SvrProcess
// Set 1099 Box
sql = new StringBuilder ("UPDATE I_Invoice o ")
.append("SET ASU_1099Box_ID=(SELECT ASU_1099Box_ID FROM ASU_1099Box a")
.append(" WHERE o.ASU_1099Box_Value=a.Value AND a.AD_Client_ID = o.AD_Client_ID) ")
.append(" WHERE ASU_1099Box_ID IS NULL and ASU_1099Box_Value IS NOT NULL")
.append("SET C_1099Box_ID=(SELECT C_1099Box_ID FROM C_1099Box a")
.append(" WHERE o.C_1099Box_Value=a.Value AND a.AD_Client_ID = o.AD_Client_ID) ")
.append(" WHERE C_1099Box_ID IS NULL and C_1099Box_Value IS NOT NULL")
.append(" AND I_IsImported<>'Y' AND IsSOTrx='N'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set ASU_1099Box_ID=" + no);
log.fine("Set C_1099Box_ID=" + no);
sql = new StringBuilder ("UPDATE I_Invoice ")
.append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid ASU_1099Box_Value, ' ")
.append("WHERE ASU_1099Box_ID IS NULL AND (ASU_1099Box_Value IS NOT NULL)")
.append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid C_1099Box_Value, ' ")
.append("WHERE C_1099Box_ID IS NULL AND (C_1099Box_Value IS NOT NULL)")
.append(" AND I_IsImported<>'Y' AND IsSOTrx='N'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0)
log.warning ("Invalid ASU_1099Box_Value=" + no);
log.warning ("Invalid C_1099Box_Value=" + no);
commitEx();

View File

@ -23,11 +23,11 @@ import org.compiere.process.SvrProcess;
import org.compiere.util.*;
/**
* ASU - Fill 1099 Extract
* Fill 1099 Extract
* @author Carlos Ruiz
* @version $Id: ASU_Fill1099Extract.java
* @version $Id: Fill1099Extract.java
*/
public class ASU_Fill1099Extract extends SvrProcess
public class Fill1099Extract extends SvrProcess
{
private Timestamp p_Cut_Date = null;
@ -58,7 +58,7 @@ public class ASU_Fill1099Extract extends SvrProcess
*/
protected String doIt() throws Exception
{
log.info("CUT_DATE=" + p_Cut_Date);
if (log.isLoggable(Level.INFO)) log.info("CUT_DATE=" + p_Cut_Date);
int AD_PInstance_ID = getAD_PInstance_ID();
//
StringBuilder sql = new StringBuilder();
@ -81,22 +81,22 @@ public class ASU_Fill1099Extract extends SvrProcess
sql.append("date_part('year', ?::timestamp), trunc(?::timestamp),");
else
sql.append("EXTRACT(year from ?), TRUNC (?), ");
sql.append("asu_get1099bucket (bp.c_bpartner_id, ?, 1), ");
sql.append("asu_get1099bucket (bp.c_bpartner_id, ?, 2), ");
sql.append("asu_get1099bucket (bp.c_bpartner_id, ?, 3), ");
sql.append("asu_get1099bucket (bp.c_bpartner_id, ?, 4), ");
sql.append("asu_get1099bucket (bp.c_bpartner_id, ?, 5), ");
sql.append("asu_get1099bucket (bp.c_bpartner_id, ?, 6), ");
sql.append("asu_get1099bucket (bp.c_bpartner_id, ?, 7), ");
sql.append("asu_get1099bucket (bp.c_bpartner_id, ?, 8), ");
sql.append("asu_get1099bucket (bp.c_bpartner_id, ?, 9), ");
sql.append("asu_get1099bucket (bp.c_bpartner_id, ?, 10), ");
sql.append("asu_get1099bucket (bp.c_bpartner_id, ?, 11), ");
sql.append("asu_get1099bucket (bp.c_bpartner_id, ?, 12), ");
sql.append("asu_get1099bucket (bp.c_bpartner_id, ?, 13), ");
sql.append("asu_get1099bucket (bp.c_bpartner_id, ?, 14), ");
sql.append("asu_get1099bucket (bp.c_bpartner_id, ?, 15), ");
sql.append("asu_get1099bucket (bp.c_bpartner_id, ?, 16) ");
sql.append("get1099bucket (bp.c_bpartner_id, ?, 1), ");
sql.append("get1099bucket (bp.c_bpartner_id, ?, 2), ");
sql.append("get1099bucket (bp.c_bpartner_id, ?, 3), ");
sql.append("get1099bucket (bp.c_bpartner_id, ?, 4), ");
sql.append("get1099bucket (bp.c_bpartner_id, ?, 5), ");
sql.append("get1099bucket (bp.c_bpartner_id, ?, 6), ");
sql.append("get1099bucket (bp.c_bpartner_id, ?, 7), ");
sql.append("get1099bucket (bp.c_bpartner_id, ?, 8), ");
sql.append("get1099bucket (bp.c_bpartner_id, ?, 9), ");
sql.append("get1099bucket (bp.c_bpartner_id, ?, 10), ");
sql.append("get1099bucket (bp.c_bpartner_id, ?, 11), ");
sql.append("get1099bucket (bp.c_bpartner_id, ?, 12), ");
sql.append("get1099bucket (bp.c_bpartner_id, ?, 13), ");
sql.append("get1099bucket (bp.c_bpartner_id, ?, 14), ");
sql.append("get1099bucket (bp.c_bpartner_id, ?, 15), ");
sql.append("get1099bucket (bp.c_bpartner_id, ?, 16) ");
sql.append("FROM c_bpartner bp, c_bpartner_location bpl "); //Yvonne: added C_BPARTNER_LOCATION bpl
sql.append("WHERE bp.c_bpartner_id = bpl.c_bpartner_id "); //Yvonne: added
sql.append("AND bp.isactive = 'Y' ");
@ -111,14 +111,14 @@ public class ASU_Fill1099Extract extends SvrProcess
sql.append(" AND i.docstatus IN ('CO', 'CL') ");
sql.append(" AND i.ad_client_id = ? ");
sql.append(" AND i.ispaid = 'Y' "); //Yvonne 16/02/2009: only those which have been paid
sql.append(" AND il.asu_1099box_id IS NOT NULL ");
sql.append(" AND il.c_1099box_id IS NOT NULL ");
sql.append(" AND i.dateacct BETWEEN ");
if (DB.isPostgreSQL())
sql.append("date_trunc('year', ?::timestamp) ");
else
sql.append("TRUNC (?, 'YEAR') ");
sql.append("AND ?) ");
log.finest(sql.toString());
if (log.isLoggable(Level.FINEST)) log.finest(sql.toString());
PreparedStatement pstmt = null;
//
@ -150,27 +150,15 @@ public class ASU_Fill1099Extract extends SvrProcess
pstmt.setTimestamp(23, p_Cut_Date);
int rows = pstmt.executeUpdate();
log.info("inserted rows=" + rows);
pstmt.close();
if (log.isLoggable(Level.INFO)) log.info("inserted rows=" + rows);
}
finally
{
DB.close(pstmt);
pstmt = null;
}
catch (Exception e)
{
log.log(Level.SEVERE, sql.toString(), e);
}
try
{
if (pstmt != null)
pstmt.close();
pstmt = null;
}
catch (Exception e)
{
pstmt = null;
}
//
return "";
} // doIt
} // ASU_Fill1099Extract
} // Fill1099Extract

View File

@ -20,15 +20,15 @@ import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.util.KeyNamePair;
/** Generated Interface for ASU_1099Box
/** Generated Interface for C_1099Box
* @author iDempiere (generated)
* @version Release 1.0a
*/
public interface I_ASU_1099Box
public interface I_C_1099Box
{
/** TableName=ASU_1099Box */
public static final String Table_Name = "ASU_1099Box";
/** TableName=C_1099Box */
public static final String Table_Name = "C_1099Box";
/** AD_Table_ID=200069 */
public static final int Table_ID = 200069;
@ -62,23 +62,23 @@ public interface I_ASU_1099Box
*/
public int getAD_Org_ID();
/** Column name ASU_1099Box_ID */
public static final String COLUMNNAME_ASU_1099Box_ID = "ASU_1099Box_ID";
/** Column name C_1099Box_ID */
public static final String COLUMNNAME_C_1099Box_ID = "C_1099Box_ID";
/** Set 1099 Box */
public void setASU_1099Box_ID (int ASU_1099Box_ID);
public void setC_1099Box_ID (int C_1099Box_ID);
/** Get 1099 Box */
public int getASU_1099Box_ID();
public int getC_1099Box_ID();
/** Column name ASU_1099Box_UU */
public static final String COLUMNNAME_ASU_1099Box_UU = "ASU_1099Box_UU";
/** Column name C_1099Box_UU */
public static final String COLUMNNAME_C_1099Box_UU = "C_1099Box_UU";
/** Set ASU_1099Box_UU */
public void setASU_1099Box_UU (String ASU_1099Box_UU);
/** Set C_1099Box_UU */
public void setC_1099Box_UU (String C_1099Box_UU);
/** Get ASU_1099Box_UU */
public String getASU_1099Box_UU();
/** Get C_1099Box_UU */
public String getC_1099Box_UU();
/** Column name Bucket */
public static final String COLUMNNAME_Bucket = "Bucket";

View File

@ -269,7 +269,7 @@ public interface I_C_BPartner
/** Get Default 1099 Box */
public int getDefault1099Box_ID();
public org.compiere.model.I_ASU_1099Box getDefault1099Box() throws RuntimeException;
public org.compiere.model.I_C_1099Box getDefault1099Box() throws RuntimeException;
/** Column name DeliveryRule */
public static final String COLUMNNAME_DeliveryRule = "DeliveryRule";

View File

@ -132,16 +132,16 @@ public interface I_C_InvoiceLine
*/
public int getAD_OrgTrx_ID();
/** Column name ASU_1099Box_ID */
public static final String COLUMNNAME_ASU_1099Box_ID = "ASU_1099Box_ID";
/** Column name C_1099Box_ID */
public static final String COLUMNNAME_C_1099Box_ID = "C_1099Box_ID";
/** Set 1099 Box */
public void setASU_1099Box_ID (int ASU_1099Box_ID);
public void setC_1099Box_ID (int C_1099Box_ID);
/** Get 1099 Box */
public int getASU_1099Box_ID();
public int getC_1099Box_ID();
public org.compiere.model.I_ASU_1099Box getASU_1099Box() throws RuntimeException;
public org.compiere.model.I_C_1099Box getC_1099Box() throws RuntimeException;
/** Column name C_Activity_ID */
public static final String COLUMNNAME_C_Activity_ID = "C_Activity_ID";

View File

@ -129,25 +129,25 @@ public interface I_I_Invoice
*/
public String getAddress2();
/** Column name ASU_1099Box_ID */
public static final String COLUMNNAME_ASU_1099Box_ID = "ASU_1099Box_ID";
/** Column name C_1099Box_ID */
public static final String COLUMNNAME_C_1099Box_ID = "C_1099Box_ID";
/** Set 1099 Box */
public void setASU_1099Box_ID (int ASU_1099Box_ID);
public void setC_1099Box_ID (int C_1099Box_ID);
/** Get 1099 Box */
public int getASU_1099Box_ID();
public int getC_1099Box_ID();
public org.compiere.model.I_ASU_1099Box getASU_1099Box() throws RuntimeException;
public org.compiere.model.I_C_1099Box getC_1099Box() throws RuntimeException;
/** Column name ASU_1099Box_Value */
public static final String COLUMNNAME_ASU_1099Box_Value = "ASU_1099Box_Value";
/** Column name C_1099Box_Value */
public static final String COLUMNNAME_C_1099Box_Value = "C_1099Box_Value";
/** Set 1099 Box Value */
public void setASU_1099Box_Value (String ASU_1099Box_Value);
public void setC_1099Box_Value (String C_1099Box_Value);
/** Get 1099 Box Value */
public String getASU_1099Box_Value();
public String getC_1099Box_Value();
/** Column name BPartnerValue */
public static final String COLUMNNAME_BPartnerValue = "BPartnerValue";

View File

@ -21,10 +21,10 @@ import java.sql.ResultSet;
import java.util.Properties;
import org.compiere.util.KeyNamePair;
/** Generated Model for ASU_1099Box
/** Generated Model for C_1099Box
* @author iDempiere (generated)
* @version Release 1.0a - $Id$ */
public class X_ASU_1099Box extends PO implements I_ASU_1099Box, I_Persistent
public class X_C_1099Box extends PO implements I_C_1099Box, I_Persistent
{
/**
@ -33,12 +33,12 @@ public class X_ASU_1099Box extends PO implements I_ASU_1099Box, I_Persistent
private static final long serialVersionUID = 20130228L;
/** Standard Constructor */
public X_ASU_1099Box (Properties ctx, int ASU_1099Box_ID, String trxName)
public X_C_1099Box (Properties ctx, int C_1099Box_ID, String trxName)
{
super (ctx, ASU_1099Box_ID, trxName);
/** if (ASU_1099Box_ID == 0)
super (ctx, C_1099Box_ID, trxName);
/** if (C_1099Box_ID == 0)
{
setASU_1099Box_ID (0);
setC_1099Box_ID (0);
setBucket (0);
setName (null);
setValue (null);
@ -46,7 +46,7 @@ public class X_ASU_1099Box extends PO implements I_ASU_1099Box, I_Persistent
}
/** Load Constructor */
public X_ASU_1099Box (Properties ctx, ResultSet rs, String trxName)
public X_C_1099Box (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
@ -68,43 +68,43 @@ public class X_ASU_1099Box extends PO implements I_ASU_1099Box, I_Persistent
public String toString()
{
StringBuffer sb = new StringBuffer ("X_ASU_1099Box[")
StringBuffer sb = new StringBuffer ("X_C_1099Box[")
.append(get_ID()).append("]");
return sb.toString();
}
/** Set 1099 Box.
@param ASU_1099Box_ID 1099 Box */
public void setASU_1099Box_ID (int ASU_1099Box_ID)
@param C_1099Box_ID 1099 Box */
public void setC_1099Box_ID (int C_1099Box_ID)
{
if (ASU_1099Box_ID < 1)
set_ValueNoCheck (COLUMNNAME_ASU_1099Box_ID, null);
if (C_1099Box_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_1099Box_ID, null);
else
set_ValueNoCheck (COLUMNNAME_ASU_1099Box_ID, Integer.valueOf(ASU_1099Box_ID));
set_ValueNoCheck (COLUMNNAME_C_1099Box_ID, Integer.valueOf(C_1099Box_ID));
}
/** Get 1099 Box.
@return 1099 Box */
public int getASU_1099Box_ID ()
public int getC_1099Box_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_ASU_1099Box_ID);
Integer ii = (Integer)get_Value(COLUMNNAME_C_1099Box_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set ASU_1099Box_UU.
@param ASU_1099Box_UU ASU_1099Box_UU */
public void setASU_1099Box_UU (String ASU_1099Box_UU)
/** Set C_1099Box_UU.
@param C_1099Box_UU C_1099Box_UU */
public void setC_1099Box_UU (String C_1099Box_UU)
{
set_Value (COLUMNNAME_ASU_1099Box_UU, ASU_1099Box_UU);
set_Value (COLUMNNAME_C_1099Box_UU, C_1099Box_UU);
}
/** Get ASU_1099Box_UU.
@return ASU_1099Box_UU */
public String getASU_1099Box_UU ()
/** Get C_1099Box_UU.
@return C_1099Box_UU */
public String getC_1099Box_UU ()
{
return (String)get_Value(COLUMNNAME_ASU_1099Box_UU);
return (String)get_Value(COLUMNNAME_C_1099Box_UU);
}
/** Set Bucket.

View File

@ -406,9 +406,9 @@ public class X_C_BPartner extends PO implements I_C_BPartner, I_Persistent
return (String)get_Value(COLUMNNAME_CustomerProfileID);
}
public org.compiere.model.I_ASU_1099Box getDefault1099Box() throws RuntimeException
public org.compiere.model.I_C_1099Box getDefault1099Box() throws RuntimeException
{
return (org.compiere.model.I_ASU_1099Box)MTable.get(getCtx(), org.compiere.model.I_ASU_1099Box.Table_Name)
return (org.compiere.model.I_C_1099Box)MTable.get(getCtx(), org.compiere.model.I_C_1099Box.Table_Name)
.getPO(getDefault1099Box_ID(), get_TrxName()); }
/** Set Default 1099 Box.

View File

@ -234,26 +234,26 @@ public class X_C_InvoiceLine extends PO implements I_C_InvoiceLine, I_Persistent
return ii.intValue();
}
public org.compiere.model.I_ASU_1099Box getASU_1099Box() throws RuntimeException
public org.compiere.model.I_C_1099Box getC_1099Box() throws RuntimeException
{
return (org.compiere.model.I_ASU_1099Box)MTable.get(getCtx(), org.compiere.model.I_ASU_1099Box.Table_Name)
.getPO(getASU_1099Box_ID(), get_TrxName()); }
return (org.compiere.model.I_C_1099Box)MTable.get(getCtx(), org.compiere.model.I_C_1099Box.Table_Name)
.getPO(getC_1099Box_ID(), get_TrxName()); }
/** Set 1099 Box.
@param ASU_1099Box_ID 1099 Box */
public void setASU_1099Box_ID (int ASU_1099Box_ID)
@param C_1099Box_ID 1099 Box */
public void setC_1099Box_ID (int C_1099Box_ID)
{
if (ASU_1099Box_ID < 1)
set_Value (COLUMNNAME_ASU_1099Box_ID, null);
if (C_1099Box_ID < 1)
set_Value (COLUMNNAME_C_1099Box_ID, null);
else
set_Value (COLUMNNAME_ASU_1099Box_ID, Integer.valueOf(ASU_1099Box_ID));
set_Value (COLUMNNAME_C_1099Box_ID, Integer.valueOf(C_1099Box_ID));
}
/** Get 1099 Box.
@return 1099 Box */
public int getASU_1099Box_ID ()
public int getC_1099Box_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_ASU_1099Box_ID);
Integer ii = (Integer)get_Value(COLUMNNAME_C_1099Box_ID);
if (ii == null)
return 0;
return ii.intValue();

View File

@ -175,43 +175,43 @@ public class X_I_Invoice extends PO implements I_I_Invoice, I_Persistent
return (String)get_Value(COLUMNNAME_Address2);
}
public org.compiere.model.I_ASU_1099Box getASU_1099Box() throws RuntimeException
public org.compiere.model.I_C_1099Box getC_1099Box() throws RuntimeException
{
return (org.compiere.model.I_ASU_1099Box)MTable.get(getCtx(), org.compiere.model.I_ASU_1099Box.Table_Name)
.getPO(getASU_1099Box_ID(), get_TrxName()); }
return (org.compiere.model.I_C_1099Box)MTable.get(getCtx(), org.compiere.model.I_C_1099Box.Table_Name)
.getPO(getC_1099Box_ID(), get_TrxName()); }
/** Set 1099 Box.
@param ASU_1099Box_ID 1099 Box */
public void setASU_1099Box_ID (int ASU_1099Box_ID)
@param C_1099Box_ID 1099 Box */
public void setC_1099Box_ID (int C_1099Box_ID)
{
if (ASU_1099Box_ID < 1)
set_Value (COLUMNNAME_ASU_1099Box_ID, null);
if (C_1099Box_ID < 1)
set_Value (COLUMNNAME_C_1099Box_ID, null);
else
set_Value (COLUMNNAME_ASU_1099Box_ID, Integer.valueOf(ASU_1099Box_ID));
set_Value (COLUMNNAME_C_1099Box_ID, Integer.valueOf(C_1099Box_ID));
}
/** Get 1099 Box.
@return 1099 Box */
public int getASU_1099Box_ID ()
public int getC_1099Box_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_ASU_1099Box_ID);
Integer ii = (Integer)get_Value(COLUMNNAME_C_1099Box_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set 1099 Box Value.
@param ASU_1099Box_Value 1099 Box Value */
public void setASU_1099Box_Value (String ASU_1099Box_Value)
@param C_1099Box_Value 1099 Box Value */
public void setC_1099Box_Value (String C_1099Box_Value)
{
set_Value (COLUMNNAME_ASU_1099Box_Value, ASU_1099Box_Value);
set_Value (COLUMNNAME_C_1099Box_Value, C_1099Box_Value);
}
/** Get 1099 Box Value.
@return 1099 Box Value */
public String getASU_1099Box_Value ()
public String getC_1099Box_Value ()
{
return (String)get_Value(COLUMNNAME_ASU_1099Box_Value);
return (String)get_Value(COLUMNNAME_C_1099Box_Value);
}
/** Set Business Partner Key.