Improved journal trans: added currency support, tax and source document date. Allowed...
[fa-stable.git] / purchasing / includes / db / suppliers_db.inc
index c3a3b798c0bc43068694a02e6146bd72c964c345..affdb6270e53827840fe9a0d4c27741f9ccca27e 100644 (file)
@@ -93,7 +93,8 @@ function get_supplier_details($supplier_id, $to=null, $all=true)
        if ($all)
        $value = "(trans.ov_amount + trans.ov_gst + trans.ov_discount)";
     else       
-       $value = "IF (trans.type=".ST_SUPPINVOICE." OR trans.type=".ST_BANKDEPOSIT.",
+       $value = "IF (trans.type=".ST_SUPPINVOICE." OR trans.type=".ST_BANKDEPOSIT."
+       OR (trans.type=".ST_JOURNAL." AND (trans.ov_amount + trans.ov_gst + trans.ov_discount)>0),
                (trans.ov_amount + trans.ov_gst + trans.ov_discount - trans.alloc),
                (trans.ov_amount + trans.ov_gst + trans.ov_discount + trans.alloc))";
        $due = "IF (trans.type=".ST_SUPPINVOICE." OR trans.type=".ST_SUPPCREDIT.",trans.due_date,trans.tran_date)";