Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Page.Title = "Pgto de Produtores - Relatório de Pagamentos de Produtor";

        try
        {
            Pagamento pgto = new Pagamento();
            PagamentoBLL obj = new PagamentoBLL();
            String strPathreport = String.Empty;

            pgto.Id_regiao = Convert.ToInt32(Session["ID_REGIAO"]);
            pgto.Id_cooperativa = Convert.ToInt32(Session["ID_COOPERATIVA"]);
            pgto.Id_propriedade = Convert.ToInt32(Session["ID_PROPRIEDADE"]);
            pgto.Dt_inicio = Convert.ToString(Session["DT_INICIO"]);
            pgto.Dt_fim = Convert.ToString(Session["DT_FIM"]);
            pgto.Tp_relatorio = Convert.ToChar(Session["TP_RELATORIO"]);

            strPathreport = Server.MapPath("Relatorio.rpt");

            CrystalReportViewer1.LogOnInfo = Crystal.ConectaCrystal();
            CrystalReportViewer1.ReportSource = obj.GerarRelatorioPgtoProdutores(pgto, strPathreport);
            CrystalReportViewer1.DataBind();
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('" + ex.Message.ToString() + "');</script>");
        }
    }
Ejemplo n.º 2
0
    protected void btnLiberarPgto_Click(object sender, EventArgs e)
    {
        try
        {
            Pagamento pgto = new Pagamento();
            PagamentoBLL obj = new PagamentoBLL();

            pgto.Id_regiao = Convert.ToInt32(ddlRegiao.SelectedValue);
            pgto.Id_cooperativa = Convert.ToInt32(ddlCooperativa.SelectedValue);
            pgto.Id_propriedade = Convert.ToInt32(ddlPropriedade.SelectedValue);
            pgto.Dt_inicio = txtDataInicial.Text;
            pgto.Dt_fim = txtDataFinal.Text;

            if (txtDataInicial.Text == string.Empty || txtDataFinal.Text == string.Empty)
                throw new Exception("Preencha a data inicial e a data final");
            if (pgto.Id_propriedade == 0)
                throw new Exception("Selecione apenas uma propriedade!");

            string login = Convert.ToString(Session["LOGIN"]);

            bool existePgto = obj.LiberarPagamento(pgto, login);

            if (existePgto == true)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('Pagamentos liberados!');</script>");
            }
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('" + ex.Message.ToString() + "');</script>");
        }
    }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Page.Title = "Pgto de Produtores - Relatório de Pagamentos de Produtor";

        try
        {
            Pagamento    pgto          = new Pagamento();
            PagamentoBLL obj           = new PagamentoBLL();
            String       strPathreport = String.Empty;

            pgto.Id_regiao      = Convert.ToInt32(Session["ID_REGIAO"]);
            pgto.Id_cooperativa = Convert.ToInt32(Session["ID_COOPERATIVA"]);
            pgto.Id_propriedade = Convert.ToInt32(Session["ID_PROPRIEDADE"]);
            pgto.Dt_inicio      = Convert.ToString(Session["DT_INICIO"]);
            pgto.Dt_fim         = Convert.ToString(Session["DT_FIM"]);
            pgto.Tp_relatorio   = Convert.ToChar(Session["TP_RELATORIO"]);

            strPathreport = Server.MapPath("Relatorio.rpt");

            CrystalReportViewer1.LogOnInfo    = Crystal.ConectaCrystal();
            CrystalReportViewer1.ReportSource = obj.GerarRelatorioPgtoProdutores(pgto, strPathreport);
            CrystalReportViewer1.DataBind();
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('" + ex.Message.ToString() + "');</script>");
        }
    }
