Revert revision 2327 and 2328

Testing a better approach
This commit is contained in:
Carlos Ruiz 2007-05-09 07:43:24 +00:00
parent d640fc4190
commit c17c1ae08c
34 changed files with 592 additions and 1312 deletions

View File

@ -1,574 +0,0 @@
package org.compiere.acct;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Properties;
import org.compiere.model.MAccount;
import org.compiere.model.MAcctSchema;
import org.compiere.model.MDocType;
public interface IDoc {
/** AR Invoices - ARI */
public static final String DOCTYPE_ARInvoice = MDocType.DOCBASETYPE_ARInvoice;
/** AR Credit Memo */
public static final String DOCTYPE_ARCredit = "ARC";
/** AR Receipt */
public static final String DOCTYPE_ARReceipt = "ARR";
/** AR ProForma */
public static final String DOCTYPE_ARProForma = "ARF";
/** AP Invoices */
public static final String DOCTYPE_APInvoice = "API";
/** AP Credit Memo */
public static final String DOCTYPE_APCredit = "APC";
/** AP Payment */
public static final String DOCTYPE_APPayment = "APP";
/** CashManagement Bank Statement */
public static final String DOCTYPE_BankStatement = "CMB";
/** CashManagement Cash Journals */
public static final String DOCTYPE_CashJournal = "CMC";
/** CashManagement Allocations */
public static final String DOCTYPE_Allocation = "CMA";
/** Material Shipment */
public static final String DOCTYPE_MatShipment = "MMS";
/** Material Receipt */
public static final String DOCTYPE_MatReceipt = "MMR";
/** Material Inventory */
public static final String DOCTYPE_MatInventory = "MMI";
/** Material Movement */
public static final String DOCTYPE_MatMovement = "MMM";
/** Material Production */
public static final String DOCTYPE_MatProduction = "MMP";
/** Match Invoice */
public static final String DOCTYPE_MatMatchInv = "MXI";
/** Match PO */
public static final String DOCTYPE_MatMatchPO = "MXP";
/** GL Journal */
public static final String DOCTYPE_GLJournal = "GLJ";
/** Purchase Order */
public static final String DOCTYPE_POrder = "POO";
/** Sales Order */
public static final String DOCTYPE_SOrder = "SOO";
/** Project Issue */
public static final String DOCTYPE_ProjectIssue = "PJI";
/** Purchase Requisition */
public static final String DOCTYPE_PurchaseRequisition = "POR";
// Posting Status - AD_Reference_ID=234 //
/** Document Status */
public static final String STATUS_NotPosted = "N";
/** Document Status */
public static final String STATUS_NotBalanced = "b";
/** Document Status */
public static final String STATUS_NotConvertible = "c";
/** Document Status */
public static final String STATUS_PeriodClosed = "p";
/** Document Status */
public static final String STATUS_InvalidAccount = "i";
/** Document Status */
public static final String STATUS_PostPrepared = "y";
/** Document Status */
public static final String STATUS_Posted = "Y";
/** Document Status */
public static final String STATUS_Error = "E";
/** No Currency in Document Indicator (-1) */
public static final int NO_CURRENCY = -2;
/**
* Get Table Name
* @return table name
*/
public abstract String get_TableName(); // get_TableName
/**
* Get Table ID
* @return table id
*/
public abstract int get_Table_ID(); // get_Table_ID
/**
* Get Record_ID
* @return record id
*/
public abstract int get_ID(); // get_ID
/**
* Post Document.
* <pre>
* - try to lock document (Processed='Y' (AND Processing='N' AND Posted='N'))
* - if not ok - return false
* - postlogic (for all Accounting Schema)
* - create Fact lines
* - postCommit
* - commits Fact lines and Document & sets Processing = 'N'
* - if error - create Note
* </pre>
* @param force if true ignore that locked
* @param repost if true ignore that already posted
* @return null if posted error otherwise
*/
public abstract String post(boolean force, boolean repost); // post
/**************************************************************************
* Is the Source Document Balanced
* @return true if (source) baanced
*/
public abstract boolean isBalanced(); // isBalanced
/**
* Is Document convertible to currency and Conversion Type
* @param acctSchema accounting schema
* @return true, if vonvertable to accounting currency
*/
public abstract boolean isConvertible(MAcctSchema acctSchema); // isConvertible
/**
* Calculate Period from DateAcct.
* m_C_Period_ID is set to -1 of not open to 0 if not found
*/
public abstract void setPeriod(); // setC_Period_ID
/**
* Get C_Period_ID
* @return period
*/
public abstract int getC_Period_ID(); // getC_Period_ID
/**
* Is Period Open
* @return true if period is open
*/
public abstract boolean isPeriodOpen(); // isPeriodOpen
/** Amount Type - Invoice - Gross */
public static final int AMTTYPE_Gross = 0;
/** Amount Type - Invoice - Net */
public static final int AMTTYPE_Net = 1;
/** Amount Type - Invoice - Charge */
public static final int AMTTYPE_Charge = 2;
/**
* Get the Amount
* (loaded in loadDocumentDetails)
*
* @param AmtType see AMTTYPE_*
* @return Amount
*/
public abstract BigDecimal getAmount(int AmtType); // getAmount
/**
* Set the Amount
* @param AmtType see AMTTYPE_*
* @param amt Amount
*/
public void setAmount(int AmtType, BigDecimal amt);
/**
* Get Amount with index 0
* @return Amount (primary document amount)
*/
public abstract BigDecimal getAmount(); // getAmount
/**
* Set Quantity
* @param qty Quantity
*/
public void setQty (BigDecimal qty);
/**
* Get Quantity
* @return Quantity
*/
public abstract BigDecimal getQty(); // getQty
/** Account Type - Invoice - Charge */
public static final int ACCTTYPE_Charge = 0;
/** Account Type - Invoice - AR */
public static final int ACCTTYPE_C_Receivable = 1;
/** Account Type - Invoice - AP */
public static final int ACCTTYPE_V_Liability = 2;
/** Account Type - Invoice - AP Service */
public static final int ACCTTYPE_V_Liability_Services = 3;
/** Account Type - Invoice - AR Service */
public static final int ACCTTYPE_C_Receivable_Services = 4;
/** Account Type - Payment - Unallocated */
public static final int ACCTTYPE_UnallocatedCash = 10;
/** Account Type - Payment - Transfer */
public static final int ACCTTYPE_BankInTransit = 11;
/** Account Type - Payment - Selection */
public static final int ACCTTYPE_PaymentSelect = 12;
/** Account Type - Payment - Prepayment */
public static final int ACCTTYPE_C_Prepayment = 13;
/** Account Type - Payment - Prepayment */
public static final int ACCTTYPE_V_Prepayment = 14;
/** Account Type - Cash - Asset */
public static final int ACCTTYPE_CashAsset = 20;
/** Account Type - Cash - Transfer */
public static final int ACCTTYPE_CashTransfer = 21;
/** Account Type - Cash - Expense */
public static final int ACCTTYPE_CashExpense = 22;
/** Account Type - Cash - Receipt */
public static final int ACCTTYPE_CashReceipt = 23;
/** Account Type - Cash - Difference */
public static final int ACCTTYPE_CashDifference = 24;
/** Account Type - Allocation - Discount Expense (AR) */
public static final int ACCTTYPE_DiscountExp = 30;
/** Account Type - Allocation - Discount Revenue (AP) */
public static final int ACCTTYPE_DiscountRev = 31;
/** Account Type - Allocation - Write Off */
public static final int ACCTTYPE_WriteOff = 32;
/** Account Type - Bank Statement - Asset */
public static final int ACCTTYPE_BankAsset = 40;
/** Account Type - Bank Statement - Interest Revenue */
public static final int ACCTTYPE_InterestRev = 41;
/** Account Type - Bank Statement - Interest Exp */
public static final int ACCTTYPE_InterestExp = 42;
/** Inventory Accounts - Differnces */
public static final int ACCTTYPE_InvDifferences = 50;
/** Inventory Accounts - NIR */
public static final int ACCTTYPE_NotInvoicedReceipts = 51;
/** Project Accounts - Assets */
public static final int ACCTTYPE_ProjectAsset = 61;
/** Project Accounts - WIP */
public static final int ACCTTYPE_ProjectWIP = 62;
/** GL Accounts - PPV Offset */
public static final int ACCTTYPE_PPVOffset = 101;
/** GL Accounts - Commitment Offset */
public static final int ACCTTYPE_CommitmentOffset = 111;
/**
* Get the Valid Combination id for Accounting Schema
* @param AcctType see ACCTTYPE_*
* @param as accounting schema
* @return C_ValidCombination_ID
*/
public abstract int getValidCombination_ID(int AcctType, MAcctSchema as); // getAccount_ID
/**
* Get the account for Accounting Schema
* @param AcctType see ACCTTYPE_*
* @param as accounting schema
* @return Account
*/
public abstract MAccount getAccount(int AcctType, MAcctSchema as); // getAccount
/**
* Get DocLine with ID
* @param Record_ID Record ID
* @return DocLine
*/
public abstract IDocLine getDocLine(int Record_ID); // getDocLine
/**
* Get AD_Client_ID
* @return client
*/
public abstract int getAD_Client_ID(); // getAD_Client_ID
/**
* Get AD_Org_ID
* @return org
*/
public abstract int getAD_Org_ID(); // getAD_Org_ID
/**
* Get Document No
* @return document No
*/
public abstract String getDocumentNo(); // getDocumentNo
/**
* Get Description
* @return Description
*/
public abstract String getDescription(); // getDescription
/**
* Get C_Currency_ID
* @return currency
*/
public abstract int getC_Currency_ID(); // getC_Currency_ID
/**
* Set C_Currency_ID
* @param C_Currency_ID id
*/
public abstract void setC_Currency_ID(int C_Currency_ID); // setC_Currency_ID
/**
* Is Multi Currency
* @return mc
*/
public abstract boolean isMultiCurrency(); // isMultiCurrency
/**
* Set Multi Currency
* @param mc multi currency
*/
public void setIsMultiCurrency (boolean mc);
/**
* Is Tax Included
* @return tax incl
*/
public abstract boolean isTaxIncluded(); // isTaxIncluded
/**
* Set Tax Includedy
* @param ti Tax Included
*/
public void setIsTaxIncluded (boolean ti);
/**
* Get C_ConversionType_ID
* @return ConversionType
*/
public abstract int getC_ConversionType_ID(); // getC_ConversionType_ID
/**
* Get GL_Category_ID
* @return categoory
*/
public abstract int getGL_Category_ID(); // getGL_Category_ID
/**
* Get GL_Category_ID
* @return categoory
*/
public abstract int getGL_Budget_ID(); // getGL_Budget_ID
/**
* Get Accounting Date
* @return currency
*/
public abstract Timestamp getDateAcct(); // getDateAcct
/**
* Set Date Acct
* @param da accounting date
*/
public void setDateAcct (Timestamp da);
/**
* Get Document Date
* @return currency
*/
public abstract Timestamp getDateDoc(); // getDateDoc
/**
* Set Date Doc
* @param dd document date
*/
public void setDateDoc (Timestamp dd);
/**
* Is Document Posted
* @return true if posted
*/
public abstract boolean isPosted(); // isPosted
/**
* Is Sales Trx
* @return true if posted
*/
public abstract boolean isSOTrx(); // isSOTrx
/**
* Get C_DocType_ID
* @return DocType
*/
public abstract int getC_DocType_ID(); // getC_DocType_ID
/**
* Get header level C_Charge_ID
* @return Charge
*/
public abstract int getC_Charge_ID(); // getC_Charge_ID
/**
* Get SalesRep_ID
* @return SalesRep
*/
public abstract int getSalesRep_ID(); // getSalesRep_ID
/**
* Get C_BankAccount_ID
* @return BankAccount
*/
public abstract int getC_BankAccount_ID(); // getC_BankAccount_ID
/**
* Set C_BankAccount_ID
* @param C_BankAccount_ID bank acct
*/
public void setC_BankAccount_ID (int C_BankAccount_ID);
/**
* Get C_CashBook_ID
* @return CashBook
*/
public abstract int getC_CashBook_ID(); // getC_CashBook_ID
/**
* Set C_CashBook_ID
* @param C_CashBook_ID cash book
*/
public void setC_CashBook_ID (int C_CashBook_ID);
/**
* Get M_Warehouse_ID
* @return Warehouse
*/
public abstract int getM_Warehouse_ID(); // getM_Warehouse_ID
/**
* Get C_BPartner_ID
* @return BPartner
*/
public abstract int getC_BPartner_ID(); // getC_BPartner_ID
/**
* Set C_BPartner_ID
* @param C_BPartner_ID bp
*/
public void setC_BPartner_ID (int C_BPartner_ID);
/**
* Get C_BPartner_Location_ID
* @return BPartner Location
*/
public abstract int getC_BPartner_Location_ID(); // getC_BPartner_Location_ID
/**
* Get C_Project_ID
* @return Project
*/
public abstract int getC_Project_ID(); // getC_Project_ID
/**
* Get C_SalesRegion_ID
* @return Sales Region
*/
public abstract int getC_SalesRegion_ID(); // getC_SalesRegion_ID
/**
* Get C_SalesRegion_ID
* @return Sales Region
*/
public abstract int getBP_C_SalesRegion_ID(); // getBP_C_SalesRegion_ID
/**
* Get C_Activity_ID
* @return Activity
*/
public abstract int getC_Activity_ID(); // getC_Activity_ID
/**
* Get C_Campaign_ID
* @return Campaign
*/
public abstract int getC_Campaign_ID(); // getC_Campaign_ID
/**
* Get M_Product_ID
* @return Product
*/
public abstract int getM_Product_ID(); // getM_Product_ID
/**
* Get AD_OrgTrx_ID
* @return Trx Org
*/
public abstract int getAD_OrgTrx_ID(); // getAD_OrgTrx_ID
/**
* Get C_LocFrom_ID
* @return loc from
*/
public abstract int getC_LocFrom_ID(); // getC_LocFrom_ID
/**
* Set C_LocFrom_ID
* @param C_LocFrom_ID loc from
*/
public void setC_LocFrom_ID(int C_LocFrom_ID);
/**
* Get C_LocTo_ID
* @return loc to
*/
public abstract int getC_LocTo_ID(); // getC_LocTo_ID
/**
* Set C_LocTo_ID
* @param C_LocTo_ID loc to
*/
public void setC_LocTo_ID(int C_LocTo_ID);
/**
* Get User1_ID
* @return Campaign
*/
public abstract int getUser1_ID(); // getUser1_ID
/**
* Get User2_ID
* @return Campaign
*/
public abstract int getUser2_ID(); // getUser2_ID
/**
* Get User Defined value
* @return User defined
*/
public abstract int getValue(String ColumnName); // getValue
/**
* Get Source Currency Balance - subtracts line (and tax) amounts from total - no rounding
* @return positive amount, if total header is bigger than lines
*/
public abstract BigDecimal getBalance();
/**
* Create Facts (the accounting logic)
* @param as accounting schema
* @return Facts
*/
public abstract ArrayList<Fact> createFacts(MAcctSchema as);
/**
* Get Context
* @return context
*/
public Properties getCtx();
/**************************************************************************
* Load Document Type and GL Info.
* Set p_DocumentType and p_GL_Category_ID
* @return document type
*/
public String getDocumentType();
/**
* Load Document Type and GL Info.
* Set p_DocumentType and p_GL_Category_ID
* @param DocumentType
*/
public void setDocumentType (String DocumentType);
/**
* Set C_SalesRegion_ID
* @param C_SalesRegion_ID id
*/
public void setBP_C_SalesRegion_ID (int C_SalesRegion_ID);
/*
* Get the facts
* @return ArrayList<Fact>
*/
public ArrayList<Fact> getFacts();
}

