private void dgvNFe_CellEndEdit(object sender, DataGridViewCellEventArgs e) { try { if (dgvNFe.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null) { string ValueCell = dgvNFe.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString().TrimEnd().ToUpper(); if (ValueCell != "S" && ValueCell != "N") { MessageBox.Show("Digite apenas S ou N!"); dgvNFe.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "N"; } else { dgvNFe.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = ValueCell; NOTAFISCALEEntity NOTAFISCALTy = new NOTAFISCALEEntity(); NOTAFISCALEProvider NOTAFISCALEP = new NOTAFISCALEProvider(); NOTAFISCALTy = NOTAFISCALEP.Read(Convert.ToInt32(LIS_NOTAFISCALEColl[e.RowIndex].IDNOTAFISCALE)); if (e.ColumnIndex == 1) { NOTAFISCALTy.FLAGCANCELADA = ValueCell.ToUpper(); NOTAFISCALEP.Save(NOTAFISCALTy); } else if (e.ColumnIndex == 2) { NOTAFISCALTy.FLAGENVIADA = ValueCell.ToUpper(); NOTAFISCALEP.Save(NOTAFISCALTy); } else if (e.ColumnIndex == 3) { NOTAFISCALTy.FLAGINUTILIZADO = ValueCell.ToUpper(); NOTAFISCALEP.Save(NOTAFISCALTy); } } } else { MessageBox.Show("Digite apenas S ou N!"); dgvNFe.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "N"; } } catch (Exception ex) { MessageBox.Show("Erro técnico: " + ex.Message); } }
private void PreencheGrid2() { CreaterCursor Cr = new CreaterCursor(); this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0); try { TotalGeral = 0; DataGriewDados.Rows.Clear(); foreach (var LIS_PRODUTONFEEntity in LIS_PRODUTONFE_2Coll) { NOTAFISCALEEntity NOTAFISCALETY = new NOTAFISCALEEntity(); NOTAFISCALEProvider NOTAFISCALEP = new NOTAFISCALEProvider(); NOTAFISCALETY = NOTAFISCALEP.Read(Convert.ToInt32(LIS_PRODUTONFEEntity.IDNOTAFISCALE)); CLIENTEEntity CLIENTETy = new CLIENTEEntity(); CLIENTEProvider CLIENTEP = new CLIENTEProvider(); CLIENTETy = CLIENTEP.Read(Convert.ToInt32(LIS_PRODUTONFEEntity.IDCLIENTE)); string NotaFiscal = NOTAFISCALETY.NOTAFISCALE; decimal ValorTotal = Convert.ToDecimal(NOTAFISCALETY.TOTALNOTA); TotalGeral += ValorTotal; string FlagEnviada = NOTAFISCALETY.FLAGENVIADA; string FLAGINUTILIZADO = NOTAFISCALETY.FLAGINUTILIZADO; string FLAGCANCELADA = NOTAFISCALETY.FLAGCANCELADA; DataGridViewRow row1 = new DataGridViewRow(); row1.CreateCells(DataGriewDados, NotaFiscal, CLIENTETy.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 AtualizaDadosNFE() { try { CreaterCursor Cr = new CreaterCursor(); this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0); NOTAFISCALEProvider NOTAFISCALEP = new NOTAFISCALEProvider(); LIS_NOTAFISCALEProvider LIS_NOTAFISCALEP = new LIS_NOTAFISCALEProvider(); LIS_NOTAFISCALECollection LIS_NOTAFISCALEColl2 = new LIS_NOTAFISCALECollection(); RowsFiltroCollection RowRelatorio = new RowsFiltroCollection(); RowRelatorio.Add(new RowsFiltro("NFISCALE", "System.String", ">=", txtIni.Text.PadLeft(8, '0'))); RowRelatorio.Add(new RowsFiltro("NFISCALE", "System.String", "<=", txtFim.Text.PadLeft(8, '0'))); RowRelatorio.Add(new RowsFiltro("FLAGENVIADA", "System.String", "=", "N")); LIS_NOTAFISCALEColl2 = LIS_NOTAFISCALEP.ReadCollectionByParameter(RowRelatorio); if (LIS_NOTAFISCALEColl2.Count > 0) { foreach (LIS_NOTAFISCALEEntity item in LIS_NOTAFISCALEColl2) { NOTAFISCALEEntity NOTAFISCALETy = new NOTAFISCALEEntity(); NOTAFISCALETy = NOTAFISCALEP.Read(Convert.ToInt32(item.IDNOTAFISCALE)); NOTAFISCALETy.FLAGINUTILIZADO = "S"; NOTAFISCALEP.Save(NOTAFISCALETy); } this.Cursor = Cursors.Default; } else { this.Cursor = Cursors.Default; MessageBox.Show("Não foi possível alterar as notas selecionadas!!"); } this.Cursor = Cursors.Default; } catch (Exception ex) { this.Cursor = Cursors.Default; MessageBox.Show("Erro técnico: " + ex.Message); } }
private decimal RetornaQuantSaida(int Idproduto) { decimal result = 0; if (chkNFe.Checked) { LIS_PRODUTONFECollection LIS_PRODUTONFEColl2 = new LIS_PRODUTONFECollection(); RowRelatorio.Clear(); if (msktDataInicial.Text != " / /") { RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", ">=", Util.ConverStringDateSearch(msktDataInicial.Text))); } if (msktDataFinal.Text != " / /") { RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", "<=", Util.ConverStringDateSearch(msktDataFinal.Text))); } RowRelatorio.Add(new RowsFiltro("IDPRODUTO", "System.Int32", "=", Idproduto.ToString())); RowRelatorio.Add(new RowsFiltro("FLAGENVIADA", "System.String", "=", "S")); RowRelatorio.Add(new RowsFiltro("FLAGCANCELADA", "System.String", "=", "N")); LIS_PRODUTONFEColl2 = LIS_PRODUTONFEP.ReadCollectionByParameter(RowRelatorio, "IDNOTAFISCALE DESC"); NOTAFISCALEProvider NOTAFISCALEP = new NOTAFISCALEProvider(); foreach (LIS_PRODUTONFEEntity item in LIS_PRODUTONFEColl2) { if (NOTAFISCALEP.Read(Convert.ToInt32(item.IDNOTAFISCALE)).FLAGCANCELADA.TrimEnd() == "N" && NOTAFISCALEP.Read(Convert.ToInt32(item.IDNOTAFISCALE)).FLAGENVIADA.TrimEnd() == "S")//Desconsidera nota fiscal cancelada { result += Convert.ToDecimal(item.QUANTIDADE); } } } //Saida pelo Pedido de Venda if (chkSaidaPedido.Checked) { LIS_PRODUTOSPEDIDOCollection LIS_PRODUTOSPEDIDOColl = new LIS_PRODUTOSPEDIDOCollection(); LIS_PRODUTOSPEDIDOProvider LIS_PRODUTOSPEDIDOP = new LIS_PRODUTOSPEDIDOProvider(); RowRelatorio.Clear(); RowRelatorio.Add(new RowsFiltro("IDPRODUTO", "System.Int32", "=", Idproduto.ToString())); if (msktDataInicial.Text != " / /") { RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", ">=", Util.ConverStringDateSearch(msktDataInicial.Text))); } if (msktDataFinal.Text != " / /") { RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", "<=", Util.ConverStringDateSearch(msktDataFinal.Text))); } LIS_PRODUTOSPEDIDOColl = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowRelatorio); PEDIDOProvider PEDIDOP = new PEDIDOProvider(); foreach (LIS_PRODUTOSPEDIDOEntity item2 in LIS_PRODUTOSPEDIDOColl) { if (PEDIDOP.Read(Convert.ToInt32(item2.IDPEDIDO)).FLAGORCAMENTO.TrimEnd() == "N") { result += Convert.ToDecimal(item2.QUANTIDADE); } } } //Saida Pedido2 LIS_PRODUTOSPEDIDOMTQCollection LIS_PRODUTOSPEDIDOMTQColl = new LIS_PRODUTOSPEDIDOMTQCollection(); LIS_PRODUTOSPEDIDOMTQProvider LIS_PRODUTOSPEDIDOMTQP = new LIS_PRODUTOSPEDIDOMTQProvider(); RowRelatorio.Clear(); RowRelatorio.Add(new RowsFiltro("IDPRODUTO", "System.Int32", "=", Idproduto.ToString())); if (msktDataInicial.Text != " / /") { RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", ">=", Util.ConverStringDateSearch(msktDataInicial.Text))); } if (msktDataFinal.Text != " / /") { RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", "<=", Util.ConverStringDateSearch(msktDataFinal.Text))); } LIS_PRODUTOSPEDIDOMTQColl = LIS_PRODUTOSPEDIDOMTQP.ReadCollectionByParameter(RowRelatorio); foreach (LIS_PRODUTOSPEDIDOMTQEntity item2 in LIS_PRODUTOSPEDIDOMTQColl) { if (item2.FLAGORCAMENTO.TrimEnd() == "N") { result += Convert.ToDecimal(item2.MT2) * Convert.ToDecimal(item2.QUANTIDADE); } } ////Estoque Digisat CONFISISTEMAProvider CONFISISTEMAP = new CONFISISTEMAProvider(); if (CONFISISTEMAP.Read(1).FLAGCPDIGISAT.TrimEnd() == "S") { ITEVENDAS_ECFCollection ITEVENDAS_ECFColl = new ITEVENDAS_ECFCollection(); ITEVENDAS_ECFProvider ITEVENDAS_ECFP = new ITEVENDAS_ECFProvider(); RowRelatorio.Clear(); RowRelatorio.Add(new RowsFiltro("CANCELADO", "System.Int32", "=", "0")); RowRelatorio.Add(new RowsFiltro("CODIGO", "System.Int32", "=", Idproduto.ToString())); ITEVENDAS_ECFColl = ITEVENDAS_ECFP.ReadCollectionByParameter(RowRelatorio, "CUPOM DESC"); foreach (ITEVENDAS_ECFEntity item in ITEVENDAS_ECFColl) { result += Convert.ToDecimal(item.QTD); } } return(result); }