How to define a Weil divisor from a Cartier divisor on a variety? Let $X$ be an irreducible variety. Here are the definitions I'm working with (from Shafarevich). 
A Weil divisor on $X$ is a formal finite sum of irreducible closed codimension 1 subvarieties of $X$. A Cartier divisor is "a system of rational functions $\{f_i\}$ corresponding to the open sets $U_i$ of a cover $X=\cup U_i$ satisfying both conditions: (1) the $f_i$ are not identically 0; (2) $f_i/f_j$ and $f_j/f_i$ are both regular on $U_i\cap U_j$." 
I don't understand Shafarevich's description of how to define a Weil divisor from a Cartier divisor. He says that "any compatible system of functions defines a [Weil] divisor on $X$. Indeed, for a prime divisor $C$, we set $k_C=v_C(f_i)$ if $U_i\cap C\neq \emptyset $". He mentions that $k_C$ is independent of the choice of $i$ by compatibility, and thus we end up with a divisor $D=\sum k_C C$. 

Does this mean that, given a Cartier divisor $(U_i, f_i)$, to define the Weil divisor we need only fix some $f=f_i$ and compute $v_C(f)$ for that $f$ only?

I was trying to do what I thought might be an easy example, but I'm having trouble with the computations. Can someone help or critique where I'm going wrong? Let $H\subseteq \mathbb{P}^2$ be a hyperplane defined by $F(X,Y,Z)=aX+bY+cZ=0$. Then $H$ is an irreducible codimension 1 subvariety and therefore $H$ is a Weil divisor. If $U_i=\mathbb A _i^2$ is the standard affine cover of $\mathbb P^2$ then we also have Cartier divisor $(U_i, f_i)$, where $f_0=F/X, f_1=F/Y, f_2=F/Z$. It would make a lot of sense that the Weil divisor determined by $(U_i, f_i)$ be equal to $H$, but it doesn't seem to be... By definition, it suffices to compute $k_C=v_C(f_0)$ for every prime divisor $C$. (What is the best way to do this?) I think the only prime divisors $C$ where $v_C(f_0)$ is nonzero are $C=H$ and $C=(X=0)$, where I've found $v_H(f_0)=1$ and $v_{(X=0)}(f_0)=-1$. Thus it seems like the Weil divisor determined by $(U_i, f_i)$ is $H-H_0$ (not $H$!), where $H_0=(X=0)$. This seems wrong to me... Can someone help? 
 A: In order to provide an answer to this question, let me expand Jane Doé's comment.
Fitst, let me clarify two things:
i) There are many members within this Community who know much more than me about these topics, and it should be they who provided a full answer.
ii) In order to give some intuition behind Shafarevich's reasoning, I will talk about the zeros of functions, instead of valuation rings. This means I am refuising to use schemes as much as possible. Both picturesd are quivalent, though, and one can say

*

*$v_Y(f) = k$ if $f$ vanishes along $Y$ (or rather, along $Y\cap U_i$) up to order $k$


*$v_Y(f)=-k$ if $1/f$ vanishes along $Y$ up to order $k$


*$v_Y(f)=0$ otherwise.
(I have just discoeverd that The Stacks Project give concrete recipes to compute the valuations $v_Y$ when they talk about Divisors here. If you came up with an explicit proof of such equivalence, please let me know.)
In full generality, Carier divisors are global sections of the quotient sheaf $\mathscr K^*/\mathscr O^*_X$, where $\mathscr O_X$ is the structure sheaf of the variety and $\mathscr K$ is that of meromorphic functions (I do not know if that was the sheafy approach some users were looking forward to, for me there is no much difference).
Because I am not familiar with GAGA equivalence, I think of $\mathscr K$ as the sheaf of rings associated to the presheaf
$$
U\longmapsto S(U)^{-1}(U)\Gamma(U,\mathscr O_X),
$$
where $S(U)$ denotes the local sections $s$ over $U$ such that $s_x \in\mathscr O_{X,x}$ are not zero divisors, $x\in U$.
This is actually the general definition of $\mathscr K$, which I guess turns out to be equivalent to the sheaf of meromorphic functions for well-behaved schemes.
Because of the definition of the quotient sheaf, a global section of $\mathscr K^*/\mathscr O_X^*$ is equivalent to giving elements $f_i\in \Gamma(U_i,\mathscr K)$ such that $f_if_j^{-1}$ are in the subgroup $\Gamma(U_i\cap U_j,\mathscr O_X^*$ whenever $U_i\cap U_j$ are non-empty.
Now, $v_Y(D)$ is all about the local nature of $D$ around the generic point $\eta$ of $Y$, which is encode in the local piece $f_i$.
If $U_i$ does not contain $\eta$, then tehere is nothing to say and $v_Y(D)=0$.
Assume then that $\eta\in U_i$, and, moreover, that $\eta \in U_j$, for some $j\neq i$.
Then $f_i=rf_j$ for some invertible element $r\in\Gamma(U_i\cap U_j,\mathscr O_X^*)$, so that $f_i$ and $f_j$ ''have the same zeros and poles'' and thus $v_Y(D)=v_Y(f_i)=v_Y(f_j)$.
Remark. In full generality, once needs to be carefull when talking about zeros and poles of sections of $\mathscr K$.
This is easily seen for curves because Weil divisors are formal sum of points.
Suppose furthermore that our curve is quasi-projective (I do not know if that is completely necessary), so that we can expand functions using Laurent series.
For a point $x$ in the domain of the $i$-th piece $f_i$ defining a Cartier divisor $D$, set $v_x(D)$ to be the unique integer $k$ such that $a_k$ is the first non-trivial term in the Laurent expansion of $f_i$ around $x$ (once more, this should be equivalent to any previous definition given so far).
If $x$ is also in the domian of another piece $f_j$, then $f_i$ and $f_j$ are related by a nowhere-vanishing function $r$, meaning that the integer $k$, as just defined, remains unchanged.
Of course if $x$ is not in the definition of $f_j$, $v_x(D)$ cannot be computed using $f_j$.
This question is also about the morphism $CaCl(X) \to Cl(X)$, but as treated in Hartshorne.
To be honest, I cannot see there is much difference between one another, and in my opinion both resemble Grothendieck's approach.
