clear all
close all

current_month = 3

data = xlsread('DollarsSpent.xls');

idx = 1:51;

month = datenum(data(idx,1), data(idx,2), 28);

spent = data(idx,13);
cumulative_spent = data(idx,14);

linear_spendrate = data(idx,4);
planned_spendrate = data(idx,6);




figure('Position', [ 198         610        1101         403]);
fh = plot(month,cumulative_spent,month,linear_spendrate,month,planned_spendrate,[datenum(month(43)) datenum(month(43))],[0 linear_spendrate(end)],'--');
legend('Actual Spending','Linear Spend Profile','Planned Spend Profile','Location','NorthWest');
datetick('x','mmm-yyyy','keepticks');
ylabel('Thousands of Dollars');
xlabel('Date');
title('Spending through Oct 22, 2012');
%foo = axis;
%foo(1) = month(1);
%foo(2) = month(end);
%axis(foo);

print('-dpng','Spending through Oct, 2012');
print('-dpdf','Spending through Oct, 2012');

figure('Position', [ 198         610        1101         403]);
fh = bar(month,spent/1000)
hold on
plot(month,ones(1,length(month))*nanmean(spent/1000),month()
legend('Monthly expenditures','Average monthly spending','Allowable average montly spending to end')
datetick('x','mmm-yyyy','keepticks');
ylabel('Thousands of Dollars');
xlabel('Date');


