The below is an example on to sort payment details by Doc No in the Payment Voucher. 

1. Go to the properties of payment details by click the small arrow icon. 

2. Click the dotted box from the Sort Fields. 

3. Click Add, select sorting by “Pay For Code” in the field name. Then click OK to confirm. 

4. Now you can save the report format and try to preview.

Full document please refer to attachment.

Thank you :)