IDEMPIERE-376 Limit charges to use just one account / Thanks to David Peñuela

This commit is contained in:
Carlos Ruiz 2012-08-17 11:05:38 -05:00
parent 3c3b264887
commit 1302d6b348
16 changed files with 325 additions and 139 deletions

View File

@ -0,0 +1,111 @@
-- Aug 16, 2012 11:44:05 AM COT
-- IDEMPIERE-879 Change to one account
UPDATE AD_Element SET Name='Charge Revenue (Deprecated)',Updated=TO_DATE('2012-08-16 11:44:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Element_ID=1388
;
-- Aug 16, 2012 11:44:05 AM COT
UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=1388
;
-- Aug 16, 2012 11:44:05 AM COT
UPDATE AD_Column SET ColumnName='Ch_Revenue_Acct', Name='Charge Revenue (Deprecated)', Description='Charge Revenue Account', Help='The Charge Revenue Account identifies the account to use when recording charges paid by customers.' WHERE AD_Element_ID=1388
;
-- Aug 16, 2012 11:44:05 AM COT
UPDATE AD_Process_Para SET ColumnName='Ch_Revenue_Acct', Name='Charge Revenue (Deprecated)', Description='Charge Revenue Account', Help='The Charge Revenue Account identifies the account to use when recording charges paid by customers.', AD_Element_ID=1388 WHERE UPPER(ColumnName)='CH_REVENUE_ACCT' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Aug 16, 2012 11:44:05 AM COT
UPDATE AD_Process_Para SET ColumnName='Ch_Revenue_Acct', Name='Charge Revenue (Deprecated)', Description='Charge Revenue Account', Help='The Charge Revenue Account identifies the account to use when recording charges paid by customers.' WHERE AD_Element_ID=1388 AND IsCentrallyMaintained='Y'
;
-- Aug 16, 2012 11:44:05 AM COT
UPDATE AD_Field SET Name='Charge Revenue (Deprecated)', Description='Charge Revenue Account', Help='The Charge Revenue Account identifies the account to use when recording charges paid by customers.' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=1388) AND IsCentrallyMaintained='Y'
;
-- Aug 16, 2012 11:44:05 AM COT
UPDATE AD_PrintFormatItem pi SET PrintName='Charge Revenue', Name='Charge Revenue (Deprecated)' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=1388)
;
-- Aug 17, 2012 9:37:01 AM COT
UPDATE AD_Element SET Help='The Charge Account identifies the account to use when recording charges', Name='Charge Account', Description='Charge Account', PrintName='Charge Account',Updated=TO_DATE('2012-08-17 09:37:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=1387
;
-- Aug 17, 2012 9:37:02 AM COT
UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=1387
;
-- Aug 17, 2012 9:37:02 AM COT
UPDATE AD_Column SET ColumnName='Ch_Expense_Acct', Name='Charge Account', Description='Charge Account', Help='The Charge Account identifies the account to use when recording charges' WHERE AD_Element_ID=1387
;
-- Aug 17, 2012 9:37:02 AM COT
UPDATE AD_Process_Para SET ColumnName='Ch_Expense_Acct', Name='Charge Account', Description='Charge Account', Help='The Charge Account identifies the account to use when recording charges', AD_Element_ID=1387 WHERE UPPER(ColumnName)='CH_EXPENSE_ACCT' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Aug 17, 2012 9:37:02 AM COT
UPDATE AD_Process_Para SET ColumnName='Ch_Expense_Acct', Name='Charge Account', Description='Charge Account', Help='The Charge Account identifies the account to use when recording charges' WHERE AD_Element_ID=1387 AND IsCentrallyMaintained='Y'
;
-- Aug 17, 2012 9:37:02 AM COT
UPDATE AD_Field SET Name='Charge Account', Description='Charge Account', Help='The Charge Account identifies the account to use when recording charges' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=1387) AND IsCentrallyMaintained='Y'
;
-- Aug 17, 2012 9:37:02 AM COT
UPDATE AD_PrintFormatItem pi SET PrintName='Charge Account', Name='Charge Account' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=1387)
;
-- Aug 17, 2012 9:39:00 AM COT
UPDATE AD_Column SET IsMandatory='N',Updated=TO_DATE('2012-08-17 09:39:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4871
;
-- Aug 17, 2012 9:39:05 AM COT
ALTER TABLE C_AcctSchema_Default MODIFY Ch_Revenue_Acct NUMBER(10) DEFAULT NULL
;
-- Aug 17, 2012 9:39:05 AM COT
ALTER TABLE C_AcctSchema_Default MODIFY Ch_Revenue_Acct NULL
;
-- Aug 17, 2012 9:39:11 AM COT
UPDATE AD_Column SET IsActive='N',Updated=TO_DATE('2012-08-17 09:39:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4871
;
-- Aug 17, 2012 9:39:47 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2012-08-17 09:39:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3852
;
-- Aug 17, 2012 9:40:09 AM COT
UPDATE AD_Column SET IsMandatory='N',Updated=TO_DATE('2012-08-17 09:40:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=5013
;
-- Aug 17, 2012 9:40:13 AM COT
ALTER TABLE C_Charge_Acct MODIFY Ch_Revenue_Acct NUMBER(10) DEFAULT NULL
;
-- Aug 17, 2012 9:40:13 AM COT
ALTER TABLE C_Charge_Acct MODIFY Ch_Revenue_Acct NULL
;
-- Aug 17, 2012 9:40:18 AM COT
UPDATE AD_Column SET IsActive='N',Updated=TO_DATE('2012-08-17 09:40:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=5013
;
-- Aug 17, 2012 9:40:38 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2012-08-17 09:40:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4064
;
update c_charge_acct set ch_revenue_acct=NULL WHERE AD_Client_ID=11;
update c_acctschema_default set ch_revenue_acct=NULL WHERE AD_Client_ID=11;
ALTER TABLE c_charge_acct DROP CONSTRAINT vc_chrevenue_ccharge;
ALTER TABLE c_acctschema_default DROP CONSTRAINT vc_chrevenue_cschemadefault;
UPDATE AD_System
SET LastMigrationScriptApplied='879_IDEMPIERE-376.sql'
WHERE LastMigrationScriptApplied<'879_IDEMPIERE-376.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,110 @@
-- Aug 16, 2012 11:44:05 AM COT
-- IDEMPIERE-879 Change to one account
UPDATE AD_Element SET Name='Charge Revenue (Deprecated)',Updated=TO_TIMESTAMP('2012-08-16 11:44:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Element_ID=1388
;
-- Aug 16, 2012 11:44:05 AM COT
UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=1388
;
-- Aug 16, 2012 11:44:05 AM COT
UPDATE AD_Column SET ColumnName='Ch_Revenue_Acct', Name='Charge Revenue (Deprecated)', Description='Charge Revenue Account', Help='The Charge Revenue Account identifies the account to use when recording charges paid by customers.' WHERE AD_Element_ID=1388
;
-- Aug 16, 2012 11:44:05 AM COT
UPDATE AD_Process_Para SET ColumnName='Ch_Revenue_Acct', Name='Charge Revenue (Deprecated)', Description='Charge Revenue Account', Help='The Charge Revenue Account identifies the account to use when recording charges paid by customers.', AD_Element_ID=1388 WHERE UPPER(ColumnName)='CH_REVENUE_ACCT' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Aug 16, 2012 11:44:05 AM COT
UPDATE AD_Process_Para SET ColumnName='Ch_Revenue_Acct', Name='Charge Revenue (Deprecated)', Description='Charge Revenue Account', Help='The Charge Revenue Account identifies the account to use when recording charges paid by customers.' WHERE AD_Element_ID=1388 AND IsCentrallyMaintained='Y'
;
-- Aug 16, 2012 11:44:05 AM COT
UPDATE AD_Field SET Name='Charge Revenue (Deprecated)', Description='Charge Revenue Account', Help='The Charge Revenue Account identifies the account to use when recording charges paid by customers.' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=1388) AND IsCentrallyMaintained='Y'
;
-- Aug 16, 2012 11:44:05 AM COT
UPDATE AD_PrintFormatItem SET PrintName='Charge Revenue', Name='Charge Revenue (Deprecated)' 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=1388)
;
-- Aug 17, 2012 9:37:01 AM COT
UPDATE AD_Element SET Help='The Charge Account identifies the account to use when recording charges', Name='Charge Account', Description='Charge Account', PrintName='Charge Account',Updated=TO_TIMESTAMP('2012-08-17 09:37:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=1387
;
-- Aug 17, 2012 9:37:02 AM COT
UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=1387
;
-- Aug 17, 2012 9:37:02 AM COT
UPDATE AD_Column SET ColumnName='Ch_Expense_Acct', Name='Charge Account', Description='Charge Account', Help='The Charge Account identifies the account to use when recording charges' WHERE AD_Element_ID=1387
;
-- Aug 17, 2012 9:37:02 AM COT
UPDATE AD_Process_Para SET ColumnName='Ch_Expense_Acct', Name='Charge Account', Description='Charge Account', Help='The Charge Account identifies the account to use when recording charges', AD_Element_ID=1387 WHERE UPPER(ColumnName)='CH_EXPENSE_ACCT' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Aug 17, 2012 9:37:02 AM COT
UPDATE AD_Process_Para SET ColumnName='Ch_Expense_Acct', Name='Charge Account', Description='Charge Account', Help='The Charge Account identifies the account to use when recording charges' WHERE AD_Element_ID=1387 AND IsCentrallyMaintained='Y'
;
-- Aug 17, 2012 9:37:02 AM COT
UPDATE AD_Field SET Name='Charge Account', Description='Charge Account', Help='The Charge Account identifies the account to use when recording charges' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=1387) AND IsCentrallyMaintained='Y'
;
-- Aug 17, 2012 9:37:02 AM COT
UPDATE AD_PrintFormatItem SET PrintName='Charge Account', Name='Charge Account' 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=1387)
;
-- Aug 17, 2012 9:39:00 AM COT
UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2012-08-17 09:39:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4871
;
-- Aug 17, 2012 9:39:05 AM COT
INSERT INTO t_alter_column values('c_acctschema_default','Ch_Revenue_Acct','NUMERIC(10)',null,'NULL')
;
-- Aug 17, 2012 9:39:05 AM COT
INSERT INTO t_alter_column values('c_acctschema_default','Ch_Revenue_Acct',null,'NULL',null)
;
-- Aug 17, 2012 9:39:11 AM COT
UPDATE AD_Column SET IsActive='N',Updated=TO_TIMESTAMP('2012-08-17 09:39:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4871
;
-- Aug 17, 2012 9:39:47 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2012-08-17 09:39:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3852
;
-- Aug 17, 2012 9:40:09 AM COT
UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2012-08-17 09:40:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=5013
;
-- Aug 17, 2012 9:40:13 AM COT
INSERT INTO t_alter_column values('c_charge_acct','Ch_Revenue_Acct','NUMERIC(10)',null,'NULL')
;
-- Aug 17, 2012 9:40:13 AM COT
INSERT INTO t_alter_column values('c_charge_acct','Ch_Revenue_Acct',null,'NULL',null)
;
-- Aug 17, 2012 9:40:18 AM COT
UPDATE AD_Column SET IsActive='N',Updated=TO_TIMESTAMP('2012-08-17 09:40:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=5013
;
-- Aug 17, 2012 9:40:38 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2012-08-17 09:40:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4064
;
update c_charge_acct set ch_revenue_acct=NULL WHERE AD_Client_ID=11;
update c_acctschema_default set ch_revenue_acct=NULL WHERE AD_Client_ID=11;
ALTER TABLE c_charge_acct DROP CONSTRAINT vc_chrevenue_ccharge;
ALTER TABLE c_acctschema_default DROP CONSTRAINT vc_chrevenue_cschemadefault;
UPDATE AD_System
SET LastMigrationScriptApplied='879_IDEMPIERE-376.sql'
WHERE LastMigrationScriptApplied<'879_IDEMPIERE-376.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -484,7 +484,6 @@ public class AcctSchemaDefaultCopy extends SvrProcess
{
sql = "UPDATE C_Charge_Acct a "
+ "SET Ch_Expense_Acct=" + acct.getCh_Expense_Acct()
+ ", Ch_Revenue_Acct=" + acct.getCh_Revenue_Acct()
+ ", Updated=SysDate, UpdatedBy=0 "
+ "WHERE a.C_AcctSchema_ID=" + p_C_AcctSchema_ID
+ " AND EXISTS (SELECT * FROM C_Charge_Acct x "
@ -497,10 +496,10 @@ public class AcctSchemaDefaultCopy extends SvrProcess
sql = "INSERT INTO C_Charge_Acct "
+ "(C_Charge_ID, C_AcctSchema_ID,"
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,"
+ " Ch_Expense_Acct, Ch_Revenue_Acct) "
+ " Ch_Expense_Acct) "
+ "SELECT x.C_Charge_ID, acct.C_AcctSchema_ID,"
+ " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,"
+ " acct.Ch_Expense_Acct, acct.Ch_Revenue_Acct "
+ " acct.Ch_Expense_Acct "
+ "FROM C_Charge x"
+ " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) "
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID

View File

@ -594,14 +594,8 @@ public class CreateInvoicedAsset extends SvrProcess
int invoiceAcct =0;
if (M_Product_ID == 0 && C_Charge_ID != 0)
{
if(lineAmt.signum() > 0){
String sqlb = "SELECT CH_Expense_Acct FROM C_Charge_Acct WHERE C_Charge_ID=? and C_AcctSchema_ID=?";
invoiceAcct = DB.getSQLValue(get_TrxName(),sqlb,C_Charge_ID,C_AcctSchema_ID);
}
else{
String sqlb = "SELECT CH_Revenue_Acct FROM C_Charge_Acct WHERE C_Charge_ID=? and C_AcctSchema_ID=?";
invoiceAcct = DB.getSQLValue(get_TrxName(),sqlb,C_Charge_ID,C_AcctSchema_ID);
}
String sqlb = "SELECT CH_Expense_Acct FROM C_Charge_Acct WHERE C_Charge_ID=? and C_AcctSchema_ID=?";
invoiceAcct = DB.getSQLValue(get_TrxName(),sqlb,C_Charge_ID,C_AcctSchema_ID);
}
else if(M_Product_ID != 0){

View File

@ -1187,10 +1187,9 @@ public abstract class Doc
int cmp = getAmount(AMTTYPE_Charge).compareTo(Env.ZERO);
if (cmp == 0)
return 0;
else if (cmp < 0)
sql = "SELECT CH_Expense_Acct FROM C_Charge_Acct WHERE C_Charge_ID=? AND C_AcctSchema_ID=?";
else
sql = "SELECT CH_Revenue_Acct FROM C_Charge_Acct WHERE C_Charge_ID=? AND C_AcctSchema_ID=?";
sql = "SELECT CH_Expense_Acct FROM C_Charge_Acct WHERE C_Charge_ID=? AND C_AcctSchema_ID=?";
para_1 = getC_Charge_ID();
}
else if (AcctType == ACCTTYPE_V_Liability)

View File

@ -441,7 +441,7 @@ public class DocLine
int C_Charge_ID = getC_Charge_ID();
if (C_Charge_ID == 0)
return null;
return MCharge.getAccount(C_Charge_ID, as, amount);
return MCharge.getAccount(C_Charge_ID, as);
} // getChargeAccount
/**

View File

@ -127,7 +127,7 @@ public class Doc_Payment extends Doc
//
MAccount acct = null;
if (getC_Charge_ID() != 0)
acct = MCharge.getAccount(getC_Charge_ID(), as, getAmount());
acct = MCharge.getAccount(getC_Charge_ID(), as);
else if (m_Prepayment)
acct = getAccount(Doc.ACCTTYPE_C_Prepayment, as);
else
@ -143,7 +143,7 @@ public class Doc_Payment extends Doc
{
MAccount acct = null;
if (getC_Charge_ID() != 0)
acct = MCharge.getAccount(getC_Charge_ID(), as, getAmount());
acct = MCharge.getAccount(getC_Charge_ID(), as);
else if (m_Prepayment)
acct = getAccount(Doc.ACCTTYPE_V_Prepayment, as);
else

View File

@ -31,7 +31,7 @@ public interface I_C_AcctSchema_Default
public static final String Table_Name = "C_AcctSchema_Default";
/** AD_Table_ID=315 */
public static final int Table_ID = MTable.getTable_ID(Table_Name);
public static final int Table_ID = 315;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
@ -242,6 +242,15 @@ public interface I_C_AcctSchema_Default
public I_C_ValidCombination getB_Unidentified_A() throws RuntimeException;
/** Column name C_AcctSchema_Default_UU */
public static final String COLUMNNAME_C_AcctSchema_Default_UU = "C_AcctSchema_Default_UU";
/** Set C_AcctSchema_Default_UU */
public void setC_AcctSchema_Default_UU (String C_AcctSchema_Default_UU);
/** Get C_AcctSchema_Default_UU */
public String getC_AcctSchema_Default_UU();
/** Column name C_AcctSchema_ID */
public static final String COLUMNNAME_C_AcctSchema_ID = "C_AcctSchema_ID";
@ -255,7 +264,7 @@ public interface I_C_AcctSchema_Default
*/
public int getC_AcctSchema_ID();
public I_C_AcctSchema getC_AcctSchema() throws RuntimeException;
public org.compiere.model.I_C_AcctSchema getC_AcctSchema() throws RuntimeException;
/** Column name CB_Asset_Acct */
public static final String COLUMNNAME_CB_Asset_Acct = "CB_Asset_Acct";
@ -335,33 +344,18 @@ public interface I_C_AcctSchema_Default
/** Column name Ch_Expense_Acct */
public static final String COLUMNNAME_Ch_Expense_Acct = "Ch_Expense_Acct";
/** Set Charge Expense.
* Charge Expense Account
/** Set Charge Account.
* Charge Account
*/
public void setCh_Expense_Acct (int Ch_Expense_Acct);
/** Get Charge Expense.
* Charge Expense Account
/** Get Charge Account.
* Charge Account
*/
public int getCh_Expense_Acct();
public I_C_ValidCombination getCh_Expense_A() throws RuntimeException;
/** Column name Ch_Revenue_Acct */
public static final String COLUMNNAME_Ch_Revenue_Acct = "Ch_Revenue_Acct";
/** Set Charge Revenue.
* Charge Revenue Account
*/
public void setCh_Revenue_Acct (int Ch_Revenue_Acct);
/** Get Charge Revenue.
* Charge Revenue Account
*/
public int getCh_Revenue_Acct();
public I_C_ValidCombination getCh_Revenue_A() throws RuntimeException;
/** Column name C_Prepayment_Acct */
public static final String COLUMNNAME_C_Prepayment_Acct = "C_Prepayment_Acct";

View File

@ -31,7 +31,7 @@ public interface I_C_Charge_Acct
public static final String Table_Name = "C_Charge_Acct";
/** AD_Table_ID=396 */
public static final int Table_ID = MTable.getTable_ID(Table_Name);
public static final int Table_ID = 396;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
@ -75,7 +75,16 @@ public interface I_C_Charge_Acct
*/
public int getC_AcctSchema_ID();
public I_C_AcctSchema getC_AcctSchema() throws RuntimeException;
public org.compiere.model.I_C_AcctSchema getC_AcctSchema() throws RuntimeException;
/** Column name C_Charge_Acct_UU */
public static final String COLUMNNAME_C_Charge_Acct_UU = "C_Charge_Acct_UU";
/** Set C_Charge_Acct_UU */
public void setC_Charge_Acct_UU (String C_Charge_Acct_UU);
/** Get C_Charge_Acct_UU */
public String getC_Charge_Acct_UU();
/** Column name C_Charge_ID */
public static final String COLUMNNAME_C_Charge_ID = "C_Charge_ID";
@ -90,38 +99,23 @@ public interface I_C_Charge_Acct
*/
public int getC_Charge_ID();
public I_C_Charge getC_Charge() throws RuntimeException;
public org.compiere.model.I_C_Charge getC_Charge() throws RuntimeException;
/** Column name Ch_Expense_Acct */
public static final String COLUMNNAME_Ch_Expense_Acct = "Ch_Expense_Acct";
/** Set Charge Expense.
* Charge Expense Account
/** Set Charge Account.
* Charge Account
*/
public void setCh_Expense_Acct (int Ch_Expense_Acct);
/** Get Charge Expense.
* Charge Expense Account
/** Get Charge Account.
* Charge Account
*/
public int getCh_Expense_Acct();
public I_C_ValidCombination getCh_Expense_A() throws RuntimeException;
/** Column name Ch_Revenue_Acct */
public static final String COLUMNNAME_Ch_Revenue_Acct = "Ch_Revenue_Acct";
/** Set Charge Revenue.
* Charge Revenue Account
*/
public void setCh_Revenue_Acct (int Ch_Revenue_Acct);
/** Get Charge Revenue.
* Charge Revenue Account
*/
public int getCh_Revenue_Acct();
public I_C_ValidCombination getCh_Revenue_A() throws RuntimeException;
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";

View File

@ -39,25 +39,33 @@ public class MCharge extends X_C_Charge
/**
*
*/
private static final long serialVersionUID = 630271473830196435L;
private static final long serialVersionUID = 8246481667219415012L;
/**
* Get Charge Account
* @param C_Charge_ID charge
* @param as account schema
* @param amount amount for expense(+)/revenue(-)
* @param amount amount NOT USED
* @return Charge Account or null
* @deprecated use getAccount(Charge, as) instead
*/
public static MAccount getAccount (int C_Charge_ID, MAcctSchema as, BigDecimal amount)
{
return getAccount (C_Charge_ID, as);
} // getAccount
/**
* Get Charge Account
* @param C_Charge_ID charge
* @param as account schema
* @return Charge Account or null
*/
public static MAccount getAccount (int C_Charge_ID, MAcctSchema as)
{
if (C_Charge_ID == 0 || as == null)
return null;
String acctName = X_C_Charge_Acct.COLUMNNAME_Ch_Expense_Acct; // Expense (positive amt)
if (amount != null && amount.signum() < 0)
acctName = X_C_Charge_Acct.COLUMNNAME_Ch_Revenue_Acct; // Revenue (negative amt)
String sql = "SELECT "+acctName+" FROM C_Charge_Acct WHERE C_Charge_ID=? AND C_AcctSchema_ID=?";
String sql = "SELECT Ch_Expense_Acct FROM C_Charge_Acct WHERE C_Charge_ID=? AND C_AcctSchema_ID=?";
int Account_ID = DB.getSQLValueEx(null, sql, C_Charge_ID, as.get_ID());
// No account
if (Account_ID <= 0)

View File

@ -553,7 +553,7 @@ public final class MSetup
sqlCmd.append(getAD_Org_ID()).append(" WHERE C_AcctSchema_Element_ID=").append(C_AcctSchema_Element_ID);
no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName());
if (no != 1)
log.log(Level.SEVERE, "Default Org in AcctSchamaElement NOT updated");
log.log(Level.SEVERE, "Default Org in AcctSchemaElement NOT updated");
}
if (ElementType.equals("AC"))
{
@ -562,7 +562,7 @@ public final class MSetup
sqlCmd.append(" WHERE C_AcctSchema_Element_ID=").append(C_AcctSchema_Element_ID);
no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName());
if (no != 1)
log.log(Level.SEVERE, "Default Account in AcctSchamaElement NOT updated");
log.log(Level.SEVERE, "Default Account in AcctSchemaElement NOT updated");
}
}
}
@ -777,6 +777,8 @@ public final class MSetup
MColumn[] cols = table.getColumns(false);
for (MColumn c : cols) {
if (!c.isActive())
continue;
String columnName = c.getColumnName();
if (c.isStandardColumn()) {
}

View File

@ -30,7 +30,7 @@ public class X_C_AcctSchema_Default extends PO implements I_C_AcctSchema_Default
/**
*
*/
private static final long serialVersionUID = 20100614L;
private static final long serialVersionUID = 20120817L;
/** Standard Constructor */
public X_C_AcctSchema_Default (Properties ctx, int C_AcctSchema_Default_ID, String trxName)
@ -57,7 +57,6 @@ public class X_C_AcctSchema_Default extends PO implements I_C_AcctSchema_Default
setCB_Expense_Acct (0);
setCB_Receipt_Acct (0);
setCh_Expense_Acct (0);
setCh_Revenue_Acct (0);
setC_Prepayment_Acct (0);
setC_Receivable_Acct (0);
setC_Receivable_Services_Acct (0);
@ -442,9 +441,23 @@ public class X_C_AcctSchema_Default extends PO implements I_C_AcctSchema_Default
return ii.intValue();
}
public I_C_AcctSchema getC_AcctSchema() throws RuntimeException
/** Set C_AcctSchema_Default_UU.
@param C_AcctSchema_Default_UU C_AcctSchema_Default_UU */
public void setC_AcctSchema_Default_UU (String C_AcctSchema_Default_UU)
{
set_Value (COLUMNNAME_C_AcctSchema_Default_UU, C_AcctSchema_Default_UU);
}
/** Get C_AcctSchema_Default_UU.
@return C_AcctSchema_Default_UU */
public String getC_AcctSchema_Default_UU ()
{
return (String)get_Value(COLUMNNAME_C_AcctSchema_Default_UU);
}
public org.compiere.model.I_C_AcctSchema getC_AcctSchema() throws RuntimeException
{
return (I_C_AcctSchema)MTable.get(getCtx(), I_C_AcctSchema.Table_Name)
return (org.compiere.model.I_C_AcctSchema)MTable.get(getCtx(), org.compiere.model.I_C_AcctSchema.Table_Name)
.getPO(getC_AcctSchema_ID(), get_TrxName()); }
/** Set Accounting Schema.
@ -608,17 +621,17 @@ public class X_C_AcctSchema_Default extends PO implements I_C_AcctSchema_Default
return (I_C_ValidCombination)MTable.get(getCtx(), I_C_ValidCombination.Table_Name)
.getPO(getCh_Expense_Acct(), get_TrxName()); }
/** Set Charge Expense.
/** Set Charge Account.
@param Ch_Expense_Acct
Charge Expense Account
Charge Account
*/
public void setCh_Expense_Acct (int Ch_Expense_Acct)
{
set_Value (COLUMNNAME_Ch_Expense_Acct, Integer.valueOf(Ch_Expense_Acct));
}
/** Get Charge Expense.
@return Charge Expense Account
/** Get Charge Account.
@return Charge Account
*/
public int getCh_Expense_Acct ()
{
@ -628,31 +641,6 @@ public class X_C_AcctSchema_Default extends PO implements I_C_AcctSchema_Default
return ii.intValue();
}
public I_C_ValidCombination getCh_Revenue_A() throws RuntimeException
{
return (I_C_ValidCombination)MTable.get(getCtx(), I_C_ValidCombination.Table_Name)
.getPO(getCh_Revenue_Acct(), get_TrxName()); }
/** Set Charge Revenue.
@param Ch_Revenue_Acct
Charge Revenue Account
*/
public void setCh_Revenue_Acct (int Ch_Revenue_Acct)
{
set_Value (COLUMNNAME_Ch_Revenue_Acct, Integer.valueOf(Ch_Revenue_Acct));
}
/** Get Charge Revenue.
@return Charge Revenue Account
*/
public int getCh_Revenue_Acct ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Ch_Revenue_Acct);
if (ii == null)
return 0;
return ii.intValue();
}
public I_C_ValidCombination getC_Prepayment_A() throws RuntimeException
{
return (I_C_ValidCombination)MTable.get(getCtx(), I_C_ValidCombination.Table_Name)

View File

@ -29,7 +29,7 @@ public class X_C_Charge_Acct extends PO implements I_C_Charge_Acct, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20100614L;
private static final long serialVersionUID = 20120817L;
/** Standard Constructor */
public X_C_Charge_Acct (Properties ctx, int C_Charge_Acct_ID, String trxName)
@ -40,7 +40,6 @@ public class X_C_Charge_Acct extends PO implements I_C_Charge_Acct, I_Persistent
setC_AcctSchema_ID (0);
setC_Charge_ID (0);
setCh_Expense_Acct (0);
setCh_Revenue_Acct (0);
} */
}
@ -72,9 +71,9 @@ public class X_C_Charge_Acct extends PO implements I_C_Charge_Acct, I_Persistent
return sb.toString();
}
public I_C_AcctSchema getC_AcctSchema() throws RuntimeException
public org.compiere.model.I_C_AcctSchema getC_AcctSchema() throws RuntimeException
{
return (I_C_AcctSchema)MTable.get(getCtx(), I_C_AcctSchema.Table_Name)
return (org.compiere.model.I_C_AcctSchema)MTable.get(getCtx(), org.compiere.model.I_C_AcctSchema.Table_Name)
.getPO(getC_AcctSchema_ID(), get_TrxName()); }
/** Set Accounting Schema.
@ -100,9 +99,23 @@ public class X_C_Charge_Acct extends PO implements I_C_Charge_Acct, I_Persistent
return ii.intValue();
}
public I_C_Charge getC_Charge() throws RuntimeException
/** Set C_Charge_Acct_UU.
@param C_Charge_Acct_UU C_Charge_Acct_UU */
public void setC_Charge_Acct_UU (String C_Charge_Acct_UU)
{
set_Value (COLUMNNAME_C_Charge_Acct_UU, C_Charge_Acct_UU);
}
/** Get C_Charge_Acct_UU.
@return C_Charge_Acct_UU */
public String getC_Charge_Acct_UU ()
{
return (String)get_Value(COLUMNNAME_C_Charge_Acct_UU);
}
public org.compiere.model.I_C_Charge getC_Charge() throws RuntimeException
{
return (I_C_Charge)MTable.get(getCtx(), I_C_Charge.Table_Name)
return (org.compiere.model.I_C_Charge)MTable.get(getCtx(), org.compiere.model.I_C_Charge.Table_Name)
.getPO(getC_Charge_ID(), get_TrxName()); }
/** Set Charge.
@ -133,17 +146,17 @@ public class X_C_Charge_Acct extends PO implements I_C_Charge_Acct, I_Persistent
return (I_C_ValidCombination)MTable.get(getCtx(), I_C_ValidCombination.Table_Name)
.getPO(getCh_Expense_Acct(), get_TrxName()); }
/** Set Charge Expense.
/** Set Charge Account.
@param Ch_Expense_Acct
Charge Expense Account
Charge Account
*/
public void setCh_Expense_Acct (int Ch_Expense_Acct)
{
set_Value (COLUMNNAME_Ch_Expense_Acct, Integer.valueOf(Ch_Expense_Acct));
}
/** Get Charge Expense.
@return Charge Expense Account
/** Get Charge Account.
@return Charge Account
*/
public int getCh_Expense_Acct ()
{
@ -152,29 +165,4 @@ public class X_C_Charge_Acct extends PO implements I_C_Charge_Acct, I_Persistent
return 0;
return ii.intValue();
}
public I_C_ValidCombination getCh_Revenue_A() throws RuntimeException
{
return (I_C_ValidCombination)MTable.get(getCtx(), I_C_ValidCombination.Table_Name)
.getPO(getCh_Revenue_Acct(), get_TrxName()); }
/** Set Charge Revenue.
@param Ch_Revenue_Acct
Charge Revenue Account
*/
public void setCh_Revenue_Acct (int Ch_Revenue_Acct)
{
set_Value (COLUMNNAME_Ch_Revenue_Acct, Integer.valueOf(Ch_Revenue_Acct));
}
/** Get Charge Revenue.
@return Charge Revenue Account
*/
public int getCh_Revenue_Acct ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Ch_Revenue_Acct);
if (ii == null)
return 0;
return ii.intValue();
}
}

