Example #1
0
        protected void CarregarDados()
        {
            LabelMensagens.Text = "Apresentando os dados para o dia " + DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss");

            try
            {
                TableDados.Rows.Clear();
                AdicionarCabecalho();

                using (ServicoSISGMFClient Servico = new ServicoSISGMFClient())
                {
                    // Total de Vendedores por Área
                    ViewTotalVendedorAreaDTO TotalVendedorArea = new ViewTotalVendedorAreaDTO();
                    TotalVendedorArea.IdMercado = IdMercado;
                    List <ViewTotalVendedorAreaDTO> ListaServ = Servico.SelectViewTotalVendedorArea(TotalVendedorArea);

                    // Para cada Área monta uma linha na Table
                    foreach (ViewTotalVendedorAreaDTO objAdd in ListaServ)
                    {
                        TableRow Linha = new TableRow();

                        TableCell ColunaArea = new TableCell();
                        ColunaArea.Text = objAdd.Nome;
                        Linha.Cells.Add(ColunaArea);

                        TableCell ColunaTotalVendedores = new TableCell();
                        ColunaTotalVendedores.HorizontalAlign = HorizontalAlign.Right;
                        ColunaTotalVendedores.Text            = objAdd.TotalVendedor.ToString();
                        Linha.Cells.Add(ColunaTotalVendedores);
                        RodapeTotalVendedores = RodapeTotalVendedores + objAdd.TotalVendedor;

                        // Presenças e Ausencias
                        ViewTotalPresencaAreaDTO TotalPresenca = new ViewTotalPresencaAreaDTO();
                        TotalPresenca.IdArea       = objAdd.Id;
                        TotalPresenca.DataPresenca = DateTime.Today;
                        TotalPresenca.IdMercado    = IdMercado;
                        List <ViewTotalPresencaAreaDTO> ListaPresenca = Servico.SelectViewTotalPresencaArea(TotalPresenca);

                        if (ListaPresenca.Count > 0)
                        {
                            TotalPresenca = ListaPresenca[0];
                        }
                        else
                        {
                            TotalPresenca.TotalPresenca = 0;
                        }

                        TableCell ColunaTotalPresencas = new TableCell();
                        ColunaTotalPresencas.HorizontalAlign = HorizontalAlign.Right;
                        ColunaTotalPresencas.Text            = TotalPresenca.TotalPresenca.ToString();
                        Linha.Cells.Add(ColunaTotalPresencas);
                        RodapeTotalPresencas = RodapeTotalPresencas + TotalPresenca.TotalPresenca;

                        TableCell ColunaTotalAusencias = new TableCell();
                        ColunaTotalAusencias.HorizontalAlign = HorizontalAlign.Right;
                        ColunaTotalAusencias.Text            = (objAdd.TotalVendedor - TotalPresenca.TotalPresenca).ToString();
                        Linha.Cells.Add(ColunaTotalAusencias);
                        RodapeTotalAusencias = RodapeTotalAusencias + (objAdd.TotalVendedor - TotalPresenca.TotalPresenca);


                        // Pagamentos e Inadimplências
                        ViewTotalPagamentoAreaDTO TotalPagamento = new ViewTotalPagamentoAreaDTO();
                        TotalPagamento.IdArea        = objAdd.Id;
                        TotalPagamento.DataPagamento = DateTime.Today;
                        TotalPagamento.IdMercado     = IdMercado;
                        List <ViewTotalPagamentoAreaDTO> ListaPagamento = Servico.SelectViewTotalPagamentoArea(TotalPagamento);

                        if (ListaPagamento.Count > 0)
                        {
                            TotalPagamento = ListaPagamento[0];
                        }
                        else
                        {
                            TotalPagamento.TotalPagamento = 0;
                            TotalPagamento.TotalTaxa      = 0;
                        }

                        TableCell ColunaTotalTaxas = new TableCell();
                        ColunaTotalTaxas.HorizontalAlign = HorizontalAlign.Right;
                        ColunaTotalTaxas.Text            = TotalPagamento.TotalTaxa.Value.ToString("#,###,##0.00");
                        Linha.Cells.Add(ColunaTotalTaxas);
                        RodapeTotalTaxas = RodapeTotalTaxas + TotalPagamento.TotalTaxa.Value;

                        TableCell ColunaTotalPagamentos = new TableCell();
                        ColunaTotalPagamentos.HorizontalAlign = HorizontalAlign.Right;
                        ColunaTotalPagamentos.Text            = TotalPagamento.TotalPagamento.Value.ToString("#,###,##0.00");
                        Linha.Cells.Add(ColunaTotalPagamentos);
                        RodapeTotalPagamentos = RodapeTotalPagamentos + TotalPagamento.TotalPagamento.Value;

                        TableCell ColunaTotalDevido = new TableCell();
                        ColunaTotalDevido.HorizontalAlign = HorizontalAlign.Right;
                        ColunaTotalDevido.Text            = (TotalPagamento.TotalTaxa - TotalPagamento.TotalPagamento).Value.ToString("#,###,##0.00");
                        Linha.Cells.Add(ColunaTotalDevido);
                        RodapeTotalDevido = RodapeTotalDevido + (TotalPagamento.TotalTaxa.Value - TotalPagamento.TotalPagamento.Value);

                        TableDados.Rows.Add(Linha);
                    }
                }

                AdicionarRodape();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
        protected void Calendario_SelectionChanged(object sender, EventArgs e)
        {
            if (Request.QueryString["id_mercado"] != null)
            {
                IdMercado = int.Parse(Request.QueryString["id_mercado"]);
            }
            else
            {
                Response.Redirect("Mercado.aspx");
            }
            ZerarTotais();
            LabelMensagens.Text = "Apresentando os dados para o dia " + Calendario.SelectedDate.ToString("dd/MM/yyyy");

            try
            {
                TableDados.Rows.Clear();
                AdicionarCabecalho();

                using (ServicoSISGMFClient Servico = new ServicoSISGMFClient())
                {
                    // Total de Vendedores por Área
                    ViewTotalVendedorAreaDTO TotalVendedorArea = new ViewTotalVendedorAreaDTO();
                    TotalVendedorArea.IdMercado = IdMercado;
                    List <ViewTotalVendedorAreaDTO> ListaServ = Servico.SelectViewTotalVendedorArea(TotalVendedorArea);

                    // Para cada Área monta uma linha na Table
                    foreach (ViewTotalVendedorAreaDTO objAdd in ListaServ)
                    {
                        TableRow Linha = new TableRow();

                        TableCell ColunaArea = new TableCell();
                        ColunaArea.Text = objAdd.Nome;
                        Linha.Cells.Add(ColunaArea);

                        TableCell ColunaTotalVendedores = new TableCell();
                        ColunaTotalVendedores.HorizontalAlign = HorizontalAlign.Right;
                        ColunaTotalVendedores.Text            = objAdd.TotalVendedor.ToString();
                        Linha.Cells.Add(ColunaTotalVendedores);
                        RodapeTotalVendedores = RodapeTotalVendedores + objAdd.TotalVendedor;

                        // Presenças e Ausencias
                        ViewTotalPresencaAreaDTO TotalPresenca = new ViewTotalPresencaAreaDTO();
                        TotalPresenca.IdArea       = objAdd.Id;
                        TotalPresenca.DataPresenca = Calendario.SelectedDate;
                        TotalPresenca.IdMercado    = IdMercado;
                        List <ViewTotalPresencaAreaDTO> ListaPresenca = Servico.SelectViewTotalPresencaArea(TotalPresenca);

                        if (ListaPresenca.Count > 0)
                        {
                            TotalPresenca = ListaPresenca[0];
                        }
                        else
                        {
                            TotalPresenca.TotalPresenca = 0;
                        }

                        TableCell ColunaTotalPresencas = new TableCell();
                        ColunaTotalPresencas.HorizontalAlign = HorizontalAlign.Right;
                        ColunaTotalPresencas.Text            = TotalPresenca.TotalPresenca.ToString();
                        Linha.Cells.Add(ColunaTotalPresencas);
                        RodapeTotalPresencas = RodapeTotalPresencas + TotalPresenca.TotalPresenca;

                        TableCell ColunaTotalAusencias = new TableCell();
                        ColunaTotalAusencias.HorizontalAlign = HorizontalAlign.Right;
                        ColunaTotalAusencias.Text            = (objAdd.TotalVendedor - TotalPresenca.TotalPresenca).ToString();
                        Linha.Cells.Add(ColunaTotalAusencias);
                        RodapeTotalAusencias = RodapeTotalAusencias + (objAdd.TotalVendedor - TotalPresenca.TotalPresenca);


                        // Pagamentos e Inadimplências
                        ViewTotalPagamentoAreaDTO TotalPagamento = new ViewTotalPagamentoAreaDTO();
                        TotalPagamento.IdArea        = objAdd.Id;
                        TotalPagamento.DataPagamento = Calendario.SelectedDate;
                        TotalPagamento.IdMercado     = IdMercado;
                        List <ViewTotalPagamentoAreaDTO> ListaPagamento = Servico.SelectViewTotalPagamentoArea(TotalPagamento);

                        if (ListaPagamento.Count > 0)
                        {
                            TotalPagamento = ListaPagamento[0];
                        }
                        else
                        {
                            TotalPagamento.TotalPagamento = 0;
                            TotalPagamento.TotalTaxa      = 0;
                        }

                        TableCell ColunaTotalTaxas = new TableCell();
                        ColunaTotalTaxas.HorizontalAlign = HorizontalAlign.Right;
                        ColunaTotalTaxas.Text            = TotalPagamento.TotalTaxa.Value.ToString("#,###,##0.00");
                        Linha.Cells.Add(ColunaTotalTaxas);
                        RodapeTotalTaxas = RodapeTotalTaxas + TotalPagamento.TotalTaxa.Value;

                        TableCell ColunaTotalPagamentos = new TableCell();
                        ColunaTotalPagamentos.HorizontalAlign = HorizontalAlign.Right;
                        ColunaTotalPagamentos.Text            = TotalPagamento.TotalPagamento.Value.ToString("#,###,##0.00");
                        Linha.Cells.Add(ColunaTotalPagamentos);
                        RodapeTotalPagamentos = RodapeTotalPagamentos + TotalPagamento.TotalPagamento.Value;

                        TableCell ColunaTotalDevido = new TableCell();
                        ColunaTotalDevido.HorizontalAlign = HorizontalAlign.Right;
                        ColunaTotalDevido.Text            = (TotalPagamento.TotalTaxa - TotalPagamento.TotalPagamento).Value.ToString("#,###,##0.00");
                        Linha.Cells.Add(ColunaTotalDevido);
                        RodapeTotalDevido = RodapeTotalDevido + (TotalPagamento.TotalTaxa.Value - TotalPagamento.TotalPagamento.Value);

                        TableDados.Rows.Add(Linha);
                    }
                }

                AdicionarRodape();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }