[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: more is_zero problems in bin/aa.pl





On Mon, Dec 31, 2012 at 12:55 PM, Michael Richardson <..hidden..> wrote:

continuing, I thought, to work on my 2011 expense reports,
I loaded an older semi-recurring transaction to intending to
copy-as-new.

I think this may be the same issue.  Is it also a tax included transaction?
 

(btw: handling recurring transactions for non-fixed amounts is a PITA
      for which I have a number of ideas.  For example, a long-distance
      or mobile phone bill)

Yep.  We have an add-on to help with some of that in 1.3 and expect this to be significantly better under 1.4.

Best Wishes,
Chris Travers 

I got:

 Can't call method "is_zero" on unblessed reference at /usr/share/perl5/Math/BigFloat.pm line 509., referer: https://marlin.sandelman.ca/ledgersmb/ap.pl
 Compilation failed in require at /home/ledgersmb/ledgersmb/ap.pl line 7., referer: https://marlin.sandelman.ca/ledgersmb/ap.pl
 Premature end of script headers: ap.pl, referer: https://marlin.sandelman.ca/ledgersmb/ap.pl

Some additional debugging of pointed me at bin/aa.pl, at:

    if ( $form->{id} ) {
        if ( $form->{taxincluded} ) {

            $amount =
              Tax::calculate_taxes( \@taxaccounts, $form, $form->{invtotal},
                1 );
            $tax = $form->round_amount( $amount, 2 );

        }
        else {
            $tax =
              $form->round_amount(
                Tax::calculate_taxes( \@taxaccounts, $form, $netamount, 0 ) );
        }
        foreach $item (@taxaccounts) {
            $tax{ $item->account } = $form->round_amount( $item->value, 2 );
            $form->{ "calctax_" . $item->account } = 1
              if $item->value
              and
              ( $tax{ $item->account } == $form->{ "tax_" . $item->account } );
        }
    }


The call is in bcmp() and it appears that it's the == at the bottom.
As far as I can see, $tax is never gonna be a hash.  Above it is assigned the
result of ->round_amount().

I'm thinking that there must be a typo here that another hash is
desired.  But, this code has been like this forever.
It only gets invoked on previous transactions due to the if().

It only has to have an $item->value which is non-zero, otherwise the
if() statement gets short circuited.

My $item here is 2310, and it isn't a hash either or an object either.
@taxaccounts is perhaps also broken?

For, I have changed the code:

-    if ( $form->{id} ) {
+    if ( 0 && $form->{id} ) {

As I don't think that this code matters that much for viewing/copying.

ps: 1.3 has never calculated taxincluded properly for me.

p.p.s: I think that the transaction which I am trying to view was
       prepared by 1.2.26, as it's from 2010.

p.p.p.s: I could open tickets on SF.net for this, but since you guys
         close them very quickly, and sf.net does not let me reopen
         them, it seems a total waste of time.  And I am not happy with
         sf.net sticking microsoft.net ads at the bottom of these messages.


--
]       He who is tired of Weird Al is tired of life!           |  firewalls  [
]   Michael Richardson, Sandelman Software Works, Ottawa, ON    |net architect[
] ..hidden.. http://www.sandelman.ottawa.on.ca/ |device driver[
   Kyoto Plus: watch the video <http://www.youtube.com/watch?v=kzx1ycLXQSE>
                       then sign the petition.










------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, _javascript_ and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
Ledger-smb-devel mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel