I will pose this general question by presenting the following scenario:
Reuvan works for Shimon. One time, at the end of the day, when Shimon came to pay Reuvan for that day's work (which was $100.), Reuvan took the money and said, "This money you are giving me now is for the previous debt that you still owe me. Now please give me another $100 for today's work so you shouldn't be over on the din of ביום תתן שכרו" (that a worker should be paid on the day that the work is done).
Does Reuvan have the right (in halacha or according to Shulchan Aruch) to do such a thing like this: to consider the money now as being paid for the previous debt and not for today's work which is what Shimon had it in mind for?