webERP Forum

Full Version: SQL bug in Item Maintenance re. stock category
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Have found that changing stock category causes an SQL error due to the syntax of the inserts into
gltrans - the generated SQL is missing the closing parenthesis, has quotes around numeric columns, and has a mis-spelt variable ($NewStockAccount - should be $NewStockAct). My corrected version is as follows (the other 3 gltrans inserts are modified similarly) :

$SQL = "INSERT INTO gltrans (type,
" . $JournalNo . ",
'" . Date('Y-m-d') . "',
" . GetPeriod(Date($_SESSION['DefaultDateFormat']),$db,true) . ",
" . $NewStockAct . ",
'" . $StockID . ' ' . _('Change stock category') . "',
" . ($UnitCost* $StockQtyRow[0]) . ")";

As an aside, I always use "heredoc" syntax for statements like this, as it makes it so much easier
to embed quotes. Hope this helps.
Thanks tomglare - looks like this is already fixed in the latest code.
(09-04-2013, 06:47 AM)phil Wrote: [ -> ]Thanks tomglare - looks like this is already fixed in the latest code.

Good afternoon,
Thanks for sending information about my problem. This is to prevent these errors, but once you have entered the information, as I do to correct the huge variations in Balance Sheet?. Would you please indicate which table stores individual transactions account.

Beforehand grateful.
Note: I deleted manually via phpmyadmin wrong income, but my mind over and Adjustment Inventory Inventory remains with billions of difference.
Did you post to the correct thread here?
It sounds as though you have incorrect set up of GL accounts - I'd say you really need some professional support and your issues are not specific enough to be able to diagnose on the forum.
Don't be frightened to ask for paid support if you need someone to login and spend an hour sorting out a problem for you there is a list of support people at - this is a good way to give back to the people who make this software possible for everyone.

You can delete general ledger transactions from the gltrans table and rerun the posting from Z_RePostGLFromPeriod.php However, you will end up with inconsistent transactions elsewhere and stock movements orphaned etc - ongoing problems will recurr. Deleting gltrans really needs professional support or deep knowledge of the system