
<?php


    mysql_query("update cuotas set dias_atraso=TIMESTAMPDIFF(DAY, vence, CURDATE()) -5 where balance>1") or die(mysql_error());
    mysql_query("update cuotas set dias_atraso=0 where dias_atraso<0") or die(mysql_error());
    mysql_query("update cuotas set mora=(balance * 10/100) * (dias_atraso/30) where balance>1 and dias_atraso>0") or die(mysql_error());
    mysql_query("update cuotas set mora=0 where mora<0") or die(mysql_error());
    mysql_query("update cuotas set balance=balance_capital + balance_interes + mora where balance>1") or die(mysql_error());
   ?>