Ejemplo n.º 4
0
 public static PagamentoBLL create()
 {
     if (_Pagamento == null)
     {
         _Pagamento = new PagamentoBLL();
     }
     return(_Pagamento);
 }
        public void Setup()
        {
            bll            = new PagamentoBLL();
            tipoPagamento  = new TipoPagamento();
            dataPagamento  = DateTime.Now;
            valorPagamento = 478.55;
            paciente       = new Paciente();

            tipoPagamento.Id = 1;
            paciente.Id      = 1;

            str = string.Empty;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            int idEmpresa = Convert.ToInt32(Request.QueryString["id"].ToString());
            int idAssociacao;

            if (Session["AssociacaoID"] == null)
            {
                idAssociacao = 0;
                Response.Redirect("~/Login.aspx");
            }
            else
            {
                idAssociacao = Convert.ToInt32(Session["AssociacaoID"]);
            }

            try
            {
                if (idEmpresa > 0)
                {
                    EmpresaBLL  BLL     = new EmpresaBLL();
                    EmpresaType empresa = BLL.selectRecord(idEmpresa);

                    if (empresa.IdAssociacao != idAssociacao)
                    {
                        throw new Exception("Acesso Negado!");
                    }

                    PagamentoBLL pgBLL = new PagamentoBLL();
                    pgBLL.efetuarBaixa(empresa, 100.00);
                    empresa.addDays(30);

                    Session["FlashMsg"]     = "Baixa efetuada com sucesso.";
                    Session["FlashMsgType"] = "success";
                }
                else
                {
                    throw new Exception("ID Empresa não encontrado");
                }
            }
            catch (Exception error)
            {
                Session["FlashMsg"]     = error.Message;
                Session["FlashMsgType"] = "dang";
            }
            finally {
                Response.Redirect("~/Painel/Empresas.aspx");
            }
        }
        public IActionResult Pagamento(double valor, int idSelecionado, DateTime data, int IdPaciente, string saveBtn, string saveBtn2, int idTipoPagamento)
        {
            PagamentoBLL bll       = new PagamentoBLL();
            Pagamento    pagamento = new Pagamento();


            if (saveBtn2 == "Deletar")
            {
                pagamento.Id       = idSelecionado;
                ViewData["result"] = bll.Delete(pagamento);

                return(View());
            }
            if (idSelecionado != 0)
            {
                pagamento.TipoPagamento    = new TipoPagamento();
                pagamento.Paciente         = new Paciente();
                pagamento.Id               = idSelecionado;
                pagamento.TipoPagamento.Id = idTipoPagamento;
                pagamento.ValorPagamento   = valor;
                pagamento.DataPagamento    = data;
                pagamento.Paciente.Id      = IdPaciente;

                ViewData["result"] = bll.Update(pagamento);
                return(View());
            }


            if (saveBtn == "Salvar")
            {
                pagamento.TipoPagamento    = new TipoPagamento();
                pagamento.Paciente         = new Paciente();
                pagamento.TipoPagamento.Id = idTipoPagamento;
                pagamento.ValorPagamento   = valor;
                pagamento.DataPagamento    = data;
                pagamento.Paciente.Id      = IdPaciente;

                ViewData["result"] = bll.Insert(pagamento);
                return(View());
            }

            return(View());
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            int idEmpresa;

            if (Session["idEmpresa"] == null)
            {
                idEmpresa = 7;
            }
            else
            {
                idEmpresa = Convert.ToInt32(Session["idEmpresa"]);
            }

            EmpresaBLL  BLL     = new EmpresaBLL();
            EmpresaType empresa = BLL.selectRecord(idEmpresa);

            PagamentoBLL pgBLL = new PagamentoBLL();

            pgBLL.efetuarBaixa(empresa, 100.00);
            empresa.addDays(30);
        }
        public IActionResult Finances(int idSelecionado, int idSelecionadoDispesa, string saveBtn2)

        {
            if (saveBtn2 == "Deletar")
            {
                if (idSelecionado != 0)
                {
                    PagamentoBLL bll = new PagamentoBLL();
                    Pagamento    pg  = new Pagamento();
                    pg.Id = idSelecionado;

                    ViewData["resultB"] = bll.Delete(pg);
                }
                if (idSelecionadoDispesa != 0)
                {
                    DespesaBLL bll     = new DespesaBLL();
                    Despesa    dispesa = new Despesa();
                    dispesa.idDespesa = idSelecionadoDispesa;

                    ViewData["resultA"] = bll.Delete(dispesa);
                }
            }
            return(View());
        }
Ejemplo n.º 10
0
    protected void btnLiberarPgto_Click(object sender, EventArgs e)
    {
        try
        {
            Pagamento    pgto = new Pagamento();
            PagamentoBLL obj  = new PagamentoBLL();

            pgto.Id_regiao      = Convert.ToInt32(ddlRegiao.SelectedValue);
            pgto.Id_cooperativa = Convert.ToInt32(ddlCooperativa.SelectedValue);
            pgto.Id_propriedade = Convert.ToInt32(ddlPropriedade.SelectedValue);
            pgto.Dt_inicio      = txtDataInicial.Text;
            pgto.Dt_fim         = txtDataFinal.Text;

            if (txtDataInicial.Text == string.Empty || txtDataFinal.Text == string.Empty)
            {
                throw new Exception("Preencha a data inicial e a data final");
            }
            if (pgto.Id_propriedade == 0)
            {
                throw new Exception("Selecione apenas uma propriedade!");
            }

            string login = Convert.ToString(Session["LOGIN"]);

            bool existePgto = obj.LiberarPagamento(pgto, login);

            if (existePgto == true)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('Pagamentos liberados!');</script>");
            }
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('" + ex.Message.ToString() + "');</script>");
        }
    }