[ASTPPCOM-481] Some invoice items assigned to wrong invoices and customers (invoice_details.accountid != invoices.accountid) for monthly post pay DIDCHRG & SUBCHRG Created: 14/Jan/19  Updated: 27/Oct/19  Resolved: 27/Oct/19

Status: Done
Project: ASTPP Community
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature
Reporter: alexheylin Assignee: Samir Doshi
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I have found we have some invoices where the invoices are wrong and contain items that should have been billed to other customers.

These items are easy to find by running this query

select *
FROM `astpp`.`invoices` 
  LEFT JOIN `astpp`.`invoice_details` ON `astpp`.`invoices`.`id` = `astpp`.`invoice_details`.`invoiceid`
  LEFT JOIN `astpp`.`accounts` ON `astpp`.`invoice_details`.`accountid` = `astpp`.`accounts`.`id` 
WHERE astpp.invoices.accountid != astpp.invoice_details.accountid 

If any rows are returned, those are rows that have been added to the wrong invoice & customer.

See attached image.

I have confirmed that the invoice_details.accountid is correct and both invoice.accountid and invoice_details.invoiceid are incorrect. Note that some of the invoices.ids are not only wrong between the tables, but are also used for multiple invoice_details.accountids

The invoice_details.created_date on these items looks strange because the date is vaguely believable, but the times see odd.

I have the astpp-invoice.log for the generation of some of these invoices, but there's not enough detail to be helpful.

This looks like it may be related to ASTPPCOM-179 which appears to have been closed without a clear resolution.

My code is up to date to v3.6 I think to commit bee34d1d4bf82d61561a570be65ec3cf5eda166b

Please can others using monthly post-pay please run query above and add their results?

I'm continuing to investigate.



 Comments   
Comment by alexheylin [ 18/Feb/19 ]

After some more investigation it seems invoices.accountid is often wrong for DIDCHRG & SUBCHRG. In my data it's wrong 36% of the time, and this problem has been happening since the system was installed. These entries also have the wrong value is invoice_details.invoiceid with items for multiple customers all having the same value for invoice_details.invoiceid.

The PDF of the invoice is also wrong - with either the wrong customer on it, or charges for multiple customers on the one invoice. This reflects what's the DB; if you use the invoices_details.invoiceid to select items for one invoice there's a good chance you'll get items that should be on separate invoices, often to separate customers.

Am I really the ONLY person seeing this?

Comment by alexheylin [ 18/Feb/19 ]

invoice_details.accountid IS correct for these entries.

Generated at Sat Feb 10 07:17:32 CET 2024 using Jira 8.13.3#813003-sha1:22ebedbb75c99b147c66f14e031dd8a2d214753a.