nFeeRequired must be replaced with nTransactionFee here, I would remove this line and put it below before the return:
if((total + nTransactionFee) > getBalance())
{
        transaction.setTransactionFee(nTransactionFee);
        return SendCoinsReturn(AmountWithFeeExceedsBalance);
}