DATEADD(dd, -1, @year + '-' + 'select * from mon_allstat('+ b.shpdate + ')' + '-01')
DATEADD(dd, -1, @year + '-' + MONTH(b.shpdate) + '-01')