private void AbrirArquivoRetorno(string NomeArquivo) { CreaterCursor Cr = new CreaterCursor(); this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0); try { LIS_DUPLICATARECEBERColl2.Clear(); //Limpa dados do grid DataGridRelaDupl.Rows.Clear(); TotalGeral = 0; string PathSystem = NomeArquivo; StreamReader objReader = new StreamReader(PathSystem, Encoding.Default); string sLine = ""; while (sLine != null) { sLine = objReader.ReadLine(); if (sLine != null) { //Nosso numero sLine = sLine.Substring(Convert.ToInt32(txtcolunaInicial.Text), 7); //Pegar o ultimo digito string sLineEnd = sLine.Substring(sLine.Length - 1, 1); sLine = sLine.Substring(0, sLine.Length - 1); sLine = sLine + "-" + sLineEnd; //Verifica se a duplicata existe e adiciona no grid VerificaExisteDuplicata(sLine); } } //Somatorio DataGridViewRow row2 = new DataGridViewRow(); row2.CreateCells(DataGridRelaDupl, "", "", "", "", "", TotalGeral.ToString("n2"), "", "", "", ""); row2.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold); DataGridRelaDupl.Rows.Add(row2); if (TotalGeral == 0) { MessageBox.Show("Não Foram Encontrados Registros"); } this.Cursor = Cursors.Default; } catch (Exception ex) { this.Cursor = Cursors.Default; MessageBox.Show("Erro técnico: " + ex.Message); } }
/// <summary> /// Retorna o texto do registro do tipo 90 para uso do SIntegra. /// </summary> /// <returns>Uma string com os dados formatados para uso do SIntegra.</returns> public override string ToString() { // Formata os dados para gerar a string do cabeçalho da resposta string n01 = Tipo.ToString().PadLeft(2, '0'); string n02 = CNPJ.PadLeft(14, '0'); string n03 = InscEstadual.PadRight(14); string[] n04 = new string[TotaisTipoRegistro.Keys.Count + 1]; string n05 = TotalRegistros90.ToString(); // Coloca os totais de registros na variável n04 int j = 0; foreach (int tipo in TotaisTipoRegistro.Keys) { n04[j++] = tipo.ToString().PadLeft(2, '0') + TotaisTipoRegistro[tipo].ToString().PadLeft(8, '0'); } n04[j] = "99" + TotalGeral.ToString().PadLeft(8, '0'); // Formata as linhas dos registros 90 string[] linhas = new string[TotalRegistros90]; for (int i = 0; i < linhas.Length; i++) { string n04Linha = ""; for (j = i * 8; j < (i + 1) * 8; j++) { if (j >= n04.Length) { break; } n04Linha += n04[j]; } linhas[i] = n01 + n02 + n03 + n04Linha.PadRight(95) + n05; } // Retorna os dados formatados StringBuilder retorno = new StringBuilder(); foreach (string s in linhas) { retorno.AppendLine(s); } return(retorno.ToString()); }
private void btnPesquisa_Click(object sender, EventArgs e) { if (Validacoes()) { try { SaldoAbertura = BuscaSaldoAbertura(); TotalSangria = BuscaSangria(); TotalGeral = 0; TotalDinheiro = 0; TotalCartaoCredito = 0; TotalCheque = 0; DataGriewDados.Rows.Clear(); if (rbDinheiro.Checked) { PreencheGrid2(1); //1=Dinheiro } else if (rbCheque.Checked) { PreencheGrid2(2); //2=Cheque } else if (rbCartaoCredito.Checked) { PreencheGrid2(3); //3=Cartão de Crédito } else if (rbCartaoDebito.Checked) { PreencheGrid2(4); //4=Cartão de Débito } else if (rbOutros.Checked) { PreencheGrid2(1); //1=Dinheiro PreencheGrid2(2); //2=Cheque PreencheGrid2(3); //3=Cartão de Crédito PreencheGrid2(4); //4=Cartão de Débito PreencheGrid2(11); //11=Vale RefeiçãO PreencheGrid2(99); ////99=Outros } DataGridViewRow rowRodape = new DataGridViewRow(); rowRodape.CreateCells(DataGriewDados, string.Empty, "Total Geral: ", TotalGeral.ToString("n2")); rowRodape.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold); DataGriewDados.Rows.Add(rowRodape); DataGridViewRow rowRodape_2 = new DataGridViewRow(); rowRodape_2.CreateCells(DataGriewDados, "---------------------------------------------------", "-----------------------", "-----------------------", "-----------------------"); rowRodape_2.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold); DataGriewDados.Rows.Add(rowRodape_2); DataGridViewRow rowRodape_Saldo = new DataGridViewRow(); decimal Saldo = (SaldoAbertura + TotalDinheiro + TotalCheque) - TotalSangria; rowRodape_Saldo.CreateCells(DataGriewDados, "Total da Abertura: " + SaldoAbertura.ToString("n2"), "", ""); rowRodape_Saldo.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold); DataGriewDados.Rows.Add(rowRodape_Saldo); DataGridViewRow rowRodape_Saldo2 = new DataGridViewRow(); rowRodape_Saldo2.CreateCells(DataGriewDados, "Total de Sangria: " + TotalSangria.ToString("n2"), "", "", ""); rowRodape_Saldo2.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold); DataGriewDados.Rows.Add(rowRodape_Saldo2); DataGridViewRow rowRodape_Saldo3 = new DataGridViewRow(); rowRodape_Saldo3.CreateCells(DataGriewDados, "Saldo: " + Saldo.ToString("n2"), "", "", ""); rowRodape_Saldo3.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold); DataGriewDados.Rows.Add(rowRodape_Saldo3); } catch (Exception EX) { MessageBox.Show("Erro na pesquisa!"); MessageBox.Show("Erro técnico: " + EX.Message); } } }
private void PreencheGrid3() { CreaterCursor Cr = new CreaterCursor(); this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0); try { TotalGeral = 0; DataGriewDados.Rows.Clear(); foreach (LIS_MOVPRODUTOESEntity item in LIS_MOVPRODUTOESColl) { FORNECEDORProvider FORNECEDORP = new FORNECEDORProvider(); FORNECEDOREntity FORNECEDORTy = new FORNECEDOREntity(); FORNECEDORTy = FORNECEDORP.Read(Convert.ToInt32(item.IDFORNECEDOR)); string NotaFiscal = item.NDOCUMENTO; decimal ValorTotal = Convert.ToDecimal(item.VALORTOTAL); TotalGeral += TotalNFEntradaReg50(Convert.ToInt32(item.IDCFOP), Convert.ToDecimal(item.ALQICMS), item.NDOCUMENTO);; string FlagEnviada = "S"; string FLAGINUTILIZADO = "S"; string FLAGCANCELADA = "S"; DataGridViewRow row1 = new DataGridViewRow(); row1.CreateCells(DataGriewDados, NotaFiscal, FORNECEDORTy.NOME, FlagEnviada, FLAGINUTILIZADO, FLAGCANCELADA, ValorTotal.ToString("n2")); row1.DefaultCellStyle.Font = new Font("Arial", 8); DataGriewDados.Rows.Add(row1); } DataGridViewRow rowLinha = new DataGridViewRow(); rowLinha.CreateCells(DataGriewDados, "-------", "-----------------------------", "---------", "---------", "Total geral:", TotalGeral.ToString("n2")); rowLinha.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold); DataGriewDados.Rows.Add(rowLinha); this.Cursor = Cursors.Default; } catch (Exception ex) { this.Cursor = Cursors.Default; MessageBox.Show("Erro técnico: " + ex.Message); } }
private void btnPesquisa_Click(object sender, EventArgs e) { if (Validacoes()) { CreaterCursor Cr = new CreaterCursor(); this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0); try { RowRelatorio.Clear(); string DataInicial = Util.ConverStringDateSearch(msktDataInicial.Text); string DataFinal = Util.ConverStringDateSearch(msktDataFinal.Text); RowRelatorio.Add(new RowsFiltro("DATAEMISSAO", "System.DateTime", ">=", DataInicial, "and")); RowRelatorio.Add(new RowsFiltro("DATAEMISSAO", "System.DateTime", "<=", DataFinal, "and")); if (rbOrcamentoPesquisa.Checked) { RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "S", "and")); } if (rbVendasPesquisa.Checked) { RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "N", "and")); } RowRelatorio.Add(new RowsFiltro("IDFUNCIONARIO", "System.Int32", "=", Convert.ToInt32(cbFuncionario.SelectedValue).ToString(), "and")); DataGriewDados.Rows.Clear(); TotalGeral = 0; TotalGeralComissao = 0; LIS_PRODUTOOSFECHColl.Clear(); LIS_SERVICOOSFECHColl.Clear(); if (chkProduto.Checked) { LIS_PRODUTOOSFECHColl = LIS_PRODUTOOSFECHP.ReadCollectionByParameter(RowRelatorio, "IDORDEMSERVICO DESC"); lblTotalRegistros.Text = "Total de Registros: " + LIS_PRODUTOOSFECHColl.Count.ToString(); PreencheGridProduto(); } if (ChkServiço.Checked) { LIS_SERVICOOSFECHColl = LIS_SERVICOOSFECHP.ReadCollectionByParameter(RowRelatorio, "IDORDEMSERVICO DESC"); lblTotalRegistros.Text = "Total de Registros: " + (LIS_SERVICOOSFECHColl.Count + LIS_PRODUTOOSFECHColl.Count).ToString(); PreencheGridServico(); } DataGriewDados.Sort(DataGriewDados.Columns["ordemservico"], ListSortDirection.Descending); DataGridViewRow row3 = new DataGridViewRow(); row3.CreateCells(DataGriewDados, "", "", "Total Geral:", TotalGeral.ToString("n2"), TotalGeralComissao.ToString("n2")); row3.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold); DataGriewDados.Rows.Add(row3); this.Cursor = Cursors.Default; } catch (Exception EX) { this.Cursor = Cursors.Default; MessageBox.Show("Erro na pesquisa!"); MessageBox.Show("Erro técnico: " + EX.Message); } } }