Hi Claire,
I think I've found the cause.
In the stored procedure you provided, it is attempting to exclude some invoices from the list to email or print:
- Code: Select all
InvoiceNo <> 865 and InvoiceNo <> 874 and InvoiceNo <> 1016 and InvoiceNo <> 1023 and InvoiceNo <> 1024 and InvoiceNo <> 1025
Invoice numbers are a string field, and the above logic as implemented would work with situations where the invoice (or credit note) numbers were numbers only, but with a "C" prefix as you have will cause your error.
I don't know why those invoice numbers were singled out to be excluded, but I've provided a modified version of your supplied stored procedure which should solve your issue for now. I'd still like to know why those invoice numbers were excluded so I can be sure this does not cause future issues - you should contact the author and direct them to this post.
Attached is the SQL script to correct the stored procedure.
The change I made was simply replacing the line quoted above with the following:
- Code: Select all
InvoiceNo NOT LIKE '%0000865' and InvoiceNo NOT LIKE '%0000874' and InvoiceNo NOT LIKE '%0001016' and InvoiceNo NOT LIKE '%0001023' and InvoiceNo NOT LIKE '%0001024' and InvoiceNo NOT LIKE '%0001025'
To apply this change all you need to do is download the attachment and run it against your database using SQL Server Management Studio - make sure you select the database first, otherwise you'll get an error (but no harm will be done if you do get an error).
If you still have a problem, then there is another stored procedure which may have been modified - the name of which can be seen in the System Configuration form, under the Invoicing tab - the setting "StoredProcForGettingActionsInSOBatchPrinting" by default is "usp_JIWA_SalesOrders_SOBatchPrintGetActions" - if yours is something different then you should provide that stored procedure also.
Regards,
Mike