<?php
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *                                   ATTENTION!
 * If you see this message in your browser (Internet Explorer, Mozilla Firefox, Google Chrome, etc.)
 * this means that PHP is not properly installed on your web server. Please refer to the PHP manual
 * for more details: http://php.net/manual/install.php 
 *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 */

    include_once dirname(__FILE__) . '/components/startup.php';
    include_once dirname(__FILE__) . '/components/application.php';
    include_once dirname(__FILE__) . '/' . 'authorization.php';


    include_once dirname(__FILE__) . '/' . 'database_engine/mysql_engine.php';
    include_once dirname(__FILE__) . '/' . 'components/page/page_includes.php';

    function GetConnectionOptions()
    {
        $result = GetGlobalConnectionOptions();
        $result['client_encoding'] = 'utf8';
        GetApplication()->GetUserAuthentication()->applyIdentityToConnectionOptions($result);
        return $result;
    }

    
    
    
    
    // OnBeforePageExecute event handler
    
    
    
    class notas_itensPage extends DetailPage
    {
        protected function DoBeforeCreate()
        {
            $this->SetTitle('Itens');
            $this->SetMenuLabel('Itens');
            $this->SetHeader(GetPagesHeader());
            $this->SetFooter(GetPagesFooter());
    
            $this->dataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`itens`');
            $this->dataset->addFields(
                array(
                    new IntegerField('id_itens', true, true, true),
                    new StringField('chave'),
                    new StringField('numero_item'),
                    new StringField('codigo_produto'),
                    new StringField('codigo_barras_comercial'),
                    new StringField('descricao'),
                    new StringField('codigo_ncm'),
                    new StringField('cest'),
                    new StringField('codigo_ex_tipi'),
                    new StringField('cfop'),
                    new StringField('unidade_comercial'),
                    new StringField('quantidade_comercial'),
                    new StringField('valor_unitario_comercial'),
                    new StringField('valor_bruto'),
                    new StringField('codigo_barras_tributavel'),
                    new StringField('unidade_tributavel'),
                    new StringField('quantidade_tributavel'),
                    new StringField('valor_unitario_tributavel'),
                    new StringField('valor_frete'),
                    new StringField('valor_outras_despesas'),
                    new StringField('inclui_no_total'),
                    new StringField('pedido_compra'),
                    new StringField('numero_item_pedido_compra'),
                    new StringField('icms_origem'),
                    new StringField('icms_situacao_tributaria'),
                    new StringField('icms_modalidade_base_calculo'),
                    new StringField('icms_base_calculo'),
                    new StringField('icms_base_calculo_retido_st'),
                    new StringField('icms_reducao_base_calculo'),
                    new StringField('icms_aliquota'),
                    new StringField('icms_valor'),
                    new StringField('icms_valor_retido_st'),
                    new StringField('icms_valor_desonerado'),
                    new StringField('icms_valor_operacao'),
                    new StringField('icms_percentual_diferimento'),
                    new StringField('icms_valor_diferido'),
                    new StringField('icms_motivo_desoneracao'),
                    new StringField('icms_modalidade_base_calculo_st'),
                    new StringField('icms_margem_valor_adicionado_st'),
                    new StringField('icms_reducao_base_calculo_st'),
                    new StringField('icms_base_calculo_st'),
                    new StringField('icms_aliquota_st'),
                    new StringField('icms_valor_st'),
                    new StringField('ipi_situacao_tributaria'),
                    new StringField('ipi_base_calculo'),
                    new StringField('ipi_aliquota'),
                    new StringField('ipi_quantidade_total'),
                    new StringField('ipi_valor_por_unidade_tributavel'),
                    new StringField('ipi_valor'),
                    new StringField('ipi_classe_enquadramento'),
                    new StringField('ipi_cnpj_produtor'),
                    new StringField('ipi_codigo_selo_controle'),
                    new StringField('ipi_codigo_enquadramento_legal'),
                    new StringField('pis_situacao_tributaria'),
                    new StringField('pis_base_calculo'),
                    new StringField('pis_aliquota_porcentual'),
                    new StringField('pis_quantidade_vendida'),
                    new StringField('pis_aliquota_valor'),
                    new StringField('pis_valor'),
                    new StringField('pis_base_calculo_st'),
                    new StringField('pis_aliquota_porcentaul_st'),
                    new StringField('pis_quantidade_vendida_st'),
                    new StringField('pis_aliquota_valor_st'),
                    new StringField('pis_valor_st'),
                    new StringField('cofins_situacao_tributaria'),
                    new StringField('cofins_base_calculo'),
                    new StringField('cofins_aliquota_porcentual'),
                    new StringField('cofins_quantidade_vendida'),
                    new StringField('cofins_aliquota_valor'),
                    new StringField('cofins_valor'),
                    new StringField('cofins_base_calculo_st'),
                    new StringField('cofins_aliquota_porcentual_st'),
                    new StringField('cofins_quantidade_vendida_st'),
                    new StringField('cofins_aliquota_valor_st'),
                    new StringField('cofins_valor_st'),
                    new StringField('percentual_devolvido'),
                    new StringField('valor_ipi_devolvido')
                )
            );
            $this->dataset->AddLookupField('inclui_no_total', 'inclui_no_total', new StringField('cd_tabela'), new StringField('ds_tabela', false, false, false, false, 'inclui_no_total_ds_tabela', 'inclui_no_total_ds_tabela_inclui_no_total'), 'inclui_no_total_ds_tabela_inclui_no_total');
            $this->dataset->AddLookupField('icms_origem', 'icms_origem', new StringField('cd_tabela'), new StringField('ds_tabela', false, false, false, false, 'icms_origem_ds_tabela', 'icms_origem_ds_tabela_icms_origem'), 'icms_origem_ds_tabela_icms_origem');
            $this->dataset->AddLookupField('icms_situacao_tributaria', 'icms_situacao_tributaria', new StringField('cd_tabela'), new StringField('ds_tabela', false, false, false, false, 'icms_situacao_tributaria_ds_tabela', 'icms_situacao_tributaria_ds_tabela_icms_situacao_tributaria'), 'icms_situacao_tributaria_ds_tabela_icms_situacao_tributaria');
            $this->dataset->AddLookupField('icms_modalidade_base_calculo', 'icms_modalidade_base_calculo', new StringField('cd_tabela'), new StringField('ds_tabela', false, false, false, false, 'icms_modalidade_base_calculo_ds_tabela', 'icms_modalidade_base_calculo_ds_tabela_icms_modalidade_base_calculo'), 'icms_modalidade_base_calculo_ds_tabela_icms_modalidade_base_calculo');
            $this->dataset->AddLookupField('icms_modalidade_base_calculo_st', 'icms_modalidade_base_calculo', new StringField('cd_tabela'), new StringField('ds_tabela', false, false, false, false, 'icms_modalidade_base_calculo_st_ds_tabela', 'icms_modalidade_base_calculo_st_ds_tabela_icms_modalidade_base_calculo'), 'icms_modalidade_base_calculo_st_ds_tabela_icms_modalidade_base_calculo');
            $this->dataset->AddLookupField('ipi_situacao_tributaria', 'ipi_situacao_tributaria', new StringField('cd_tabela'), new StringField('ds_tabela', false, false, false, false, 'ipi_situacao_tributaria_ds_tabela', 'ipi_situacao_tributaria_ds_tabela_ipi_situacao_tributaria'), 'ipi_situacao_tributaria_ds_tabela_ipi_situacao_tributaria');
            $this->dataset->AddLookupField('ipi_codigo_enquadramento_legal', 'ipi_codigo_enquadramento_legal', new StringField('cd_tabela'), new StringField('ds_tabela', false, false, false, false, 'ipi_codigo_enquadramento_legal_ds_tabela', 'ipi_codigo_enquadramento_legal_ds_tabela_ipi_codigo_enquadramento_legal'), 'ipi_codigo_enquadramento_legal_ds_tabela_ipi_codigo_enquadramento_legal');
            $this->dataset->AddLookupField('pis_situacao_tributaria', 'pis_situacao_tributaria', new StringField('cd_tabela'), new StringField('ds_tabela', false, false, false, false, 'pis_situacao_tributaria_ds_tabela', 'pis_situacao_tributaria_ds_tabela_pis_situacao_tributaria'), 'pis_situacao_tributaria_ds_tabela_pis_situacao_tributaria');
            $this->dataset->AddLookupField('cofins_situacao_tributaria', 'cofins_situacao_tributaria', new StringField('cd_tabela'), new StringField('ds_tabela', false, false, false, false, 'cofins_situacao_tributaria_ds_tabela', 'cofins_situacao_tributaria_ds_tabela_cofins_situacao_tributaria'), 'cofins_situacao_tributaria_ds_tabela_cofins_situacao_tributaria');
        }
    
        protected function DoPrepare() {
    
        }
    
        protected function CreatePageNavigator()
        {
            $result = new CompositePageNavigator($this);
            
            $partitionNavigator = new PageNavigator('pnav', $this, $this->dataset);
            $partitionNavigator->SetRowsPerPage(20);
            $result->AddPageNavigator($partitionNavigator);
            
            return $result;
        }
    
        protected function CreateRssGenerator()
        {
            return null;
        }
    
        protected function setupCharts()
        {
    
        }
    
        protected function getFiltersColumns()
        {
            return array(
                new FilterColumn($this->dataset, 'id_itens', 'id_itens', 'Id Itens'),
                new FilterColumn($this->dataset, 'chave', 'chave', 'Chave'),
                new FilterColumn($this->dataset, 'numero_item', 'numero_item', 'Numero Item'),
                new FilterColumn($this->dataset, 'codigo_produto', 'codigo_produto', 'Codigo Produto'),
                new FilterColumn($this->dataset, 'codigo_barras_comercial', 'codigo_barras_comercial', 'Codigo Barras Comercial'),
                new FilterColumn($this->dataset, 'descricao', 'descricao', 'Descricao'),
                new FilterColumn($this->dataset, 'codigo_ncm', 'codigo_ncm', 'Codigo Ncm'),
                new FilterColumn($this->dataset, 'cest', 'cest', 'Cest'),
                new FilterColumn($this->dataset, 'codigo_ex_tipi', 'codigo_ex_tipi', 'Codigo Ex Tipi'),
                new FilterColumn($this->dataset, 'cfop', 'cfop', 'CFOP'),
                new FilterColumn($this->dataset, 'unidade_comercial', 'unidade_comercial', 'Unidade Comercial'),
                new FilterColumn($this->dataset, 'quantidade_comercial', 'quantidade_comercial', 'Quantidade Comercial'),
                new FilterColumn($this->dataset, 'valor_unitario_comercial', 'valor_unitario_comercial', 'Valor Unitario Comercial'),
                new FilterColumn($this->dataset, 'valor_bruto', 'valor_bruto', 'Valor Bruto'),
                new FilterColumn($this->dataset, 'codigo_barras_tributavel', 'codigo_barras_tributavel', 'Codigo Barras Tributavel'),
                new FilterColumn($this->dataset, 'unidade_tributavel', 'unidade_tributavel', 'Unidade Tributavel'),
                new FilterColumn($this->dataset, 'quantidade_tributavel', 'quantidade_tributavel', 'Quantidade Tributavel'),
                new FilterColumn($this->dataset, 'valor_unitario_tributavel', 'valor_unitario_tributavel', 'Valor Unitario Tributavel'),
                new FilterColumn($this->dataset, 'valor_outras_despesas', 'valor_outras_despesas', 'Valor Outras Despesas'),
                new FilterColumn($this->dataset, 'inclui_no_total', 'inclui_no_total_ds_tabela', 'Inclui No Total'),
                new FilterColumn($this->dataset, 'pedido_compra', 'pedido_compra', 'Pedido Compra'),
                new FilterColumn($this->dataset, 'numero_item_pedido_compra', 'numero_item_pedido_compra', 'Numero Item Pedido Compra'),
                new FilterColumn($this->dataset, 'icms_origem', 'icms_origem_ds_tabela', 'Icms Origem'),
                new FilterColumn($this->dataset, 'icms_situacao_tributaria', 'icms_situacao_tributaria_ds_tabela', 'Icms Situacao Tributaria'),
                new FilterColumn($this->dataset, 'icms_modalidade_base_calculo', 'icms_modalidade_base_calculo_ds_tabela', 'Icms Modalidade Base Calculo'),
                new FilterColumn($this->dataset, 'icms_base_calculo', 'icms_base_calculo', 'Icms Base Calculo'),
                new FilterColumn($this->dataset, 'icms_base_calculo_retido_st', 'icms_base_calculo_retido_st', 'Icms Base Calculo Retido St'),
                new FilterColumn($this->dataset, 'icms_reducao_base_calculo', 'icms_reducao_base_calculo', 'Icms Reducao Base Calculo'),
                new FilterColumn($this->dataset, 'icms_aliquota', 'icms_aliquota', 'Icms Aliquota'),
                new FilterColumn($this->dataset, 'icms_valor', 'icms_valor', 'Icms Valor'),
                new FilterColumn($this->dataset, 'icms_valor_retido_st', 'icms_valor_retido_st', 'Icms Valor Retido St'),
                new FilterColumn($this->dataset, 'icms_valor_desonerado', 'icms_valor_desonerado', 'Icms Valor Desonerado'),
                new FilterColumn($this->dataset, 'icms_valor_operacao', 'icms_valor_operacao', 'Icms Valor Operacao'),
                new FilterColumn($this->dataset, 'icms_percentual_diferimento', 'icms_percentual_diferimento', 'Icms Percentual Diferimento'),
                new FilterColumn($this->dataset, 'icms_valor_diferido', 'icms_valor_diferido', 'Icms Valor Diferido'),
                new FilterColumn($this->dataset, 'icms_motivo_desoneracao', 'icms_motivo_desoneracao', 'Icms Motivo Desoneracao'),
                new FilterColumn($this->dataset, 'icms_modalidade_base_calculo_st', 'icms_modalidade_base_calculo_st_ds_tabela', 'Icms Modalidade Base Calculo St'),
                new FilterColumn($this->dataset, 'icms_margem_valor_adicionado_st', 'icms_margem_valor_adicionado_st', 'Icms Margem Valor Adicionado St'),
                new FilterColumn($this->dataset, 'icms_reducao_base_calculo_st', 'icms_reducao_base_calculo_st', 'Icms Reducao Base Calculo St'),
                new FilterColumn($this->dataset, 'icms_base_calculo_st', 'icms_base_calculo_st', 'Icms Base Calculo St'),
                new FilterColumn($this->dataset, 'icms_aliquota_st', 'icms_aliquota_st', 'Icms Aliquota St'),
                new FilterColumn($this->dataset, 'icms_valor_st', 'icms_valor_st', 'Icms Valor St'),
                new FilterColumn($this->dataset, 'ipi_situacao_tributaria', 'ipi_situacao_tributaria_ds_tabela', 'Ipi Situacao Tributaria'),
                new FilterColumn($this->dataset, 'ipi_base_calculo', 'ipi_base_calculo', 'Ipi Base Calculo'),
                new FilterColumn($this->dataset, 'ipi_aliquota', 'ipi_aliquota', 'Ipi Aliquota'),
                new FilterColumn($this->dataset, 'ipi_quantidade_total', 'ipi_quantidade_total', 'Ipi Quantidade Total'),
                new FilterColumn($this->dataset, 'ipi_valor_por_unidade_tributavel', 'ipi_valor_por_unidade_tributavel', 'Ipi Valor Por Unidade Tributavel'),
                new FilterColumn($this->dataset, 'ipi_valor', 'ipi_valor', 'Ipi Valor'),
                new FilterColumn($this->dataset, 'ipi_classe_enquadramento', 'ipi_classe_enquadramento', 'Ipi Classe Enquadramento'),
                new FilterColumn($this->dataset, 'ipi_cnpj_produtor', 'ipi_cnpj_produtor', 'Ipi Cnpj Produtor'),
                new FilterColumn($this->dataset, 'ipi_codigo_selo_controle', 'ipi_codigo_selo_controle', 'Ipi Codigo Selo Controle'),
                new FilterColumn($this->dataset, 'ipi_codigo_enquadramento_legal', 'ipi_codigo_enquadramento_legal_ds_tabela', 'Ipi Codigo Enquadramento Legal'),
                new FilterColumn($this->dataset, 'pis_situacao_tributaria', 'pis_situacao_tributaria_ds_tabela', 'Pis Situacao Tributaria'),
                new FilterColumn($this->dataset, 'pis_base_calculo', 'pis_base_calculo', 'Pis Base Calculo'),
                new FilterColumn($this->dataset, 'pis_aliquota_porcentual', 'pis_aliquota_porcentual', 'Pis Aliquota Porcentual'),
                new FilterColumn($this->dataset, 'pis_quantidade_vendida', 'pis_quantidade_vendida', 'Pis Quantidade Vendida'),
                new FilterColumn($this->dataset, 'pis_aliquota_valor', 'pis_aliquota_valor', 'Pis Aliquota Valor'),
                new FilterColumn($this->dataset, 'pis_valor', 'pis_valor', 'Pis Valor'),
                new FilterColumn($this->dataset, 'pis_base_calculo_st', 'pis_base_calculo_st', 'Pis Base Calculo St'),
                new FilterColumn($this->dataset, 'pis_aliquota_porcentaul_st', 'pis_aliquota_porcentaul_st', 'Pis Aliquota Porcentaul St'),
                new FilterColumn($this->dataset, 'pis_quantidade_vendida_st', 'pis_quantidade_vendida_st', 'Pis Quantidade Vendida St'),
                new FilterColumn($this->dataset, 'pis_aliquota_valor_st', 'pis_aliquota_valor_st', 'Pis Aliquota Valor St'),
                new FilterColumn($this->dataset, 'pis_valor_st', 'pis_valor_st', 'Pis Valor St'),
                new FilterColumn($this->dataset, 'cofins_situacao_tributaria', 'cofins_situacao_tributaria_ds_tabela', 'Cofins Situacao Tributaria'),
                new FilterColumn($this->dataset, 'cofins_base_calculo', 'cofins_base_calculo', 'Cofins Base Calculo'),
                new FilterColumn($this->dataset, 'cofins_aliquota_porcentual', 'cofins_aliquota_porcentual', 'Cofins Aliquota Porcentual'),
                new FilterColumn($this->dataset, 'cofins_quantidade_vendida', 'cofins_quantidade_vendida', 'Cofins Quantidade Vendida'),
                new FilterColumn($this->dataset, 'cofins_aliquota_valor', 'cofins_aliquota_valor', 'Cofins Aliquota Valor'),
                new FilterColumn($this->dataset, 'cofins_valor', 'cofins_valor', 'Cofins Valor'),
                new FilterColumn($this->dataset, 'cofins_base_calculo_st', 'cofins_base_calculo_st', 'Cofins Base Calculo St'),
                new FilterColumn($this->dataset, 'cofins_aliquota_porcentual_st', 'cofins_aliquota_porcentual_st', 'Cofins Aliquota Porcentual St'),
                new FilterColumn($this->dataset, 'cofins_quantidade_vendida_st', 'cofins_quantidade_vendida_st', 'Cofins Quantidade Vendida St'),
                new FilterColumn($this->dataset, 'cofins_aliquota_valor_st', 'cofins_aliquota_valor_st', 'Cofins Aliquota Valor St'),
                new FilterColumn($this->dataset, 'cofins_valor_st', 'cofins_valor_st', 'Cofins Valor St'),
                new FilterColumn($this->dataset, 'percentual_devolvido', 'percentual_devolvido', 'Percentual Devolvido'),
                new FilterColumn($this->dataset, 'valor_ipi_devolvido', 'valor_ipi_devolvido', 'Valor Ipi Devolvido'),
                new FilterColumn($this->dataset, 'valor_frete', 'valor_frete', 'Valor Frete')
            );
        }
    
        protected function setupQuickFilter(QuickFilter $quickFilter, FixedKeysArray $columns)
        {
            $quickFilter
                ->addColumn($columns['chave'])
                ->addColumn($columns['numero_item'])
                ->addColumn($columns['codigo_produto'])
                ->addColumn($columns['codigo_barras_comercial'])
                ->addColumn($columns['descricao'])
                ->addColumn($columns['codigo_ncm'])
                ->addColumn($columns['codigo_ex_tipi'])
                ->addColumn($columns['cfop'])
                ->addColumn($columns['unidade_comercial'])
                ->addColumn($columns['quantidade_comercial'])
                ->addColumn($columns['valor_unitario_comercial'])
                ->addColumn($columns['valor_bruto'])
                ->addColumn($columns['codigo_barras_tributavel'])
                ->addColumn($columns['unidade_tributavel'])
                ->addColumn($columns['quantidade_tributavel'])
                ->addColumn($columns['valor_unitario_tributavel'])
                ->addColumn($columns['valor_outras_despesas'])
                ->addColumn($columns['inclui_no_total'])
                ->addColumn($columns['pedido_compra'])
                ->addColumn($columns['numero_item_pedido_compra'])
                ->addColumn($columns['icms_origem'])
                ->addColumn($columns['icms_situacao_tributaria'])
                ->addColumn($columns['icms_modalidade_base_calculo'])
                ->addColumn($columns['icms_base_calculo'])
                ->addColumn($columns['icms_base_calculo_retido_st'])
                ->addColumn($columns['icms_reducao_base_calculo'])
                ->addColumn($columns['icms_aliquota'])
                ->addColumn($columns['icms_valor'])
                ->addColumn($columns['icms_valor_retido_st'])
                ->addColumn($columns['icms_valor_desonerado'])
                ->addColumn($columns['icms_valor_operacao'])
                ->addColumn($columns['icms_percentual_diferimento'])
                ->addColumn($columns['icms_valor_diferido'])
                ->addColumn($columns['icms_motivo_desoneracao'])
                ->addColumn($columns['icms_modalidade_base_calculo_st'])
                ->addColumn($columns['icms_margem_valor_adicionado_st'])
                ->addColumn($columns['icms_reducao_base_calculo_st'])
                ->addColumn($columns['icms_base_calculo_st'])
                ->addColumn($columns['icms_aliquota_st'])
                ->addColumn($columns['icms_valor_st'])
                ->addColumn($columns['ipi_situacao_tributaria'])
                ->addColumn($columns['ipi_base_calculo'])
                ->addColumn($columns['ipi_aliquota'])
                ->addColumn($columns['ipi_quantidade_total'])
                ->addColumn($columns['ipi_valor_por_unidade_tributavel'])
                ->addColumn($columns['ipi_valor'])
                ->addColumn($columns['ipi_classe_enquadramento'])
                ->addColumn($columns['ipi_cnpj_produtor'])
                ->addColumn($columns['ipi_codigo_selo_controle'])
                ->addColumn($columns['ipi_codigo_enquadramento_legal'])
                ->addColumn($columns['pis_situacao_tributaria'])
                ->addColumn($columns['pis_base_calculo'])
                ->addColumn($columns['pis_aliquota_porcentual'])
                ->addColumn($columns['pis_quantidade_vendida'])
                ->addColumn($columns['pis_aliquota_valor'])
                ->addColumn($columns['pis_valor'])
                ->addColumn($columns['pis_base_calculo_st'])
                ->addColumn($columns['pis_aliquota_porcentaul_st'])
                ->addColumn($columns['pis_quantidade_vendida_st'])
                ->addColumn($columns['pis_aliquota_valor_st'])
                ->addColumn($columns['pis_valor_st'])
                ->addColumn($columns['cofins_situacao_tributaria'])
                ->addColumn($columns['cofins_base_calculo'])
                ->addColumn($columns['cofins_aliquota_porcentual'])
                ->addColumn($columns['cofins_quantidade_vendida'])
                ->addColumn($columns['cofins_aliquota_valor'])
                ->addColumn($columns['cofins_valor'])
                ->addColumn($columns['cofins_base_calculo_st'])
                ->addColumn($columns['cofins_aliquota_porcentual_st'])
                ->addColumn($columns['cofins_quantidade_vendida_st'])
                ->addColumn($columns['cofins_aliquota_valor_st'])
                ->addColumn($columns['cofins_valor_st'])
                ->addColumn($columns['percentual_devolvido'])
                ->addColumn($columns['valor_ipi_devolvido'])
                ->addColumn($columns['cest'])
                ->addColumn($columns['valor_frete']);
        }
    
        protected function setupColumnFilter(ColumnFilter $columnFilter)
        {
            $columnFilter
                ->setOptionsFor('inclui_no_total')
                ->setOptionsFor('icms_origem')
                ->setOptionsFor('icms_situacao_tributaria')
                ->setOptionsFor('icms_modalidade_base_calculo')
                ->setOptionsFor('icms_modalidade_base_calculo_st')
                ->setOptionsFor('ipi_situacao_tributaria')
                ->setOptionsFor('ipi_codigo_enquadramento_legal')
                ->setOptionsFor('pis_situacao_tributaria')
                ->setOptionsFor('cofins_situacao_tributaria');
        }
    
        protected function setupFilterBuilder(FilterBuilder $filterBuilder, FixedKeysArray $columns)
        {
            $main_editor = new TextEdit('chave_edit');
            $main_editor->SetMaxLength(15);
            
            $filterBuilder->addColumn(
                $columns['chave'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('numero_item_edit');
            $main_editor->SetMaxLength(6);
            
            $filterBuilder->addColumn(
                $columns['numero_item'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('codigo_produto_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['codigo_produto'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('codigo_barras_comercial_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['codigo_barras_comercial'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('descricao');
            
            $filterBuilder->addColumn(
                $columns['descricao'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('codigo_ncm_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['codigo_ncm'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('cest_edit');
            $main_editor->SetMaxLength(7);
            
            $filterBuilder->addColumn(
                $columns['cest'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('codigo_ex_tipi_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['codigo_ex_tipi'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('cfop_edit');
            $main_editor->SetMaxLength(6);
            
            $filterBuilder->addColumn(
                $columns['cfop'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('unidade_comercial_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['unidade_comercial'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('quantidade_comercial_edit');
            $main_editor->SetMaxLength(12);
            
            $filterBuilder->addColumn(
                $columns['quantidade_comercial'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('valor_unitario_comercial_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['valor_unitario_comercial'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('valor_bruto_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['valor_bruto'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('codigo_barras_tributavel_edit');
            $main_editor->SetMaxLength(30);
            
            $filterBuilder->addColumn(
                $columns['codigo_barras_tributavel'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('unidade_tributavel_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['unidade_tributavel'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('quantidade_tributavel_edit');
            $main_editor->SetMaxLength(12);
            
            $filterBuilder->addColumn(
                $columns['quantidade_tributavel'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('valor_unitario_tributavel_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['valor_unitario_tributavel'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('valor_outras_despesas_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['valor_outras_despesas'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new DynamicCombobox('inclui_no_total_edit', $this->CreateLinkBuilder());
            $main_editor->setAllowClear(true);
            $main_editor->setMinimumInputLength(0);
            $main_editor->SetAllowNullValue(false);
            $main_editor->SetHandlerName('filter_builder_notas_itens_inclui_no_total_search');
            
            $multi_value_select_editor = new RemoteMultiValueSelect('inclui_no_total', $this->CreateLinkBuilder());
            $multi_value_select_editor->SetHandlerName('filter_builder_notas_itens_inclui_no_total_search');
            
            $text_editor = new TextEdit('inclui_no_total');
            
            $filterBuilder->addColumn(
                $columns['inclui_no_total'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $text_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $text_editor,
                    FilterConditionOperator::BEGINS_WITH => $text_editor,
                    FilterConditionOperator::ENDS_WITH => $text_editor,
                    FilterConditionOperator::IS_LIKE => $text_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $text_editor,
                    FilterConditionOperator::IN => $multi_value_select_editor,
                    FilterConditionOperator::NOT_IN => $multi_value_select_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('pedido_compra_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['pedido_compra'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('numero_item_pedido_compra_edit');
            $main_editor->SetMaxLength(10);
            
            $filterBuilder->addColumn(
                $columns['numero_item_pedido_compra'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new DynamicCombobox('icms_origem_edit', $this->CreateLinkBuilder());
            $main_editor->setAllowClear(true);
            $main_editor->setMinimumInputLength(0);
            $main_editor->SetAllowNullValue(false);
            $main_editor->SetHandlerName('filter_builder_notas_itens_icms_origem_search');
            
            $multi_value_select_editor = new RemoteMultiValueSelect('icms_origem', $this->CreateLinkBuilder());
            $multi_value_select_editor->SetHandlerName('filter_builder_notas_itens_icms_origem_search');
            
            $text_editor = new TextEdit('icms_origem');
            
            $filterBuilder->addColumn(
                $columns['icms_origem'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $text_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $text_editor,
                    FilterConditionOperator::BEGINS_WITH => $text_editor,
                    FilterConditionOperator::ENDS_WITH => $text_editor,
                    FilterConditionOperator::IS_LIKE => $text_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $text_editor,
                    FilterConditionOperator::IN => $multi_value_select_editor,
                    FilterConditionOperator::NOT_IN => $multi_value_select_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new DynamicCombobox('icms_situacao_tributaria_edit', $this->CreateLinkBuilder());
            $main_editor->setAllowClear(true);
            $main_editor->setMinimumInputLength(0);
            $main_editor->SetAllowNullValue(false);
            $main_editor->SetHandlerName('filter_builder_notas_itens_icms_situacao_tributaria_search');
            
            $multi_value_select_editor = new RemoteMultiValueSelect('icms_situacao_tributaria', $this->CreateLinkBuilder());
            $multi_value_select_editor->SetHandlerName('filter_builder_notas_itens_icms_situacao_tributaria_search');
            
            $text_editor = new TextEdit('icms_situacao_tributaria');
            
            $filterBuilder->addColumn(
                $columns['icms_situacao_tributaria'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $text_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $text_editor,
                    FilterConditionOperator::BEGINS_WITH => $text_editor,
                    FilterConditionOperator::ENDS_WITH => $text_editor,
                    FilterConditionOperator::IS_LIKE => $text_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $text_editor,
                    FilterConditionOperator::IN => $multi_value_select_editor,
                    FilterConditionOperator::NOT_IN => $multi_value_select_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new DynamicCombobox('icms_modalidade_base_calculo_edit', $this->CreateLinkBuilder());
            $main_editor->setAllowClear(true);
            $main_editor->setMinimumInputLength(0);
            $main_editor->SetAllowNullValue(false);
            $main_editor->SetHandlerName('filter_builder_notas_itens_icms_modalidade_base_calculo_search');
            
            $multi_value_select_editor = new RemoteMultiValueSelect('icms_modalidade_base_calculo', $this->CreateLinkBuilder());
            $multi_value_select_editor->SetHandlerName('filter_builder_notas_itens_icms_modalidade_base_calculo_search');
            
            $text_editor = new TextEdit('icms_modalidade_base_calculo');
            
            $filterBuilder->addColumn(
                $columns['icms_modalidade_base_calculo'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $text_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $text_editor,
                    FilterConditionOperator::BEGINS_WITH => $text_editor,
                    FilterConditionOperator::ENDS_WITH => $text_editor,
                    FilterConditionOperator::IS_LIKE => $text_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $text_editor,
                    FilterConditionOperator::IN => $multi_value_select_editor,
                    FilterConditionOperator::NOT_IN => $multi_value_select_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('icms_base_calculo_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['icms_base_calculo'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('icms_base_calculo_retido_st_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['icms_base_calculo_retido_st'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('icms_reducao_base_calculo_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['icms_reducao_base_calculo'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('icms_aliquota_edit');
            $main_editor->SetMaxLength(10);
            
            $filterBuilder->addColumn(
                $columns['icms_aliquota'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('icms_valor_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['icms_valor'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('icms_valor_retido_st_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['icms_valor_retido_st'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('icms_valor_desonerado_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['icms_valor_desonerado'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('icms_valor_operacao_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['icms_valor_operacao'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('icms_percentual_diferimento_edit');
            $main_editor->SetMaxLength(10);
            
            $filterBuilder->addColumn(
                $columns['icms_percentual_diferimento'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('icms_valor_diferido_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['icms_valor_diferido'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('icms_motivo_desoneracao_edit');
            $main_editor->SetMaxLength(1);
            
            $filterBuilder->addColumn(
                $columns['icms_motivo_desoneracao'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new DynamicCombobox('icms_modalidade_base_calculo_st_edit', $this->CreateLinkBuilder());
            $main_editor->setAllowClear(true);
            $main_editor->setMinimumInputLength(0);
            $main_editor->SetAllowNullValue(false);
            $main_editor->SetHandlerName('filter_builder_notas_itens_icms_modalidade_base_calculo_st_search');
            
            $multi_value_select_editor = new RemoteMultiValueSelect('icms_modalidade_base_calculo_st', $this->CreateLinkBuilder());
            $multi_value_select_editor->SetHandlerName('filter_builder_notas_itens_icms_modalidade_base_calculo_st_search');
            
            $text_editor = new TextEdit('icms_modalidade_base_calculo_st');
            
            $filterBuilder->addColumn(
                $columns['icms_modalidade_base_calculo_st'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $text_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $text_editor,
                    FilterConditionOperator::BEGINS_WITH => $text_editor,
                    FilterConditionOperator::ENDS_WITH => $text_editor,
                    FilterConditionOperator::IS_LIKE => $text_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $text_editor,
                    FilterConditionOperator::IN => $multi_value_select_editor,
                    FilterConditionOperator::NOT_IN => $multi_value_select_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('icms_margem_valor_adicionado_st_edit');
            $main_editor->SetMaxLength(10);
            
            $filterBuilder->addColumn(
                $columns['icms_margem_valor_adicionado_st'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('icms_reducao_base_calculo_st_edit');
            $main_editor->SetMaxLength(10);
            
            $filterBuilder->addColumn(
                $columns['icms_reducao_base_calculo_st'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('icms_base_calculo_st_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['icms_base_calculo_st'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('icms_aliquota_st_edit');
            $main_editor->SetMaxLength(10);
            
            $filterBuilder->addColumn(
                $columns['icms_aliquota_st'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('icms_valor_st_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['icms_valor_st'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new DynamicCombobox('ipi_situacao_tributaria_edit', $this->CreateLinkBuilder());
            $main_editor->setAllowClear(true);
            $main_editor->setMinimumInputLength(0);
            $main_editor->SetAllowNullValue(false);
            $main_editor->SetHandlerName('filter_builder_notas_itens_ipi_situacao_tributaria_search');
            
            $multi_value_select_editor = new RemoteMultiValueSelect('ipi_situacao_tributaria', $this->CreateLinkBuilder());
            $multi_value_select_editor->SetHandlerName('filter_builder_notas_itens_ipi_situacao_tributaria_search');
            
            $text_editor = new TextEdit('ipi_situacao_tributaria');
            
            $filterBuilder->addColumn(
                $columns['ipi_situacao_tributaria'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $text_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $text_editor,
                    FilterConditionOperator::BEGINS_WITH => $text_editor,
                    FilterConditionOperator::ENDS_WITH => $text_editor,
                    FilterConditionOperator::IS_LIKE => $text_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $text_editor,
                    FilterConditionOperator::IN => $multi_value_select_editor,
                    FilterConditionOperator::NOT_IN => $multi_value_select_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('ipi_base_calculo_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['ipi_base_calculo'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('ipi_aliquota_edit');
            $main_editor->SetMaxLength(10);
            
            $filterBuilder->addColumn(
                $columns['ipi_aliquota'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('ipi_quantidade_total_edit');
            $main_editor->SetMaxLength(12);
            
            $filterBuilder->addColumn(
                $columns['ipi_quantidade_total'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('ipi_valor_por_unidade_tributavel_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['ipi_valor_por_unidade_tributavel'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('ipi_valor_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['ipi_valor'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('ipi_classe_enquadramento_edit');
            $main_editor->SetMaxLength(30);
            
            $filterBuilder->addColumn(
                $columns['ipi_classe_enquadramento'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('ipi_cnpj_produtor_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['ipi_cnpj_produtor'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('ipi_codigo_selo_controle_edit');
            $main_editor->SetMaxLength(30);
            
            $filterBuilder->addColumn(
                $columns['ipi_codigo_selo_controle'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new DynamicCombobox('ipi_codigo_enquadramento_legal_edit', $this->CreateLinkBuilder());
            $main_editor->setAllowClear(true);
            $main_editor->setMinimumInputLength(0);
            $main_editor->SetAllowNullValue(false);
            $main_editor->SetHandlerName('filter_builder_notas_itens_ipi_codigo_enquadramento_legal_search');
            
            $multi_value_select_editor = new RemoteMultiValueSelect('ipi_codigo_enquadramento_legal', $this->CreateLinkBuilder());
            $multi_value_select_editor->SetHandlerName('filter_builder_notas_itens_ipi_codigo_enquadramento_legal_search');
            
            $text_editor = new TextEdit('ipi_codigo_enquadramento_legal');
            
            $filterBuilder->addColumn(
                $columns['ipi_codigo_enquadramento_legal'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $text_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $text_editor,
                    FilterConditionOperator::BEGINS_WITH => $text_editor,
                    FilterConditionOperator::ENDS_WITH => $text_editor,
                    FilterConditionOperator::IS_LIKE => $text_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $text_editor,
                    FilterConditionOperator::IN => $multi_value_select_editor,
                    FilterConditionOperator::NOT_IN => $multi_value_select_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new DynamicCombobox('pis_situacao_tributaria_edit', $this->CreateLinkBuilder());
            $main_editor->setAllowClear(true);
            $main_editor->setMinimumInputLength(0);
            $main_editor->SetAllowNullValue(false);
            $main_editor->SetHandlerName('filter_builder_notas_itens_pis_situacao_tributaria_search');
            
            $multi_value_select_editor = new RemoteMultiValueSelect('pis_situacao_tributaria', $this->CreateLinkBuilder());
            $multi_value_select_editor->SetHandlerName('filter_builder_notas_itens_pis_situacao_tributaria_search');
            
            $text_editor = new TextEdit('pis_situacao_tributaria');
            
            $filterBuilder->addColumn(
                $columns['pis_situacao_tributaria'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $text_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $text_editor,
                    FilterConditionOperator::BEGINS_WITH => $text_editor,
                    FilterConditionOperator::ENDS_WITH => $text_editor,
                    FilterConditionOperator::IS_LIKE => $text_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $text_editor,
                    FilterConditionOperator::IN => $multi_value_select_editor,
                    FilterConditionOperator::NOT_IN => $multi_value_select_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('pis_base_calculo_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['pis_base_calculo'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('pis_aliquota_porcentual_edit');
            $main_editor->SetMaxLength(10);
            
            $filterBuilder->addColumn(
                $columns['pis_aliquota_porcentual'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('pis_quantidade_vendida_edit');
            $main_editor->SetMaxLength(12);
            
            $filterBuilder->addColumn(
                $columns['pis_quantidade_vendida'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('pis_aliquota_valor_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['pis_aliquota_valor'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('pis_valor_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['pis_valor'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('pis_base_calculo_st_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['pis_base_calculo_st'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('pis_aliquota_porcentaul_st_edit');
            $main_editor->SetMaxLength(10);
            
            $filterBuilder->addColumn(
                $columns['pis_aliquota_porcentaul_st'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('pis_quantidade_vendida_st_edit');
            $main_editor->SetMaxLength(12);
            
            $filterBuilder->addColumn(
                $columns['pis_quantidade_vendida_st'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('pis_aliquota_valor_st_edit');
            $main_editor->SetMaxLength(10);
            
            $filterBuilder->addColumn(
                $columns['pis_aliquota_valor_st'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('pis_valor_st_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['pis_valor_st'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new DynamicCombobox('cofins_situacao_tributaria_edit', $this->CreateLinkBuilder());
            $main_editor->setAllowClear(true);
            $main_editor->setMinimumInputLength(0);
            $main_editor->SetAllowNullValue(false);
            $main_editor->SetHandlerName('filter_builder_notas_itens_cofins_situacao_tributaria_search');
            
            $multi_value_select_editor = new RemoteMultiValueSelect('cofins_situacao_tributaria', $this->CreateLinkBuilder());
            $multi_value_select_editor->SetHandlerName('filter_builder_notas_itens_cofins_situacao_tributaria_search');
            
            $text_editor = new TextEdit('cofins_situacao_tributaria');
            
            $filterBuilder->addColumn(
                $columns['cofins_situacao_tributaria'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $text_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $text_editor,
                    FilterConditionOperator::BEGINS_WITH => $text_editor,
                    FilterConditionOperator::ENDS_WITH => $text_editor,
                    FilterConditionOperator::IS_LIKE => $text_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $text_editor,
                    FilterConditionOperator::IN => $multi_value_select_editor,
                    FilterConditionOperator::NOT_IN => $multi_value_select_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('cofins_base_calculo_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['cofins_base_calculo'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('cofins_aliquota_porcentual_edit');
            $main_editor->SetMaxLength(10);
            
            $filterBuilder->addColumn(
                $columns['cofins_aliquota_porcentual'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('cofins_quantidade_vendida_edit');
            $main_editor->SetMaxLength(12);
            
            $filterBuilder->addColumn(
                $columns['cofins_quantidade_vendida'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('cofins_aliquota_valor_edit');
            $main_editor->SetMaxLength(10);
            
            $filterBuilder->addColumn(
                $columns['cofins_aliquota_valor'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('cofins_valor_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['cofins_valor'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('cofins_base_calculo_st_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['cofins_base_calculo_st'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('cofins_aliquota_porcentual_st_edit');
            $main_editor->SetMaxLength(10);
            
            $filterBuilder->addColumn(
                $columns['cofins_aliquota_porcentual_st'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('cofins_quantidade_vendida_st_edit');
            $main_editor->SetMaxLength(12);
            
            $filterBuilder->addColumn(
                $columns['cofins_quantidade_vendida_st'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('cofins_aliquota_valor_st_edit');
            $main_editor->SetMaxLength(10);
            
            $filterBuilder->addColumn(
                $columns['cofins_aliquota_valor_st'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('cofins_valor_st_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['cofins_valor_st'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('percentual_devolvido_edit');
            $main_editor->SetMaxLength(10);
            
            $filterBuilder->addColumn(
                $columns['percentual_devolvido'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('valor_ipi_devolvido_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['valor_ipi_devolvido'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('valor_frete_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['valor_frete'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
        }
    
        protected function AddOperationsColumns(Grid $grid)
        {
            $actions = $grid->getActions();
            $actions->setCaption($this->GetLocalizerCaptions()->GetMessageString('Actions'));
            $actions->setPosition(ActionList::POSITION_LEFT);
            
            if ($this->GetSecurityInfo()->HasViewGrant())
            {
                $operation = new LinkOperation($this->GetLocalizerCaptions()->GetMessageString('View'), OPERATION_VIEW, $this->dataset, $grid);
                $operation->setUseImage(true);
                $actions->addOperation($operation);
            }
            
            if ($this->GetSecurityInfo()->HasEditGrant())
            {
                $operation = new LinkOperation($this->GetLocalizerCaptions()->GetMessageString('Edit'), OPERATION_EDIT, $this->dataset, $grid);
                $operation->setUseImage(true);
                $actions->addOperation($operation);
                $operation->OnShow->AddListener('ShowEditButtonHandler', $this);
            }
            
            if ($this->GetSecurityInfo()->HasDeleteGrant())
            {
                $operation = new LinkOperation($this->GetLocalizerCaptions()->GetMessageString('Delete'), OPERATION_DELETE, $this->dataset, $grid);
                $operation->setUseImage(true);
                $actions->addOperation($operation);
                $operation->OnShow->AddListener('ShowDeleteButtonHandler', $this);
                $operation->SetAdditionalAttribute('data-modal-operation', 'delete');
                $operation->SetAdditionalAttribute('data-delete-handler-name', $this->GetModalGridDeleteHandler());
            }
            
            if ($this->GetSecurityInfo()->HasAddGrant())
            {
                $operation = new LinkOperation($this->GetLocalizerCaptions()->GetMessageString('Copy'), OPERATION_COPY, $this->dataset, $grid);
                $operation->setUseImage(true);
                $actions->addOperation($operation);
            }
        }
    
        protected function AddFieldColumns(Grid $grid, $withDetails = true)
        {
            //
            // View column for chave field
            //
            $column = new TextViewColumn('chave', 'chave', 'Chave', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for numero_item field
            //
            $column = new TextViewColumn('numero_item', 'numero_item', 'Numero Item', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for codigo_produto field
            //
            $column = new TextViewColumn('codigo_produto', 'codigo_produto', 'Codigo Produto', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for codigo_barras_comercial field
            //
            $column = new TextViewColumn('codigo_barras_comercial', 'codigo_barras_comercial', 'Codigo Barras Comercial', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for descricao field
            //
            $column = new TextViewColumn('descricao', 'descricao', 'Descricao', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('DetailGridnotas.itens_descricao_handler_list');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for codigo_ncm field
            //
            $column = new TextViewColumn('codigo_ncm', 'codigo_ncm', 'Codigo Ncm', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for cest field
            //
            $column = new TextViewColumn('cest', 'cest', 'Cest', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for codigo_ex_tipi field
            //
            $column = new TextViewColumn('codigo_ex_tipi', 'codigo_ex_tipi', 'Codigo Ex Tipi', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for cfop field
            //
            $column = new TextViewColumn('cfop', 'cfop', 'CFOP', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for unidade_comercial field
            //
            $column = new TextViewColumn('unidade_comercial', 'unidade_comercial', 'Unidade Comercial', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for quantidade_comercial field
            //
            $column = new TextViewColumn('quantidade_comercial', 'quantidade_comercial', 'Quantidade Comercial', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_unitario_comercial field
            //
            $column = new TextViewColumn('valor_unitario_comercial', 'valor_unitario_comercial', 'Valor Unitario Comercial', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_bruto field
            //
            $column = new TextViewColumn('valor_bruto', 'valor_bruto', 'Valor Bruto', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for codigo_barras_tributavel field
            //
            $column = new TextViewColumn('codigo_barras_tributavel', 'codigo_barras_tributavel', 'Codigo Barras Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for unidade_tributavel field
            //
            $column = new TextViewColumn('unidade_tributavel', 'unidade_tributavel', 'Unidade Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for quantidade_tributavel field
            //
            $column = new TextViewColumn('quantidade_tributavel', 'quantidade_tributavel', 'Quantidade Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_unitario_tributavel field
            //
            $column = new TextViewColumn('valor_unitario_tributavel', 'valor_unitario_tributavel', 'Valor Unitario Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_outras_despesas field
            //
            $column = new TextViewColumn('valor_outras_despesas', 'valor_outras_despesas', 'Valor Outras Despesas', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('inclui_no_total', 'inclui_no_total_ds_tabela', 'Inclui No Total', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for pedido_compra field
            //
            $column = new TextViewColumn('pedido_compra', 'pedido_compra', 'Pedido Compra', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for numero_item_pedido_compra field
            //
            $column = new TextViewColumn('numero_item_pedido_compra', 'numero_item_pedido_compra', 'Numero Item Pedido Compra', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('icms_origem', 'icms_origem_ds_tabela', 'Icms Origem', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('icms_situacao_tributaria', 'icms_situacao_tributaria_ds_tabela', 'Icms Situacao Tributaria', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('icms_modalidade_base_calculo', 'icms_modalidade_base_calculo_ds_tabela', 'Icms Modalidade Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for icms_base_calculo field
            //
            $column = new TextViewColumn('icms_base_calculo', 'icms_base_calculo', 'Icms Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for icms_base_calculo_retido_st field
            //
            $column = new TextViewColumn('icms_base_calculo_retido_st', 'icms_base_calculo_retido_st', 'Icms Base Calculo Retido St', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for icms_reducao_base_calculo field
            //
            $column = new TextViewColumn('icms_reducao_base_calculo', 'icms_reducao_base_calculo', 'Icms Reducao Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for icms_aliquota field
            //
            $column = new TextViewColumn('icms_aliquota', 'icms_aliquota', 'Icms Aliquota', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for icms_valor field
            //
            $column = new TextViewColumn('icms_valor', 'icms_valor', 'Icms Valor', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for icms_valor_retido_st field
            //
            $column = new TextViewColumn('icms_valor_retido_st', 'icms_valor_retido_st', 'Icms Valor Retido St', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for icms_valor_desonerado field
            //
            $column = new TextViewColumn('icms_valor_desonerado', 'icms_valor_desonerado', 'Icms Valor Desonerado', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for icms_valor_operacao field
            //
            $column = new TextViewColumn('icms_valor_operacao', 'icms_valor_operacao', 'Icms Valor Operacao', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for icms_percentual_diferimento field
            //
            $column = new TextViewColumn('icms_percentual_diferimento', 'icms_percentual_diferimento', 'Icms Percentual Diferimento', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for icms_valor_diferido field
            //
            $column = new TextViewColumn('icms_valor_diferido', 'icms_valor_diferido', 'Icms Valor Diferido', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for icms_motivo_desoneracao field
            //
            $column = new TextViewColumn('icms_motivo_desoneracao', 'icms_motivo_desoneracao', 'Icms Motivo Desoneracao', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('icms_modalidade_base_calculo_st', 'icms_modalidade_base_calculo_st_ds_tabela', 'Icms Modalidade Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for icms_margem_valor_adicionado_st field
            //
            $column = new TextViewColumn('icms_margem_valor_adicionado_st', 'icms_margem_valor_adicionado_st', 'Icms Margem Valor Adicionado St', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for icms_reducao_base_calculo_st field
            //
            $column = new TextViewColumn('icms_reducao_base_calculo_st', 'icms_reducao_base_calculo_st', 'Icms Reducao Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for icms_base_calculo_st field
            //
            $column = new TextViewColumn('icms_base_calculo_st', 'icms_base_calculo_st', 'Icms Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for icms_aliquota_st field
            //
            $column = new TextViewColumn('icms_aliquota_st', 'icms_aliquota_st', 'Icms Aliquota St', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for icms_valor_st field
            //
            $column = new TextViewColumn('icms_valor_st', 'icms_valor_st', 'Icms Valor St', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('ipi_situacao_tributaria', 'ipi_situacao_tributaria_ds_tabela', 'Ipi Situacao Tributaria', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ipi_base_calculo field
            //
            $column = new TextViewColumn('ipi_base_calculo', 'ipi_base_calculo', 'Ipi Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ipi_aliquota field
            //
            $column = new TextViewColumn('ipi_aliquota', 'ipi_aliquota', 'Ipi Aliquota', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ipi_quantidade_total field
            //
            $column = new TextViewColumn('ipi_quantidade_total', 'ipi_quantidade_total', 'Ipi Quantidade Total', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ipi_valor_por_unidade_tributavel field
            //
            $column = new TextViewColumn('ipi_valor_por_unidade_tributavel', 'ipi_valor_por_unidade_tributavel', 'Ipi Valor Por Unidade Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ipi_valor field
            //
            $column = new TextViewColumn('ipi_valor', 'ipi_valor', 'Ipi Valor', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ipi_classe_enquadramento field
            //
            $column = new TextViewColumn('ipi_classe_enquadramento', 'ipi_classe_enquadramento', 'Ipi Classe Enquadramento', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ipi_cnpj_produtor field
            //
            $column = new TextViewColumn('ipi_cnpj_produtor', 'ipi_cnpj_produtor', 'Ipi Cnpj Produtor', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ipi_codigo_selo_controle field
            //
            $column = new TextViewColumn('ipi_codigo_selo_controle', 'ipi_codigo_selo_controle', 'Ipi Codigo Selo Controle', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('ipi_codigo_enquadramento_legal', 'ipi_codigo_enquadramento_legal_ds_tabela', 'Ipi Codigo Enquadramento Legal', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('pis_situacao_tributaria', 'pis_situacao_tributaria_ds_tabela', 'Pis Situacao Tributaria', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for pis_base_calculo field
            //
            $column = new TextViewColumn('pis_base_calculo', 'pis_base_calculo', 'Pis Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for pis_aliquota_porcentual field
            //
            $column = new TextViewColumn('pis_aliquota_porcentual', 'pis_aliquota_porcentual', 'Pis Aliquota Porcentual', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for pis_quantidade_vendida field
            //
            $column = new TextViewColumn('pis_quantidade_vendida', 'pis_quantidade_vendida', 'Pis Quantidade Vendida', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for pis_aliquota_valor field
            //
            $column = new TextViewColumn('pis_aliquota_valor', 'pis_aliquota_valor', 'Pis Aliquota Valor', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for pis_valor field
            //
            $column = new TextViewColumn('pis_valor', 'pis_valor', 'Pis Valor', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for pis_base_calculo_st field
            //
            $column = new TextViewColumn('pis_base_calculo_st', 'pis_base_calculo_st', 'Pis Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for pis_aliquota_porcentaul_st field
            //
            $column = new TextViewColumn('pis_aliquota_porcentaul_st', 'pis_aliquota_porcentaul_st', 'Pis Aliquota Porcentaul St', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for pis_quantidade_vendida_st field
            //
            $column = new TextViewColumn('pis_quantidade_vendida_st', 'pis_quantidade_vendida_st', 'Pis Quantidade Vendida St', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for pis_aliquota_valor_st field
            //
            $column = new TextViewColumn('pis_aliquota_valor_st', 'pis_aliquota_valor_st', 'Pis Aliquota Valor St', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for pis_valor_st field
            //
            $column = new TextViewColumn('pis_valor_st', 'pis_valor_st', 'Pis Valor St', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('cofins_situacao_tributaria', 'cofins_situacao_tributaria_ds_tabela', 'Cofins Situacao Tributaria', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for cofins_base_calculo field
            //
            $column = new TextViewColumn('cofins_base_calculo', 'cofins_base_calculo', 'Cofins Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for cofins_aliquota_porcentual field
            //
            $column = new TextViewColumn('cofins_aliquota_porcentual', 'cofins_aliquota_porcentual', 'Cofins Aliquota Porcentual', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for cofins_quantidade_vendida field
            //
            $column = new TextViewColumn('cofins_quantidade_vendida', 'cofins_quantidade_vendida', 'Cofins Quantidade Vendida', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for cofins_aliquota_valor field
            //
            $column = new TextViewColumn('cofins_aliquota_valor', 'cofins_aliquota_valor', 'Cofins Aliquota Valor', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for cofins_valor field
            //
            $column = new TextViewColumn('cofins_valor', 'cofins_valor', 'Cofins Valor', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for cofins_base_calculo_st field
            //
            $column = new TextViewColumn('cofins_base_calculo_st', 'cofins_base_calculo_st', 'Cofins Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for cofins_aliquota_porcentual_st field
            //
            $column = new TextViewColumn('cofins_aliquota_porcentual_st', 'cofins_aliquota_porcentual_st', 'Cofins Aliquota Porcentual St', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for cofins_quantidade_vendida_st field
            //
            $column = new TextViewColumn('cofins_quantidade_vendida_st', 'cofins_quantidade_vendida_st', 'Cofins Quantidade Vendida St', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for cofins_aliquota_valor_st field
            //
            $column = new TextViewColumn('cofins_aliquota_valor_st', 'cofins_aliquota_valor_st', 'Cofins Aliquota Valor St', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for cofins_valor_st field
            //
            $column = new TextViewColumn('cofins_valor_st', 'cofins_valor_st', 'Cofins Valor St', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for percentual_devolvido field
            //
            $column = new TextViewColumn('percentual_devolvido', 'percentual_devolvido', 'Percentual Devolvido', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_ipi_devolvido field
            //
            $column = new TextViewColumn('valor_ipi_devolvido', 'valor_ipi_devolvido', 'Valor Ipi Devolvido', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_frete field
            //
            $column = new TextViewColumn('valor_frete', 'valor_frete', 'Valor Frete', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
        }
    
        protected function AddSingleRecordViewColumns(Grid $grid)
        {
            //
            // View column for chave field
            //
            $column = new TextViewColumn('chave', 'chave', 'Chave', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for numero_item field
            //
            $column = new TextViewColumn('numero_item', 'numero_item', 'Numero Item', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for codigo_produto field
            //
            $column = new TextViewColumn('codigo_produto', 'codigo_produto', 'Codigo Produto', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for codigo_barras_comercial field
            //
            $column = new TextViewColumn('codigo_barras_comercial', 'codigo_barras_comercial', 'Codigo Barras Comercial', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for descricao field
            //
            $column = new TextViewColumn('descricao', 'descricao', 'Descricao', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('DetailGridnotas.itens_descricao_handler_view');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for codigo_ncm field
            //
            $column = new TextViewColumn('codigo_ncm', 'codigo_ncm', 'Codigo Ncm', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for cest field
            //
            $column = new TextViewColumn('cest', 'cest', 'Cest', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for codigo_ex_tipi field
            //
            $column = new TextViewColumn('codigo_ex_tipi', 'codigo_ex_tipi', 'Codigo Ex Tipi', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for cfop field
            //
            $column = new TextViewColumn('cfop', 'cfop', 'CFOP', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for unidade_comercial field
            //
            $column = new TextViewColumn('unidade_comercial', 'unidade_comercial', 'Unidade Comercial', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for quantidade_comercial field
            //
            $column = new TextViewColumn('quantidade_comercial', 'quantidade_comercial', 'Quantidade Comercial', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_unitario_comercial field
            //
            $column = new TextViewColumn('valor_unitario_comercial', 'valor_unitario_comercial', 'Valor Unitario Comercial', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_bruto field
            //
            $column = new TextViewColumn('valor_bruto', 'valor_bruto', 'Valor Bruto', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for codigo_barras_tributavel field
            //
            $column = new TextViewColumn('codigo_barras_tributavel', 'codigo_barras_tributavel', 'Codigo Barras Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for unidade_tributavel field
            //
            $column = new TextViewColumn('unidade_tributavel', 'unidade_tributavel', 'Unidade Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for quantidade_tributavel field
            //
            $column = new TextViewColumn('quantidade_tributavel', 'quantidade_tributavel', 'Quantidade Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_unitario_tributavel field
            //
            $column = new TextViewColumn('valor_unitario_tributavel', 'valor_unitario_tributavel', 'Valor Unitario Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_outras_despesas field
            //
            $column = new TextViewColumn('valor_outras_despesas', 'valor_outras_despesas', 'Valor Outras Despesas', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('inclui_no_total', 'inclui_no_total_ds_tabela', 'Inclui No Total', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for pedido_compra field
            //
            $column = new TextViewColumn('pedido_compra', 'pedido_compra', 'Pedido Compra', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for numero_item_pedido_compra field
            //
            $column = new TextViewColumn('numero_item_pedido_compra', 'numero_item_pedido_compra', 'Numero Item Pedido Compra', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('icms_origem', 'icms_origem_ds_tabela', 'Icms Origem', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('icms_situacao_tributaria', 'icms_situacao_tributaria_ds_tabela', 'Icms Situacao Tributaria', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('icms_modalidade_base_calculo', 'icms_modalidade_base_calculo_ds_tabela', 'Icms Modalidade Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for icms_base_calculo field
            //
            $column = new TextViewColumn('icms_base_calculo', 'icms_base_calculo', 'Icms Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for icms_base_calculo_retido_st field
            //
            $column = new TextViewColumn('icms_base_calculo_retido_st', 'icms_base_calculo_retido_st', 'Icms Base Calculo Retido St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for icms_reducao_base_calculo field
            //
            $column = new TextViewColumn('icms_reducao_base_calculo', 'icms_reducao_base_calculo', 'Icms Reducao Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for icms_aliquota field
            //
            $column = new TextViewColumn('icms_aliquota', 'icms_aliquota', 'Icms Aliquota', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for icms_valor field
            //
            $column = new TextViewColumn('icms_valor', 'icms_valor', 'Icms Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for icms_valor_retido_st field
            //
            $column = new TextViewColumn('icms_valor_retido_st', 'icms_valor_retido_st', 'Icms Valor Retido St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for icms_valor_desonerado field
            //
            $column = new TextViewColumn('icms_valor_desonerado', 'icms_valor_desonerado', 'Icms Valor Desonerado', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for icms_valor_operacao field
            //
            $column = new TextViewColumn('icms_valor_operacao', 'icms_valor_operacao', 'Icms Valor Operacao', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for icms_percentual_diferimento field
            //
            $column = new TextViewColumn('icms_percentual_diferimento', 'icms_percentual_diferimento', 'Icms Percentual Diferimento', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for icms_valor_diferido field
            //
            $column = new TextViewColumn('icms_valor_diferido', 'icms_valor_diferido', 'Icms Valor Diferido', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for icms_motivo_desoneracao field
            //
            $column = new TextViewColumn('icms_motivo_desoneracao', 'icms_motivo_desoneracao', 'Icms Motivo Desoneracao', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('icms_modalidade_base_calculo_st', 'icms_modalidade_base_calculo_st_ds_tabela', 'Icms Modalidade Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for icms_margem_valor_adicionado_st field
            //
            $column = new TextViewColumn('icms_margem_valor_adicionado_st', 'icms_margem_valor_adicionado_st', 'Icms Margem Valor Adicionado St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for icms_reducao_base_calculo_st field
            //
            $column = new TextViewColumn('icms_reducao_base_calculo_st', 'icms_reducao_base_calculo_st', 'Icms Reducao Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for icms_base_calculo_st field
            //
            $column = new TextViewColumn('icms_base_calculo_st', 'icms_base_calculo_st', 'Icms Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for icms_aliquota_st field
            //
            $column = new TextViewColumn('icms_aliquota_st', 'icms_aliquota_st', 'Icms Aliquota St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for icms_valor_st field
            //
            $column = new TextViewColumn('icms_valor_st', 'icms_valor_st', 'Icms Valor St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('ipi_situacao_tributaria', 'ipi_situacao_tributaria_ds_tabela', 'Ipi Situacao Tributaria', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ipi_base_calculo field
            //
            $column = new TextViewColumn('ipi_base_calculo', 'ipi_base_calculo', 'Ipi Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ipi_aliquota field
            //
            $column = new TextViewColumn('ipi_aliquota', 'ipi_aliquota', 'Ipi Aliquota', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ipi_quantidade_total field
            //
            $column = new TextViewColumn('ipi_quantidade_total', 'ipi_quantidade_total', 'Ipi Quantidade Total', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ipi_valor_por_unidade_tributavel field
            //
            $column = new TextViewColumn('ipi_valor_por_unidade_tributavel', 'ipi_valor_por_unidade_tributavel', 'Ipi Valor Por Unidade Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ipi_valor field
            //
            $column = new TextViewColumn('ipi_valor', 'ipi_valor', 'Ipi Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ipi_classe_enquadramento field
            //
            $column = new TextViewColumn('ipi_classe_enquadramento', 'ipi_classe_enquadramento', 'Ipi Classe Enquadramento', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ipi_cnpj_produtor field
            //
            $column = new TextViewColumn('ipi_cnpj_produtor', 'ipi_cnpj_produtor', 'Ipi Cnpj Produtor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ipi_codigo_selo_controle field
            //
            $column = new TextViewColumn('ipi_codigo_selo_controle', 'ipi_codigo_selo_controle', 'Ipi Codigo Selo Controle', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('ipi_codigo_enquadramento_legal', 'ipi_codigo_enquadramento_legal_ds_tabela', 'Ipi Codigo Enquadramento Legal', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('pis_situacao_tributaria', 'pis_situacao_tributaria_ds_tabela', 'Pis Situacao Tributaria', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for pis_base_calculo field
            //
            $column = new TextViewColumn('pis_base_calculo', 'pis_base_calculo', 'Pis Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for pis_aliquota_porcentual field
            //
            $column = new TextViewColumn('pis_aliquota_porcentual', 'pis_aliquota_porcentual', 'Pis Aliquota Porcentual', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for pis_quantidade_vendida field
            //
            $column = new TextViewColumn('pis_quantidade_vendida', 'pis_quantidade_vendida', 'Pis Quantidade Vendida', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for pis_aliquota_valor field
            //
            $column = new TextViewColumn('pis_aliquota_valor', 'pis_aliquota_valor', 'Pis Aliquota Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for pis_valor field
            //
            $column = new TextViewColumn('pis_valor', 'pis_valor', 'Pis Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for pis_base_calculo_st field
            //
            $column = new TextViewColumn('pis_base_calculo_st', 'pis_base_calculo_st', 'Pis Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for pis_aliquota_porcentaul_st field
            //
            $column = new TextViewColumn('pis_aliquota_porcentaul_st', 'pis_aliquota_porcentaul_st', 'Pis Aliquota Porcentaul St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for pis_quantidade_vendida_st field
            //
            $column = new TextViewColumn('pis_quantidade_vendida_st', 'pis_quantidade_vendida_st', 'Pis Quantidade Vendida St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for pis_aliquota_valor_st field
            //
            $column = new TextViewColumn('pis_aliquota_valor_st', 'pis_aliquota_valor_st', 'Pis Aliquota Valor St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for pis_valor_st field
            //
            $column = new TextViewColumn('pis_valor_st', 'pis_valor_st', 'Pis Valor St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('cofins_situacao_tributaria', 'cofins_situacao_tributaria_ds_tabela', 'Cofins Situacao Tributaria', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for cofins_base_calculo field
            //
            $column = new TextViewColumn('cofins_base_calculo', 'cofins_base_calculo', 'Cofins Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for cofins_aliquota_porcentual field
            //
            $column = new TextViewColumn('cofins_aliquota_porcentual', 'cofins_aliquota_porcentual', 'Cofins Aliquota Porcentual', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for cofins_quantidade_vendida field
            //
            $column = new TextViewColumn('cofins_quantidade_vendida', 'cofins_quantidade_vendida', 'Cofins Quantidade Vendida', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for cofins_aliquota_valor field
            //
            $column = new TextViewColumn('cofins_aliquota_valor', 'cofins_aliquota_valor', 'Cofins Aliquota Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for cofins_valor field
            //
            $column = new TextViewColumn('cofins_valor', 'cofins_valor', 'Cofins Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for cofins_base_calculo_st field
            //
            $column = new TextViewColumn('cofins_base_calculo_st', 'cofins_base_calculo_st', 'Cofins Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for cofins_aliquota_porcentual_st field
            //
            $column = new TextViewColumn('cofins_aliquota_porcentual_st', 'cofins_aliquota_porcentual_st', 'Cofins Aliquota Porcentual St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for cofins_quantidade_vendida_st field
            //
            $column = new TextViewColumn('cofins_quantidade_vendida_st', 'cofins_quantidade_vendida_st', 'Cofins Quantidade Vendida St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for cofins_aliquota_valor_st field
            //
            $column = new TextViewColumn('cofins_aliquota_valor_st', 'cofins_aliquota_valor_st', 'Cofins Aliquota Valor St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for cofins_valor_st field
            //
            $column = new TextViewColumn('cofins_valor_st', 'cofins_valor_st', 'Cofins Valor St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for percentual_devolvido field
            //
            $column = new TextViewColumn('percentual_devolvido', 'percentual_devolvido', 'Percentual Devolvido', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_ipi_devolvido field
            //
            $column = new TextViewColumn('valor_ipi_devolvido', 'valor_ipi_devolvido', 'Valor Ipi Devolvido', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_frete field
            //
            $column = new TextViewColumn('valor_frete', 'valor_frete', 'Valor Frete', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
        }
    
        protected function AddEditColumns(Grid $grid)
        {
            //
            // Edit column for numero_item field
            //
            $editor = new TextEdit('numero_item_edit');
            $editor->SetMaxLength(6);
            $editColumn = new CustomEditColumn('Numero Item', 'numero_item', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for codigo_produto field
            //
            $editor = new TextEdit('codigo_produto_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Codigo Produto', 'codigo_produto', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for codigo_barras_comercial field
            //
            $editor = new TextEdit('codigo_barras_comercial_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Codigo Barras Comercial', 'codigo_barras_comercial', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for descricao field
            //
            $editor = new TextAreaEdit('descricao_edit', 50, 8);
            $editColumn = new CustomEditColumn('Descricao', 'descricao', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for codigo_ncm field
            //
            $editor = new TextEdit('codigo_ncm_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Codigo Ncm', 'codigo_ncm', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for cest field
            //
            $editor = new TextEdit('cest_edit');
            $editor->SetMaxLength(7);
            $editColumn = new CustomEditColumn('Cest', 'cest', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for codigo_ex_tipi field
            //
            $editor = new TextEdit('codigo_ex_tipi_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Codigo Ex Tipi', 'codigo_ex_tipi', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for cfop field
            //
            $editor = new TextEdit('cfop_edit');
            $editor->SetMaxLength(6);
            $editColumn = new CustomEditColumn('CFOP', 'cfop', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for unidade_comercial field
            //
            $editor = new TextEdit('unidade_comercial_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Unidade Comercial', 'unidade_comercial', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for quantidade_comercial field
            //
            $editor = new TextEdit('quantidade_comercial_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Quantidade Comercial', 'quantidade_comercial', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_unitario_comercial field
            //
            $editor = new TextEdit('valor_unitario_comercial_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Unitario Comercial', 'valor_unitario_comercial', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_bruto field
            //
            $editor = new TextEdit('valor_bruto_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Bruto', 'valor_bruto', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for codigo_barras_tributavel field
            //
            $editor = new TextEdit('codigo_barras_tributavel_edit');
            $editor->SetMaxLength(30);
            $editColumn = new CustomEditColumn('Codigo Barras Tributavel', 'codigo_barras_tributavel', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for unidade_tributavel field
            //
            $editor = new TextEdit('unidade_tributavel_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Unidade Tributavel', 'unidade_tributavel', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for quantidade_tributavel field
            //
            $editor = new TextEdit('quantidade_tributavel_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Quantidade Tributavel', 'quantidade_tributavel', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_unitario_tributavel field
            //
            $editor = new TextEdit('valor_unitario_tributavel_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Unitario Tributavel', 'valor_unitario_tributavel', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_outras_despesas field
            //
            $editor = new TextEdit('valor_outras_despesas_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Outras Despesas', 'valor_outras_despesas', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for inclui_no_total field
            //
            $editor = new ComboBox('inclui_no_total_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`inclui_no_total`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Inclui No Total', 
                'inclui_no_total', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for pedido_compra field
            //
            $editor = new TextEdit('pedido_compra_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Pedido Compra', 'pedido_compra', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for numero_item_pedido_compra field
            //
            $editor = new TextEdit('numero_item_pedido_compra_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Numero Item Pedido Compra', 'numero_item_pedido_compra', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_origem field
            //
            $editor = new ComboBox('icms_origem_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`icms_origem`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Icms Origem', 
                'icms_origem', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_situacao_tributaria field
            //
            $editor = new ComboBox('icms_situacao_tributaria_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`icms_situacao_tributaria`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Icms Situacao Tributaria', 
                'icms_situacao_tributaria', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_modalidade_base_calculo field
            //
            $editor = new ComboBox('icms_modalidade_base_calculo_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`icms_modalidade_base_calculo`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Icms Modalidade Base Calculo', 
                'icms_modalidade_base_calculo', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_base_calculo field
            //
            $editor = new TextEdit('icms_base_calculo_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Base Calculo', 'icms_base_calculo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_base_calculo_retido_st field
            //
            $editor = new TextEdit('icms_base_calculo_retido_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Base Calculo Retido St', 'icms_base_calculo_retido_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_reducao_base_calculo field
            //
            $editor = new TextEdit('icms_reducao_base_calculo_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Reducao Base Calculo', 'icms_reducao_base_calculo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_aliquota field
            //
            $editor = new TextEdit('icms_aliquota_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Icms Aliquota', 'icms_aliquota', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_valor field
            //
            $editor = new TextEdit('icms_valor_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor', 'icms_valor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_valor_retido_st field
            //
            $editor = new TextEdit('icms_valor_retido_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor Retido St', 'icms_valor_retido_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_valor_desonerado field
            //
            $editor = new TextEdit('icms_valor_desonerado_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor Desonerado', 'icms_valor_desonerado', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_valor_operacao field
            //
            $editor = new TextEdit('icms_valor_operacao_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor Operacao', 'icms_valor_operacao', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_percentual_diferimento field
            //
            $editor = new TextEdit('icms_percentual_diferimento_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Icms Percentual Diferimento', 'icms_percentual_diferimento', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_valor_diferido field
            //
            $editor = new TextEdit('icms_valor_diferido_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor Diferido', 'icms_valor_diferido', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_motivo_desoneracao field
            //
            $editor = new TextEdit('icms_motivo_desoneracao_edit');
            $editor->SetMaxLength(1);
            $editColumn = new CustomEditColumn('Icms Motivo Desoneracao', 'icms_motivo_desoneracao', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_modalidade_base_calculo_st field
            //
            $editor = new ComboBox('icms_modalidade_base_calculo_st_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`icms_modalidade_base_calculo`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Icms Modalidade Base Calculo St', 
                'icms_modalidade_base_calculo_st', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_margem_valor_adicionado_st field
            //
            $editor = new TextEdit('icms_margem_valor_adicionado_st_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Icms Margem Valor Adicionado St', 'icms_margem_valor_adicionado_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_reducao_base_calculo_st field
            //
            $editor = new TextEdit('icms_reducao_base_calculo_st_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Icms Reducao Base Calculo St', 'icms_reducao_base_calculo_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_base_calculo_st field
            //
            $editor = new TextEdit('icms_base_calculo_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Base Calculo St', 'icms_base_calculo_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_aliquota_st field
            //
            $editor = new TextEdit('icms_aliquota_st_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Icms Aliquota St', 'icms_aliquota_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_valor_st field
            //
            $editor = new TextEdit('icms_valor_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor St', 'icms_valor_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for ipi_situacao_tributaria field
            //
            $editor = new ComboBox('ipi_situacao_tributaria_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`ipi_situacao_tributaria`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Ipi Situacao Tributaria', 
                'ipi_situacao_tributaria', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for ipi_base_calculo field
            //
            $editor = new TextEdit('ipi_base_calculo_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Ipi Base Calculo', 'ipi_base_calculo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for ipi_aliquota field
            //
            $editor = new TextEdit('ipi_aliquota_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Ipi Aliquota', 'ipi_aliquota', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for ipi_quantidade_total field
            //
            $editor = new TextEdit('ipi_quantidade_total_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Ipi Quantidade Total', 'ipi_quantidade_total', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for ipi_valor_por_unidade_tributavel field
            //
            $editor = new TextEdit('ipi_valor_por_unidade_tributavel_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Ipi Valor Por Unidade Tributavel', 'ipi_valor_por_unidade_tributavel', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for ipi_valor field
            //
            $editor = new TextEdit('ipi_valor_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Ipi Valor', 'ipi_valor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for ipi_classe_enquadramento field
            //
            $editor = new TextEdit('ipi_classe_enquadramento_edit');
            $editor->SetMaxLength(30);
            $editColumn = new CustomEditColumn('Ipi Classe Enquadramento', 'ipi_classe_enquadramento', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for ipi_cnpj_produtor field
            //
            $editor = new TextEdit('ipi_cnpj_produtor_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Ipi Cnpj Produtor', 'ipi_cnpj_produtor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for ipi_codigo_selo_controle field
            //
            $editor = new TextEdit('ipi_codigo_selo_controle_edit');
            $editor->SetMaxLength(30);
            $editColumn = new CustomEditColumn('Ipi Codigo Selo Controle', 'ipi_codigo_selo_controle', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for ipi_codigo_enquadramento_legal field
            //
            $editor = new ComboBox('ipi_codigo_enquadramento_legal_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`ipi_codigo_enquadramento_legal`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Ipi Codigo Enquadramento Legal', 
                'ipi_codigo_enquadramento_legal', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for pis_situacao_tributaria field
            //
            $editor = new ComboBox('pis_situacao_tributaria_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`pis_situacao_tributaria`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Pis Situacao Tributaria', 
                'pis_situacao_tributaria', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for pis_base_calculo field
            //
            $editor = new TextEdit('pis_base_calculo_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Pis Base Calculo', 'pis_base_calculo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for pis_aliquota_porcentual field
            //
            $editor = new TextEdit('pis_aliquota_porcentual_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Pis Aliquota Porcentual', 'pis_aliquota_porcentual', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for pis_quantidade_vendida field
            //
            $editor = new TextEdit('pis_quantidade_vendida_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Pis Quantidade Vendida', 'pis_quantidade_vendida', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for pis_aliquota_valor field
            //
            $editor = new TextEdit('pis_aliquota_valor_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Pis Aliquota Valor', 'pis_aliquota_valor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for pis_valor field
            //
            $editor = new TextEdit('pis_valor_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Pis Valor', 'pis_valor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for pis_base_calculo_st field
            //
            $editor = new TextEdit('pis_base_calculo_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Pis Base Calculo St', 'pis_base_calculo_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for pis_aliquota_porcentaul_st field
            //
            $editor = new TextEdit('pis_aliquota_porcentaul_st_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Pis Aliquota Porcentaul St', 'pis_aliquota_porcentaul_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for pis_quantidade_vendida_st field
            //
            $editor = new TextEdit('pis_quantidade_vendida_st_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Pis Quantidade Vendida St', 'pis_quantidade_vendida_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for pis_aliquota_valor_st field
            //
            $editor = new TextEdit('pis_aliquota_valor_st_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Pis Aliquota Valor St', 'pis_aliquota_valor_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for pis_valor_st field
            //
            $editor = new TextEdit('pis_valor_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Pis Valor St', 'pis_valor_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for cofins_situacao_tributaria field
            //
            $editor = new ComboBox('cofins_situacao_tributaria_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`cofins_situacao_tributaria`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Cofins Situacao Tributaria', 
                'cofins_situacao_tributaria', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for cofins_base_calculo field
            //
            $editor = new TextEdit('cofins_base_calculo_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cofins Base Calculo', 'cofins_base_calculo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for cofins_aliquota_porcentual field
            //
            $editor = new TextEdit('cofins_aliquota_porcentual_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Cofins Aliquota Porcentual', 'cofins_aliquota_porcentual', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for cofins_quantidade_vendida field
            //
            $editor = new TextEdit('cofins_quantidade_vendida_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Cofins Quantidade Vendida', 'cofins_quantidade_vendida', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for cofins_aliquota_valor field
            //
            $editor = new TextEdit('cofins_aliquota_valor_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Cofins Aliquota Valor', 'cofins_aliquota_valor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for cofins_valor field
            //
            $editor = new TextEdit('cofins_valor_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cofins Valor', 'cofins_valor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for cofins_base_calculo_st field
            //
            $editor = new TextEdit('cofins_base_calculo_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cofins Base Calculo St', 'cofins_base_calculo_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for cofins_aliquota_porcentual_st field
            //
            $editor = new TextEdit('cofins_aliquota_porcentual_st_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Cofins Aliquota Porcentual St', 'cofins_aliquota_porcentual_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for cofins_quantidade_vendida_st field
            //
            $editor = new TextEdit('cofins_quantidade_vendida_st_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Cofins Quantidade Vendida St', 'cofins_quantidade_vendida_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for cofins_aliquota_valor_st field
            //
            $editor = new TextEdit('cofins_aliquota_valor_st_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Cofins Aliquota Valor St', 'cofins_aliquota_valor_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for cofins_valor_st field
            //
            $editor = new TextEdit('cofins_valor_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cofins Valor St', 'cofins_valor_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for percentual_devolvido field
            //
            $editor = new TextEdit('percentual_devolvido_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Percentual Devolvido', 'percentual_devolvido', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_ipi_devolvido field
            //
            $editor = new TextEdit('valor_ipi_devolvido_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Ipi Devolvido', 'valor_ipi_devolvido', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_frete field
            //
            $editor = new TextEdit('valor_frete_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Frete', 'valor_frete', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
        }
    
        protected function AddMultiEditColumns(Grid $grid)
        {
            //
            // Edit column for chave field
            //
            $editor = new TextEdit('chave_edit');
            $editor->SetMaxLength(15);
            $editColumn = new CustomEditColumn('Chave', 'chave', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for numero_item field
            //
            $editor = new TextEdit('numero_item_edit');
            $editor->SetMaxLength(6);
            $editColumn = new CustomEditColumn('Numero Item', 'numero_item', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for codigo_produto field
            //
            $editor = new TextEdit('codigo_produto_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Codigo Produto', 'codigo_produto', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for codigo_barras_comercial field
            //
            $editor = new TextEdit('codigo_barras_comercial_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Codigo Barras Comercial', 'codigo_barras_comercial', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for descricao field
            //
            $editor = new TextAreaEdit('descricao_edit', 50, 8);
            $editColumn = new CustomEditColumn('Descricao', 'descricao', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for codigo_ncm field
            //
            $editor = new TextEdit('codigo_ncm_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Codigo Ncm', 'codigo_ncm', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for codigo_ex_tipi field
            //
            $editor = new TextEdit('codigo_ex_tipi_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Codigo Ex Tipi', 'codigo_ex_tipi', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cfop field
            //
            $editor = new TextEdit('cfop_edit');
            $editor->SetMaxLength(6);
            $editColumn = new CustomEditColumn('CFOP', 'cfop', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for unidade_comercial field
            //
            $editor = new TextEdit('unidade_comercial_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Unidade Comercial', 'unidade_comercial', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for quantidade_comercial field
            //
            $editor = new TextEdit('quantidade_comercial_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Quantidade Comercial', 'quantidade_comercial', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_unitario_comercial field
            //
            $editor = new TextEdit('valor_unitario_comercial_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Unitario Comercial', 'valor_unitario_comercial', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_bruto field
            //
            $editor = new TextEdit('valor_bruto_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Bruto', 'valor_bruto', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for codigo_barras_tributavel field
            //
            $editor = new TextEdit('codigo_barras_tributavel_edit');
            $editor->SetMaxLength(30);
            $editColumn = new CustomEditColumn('Codigo Barras Tributavel', 'codigo_barras_tributavel', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for unidade_tributavel field
            //
            $editor = new TextEdit('unidade_tributavel_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Unidade Tributavel', 'unidade_tributavel', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for quantidade_tributavel field
            //
            $editor = new TextEdit('quantidade_tributavel_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Quantidade Tributavel', 'quantidade_tributavel', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_unitario_tributavel field
            //
            $editor = new TextEdit('valor_unitario_tributavel_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Unitario Tributavel', 'valor_unitario_tributavel', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_outras_despesas field
            //
            $editor = new TextEdit('valor_outras_despesas_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Outras Despesas', 'valor_outras_despesas', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for inclui_no_total field
            //
            $editor = new ComboBox('inclui_no_total_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`inclui_no_total`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Inclui No Total', 
                'inclui_no_total', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for pedido_compra field
            //
            $editor = new TextEdit('pedido_compra_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Pedido Compra', 'pedido_compra', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for numero_item_pedido_compra field
            //
            $editor = new TextEdit('numero_item_pedido_compra_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Numero Item Pedido Compra', 'numero_item_pedido_compra', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_origem field
            //
            $editor = new ComboBox('icms_origem_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`icms_origem`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Icms Origem', 
                'icms_origem', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_situacao_tributaria field
            //
            $editor = new ComboBox('icms_situacao_tributaria_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`icms_situacao_tributaria`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Icms Situacao Tributaria', 
                'icms_situacao_tributaria', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_modalidade_base_calculo field
            //
            $editor = new ComboBox('icms_modalidade_base_calculo_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`icms_modalidade_base_calculo`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Icms Modalidade Base Calculo', 
                'icms_modalidade_base_calculo', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_base_calculo field
            //
            $editor = new TextEdit('icms_base_calculo_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Base Calculo', 'icms_base_calculo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_base_calculo_retido_st field
            //
            $editor = new TextEdit('icms_base_calculo_retido_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Base Calculo Retido St', 'icms_base_calculo_retido_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_reducao_base_calculo field
            //
            $editor = new TextEdit('icms_reducao_base_calculo_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Reducao Base Calculo', 'icms_reducao_base_calculo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_aliquota field
            //
            $editor = new TextEdit('icms_aliquota_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Icms Aliquota', 'icms_aliquota', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_valor field
            //
            $editor = new TextEdit('icms_valor_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor', 'icms_valor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_valor_retido_st field
            //
            $editor = new TextEdit('icms_valor_retido_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor Retido St', 'icms_valor_retido_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_valor_desonerado field
            //
            $editor = new TextEdit('icms_valor_desonerado_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor Desonerado', 'icms_valor_desonerado', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_valor_operacao field
            //
            $editor = new TextEdit('icms_valor_operacao_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor Operacao', 'icms_valor_operacao', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_percentual_diferimento field
            //
            $editor = new TextEdit('icms_percentual_diferimento_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Icms Percentual Diferimento', 'icms_percentual_diferimento', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_valor_diferido field
            //
            $editor = new TextEdit('icms_valor_diferido_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor Diferido', 'icms_valor_diferido', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_motivo_desoneracao field
            //
            $editor = new TextEdit('icms_motivo_desoneracao_edit');
            $editor->SetMaxLength(1);
            $editColumn = new CustomEditColumn('Icms Motivo Desoneracao', 'icms_motivo_desoneracao', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_modalidade_base_calculo_st field
            //
            $editor = new ComboBox('icms_modalidade_base_calculo_st_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`icms_modalidade_base_calculo`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Icms Modalidade Base Calculo St', 
                'icms_modalidade_base_calculo_st', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_margem_valor_adicionado_st field
            //
            $editor = new TextEdit('icms_margem_valor_adicionado_st_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Icms Margem Valor Adicionado St', 'icms_margem_valor_adicionado_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_reducao_base_calculo_st field
            //
            $editor = new TextEdit('icms_reducao_base_calculo_st_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Icms Reducao Base Calculo St', 'icms_reducao_base_calculo_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_base_calculo_st field
            //
            $editor = new TextEdit('icms_base_calculo_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Base Calculo St', 'icms_base_calculo_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_aliquota_st field
            //
            $editor = new TextEdit('icms_aliquota_st_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Icms Aliquota St', 'icms_aliquota_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_valor_st field
            //
            $editor = new TextEdit('icms_valor_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor St', 'icms_valor_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for ipi_situacao_tributaria field
            //
            $editor = new ComboBox('ipi_situacao_tributaria_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`ipi_situacao_tributaria`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Ipi Situacao Tributaria', 
                'ipi_situacao_tributaria', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for ipi_base_calculo field
            //
            $editor = new TextEdit('ipi_base_calculo_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Ipi Base Calculo', 'ipi_base_calculo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for ipi_aliquota field
            //
            $editor = new TextEdit('ipi_aliquota_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Ipi Aliquota', 'ipi_aliquota', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for ipi_quantidade_total field
            //
            $editor = new TextEdit('ipi_quantidade_total_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Ipi Quantidade Total', 'ipi_quantidade_total', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for ipi_valor_por_unidade_tributavel field
            //
            $editor = new TextEdit('ipi_valor_por_unidade_tributavel_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Ipi Valor Por Unidade Tributavel', 'ipi_valor_por_unidade_tributavel', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for ipi_valor field
            //
            $editor = new TextEdit('ipi_valor_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Ipi Valor', 'ipi_valor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for ipi_classe_enquadramento field
            //
            $editor = new TextEdit('ipi_classe_enquadramento_edit');
            $editor->SetMaxLength(30);
            $editColumn = new CustomEditColumn('Ipi Classe Enquadramento', 'ipi_classe_enquadramento', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for ipi_cnpj_produtor field
            //
            $editor = new TextEdit('ipi_cnpj_produtor_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Ipi Cnpj Produtor', 'ipi_cnpj_produtor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for ipi_codigo_selo_controle field
            //
            $editor = new TextEdit('ipi_codigo_selo_controle_edit');
            $editor->SetMaxLength(30);
            $editColumn = new CustomEditColumn('Ipi Codigo Selo Controle', 'ipi_codigo_selo_controle', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for ipi_codigo_enquadramento_legal field
            //
            $editor = new ComboBox('ipi_codigo_enquadramento_legal_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`ipi_codigo_enquadramento_legal`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Ipi Codigo Enquadramento Legal', 
                'ipi_codigo_enquadramento_legal', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for pis_situacao_tributaria field
            //
            $editor = new ComboBox('pis_situacao_tributaria_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`pis_situacao_tributaria`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Pis Situacao Tributaria', 
                'pis_situacao_tributaria', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for pis_base_calculo field
            //
            $editor = new TextEdit('pis_base_calculo_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Pis Base Calculo', 'pis_base_calculo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for pis_aliquota_porcentual field
            //
            $editor = new TextEdit('pis_aliquota_porcentual_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Pis Aliquota Porcentual', 'pis_aliquota_porcentual', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for pis_quantidade_vendida field
            //
            $editor = new TextEdit('pis_quantidade_vendida_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Pis Quantidade Vendida', 'pis_quantidade_vendida', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for pis_aliquota_valor field
            //
            $editor = new TextEdit('pis_aliquota_valor_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Pis Aliquota Valor', 'pis_aliquota_valor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for pis_valor field
            //
            $editor = new TextEdit('pis_valor_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Pis Valor', 'pis_valor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for pis_base_calculo_st field
            //
            $editor = new TextEdit('pis_base_calculo_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Pis Base Calculo St', 'pis_base_calculo_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for pis_aliquota_porcentaul_st field
            //
            $editor = new TextEdit('pis_aliquota_porcentaul_st_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Pis Aliquota Porcentaul St', 'pis_aliquota_porcentaul_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for pis_quantidade_vendida_st field
            //
            $editor = new TextEdit('pis_quantidade_vendida_st_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Pis Quantidade Vendida St', 'pis_quantidade_vendida_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for pis_aliquota_valor_st field
            //
            $editor = new TextEdit('pis_aliquota_valor_st_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Pis Aliquota Valor St', 'pis_aliquota_valor_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for pis_valor_st field
            //
            $editor = new TextEdit('pis_valor_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Pis Valor St', 'pis_valor_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cofins_situacao_tributaria field
            //
            $editor = new ComboBox('cofins_situacao_tributaria_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`cofins_situacao_tributaria`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Cofins Situacao Tributaria', 
                'cofins_situacao_tributaria', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cofins_base_calculo field
            //
            $editor = new TextEdit('cofins_base_calculo_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cofins Base Calculo', 'cofins_base_calculo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cofins_aliquota_porcentual field
            //
            $editor = new TextEdit('cofins_aliquota_porcentual_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Cofins Aliquota Porcentual', 'cofins_aliquota_porcentual', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cofins_quantidade_vendida field
            //
            $editor = new TextEdit('cofins_quantidade_vendida_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Cofins Quantidade Vendida', 'cofins_quantidade_vendida', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cofins_aliquota_valor field
            //
            $editor = new TextEdit('cofins_aliquota_valor_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Cofins Aliquota Valor', 'cofins_aliquota_valor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cofins_valor field
            //
            $editor = new TextEdit('cofins_valor_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cofins Valor', 'cofins_valor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cofins_base_calculo_st field
            //
            $editor = new TextEdit('cofins_base_calculo_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cofins Base Calculo St', 'cofins_base_calculo_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cofins_aliquota_porcentual_st field
            //
            $editor = new TextEdit('cofins_aliquota_porcentual_st_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Cofins Aliquota Porcentual St', 'cofins_aliquota_porcentual_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cofins_quantidade_vendida_st field
            //
            $editor = new TextEdit('cofins_quantidade_vendida_st_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Cofins Quantidade Vendida St', 'cofins_quantidade_vendida_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cofins_aliquota_valor_st field
            //
            $editor = new TextEdit('cofins_aliquota_valor_st_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Cofins Aliquota Valor St', 'cofins_aliquota_valor_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cofins_valor_st field
            //
            $editor = new TextEdit('cofins_valor_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cofins Valor St', 'cofins_valor_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for percentual_devolvido field
            //
            $editor = new TextEdit('percentual_devolvido_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Percentual Devolvido', 'percentual_devolvido', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_ipi_devolvido field
            //
            $editor = new TextEdit('valor_ipi_devolvido_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Ipi Devolvido', 'valor_ipi_devolvido', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cest field
            //
            $editor = new TextEdit('cest_edit');
            $editor->SetMaxLength(7);
            $editColumn = new CustomEditColumn('Cest', 'cest', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_frete field
            //
            $editor = new TextEdit('valor_frete_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Frete', 'valor_frete', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
        }
    
        protected function AddInsertColumns(Grid $grid)
        {
            //
            // Edit column for numero_item field
            //
            $editor = new TextEdit('numero_item_edit');
            $editor->SetMaxLength(6);
            $editColumn = new CustomEditColumn('Numero Item', 'numero_item', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for codigo_produto field
            //
            $editor = new TextEdit('codigo_produto_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Codigo Produto', 'codigo_produto', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for codigo_barras_comercial field
            //
            $editor = new TextEdit('codigo_barras_comercial_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Codigo Barras Comercial', 'codigo_barras_comercial', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for descricao field
            //
            $editor = new TextAreaEdit('descricao_edit', 50, 8);
            $editColumn = new CustomEditColumn('Descricao', 'descricao', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for codigo_ncm field
            //
            $editor = new TextEdit('codigo_ncm_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Codigo Ncm', 'codigo_ncm', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for cest field
            //
            $editor = new TextEdit('cest_edit');
            $editor->SetMaxLength(7);
            $editColumn = new CustomEditColumn('Cest', 'cest', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for codigo_ex_tipi field
            //
            $editor = new TextEdit('codigo_ex_tipi_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Codigo Ex Tipi', 'codigo_ex_tipi', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for cfop field
            //
            $editor = new TextEdit('cfop_edit');
            $editor->SetMaxLength(6);
            $editColumn = new CustomEditColumn('CFOP', 'cfop', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for unidade_comercial field
            //
            $editor = new TextEdit('unidade_comercial_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Unidade Comercial', 'unidade_comercial', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for quantidade_comercial field
            //
            $editor = new TextEdit('quantidade_comercial_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Quantidade Comercial', 'quantidade_comercial', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_unitario_comercial field
            //
            $editor = new TextEdit('valor_unitario_comercial_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Unitario Comercial', 'valor_unitario_comercial', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_bruto field
            //
            $editor = new TextEdit('valor_bruto_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Bruto', 'valor_bruto', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for codigo_barras_tributavel field
            //
            $editor = new TextEdit('codigo_barras_tributavel_edit');
            $editor->SetMaxLength(30);
            $editColumn = new CustomEditColumn('Codigo Barras Tributavel', 'codigo_barras_tributavel', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for unidade_tributavel field
            //
            $editor = new TextEdit('unidade_tributavel_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Unidade Tributavel', 'unidade_tributavel', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for quantidade_tributavel field
            //
            $editor = new TextEdit('quantidade_tributavel_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Quantidade Tributavel', 'quantidade_tributavel', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_unitario_tributavel field
            //
            $editor = new TextEdit('valor_unitario_tributavel_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Unitario Tributavel', 'valor_unitario_tributavel', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_outras_despesas field
            //
            $editor = new TextEdit('valor_outras_despesas_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Outras Despesas', 'valor_outras_despesas', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for inclui_no_total field
            //
            $editor = new ComboBox('inclui_no_total_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`inclui_no_total`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Inclui No Total', 
                'inclui_no_total', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for pedido_compra field
            //
            $editor = new TextEdit('pedido_compra_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Pedido Compra', 'pedido_compra', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for numero_item_pedido_compra field
            //
            $editor = new TextEdit('numero_item_pedido_compra_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Numero Item Pedido Compra', 'numero_item_pedido_compra', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_origem field
            //
            $editor = new ComboBox('icms_origem_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`icms_origem`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Icms Origem', 
                'icms_origem', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_situacao_tributaria field
            //
            $editor = new ComboBox('icms_situacao_tributaria_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`icms_situacao_tributaria`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Icms Situacao Tributaria', 
                'icms_situacao_tributaria', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_modalidade_base_calculo field
            //
            $editor = new ComboBox('icms_modalidade_base_calculo_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`icms_modalidade_base_calculo`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Icms Modalidade Base Calculo', 
                'icms_modalidade_base_calculo', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_base_calculo field
            //
            $editor = new TextEdit('icms_base_calculo_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Base Calculo', 'icms_base_calculo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_base_calculo_retido_st field
            //
            $editor = new TextEdit('icms_base_calculo_retido_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Base Calculo Retido St', 'icms_base_calculo_retido_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_reducao_base_calculo field
            //
            $editor = new TextEdit('icms_reducao_base_calculo_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Reducao Base Calculo', 'icms_reducao_base_calculo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_aliquota field
            //
            $editor = new TextEdit('icms_aliquota_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Icms Aliquota', 'icms_aliquota', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_valor field
            //
            $editor = new TextEdit('icms_valor_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor', 'icms_valor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_valor_retido_st field
            //
            $editor = new TextEdit('icms_valor_retido_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor Retido St', 'icms_valor_retido_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_valor_desonerado field
            //
            $editor = new TextEdit('icms_valor_desonerado_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor Desonerado', 'icms_valor_desonerado', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_valor_operacao field
            //
            $editor = new TextEdit('icms_valor_operacao_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor Operacao', 'icms_valor_operacao', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_percentual_diferimento field
            //
            $editor = new TextEdit('icms_percentual_diferimento_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Icms Percentual Diferimento', 'icms_percentual_diferimento', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_valor_diferido field
            //
            $editor = new TextEdit('icms_valor_diferido_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor Diferido', 'icms_valor_diferido', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_motivo_desoneracao field
            //
            $editor = new TextEdit('icms_motivo_desoneracao_edit');
            $editor->SetMaxLength(1);
            $editColumn = new CustomEditColumn('Icms Motivo Desoneracao', 'icms_motivo_desoneracao', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_modalidade_base_calculo_st field
            //
            $editor = new ComboBox('icms_modalidade_base_calculo_st_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`icms_modalidade_base_calculo`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Icms Modalidade Base Calculo St', 
                'icms_modalidade_base_calculo_st', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_margem_valor_adicionado_st field
            //
            $editor = new TextEdit('icms_margem_valor_adicionado_st_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Icms Margem Valor Adicionado St', 'icms_margem_valor_adicionado_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_reducao_base_calculo_st field
            //
            $editor = new TextEdit('icms_reducao_base_calculo_st_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Icms Reducao Base Calculo St', 'icms_reducao_base_calculo_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_base_calculo_st field
            //
            $editor = new TextEdit('icms_base_calculo_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Base Calculo St', 'icms_base_calculo_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_aliquota_st field
            //
            $editor = new TextEdit('icms_aliquota_st_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Icms Aliquota St', 'icms_aliquota_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_valor_st field
            //
            $editor = new TextEdit('icms_valor_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor St', 'icms_valor_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for ipi_situacao_tributaria field
            //
            $editor = new ComboBox('ipi_situacao_tributaria_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`ipi_situacao_tributaria`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Ipi Situacao Tributaria', 
                'ipi_situacao_tributaria', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for ipi_base_calculo field
            //
            $editor = new TextEdit('ipi_base_calculo_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Ipi Base Calculo', 'ipi_base_calculo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for ipi_aliquota field
            //
            $editor = new TextEdit('ipi_aliquota_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Ipi Aliquota', 'ipi_aliquota', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for ipi_quantidade_total field
            //
            $editor = new TextEdit('ipi_quantidade_total_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Ipi Quantidade Total', 'ipi_quantidade_total', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for ipi_valor_por_unidade_tributavel field
            //
            $editor = new TextEdit('ipi_valor_por_unidade_tributavel_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Ipi Valor Por Unidade Tributavel', 'ipi_valor_por_unidade_tributavel', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for ipi_valor field
            //
            $editor = new TextEdit('ipi_valor_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Ipi Valor', 'ipi_valor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for ipi_classe_enquadramento field
            //
            $editor = new TextEdit('ipi_classe_enquadramento_edit');
            $editor->SetMaxLength(30);
            $editColumn = new CustomEditColumn('Ipi Classe Enquadramento', 'ipi_classe_enquadramento', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for ipi_cnpj_produtor field
            //
            $editor = new TextEdit('ipi_cnpj_produtor_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Ipi Cnpj Produtor', 'ipi_cnpj_produtor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for ipi_codigo_selo_controle field
            //
            $editor = new TextEdit('ipi_codigo_selo_controle_edit');
            $editor->SetMaxLength(30);
            $editColumn = new CustomEditColumn('Ipi Codigo Selo Controle', 'ipi_codigo_selo_controle', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for ipi_codigo_enquadramento_legal field
            //
            $editor = new ComboBox('ipi_codigo_enquadramento_legal_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`ipi_codigo_enquadramento_legal`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Ipi Codigo Enquadramento Legal', 
                'ipi_codigo_enquadramento_legal', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for pis_situacao_tributaria field
            //
            $editor = new ComboBox('pis_situacao_tributaria_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`pis_situacao_tributaria`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Pis Situacao Tributaria', 
                'pis_situacao_tributaria', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for pis_base_calculo field
            //
            $editor = new TextEdit('pis_base_calculo_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Pis Base Calculo', 'pis_base_calculo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for pis_aliquota_porcentual field
            //
            $editor = new TextEdit('pis_aliquota_porcentual_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Pis Aliquota Porcentual', 'pis_aliquota_porcentual', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for pis_quantidade_vendida field
            //
            $editor = new TextEdit('pis_quantidade_vendida_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Pis Quantidade Vendida', 'pis_quantidade_vendida', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for pis_aliquota_valor field
            //
            $editor = new TextEdit('pis_aliquota_valor_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Pis Aliquota Valor', 'pis_aliquota_valor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for pis_valor field
            //
            $editor = new TextEdit('pis_valor_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Pis Valor', 'pis_valor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for pis_base_calculo_st field
            //
            $editor = new TextEdit('pis_base_calculo_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Pis Base Calculo St', 'pis_base_calculo_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for pis_aliquota_porcentaul_st field
            //
            $editor = new TextEdit('pis_aliquota_porcentaul_st_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Pis Aliquota Porcentaul St', 'pis_aliquota_porcentaul_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for pis_quantidade_vendida_st field
            //
            $editor = new TextEdit('pis_quantidade_vendida_st_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Pis Quantidade Vendida St', 'pis_quantidade_vendida_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for pis_aliquota_valor_st field
            //
            $editor = new TextEdit('pis_aliquota_valor_st_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Pis Aliquota Valor St', 'pis_aliquota_valor_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for pis_valor_st field
            //
            $editor = new TextEdit('pis_valor_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Pis Valor St', 'pis_valor_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for cofins_situacao_tributaria field
            //
            $editor = new ComboBox('cofins_situacao_tributaria_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`cofins_situacao_tributaria`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Cofins Situacao Tributaria', 
                'cofins_situacao_tributaria', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for cofins_base_calculo field
            //
            $editor = new TextEdit('cofins_base_calculo_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cofins Base Calculo', 'cofins_base_calculo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for cofins_aliquota_porcentual field
            //
            $editor = new TextEdit('cofins_aliquota_porcentual_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Cofins Aliquota Porcentual', 'cofins_aliquota_porcentual', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for cofins_quantidade_vendida field
            //
            $editor = new TextEdit('cofins_quantidade_vendida_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Cofins Quantidade Vendida', 'cofins_quantidade_vendida', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for cofins_aliquota_valor field
            //
            $editor = new TextEdit('cofins_aliquota_valor_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Cofins Aliquota Valor', 'cofins_aliquota_valor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for cofins_valor field
            //
            $editor = new TextEdit('cofins_valor_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cofins Valor', 'cofins_valor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for cofins_base_calculo_st field
            //
            $editor = new TextEdit('cofins_base_calculo_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cofins Base Calculo St', 'cofins_base_calculo_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for cofins_aliquota_porcentual_st field
            //
            $editor = new TextEdit('cofins_aliquota_porcentual_st_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Cofins Aliquota Porcentual St', 'cofins_aliquota_porcentual_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for cofins_quantidade_vendida_st field
            //
            $editor = new TextEdit('cofins_quantidade_vendida_st_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Cofins Quantidade Vendida St', 'cofins_quantidade_vendida_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for cofins_aliquota_valor_st field
            //
            $editor = new TextEdit('cofins_aliquota_valor_st_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Cofins Aliquota Valor St', 'cofins_aliquota_valor_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for cofins_valor_st field
            //
            $editor = new TextEdit('cofins_valor_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cofins Valor St', 'cofins_valor_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for percentual_devolvido field
            //
            $editor = new TextEdit('percentual_devolvido_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Percentual Devolvido', 'percentual_devolvido', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_ipi_devolvido field
            //
            $editor = new TextEdit('valor_ipi_devolvido_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Ipi Devolvido', 'valor_ipi_devolvido', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_frete field
            //
            $editor = new TextEdit('valor_frete_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Frete', 'valor_frete', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            $grid->SetShowAddButton(true && $this->GetSecurityInfo()->HasAddGrant());
        }
    
        private function AddMultiUploadColumn(Grid $grid)
        {
    
        }
    
        protected function AddPrintColumns(Grid $grid)
        {
            //
            // View column for chave field
            //
            $column = new TextViewColumn('chave', 'chave', 'Chave', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for numero_item field
            //
            $column = new TextViewColumn('numero_item', 'numero_item', 'Numero Item', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for codigo_produto field
            //
            $column = new TextViewColumn('codigo_produto', 'codigo_produto', 'Codigo Produto', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for codigo_barras_comercial field
            //
            $column = new TextViewColumn('codigo_barras_comercial', 'codigo_barras_comercial', 'Codigo Barras Comercial', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for descricao field
            //
            $column = new TextViewColumn('descricao', 'descricao', 'Descricao', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('DetailGridnotas.itens_descricao_handler_print');
            $grid->AddPrintColumn($column);
            
            //
            // View column for codigo_ncm field
            //
            $column = new TextViewColumn('codigo_ncm', 'codigo_ncm', 'Codigo Ncm', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for cest field
            //
            $column = new TextViewColumn('cest', 'cest', 'Cest', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for codigo_ex_tipi field
            //
            $column = new TextViewColumn('codigo_ex_tipi', 'codigo_ex_tipi', 'Codigo Ex Tipi', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for cfop field
            //
            $column = new TextViewColumn('cfop', 'cfop', 'CFOP', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for unidade_comercial field
            //
            $column = new TextViewColumn('unidade_comercial', 'unidade_comercial', 'Unidade Comercial', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for quantidade_comercial field
            //
            $column = new TextViewColumn('quantidade_comercial', 'quantidade_comercial', 'Quantidade Comercial', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_unitario_comercial field
            //
            $column = new TextViewColumn('valor_unitario_comercial', 'valor_unitario_comercial', 'Valor Unitario Comercial', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_bruto field
            //
            $column = new TextViewColumn('valor_bruto', 'valor_bruto', 'Valor Bruto', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for codigo_barras_tributavel field
            //
            $column = new TextViewColumn('codigo_barras_tributavel', 'codigo_barras_tributavel', 'Codigo Barras Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for unidade_tributavel field
            //
            $column = new TextViewColumn('unidade_tributavel', 'unidade_tributavel', 'Unidade Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for quantidade_tributavel field
            //
            $column = new TextViewColumn('quantidade_tributavel', 'quantidade_tributavel', 'Quantidade Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_unitario_tributavel field
            //
            $column = new TextViewColumn('valor_unitario_tributavel', 'valor_unitario_tributavel', 'Valor Unitario Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_outras_despesas field
            //
            $column = new TextViewColumn('valor_outras_despesas', 'valor_outras_despesas', 'Valor Outras Despesas', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('inclui_no_total', 'inclui_no_total_ds_tabela', 'Inclui No Total', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for pedido_compra field
            //
            $column = new TextViewColumn('pedido_compra', 'pedido_compra', 'Pedido Compra', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for numero_item_pedido_compra field
            //
            $column = new TextViewColumn('numero_item_pedido_compra', 'numero_item_pedido_compra', 'Numero Item Pedido Compra', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('icms_origem', 'icms_origem_ds_tabela', 'Icms Origem', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('icms_situacao_tributaria', 'icms_situacao_tributaria_ds_tabela', 'Icms Situacao Tributaria', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('icms_modalidade_base_calculo', 'icms_modalidade_base_calculo_ds_tabela', 'Icms Modalidade Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for icms_base_calculo field
            //
            $column = new TextViewColumn('icms_base_calculo', 'icms_base_calculo', 'Icms Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for icms_base_calculo_retido_st field
            //
            $column = new TextViewColumn('icms_base_calculo_retido_st', 'icms_base_calculo_retido_st', 'Icms Base Calculo Retido St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for icms_reducao_base_calculo field
            //
            $column = new TextViewColumn('icms_reducao_base_calculo', 'icms_reducao_base_calculo', 'Icms Reducao Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for icms_aliquota field
            //
            $column = new TextViewColumn('icms_aliquota', 'icms_aliquota', 'Icms Aliquota', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for icms_valor field
            //
            $column = new TextViewColumn('icms_valor', 'icms_valor', 'Icms Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for icms_valor_retido_st field
            //
            $column = new TextViewColumn('icms_valor_retido_st', 'icms_valor_retido_st', 'Icms Valor Retido St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for icms_valor_desonerado field
            //
            $column = new TextViewColumn('icms_valor_desonerado', 'icms_valor_desonerado', 'Icms Valor Desonerado', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for icms_valor_operacao field
            //
            $column = new TextViewColumn('icms_valor_operacao', 'icms_valor_operacao', 'Icms Valor Operacao', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for icms_percentual_diferimento field
            //
            $column = new TextViewColumn('icms_percentual_diferimento', 'icms_percentual_diferimento', 'Icms Percentual Diferimento', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for icms_valor_diferido field
            //
            $column = new TextViewColumn('icms_valor_diferido', 'icms_valor_diferido', 'Icms Valor Diferido', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for icms_motivo_desoneracao field
            //
            $column = new TextViewColumn('icms_motivo_desoneracao', 'icms_motivo_desoneracao', 'Icms Motivo Desoneracao', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('icms_modalidade_base_calculo_st', 'icms_modalidade_base_calculo_st_ds_tabela', 'Icms Modalidade Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for icms_margem_valor_adicionado_st field
            //
            $column = new TextViewColumn('icms_margem_valor_adicionado_st', 'icms_margem_valor_adicionado_st', 'Icms Margem Valor Adicionado St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for icms_reducao_base_calculo_st field
            //
            $column = new TextViewColumn('icms_reducao_base_calculo_st', 'icms_reducao_base_calculo_st', 'Icms Reducao Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for icms_base_calculo_st field
            //
            $column = new TextViewColumn('icms_base_calculo_st', 'icms_base_calculo_st', 'Icms Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for icms_aliquota_st field
            //
            $column = new TextViewColumn('icms_aliquota_st', 'icms_aliquota_st', 'Icms Aliquota St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for icms_valor_st field
            //
            $column = new TextViewColumn('icms_valor_st', 'icms_valor_st', 'Icms Valor St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('ipi_situacao_tributaria', 'ipi_situacao_tributaria_ds_tabela', 'Ipi Situacao Tributaria', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ipi_base_calculo field
            //
            $column = new TextViewColumn('ipi_base_calculo', 'ipi_base_calculo', 'Ipi Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ipi_aliquota field
            //
            $column = new TextViewColumn('ipi_aliquota', 'ipi_aliquota', 'Ipi Aliquota', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ipi_quantidade_total field
            //
            $column = new TextViewColumn('ipi_quantidade_total', 'ipi_quantidade_total', 'Ipi Quantidade Total', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ipi_valor_por_unidade_tributavel field
            //
            $column = new TextViewColumn('ipi_valor_por_unidade_tributavel', 'ipi_valor_por_unidade_tributavel', 'Ipi Valor Por Unidade Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ipi_valor field
            //
            $column = new TextViewColumn('ipi_valor', 'ipi_valor', 'Ipi Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ipi_classe_enquadramento field
            //
            $column = new TextViewColumn('ipi_classe_enquadramento', 'ipi_classe_enquadramento', 'Ipi Classe Enquadramento', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ipi_cnpj_produtor field
            //
            $column = new TextViewColumn('ipi_cnpj_produtor', 'ipi_cnpj_produtor', 'Ipi Cnpj Produtor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ipi_codigo_selo_controle field
            //
            $column = new TextViewColumn('ipi_codigo_selo_controle', 'ipi_codigo_selo_controle', 'Ipi Codigo Selo Controle', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('ipi_codigo_enquadramento_legal', 'ipi_codigo_enquadramento_legal_ds_tabela', 'Ipi Codigo Enquadramento Legal', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('pis_situacao_tributaria', 'pis_situacao_tributaria_ds_tabela', 'Pis Situacao Tributaria', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for pis_base_calculo field
            //
            $column = new TextViewColumn('pis_base_calculo', 'pis_base_calculo', 'Pis Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for pis_aliquota_porcentual field
            //
            $column = new TextViewColumn('pis_aliquota_porcentual', 'pis_aliquota_porcentual', 'Pis Aliquota Porcentual', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for pis_quantidade_vendida field
            //
            $column = new TextViewColumn('pis_quantidade_vendida', 'pis_quantidade_vendida', 'Pis Quantidade Vendida', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for pis_aliquota_valor field
            //
            $column = new TextViewColumn('pis_aliquota_valor', 'pis_aliquota_valor', 'Pis Aliquota Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for pis_valor field
            //
            $column = new TextViewColumn('pis_valor', 'pis_valor', 'Pis Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for pis_base_calculo_st field
            //
            $column = new TextViewColumn('pis_base_calculo_st', 'pis_base_calculo_st', 'Pis Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for pis_aliquota_porcentaul_st field
            //
            $column = new TextViewColumn('pis_aliquota_porcentaul_st', 'pis_aliquota_porcentaul_st', 'Pis Aliquota Porcentaul St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for pis_quantidade_vendida_st field
            //
            $column = new TextViewColumn('pis_quantidade_vendida_st', 'pis_quantidade_vendida_st', 'Pis Quantidade Vendida St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for pis_aliquota_valor_st field
            //
            $column = new TextViewColumn('pis_aliquota_valor_st', 'pis_aliquota_valor_st', 'Pis Aliquota Valor St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for pis_valor_st field
            //
            $column = new TextViewColumn('pis_valor_st', 'pis_valor_st', 'Pis Valor St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('cofins_situacao_tributaria', 'cofins_situacao_tributaria_ds_tabela', 'Cofins Situacao Tributaria', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for cofins_base_calculo field
            //
            $column = new TextViewColumn('cofins_base_calculo', 'cofins_base_calculo', 'Cofins Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for cofins_aliquota_porcentual field
            //
            $column = new TextViewColumn('cofins_aliquota_porcentual', 'cofins_aliquota_porcentual', 'Cofins Aliquota Porcentual', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for cofins_quantidade_vendida field
            //
            $column = new TextViewColumn('cofins_quantidade_vendida', 'cofins_quantidade_vendida', 'Cofins Quantidade Vendida', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for cofins_aliquota_valor field
            //
            $column = new TextViewColumn('cofins_aliquota_valor', 'cofins_aliquota_valor', 'Cofins Aliquota Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for cofins_valor field
            //
            $column = new TextViewColumn('cofins_valor', 'cofins_valor', 'Cofins Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for cofins_base_calculo_st field
            //
            $column = new TextViewColumn('cofins_base_calculo_st', 'cofins_base_calculo_st', 'Cofins Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for cofins_aliquota_porcentual_st field
            //
            $column = new TextViewColumn('cofins_aliquota_porcentual_st', 'cofins_aliquota_porcentual_st', 'Cofins Aliquota Porcentual St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for cofins_quantidade_vendida_st field
            //
            $column = new TextViewColumn('cofins_quantidade_vendida_st', 'cofins_quantidade_vendida_st', 'Cofins Quantidade Vendida St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for cofins_aliquota_valor_st field
            //
            $column = new TextViewColumn('cofins_aliquota_valor_st', 'cofins_aliquota_valor_st', 'Cofins Aliquota Valor St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for cofins_valor_st field
            //
            $column = new TextViewColumn('cofins_valor_st', 'cofins_valor_st', 'Cofins Valor St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for percentual_devolvido field
            //
            $column = new TextViewColumn('percentual_devolvido', 'percentual_devolvido', 'Percentual Devolvido', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_ipi_devolvido field
            //
            $column = new TextViewColumn('valor_ipi_devolvido', 'valor_ipi_devolvido', 'Valor Ipi Devolvido', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_frete field
            //
            $column = new TextViewColumn('valor_frete', 'valor_frete', 'Valor Frete', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
        }
    
        protected function AddExportColumns(Grid $grid)
        {
            //
            // View column for chave field
            //
            $column = new TextViewColumn('chave', 'chave', 'Chave', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for numero_item field
            //
            $column = new TextViewColumn('numero_item', 'numero_item', 'Numero Item', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for codigo_produto field
            //
            $column = new TextViewColumn('codigo_produto', 'codigo_produto', 'Codigo Produto', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for codigo_barras_comercial field
            //
            $column = new TextViewColumn('codigo_barras_comercial', 'codigo_barras_comercial', 'Codigo Barras Comercial', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for descricao field
            //
            $column = new TextViewColumn('descricao', 'descricao', 'Descricao', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('DetailGridnotas.itens_descricao_handler_export');
            $grid->AddExportColumn($column);
            
            //
            // View column for codigo_ncm field
            //
            $column = new TextViewColumn('codigo_ncm', 'codigo_ncm', 'Codigo Ncm', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for cest field
            //
            $column = new TextViewColumn('cest', 'cest', 'Cest', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for codigo_ex_tipi field
            //
            $column = new TextViewColumn('codigo_ex_tipi', 'codigo_ex_tipi', 'Codigo Ex Tipi', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for cfop field
            //
            $column = new TextViewColumn('cfop', 'cfop', 'CFOP', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for unidade_comercial field
            //
            $column = new TextViewColumn('unidade_comercial', 'unidade_comercial', 'Unidade Comercial', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for quantidade_comercial field
            //
            $column = new TextViewColumn('quantidade_comercial', 'quantidade_comercial', 'Quantidade Comercial', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_unitario_comercial field
            //
            $column = new TextViewColumn('valor_unitario_comercial', 'valor_unitario_comercial', 'Valor Unitario Comercial', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_bruto field
            //
            $column = new TextViewColumn('valor_bruto', 'valor_bruto', 'Valor Bruto', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for codigo_barras_tributavel field
            //
            $column = new TextViewColumn('codigo_barras_tributavel', 'codigo_barras_tributavel', 'Codigo Barras Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for unidade_tributavel field
            //
            $column = new TextViewColumn('unidade_tributavel', 'unidade_tributavel', 'Unidade Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for quantidade_tributavel field
            //
            $column = new TextViewColumn('quantidade_tributavel', 'quantidade_tributavel', 'Quantidade Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_unitario_tributavel field
            //
            $column = new TextViewColumn('valor_unitario_tributavel', 'valor_unitario_tributavel', 'Valor Unitario Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_outras_despesas field
            //
            $column = new TextViewColumn('valor_outras_despesas', 'valor_outras_despesas', 'Valor Outras Despesas', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('inclui_no_total', 'inclui_no_total_ds_tabela', 'Inclui No Total', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for pedido_compra field
            //
            $column = new TextViewColumn('pedido_compra', 'pedido_compra', 'Pedido Compra', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for numero_item_pedido_compra field
            //
            $column = new TextViewColumn('numero_item_pedido_compra', 'numero_item_pedido_compra', 'Numero Item Pedido Compra', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('icms_origem', 'icms_origem_ds_tabela', 'Icms Origem', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('icms_situacao_tributaria', 'icms_situacao_tributaria_ds_tabela', 'Icms Situacao Tributaria', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('icms_modalidade_base_calculo', 'icms_modalidade_base_calculo_ds_tabela', 'Icms Modalidade Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for icms_base_calculo field
            //
            $column = new TextViewColumn('icms_base_calculo', 'icms_base_calculo', 'Icms Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for icms_base_calculo_retido_st field
            //
            $column = new TextViewColumn('icms_base_calculo_retido_st', 'icms_base_calculo_retido_st', 'Icms Base Calculo Retido St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for icms_reducao_base_calculo field
            //
            $column = new TextViewColumn('icms_reducao_base_calculo', 'icms_reducao_base_calculo', 'Icms Reducao Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for icms_aliquota field
            //
            $column = new TextViewColumn('icms_aliquota', 'icms_aliquota', 'Icms Aliquota', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for icms_valor field
            //
            $column = new TextViewColumn('icms_valor', 'icms_valor', 'Icms Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for icms_valor_retido_st field
            //
            $column = new TextViewColumn('icms_valor_retido_st', 'icms_valor_retido_st', 'Icms Valor Retido St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for icms_valor_desonerado field
            //
            $column = new TextViewColumn('icms_valor_desonerado', 'icms_valor_desonerado', 'Icms Valor Desonerado', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for icms_valor_operacao field
            //
            $column = new TextViewColumn('icms_valor_operacao', 'icms_valor_operacao', 'Icms Valor Operacao', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for icms_percentual_diferimento field
            //
            $column = new TextViewColumn('icms_percentual_diferimento', 'icms_percentual_diferimento', 'Icms Percentual Diferimento', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for icms_valor_diferido field
            //
            $column = new TextViewColumn('icms_valor_diferido', 'icms_valor_diferido', 'Icms Valor Diferido', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for icms_motivo_desoneracao field
            //
            $column = new TextViewColumn('icms_motivo_desoneracao', 'icms_motivo_desoneracao', 'Icms Motivo Desoneracao', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('icms_modalidade_base_calculo_st', 'icms_modalidade_base_calculo_st_ds_tabela', 'Icms Modalidade Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for icms_margem_valor_adicionado_st field
            //
            $column = new TextViewColumn('icms_margem_valor_adicionado_st', 'icms_margem_valor_adicionado_st', 'Icms Margem Valor Adicionado St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for icms_reducao_base_calculo_st field
            //
            $column = new TextViewColumn('icms_reducao_base_calculo_st', 'icms_reducao_base_calculo_st', 'Icms Reducao Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for icms_base_calculo_st field
            //
            $column = new TextViewColumn('icms_base_calculo_st', 'icms_base_calculo_st', 'Icms Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for icms_aliquota_st field
            //
            $column = new TextViewColumn('icms_aliquota_st', 'icms_aliquota_st', 'Icms Aliquota St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for icms_valor_st field
            //
            $column = new TextViewColumn('icms_valor_st', 'icms_valor_st', 'Icms Valor St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('ipi_situacao_tributaria', 'ipi_situacao_tributaria_ds_tabela', 'Ipi Situacao Tributaria', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ipi_base_calculo field
            //
            $column = new TextViewColumn('ipi_base_calculo', 'ipi_base_calculo', 'Ipi Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ipi_aliquota field
            //
            $column = new TextViewColumn('ipi_aliquota', 'ipi_aliquota', 'Ipi Aliquota', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ipi_quantidade_total field
            //
            $column = new TextViewColumn('ipi_quantidade_total', 'ipi_quantidade_total', 'Ipi Quantidade Total', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ipi_valor_por_unidade_tributavel field
            //
            $column = new TextViewColumn('ipi_valor_por_unidade_tributavel', 'ipi_valor_por_unidade_tributavel', 'Ipi Valor Por Unidade Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ipi_valor field
            //
            $column = new TextViewColumn('ipi_valor', 'ipi_valor', 'Ipi Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ipi_classe_enquadramento field
            //
            $column = new TextViewColumn('ipi_classe_enquadramento', 'ipi_classe_enquadramento', 'Ipi Classe Enquadramento', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ipi_cnpj_produtor field
            //
            $column = new TextViewColumn('ipi_cnpj_produtor', 'ipi_cnpj_produtor', 'Ipi Cnpj Produtor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ipi_codigo_selo_controle field
            //
            $column = new TextViewColumn('ipi_codigo_selo_controle', 'ipi_codigo_selo_controle', 'Ipi Codigo Selo Controle', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('ipi_codigo_enquadramento_legal', 'ipi_codigo_enquadramento_legal_ds_tabela', 'Ipi Codigo Enquadramento Legal', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('pis_situacao_tributaria', 'pis_situacao_tributaria_ds_tabela', 'Pis Situacao Tributaria', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for pis_base_calculo field
            //
            $column = new TextViewColumn('pis_base_calculo', 'pis_base_calculo', 'Pis Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for pis_aliquota_porcentual field
            //
            $column = new TextViewColumn('pis_aliquota_porcentual', 'pis_aliquota_porcentual', 'Pis Aliquota Porcentual', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for pis_quantidade_vendida field
            //
            $column = new TextViewColumn('pis_quantidade_vendida', 'pis_quantidade_vendida', 'Pis Quantidade Vendida', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for pis_aliquota_valor field
            //
            $column = new TextViewColumn('pis_aliquota_valor', 'pis_aliquota_valor', 'Pis Aliquota Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for pis_valor field
            //
            $column = new TextViewColumn('pis_valor', 'pis_valor', 'Pis Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for pis_base_calculo_st field
            //
            $column = new TextViewColumn('pis_base_calculo_st', 'pis_base_calculo_st', 'Pis Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for pis_aliquota_porcentaul_st field
            //
            $column = new TextViewColumn('pis_aliquota_porcentaul_st', 'pis_aliquota_porcentaul_st', 'Pis Aliquota Porcentaul St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for pis_quantidade_vendida_st field
            //
            $column = new TextViewColumn('pis_quantidade_vendida_st', 'pis_quantidade_vendida_st', 'Pis Quantidade Vendida St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for pis_aliquota_valor_st field
            //
            $column = new TextViewColumn('pis_aliquota_valor_st', 'pis_aliquota_valor_st', 'Pis Aliquota Valor St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for pis_valor_st field
            //
            $column = new TextViewColumn('pis_valor_st', 'pis_valor_st', 'Pis Valor St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('cofins_situacao_tributaria', 'cofins_situacao_tributaria_ds_tabela', 'Cofins Situacao Tributaria', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for cofins_base_calculo field
            //
            $column = new TextViewColumn('cofins_base_calculo', 'cofins_base_calculo', 'Cofins Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for cofins_aliquota_porcentual field
            //
            $column = new TextViewColumn('cofins_aliquota_porcentual', 'cofins_aliquota_porcentual', 'Cofins Aliquota Porcentual', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for cofins_quantidade_vendida field
            //
            $column = new TextViewColumn('cofins_quantidade_vendida', 'cofins_quantidade_vendida', 'Cofins Quantidade Vendida', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for cofins_aliquota_valor field
            //
            $column = new TextViewColumn('cofins_aliquota_valor', 'cofins_aliquota_valor', 'Cofins Aliquota Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for cofins_valor field
            //
            $column = new TextViewColumn('cofins_valor', 'cofins_valor', 'Cofins Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for cofins_base_calculo_st field
            //
            $column = new TextViewColumn('cofins_base_calculo_st', 'cofins_base_calculo_st', 'Cofins Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for cofins_aliquota_porcentual_st field
            //
            $column = new TextViewColumn('cofins_aliquota_porcentual_st', 'cofins_aliquota_porcentual_st', 'Cofins Aliquota Porcentual St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for cofins_quantidade_vendida_st field
            //
            $column = new TextViewColumn('cofins_quantidade_vendida_st', 'cofins_quantidade_vendida_st', 'Cofins Quantidade Vendida St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for cofins_aliquota_valor_st field
            //
            $column = new TextViewColumn('cofins_aliquota_valor_st', 'cofins_aliquota_valor_st', 'Cofins Aliquota Valor St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for cofins_valor_st field
            //
            $column = new TextViewColumn('cofins_valor_st', 'cofins_valor_st', 'Cofins Valor St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for percentual_devolvido field
            //
            $column = new TextViewColumn('percentual_devolvido', 'percentual_devolvido', 'Percentual Devolvido', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_ipi_devolvido field
            //
            $column = new TextViewColumn('valor_ipi_devolvido', 'valor_ipi_devolvido', 'Valor Ipi Devolvido', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_frete field
            //
            $column = new TextViewColumn('valor_frete', 'valor_frete', 'Valor Frete', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
        }
    
        private function AddCompareColumns(Grid $grid)
        {
            //
            // View column for id_itens field
            //
            $column = new TextViewColumn('id_itens', 'id_itens', 'Id Itens', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for chave field
            //
            $column = new TextViewColumn('chave', 'chave', 'Chave', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for numero_item field
            //
            $column = new TextViewColumn('numero_item', 'numero_item', 'Numero Item', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for codigo_produto field
            //
            $column = new TextViewColumn('codigo_produto', 'codigo_produto', 'Codigo Produto', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for codigo_barras_comercial field
            //
            $column = new TextViewColumn('codigo_barras_comercial', 'codigo_barras_comercial', 'Codigo Barras Comercial', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for descricao field
            //
            $column = new TextViewColumn('descricao', 'descricao', 'Descricao', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('DetailGridnotas.itens_descricao_handler_compare');
            $grid->AddCompareColumn($column);
            
            //
            // View column for codigo_ncm field
            //
            $column = new TextViewColumn('codigo_ncm', 'codigo_ncm', 'Codigo Ncm', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cest field
            //
            $column = new TextViewColumn('cest', 'cest', 'Cest', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for codigo_ex_tipi field
            //
            $column = new TextViewColumn('codigo_ex_tipi', 'codigo_ex_tipi', 'Codigo Ex Tipi', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cfop field
            //
            $column = new TextViewColumn('cfop', 'cfop', 'CFOP', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for unidade_comercial field
            //
            $column = new TextViewColumn('unidade_comercial', 'unidade_comercial', 'Unidade Comercial', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for quantidade_comercial field
            //
            $column = new TextViewColumn('quantidade_comercial', 'quantidade_comercial', 'Quantidade Comercial', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_unitario_comercial field
            //
            $column = new TextViewColumn('valor_unitario_comercial', 'valor_unitario_comercial', 'Valor Unitario Comercial', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_bruto field
            //
            $column = new TextViewColumn('valor_bruto', 'valor_bruto', 'Valor Bruto', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for codigo_barras_tributavel field
            //
            $column = new TextViewColumn('codigo_barras_tributavel', 'codigo_barras_tributavel', 'Codigo Barras Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for unidade_tributavel field
            //
            $column = new TextViewColumn('unidade_tributavel', 'unidade_tributavel', 'Unidade Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for quantidade_tributavel field
            //
            $column = new TextViewColumn('quantidade_tributavel', 'quantidade_tributavel', 'Quantidade Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_unitario_tributavel field
            //
            $column = new TextViewColumn('valor_unitario_tributavel', 'valor_unitario_tributavel', 'Valor Unitario Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_outras_despesas field
            //
            $column = new TextViewColumn('valor_outras_despesas', 'valor_outras_despesas', 'Valor Outras Despesas', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('inclui_no_total', 'inclui_no_total_ds_tabela', 'Inclui No Total', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for pedido_compra field
            //
            $column = new TextViewColumn('pedido_compra', 'pedido_compra', 'Pedido Compra', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for numero_item_pedido_compra field
            //
            $column = new TextViewColumn('numero_item_pedido_compra', 'numero_item_pedido_compra', 'Numero Item Pedido Compra', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('icms_origem', 'icms_origem_ds_tabela', 'Icms Origem', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('icms_situacao_tributaria', 'icms_situacao_tributaria_ds_tabela', 'Icms Situacao Tributaria', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('icms_modalidade_base_calculo', 'icms_modalidade_base_calculo_ds_tabela', 'Icms Modalidade Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for icms_base_calculo field
            //
            $column = new TextViewColumn('icms_base_calculo', 'icms_base_calculo', 'Icms Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for icms_base_calculo_retido_st field
            //
            $column = new TextViewColumn('icms_base_calculo_retido_st', 'icms_base_calculo_retido_st', 'Icms Base Calculo Retido St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for icms_reducao_base_calculo field
            //
            $column = new TextViewColumn('icms_reducao_base_calculo', 'icms_reducao_base_calculo', 'Icms Reducao Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for icms_aliquota field
            //
            $column = new TextViewColumn('icms_aliquota', 'icms_aliquota', 'Icms Aliquota', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for icms_valor field
            //
            $column = new TextViewColumn('icms_valor', 'icms_valor', 'Icms Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for icms_valor_retido_st field
            //
            $column = new TextViewColumn('icms_valor_retido_st', 'icms_valor_retido_st', 'Icms Valor Retido St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for icms_valor_desonerado field
            //
            $column = new TextViewColumn('icms_valor_desonerado', 'icms_valor_desonerado', 'Icms Valor Desonerado', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for icms_valor_operacao field
            //
            $column = new TextViewColumn('icms_valor_operacao', 'icms_valor_operacao', 'Icms Valor Operacao', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for icms_percentual_diferimento field
            //
            $column = new TextViewColumn('icms_percentual_diferimento', 'icms_percentual_diferimento', 'Icms Percentual Diferimento', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for icms_valor_diferido field
            //
            $column = new TextViewColumn('icms_valor_diferido', 'icms_valor_diferido', 'Icms Valor Diferido', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for icms_motivo_desoneracao field
            //
            $column = new TextViewColumn('icms_motivo_desoneracao', 'icms_motivo_desoneracao', 'Icms Motivo Desoneracao', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('icms_modalidade_base_calculo_st', 'icms_modalidade_base_calculo_st_ds_tabela', 'Icms Modalidade Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for icms_margem_valor_adicionado_st field
            //
            $column = new TextViewColumn('icms_margem_valor_adicionado_st', 'icms_margem_valor_adicionado_st', 'Icms Margem Valor Adicionado St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for icms_reducao_base_calculo_st field
            //
            $column = new TextViewColumn('icms_reducao_base_calculo_st', 'icms_reducao_base_calculo_st', 'Icms Reducao Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for icms_base_calculo_st field
            //
            $column = new TextViewColumn('icms_base_calculo_st', 'icms_base_calculo_st', 'Icms Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for icms_aliquota_st field
            //
            $column = new TextViewColumn('icms_aliquota_st', 'icms_aliquota_st', 'Icms Aliquota St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for icms_valor_st field
            //
            $column = new TextViewColumn('icms_valor_st', 'icms_valor_st', 'Icms Valor St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('ipi_situacao_tributaria', 'ipi_situacao_tributaria_ds_tabela', 'Ipi Situacao Tributaria', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ipi_base_calculo field
            //
            $column = new TextViewColumn('ipi_base_calculo', 'ipi_base_calculo', 'Ipi Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ipi_aliquota field
            //
            $column = new TextViewColumn('ipi_aliquota', 'ipi_aliquota', 'Ipi Aliquota', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ipi_quantidade_total field
            //
            $column = new TextViewColumn('ipi_quantidade_total', 'ipi_quantidade_total', 'Ipi Quantidade Total', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ipi_valor_por_unidade_tributavel field
            //
            $column = new TextViewColumn('ipi_valor_por_unidade_tributavel', 'ipi_valor_por_unidade_tributavel', 'Ipi Valor Por Unidade Tributavel', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ipi_valor field
            //
            $column = new TextViewColumn('ipi_valor', 'ipi_valor', 'Ipi Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ipi_classe_enquadramento field
            //
            $column = new TextViewColumn('ipi_classe_enquadramento', 'ipi_classe_enquadramento', 'Ipi Classe Enquadramento', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ipi_cnpj_produtor field
            //
            $column = new TextViewColumn('ipi_cnpj_produtor', 'ipi_cnpj_produtor', 'Ipi Cnpj Produtor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ipi_codigo_selo_controle field
            //
            $column = new TextViewColumn('ipi_codigo_selo_controle', 'ipi_codigo_selo_controle', 'Ipi Codigo Selo Controle', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('ipi_codigo_enquadramento_legal', 'ipi_codigo_enquadramento_legal_ds_tabela', 'Ipi Codigo Enquadramento Legal', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('pis_situacao_tributaria', 'pis_situacao_tributaria_ds_tabela', 'Pis Situacao Tributaria', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for pis_base_calculo field
            //
            $column = new TextViewColumn('pis_base_calculo', 'pis_base_calculo', 'Pis Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for pis_aliquota_porcentual field
            //
            $column = new TextViewColumn('pis_aliquota_porcentual', 'pis_aliquota_porcentual', 'Pis Aliquota Porcentual', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for pis_quantidade_vendida field
            //
            $column = new TextViewColumn('pis_quantidade_vendida', 'pis_quantidade_vendida', 'Pis Quantidade Vendida', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for pis_aliquota_valor field
            //
            $column = new TextViewColumn('pis_aliquota_valor', 'pis_aliquota_valor', 'Pis Aliquota Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for pis_valor field
            //
            $column = new TextViewColumn('pis_valor', 'pis_valor', 'Pis Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for pis_base_calculo_st field
            //
            $column = new TextViewColumn('pis_base_calculo_st', 'pis_base_calculo_st', 'Pis Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for pis_aliquota_porcentaul_st field
            //
            $column = new TextViewColumn('pis_aliquota_porcentaul_st', 'pis_aliquota_porcentaul_st', 'Pis Aliquota Porcentaul St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for pis_quantidade_vendida_st field
            //
            $column = new TextViewColumn('pis_quantidade_vendida_st', 'pis_quantidade_vendida_st', 'Pis Quantidade Vendida St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for pis_aliquota_valor_st field
            //
            $column = new TextViewColumn('pis_aliquota_valor_st', 'pis_aliquota_valor_st', 'Pis Aliquota Valor St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for pis_valor_st field
            //
            $column = new TextViewColumn('pis_valor_st', 'pis_valor_st', 'Pis Valor St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('cofins_situacao_tributaria', 'cofins_situacao_tributaria_ds_tabela', 'Cofins Situacao Tributaria', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cofins_base_calculo field
            //
            $column = new TextViewColumn('cofins_base_calculo', 'cofins_base_calculo', 'Cofins Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cofins_aliquota_porcentual field
            //
            $column = new TextViewColumn('cofins_aliquota_porcentual', 'cofins_aliquota_porcentual', 'Cofins Aliquota Porcentual', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cofins_quantidade_vendida field
            //
            $column = new TextViewColumn('cofins_quantidade_vendida', 'cofins_quantidade_vendida', 'Cofins Quantidade Vendida', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cofins_aliquota_valor field
            //
            $column = new TextViewColumn('cofins_aliquota_valor', 'cofins_aliquota_valor', 'Cofins Aliquota Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cofins_valor field
            //
            $column = new TextViewColumn('cofins_valor', 'cofins_valor', 'Cofins Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cofins_base_calculo_st field
            //
            $column = new TextViewColumn('cofins_base_calculo_st', 'cofins_base_calculo_st', 'Cofins Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cofins_aliquota_porcentual_st field
            //
            $column = new TextViewColumn('cofins_aliquota_porcentual_st', 'cofins_aliquota_porcentual_st', 'Cofins Aliquota Porcentual St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cofins_quantidade_vendida_st field
            //
            $column = new TextViewColumn('cofins_quantidade_vendida_st', 'cofins_quantidade_vendida_st', 'Cofins Quantidade Vendida St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cofins_aliquota_valor_st field
            //
            $column = new TextViewColumn('cofins_aliquota_valor_st', 'cofins_aliquota_valor_st', 'Cofins Aliquota Valor St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cofins_valor_st field
            //
            $column = new TextViewColumn('cofins_valor_st', 'cofins_valor_st', 'Cofins Valor St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for percentual_devolvido field
            //
            $column = new TextViewColumn('percentual_devolvido', 'percentual_devolvido', 'Percentual Devolvido', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_ipi_devolvido field
            //
            $column = new TextViewColumn('valor_ipi_devolvido', 'valor_ipi_devolvido', 'Valor Ipi Devolvido', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_frete field
            //
            $column = new TextViewColumn('valor_frete', 'valor_frete', 'Valor Frete', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
        }
    
        private function AddCompareHeaderColumns(Grid $grid)
        {
    
        }
    
        public function GetPageDirection()
        {
            return null;
        }
    
        public function isFilterConditionRequired()
        {
            return false;
        }
    
        protected function ApplyCommonColumnEditProperties(CustomEditColumn $column)
        {
            $column->SetDisplaySetToNullCheckBox(false);
            $column->SetDisplaySetToDefaultCheckBox(false);
    		$column->SetVariableContainer($this->GetColumnVariableContainer());
        }
    
        function GetCustomClientScript()
        {
            return ;
        }
        
        function GetOnPageLoadedClientScript()
        {
            return ;
        }
        protected function GetEnableModalGridDelete() { return true; }
    
        protected function CreateGrid()
        {
            $result = new Grid($this, $this->dataset);
            if ($this->GetSecurityInfo()->HasDeleteGrant())
               $result->SetAllowDeleteSelected(true);
            else
               $result->SetAllowDeleteSelected(false);   
            
            ApplyCommonPageSettings($this, $result);
            
            $result->SetUseImagesForActions(true);
            $result->SetUseFixedHeader(false);
            $result->SetShowLineNumbers(false);
            $result->SetViewMode(ViewMode::TABLE);
            $result->setEnableRuntimeCustomization(true);
            $result->setAllowCompare(true);
            $this->AddCompareHeaderColumns($result);
            $this->AddCompareColumns($result);
            $result->setMultiEditAllowed($this->GetSecurityInfo()->HasEditGrant() && false);
            $result->setTableBordered(false);
            $result->setTableCondensed(false);
            
            $result->SetHighlightRowAtHover(false);
            $result->SetWidth('');
            $this->AddOperationsColumns($result);
            $this->AddFieldColumns($result);
            $this->AddSingleRecordViewColumns($result);
            $this->AddEditColumns($result);
            $this->AddMultiEditColumns($result);
            $this->AddInsertColumns($result);
            $this->AddPrintColumns($result);
            $this->AddExportColumns($result);
            $this->AddMultiUploadColumn($result);
    
    
            $this->SetShowPageList(true);
            $this->SetShowTopPageNavigator(true);
            $this->SetShowBottomPageNavigator(true);
            $this->setPrintListAvailable(false);
            $this->setPrintListRecordAvailable(false);
            $this->setPrintOneRecordAvailable(false);
            $this->setAllowPrintSelectedRecords(true);
            $this->setExportListAvailable(array('pdf', 'excel', 'word'));
            $this->setExportSelectedRecordsAvailable(array('pdf', 'excel', 'word', 'xml', 'csv'));
            $this->setExportListRecordAvailable(array());
            $this->setExportOneRecordAvailable(array('pdf', 'excel', 'word'));
    
            return $result;
        }
     
        protected function setClientSideEvents(Grid $grid) {
    
        }
    
        protected function doRegisterHandlers() {
            //
            // View column for descricao field
            //
            $column = new TextViewColumn('descricao', 'descricao', 'Descricao', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'DetailGridnotas.itens_descricao_handler_list', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for descricao field
            //
            $column = new TextViewColumn('descricao', 'descricao', 'Descricao', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'DetailGridnotas.itens_descricao_handler_print', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for descricao field
            //
            $column = new TextViewColumn('descricao', 'descricao', 'Descricao', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'DetailGridnotas.itens_descricao_handler_compare', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`inclui_no_total`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $handler = new DynamicSearchHandler($lookupDataset, $this, 'filter_builder_notas_itens_inclui_no_total_search', 'cd_tabela', 'ds_tabela', null, 20);
            GetApplication()->RegisterHTTPHandler($handler);
            
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`icms_origem`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $handler = new DynamicSearchHandler($lookupDataset, $this, 'filter_builder_notas_itens_icms_origem_search', 'cd_tabela', 'ds_tabela', null, 20);
            GetApplication()->RegisterHTTPHandler($handler);
            
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`icms_situacao_tributaria`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $handler = new DynamicSearchHandler($lookupDataset, $this, 'filter_builder_notas_itens_icms_situacao_tributaria_search', 'cd_tabela', 'ds_tabela', null, 20);
            GetApplication()->RegisterHTTPHandler($handler);
            
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`icms_modalidade_base_calculo`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $handler = new DynamicSearchHandler($lookupDataset, $this, 'filter_builder_notas_itens_icms_modalidade_base_calculo_search', 'cd_tabela', 'ds_tabela', null, 20);
            GetApplication()->RegisterHTTPHandler($handler);
            
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`icms_modalidade_base_calculo`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $handler = new DynamicSearchHandler($lookupDataset, $this, 'filter_builder_notas_itens_icms_modalidade_base_calculo_st_search', 'cd_tabela', 'ds_tabela', null, 20);
            GetApplication()->RegisterHTTPHandler($handler);
            
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`ipi_situacao_tributaria`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $handler = new DynamicSearchHandler($lookupDataset, $this, 'filter_builder_notas_itens_ipi_situacao_tributaria_search', 'cd_tabela', 'ds_tabela', null, 20);
            GetApplication()->RegisterHTTPHandler($handler);
            
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`ipi_codigo_enquadramento_legal`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $handler = new DynamicSearchHandler($lookupDataset, $this, 'filter_builder_notas_itens_ipi_codigo_enquadramento_legal_search', 'cd_tabela', 'ds_tabela', null, 20);
            GetApplication()->RegisterHTTPHandler($handler);
            
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`pis_situacao_tributaria`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $handler = new DynamicSearchHandler($lookupDataset, $this, 'filter_builder_notas_itens_pis_situacao_tributaria_search', 'cd_tabela', 'ds_tabela', null, 20);
            GetApplication()->RegisterHTTPHandler($handler);
            
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`cofins_situacao_tributaria`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $handler = new DynamicSearchHandler($lookupDataset, $this, 'filter_builder_notas_itens_cofins_situacao_tributaria_search', 'cd_tabela', 'ds_tabela', null, 20);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for descricao field
            //
            $column = new TextViewColumn('descricao', 'descricao', 'Descricao', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'DetailGridnotas.itens_descricao_handler_view', $column);
            GetApplication()->RegisterHTTPHandler($handler);
        }
       
        protected function doCustomRenderColumn($fieldName, $fieldData, $rowData, &$customText, &$handled)
        { 
    
        }
    
        protected function doCustomRenderPrintColumn($fieldName, $fieldData, $rowData, &$customText, &$handled)
        { 
    
        }
    
        protected function doCustomRenderExportColumn($exportType, $fieldName, $fieldData, $rowData, &$customText, &$handled)
        { 
    
        }
    
        protected function doCustomDrawRow($rowData, &$cellFontColor, &$cellFontSize, &$cellBgColor, &$cellItalicAttr, &$cellBoldAttr)
        {
    
        }
    
        protected function doExtendedCustomDrawRow($rowData, &$rowCellStyles, &$rowStyles, &$rowClasses, &$cellClasses)
        {
    
        }
    
        protected function doCustomRenderTotal($totalValue, $aggregate, $columnName, &$customText, &$handled)
        {
    
        }
    
        protected function doCustomDefaultValues(&$values, &$handled) 
        {
    
        }
    
        protected function doCustomCompareColumn($columnName, $valueA, $valueB, &$result)
        {
    
        }
    
        protected function doBeforeInsertRecord($page, &$rowData, $tableName, &$cancel, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doBeforeUpdateRecord($page, $oldRowData, &$rowData, $tableName, &$cancel, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doBeforeDeleteRecord($page, &$rowData, $tableName, &$cancel, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doAfterInsertRecord($page, $rowData, $tableName, &$success, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doAfterUpdateRecord($page, $oldRowData, $rowData, $tableName, &$success, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doAfterDeleteRecord($page, $rowData, $tableName, &$success, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doCustomHTMLHeader($page, &$customHtmlHeaderText)
        { 
    
        }
    
        protected function doGetCustomTemplate($type, $part, $mode, &$result, &$params)
        {
    
        }
    
        protected function doGetCustomExportOptions(Page $page, $exportType, $rowData, &$options)
        {
    
        }
    
        protected function doFileUpload($fieldName, $rowData, &$result, &$accept, $originalFileName, $originalFileExtension, $fileSize, $tempFileName)
        {
    
        }
    
        protected function doPrepareChart(Chart $chart)
        {
    
        }
    
        protected function doPrepareColumnFilter(ColumnFilter $columnFilter)
        {
    
        }
    
        protected function doPrepareFilterBuilder(FilterBuilder $filterBuilder, FixedKeysArray $columns)
        {
    
        }
    
        protected function doGetSelectionFilters(FixedKeysArray $columns, &$result)
        {
    
        }
    
        protected function doGetCustomFormLayout($mode, FixedKeysArray $columns, FormLayout $layout)
        {
    
        }
    
        protected function doGetCustomColumnGroup(FixedKeysArray $columns, ViewColumnGroup $columnGroup)
        {
    
        }
    
        protected function doPageLoaded()
        {
    
        }
    
        protected function doCalculateFields($rowData, $fieldName, &$value)
        {
    
        }
    
        protected function doGetCustomPagePermissions(Page $page, PermissionSet &$permissions, &$handled)
        {
    
        }
    
        protected function doGetCustomRecordPermissions(Page $page, &$usingCondition, $rowData, &$allowEdit, &$allowDelete, &$mergeWithDefault, &$handled)
        {
    
        }
    
    }
    
    
    
    
    // OnBeforePageExecute event handler
    
    
    
    class notas_notas_referenciadasPage extends DetailPage
    {
        protected function DoBeforeCreate()
        {
            $this->SetTitle('Notas Referenciadas');
            $this->SetMenuLabel('Notas Referenciadas');
            $this->SetHeader(GetPagesHeader());
            $this->SetFooter(GetPagesFooter());
    
            $this->dataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`notas_referenciadas`');
            $this->dataset->addFields(
                array(
                    new IntegerField('id_notas_referenciadas', true, true, true),
                    new StringField('chave'),
                    new StringField('chave_nfe'),
                    new StringField('uf'),
                    new StringField('mes'),
                    new StringField('cnpj'),
                    new StringField('modelo'),
                    new StringField('serie'),
                    new StringField('numero')
                )
            );
        }
    
        protected function DoPrepare() {
    
        }
    
        protected function CreatePageNavigator()
        {
            $result = new CompositePageNavigator($this);
            
            $partitionNavigator = new PageNavigator('pnav', $this, $this->dataset);
            $partitionNavigator->SetRowsPerPage(20);
            $result->AddPageNavigator($partitionNavigator);
            
            return $result;
        }
    
        protected function CreateRssGenerator()
        {
            return null;
        }
    
        protected function setupCharts()
        {
    
        }
    
        protected function getFiltersColumns()
        {
            return array(
                new FilterColumn($this->dataset, 'id_notas_referenciadas', 'id_notas_referenciadas', 'Id Notas Referenciadas'),
                new FilterColumn($this->dataset, 'chave', 'chave', 'Chave'),
                new FilterColumn($this->dataset, 'chave_nfe', 'chave_nfe', 'Chave Nfe'),
                new FilterColumn($this->dataset, 'uf', 'uf', 'Uf'),
                new FilterColumn($this->dataset, 'mes', 'mes', 'Mes'),
                new FilterColumn($this->dataset, 'cnpj', 'cnpj', 'Cnpj'),
                new FilterColumn($this->dataset, 'modelo', 'modelo', 'Modelo'),
                new FilterColumn($this->dataset, 'serie', 'serie', 'Serie'),
                new FilterColumn($this->dataset, 'numero', 'numero', 'Numero')
            );
        }
    
        protected function setupQuickFilter(QuickFilter $quickFilter, FixedKeysArray $columns)
        {
            $quickFilter
                ->addColumn($columns['chave_nfe'])
                ->addColumn($columns['uf'])
                ->addColumn($columns['mes'])
                ->addColumn($columns['cnpj'])
                ->addColumn($columns['modelo'])
                ->addColumn($columns['serie'])
                ->addColumn($columns['numero']);
        }
    
        protected function setupColumnFilter(ColumnFilter $columnFilter)
        {
    
        }
    
        protected function setupFilterBuilder(FilterBuilder $filterBuilder, FixedKeysArray $columns)
        {
            $main_editor = new TextEdit('chave_nfe_edit');
            $main_editor->SetMaxLength(80);
            
            $filterBuilder->addColumn(
                $columns['chave_nfe'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('uf_edit');
            $main_editor->SetMaxLength(3);
            
            $filterBuilder->addColumn(
                $columns['uf'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('mes_edit');
            $main_editor->SetMaxLength(4);
            
            $filterBuilder->addColumn(
                $columns['mes'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('cnpj_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['cnpj'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('modelo_edit');
            $main_editor->SetMaxLength(5);
            
            $filterBuilder->addColumn(
                $columns['modelo'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('serie_edit');
            $main_editor->SetMaxLength(12);
            
            $filterBuilder->addColumn(
                $columns['serie'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('numero_edit');
            $main_editor->SetMaxLength(12);
            
            $filterBuilder->addColumn(
                $columns['numero'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
        }
    
        protected function AddOperationsColumns(Grid $grid)
        {
            $actions = $grid->getActions();
            $actions->setCaption($this->GetLocalizerCaptions()->GetMessageString('Actions'));
            $actions->setPosition(ActionList::POSITION_LEFT);
            
            if ($this->GetSecurityInfo()->HasViewGrant())
            {
                $operation = new LinkOperation($this->GetLocalizerCaptions()->GetMessageString('View'), OPERATION_VIEW, $this->dataset, $grid);
                $operation->setUseImage(true);
                $actions->addOperation($operation);
            }
            
            if ($this->GetSecurityInfo()->HasEditGrant())
            {
                $operation = new LinkOperation($this->GetLocalizerCaptions()->GetMessageString('Edit'), OPERATION_EDIT, $this->dataset, $grid);
                $operation->setUseImage(true);
                $actions->addOperation($operation);
                $operation->OnShow->AddListener('ShowEditButtonHandler', $this);
            }
            
            if ($this->GetSecurityInfo()->HasDeleteGrant())
            {
                $operation = new LinkOperation($this->GetLocalizerCaptions()->GetMessageString('Delete'), OPERATION_DELETE, $this->dataset, $grid);
                $operation->setUseImage(true);
                $actions->addOperation($operation);
                $operation->OnShow->AddListener('ShowDeleteButtonHandler', $this);
                $operation->SetAdditionalAttribute('data-modal-operation', 'delete');
                $operation->SetAdditionalAttribute('data-delete-handler-name', $this->GetModalGridDeleteHandler());
            }
            
            if ($this->GetSecurityInfo()->HasAddGrant())
            {
                $operation = new LinkOperation($this->GetLocalizerCaptions()->GetMessageString('Copy'), OPERATION_COPY, $this->dataset, $grid);
                $operation->setUseImage(true);
                $actions->addOperation($operation);
            }
        }
    
        protected function AddFieldColumns(Grid $grid, $withDetails = true)
        {
            //
            // View column for chave_nfe field
            //
            $column = new TextViewColumn('chave_nfe', 'chave_nfe', 'Chave Nfe', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('DetailGridnotas.notas_referenciadas_chave_nfe_handler_list');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for uf field
            //
            $column = new TextViewColumn('uf', 'uf', 'Uf', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for mes field
            //
            $column = new TextViewColumn('mes', 'mes', 'Mes', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for cnpj field
            //
            $column = new TextViewColumn('cnpj', 'cnpj', 'Cnpj', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for modelo field
            //
            $column = new TextViewColumn('modelo', 'modelo', 'Modelo', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for serie field
            //
            $column = new TextViewColumn('serie', 'serie', 'Serie', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for numero field
            //
            $column = new TextViewColumn('numero', 'numero', 'Numero', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
        }
    
        protected function AddSingleRecordViewColumns(Grid $grid)
        {
            //
            // View column for chave_nfe field
            //
            $column = new TextViewColumn('chave_nfe', 'chave_nfe', 'Chave Nfe', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('DetailGridnotas.notas_referenciadas_chave_nfe_handler_view');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for uf field
            //
            $column = new TextViewColumn('uf', 'uf', 'Uf', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for mes field
            //
            $column = new TextViewColumn('mes', 'mes', 'Mes', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for cnpj field
            //
            $column = new TextViewColumn('cnpj', 'cnpj', 'Cnpj', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for modelo field
            //
            $column = new TextViewColumn('modelo', 'modelo', 'Modelo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for serie field
            //
            $column = new TextViewColumn('serie', 'serie', 'Serie', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for numero field
            //
            $column = new TextViewColumn('numero', 'numero', 'Numero', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
        }
    
        protected function AddEditColumns(Grid $grid)
        {
            //
            // Edit column for chave_nfe field
            //
            $editor = new TextEdit('chave_nfe_edit');
            $editor->SetMaxLength(80);
            $editColumn = new CustomEditColumn('Chave Nfe', 'chave_nfe', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for uf field
            //
            $editor = new TextEdit('uf_edit');
            $editor->SetMaxLength(3);
            $editColumn = new CustomEditColumn('Uf', 'uf', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for mes field
            //
            $editor = new TextEdit('mes_edit');
            $editor->SetMaxLength(4);
            $editColumn = new CustomEditColumn('Mes', 'mes', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for cnpj field
            //
            $editor = new TextEdit('cnpj_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cnpj', 'cnpj', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for modelo field
            //
            $editor = new TextEdit('modelo_edit');
            $editor->SetMaxLength(5);
            $editColumn = new CustomEditColumn('Modelo', 'modelo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for serie field
            //
            $editor = new TextEdit('serie_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Serie', 'serie', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for numero field
            //
            $editor = new TextEdit('numero_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Numero', 'numero', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
        }
    
        protected function AddMultiEditColumns(Grid $grid)
        {
            //
            // Edit column for chave field
            //
            $editor = new TextEdit('chave_edit');
            $editor->SetMaxLength(15);
            $editColumn = new CustomEditColumn('Chave', 'chave', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for chave_nfe field
            //
            $editor = new TextEdit('chave_nfe_edit');
            $editor->SetMaxLength(80);
            $editColumn = new CustomEditColumn('Chave Nfe', 'chave_nfe', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for uf field
            //
            $editor = new TextEdit('uf_edit');
            $editor->SetMaxLength(3);
            $editColumn = new CustomEditColumn('Uf', 'uf', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for mes field
            //
            $editor = new TextEdit('mes_edit');
            $editor->SetMaxLength(4);
            $editColumn = new CustomEditColumn('Mes', 'mes', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cnpj field
            //
            $editor = new TextEdit('cnpj_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cnpj', 'cnpj', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for modelo field
            //
            $editor = new TextEdit('modelo_edit');
            $editor->SetMaxLength(5);
            $editColumn = new CustomEditColumn('Modelo', 'modelo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for serie field
            //
            $editor = new TextEdit('serie_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Serie', 'serie', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for numero field
            //
            $editor = new TextEdit('numero_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Numero', 'numero', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
        }
    
        protected function AddInsertColumns(Grid $grid)
        {
            //
            // Edit column for chave_nfe field
            //
            $editor = new TextEdit('chave_nfe_edit');
            $editor->SetMaxLength(80);
            $editColumn = new CustomEditColumn('Chave Nfe', 'chave_nfe', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for uf field
            //
            $editor = new TextEdit('uf_edit');
            $editor->SetMaxLength(3);
            $editColumn = new CustomEditColumn('Uf', 'uf', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for mes field
            //
            $editor = new TextEdit('mes_edit');
            $editor->SetMaxLength(4);
            $editColumn = new CustomEditColumn('Mes', 'mes', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for cnpj field
            //
            $editor = new TextEdit('cnpj_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cnpj', 'cnpj', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for modelo field
            //
            $editor = new TextEdit('modelo_edit');
            $editor->SetMaxLength(5);
            $editColumn = new CustomEditColumn('Modelo', 'modelo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for serie field
            //
            $editor = new TextEdit('serie_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Serie', 'serie', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for numero field
            //
            $editor = new TextEdit('numero_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Numero', 'numero', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            $grid->SetShowAddButton(true && $this->GetSecurityInfo()->HasAddGrant());
        }
    
        private function AddMultiUploadColumn(Grid $grid)
        {
    
        }
    
        protected function AddPrintColumns(Grid $grid)
        {
            //
            // View column for chave_nfe field
            //
            $column = new TextViewColumn('chave_nfe', 'chave_nfe', 'Chave Nfe', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('DetailGridnotas.notas_referenciadas_chave_nfe_handler_print');
            $grid->AddPrintColumn($column);
            
            //
            // View column for uf field
            //
            $column = new TextViewColumn('uf', 'uf', 'Uf', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for mes field
            //
            $column = new TextViewColumn('mes', 'mes', 'Mes', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for cnpj field
            //
            $column = new TextViewColumn('cnpj', 'cnpj', 'Cnpj', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for modelo field
            //
            $column = new TextViewColumn('modelo', 'modelo', 'Modelo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for serie field
            //
            $column = new TextViewColumn('serie', 'serie', 'Serie', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for numero field
            //
            $column = new TextViewColumn('numero', 'numero', 'Numero', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
        }
    
        protected function AddExportColumns(Grid $grid)
        {
            //
            // View column for chave_nfe field
            //
            $column = new TextViewColumn('chave_nfe', 'chave_nfe', 'Chave Nfe', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('DetailGridnotas.notas_referenciadas_chave_nfe_handler_export');
            $grid->AddExportColumn($column);
            
            //
            // View column for uf field
            //
            $column = new TextViewColumn('uf', 'uf', 'Uf', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for mes field
            //
            $column = new TextViewColumn('mes', 'mes', 'Mes', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for cnpj field
            //
            $column = new TextViewColumn('cnpj', 'cnpj', 'Cnpj', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for modelo field
            //
            $column = new TextViewColumn('modelo', 'modelo', 'Modelo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for serie field
            //
            $column = new TextViewColumn('serie', 'serie', 'Serie', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for numero field
            //
            $column = new TextViewColumn('numero', 'numero', 'Numero', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
        }
    
        private function AddCompareColumns(Grid $grid)
        {
            //
            // View column for id_notas_referenciadas field
            //
            $column = new TextViewColumn('id_notas_referenciadas', 'id_notas_referenciadas', 'Id Notas Referenciadas', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for chave_nfe field
            //
            $column = new TextViewColumn('chave_nfe', 'chave_nfe', 'Chave Nfe', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('DetailGridnotas.notas_referenciadas_chave_nfe_handler_compare');
            $grid->AddCompareColumn($column);
            
            //
            // View column for uf field
            //
            $column = new TextViewColumn('uf', 'uf', 'Uf', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for mes field
            //
            $column = new TextViewColumn('mes', 'mes', 'Mes', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cnpj field
            //
            $column = new TextViewColumn('cnpj', 'cnpj', 'Cnpj', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for modelo field
            //
            $column = new TextViewColumn('modelo', 'modelo', 'Modelo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for serie field
            //
            $column = new TextViewColumn('serie', 'serie', 'Serie', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for numero field
            //
            $column = new TextViewColumn('numero', 'numero', 'Numero', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
        }
    
        private function AddCompareHeaderColumns(Grid $grid)
        {
    
        }
    
        public function GetPageDirection()
        {
            return null;
        }
    
        public function isFilterConditionRequired()
        {
            return false;
        }
    
        protected function ApplyCommonColumnEditProperties(CustomEditColumn $column)
        {
            $column->SetDisplaySetToNullCheckBox(false);
            $column->SetDisplaySetToDefaultCheckBox(false);
    		$column->SetVariableContainer($this->GetColumnVariableContainer());
        }
    
        function GetCustomClientScript()
        {
            return ;
        }
        
        function GetOnPageLoadedClientScript()
        {
            return ;
        }
        protected function GetEnableModalGridDelete() { return true; }
    
        protected function CreateGrid()
        {
            $result = new Grid($this, $this->dataset);
            if ($this->GetSecurityInfo()->HasDeleteGrant())
               $result->SetAllowDeleteSelected(true);
            else
               $result->SetAllowDeleteSelected(false);   
            
            ApplyCommonPageSettings($this, $result);
            
            $result->SetUseImagesForActions(true);
            $result->SetUseFixedHeader(false);
            $result->SetShowLineNumbers(false);
            $result->SetViewMode(ViewMode::TABLE);
            $result->setEnableRuntimeCustomization(true);
            $result->setAllowCompare(true);
            $this->AddCompareHeaderColumns($result);
            $this->AddCompareColumns($result);
            $result->setMultiEditAllowed($this->GetSecurityInfo()->HasEditGrant() && false);
            $result->setTableBordered(false);
            $result->setTableCondensed(false);
            
            $result->SetHighlightRowAtHover(false);
            $result->SetWidth('');
            $this->AddOperationsColumns($result);
            $this->AddFieldColumns($result);
            $this->AddSingleRecordViewColumns($result);
            $this->AddEditColumns($result);
            $this->AddMultiEditColumns($result);
            $this->AddInsertColumns($result);
            $this->AddPrintColumns($result);
            $this->AddExportColumns($result);
            $this->AddMultiUploadColumn($result);
    
    
            $this->SetShowPageList(true);
            $this->SetShowTopPageNavigator(true);
            $this->SetShowBottomPageNavigator(true);
            $this->setPrintListAvailable(false);
            $this->setPrintListRecordAvailable(false);
            $this->setPrintOneRecordAvailable(false);
            $this->setAllowPrintSelectedRecords(true);
            $this->setExportListAvailable(array('pdf', 'excel', 'word'));
            $this->setExportSelectedRecordsAvailable(array('pdf', 'excel', 'word', 'xml', 'csv'));
            $this->setExportListRecordAvailable(array());
            $this->setExportOneRecordAvailable(array('pdf', 'excel', 'word'));
    
            return $result;
        }
     
        protected function setClientSideEvents(Grid $grid) {
    
        }
    
        protected function doRegisterHandlers() {
            //
            // View column for chave_nfe field
            //
            $column = new TextViewColumn('chave_nfe', 'chave_nfe', 'Chave Nfe', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'DetailGridnotas.notas_referenciadas_chave_nfe_handler_list', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for chave_nfe field
            //
            $column = new TextViewColumn('chave_nfe', 'chave_nfe', 'Chave Nfe', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'DetailGridnotas.notas_referenciadas_chave_nfe_handler_print', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for chave_nfe field
            //
            $column = new TextViewColumn('chave_nfe', 'chave_nfe', 'Chave Nfe', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'DetailGridnotas.notas_referenciadas_chave_nfe_handler_compare', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for chave_nfe field
            //
            $column = new TextViewColumn('chave_nfe', 'chave_nfe', 'Chave Nfe', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'DetailGridnotas.notas_referenciadas_chave_nfe_handler_view', $column);
            GetApplication()->RegisterHTTPHandler($handler);
        }
       
        protected function doCustomRenderColumn($fieldName, $fieldData, $rowData, &$customText, &$handled)
        { 
    
        }
    
        protected function doCustomRenderPrintColumn($fieldName, $fieldData, $rowData, &$customText, &$handled)
        { 
    
        }
    
        protected function doCustomRenderExportColumn($exportType, $fieldName, $fieldData, $rowData, &$customText, &$handled)
        { 
    
        }
    
        protected function doCustomDrawRow($rowData, &$cellFontColor, &$cellFontSize, &$cellBgColor, &$cellItalicAttr, &$cellBoldAttr)
        {
    
        }
    
        protected function doExtendedCustomDrawRow($rowData, &$rowCellStyles, &$rowStyles, &$rowClasses, &$cellClasses)
        {
    
        }
    
        protected function doCustomRenderTotal($totalValue, $aggregate, $columnName, &$customText, &$handled)
        {
    
        }
    
        protected function doCustomDefaultValues(&$values, &$handled) 
        {
    
        }
    
        protected function doCustomCompareColumn($columnName, $valueA, $valueB, &$result)
        {
    
        }
    
        protected function doBeforeInsertRecord($page, &$rowData, $tableName, &$cancel, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doBeforeUpdateRecord($page, $oldRowData, &$rowData, $tableName, &$cancel, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doBeforeDeleteRecord($page, &$rowData, $tableName, &$cancel, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doAfterInsertRecord($page, $rowData, $tableName, &$success, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doAfterUpdateRecord($page, $oldRowData, $rowData, $tableName, &$success, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doAfterDeleteRecord($page, $rowData, $tableName, &$success, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doCustomHTMLHeader($page, &$customHtmlHeaderText)
        { 
    
        }
    
        protected function doGetCustomTemplate($type, $part, $mode, &$result, &$params)
        {
    
        }
    
        protected function doGetCustomExportOptions(Page $page, $exportType, $rowData, &$options)
        {
    
        }
    
        protected function doFileUpload($fieldName, $rowData, &$result, &$accept, $originalFileName, $originalFileExtension, $fileSize, $tempFileName)
        {
    
        }
    
        protected function doPrepareChart(Chart $chart)
        {
    
        }
    
        protected function doPrepareColumnFilter(ColumnFilter $columnFilter)
        {
    
        }
    
        protected function doPrepareFilterBuilder(FilterBuilder $filterBuilder, FixedKeysArray $columns)
        {
    
        }
    
        protected function doGetSelectionFilters(FixedKeysArray $columns, &$result)
        {
    
        }
    
        protected function doGetCustomFormLayout($mode, FixedKeysArray $columns, FormLayout $layout)
        {
    
        }
    
        protected function doGetCustomColumnGroup(FixedKeysArray $columns, ViewColumnGroup $columnGroup)
        {
    
        }
    
        protected function doPageLoaded()
        {
    
        }
    
        protected function doCalculateFields($rowData, $fieldName, &$value)
        {
    
        }
    
        protected function doGetCustomPagePermissions(Page $page, PermissionSet &$permissions, &$handled)
        {
    
        }
    
        protected function doGetCustomRecordPermissions(Page $page, &$usingCondition, $rowData, &$allowEdit, &$allowDelete, &$mergeWithDefault, &$handled)
        {
    
        }
    
    }
    
    
    
    
    // OnBeforePageExecute event handler
    
    
    
    class notas_duplicatasPage extends DetailPage
    {
        protected function DoBeforeCreate()
        {
            $this->SetTitle('Duplicatas');
            $this->SetMenuLabel('Duplicatas');
            $this->SetHeader(GetPagesHeader());
            $this->SetFooter(GetPagesFooter());
    
            $this->dataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`duplicatas`');
            $this->dataset->addFields(
                array(
                    new IntegerField('id_duplicatas', true, true, true),
                    new StringField('chave'),
                    new StringField('numero'),
                    new StringField('data_vencimento'),
                    new StringField('valor')
                )
            );
        }
    
        protected function DoPrepare() {
    
        }
    
        protected function CreatePageNavigator()
        {
            $result = new CompositePageNavigator($this);
            
            $partitionNavigator = new PageNavigator('pnav', $this, $this->dataset);
            $partitionNavigator->SetRowsPerPage(20);
            $result->AddPageNavigator($partitionNavigator);
            
            return $result;
        }
    
        protected function CreateRssGenerator()
        {
            return null;
        }
    
        protected function setupCharts()
        {
    
        }
    
        protected function getFiltersColumns()
        {
            return array(
                new FilterColumn($this->dataset, 'id_duplicatas', 'id_duplicatas', 'Id Duplicatas'),
                new FilterColumn($this->dataset, 'chave', 'chave', 'Chave'),
                new FilterColumn($this->dataset, 'numero', 'numero', 'Numero'),
                new FilterColumn($this->dataset, 'data_vencimento', 'data_vencimento', 'Data Vencimento'),
                new FilterColumn($this->dataset, 'valor', 'valor', 'Valor')
            );
        }
    
        protected function setupQuickFilter(QuickFilter $quickFilter, FixedKeysArray $columns)
        {
            $quickFilter
                ->addColumn($columns['numero'])
                ->addColumn($columns['data_vencimento'])
                ->addColumn($columns['valor']);
        }
    
        protected function setupColumnFilter(ColumnFilter $columnFilter)
        {
    
        }
    
        protected function setupFilterBuilder(FilterBuilder $filterBuilder, FixedKeysArray $columns)
        {
            $main_editor = new TextEdit('numero_edit');
            $main_editor->SetMaxLength(15);
            
            $filterBuilder->addColumn(
                $columns['numero'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('data_vencimento_edit');
            $main_editor->SetMaxLength(12);
            
            $filterBuilder->addColumn(
                $columns['data_vencimento'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
            
            $main_editor = new TextEdit('valor_edit');
            $main_editor->SetMaxLength(20);
            
            $filterBuilder->addColumn(
                $columns['valor'],
                array(
                    FilterConditionOperator::EQUALS => $main_editor,
                    FilterConditionOperator::DOES_NOT_EQUAL => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN => $main_editor,
                    FilterConditionOperator::IS_GREATER_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN => $main_editor,
                    FilterConditionOperator::IS_LESS_THAN_OR_EQUAL_TO => $main_editor,
                    FilterConditionOperator::IS_BETWEEN => $main_editor,
                    FilterConditionOperator::IS_NOT_BETWEEN => $main_editor,
                    FilterConditionOperator::CONTAINS => $main_editor,
                    FilterConditionOperator::DOES_NOT_CONTAIN => $main_editor,
                    FilterConditionOperator::BEGINS_WITH => $main_editor,
                    FilterConditionOperator::ENDS_WITH => $main_editor,
                    FilterConditionOperator::IS_LIKE => $main_editor,
                    FilterConditionOperator::IS_NOT_LIKE => $main_editor,
                    FilterConditionOperator::IS_BLANK => null,
                    FilterConditionOperator::IS_NOT_BLANK => null
                )
            );
        }
    
        protected function AddOperationsColumns(Grid $grid)
        {
            $actions = $grid->getActions();
            $actions->setCaption($this->GetLocalizerCaptions()->GetMessageString('Actions'));
            $actions->setPosition(ActionList::POSITION_LEFT);
            
            if ($this->GetSecurityInfo()->HasViewGrant())
            {
                $operation = new LinkOperation($this->GetLocalizerCaptions()->GetMessageString('View'), OPERATION_VIEW, $this->dataset, $grid);
                $operation->setUseImage(true);
                $actions->addOperation($operation);
            }
            
            if ($this->GetSecurityInfo()->HasEditGrant())
            {
                $operation = new LinkOperation($this->GetLocalizerCaptions()->GetMessageString('Edit'), OPERATION_EDIT, $this->dataset, $grid);
                $operation->setUseImage(true);
                $actions->addOperation($operation);
                $operation->OnShow->AddListener('ShowEditButtonHandler', $this);
            }
            
            if ($this->GetSecurityInfo()->HasDeleteGrant())
            {
                $operation = new LinkOperation($this->GetLocalizerCaptions()->GetMessageString('Delete'), OPERATION_DELETE, $this->dataset, $grid);
                $operation->setUseImage(true);
                $actions->addOperation($operation);
                $operation->OnShow->AddListener('ShowDeleteButtonHandler', $this);
                $operation->SetAdditionalAttribute('data-modal-operation', 'delete');
                $operation->SetAdditionalAttribute('data-delete-handler-name', $this->GetModalGridDeleteHandler());
            }
            
            if ($this->GetSecurityInfo()->HasAddGrant())
            {
                $operation = new LinkOperation($this->GetLocalizerCaptions()->GetMessageString('Copy'), OPERATION_COPY, $this->dataset, $grid);
                $operation->setUseImage(true);
                $actions->addOperation($operation);
            }
        }
    
        protected function AddFieldColumns(Grid $grid, $withDetails = true)
        {
            //
            // View column for numero field
            //
            $column = new TextViewColumn('numero', 'numero', 'Numero', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for data_vencimento field
            //
            $column = new TextViewColumn('data_vencimento', 'data_vencimento', 'Data Vencimento', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor field
            //
            $column = new TextViewColumn('valor', 'valor', 'Valor', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
        }
    
        protected function AddSingleRecordViewColumns(Grid $grid)
        {
            //
            // View column for numero field
            //
            $column = new TextViewColumn('numero', 'numero', 'Numero', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for data_vencimento field
            //
            $column = new TextViewColumn('data_vencimento', 'data_vencimento', 'Data Vencimento', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor field
            //
            $column = new TextViewColumn('valor', 'valor', 'Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
        }
    
        protected function AddEditColumns(Grid $grid)
        {
            //
            // Edit column for numero field
            //
            $editor = new TextEdit('numero_edit');
            $editor->SetMaxLength(15);
            $editColumn = new CustomEditColumn('Numero', 'numero', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for data_vencimento field
            //
            $editor = new TextEdit('data_vencimento_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Data Vencimento', 'data_vencimento', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor field
            //
            $editor = new TextEdit('valor_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor', 'valor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
        }
    
        protected function AddMultiEditColumns(Grid $grid)
        {
            //
            // Edit column for chave field
            //
            $editor = new TextEdit('chave_edit');
            $editor->SetMaxLength(15);
            $editColumn = new CustomEditColumn('Chave', 'chave', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for numero field
            //
            $editor = new TextEdit('numero_edit');
            $editor->SetMaxLength(15);
            $editColumn = new CustomEditColumn('Numero', 'numero', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for data_vencimento field
            //
            $editor = new TextEdit('data_vencimento_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Data Vencimento', 'data_vencimento', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor field
            //
            $editor = new TextEdit('valor_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor', 'valor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
        }
    
        protected function AddInsertColumns(Grid $grid)
        {
            //
            // Edit column for numero field
            //
            $editor = new TextEdit('numero_edit');
            $editor->SetMaxLength(15);
            $editColumn = new CustomEditColumn('Numero', 'numero', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for data_vencimento field
            //
            $editor = new TextEdit('data_vencimento_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Data Vencimento', 'data_vencimento', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor field
            //
            $editor = new TextEdit('valor_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor', 'valor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            $grid->SetShowAddButton(true && $this->GetSecurityInfo()->HasAddGrant());
        }
    
        private function AddMultiUploadColumn(Grid $grid)
        {
    
        }
    
        protected function AddPrintColumns(Grid $grid)
        {
            //
            // View column for numero field
            //
            $column = new TextViewColumn('numero', 'numero', 'Numero', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for data_vencimento field
            //
            $column = new TextViewColumn('data_vencimento', 'data_vencimento', 'Data Vencimento', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor field
            //
            $column = new TextViewColumn('valor', 'valor', 'Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
        }
    
        protected function AddExportColumns(Grid $grid)
        {
            //
            // View column for numero field
            //
            $column = new TextViewColumn('numero', 'numero', 'Numero', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for data_vencimento field
            //
            $column = new TextViewColumn('data_vencimento', 'data_vencimento', 'Data Vencimento', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor field
            //
            $column = new TextViewColumn('valor', 'valor', 'Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
        }
    
        private function AddCompareColumns(Grid $grid)
        {
            //
            // View column for id_duplicatas field
            //
            $column = new TextViewColumn('id_duplicatas', 'id_duplicatas', 'Id Duplicatas', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for numero field
            //
            $column = new TextViewColumn('numero', 'numero', 'Numero', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for data_vencimento field
            //
            $column = new TextViewColumn('data_vencimento', 'data_vencimento', 'Data Vencimento', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor field
            //
            $column = new TextViewColumn('valor', 'valor', 'Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
        }
    
        private function AddCompareHeaderColumns(Grid $grid)
        {
    
        }
    
        public function GetPageDirection()
        {
            return null;
        }
    
        public function isFilterConditionRequired()
        {
            return false;
        }
    
        protected function ApplyCommonColumnEditProperties(CustomEditColumn $column)
        {
            $column->SetDisplaySetToNullCheckBox(false);
            $column->SetDisplaySetToDefaultCheckBox(false);
    		$column->SetVariableContainer($this->GetColumnVariableContainer());
        }
    
        function GetCustomClientScript()
        {
            return ;
        }
        
        function GetOnPageLoadedClientScript()
        {
            return ;
        }
        protected function GetEnableModalGridDelete() { return true; }
    
        protected function CreateGrid()
        {
            $result = new Grid($this, $this->dataset);
            if ($this->GetSecurityInfo()->HasDeleteGrant())
               $result->SetAllowDeleteSelected(true);
            else
               $result->SetAllowDeleteSelected(false);   
            
            ApplyCommonPageSettings($this, $result);
            
            $result->SetUseImagesForActions(true);
            $result->SetUseFixedHeader(false);
            $result->SetShowLineNumbers(false);
            $result->SetViewMode(ViewMode::TABLE);
            $result->setEnableRuntimeCustomization(true);
            $result->setAllowCompare(true);
            $this->AddCompareHeaderColumns($result);
            $this->AddCompareColumns($result);
            $result->setMultiEditAllowed($this->GetSecurityInfo()->HasEditGrant() && false);
            $result->setTableBordered(false);
            $result->setTableCondensed(false);
            
            $result->SetHighlightRowAtHover(false);
            $result->SetWidth('');
            $this->AddOperationsColumns($result);
            $this->AddFieldColumns($result);
            $this->AddSingleRecordViewColumns($result);
            $this->AddEditColumns($result);
            $this->AddMultiEditColumns($result);
            $this->AddInsertColumns($result);
            $this->AddPrintColumns($result);
            $this->AddExportColumns($result);
            $this->AddMultiUploadColumn($result);
    
    
            $this->SetShowPageList(true);
            $this->SetShowTopPageNavigator(true);
            $this->SetShowBottomPageNavigator(true);
            $this->setPrintListAvailable(false);
            $this->setPrintListRecordAvailable(false);
            $this->setPrintOneRecordAvailable(false);
            $this->setAllowPrintSelectedRecords(true);
            $this->setExportListAvailable(array('pdf', 'excel', 'word'));
            $this->setExportSelectedRecordsAvailable(array('pdf', 'excel', 'word', 'xml', 'csv'));
            $this->setExportListRecordAvailable(array());
            $this->setExportOneRecordAvailable(array('pdf', 'excel', 'word'));
    
            return $result;
        }
     
        protected function setClientSideEvents(Grid $grid) {
    
        }
    
        protected function doRegisterHandlers() {
            
            
        }
       
        protected function doCustomRenderColumn($fieldName, $fieldData, $rowData, &$customText, &$handled)
        { 
    
        }
    
        protected function doCustomRenderPrintColumn($fieldName, $fieldData, $rowData, &$customText, &$handled)
        { 
    
        }
    
        protected function doCustomRenderExportColumn($exportType, $fieldName, $fieldData, $rowData, &$customText, &$handled)
        { 
    
        }
    
        protected function doCustomDrawRow($rowData, &$cellFontColor, &$cellFontSize, &$cellBgColor, &$cellItalicAttr, &$cellBoldAttr)
        {
    
        }
    
        protected function doExtendedCustomDrawRow($rowData, &$rowCellStyles, &$rowStyles, &$rowClasses, &$cellClasses)
        {
    
        }
    
        protected function doCustomRenderTotal($totalValue, $aggregate, $columnName, &$customText, &$handled)
        {
    
        }
    
        protected function doCustomDefaultValues(&$values, &$handled) 
        {
    
        }
    
        protected function doCustomCompareColumn($columnName, $valueA, $valueB, &$result)
        {
    
        }
    
        protected function doBeforeInsertRecord($page, &$rowData, $tableName, &$cancel, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doBeforeUpdateRecord($page, $oldRowData, &$rowData, $tableName, &$cancel, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doBeforeDeleteRecord($page, &$rowData, $tableName, &$cancel, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doAfterInsertRecord($page, $rowData, $tableName, &$success, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doAfterUpdateRecord($page, $oldRowData, $rowData, $tableName, &$success, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doAfterDeleteRecord($page, $rowData, $tableName, &$success, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doCustomHTMLHeader($page, &$customHtmlHeaderText)
        { 
    
        }
    
        protected function doGetCustomTemplate($type, $part, $mode, &$result, &$params)
        {
    
        }
    
        protected function doGetCustomExportOptions(Page $page, $exportType, $rowData, &$options)
        {
    
        }
    
        protected function doFileUpload($fieldName, $rowData, &$result, &$accept, $originalFileName, $originalFileExtension, $fileSize, $tempFileName)
        {
    
        }
    
        protected function doPrepareChart(Chart $chart)
        {
    
        }
    
        protected function doPrepareColumnFilter(ColumnFilter $columnFilter)
        {
    
        }
    
        protected function doPrepareFilterBuilder(FilterBuilder $filterBuilder, FixedKeysArray $columns)
        {
    
        }
    
        protected function doGetSelectionFilters(FixedKeysArray $columns, &$result)
        {
    
        }
    
        protected function doGetCustomFormLayout($mode, FixedKeysArray $columns, FormLayout $layout)
        {
    
        }
    
        protected function doGetCustomColumnGroup(FixedKeysArray $columns, ViewColumnGroup $columnGroup)
        {
    
        }
    
        protected function doPageLoaded()
        {
    
        }
    
        protected function doCalculateFields($rowData, $fieldName, &$value)
        {
    
        }
    
        protected function doGetCustomPagePermissions(Page $page, PermissionSet &$permissions, &$handled)
        {
    
        }
    
        protected function doGetCustomRecordPermissions(Page $page, &$usingCondition, $rowData, &$allowEdit, &$allowDelete, &$mergeWithDefault, &$handled)
        {
    
        }
    
    }
    
    
    
    
    // OnBeforePageExecute event handler
    
    
    
    class notas_volumesPage extends DetailPage
    {
        protected function DoBeforeCreate()
        {
            $this->SetTitle('Volumes');
            $this->SetMenuLabel('Volumes');
            $this->SetHeader(GetPagesHeader());
            $this->SetFooter(GetPagesFooter());
    
            $this->dataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`volumes`');
            $this->dataset->addFields(
                array(
                    new IntegerField('id_volumes', true, true, true),
                    new StringField('chave'),
                    new IntegerField('sequencia'),
                    new StringField('quantidade'),
                    new StringField('especie'),
                    new StringField('marca'),
                    new StringField('numero'),
                    new StringField('peso_liquido'),
                    new StringField('peso_bruto'),
                    new StringField('colecao___________________lacres')
                )
            );
        }
    
        protected function DoPrepare() {
    
        }
    
        protected function CreatePageNavigator()
        {
            $result = new CompositePageNavigator($this);
            
            $partitionNavigator = new PageNavigator('pnav', $this, $this->dataset);
            $partitionNavigator->SetRowsPerPage(20);
            $result->AddPageNavigator($partitionNavigator);
            
            return $result;
        }
    
        protected function CreateRssGenerator()
        {
            return null;
        }
    
        protected function setupCharts()
        {
    
        }
    
        protected function getFiltersColumns()
        {
            return array(
                new FilterColumn($this->dataset, 'id_volumes', 'id_volumes', 'Id Volumes'),
                new FilterColumn($this->dataset, 'chave', 'chave', 'Chave'),
                new FilterColumn($this->dataset, 'sequencia', 'sequencia', 'Sequencia'),
                new FilterColumn($this->dataset, 'quantidade', 'quantidade', 'Quantidade'),
                new FilterColumn($this->dataset, 'especie', 'especie', 'Especie'),
                new FilterColumn($this->dataset, 'marca', 'marca', 'Marca'),
                new FilterColumn($this->dataset, 'numero', 'numero', 'Numero'),
                new FilterColumn($this->dataset, 'peso_liquido', 'peso_liquido', 'Peso Liquido kgs'),
                new FilterColumn($this->dataset, 'peso_bruto', 'peso_bruto', 'Peso Bruto kgs'),
                new FilterColumn($this->dataset, 'colecao___________________lacres', 'colecao___________________lacres', 'Colecao                   Lacres')
            );
        }
    
        protected function setupQuickFilter(QuickFilter $quickFilter, FixedKeysArray $columns)
        {
    
        }
    
        protected function setupColumnFilter(ColumnFilter $columnFilter)
        {
    
        }
    
        protected function setupFilterBuilder(FilterBuilder $filterBuilder, FixedKeysArray $columns)
        {
    
        }
    
        protected function AddOperationsColumns(Grid $grid)
        {
            $actions = $grid->getActions();
            $actions->setCaption($this->GetLocalizerCaptions()->GetMessageString('Actions'));
            $actions->setPosition(ActionList::POSITION_LEFT);
            
            if ($this->GetSecurityInfo()->HasViewGrant())
            {
                $operation = new AjaxOperation(OPERATION_VIEW,
                    $this->GetLocalizerCaptions()->GetMessageString('View'),
                    $this->GetLocalizerCaptions()->GetMessageString('View'), $this->dataset,
                    $this->GetModalGridViewHandler(), $grid);
                $operation->setUseImage(true);
                $actions->addOperation($operation);
            }
            
            if ($this->GetSecurityInfo()->HasEditGrant())
            {
                $operation = new AjaxOperation(OPERATION_EDIT,
                    $this->GetLocalizerCaptions()->GetMessageString('Edit'),
                    $this->GetLocalizerCaptions()->GetMessageString('Edit'), $this->dataset,
                    $this->GetGridEditHandler(), $grid);
                $operation->setUseImage(true);
                $actions->addOperation($operation);
                $operation->OnShow->AddListener('ShowEditButtonHandler', $this);
            }
            
            if ($this->GetSecurityInfo()->HasDeleteGrant())
            {
                $operation = new LinkOperation($this->GetLocalizerCaptions()->GetMessageString('Delete'), OPERATION_DELETE, $this->dataset, $grid);
                $operation->setUseImage(true);
                $actions->addOperation($operation);
                $operation->OnShow->AddListener('ShowDeleteButtonHandler', $this);
                $operation->SetAdditionalAttribute('data-modal-operation', 'delete');
                $operation->SetAdditionalAttribute('data-delete-handler-name', $this->GetModalGridDeleteHandler());
            }
        }
    
        protected function AddFieldColumns(Grid $grid, $withDetails = true)
        {
            //
            // View column for chave field
            //
            $column = new TextViewColumn('chave', 'chave', 'Chave', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for sequencia field
            //
            $column = new TextViewColumn('sequencia', 'sequencia', 'Sequencia', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for quantidade field
            //
            $column = new TextViewColumn('quantidade', 'quantidade', 'Quantidade', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for especie field
            //
            $column = new TextViewColumn('especie', 'especie', 'Especie', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for marca field
            //
            $column = new TextViewColumn('marca', 'marca', 'Marca', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for numero field
            //
            $column = new TextViewColumn('numero', 'numero', 'Numero', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for peso_liquido field
            //
            $column = new TextViewColumn('peso_liquido', 'peso_liquido', 'Peso Liquido kgs', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for peso_bruto field
            //
            $column = new TextViewColumn('peso_bruto', 'peso_bruto', 'Peso Bruto kgs', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
        }
    
        protected function AddSingleRecordViewColumns(Grid $grid)
        {
            //
            // View column for chave field
            //
            $column = new TextViewColumn('chave', 'chave', 'Chave', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for sequencia field
            //
            $column = new TextViewColumn('sequencia', 'sequencia', 'Sequencia', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for quantidade field
            //
            $column = new TextViewColumn('quantidade', 'quantidade', 'Quantidade', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for especie field
            //
            $column = new TextViewColumn('especie', 'especie', 'Especie', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for marca field
            //
            $column = new TextViewColumn('marca', 'marca', 'Marca', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for numero field
            //
            $column = new TextViewColumn('numero', 'numero', 'Numero', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for peso_liquido field
            //
            $column = new TextViewColumn('peso_liquido', 'peso_liquido', 'Peso Liquido kgs', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for peso_bruto field
            //
            $column = new TextViewColumn('peso_bruto', 'peso_bruto', 'Peso Bruto kgs', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
        }
    
        protected function AddEditColumns(Grid $grid)
        {
            //
            // Edit column for sequencia field
            //
            $editor = new TextEdit('sequencia_edit');
            $editColumn = new CustomEditColumn('Sequencia', 'sequencia', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for quantidade field
            //
            $editor = new TextEdit('quantidade_edit');
            $editColumn = new CustomEditColumn('Quantidade', 'quantidade', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for especie field
            //
            $editor = new TextEdit('especie_edit');
            $editor->SetMaxLength(50);
            $editColumn = new CustomEditColumn('Especie', 'especie', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for marca field
            //
            $editor = new TextEdit('marca_edit');
            $editor->SetMaxLength(50);
            $editColumn = new CustomEditColumn('Marca', 'marca', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for numero field
            //
            $editor = new TextEdit('numero_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Numero', 'numero', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for peso_liquido field
            //
            $editor = new TextEdit('peso_liquido_edit');
            $editColumn = new CustomEditColumn('Peso Liquido kgs', 'peso_liquido', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for peso_bruto field
            //
            $editor = new TextEdit('peso_bruto_edit');
            $editColumn = new CustomEditColumn('Peso Bruto kgs', 'peso_bruto', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
        }
    
        protected function AddMultiEditColumns(Grid $grid)
        {
            //
            // Edit column for chave field
            //
            $editor = new TextEdit('chave_edit');
            $editor->SetMaxLength(15);
            $editColumn = new CustomEditColumn('Chave', 'chave', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for sequencia field
            //
            $editor = new TextEdit('sequencia_edit');
            $editColumn = new CustomEditColumn('Sequencia', 'sequencia', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for quantidade field
            //
            $editor = new TextEdit('quantidade_edit');
            $editColumn = new CustomEditColumn('Quantidade', 'quantidade', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for especie field
            //
            $editor = new TextEdit('especie_edit');
            $editor->SetMaxLength(50);
            $editColumn = new CustomEditColumn('Especie', 'especie', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for marca field
            //
            $editor = new TextEdit('marca_edit');
            $editor->SetMaxLength(50);
            $editColumn = new CustomEditColumn('Marca', 'marca', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for numero field
            //
            $editor = new TextEdit('numero_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Numero', 'numero', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for peso_liquido field
            //
            $editor = new TextEdit('peso_liquido_edit');
            $editColumn = new CustomEditColumn('Peso Liquido kgs', 'peso_liquido', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for peso_bruto field
            //
            $editor = new TextEdit('peso_bruto_edit');
            $editColumn = new CustomEditColumn('Peso Bruto kgs', 'peso_bruto', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for colecao___________________lacres field
            //
            $editor = new TextEdit('colecao___________________lacres_edit');
            $editor->SetMaxLength(1);
            $editColumn = new CustomEditColumn('Colecao                   Lacres', 'colecao___________________lacres', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
        }
    
        protected function AddInsertColumns(Grid $grid)
        {
            //
            // Edit column for sequencia field
            //
            $editor = new TextEdit('sequencia_edit');
            $editColumn = new CustomEditColumn('Sequencia', 'sequencia', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for quantidade field
            //
            $editor = new TextEdit('quantidade_edit');
            $editColumn = new CustomEditColumn('Quantidade', 'quantidade', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for especie field
            //
            $editor = new TextEdit('especie_edit');
            $editor->SetMaxLength(50);
            $editColumn = new CustomEditColumn('Especie', 'especie', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for marca field
            //
            $editor = new TextEdit('marca_edit');
            $editor->SetMaxLength(50);
            $editColumn = new CustomEditColumn('Marca', 'marca', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for numero field
            //
            $editor = new TextEdit('numero_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Numero', 'numero', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for peso_liquido field
            //
            $editor = new TextEdit('peso_liquido_edit');
            $editColumn = new CustomEditColumn('Peso Liquido kgs', 'peso_liquido', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for peso_bruto field
            //
            $editor = new TextEdit('peso_bruto_edit');
            $editColumn = new CustomEditColumn('Peso Bruto kgs', 'peso_bruto', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            $grid->SetShowAddButton(true && $this->GetSecurityInfo()->HasAddGrant());
        }
    
        private function AddMultiUploadColumn(Grid $grid)
        {
    
        }
    
        protected function AddPrintColumns(Grid $grid)
        {
            //
            // View column for chave field
            //
            $column = new TextViewColumn('chave', 'chave', 'Chave', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for sequencia field
            //
            $column = new TextViewColumn('sequencia', 'sequencia', 'Sequencia', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for quantidade field
            //
            $column = new TextViewColumn('quantidade', 'quantidade', 'Quantidade', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for especie field
            //
            $column = new TextViewColumn('especie', 'especie', 'Especie', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for marca field
            //
            $column = new TextViewColumn('marca', 'marca', 'Marca', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for numero field
            //
            $column = new TextViewColumn('numero', 'numero', 'Numero', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for peso_liquido field
            //
            $column = new TextViewColumn('peso_liquido', 'peso_liquido', 'Peso Liquido kgs', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for peso_bruto field
            //
            $column = new TextViewColumn('peso_bruto', 'peso_bruto', 'Peso Bruto kgs', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
        }
    
        protected function AddExportColumns(Grid $grid)
        {
            //
            // View column for chave field
            //
            $column = new TextViewColumn('chave', 'chave', 'Chave', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for sequencia field
            //
            $column = new TextViewColumn('sequencia', 'sequencia', 'Sequencia', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for quantidade field
            //
            $column = new TextViewColumn('quantidade', 'quantidade', 'Quantidade', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for especie field
            //
            $column = new TextViewColumn('especie', 'especie', 'Especie', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for marca field
            //
            $column = new TextViewColumn('marca', 'marca', 'Marca', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for numero field
            //
            $column = new TextViewColumn('numero', 'numero', 'Numero', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for peso_liquido field
            //
            $column = new TextViewColumn('peso_liquido', 'peso_liquido', 'Peso Liquido kgs', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for peso_bruto field
            //
            $column = new TextViewColumn('peso_bruto', 'peso_bruto', 'Peso Bruto kgs', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
        }
    
        private function AddCompareColumns(Grid $grid)
        {
            //
            // View column for id_volumes field
            //
            $column = new TextViewColumn('id_volumes', 'id_volumes', 'Id Volumes', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for chave field
            //
            $column = new TextViewColumn('chave', 'chave', 'Chave', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for sequencia field
            //
            $column = new TextViewColumn('sequencia', 'sequencia', 'Sequencia', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for quantidade field
            //
            $column = new TextViewColumn('quantidade', 'quantidade', 'Quantidade', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for especie field
            //
            $column = new TextViewColumn('especie', 'especie', 'Especie', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for marca field
            //
            $column = new TextViewColumn('marca', 'marca', 'Marca', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for numero field
            //
            $column = new TextViewColumn('numero', 'numero', 'Numero', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for peso_liquido field
            //
            $column = new TextViewColumn('peso_liquido', 'peso_liquido', 'Peso Liquido kgs', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for peso_bruto field
            //
            $column = new TextViewColumn('peso_bruto', 'peso_bruto', 'Peso Bruto kgs', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for colecao___________________lacres field
            //
            $column = new TextViewColumn('colecao___________________lacres', 'colecao___________________lacres', 'Colecao                   Lacres', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
        }
    
        private function AddCompareHeaderColumns(Grid $grid)
        {
    
        }
    
        public function GetPageDirection()
        {
            return null;
        }
    
        public function isFilterConditionRequired()
        {
            return false;
        }
    
        protected function ApplyCommonColumnEditProperties(CustomEditColumn $column)
        {
            $column->SetDisplaySetToNullCheckBox(false);
            $column->SetDisplaySetToDefaultCheckBox(false);
    		$column->SetVariableContainer($this->GetColumnVariableContainer());
        }
    
        function GetCustomClientScript()
        {
            return ;
        }
        
        function GetOnPageLoadedClientScript()
        {
            return ;
        }
        
        public function GetEnableModalGridInsert() { return true; }
        public function GetEnableModalSingleRecordView() { return true; }
        
        public function GetEnableModalGridEdit() { return true; }
        
        protected function GetEnableModalGridDelete() { return true; }
    
        protected function CreateGrid()
        {
            $result = new Grid($this, $this->dataset);
            if ($this->GetSecurityInfo()->HasDeleteGrant())
               $result->SetAllowDeleteSelected(false);
            else
               $result->SetAllowDeleteSelected(false);   
            
            ApplyCommonPageSettings($this, $result);
            
            $result->SetUseImagesForActions(true);
            $result->SetUseFixedHeader(false);
            $result->SetShowLineNumbers(false);
            $result->SetViewMode(ViewMode::TABLE);
            $result->setEnableRuntimeCustomization(true);
            $result->setAllowCompare(true);
            $this->AddCompareHeaderColumns($result);
            $this->AddCompareColumns($result);
            $result->setMultiEditAllowed($this->GetSecurityInfo()->HasEditGrant() && false);
            $result->setTableBordered(false);
            $result->setTableCondensed(false);
            
            $result->SetHighlightRowAtHover(false);
            $result->SetWidth('');
            $this->AddOperationsColumns($result);
            $this->AddFieldColumns($result);
            $this->AddSingleRecordViewColumns($result);
            $this->AddEditColumns($result);
            $this->AddMultiEditColumns($result);
            $this->AddInsertColumns($result);
            $this->AddPrintColumns($result);
            $this->AddExportColumns($result);
            $this->AddMultiUploadColumn($result);
    
    
            $this->SetShowPageList(true);
            $this->SetShowTopPageNavigator(true);
            $this->SetShowBottomPageNavigator(true);
            $this->setPrintListAvailable(false);
            $this->setPrintListRecordAvailable(false);
            $this->setPrintOneRecordAvailable(false);
            $this->setAllowPrintSelectedRecords(true);
            $this->setExportListAvailable(array('pdf', 'excel', 'word'));
            $this->setExportSelectedRecordsAvailable(array('pdf', 'excel', 'word', 'xml', 'csv'));
            $this->setExportListRecordAvailable(array());
            $this->setExportOneRecordAvailable(array('pdf', 'excel', 'word'));
    
            return $result;
        }
     
        protected function setClientSideEvents(Grid $grid) {
    
        }
    
        protected function doRegisterHandlers() {
            
            
        }
       
        protected function doCustomRenderColumn($fieldName, $fieldData, $rowData, &$customText, &$handled)
        { 
    
        }
    
        protected function doCustomRenderPrintColumn($fieldName, $fieldData, $rowData, &$customText, &$handled)
        { 
    
        }
    
        protected function doCustomRenderExportColumn($exportType, $fieldName, $fieldData, $rowData, &$customText, &$handled)
        { 
    
        }
    
        protected function doCustomDrawRow($rowData, &$cellFontColor, &$cellFontSize, &$cellBgColor, &$cellItalicAttr, &$cellBoldAttr)
        {
    
        }
    
        protected function doExtendedCustomDrawRow($rowData, &$rowCellStyles, &$rowStyles, &$rowClasses, &$cellClasses)
        {
    
        }
    
        protected function doCustomRenderTotal($totalValue, $aggregate, $columnName, &$customText, &$handled)
        {
    
        }
    
        protected function doCustomDefaultValues(&$values, &$handled) 
        {
    
        }
    
        protected function doCustomCompareColumn($columnName, $valueA, $valueB, &$result)
        {
    
        }
    
        protected function doBeforeInsertRecord($page, &$rowData, $tableName, &$cancel, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doBeforeUpdateRecord($page, $oldRowData, &$rowData, $tableName, &$cancel, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doBeforeDeleteRecord($page, &$rowData, $tableName, &$cancel, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doAfterInsertRecord($page, $rowData, $tableName, &$success, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doAfterUpdateRecord($page, $oldRowData, $rowData, $tableName, &$success, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doAfterDeleteRecord($page, $rowData, $tableName, &$success, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doCustomHTMLHeader($page, &$customHtmlHeaderText)
        { 
    
        }
    
        protected function doGetCustomTemplate($type, $part, $mode, &$result, &$params)
        {
    
        }
    
        protected function doGetCustomExportOptions(Page $page, $exportType, $rowData, &$options)
        {
    
        }
    
        protected function doFileUpload($fieldName, $rowData, &$result, &$accept, $originalFileName, $originalFileExtension, $fileSize, $tempFileName)
        {
    
        }
    
        protected function doPrepareChart(Chart $chart)
        {
    
        }
    
        protected function doPrepareColumnFilter(ColumnFilter $columnFilter)
        {
    
        }
    
        protected function doPrepareFilterBuilder(FilterBuilder $filterBuilder, FixedKeysArray $columns)
        {
    
        }
    
        protected function doGetSelectionFilters(FixedKeysArray $columns, &$result)
        {
    
        }
    
        protected function doGetCustomFormLayout($mode, FixedKeysArray $columns, FormLayout $layout)
        {
    
        }
    
        protected function doGetCustomColumnGroup(FixedKeysArray $columns, ViewColumnGroup $columnGroup)
        {
    
        }
    
        protected function doPageLoaded()
        {
    
        }
    
        protected function doCalculateFields($rowData, $fieldName, &$value)
        {
    
        }
    
        protected function doGetCustomPagePermissions(Page $page, PermissionSet &$permissions, &$handled)
        {
    
        }
    
        protected function doGetCustomRecordPermissions(Page $page, &$usingCondition, $rowData, &$allowEdit, &$allowDelete, &$mergeWithDefault, &$handled)
        {
    
        }
    
    }
    
    // OnBeforePageExecute event handler
    
    
    
    class notasPage extends Page
    {
        protected function DoBeforeCreate()
        {
            $this->SetTitle('Notas');
            $this->SetMenuLabel('Caixa de Entrada');
            $this->SetHeader(GetPagesHeader());
            $this->SetFooter(GetPagesFooter());
    
            $this->dataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`notas`');
            $this->dataset->addFields(
                array(
                    new IntegerField('id_notas', true, true, true),
                    new IntegerField('id_licencas'),
                    new StringField('chave'),
                    new IntegerField('sequencia'),
                    new StringField('tipo_nf'),
                    new DateTimeField('dt_inclusao'),
                    new DateTimeField('dt_concluido'),
                    new StringField('st_nota'),
                    new StringField('tx_obs'),
                    new StringField('nm_arquivo_retorno'),
                    new StringField('natureza_operacao'),
                    new StringField('forma_pagamento'),
                    new DateField('data_emissao'),
                    new DateTimeField('data_entrada_saida'),
                    new StringField('tipo_documento'),
                    new StringField('local_destino'),
                    new StringField('finalidade_emissao'),
                    new StringField('consumidor_final'),
                    new StringField('presenca_comprador'),
                    new StringField('colecao____________________notas_referenciadas'),
                    new StringField('colecao____________________pessoas_autorizadas'),
                    new StringField('cnpj_emitente'),
                    new StringField('nome_emitente'),
                    new StringField('nome_fantasia_emitente'),
                    new StringField('logradouro_emitente'),
                    new StringField('numero_emitente'),
                    new StringField('complemento_emitente'),
                    new StringField('bairro_emitente'),
                    new StringField('prestador_codigo_municipio'),
                    new StringField('municipio_emitente'),
                    new StringField('uf_emitente'),
                    new StringField('cep_emitente'),
                    new StringField('telefone_emitente'),
                    new StringField('inscricao_estadual_emitenete'),
                    new StringField('inscricao_estadual_st_emitente'),
                    new StringField('inscricao_municipal_emitente'),
                    new StringField('cnae_emitente'),
                    new StringField('regime_tributario_emitente'),
                    new StringField('cnpj_destinatario'),
                    new StringField('cpf_destinatario'),
                    new StringField('id_estrangeiro_destinatario'),
                    new StringField('nome_destinatario'),
                    new StringField('logradoura_destinatario'),
                    new StringField('numero_destinatario'),
                    new StringField('complemento_destinatario'),
                    new StringField('bairro_destinatario'),
                    new StringField('codigo_municipio_destinatario'),
                    new StringField('municipio_destinatario'),
                    new StringField('uf_destinatario'),
                    new StringField('cep_destinatario'),
                    new StringField('pais_destinatario'),
                    new StringField('telefone_destinatario'),
                    new StringField('indicador_inscricao_estadual_destinatario'),
                    new StringField('inscricao_estadual_destinatario'),
                    new StringField('inscricao_suframa_destinatario'),
                    new StringField('email_destinatario'),
                    new StringField('inscricao_municipal_destinatario'),
                    new StringField('cnpj_retirada'),
                    new StringField('cpf_retirada'),
                    new StringField('logradoura_retirada'),
                    new StringField('numero_retirada'),
                    new StringField('complemento_retirada'),
                    new StringField('bairro_retirada'),
                    new StringField('codigo_municipio_retirada'),
                    new StringField('municipio_retirada'),
                    new StringField('uf_retirada'),
                    new StringField('cnpj_entrega'),
                    new StringField('cpf_entrega'),
                    new StringField('logradouro_entrega'),
                    new StringField('numero_entrega'),
                    new StringField('complemento_entrega'),
                    new StringField('bairro_entrega'),
                    new StringField('codigo_municipio_entrega'),
                    new StringField('municipio_entrega'),
                    new StringField('uf_entrega'),
                    new StringField('colecao____________________itens'),
                    new StringField('icms_base_calculo'),
                    new StringField('icms_valor_total'),
                    new StringField('icms_valor_total_desonerado'),
                    new StringField('icms_base_calculo_st'),
                    new StringField('icms_valor_total_st'),
                    new StringField('valor_produtos'),
                    new StringField('valor_frete'),
                    new StringField('valor_seguro'),
                    new StringField('valor_desconto'),
                    new StringField('valor_total_ii'),
                    new StringField('valor_ipi'),
                    new StringField('valor_pis'),
                    new StringField('valor_cofins'),
                    new StringField('valor_outras_despesas'),
                    new StringField('valor_total'),
                    new StringField('valor_total_servicos'),
                    new StringField('base_issqn'),
                    new StringField('valor_pis_servico'),
                    new StringField('data_prestacao_servico'),
                    new StringField('valor_total_deducao_base_calculo'),
                    new StringField('valor_total_outras_retencoes'),
                    new StringField('valor_total_desconto_incondicionado'),
                    new StringField('valor_total_valor_condicionado'),
                    new StringField('valor_total_retencao_iss'),
                    new StringField('codigo_regime_especial_tributacao'),
                    new StringField('valor_retido_pis'),
                    new StringField('valor_retido_cofins'),
                    new StringField('valor_retido_csll'),
                    new StringField('base_calculo_irrf'),
                    new StringField('valor_retido_irrf'),
                    new StringField('prev_social_base_calculo'),
                    new StringField('prev_social_valor_retido'),
                    new StringField('modalidade_frete'),
                    new StringField('cnpj_transportador'),
                    new StringField('cpf_transportador'),
                    new StringField('nome_transportador'),
                    new StringField('inscricao_estadual_transportador'),
                    new StringField('endereco_transportador'),
                    new StringField('municipio_transportador'),
                    new StringField('uf_transportador'),
                    new StringField('transporte_icms_servico'),
                    new StringField('transporte_icms_base_servico'),
                    new StringField('transporte_icms_aliquota'),
                    new StringField('transporte_icms_valor'),
                    new StringField('transporte_icms_cfop'),
                    new StringField('transporte_icms_codigo_municipio'),
                    new StringField('veiculo_placa'),
                    new StringField('veiculo_uf'),
                    new StringField('veiculo_rntc'),
                    new StringField('veiculo_identificacao_vagao'),
                    new StringField('veiculo_identificacao_balsa'),
                    new StringField('colecao____________________volumes'),
                    new StringField('numero_fatura'),
                    new StringField('valor_original_fatura'),
                    new StringField('valor_desconto_fatura'),
                    new StringField('valor_liquido_fatura'),
                    new StringField('colecao____________________duplicatas'),
                    new StringField('informacoes_adicionais_contribuinte'),
                    new StringField('uf_local_embarque'),
                    new StringField('local_embarque'),
                    new StringField('local_despacho'),
                    new StringField('colecao____________________formas_pagamento'),
                    new StringField('operacao'),
                    new StringField('tx_cancelamento'),
                    new StringField('tx_correcao'),
                    new IntegerField('id_pedido'),
                    new IntegerField('numero_nf')
                )
            );
            $this->dataset->AddLookupField('natureza_operacao', '(select id_codigo_cfop,descricao from cfop group by descricao order by descricao)', new StringField('descricao'), new StringField('descricao', false, false, false, false, 'natureza_operacao_descricao', 'natureza_operacao_descricao_NOP'), 'natureza_operacao_descricao_NOP');
            $this->dataset->AddLookupField('forma_pagamento', 'forma_pagamento', new StringField('cd_tabela'), new StringField('ds_tabela', false, false, false, false, 'forma_pagamento_ds_tabela', 'forma_pagamento_ds_tabela_forma_pagamento'), 'forma_pagamento_ds_tabela_forma_pagamento');
            $this->dataset->AddLookupField('tipo_documento', 'tipo_documento', new StringField('cd_tabela'), new StringField('ds_tabela', false, false, false, false, 'tipo_documento_ds_tabela', 'tipo_documento_ds_tabela_tipo_documento'), 'tipo_documento_ds_tabela_tipo_documento');
            $this->dataset->AddLookupField('local_destino', 'local_destino', new StringField('cd_tabela'), new StringField('ds_tabela', false, false, false, false, 'local_destino_ds_tabela', 'local_destino_ds_tabela_local_destino'), 'local_destino_ds_tabela_local_destino');
            $this->dataset->AddLookupField('finalidade_emissao', 'finalidade_emissao', new StringField('cd_tabela'), new StringField('ds_tabela', false, false, false, false, 'finalidade_emissao_ds_tabela', 'finalidade_emissao_ds_tabela_finalidade_emissao'), 'finalidade_emissao_ds_tabela_finalidade_emissao');
            $this->dataset->AddLookupField('consumidor_final', 'consumidor_final', new StringField('cd_tabela'), new StringField('ds_tabela', false, false, false, false, 'consumidor_final_ds_tabela', 'consumidor_final_ds_tabela_consumidor_final'), 'consumidor_final_ds_tabela_consumidor_final');
            $this->dataset->AddLookupField('presenca_comprador', 'presenca_comprador', new StringField('cd_tabela'), new StringField('ds_tabela', false, false, false, false, 'presenca_comprador_ds_tabela', 'presenca_comprador_ds_tabela_presenca_comprador'), 'presenca_comprador_ds_tabela_presenca_comprador');
            $this->dataset->AddLookupField('regime_tributario_emitente', 'regime_tributario', new StringField('cd_tabela'), new StringField('ds_tabela', false, false, false, false, 'regime_tributario_emitente_ds_tabela', 'regime_tributario_emitente_ds_tabela_regime_tributario'), 'regime_tributario_emitente_ds_tabela_regime_tributario');
            $this->dataset->AddLookupField('codigo_regime_especial_tributacao', 'codigo_regime_especial_tributacao', new StringField('cd_tabela'), new StringField('ds_tabela', false, false, false, false, 'codigo_regime_especial_tributacao_ds_tabela', 'codigo_regime_especial_tributacao_ds_tabela_codigo_regime_especial_tributacao'), 'codigo_regime_especial_tributacao_ds_tabela_codigo_regime_especial_tributacao');
            $this->dataset->AddLookupField('modalidade_frete', 'modalidade_frete', new StringField('cd_tabela'), new StringField('ds_tabela', false, false, false, false, 'modalidade_frete_ds_tabela', 'modalidade_frete_ds_tabela_modalidade_frete'), 'modalidade_frete_ds_tabela_modalidade_frete');
            $this->dataset->AddLookupField('transporte_icms_cfop', 'transporte_icms_cfop', new StringField('cd_tabela'), new StringField('ds_tabela', false, false, false, false, 'transporte_icms_cfop_ds_tabela', 'transporte_icms_cfop_ds_tabela_transporte_icms_cfop'), 'transporte_icms_cfop_ds_tabela_transporte_icms_cfop');
            $this->dataset->AddCustomCondition(EnvVariablesUtils::EvaluateVariableTemplate($this->GetColumnVariableContainer(), 'id_licencas=%CURRENT_USER_ID% and (st_nota=\'A\' or st_nota=\'N\' or st_nota=\'E\')'));
        }
    
        protected function DoPrepare() {
    
        }
    
        protected function CreatePageNavigator()
        {
            $result = new CompositePageNavigator($this);
            
            $partitionNavigator = new PageNavigator('pnav', $this, $this->dataset);
            $partitionNavigator->SetRowsPerPage(20);
            $result->AddPageNavigator($partitionNavigator);
            
            return $result;
        }
    
        protected function CreateRssGenerator()
        {
            return null;
        }
    
        protected function setupCharts()
        {
    
        }
    
        protected function getFiltersColumns()
        {
            return array(
                new FilterColumn($this->dataset, 'id_notas', 'id_notas', 'Id Notas'),
                new FilterColumn($this->dataset, 'id_licencas', 'id_licencas', 'Id Licencas'),
                new FilterColumn($this->dataset, 'chave', 'chave', 'Chave'),
                new FilterColumn($this->dataset, 'sequencia', 'sequencia', 'Sequencia'),
                new FilterColumn($this->dataset, 'tipo_nf', 'tipo_nf', 'Tipo Nf'),
                new FilterColumn($this->dataset, 'dt_inclusao', 'dt_inclusao', 'Data Inclusão'),
                new FilterColumn($this->dataset, 'dt_concluido', 'dt_concluido', 'Data Concluído'),
                new FilterColumn($this->dataset, 'st_nota', 'st_nota', 'Status Nota'),
                new FilterColumn($this->dataset, 'tx_obs', 'tx_obs', 'Ocorrências da NF'),
                new FilterColumn($this->dataset, 'nm_arquivo_retorno', 'nm_arquivo_retorno', 'Nm Arquivo Retorno'),
                new FilterColumn($this->dataset, 'natureza_operacao', 'natureza_operacao_descricao', 'Natureza Operação'),
                new FilterColumn($this->dataset, 'forma_pagamento', 'forma_pagamento_ds_tabela', 'Forma Pagamento'),
                new FilterColumn($this->dataset, 'data_emissao', 'data_emissao', 'Data Emissão'),
                new FilterColumn($this->dataset, 'data_entrada_saida', 'data_entrada_saida', 'Data Entrada Saida'),
                new FilterColumn($this->dataset, 'tipo_documento', 'tipo_documento_ds_tabela', 'Tipo Documento'),
                new FilterColumn($this->dataset, 'local_destino', 'local_destino_ds_tabela', 'Local Destino'),
                new FilterColumn($this->dataset, 'finalidade_emissao', 'finalidade_emissao_ds_tabela', 'Finalidade Emissao'),
                new FilterColumn($this->dataset, 'consumidor_final', 'consumidor_final_ds_tabela', 'Consumidor Final'),
                new FilterColumn($this->dataset, 'presenca_comprador', 'presenca_comprador_ds_tabela', 'Presenca Comprador'),
                new FilterColumn($this->dataset, 'colecao____________________notas_referenciadas', 'colecao____________________notas_referenciadas', 'Colecao                    Notas Referenciadas'),
                new FilterColumn($this->dataset, 'colecao____________________pessoas_autorizadas', 'colecao____________________pessoas_autorizadas', 'Colecao                    Pessoas Autorizadas'),
                new FilterColumn($this->dataset, 'cnpj_emitente', 'cnpj_emitente', 'Cnpj Emitente'),
                new FilterColumn($this->dataset, 'nome_emitente', 'nome_emitente', 'Nome Emitente'),
                new FilterColumn($this->dataset, 'nome_fantasia_emitente', 'nome_fantasia_emitente', 'Nome Fantasia Emitente'),
                new FilterColumn($this->dataset, 'logradouro_emitente', 'logradouro_emitente', 'Logradouro Emitente'),
                new FilterColumn($this->dataset, 'numero_emitente', 'numero_emitente', 'Numero Emitente'),
                new FilterColumn($this->dataset, 'complemento_emitente', 'complemento_emitente', 'Complemento Emitente'),
                new FilterColumn($this->dataset, 'bairro_emitente', 'bairro_emitente', 'Bairro Emitente'),
                new FilterColumn($this->dataset, 'prestador_codigo_municipio', 'prestador_codigo_municipio', 'Prestador Codigo Municipio'),
                new FilterColumn($this->dataset, 'municipio_emitente', 'municipio_emitente', 'Municipio Emitente'),
                new FilterColumn($this->dataset, 'uf_emitente', 'uf_emitente', 'Uf Emitente'),
                new FilterColumn($this->dataset, 'cep_emitente', 'cep_emitente', 'Cep Emitente'),
                new FilterColumn($this->dataset, 'telefone_emitente', 'telefone_emitente', 'Telefone Emitente'),
                new FilterColumn($this->dataset, 'inscricao_estadual_emitenete', 'inscricao_estadual_emitenete', 'Inscricao Estadual Emitenete'),
                new FilterColumn($this->dataset, 'inscricao_estadual_st_emitente', 'inscricao_estadual_st_emitente', 'Inscricao Estadual St Emitente'),
                new FilterColumn($this->dataset, 'inscricao_municipal_emitente', 'inscricao_municipal_emitente', 'Inscricao Municipal Emitente'),
                new FilterColumn($this->dataset, 'cnae_emitente', 'cnae_emitente', 'Cnae Emitente'),
                new FilterColumn($this->dataset, 'regime_tributario_emitente', 'regime_tributario_emitente_ds_tabela', 'Regime Tributario Emitente'),
                new FilterColumn($this->dataset, 'cnpj_destinatario', 'cnpj_destinatario', 'Cnpj Destinatario'),
                new FilterColumn($this->dataset, 'cpf_destinatario', 'cpf_destinatario', 'Cpf Destinatario'),
                new FilterColumn($this->dataset, 'id_estrangeiro_destinatario', 'id_estrangeiro_destinatario', 'Id Estrangeiro Destinatario'),
                new FilterColumn($this->dataset, 'nome_destinatario', 'nome_destinatario', 'Nome Destinatario'),
                new FilterColumn($this->dataset, 'logradoura_destinatario', 'logradoura_destinatario', 'Logradoura Destinatario'),
                new FilterColumn($this->dataset, 'numero_destinatario', 'numero_destinatario', 'Numero Destinatario'),
                new FilterColumn($this->dataset, 'complemento_destinatario', 'complemento_destinatario', 'Complemento Destinatario'),
                new FilterColumn($this->dataset, 'bairro_destinatario', 'bairro_destinatario', 'Bairro Destinatario'),
                new FilterColumn($this->dataset, 'codigo_municipio_destinatario', 'codigo_municipio_destinatario', 'Codigo Municipio Destinatario'),
                new FilterColumn($this->dataset, 'municipio_destinatario', 'municipio_destinatario', 'Municipio Destinatario'),
                new FilterColumn($this->dataset, 'uf_destinatario', 'uf_destinatario', 'Uf Destinatario'),
                new FilterColumn($this->dataset, 'cep_destinatario', 'cep_destinatario', 'Cep Destinatario'),
                new FilterColumn($this->dataset, 'pais_destinatario', 'pais_destinatario', 'Pais Destinatario'),
                new FilterColumn($this->dataset, 'telefone_destinatario', 'telefone_destinatario', 'Telefone Destinatario'),
                new FilterColumn($this->dataset, 'indicador_inscricao_estadual_destinatario', 'indicador_inscricao_estadual_destinatario', 'Indicador Inscricao Estadual Destinatario'),
                new FilterColumn($this->dataset, 'inscricao_estadual_destinatario', 'inscricao_estadual_destinatario', 'Inscricao Estadual Destinatario'),
                new FilterColumn($this->dataset, 'inscricao_suframa_destinatario', 'inscricao_suframa_destinatario', 'Inscricao Suframa Destinatario'),
                new FilterColumn($this->dataset, 'email_destinatario', 'email_destinatario', 'Email Destinatario'),
                new FilterColumn($this->dataset, 'inscricao_municipal_destinatario', 'inscricao_municipal_destinatario', 'Inscricao Municipal Destinatario'),
                new FilterColumn($this->dataset, 'cnpj_retirada', 'cnpj_retirada', 'Cnpj Retirada'),
                new FilterColumn($this->dataset, 'cpf_retirada', 'cpf_retirada', 'Cpf Retirada'),
                new FilterColumn($this->dataset, 'logradoura_retirada', 'logradoura_retirada', 'Logradoura Retirada'),
                new FilterColumn($this->dataset, 'numero_retirada', 'numero_retirada', 'Numero Retirada'),
                new FilterColumn($this->dataset, 'complemento_retirada', 'complemento_retirada', 'Complemento Retirada'),
                new FilterColumn($this->dataset, 'bairro_retirada', 'bairro_retirada', 'Bairro Retirada'),
                new FilterColumn($this->dataset, 'codigo_municipio_retirada', 'codigo_municipio_retirada', 'Codigo Municipio Retirada'),
                new FilterColumn($this->dataset, 'municipio_retirada', 'municipio_retirada', 'Municipio Retirada'),
                new FilterColumn($this->dataset, 'uf_retirada', 'uf_retirada', 'Uf Retirada'),
                new FilterColumn($this->dataset, 'cnpj_entrega', 'cnpj_entrega', 'Cnpj Entrega'),
                new FilterColumn($this->dataset, 'cpf_entrega', 'cpf_entrega', 'Cpf Entrega'),
                new FilterColumn($this->dataset, 'logradouro_entrega', 'logradouro_entrega', 'Logradouro Entrega'),
                new FilterColumn($this->dataset, 'numero_entrega', 'numero_entrega', 'Numero Entrega'),
                new FilterColumn($this->dataset, 'complemento_entrega', 'complemento_entrega', 'Complemento Entrega'),
                new FilterColumn($this->dataset, 'bairro_entrega', 'bairro_entrega', 'Bairro Entrega'),
                new FilterColumn($this->dataset, 'codigo_municipio_entrega', 'codigo_municipio_entrega', 'Codigo Municipio Entrega'),
                new FilterColumn($this->dataset, 'municipio_entrega', 'municipio_entrega', 'Municipio Entrega'),
                new FilterColumn($this->dataset, 'uf_entrega', 'uf_entrega', 'Uf Entrega'),
                new FilterColumn($this->dataset, 'colecao____________________itens', 'colecao____________________itens', 'Colecao                    Itens'),
                new FilterColumn($this->dataset, 'icms_base_calculo', 'icms_base_calculo', 'Icms Base Calculo'),
                new FilterColumn($this->dataset, 'icms_valor_total', 'icms_valor_total', 'Icms Valor Total'),
                new FilterColumn($this->dataset, 'icms_valor_total_desonerado', 'icms_valor_total_desonerado', 'Icms Valor Total Desonerado'),
                new FilterColumn($this->dataset, 'icms_base_calculo_st', 'icms_base_calculo_st', 'Icms Base Calculo St'),
                new FilterColumn($this->dataset, 'icms_valor_total_st', 'icms_valor_total_st', 'Icms Valor Total St'),
                new FilterColumn($this->dataset, 'valor_produtos', 'valor_produtos', 'Valor Produtos'),
                new FilterColumn($this->dataset, 'valor_frete', 'valor_frete', 'Valor Frete'),
                new FilterColumn($this->dataset, 'valor_seguro', 'valor_seguro', 'Valor Seguro'),
                new FilterColumn($this->dataset, 'valor_desconto', 'valor_desconto', 'Valor Desconto'),
                new FilterColumn($this->dataset, 'valor_total_ii', 'valor_total_ii', 'Valor Total Ii'),
                new FilterColumn($this->dataset, 'valor_ipi', 'valor_ipi', 'Valor Ipi'),
                new FilterColumn($this->dataset, 'valor_pis', 'valor_pis', 'Valor Pis'),
                new FilterColumn($this->dataset, 'valor_cofins', 'valor_cofins', 'Valor Cofins'),
                new FilterColumn($this->dataset, 'valor_outras_despesas', 'valor_outras_despesas', 'Valor Outras Despesas'),
                new FilterColumn($this->dataset, 'valor_total', 'valor_total', 'Valor Total'),
                new FilterColumn($this->dataset, 'valor_total_servicos', 'valor_total_servicos', 'Valor Total Servicos'),
                new FilterColumn($this->dataset, 'base_issqn', 'base_issqn', 'Base Issqn'),
                new FilterColumn($this->dataset, 'valor_pis_servico', 'valor_pis_servico', 'Valor Pis Servico'),
                new FilterColumn($this->dataset, 'data_prestacao_servico', 'data_prestacao_servico', 'Data Prestacao Servico'),
                new FilterColumn($this->dataset, 'valor_total_deducao_base_calculo', 'valor_total_deducao_base_calculo', 'Valor Total Deducao Base Calculo'),
                new FilterColumn($this->dataset, 'valor_total_outras_retencoes', 'valor_total_outras_retencoes', 'Valor Total Outras Retencoes'),
                new FilterColumn($this->dataset, 'valor_total_desconto_incondicionado', 'valor_total_desconto_incondicionado', 'Valor Total Desconto Incondicionado'),
                new FilterColumn($this->dataset, 'valor_total_valor_condicionado', 'valor_total_valor_condicionado', 'Valor Total Valor Condicionado'),
                new FilterColumn($this->dataset, 'valor_total_retencao_iss', 'valor_total_retencao_iss', 'Valor Total Retencao Iss'),
                new FilterColumn($this->dataset, 'codigo_regime_especial_tributacao', 'codigo_regime_especial_tributacao_ds_tabela', 'Codigo Regime Especial Tributacao'),
                new FilterColumn($this->dataset, 'valor_retido_pis', 'valor_retido_pis', 'Valor Retido Pis'),
                new FilterColumn($this->dataset, 'valor_retido_cofins', 'valor_retido_cofins', 'Valor Retido Cofins'),
                new FilterColumn($this->dataset, 'valor_retido_csll', 'valor_retido_csll', 'Valor Retido Csll'),
                new FilterColumn($this->dataset, 'base_calculo_irrf', 'base_calculo_irrf', 'Base Calculo Irrf'),
                new FilterColumn($this->dataset, 'valor_retido_irrf', 'valor_retido_irrf', 'Valor Retido Irrf'),
                new FilterColumn($this->dataset, 'prev_social_base_calculo', 'prev_social_base_calculo', 'Prev Social Base Calculo'),
                new FilterColumn($this->dataset, 'prev_social_valor_retido', 'prev_social_valor_retido', 'Prev Social Valor Retido'),
                new FilterColumn($this->dataset, 'modalidade_frete', 'modalidade_frete_ds_tabela', 'Modalidade Frete'),
                new FilterColumn($this->dataset, 'cnpj_transportador', 'cnpj_transportador', 'Cnpj Transportador'),
                new FilterColumn($this->dataset, 'cpf_transportador', 'cpf_transportador', 'Cpf Transportador'),
                new FilterColumn($this->dataset, 'nome_transportador', 'nome_transportador', 'Nome Transportador'),
                new FilterColumn($this->dataset, 'inscricao_estadual_transportador', 'inscricao_estadual_transportador', 'Inscricao Estadual Transportador'),
                new FilterColumn($this->dataset, 'endereco_transportador', 'endereco_transportador', 'Endereco Transportador'),
                new FilterColumn($this->dataset, 'municipio_transportador', 'municipio_transportador', 'Municipio Transportador'),
                new FilterColumn($this->dataset, 'uf_transportador', 'uf_transportador', 'Uf Transportador'),
                new FilterColumn($this->dataset, 'transporte_icms_servico', 'transporte_icms_servico', 'Transporte Icms Servico'),
                new FilterColumn($this->dataset, 'transporte_icms_base_servico', 'transporte_icms_base_servico', 'Transporte Icms Base Servico'),
                new FilterColumn($this->dataset, 'transporte_icms_aliquota', 'transporte_icms_aliquota', 'Transporte Icms Aliquota'),
                new FilterColumn($this->dataset, 'transporte_icms_valor', 'transporte_icms_valor', 'Transporte Icms Valor'),
                new FilterColumn($this->dataset, 'transporte_icms_cfop', 'transporte_icms_cfop_ds_tabela', 'Transporte Icms Cfop'),
                new FilterColumn($this->dataset, 'transporte_icms_codigo_municipio', 'transporte_icms_codigo_municipio', 'Transporte Icms Codigo Municipio'),
                new FilterColumn($this->dataset, 'veiculo_placa', 'veiculo_placa', 'Veiculo Placa'),
                new FilterColumn($this->dataset, 'veiculo_uf', 'veiculo_uf', 'Veiculo Uf'),
                new FilterColumn($this->dataset, 'veiculo_rntc', 'veiculo_rntc', 'Veiculo Rntc'),
                new FilterColumn($this->dataset, 'veiculo_identificacao_vagao', 'veiculo_identificacao_vagao', 'Veiculo Identificacao Vagao'),
                new FilterColumn($this->dataset, 'veiculo_identificacao_balsa', 'veiculo_identificacao_balsa', 'Veiculo Identificacao Balsa'),
                new FilterColumn($this->dataset, 'colecao____________________volumes', 'colecao____________________volumes', 'Colecao                    Volumes'),
                new FilterColumn($this->dataset, 'numero_fatura', 'numero_fatura', 'Numero Fatura'),
                new FilterColumn($this->dataset, 'valor_original_fatura', 'valor_original_fatura', 'Valor Original Fatura'),
                new FilterColumn($this->dataset, 'valor_desconto_fatura', 'valor_desconto_fatura', 'Valor Desconto Fatura'),
                new FilterColumn($this->dataset, 'valor_liquido_fatura', 'valor_liquido_fatura', 'Valor Liquido Fatura'),
                new FilterColumn($this->dataset, 'colecao____________________duplicatas', 'colecao____________________duplicatas', 'Colecao                    Duplicatas'),
                new FilterColumn($this->dataset, 'informacoes_adicionais_contribuinte', 'informacoes_adicionais_contribuinte', 'Informacoes Adicionais Contribuinte'),
                new FilterColumn($this->dataset, 'uf_local_embarque', 'uf_local_embarque', 'Uf Local Embarque'),
                new FilterColumn($this->dataset, 'local_embarque', 'local_embarque', 'Local Embarque'),
                new FilterColumn($this->dataset, 'local_despacho', 'local_despacho', 'Local Despacho'),
                new FilterColumn($this->dataset, 'colecao____________________formas_pagamento', 'colecao____________________formas_pagamento', 'Colecao                    Formas Pagamento'),
                new FilterColumn($this->dataset, 'operacao', 'operacao', 'Operacao'),
                new FilterColumn($this->dataset, 'tx_cancelamento', 'tx_cancelamento', 'Tx Cancelamento'),
                new FilterColumn($this->dataset, 'tx_correcao', 'tx_correcao', 'Tx Correcao'),
                new FilterColumn($this->dataset, 'id_pedido', 'id_pedido', 'Id Pedido'),
                new FilterColumn($this->dataset, 'numero_nf', 'numero_nf', 'Numero Nf')
            );
        }
    
        protected function setupQuickFilter(QuickFilter $quickFilter, FixedKeysArray $columns)
        {
            $quickFilter
                ->addColumn($columns['chave'])
                ->addColumn($columns['dt_inclusao'])
                ->addColumn($columns['st_nota'])
                ->addColumn($columns['tx_obs'])
                ->addColumn($columns['natureza_operacao'])
                ->addColumn($columns['forma_pagamento'])
                ->addColumn($columns['data_emissao'])
                ->addColumn($columns['data_entrada_saida'])
                ->addColumn($columns['tipo_documento'])
                ->addColumn($columns['local_destino'])
                ->addColumn($columns['finalidade_emissao'])
                ->addColumn($columns['consumidor_final'])
                ->addColumn($columns['presenca_comprador'])
                ->addColumn($columns['regime_tributario_emitente'])
                ->addColumn($columns['cnpj_destinatario'])
                ->addColumn($columns['cpf_destinatario'])
                ->addColumn($columns['id_estrangeiro_destinatario'])
                ->addColumn($columns['nome_destinatario'])
                ->addColumn($columns['logradoura_destinatario'])
                ->addColumn($columns['numero_destinatario'])
                ->addColumn($columns['complemento_destinatario'])
                ->addColumn($columns['bairro_destinatario'])
                ->addColumn($columns['codigo_municipio_destinatario'])
                ->addColumn($columns['municipio_destinatario'])
                ->addColumn($columns['uf_destinatario'])
                ->addColumn($columns['cep_destinatario'])
                ->addColumn($columns['pais_destinatario'])
                ->addColumn($columns['telefone_destinatario'])
                ->addColumn($columns['indicador_inscricao_estadual_destinatario'])
                ->addColumn($columns['inscricao_estadual_destinatario'])
                ->addColumn($columns['inscricao_suframa_destinatario'])
                ->addColumn($columns['email_destinatario'])
                ->addColumn($columns['inscricao_municipal_destinatario'])
                ->addColumn($columns['cnpj_retirada'])
                ->addColumn($columns['cpf_retirada'])
                ->addColumn($columns['logradoura_retirada'])
                ->addColumn($columns['numero_retirada'])
                ->addColumn($columns['complemento_retirada'])
                ->addColumn($columns['bairro_retirada'])
                ->addColumn($columns['codigo_municipio_retirada'])
                ->addColumn($columns['municipio_retirada'])
                ->addColumn($columns['uf_retirada'])
                ->addColumn($columns['cnpj_entrega'])
                ->addColumn($columns['cpf_entrega'])
                ->addColumn($columns['logradouro_entrega'])
                ->addColumn($columns['numero_entrega'])
                ->addColumn($columns['complemento_entrega'])
                ->addColumn($columns['bairro_entrega'])
                ->addColumn($columns['codigo_municipio_entrega'])
                ->addColumn($columns['municipio_entrega'])
                ->addColumn($columns['uf_entrega'])
                ->addColumn($columns['icms_base_calculo'])
                ->addColumn($columns['icms_valor_total'])
                ->addColumn($columns['icms_valor_total_desonerado'])
                ->addColumn($columns['icms_base_calculo_st'])
                ->addColumn($columns['icms_valor_total_st'])
                ->addColumn($columns['valor_produtos'])
                ->addColumn($columns['valor_frete'])
                ->addColumn($columns['valor_seguro'])
                ->addColumn($columns['valor_desconto'])
                ->addColumn($columns['valor_total_ii'])
                ->addColumn($columns['valor_ipi'])
                ->addColumn($columns['valor_pis'])
                ->addColumn($columns['valor_cofins'])
                ->addColumn($columns['valor_outras_despesas'])
                ->addColumn($columns['valor_total'])
                ->addColumn($columns['valor_total_servicos'])
                ->addColumn($columns['base_issqn'])
                ->addColumn($columns['valor_pis_servico'])
                ->addColumn($columns['data_prestacao_servico'])
                ->addColumn($columns['valor_total_deducao_base_calculo'])
                ->addColumn($columns['valor_total_outras_retencoes'])
                ->addColumn($columns['valor_total_desconto_incondicionado'])
                ->addColumn($columns['valor_total_valor_condicionado'])
                ->addColumn($columns['valor_total_retencao_iss'])
                ->addColumn($columns['codigo_regime_especial_tributacao'])
                ->addColumn($columns['valor_retido_pis'])
                ->addColumn($columns['valor_retido_cofins'])
                ->addColumn($columns['valor_retido_csll'])
                ->addColumn($columns['base_calculo_irrf'])
                ->addColumn($columns['valor_retido_irrf'])
                ->addColumn($columns['prev_social_base_calculo'])
                ->addColumn($columns['prev_social_valor_retido'])
                ->addColumn($columns['modalidade_frete'])
                ->addColumn($columns['cnpj_transportador'])
                ->addColumn($columns['cpf_transportador'])
                ->addColumn($columns['nome_transportador'])
                ->addColumn($columns['inscricao_estadual_transportador'])
                ->addColumn($columns['endereco_transportador'])
                ->addColumn($columns['municipio_transportador'])
                ->addColumn($columns['uf_transportador'])
                ->addColumn($columns['transporte_icms_servico'])
                ->addColumn($columns['transporte_icms_base_servico'])
                ->addColumn($columns['transporte_icms_aliquota'])
                ->addColumn($columns['transporte_icms_valor'])
                ->addColumn($columns['transporte_icms_cfop'])
                ->addColumn($columns['transporte_icms_codigo_municipio'])
                ->addColumn($columns['veiculo_placa'])
                ->addColumn($columns['veiculo_uf'])
                ->addColumn($columns['veiculo_rntc'])
                ->addColumn($columns['veiculo_identificacao_vagao'])
                ->addColumn($columns['veiculo_identificacao_balsa'])
                ->addColumn($columns['numero_fatura'])
                ->addColumn($columns['valor_original_fatura'])
                ->addColumn($columns['valor_desconto_fatura'])
                ->addColumn($columns['valor_liquido_fatura'])
                ->addColumn($columns['informacoes_adicionais_contribuinte'])
                ->addColumn($columns['uf_local_embarque'])
                ->addColumn($columns['local_embarque'])
                ->addColumn($columns['local_despacho'])
                ->addColumn($columns['tx_cancelamento'])
                ->addColumn($columns['tx_correcao'])
                ->addColumn($columns['id_pedido'])
                ->addColumn($columns['numero_nf']);
        }
    
        protected function setupColumnFilter(ColumnFilter $columnFilter)
        {
            $columnFilter
                ->setOptionsFor('dt_inclusao')
                ->setOptionsFor('natureza_operacao')
                ->setOptionsFor('forma_pagamento')
                ->setOptionsFor('data_emissao')
                ->setOptionsFor('data_entrada_saida')
                ->setOptionsFor('tipo_documento')
                ->setOptionsFor('local_destino')
                ->setOptionsFor('finalidade_emissao')
                ->setOptionsFor('consumidor_final')
                ->setOptionsFor('presenca_comprador')
                ->setOptionsFor('regime_tributario_emitente')
                ->setOptionsFor('indicador_inscricao_estadual_destinatario')
                ->setOptionsFor('codigo_regime_especial_tributacao')
                ->setOptionsFor('modalidade_frete')
                ->setOptionsFor('transporte_icms_cfop');
        }
    
        protected function setupFilterBuilder(FilterBuilder $filterBuilder, FixedKeysArray $columns)
        {
    
        }
    
        protected function AddOperationsColumns(Grid $grid)
        {
            $actions = $grid->getActions();
            $actions->setCaption($this->GetLocalizerCaptions()->GetMessageString('Actions'));
            $actions->setPosition(ActionList::POSITION_LEFT);
            
            if ($this->GetSecurityInfo()->HasViewGrant())
            {
                $operation = new LinkOperation($this->GetLocalizerCaptions()->GetMessageString('View'), OPERATION_VIEW, $this->dataset, $grid);
                $operation->setUseImage(true);
                $actions->addOperation($operation);
            }
            
            if ($this->GetSecurityInfo()->HasEditGrant())
            {
                $operation = new LinkOperation($this->GetLocalizerCaptions()->GetMessageString('Edit'), OPERATION_EDIT, $this->dataset, $grid);
                $operation->setUseImage(true);
                $actions->addOperation($operation);
                $operation->OnShow->AddListener('ShowEditButtonHandler', $this);
            }
            
            if ($this->GetSecurityInfo()->HasDeleteGrant())
            {
                $operation = new LinkOperation($this->GetLocalizerCaptions()->GetMessageString('Delete'), OPERATION_DELETE, $this->dataset, $grid);
                $operation->setUseImage(true);
                $actions->addOperation($operation);
                $operation->OnShow->AddListener('ShowDeleteButtonHandler', $this);
                $operation->SetAdditionalAttribute('data-modal-operation', 'delete');
                $operation->SetAdditionalAttribute('data-delete-handler-name', $this->GetModalGridDeleteHandler());
            }
        }
    
        protected function AddFieldColumns(Grid $grid, $withDetails = true)
        {
            if (GetCurrentUserPermissionSetForDataSource('notas.itens')->HasViewGrant() && $withDetails)
            {
            //
            // View column for notas_itens detail
            //
            $column = new DetailColumn(array('chave'), 'notas.itens', 'notas_itens_handler', $this->dataset, 'Itens');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $grid->AddViewColumn($column);
            }
            
            if (GetCurrentUserPermissionSetForDataSource('notas.notas_referenciadas')->HasViewGrant() && $withDetails)
            {
            //
            // View column for notas_notas_referenciadas detail
            //
            $column = new DetailColumn(array('chave'), 'notas.notas_referenciadas', 'notas_notas_referenciadas_handler', $this->dataset, 'Notas Referenciadas');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $grid->AddViewColumn($column);
            }
            
            if (GetCurrentUserPermissionSetForDataSource('notas.duplicatas')->HasViewGrant() && $withDetails)
            {
            //
            // View column for notas_duplicatas detail
            //
            $column = new DetailColumn(array('chave'), 'notas.duplicatas', 'notas_duplicatas_handler', $this->dataset, 'Duplicatas');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $grid->AddViewColumn($column);
            }
            
            if (GetCurrentUserPermissionSetForDataSource('notas.volumes')->HasViewGrant() && $withDetails)
            {
            //
            // View column for notas_volumes detail
            //
            $column = new DetailColumn(array('chave'), 'notas.volumes', 'notas_volumes_handler', $this->dataset, 'Volumes');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $grid->AddViewColumn($column);
            }
            
            //
            // View column for chave field
            //
            $column = new TextViewColumn('chave', 'chave', 'Chave', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for sequencia field
            //
            $column = new TextViewColumn('sequencia', 'sequencia', 'Sequencia', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for dt_inclusao field
            //
            $column = new DateTimeViewColumn('dt_inclusao', 'dt_inclusao', 'Data Inclusão', $this->dataset);
            $column->SetOrderable(true);
            $column->SetDateTimeFormat('d.m.Y H:i:s');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for st_nota field
            //
            $column = new TextViewColumn('st_nota', 'st_nota', 'Status Nota', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for tx_obs field
            //
            $column = new TextViewColumn('tx_obs', 'tx_obs', 'Ocorrências da NF', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_tx_obs_handler_list');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for descricao field
            //
            $column = new TextViewColumn('natureza_operacao', 'natureza_operacao_descricao', 'Natureza Operação', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('forma_pagamento', 'forma_pagamento_ds_tabela', 'Forma Pagamento', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for data_emissao field
            //
            $column = new DateTimeViewColumn('data_emissao', 'data_emissao', 'Data Emissão', $this->dataset);
            $column->SetOrderable(true);
            $column->SetDateTimeFormat('Y-m-d');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for data_entrada_saida field
            //
            $column = new DateTimeViewColumn('data_entrada_saida', 'data_entrada_saida', 'Data Entrada Saida', $this->dataset);
            $column->SetOrderable(true);
            $column->SetDateTimeFormat('d.m.Y H:i:s');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('tipo_documento', 'tipo_documento_ds_tabela', 'Tipo Documento', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('local_destino', 'local_destino_ds_tabela', 'Local Destino', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('finalidade_emissao', 'finalidade_emissao_ds_tabela', 'Finalidade Emissao', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('consumidor_final', 'consumidor_final_ds_tabela', 'Consumidor Final', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('presenca_comprador', 'presenca_comprador_ds_tabela', 'Presenca Comprador', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('regime_tributario_emitente', 'regime_tributario_emitente_ds_tabela', 'Regime Tributario Emitente', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for cnpj_destinatario field
            //
            $column = new TextViewColumn('cnpj_destinatario', 'cnpj_destinatario', 'Cnpj Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for cpf_destinatario field
            //
            $column = new TextViewColumn('cpf_destinatario', 'cpf_destinatario', 'Cpf Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for id_estrangeiro_destinatario field
            //
            $column = new TextViewColumn('id_estrangeiro_destinatario', 'id_estrangeiro_destinatario', 'Id Estrangeiro Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for nome_destinatario field
            //
            $column = new TextViewColumn('nome_destinatario', 'nome_destinatario', 'Nome Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_nome_destinatario_handler_list');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for logradoura_destinatario field
            //
            $column = new TextViewColumn('logradoura_destinatario', 'logradoura_destinatario', 'Logradoura Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_logradoura_destinatario_handler_list');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for numero_destinatario field
            //
            $column = new TextViewColumn('numero_destinatario', 'numero_destinatario', 'Numero Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for complemento_destinatario field
            //
            $column = new TextViewColumn('complemento_destinatario', 'complemento_destinatario', 'Complemento Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_complemento_destinatario_handler_list');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for bairro_destinatario field
            //
            $column = new TextViewColumn('bairro_destinatario', 'bairro_destinatario', 'Bairro Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for codigo_municipio_destinatario field
            //
            $column = new TextViewColumn('codigo_municipio_destinatario', 'codigo_municipio_destinatario', 'Codigo Municipio Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for municipio_destinatario field
            //
            $column = new TextViewColumn('municipio_destinatario', 'municipio_destinatario', 'Municipio Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for uf_destinatario field
            //
            $column = new TextViewColumn('uf_destinatario', 'uf_destinatario', 'Uf Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for cep_destinatario field
            //
            $column = new TextViewColumn('cep_destinatario', 'cep_destinatario', 'Cep Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for pais_destinatario field
            //
            $column = new TextViewColumn('pais_destinatario', 'pais_destinatario', 'Pais Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for telefone_destinatario field
            //
            $column = new TextViewColumn('telefone_destinatario', 'telefone_destinatario', 'Telefone Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for indicador_inscricao_estadual_destinatario field
            //
            $column = new TextViewColumn('indicador_inscricao_estadual_destinatario', 'indicador_inscricao_estadual_destinatario', 'Indicador Inscricao Estadual Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for inscricao_estadual_destinatario field
            //
            $column = new TextViewColumn('inscricao_estadual_destinatario', 'inscricao_estadual_destinatario', 'Inscricao Estadual Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for inscricao_suframa_destinatario field
            //
            $column = new TextViewColumn('inscricao_suframa_destinatario', 'inscricao_suframa_destinatario', 'Inscricao Suframa Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for email_destinatario field
            //
            $column = new TextViewColumn('email_destinatario', 'email_destinatario', 'Email Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_email_destinatario_handler_list');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for inscricao_municipal_destinatario field
            //
            $column = new TextViewColumn('inscricao_municipal_destinatario', 'inscricao_municipal_destinatario', 'Inscricao Municipal Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for cnpj_retirada field
            //
            $column = new TextViewColumn('cnpj_retirada', 'cnpj_retirada', 'Cnpj Retirada', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for cpf_retirada field
            //
            $column = new TextViewColumn('cpf_retirada', 'cpf_retirada', 'Cpf Retirada', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for logradoura_retirada field
            //
            $column = new TextViewColumn('logradoura_retirada', 'logradoura_retirada', 'Logradoura Retirada', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_logradoura_retirada_handler_list');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for numero_retirada field
            //
            $column = new TextViewColumn('numero_retirada', 'numero_retirada', 'Numero Retirada', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for complemento_retirada field
            //
            $column = new TextViewColumn('complemento_retirada', 'complemento_retirada', 'Complemento Retirada', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_complemento_retirada_handler_list');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for bairro_retirada field
            //
            $column = new TextViewColumn('bairro_retirada', 'bairro_retirada', 'Bairro Retirada', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for codigo_municipio_retirada field
            //
            $column = new TextViewColumn('codigo_municipio_retirada', 'codigo_municipio_retirada', 'Codigo Municipio Retirada', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for municipio_retirada field
            //
            $column = new TextViewColumn('municipio_retirada', 'municipio_retirada', 'Municipio Retirada', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for uf_retirada field
            //
            $column = new TextViewColumn('uf_retirada', 'uf_retirada', 'Uf Retirada', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for cnpj_entrega field
            //
            $column = new TextViewColumn('cnpj_entrega', 'cnpj_entrega', 'Cnpj Entrega', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for cpf_entrega field
            //
            $column = new TextViewColumn('cpf_entrega', 'cpf_entrega', 'Cpf Entrega', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for logradouro_entrega field
            //
            $column = new TextViewColumn('logradouro_entrega', 'logradouro_entrega', 'Logradouro Entrega', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_logradouro_entrega_handler_list');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for numero_entrega field
            //
            $column = new TextViewColumn('numero_entrega', 'numero_entrega', 'Numero Entrega', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for complemento_entrega field
            //
            $column = new TextViewColumn('complemento_entrega', 'complemento_entrega', 'Complemento Entrega', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_complemento_entrega_handler_list');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for bairro_entrega field
            //
            $column = new TextViewColumn('bairro_entrega', 'bairro_entrega', 'Bairro Entrega', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for codigo_municipio_entrega field
            //
            $column = new TextViewColumn('codigo_municipio_entrega', 'codigo_municipio_entrega', 'Codigo Municipio Entrega', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for municipio_entrega field
            //
            $column = new TextViewColumn('municipio_entrega', 'municipio_entrega', 'Municipio Entrega', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for uf_entrega field
            //
            $column = new TextViewColumn('uf_entrega', 'uf_entrega', 'Uf Entrega', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for icms_base_calculo field
            //
            $column = new TextViewColumn('icms_base_calculo', 'icms_base_calculo', 'Icms Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for icms_valor_total field
            //
            $column = new TextViewColumn('icms_valor_total', 'icms_valor_total', 'Icms Valor Total', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for icms_valor_total_desonerado field
            //
            $column = new TextViewColumn('icms_valor_total_desonerado', 'icms_valor_total_desonerado', 'Icms Valor Total Desonerado', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for icms_base_calculo_st field
            //
            $column = new TextViewColumn('icms_base_calculo_st', 'icms_base_calculo_st', 'Icms Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for icms_valor_total_st field
            //
            $column = new TextViewColumn('icms_valor_total_st', 'icms_valor_total_st', 'Icms Valor Total St', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_produtos field
            //
            $column = new TextViewColumn('valor_produtos', 'valor_produtos', 'Valor Produtos', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_frete field
            //
            $column = new TextViewColumn('valor_frete', 'valor_frete', 'Valor Frete', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_seguro field
            //
            $column = new TextViewColumn('valor_seguro', 'valor_seguro', 'Valor Seguro', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_desconto field
            //
            $column = new TextViewColumn('valor_desconto', 'valor_desconto', 'Valor Desconto', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_total_ii field
            //
            $column = new TextViewColumn('valor_total_ii', 'valor_total_ii', 'Valor Total Ii', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_ipi field
            //
            $column = new TextViewColumn('valor_ipi', 'valor_ipi', 'Valor Ipi', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_pis field
            //
            $column = new TextViewColumn('valor_pis', 'valor_pis', 'Valor Pis', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_cofins field
            //
            $column = new TextViewColumn('valor_cofins', 'valor_cofins', 'Valor Cofins', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_outras_despesas field
            //
            $column = new TextViewColumn('valor_outras_despesas', 'valor_outras_despesas', 'Valor Outras Despesas', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_total field
            //
            $column = new TextViewColumn('valor_total', 'valor_total', 'Valor Total', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_total_servicos field
            //
            $column = new TextViewColumn('valor_total_servicos', 'valor_total_servicos', 'Valor Total Servicos', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for base_issqn field
            //
            $column = new TextViewColumn('base_issqn', 'base_issqn', 'Base Issqn', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_pis_servico field
            //
            $column = new TextViewColumn('valor_pis_servico', 'valor_pis_servico', 'Valor Pis Servico', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for data_prestacao_servico field
            //
            $column = new TextViewColumn('data_prestacao_servico', 'data_prestacao_servico', 'Data Prestacao Servico', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_total_deducao_base_calculo field
            //
            $column = new TextViewColumn('valor_total_deducao_base_calculo', 'valor_total_deducao_base_calculo', 'Valor Total Deducao Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_total_outras_retencoes field
            //
            $column = new TextViewColumn('valor_total_outras_retencoes', 'valor_total_outras_retencoes', 'Valor Total Outras Retencoes', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_total_desconto_incondicionado field
            //
            $column = new TextViewColumn('valor_total_desconto_incondicionado', 'valor_total_desconto_incondicionado', 'Valor Total Desconto Incondicionado', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_total_valor_condicionado field
            //
            $column = new TextViewColumn('valor_total_valor_condicionado', 'valor_total_valor_condicionado', 'Valor Total Valor Condicionado', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_total_retencao_iss field
            //
            $column = new TextViewColumn('valor_total_retencao_iss', 'valor_total_retencao_iss', 'Valor Total Retencao Iss', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('codigo_regime_especial_tributacao', 'codigo_regime_especial_tributacao_ds_tabela', 'Codigo Regime Especial Tributacao', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_retido_pis field
            //
            $column = new TextViewColumn('valor_retido_pis', 'valor_retido_pis', 'Valor Retido Pis', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_retido_cofins field
            //
            $column = new TextViewColumn('valor_retido_cofins', 'valor_retido_cofins', 'Valor Retido Cofins', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_retido_csll field
            //
            $column = new TextViewColumn('valor_retido_csll', 'valor_retido_csll', 'Valor Retido Csll', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for base_calculo_irrf field
            //
            $column = new TextViewColumn('base_calculo_irrf', 'base_calculo_irrf', 'Base Calculo Irrf', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_retido_irrf field
            //
            $column = new TextViewColumn('valor_retido_irrf', 'valor_retido_irrf', 'Valor Retido Irrf', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for prev_social_base_calculo field
            //
            $column = new TextViewColumn('prev_social_base_calculo', 'prev_social_base_calculo', 'Prev Social Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for prev_social_valor_retido field
            //
            $column = new TextViewColumn('prev_social_valor_retido', 'prev_social_valor_retido', 'Prev Social Valor Retido', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('modalidade_frete', 'modalidade_frete_ds_tabela', 'Modalidade Frete', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for cnpj_transportador field
            //
            $column = new TextViewColumn('cnpj_transportador', 'cnpj_transportador', 'Cnpj Transportador', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for cpf_transportador field
            //
            $column = new TextViewColumn('cpf_transportador', 'cpf_transportador', 'Cpf Transportador', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for nome_transportador field
            //
            $column = new TextViewColumn('nome_transportador', 'nome_transportador', 'Nome Transportador', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_nome_transportador_handler_list');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for inscricao_estadual_transportador field
            //
            $column = new TextViewColumn('inscricao_estadual_transportador', 'inscricao_estadual_transportador', 'Inscricao Estadual Transportador', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for endereco_transportador field
            //
            $column = new TextViewColumn('endereco_transportador', 'endereco_transportador', 'Endereco Transportador', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_endereco_transportador_handler_list');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for municipio_transportador field
            //
            $column = new TextViewColumn('municipio_transportador', 'municipio_transportador', 'Municipio Transportador', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for uf_transportador field
            //
            $column = new TextViewColumn('uf_transportador', 'uf_transportador', 'Uf Transportador', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for transporte_icms_servico field
            //
            $column = new TextViewColumn('transporte_icms_servico', 'transporte_icms_servico', 'Transporte Icms Servico', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for transporte_icms_base_servico field
            //
            $column = new TextViewColumn('transporte_icms_base_servico', 'transporte_icms_base_servico', 'Transporte Icms Base Servico', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for transporte_icms_aliquota field
            //
            $column = new TextViewColumn('transporte_icms_aliquota', 'transporte_icms_aliquota', 'Transporte Icms Aliquota', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for transporte_icms_valor field
            //
            $column = new TextViewColumn('transporte_icms_valor', 'transporte_icms_valor', 'Transporte Icms Valor', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('transporte_icms_cfop', 'transporte_icms_cfop_ds_tabela', 'Transporte Icms Cfop', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for transporte_icms_codigo_municipio field
            //
            $column = new TextViewColumn('transporte_icms_codigo_municipio', 'transporte_icms_codigo_municipio', 'Transporte Icms Codigo Municipio', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for veiculo_placa field
            //
            $column = new TextViewColumn('veiculo_placa', 'veiculo_placa', 'Veiculo Placa', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for veiculo_uf field
            //
            $column = new TextViewColumn('veiculo_uf', 'veiculo_uf', 'Veiculo Uf', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for veiculo_rntc field
            //
            $column = new TextViewColumn('veiculo_rntc', 'veiculo_rntc', 'Veiculo Rntc', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for veiculo_identificacao_vagao field
            //
            $column = new TextViewColumn('veiculo_identificacao_vagao', 'veiculo_identificacao_vagao', 'Veiculo Identificacao Vagao', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for veiculo_identificacao_balsa field
            //
            $column = new TextViewColumn('veiculo_identificacao_balsa', 'veiculo_identificacao_balsa', 'Veiculo Identificacao Balsa', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for numero_fatura field
            //
            $column = new TextViewColumn('numero_fatura', 'numero_fatura', 'Numero Fatura', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_original_fatura field
            //
            $column = new TextViewColumn('valor_original_fatura', 'valor_original_fatura', 'Valor Original Fatura', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_desconto_fatura field
            //
            $column = new TextViewColumn('valor_desconto_fatura', 'valor_desconto_fatura', 'Valor Desconto Fatura', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for valor_liquido_fatura field
            //
            $column = new TextViewColumn('valor_liquido_fatura', 'valor_liquido_fatura', 'Valor Liquido Fatura', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for informacoes_adicionais_contribuinte field
            //
            $column = new TextViewColumn('informacoes_adicionais_contribuinte', 'informacoes_adicionais_contribuinte', 'Informacoes Adicionais Contribuinte', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_informacoes_adicionais_contribuinte_handler_list');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for uf_local_embarque field
            //
            $column = new TextViewColumn('uf_local_embarque', 'uf_local_embarque', 'Uf Local Embarque', $this->dataset);
            $column->SetOrderable(true);
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for local_embarque field
            //
            $column = new TextViewColumn('local_embarque', 'local_embarque', 'Local Embarque', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_local_embarque_handler_list');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for local_despacho field
            //
            $column = new TextViewColumn('local_despacho', 'local_despacho', 'Local Despacho', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_local_despacho_handler_list');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for tx_cancelamento field
            //
            $column = new TextViewColumn('tx_cancelamento', 'tx_cancelamento', 'Tx Cancelamento', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_tx_cancelamento_handler_list');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for tx_correcao field
            //
            $column = new TextViewColumn('tx_correcao', 'tx_correcao', 'Tx Correcao', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_tx_correcao_handler_list');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for id_pedido field
            //
            $column = new NumberViewColumn('id_pedido', 'id_pedido', 'Id Pedido', $this->dataset);
            $column->SetOrderable(true);
            $column->setNumberAfterDecimal(0);
            $column->setThousandsSeparator('.');
            $column->setDecimalSeparator('');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for numero_nf field
            //
            $column = new NumberViewColumn('numero_nf', 'numero_nf', 'Numero Nf', $this->dataset);
            $column->SetOrderable(true);
            $column->setNumberAfterDecimal(0);
            $column->setThousandsSeparator('.');
            $column->setDecimalSeparator('');
            $column->setMinimalVisibility(ColumnVisibility::PHONE);
            $column->SetDescription('');
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
        }
    
        protected function AddSingleRecordViewColumns(Grid $grid)
        {
            //
            // View column for chave field
            //
            $column = new TextViewColumn('chave', 'chave', 'Chave', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for sequencia field
            //
            $column = new TextViewColumn('sequencia', 'sequencia', 'Sequencia', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for dt_inclusao field
            //
            $column = new DateTimeViewColumn('dt_inclusao', 'dt_inclusao', 'Data Inclusão', $this->dataset);
            $column->SetOrderable(true);
            $column->SetDateTimeFormat('d.m.Y H:i:s');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for st_nota field
            //
            $column = new TextViewColumn('st_nota', 'st_nota', 'Status Nota', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for tx_obs field
            //
            $column = new TextViewColumn('tx_obs', 'tx_obs', 'Ocorrências da NF', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_tx_obs_handler_view');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for descricao field
            //
            $column = new TextViewColumn('natureza_operacao', 'natureza_operacao_descricao', 'Natureza Operação', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('forma_pagamento', 'forma_pagamento_ds_tabela', 'Forma Pagamento', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for data_emissao field
            //
            $column = new DateTimeViewColumn('data_emissao', 'data_emissao', 'Data Emissão', $this->dataset);
            $column->SetOrderable(true);
            $column->SetDateTimeFormat('Y-m-d');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for data_entrada_saida field
            //
            $column = new DateTimeViewColumn('data_entrada_saida', 'data_entrada_saida', 'Data Entrada Saida', $this->dataset);
            $column->SetOrderable(true);
            $column->SetDateTimeFormat('d.m.Y H:i:s');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('tipo_documento', 'tipo_documento_ds_tabela', 'Tipo Documento', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('local_destino', 'local_destino_ds_tabela', 'Local Destino', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('finalidade_emissao', 'finalidade_emissao_ds_tabela', 'Finalidade Emissao', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('consumidor_final', 'consumidor_final_ds_tabela', 'Consumidor Final', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('presenca_comprador', 'presenca_comprador_ds_tabela', 'Presenca Comprador', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('regime_tributario_emitente', 'regime_tributario_emitente_ds_tabela', 'Regime Tributario Emitente', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for cnpj_destinatario field
            //
            $column = new TextViewColumn('cnpj_destinatario', 'cnpj_destinatario', 'Cnpj Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for cpf_destinatario field
            //
            $column = new TextViewColumn('cpf_destinatario', 'cpf_destinatario', 'Cpf Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for id_estrangeiro_destinatario field
            //
            $column = new TextViewColumn('id_estrangeiro_destinatario', 'id_estrangeiro_destinatario', 'Id Estrangeiro Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for nome_destinatario field
            //
            $column = new TextViewColumn('nome_destinatario', 'nome_destinatario', 'Nome Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_nome_destinatario_handler_view');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for logradoura_destinatario field
            //
            $column = new TextViewColumn('logradoura_destinatario', 'logradoura_destinatario', 'Logradoura Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_logradoura_destinatario_handler_view');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for numero_destinatario field
            //
            $column = new TextViewColumn('numero_destinatario', 'numero_destinatario', 'Numero Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for complemento_destinatario field
            //
            $column = new TextViewColumn('complemento_destinatario', 'complemento_destinatario', 'Complemento Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_complemento_destinatario_handler_view');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for bairro_destinatario field
            //
            $column = new TextViewColumn('bairro_destinatario', 'bairro_destinatario', 'Bairro Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for codigo_municipio_destinatario field
            //
            $column = new TextViewColumn('codigo_municipio_destinatario', 'codigo_municipio_destinatario', 'Codigo Municipio Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for municipio_destinatario field
            //
            $column = new TextViewColumn('municipio_destinatario', 'municipio_destinatario', 'Municipio Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for uf_destinatario field
            //
            $column = new TextViewColumn('uf_destinatario', 'uf_destinatario', 'Uf Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for cep_destinatario field
            //
            $column = new TextViewColumn('cep_destinatario', 'cep_destinatario', 'Cep Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for pais_destinatario field
            //
            $column = new TextViewColumn('pais_destinatario', 'pais_destinatario', 'Pais Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for telefone_destinatario field
            //
            $column = new TextViewColumn('telefone_destinatario', 'telefone_destinatario', 'Telefone Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for indicador_inscricao_estadual_destinatario field
            //
            $column = new TextViewColumn('indicador_inscricao_estadual_destinatario', 'indicador_inscricao_estadual_destinatario', 'Indicador Inscricao Estadual Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for inscricao_estadual_destinatario field
            //
            $column = new TextViewColumn('inscricao_estadual_destinatario', 'inscricao_estadual_destinatario', 'Inscricao Estadual Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for inscricao_suframa_destinatario field
            //
            $column = new TextViewColumn('inscricao_suframa_destinatario', 'inscricao_suframa_destinatario', 'Inscricao Suframa Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for email_destinatario field
            //
            $column = new TextViewColumn('email_destinatario', 'email_destinatario', 'Email Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_email_destinatario_handler_view');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for inscricao_municipal_destinatario field
            //
            $column = new TextViewColumn('inscricao_municipal_destinatario', 'inscricao_municipal_destinatario', 'Inscricao Municipal Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for cnpj_retirada field
            //
            $column = new TextViewColumn('cnpj_retirada', 'cnpj_retirada', 'Cnpj Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for cpf_retirada field
            //
            $column = new TextViewColumn('cpf_retirada', 'cpf_retirada', 'Cpf Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for logradoura_retirada field
            //
            $column = new TextViewColumn('logradoura_retirada', 'logradoura_retirada', 'Logradoura Retirada', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_logradoura_retirada_handler_view');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for numero_retirada field
            //
            $column = new TextViewColumn('numero_retirada', 'numero_retirada', 'Numero Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for complemento_retirada field
            //
            $column = new TextViewColumn('complemento_retirada', 'complemento_retirada', 'Complemento Retirada', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_complemento_retirada_handler_view');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for bairro_retirada field
            //
            $column = new TextViewColumn('bairro_retirada', 'bairro_retirada', 'Bairro Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for codigo_municipio_retirada field
            //
            $column = new TextViewColumn('codigo_municipio_retirada', 'codigo_municipio_retirada', 'Codigo Municipio Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for municipio_retirada field
            //
            $column = new TextViewColumn('municipio_retirada', 'municipio_retirada', 'Municipio Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for uf_retirada field
            //
            $column = new TextViewColumn('uf_retirada', 'uf_retirada', 'Uf Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for cnpj_entrega field
            //
            $column = new TextViewColumn('cnpj_entrega', 'cnpj_entrega', 'Cnpj Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for cpf_entrega field
            //
            $column = new TextViewColumn('cpf_entrega', 'cpf_entrega', 'Cpf Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for logradouro_entrega field
            //
            $column = new TextViewColumn('logradouro_entrega', 'logradouro_entrega', 'Logradouro Entrega', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_logradouro_entrega_handler_view');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for numero_entrega field
            //
            $column = new TextViewColumn('numero_entrega', 'numero_entrega', 'Numero Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for complemento_entrega field
            //
            $column = new TextViewColumn('complemento_entrega', 'complemento_entrega', 'Complemento Entrega', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_complemento_entrega_handler_view');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for bairro_entrega field
            //
            $column = new TextViewColumn('bairro_entrega', 'bairro_entrega', 'Bairro Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for codigo_municipio_entrega field
            //
            $column = new TextViewColumn('codigo_municipio_entrega', 'codigo_municipio_entrega', 'Codigo Municipio Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for municipio_entrega field
            //
            $column = new TextViewColumn('municipio_entrega', 'municipio_entrega', 'Municipio Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for uf_entrega field
            //
            $column = new TextViewColumn('uf_entrega', 'uf_entrega', 'Uf Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for icms_base_calculo field
            //
            $column = new TextViewColumn('icms_base_calculo', 'icms_base_calculo', 'Icms Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for icms_valor_total field
            //
            $column = new TextViewColumn('icms_valor_total', 'icms_valor_total', 'Icms Valor Total', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for icms_valor_total_desonerado field
            //
            $column = new TextViewColumn('icms_valor_total_desonerado', 'icms_valor_total_desonerado', 'Icms Valor Total Desonerado', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for icms_base_calculo_st field
            //
            $column = new TextViewColumn('icms_base_calculo_st', 'icms_base_calculo_st', 'Icms Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for icms_valor_total_st field
            //
            $column = new TextViewColumn('icms_valor_total_st', 'icms_valor_total_st', 'Icms Valor Total St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_produtos field
            //
            $column = new TextViewColumn('valor_produtos', 'valor_produtos', 'Valor Produtos', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_frete field
            //
            $column = new TextViewColumn('valor_frete', 'valor_frete', 'Valor Frete', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_seguro field
            //
            $column = new TextViewColumn('valor_seguro', 'valor_seguro', 'Valor Seguro', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_desconto field
            //
            $column = new TextViewColumn('valor_desconto', 'valor_desconto', 'Valor Desconto', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_total_ii field
            //
            $column = new TextViewColumn('valor_total_ii', 'valor_total_ii', 'Valor Total Ii', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_ipi field
            //
            $column = new TextViewColumn('valor_ipi', 'valor_ipi', 'Valor Ipi', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_pis field
            //
            $column = new TextViewColumn('valor_pis', 'valor_pis', 'Valor Pis', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_cofins field
            //
            $column = new TextViewColumn('valor_cofins', 'valor_cofins', 'Valor Cofins', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_outras_despesas field
            //
            $column = new TextViewColumn('valor_outras_despesas', 'valor_outras_despesas', 'Valor Outras Despesas', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_total field
            //
            $column = new TextViewColumn('valor_total', 'valor_total', 'Valor Total', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_total_servicos field
            //
            $column = new TextViewColumn('valor_total_servicos', 'valor_total_servicos', 'Valor Total Servicos', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for base_issqn field
            //
            $column = new TextViewColumn('base_issqn', 'base_issqn', 'Base Issqn', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_pis_servico field
            //
            $column = new TextViewColumn('valor_pis_servico', 'valor_pis_servico', 'Valor Pis Servico', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for data_prestacao_servico field
            //
            $column = new TextViewColumn('data_prestacao_servico', 'data_prestacao_servico', 'Data Prestacao Servico', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_total_deducao_base_calculo field
            //
            $column = new TextViewColumn('valor_total_deducao_base_calculo', 'valor_total_deducao_base_calculo', 'Valor Total Deducao Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_total_outras_retencoes field
            //
            $column = new TextViewColumn('valor_total_outras_retencoes', 'valor_total_outras_retencoes', 'Valor Total Outras Retencoes', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_total_desconto_incondicionado field
            //
            $column = new TextViewColumn('valor_total_desconto_incondicionado', 'valor_total_desconto_incondicionado', 'Valor Total Desconto Incondicionado', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_total_valor_condicionado field
            //
            $column = new TextViewColumn('valor_total_valor_condicionado', 'valor_total_valor_condicionado', 'Valor Total Valor Condicionado', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_total_retencao_iss field
            //
            $column = new TextViewColumn('valor_total_retencao_iss', 'valor_total_retencao_iss', 'Valor Total Retencao Iss', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('codigo_regime_especial_tributacao', 'codigo_regime_especial_tributacao_ds_tabela', 'Codigo Regime Especial Tributacao', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_retido_pis field
            //
            $column = new TextViewColumn('valor_retido_pis', 'valor_retido_pis', 'Valor Retido Pis', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_retido_cofins field
            //
            $column = new TextViewColumn('valor_retido_cofins', 'valor_retido_cofins', 'Valor Retido Cofins', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_retido_csll field
            //
            $column = new TextViewColumn('valor_retido_csll', 'valor_retido_csll', 'Valor Retido Csll', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for base_calculo_irrf field
            //
            $column = new TextViewColumn('base_calculo_irrf', 'base_calculo_irrf', 'Base Calculo Irrf', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_retido_irrf field
            //
            $column = new TextViewColumn('valor_retido_irrf', 'valor_retido_irrf', 'Valor Retido Irrf', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for prev_social_base_calculo field
            //
            $column = new TextViewColumn('prev_social_base_calculo', 'prev_social_base_calculo', 'Prev Social Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for prev_social_valor_retido field
            //
            $column = new TextViewColumn('prev_social_valor_retido', 'prev_social_valor_retido', 'Prev Social Valor Retido', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('modalidade_frete', 'modalidade_frete_ds_tabela', 'Modalidade Frete', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for cnpj_transportador field
            //
            $column = new TextViewColumn('cnpj_transportador', 'cnpj_transportador', 'Cnpj Transportador', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for cpf_transportador field
            //
            $column = new TextViewColumn('cpf_transportador', 'cpf_transportador', 'Cpf Transportador', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for nome_transportador field
            //
            $column = new TextViewColumn('nome_transportador', 'nome_transportador', 'Nome Transportador', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_nome_transportador_handler_view');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for inscricao_estadual_transportador field
            //
            $column = new TextViewColumn('inscricao_estadual_transportador', 'inscricao_estadual_transportador', 'Inscricao Estadual Transportador', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for endereco_transportador field
            //
            $column = new TextViewColumn('endereco_transportador', 'endereco_transportador', 'Endereco Transportador', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_endereco_transportador_handler_view');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for municipio_transportador field
            //
            $column = new TextViewColumn('municipio_transportador', 'municipio_transportador', 'Municipio Transportador', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for uf_transportador field
            //
            $column = new TextViewColumn('uf_transportador', 'uf_transportador', 'Uf Transportador', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for transporte_icms_servico field
            //
            $column = new TextViewColumn('transporte_icms_servico', 'transporte_icms_servico', 'Transporte Icms Servico', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for transporte_icms_base_servico field
            //
            $column = new TextViewColumn('transporte_icms_base_servico', 'transporte_icms_base_servico', 'Transporte Icms Base Servico', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for transporte_icms_aliquota field
            //
            $column = new TextViewColumn('transporte_icms_aliquota', 'transporte_icms_aliquota', 'Transporte Icms Aliquota', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for transporte_icms_valor field
            //
            $column = new TextViewColumn('transporte_icms_valor', 'transporte_icms_valor', 'Transporte Icms Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('transporte_icms_cfop', 'transporte_icms_cfop_ds_tabela', 'Transporte Icms Cfop', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for transporte_icms_codigo_municipio field
            //
            $column = new TextViewColumn('transporte_icms_codigo_municipio', 'transporte_icms_codigo_municipio', 'Transporte Icms Codigo Municipio', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for veiculo_placa field
            //
            $column = new TextViewColumn('veiculo_placa', 'veiculo_placa', 'Veiculo Placa', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for veiculo_uf field
            //
            $column = new TextViewColumn('veiculo_uf', 'veiculo_uf', 'Veiculo Uf', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for veiculo_rntc field
            //
            $column = new TextViewColumn('veiculo_rntc', 'veiculo_rntc', 'Veiculo Rntc', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for veiculo_identificacao_vagao field
            //
            $column = new TextViewColumn('veiculo_identificacao_vagao', 'veiculo_identificacao_vagao', 'Veiculo Identificacao Vagao', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for veiculo_identificacao_balsa field
            //
            $column = new TextViewColumn('veiculo_identificacao_balsa', 'veiculo_identificacao_balsa', 'Veiculo Identificacao Balsa', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for numero_fatura field
            //
            $column = new TextViewColumn('numero_fatura', 'numero_fatura', 'Numero Fatura', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_original_fatura field
            //
            $column = new TextViewColumn('valor_original_fatura', 'valor_original_fatura', 'Valor Original Fatura', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_desconto_fatura field
            //
            $column = new TextViewColumn('valor_desconto_fatura', 'valor_desconto_fatura', 'Valor Desconto Fatura', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for valor_liquido_fatura field
            //
            $column = new TextViewColumn('valor_liquido_fatura', 'valor_liquido_fatura', 'Valor Liquido Fatura', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for informacoes_adicionais_contribuinte field
            //
            $column = new TextViewColumn('informacoes_adicionais_contribuinte', 'informacoes_adicionais_contribuinte', 'Informacoes Adicionais Contribuinte', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_informacoes_adicionais_contribuinte_handler_view');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for uf_local_embarque field
            //
            $column = new TextViewColumn('uf_local_embarque', 'uf_local_embarque', 'Uf Local Embarque', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for local_embarque field
            //
            $column = new TextViewColumn('local_embarque', 'local_embarque', 'Local Embarque', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_local_embarque_handler_view');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for local_despacho field
            //
            $column = new TextViewColumn('local_despacho', 'local_despacho', 'Local Despacho', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_local_despacho_handler_view');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for tx_cancelamento field
            //
            $column = new TextViewColumn('tx_cancelamento', 'tx_cancelamento', 'Tx Cancelamento', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_tx_cancelamento_handler_view');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for tx_correcao field
            //
            $column = new TextViewColumn('tx_correcao', 'tx_correcao', 'Tx Correcao', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_tx_correcao_handler_view');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for id_pedido field
            //
            $column = new NumberViewColumn('id_pedido', 'id_pedido', 'Id Pedido', $this->dataset);
            $column->SetOrderable(true);
            $column->setNumberAfterDecimal(0);
            $column->setThousandsSeparator('.');
            $column->setDecimalSeparator('');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for numero_nf field
            //
            $column = new NumberViewColumn('numero_nf', 'numero_nf', 'Numero Nf', $this->dataset);
            $column->SetOrderable(true);
            $column->setNumberAfterDecimal(0);
            $column->setThousandsSeparator('.');
            $column->setDecimalSeparator('');
            $grid->AddSingleRecordViewColumn($column);
        }
    
        protected function AddEditColumns(Grid $grid)
        {
            //
            // Edit column for sequencia field
            //
            $editor = new TextEdit('sequencia_edit');
            $editColumn = new CustomEditColumn('Sequencia', 'sequencia', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for dt_inclusao field
            //
            $editor = new DateTimeEdit('dt_inclusao_edit', false, 'd.m.Y H:i:s');
            $editColumn = new CustomEditColumn('Data Inclusão', 'dt_inclusao', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for st_nota field
            //
            $editor = new ComboBox('st_nota_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $editor->addChoice('A', 'Aguardando');
            $editor->addChoice('E', 'ERRO NO ENVIO');
            $editor->addChoice('N', 'Homologação');
            $editColumn = new CustomEditColumn('Status Nota', 'st_nota', $editor, $this->dataset);
            $validator = new RequiredValidator(StringUtils::Format($this->GetLocalizerCaptions()->GetMessageString('RequiredValidationMessage'), $editColumn->GetCaption()));
            $editor->GetValidatorCollection()->AddValidator($validator);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for natureza_operacao field
            //
            $editor = new ComboBox('natureza_operacao_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $selectQuery = 'select id_codigo_cfop,descricao from cfop group by descricao order by descricao';
            $insertQuery = array();
            $updateQuery = array();
            $deleteQuery = array();
            $lookupDataset = new QueryDataset(
              MyConnectionFactory::getInstance(), 
              GetConnectionOptions(),
              $selectQuery, $insertQuery, $updateQuery, $deleteQuery, 'NOP');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_codigo_cfop', true, true, true),
                    new StringField('descricao', true)
                )
            );
            $lookupDataset->setOrderByField('descricao', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Natureza Operação', 
                'natureza_operacao', 
                $editor, 
                $this->dataset, 'descricao', 'descricao', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for forma_pagamento field
            //
            $editor = new ComboBox('forma_pagamento_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $editor->addChoice('0', 'a vista');
            $editor->addChoice('1', 'a prazo');
            $editor->addChoice('2', 'outros');
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`forma_pagamento`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Forma Pagamento', 
                'forma_pagamento', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for data_emissao field
            //
            $editor = new DateTimeEdit('data_emissao_edit', false, 'd.m.Y H:i:s');
            $editColumn = new CustomEditColumn('Data Emissão', 'data_emissao', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for data_entrada_saida field
            //
            $editor = new DateTimeEdit('data_entrada_saida_edit', false, 'd.m.Y H:i:s');
            $editColumn = new CustomEditColumn('Data Entrada Saida', 'data_entrada_saida', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for tipo_documento field
            //
            $editor = new ComboBox('tipo_documento_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $editor->addChoice('0', 'nota entrada');
            $editor->addChoice('1', 'nota saída');
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`tipo_documento`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Tipo Documento', 
                'tipo_documento', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for local_destino field
            //
            $editor = new ComboBox('local_destino_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $editor->addChoice('1', 'operaçao interna');
            $editor->addChoice('2', 'operaçao interestadual');
            $editor->addChoice('3', 'operação com exterior');
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`local_destino`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Local Destino', 
                'local_destino', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for finalidade_emissao field
            //
            $editor = new ComboBox('finalidade_emissao_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $editor->addChoice('1', 'Nota normal');
            $editor->addChoice('2', 'Nota complementar');
            $editor->addChoice('3', 'Nota de ajuste');
            $editor->addChoice('4', 'Devolução de mercadoria');
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`finalidade_emissao`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Finalidade Emissao', 
                'finalidade_emissao', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for consumidor_final field
            //
            $editor = new ComboBox('consumidor_final_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $editor->addChoice('0', 'normal');
            $editor->addChoice('1', 'consumidor final');
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`consumidor_final`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Consumidor Final', 
                'consumidor_final', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for presenca_comprador field
            //
            $editor = new ComboBox('presenca_comprador_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $editor->addChoice('0', 'Não se aplica (por exemplo, para a Nota Fiscal complementar ou de ajuste)');
            $editor->addChoice('1', 'Operação presencial');
            $editor->addChoice('2', 'Operação não presencial, pela internet');
            $editor->addChoice('3', 'Operação não presencial, teleatendimento');
            $editor->addChoice('4', 'NFC-e em operação com entrega em domicílio');
            $editor->addChoice('5', 'Operação não presencial, outros');
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`presenca_comprador`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Presenca Comprador', 
                'presenca_comprador', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for cnpj_destinatario field
            //
            $editor = new TextEdit('cnpj_destinatario_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cnpj Destinatario', 'cnpj_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for cpf_destinatario field
            //
            $editor = new TextEdit('cpf_destinatario_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cpf Destinatario', 'cpf_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for id_estrangeiro_destinatario field
            //
            $editor = new TextEdit('id_estrangeiro_destinatario_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Id Estrangeiro Destinatario', 'id_estrangeiro_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for nome_destinatario field
            //
            $editor = new TextEdit('nome_destinatario_edit');
            $editor->SetMaxLength(100);
            $editColumn = new CustomEditColumn('Nome Destinatario', 'nome_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for logradoura_destinatario field
            //
            $editor = new TextAreaEdit('logradoura_destinatario_edit', 50, 8);
            $editColumn = new CustomEditColumn('Logradoura Destinatario', 'logradoura_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for numero_destinatario field
            //
            $editor = new TextEdit('numero_destinatario_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Numero Destinatario', 'numero_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for complemento_destinatario field
            //
            $editor = new TextAreaEdit('complemento_destinatario_edit', 50, 8);
            $editColumn = new CustomEditColumn('Complemento Destinatario', 'complemento_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for bairro_destinatario field
            //
            $editor = new TextEdit('bairro_destinatario_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Bairro Destinatario', 'bairro_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for codigo_municipio_destinatario field
            //
            $editor = new TextEdit('codigo_municipio_destinatario_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Codigo Municipio Destinatario', 'codigo_municipio_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for municipio_destinatario field
            //
            $editor = new TextEdit('municipio_destinatario_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Municipio Destinatario', 'municipio_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for uf_destinatario field
            //
            $editor = new TextEdit('uf_destinatario_edit');
            $editor->SetMaxLength(3);
            $editColumn = new CustomEditColumn('Uf Destinatario', 'uf_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for cep_destinatario field
            //
            $editor = new TextEdit('cep_destinatario_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Cep Destinatario', 'cep_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for pais_destinatario field
            //
            $editor = new TextEdit('pais_destinatario_edit');
            $editor->SetMaxLength(30);
            $editColumn = new CustomEditColumn('Pais Destinatario', 'pais_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for telefone_destinatario field
            //
            $editor = new TextEdit('telefone_destinatario_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Telefone Destinatario', 'telefone_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for indicador_inscricao_estadual_destinatario field
            //
            $editor = new ComboBox('indicador_inscricao_estadual_destinatario_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $editor->addChoice('1', 'Contribuinte ICMS (informar a IE do destinatário)');
            $editor->addChoice('2', 'Contribuinte isento de Inscrição no cadastro de Contribuintes do ICMS');
            $editor->addChoice('9', 'Não Contribuinte, que pode ou não possuir Inscrição Estadual no Cadastro de Contribuintes ');
            $editColumn = new CustomEditColumn('Indicador Inscricao Estadual Destinatario', 'indicador_inscricao_estadual_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for inscricao_estadual_destinatario field
            //
            $editor = new TextEdit('inscricao_estadual_destinatario_edit');
            $editor->SetMaxLength(30);
            $editColumn = new CustomEditColumn('Inscricao Estadual Destinatario', 'inscricao_estadual_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for inscricao_suframa_destinatario field
            //
            $editor = new TextEdit('inscricao_suframa_destinatario_edit');
            $editor->SetMaxLength(30);
            $editColumn = new CustomEditColumn('Inscricao Suframa Destinatario', 'inscricao_suframa_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for email_destinatario field
            //
            $editor = new TextEdit('email_destinatario_edit');
            $editor->SetMaxLength(100);
            $editColumn = new CustomEditColumn('Email Destinatario', 'email_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for inscricao_municipal_destinatario field
            //
            $editor = new TextEdit('inscricao_municipal_destinatario_edit');
            $editor->SetMaxLength(30);
            $editColumn = new CustomEditColumn('Inscricao Municipal Destinatario', 'inscricao_municipal_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for cnpj_retirada field
            //
            $editor = new TextEdit('cnpj_retirada_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cnpj Retirada', 'cnpj_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for cpf_retirada field
            //
            $editor = new TextEdit('cpf_retirada_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cpf Retirada', 'cpf_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for logradoura_retirada field
            //
            $editor = new TextAreaEdit('logradoura_retirada_edit', 50, 8);
            $editColumn = new CustomEditColumn('Logradoura Retirada', 'logradoura_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for numero_retirada field
            //
            $editor = new TextEdit('numero_retirada_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Numero Retirada', 'numero_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for complemento_retirada field
            //
            $editor = new TextAreaEdit('complemento_retirada_edit', 50, 8);
            $editColumn = new CustomEditColumn('Complemento Retirada', 'complemento_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for bairro_retirada field
            //
            $editor = new TextEdit('bairro_retirada_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Bairro Retirada', 'bairro_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for codigo_municipio_retirada field
            //
            $editor = new TextEdit('codigo_municipio_retirada_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Codigo Municipio Retirada', 'codigo_municipio_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for municipio_retirada field
            //
            $editor = new TextEdit('municipio_retirada_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Municipio Retirada', 'municipio_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for uf_retirada field
            //
            $editor = new TextEdit('uf_retirada_edit');
            $editor->SetMaxLength(3);
            $editColumn = new CustomEditColumn('Uf Retirada', 'uf_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for cnpj_entrega field
            //
            $editor = new TextEdit('cnpj_entrega_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cnpj Entrega', 'cnpj_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for cpf_entrega field
            //
            $editor = new TextEdit('cpf_entrega_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cpf Entrega', 'cpf_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for logradouro_entrega field
            //
            $editor = new TextAreaEdit('logradouro_entrega_edit', 50, 8);
            $editColumn = new CustomEditColumn('Logradouro Entrega', 'logradouro_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for numero_entrega field
            //
            $editor = new TextEdit('numero_entrega_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Numero Entrega', 'numero_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for complemento_entrega field
            //
            $editor = new TextAreaEdit('complemento_entrega_edit', 50, 8);
            $editColumn = new CustomEditColumn('Complemento Entrega', 'complemento_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for bairro_entrega field
            //
            $editor = new TextEdit('bairro_entrega_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Bairro Entrega', 'bairro_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for codigo_municipio_entrega field
            //
            $editor = new TextEdit('codigo_municipio_entrega_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Codigo Municipio Entrega', 'codigo_municipio_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for municipio_entrega field
            //
            $editor = new TextEdit('municipio_entrega_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Municipio Entrega', 'municipio_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for uf_entrega field
            //
            $editor = new TextEdit('uf_entrega_edit');
            $editor->SetMaxLength(3);
            $editColumn = new CustomEditColumn('Uf Entrega', 'uf_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_base_calculo field
            //
            $editor = new TextEdit('icms_base_calculo_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Base Calculo', 'icms_base_calculo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_valor_total field
            //
            $editor = new TextEdit('icms_valor_total_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor Total', 'icms_valor_total', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_valor_total_desonerado field
            //
            $editor = new TextEdit('icms_valor_total_desonerado_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor Total Desonerado', 'icms_valor_total_desonerado', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_base_calculo_st field
            //
            $editor = new TextEdit('icms_base_calculo_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Base Calculo St', 'icms_base_calculo_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for icms_valor_total_st field
            //
            $editor = new TextEdit('icms_valor_total_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor Total St', 'icms_valor_total_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_produtos field
            //
            $editor = new TextEdit('valor_produtos_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Produtos', 'valor_produtos', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_frete field
            //
            $editor = new TextEdit('valor_frete_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Frete', 'valor_frete', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_seguro field
            //
            $editor = new TextEdit('valor_seguro_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Seguro', 'valor_seguro', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_desconto field
            //
            $editor = new TextEdit('valor_desconto_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Desconto', 'valor_desconto', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_total_ii field
            //
            $editor = new TextEdit('valor_total_ii_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Total Ii', 'valor_total_ii', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_ipi field
            //
            $editor = new TextEdit('valor_ipi_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Ipi', 'valor_ipi', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_pis field
            //
            $editor = new TextEdit('valor_pis_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Pis', 'valor_pis', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_cofins field
            //
            $editor = new TextEdit('valor_cofins_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Cofins', 'valor_cofins', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_outras_despesas field
            //
            $editor = new TextEdit('valor_outras_despesas_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Outras Despesas', 'valor_outras_despesas', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_total field
            //
            $editor = new TextEdit('valor_total_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Total', 'valor_total', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_total_servicos field
            //
            $editor = new TextEdit('valor_total_servicos_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Total Servicos', 'valor_total_servicos', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for base_issqn field
            //
            $editor = new TextEdit('base_issqn_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Base Issqn', 'base_issqn', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_pis_servico field
            //
            $editor = new TextEdit('valor_pis_servico_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Pis Servico', 'valor_pis_servico', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for data_prestacao_servico field
            //
            $editor = new TextEdit('data_prestacao_servico_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Data Prestacao Servico', 'data_prestacao_servico', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_total_deducao_base_calculo field
            //
            $editor = new TextEdit('valor_total_deducao_base_calculo_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Total Deducao Base Calculo', 'valor_total_deducao_base_calculo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_total_outras_retencoes field
            //
            $editor = new TextEdit('valor_total_outras_retencoes_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Total Outras Retencoes', 'valor_total_outras_retencoes', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_total_desconto_incondicionado field
            //
            $editor = new TextEdit('valor_total_desconto_incondicionado_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Total Desconto Incondicionado', 'valor_total_desconto_incondicionado', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_total_valor_condicionado field
            //
            $editor = new TextEdit('valor_total_valor_condicionado_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Total Valor Condicionado', 'valor_total_valor_condicionado', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_total_retencao_iss field
            //
            $editor = new TextEdit('valor_total_retencao_iss_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Total Retencao Iss', 'valor_total_retencao_iss', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for codigo_regime_especial_tributacao field
            //
            $editor = new ComboBox('codigo_regime_especial_tributacao_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`codigo_regime_especial_tributacao`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Codigo Regime Especial Tributacao', 
                'codigo_regime_especial_tributacao', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_retido_pis field
            //
            $editor = new TextEdit('valor_retido_pis_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Retido Pis', 'valor_retido_pis', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_retido_cofins field
            //
            $editor = new TextEdit('valor_retido_cofins_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Retido Cofins', 'valor_retido_cofins', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_retido_csll field
            //
            $editor = new TextEdit('valor_retido_csll_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Retido Csll', 'valor_retido_csll', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for base_calculo_irrf field
            //
            $editor = new TextEdit('base_calculo_irrf_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Base Calculo Irrf', 'base_calculo_irrf', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_retido_irrf field
            //
            $editor = new TextEdit('valor_retido_irrf_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Retido Irrf', 'valor_retido_irrf', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for prev_social_base_calculo field
            //
            $editor = new TextEdit('prev_social_base_calculo_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Prev Social Base Calculo', 'prev_social_base_calculo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for prev_social_valor_retido field
            //
            $editor = new TextEdit('prev_social_valor_retido_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Prev Social Valor Retido', 'prev_social_valor_retido', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for modalidade_frete field
            //
            $editor = new ComboBox('modalidade_frete_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`modalidade_frete`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Modalidade Frete', 
                'modalidade_frete', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for cnpj_transportador field
            //
            $editor = new TextEdit('cnpj_transportador_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cnpj Transportador', 'cnpj_transportador', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for cpf_transportador field
            //
            $editor = new TextEdit('cpf_transportador_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cpf Transportador', 'cpf_transportador', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for nome_transportador field
            //
            $editor = new TextEdit('nome_transportador_edit');
            $editor->SetMaxLength(100);
            $editColumn = new CustomEditColumn('Nome Transportador', 'nome_transportador', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for inscricao_estadual_transportador field
            //
            $editor = new TextEdit('inscricao_estadual_transportador_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Inscricao Estadual Transportador', 'inscricao_estadual_transportador', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for endereco_transportador field
            //
            $editor = new TextAreaEdit('endereco_transportador_edit', 50, 8);
            $editColumn = new CustomEditColumn('Endereco Transportador', 'endereco_transportador', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for municipio_transportador field
            //
            $editor = new TextEdit('municipio_transportador_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Municipio Transportador', 'municipio_transportador', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for uf_transportador field
            //
            $editor = new TextEdit('uf_transportador_edit');
            $editor->SetMaxLength(3);
            $editColumn = new CustomEditColumn('Uf Transportador', 'uf_transportador', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for transporte_icms_servico field
            //
            $editor = new TextEdit('transporte_icms_servico_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Transporte Icms Servico', 'transporte_icms_servico', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for transporte_icms_base_servico field
            //
            $editor = new TextEdit('transporte_icms_base_servico_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Transporte Icms Base Servico', 'transporte_icms_base_servico', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for transporte_icms_aliquota field
            //
            $editor = new TextEdit('transporte_icms_aliquota_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Transporte Icms Aliquota', 'transporte_icms_aliquota', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for transporte_icms_valor field
            //
            $editor = new TextEdit('transporte_icms_valor_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Transporte Icms Valor', 'transporte_icms_valor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for transporte_icms_cfop field
            //
            $editor = new ComboBox('transporte_icms_cfop_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`transporte_icms_cfop`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Transporte Icms Cfop', 
                'transporte_icms_cfop', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for transporte_icms_codigo_municipio field
            //
            $editor = new TextEdit('transporte_icms_codigo_municipio_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Transporte Icms Codigo Municipio', 'transporte_icms_codigo_municipio', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for veiculo_placa field
            //
            $editor = new TextEdit('veiculo_placa_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Veiculo Placa', 'veiculo_placa', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for veiculo_uf field
            //
            $editor = new TextEdit('veiculo_uf_edit');
            $editor->SetMaxLength(3);
            $editColumn = new CustomEditColumn('Veiculo Uf', 'veiculo_uf', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for veiculo_rntc field
            //
            $editor = new TextEdit('veiculo_rntc_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Veiculo Rntc', 'veiculo_rntc', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for veiculo_identificacao_vagao field
            //
            $editor = new TextEdit('veiculo_identificacao_vagao_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Veiculo Identificacao Vagao', 'veiculo_identificacao_vagao', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for veiculo_identificacao_balsa field
            //
            $editor = new TextEdit('veiculo_identificacao_balsa_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Veiculo Identificacao Balsa', 'veiculo_identificacao_balsa', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for numero_fatura field
            //
            $editor = new TextEdit('numero_fatura_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Numero Fatura', 'numero_fatura', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_original_fatura field
            //
            $editor = new TextEdit('valor_original_fatura_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Original Fatura', 'valor_original_fatura', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_desconto_fatura field
            //
            $editor = new TextEdit('valor_desconto_fatura_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Desconto Fatura', 'valor_desconto_fatura', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for valor_liquido_fatura field
            //
            $editor = new TextEdit('valor_liquido_fatura_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Liquido Fatura', 'valor_liquido_fatura', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for informacoes_adicionais_contribuinte field
            //
            $editor = new TextAreaEdit('informacoes_adicionais_contribuinte_edit', 50, 8);
            $editColumn = new CustomEditColumn('Informacoes Adicionais Contribuinte', 'informacoes_adicionais_contribuinte', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for uf_local_embarque field
            //
            $editor = new TextEdit('uf_local_embarque_edit');
            $editor->SetMaxLength(3);
            $editColumn = new CustomEditColumn('Uf Local Embarque', 'uf_local_embarque', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for local_embarque field
            //
            $editor = new TextAreaEdit('local_embarque_edit', 50, 8);
            $editColumn = new CustomEditColumn('Local Embarque', 'local_embarque', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for local_despacho field
            //
            $editor = new TextAreaEdit('local_despacho_edit', 50, 8);
            $editColumn = new CustomEditColumn('Local Despacho', 'local_despacho', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for tx_cancelamento field
            //
            $editor = new TextAreaEdit('tx_cancelamento_edit', 50, 8);
            $editColumn = new CustomEditColumn('Tx Cancelamento', 'tx_cancelamento', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for tx_correcao field
            //
            $editor = new TextAreaEdit('tx_correcao_edit', 50, 8);
            $editColumn = new CustomEditColumn('Tx Correcao', 'tx_correcao', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for id_pedido field
            //
            $editor = new TextEdit('id_pedido_edit');
            $editColumn = new CustomEditColumn('Id Pedido', 'id_pedido', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for numero_nf field
            //
            $editor = new TextEdit('numero_nf_edit');
            $editColumn = new CustomEditColumn('Numero Nf', 'numero_nf', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
        }
    
        protected function AddMultiEditColumns(Grid $grid)
        {
            //
            // Edit column for id_licencas field
            //
            $editor = new TextEdit('id_licencas_edit');
            $editColumn = new CustomEditColumn('Id Licencas', 'id_licencas', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for chave field
            //
            $editor = new TextEdit('chave_edit');
            $editor->SetMaxLength(15);
            $editColumn = new CustomEditColumn('Chave', 'chave', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for sequencia field
            //
            $editor = new TextEdit('sequencia_edit');
            $editColumn = new CustomEditColumn('Sequencia', 'sequencia', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for tipo_nf field
            //
            $editor = new TextEdit('tipo_nf_edit');
            $editor->SetMaxLength(1);
            $editColumn = new CustomEditColumn('Tipo Nf', 'tipo_nf', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for dt_inclusao field
            //
            $editor = new DateTimeEdit('dt_inclusao_edit', false, 'd.m.Y H:i:s');
            $editColumn = new CustomEditColumn('Data Inclusão', 'dt_inclusao', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for dt_concluido field
            //
            $editor = new DateTimeEdit('dt_concluido_edit', false, 'd.m.Y H:i:s');
            $editColumn = new CustomEditColumn('Data Concluído', 'dt_concluido', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for st_nota field
            //
            $editor = new ComboBox('st_nota_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $editor->addChoice('A', 'Aguardando');
            $editor->addChoice('E', 'ERRO NO ENVIO');
            $editor->addChoice('N', 'Homologação');
            $editColumn = new CustomEditColumn('Status Nota', 'st_nota', $editor, $this->dataset);
            $validator = new RequiredValidator(StringUtils::Format($this->GetLocalizerCaptions()->GetMessageString('RequiredValidationMessage'), $editColumn->GetCaption()));
            $editor->GetValidatorCollection()->AddValidator($validator);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for tx_obs field
            //
            $editor = new TextAreaEdit('tx_obs_edit', 50, 8);
            $editColumn = new CustomEditColumn('Ocorrências da NF', 'tx_obs', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for nm_arquivo_retorno field
            //
            $editor = new TextEdit('nm_arquivo_retorno_edit');
            $editor->SetMaxLength(100);
            $editColumn = new CustomEditColumn('Nm Arquivo Retorno', 'nm_arquivo_retorno', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for natureza_operacao field
            //
            $editor = new ComboBox('natureza_operacao_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $selectQuery = 'select id_codigo_cfop,descricao from cfop group by descricao order by descricao';
            $insertQuery = array();
            $updateQuery = array();
            $deleteQuery = array();
            $lookupDataset = new QueryDataset(
              MyConnectionFactory::getInstance(), 
              GetConnectionOptions(),
              $selectQuery, $insertQuery, $updateQuery, $deleteQuery, 'NOP');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_codigo_cfop', true, true, true),
                    new StringField('descricao', true)
                )
            );
            $lookupDataset->setOrderByField('descricao', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Natureza Operação', 
                'natureza_operacao', 
                $editor, 
                $this->dataset, 'descricao', 'descricao', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for forma_pagamento field
            //
            $editor = new ComboBox('forma_pagamento_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $editor->addChoice('0', 'a vista');
            $editor->addChoice('1', 'a prazo');
            $editor->addChoice('2', 'outros');
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`forma_pagamento`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Forma Pagamento', 
                'forma_pagamento', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for data_emissao field
            //
            $editor = new DateTimeEdit('data_emissao_edit', false, 'd.m.Y H:i:s');
            $editColumn = new CustomEditColumn('Data Emissão', 'data_emissao', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for data_entrada_saida field
            //
            $editor = new DateTimeEdit('data_entrada_saida_edit', false, 'd.m.Y H:i:s');
            $editColumn = new CustomEditColumn('Data Entrada Saida', 'data_entrada_saida', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for tipo_documento field
            //
            $editor = new ComboBox('tipo_documento_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $editor->addChoice('0', 'nota entrada');
            $editor->addChoice('1', 'nota saída');
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`tipo_documento`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Tipo Documento', 
                'tipo_documento', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for local_destino field
            //
            $editor = new ComboBox('local_destino_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $editor->addChoice('1', 'operaçao interna');
            $editor->addChoice('2', 'operaçao interestadual');
            $editor->addChoice('3', 'operação com exterior');
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`local_destino`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Local Destino', 
                'local_destino', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for finalidade_emissao field
            //
            $editor = new ComboBox('finalidade_emissao_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $editor->addChoice('1', 'Nota normal');
            $editor->addChoice('2', 'Nota complementar');
            $editor->addChoice('3', 'Nota de ajuste');
            $editor->addChoice('4', 'Devolução de mercadoria');
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`finalidade_emissao`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Finalidade Emissao', 
                'finalidade_emissao', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for consumidor_final field
            //
            $editor = new ComboBox('consumidor_final_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $editor->addChoice('0', 'normal');
            $editor->addChoice('1', 'consumidor final');
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`consumidor_final`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Consumidor Final', 
                'consumidor_final', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for presenca_comprador field
            //
            $editor = new ComboBox('presenca_comprador_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $editor->addChoice('0', 'Não se aplica (por exemplo, para a Nota Fiscal complementar ou de ajuste)');
            $editor->addChoice('1', 'Operação presencial');
            $editor->addChoice('2', 'Operação não presencial, pela internet');
            $editor->addChoice('3', 'Operação não presencial, teleatendimento');
            $editor->addChoice('4', 'NFC-e em operação com entrega em domicílio');
            $editor->addChoice('5', 'Operação não presencial, outros');
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`presenca_comprador`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Presenca Comprador', 
                'presenca_comprador', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for colecao____________________notas_referenciadas field
            //
            $editor = new TextEdit('colecao____________________notas_referenciadas_edit');
            $editor->SetMaxLength(1);
            $editColumn = new CustomEditColumn('Colecao                    Notas Referenciadas', 'colecao____________________notas_referenciadas', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for colecao____________________pessoas_autorizadas field
            //
            $editor = new TextEdit('colecao____________________pessoas_autorizadas_edit');
            $editor->SetMaxLength(1);
            $editColumn = new CustomEditColumn('Colecao                    Pessoas Autorizadas', 'colecao____________________pessoas_autorizadas', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cnpj_emitente field
            //
            $editor = new TextEdit('cnpj_emitente_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cnpj Emitente', 'cnpj_emitente', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for nome_emitente field
            //
            $editor = new TextEdit('nome_emitente_edit');
            $editor->SetMaxLength(100);
            $editColumn = new CustomEditColumn('Nome Emitente', 'nome_emitente', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for nome_fantasia_emitente field
            //
            $editor = new TextEdit('nome_fantasia_emitente_edit');
            $editor->SetMaxLength(40);
            $editColumn = new CustomEditColumn('Nome Fantasia Emitente', 'nome_fantasia_emitente', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for logradouro_emitente field
            //
            $editor = new TextAreaEdit('logradouro_emitente_edit', 50, 8);
            $editColumn = new CustomEditColumn('Logradouro Emitente', 'logradouro_emitente', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for numero_emitente field
            //
            $editor = new TextEdit('numero_emitente_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Numero Emitente', 'numero_emitente', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for complemento_emitente field
            //
            $editor = new TextAreaEdit('complemento_emitente_edit', 50, 8);
            $editColumn = new CustomEditColumn('Complemento Emitente', 'complemento_emitente', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for bairro_emitente field
            //
            $editor = new TextEdit('bairro_emitente_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Bairro Emitente', 'bairro_emitente', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for prestador_codigo_municipio field
            //
            $editor = new TextEdit('prestador_codigo_municipio_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Prestador Codigo Municipio', 'prestador_codigo_municipio', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for municipio_emitente field
            //
            $editor = new TextEdit('municipio_emitente_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Municipio Emitente', 'municipio_emitente', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for uf_emitente field
            //
            $editor = new TextEdit('uf_emitente_edit');
            $editor->SetMaxLength(3);
            $editColumn = new CustomEditColumn('Uf Emitente', 'uf_emitente', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cep_emitente field
            //
            $editor = new TextEdit('cep_emitente_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Cep Emitente', 'cep_emitente', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for telefone_emitente field
            //
            $editor = new TextEdit('telefone_emitente_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Telefone Emitente', 'telefone_emitente', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for inscricao_estadual_emitenete field
            //
            $editor = new TextEdit('inscricao_estadual_emitenete_edit');
            $editor->SetMaxLength(30);
            $editColumn = new CustomEditColumn('Inscricao Estadual Emitenete', 'inscricao_estadual_emitenete', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for inscricao_estadual_st_emitente field
            //
            $editor = new TextEdit('inscricao_estadual_st_emitente_edit');
            $editor->SetMaxLength(30);
            $editColumn = new CustomEditColumn('Inscricao Estadual St Emitente', 'inscricao_estadual_st_emitente', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for inscricao_municipal_emitente field
            //
            $editor = new TextEdit('inscricao_municipal_emitente_edit');
            $editor->SetMaxLength(30);
            $editColumn = new CustomEditColumn('Inscricao Municipal Emitente', 'inscricao_municipal_emitente', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cnae_emitente field
            //
            $editor = new TextEdit('cnae_emitente_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cnae Emitente', 'cnae_emitente', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for regime_tributario_emitente field
            //
            $editor = new ComboBox('regime_tributario_emitente_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`regime_tributario`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Regime Tributario Emitente', 
                'regime_tributario_emitente', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cnpj_destinatario field
            //
            $editor = new TextEdit('cnpj_destinatario_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cnpj Destinatario', 'cnpj_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cpf_destinatario field
            //
            $editor = new TextEdit('cpf_destinatario_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cpf Destinatario', 'cpf_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for id_estrangeiro_destinatario field
            //
            $editor = new TextEdit('id_estrangeiro_destinatario_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Id Estrangeiro Destinatario', 'id_estrangeiro_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for nome_destinatario field
            //
            $editor = new TextEdit('nome_destinatario_edit');
            $editor->SetMaxLength(100);
            $editColumn = new CustomEditColumn('Nome Destinatario', 'nome_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for logradoura_destinatario field
            //
            $editor = new TextAreaEdit('logradoura_destinatario_edit', 50, 8);
            $editColumn = new CustomEditColumn('Logradoura Destinatario', 'logradoura_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for numero_destinatario field
            //
            $editor = new TextEdit('numero_destinatario_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Numero Destinatario', 'numero_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for complemento_destinatario field
            //
            $editor = new TextAreaEdit('complemento_destinatario_edit', 50, 8);
            $editColumn = new CustomEditColumn('Complemento Destinatario', 'complemento_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for bairro_destinatario field
            //
            $editor = new TextEdit('bairro_destinatario_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Bairro Destinatario', 'bairro_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for codigo_municipio_destinatario field
            //
            $editor = new TextEdit('codigo_municipio_destinatario_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Codigo Municipio Destinatario', 'codigo_municipio_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for municipio_destinatario field
            //
            $editor = new TextEdit('municipio_destinatario_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Municipio Destinatario', 'municipio_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for uf_destinatario field
            //
            $editor = new TextEdit('uf_destinatario_edit');
            $editor->SetMaxLength(3);
            $editColumn = new CustomEditColumn('Uf Destinatario', 'uf_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cep_destinatario field
            //
            $editor = new TextEdit('cep_destinatario_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Cep Destinatario', 'cep_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for pais_destinatario field
            //
            $editor = new TextEdit('pais_destinatario_edit');
            $editor->SetMaxLength(30);
            $editColumn = new CustomEditColumn('Pais Destinatario', 'pais_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for telefone_destinatario field
            //
            $editor = new TextEdit('telefone_destinatario_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Telefone Destinatario', 'telefone_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for indicador_inscricao_estadual_destinatario field
            //
            $editor = new ComboBox('indicador_inscricao_estadual_destinatario_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $editor->addChoice('1', 'Contribuinte ICMS (informar a IE do destinatário)');
            $editor->addChoice('2', 'Contribuinte isento de Inscrição no cadastro de Contribuintes do ICMS');
            $editor->addChoice('9', 'Não Contribuinte, que pode ou não possuir Inscrição Estadual no Cadastro de Contribuintes ');
            $editColumn = new CustomEditColumn('Indicador Inscricao Estadual Destinatario', 'indicador_inscricao_estadual_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for inscricao_estadual_destinatario field
            //
            $editor = new TextEdit('inscricao_estadual_destinatario_edit');
            $editor->SetMaxLength(30);
            $editColumn = new CustomEditColumn('Inscricao Estadual Destinatario', 'inscricao_estadual_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for inscricao_suframa_destinatario field
            //
            $editor = new TextEdit('inscricao_suframa_destinatario_edit');
            $editor->SetMaxLength(30);
            $editColumn = new CustomEditColumn('Inscricao Suframa Destinatario', 'inscricao_suframa_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for email_destinatario field
            //
            $editor = new TextEdit('email_destinatario_edit');
            $editor->SetMaxLength(100);
            $editColumn = new CustomEditColumn('Email Destinatario', 'email_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for inscricao_municipal_destinatario field
            //
            $editor = new TextEdit('inscricao_municipal_destinatario_edit');
            $editor->SetMaxLength(30);
            $editColumn = new CustomEditColumn('Inscricao Municipal Destinatario', 'inscricao_municipal_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cnpj_retirada field
            //
            $editor = new TextEdit('cnpj_retirada_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cnpj Retirada', 'cnpj_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cpf_retirada field
            //
            $editor = new TextEdit('cpf_retirada_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cpf Retirada', 'cpf_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for logradoura_retirada field
            //
            $editor = new TextAreaEdit('logradoura_retirada_edit', 50, 8);
            $editColumn = new CustomEditColumn('Logradoura Retirada', 'logradoura_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for numero_retirada field
            //
            $editor = new TextEdit('numero_retirada_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Numero Retirada', 'numero_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for complemento_retirada field
            //
            $editor = new TextAreaEdit('complemento_retirada_edit', 50, 8);
            $editColumn = new CustomEditColumn('Complemento Retirada', 'complemento_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for bairro_retirada field
            //
            $editor = new TextEdit('bairro_retirada_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Bairro Retirada', 'bairro_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for codigo_municipio_retirada field
            //
            $editor = new TextEdit('codigo_municipio_retirada_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Codigo Municipio Retirada', 'codigo_municipio_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for municipio_retirada field
            //
            $editor = new TextEdit('municipio_retirada_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Municipio Retirada', 'municipio_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for uf_retirada field
            //
            $editor = new TextEdit('uf_retirada_edit');
            $editor->SetMaxLength(3);
            $editColumn = new CustomEditColumn('Uf Retirada', 'uf_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cnpj_entrega field
            //
            $editor = new TextEdit('cnpj_entrega_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cnpj Entrega', 'cnpj_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cpf_entrega field
            //
            $editor = new TextEdit('cpf_entrega_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cpf Entrega', 'cpf_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for logradouro_entrega field
            //
            $editor = new TextAreaEdit('logradouro_entrega_edit', 50, 8);
            $editColumn = new CustomEditColumn('Logradouro Entrega', 'logradouro_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for numero_entrega field
            //
            $editor = new TextEdit('numero_entrega_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Numero Entrega', 'numero_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for complemento_entrega field
            //
            $editor = new TextAreaEdit('complemento_entrega_edit', 50, 8);
            $editColumn = new CustomEditColumn('Complemento Entrega', 'complemento_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for bairro_entrega field
            //
            $editor = new TextEdit('bairro_entrega_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Bairro Entrega', 'bairro_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for codigo_municipio_entrega field
            //
            $editor = new TextEdit('codigo_municipio_entrega_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Codigo Municipio Entrega', 'codigo_municipio_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for municipio_entrega field
            //
            $editor = new TextEdit('municipio_entrega_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Municipio Entrega', 'municipio_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for uf_entrega field
            //
            $editor = new TextEdit('uf_entrega_edit');
            $editor->SetMaxLength(3);
            $editColumn = new CustomEditColumn('Uf Entrega', 'uf_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for colecao____________________itens field
            //
            $editor = new TextEdit('colecao____________________itens_edit');
            $editor->SetMaxLength(1);
            $editColumn = new CustomEditColumn('Colecao                    Itens', 'colecao____________________itens', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_base_calculo field
            //
            $editor = new TextEdit('icms_base_calculo_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Base Calculo', 'icms_base_calculo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_valor_total field
            //
            $editor = new TextEdit('icms_valor_total_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor Total', 'icms_valor_total', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_valor_total_desonerado field
            //
            $editor = new TextEdit('icms_valor_total_desonerado_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor Total Desonerado', 'icms_valor_total_desonerado', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_base_calculo_st field
            //
            $editor = new TextEdit('icms_base_calculo_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Base Calculo St', 'icms_base_calculo_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for icms_valor_total_st field
            //
            $editor = new TextEdit('icms_valor_total_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor Total St', 'icms_valor_total_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_produtos field
            //
            $editor = new TextEdit('valor_produtos_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Produtos', 'valor_produtos', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_frete field
            //
            $editor = new TextEdit('valor_frete_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Frete', 'valor_frete', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_seguro field
            //
            $editor = new TextEdit('valor_seguro_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Seguro', 'valor_seguro', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_desconto field
            //
            $editor = new TextEdit('valor_desconto_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Desconto', 'valor_desconto', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_total_ii field
            //
            $editor = new TextEdit('valor_total_ii_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Total Ii', 'valor_total_ii', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_ipi field
            //
            $editor = new TextEdit('valor_ipi_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Ipi', 'valor_ipi', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_pis field
            //
            $editor = new TextEdit('valor_pis_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Pis', 'valor_pis', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_cofins field
            //
            $editor = new TextEdit('valor_cofins_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Cofins', 'valor_cofins', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_outras_despesas field
            //
            $editor = new TextEdit('valor_outras_despesas_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Outras Despesas', 'valor_outras_despesas', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_total field
            //
            $editor = new TextEdit('valor_total_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Total', 'valor_total', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_total_servicos field
            //
            $editor = new TextEdit('valor_total_servicos_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Total Servicos', 'valor_total_servicos', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for base_issqn field
            //
            $editor = new TextEdit('base_issqn_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Base Issqn', 'base_issqn', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_pis_servico field
            //
            $editor = new TextEdit('valor_pis_servico_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Pis Servico', 'valor_pis_servico', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for data_prestacao_servico field
            //
            $editor = new TextEdit('data_prestacao_servico_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Data Prestacao Servico', 'data_prestacao_servico', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_total_deducao_base_calculo field
            //
            $editor = new TextEdit('valor_total_deducao_base_calculo_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Total Deducao Base Calculo', 'valor_total_deducao_base_calculo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_total_outras_retencoes field
            //
            $editor = new TextEdit('valor_total_outras_retencoes_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Total Outras Retencoes', 'valor_total_outras_retencoes', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_total_desconto_incondicionado field
            //
            $editor = new TextEdit('valor_total_desconto_incondicionado_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Total Desconto Incondicionado', 'valor_total_desconto_incondicionado', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_total_valor_condicionado field
            //
            $editor = new TextEdit('valor_total_valor_condicionado_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Total Valor Condicionado', 'valor_total_valor_condicionado', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_total_retencao_iss field
            //
            $editor = new TextEdit('valor_total_retencao_iss_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Total Retencao Iss', 'valor_total_retencao_iss', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for codigo_regime_especial_tributacao field
            //
            $editor = new ComboBox('codigo_regime_especial_tributacao_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`codigo_regime_especial_tributacao`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Codigo Regime Especial Tributacao', 
                'codigo_regime_especial_tributacao', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_retido_pis field
            //
            $editor = new TextEdit('valor_retido_pis_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Retido Pis', 'valor_retido_pis', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_retido_cofins field
            //
            $editor = new TextEdit('valor_retido_cofins_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Retido Cofins', 'valor_retido_cofins', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_retido_csll field
            //
            $editor = new TextEdit('valor_retido_csll_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Retido Csll', 'valor_retido_csll', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for base_calculo_irrf field
            //
            $editor = new TextEdit('base_calculo_irrf_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Base Calculo Irrf', 'base_calculo_irrf', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_retido_irrf field
            //
            $editor = new TextEdit('valor_retido_irrf_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Retido Irrf', 'valor_retido_irrf', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for prev_social_base_calculo field
            //
            $editor = new TextEdit('prev_social_base_calculo_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Prev Social Base Calculo', 'prev_social_base_calculo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for prev_social_valor_retido field
            //
            $editor = new TextEdit('prev_social_valor_retido_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Prev Social Valor Retido', 'prev_social_valor_retido', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for modalidade_frete field
            //
            $editor = new ComboBox('modalidade_frete_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`modalidade_frete`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Modalidade Frete', 
                'modalidade_frete', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cnpj_transportador field
            //
            $editor = new TextEdit('cnpj_transportador_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cnpj Transportador', 'cnpj_transportador', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for cpf_transportador field
            //
            $editor = new TextEdit('cpf_transportador_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cpf Transportador', 'cpf_transportador', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for nome_transportador field
            //
            $editor = new TextEdit('nome_transportador_edit');
            $editor->SetMaxLength(100);
            $editColumn = new CustomEditColumn('Nome Transportador', 'nome_transportador', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for inscricao_estadual_transportador field
            //
            $editor = new TextEdit('inscricao_estadual_transportador_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Inscricao Estadual Transportador', 'inscricao_estadual_transportador', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for endereco_transportador field
            //
            $editor = new TextAreaEdit('endereco_transportador_edit', 50, 8);
            $editColumn = new CustomEditColumn('Endereco Transportador', 'endereco_transportador', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for municipio_transportador field
            //
            $editor = new TextEdit('municipio_transportador_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Municipio Transportador', 'municipio_transportador', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for uf_transportador field
            //
            $editor = new TextEdit('uf_transportador_edit');
            $editor->SetMaxLength(3);
            $editColumn = new CustomEditColumn('Uf Transportador', 'uf_transportador', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for transporte_icms_servico field
            //
            $editor = new TextEdit('transporte_icms_servico_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Transporte Icms Servico', 'transporte_icms_servico', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for transporte_icms_base_servico field
            //
            $editor = new TextEdit('transporte_icms_base_servico_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Transporte Icms Base Servico', 'transporte_icms_base_servico', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for transporte_icms_aliquota field
            //
            $editor = new TextEdit('transporte_icms_aliquota_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Transporte Icms Aliquota', 'transporte_icms_aliquota', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for transporte_icms_valor field
            //
            $editor = new TextEdit('transporte_icms_valor_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Transporte Icms Valor', 'transporte_icms_valor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for transporte_icms_cfop field
            //
            $editor = new ComboBox('transporte_icms_cfop_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`transporte_icms_cfop`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Transporte Icms Cfop', 
                'transporte_icms_cfop', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for transporte_icms_codigo_municipio field
            //
            $editor = new TextEdit('transporte_icms_codigo_municipio_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Transporte Icms Codigo Municipio', 'transporte_icms_codigo_municipio', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for veiculo_placa field
            //
            $editor = new TextEdit('veiculo_placa_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Veiculo Placa', 'veiculo_placa', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for veiculo_uf field
            //
            $editor = new TextEdit('veiculo_uf_edit');
            $editor->SetMaxLength(3);
            $editColumn = new CustomEditColumn('Veiculo Uf', 'veiculo_uf', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for veiculo_rntc field
            //
            $editor = new TextEdit('veiculo_rntc_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Veiculo Rntc', 'veiculo_rntc', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for veiculo_identificacao_vagao field
            //
            $editor = new TextEdit('veiculo_identificacao_vagao_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Veiculo Identificacao Vagao', 'veiculo_identificacao_vagao', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for veiculo_identificacao_balsa field
            //
            $editor = new TextEdit('veiculo_identificacao_balsa_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Veiculo Identificacao Balsa', 'veiculo_identificacao_balsa', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for colecao____________________volumes field
            //
            $editor = new TextEdit('colecao____________________volumes_edit');
            $editor->SetMaxLength(1);
            $editColumn = new CustomEditColumn('Colecao                    Volumes', 'colecao____________________volumes', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for numero_fatura field
            //
            $editor = new TextEdit('numero_fatura_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Numero Fatura', 'numero_fatura', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_original_fatura field
            //
            $editor = new TextEdit('valor_original_fatura_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Original Fatura', 'valor_original_fatura', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_desconto_fatura field
            //
            $editor = new TextEdit('valor_desconto_fatura_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Desconto Fatura', 'valor_desconto_fatura', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for valor_liquido_fatura field
            //
            $editor = new TextEdit('valor_liquido_fatura_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Liquido Fatura', 'valor_liquido_fatura', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for colecao____________________duplicatas field
            //
            $editor = new TextAreaEdit('colecao____________________duplicatas_edit', 50, 8);
            $editColumn = new CustomEditColumn('Colecao                    Duplicatas', 'colecao____________________duplicatas', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for informacoes_adicionais_contribuinte field
            //
            $editor = new TextAreaEdit('informacoes_adicionais_contribuinte_edit', 50, 8);
            $editColumn = new CustomEditColumn('Informacoes Adicionais Contribuinte', 'informacoes_adicionais_contribuinte', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for uf_local_embarque field
            //
            $editor = new TextEdit('uf_local_embarque_edit');
            $editor->SetMaxLength(3);
            $editColumn = new CustomEditColumn('Uf Local Embarque', 'uf_local_embarque', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for local_embarque field
            //
            $editor = new TextAreaEdit('local_embarque_edit', 50, 8);
            $editColumn = new CustomEditColumn('Local Embarque', 'local_embarque', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for local_despacho field
            //
            $editor = new TextAreaEdit('local_despacho_edit', 50, 8);
            $editColumn = new CustomEditColumn('Local Despacho', 'local_despacho', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for colecao____________________formas_pagamento field
            //
            $editor = new TextEdit('colecao____________________formas_pagamento_edit');
            $editor->SetMaxLength(1);
            $editColumn = new CustomEditColumn('Colecao                    Formas Pagamento', 'colecao____________________formas_pagamento', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for operacao field
            //
            $editor = new TextEdit('operacao_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Operacao', 'operacao', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for tx_cancelamento field
            //
            $editor = new TextAreaEdit('tx_cancelamento_edit', 50, 8);
            $editColumn = new CustomEditColumn('Tx Cancelamento', 'tx_cancelamento', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for tx_correcao field
            //
            $editor = new TextAreaEdit('tx_correcao_edit', 50, 8);
            $editColumn = new CustomEditColumn('Tx Correcao', 'tx_correcao', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for id_pedido field
            //
            $editor = new TextEdit('id_pedido_edit');
            $editColumn = new CustomEditColumn('Id Pedido', 'id_pedido', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
            
            //
            // Edit column for numero_nf field
            //
            $editor = new TextEdit('numero_nf_edit');
            $editColumn = new CustomEditColumn('Numero Nf', 'numero_nf', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddMultiEditColumn($editColumn);
        }
    
        protected function AddInsertColumns(Grid $grid)
        {
            //
            // Edit column for dt_inclusao field
            //
            $editor = new DateTimeEdit('dt_inclusao_edit', false, 'd.m.Y H:i:s');
            $editColumn = new CustomEditColumn('Data Inclusão', 'dt_inclusao', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for natureza_operacao field
            //
            $editor = new ComboBox('natureza_operacao_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $selectQuery = 'select id_codigo_cfop,descricao from cfop group by descricao order by descricao';
            $insertQuery = array();
            $updateQuery = array();
            $deleteQuery = array();
            $lookupDataset = new QueryDataset(
              MyConnectionFactory::getInstance(), 
              GetConnectionOptions(),
              $selectQuery, $insertQuery, $updateQuery, $deleteQuery, 'NOP');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_codigo_cfop', true, true, true),
                    new StringField('descricao', true)
                )
            );
            $lookupDataset->setOrderByField('descricao', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Natureza Operação', 
                'natureza_operacao', 
                $editor, 
                $this->dataset, 'descricao', 'descricao', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for forma_pagamento field
            //
            $editor = new ComboBox('forma_pagamento_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $editor->addChoice('0', 'a vista');
            $editor->addChoice('1', 'a prazo');
            $editor->addChoice('2', 'outros');
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`forma_pagamento`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Forma Pagamento', 
                'forma_pagamento', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for data_emissao field
            //
            $editor = new DateTimeEdit('data_emissao_edit', false, 'd.m.Y H:i:s');
            $editColumn = new CustomEditColumn('Data Emissão', 'data_emissao', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for data_entrada_saida field
            //
            $editor = new DateTimeEdit('data_entrada_saida_edit', false, 'd.m.Y H:i:s');
            $editColumn = new CustomEditColumn('Data Entrada Saida', 'data_entrada_saida', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for tipo_documento field
            //
            $editor = new ComboBox('tipo_documento_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $editor->addChoice('0', 'nota entrada');
            $editor->addChoice('1', 'nota saída');
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`tipo_documento`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Tipo Documento', 
                'tipo_documento', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for local_destino field
            //
            $editor = new ComboBox('local_destino_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $editor->addChoice('1', 'operaçao interna');
            $editor->addChoice('2', 'operaçao interestadual');
            $editor->addChoice('3', 'operação com exterior');
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`local_destino`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Local Destino', 
                'local_destino', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for finalidade_emissao field
            //
            $editor = new ComboBox('finalidade_emissao_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $editor->addChoice('1', 'Nota normal');
            $editor->addChoice('2', 'Nota complementar');
            $editor->addChoice('3', 'Nota de ajuste');
            $editor->addChoice('4', 'Devolução de mercadoria');
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`finalidade_emissao`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Finalidade Emissao', 
                'finalidade_emissao', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for consumidor_final field
            //
            $editor = new ComboBox('consumidor_final_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $editor->addChoice('0', 'normal');
            $editor->addChoice('1', 'consumidor final');
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`consumidor_final`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Consumidor Final', 
                'consumidor_final', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for presenca_comprador field
            //
            $editor = new ComboBox('presenca_comprador_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $editor->addChoice('0', 'Não se aplica (por exemplo, para a Nota Fiscal complementar ou de ajuste)');
            $editor->addChoice('1', 'Operação presencial');
            $editor->addChoice('2', 'Operação não presencial, pela internet');
            $editor->addChoice('3', 'Operação não presencial, teleatendimento');
            $editor->addChoice('4', 'NFC-e em operação com entrega em domicílio');
            $editor->addChoice('5', 'Operação não presencial, outros');
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`presenca_comprador`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Presenca Comprador', 
                'presenca_comprador', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for cnpj_destinatario field
            //
            $editor = new TextEdit('cnpj_destinatario_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cnpj Destinatario', 'cnpj_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for cpf_destinatario field
            //
            $editor = new TextEdit('cpf_destinatario_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cpf Destinatario', 'cpf_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for id_estrangeiro_destinatario field
            //
            $editor = new TextEdit('id_estrangeiro_destinatario_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Id Estrangeiro Destinatario', 'id_estrangeiro_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for nome_destinatario field
            //
            $editor = new TextEdit('nome_destinatario_edit');
            $editor->SetMaxLength(100);
            $editColumn = new CustomEditColumn('Nome Destinatario', 'nome_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for logradoura_destinatario field
            //
            $editor = new TextAreaEdit('logradoura_destinatario_edit', 50, 8);
            $editColumn = new CustomEditColumn('Logradoura Destinatario', 'logradoura_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for numero_destinatario field
            //
            $editor = new TextEdit('numero_destinatario_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Numero Destinatario', 'numero_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for complemento_destinatario field
            //
            $editor = new TextAreaEdit('complemento_destinatario_edit', 50, 8);
            $editColumn = new CustomEditColumn('Complemento Destinatario', 'complemento_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for bairro_destinatario field
            //
            $editor = new TextEdit('bairro_destinatario_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Bairro Destinatario', 'bairro_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for codigo_municipio_destinatario field
            //
            $editor = new TextEdit('codigo_municipio_destinatario_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Codigo Municipio Destinatario', 'codigo_municipio_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for municipio_destinatario field
            //
            $editor = new TextEdit('municipio_destinatario_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Municipio Destinatario', 'municipio_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for uf_destinatario field
            //
            $editor = new TextEdit('uf_destinatario_edit');
            $editor->SetMaxLength(3);
            $editColumn = new CustomEditColumn('Uf Destinatario', 'uf_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for cep_destinatario field
            //
            $editor = new TextEdit('cep_destinatario_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Cep Destinatario', 'cep_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for pais_destinatario field
            //
            $editor = new TextEdit('pais_destinatario_edit');
            $editor->SetMaxLength(30);
            $editColumn = new CustomEditColumn('Pais Destinatario', 'pais_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for telefone_destinatario field
            //
            $editor = new TextEdit('telefone_destinatario_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Telefone Destinatario', 'telefone_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for indicador_inscricao_estadual_destinatario field
            //
            $editor = new ComboBox('indicador_inscricao_estadual_destinatario_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $editor->addChoice('1', 'Contribuinte ICMS (informar a IE do destinatário)');
            $editor->addChoice('2', 'Contribuinte isento de Inscrição no cadastro de Contribuintes do ICMS');
            $editor->addChoice('9', 'Não Contribuinte, que pode ou não possuir Inscrição Estadual no Cadastro de Contribuintes ');
            $editColumn = new CustomEditColumn('Indicador Inscricao Estadual Destinatario', 'indicador_inscricao_estadual_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for inscricao_estadual_destinatario field
            //
            $editor = new TextEdit('inscricao_estadual_destinatario_edit');
            $editor->SetMaxLength(30);
            $editColumn = new CustomEditColumn('Inscricao Estadual Destinatario', 'inscricao_estadual_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for inscricao_suframa_destinatario field
            //
            $editor = new TextEdit('inscricao_suframa_destinatario_edit');
            $editor->SetMaxLength(30);
            $editColumn = new CustomEditColumn('Inscricao Suframa Destinatario', 'inscricao_suframa_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for email_destinatario field
            //
            $editor = new TextEdit('email_destinatario_edit');
            $editor->SetMaxLength(100);
            $editColumn = new CustomEditColumn('Email Destinatario', 'email_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for inscricao_municipal_destinatario field
            //
            $editor = new TextEdit('inscricao_municipal_destinatario_edit');
            $editor->SetMaxLength(30);
            $editColumn = new CustomEditColumn('Inscricao Municipal Destinatario', 'inscricao_municipal_destinatario', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for cnpj_retirada field
            //
            $editor = new TextEdit('cnpj_retirada_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cnpj Retirada', 'cnpj_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for cpf_retirada field
            //
            $editor = new TextEdit('cpf_retirada_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cpf Retirada', 'cpf_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for logradoura_retirada field
            //
            $editor = new TextAreaEdit('logradoura_retirada_edit', 50, 8);
            $editColumn = new CustomEditColumn('Logradoura Retirada', 'logradoura_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for numero_retirada field
            //
            $editor = new TextEdit('numero_retirada_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Numero Retirada', 'numero_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for complemento_retirada field
            //
            $editor = new TextAreaEdit('complemento_retirada_edit', 50, 8);
            $editColumn = new CustomEditColumn('Complemento Retirada', 'complemento_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for bairro_retirada field
            //
            $editor = new TextEdit('bairro_retirada_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Bairro Retirada', 'bairro_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for codigo_municipio_retirada field
            //
            $editor = new TextEdit('codigo_municipio_retirada_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Codigo Municipio Retirada', 'codigo_municipio_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for municipio_retirada field
            //
            $editor = new TextEdit('municipio_retirada_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Municipio Retirada', 'municipio_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for uf_retirada field
            //
            $editor = new TextEdit('uf_retirada_edit');
            $editor->SetMaxLength(3);
            $editColumn = new CustomEditColumn('Uf Retirada', 'uf_retirada', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for cnpj_entrega field
            //
            $editor = new TextEdit('cnpj_entrega_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cnpj Entrega', 'cnpj_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for cpf_entrega field
            //
            $editor = new TextEdit('cpf_entrega_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cpf Entrega', 'cpf_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for logradouro_entrega field
            //
            $editor = new TextAreaEdit('logradouro_entrega_edit', 50, 8);
            $editColumn = new CustomEditColumn('Logradouro Entrega', 'logradouro_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for numero_entrega field
            //
            $editor = new TextEdit('numero_entrega_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Numero Entrega', 'numero_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for complemento_entrega field
            //
            $editor = new TextAreaEdit('complemento_entrega_edit', 50, 8);
            $editColumn = new CustomEditColumn('Complemento Entrega', 'complemento_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for bairro_entrega field
            //
            $editor = new TextEdit('bairro_entrega_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Bairro Entrega', 'bairro_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for codigo_municipio_entrega field
            //
            $editor = new TextEdit('codigo_municipio_entrega_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Codigo Municipio Entrega', 'codigo_municipio_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for municipio_entrega field
            //
            $editor = new TextEdit('municipio_entrega_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Municipio Entrega', 'municipio_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for uf_entrega field
            //
            $editor = new TextEdit('uf_entrega_edit');
            $editor->SetMaxLength(3);
            $editColumn = new CustomEditColumn('Uf Entrega', 'uf_entrega', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_base_calculo field
            //
            $editor = new TextEdit('icms_base_calculo_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Base Calculo', 'icms_base_calculo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_valor_total field
            //
            $editor = new TextEdit('icms_valor_total_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor Total', 'icms_valor_total', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_valor_total_desonerado field
            //
            $editor = new TextEdit('icms_valor_total_desonerado_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor Total Desonerado', 'icms_valor_total_desonerado', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_base_calculo_st field
            //
            $editor = new TextEdit('icms_base_calculo_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Base Calculo St', 'icms_base_calculo_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for icms_valor_total_st field
            //
            $editor = new TextEdit('icms_valor_total_st_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Icms Valor Total St', 'icms_valor_total_st', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_produtos field
            //
            $editor = new TextEdit('valor_produtos_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Produtos', 'valor_produtos', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_frete field
            //
            $editor = new TextEdit('valor_frete_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Frete', 'valor_frete', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_seguro field
            //
            $editor = new TextEdit('valor_seguro_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Seguro', 'valor_seguro', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_desconto field
            //
            $editor = new TextEdit('valor_desconto_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Desconto', 'valor_desconto', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_total_ii field
            //
            $editor = new TextEdit('valor_total_ii_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Total Ii', 'valor_total_ii', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_ipi field
            //
            $editor = new TextEdit('valor_ipi_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Ipi', 'valor_ipi', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_pis field
            //
            $editor = new TextEdit('valor_pis_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Pis', 'valor_pis', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_cofins field
            //
            $editor = new TextEdit('valor_cofins_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Cofins', 'valor_cofins', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_outras_despesas field
            //
            $editor = new TextEdit('valor_outras_despesas_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Outras Despesas', 'valor_outras_despesas', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_total field
            //
            $editor = new TextEdit('valor_total_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Total', 'valor_total', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_total_servicos field
            //
            $editor = new TextEdit('valor_total_servicos_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Total Servicos', 'valor_total_servicos', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for base_issqn field
            //
            $editor = new TextEdit('base_issqn_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Base Issqn', 'base_issqn', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_pis_servico field
            //
            $editor = new TextEdit('valor_pis_servico_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Pis Servico', 'valor_pis_servico', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for data_prestacao_servico field
            //
            $editor = new TextEdit('data_prestacao_servico_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Data Prestacao Servico', 'data_prestacao_servico', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_total_deducao_base_calculo field
            //
            $editor = new TextEdit('valor_total_deducao_base_calculo_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Total Deducao Base Calculo', 'valor_total_deducao_base_calculo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_total_outras_retencoes field
            //
            $editor = new TextEdit('valor_total_outras_retencoes_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Total Outras Retencoes', 'valor_total_outras_retencoes', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_total_desconto_incondicionado field
            //
            $editor = new TextEdit('valor_total_desconto_incondicionado_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Total Desconto Incondicionado', 'valor_total_desconto_incondicionado', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_total_valor_condicionado field
            //
            $editor = new TextEdit('valor_total_valor_condicionado_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Total Valor Condicionado', 'valor_total_valor_condicionado', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_total_retencao_iss field
            //
            $editor = new TextEdit('valor_total_retencao_iss_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Total Retencao Iss', 'valor_total_retencao_iss', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for codigo_regime_especial_tributacao field
            //
            $editor = new ComboBox('codigo_regime_especial_tributacao_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`codigo_regime_especial_tributacao`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Codigo Regime Especial Tributacao', 
                'codigo_regime_especial_tributacao', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_retido_pis field
            //
            $editor = new TextEdit('valor_retido_pis_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Retido Pis', 'valor_retido_pis', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_retido_cofins field
            //
            $editor = new TextEdit('valor_retido_cofins_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Retido Cofins', 'valor_retido_cofins', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_retido_csll field
            //
            $editor = new TextEdit('valor_retido_csll_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Retido Csll', 'valor_retido_csll', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for base_calculo_irrf field
            //
            $editor = new TextEdit('base_calculo_irrf_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Base Calculo Irrf', 'base_calculo_irrf', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_retido_irrf field
            //
            $editor = new TextEdit('valor_retido_irrf_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Retido Irrf', 'valor_retido_irrf', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for prev_social_base_calculo field
            //
            $editor = new TextEdit('prev_social_base_calculo_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Prev Social Base Calculo', 'prev_social_base_calculo', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for prev_social_valor_retido field
            //
            $editor = new TextEdit('prev_social_valor_retido_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Prev Social Valor Retido', 'prev_social_valor_retido', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for modalidade_frete field
            //
            $editor = new ComboBox('modalidade_frete_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`modalidade_frete`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Modalidade Frete', 
                'modalidade_frete', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for cnpj_transportador field
            //
            $editor = new TextEdit('cnpj_transportador_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cnpj Transportador', 'cnpj_transportador', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for cpf_transportador field
            //
            $editor = new TextEdit('cpf_transportador_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Cpf Transportador', 'cpf_transportador', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for nome_transportador field
            //
            $editor = new TextEdit('nome_transportador_edit');
            $editor->SetMaxLength(100);
            $editColumn = new CustomEditColumn('Nome Transportador', 'nome_transportador', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for inscricao_estadual_transportador field
            //
            $editor = new TextEdit('inscricao_estadual_transportador_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Inscricao Estadual Transportador', 'inscricao_estadual_transportador', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for endereco_transportador field
            //
            $editor = new TextAreaEdit('endereco_transportador_edit', 50, 8);
            $editColumn = new CustomEditColumn('Endereco Transportador', 'endereco_transportador', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for municipio_transportador field
            //
            $editor = new TextEdit('municipio_transportador_edit');
            $editor->SetMaxLength(60);
            $editColumn = new CustomEditColumn('Municipio Transportador', 'municipio_transportador', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for uf_transportador field
            //
            $editor = new TextEdit('uf_transportador_edit');
            $editor->SetMaxLength(3);
            $editColumn = new CustomEditColumn('Uf Transportador', 'uf_transportador', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for transporte_icms_servico field
            //
            $editor = new TextEdit('transporte_icms_servico_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Transporte Icms Servico', 'transporte_icms_servico', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for transporte_icms_base_servico field
            //
            $editor = new TextEdit('transporte_icms_base_servico_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Transporte Icms Base Servico', 'transporte_icms_base_servico', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for transporte_icms_aliquota field
            //
            $editor = new TextEdit('transporte_icms_aliquota_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Transporte Icms Aliquota', 'transporte_icms_aliquota', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for transporte_icms_valor field
            //
            $editor = new TextEdit('transporte_icms_valor_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Transporte Icms Valor', 'transporte_icms_valor', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for transporte_icms_cfop field
            //
            $editor = new ComboBox('transporte_icms_cfop_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                MyConnectionFactory::getInstance(),
                GetConnectionOptions(),
                '`transporte_icms_cfop`');
            $lookupDataset->addFields(
                array(
                    new IntegerField('id_tabelas', true),
                    new StringField('nm_arquivo'),
                    new IntegerField('nu_campo'),
                    new StringField('nm_campo'),
                    new StringField('cd_tabela', true),
                    new StringField('ds_tabela')
                )
            );
            $lookupDataset->setOrderByField('ds_tabela', 'ASC');
            $editColumn = new LookUpEditColumn(
                'Transporte Icms Cfop', 
                'transporte_icms_cfop', 
                $editor, 
                $this->dataset, 'cd_tabela', 'ds_tabela', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for transporte_icms_codigo_municipio field
            //
            $editor = new TextEdit('transporte_icms_codigo_municipio_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Transporte Icms Codigo Municipio', 'transporte_icms_codigo_municipio', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for veiculo_placa field
            //
            $editor = new TextEdit('veiculo_placa_edit');
            $editor->SetMaxLength(10);
            $editColumn = new CustomEditColumn('Veiculo Placa', 'veiculo_placa', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for veiculo_uf field
            //
            $editor = new TextEdit('veiculo_uf_edit');
            $editor->SetMaxLength(3);
            $editColumn = new CustomEditColumn('Veiculo Uf', 'veiculo_uf', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for veiculo_rntc field
            //
            $editor = new TextEdit('veiculo_rntc_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Veiculo Rntc', 'veiculo_rntc', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for veiculo_identificacao_vagao field
            //
            $editor = new TextEdit('veiculo_identificacao_vagao_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Veiculo Identificacao Vagao', 'veiculo_identificacao_vagao', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for veiculo_identificacao_balsa field
            //
            $editor = new TextEdit('veiculo_identificacao_balsa_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Veiculo Identificacao Balsa', 'veiculo_identificacao_balsa', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for numero_fatura field
            //
            $editor = new TextEdit('numero_fatura_edit');
            $editor->SetMaxLength(12);
            $editColumn = new CustomEditColumn('Numero Fatura', 'numero_fatura', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_original_fatura field
            //
            $editor = new TextEdit('valor_original_fatura_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Original Fatura', 'valor_original_fatura', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_desconto_fatura field
            //
            $editor = new TextEdit('valor_desconto_fatura_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Desconto Fatura', 'valor_desconto_fatura', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for valor_liquido_fatura field
            //
            $editor = new TextEdit('valor_liquido_fatura_edit');
            $editor->SetMaxLength(20);
            $editColumn = new CustomEditColumn('Valor Liquido Fatura', 'valor_liquido_fatura', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for informacoes_adicionais_contribuinte field
            //
            $editor = new TextAreaEdit('informacoes_adicionais_contribuinte_edit', 50, 8);
            $editColumn = new CustomEditColumn('Informacoes Adicionais Contribuinte', 'informacoes_adicionais_contribuinte', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for uf_local_embarque field
            //
            $editor = new TextEdit('uf_local_embarque_edit');
            $editor->SetMaxLength(3);
            $editColumn = new CustomEditColumn('Uf Local Embarque', 'uf_local_embarque', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for local_embarque field
            //
            $editor = new TextAreaEdit('local_embarque_edit', 50, 8);
            $editColumn = new CustomEditColumn('Local Embarque', 'local_embarque', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for local_despacho field
            //
            $editor = new TextAreaEdit('local_despacho_edit', 50, 8);
            $editColumn = new CustomEditColumn('Local Despacho', 'local_despacho', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for tx_cancelamento field
            //
            $editor = new TextAreaEdit('tx_cancelamento_edit', 50, 8);
            $editColumn = new CustomEditColumn('Tx Cancelamento', 'tx_cancelamento', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for tx_correcao field
            //
            $editor = new TextAreaEdit('tx_correcao_edit', 50, 8);
            $editColumn = new CustomEditColumn('Tx Correcao', 'tx_correcao', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for id_pedido field
            //
            $editor = new TextEdit('id_pedido_edit');
            $editColumn = new CustomEditColumn('Id Pedido', 'id_pedido', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for numero_nf field
            //
            $editor = new TextEdit('numero_nf_edit');
            $editColumn = new CustomEditColumn('Numero Nf', 'numero_nf', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            $grid->SetShowAddButton(false && $this->GetSecurityInfo()->HasAddGrant());
        }
    
        private function AddMultiUploadColumn(Grid $grid)
        {
    
        }
    
        protected function AddPrintColumns(Grid $grid)
        {
            //
            // View column for chave field
            //
            $column = new TextViewColumn('chave', 'chave', 'Chave', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for dt_inclusao field
            //
            $column = new DateTimeViewColumn('dt_inclusao', 'dt_inclusao', 'Data Inclusão', $this->dataset);
            $column->SetOrderable(true);
            $column->SetDateTimeFormat('d.m.Y H:i:s');
            $grid->AddPrintColumn($column);
            
            //
            // View column for st_nota field
            //
            $column = new TextViewColumn('st_nota', 'st_nota', 'Status Nota', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for tx_obs field
            //
            $column = new TextViewColumn('tx_obs', 'tx_obs', 'Ocorrências da NF', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_tx_obs_handler_print');
            $grid->AddPrintColumn($column);
            
            //
            // View column for descricao field
            //
            $column = new TextViewColumn('natureza_operacao', 'natureza_operacao_descricao', 'Natureza Operação', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('forma_pagamento', 'forma_pagamento_ds_tabela', 'Forma Pagamento', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for data_emissao field
            //
            $column = new DateTimeViewColumn('data_emissao', 'data_emissao', 'Data Emissão', $this->dataset);
            $column->SetOrderable(true);
            $column->SetDateTimeFormat('Y-m-d');
            $grid->AddPrintColumn($column);
            
            //
            // View column for data_entrada_saida field
            //
            $column = new DateTimeViewColumn('data_entrada_saida', 'data_entrada_saida', 'Data Entrada Saida', $this->dataset);
            $column->SetOrderable(true);
            $column->SetDateTimeFormat('d.m.Y H:i:s');
            $grid->AddPrintColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('tipo_documento', 'tipo_documento_ds_tabela', 'Tipo Documento', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('local_destino', 'local_destino_ds_tabela', 'Local Destino', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('finalidade_emissao', 'finalidade_emissao_ds_tabela', 'Finalidade Emissao', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('consumidor_final', 'consumidor_final_ds_tabela', 'Consumidor Final', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('presenca_comprador', 'presenca_comprador_ds_tabela', 'Presenca Comprador', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('regime_tributario_emitente', 'regime_tributario_emitente_ds_tabela', 'Regime Tributario Emitente', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for cnpj_destinatario field
            //
            $column = new TextViewColumn('cnpj_destinatario', 'cnpj_destinatario', 'Cnpj Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for cpf_destinatario field
            //
            $column = new TextViewColumn('cpf_destinatario', 'cpf_destinatario', 'Cpf Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for id_estrangeiro_destinatario field
            //
            $column = new TextViewColumn('id_estrangeiro_destinatario', 'id_estrangeiro_destinatario', 'Id Estrangeiro Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for nome_destinatario field
            //
            $column = new TextViewColumn('nome_destinatario', 'nome_destinatario', 'Nome Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_nome_destinatario_handler_print');
            $grid->AddPrintColumn($column);
            
            //
            // View column for logradoura_destinatario field
            //
            $column = new TextViewColumn('logradoura_destinatario', 'logradoura_destinatario', 'Logradoura Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_logradoura_destinatario_handler_print');
            $grid->AddPrintColumn($column);
            
            //
            // View column for numero_destinatario field
            //
            $column = new TextViewColumn('numero_destinatario', 'numero_destinatario', 'Numero Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for complemento_destinatario field
            //
            $column = new TextViewColumn('complemento_destinatario', 'complemento_destinatario', 'Complemento Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_complemento_destinatario_handler_print');
            $grid->AddPrintColumn($column);
            
            //
            // View column for bairro_destinatario field
            //
            $column = new TextViewColumn('bairro_destinatario', 'bairro_destinatario', 'Bairro Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for codigo_municipio_destinatario field
            //
            $column = new TextViewColumn('codigo_municipio_destinatario', 'codigo_municipio_destinatario', 'Codigo Municipio Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for municipio_destinatario field
            //
            $column = new TextViewColumn('municipio_destinatario', 'municipio_destinatario', 'Municipio Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for uf_destinatario field
            //
            $column = new TextViewColumn('uf_destinatario', 'uf_destinatario', 'Uf Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for cep_destinatario field
            //
            $column = new TextViewColumn('cep_destinatario', 'cep_destinatario', 'Cep Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for pais_destinatario field
            //
            $column = new TextViewColumn('pais_destinatario', 'pais_destinatario', 'Pais Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for telefone_destinatario field
            //
            $column = new TextViewColumn('telefone_destinatario', 'telefone_destinatario', 'Telefone Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for indicador_inscricao_estadual_destinatario field
            //
            $column = new TextViewColumn('indicador_inscricao_estadual_destinatario', 'indicador_inscricao_estadual_destinatario', 'Indicador Inscricao Estadual Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for inscricao_estadual_destinatario field
            //
            $column = new TextViewColumn('inscricao_estadual_destinatario', 'inscricao_estadual_destinatario', 'Inscricao Estadual Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for inscricao_suframa_destinatario field
            //
            $column = new TextViewColumn('inscricao_suframa_destinatario', 'inscricao_suframa_destinatario', 'Inscricao Suframa Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for email_destinatario field
            //
            $column = new TextViewColumn('email_destinatario', 'email_destinatario', 'Email Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_email_destinatario_handler_print');
            $grid->AddPrintColumn($column);
            
            //
            // View column for inscricao_municipal_destinatario field
            //
            $column = new TextViewColumn('inscricao_municipal_destinatario', 'inscricao_municipal_destinatario', 'Inscricao Municipal Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for cnpj_retirada field
            //
            $column = new TextViewColumn('cnpj_retirada', 'cnpj_retirada', 'Cnpj Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for cpf_retirada field
            //
            $column = new TextViewColumn('cpf_retirada', 'cpf_retirada', 'Cpf Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for logradoura_retirada field
            //
            $column = new TextViewColumn('logradoura_retirada', 'logradoura_retirada', 'Logradoura Retirada', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_logradoura_retirada_handler_print');
            $grid->AddPrintColumn($column);
            
            //
            // View column for numero_retirada field
            //
            $column = new TextViewColumn('numero_retirada', 'numero_retirada', 'Numero Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for complemento_retirada field
            //
            $column = new TextViewColumn('complemento_retirada', 'complemento_retirada', 'Complemento Retirada', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_complemento_retirada_handler_print');
            $grid->AddPrintColumn($column);
            
            //
            // View column for bairro_retirada field
            //
            $column = new TextViewColumn('bairro_retirada', 'bairro_retirada', 'Bairro Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for codigo_municipio_retirada field
            //
            $column = new TextViewColumn('codigo_municipio_retirada', 'codigo_municipio_retirada', 'Codigo Municipio Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for municipio_retirada field
            //
            $column = new TextViewColumn('municipio_retirada', 'municipio_retirada', 'Municipio Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for uf_retirada field
            //
            $column = new TextViewColumn('uf_retirada', 'uf_retirada', 'Uf Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for cnpj_entrega field
            //
            $column = new TextViewColumn('cnpj_entrega', 'cnpj_entrega', 'Cnpj Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for cpf_entrega field
            //
            $column = new TextViewColumn('cpf_entrega', 'cpf_entrega', 'Cpf Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for logradouro_entrega field
            //
            $column = new TextViewColumn('logradouro_entrega', 'logradouro_entrega', 'Logradouro Entrega', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_logradouro_entrega_handler_print');
            $grid->AddPrintColumn($column);
            
            //
            // View column for numero_entrega field
            //
            $column = new TextViewColumn('numero_entrega', 'numero_entrega', 'Numero Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for complemento_entrega field
            //
            $column = new TextViewColumn('complemento_entrega', 'complemento_entrega', 'Complemento Entrega', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_complemento_entrega_handler_print');
            $grid->AddPrintColumn($column);
            
            //
            // View column for bairro_entrega field
            //
            $column = new TextViewColumn('bairro_entrega', 'bairro_entrega', 'Bairro Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for codigo_municipio_entrega field
            //
            $column = new TextViewColumn('codigo_municipio_entrega', 'codigo_municipio_entrega', 'Codigo Municipio Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for municipio_entrega field
            //
            $column = new TextViewColumn('municipio_entrega', 'municipio_entrega', 'Municipio Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for uf_entrega field
            //
            $column = new TextViewColumn('uf_entrega', 'uf_entrega', 'Uf Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for icms_base_calculo field
            //
            $column = new TextViewColumn('icms_base_calculo', 'icms_base_calculo', 'Icms Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for icms_valor_total field
            //
            $column = new TextViewColumn('icms_valor_total', 'icms_valor_total', 'Icms Valor Total', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for icms_valor_total_desonerado field
            //
            $column = new TextViewColumn('icms_valor_total_desonerado', 'icms_valor_total_desonerado', 'Icms Valor Total Desonerado', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for icms_base_calculo_st field
            //
            $column = new TextViewColumn('icms_base_calculo_st', 'icms_base_calculo_st', 'Icms Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for icms_valor_total_st field
            //
            $column = new TextViewColumn('icms_valor_total_st', 'icms_valor_total_st', 'Icms Valor Total St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_produtos field
            //
            $column = new TextViewColumn('valor_produtos', 'valor_produtos', 'Valor Produtos', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_frete field
            //
            $column = new TextViewColumn('valor_frete', 'valor_frete', 'Valor Frete', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_seguro field
            //
            $column = new TextViewColumn('valor_seguro', 'valor_seguro', 'Valor Seguro', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_desconto field
            //
            $column = new TextViewColumn('valor_desconto', 'valor_desconto', 'Valor Desconto', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_total_ii field
            //
            $column = new TextViewColumn('valor_total_ii', 'valor_total_ii', 'Valor Total Ii', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_ipi field
            //
            $column = new TextViewColumn('valor_ipi', 'valor_ipi', 'Valor Ipi', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_pis field
            //
            $column = new TextViewColumn('valor_pis', 'valor_pis', 'Valor Pis', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_cofins field
            //
            $column = new TextViewColumn('valor_cofins', 'valor_cofins', 'Valor Cofins', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_outras_despesas field
            //
            $column = new TextViewColumn('valor_outras_despesas', 'valor_outras_despesas', 'Valor Outras Despesas', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_total field
            //
            $column = new TextViewColumn('valor_total', 'valor_total', 'Valor Total', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_total_servicos field
            //
            $column = new TextViewColumn('valor_total_servicos', 'valor_total_servicos', 'Valor Total Servicos', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for base_issqn field
            //
            $column = new TextViewColumn('base_issqn', 'base_issqn', 'Base Issqn', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_pis_servico field
            //
            $column = new TextViewColumn('valor_pis_servico', 'valor_pis_servico', 'Valor Pis Servico', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for data_prestacao_servico field
            //
            $column = new TextViewColumn('data_prestacao_servico', 'data_prestacao_servico', 'Data Prestacao Servico', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_total_deducao_base_calculo field
            //
            $column = new TextViewColumn('valor_total_deducao_base_calculo', 'valor_total_deducao_base_calculo', 'Valor Total Deducao Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_total_outras_retencoes field
            //
            $column = new TextViewColumn('valor_total_outras_retencoes', 'valor_total_outras_retencoes', 'Valor Total Outras Retencoes', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_total_desconto_incondicionado field
            //
            $column = new TextViewColumn('valor_total_desconto_incondicionado', 'valor_total_desconto_incondicionado', 'Valor Total Desconto Incondicionado', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_total_valor_condicionado field
            //
            $column = new TextViewColumn('valor_total_valor_condicionado', 'valor_total_valor_condicionado', 'Valor Total Valor Condicionado', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_total_retencao_iss field
            //
            $column = new TextViewColumn('valor_total_retencao_iss', 'valor_total_retencao_iss', 'Valor Total Retencao Iss', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('codigo_regime_especial_tributacao', 'codigo_regime_especial_tributacao_ds_tabela', 'Codigo Regime Especial Tributacao', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_retido_pis field
            //
            $column = new TextViewColumn('valor_retido_pis', 'valor_retido_pis', 'Valor Retido Pis', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_retido_cofins field
            //
            $column = new TextViewColumn('valor_retido_cofins', 'valor_retido_cofins', 'Valor Retido Cofins', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_retido_csll field
            //
            $column = new TextViewColumn('valor_retido_csll', 'valor_retido_csll', 'Valor Retido Csll', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for base_calculo_irrf field
            //
            $column = new TextViewColumn('base_calculo_irrf', 'base_calculo_irrf', 'Base Calculo Irrf', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_retido_irrf field
            //
            $column = new TextViewColumn('valor_retido_irrf', 'valor_retido_irrf', 'Valor Retido Irrf', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for prev_social_base_calculo field
            //
            $column = new TextViewColumn('prev_social_base_calculo', 'prev_social_base_calculo', 'Prev Social Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for prev_social_valor_retido field
            //
            $column = new TextViewColumn('prev_social_valor_retido', 'prev_social_valor_retido', 'Prev Social Valor Retido', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('modalidade_frete', 'modalidade_frete_ds_tabela', 'Modalidade Frete', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for cnpj_transportador field
            //
            $column = new TextViewColumn('cnpj_transportador', 'cnpj_transportador', 'Cnpj Transportador', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for cpf_transportador field
            //
            $column = new TextViewColumn('cpf_transportador', 'cpf_transportador', 'Cpf Transportador', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for nome_transportador field
            //
            $column = new TextViewColumn('nome_transportador', 'nome_transportador', 'Nome Transportador', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_nome_transportador_handler_print');
            $grid->AddPrintColumn($column);
            
            //
            // View column for inscricao_estadual_transportador field
            //
            $column = new TextViewColumn('inscricao_estadual_transportador', 'inscricao_estadual_transportador', 'Inscricao Estadual Transportador', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for endereco_transportador field
            //
            $column = new TextViewColumn('endereco_transportador', 'endereco_transportador', 'Endereco Transportador', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_endereco_transportador_handler_print');
            $grid->AddPrintColumn($column);
            
            //
            // View column for municipio_transportador field
            //
            $column = new TextViewColumn('municipio_transportador', 'municipio_transportador', 'Municipio Transportador', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for uf_transportador field
            //
            $column = new TextViewColumn('uf_transportador', 'uf_transportador', 'Uf Transportador', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for transporte_icms_servico field
            //
            $column = new TextViewColumn('transporte_icms_servico', 'transporte_icms_servico', 'Transporte Icms Servico', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for transporte_icms_base_servico field
            //
            $column = new TextViewColumn('transporte_icms_base_servico', 'transporte_icms_base_servico', 'Transporte Icms Base Servico', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for transporte_icms_aliquota field
            //
            $column = new TextViewColumn('transporte_icms_aliquota', 'transporte_icms_aliquota', 'Transporte Icms Aliquota', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for transporte_icms_valor field
            //
            $column = new TextViewColumn('transporte_icms_valor', 'transporte_icms_valor', 'Transporte Icms Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('transporte_icms_cfop', 'transporte_icms_cfop_ds_tabela', 'Transporte Icms Cfop', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for transporte_icms_codigo_municipio field
            //
            $column = new TextViewColumn('transporte_icms_codigo_municipio', 'transporte_icms_codigo_municipio', 'Transporte Icms Codigo Municipio', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for veiculo_placa field
            //
            $column = new TextViewColumn('veiculo_placa', 'veiculo_placa', 'Veiculo Placa', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for veiculo_uf field
            //
            $column = new TextViewColumn('veiculo_uf', 'veiculo_uf', 'Veiculo Uf', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for veiculo_rntc field
            //
            $column = new TextViewColumn('veiculo_rntc', 'veiculo_rntc', 'Veiculo Rntc', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for veiculo_identificacao_vagao field
            //
            $column = new TextViewColumn('veiculo_identificacao_vagao', 'veiculo_identificacao_vagao', 'Veiculo Identificacao Vagao', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for veiculo_identificacao_balsa field
            //
            $column = new TextViewColumn('veiculo_identificacao_balsa', 'veiculo_identificacao_balsa', 'Veiculo Identificacao Balsa', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for numero_fatura field
            //
            $column = new TextViewColumn('numero_fatura', 'numero_fatura', 'Numero Fatura', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_original_fatura field
            //
            $column = new TextViewColumn('valor_original_fatura', 'valor_original_fatura', 'Valor Original Fatura', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_desconto_fatura field
            //
            $column = new TextViewColumn('valor_desconto_fatura', 'valor_desconto_fatura', 'Valor Desconto Fatura', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for valor_liquido_fatura field
            //
            $column = new TextViewColumn('valor_liquido_fatura', 'valor_liquido_fatura', 'Valor Liquido Fatura', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for informacoes_adicionais_contribuinte field
            //
            $column = new TextViewColumn('informacoes_adicionais_contribuinte', 'informacoes_adicionais_contribuinte', 'Informacoes Adicionais Contribuinte', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_informacoes_adicionais_contribuinte_handler_print');
            $grid->AddPrintColumn($column);
            
            //
            // View column for uf_local_embarque field
            //
            $column = new TextViewColumn('uf_local_embarque', 'uf_local_embarque', 'Uf Local Embarque', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for local_embarque field
            //
            $column = new TextViewColumn('local_embarque', 'local_embarque', 'Local Embarque', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_local_embarque_handler_print');
            $grid->AddPrintColumn($column);
            
            //
            // View column for local_despacho field
            //
            $column = new TextViewColumn('local_despacho', 'local_despacho', 'Local Despacho', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_local_despacho_handler_print');
            $grid->AddPrintColumn($column);
            
            //
            // View column for tx_cancelamento field
            //
            $column = new TextViewColumn('tx_cancelamento', 'tx_cancelamento', 'Tx Cancelamento', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_tx_cancelamento_handler_print');
            $grid->AddPrintColumn($column);
            
            //
            // View column for tx_correcao field
            //
            $column = new TextViewColumn('tx_correcao', 'tx_correcao', 'Tx Correcao', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_tx_correcao_handler_print');
            $grid->AddPrintColumn($column);
            
            //
            // View column for id_pedido field
            //
            $column = new NumberViewColumn('id_pedido', 'id_pedido', 'Id Pedido', $this->dataset);
            $column->SetOrderable(true);
            $column->setNumberAfterDecimal(0);
            $column->setThousandsSeparator('.');
            $column->setDecimalSeparator('');
            $grid->AddPrintColumn($column);
            
            //
            // View column for numero_nf field
            //
            $column = new NumberViewColumn('numero_nf', 'numero_nf', 'Numero Nf', $this->dataset);
            $column->SetOrderable(true);
            $column->setNumberAfterDecimal(0);
            $column->setThousandsSeparator('.');
            $column->setDecimalSeparator('');
            $grid->AddPrintColumn($column);
        }
    
        protected function AddExportColumns(Grid $grid)
        {
            //
            // View column for chave field
            //
            $column = new TextViewColumn('chave', 'chave', 'Chave', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for dt_inclusao field
            //
            $column = new DateTimeViewColumn('dt_inclusao', 'dt_inclusao', 'Data Inclusão', $this->dataset);
            $column->SetOrderable(true);
            $column->SetDateTimeFormat('d.m.Y H:i:s');
            $grid->AddExportColumn($column);
            
            //
            // View column for st_nota field
            //
            $column = new TextViewColumn('st_nota', 'st_nota', 'Status Nota', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for tx_obs field
            //
            $column = new TextViewColumn('tx_obs', 'tx_obs', 'Ocorrências da NF', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_tx_obs_handler_export');
            $grid->AddExportColumn($column);
            
            //
            // View column for descricao field
            //
            $column = new TextViewColumn('natureza_operacao', 'natureza_operacao_descricao', 'Natureza Operação', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('forma_pagamento', 'forma_pagamento_ds_tabela', 'Forma Pagamento', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for data_emissao field
            //
            $column = new DateTimeViewColumn('data_emissao', 'data_emissao', 'Data Emissão', $this->dataset);
            $column->SetOrderable(true);
            $column->SetDateTimeFormat('Y-m-d');
            $grid->AddExportColumn($column);
            
            //
            // View column for data_entrada_saida field
            //
            $column = new DateTimeViewColumn('data_entrada_saida', 'data_entrada_saida', 'Data Entrada Saida', $this->dataset);
            $column->SetOrderable(true);
            $column->SetDateTimeFormat('d.m.Y H:i:s');
            $grid->AddExportColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('tipo_documento', 'tipo_documento_ds_tabela', 'Tipo Documento', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('local_destino', 'local_destino_ds_tabela', 'Local Destino', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('finalidade_emissao', 'finalidade_emissao_ds_tabela', 'Finalidade Emissao', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('consumidor_final', 'consumidor_final_ds_tabela', 'Consumidor Final', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('presenca_comprador', 'presenca_comprador_ds_tabela', 'Presenca Comprador', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('regime_tributario_emitente', 'regime_tributario_emitente_ds_tabela', 'Regime Tributario Emitente', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for cnpj_destinatario field
            //
            $column = new TextViewColumn('cnpj_destinatario', 'cnpj_destinatario', 'Cnpj Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for cpf_destinatario field
            //
            $column = new TextViewColumn('cpf_destinatario', 'cpf_destinatario', 'Cpf Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for id_estrangeiro_destinatario field
            //
            $column = new TextViewColumn('id_estrangeiro_destinatario', 'id_estrangeiro_destinatario', 'Id Estrangeiro Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for nome_destinatario field
            //
            $column = new TextViewColumn('nome_destinatario', 'nome_destinatario', 'Nome Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_nome_destinatario_handler_export');
            $grid->AddExportColumn($column);
            
            //
            // View column for logradoura_destinatario field
            //
            $column = new TextViewColumn('logradoura_destinatario', 'logradoura_destinatario', 'Logradoura Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_logradoura_destinatario_handler_export');
            $grid->AddExportColumn($column);
            
            //
            // View column for numero_destinatario field
            //
            $column = new TextViewColumn('numero_destinatario', 'numero_destinatario', 'Numero Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for complemento_destinatario field
            //
            $column = new TextViewColumn('complemento_destinatario', 'complemento_destinatario', 'Complemento Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_complemento_destinatario_handler_export');
            $grid->AddExportColumn($column);
            
            //
            // View column for bairro_destinatario field
            //
            $column = new TextViewColumn('bairro_destinatario', 'bairro_destinatario', 'Bairro Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for codigo_municipio_destinatario field
            //
            $column = new TextViewColumn('codigo_municipio_destinatario', 'codigo_municipio_destinatario', 'Codigo Municipio Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for municipio_destinatario field
            //
            $column = new TextViewColumn('municipio_destinatario', 'municipio_destinatario', 'Municipio Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for uf_destinatario field
            //
            $column = new TextViewColumn('uf_destinatario', 'uf_destinatario', 'Uf Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for cep_destinatario field
            //
            $column = new TextViewColumn('cep_destinatario', 'cep_destinatario', 'Cep Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for pais_destinatario field
            //
            $column = new TextViewColumn('pais_destinatario', 'pais_destinatario', 'Pais Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for telefone_destinatario field
            //
            $column = new TextViewColumn('telefone_destinatario', 'telefone_destinatario', 'Telefone Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for indicador_inscricao_estadual_destinatario field
            //
            $column = new TextViewColumn('indicador_inscricao_estadual_destinatario', 'indicador_inscricao_estadual_destinatario', 'Indicador Inscricao Estadual Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for inscricao_estadual_destinatario field
            //
            $column = new TextViewColumn('inscricao_estadual_destinatario', 'inscricao_estadual_destinatario', 'Inscricao Estadual Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for inscricao_suframa_destinatario field
            //
            $column = new TextViewColumn('inscricao_suframa_destinatario', 'inscricao_suframa_destinatario', 'Inscricao Suframa Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for email_destinatario field
            //
            $column = new TextViewColumn('email_destinatario', 'email_destinatario', 'Email Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_email_destinatario_handler_export');
            $grid->AddExportColumn($column);
            
            //
            // View column for inscricao_municipal_destinatario field
            //
            $column = new TextViewColumn('inscricao_municipal_destinatario', 'inscricao_municipal_destinatario', 'Inscricao Municipal Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for cnpj_retirada field
            //
            $column = new TextViewColumn('cnpj_retirada', 'cnpj_retirada', 'Cnpj Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for cpf_retirada field
            //
            $column = new TextViewColumn('cpf_retirada', 'cpf_retirada', 'Cpf Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for logradoura_retirada field
            //
            $column = new TextViewColumn('logradoura_retirada', 'logradoura_retirada', 'Logradoura Retirada', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_logradoura_retirada_handler_export');
            $grid->AddExportColumn($column);
            
            //
            // View column for numero_retirada field
            //
            $column = new TextViewColumn('numero_retirada', 'numero_retirada', 'Numero Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for complemento_retirada field
            //
            $column = new TextViewColumn('complemento_retirada', 'complemento_retirada', 'Complemento Retirada', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_complemento_retirada_handler_export');
            $grid->AddExportColumn($column);
            
            //
            // View column for bairro_retirada field
            //
            $column = new TextViewColumn('bairro_retirada', 'bairro_retirada', 'Bairro Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for codigo_municipio_retirada field
            //
            $column = new TextViewColumn('codigo_municipio_retirada', 'codigo_municipio_retirada', 'Codigo Municipio Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for municipio_retirada field
            //
            $column = new TextViewColumn('municipio_retirada', 'municipio_retirada', 'Municipio Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for uf_retirada field
            //
            $column = new TextViewColumn('uf_retirada', 'uf_retirada', 'Uf Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for cnpj_entrega field
            //
            $column = new TextViewColumn('cnpj_entrega', 'cnpj_entrega', 'Cnpj Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for cpf_entrega field
            //
            $column = new TextViewColumn('cpf_entrega', 'cpf_entrega', 'Cpf Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for logradouro_entrega field
            //
            $column = new TextViewColumn('logradouro_entrega', 'logradouro_entrega', 'Logradouro Entrega', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_logradouro_entrega_handler_export');
            $grid->AddExportColumn($column);
            
            //
            // View column for numero_entrega field
            //
            $column = new TextViewColumn('numero_entrega', 'numero_entrega', 'Numero Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for complemento_entrega field
            //
            $column = new TextViewColumn('complemento_entrega', 'complemento_entrega', 'Complemento Entrega', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_complemento_entrega_handler_export');
            $grid->AddExportColumn($column);
            
            //
            // View column for bairro_entrega field
            //
            $column = new TextViewColumn('bairro_entrega', 'bairro_entrega', 'Bairro Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for codigo_municipio_entrega field
            //
            $column = new TextViewColumn('codigo_municipio_entrega', 'codigo_municipio_entrega', 'Codigo Municipio Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for municipio_entrega field
            //
            $column = new TextViewColumn('municipio_entrega', 'municipio_entrega', 'Municipio Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for uf_entrega field
            //
            $column = new TextViewColumn('uf_entrega', 'uf_entrega', 'Uf Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for icms_base_calculo field
            //
            $column = new TextViewColumn('icms_base_calculo', 'icms_base_calculo', 'Icms Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for icms_valor_total field
            //
            $column = new TextViewColumn('icms_valor_total', 'icms_valor_total', 'Icms Valor Total', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for icms_valor_total_desonerado field
            //
            $column = new TextViewColumn('icms_valor_total_desonerado', 'icms_valor_total_desonerado', 'Icms Valor Total Desonerado', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for icms_base_calculo_st field
            //
            $column = new TextViewColumn('icms_base_calculo_st', 'icms_base_calculo_st', 'Icms Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for icms_valor_total_st field
            //
            $column = new TextViewColumn('icms_valor_total_st', 'icms_valor_total_st', 'Icms Valor Total St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_produtos field
            //
            $column = new TextViewColumn('valor_produtos', 'valor_produtos', 'Valor Produtos', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_frete field
            //
            $column = new TextViewColumn('valor_frete', 'valor_frete', 'Valor Frete', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_seguro field
            //
            $column = new TextViewColumn('valor_seguro', 'valor_seguro', 'Valor Seguro', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_desconto field
            //
            $column = new TextViewColumn('valor_desconto', 'valor_desconto', 'Valor Desconto', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_total_ii field
            //
            $column = new TextViewColumn('valor_total_ii', 'valor_total_ii', 'Valor Total Ii', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_ipi field
            //
            $column = new TextViewColumn('valor_ipi', 'valor_ipi', 'Valor Ipi', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_pis field
            //
            $column = new TextViewColumn('valor_pis', 'valor_pis', 'Valor Pis', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_cofins field
            //
            $column = new TextViewColumn('valor_cofins', 'valor_cofins', 'Valor Cofins', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_outras_despesas field
            //
            $column = new TextViewColumn('valor_outras_despesas', 'valor_outras_despesas', 'Valor Outras Despesas', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_total field
            //
            $column = new TextViewColumn('valor_total', 'valor_total', 'Valor Total', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_total_servicos field
            //
            $column = new TextViewColumn('valor_total_servicos', 'valor_total_servicos', 'Valor Total Servicos', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for base_issqn field
            //
            $column = new TextViewColumn('base_issqn', 'base_issqn', 'Base Issqn', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_pis_servico field
            //
            $column = new TextViewColumn('valor_pis_servico', 'valor_pis_servico', 'Valor Pis Servico', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for data_prestacao_servico field
            //
            $column = new TextViewColumn('data_prestacao_servico', 'data_prestacao_servico', 'Data Prestacao Servico', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_total_deducao_base_calculo field
            //
            $column = new TextViewColumn('valor_total_deducao_base_calculo', 'valor_total_deducao_base_calculo', 'Valor Total Deducao Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_total_outras_retencoes field
            //
            $column = new TextViewColumn('valor_total_outras_retencoes', 'valor_total_outras_retencoes', 'Valor Total Outras Retencoes', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_total_desconto_incondicionado field
            //
            $column = new TextViewColumn('valor_total_desconto_incondicionado', 'valor_total_desconto_incondicionado', 'Valor Total Desconto Incondicionado', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_total_valor_condicionado field
            //
            $column = new TextViewColumn('valor_total_valor_condicionado', 'valor_total_valor_condicionado', 'Valor Total Valor Condicionado', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_total_retencao_iss field
            //
            $column = new TextViewColumn('valor_total_retencao_iss', 'valor_total_retencao_iss', 'Valor Total Retencao Iss', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('codigo_regime_especial_tributacao', 'codigo_regime_especial_tributacao_ds_tabela', 'Codigo Regime Especial Tributacao', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_retido_pis field
            //
            $column = new TextViewColumn('valor_retido_pis', 'valor_retido_pis', 'Valor Retido Pis', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_retido_cofins field
            //
            $column = new TextViewColumn('valor_retido_cofins', 'valor_retido_cofins', 'Valor Retido Cofins', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_retido_csll field
            //
            $column = new TextViewColumn('valor_retido_csll', 'valor_retido_csll', 'Valor Retido Csll', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for base_calculo_irrf field
            //
            $column = new TextViewColumn('base_calculo_irrf', 'base_calculo_irrf', 'Base Calculo Irrf', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_retido_irrf field
            //
            $column = new TextViewColumn('valor_retido_irrf', 'valor_retido_irrf', 'Valor Retido Irrf', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for prev_social_base_calculo field
            //
            $column = new TextViewColumn('prev_social_base_calculo', 'prev_social_base_calculo', 'Prev Social Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for prev_social_valor_retido field
            //
            $column = new TextViewColumn('prev_social_valor_retido', 'prev_social_valor_retido', 'Prev Social Valor Retido', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('modalidade_frete', 'modalidade_frete_ds_tabela', 'Modalidade Frete', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for cnpj_transportador field
            //
            $column = new TextViewColumn('cnpj_transportador', 'cnpj_transportador', 'Cnpj Transportador', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for cpf_transportador field
            //
            $column = new TextViewColumn('cpf_transportador', 'cpf_transportador', 'Cpf Transportador', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for nome_transportador field
            //
            $column = new TextViewColumn('nome_transportador', 'nome_transportador', 'Nome Transportador', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_nome_transportador_handler_export');
            $grid->AddExportColumn($column);
            
            //
            // View column for inscricao_estadual_transportador field
            //
            $column = new TextViewColumn('inscricao_estadual_transportador', 'inscricao_estadual_transportador', 'Inscricao Estadual Transportador', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for endereco_transportador field
            //
            $column = new TextViewColumn('endereco_transportador', 'endereco_transportador', 'Endereco Transportador', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_endereco_transportador_handler_export');
            $grid->AddExportColumn($column);
            
            //
            // View column for municipio_transportador field
            //
            $column = new TextViewColumn('municipio_transportador', 'municipio_transportador', 'Municipio Transportador', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for uf_transportador field
            //
            $column = new TextViewColumn('uf_transportador', 'uf_transportador', 'Uf Transportador', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for transporte_icms_servico field
            //
            $column = new TextViewColumn('transporte_icms_servico', 'transporte_icms_servico', 'Transporte Icms Servico', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for transporte_icms_base_servico field
            //
            $column = new TextViewColumn('transporte_icms_base_servico', 'transporte_icms_base_servico', 'Transporte Icms Base Servico', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for transporte_icms_aliquota field
            //
            $column = new TextViewColumn('transporte_icms_aliquota', 'transporte_icms_aliquota', 'Transporte Icms Aliquota', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for transporte_icms_valor field
            //
            $column = new TextViewColumn('transporte_icms_valor', 'transporte_icms_valor', 'Transporte Icms Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('transporte_icms_cfop', 'transporte_icms_cfop_ds_tabela', 'Transporte Icms Cfop', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for transporte_icms_codigo_municipio field
            //
            $column = new TextViewColumn('transporte_icms_codigo_municipio', 'transporte_icms_codigo_municipio', 'Transporte Icms Codigo Municipio', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for veiculo_placa field
            //
            $column = new TextViewColumn('veiculo_placa', 'veiculo_placa', 'Veiculo Placa', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for veiculo_uf field
            //
            $column = new TextViewColumn('veiculo_uf', 'veiculo_uf', 'Veiculo Uf', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for veiculo_rntc field
            //
            $column = new TextViewColumn('veiculo_rntc', 'veiculo_rntc', 'Veiculo Rntc', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for veiculo_identificacao_vagao field
            //
            $column = new TextViewColumn('veiculo_identificacao_vagao', 'veiculo_identificacao_vagao', 'Veiculo Identificacao Vagao', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for veiculo_identificacao_balsa field
            //
            $column = new TextViewColumn('veiculo_identificacao_balsa', 'veiculo_identificacao_balsa', 'Veiculo Identificacao Balsa', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for numero_fatura field
            //
            $column = new TextViewColumn('numero_fatura', 'numero_fatura', 'Numero Fatura', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_original_fatura field
            //
            $column = new TextViewColumn('valor_original_fatura', 'valor_original_fatura', 'Valor Original Fatura', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_desconto_fatura field
            //
            $column = new TextViewColumn('valor_desconto_fatura', 'valor_desconto_fatura', 'Valor Desconto Fatura', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for valor_liquido_fatura field
            //
            $column = new TextViewColumn('valor_liquido_fatura', 'valor_liquido_fatura', 'Valor Liquido Fatura', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for informacoes_adicionais_contribuinte field
            //
            $column = new TextViewColumn('informacoes_adicionais_contribuinte', 'informacoes_adicionais_contribuinte', 'Informacoes Adicionais Contribuinte', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_informacoes_adicionais_contribuinte_handler_export');
            $grid->AddExportColumn($column);
            
            //
            // View column for uf_local_embarque field
            //
            $column = new TextViewColumn('uf_local_embarque', 'uf_local_embarque', 'Uf Local Embarque', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for local_embarque field
            //
            $column = new TextViewColumn('local_embarque', 'local_embarque', 'Local Embarque', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_local_embarque_handler_export');
            $grid->AddExportColumn($column);
            
            //
            // View column for local_despacho field
            //
            $column = new TextViewColumn('local_despacho', 'local_despacho', 'Local Despacho', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_local_despacho_handler_export');
            $grid->AddExportColumn($column);
            
            //
            // View column for tx_cancelamento field
            //
            $column = new TextViewColumn('tx_cancelamento', 'tx_cancelamento', 'Tx Cancelamento', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_tx_cancelamento_handler_export');
            $grid->AddExportColumn($column);
            
            //
            // View column for tx_correcao field
            //
            $column = new TextViewColumn('tx_correcao', 'tx_correcao', 'Tx Correcao', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_tx_correcao_handler_export');
            $grid->AddExportColumn($column);
            
            //
            // View column for id_pedido field
            //
            $column = new NumberViewColumn('id_pedido', 'id_pedido', 'Id Pedido', $this->dataset);
            $column->SetOrderable(true);
            $column->setNumberAfterDecimal(0);
            $column->setThousandsSeparator('.');
            $column->setDecimalSeparator('');
            $grid->AddExportColumn($column);
            
            //
            // View column for numero_nf field
            //
            $column = new NumberViewColumn('numero_nf', 'numero_nf', 'Numero Nf', $this->dataset);
            $column->SetOrderable(true);
            $column->setNumberAfterDecimal(0);
            $column->setThousandsSeparator('.');
            $column->setDecimalSeparator('');
            $grid->AddExportColumn($column);
        }
    
        private function AddCompareColumns(Grid $grid)
        {
            //
            // View column for id_notas field
            //
            $column = new TextViewColumn('id_notas', 'id_notas', 'Id Notas', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for id_licencas field
            //
            $column = new TextViewColumn('id_licencas', 'id_licencas', 'Id Licencas', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for chave field
            //
            $column = new TextViewColumn('chave', 'chave', 'Chave', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for sequencia field
            //
            $column = new TextViewColumn('sequencia', 'sequencia', 'Sequencia', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for tipo_nf field
            //
            $column = new TextViewColumn('tipo_nf', 'tipo_nf', 'Tipo Nf', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for dt_inclusao field
            //
            $column = new DateTimeViewColumn('dt_inclusao', 'dt_inclusao', 'Data Inclusão', $this->dataset);
            $column->SetOrderable(true);
            $column->SetDateTimeFormat('d.m.Y H:i:s');
            $grid->AddCompareColumn($column);
            
            //
            // View column for dt_concluido field
            //
            $column = new DateTimeViewColumn('dt_concluido', 'dt_concluido', 'Data Concluído', $this->dataset);
            $column->SetOrderable(true);
            $column->SetDateTimeFormat('d.m.Y H:i:s');
            $grid->AddCompareColumn($column);
            
            //
            // View column for st_nota field
            //
            $column = new TextViewColumn('st_nota', 'st_nota', 'Status Nota', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for tx_obs field
            //
            $column = new TextViewColumn('tx_obs', 'tx_obs', 'Ocorrências da NF', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_tx_obs_handler_compare');
            $grid->AddCompareColumn($column);
            
            //
            // View column for nm_arquivo_retorno field
            //
            $column = new TextViewColumn('nm_arquivo_retorno', 'nm_arquivo_retorno', 'Nm Arquivo Retorno', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_nm_arquivo_retorno_handler_compare');
            $grid->AddCompareColumn($column);
            
            //
            // View column for descricao field
            //
            $column = new TextViewColumn('natureza_operacao', 'natureza_operacao_descricao', 'Natureza Operação', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('forma_pagamento', 'forma_pagamento_ds_tabela', 'Forma Pagamento', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for data_emissao field
            //
            $column = new DateTimeViewColumn('data_emissao', 'data_emissao', 'Data Emissão', $this->dataset);
            $column->SetOrderable(true);
            $column->SetDateTimeFormat('Y-m-d');
            $grid->AddCompareColumn($column);
            
            //
            // View column for data_entrada_saida field
            //
            $column = new DateTimeViewColumn('data_entrada_saida', 'data_entrada_saida', 'Data Entrada Saida', $this->dataset);
            $column->SetOrderable(true);
            $column->SetDateTimeFormat('d.m.Y H:i:s');
            $grid->AddCompareColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('tipo_documento', 'tipo_documento_ds_tabela', 'Tipo Documento', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('local_destino', 'local_destino_ds_tabela', 'Local Destino', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('finalidade_emissao', 'finalidade_emissao_ds_tabela', 'Finalidade Emissao', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('consumidor_final', 'consumidor_final_ds_tabela', 'Consumidor Final', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('presenca_comprador', 'presenca_comprador_ds_tabela', 'Presenca Comprador', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cnpj_emitente field
            //
            $column = new TextViewColumn('cnpj_emitente', 'cnpj_emitente', 'Cnpj Emitente', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for nome_emitente field
            //
            $column = new TextViewColumn('nome_emitente', 'nome_emitente', 'Nome Emitente', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_nome_emitente_handler_compare');
            $grid->AddCompareColumn($column);
            
            //
            // View column for nome_fantasia_emitente field
            //
            $column = new TextViewColumn('nome_fantasia_emitente', 'nome_fantasia_emitente', 'Nome Fantasia Emitente', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for logradouro_emitente field
            //
            $column = new TextViewColumn('logradouro_emitente', 'logradouro_emitente', 'Logradouro Emitente', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_logradouro_emitente_handler_compare');
            $grid->AddCompareColumn($column);
            
            //
            // View column for numero_emitente field
            //
            $column = new TextViewColumn('numero_emitente', 'numero_emitente', 'Numero Emitente', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for complemento_emitente field
            //
            $column = new TextViewColumn('complemento_emitente', 'complemento_emitente', 'Complemento Emitente', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_complemento_emitente_handler_compare');
            $grid->AddCompareColumn($column);
            
            //
            // View column for bairro_emitente field
            //
            $column = new TextViewColumn('bairro_emitente', 'bairro_emitente', 'Bairro Emitente', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for prestador_codigo_municipio field
            //
            $column = new TextViewColumn('prestador_codigo_municipio', 'prestador_codigo_municipio', 'Prestador Codigo Municipio', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for municipio_emitente field
            //
            $column = new TextViewColumn('municipio_emitente', 'municipio_emitente', 'Municipio Emitente', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for uf_emitente field
            //
            $column = new TextViewColumn('uf_emitente', 'uf_emitente', 'Uf Emitente', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cep_emitente field
            //
            $column = new TextViewColumn('cep_emitente', 'cep_emitente', 'Cep Emitente', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for telefone_emitente field
            //
            $column = new TextViewColumn('telefone_emitente', 'telefone_emitente', 'Telefone Emitente', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for inscricao_estadual_emitenete field
            //
            $column = new TextViewColumn('inscricao_estadual_emitenete', 'inscricao_estadual_emitenete', 'Inscricao Estadual Emitenete', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for inscricao_estadual_st_emitente field
            //
            $column = new TextViewColumn('inscricao_estadual_st_emitente', 'inscricao_estadual_st_emitente', 'Inscricao Estadual St Emitente', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for inscricao_municipal_emitente field
            //
            $column = new TextViewColumn('inscricao_municipal_emitente', 'inscricao_municipal_emitente', 'Inscricao Municipal Emitente', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cnae_emitente field
            //
            $column = new TextViewColumn('cnae_emitente', 'cnae_emitente', 'Cnae Emitente', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('regime_tributario_emitente', 'regime_tributario_emitente_ds_tabela', 'Regime Tributario Emitente', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cnpj_destinatario field
            //
            $column = new TextViewColumn('cnpj_destinatario', 'cnpj_destinatario', 'Cnpj Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cpf_destinatario field
            //
            $column = new TextViewColumn('cpf_destinatario', 'cpf_destinatario', 'Cpf Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for id_estrangeiro_destinatario field
            //
            $column = new TextViewColumn('id_estrangeiro_destinatario', 'id_estrangeiro_destinatario', 'Id Estrangeiro Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for nome_destinatario field
            //
            $column = new TextViewColumn('nome_destinatario', 'nome_destinatario', 'Nome Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_nome_destinatario_handler_compare');
            $grid->AddCompareColumn($column);
            
            //
            // View column for logradoura_destinatario field
            //
            $column = new TextViewColumn('logradoura_destinatario', 'logradoura_destinatario', 'Logradoura Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_logradoura_destinatario_handler_compare');
            $grid->AddCompareColumn($column);
            
            //
            // View column for numero_destinatario field
            //
            $column = new TextViewColumn('numero_destinatario', 'numero_destinatario', 'Numero Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for complemento_destinatario field
            //
            $column = new TextViewColumn('complemento_destinatario', 'complemento_destinatario', 'Complemento Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_complemento_destinatario_handler_compare');
            $grid->AddCompareColumn($column);
            
            //
            // View column for bairro_destinatario field
            //
            $column = new TextViewColumn('bairro_destinatario', 'bairro_destinatario', 'Bairro Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for codigo_municipio_destinatario field
            //
            $column = new TextViewColumn('codigo_municipio_destinatario', 'codigo_municipio_destinatario', 'Codigo Municipio Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for municipio_destinatario field
            //
            $column = new TextViewColumn('municipio_destinatario', 'municipio_destinatario', 'Municipio Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for uf_destinatario field
            //
            $column = new TextViewColumn('uf_destinatario', 'uf_destinatario', 'Uf Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cep_destinatario field
            //
            $column = new TextViewColumn('cep_destinatario', 'cep_destinatario', 'Cep Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for pais_destinatario field
            //
            $column = new TextViewColumn('pais_destinatario', 'pais_destinatario', 'Pais Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for telefone_destinatario field
            //
            $column = new TextViewColumn('telefone_destinatario', 'telefone_destinatario', 'Telefone Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for indicador_inscricao_estadual_destinatario field
            //
            $column = new TextViewColumn('indicador_inscricao_estadual_destinatario', 'indicador_inscricao_estadual_destinatario', 'Indicador Inscricao Estadual Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for inscricao_estadual_destinatario field
            //
            $column = new TextViewColumn('inscricao_estadual_destinatario', 'inscricao_estadual_destinatario', 'Inscricao Estadual Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for inscricao_suframa_destinatario field
            //
            $column = new TextViewColumn('inscricao_suframa_destinatario', 'inscricao_suframa_destinatario', 'Inscricao Suframa Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for email_destinatario field
            //
            $column = new TextViewColumn('email_destinatario', 'email_destinatario', 'Email Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_email_destinatario_handler_compare');
            $grid->AddCompareColumn($column);
            
            //
            // View column for inscricao_municipal_destinatario field
            //
            $column = new TextViewColumn('inscricao_municipal_destinatario', 'inscricao_municipal_destinatario', 'Inscricao Municipal Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cnpj_retirada field
            //
            $column = new TextViewColumn('cnpj_retirada', 'cnpj_retirada', 'Cnpj Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cpf_retirada field
            //
            $column = new TextViewColumn('cpf_retirada', 'cpf_retirada', 'Cpf Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for logradoura_retirada field
            //
            $column = new TextViewColumn('logradoura_retirada', 'logradoura_retirada', 'Logradoura Retirada', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_logradoura_retirada_handler_compare');
            $grid->AddCompareColumn($column);
            
            //
            // View column for numero_retirada field
            //
            $column = new TextViewColumn('numero_retirada', 'numero_retirada', 'Numero Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for complemento_retirada field
            //
            $column = new TextViewColumn('complemento_retirada', 'complemento_retirada', 'Complemento Retirada', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_complemento_retirada_handler_compare');
            $grid->AddCompareColumn($column);
            
            //
            // View column for bairro_retirada field
            //
            $column = new TextViewColumn('bairro_retirada', 'bairro_retirada', 'Bairro Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for codigo_municipio_retirada field
            //
            $column = new TextViewColumn('codigo_municipio_retirada', 'codigo_municipio_retirada', 'Codigo Municipio Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for municipio_retirada field
            //
            $column = new TextViewColumn('municipio_retirada', 'municipio_retirada', 'Municipio Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for uf_retirada field
            //
            $column = new TextViewColumn('uf_retirada', 'uf_retirada', 'Uf Retirada', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cnpj_entrega field
            //
            $column = new TextViewColumn('cnpj_entrega', 'cnpj_entrega', 'Cnpj Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cpf_entrega field
            //
            $column = new TextViewColumn('cpf_entrega', 'cpf_entrega', 'Cpf Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for logradouro_entrega field
            //
            $column = new TextViewColumn('logradouro_entrega', 'logradouro_entrega', 'Logradouro Entrega', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_logradouro_entrega_handler_compare');
            $grid->AddCompareColumn($column);
            
            //
            // View column for numero_entrega field
            //
            $column = new TextViewColumn('numero_entrega', 'numero_entrega', 'Numero Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for complemento_entrega field
            //
            $column = new TextViewColumn('complemento_entrega', 'complemento_entrega', 'Complemento Entrega', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_complemento_entrega_handler_compare');
            $grid->AddCompareColumn($column);
            
            //
            // View column for bairro_entrega field
            //
            $column = new TextViewColumn('bairro_entrega', 'bairro_entrega', 'Bairro Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for codigo_municipio_entrega field
            //
            $column = new TextViewColumn('codigo_municipio_entrega', 'codigo_municipio_entrega', 'Codigo Municipio Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for municipio_entrega field
            //
            $column = new TextViewColumn('municipio_entrega', 'municipio_entrega', 'Municipio Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for uf_entrega field
            //
            $column = new TextViewColumn('uf_entrega', 'uf_entrega', 'Uf Entrega', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for icms_base_calculo field
            //
            $column = new TextViewColumn('icms_base_calculo', 'icms_base_calculo', 'Icms Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for icms_valor_total field
            //
            $column = new TextViewColumn('icms_valor_total', 'icms_valor_total', 'Icms Valor Total', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for icms_valor_total_desonerado field
            //
            $column = new TextViewColumn('icms_valor_total_desonerado', 'icms_valor_total_desonerado', 'Icms Valor Total Desonerado', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for icms_base_calculo_st field
            //
            $column = new TextViewColumn('icms_base_calculo_st', 'icms_base_calculo_st', 'Icms Base Calculo St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for icms_valor_total_st field
            //
            $column = new TextViewColumn('icms_valor_total_st', 'icms_valor_total_st', 'Icms Valor Total St', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_produtos field
            //
            $column = new TextViewColumn('valor_produtos', 'valor_produtos', 'Valor Produtos', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_frete field
            //
            $column = new TextViewColumn('valor_frete', 'valor_frete', 'Valor Frete', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_seguro field
            //
            $column = new TextViewColumn('valor_seguro', 'valor_seguro', 'Valor Seguro', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_desconto field
            //
            $column = new TextViewColumn('valor_desconto', 'valor_desconto', 'Valor Desconto', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_total_ii field
            //
            $column = new TextViewColumn('valor_total_ii', 'valor_total_ii', 'Valor Total Ii', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_ipi field
            //
            $column = new TextViewColumn('valor_ipi', 'valor_ipi', 'Valor Ipi', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_pis field
            //
            $column = new TextViewColumn('valor_pis', 'valor_pis', 'Valor Pis', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_cofins field
            //
            $column = new TextViewColumn('valor_cofins', 'valor_cofins', 'Valor Cofins', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_outras_despesas field
            //
            $column = new TextViewColumn('valor_outras_despesas', 'valor_outras_despesas', 'Valor Outras Despesas', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_total field
            //
            $column = new TextViewColumn('valor_total', 'valor_total', 'Valor Total', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_total_servicos field
            //
            $column = new TextViewColumn('valor_total_servicos', 'valor_total_servicos', 'Valor Total Servicos', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for base_issqn field
            //
            $column = new TextViewColumn('base_issqn', 'base_issqn', 'Base Issqn', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_pis_servico field
            //
            $column = new TextViewColumn('valor_pis_servico', 'valor_pis_servico', 'Valor Pis Servico', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for data_prestacao_servico field
            //
            $column = new TextViewColumn('data_prestacao_servico', 'data_prestacao_servico', 'Data Prestacao Servico', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_total_deducao_base_calculo field
            //
            $column = new TextViewColumn('valor_total_deducao_base_calculo', 'valor_total_deducao_base_calculo', 'Valor Total Deducao Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_total_outras_retencoes field
            //
            $column = new TextViewColumn('valor_total_outras_retencoes', 'valor_total_outras_retencoes', 'Valor Total Outras Retencoes', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_total_desconto_incondicionado field
            //
            $column = new TextViewColumn('valor_total_desconto_incondicionado', 'valor_total_desconto_incondicionado', 'Valor Total Desconto Incondicionado', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_total_valor_condicionado field
            //
            $column = new TextViewColumn('valor_total_valor_condicionado', 'valor_total_valor_condicionado', 'Valor Total Valor Condicionado', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_total_retencao_iss field
            //
            $column = new TextViewColumn('valor_total_retencao_iss', 'valor_total_retencao_iss', 'Valor Total Retencao Iss', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('codigo_regime_especial_tributacao', 'codigo_regime_especial_tributacao_ds_tabela', 'Codigo Regime Especial Tributacao', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_retido_pis field
            //
            $column = new TextViewColumn('valor_retido_pis', 'valor_retido_pis', 'Valor Retido Pis', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_retido_cofins field
            //
            $column = new TextViewColumn('valor_retido_cofins', 'valor_retido_cofins', 'Valor Retido Cofins', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_retido_csll field
            //
            $column = new TextViewColumn('valor_retido_csll', 'valor_retido_csll', 'Valor Retido Csll', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for base_calculo_irrf field
            //
            $column = new TextViewColumn('base_calculo_irrf', 'base_calculo_irrf', 'Base Calculo Irrf', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_retido_irrf field
            //
            $column = new TextViewColumn('valor_retido_irrf', 'valor_retido_irrf', 'Valor Retido Irrf', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for prev_social_base_calculo field
            //
            $column = new TextViewColumn('prev_social_base_calculo', 'prev_social_base_calculo', 'Prev Social Base Calculo', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for prev_social_valor_retido field
            //
            $column = new TextViewColumn('prev_social_valor_retido', 'prev_social_valor_retido', 'Prev Social Valor Retido', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('modalidade_frete', 'modalidade_frete_ds_tabela', 'Modalidade Frete', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cnpj_transportador field
            //
            $column = new TextViewColumn('cnpj_transportador', 'cnpj_transportador', 'Cnpj Transportador', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for cpf_transportador field
            //
            $column = new TextViewColumn('cpf_transportador', 'cpf_transportador', 'Cpf Transportador', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for nome_transportador field
            //
            $column = new TextViewColumn('nome_transportador', 'nome_transportador', 'Nome Transportador', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_nome_transportador_handler_compare');
            $grid->AddCompareColumn($column);
            
            //
            // View column for inscricao_estadual_transportador field
            //
            $column = new TextViewColumn('inscricao_estadual_transportador', 'inscricao_estadual_transportador', 'Inscricao Estadual Transportador', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for endereco_transportador field
            //
            $column = new TextViewColumn('endereco_transportador', 'endereco_transportador', 'Endereco Transportador', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_endereco_transportador_handler_compare');
            $grid->AddCompareColumn($column);
            
            //
            // View column for municipio_transportador field
            //
            $column = new TextViewColumn('municipio_transportador', 'municipio_transportador', 'Municipio Transportador', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for uf_transportador field
            //
            $column = new TextViewColumn('uf_transportador', 'uf_transportador', 'Uf Transportador', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for transporte_icms_servico field
            //
            $column = new TextViewColumn('transporte_icms_servico', 'transporte_icms_servico', 'Transporte Icms Servico', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for transporte_icms_base_servico field
            //
            $column = new TextViewColumn('transporte_icms_base_servico', 'transporte_icms_base_servico', 'Transporte Icms Base Servico', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for transporte_icms_aliquota field
            //
            $column = new TextViewColumn('transporte_icms_aliquota', 'transporte_icms_aliquota', 'Transporte Icms Aliquota', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for transporte_icms_valor field
            //
            $column = new TextViewColumn('transporte_icms_valor', 'transporte_icms_valor', 'Transporte Icms Valor', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for ds_tabela field
            //
            $column = new TextViewColumn('transporte_icms_cfop', 'transporte_icms_cfop_ds_tabela', 'Transporte Icms Cfop', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for transporte_icms_codigo_municipio field
            //
            $column = new TextViewColumn('transporte_icms_codigo_municipio', 'transporte_icms_codigo_municipio', 'Transporte Icms Codigo Municipio', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for veiculo_placa field
            //
            $column = new TextViewColumn('veiculo_placa', 'veiculo_placa', 'Veiculo Placa', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for veiculo_uf field
            //
            $column = new TextViewColumn('veiculo_uf', 'veiculo_uf', 'Veiculo Uf', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for veiculo_rntc field
            //
            $column = new TextViewColumn('veiculo_rntc', 'veiculo_rntc', 'Veiculo Rntc', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for veiculo_identificacao_vagao field
            //
            $column = new TextViewColumn('veiculo_identificacao_vagao', 'veiculo_identificacao_vagao', 'Veiculo Identificacao Vagao', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for veiculo_identificacao_balsa field
            //
            $column = new TextViewColumn('veiculo_identificacao_balsa', 'veiculo_identificacao_balsa', 'Veiculo Identificacao Balsa', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for numero_fatura field
            //
            $column = new TextViewColumn('numero_fatura', 'numero_fatura', 'Numero Fatura', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_original_fatura field
            //
            $column = new TextViewColumn('valor_original_fatura', 'valor_original_fatura', 'Valor Original Fatura', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_desconto_fatura field
            //
            $column = new TextViewColumn('valor_desconto_fatura', 'valor_desconto_fatura', 'Valor Desconto Fatura', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for valor_liquido_fatura field
            //
            $column = new TextViewColumn('valor_liquido_fatura', 'valor_liquido_fatura', 'Valor Liquido Fatura', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for informacoes_adicionais_contribuinte field
            //
            $column = new TextViewColumn('informacoes_adicionais_contribuinte', 'informacoes_adicionais_contribuinte', 'Informacoes Adicionais Contribuinte', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_informacoes_adicionais_contribuinte_handler_compare');
            $grid->AddCompareColumn($column);
            
            //
            // View column for uf_local_embarque field
            //
            $column = new TextViewColumn('uf_local_embarque', 'uf_local_embarque', 'Uf Local Embarque', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for local_embarque field
            //
            $column = new TextViewColumn('local_embarque', 'local_embarque', 'Local Embarque', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_local_embarque_handler_compare');
            $grid->AddCompareColumn($column);
            
            //
            // View column for local_despacho field
            //
            $column = new TextViewColumn('local_despacho', 'local_despacho', 'Local Despacho', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_local_despacho_handler_compare');
            $grid->AddCompareColumn($column);
            
            //
            // View column for operacao field
            //
            $column = new TextViewColumn('operacao', 'operacao', 'Operacao', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddCompareColumn($column);
            
            //
            // View column for tx_cancelamento field
            //
            $column = new TextViewColumn('tx_cancelamento', 'tx_cancelamento', 'Tx Cancelamento', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_tx_cancelamento_handler_compare');
            $grid->AddCompareColumn($column);
            
            //
            // View column for tx_correcao field
            //
            $column = new TextViewColumn('tx_correcao', 'tx_correcao', 'Tx Correcao', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('notasGrid_tx_correcao_handler_compare');
            $grid->AddCompareColumn($column);
            
            //
            // View column for id_pedido field
            //
            $column = new NumberViewColumn('id_pedido', 'id_pedido', 'Id Pedido', $this->dataset);
            $column->SetOrderable(true);
            $column->setNumberAfterDecimal(0);
            $column->setThousandsSeparator('.');
            $column->setDecimalSeparator('');
            $grid->AddCompareColumn($column);
            
            //
            // View column for numero_nf field
            //
            $column = new NumberViewColumn('numero_nf', 'numero_nf', 'Numero Nf', $this->dataset);
            $column->SetOrderable(true);
            $column->setNumberAfterDecimal(0);
            $column->setThousandsSeparator('.');
            $column->setDecimalSeparator('');
            $grid->AddCompareColumn($column);
        }
    
        private function AddCompareHeaderColumns(Grid $grid)
        {
    
        }
    
        public function GetPageDirection()
        {
            return null;
        }
    
        public function isFilterConditionRequired()
        {
            return false;
        }
    
        protected function ApplyCommonColumnEditProperties(CustomEditColumn $column)
        {
            $column->SetDisplaySetToNullCheckBox(false);
            $column->SetDisplaySetToDefaultCheckBox(false);
    		$column->SetVariableContainer($this->GetColumnVariableContainer());
        }
    
        function CreateMasterDetailRecordGrid()
        {
            $result = new Grid($this, $this->dataset);
            
            $this->AddFieldColumns($result, false);
            $this->AddPrintColumns($result);
            $this->AddExportColumns($result);
            
            $result->SetAllowDeleteSelected(false);
            $result->SetShowUpdateLink(false);
            $result->SetShowKeyColumnsImagesInHeader(false);
            $result->SetViewMode(ViewMode::TABLE);
            $result->setEnableRuntimeCustomization(false);
            $result->setTableBordered(false);
            $result->setTableCondensed(false);
            
            $this->setupGridColumnGroup($result);
            $this->attachGridEventHandlers($result);
            
            return $result;
        }
        
        function GetCustomClientScript()
        {
            return ;
        }
        
        function GetOnPageLoadedClientScript()
        {
            return ;
        }
        protected function GetEnableModalGridDelete() { return true; }
    
        protected function CreateGrid()
        {
            $result = new Grid($this, $this->dataset);
            if ($this->GetSecurityInfo()->HasDeleteGrant())
               $result->SetAllowDeleteSelected(false);
            else
               $result->SetAllowDeleteSelected(false);   
            
            ApplyCommonPageSettings($this, $result);
            
            $result->SetUseImagesForActions(true);
            $defaultSortedColumns = array();
            $defaultSortedColumns[] = new SortColumn('chave', 'ASC');
            $result->setDefaultOrdering($defaultSortedColumns);
            $result->SetUseFixedHeader(false);
            $result->SetShowLineNumbers(false);
            $result->SetViewMode(ViewMode::TABLE);
            $result->setEnableRuntimeCustomization(true);
            $result->setAllowCompare(true);
            $this->AddCompareHeaderColumns($result);
            $this->AddCompareColumns($result);
            $result->setMultiEditAllowed($this->GetSecurityInfo()->HasEditGrant() && false);
            $result->setTableBordered(false);
            $result->setTableCondensed(false);
            
            $result->SetHighlightRowAtHover(false);
            $result->SetWidth('');
            $this->AddOperationsColumns($result);
            $this->AddFieldColumns($result);
            $this->AddSingleRecordViewColumns($result);
            $this->AddEditColumns($result);
            $this->AddMultiEditColumns($result);
            $this->AddInsertColumns($result);
            $this->AddPrintColumns($result);
            $this->AddExportColumns($result);
            $this->AddMultiUploadColumn($result);
    
    
            $this->SetShowPageList(true);
            $this->SetShowTopPageNavigator(true);
            $this->SetShowBottomPageNavigator(true);
            $this->setPrintListAvailable(false);
            $this->setPrintListRecordAvailable(false);
            $this->setPrintOneRecordAvailable(false);
            $this->setAllowPrintSelectedRecords(true);
            $this->setExportListAvailable(array('pdf', 'excel', 'word'));
            $this->setExportSelectedRecordsAvailable(array('pdf', 'excel', 'word', 'xml', 'csv'));
            $this->setExportListRecordAvailable(array());
            $this->setExportOneRecordAvailable(array('pdf', 'excel', 'word'));
    
            return $result;
        }
     
        protected function setClientSideEvents(Grid $grid) {
    
        }
    
        protected function doRegisterHandlers() {
            $detailPage = new notas_itensPage('notas_itens', $this, array('chave'), array('chave'), $this->GetForeignKeyFields(), $this->CreateMasterDetailRecordGrid(), $this->dataset, GetCurrentUserPermissionSetForDataSource('notas.itens'), 'UTF-8');
            $detailPage->SetRecordPermission(GetCurrentUserRecordPermissionsForDataSource('notas.itens'));
            $detailPage->SetHttpHandlerName('notas_itens_handler');
            $handler = new PageHTTPHandler('notas_itens_handler', $detailPage);
            GetApplication()->RegisterHTTPHandler($handler);
            
            $detailPage = new notas_notas_referenciadasPage('notas_notas_referenciadas', $this, array('chave'), array('chave'), $this->GetForeignKeyFields(), $this->CreateMasterDetailRecordGrid(), $this->dataset, GetCurrentUserPermissionSetForDataSource('notas.notas_referenciadas'), 'UTF-8');
            $detailPage->SetRecordPermission(GetCurrentUserRecordPermissionsForDataSource('notas.notas_referenciadas'));
            $detailPage->SetHttpHandlerName('notas_notas_referenciadas_handler');
            $handler = new PageHTTPHandler('notas_notas_referenciadas_handler', $detailPage);
            GetApplication()->RegisterHTTPHandler($handler);
            
            $detailPage = new notas_duplicatasPage('notas_duplicatas', $this, array('chave'), array('chave'), $this->GetForeignKeyFields(), $this->CreateMasterDetailRecordGrid(), $this->dataset, GetCurrentUserPermissionSetForDataSource('notas.duplicatas'), 'UTF-8');
            $detailPage->SetRecordPermission(GetCurrentUserRecordPermissionsForDataSource('notas.duplicatas'));
            $detailPage->SetHttpHandlerName('notas_duplicatas_handler');
            $handler = new PageHTTPHandler('notas_duplicatas_handler', $detailPage);
            GetApplication()->RegisterHTTPHandler($handler);
            
            $detailPage = new notas_volumesPage('notas_volumes', $this, array('chave'), array('chave'), $this->GetForeignKeyFields(), $this->CreateMasterDetailRecordGrid(), $this->dataset, GetCurrentUserPermissionSetForDataSource('notas.volumes'), 'UTF-8');
            $detailPage->SetRecordPermission(GetCurrentUserRecordPermissionsForDataSource('notas.volumes'));
            $detailPage->SetHttpHandlerName('notas_volumes_handler');
            $handler = new PageHTTPHandler('notas_volumes_handler', $detailPage);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for tx_obs field
            //
            $column = new TextViewColumn('tx_obs', 'tx_obs', 'Ocorrências da NF', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_tx_obs_handler_list', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for nome_destinatario field
            //
            $column = new TextViewColumn('nome_destinatario', 'nome_destinatario', 'Nome Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_nome_destinatario_handler_list', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for logradoura_destinatario field
            //
            $column = new TextViewColumn('logradoura_destinatario', 'logradoura_destinatario', 'Logradoura Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_logradoura_destinatario_handler_list', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for complemento_destinatario field
            //
            $column = new TextViewColumn('complemento_destinatario', 'complemento_destinatario', 'Complemento Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_complemento_destinatario_handler_list', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for email_destinatario field
            //
            $column = new TextViewColumn('email_destinatario', 'email_destinatario', 'Email Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_email_destinatario_handler_list', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for logradoura_retirada field
            //
            $column = new TextViewColumn('logradoura_retirada', 'logradoura_retirada', 'Logradoura Retirada', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_logradoura_retirada_handler_list', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for complemento_retirada field
            //
            $column = new TextViewColumn('complemento_retirada', 'complemento_retirada', 'Complemento Retirada', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_complemento_retirada_handler_list', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for logradouro_entrega field
            //
            $column = new TextViewColumn('logradouro_entrega', 'logradouro_entrega', 'Logradouro Entrega', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_logradouro_entrega_handler_list', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for complemento_entrega field
            //
            $column = new TextViewColumn('complemento_entrega', 'complemento_entrega', 'Complemento Entrega', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_complemento_entrega_handler_list', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for nome_transportador field
            //
            $column = new TextViewColumn('nome_transportador', 'nome_transportador', 'Nome Transportador', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_nome_transportador_handler_list', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for endereco_transportador field
            //
            $column = new TextViewColumn('endereco_transportador', 'endereco_transportador', 'Endereco Transportador', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_endereco_transportador_handler_list', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for informacoes_adicionais_contribuinte field
            //
            $column = new TextViewColumn('informacoes_adicionais_contribuinte', 'informacoes_adicionais_contribuinte', 'Informacoes Adicionais Contribuinte', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_informacoes_adicionais_contribuinte_handler_list', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for local_embarque field
            //
            $column = new TextViewColumn('local_embarque', 'local_embarque', 'Local Embarque', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_local_embarque_handler_list', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for local_despacho field
            //
            $column = new TextViewColumn('local_despacho', 'local_despacho', 'Local Despacho', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_local_despacho_handler_list', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for tx_cancelamento field
            //
            $column = new TextViewColumn('tx_cancelamento', 'tx_cancelamento', 'Tx Cancelamento', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_tx_cancelamento_handler_list', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for tx_correcao field
            //
            $column = new TextViewColumn('tx_correcao', 'tx_correcao', 'Tx Correcao', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_tx_correcao_handler_list', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for tx_obs field
            //
            $column = new TextViewColumn('tx_obs', 'tx_obs', 'Ocorrências da NF', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_tx_obs_handler_print', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for nome_destinatario field
            //
            $column = new TextViewColumn('nome_destinatario', 'nome_destinatario', 'Nome Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_nome_destinatario_handler_print', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for logradoura_destinatario field
            //
            $column = new TextViewColumn('logradoura_destinatario', 'logradoura_destinatario', 'Logradoura Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_logradoura_destinatario_handler_print', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for complemento_destinatario field
            //
            $column = new TextViewColumn('complemento_destinatario', 'complemento_destinatario', 'Complemento Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_complemento_destinatario_handler_print', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for email_destinatario field
            //
            $column = new TextViewColumn('email_destinatario', 'email_destinatario', 'Email Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_email_destinatario_handler_print', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for logradoura_retirada field
            //
            $column = new TextViewColumn('logradoura_retirada', 'logradoura_retirada', 'Logradoura Retirada', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_logradoura_retirada_handler_print', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for complemento_retirada field
            //
            $column = new TextViewColumn('complemento_retirada', 'complemento_retirada', 'Complemento Retirada', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_complemento_retirada_handler_print', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for logradouro_entrega field
            //
            $column = new TextViewColumn('logradouro_entrega', 'logradouro_entrega', 'Logradouro Entrega', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_logradouro_entrega_handler_print', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for complemento_entrega field
            //
            $column = new TextViewColumn('complemento_entrega', 'complemento_entrega', 'Complemento Entrega', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_complemento_entrega_handler_print', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for nome_transportador field
            //
            $column = new TextViewColumn('nome_transportador', 'nome_transportador', 'Nome Transportador', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_nome_transportador_handler_print', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for endereco_transportador field
            //
            $column = new TextViewColumn('endereco_transportador', 'endereco_transportador', 'Endereco Transportador', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_endereco_transportador_handler_print', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for informacoes_adicionais_contribuinte field
            //
            $column = new TextViewColumn('informacoes_adicionais_contribuinte', 'informacoes_adicionais_contribuinte', 'Informacoes Adicionais Contribuinte', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_informacoes_adicionais_contribuinte_handler_print', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for local_embarque field
            //
            $column = new TextViewColumn('local_embarque', 'local_embarque', 'Local Embarque', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_local_embarque_handler_print', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for local_despacho field
            //
            $column = new TextViewColumn('local_despacho', 'local_despacho', 'Local Despacho', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_local_despacho_handler_print', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for tx_cancelamento field
            //
            $column = new TextViewColumn('tx_cancelamento', 'tx_cancelamento', 'Tx Cancelamento', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_tx_cancelamento_handler_print', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for tx_correcao field
            //
            $column = new TextViewColumn('tx_correcao', 'tx_correcao', 'Tx Correcao', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_tx_correcao_handler_print', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for tx_obs field
            //
            $column = new TextViewColumn('tx_obs', 'tx_obs', 'Ocorrências da NF', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_tx_obs_handler_compare', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for nm_arquivo_retorno field
            //
            $column = new TextViewColumn('nm_arquivo_retorno', 'nm_arquivo_retorno', 'Nm Arquivo Retorno', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_nm_arquivo_retorno_handler_compare', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for nome_emitente field
            //
            $column = new TextViewColumn('nome_emitente', 'nome_emitente', 'Nome Emitente', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_nome_emitente_handler_compare', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for logradouro_emitente field
            //
            $column = new TextViewColumn('logradouro_emitente', 'logradouro_emitente', 'Logradouro Emitente', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_logradouro_emitente_handler_compare', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for complemento_emitente field
            //
            $column = new TextViewColumn('complemento_emitente', 'complemento_emitente', 'Complemento Emitente', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_complemento_emitente_handler_compare', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for nome_destinatario field
            //
            $column = new TextViewColumn('nome_destinatario', 'nome_destinatario', 'Nome Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_nome_destinatario_handler_compare', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for logradoura_destinatario field
            //
            $column = new TextViewColumn('logradoura_destinatario', 'logradoura_destinatario', 'Logradoura Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_logradoura_destinatario_handler_compare', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for complemento_destinatario field
            //
            $column = new TextViewColumn('complemento_destinatario', 'complemento_destinatario', 'Complemento Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_complemento_destinatario_handler_compare', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for email_destinatario field
            //
            $column = new TextViewColumn('email_destinatario', 'email_destinatario', 'Email Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_email_destinatario_handler_compare', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for logradoura_retirada field
            //
            $column = new TextViewColumn('logradoura_retirada', 'logradoura_retirada', 'Logradoura Retirada', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_logradoura_retirada_handler_compare', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for complemento_retirada field
            //
            $column = new TextViewColumn('complemento_retirada', 'complemento_retirada', 'Complemento Retirada', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_complemento_retirada_handler_compare', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for logradouro_entrega field
            //
            $column = new TextViewColumn('logradouro_entrega', 'logradouro_entrega', 'Logradouro Entrega', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_logradouro_entrega_handler_compare', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for complemento_entrega field
            //
            $column = new TextViewColumn('complemento_entrega', 'complemento_entrega', 'Complemento Entrega', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_complemento_entrega_handler_compare', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for nome_transportador field
            //
            $column = new TextViewColumn('nome_transportador', 'nome_transportador', 'Nome Transportador', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_nome_transportador_handler_compare', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for endereco_transportador field
            //
            $column = new TextViewColumn('endereco_transportador', 'endereco_transportador', 'Endereco Transportador', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_endereco_transportador_handler_compare', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for informacoes_adicionais_contribuinte field
            //
            $column = new TextViewColumn('informacoes_adicionais_contribuinte', 'informacoes_adicionais_contribuinte', 'Informacoes Adicionais Contribuinte', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_informacoes_adicionais_contribuinte_handler_compare', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for local_embarque field
            //
            $column = new TextViewColumn('local_embarque', 'local_embarque', 'Local Embarque', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_local_embarque_handler_compare', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for local_despacho field
            //
            $column = new TextViewColumn('local_despacho', 'local_despacho', 'Local Despacho', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_local_despacho_handler_compare', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for tx_cancelamento field
            //
            $column = new TextViewColumn('tx_cancelamento', 'tx_cancelamento', 'Tx Cancelamento', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_tx_cancelamento_handler_compare', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for tx_correcao field
            //
            $column = new TextViewColumn('tx_correcao', 'tx_correcao', 'Tx Correcao', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_tx_correcao_handler_compare', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for tx_obs field
            //
            $column = new TextViewColumn('tx_obs', 'tx_obs', 'Ocorrências da NF', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_tx_obs_handler_view', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for nome_destinatario field
            //
            $column = new TextViewColumn('nome_destinatario', 'nome_destinatario', 'Nome Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_nome_destinatario_handler_view', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for logradoura_destinatario field
            //
            $column = new TextViewColumn('logradoura_destinatario', 'logradoura_destinatario', 'Logradoura Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_logradoura_destinatario_handler_view', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for complemento_destinatario field
            //
            $column = new TextViewColumn('complemento_destinatario', 'complemento_destinatario', 'Complemento Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_complemento_destinatario_handler_view', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for email_destinatario field
            //
            $column = new TextViewColumn('email_destinatario', 'email_destinatario', 'Email Destinatario', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_email_destinatario_handler_view', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for logradoura_retirada field
            //
            $column = new TextViewColumn('logradoura_retirada', 'logradoura_retirada', 'Logradoura Retirada', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_logradoura_retirada_handler_view', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for complemento_retirada field
            //
            $column = new TextViewColumn('complemento_retirada', 'complemento_retirada', 'Complemento Retirada', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_complemento_retirada_handler_view', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for logradouro_entrega field
            //
            $column = new TextViewColumn('logradouro_entrega', 'logradouro_entrega', 'Logradouro Entrega', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_logradouro_entrega_handler_view', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for complemento_entrega field
            //
            $column = new TextViewColumn('complemento_entrega', 'complemento_entrega', 'Complemento Entrega', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_complemento_entrega_handler_view', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for nome_transportador field
            //
            $column = new TextViewColumn('nome_transportador', 'nome_transportador', 'Nome Transportador', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_nome_transportador_handler_view', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for endereco_transportador field
            //
            $column = new TextViewColumn('endereco_transportador', 'endereco_transportador', 'Endereco Transportador', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_endereco_transportador_handler_view', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for informacoes_adicionais_contribuinte field
            //
            $column = new TextViewColumn('informacoes_adicionais_contribuinte', 'informacoes_adicionais_contribuinte', 'Informacoes Adicionais Contribuinte', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_informacoes_adicionais_contribuinte_handler_view', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for local_embarque field
            //
            $column = new TextViewColumn('local_embarque', 'local_embarque', 'Local Embarque', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_local_embarque_handler_view', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for local_despacho field
            //
            $column = new TextViewColumn('local_despacho', 'local_despacho', 'Local Despacho', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_local_despacho_handler_view', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for tx_cancelamento field
            //
            $column = new TextViewColumn('tx_cancelamento', 'tx_cancelamento', 'Tx Cancelamento', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_tx_cancelamento_handler_view', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            
            //
            // View column for tx_correcao field
            //
            $column = new TextViewColumn('tx_correcao', 'tx_correcao', 'Tx Correcao', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'notasGrid_tx_correcao_handler_view', $column);
            GetApplication()->RegisterHTTPHandler($handler);
        }
       
        protected function doCustomRenderColumn($fieldName, $fieldData, $rowData, &$customText, &$handled)
        { 
            if ($fieldName == 'sequencia')
            {
               $customText = '<a href="php/envia_nfe.php?chave=' .$rowData['chave'] .'">ENVIAR</a>';
               $handled = true;
            }
        }
    
        protected function doCustomRenderPrintColumn($fieldName, $fieldData, $rowData, &$customText, &$handled)
        { 
    
        }
    
        protected function doCustomRenderExportColumn($exportType, $fieldName, $fieldData, $rowData, &$customText, &$handled)
        { 
    
        }
    
        protected function doCustomDrawRow($rowData, &$cellFontColor, &$cellFontSize, &$cellBgColor, &$cellItalicAttr, &$cellBoldAttr)
        {
    
        }
    
        protected function doExtendedCustomDrawRow($rowData, &$rowCellStyles, &$rowStyles, &$rowClasses, &$cellClasses)
        {
    
        }
    
        protected function doCustomRenderTotal($totalValue, $aggregate, $columnName, &$customText, &$handled)
        {
    
        }
    
        protected function doCustomDefaultValues(&$values, &$handled) 
        {
    
        }
    
        protected function doCustomCompareColumn($columnName, $valueA, $valueB, &$result)
        {
    
        }
    
        protected function doBeforeInsertRecord($page, &$rowData, $tableName, &$cancel, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doBeforeUpdateRecord($page, $oldRowData, &$rowData, $tableName, &$cancel, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doBeforeDeleteRecord($page, &$rowData, $tableName, &$cancel, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doAfterInsertRecord($page, $rowData, $tableName, &$success, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doAfterUpdateRecord($page, $oldRowData, $rowData, $tableName, &$success, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doAfterDeleteRecord($page, $rowData, $tableName, &$success, &$message, &$messageDisplayTime)
        {
    
        }
    
        protected function doCustomHTMLHeader($page, &$customHtmlHeaderText)
        { 
    
        }
    
        protected function doGetCustomTemplate($type, $part, $mode, &$result, &$params)
        {
    
        }
    
        protected function doGetCustomExportOptions(Page $page, $exportType, $rowData, &$options)
        {
    
        }
    
        protected function doFileUpload($fieldName, $rowData, &$result, &$accept, $originalFileName, $originalFileExtension, $fileSize, $tempFileName)
        {
    
        }
    
        protected function doPrepareChart(Chart $chart)
        {
    
        }
    
        protected function doPrepareColumnFilter(ColumnFilter $columnFilter)
        {
    
        }
    
        protected function doPrepareFilterBuilder(FilterBuilder $filterBuilder, FixedKeysArray $columns)
        {
    
        }
    
        protected function doGetSelectionFilters(FixedKeysArray $columns, &$result)
        {
    
        }
    
        protected function doGetCustomFormLayout($mode, FixedKeysArray $columns, FormLayout $layout)
        {
    
        }
    
        protected function doGetCustomColumnGroup(FixedKeysArray $columns, ViewColumnGroup $columnGroup)
        {
    
        }
    
        protected function doPageLoaded()
        {
    
        }
    
        protected function doCalculateFields($rowData, $fieldName, &$value)
        {
    
        }
    
        protected function doGetCustomPagePermissions(Page $page, PermissionSet &$permissions, &$handled)
        {
    
        }
    
        protected function doGetCustomRecordPermissions(Page $page, &$usingCondition, $rowData, &$allowEdit, &$allowDelete, &$mergeWithDefault, &$handled)
        {
    
        }
    
    }

    SetUpUserAuthorization();

    try
    {
        $Page = new notasPage("notas", "notas.php", GetCurrentUserPermissionSetForDataSource("notas"), 'UTF-8');
        $Page->SetRecordPermission(GetCurrentUserRecordPermissionsForDataSource("notas"));
        GetApplication()->SetMainPage($Page);
        GetApplication()->Run();
    }
    catch(Exception $e)
    {
        ShowErrorPage($e);
    }
	
