Customer payment journal settlement with sales invoice by code in MSD axapta

If you want to Customer payment journal settlement with sales invoice by code in axapta. Mark invoice automatically by code before posting of customer payment journal
You can refer this code


settlement in axapta