private final I_C_TaxDeclarationLine newTaxDeclarationLine() { final I_C_TaxDeclaration taxDeclaration = getC_TaxDeclaration(); final I_C_TaxDeclarationLine taxDeclarationLine = InterfaceWrapperHelper.create( getCtx(), I_C_TaxDeclarationLine.class, ITrx.TRXNAME_ThreadInherited); taxDeclarationLine.setAD_Org_ID(taxDeclaration.getAD_Org_ID()); taxDeclarationLine.setC_TaxDeclaration(taxDeclaration); return taxDeclarationLine; }
private final I_C_TaxDeclarationAcct createTaxDeclarationAcct( final I_C_TaxDeclarationLine taxDeclarationLine, final I_Fact_Acct fact) { final I_C_TaxDeclaration taxDeclaration = getC_TaxDeclaration(); final I_C_TaxDeclarationAcct taxDeclarationAcct = InterfaceWrapperHelper.create( getCtx(), I_C_TaxDeclarationAcct.class, ITrx.TRXNAME_ThreadInherited); taxDeclarationAcct.setAD_Org_ID(fact.getAD_Org_ID()); taxDeclarationAcct.setC_TaxDeclaration(taxDeclaration); // Link to C_TaxDeclarationLine ONLY if the Fact_Acct record is about tax booking // NOTE: very important, reports are relying on this (e.g. see RV_TaxDeclarationLine) if (taxDeclarationLine != null && taxDeclarationLine.getC_Tax_ID() == fact.getC_Tax_ID()) { taxDeclarationAcct.setC_TaxDeclarationLine(taxDeclarationLine); } else { taxDeclarationAcct.setC_TaxDeclarationLine(null); } taxDeclarationAcct.setFact_Acct_ID( fact.getFact_Acct_ID()); // this FK shall block Fact_Acct to be deleted taxDeclarationAcct.setC_AcctSchema_ID(fact.getC_AcctSchema_ID()); // // Save final int line = lineNoOffset_TaxDeclarationAcct + (countAcctLinesCreated + 1) * 10; taxDeclarationAcct.setLine(line); InterfaceWrapperHelper.save(taxDeclarationAcct); countAcctLinesCreated++; return taxDeclarationAcct; }
private final void save(final I_C_TaxDeclarationLine taxDeclarationLine) { final int line = lineNoOffset_TaxDeclarationLine + (countLinesCreated + 1) * 10; taxDeclarationLine.setLine(line); InterfaceWrapperHelper.save(taxDeclarationLine); countLinesCreated++; }
private final I_C_TaxDeclarationLine createTaxDeclarationLine( final I_GL_JournalLine glJournalLine) { final String summary = journalLineBL.getDocumentNo(glJournalLine); final I_C_TaxDeclarationLine taxDeclarationLine = newTaxDeclarationLine(); taxDeclarationLine.setAD_Org_ID(glJournalLine.getAD_Org_ID()); taxDeclarationLine.setIsManual(false); // taxDeclarationLine.setGL_JournalLine(glJournalLine); taxDeclarationLine.setC_Currency_ID(glJournalLine.getC_Currency_ID()); taxDeclarationLine.setDateAcct(glJournalLine.getDateAcct()); taxDeclarationLine.setC_DocType_ID(glJournalLine.getGL_Journal().getC_DocType_ID()); taxDeclarationLine.setDocumentNo(summary); // final ITaxAccountable taxAccountable = journalLineBL.asTaxAccountable(glJournalLine); // NOTE: Tax on sales transactions is booked on CR, tax on purchase transactions is booked on DR final boolean isSOTrx = taxAccountable.isAccountSignCR(); taxDeclarationLine.setIsSOTrx(isSOTrx); taxDeclarationLine.setC_Tax_ID(taxAccountable.getC_Tax_ID()); taxDeclarationLine.setTaxBaseAmt(taxAccountable.getTaxBaseAmt()); taxDeclarationLine.setTaxAmt(taxAccountable.getTaxAmt()); save(taxDeclarationLine); return taxDeclarationLine; }
private final I_C_TaxDeclarationLine createTaxDeclarationLine( final I_C_Invoice invoice, final I_C_InvoiceTax invoiceTax) { final I_C_TaxDeclarationLine taxDeclarationLine = newTaxDeclarationLine(); taxDeclarationLine.setAD_Org_ID(invoice.getAD_Org_ID()); taxDeclarationLine.setIsManual(false); // taxDeclarationLine.setC_Invoice(invoice); taxDeclarationLine.setIsSOTrx(invoice.isSOTrx()); taxDeclarationLine.setC_BPartner_ID(invoice.getC_BPartner_ID()); taxDeclarationLine.setC_Currency_ID(invoice.getC_Currency_ID()); taxDeclarationLine.setDateAcct(invoice.getDateAcct()); taxDeclarationLine.setC_DocType_ID(invoice.getC_DocType_ID()); taxDeclarationLine.setDocumentNo(invoice.getDocumentNo()); // taxDeclarationLine.setC_Tax_ID(invoiceTax.getC_Tax_ID()); taxDeclarationLine.setTaxBaseAmt(invoiceTax.getTaxBaseAmt()); taxDeclarationLine.setTaxAmt(invoiceTax.getTaxAmt()); save(taxDeclarationLine); return taxDeclarationLine; }