A Macroeconomic Model with Financially Constrained Producers and Intermediaries