View File

@ -333,7 +333,7 @@
79400,"Cash book expense","Default other expense for petty cash transactions","Expense",,"Yes","No","CB_EXPENSE_ACCT",79,,,,,,,,,,
79500,"Cash book receipts","Default other revenue for petty cash transactions","Revenue",,"Yes","No","CB_RECEIPT_ACCT",79,,,,,,,,,,
79600,"Charge expense","Default other expense","Expense",,"Yes","No","CH_EXPENSE_ACCT",79,,,,,,,,,,
79700,"Charge revenue","Default other revenue","Revenue",,"Yes","No","CH_REVENUE_ACCT",79,,,,,,,,,,
79700,"Charge revenue","Default other revenue","Revenue",,"Yes","No",,79,,,,,,,,,,
,,,,,,,,,,,,,"79_","Total Operating Expenses",,,,
,,,,,,,,,,,,,"79__","Operating Income",,,,
80,"Other Income",,"Revenue",,,"Yes",,,,,,,80,"Other Income",,,,

1 [Account_Value] [Account_Name] [Account_Description] [Account_Type] [Account_Sign] [Account_Document] [Account_Summary] [Default_Account] [Account_Parent] [Balance Sheet] [Balance Sheet_Name] [US 1120 Balance Sheet] US 1120 Balance Sheet_Name [Profit & Loss] [Profit & Loss_Name] [US 1120 Income Statement] [US 1120 Income Statement_Name] [Cash Flow] [Cash Flow_Name]
333 79400 Cash book expense Default other expense for petty cash transactions Expense Yes No CB_EXPENSE_ACCT 79
334 79500 Cash book receipts Default other revenue for petty cash transactions Revenue Yes No CB_RECEIPT_ACCT 79
335 79600 Charge expense Default other expense Expense Yes No CH_EXPENSE_ACCT 79
336 79700 Charge revenue Default other revenue Revenue Yes No CH_REVENUE_ACCT 79
337 79_ Total Operating Expenses
338 79__ Operating Income
339 80 Other Income Revenue Yes 80 Other Income

View File

@ -297,7 +297,6 @@ public class Charge
{
StringBuffer sql = new StringBuffer("UPDATE C_Charge_Acct ");
sql.append("SET CH_Expense_Acct=").append(account.getC_ValidCombination_ID());
sql.append(", CH_Revenue_Acct=").append(account.getC_ValidCombination_ID());
sql.append(" WHERE C_Charge_ID=").append(charge.getC_Charge_ID());
sql.append(" AND C_AcctSchema_ID=").append(m_C_AcctSchema_ID);