View File

@ -1,399 +0,0 @@
package org.compiere.acct;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.model.MAccount;
import org.compiere.model.MAcctSchema;
import org.compiere.model.MProduct;
import org.compiere.model.ProductCost;
public interface IDocLine {
/**
* Get Currency
* @return c_Currency_ID
*/
public abstract int getC_Currency_ID(); // getC_Currency_ID
/**
* Get Conversion Type
* @return C_ConversionType_ID
*/
public abstract int getC_ConversionType_ID(); // getC_ConversionType_ID
/**
* Set Amount (DR)
* @param sourceAmt source amt
*/
public abstract void setAmount(BigDecimal sourceAmt); // setAmounts
/**
* Set Amounts
* @param amtSourceDr source amount dr
* @param amtSourceCr source amount cr
*/
public abstract void setAmount(BigDecimal amtSourceDr,
BigDecimal amtSourceCr); // setAmounts
/**
* Set Converted Amounts
* @param C_AcctSchema_ID acct schema
* @param amtAcctDr acct amount dr
* @param amtAcctCr acct amount cr
*/
public abstract void setConvertedAmt(int C_AcctSchema_ID,
BigDecimal amtAcctDr, BigDecimal amtAcctCr); // setConvertedAmt
/**
* Line Net Amount or Dr-Cr
* @return balance
*/
public abstract BigDecimal getAmtSource(); // getAmount
/**
* Get (Journal) Line Source Dr Amount
* @return DR source amount
*/
public abstract BigDecimal getAmtSourceDr(); // getAmtSourceDr
/**
* Get (Journal) Line Source Cr Amount
* @return CR source amount
*/
public abstract BigDecimal getAmtSourceCr(); // getAmtSourceCr
/**
* Line Journal Accounted Dr Amount
* @return DR accounted amount
*/
public abstract BigDecimal getAmtAcctDr(); // getAmtAcctDr
/**
* Line Journal Accounted Cr Amount
* @return CR accounted amount
*/
public abstract BigDecimal getAmtAcctCr(); // getAmtAccrCr
/**
* Charge Amount
* @return charge amount
*/
public abstract BigDecimal getChargeAmt(); // getChargeAmt
/**
* Set Product Amounts
* @param LineNetAmt Line Net Amt
* @param PriceList Price List
* @param Qty Qty for discount calc
*/
public abstract void setAmount(BigDecimal LineNetAmt, BigDecimal PriceList,
BigDecimal Qty); // setAmounts
/**
* Line Discount
* @return discount amount
*/
public abstract BigDecimal getDiscount(); // getDiscount
/**
* Line List Amount
* @return list amount
*/
public abstract BigDecimal getListAmount(); // getListAmount
/**
* Set Line Net Amt Difference
* @param diff difference (to be subtracted)
*/
public abstract void setLineNetAmtDifference(BigDecimal diff); // setLineNetAmtDifference
/**************************************************************************
* Set Accounting Date
* @param dateAcct acct date
*/
public abstract void setDateAcct(Timestamp dateAcct); // setDateAcct
/**
* Get Accounting Date
* @return accounting date
*/
public abstract Timestamp getDateAcct(); // getDateAcct
/**
* Set Document Date
* @param dateDoc doc date
*/
public abstract void setDateDoc(Timestamp dateDoc); // setDateDoc
/**
* Get Document Date
* @return document date
*/
public abstract Timestamp getDateDoc(); // getDateDoc
/**************************************************************************
* Set GL Journal Account
* @param acct account
*/
public abstract void setAccount(MAccount acct); // setAccount
/**
* Get GL Journal Account
* @return account
*/
public abstract MAccount getAccount(); // getAccount
/**
* Line Account from Product (or Charge).
*
* @param AcctType see ProductCost.ACCTTYPE_* (0..3)
* @param as Accounting schema
* @return Requested Product Account
*/
public abstract MAccount getAccount(int AcctType, MAcctSchema as); // getAccount
/**
* Get Charge Account
* @param as account schema
* @param amount amount for expense(+)/revenue(-)
* @return Charge Account or null
*/
public abstract MAccount getChargeAccount(MAcctSchema as, BigDecimal amount); // getChargeAccount
/**************************************************************************
* Get (Journal) AcctSchema
* @return C_AcctSchema_ID
*/
public abstract int getC_AcctSchema_ID(); // getC_AcctSchema_ID
/**
* Get Line ID
* @return id
*/
public abstract int get_ID(); // get_ID
/**
* Get AD_Org_ID
* @return org
*/
public abstract int getAD_Org_ID(); // getAD_Org_ID
/**
* Get Order AD_Org_ID
* @return order org if defined
*/
public abstract int getOrder_Org_ID(); // getOrder_Org_ID
/**
* Product
* @return M_Product_ID
*/
public abstract int getM_Product_ID(); // getM_Product_ID
/**
* Is this an Item Product (vs. not a Service, a charge)
* @return true if product
*/
public abstract boolean isItem(); // isItem
/**
* ASI
* @return M_AttributeSetInstance_ID
*/
public abstract int getM_AttributeSetInstance_ID(); // getM_AttributeSetInstance_ID
/**
* Get Warehouse Locator (from)
* @return M_Locator_ID
*/
public abstract int getM_Locator_ID(); // getM_Locator_ID
/**
* Get Warehouse Locator To
* @return M_Locator_ID
*/
public abstract int getM_LocatorTo_ID(); // getM_LocatorTo_ID
/**
* Set Production BOM flag
* @param productionBOM flag
*/
public abstract void setProductionBOM(boolean productionBOM); // setProductionBOM
/**
* Is this the BOM to be produced
* @return true if BOM
*/
public abstract boolean isProductionBOM(); // isProductionBOM
/**
* Get Production Plan
* @return M_ProductionPlan_ID
*/
public abstract int getM_ProductionPlan_ID(); // getM_ProductionPlan_ID
/**
* Get Order Line Reference
* @return C_OrderLine_ID
*/
public abstract int getC_OrderLine_ID(); // getC_OrderLine_ID
/**
* Get C_LocFrom_ID
* @return loc from
*/
public abstract int getC_LocFrom_ID(); // getC_LocFrom_ID
/**
* Set C_LocFrom_ID
* @param C_LocFrom_ID loc from
*/
public abstract void setC_LocFrom_ID(int C_LocFrom_ID); // setC_LocFrom_ID
/**
* Get C_LocTo_ID
* @return loc to
*/
public abstract int getC_LocTo_ID(); // getC_LocTo_ID
/**
* Set C_LocTo_ID
* @param C_LocTo_ID loc to
*/
public abstract void setC_LocTo_ID(int C_LocTo_ID); // setC_LocTo_ID
/**
* Get Product Cost Info
* @return product cost
*/
public abstract ProductCost getProductCost(); // getProductCost
/**
* Get Total Product Costs
* @param as accounting schema
* @param AD_Org_ID trx org
* @param zeroCostsOK zero/no costs are OK
* @return costs
*/
public abstract BigDecimal getProductCosts(MAcctSchema as, int AD_Org_ID,
boolean zeroCostsOK); // getProductCosts
/**
* Get Product
* @return product or null if no product
*/
public abstract MProduct getProduct(); // getProduct
/**
* Get Revenue Recognition
* @return C_RevenueRecognition_ID or 0
*/
public abstract int getC_RevenueRecognition_ID(); // getC_RevenueRecognition_ID
/**
* Quantity UOM
* @return Transaction or Storage M_UOM_ID
*/
public abstract int getC_UOM_ID(); // getC_UOM
/**
* Quantity
* @param qty transaction Qty
* @param isSOTrx SL order trx (i.e. negative qty)
*/
public abstract void setQty(BigDecimal qty, boolean isSOTrx); // setQty
/**
* Quantity
* @return transaction Qty
*/
public abstract BigDecimal getQty(); // getQty
/**
* Description
* @return doc line description
*/
public abstract String getDescription(); // getDescription
/**
* Line Tax
* @return C_Tax_ID
*/
public abstract int getC_Tax_ID(); // getC_Tax_ID
/**
* Get Line Number
* @return line no
*/
public abstract int getLine(); // getLine
/**
* Get BPartner
* @return C_BPartner_ID
*/
public abstract int getC_BPartner_ID(); // getC_BPartner_ID
/**
* Get C_BPartner_Location_ID
* @return BPartner Location
*/
public abstract int getC_BPartner_Location_ID(); // getC_BPartner_Location_ID
/**
* Get TrxOrg
* @return AD_OrgTrx_ID
*/
public abstract int getAD_OrgTrx_ID(); // getAD_OrgTrx_ID
/**
* Get SalesRegion.
* - get Sales Region from BPartner
* @return C_SalesRegion_ID
*/
public abstract int getC_SalesRegion_ID(); // getC_SalesRegion_ID
/**
* Get Project
* @return C_Project_ID
*/
public abstract int getC_Project_ID(); // getC_Project_ID
/**
* Get Campaign
* @return C_Campaign_ID
*/
public abstract int getC_Campaign_ID(); // getC_Campaign_ID
/**
* Get Activity
* @return C_Activity_ID
*/
public abstract int getC_Activity_ID(); // getC_Activity_ID
/**
* Get User 1
* @return user defined 1
*/
public abstract int getUser1_ID(); // getUser1_ID
/**
* Get User 2
* @return user defined 2
*/
public abstract int getUser2_ID(); // getUser2_ID
/**
* Get User Defined Column
* @param ColumnName column name
* @return user defined column value
*/
public abstract int getValue(String ColumnName); // getValue
/**
* Get Period
* @return C_Period_ID
*/
public int getC_Period_ID();
}

