couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Anderson <jch...@apache.org>
Subject Re: FIFO/LIFO accountancy
Date Wed, 03 Feb 2010 16:11:25 GMT
On Wed, Feb 3, 2010 at 8:06 AM, Metin Akat <akat.metin@gmail.com> wrote:
> Unfortunately, we can't do that. The government requires that the
> company pays taxes, which are a certain percentage from the profit.
> There are things like VAT involved (which depends on the profit of
> each separate apple, so that needs to be traceable) I won't go into
> further detail on why we need the profit accounts and separate
> transactions, and why we need to take out apples from the warehouse at
> their cost. It's very complicated, but that's not important at the
> moment, because that's not the question I'm asking.
>
> The question I am asking is how do we make it fault tolerant.
> Numbering batches is one of the things we are thinking for. But yet,
> how do we ensure that one batch won't go to a negative balance (if 2
> cashiers sell apples at the same time)?

can you keep each transaction in a single document?

eg

{ "action": "TRANSFER", "from-account":"farm", "to-account" :
"warehouse", "value": 15, "asset":
"apples", "qty": 5}

this way there's no chance of accidentally missing corresponding debit
and credit actions.

see:

http://books.couchdb.org/relax/reference/recipes


>
>
> On Wed, Feb 3, 2010 at 5:52 PM, Alan Bell
> <alan.bell@theopenlearningcentre.com> wrote:
>>
>> Metin Akat wrote:
>>>
>>> 4. Lets sell 6 apples to a customer, 5 dollars each. I won't go into
>>> much detail on why this is required by accountancy standards but if we
>>> use FIFO here, we must issue 2 transactions. One removing 5 apples at
>>> 2 dollars and another, removing 1 apple at 3 dollars. The profit is
>>> recorded in another account where it's 5x3 = 15 for the first
>>> transaction and 2x1=2 for the second transaction.
>>>
>> I am a bit puzzled by the need to do this. FIFO stock control is one
>> thing, and you could put dates on your batches of stock and have them
>> degrade over time if they are fresh produce, that would get you the
>> ability to control the sequence in which they are sold. Ultimately from
>> your description apples are apples, you are selling them all at $5. I
>> don't understand why you are crediting the warehouse at the cost price
>> though.
>> I would put in a transaction like this:
>>
>> { "action": "CREDIT", "account" : "warehouse", "value": 30, "asset":"apples", "qty":
6}
>>
>>
>> so now your warehouse view would show a stock level of 4 apples and an
>> overall positive balance of $5, which you can sweep into another account
>> later.
>>
>



-- 
Chris Anderson
http://jchrisa.net
http://couch.io

Mime
View raw message