示例#1
0
        private void PesquisaSaida()
        {
            CreaterCursor Cr = new CreaterCursor();

            this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0);

            try
            {
                //Filtra Produtos Nota Fiscal
                RowRelatorio.Clear();
                RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", ">=", Util.ConverStringDateSearch(msktDataInicial.Text)));
                RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", "<=", Util.ConverStringDateSearch(msktDataFinal.Text)));


                if (rbCancelada.Checked)
                {
                    RowRelatorio.Add(new RowsFiltro("FLAGCANCELADA", "System.String", "=", "S"));
                }
                else if (rdbEnviada.Checked)
                {
                    RowRelatorio.Add(new RowsFiltro("FLAGENVIADA", "System.String", "=", "S"));
                    RowRelatorio.Add(new RowsFiltro("FLAGCANCELADA", "System.String", "=", "N"));
                }

                LIS_PRODUTONFE_2Coll = LIS_PRODUTONFEP.ReadCollectionByParameter(RowRelatorio, "NOTAFISCALE, DTEMISSAO");

                // Remove CFOP, Aliq. ICMS  e nota fiscal repetido
                LIS_PRODUTONFECollection LIS_PRODUTONFE_2_2Coll = new LIS_PRODUTONFECollection();
                foreach (LIS_PRODUTONFEEntity item in LIS_PRODUTONFE_2Coll)
                {
                    if (LIS_PRODUTONFE_2_2Coll.Find(delegate(LIS_PRODUTONFEEntity item2)
                                                    { return(item2.CODCFOP == item.CODCFOP && item2.ALICMS == item.ALICMS && item2.NOTAFISCALE == item.NOTAFISCALE); }) == null)
                    {
                        LIS_PRODUTONFE_2_2Coll.Add(item);
                    }
                }
                LIS_PRODUTONFE_2Coll.Clear();
                LIS_PRODUTONFE_2Coll = LIS_PRODUTONFE_2_2Coll;

                PreencheGrid2();

                this.Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show("Erro técnico: " + ex.Message);
            }
        }
示例#2
0
        private static LIS_PRODUTONFECollection ExecuteReader(ref LIS_PRODUTONFECollection collection, ref FbDataReader dataReader, FbCommand dbCommand)
        {
            using (dataReader = dbCommand.ExecuteReader())
            {
                collection = new LIS_PRODUTONFECollection();

                if (dataReader.HasRows)
                {
                    while (dataReader.Read())
                    {
                        collection.Add(FillEntityObject(ref dataReader));
                    }
                }

                if (!(dataReader.IsClosed))
                {
                    dataReader.Close();
                }
                dataReader.Dispose();
            }

            return(collection);
        }
示例#3
0
        private LIS_PRODUTONFECollection BuscaProdutoNFePelaCidade(int COD_MUN_IBGE)
        {
            LIS_PRODUTONFECollection LIS_PRODUTONFEColl = new LIS_PRODUTONFECollection();

            try
            {
                LIS_PRODUTONFEProvider LIS_PRODUTONFEP = new LIS_PRODUTONFEProvider();
                RowRelatorio.Clear();
                string DataInicial = Util.ConverStringDateSearch(msktDataInicial.Text);
                string DataFinal   = Util.ConverStringDateSearch(msktDataFinal.Text);

                RowRelatorio.Add(new RowsFiltro("COD_MUN_IBGE", "System.Int32", "=", COD_MUN_IBGE.ToString()));

                if (Convert.ToInt32(cbFuncionario.SelectedValue) > 0)
                {
                    RowRelatorio.Add(new RowsFiltro("IDVENDEDOR", "System.Int32", "=", Convert.ToInt32(cbFuncionario.SelectedValue).ToString()));
                }

                if (Convert.ToInt32(cbProduto.SelectedValue) > 0)
                {
                    RowRelatorio.Add(new RowsFiltro("IDPRODUTO", "System.Int32", "=", Convert.ToInt32(cbProduto.SelectedValue).ToString()));
                }


                if (Convert.ToInt32(cbTransportador.SelectedValue) > 0)
                {
                    RowRelatorio.Add(new RowsFiltro("IDTRANSPORTES", "System.Int32", "=", Convert.ToInt32(cbTransportador.SelectedValue).ToString()));
                }


                RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", ">=", DataInicial));
                RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", "<=", DataFinal));

                if (Convert.ToInt32(cbStatus.SelectedValue) > 0)
                {
                    RowRelatorio.Add(new RowsFiltro("IDSTATUS", "System.Int32", "=", Convert.ToInt32(cbStatus.SelectedValue).ToString()));
                }

                if (txtCidade1.Text.Trim() != string.Empty)
                {
                    RowRelatorio.Add(new RowsFiltro("COD_MUN_IBGE", "System.Int32", "=", _COD_MUN_IBGE.ToString()));
                }

                if (chkNFeEnviada.Checked)
                {
                    RowRelatorio.Add(new RowsFiltro("FLAGENVIADA", "System.String", "=", "S"));
                    RowRelatorio.Add(new RowsFiltro("FLAGCANCELADA", "System.String", "=", "N"));
                }

                if (Convert.ToInt32(cbFuncionario.SelectedValue) > 0)
                {
                    LIS_PRODUTONFEColl = LIS_PRODUTONFEP.ReadCollectionByParameter(RowRelatorio, "NOMEPRODUTO, NOTAFISCALE");
                }
                else
                {
                    LIS_PRODUTONFEColl = LIS_PRODUTONFEP.ReadCollectionByParameter(RowRelatorio, "NOMEPRODUTO, NOTAFISCALE");
                }


                LIS_PRODUTONFECollection LIS_PRODUTONFEColl_2 = new LIS_PRODUTONFECollection();
                if (chkAgruparProduto.Checked)
                {
                    //Remove os produtos Repetidos
                    foreach (LIS_PRODUTONFEEntity item in LIS_PRODUTONFEColl)
                    {
                        if (LIS_PRODUTONFEColl_2.Find(delegate(LIS_PRODUTONFEEntity item2) { return(item2.IDPRODUTO == item.IDPRODUTO); }) == null)
                        {
                            LIS_PRODUTONFEColl_2.Add(item);
                        }
                    }

                    LIS_PRODUTONFEColl = LIS_PRODUTONFEColl_2;
                }

                return(LIS_PRODUTONFEColl);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro técnico: " + ex.Message);
                return(LIS_PRODUTONFEColl);
            }
        }