View File

@ -73,10 +73,6 @@ public interface ModelValidator
public static final int TIMING_AFTER_REVERSECORRECT = 13; public static final int TIMING_AFTER_REVERSECORRECT = 13;
/** Called after document is reverseaccrual */ /** Called after document is reverseaccrual */
public static final int TIMING_AFTER_REVERSEACCRUAL = 14; public static final int TIMING_AFTER_REVERSEACCRUAL = 14;
/** Called before document is posted */
public static final int TIMING_BEFORE_POST = 15;
/** Called after document is posted */
public static final int TIMING_AFTER_POST = 16;
/** /**
* Initialize Validation * Initialize Validation

View File

@ -26,7 +26,6 @@ import javax.xml.transform.*;
import javax.xml.transform.dom.*; import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*; import javax.xml.transform.stream.*;
import org.compiere.*; import org.compiere.*;
import org.compiere.acct.IDoc;
import org.compiere.util.*; import org.compiere.util.*;
import org.w3c.dom.*; import org.w3c.dom.*;
@ -3412,23 +3411,4 @@ public abstract class PO
return document; return document;
} // getDocument } // getDocument
/* Doc - To be used on ModelValidator to get the corresponding Doc from the PO */
private IDoc m_doc;
/**
* Set the accounting document associated to the PO - for use in POST ModelValidator
* @param doc Document
*/
public void setDoc(IDoc doc) {
m_doc = doc;
}
/**
* Set the accounting document associated to the PO - for use in POST ModelValidator
* @return Doc Document
*/
public IDoc getDoc() {
return m_doc;
}
} // PO } // PO

View File

