Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Credit Invoice problem
03-18-2016, 09:21 PM, (This post was last modified: 03-18-2016, 09:33 PM by janb.)
#1
Credit Invoice problem
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
Reply
03-18-2016, 09:59 PM,
#2
RE: Credit Invoice problem
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
Reply
03-18-2016, 10:16 PM, (This post was last modified: 03-18-2016, 10:50 PM by janb.)
#3
RE: Credit Invoice problem
(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?
Reply
03-18-2016, 11:17 PM, (This post was last modified: 03-18-2016, 11:21 PM by janb.)
#4
RE: Credit Invoice problem
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
Reply
03-19-2016, 02:47 AM, (This post was last modified: 03-19-2016, 02:51 AM by janb.)
#5
RE: Credit Invoice problem
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

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)