private void CarregaPagamentos(int cliente) { PagamentoDB pagDB = new PagamentoDB(); DataSet ds = pagDB.SelectAllPagamentosByCliente(cliente); Function.CarregaGrid(ds, gridPagamento, lblqtdPagamentoprocesso); }
private void CarregaPagamentos(int adv, DateTime initialdate, DateTime finaldate) { PagamentoDB pagDB = new PagamentoDB(); DataSet ds = pagDB.SelectAllPagamentos(adv, initialdate, finaldate); Function.CarregaGrid(ds, gdvPagamento, lblqtdPagamento); }
private void CarregaLabels(int adv, int mes) { PagamentoDB pagDB = new PagamentoDB(); lblTotalPagamento.Text = pagDB.TotalPagamentoMes(adv, mes).ToString("C2"); double pagamento = pagDB.TotalPagamentoMes(adv, mes); DespesasDB desDB = new DespesasDB(); lblTotalDespesa.Text = desDB.GetTotalDespesaEscritorio(adv, mes).ToString("C2"); double despesa = desDB.GetTotalDespesaEscritorio(adv, mes); double total = pagamento - despesa; lblFaturamento.Text = total.ToString("C2"); }
public void BindChartTipoPagamentosByDateHome(int adv, Literal lt, DateTime initialdate, DateTime finaldate) { StringBuilder str = new StringBuilder(); Pagamento pag = new Pagamento(); PagamentoDB pagDB = new PagamentoDB(); DataTable dt = new DataTable(); Servico sev = new Servico(); ServicoDB sevDB = new ServicoDB(); int totalServico = sevDB.SelectTotalServico(); dt.Columns.Add("total", typeof(int)); dt.Columns.Add("tipo", typeof(string)); for (int j = 1; j <= totalServico; j++) { sev = sevDB.Select(j); if (sev.Descricao != "Outros") { double total = pagDB.GetTotalPagamentoByDate(adv, sev.Codigo, initialdate, finaldate); dt.Rows.Add(total, sev.Descricao); } } str.Append(@"<script type=*text/javascript*> google.load( *visualization*, *1*, {packages:[*corechart*]}); google.setOnLoadCallback(drawChartServicoPagamentoByMonth); function drawChartServicoPagamentoByMonth() { var data = google.visualization.arrayToDataTable([ ['TipoDespesa', 'quantidade'], "); for (int i = 0; i <= dt.Rows.Count - 1; i++) { str.Append("['" + dt.Rows[i]["tipo"].ToString() + "'," + dt.Rows[i]["total"].ToString() + "],"); } str.Append(" ]); "); str.Append(" var options = { "); str.Append(" is3D: true, "); str.Append(" backgroundColor: '#e8f1f4', "); str.Append(" chartArea: { left: 40, top: 20, width: '100%', height: '100%' } "); str.Append(" }; "); str.Append(" var chart = new google.visualization.PieChart(document.getElementById('piechart_ServicoPagamentoByMonth'));"); str.Append(" chart.draw(data, options);"); str.Append("}"); str.Append("</script>"); lt.Text = str.ToString().Replace('*', '"'); }
protected void Page_Load(object sender, EventArgs e) { if (Session["ModalPagamento"] != null) { modalAddPagamento.Show(); } else { txtValor.Text = string.Empty; lblMsgAddPagamento.Text = string.Empty; divMsgAddPagamento.Attributes["class"] = ""; txtDataPagamento.Text = DateTime.Today.ToString("dd/MM/yyyy"); Function.LimpaDDL(ddlProcesso); Function.LimpaDDL(ddlServico); txtDescricaoServico.Enabled = false; ddlProcesso.Enabled = false; } if (!Page.IsPostBack) { CarregaPagamentos(Convert.ToInt32(Session["PagamentoCliente"])); CarregaProcessosDoCliente(Convert.ToInt32(Session["PagamentoCliente"])); PessoaDB pesDB = new PessoaDB(); Pessoa pes = pesDB.SelectGenerico(Convert.ToInt32(Session["PagamentoCliente"])); if (pes.Nivel == 3) { ClienteFisicoDB cliFSDB = new ClienteFisicoDB(); ClienteFisico cliFS = cliFSDB.Select(pes.Codigo); ContatoDB conDB = new ContatoDB(); Contato con = conDB.SelectContato(cliFS.ContatoPessoa.Codigo); lblNome.Text = con.Nome; } else if (pes.Nivel == 4) { ClienteJuridicoDB cliJuDB = new ClienteJuridicoDB(); ClienteJuridico cliJu = cliJuDB.Select(pes.Codigo); ContatoDB conDB = new ContatoDB(); Contato con = conDB.SelectContato(pes.Codigo); lblNome.Text = con.Nome; } PagamentoDB pagDB = new PagamentoDB(); lblValorTotalPagamento.Text = pagDB.TotalPagamentoCliente(pes.Codigo).ToString("C2"); CarregaServico(); } }
private DataTable GetDataFinanceiro(int adv) { DespesasDB desDB = new DespesasDB(); PagamentoDB pagDB = new PagamentoDB(); DataTable dt = new DataTable(); dt.Columns.Add("id", typeof(int)); dt.Columns.Add("Despesa", typeof(int)); dt.Columns.Add("Pagamento", typeof(int)); dt.Columns.Add("Mes", typeof(string)); for (int i = 1; i <= 12; i++) { double despesa = desDB.GetTotalDespesaEscritorio(adv, i); double pagamento = pagDB.TotalPagamentoMes(adv, i); string mes = System.Globalization.DateTimeFormatInfo.CurrentInfo.GetMonthName(i); dt.Rows.Add(i, despesa, pagamento, mes); } return(dt); }
public void BindChartPagamentos(int adv, Literal lt) { DataTable dt = new DataTable(); StringBuilder str = new StringBuilder(); PagamentoDB pagDB = new PagamentoDB(); dt.Columns.Add("id", typeof(int)); dt.Columns.Add("Total", typeof(int)); dt.Columns.Add("Mes", typeof(string)); for (int i = 1; i <= 12; i++) { double total = pagDB.TotalPagamentoMes(adv, i); string mes = System.Globalization.DateTimeFormatInfo.CurrentInfo.GetMonthName(i); dt.Rows.Add(i, total, mes); } str.Append(@"<script type=*text/javascript*> google.load( *visualization*, *1*, {packages:[*corechart*]}); google.setOnLoadCallback(drawChartPagamentosAno); function drawChartPagamentosAno() { var data = google.visualization.arrayToDataTable([ ['2015', 'Pagamentos'], "); for (int i = 0; i <= dt.Rows.Count - 1; i++) { str.Append("['" + dt.Rows[i]["Mes"].ToString() + "'," + dt.Rows[i]["Total"].ToString() + "],"); } str.Append(" ]); "); str.Append(" var options = {"); str.Append(" backgroundColor: '#fff', "); str.Append(" chart: {"); str.Append(" title: 'Relatorio Pagamentos',"); str.Append(" }"); str.Append(" };"); str.Append(" var chart = new google.visualization.ColumnChart(document.getElementById('chart_PagamentosAno'));"); str.Append(" chart.draw(data, options);"); str.Append("}"); str.Append("</script>"); lt.Text = str.ToString().Replace('*', '"'); }
private void CarregaTotalLabel(int adv, DateTime initialdate, DateTime finaldate) { PagamentoDB pagDB = new PagamentoDB(); lblTotalPagamento.Text = pagDB.TotalPagamentoByDate(adv, initialdate, finaldate).ToString("C2"); }
private bool InsertPagamento() { try { if (Convert.ToDateTime(txtDataPagamento.Text) > DateTime.Today) { lblMsgAddPagamento.Text = "A data não pode ser maior que hoje"; divMsgAddPagamento.Attributes["class"] = "alert alert-danger"; } else if (string.IsNullOrWhiteSpace(txtValor.Text)) { lblMsgAddPagamento.Text = "Insira um valor"; divMsgAddPagamento.Attributes["class"] = "alert alert-danger"; } else if (string.IsNullOrWhiteSpace(txtDataPagamento.Text)) { lblMsgAddPagamento.Text = "Insira uma data"; divMsgAddPagamento.Attributes["class"] = "alert alert-danger"; } else if (ddlServico.SelectedItem.Text == "Selecione") { lblMsgAddPagamento.Text = "Selecione um Serviço para o pagamento"; divMsgAddPagamento.Attributes["class"] = "alert alert-danger"; } else if (ddlServico.SelectedItem.Text == "Outros" && string.IsNullOrWhiteSpace(txtDescricaoServico.Text)) { lblMsgAddPagamento.Text = "Insira uma descrição para o pagamento"; divMsgAddPagamento.Attributes["class"] = "alert alert-danger"; } else if (ddlServico.SelectedItem.Text == "Processo" && ddlProcesso.SelectedItem.Text == "Selecione") { lblMsgAddPagamento.Text = "informe de qual processo é o pagamento"; divMsgAddPagamento.Attributes["class"] = "alert alert-danger"; } else { Pagamento pag = new Pagamento(); PagamentoDB pagDB = new PagamentoDB(); Servico sev = new Servico(); ServicoDB sevDB = new ServicoDB(); Processo pro = new Processo(); Pessoa pes = new Pessoa(); Advogado adv = new Advogado(); pag.Valor = Convert.ToDecimal(txtValor.Text); pag.DataPagamento = Convert.ToDateTime(txtDataPagamento.Text); sev.Codigo = Convert.ToInt32(ddlServico.SelectedItem.Value); pag.Servico = sev; adv.Codigo = Convert.ToInt32(Session["Advogado"]); pag.Advogado = adv; pes.Codigo = Convert.ToInt32(Session["PagamentoCliente"]); pag.Pes_cliente = pes; if (ddlProcesso.SelectedItem.Text != "Selecione") { pro.Codigo = Convert.ToInt32(ddlProcesso.SelectedItem.Value); pag.Processo = pro; } if (ddlServico.SelectedItem.Text == "Outros") { sev.Descricao = txtDescricaoServico.Text; sevDB.Insert(sev); sev = sevDB.GetLastId(txtDescricaoServico.Text); pag.Servico = sev; } if (!pagDB.Insert(pag)) { //mensagem de falha } else { txtValor.Text = string.Empty; lblMsgAddPagamento.Text = "Pagamento inserido com secesso"; divMsgAddPagamento.Attributes["class"] = "alert alert-success"; txtDataPagamento.Text = DateTime.Today.ToString("dd/MM/yyyy"); Function.LimpaDDL(ddlProcesso); Function.LimpaDDL(ddlServico); txtDescricaoServico.Enabled = false; ddlProcesso.Enabled = false; } } } catch (FormatException) { lblMsgAddPagamento.Text = "Data Invalida"; divMsgAddPagamento.Attributes["class"] = "alert alert-danger"; } return(true); }
public PagamentoController() { this.pagamentoDB = new PagamentoDB(); }