<?php

function gl_inquiry_controls() {

    global $payment_person_all_types;
    
    $dim = get_company_pref('use_dimension');

    start_table(TABLESTYLE_NOBORDER);
	start_row();
            gl_all_accounts_list_cells(_("Account:"), 'account', null, false, false, _("All Accounts"), true);
            date_cells(_("from:"), 'TransFromDate', '', null, -30, 0, 0, null, true);
            date_cells(_("to:"), 'TransToDate', '', null, 0, 0, 0, null, true);
        end_row();
    end_table();

        
    start_table(TABLESTYLE_NOBORDER);
    start_row();    
        project_list_cells(_("Project:"), 'project_id', null, _('Select a project'), true);    

        $gl_tr_tp_array = array("'GL_TRANS_TYPE_BANKPAYMENT'", "'GL_TRANS_TYPE_BANKDEPOSIT'", "'GL_TRANS_TYPE_CASH_PAYMENT'", 
                                "'GL_TRANS_TYPE_CASH_RECEIPT'", "'GL_TRANS_TYPE_GL_CREDIT'", "'GL_TRANS_TYPE_GL_DEBIT'", "'GL_TRANS_TYPE_JOURNAL'");
        $list_codes_in = implode(',', $gl_tr_tp_array);
        filtered_value_list_cells('GL Trans Type:', 'gl_trans_type_id', $list_codes_in, '', null, '', true); 
        
        $payment_person_all_types[-1] = '';
        ksort($payment_person_all_types);
        custom_values_list_cells('Person Type:', 'person_type_id', $payment_person_all_types, null, false, true);
    end_table();
    
    start_table(TABLESTYLE_NOBORDER);
	start_row();
            if ($dim >= 1)
                    dimensions_list_cells(_("Dimension")." 1:", 'Dimension', null, true, " ", false, 1);
            if ($dim > 1)
                    dimensions_list_cells(_("Dimension")." 2:", 'Dimension2', null, true, " ", false, 2);

            small_amount_cells(_("Amount min:"), 'amount_min', null, " ");
            small_amount_cells(_("Amount max:"), 'amount_max', null, " ");
            submit_cells('Show',_("Show"),'','', 'default');
	end_row();
    end_table(2);

    
    echo '<hr>';
}

function display_view_fi_remaining_transactions($type_id, $cutoff_date) {
    global $path_to_root, $systypes_array;

    
        $text = "Remaining ".$systypes_array[$type_id]."s Up To ".sql2date($cutoff_date);
        display_heading($text);
        
        br(1);

        $result = fi_get_remaining_transactions_details($type_id, $cutoff_date);
	
	start_table(TABLESTYLE);

        $th = array(_("Type"), _("#"), _("Date"));

        table_header($th, "width=25%");

        $n=0;
        while ($myrow = db_fetch($result)) {

            alt_table_row_color($k);

                label_cell($systypes_array[$type_id]);
                $link = get_trans_view_str($type_id, $myrow["trans_no"]);
                label_cell($link, "align=center");
                label_cell(sql2date($myrow["tran_date"]), "align=center");
                
                $n++;

            end_row();
        }
        
        start_row();
        label_cell("Count", "align=right");
        label_cell($n, "align=center");
        label_cell("");
        end_row();
        
        end_table();
        
            
            
            
            br(2);



}
