Section 22. Each sheriff shall keep an account of all fees and money received by virtue of his office, and, except as otherwise provided, shall annually, on or before June fifteenth, render to the county treasurer a sworn account thereof and, except as provided in section seventeen, pay him the same.