PHP Sort Associative Array first by relativity of value then by other value desc
You are not actually sorting on qt, only using it to separate two sets (positive qt coming first). Only within each set you are actually sorting (on sa). Therefore, the usort() comparator function could look like this:
usort($array, function($a, $b) {
    // split in positive and negative set
   if ($a['qt'] &lt;= 0 &amp;&amp; $b['qt'] &gt; 0) return 1; // b before a
   if ($a['qt'] &gt; 0 &amp;&amp; $b['qt'] &lt;= 0) return -1; // a before b

   // both a and b are in the same set. sort on `sa` descending
   return $b['sa'] - $a['sa'];
});