Ibn Abbas and Ibn Umar (may Allah be pleased with them) said, concerning a man who seeks a loan in order to spend on his fruit crop and on his family: Ibn Umar (may Allah be pleased with them both) said: He begins by paying off his loan, and he pays zakah on the remainder. Ibn Abbas (may Allah be pleased with them both) said: He pays off what he spent on the fruit, then pays zakah on the remainder.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الزكاة / 7608