예제 #1
0
        private void AddGridFormaPagto()
        {
            try
            {
                //Remove ID  repetido
                LIS_ORDEMSERVICOSFECHCollection LIS_ORDEMSERVICOSFECH2Coll = new LIS_ORDEMSERVICOSFECHCollection();
                foreach (LIS_ORDEMSERVICOSFECHEntity item in LIS_ORDEMSERVICOSFECHColl)
                {
                    if (LIS_ORDEMSERVICOSFECH2Coll.Find(delegate(LIS_ORDEMSERVICOSFECHEntity item2)
                    {
                        return
                        (item2.IDFORMAPAGAMENTO == item.IDFORMAPAGAMENTO);
                    }) == null)
                    {
                        LIS_ORDEMSERVICOSFECH2Coll.Add(item);
                    }
                }

                decimal ValorTotal = 0;
                decimal TotalGeral = 0;

                dtgFormPagto.Rows.Clear();

                foreach (var LIS_ORDEMSERVICOSFECH2Ty in LIS_ORDEMSERVICOSFECH2Coll)
                {
                    ValorTotal  = 0;
                    ValorTotal  = QuantFormaPagto(Convert.ToInt32(LIS_ORDEMSERVICOSFECH2Ty.IDFORMAPAGAMENTO));
                    TotalGeral += ValorTotal;
                    DataGridViewRow row2 = new DataGridViewRow();
                    row2.CreateCells(dtgFormPagto, LIS_ORDEMSERVICOSFECH2Ty.NOMEFORMAPAGTO, ValorTotal.ToString("n2"));
                    row2.DefaultCellStyle.Font = new Font("Arial", 8);
                    dtgFormPagto.Rows.Add(row2);
                }

                //Total Geral
                DataGridViewRow row3 = new DataGridViewRow();
                row3.CreateCells(dtgFormPagto, "Total: ", TotalGeral.ToString("n2"));
                row3.DefaultCellStyle.Font = new Font("Arial", 8);
                dtgFormPagto.Rows.Add(row3);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro técnico: " + ex.Message);
            }
        }
예제 #2
0
        private void btnConsultar_Click(object sender, EventArgs e)
        {
            try
            {
                RowRelatorio.Clear();
                RowRelatorio.Add(new RowsFiltro("DATAEMISSAO", "System.DateTime", ">=", Util.ConverStringDateSearch(mkDtInicial.Text)));
                RowRelatorio.Add(new RowsFiltro("DATAEMISSAO", "System.DateTime", "<=", Util.ConverStringDateSearch(mkdatafinal.Text)));

                if (rdOrcamento.Checked)
                {
                    RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "S"));
                }
                else if (rdVenda.Checked)
                {
                    RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "N"));
                }

                LIS_ORDEMSERVICOSFECHColl.Clear();

                LIS_ORDEMSERVICOSFECHColl = LIS_ORDEMSERVICOSFECHP.ReadCollectionByParameter(RowRelatorio, "DATAEMISSAO DESC");

                //Colocando somatorio no final da lista
                LIS_ORDEMSERVICOSFECHEntity LIS_ORDEMSERVICOSFECHTy = new LIS_ORDEMSERVICOSFECHEntity();
                LIS_ORDEMSERVICOSFECHTy.TOTALFECHOS = SumTotalPesquisa("TOTALFECHOS");

                LIS_ORDEMSERVICOSFECHColl.Add(LIS_ORDEMSERVICOSFECHTy);

                lblTotalRegistros.Text = "Total de Registros: " + (LIS_ORDEMSERVICOSFECHColl.Count - 1).ToString();

                DataGridRelaPedido.AutoGenerateColumns = false;
                DataGridRelaPedido.DataSource          = LIS_ORDEMSERVICOSFECHColl;

                AddGridFormaPagto();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro técnico: " + ex.Message);
            }
        }
예제 #3
0
        private static LIS_ORDEMSERVICOSFECHCollection ExecuteReader(ref LIS_ORDEMSERVICOSFECHCollection collection, ref FbDataReader dataReader, FbCommand dbCommand)
        {
            using (dataReader = dbCommand.ExecuteReader())
            {
                collection = new LIS_ORDEMSERVICOSFECHCollection();

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

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

            return(collection);
        }