I am trying to solve this equation:

$dz = \frac{x^2+z-y^2}{x} dx + \frac{y^2+xy-z}{x} dy$
With the following form:
$dq_3 = B_1 dq_1 + B_2 dq_2$
condition (taking dq1.dq2=dq2.dq1)is:
$\frac{\partial B_1}{\partial q_2} + \frac{\partial B_1}{\partial q_3} B_2 = \frac{\partial B_2}{\partial q_1} + \frac{\partial B_2}{\partial q_3} B_1$.
RHS = $\frac{-x^2}{x^2}=-1$ which is true
LHS= $\frac{-2y}{x} + \frac{y^2+xy-z}{x^2} = \frac{y^2-xy-z}{x^2}$ this should be -1!
the solution is: $z = x^2-xy+y^2$
Question:
- What is wrong with my calculations?
note: This is used to prove holonomic constraints for Lagrangian mechanics and I think it isn't relevant to include that.
Thanks in advance.