10-17-2018, 11:44 PM,
|
|
HDeriauFF
Senior Member
|
Posts: 149
Threads: 56
Joined: Dec 2017
|
|
Z_DeleteInvoice: locstock not updated
It looks like the query used to supposedly update locstock is missing and what is used instead in the if statement line 130 is the same $SQL used to update salesorderdetails.
starting line 121:
Code: $SQL = "UPDATE salesorderdetails SET qtyinvoiced = qtyinvoiced + " . $OrderLine['qty'] . ",
completed = 0
WHERE orderno = '" . $ProcessingOrder . "'
AND stkcode = '" . $OrderLine['stockid'] . "'";
$ErrMsg = _('The SQL to reverse the update of the sales order detail records failed because');
$Result = DB_query($SQL,$ErrMsg,$DbgMsg,true);
prnMsg(_('The sales order records have been updated as not invoiced'),'info');
/*reverse the update to LocStock */
if ($OrderLine['mbflag']!='A' AND $OrderLine['mbflag']!='D'){
$ErrMsg = _('The SQL to reverse update to the location stock records failed because');
$Result = DB_query($SQL, $ErrMsg, $DbgMsg, true);
prnMsg(_('Reversed the location stock quantities for items that decreased'),'info');
}
Additionally, it appears that controlled items are not handled by the script as stockserialmoves is not called in the process
Thank you for your input!
|
|
10-18-2018, 12:02 AM,
|
|
TimSchofield
Tim Schofield
|
Posts: 1,318
Threads: 22
Joined: Mar 2015
|
|
RE: Z_DeleteInvoice: locstock not updated
I cannot stress highly enough that people shouldn't use this script. There are a number of gotchas, not just the one you stated - for instance it deletes the stockmoves record, but doesn't update any future quantity on hand records for any transactions that came after the invoice. I could go on...
It is also very bad accounting practice. Any transactions that are incorrect should be properly reversed out, and re-entered correctly so that the full audit trail is available. As an accountant scripts like these horrify me, and I always remove them before putting the code onto a clients server.
If an invoice is wrong, credit it and re-invoice correctly.
Sorry for the rant
Tim
|
|
10-18-2018, 05:25 AM,
(This post was last modified: 10-18-2018, 05:33 AM by VortecCPI.)
|
|
VortecCPI
Paul Becker
|
Posts: 751
Threads: 211
Joined: Apr 2017
|
|
RE: Z_DeleteInvoice: locstock not updated
(10-18-2018, 12:02 AM)falkoner Wrote: I cannot stress highly enough that people shouldn't use this script. There are a number of gotchas, not just the one you stated - for instance it deletes the stockmoves record, but doesn't update any future quantity on hand records for any transactions that came after the invoice. I could go on...
It is also very bad accounting practice. Any transactions that are incorrect should be properly reversed out, and re-entered correctly so that the full audit trail is available. As an accountant scripts like these horrify me, and I always remove them before putting the code onto a clients server.
If an invoice is wrong, credit it and re-invoice correctly.
Sorry for the rant
Tim
I could not agree more. We had one customer request we break an existing invoice down into four invoices. This is NOT an edit procedure -- It is a credit-and-create-new procedure for sure.
I know a lot of work went into the CREDIT feature and it works. There is a LOT of code in Credit_Invoice.php and it does a LOT of work.
I believe I read that webERP once had an EDIT INVOICE feature and, if it did, I am happy it is now gone.
I see an EDIT INVOICE feature as a HUGE can of worms...
https://www.linkedin.com/in/eclipsepaulbecker
|
|
10-20-2018, 04:24 AM,
(This post was last modified: 10-20-2018, 04:25 AM by dalescott.)
|
|
dalescott
Senior Member
|
Posts: 107
Threads: 23
Joined: Sep 2016
|
|
RE: Z_DeleteInvoice: locstock not updated
(10-18-2018, 12:02 AM)falkoner Wrote: ...I always remove them before putting the code onto a clients server.
Hi Tim, what other scripts do you remove?
Cheers,
Dale
http://www.dalescott.net
|
|
10-20-2018, 04:49 AM,
|
|
HDeriauFF
Senior Member
|
Posts: 149
Threads: 56
Joined: Dec 2017
|
|
RE: Z_DeleteInvoice: locstock not updated
(10-18-2018, 05:25 AM)VortecCPI Wrote: (10-18-2018, 12:02 AM)falkoner Wrote: I cannot stress highly enough that people shouldn't use this script. There are a number of gotchas, not just the one you stated - for instance it deletes the stockmoves record, but doesn't update any future quantity on hand records for any transactions that came after the invoice. I could go on...
It is also very bad accounting practice. Any transactions that are incorrect should be properly reversed out, and re-entered correctly so that the full audit trail is available. As an accountant scripts like these horrify me, and I always remove them before putting the code onto a clients server.
If an invoice is wrong, credit it and re-invoice correctly.
Sorry for the rant
Tim
I could not agree more. We had one customer request we break an existing invoice down into four invoices. This is NOT an edit procedure -- It is a credit-and-create-new procedure for sure.
I know a lot of work went into the CREDIT feature and it works. There is a LOT of code in Credit_Invoice.php and it does a LOT of work.
I believe I read that webERP once had an EDIT INVOICE feature and, if it did, I am happy it is now gone.
I see an EDIT INVOICE feature as a HUGE can of worms...
I know I know…
I got this request because the full crediting of an invoice from an order that that has dozens (if not hundreds for us) of lines of expirable controlled items is a total pain: you have to enter each quantity, each lot number each expiration date. Even if you need to credit one line, you have to manually delete all the others one by one, then replace the order from scratch …
I've already automated the ConfirmDispatchInvoice script to expedite the lot picking process, I'm thinking of porting the same capability to the crediting process by automatically inserting the controlled lots info and having a single click "recreate order" capability.
We'll see how that goes :-)
|
|
10-20-2018, 05:21 AM,
|
|
VortecCPI
Paul Becker
|
Posts: 751
Threads: 211
Joined: Apr 2017
|
|
RE: Z_DeleteInvoice: locstock not updated
Wow... Sounds very interesting...
Years ago we used to invoice Family Dollar for each store (alarm monitoring) and our invoices had up to 7,500 lines. The Oracle invoice import tool had to be rebuilt to accept our invoices because they were so large.
https://www.linkedin.com/in/eclipsepaulbecker
|
|
10-20-2018, 11:19 PM,
|
|
HDeriauFF
Senior Member
|
Posts: 149
Threads: 56
Joined: Dec 2017
|
|
RE: Z_DeleteInvoice: locstock not updated
(10-20-2018, 05:21 PM)falkoner Wrote: Would it help for the credit screen to default to having quantities of zero on every line and then you just fill in the quantities for those lines you wish to amend?
Tim
I started improving the page by replacing all "delete" links with is a "select/deselect all" checkbox system (see screenshot).
Question about CreditIitemsControlled.php: could you please confirm on your end that the correct lot and quantity are displayed on the left table, but the expiry date is always set to 0000-00-00 no matter what?
|
|
|