I have a water tank, a horizontally placed cylinder with two ends (one at right, the other at the left), these ends have a spherical cap [not hemispherical] of a sphere whose radius is $R$.
Given $L$, the level of water from ground (as in figure), and $W$, the width (i.e. the distance between the top of the spherical cap to its circular base)... I can find the volume of partially-filled cylinder or the cap (but filled not partially filled). Can anyone help me?

Suggestions: A ball of radius $R$ centered at the origin is described by $$ x^{2} + y^{2} + z^{2} \leq R^{2}. \tag{1} $$ The end cap of your tank can be modeled as the set of points $$ x_{0} := R - W \leq x \leq R. \tag{2} $$ Taking the positive $z$-axis to point "upward" (perpendicularly to the fluid surface), the bottom of the tank lies at height $$ z_{0} := -\sqrt{R^{2} - x_{0}^{2}} = -\sqrt{(2R - W)W}. $$ The fluid in the tank therefore lies in the region $$ z_{0} \leq z \leq z_{0} + L. \tag{3} $$ The proposed strategy is to cut the region into slices $x = \text{constant}$ and calculate the area of a slice, then integrate the areas from $x = x_{0} = R - W$ to $x = R$, see (2). The slice at $x$ is the portion of a disk of radius $\sqrt{R^{2} - x^{2}}$ cut by a chord lying at a distance $|z_{0} + L|$ from the center.
Overall, the calculation looks messy but doable. I haven't worked out the details, however, and I haven't given much thought to other coordinate systems.