コード例 #1
0
        private void CD_Clifor_Leave(object sender, EventArgs e)
        {
            string vParam       = "a.cd_clifor|=|'" + CD_Clifor.Text.Trim() + "';isnull(a.st_registro, 'A')|<>|'C'";
            object obj_regvenda = null;

            if (!string.IsNullOrEmpty(CD_CompVend.Text))
            {
                obj_regvenda = new CamadaDados.Faturamento.Cadastros.TCD_Vendedor_X_RegiaoVenda().BuscarEscalar(
                    new Utils.TpBusca[]
                {
                    new Utils.TpBusca()
                    {
                        vNM_Campo = "a.cd_vendedor",
                        vOperador = "=",
                        vVL_Busca = "'" + CD_CompVend.Text.Trim() + "'"
                    }
                }, "1");
            }
            if (obj_regvenda == null ? false : obj_regvenda.ToString().Trim().Equals("1"))
            {
                vParam += ";|exists|(select 1 from tb_fat_vendedor_x_regiaovenda x " +
                          "         where x.id_regiao = a.id_regiao " +
                          "         and x.cd_vendedor = '" + CD_CompVend.Text.Trim() + "')";
            }
            DataRow linha = FormBusca.UtilPesquisa.EDIT_LEAVE(vParam, new Componentes.EditDefault[] { CD_Clifor, NM_Clifor }, new CamadaDados.Financeiro.Cadastros.TCD_CadClifor());

            CD_Endereco.Clear();
            DS_Endereco.Clear();
            DS_Cidade.Clear();
            UF.Text = string.Empty;
            Fone.Clear();
            Busca_Endereco_Clifor();
            bsOrcamento.ResetCurrentItem();
        }
コード例 #2
0
 private void CD_Clifor_Leave(object sender, EventArgs e)
 {
     FormBusca.UtilPesquisa.EDIT_LeaveClifor("a.cd_clifor|=|'" + CD_Clifor.Text.Trim() + "'",
                                             new Componentes.EditDefault[] { CD_Clifor, NM_Clifor },
                                             new CamadaDados.Financeiro.Cadastros.TCD_CadClifor());
     if (!string.IsNullOrEmpty(CD_Clifor.Text))
     {
         //Buscar endereco
         this.BuscarEndereco();
         NM_Clifor.Enabled   = false;
         CD_Endereco.Enabled = true;
         BB_Endereco.Enabled = true;
         DS_Endereco.Enabled = false;
         DS_Cidade.Enabled   = false;
         UF.Enabled          = false;
         Fone.Enabled        = false;
     }
     else
     {
         NM_Clifor.Enabled   = true;
         CD_Endereco.Enabled = false;
         BB_Endereco.Enabled = false;
         DS_Endereco.Enabled = true;
         DS_Cidade.Enabled   = true;
         UF.Enabled          = true;
         Fone.Enabled        = true;
         CD_Endereco.Clear();
         DS_Endereco.Clear();
         DS_Cidade.Clear();
         UF.Clear();
         Fone.Clear();
     }
 }
コード例 #3
0
 private void BB_Clifor_Click(object sender, EventArgs e)
 {
     FormBusca.UtilPesquisa.BTN_BuscaClifor(new Componentes.EditDefault[] { CD_Clifor, NM_Clifor }, string.Empty);
     if (!string.IsNullOrEmpty(CD_Clifor.Text))
     {
         //Buscar endereco
         this.BuscarEndereco();
         NM_Clifor.Enabled   = false;
         CD_Endereco.Enabled = true;
         BB_Endereco.Enabled = true;
         DS_Endereco.Enabled = false;
         DS_Cidade.Enabled   = false;
         UF.Enabled          = false;
         Fone.Enabled        = false;
     }
     else
     {
         NM_Clifor.Enabled   = true;
         CD_Endereco.Enabled = false;
         BB_Endereco.Enabled = false;
         DS_Endereco.Enabled = true;
         DS_Cidade.Enabled   = true;
         UF.Enabled          = true;
         Fone.Enabled        = true;
         CD_Endereco.Clear();
         DS_Endereco.Clear();
         DS_Cidade.Clear();
         UF.Clear();
         Fone.Clear();
     }
 }
