Photovoltaic (PV) power generation systems are one of the most promising renewable power sources to reduce carbon footprint. Grid-connected PV power systems do not generally have a battery to store the excess charge. However, due to severe imbalance between the peak PV power generation and peak load demand, battery-less Grid-connected PV systems are much less effective for the purpose of power generation and demand mismatch mitigation. Grid-connected PV systems equipped with a battery indeed require elaborate management. This is the first paper that introduces a systematic battery management optimization that accommodates arbitrary electricity billing policies. We formulate an optimization framework to determine the battery charging current from the Grid and PV array taking into account the limited battery capacity, power converter efficiency, battery's internal resistance and rate capacity effect, and maximum power tracking of the PV array. Experimental results show that the proposed algorithm effectively reduces the electricity bill by as much as 28% when compared with previous state-of-the-art battery management policies.