Difference between revisions of "Deferred Tax"

From ADempiere
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.
(Background)
m (Background)
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
*This is a technical, step-by-step newbie/oldie attempt at extending ADempiere for [[usability]]. Another deep-end tutorial from [[User:Red1|red1]]
 
=Background=
 
=Background=
 
(This is a stub. Please help expand it)
 
(This is a stub. Please help expand it)
 
*The [[Thailand]] [[Usability]] project uses Deferred Tax in VAT when the Invoice for services is completed.
 
*The [[Thailand]] [[Usability]] project uses Deferred Tax in VAT when the Invoice for services is completed.
*Then during Payment process of that Invoice, its Accounting transfers that to Tax_Due.
+
*Then during Payment process of that Invoice, its Accounting transfers that to Tax_Due or Tax_Credit.
*This is a good case for using a [[ModelValidator]].
+
*This is a good case for using a [[ModelValidator]] and the result is a [[MyValidatorThailand]].
*A pretty good validator to learn from is [[LCO_Validator]]
+
*Some pretty good validators to learn from are [[LCO_Validator]] and [[Sponsored_Development:_Libero_Global_Tax_Management#How_create_a_new_Logical_Tax_Calculation_.3F|creating new Tax via]] a [[Script ModelValidator]].
  
 
=Business Logic=
 
=Business Logic=
Line 16: Line 17:
 
*MODEL: FACT_ACCT
 
*MODEL: FACT_ACCT
 
*CODE INTERCEPTION 1: fact.creatline(..,..,..,..,..);
 
*CODE INTERCEPTION 1: fact.creatline(..,..,..,..,..);
 +
 +
=TODO=
 +
#First I try to create my own Model Validator so that I can debug it to make it work correctly.
 +
#Then I shall transfer it to a [[Script ModelValidator]] so that I can easily teleport it anywhere I want without harming the ozone layer.
 +
 +
==Using MyValidator==
 +
*Now, to do the first TODO, I do it by good old copy/paste from [[MyValidator]]
 +
*Then I introduce my stub for a BEFORE_POST, putting a break there to POC up to that point.
 +
 +
==BEFORE_POST SNIP==
 +
*Again, I can find a sample to do this in [[LCO_Validator]]:
 +
[[Image:BEFORE POST.gif]]
 +
*So I will try it under the DocValidate implementation, as:
 +
if (po.get_TableName().equals(MInvoice.Table_Name) && timing == TIMING_BEFORE_POST) {
 +
  // check other stuff such as the Product is Service and has right VAT Tax ID
 +
  // get to the Fact and change it.
 +
 +
*Finally i worked out a POC method to exchange the Tax_Credit/Tax_Due with Tax_Liability:
 +
[[Image:DeferedTaxCode.gif]]
 +
 +
*In order to get to this proof that it works!:
 +
[[Image:InjectedAccount.gif]]
  
 
=See Also=
 
=See Also=
 +
*[[Usability]]

Latest revision as of 16:51, 20 April 2010

  • This is a technical, step-by-step newbie/oldie attempt at extending ADempiere for usability. Another deep-end tutorial from red1

Background

(This is a stub. Please help expand it)

Business Logic

  • What i intend to do is to write a ModelValidator that uses AOP (aspect oriented programming) principle in intercepting Invoice BEFORE POST to change the facts to Tax_Liability and then during Payment BEFORE POST to transfer the Facts to TAX_DUE
  • There can be logic in the ModelValidator to ensure that the Invoice is for Services product and is qualified for VAT. The Payment part's logic handles to make sure its transfering the right fact in the accounts.

Technical Logic

  • OCCURENCE 1: Doc_Invoice.FactsCreate()
  • OCCURENCE 2: Doc_Payment.FactsCreate()
  • MODEL: FACT_ACCT
  • CODE INTERCEPTION 1: fact.creatline(..,..,..,..,..);

TODO

  1. First I try to create my own Model Validator so that I can debug it to make it work correctly.
  2. Then I shall transfer it to a Script ModelValidator so that I can easily teleport it anywhere I want without harming the ozone layer.

Using MyValidator

  • Now, to do the first TODO, I do it by good old copy/paste from MyValidator
  • Then I introduce my stub for a BEFORE_POST, putting a break there to POC up to that point.

BEFORE_POST SNIP

BEFORE POST.gif

  • So I will try it under the DocValidate implementation, as:
if (po.get_TableName().equals(MInvoice.Table_Name) && timing == TIMING_BEFORE_POST) {
  // check other stuff such as the Product is Service and has right VAT Tax ID
  // get to the Fact and change it.
  • Finally i worked out a POC method to exchange the Tax_Credit/Tax_Due with Tax_Liability:

DeferedTaxCode.gif

  • In order to get to this proof that it works!:

InjectedAccount.gif

See Also