Different Default print format for Payment Entry based on Voucher Type

I want to configure different default print formats for different values of Voucher type in Payment Entry. When the payment type is “Pay” a different format will be selected and when it is “Receive” a different print format will be selected by default. can this be achieved by any script or is there any workouts in the UI

You will need to write some custom JS for this or modify print.js file to meet your needs.

can i get a code snipet for that?