コード例 #4
0
 private void CD_Clifor_TextChanged(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(CD_Clifor.Text))
     {
         CD_Endereco.Clear();
         DS_Endereco.Clear();
     }
 }
コード例 #5
0
 private void BB_Clifor_Click(object sender, EventArgs e)
 {
     FormBusca.UtilPesquisa.BTN_BuscaClifor(new Componentes.EditDefault[] { CD_Clifor, NM_Clifor }, string.Empty);
     if (!string.IsNullOrEmpty(CD_Clifor.Text))
     {
         //Buscar endereco
         BuscarEndereco();
         //Buscar veiculo cliente
         BuscarVeiculoCliente();
         NM_Clifor.Enabled   = false;
         CD_Endereco.Enabled = true;
         BB_Endereco.Enabled = true;
         DS_Endereco.Enabled = false;
         DS_Cidade.Enabled   = false;
         UF.Enabled          = false;
     }
     else
     {
         NM_Clifor.Enabled   = true;
         CD_Endereco.Enabled = false;
         BB_Endereco.Enabled = false;
         DS_Endereco.Enabled = true;
         DS_Cidade.Enabled   = true;
         UF.Enabled          = true;
         CD_Endereco.Clear();
         DS_Endereco.Clear();
         DS_Cidade.Clear();
         UF.Clear();
         placaveiculo.Clear();
         ds_veiculo.Clear();
         ds_marca.Clear();
         ds_obsveiculo.Clear();
         placaveiculo.Enabled  = true;
         ds_veiculo.Enabled    = true;
         ds_marca.Enabled      = true;
         ds_obsveiculo.Enabled = true;
     }
 }
コード例 #6
0
        private void BB_Clifor_Click(object sender, EventArgs e)
        {
            string vParam = "isnull(a.st_fornecedor, 'N')|<>|'S';" +
                            "isnull(a.ST_Funcionarios, 'N')|<>|'S';" +
                            "isnull(a.st_representante, 'N')|<>|'S';" +
                            "isnull(a.st_transportadora, 'N')|<>|'S'";

            FormBusca.UtilPesquisa.BTN_BuscaClifor(new Componentes.EditDefault[] { CD_Clifor, NM_Clifor }, vParam);
            if (!string.IsNullOrEmpty(CD_Clifor.Text))
            {
                //Buscar endereco
                this.BuscarEndereco();
                NM_Clifor.Enabled = false;
            }
            else
            {
                NM_Clifor.Enabled = true;
                CD_Endereco.Clear();
                DS_Endereco.Clear();
                DS_Cidade.Clear();
                UF.Clear();
            }
        }
コード例 #7
0
 private void CD_Clifor_Leave(object sender, EventArgs e)
 {
     FormBusca.UtilPesquisa.EDIT_LeaveClifor("a.cd_clifor|=|'" + CD_Clifor.Text.Trim() + "';" +
                                             "isnull(a.st_fornecedor, 'N')|<>|'S';" +
                                             "isnull(a.ST_Funcionarios, 'N')|<>|'S';" +
                                             "isnull(a.st_representante, 'N')|<>|'S';" +
                                             "isnull(a.st_transportadora, 'N')|<>|'S'",
                                             new Componentes.EditDefault[] { CD_Clifor, NM_Clifor },
                                             new CamadaDados.Financeiro.Cadastros.TCD_CadClifor());
     if (!string.IsNullOrEmpty(CD_Clifor.Text))
     {
         //Buscar endereco
         this.BuscarEndereco();
         NM_Clifor.Enabled = false;
     }
     else
     {
         NM_Clifor.Enabled = true;
         CD_Endereco.Clear();
         DS_Endereco.Clear();
         DS_Cidade.Clear();
         UF.Clear();
     }
 }
