At time $t$ the payment is $P=I_t+K_t$ with interest part $I_t=Pi\,a_{\overline{n-t+1}|i}=P(1-v^{n-t+1})$ and principal part $K_t=Pv^{n-t+1}$ and the outstanding balance is $P\,a_{\overline{n-t}|i}$.
$v=\frac{1}{1+i}$, $a_{\overline{m}|i}=\frac{1-v^m}{i}=\frac{1-(1+i)^{-m}}{i}$ and $i$ is the effective interest rate for the payment period.
So if you have $i^{(12)}=10\%$ annual nominal rate, compounded monthly, the effective monthly interest rate is $i=\frac{i^{(12)}}{12}$.