- + trans.ov_freight_tax + trans.ov_discount) AS TotalAmount,
- trans.alloc AS Allocated,
- ((trans.type = 10)
+ + trans.ov_freight_tax + trans.ov_discount) AS TotalAmount, ";
+ if ($_POST['filterType'] != ALL_TEXT)
+ $sql .= "@bal := @bal+(trans.ov_amount + trans.ov_gst + trans.ov_freight + trans.ov_freight_tax + trans.ov_discount), ";
+
+// else
+// $sql .= "IF(trans.type=".ST_CUSTDELIVERY.",'', IF(trans.type=".ST_SALESINVOICE." OR trans.type=".ST_BANKPAYMENT.",@bal := @bal+
+// (trans.ov_amount + trans.ov_gst + trans.ov_freight + trans.ov_freight_tax + trans.ov_discount), @bal := @bal-
+// (trans.ov_amount + trans.ov_gst + trans.ov_freight + trans.ov_freight_tax + trans.ov_discount))) , ";
+ $sql .= "trans.alloc AS Allocated,
+ ((trans.type = ".ST_SALESINVOICE.")