private decimal CalculoTributoAprox(string CODNCM) { decimal rsult = 0; try { RowRelatorio.Clear(); if (CODNCM != string.Empty) { RowRelatorio.Add(new RowsFiltro("CODNCM", "System.String", "=", CODNCM.ToString())); } NCMCollection NCMColl = new NCMCollection(); NCMProvider NCMP = new NCMProvider(); NCMColl = NCMP.ReadCollectionByParameter(RowRelatorio); if (NCMColl.Count > 0) { if (txtQuant.Text.TrimEnd().TrimStart() == string.Empty) { txtQuant.Text = "0,00"; } if (txtValorUnit.Text.TrimEnd().TrimStart() == string.Empty) { txtValorUnit.Text = "0,00"; } decimal TotalProduto = Convert.ToDecimal(txtQuant.Text) * Convert.ToDecimal(txtValorUnit.Text); decimal TributoAprox = (TotalProduto * Convert.ToDecimal(NCMColl[0].ALNACIONAL)) / 100; rsult = TributoAprox; } return(rsult); } catch (Exception ex) { return(rsult); MessageBox.Show("Não foi possível efetuar cálculo de tributos aproximados!"); } }
private void PesquisaServico() { try { NCMProvider NCMP = new NCMProvider(); RowsFiltroCollection RowRelatorio = new RowsFiltroCollection(); RowRelatorio.Add(new RowsFiltro("DESCRICAO", "System.String", "like", txtNomePesquisa.Text)); NCMColl = NCMP.ReadCollectionByParameter(RowRelatorio, "DESCRICAO"); DataGriewSearch.AutoGenerateColumns = false; DataGriewSearch.DataSource = NCMColl; txtNomePesquisa.Focus(); } catch (Exception) { MessageBox.Show(ConfigMessage.Default.searchFieldType, ConfigSistema1.Default.NomeEmpresa, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }