select ref,debito,credito FROM cgtb00004 WHERE (cuenta_no = "1161-01" and status_t is null and fecha <= "300598" and cod_sec = cod_sec and num_doc = "0018")