Re: [Openledger-developer] Random jottings
Brought to you by:
klavs
From: Klavs K. <kl...@vs...> - 2005-03-21 08:30:19
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 on 03/20/05 22:14 Tony Fraser wrote: | On Sat, 2005-03-19 at 13:27, Tony Fraser wrote: | |>hmm... I guess this is the place where I get off my butt and get around |>to contributing the UML I said I would ages ago. |> |>I finally uploaded it. You can have quick look here: |> |>http://openledger.sf.net/Business-Ledger/class_diagram.png |> |>Or you can download the Dia source here: |> |>http://openledger.sf.net/Business-Ledger/class_diagram.dia | | | As has been brought up on this list before, sometimes code is the best | description. Here is an example script that posts a GL transaction using | my fictional Business::Ledger API. | | | #!/usr/bin/perl | | use strict; | | | | our $acct = Businss::Ledger->new( | BACKEND => Business::Ledger::SQL_Ledger, | OPTIONS => { | PATH => /usr/local/sql-ledger | } | ); | our $chart = $acct->get_coa(); | Not bad. | | # Open a GL Transaction | my $gl_trans = $acct->start_transaction('Business::Ledger::Transaction::GL'); | hmm dividing them into GL etc. transactions.. I guess this is ok from the users point of view. Connecting/binding the transaction to the $acct object (which you do here - otherwise $gl_trans->post would not have known where to post) is IMHO bad. What if I have a transaction, I'd like to post in two different accounting systems? Or perhaps I have some code that uses the transaction object for "something else" (like generating a receipt or whatever)? I'd prefer having GL etc. as seperate objects (as we have now) - which the user who creates the objects, can decide to use for whatever they see fit - and then accept these as parameters for f.ex. post_transaction - - which could be made to accept both AR,AP and GL transactions. | $gl_trans->reference('test'); | $gl_trans->date('1-1-2005'); | $gl_trans->description('This is a test GL entry'); | | # Add some amounts | $gl_trans->post_debit($chart->find_account( number => '1820' ), '55.00'); | $gl_trans->post_debit($chart->find_account( number => '5700' ), '40.00'); | $gl_trans->post_credit($chart->find_account( number => '1060' ), '95.00'); Why not just use the accountnumber as referencenr.? Instead of having to find the account based on the accountnr.? The accountnr. is afterall always unique. If it wasn't unique, you couldn't trust find_account to find only one, and thus couldn't use it in the context you do here - as you wouldn't be sure which one you'd get. - -- Regards, Klavs Klavsen, GSEC - kl...@vs... - http://www.vsen.dk PGP: 7E063C62/2873 188C 968E 600D D8F8 B8DA 3D3A 0B79 7E06 3C62 "Those who do not understand Unix are condemned to reinvent it, poorly." ~ --Henry Spencer -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCPoYcPToLeX4GPGIRApEPAJ99XYDuRup4A8KTpS7JeyXotlIXmgCfSfq8 TMdbOA5DxIpOv4gLz+92dCw= =VTkl -----END PGP SIGNATURE----- |