Auto Payment Entry Script from Sales Order

I want to create a payment entry on these conditions but its giving this error .