I've been trying to read Gross' paper on Heegner points on $X_0(N)$ and I am stuck on a few details. The definition he is working with is that a heegner points is a pair $y=(E,E')$, where $E$ and $E'$ are elliptic curves admitting an isogeny that has cyclic kernel of order $N$ and where $E$ and $E'$ both have complex multiplication by the order $\mathcal{O}$ of discriminant $D$ in a quadratic imaginary field $K$. Gross goes on to explain that we may assume the lattice for $E$ is a fractional ideal $\mathfrak{a}$ and the lattice for $E'$ is $\mathfrak{b}$ such that the ideal $\mathfrak{n}=\mathfrak{a}\mathfrak{b}^{-1}$ is proper ideal of $\mathcal{O}$ such that the quotient $\mathcal{O}/\mathfrak{n}$ is cyclic of order $N$. It is the next line that I don't understand:

"Such an ideal will exist if and only if there is a primitive binary quadratic form of discriminant $D$ which properly represents $N$...". The line goes on, but this is one of the things I'm stuck on. I've tried googling some notes/papers on binary quadratic forms, but I can't find anything that helps me understand what a binary quadratic form representing $N$ has to say about an order admitting a cyclic quotient. An explanation or a good reference would be much appreciated.

The second and, I think, more important part of my confusion is a bit later on in the same section: Gross goes on to explain that if we have such an $\mathfrak{n}$, we can construct a heegner point as follows. Let $\mathfrak{a}$ be an invertible $\mathcal{O}$-submodule of $K$ and let $[\mathfrak{a}]$ denotes its class in $Pic(\mathcal{O})$. Let $\mathfrak{n}$ be a proper $\mathcal{O}$-ideal with cyclic quotient of order $N$, put $E=\mathbf{C}/\mathfrak{a}$, $E'=\mathbf{C}/\mathfrak{a}\mathfrak{n}^{-1}$. They are related by an obvious isogeny and thus determine a Heegner point, denoted $(\mathcal{O},\mathfrak{n},[\mathfrak{a}])$.

Next, given $y=(\mathcal{O},\mathfrak{n},[\mathfrak{a}])$, we can find the image of it in the upper-half plane by picking an oriented basis $\langle\omega_1,\omega_2\rangle$ of $\mathfrak{a}$ such that $\mathfrak{a}\mathfrak{n}^{-1}=\langle\omega_1,\omega_2/N\rangle$. Then $y$ corresponds to the orbit of $\omega_1/\omega_2$ under $\Gamma_0(N)$. Lastly, since $\tau\in K$ it follows that it satisfies $A\tau^2+b\tau+C=0$ for some integers $A,B,C$ such that $gcd(A,B,C)=1$.

Finally, what I don't understand is that Gross claims that $D=B^2-4AC, A=NA'$ from some $A'$ and $gcd(A',B,NC)$. I don't see what the $\tau$ we cooked up has to do with the discriminant of our order. I have read a paper that defined a Heegner point to be a quadratic imaginary point in the half-plane such that $\Delta(\tau)=\Delta(N\tau)$. I have seen how this would help with part of the claim above, but I don't see why in this situation, $\Delta(\tau)=\Delta(N\tau)$. In fact, it seems that everything I'm confused about here is the fact that it seems to be the case that $$D=\Delta(\tau)=\Delta(NT),$$ where $\Delta$ denotes discriminant.

Any insight into these two questions would very appreciated.