We assume that the \$n\$ batteries have been connected in parallel, and the external resistor connecting the endpoints(terminals) of the parallel part.
\$n:=\$ number of the batteries.
\$r_i:=\$ith internal resistance of the ith battery.
\$E_i:=\$ith EMF of the ith battery.
\$I_i:=\$ith current which flows between the endpoints of the ith battery.
\$I:=\sum_{i}{I_i}\$ ;(The current which flows through the external resistor).
\$R:=\$external resitance.
My textbooks says that below equation is true.
\$R*I=r_i*I_i+E_i\$
I thought that the above equation is wrong and my below equation is true as applying Kirchhoff's law(potential drops).
\$R*I+r_i*I_i=E_i\$
Can anyone tell me what I have been missing or mistaking so that I can resolve the problem on my own.