@ -80,7 +80,7 @@ import org.compiere.util.*;
* @author Jorg Janke * @author Jorg Janke
* @version $Id: Doc.java,v 1.6 2006/07/30 00:53:33 jjanke Exp $ * @version $Id: Doc.java,v 1.6 2006/07/30 00:53:33 jjanke Exp $
*/ */
public abstract class Doc implements IDoc public abstract class Doc
{ {
/** AD_Table_ID's of documents */ /** AD_Table_ID's of documents */
public static int[] documentsTableID = new int[] { public static int[] documentsTableID = new int[] {
@ -136,6 +136,72 @@ public abstract class Doc implements IDoc
* M_Requisition POR * M_Requisition POR
**************************************************************************/ **************************************************************************/
/** AR Invoices - ARI */
public static final String DOCTYPE_ARInvoice = MDocType.DOCBASETYPE_ARInvoice;
/** AR Credit Memo */
public static final String DOCTYPE_ARCredit = "ARC";
/** AR Receipt */
public static final String DOCTYPE_ARReceipt = "ARR";
/** AR ProForma */
public static final String DOCTYPE_ARProForma = "ARF";
/** AP Invoices */
public static final String DOCTYPE_APInvoice = "API";
/** AP Credit Memo */
public static final String DOCTYPE_APCredit = "APC";
/** AP Payment */
public static final String DOCTYPE_APPayment = "APP";
/** CashManagement Bank Statement */
public static final String DOCTYPE_BankStatement = "CMB";
/** CashManagement Cash Journals */
public static final String DOCTYPE_CashJournal = "CMC";
/** CashManagement Allocations */
public static final String DOCTYPE_Allocation = "CMA";
/** Material Shipment */
public static final String DOCTYPE_MatShipment = "MMS";
/** Material Receipt */
public static final String DOCTYPE_MatReceipt = "MMR";
/** Material Inventory */
public static final String DOCTYPE_MatInventory = "MMI";
/** Material Movement */
public static final String DOCTYPE_MatMovement = "MMM";
/** Material Production */
public static final String DOCTYPE_MatProduction = "MMP";
/** Match Invoice */
public static final String DOCTYPE_MatMatchInv = "MXI";
/** Match PO */
public static final String DOCTYPE_MatMatchPO = "MXP";
/** GL Journal */
public static final String DOCTYPE_GLJournal = "GLJ";
/** Purchase Order */
public static final String DOCTYPE_POrder = "POO";
/** Sales Order */
public static final String DOCTYPE_SOrder = "SOO";
/** Project Issue */
public static final String DOCTYPE_ProjectIssue = "PJI";
/** Purchase Requisition */
public static final String DOCTYPE_PurchaseRequisition = "POR";
// Posting Status - AD_Reference_ID=234 //
/** Document Status */
public static final String STATUS_NotPosted = "N";
/** Document Status */
public static final String STATUS_NotBalanced = "b";
/** Document Status */
public static final String STATUS_NotConvertible = "c";
/** Document Status */
public static final String STATUS_PeriodClosed = "p";
/** Document Status */
public static final String STATUS_InvalidAccount = "i";
/** Document Status */
public static final String STATUS_PostPrepared = "y";
/** Document Status */
public static final String STATUS_Posted = "Y";
/** Document Status */
public static final String STATUS_Error = "E";
/** /**
* Create Posting document * Create Posting document
* @param ass accounting schema * @param ass accounting schema
@ -369,6 +435,9 @@ public abstract class Doc implements IDoc
/** Facts */ /** Facts */
private ArrayList<Fact> m_fact = null; private ArrayList<Fact> m_fact = null;
/** No Currency in Document Indicator (-1) */
protected static final int NO_CURRENCY = -2;
/** Actual Document Status */ /** Actual Document Status */
protected String p_Status = null; protected String p_Status = null;
/** Error Message */ /** Error Message */
@ -379,29 +448,32 @@ public abstract class Doc implements IDoc
* Get Context * Get Context
* @return context * @return context
*/ */
public Properties getCtx() protected Properties getCtx()
{ {
return m_ctx; return m_ctx;
} // getCtx } // getCtx
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#get_TableName() * Get Table Name
* @return table name
*/ */
public String get_TableName() public String get_TableName()
{ {
return p_po.get_TableName(); return p_po.get_TableName();
} // get_TableName } // get_TableName
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#get_Table_ID() * Get Table ID
* @return table id
*/ */
public int get_Table_ID() public int get_Table_ID()
{ {
return p_po.get_Table_ID(); return p_po.get_Table_ID();
} // get_Table_ID } // get_Table_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#get_ID() * Get Record_ID
* @return record id
*/ */
public int get_ID() public int get_ID()
{ {
@ -417,8 +489,20 @@ public abstract class Doc implements IDoc
return p_po; return p_po;
} // getPO } // getPO
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#post(boolean, boolean) * Post Document.
* <pre>
* - try to lock document (Processed='Y' (AND Processing='N' AND Posted='N'))
* - if not ok - return false
* - postlogic (for all Accounting Schema)
* - create Fact lines
* - postCommit
* - commits Fact lines and Document & sets Processing = 'N'
* - if error - create Note
* </pre>
* @param force if true ignore that locked
* @param repost if true ignore that already posted
* @return null if posted error otherwise
*/ */
public final String post (boolean force, boolean repost) public final String post (boolean force, boolean repost)
{ {
@ -533,30 +617,9 @@ public abstract class Doc implements IDoc
OK = false; OK = false;
} }
String validatorMsg = null;
// Call validator on before post
if (!p_Status.equals(STATUS_Error)) {
getPO().setDoc(this);
validatorMsg = ModelValidationEngine.get().fireDocValidate(getPO(), ModelValidator.TIMING_BEFORE_POST);
if (validatorMsg != null) {
p_Status = STATUS_Error;
p_Error = validatorMsg;
OK = false;
}
}
// commitFact // commitFact
p_Status = postCommit (p_Status); p_Status = postCommit (p_Status);
if (!p_Status.equals(STATUS_Error)) {
validatorMsg = ModelValidationEngine.get().fireDocValidate(getPO(), ModelValidator.TIMING_AFTER_POST);
if (validatorMsg != null) {
p_Status = STATUS_Error;
p_Error = validatorMsg;
OK = false;
}
}
// Create Note // Create Note
if (!p_Status.equals(STATUS_Posted)) if (!p_Status.equals(STATUS_Posted))
{ {
@ -776,20 +839,24 @@ public abstract class Doc implements IDoc
} // unlock } // unlock
/* (non-Javadoc) /**************************************************************************
* @see org.compiere.acct.IDoc#getDocumentType() * Load Document Type and GL Info.
* Set p_DocumentType and p_GL_Category_ID
* @return document type
*/ */
public String getDocumentType() protected String getDocumentType()
{ {
if (m_DocumentType == null) if (m_DocumentType == null)
setDocumentType(null); setDocumentType(null);
return m_DocumentType; return m_DocumentType;
} // getDocumentType } // getDocumentType
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#setDocumentType() * Load Document Type and GL Info.
* Set p_DocumentType and p_GL_Category_ID
* @param DocumentType
*/ */
public void setDocumentType (String DocumentType) protected void setDocumentType (String DocumentType)
{ {
if (DocumentType != null) if (DocumentType != null)
m_DocumentType = DocumentType; m_DocumentType = DocumentType;
@ -872,8 +939,10 @@ public abstract class Doc implements IDoc
throw new IllegalStateException("Document Type not found"); throw new IllegalStateException("Document Type not found");
} // setDocumentType } // setDocumentType
/* (non-Javadoc)
* @see org.compiere.acct.IDoc#isBalanced() /**************************************************************************
* Is the Source Document Balanced
* @return true if (source) baanced
*/ */
public boolean isBalanced() public boolean isBalanced()
{ {
@ -889,8 +958,10 @@ public abstract class Doc implements IDoc
return retValue; return retValue;
} // isBalanced } // isBalanced
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#isConvertible(org.compiere.model.MAcctSchema) * Is Document convertible to currency and Conversion Type
* @param acctSchema accounting schema
* @return true, if vonvertable to accounting currency
*/ */
public boolean isConvertible (MAcctSchema acctSchema) public boolean isConvertible (MAcctSchema acctSchema)
{ {
@ -942,8 +1013,9 @@ public abstract class Doc implements IDoc
return convertible; return convertible;
} // isConvertible } // isConvertible
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#setPeriod() * Calculate Period from DateAcct.
* m_C_Period_ID is set to -1 of not open to 0 if not found
*/ */
public void setPeriod() public void setPeriod()
{ {
@ -971,8 +1043,9 @@ public abstract class Doc implements IDoc
getDateAcct() + " - " + getDocumentType() + " => " + m_C_Period_ID); getDateAcct() + " - " + getDocumentType() + " => " + m_C_Period_ID);
} // setC_Period_ID } // setC_Period_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getC_Period_ID() * Get C_Period_ID
* @return period
*/ */
public int getC_Period_ID() public int getC_Period_ID()
{ {
@ -981,8 +1054,9 @@ public abstract class Doc implements IDoc
return m_C_Period_ID; return m_C_Period_ID;
} // getC_Period_ID } // getC_Period_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#isPeriodOpen() * Is Period Open
* @return true if period is open
*/ */
public boolean isPeriodOpen() public boolean isPeriodOpen()
{ {
@ -997,13 +1071,24 @@ public abstract class Doc implements IDoc
/*************************************************************************/ /*************************************************************************/
/** Amount Type - Invoice - Gross */
public static final int AMTTYPE_Gross = 0;
/** Amount Type - Invoice - Net */
public static final int AMTTYPE_Net = 1;
/** Amount Type - Invoice - Charge */
public static final int AMTTYPE_Charge = 2;
/** Source Amounts (may not all be used) */ /** Source Amounts (may not all be used) */
private BigDecimal[] m_Amounts = new BigDecimal[4]; private BigDecimal[] m_Amounts = new BigDecimal[4];
/** Quantity */ /** Quantity */
private BigDecimal m_qty = null; private BigDecimal m_qty = null;
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getAmount(int) * Get the Amount
* (loaded in loadDocumentDetails)
*
* @param AmtType see AMTTYPE_*
* @return Amount
*/ */
public BigDecimal getAmount(int AmtType) public BigDecimal getAmount(int AmtType)
{ {
@ -1012,10 +1097,12 @@ public abstract class Doc implements IDoc
return m_Amounts[AmtType]; return m_Amounts[AmtType];
} // getAmount } // getAmount
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#setAmount(int, BigDecimal) * Set the Amount
* @param AmtType see AMTTYPE_*
* @param amt Amount
*/ */
public void setAmount(int AmtType, BigDecimal amt) protected void setAmount(int AmtType, BigDecimal amt)
{ {
if (AmtType < 0 || AmtType >= m_Amounts.length) if (AmtType < 0 || AmtType >= m_Amounts.length)
return; return;
@ -1025,24 +1112,27 @@ public abstract class Doc implements IDoc
m_Amounts[AmtType] = amt; m_Amounts[AmtType] = amt;
} // setAmount } // setAmount
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getAmount() * Get Amount with index 0
* @return Amount (primary document amount)
*/ */
public BigDecimal getAmount() public BigDecimal getAmount()
{ {
return m_Amounts[0]; return m_Amounts[0];
} // getAmount } // getAmount
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#setQty(BigDecimal) * Set Quantity
* @param qty Quantity
*/ */
public void setQty (BigDecimal qty) protected void setQty (BigDecimal qty)
{ {
m_qty = qty; m_qty = qty;
} // setQty } // setQty
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getQty() * Get Quantity
* @return Quantity
*/ */
public BigDecimal getQty() public BigDecimal getQty()
{ {
@ -1059,8 +1149,74 @@ public abstract class Doc implements IDoc
/*************************************************************************/ /*************************************************************************/
/* (non-Javadoc) /** Account Type - Invoice - Charge */
* @see org.compiere.acct.IDoc#getValidCombination_ID(int, org.compiere.model.MAcctSchema) public static final int ACCTTYPE_Charge = 0;
/** Account Type - Invoice - AR */
public static final int ACCTTYPE_C_Receivable = 1;
/** Account Type - Invoice - AP */
public static final int ACCTTYPE_V_Liability = 2;
/** Account Type - Invoice - AP Service */
public static final int ACCTTYPE_V_Liability_Services = 3;
/** Account Type - Invoice - AR Service */
public static final int ACCTTYPE_C_Receivable_Services = 4;
/** Account Type - Payment - Unallocated */
public static final int ACCTTYPE_UnallocatedCash = 10;
/** Account Type - Payment - Transfer */
public static final int ACCTTYPE_BankInTransit = 11;
/** Account Type - Payment - Selection */
public static final int ACCTTYPE_PaymentSelect = 12;
/** Account Type - Payment - Prepayment */
public static final int ACCTTYPE_C_Prepayment = 13;
/** Account Type - Payment - Prepayment */
public static final int ACCTTYPE_V_Prepayment = 14;
/** Account Type - Cash - Asset */
public static final int ACCTTYPE_CashAsset = 20;
/** Account Type - Cash - Transfer */
public static final int ACCTTYPE_CashTransfer = 21;
/** Account Type - Cash - Expense */
public static final int ACCTTYPE_CashExpense = 22;
/** Account Type - Cash - Receipt */
public static final int ACCTTYPE_CashReceipt = 23;
/** Account Type - Cash - Difference */
public static final int ACCTTYPE_CashDifference = 24;
/** Account Type - Allocation - Discount Expense (AR) */
public static final int ACCTTYPE_DiscountExp = 30;
/** Account Type - Allocation - Discount Revenue (AP) */
public static final int ACCTTYPE_DiscountRev = 31;
/** Account Type - Allocation - Write Off */
public static final int ACCTTYPE_WriteOff = 32;
/** Account Type - Bank Statement - Asset */
public static final int ACCTTYPE_BankAsset = 40;
/** Account Type - Bank Statement - Interest Revenue */
public static final int ACCTTYPE_InterestRev = 41;
/** Account Type - Bank Statement - Interest Exp */
public static final int ACCTTYPE_InterestExp = 42;
/** Inventory Accounts - Differnces */
public static final int ACCTTYPE_InvDifferences = 50;
/** Inventory Accounts - NIR */
public static final int ACCTTYPE_NotInvoicedReceipts = 51;
/** Project Accounts - Assets */
public static final int ACCTTYPE_ProjectAsset = 61;
/** Project Accounts - WIP */
public static final int ACCTTYPE_ProjectWIP = 62;
/** GL Accounts - PPV Offset */
public static final int ACCTTYPE_PPVOffset = 101;
/** GL Accounts - Commitment Offset */
public static final int ACCTTYPE_CommitmentOffset = 111;
/**
* Get the Valid Combination id for Accounting Schema
* @param AcctType see ACCTTYPE_*
* @param as accounting schema
* @return C_ValidCombination_ID
*/ */
public int getValidCombination_ID (int AcctType, MAcctSchema as) public int getValidCombination_ID (int AcctType, MAcctSchema as)
{ {
@ -1274,8 +1430,11 @@ public abstract class Doc implements IDoc
return Account_ID; return Account_ID;
} // getAccount_ID } // getAccount_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getAccount(int, org.compiere.model.MAcctSchema) * Get the account for Accounting Schema
* @param AcctType see ACCTTYPE_*
* @param as accounting schema
* @return Account
*/ */
public final MAccount getAccount (int AcctType, MAcctSchema as) public final MAccount getAccount (int AcctType, MAcctSchema as)
{ {
@ -1306,8 +1465,10 @@ public abstract class Doc implements IDoc
return no == 1; return no == 1;
} // save } // save
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getDocLine(int) * Get DocLine with ID
* @param Record_ID Record ID
* @return DocLine
*/ */
public DocLine getDocLine (int Record_ID) public DocLine getDocLine (int Record_ID)
{ {
@ -1332,24 +1493,27 @@ public abstract class Doc implements IDoc
} // toString } // toString
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getAD_Client_ID() * Get AD_Client_ID
* @return client
*/ */
public int getAD_Client_ID() public int getAD_Client_ID()
{ {
return p_po.getAD_Client_ID(); return p_po.getAD_Client_ID();
} // getAD_Client_ID } // getAD_Client_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getAD_Org_ID() * Get AD_Org_ID
* @return org
*/ */
public int getAD_Org_ID() public int getAD_Org_ID()
{ {
return p_po.getAD_Org_ID(); return p_po.getAD_Org_ID();
} // getAD_Org_ID } // getAD_Org_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getDocumentNo() * Get Document No
* @return document No
*/ */
public String getDocumentNo() public String getDocumentNo()
{ {
@ -1364,8 +1528,9 @@ public abstract class Doc implements IDoc
return m_DocumentNo; return m_DocumentNo;
} // getDocumentNo } // getDocumentNo
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getDescription() * Get Description
* @return Description
*/ */
public String getDescription() public String getDescription()
{ {
@ -1380,8 +1545,9 @@ public abstract class Doc implements IDoc
return m_Description; return m_Description;
} // getDescription } // getDescription
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getC_Currency_ID() * Get C_Currency_ID
* @return currency
*/ */
public int getC_Currency_ID() public int getC_Currency_ID()
{ {
@ -1400,48 +1566,54 @@ public abstract class Doc implements IDoc
return m_C_Currency_ID; return m_C_Currency_ID;
} // getC_Currency_ID } // getC_Currency_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#setC_Currency_ID(int) * Set C_Currency_ID
* @param C_Currency_ID id
*/ */
public void setC_Currency_ID (int C_Currency_ID) public void setC_Currency_ID (int C_Currency_ID)
{ {
m_C_Currency_ID = C_Currency_ID; m_C_Currency_ID = C_Currency_ID;
} // setC_Currency_ID } // setC_Currency_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#isMultiCurrency() * Is Multi Currency
* @return mc
*/ */
public boolean isMultiCurrency() public boolean isMultiCurrency()
{ {
return m_MultiCurrency; return m_MultiCurrency;
} // isMultiCurrency } // isMultiCurrency
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#setIsMultiCurrency(boolean) * Set Multi Currency
* @param mc multi currency
*/ */
public void setIsMultiCurrency (boolean mc) protected void setIsMultiCurrency (boolean mc)
{ {
m_MultiCurrency = mc; m_MultiCurrency = mc;
} // setIsMultiCurrency } // setIsMultiCurrency
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#isTaxIncluded() * Is Tax Included
* @return tax incl
*/ */
public boolean isTaxIncluded() public boolean isTaxIncluded()
{ {
return m_TaxIncluded; return m_TaxIncluded;
} // isTaxIncluded } // isTaxIncluded
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#setIsTaxIncluded(boolean) * Set Tax Includedy
* @param ti Tax Included
*/ */
public void setIsTaxIncluded (boolean ti) protected void setIsTaxIncluded (boolean ti)
{ {
m_TaxIncluded = ti; m_TaxIncluded = ti;
} // setIsTaxIncluded } // setIsTaxIncluded
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getC_ConversionType_ID() * Get C_ConversionType_ID
* @return ConversionType
*/ */
public int getC_ConversionType_ID() public int getC_ConversionType_ID()
{ {
@ -1455,16 +1627,18 @@ public abstract class Doc implements IDoc
return 0; return 0;
} // getC_ConversionType_ID } // getC_ConversionType_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getGL_Category_ID() * Get GL_Category_ID
* @return categoory
*/ */
public int getGL_Category_ID() public int getGL_Category_ID()
{ {
return m_GL_Category_ID; return m_GL_Category_ID;
} // getGL_Category_ID } // getGL_Category_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getGL_Budget_ID() * Get GL_Category_ID
* @return categoory
*/ */
public int getGL_Budget_ID() public int getGL_Budget_ID()
{ {
@ -1478,8 +1652,9 @@ public abstract class Doc implements IDoc
return 0; return 0;
} // getGL_Budget_ID } // getGL_Budget_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getDateAcct() * Get Accounting Date
* @return currency
*/ */
public Timestamp getDateAcct() public Timestamp getDateAcct()
{ {
@ -1495,16 +1670,18 @@ public abstract class Doc implements IDoc
throw new IllegalStateException("No DateAcct"); throw new IllegalStateException("No DateAcct");
} // getDateAcct } // getDateAcct
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#setDateAcct(Timestamp) * Set Date Acct
* @param da accounting date
*/ */
public void setDateAcct (Timestamp da) protected void setDateAcct (Timestamp da)
{ {
m_DateAcct = da; m_DateAcct = da;
} // setDateAcct } // setDateAcct
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getDateDoc() * Get Document Date
* @return currency
*/ */
public Timestamp getDateDoc() public Timestamp getDateDoc()
{ {
@ -1522,16 +1699,18 @@ public abstract class Doc implements IDoc
throw new IllegalStateException("No DateDoc"); throw new IllegalStateException("No DateDoc");
} // getDateDoc } // getDateDoc
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#setDateDoc(Timestamp) * Set Date Doc
* @param dd document date
*/ */
public void setDateDoc (Timestamp dd) protected void setDateDoc (Timestamp dd)
{ {
m_DateDoc = dd; m_DateDoc = dd;
} // setDateDoc } // setDateDoc
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#isPosted() * Is Document Posted
* @return true if posted
*/ */
public boolean isPosted() public boolean isPosted()
{ {
@ -1547,8 +1726,9 @@ public abstract class Doc implements IDoc
throw new IllegalStateException("No Posted"); throw new IllegalStateException("No Posted");
} // isPosted } // isPosted
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#isSOTrx() * Is Sales Trx
* @return true if posted
*/ */
public boolean isSOTrx() public boolean isSOTrx()
{ {
@ -1566,8 +1746,9 @@ public abstract class Doc implements IDoc
return false; return false;
} // isSOTrx } // isSOTrx
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getC_DocType_ID() * Get C_DocType_ID
* @return DocType
*/ */
public int getC_DocType_ID() public int getC_DocType_ID()
{ {
@ -1588,8 +1769,9 @@ public abstract class Doc implements IDoc
return 0; return 0;
} // getC_DocType_ID } // getC_DocType_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getC_Charge_ID() * Get header level C_Charge_ID
* @return Charge
*/ */
public int getC_Charge_ID() public int getC_Charge_ID()
{ {
@ -1603,8 +1785,9 @@ public abstract class Doc implements IDoc
return 0; return 0;
} // getC_Charge_ID } // getC_Charge_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getSalesRep_ID() * Get SalesRep_ID
* @return SalesRep
*/ */
public int getSalesRep_ID() public int getSalesRep_ID()
{ {
@ -1618,8 +1801,9 @@ public abstract class Doc implements IDoc
return 0; return 0;
} // getSalesRep_ID } // getSalesRep_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getC_BankAccount_ID() * Get C_BankAccount_ID
* @return BankAccount
*/ */
public int getC_BankAccount_ID() public int getC_BankAccount_ID()
{ {
@ -1638,16 +1822,18 @@ public abstract class Doc implements IDoc
return m_C_BankAccount_ID; return m_C_BankAccount_ID;
} // getC_BankAccount_ID } // getC_BankAccount_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#setC_BankAccount_ID(int) * Set C_BankAccount_ID
* @param C_BankAccount_ID bank acct
*/ */
public void setC_BankAccount_ID (int C_BankAccount_ID) protected void setC_BankAccount_ID (int C_BankAccount_ID)
{ {
m_C_BankAccount_ID = C_BankAccount_ID; m_C_BankAccount_ID = C_BankAccount_ID;
} // setC_BankAccount_ID } // setC_BankAccount_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getC_CashBook_ID() * Get C_CashBook_ID
* @return CashBook
*/ */
public int getC_CashBook_ID() public int getC_CashBook_ID()
{ {
@ -1666,16 +1852,18 @@ public abstract class Doc implements IDoc
return m_C_CashBook_ID; return m_C_CashBook_ID;
} // getC_CashBook_ID } // getC_CashBook_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#setC_CashBook_ID(int) * Set C_CashBook_ID
* @param C_CashBook_ID cash book
*/ */
public void setC_CashBook_ID (int C_CashBook_ID) protected void setC_CashBook_ID (int C_CashBook_ID)
{ {
m_C_CashBook_ID = C_CashBook_ID; m_C_CashBook_ID = C_CashBook_ID;
} // setC_CashBook_ID } // setC_CashBook_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getM_Warehouse_ID() * Get M_Warehouse_ID
* @return Warehouse
*/ */
public int getM_Warehouse_ID() public int getM_Warehouse_ID()
{ {
@ -1690,8 +1878,9 @@ public abstract class Doc implements IDoc
} // getM_Warehouse_ID } // getM_Warehouse_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getC_BPartner_ID() * Get C_BPartner_ID
* @return BPartner
*/ */
public int getC_BPartner_ID() public int getC_BPartner_ID()
{ {
@ -1710,16 +1899,18 @@ public abstract class Doc implements IDoc
return m_C_BPartner_ID; return m_C_BPartner_ID;
} // getC_BPartner_ID } // getC_BPartner_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#setC_BPartner_ID() * Set C_BPartner_ID
* @param C_BPartner_ID bp
*/ */
public void setC_BPartner_ID (int C_BPartner_ID) protected void setC_BPartner_ID (int C_BPartner_ID)
{ {
m_C_BPartner_ID = C_BPartner_ID; m_C_BPartner_ID = C_BPartner_ID;
} // setC_BPartner_ID } // setC_BPartner_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getC_BPartner_Location_ID() * Get C_BPartner_Location_ID
* @return BPartner Location
*/ */
public int getC_BPartner_Location_ID() public int getC_BPartner_Location_ID()
{ {
@ -1733,8 +1924,9 @@ public abstract class Doc implements IDoc
return 0; return 0;
} // getC_BPartner_Location_ID } // getC_BPartner_Location_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getC_Project_ID() * Get C_Project_ID
* @return Project
*/ */
public int getC_Project_ID() public int getC_Project_ID()
{ {
@ -1748,8 +1940,9 @@ public abstract class Doc implements IDoc
return 0; return 0;
} // getC_Project_ID } // getC_Project_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getC_SalesRegion_ID() * Get C_SalesRegion_ID
* @return Sales Region
*/ */
public int getC_SalesRegion_ID() public int getC_SalesRegion_ID()
{ {
@ -1763,8 +1956,9 @@ public abstract class Doc implements IDoc
return 0; return 0;
} // getC_SalesRegion_ID } // getC_SalesRegion_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getBP_C_SalesRegion_ID() * Get C_SalesRegion_ID
* @return Sales Region
*/ */
public int getBP_C_SalesRegion_ID() public int getBP_C_SalesRegion_ID()
{ {
@ -1787,13 +1981,14 @@ public abstract class Doc implements IDoc
* Set C_SalesRegion_ID * Set C_SalesRegion_ID
* @param C_SalesRegion_ID id * @param C_SalesRegion_ID id
*/ */
public void setBP_C_SalesRegion_ID (int C_SalesRegion_ID) protected void setBP_C_SalesRegion_ID (int C_SalesRegion_ID)
{ {
m_BP_C_SalesRegion_ID = C_SalesRegion_ID; m_BP_C_SalesRegion_ID = C_SalesRegion_ID;
} // setBP_C_SalesRegion_ID } // setBP_C_SalesRegion_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getC_Activity_ID() * Get C_Activity_ID
* @return Activity
*/ */
public int getC_Activity_ID() public int getC_Activity_ID()
{ {
@ -1807,8 +2002,9 @@ public abstract class Doc implements IDoc
return 0; return 0;
} // getC_Activity_ID } // getC_Activity_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getC_Campaign_ID() * Get C_Campaign_ID
* @return Campaign
*/ */
public int getC_Campaign_ID() public int getC_Campaign_ID()
{ {
@ -1822,8 +2018,9 @@ public abstract class Doc implements IDoc
return 0; return 0;
} // getC_Campaign_ID } // getC_Campaign_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getM_Product_ID() * Get M_Product_ID
* @return Product
*/ */
public int getM_Product_ID() public int getM_Product_ID()
{ {
@ -1837,8 +2034,9 @@ public abstract class Doc implements IDoc
return 0; return 0;
} // getM_Product_ID } // getM_Product_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getAD_OrgTrx_ID() * Get AD_OrgTrx_ID
* @return Trx Org
*/ */
public int getAD_OrgTrx_ID() public int getAD_OrgTrx_ID()
{ {
@ -1852,40 +2050,45 @@ public abstract class Doc implements IDoc
return 0; return 0;
} // getAD_OrgTrx_ID } // getAD_OrgTrx_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getC_LocFrom_ID() * Get C_LocFrom_ID
* @return loc from
*/ */
public int getC_LocFrom_ID() public int getC_LocFrom_ID()
{ {
return m_C_LocFrom_ID; return m_C_LocFrom_ID;
} // getC_LocFrom_ID } // getC_LocFrom_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#setC_LocFrom_ID(int) * Set C_LocFrom_ID
* @param C_LocFrom_ID loc from
*/ */
public void setC_LocFrom_ID(int C_LocFrom_ID) protected void setC_LocFrom_ID(int C_LocFrom_ID)
{ {
m_C_LocFrom_ID = C_LocFrom_ID; m_C_LocFrom_ID = C_LocFrom_ID;
} // setC_LocFrom_ID } // setC_LocFrom_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getC_LocTo_ID() * Get C_LocTo_ID
* @return loc to
*/ */
public int getC_LocTo_ID() public int getC_LocTo_ID()
{ {
return m_C_LocTo_ID; return m_C_LocTo_ID;
} // getC_LocTo_ID } // getC_LocTo_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#setC_LocTo_ID(int) * Set C_LocTo_ID
* @param C_LocTo_ID loc to
*/ */
public void setC_LocTo_ID(int C_LocTo_ID) protected void setC_LocTo_ID(int C_LocTo_ID)
{ {
m_C_LocTo_ID = C_LocTo_ID; m_C_LocTo_ID = C_LocTo_ID;
} // setC_LocTo_ID } // setC_LocTo_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getUser1_ID() * Get User1_ID
* @return Campaign
*/ */
public int getUser1_ID() public int getUser1_ID()
{ {
@ -1899,8 +2102,9 @@ public abstract class Doc implements IDoc
return 0; return 0;
} // getUser1_ID } // getUser1_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getUser2_ID() * Get User2_ID
* @return Campaign
*/ */
public int getUser2_ID() public int getUser2_ID()
{ {
@ -1914,8 +2118,9 @@ public abstract class Doc implements IDoc
return 0; return 0;
} // getUser2_ID } // getUser2_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getValue(java.lang.String) * Get User Defined value
* @return User defined
*/ */
public int getValue (String ColumnName) public int getValue (String ColumnName)
{ {
@ -1939,21 +2144,17 @@ public abstract class Doc implements IDoc
*/ */
protected abstract String loadDocumentDetails (); protected abstract String loadDocumentDetails ();
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#getBalance() * Get Source Currency Balance - subtracts line (and tax) amounts from total - no rounding
* @return positive amount, if total header is bigger than lines
*/ */
public abstract BigDecimal getBalance(); public abstract BigDecimal getBalance();
/* (non-Javadoc) /**
* @see org.compiere.acct.IDoc#createFacts(org.compiere.model.MAcctSchema) * Create Facts (the accounting logic)
* @param as accounting schema
* @return Facts
*/ */
public abstract ArrayList<Fact> createFacts (MAcctSchema as); public abstract ArrayList<Fact> createFacts (MAcctSchema as);
/* (non-Javadoc)
* @see org.compiere.acct.IDoc#getFacts()
*/
public ArrayList<Fact> getFacts() {
return m_fact;
}
} // Doc } // Doc

View File

@ -28,7 +28,7 @@ import org.compiere.util.*;
* @author Jorg Janke * @author Jorg Janke
* @version $Id: DocLine.java,v 1.2 2006/07/30 00:53:33 jjanke Exp $ * @version $Id: DocLine.java,v 1.2 2006/07/30 00:53:33 jjanke Exp $
*/ */
public class DocLine implements IDocLine public class DocLine
{ {
/** /**
* Create Document Line * Create Document Line
@ -103,8 +103,9 @@ public class DocLine implements IDocLine
/** Period */ /** Period */
private int m_C_Period_ID = -1; private int m_C_Period_ID = -1;
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getC_Currency_ID() * Get Currency
* @return c_Currency_ID
*/ */
public int getC_Currency_ID () public int getC_Currency_ID ()
{ {
@ -123,8 +124,9 @@ public class DocLine implements IDocLine
return m_C_Currency_ID; return m_C_Currency_ID;
} // getC_Currency_ID } // getC_Currency_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getC_ConversionType_ID() * Get Conversion Type
* @return C_ConversionType_ID
*/ */
public int getC_ConversionType_ID () public int getC_ConversionType_ID ()
{ {
@ -152,8 +154,9 @@ public class DocLine implements IDocLine
m_C_ConversionType_ID = C_ConversionType_ID; m_C_ConversionType_ID = C_ConversionType_ID;
} // setC_ConversionType_ID } // setC_ConversionType_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#setAmount(java.math.BigDecimal) * Set Amount (DR)
* @param sourceAmt source amt
*/ */
public void setAmount (BigDecimal sourceAmt) public void setAmount (BigDecimal sourceAmt)
{ {
@ -161,8 +164,10 @@ public class DocLine implements IDocLine
m_AmtSourceCr = Env.ZERO; m_AmtSourceCr = Env.ZERO;
} // setAmounts } // setAmounts
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#setAmount(java.math.BigDecimal, java.math.BigDecimal) * Set Amounts
* @param amtSourceDr source amount dr
* @param amtSourceCr source amount cr
*/ */
public void setAmount (BigDecimal amtSourceDr, BigDecimal amtSourceCr) public void setAmount (BigDecimal amtSourceDr, BigDecimal amtSourceCr)
{ {
@ -170,8 +175,11 @@ public class DocLine implements IDocLine
m_AmtSourceCr = amtSourceCr == null ? Env.ZERO : amtSourceCr; m_AmtSourceCr = amtSourceCr == null ? Env.ZERO : amtSourceCr;
} // setAmounts } // setAmounts
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#setConvertedAmt(int, java.math.BigDecimal, java.math.BigDecimal) * Set Converted Amounts
* @param C_AcctSchema_ID acct schema
* @param amtAcctDr acct amount dr
* @param amtAcctCr acct amount cr
*/ */
public void setConvertedAmt (int C_AcctSchema_ID, BigDecimal amtAcctDr, BigDecimal amtAcctCr) public void setConvertedAmt (int C_AcctSchema_ID, BigDecimal amtAcctDr, BigDecimal amtAcctCr)
{ {
@ -180,48 +188,54 @@ public class DocLine implements IDocLine
m_AmtAcctCr = amtAcctCr; m_AmtAcctCr = amtAcctCr;
} // setConvertedAmt } // setConvertedAmt
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getAmtSource() * Line Net Amount or Dr-Cr
* @return balance
*/ */
public BigDecimal getAmtSource() public BigDecimal getAmtSource()
{ {
return m_AmtSourceDr.subtract(m_AmtSourceCr); return m_AmtSourceDr.subtract(m_AmtSourceCr);
} // getAmount } // getAmount
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getAmtSourceDr() * Get (Journal) Line Source Dr Amount
* @return DR source amount
*/ */
public BigDecimal getAmtSourceDr() public BigDecimal getAmtSourceDr()
{ {
return m_AmtSourceDr; return m_AmtSourceDr;
} // getAmtSourceDr } // getAmtSourceDr
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getAmtSourceCr() * Get (Journal) Line Source Cr Amount
* @return CR source amount
*/ */
public BigDecimal getAmtSourceCr() public BigDecimal getAmtSourceCr()
{ {
return m_AmtSourceCr; return m_AmtSourceCr;
} // getAmtSourceCr } // getAmtSourceCr
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getAmtAcctDr() * Line Journal Accounted Dr Amount
* @return DR accounted amount
*/ */
public BigDecimal getAmtAcctDr() public BigDecimal getAmtAcctDr()
{ {
return m_AmtAcctDr; return m_AmtAcctDr;
} // getAmtAcctDr } // getAmtAcctDr
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getAmtAcctCr() * Line Journal Accounted Cr Amount
* @return CR accounted amount
*/ */
public BigDecimal getAmtAcctCr() public BigDecimal getAmtAcctCr()
{ {
return m_AmtAcctCr; return m_AmtAcctCr;
} // getAmtAccrCr } // getAmtAccrCr
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getChargeAmt() * Charge Amount
* @return charge amount
*/ */
public BigDecimal getChargeAmt() public BigDecimal getChargeAmt()
{ {
@ -235,8 +249,11 @@ public class DocLine implements IDocLine
return Env.ZERO; return Env.ZERO;
} // getChargeAmt } // getChargeAmt
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#setAmount(java.math.BigDecimal, java.math.BigDecimal, java.math.BigDecimal) * Set Product Amounts
* @param LineNetAmt Line Net Amt
* @param PriceList Price List
* @param Qty Qty for discount calc
*/ */
public void setAmount (BigDecimal LineNetAmt, BigDecimal PriceList, BigDecimal Qty) public void setAmount (BigDecimal LineNetAmt, BigDecimal PriceList, BigDecimal Qty)
{ {
@ -254,24 +271,27 @@ public class DocLine implements IDocLine
// + " => Amount=" + getAmount()); // + " => Amount=" + getAmount());
} // setAmounts } // setAmounts
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getDiscount() * Line Discount
* @return discount amount
*/ */
public BigDecimal getDiscount() public BigDecimal getDiscount()
{ {
return m_DiscountAmt; return m_DiscountAmt;
} // getDiscount } // getDiscount
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getListAmount() * Line List Amount
* @return list amount
*/ */
public BigDecimal getListAmount() public BigDecimal getListAmount()
{ {
return m_ListAmt; return m_ListAmt;
} // getListAmount } // getListAmount
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#setLineNetAmtDifference(java.math.BigDecimal) * Set Line Net Amt Difference
* @param diff difference (to be subtracted)
*/ */
public void setLineNetAmtDifference (BigDecimal diff) public void setLineNetAmtDifference (BigDecimal diff)
{ {
@ -284,16 +304,18 @@ public class DocLine implements IDocLine
log.fine(msg); log.fine(msg);
} // setLineNetAmtDifference } // setLineNetAmtDifference
/* (non-Javadoc) /**************************************************************************
* @see org.compiere.acct.IDocLine#setDateAcct(java.sql.Timestamp) * Set Accounting Date
* @param dateAcct acct date
*/ */
public void setDateAcct (Timestamp dateAcct) public void setDateAcct (Timestamp dateAcct)
{ {
m_DateAcct = dateAcct; m_DateAcct = dateAcct;
} // setDateAcct } // setDateAcct
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getDateAcct() * Get Accounting Date
* @return accounting date
*/ */
public Timestamp getDateAcct () public Timestamp getDateAcct ()
{ {
@ -310,16 +332,18 @@ public class DocLine implements IDocLine
return m_DateAcct; return m_DateAcct;
} // getDateAcct } // getDateAcct
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#setDateDoc(java.sql.Timestamp) * Set Document Date
* @param dateDoc doc date
*/ */
public void setDateDoc (Timestamp dateDoc) public void setDateDoc (Timestamp dateDoc)
{ {
m_DateDoc = dateDoc; m_DateDoc = dateDoc;
} // setDateDoc } // setDateDoc
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getDateDoc() * Get Document Date
* @return document date
*/ */
public Timestamp getDateDoc () public Timestamp getDateDoc ()
{ {
@ -337,24 +361,30 @@ public class DocLine implements IDocLine
} // getDateDoc } // getDateDoc
/* (non-Javadoc) /**************************************************************************
* @see org.compiere.acct.IDocLine#setAccount(org.compiere.model.MAccount) * Set GL Journal Account
* @param acct account
*/ */
public void setAccount (MAccount acct) public void setAccount (MAccount acct)
{ {
m_account = acct; m_account = acct;
} // setAccount } // setAccount
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getAccount() * Get GL Journal Account
* @return account
*/ */
public MAccount getAccount() public MAccount getAccount()
{ {
return m_account; return m_account;
} // getAccount } // getAccount
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getAccount(int, org.compiere.model.MAcctSchema) * Line Account from Product (or Charge).
*
* @param AcctType see ProductCost.ACCTTYPE_* (0..3)
* @param as Accounting schema
* @return Requested Product Account
*/ */
public MAccount getAccount (int AcctType, MAcctSchema as) public MAccount getAccount (int AcctType, MAcctSchema as)
{ {
@ -388,8 +418,11 @@ public class DocLine implements IDocLine
return 0; return 0;
} // getC_Charge_ID } // getC_Charge_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getChargeAccount(org.compiere.model.MAcctSchema, java.math.BigDecimal) * Get Charge Account
* @param as account schema
* @param amount amount for expense(+)/revenue(-)
* @return Charge Account or null
*/ */
public MAccount getChargeAccount (MAcctSchema as, BigDecimal amount) public MAccount getChargeAccount (MAcctSchema as, BigDecimal amount)
{ {
@ -403,7 +436,7 @@ public class DocLine implements IDocLine
* Get Period * Get Period
* @return C_Period_ID * @return C_Period_ID
*/ */
public int getC_Period_ID() protected int getC_Period_ID()
{ {
if (m_C_Period_ID == -1) if (m_C_Period_ID == -1)
{ {
@ -429,32 +462,36 @@ public class DocLine implements IDocLine
m_C_Period_ID = C_Period_ID; m_C_Period_ID = C_Period_ID;
} // setC_Period_ID } // setC_Period_ID
/* (non-Javadoc) /**************************************************************************
* @see org.compiere.acct.IDocLine#getC_AcctSchema_ID() * Get (Journal) AcctSchema
* @return C_AcctSchema_ID
*/ */
public int getC_AcctSchema_ID() public int getC_AcctSchema_ID()
{ {
return m_C_AcctSchema_ID; return m_C_AcctSchema_ID;
} // getC_AcctSchema_ID } // getC_AcctSchema_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#get_ID() * Get Line ID
* @return id
*/ */
public int get_ID() public int get_ID()
{ {
return p_po.get_ID(); return p_po.get_ID();
} // get_ID } // get_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getAD_Org_ID() * Get AD_Org_ID
* @return org
*/ */
public int getAD_Org_ID() public int getAD_Org_ID()
{ {
return p_po.getAD_Org_ID(); return p_po.getAD_Org_ID();
} // getAD_Org_ID } // getAD_Org_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getOrder_Org_ID() * Get Order AD_Org_ID
* @return order org if defined
*/ */
public int getOrder_Org_ID() public int getOrder_Org_ID()
{ {
@ -469,8 +506,9 @@ public class DocLine implements IDocLine
return getAD_Org_ID(); return getAD_Org_ID();
} // getOrder_Org_ID } // getOrder_Org_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getM_Product_ID() * Product
* @return M_Product_ID
*/ */
public int getM_Product_ID() public int getM_Product_ID()
{ {
@ -484,8 +522,9 @@ public class DocLine implements IDocLine
return 0; return 0;
} // getM_Product_ID } // getM_Product_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#isItem() * Is this an Item Product (vs. not a Service, a charge)
* @return true if product
*/ */
public boolean isItem() public boolean isItem()
{ {
@ -502,8 +541,9 @@ public class DocLine implements IDocLine
return m_isItem.booleanValue(); return m_isItem.booleanValue();
} // isItem } // isItem
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getM_AttributeSetInstance_ID() * ASI
* @return M_AttributeSetInstance_ID
*/ */
public int getM_AttributeSetInstance_ID() public int getM_AttributeSetInstance_ID()
{ {
@ -517,8 +557,9 @@ public class DocLine implements IDocLine
return 0; return 0;
} // getM_AttributeSetInstance_ID } // getM_AttributeSetInstance_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getM_Locator_ID() * Get Warehouse Locator (from)
* @return M_Locator_ID
*/ */
public int getM_Locator_ID() public int getM_Locator_ID()
{ {
@ -532,8 +573,9 @@ public class DocLine implements IDocLine
return 0; return 0;
} // getM_Locator_ID } // getM_Locator_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getM_LocatorTo_ID() * Get Warehouse Locator To
* @return M_Locator_ID
*/ */
public int getM_LocatorTo_ID() public int getM_LocatorTo_ID()
{ {
@ -547,24 +589,27 @@ public class DocLine implements IDocLine
return 0; return 0;
} // getM_LocatorTo_ID } // getM_LocatorTo_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#setProductionBOM(boolean) * Set Production BOM flag
* @param productionBOM flag
*/ */
public void setProductionBOM(boolean productionBOM) public void setProductionBOM(boolean productionBOM)
{ {
m_productionBOM = productionBOM; m_productionBOM = productionBOM;
} // setProductionBOM } // setProductionBOM
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#isProductionBOM() * Is this the BOM to be produced
* @return true if BOM
*/ */
public boolean isProductionBOM() public boolean isProductionBOM()
{ {
return m_productionBOM; return m_productionBOM;
} // isProductionBOM } // isProductionBOM
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getM_ProductionPlan_ID() * Get Production Plan
* @return M_ProductionPlan_ID
*/ */
public int getM_ProductionPlan_ID() public int getM_ProductionPlan_ID()
{ {
@ -578,8 +623,9 @@ public class DocLine implements IDocLine
return 0; return 0;
} // getM_ProductionPlan_ID } // getM_ProductionPlan_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getC_OrderLine_ID() * Get Order Line Reference
* @return C_OrderLine_ID
*/ */
public int getC_OrderLine_ID() public int getC_OrderLine_ID()
{ {
@ -593,40 +639,45 @@ public class DocLine implements IDocLine
return 0; return 0;
} // getC_OrderLine_ID } // getC_OrderLine_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getC_LocFrom_ID() * Get C_LocFrom_ID
* @return loc from
*/ */
public int getC_LocFrom_ID() public int getC_LocFrom_ID()
{ {
return m_C_LocFrom_ID; return m_C_LocFrom_ID;
} // getC_LocFrom_ID } // getC_LocFrom_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#setC_LocFrom_ID(int) * Set C_LocFrom_ID
* @param C_LocFrom_ID loc from
*/ */
public void setC_LocFrom_ID(int C_LocFrom_ID) public void setC_LocFrom_ID(int C_LocFrom_ID)
{ {
m_C_LocFrom_ID = C_LocFrom_ID; m_C_LocFrom_ID = C_LocFrom_ID;
} // setC_LocFrom_ID } // setC_LocFrom_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getC_LocTo_ID() * Get C_LocTo_ID
* @return loc to
*/ */
public int getC_LocTo_ID() public int getC_LocTo_ID()
{ {
return m_C_LocTo_ID; return m_C_LocTo_ID;
} // getC_LocTo_ID } // getC_LocTo_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#setC_LocTo_ID(int) * Set C_LocTo_ID
* @param C_LocTo_ID loc to
*/ */
public void setC_LocTo_ID(int C_LocTo_ID) public void setC_LocTo_ID(int C_LocTo_ID)
{ {
m_C_LocTo_ID = C_LocTo_ID; m_C_LocTo_ID = C_LocTo_ID;
} // setC_LocTo_ID } // setC_LocTo_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getProductCost() * Get Product Cost Info
* @return product cost
*/ */
public ProductCost getProductCost() public ProductCost getProductCost()
{ {
@ -636,8 +687,12 @@ public class DocLine implements IDocLine
return m_productCost; return m_productCost;
} // getProductCost } // getProductCost
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getProductCosts(org.compiere.model.MAcctSchema, int, boolean) * Get Total Product Costs
* @param as accounting schema
* @param AD_Org_ID trx org
* @param zeroCostsOK zero/no costs are OK
* @return costs
*/ */
public BigDecimal getProductCosts (MAcctSchema as, int AD_Org_ID, boolean zeroCostsOK) public BigDecimal getProductCosts (MAcctSchema as, int AD_Org_ID, boolean zeroCostsOK)
{ {
@ -651,8 +706,9 @@ public class DocLine implements IDocLine
return Env.ZERO; return Env.ZERO;
} // getProductCosts } // getProductCosts
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getProduct() * Get Product
* @return product or null if no product
*/ */
public MProduct getProduct() public MProduct getProduct()
{ {
@ -664,8 +720,9 @@ public class DocLine implements IDocLine
return null; return null;
} // getProduct } // getProduct
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getC_RevenueRecognition_ID() * Get Revenue Recognition
* @return C_RevenueRecognition_ID or 0
*/ */
public int getC_RevenueRecognition_ID() public int getC_RevenueRecognition_ID()
{ {
@ -675,8 +732,9 @@ public class DocLine implements IDocLine
return 0; return 0;
} // getC_RevenueRecognition_ID } // getC_RevenueRecognition_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getC_UOM_ID() * Quantity UOM
* @return Transaction or Storage M_UOM_ID
*/ */
public int getC_UOM_ID() public int getC_UOM_ID()
{ {
@ -696,8 +754,10 @@ public class DocLine implements IDocLine
return 0; return 0;
} // getC_UOM } // getC_UOM
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#setQty(java.math.BigDecimal, boolean) * Quantity
* @param qty transaction Qty
* @param isSOTrx SL order trx (i.e. negative qty)
*/ */
public void setQty (BigDecimal qty, boolean isSOTrx) public void setQty (BigDecimal qty, boolean isSOTrx)
{ {
@ -710,8 +770,9 @@ public class DocLine implements IDocLine
getProductCost().setQty (qty); getProductCost().setQty (qty);
} // setQty } // setQty
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getQty() * Quantity
* @return transaction Qty
*/ */
public BigDecimal getQty() public BigDecimal getQty()
{ {
@ -720,8 +781,9 @@ public class DocLine implements IDocLine
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getDescription() * Description
* @return doc line description
*/ */
public String getDescription() public String getDescription()
{ {
@ -731,8 +793,9 @@ public class DocLine implements IDocLine
return null; return null;
} // getDescription } // getDescription
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getC_Tax_ID() * Line Tax
* @return C_Tax_ID
*/ */
public int getC_Tax_ID() public int getC_Tax_ID()
{ {
@ -746,8 +809,9 @@ public class DocLine implements IDocLine
return 0; return 0;
} // getC_Tax_ID } // getC_Tax_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getLine() * Get Line Number
* @return line no
*/ */
public int getLine() public int getLine()
{ {
@ -761,8 +825,9 @@ public class DocLine implements IDocLine
return 0; return 0;
} // getLine } // getLine
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getC_BPartner_ID() * Get BPartner
* @return C_BPartner_ID
*/ */
public int getC_BPartner_ID() public int getC_BPartner_ID()
{ {
@ -791,8 +856,9 @@ public class DocLine implements IDocLine
} // setC_BPartner_ID } // setC_BPartner_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getC_BPartner_Location_ID() * Get C_BPartner_Location_ID
* @return BPartner Location
*/ */
public int getC_BPartner_Location_ID() public int getC_BPartner_Location_ID()
{ {
@ -806,8 +872,9 @@ public class DocLine implements IDocLine
return m_doc.getC_BPartner_Location_ID(); return m_doc.getC_BPartner_Location_ID();
} // getC_BPartner_Location_ID } // getC_BPartner_Location_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getAD_OrgTrx_ID() * Get TrxOrg
* @return AD_OrgTrx_ID
*/ */
public int getAD_OrgTrx_ID() public int getAD_OrgTrx_ID()
{ {
@ -821,8 +888,10 @@ public class DocLine implements IDocLine
return 0; return 0;
} // getAD_OrgTrx_ID } // getAD_OrgTrx_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getC_SalesRegion_ID() * Get SalesRegion.
* - get Sales Region from BPartner
* @return C_SalesRegion_ID
*/ */
public int getC_SalesRegion_ID() public int getC_SalesRegion_ID()
{ {
@ -846,8 +915,9 @@ public class DocLine implements IDocLine
return m_C_SalesRegion_ID; return m_C_SalesRegion_ID;
} // getC_SalesRegion_ID } // getC_SalesRegion_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getC_Project_ID() * Get Project
* @return C_Project_ID
*/ */
public int getC_Project_ID() public int getC_Project_ID()
{ {
@ -861,8 +931,9 @@ public class DocLine implements IDocLine
return 0; return 0;
} // getC_Project_ID } // getC_Project_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getC_Campaign_ID() * Get Campaign
* @return C_Campaign_ID
*/ */
public int getC_Campaign_ID() public int getC_Campaign_ID()
{ {
@ -876,8 +947,9 @@ public class DocLine implements IDocLine
return 0; return 0;
} // getC_Campaign_ID } // getC_Campaign_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getC_Activity_ID() * Get Activity
* @return C_Activity_ID
*/ */
public int getC_Activity_ID() public int getC_Activity_ID()
{ {
@ -891,8 +963,9 @@ public class DocLine implements IDocLine
return 0; return 0;
} // getC_Activity_ID } // getC_Activity_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getUser1_ID() * Get User 1
* @return user defined 1
*/ */
public int getUser1_ID() public int getUser1_ID()
{ {
@ -906,8 +979,9 @@ public class DocLine implements IDocLine
return 0; return 0;
} // getUser1_ID } // getUser1_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getUser2_ID() * Get User 2
* @return user defined 2
*/ */
public int getUser2_ID() public int getUser2_ID()
{ {
@ -921,8 +995,10 @@ public class DocLine implements IDocLine
return 0; return 0;
} // getUser2_ID } // getUser2_ID
/* (non-Javadoc) /**
* @see org.compiere.acct.IDocLine#getValue(java.lang.String) * Get User Defined Column
* @param ColumnName column name
* @return user defined column value
*/ */
public int getValue(String ColumnName) public int getValue(String ColumnName)
{ {

View File

@ -35,7 +35,7 @@ public final class Fact
* @param acctSchema Account Schema to create accounts * @param acctSchema Account Schema to create accounts
* @param defaultPostingType the default Posting type (actual,..) for this posting * @param defaultPostingType the default Posting type (actual,..) for this posting
*/ */
public Fact (IDoc document, MAcctSchema acctSchema, String defaultPostingType) public Fact (Doc document, MAcctSchema acctSchema, String defaultPostingType)
{ {
m_doc = document; m_doc = document;
m_acctSchema = acctSchema; m_acctSchema = acctSchema;
@ -49,7 +49,7 @@ public final class Fact
private CLogger log = CLogger.getCLogger(getClass()); private CLogger log = CLogger.getCLogger(getClass());
/** Document */ /** Document */
private IDoc m_doc = null; private Doc m_doc = null;
/** Accounting Schema */ /** Accounting Schema */
private MAcctSchema m_acctSchema = null; private MAcctSchema m_acctSchema = null;
/** Transaction */ /** Transaction */
@ -95,7 +95,7 @@ public final class Fact
* @param creditAmt credit amount, can be null * @param creditAmt credit amount, can be null
* @return Fact Line * @return Fact Line
*/ */
public FactLine createLine (IDocLine docLine, MAccount account, public FactLine createLine (DocLine docLine, MAccount account,
int C_Currency_ID, BigDecimal debitAmt, BigDecimal creditAmt) int C_Currency_ID, BigDecimal debitAmt, BigDecimal creditAmt)
{ {
// log.fine("createLine - " + account + " - Dr=" + debitAmt + ", Cr=" + creditAmt); // log.fine("createLine - " + account + " - Dr=" + debitAmt + ", Cr=" + creditAmt);
@ -161,7 +161,7 @@ public final class Fact
* @param Amt if negative Cr else Dr * @param Amt if negative Cr else Dr
* @return FactLine * @return FactLine
*/ */
public FactLine createLine (IDocLine docLine, MAccount accountDr, MAccount accountCr, public FactLine createLine (DocLine docLine, MAccount accountDr, MAccount accountCr,
int C_Currency_ID, BigDecimal Amt) int C_Currency_ID, BigDecimal Amt)
{ {
if (Amt.signum() < 0) if (Amt.signum() < 0)
@ -180,7 +180,7 @@ public final class Fact
* @param Amt if negative Cr else Dr * @param Amt if negative Cr else Dr
* @return FactLine * @return FactLine
*/ */
public FactLine createLine (IDocLine docLine, MAccount account, public FactLine createLine (DocLine docLine, MAccount account,
int C_Currency_ID, BigDecimal Amt) int C_Currency_ID, BigDecimal Amt)
{ {
if (Amt.signum() < 0) if (Amt.signum() < 0)
@ -272,15 +272,15 @@ public final class Fact
line.setDocumentInfo(m_doc, null); line.setDocumentInfo(m_doc, null);
line.setPostingType(m_postingType); line.setPostingType(m_postingType);
// Account
line.setAccount(m_acctSchema, m_acctSchema.getSuspenseBalancing_Acct());
// Amount // Amount
if (diff.signum() < 0) // negative balance => DR if (diff.signum() < 0) // negative balance => DR
line.setAmtSource(m_doc.getC_Currency_ID(), diff.abs(), Env.ZERO); line.setAmtSource(m_doc.getC_Currency_ID(), diff.abs(), Env.ZERO);
else // positive balance => CR else // positive balance => CR
line.setAmtSource(m_doc.getC_Currency_ID(), Env.ZERO, diff); line.setAmtSource(m_doc.getC_Currency_ID(), Env.ZERO, diff);
// Account
line.setAccount(m_acctSchema, m_acctSchema.getSuspenseBalancing_Acct());
// Convert // Convert
line.convert(); line.convert();
// //

View File

@ -66,9 +66,9 @@ public final class FactLine extends X_Fact_Acct
/** Accounting Schema */ /** Accounting Schema */
private MAcctSchema m_acctSchema = null; private MAcctSchema m_acctSchema = null;
/** Document Header */ /** Document Header */
private IDoc m_doc = null; private Doc m_doc = null;
/** Document Line */ /** Document Line */
private IDocLine m_docLine = null; private DocLine m_docLine = null;
/** /**
* Create Reversal (negate DR/CR) of the line * Create Reversal (negate DR/CR) of the line
@ -280,7 +280,7 @@ public final class FactLine extends X_Fact_Acct
* @param doc document * @param doc document
* @param docLine doc line * @param docLine doc line
*/ */
public void setDocumentInfo(IDoc doc, IDocLine docLine) public void setDocumentInfo(Doc doc, DocLine docLine)
{ {
m_doc = doc; m_doc = doc;
m_docLine = docLine; m_docLine = docLine;
@ -391,7 +391,7 @@ public final class FactLine extends X_Fact_Acct
* Get Document Line * Get Document Line
* @return doc line * @return doc line
*/ */
protected IDocLine getDocLine() protected DocLine getDocLine()
{ {
return m_docLine; return m_docLine;
} // getDocLine } // getDocLine
@ -610,7 +610,7 @@ public final class FactLine extends X_Fact_Acct
public boolean convert () public boolean convert ()
{ {
// Document has no currency // Document has no currency
if (getC_Currency_ID() == IDoc.NO_CURRENCY) if (getC_Currency_ID() == Doc.NO_CURRENCY)
setC_Currency_ID (m_acctSchema.getC_Currency_ID()); setC_Currency_ID (m_acctSchema.getC_Currency_ID());
if (m_acctSchema.getC_Currency_ID() == getC_Currency_ID()) if (m_acctSchema.getC_Currency_ID() == getC_Currency_ID())
@ -722,7 +722,7 @@ public final class FactLine extends X_Fact_Acct
// Prio 3 - get from doc - if not GL // Prio 3 - get from doc - if not GL
if (m_doc != null && super.getAD_Org_ID() == 0) if (m_doc != null && super.getAD_Org_ID() == 0)
{ {
if (IDoc.DOCTYPE_GLJournal.equals (m_doc.getDocumentType())) if (Doc.DOCTYPE_GLJournal.equals (m_doc.getDocumentType()))
{ {
setAD_Org_ID (m_acct.getAD_Org_ID()); // inter-company GL setAD_Org_ID (m_acct.getAD_Org_ID()); // inter-company GL
log.finer("AD_Org_ID=" + super.getAD_Org_ID() + " (3 from Acct)"); log.finer("AD_Org_ID=" + super.getAD_Org_ID() + " (3 from Acct)");
@ -736,7 +736,7 @@ public final class FactLine extends X_Fact_Acct
// Prio 4 - get from account - if not GL // Prio 4 - get from account - if not GL
if (m_doc != null && super.getAD_Org_ID() == 0) if (m_doc != null && super.getAD_Org_ID() == 0)
{ {
if (IDoc.DOCTYPE_GLJournal.equals (m_doc.getDocumentType())) if (Doc.DOCTYPE_GLJournal.equals (m_doc.getDocumentType()))
{ {
setAD_Org_ID (m_doc.getAD_Org_ID()); setAD_Org_ID (m_doc.getAD_Org_ID());
log.finer("AD_Org_ID=" + super.getAD_Org_ID() + " (4 from Document)"); log.finer("AD_Org_ID=" + super.getAD_Org_ID() + " (4 from Document)");
@ -844,7 +844,7 @@ public final class FactLine extends X_Fact_Acct
setUser2_ID (m_acct.getUser2_ID()); setUser2_ID (m_acct.getUser2_ID());
// Revenue Recognition for AR Invoices // Revenue Recognition for AR Invoices
if (m_doc.getDocumentType().equals(IDoc.DOCTYPE_ARInvoice) if (m_doc.getDocumentType().equals(Doc.DOCTYPE_ARInvoice)
&& m_docLine != null && m_docLine != null
&& m_docLine.getC_RevenueRecognition_ID() != 0) && m_docLine.getC_RevenueRecognition_ID() != 0)
{ {