Heisenberg Exchange Integral in a Non-Orthogonal Basis for Antiferromagnetic and Ferromagnetic Systems