Modern inverters have built-in charge controllers, so in that case, connect solar dc supply to inverter. Then connect DC supply lines to batteries, which will automatically charge them, and drain out power, when needed. Then take AC power supply from inverter for use.