Missing GL entries for invoices

Hi there,
I found out a weird issue, one I don’t know how to fix by myself.
Some of my colleagues complained to me that the total unpaid in Customer master was wrong. After a few hours digging, I realized it was because those customers had invoices with no GL entry.
Then I queried the DB and found there was quite a few of my invoices concerned.
here is the query

    select si.creation, si.name, si.`outstanding_amount`, si.`customer`
    from `tabSales Invoice` as si
    left join `tabGL Entry` as gle on si.name = gle.`voucher_no`
    where gle.name is null
    and (si.`outstanding_amount`<0 or si.`outstanding_amount`>0.01 )
    order by si.`creation`;   

I have no idea what can trigger this issue, and no idea either how to fix the GL for the past mishap.
Any help would be greatly appreciated :slight_smile:

ERPNext: v11.1.77
Frappe Framework: v11.1.69