Motivated by the earlier experimental results and \textit{ab initio} studies on the electronic structure of layered ruthenates (Sr$_2$RuO$_4$ and Ca$_2$RuO$_4$) we introduce and investigate the multiband $d-p$ charge transfer model describing a single RuO$_4$ layer, similar to the charge transfer model for a single CuO$_2$ plane including apical oxygen orbitals in high $T_c$ cuprates. The present model takes into account nearest-neighbor anisotropic ruthenium-oxygen $d-p$ and oxygen-oxygen $p-p$ hopping elements, crystal-field splittings and spin-orbit coupling. The intraorbital Coulomb repulsion and Hund's exchange are defined not only at ruthenium but also at oxygen ions. Our results demonstrate that the RuO$_4$ layer cannot be regarded to be a pure ruthenium $t_{2g}$ system. We examine a different scenario in which ruthenium $e_g$ orbitals are partly occupied and highlight the significance of oxygen orbitals. We point out that the predictions of an idealized model based on ionic configuration (with $n_0=4+4\times 6=28$ electrons per RuO$_4$ unit) do not agree with the experimental facts for Sr$_2$RuO$_4$ which support our finding that the electron number in the $d-p$ states is significantly smaller. In fact, we find the electron occupation of $d$ and $p$ orbitals for a single RuO$_4$ unit $n=28-x$, being smaller by at least 1--1.5 electrons from that in the ionic model and corresponding to self-doping with $x\simeq 1.5$.