customization on sales order invoice`

Hi all,

I have a customization, not sure how to proceed, it is bit to explain also, when ever we do sales order invoice 3 lineof GL are created on invoice journal under the sales order under voucher , here I have added a new field under auto charges like original sales invoice only check box , when ever i do sales invoicing then 3 lines are needed to be created based the account set on charge code form.

Please throw some light… i am using ax 2012 R3, please question if you need any clarification

GL entires may be like

GL entry debit credit comments

current 12000 0 from auto charges

non currecnt 24000 12000 from auto charges

AR 0 360000 AR posting from customer

where to write the code may be it should appear for the particular sales order under invoice