  We consider a locally trivial fiber bundle $\pi : E \to M$ over a compact
oriented two-dimensional manifold $M$, and a section $s$ of this bundle defined
over $M \setminus \Sigma$, where $\Sigma$ is a discrete subset of $M$. We call
the set $\Sigma$ the set of singularities of the section $s : M \setminus
\Sigma \to E$. We assume that the behavior of the section $s$ at the
singularities is controlled in the following way: $s(M \setminus \Sigma)$
coincides with the interior part of a surface $S \subset E$ with boundary
$\partial S$, and $\partial S$ is $\pi^{-1}(\Sigma)$. For such sections $s$ we
define an index of $s$ at a point of $\Sigma$, which generalizes in the natural
way the index of zero of a vector field, and then prove that the sum of this
indices at the points of $\Sigma$ can be expressed as integral over $S$ of a
$2$-form constructed via a connection in $E$. Then we show that the classical
Hopf-Poincar\'e-Gauss-Bonnet formula is a partial case of our result, and
consider some other applications.
  Keywords: singularity of section, index of singular point, curvature,
projective bundle, $G$-structure
