Activity Based Costing is an analytic accountancy method helping to determine the rentability of a determined product, command, service... It uses the "activity" concept, what means the use of different way to reach an objective. For instance, the activity "marketing", the activity "sales", the activity "production", the activity "accountancy/abc",...
All the activities together are forming the - or one of a compagny process. That means that to determine the different activities, a good knowledge of a department or a compagny is necessary. When the indirect costs are dispached among the different activities, they have a value, a cost. The next step is to determine for each activity an activity unit, called "cost per unit", an hour production, an hour sales, a kilometer,.. Those units have a cost, a fraction of the global cost of their activities. During the compagny/organisation process, it's necesary to count the amount of cost units used per each activity.
We know the cost per unit, the indirect cost of a product, service, command is the sum of each unit cost multiplied by the related amount of measuring. The direct cost is easy to identify: the raw material cost + the hours work cost.
XML is a representation language using tags to describe a value.
The tags choise is free.
So, it can be used to describe numbers that are accountancy values, to describe a product, an activity, an indirect cost, or
a direct cost..
What means there must be no XML limit to represent or describe the needed accountancy inputs.
On the other side, the XML technology offers the posibility to dissociate the data from the treatment.
The input data remains safe.
Advantage of a dissociation?
Let's use a spreadsheet to do some accountancy analyse, our data are displayed on three columns..
We need to sort the datas, ascendant sorting by date.
Let's miss one column, our datas are dead. The main reason because we were working directly on the input.
In this project, we plan to develop an Activity Based Costing application using the XML technologies.
As far as possible, we will develop this application without using any programming language, as Java or another one.
As far as possible, only with XML technologies!
As an input, a single document can be used, validated by a DTD or a XML Schema.
The necessary information must be reached in the input support, and transformed.
The World Wide Web Consortium (W3C) offerts a lot of technologies/tools XML oriented.
We propose to use at first two of them.
At first, we need the input elements.
In XML, a "table" is intended to be an "element".
Let's have as exemple a compagny working on commands; it will probably have few differents kinds of
commands from the same family.
We have the different tables, we call elements from now:
<customer/> <command/> <measuring/> <direct_cost/> <indirect_cost/> <activity/> <cost_family/> <accounting_code/>
As we have the input struture, it must be filled in with data.
An exemple of a direct cost imputation with elements.
<indirect_cost>
<document_id>doc_0015
<total_indirect>1691
<imputation_code>imp0036
<accounting_code>613204</accounting_code>
<imp_amount>1000</imp_amount>
</imputation_code>
<imputation_code>imp0037
<accounting_code>613001</accounting_code>
<imp_amount>691</imp_amount>
</imputation_code>
</total_indirect>
</document_id>
</indirect_cost>
The same indirect cost imputation can be done using elements and attributes, may be a lightly way of representation.
<indirect_cost document_id="doc_0015" total_indirect="1691">
<imputation imputation_id="imp0036" accounting_code="613204" imp_amount="1000"/>
<imputation imputation_id="imp0037" accounting_code="613001" imp_amount="691"/>
</indirect_cost>
To produce our Activity Based Costing results, we need to find the right information in our input document, extract it, and transform it.
XQuery is used for those tasks.
XQuery allows to create FLWOR request, predicates used to select and sort the information.
Some simple arythmetic transformation are possible (SUM, +, - ,*, div).
XQuery has a constructor function, creating <elements >.
So, XQuery operates on an XML tree, and proposes the FLWOR results on the form of an other XML tree.
This result (new XML tree) is used for a presentation transformation, or is passed to another application for treatment.
Or is passed to XQuery for applyance of a new FLWOR transformation/request.
A lot information can be extracted from such an accounting information tree. The total amount of all indirect costs, the total for this accounting code, the cost of an activity, or of a part of this activity: the unit cost.
Let's take a simple example.
We use the same indirect cost imputation, implemented with elements and attributes.
We add two other imputations, and a root element, called <abc/>
<abc>
<indirect_cost document_id ="doc_0015"total_indirect="1691">
<imputation imputation_id ="imp0036" accounting_code="613204" imp_amount="1000"/>
<imputation imputation_id ="imp0037" accounting_code="613001" imp_amount="691"/>
</indirect_cost>
<indirect_cost document_id="doc_0018"total_indirect="3650">
<imputation imputation_id="imp0038" accounting_code="613204" imp_amount="2650"/>
<imputation imputation_id="imp0039" accounting_code="613200" imp_amount="540"/>
<imputation imputation_id="imp0040" accounting_code="612000" imp_amount="460"/>
</indirect_cost>
<indirect_cost document_id="doc_0019" total_indirect="2000">
<imputation imputation_id="imp0041" accounting_code="613210" imp_amount="2000"/>
</indirect_cost>
</abc>
We want to produce two results:
the total of the indirect cost represented by those three documents
the total of all imputations
The FLWOR could look like this, two requests in one.
<sum_indirect>
<imputation>
{
sum(
for $in in doc("/home/...path.../file.xml")/abc/indirect_cost/imputation
return
<imp> {data($in/@imp_amount)} </imp>
)}
</imputation>
<document>
{
sum(
for $in in doc("/home/...path.../file.xml")/abc/indirect_cost
return
<Eur> {data($in/@total_indirect)} </Eur>
)}
</document>
</sum_indirect>
The resulting XML tree..
<?xml version="1.0" encoding="UTF-8"?>
<sum_indirect>
<imputation>7341</imputation>
<document>7341</document>
</sum_indirect>
Let's use some function. XQuery offers the function possibility, to reuse the same code without writting it repetitively all long the FLWOR's. This code becomes a function, placed in the beginning of the request, or on an other storage. The function is then called where necessary, and arguments passed.
We make some changes in our XML file, on the last [indirect_cost/@total_indirect="2000"], becoming [indirect_cost/@total_indirect="3440"]
<abc>
<indirect_cost document_id ="doc_0015"total_indirect="1691">
<imputation imputation_id ="imp0036" accounting_code="613204" imp_amount="1000"/>
<imputation imputation_id ="imp0037" accounting_code="613001" imp_amount="691"/>
</indirect_cost>
<indirect_cost document_id="doc_0018"total_indirect="3650">
<imputation imputation_id="imp0038" accounting_code="613204" imp_amount="2650"/>
<imputation imputation_id="imp0039" accounting_code="613200" imp_amount="540"/>
<imputation imputation_id="imp0040" accounting_code="612000" imp_amount="460"/>
</indirect_cost>
<indirect_cost document_id="doc_0019" total_indirect="3440">
<imputation imputation_id="imp0041" accounting_code="613210" imp_amount="2000"/>
</indirect_cost>
</abc>
This change: we have a difference between "imputation" and "total_indirect".
We write a request showing the imputation detail, the sum of those imputations, the documents detail, the document sum,
then a check: sum imputation - sum document and the opposite.
declare function local:base_imputation($empty as xs:anyAtomicType?)
{
for $in in doc("/home/...path.../file.xml")/abc/indirect_cost/imputation
return
<imp>{data($in/@imp_amount)}</imp>
};
declare function local:base_indirect($empty as xs:anyAtomicType?)
{
for $in in doc("/home/...path.../file.xml")/abc/indirect_cost
return
<Eur> {data($in/@total_indirect)} </Eur>
};
<sum_indirect>
<imputation_indirect_detail>{local:base_imputation("")}</imputation_indirect_detail>
<sum_imputation_indirect>{sum(local:base_imputation(""))}</sum_imputation_indirect>
<document_detail>{local:base_indirect("")}</document_detail>
<sum_document>{sum(local:base_indirect(""))}</sum_document>
<check1>{sum(local:base_indirect(""))-sum(local:base_imputation(""))}</check1>
<check2>{sum(local:base_imputation(""))-sum(local:base_indirect(""))}</check2>
</sum_indirect>
The XML tree produced by the query
<sum_indirect>
<imputation_indirect_detail>
<imp>1000</imp>
<imp>691</imp>
<imp>2650</imp>
<imp>540</imp>
<imp>460</imp>
<imp>2000</imp>
</imputation_indirect_detail>
<sum_imputation_indirect>7341</sum_imputation_indirect>
<document_detail>
<Eur>1691</Eur>
<Eur>3650</Eur>
<Eur>3440</Eur>
</document_detail>
<sum_document>8781</sum_document>
<check1>1440</check1>
<check2>-1440</check2>
</sum_indirect>
So, we can see that with a very small query using functions, we can produce a result tree showing imputation details, the sum of those details, the document detail, and checking the difference between the total indirect amount and the inputation.
XML tree are not so easy to read.
With some Xslt + css, it's possible to produce a frendly reading report..
Visitors: 78243