示例#4
0
        private void PreencheGrid2()
        {
            TotalGeral      = 0;
            TotalQuantidade = 0;
            SubTotal        = 0;

            CreaterCursor Cr = new CreaterCursor();

            this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0);

            DataGriewDados.Rows.Clear();

            //Remove as Cidades Repetidas
            LIS_PRODUTONFECollection LIS_PRODUTONFEColl_2 = new LIS_PRODUTONFECollection();

            foreach (LIS_PRODUTONFEEntity item in LIS_PRODUTONFEColl_1)
            {
                if (LIS_PRODUTONFEColl_2.Find(delegate(LIS_PRODUTONFEEntity item2) { return(item2.IDCFOP == item.IDCFOP); }) == null)
                {
                    LIS_PRODUTONFEColl_2.Add(item);
                }
            }

            //Cabeçalho Nome Cidade
            DataGridViewRow row1_2 = new DataGridViewRow();

            row1_2.CreateCells(DataGriewDados, "CFOP:", "", "", "", "");
            row1_2.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
            DataGriewDados.Rows.Add(row1_2);

            foreach (var LIS_PRODUTONFETy in LIS_PRODUTONFEColl_2)
            {
                //Busca Dados do produto por cidade
                LIS_PRODUTONFECollection LIS_PRODUTONFEColl3 = new LIS_PRODUTONFECollection();
                LIS_PRODUTONFEColl3 = BuscaProdutoCFOP(Convert.ToInt32(LIS_PRODUTONFETy.IDCFOP));

                DataGridViewRow row_header = new DataGridViewRow();
                row_header.CreateCells(DataGriewDados, LIS_PRODUTONFETy.CODCFOP, "", "", "", "");
                row_header.DefaultCellStyle.Font = new Font("Arial", 8);
                DataGriewDados.Rows.Add(row_header);

                DataGridViewRow row_header2 = new DataGridViewRow();
                row_header2.CreateCells(DataGriewDados, "Produto", "Quant.", "DT Emissão", "Nota Fiscal", "Total");
                row_header2.DefaultCellStyle.Font = new Font("Arial", 8);
                DataGriewDados.Rows.Add(row_header2);

                SubTotal = 0;
                foreach (var LIS_PRODUTONFETy_3 in LIS_PRODUTONFEColl3)
                {
                    string DataEmissao  = Convert.ToDateTime(LIS_PRODUTONFETy_3.DTEMISSAO).ToString("dd/MM/yyyy");
                    string NomeProduto  = LIS_PRODUTONFETy_3.NOMEPRODUTO;
                    string QuantProduto = LIS_PRODUTONFETy_3.QUANTIDADE.ToString();
                    TotalQuantidade += Convert.ToDecimal(LIS_PRODUTONFETy_3.QUANTIDADE);
                    string NumNF        = LIS_PRODUTONFETy_3.NOTAFISCALE.ToString().PadLeft(6, '0');
                    string TotalProduto = Convert.ToDecimal(LIS_PRODUTONFETy_3.VALORTOTAL).ToString("n2");
                    SubTotal   += Convert.ToDecimal(LIS_PRODUTONFETy_3.VALORTOTAL);
                    TotalGeral += Convert.ToDecimal(LIS_PRODUTONFETy_3.VALORTOTAL);

                    DataGridViewRow row2 = new DataGridViewRow();
                    row2.CreateCells(DataGriewDados, NomeProduto, QuantProduto, DataEmissao, NumNF, TotalProduto);
                    row2.DefaultCellStyle.Font = new Font("Arial", 8);
                    DataGriewDados.Rows.Add(row2);
                }

                if (LIS_PRODUTONFEColl3.Count > 0)
                {
                    DataGridViewRow row1_5 = new DataGridViewRow();
                    row1_5.CreateCells(DataGriewDados, "-------------------------------------------------------", TotalQuantidade.ToString(), "---------", "Sub-Total", SubTotal.ToString("n2"));
                    row1_5.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                    DataGriewDados.Rows.Add(row1_5);
                }
            }

            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;
        }