Fix sales breakdown GL matching — exact group ID instead of fuzzy names
Switch sales breakdown column matching from fuzzy name matching to exact gl_group_id comparison. Add gl_account_groups_list endpoint for settings sync so columns store real Newbook group IDs. Removes the name-based fallback that was causing sundries VAT to bleed into sundries no-VAT. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2b04d99fd6
commit
dbef4b9f7a
6 changed files with 111 additions and 28 deletions
|
|
@ -175,14 +175,19 @@ export async function fetchGlAccountList() {
|
|||
return response?.data ?? []
|
||||
}
|
||||
|
||||
export async function fetchGlAccountGroupsList() {
|
||||
const response = await callApi('gl_account_groups_list', {})
|
||||
return response?.data ?? []
|
||||
}
|
||||
|
||||
export async function fetchGlAccountsGrouped() {
|
||||
const data = await fetchGlAccountList()
|
||||
const data = await fetchGlAccountGroupsList()
|
||||
const groups = {}
|
||||
for (const item of data) {
|
||||
if (item.gl_group_id && item.gl_group_name && !groups[item.gl_group_id]) {
|
||||
let displayName = item.gl_group_name
|
||||
if (displayName.includes(' - ')) displayName = displayName.split(' - ').slice(1).join(' - ').trim()
|
||||
groups[item.gl_group_id] = displayName
|
||||
groups[String(item.gl_group_id)] = displayName
|
||||
}
|
||||
}
|
||||
return groups
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue