Changed Report Statements to accept selector Outstanding Only
[fa-stable.git] / gl / includes / db / gl_db_trans.inc
index 7c94063a6e399f477e898fe708dce141851209b0..e64169676bd0bee655a8e5c7dfd4c96af020f0b4 100644 (file)
@@ -401,6 +401,17 @@ function void_trans_tax_details($type, $type_no)
        db_query($sql, "The transaction tax details could not be voided");
 }
 
+//----------------------------------------------------------------------------------------
+
+function clear_trans_tax_details($type, $type_no)
+{
+       $sql = "DELETE FROM ".TB_PREF."trans_tax_details 
+               WHERE trans_no=".db_escape($type_no)
+               ." AND trans_type=".db_escape($type);
+
+       db_query($sql, "The transaction tax details could not be cleared");
+}
+
 function get_tax_summary($from, $to)
 {
        $fromdate = date2sql($from);
@@ -561,6 +572,22 @@ function void_gl_trans($type, $trans_id, $nested=false)
                commit_transaction();
 }
 
+//--------------------------------------------------------------------------------------------------
+
+function clear_gl_trans($type, $trans_id, $nested=false)
+{
+       if (!$nested)
+               begin_transaction();
+
+       $sql = "DELETE FROM ".TB_PREF."gl_trans WHERE type=".db_escape($type)
+       ." AND type_no=".db_escape($trans_id);
+
+       db_query($sql, "could not clear gl transactions for type=$type and trans_no=$trans_id");
+
+       if (!$nested)
+               commit_transaction();
+}
+
 //----------------------------------------------------------------------------------------
 
 function void_journal_trans($type, $type_no, $use_transaction=true)
@@ -619,6 +646,7 @@ function get_sql_for_journal_inquiry()
        }
        $sql .= " GROUP BY gl.type, gl.type_no";
 */
+
        $sql = "SELECT  IF(ISNULL(a.gl_seq),0,a.gl_seq) as gl_seq,
                gl.tran_date,
                gl.type,
@@ -642,6 +670,9 @@ function get_sql_for_journal_inquiry()
        if (isset($_POST['Ref']) && $_POST['Ref'] != "") {
                $sql .= " AND reference LIKE '%". $_POST['Ref'] . "%'";
        }
+       if (isset($_POST['Memo']) && $_POST['Memo'] != "") {
+               $sql .= " AND com.memo_ LIKE '%". $_POST['Memo'] . "%'";
+       }
        if (get_post('filterType') != -1) {
                $sql .= " AND gl.type=".get_post('filterType');
        }