Define velocity in terms of distance from the body's initial position with Lambert W function. TL;DR: $$x=2t+\dfrac{\mathrm{e}^{-40t}}{20}$$ solve for t.

I have a function for velocity relative to time:
$$v(t)=\dfrac{gm\left(1-\mathrm{e}^{-\frac{kt}{m}}\right)}{k}$$
g,m and k are all constants
And need to define velocity in terms of distance from the body's initial position (x), so I made the following steps:
v(t)= dx/dt
dx = v(t)dt
x = F(t)
and arrived at:
$$x=\dfrac{gm\mathrm{e}^{-\frac{kt}{m}}\left(\left(kt-m\right)\mathrm{e}^\frac{kt}{m}+m\right)}{k^2}$$
now I want to solve for t in terms x and substitute t(x) into v(t) to get v(x), but have no clue how to do so.
Please ask any questions if I was unclear/help with my conundrum.
 A: Assuming that your equation is correct, to simplify notations, let $\frac{k t}m=T$ and $\alpha=\frac{g m^2}{k^2}$ the expression. This would give
$$x=\alpha  \left(T+e^{-T}-1\right)\implies T+e^{-T}=\frac x \alpha+1$$ So, now the usual manipulations for Lambert function to get
$$T=\left(\frac{x}{\alpha }+1\right)+W\left(-e^{-\left(\frac{x}{\alpha }+1\right)}\right)$$ Beck to the initial variables, this should give
$$t=\frac{k }{g m}x+\frac{m}{k}+\frac{m }{k}W\left(-e^{-\left(\frac{k^2 }{g m^2}x+1\right)}\right)$$
Take care that $W(z)$ is real only if $z \geq -\frac 1e$. So, for
$$x=2t+\dfrac{\mathrm{e}^{-40t}}{20}\implies t=\frac{x}{2}+\frac{1}{40} W\left(-e^{-20 x}\right)$$ the real solution will exist for $x \geq \frac 1 {50}$.
A: Follows the detailed transformation
$$
x=\dfrac{gm\mathrm{e}^{-\frac{kt}{m}}\left(\left(kt-m\right)\mathrm{e}^\frac{kt}{m}+m\right)}{k^2}
$$
or
$$
\frac{xk^2}{mg} = kt-m+me^{-\frac{kt}{m}}
$$
or
$$
\frac{xk^2}{mg}+m=kt+me^{-\frac{kt}{m}}
$$
or
$$
\frac{xk^2}{m^2g}+1=\frac{kt}{m}+e^{-\frac{kt}{m}}
$$
now calling $u = \frac{kt}{m}$ and $b = \frac{xk^2}{m^2g}+1$ we have
$$
b = u + e^{-u}
$$
now calling $v = b-u$ we have
$$
v = e^{v-b}\Rightarrow v e^{-v} = e^{-b}\Rightarrow (-v)e^{-v}= -e^{-b}
$$
and finally using $Y e^Y = X \Leftrightarrow Y = W(X)$
$$
v = -W(e^{-b}) = b-u \Rightarrow u = b + W(e^{-b}) 
$$
or
$$
\frac{kt}{m} = \frac{xk^2}{m^2g}+1 + W\left(e^{-\left(\frac{xk^2}{m^2g}+1\right)}\right)
$$
A: Let $h$ be the height where the body drop, and substitute
$$\color{red}{u}=e^{-\frac{kt}{m}}=1-\dfrac{kv}{mg}~~~,~~~v=\dfrac{gm}{k}(1-u)~~~,~~~\color{red}{y}=\dfrac{kh}{m}-\dfrac{k^2}{m^2g}x~~~,~~~x=\dfrac{mgh}{k}-\dfrac{m^2g}{k^2}y$$
then after simplification remains $y=\ln u-u$ or 
$$-\color{red}{u}=W(-e^\color{red}{y})$$
