Examples of MAccount


Examples of org.compiere.model.MAccount

  {
    int C_ValidCombination_ID = getValidCombination_ID(AcctType, as);
    if (C_ValidCombination_ID == 0)
      return null;
    //  Return Account
    MAccount acct = MAccount.get (as.getCtx(), C_ValidCombination_ID);
    return acct;
  //  getAccount
View Full Code Here

Examples of org.compiere.model.MAccount

            desc += " 100%";
          fl.setDescription(desc);
        }
        if (!landedCost)
        {
          MAccount expense = line.getAccount(ProductCost.ACCTTYPE_P_Expense, as);
          if (line.isItem())
            expense = line.getAccount (ProductCost.ACCTTYPE_P_InventoryClearing, as);
          BigDecimal amt = line.getAmtSource();
          BigDecimal dAmt = null;
          if (as.isTradeDiscountPosted() && !line.isItem())
          {
            BigDecimal discount = line.getDiscount();
            if (discount != null && discount.signum() != 0)
            {
              amt = amt.add(discount);
              dAmt = discount;
              MAccount tradeDiscountReceived = line.getAccount(ProductCost.ACCTTYPE_P_TDiscountRec, as);
              fact.createLine (line, tradeDiscountReceived,
                  getC_Currency_ID(), null, dAmt);
            }
          }
          fact.createLine (line, expense,
            getC_Currency_ID(), amt, null);
          if (!line.isItem())
          {
            grossAmt = grossAmt.subtract(amt);
            serviceAmt = serviceAmt.add(amt);
          }
          //
          if (line.getM_Product_ID() != 0
            && line.getProduct().isService())  //  otherwise Inv Matching
            MCostDetail.createInvoice(as, line.getAD_Org_ID(),
              line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
              line.get_ID(), 0,    //  No Cost Element
              line.getAmtSource(), line.getQty(),
              line.getDescription(), getTrxName());
        }
      }
      //  Set Locations
      FactLine[] fLines = fact.getLines();
      for (int i = 0; i < fLines.length; i++)
      {
        if (fLines[i] != null)
        {
          fLines[i].setLocationFromBPartner(getC_BPartner_Location_ID(), true)//  from Loc
          fLines[i].setLocationFromOrg(fLines[i].getAD_Org_ID(), false);    //  to Loc
        }
      }

      //  Liability               CR
      int payables_ID = getValidCombination_ID (Doc.ACCTTYPE_V_Liability, as);
      int payablesServices_ID = getValidCombination_ID (Doc.ACCTTYPE_V_Liability_Services, as);
      if (m_allLinesItem || !as.isPostServices()
        || payables_ID == payablesServices_ID)
      {
        grossAmt = getAmount(Doc.AMTTYPE_Gross);
        serviceAmt = Env.ZERO;
      }
      else if (m_allLinesService)
      {
        serviceAmt = getAmount(Doc.AMTTYPE_Gross);
        grossAmt = Env.ZERO;
      }
      if (grossAmt.signum() != 0)
        fact.createLine(null, MAccount.get(getCtx(), payables_ID),
          getC_Currency_ID(), null, grossAmt);
      if (serviceAmt.signum() != 0)
        fact.createLine(null, MAccount.get(getCtx(), payablesServices_ID),
          getC_Currency_ID(), null, serviceAmt);
      //
      updateProductPO(as)//  Only API
      updateProductInfo (as.getC_AcctSchema_ID());    //  only API
    }
    //  APC
    else if (getDocumentType().equals(DOCTYPE_APCredit))
    {
      BigDecimal grossAmt = getAmount(Doc.AMTTYPE_Gross);
      BigDecimal serviceAmt = Env.ZERO;
      //  Charge                  CR
      fact.createLine (null, getAccount(Doc.ACCTTYPE_Charge, as),
        getC_Currency_ID(), null, getAmount(Doc.AMTTYPE_Charge));
      //  TaxCredit               CR
      for (int i = 0; i < m_taxes.length; i++)
      {
        FactLine tl = fact.createLine (null, m_taxes[i].getAccount(m_taxes[i].getAPTaxType(), as),
          getC_Currency_ID(), null, m_taxes[i].getAmount());
        if (tl != null)
          tl.setC_Tax_ID(m_taxes[i].getC_Tax_ID());
      }
      //  Expense                 CR
      for (int i = 0; i < p_lines.length; i++)
      {
        DocLine line = p_lines[i];
        boolean landedCost = landedCost(as, fact, line, false);
        if (landedCost && as.isExplicitCostAdjustment())
        {
          fact.createLine (line, line.getAccount(ProductCost.ACCTTYPE_P_Expense, as),
            getC_Currency_ID(), null, line.getAmtSource());
          //
          FactLine fl = fact.createLine (line, line.getAccount(ProductCost.ACCTTYPE_P_Expense, as),
            getC_Currency_ID(), line.getAmtSource(), null);
          String desc = line.getDescription();
          if (desc == null)
            desc = "100%";
          else
            desc += " 100%";
          fl.setDescription(desc);
        }
        if (!landedCost)
        {
          MAccount expense = line.getAccount(ProductCost.ACCTTYPE_P_Expense, as);
          if (line.isItem())
            expense = line.getAccount (ProductCost.ACCTTYPE_P_InventoryClearing, as);
          BigDecimal amt = line.getAmtSource();
          BigDecimal dAmt = null;
          if (as.isTradeDiscountPosted() && !line.isItem())
          {
            BigDecimal discount = line.getDiscount();
            if (discount != null && discount.signum() != 0)
            {
              amt = amt.add(discount);
              dAmt = discount;
              MAccount tradeDiscountReceived = line.getAccount(ProductCost.ACCTTYPE_P_TDiscountRec, as);
              fact.createLine (line, tradeDiscountReceived,
                  getC_Currency_ID(), dAmt, null);
            }
          }
          fact.createLine (line, expense,
View Full Code Here

Examples of org.compiere.model.MAccount

          desc += " 100%";
        fl.setDescription(desc);
      }
      if (!landedCost)
      {
        MAccount acct = line.getAccount(
          payables ? ProductCost.ACCTTYPE_P_Expense : ProductCost.ACCTTYPE_P_Revenue, as);
        if (payables)
        {
          //  if Fixed Asset
          if (line.isItem())
View Full Code Here

Examples of org.compiere.model.MAccount

    if (getM_Product_ID() == 0 && getC_Charge_ID() != 0)
    {
      BigDecimal amt = new BigDecimal (-1);    //  Revenue (-)
      if (!m_doc.isSOTrx())
        amt = new BigDecimal (+1);        //  Expense (+)
      MAccount acct = getChargeAccount(as, amt);
      if (acct != null)
        return acct;
    }
   
    return getAccountFactoringSalesOrCOGS(AcctType, as);
View Full Code Here

Examples of org.compiere.model.MAccount

      productCategoryID != 1000007) // Not Timber
    return getProductCost().getAccount (AcctType, as);
   
    int[] custAccts = getCustomerAccounts(getC_BPartner_ID());
    int accountIndex = AcctType == ProductCost.ACCTTYPE_P_Revenue ? 0 : 1;
    MAccount acct;

    // If the customer has an account specified then use it.  Else if the
    // customer market is export use the "Other Export" account.  Otherwise
    // use the "Other Timber" account.
    if (custAccts != null && custAccts[accountIndex] != 0)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.