コード例 #8
0
 private void ConfigOutrosImpostos()
 {
     if (string.IsNullOrEmpty(CD_Empresa.Text))
     {
         MessageBox.Show("Obrigatorio informar empresa para configurar imposto.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         CD_Empresa.Focus();
         return;
     }
     if (string.IsNullOrEmpty(CFG_Pedido.Text))
     {
         MessageBox.Show("Obrigatorio informar tipo pedido para configurar imposto.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         CFG_Pedido.Focus();
         return;
     }
     if (Cbx_TP_Fiscal.SelectedValue == null)
     {
         MessageBox.Show("Obrigatorio selecionar tipo fiscal para configurar imposto.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         Cbx_TP_Fiscal.Focus();
         return;
     }
     if (string.IsNullOrEmpty(CD_Clifor.Text))
     {
         MessageBox.Show("Obrigatorio informar cliente/fornecedor para configurar imposto.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         CD_Clifor.Focus();
         return;
     }
     if (string.IsNullOrEmpty(CD_Endereco.Text))
     {
         MessageBox.Show("Obrigatorio informar endereço para configurar imposto.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         CD_Endereco.Focus();
         return;
     }
     if (bsProdutoSimular.Count.Equals(0))
     {
         MessageBox.Show("Obrigatorio informar produto para configurar imposto.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         bb_adicionar.Focus();
         return;
     }
     //Buscar movimentacao comercial do tipo de pedido
     CamadaDados.Faturamento.Cadastros.TList_CadCFGPedidoFiscal lCfgPed =
         new CamadaDados.Faturamento.Cadastros.TCD_CadCFGPedidoFiscal().Select(
             new Utils.TpBusca[]
     {
         new Utils.TpBusca()
         {
             vNM_Campo = "a.cfg_pedido",
             vOperador = "=",
             vVL_Busca = "'" + CFG_Pedido.Text.Trim() + "'"
         },
         new Utils.TpBusca()
         {
             vNM_Campo = "a.tp_fiscal",
             vOperador = "=",
             vVL_Busca = "'" + Cbx_TP_Fiscal.SelectedValue.ToString() + "'"
         }
     }, 1, string.Empty);
     if (lCfgPed.Count < 1)
     {
         MessageBox.Show("Não existe configuração fiscal para o tipo de pedido " + CFG_Pedido.Text.Trim() + ", tipo fiscal " + Cbx_TP_Fiscal.SelectedValue.ToString() + ".",
                         "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         CFG_Pedido.Focus();
         return;
     }
     using (TFCondFiscalImposto fCondImposto = new TFCondFiscalImposto())
     {
         fCondImposto.pCd_empresa            = CD_Empresa.Text;
         fCondImposto.pCd_imposto            = (bsImpProduto.Current as CamadaDados.Faturamento.NotaFiscal.TRegistro_ImpostosNF).Cd_impostostr;
         fCondImposto.pCd_condfiscal_clifor  = cd_condfiscal_clifor.Text;
         fCondImposto.pCd_condfiscal_produto = (bsProdutoSimular.Current != null ? (bsProdutoSimular.Current as CamadaDados.Fiscal.TRegistro_ProdutoSimular).Cd_condfiscal_produto : string.Empty);
         fCondImposto.pCd_movimentacao       = lCfgPed[0].Cd_movtostring;
         fCondImposto.pTp_faturamento        = TP_Mov.Text;
         fCondImposto.pSt_juridica           = tp_pessoa.Text.Trim().ToUpper().Equals("J");
         fCondImposto.pSt_fisica             = tp_pessoa.Text.Trim().ToUpper().Equals("F");
         if (fCondImposto.ShowDialog() == DialogResult.OK)
         {
             if ((fCondImposto.rCond != null) &&
                 (fCondImposto.lMov != null) &&
                 (fCondImposto.lCondClifor != null) &&
                 (fCondImposto.lCondProd != null))
             {
                 try
                 {
                     CamadaNegocio.Fiscal.TCN_CondicaoFiscalImposto.gravarFiscImposto(fCondImposto.rCond,
                                                                                      fCondImposto.lMov,
                                                                                      fCondImposto.lCondClifor,
                                                                                      fCondImposto.lCondProd,
                                                                                      fCondImposto.pSt_fisica,
                                                                                      fCondImposto.pSt_juridica,
                                                                                      fCondImposto.pSt_estrangeiro,
                                                                                      null);
                 }
                 catch { }
             }
         }
         CalcularImpostos();
     }
 }
コード例 #9
0
 private void ConfigImpostoUf()
 {
     if (string.IsNullOrEmpty(CD_Empresa.Text))
     {
         MessageBox.Show("Obrigatorio informar empresa para configurar imposto.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         CD_Empresa.Focus();
         return;
     }
     if (string.IsNullOrEmpty(CFG_Pedido.Text))
     {
         MessageBox.Show("Obrigatorio informar tipo pedido para configurar imposto.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         CFG_Pedido.Focus();
         return;
     }
     if (Cbx_TP_Fiscal.SelectedValue == null)
     {
         MessageBox.Show("Obrigatorio selecionar tipo fiscal para configurar imposto.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         Cbx_TP_Fiscal.Focus();
         return;
     }
     if (string.IsNullOrEmpty(CD_Clifor.Text))
     {
         MessageBox.Show("Obrigatorio informar cliente/fornecedor para configurar imposto.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         CD_Clifor.Focus();
         return;
     }
     if (string.IsNullOrEmpty(CD_Endereco.Text))
     {
         MessageBox.Show("Obrigatorio informar endereço para configurar imposto.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         CD_Endereco.Focus();
         return;
     }
     if (bsProdutoSimular.Count.Equals(0))
     {
         MessageBox.Show("Obrigatorio informar produto para configurar imposto.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         bb_adicionar.Focus();
         return;
     }
     //Buscar movimentacao comercial do tipo de pedido
     CamadaDados.Faturamento.Cadastros.TList_CadCFGPedidoFiscal lCfgPed =
         new CamadaDados.Faturamento.Cadastros.TCD_CadCFGPedidoFiscal().Select(
             new Utils.TpBusca[]
     {
         new Utils.TpBusca()
         {
             vNM_Campo = "a.cfg_pedido",
             vOperador = "=",
             vVL_Busca = "'" + CFG_Pedido.Text.Trim() + "'"
         },
         new Utils.TpBusca()
         {
             vNM_Campo = "a.tp_fiscal",
             vOperador = "=",
             vVL_Busca = "'" + Cbx_TP_Fiscal.SelectedValue.ToString() + "'"
         }
     }, 1, string.Empty);
     if (lCfgPed.Count < 1)
     {
         MessageBox.Show("Não existe configuração fiscal para o tipo de pedido " + CFG_Pedido.Text.Trim() + ", tipo fiscal " + Cbx_TP_Fiscal.SelectedValue.ToString() + ".",
                         "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         CFG_Pedido.Focus();
         return;
     }
     using (TFCondFiscalICMS fCondICMS = new TFCondFiscalICMS())
     {
         fCondICMS.pCd_empresa            = CD_Empresa.Text;
         fCondICMS.pCd_condfiscal_clifor  = cd_condfiscal_clifor.Text;
         fCondICMS.pCd_condfiscal_produto = (bsProdutoSimular.Current != null ? (bsProdutoSimular.Current as CamadaDados.Fiscal.TRegistro_ProdutoSimular).Cd_condfiscal_produto : string.Empty);
         fCondICMS.pCd_movto     = lCfgPed[0].Cd_movtostring;
         fCondICMS.pCd_UfDest    = TP_Mov.Text.Trim().ToUpper().Equals("E") ? uf_empresa.Text : UF.Text;
         fCondICMS.pCd_UfOrig    = TP_Mov.Text.Trim().ToUpper().Equals("E") ? UF.Text : uf_empresa.Text;
         fCondICMS.pTp_movimento = (Cbx_TP_Fiscal.SelectedValue.ToString().Trim().Equals("DV") ||
                                    Cbx_TP_Fiscal.SelectedValue.ToString().Trim().Equals("DF")) ? TP_Mov.Text.Trim().ToUpper().Equals("E") ? "S" : "E" : TP_Mov.Text;
         if (fCondICMS.ShowDialog() == DialogResult.OK)
         {
             if ((fCondICMS.rCond != null) &&
                 (fCondICMS.lMov != null) &&
                 (fCondICMS.lUfDestino != null) &&
                 (fCondICMS.lUfOrigem != null))
             {
                 try
                 {
                     CamadaNegocio.Fiscal.TCN_CadCondFiscalICMS.Gravar(fCondICMS.rCond,
                                                                       fCondICMS.lMov,
                                                                       fCondICMS.lUfOrigem,
                                                                       fCondICMS.lUfDestino,
                                                                       null);
                 }
                 catch { }
             }
         }
         CalcularImpostos();
     }
 }
コード例 #10
0
 private void CalcularImpostos()
 {
     if (string.IsNullOrEmpty(CD_Empresa.Text))
     {
         MessageBox.Show("Obrigatorio informar empresa para simular impostos.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         CD_Empresa.Focus();
         return;
     }
     if (string.IsNullOrEmpty(CFG_Pedido.Text))
     {
         MessageBox.Show("Obrigatorio informar tipo pedido para simular impostos.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         CFG_Pedido.Focus();
         return;
     }
     if (Cbx_TP_Fiscal.SelectedValue == null)
     {
         MessageBox.Show("Obrigatorio selecionar tipo fiscal para simular impostos.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         Cbx_TP_Fiscal.Focus();
         return;
     }
     if (string.IsNullOrEmpty(CD_Clifor.Text))
     {
         MessageBox.Show("Obrigatorio informar cliente/fornecedor para simular impostos.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         CD_Clifor.Focus();
         return;
     }
     if (string.IsNullOrEmpty(CD_Endereco.Text))
     {
         MessageBox.Show("Obrigatorio informar endereço para simular impostos.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         CD_Endereco.Focus();
         return;
     }
     if (bsProdutoSimular.Count.Equals(0))
     {
         MessageBox.Show("Obrigatorio informar produto para simular impostos.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         bb_adicionar.Focus();
         return;
     }
     //Buscar movimentacao comercial do tipo de pedido
     CamadaDados.Faturamento.Cadastros.TList_CadCFGPedidoFiscal lCfgPed =
         new CamadaDados.Faturamento.Cadastros.TCD_CadCFGPedidoFiscal().Select(
             new Utils.TpBusca[]
     {
         new Utils.TpBusca()
         {
             vNM_Campo = "a.cfg_pedido",
             vOperador = "=",
             vVL_Busca = "'" + CFG_Pedido.Text.Trim() + "'"
         },
         new Utils.TpBusca()
         {
             vNM_Campo = "a.tp_fiscal",
             vOperador = "=",
             vVL_Busca = "'" + Cbx_TP_Fiscal.SelectedValue.ToString() + "'"
         }
     }, 1, string.Empty);
     if (lCfgPed.Count < 1)
     {
         MessageBox.Show("Não existe configuração fiscal para o tipo de pedido " + CFG_Pedido.Text.Trim() + ", tipo fiscal " + Cbx_TP_Fiscal.Text + ".",
                         "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         CFG_Pedido.Focus();
         return;
     }
     CamadaDados.Fiscal.TList_ResumoImposto lResumo = new CamadaDados.Fiscal.TList_ResumoImposto();
     for (int i = 0; i < bsProdutoSimular.Count; i++)
     {
         string retobs = string.Empty;
         (bsProdutoSimular[i] as CamadaDados.Fiscal.TRegistro_ProdutoSimular).lImpProduto =
             CamadaNegocio.Faturamento.NotaFiscal.TCN_LanFaturamento_Item.procuraImpostosPorUf(CD_Empresa.Text,
                                                                                               (TP_Mov.Text.Trim().ToUpper().Equals("E") &&
                                                                                                (Cbx_TP_Fiscal.SelectedValue.ToString().Trim() != "DV") &&
                                                                                                (Cbx_TP_Fiscal.SelectedValue.ToString().Trim() != "DF") ? UF.Text : uf_empresa.Text),
                                                                                               (TP_Mov.Text.Trim().ToUpper().Equals("E") &&
                                                                                                (Cbx_TP_Fiscal.SelectedValue.ToString().Trim() != "DV") &&
                                                                                                (Cbx_TP_Fiscal.SelectedValue.ToString().Trim() != "DF") ? uf_empresa.Text : UF.Text),
                                                                                               lCfgPed[0].Cd_movtostring,
                                                                                               (Cbx_TP_Fiscal.SelectedValue.ToString().Trim().Equals("DV") ||
                                                                                                Cbx_TP_Fiscal.SelectedValue.ToString().Trim().Equals("DF") ?
                                                                                                TP_Mov.Text.Trim().Equals("E") ? "S" : "E" : TP_Mov.Text),
                                                                                               cd_condfiscal_clifor.Text,
                                                                                               (bsProdutoSimular[i] as CamadaDados.Fiscal.TRegistro_ProdutoSimular).Cd_condfiscal_produto,
                                                                                               (bsProdutoSimular[i] as CamadaDados.Fiscal.TRegistro_ProdutoSimular).Vl_subtotal,
                                                                                               (bsProdutoSimular[i] as CamadaDados.Fiscal.TRegistro_ProdutoSimular).Quantidade,
                                                                                               ref retobs,
                                                                                               DateTime.Now,
                                                                                               cd_produto.Text,
                                                                                               string.Empty,
                                                                                               string.Empty,
                                                                                               null);
         (bsProdutoSimular[i] as CamadaDados.Fiscal.TRegistro_ProdutoSimular).lImpProduto.Concat(CamadaNegocio.Faturamento.NotaFiscal.TCN_LanFaturamento_Item.procuraCondicaoFiscalImpostos(cd_condfiscal_clifor.Text,
                                                                                                                                                                                            (bsProdutoSimular[i] as CamadaDados.Fiscal.TRegistro_ProdutoSimular).Cd_condfiscal_produto,
                                                                                                                                                                                            lCfgPed[0].Cd_movtostring,
                                                                                                                                                                                            (Cbx_TP_Fiscal.SelectedValue.ToString().Trim().Equals("DV") ||
                                                                                                                                                                                             Cbx_TP_Fiscal.SelectedValue.ToString().Trim().Equals("DF") ?
                                                                                                                                                                                             TP_Mov.Text.Trim().Equals("E") ? "S" : "E" : TP_Mov.Text),
                                                                                                                                                                                            tp_pessoa.Text,
                                                                                                                                                                                            CD_Empresa.Text,
                                                                                                                                                                                            lCfgPed[0].Nr_serie,
                                                                                                                                                                                            CD_Clifor.Text,
                                                                                                                                                                                            string.Empty,
                                                                                                                                                                                            DateTime.Now,
                                                                                                                                                                                            (bsProdutoSimular[i] as CamadaDados.Fiscal.TRegistro_ProdutoSimular).Quantidade,
                                                                                                                                                                                            (bsProdutoSimular[i] as CamadaDados.Fiscal.TRegistro_ProdutoSimular).Vl_subtotal,
                                                                                                                                                                                            string.Empty,
                                                                                                                                                                                            pCd_municipioexecservico,
                                                                                                                                                                                            null));
         var ipi  = (bsProdutoSimular[i] as CamadaDados.Fiscal.TRegistro_ProdutoSimular).lImpProduto.Find(v => v.Imposto.St_IPI);
         var icms = (bsProdutoSimular[i] as CamadaDados.Fiscal.TRegistro_ProdutoSimular).lImpProduto.Find(v => v.Imposto.St_ICMS);
         if (ipi != null &&
             (icms == null ? false : icms.St_somarIPIBaseICMS || icms.St_somarIPIBaseST))
         {
             TRegistro_ImpostosNF rImp = new TRegistro_ImpostosNF();
             rImp.Cd_imposto                  = icms.Cd_imposto;
             rImp.Pc_aliquota                 = icms.Pc_aliquota;
             rImp.Pc_reducaoaliquota          = icms.Pc_reducaoaliquota;
             rImp.Pc_reducaobasecalc          = icms.Pc_reducaobasecalc;
             rImp.Pc_aliquotasubst            = icms.Pc_aliquotasubst;
             rImp.Pc_reducaobasecalcsubsttrib = icms.Pc_reducaobasecalcsubsttrib;
             rImp.Tp_situacao                 = icms.Tp_situacao;
             rImp.Dt_imposto                  = icms.Dt_imposto;
             rImp.St_impostouf                = 0;
             rImp.Tp_modbasecalc              = icms.Tp_modbasecalc;
             rImp.Tp_modbasecalcST            = icms.Tp_modbasecalcST;
             rImp.Cd_st               = icms.Cd_st;
             rImp.St_substtrib        = icms.St_substtrib;
             rImp.St_simplesnacional  = icms.St_simplesnacional;
             rImp.Pc_iva_st           = icms.Pc_iva_st;
             rImp.Vl_mva              = icms.Vl_mva;
             rImp.Pc_aliquotaICMSDest = icms.Pc_aliquotaICMSDest;
             rImp.Vl_pauta            = icms.Vl_pauta;
             rImp.St_somarIPIBaseICMS = icms.St_somarIPIBaseICMS;
             rImp.St_somarIPIBaseST   = icms.St_somarIPIBaseST;
             rImp.Vl_ipisomar         = ipi.Vl_impostocalc;
             //Calcular Imposto
             CamadaNegocio.Faturamento.NotaFiscal.TCN_LanFaturamento_Item
             .CalcImpostos(rImp,
                           (bsProdutoSimular[i] as CamadaDados.Fiscal.TRegistro_ProdutoSimular).Vl_subtotal,
                           (bsProdutoSimular[i] as CamadaDados.Fiscal.TRegistro_ProdutoSimular).Quantidade,
                           (Cbx_TP_Fiscal.SelectedValue.ToString().Trim().Equals("DV") ||
                            Cbx_TP_Fiscal.SelectedValue.ToString().Trim().Equals("DF") ?
                            TP_Mov.Text.Trim().Equals("E") ? "S" : "E" : TP_Mov.Text));
             //Preencher ICMS Item Nota
             icms.Vl_basecalcsubsttrib = rImp.Vl_basecalcsubsttrib;
             icms.Vl_impostosubsttrib  = rImp.Vl_impostosubsttrib;
         }
         (bsProdutoSimular[i] as CamadaDados.Fiscal.TRegistro_ProdutoSimular).lImpProduto.ForEach(p =>
         {
             if (lResumo.Exists(v => v.Cd_imposto.Trim().Equals(p.Cd_imposto.Value.ToString()) &&
                                v.St_totalnota.Trim().Equals(p.St_totalnota.Trim())))
             {
                 lResumo.Find(v => v.Cd_imposto.Trim().Equals(p.Cd_impostostr.Trim())).Vl_imposto         += p.Vl_impostocalc;
                 lResumo.Find(v => v.Cd_imposto.Trim().Equals(p.Cd_impostostr.Trim())).Vl_impostoretido   += p.Vl_impostoretido;
                 lResumo.Find(v => v.Cd_imposto.Trim().Equals(p.Cd_impostostr.Trim())).Vl_impostosubstrib += p.Vl_impostosubsttrib + p.Vl_FCPST;
             }
             else
             {
                 lResumo.Add(new CamadaDados.Fiscal.TRegistro_ResumoImposto()
                 {
                     Cd_imposto         = p.Cd_impostostr,
                     Ds_imposto         = p.Ds_imposto,
                     Vl_imposto         = p.Vl_impostocalc,
                     Vl_impostoretido   = p.Vl_impostoretido,
                     Vl_impostosubstrib = p.Vl_impostosubsttrib + p.Vl_FCPST,
                     St_totalnota       = p.St_totalnota
                 });
             }
         });
     }
     tot_imposto.Value = lResumo.Sum(p => p.Vl_imposto);
     tot_retido.Value  = lResumo.Sum(p => p.Vl_impostoretido);
     tot_subst.Value   = lResumo.Sum(p => p.Vl_impostosubstrib);
     bsProdutoSimular.ResetBindings(true);
     bsResumoImposto.DataSource = lResumo;
 }