webERP Forum
Credit Invoice problem - Printable Version

+- webERP Forum (http://www.weberp.org/forum)
+-- Forum: webERP Discussion (http://www.weberp.org/forum/forumdisplay.php?fid=1)
+--- Forum: Problems / Bugs? (http://www.weberp.org/forum/forumdisplay.php?fid=8)
+--- Thread: Credit Invoice problem (/showthread.php?tid=2730)



Credit Invoice problem - janb - 03-18-2016

Hi

I have some problems with crediting invoices with Credit_Invoice.php
I am a little bit twisted in my head right now trying to find out why.

SQL error message:
Code:
Database SQL Failure : The following SQL to insert the debtor transaction taxes record was used
INSERT INTO debtortranstaxes( debtortransid, taxauthid, taxamount) VALUES('135', '', '-162.085')


This is how $_SESSION['CreditItems' . $identifier]->LineItems[0]->Taxes object looks like before Line 238 which i suspects mess up $TaxLineTotal (adds a stdClass Object)


Code:
Array
(
    [1] => Tax Object
        (
            [TaxCalculationOrder] => 0
            [TaxAuthID] => 13
            [TaxAuthDescription] => UK VAT
            [TaxRate] => 0.08
            [TaxOnTax] => 0
            [TaxGLCode] => 2300
        )

and after:

Code:
Array
(
    [1] => Tax Object
        (
            [TaxCalculationOrder] => 0
            [TaxAuthID] => 13
            [TaxAuthDescription] => UK VAT
            [TaxRate] => 0.08
            [TaxOnTax] => 0
            [TaxGLCode] => 2300
        )

    [0] => stdClass Object
        (
            [TaxRate] => 0
        )

)

..or is it me that havent set up Taxes correct?
Jan


RE: Credit Invoice problem - TimSchofield - 03-18-2016

Hi Jan, are you using the latest Credit_Invoice.php from svn? If not can you try it as i think it should fix this problem

Tim


RE: Credit Invoice problem - janb - 03-18-2016

(03-18-2016, 09:59 PM)falkoner Wrote: Hi Jan, are you using the latest Credit_Invoice.php from svn? If not can you try it as i think it should fix this problem

Tim

Hi Tim

I'm using the latest (7345 2015-08-27)
Whats confuse me a bit is this:
Taxes[$TaxLine->TaxCalculationOrder]

All Taxes objects have as far i can see the key set to 1 (or at least starts with 1)
while this line
Code:
$_SESSION['CreditItems' . $identifier]->LineItems[$LineItem->LineNumber]->Taxes[$TaxLine->TaxCalculationOrder]->TaxRate = filter_number_format($_POST[$LineItem->LineNumber  . $TaxLine->TaxCalculationOrder . '_TaxRate'])/100;
creates a new object with key 0

Is this the intention?
..og is it to modify the existing one?


RE: Credit Invoice problem - janb - 03-18-2016

Maybe i'm wrong but it looks like line 238 tries to modify the existing object.
..and should be like this:

Code:
$_SESSION['CreditItems' . $identifier]->LineItems[$LineItem->LineNumber]->Taxes[1]->TaxRate = filter_number_format($_POST[$LineItem->LineNumber  . $TaxLine->TaxCalculationOrder . '_TaxRate'])/100;

(and the same with FreightTaxes)

As i don't know how this is intended to work (i don't have any Tax Objects other than with key = 1)
..and i wont try this in my production db. I have to at least mirror my db first.

Jan


RE: Credit Invoice problem - janb - 03-19-2016

I rest my case! ..but I have no idea what happened.
I mirrored my prod db, ran a few tests with no errors (but stil the same error on my prod db)
I dropped my prod db and restored it back from backup (the same as i mirrored)
...and viola, problem "solved" uh(???)

Jan