public fGraficoNatureza(char origem) { this.origem = origem; InitializeComponent(); if (origem == 'p') { titulos_pagar = new cTitulosPagar(); } else { titulos_receber = new cTitulosXeceber(); } valores = new ArrayList(); descricoes = new ArrayList(); dtpInicial.Value = DateTime.Now; int d = DateTime.Now.Day; int m = DateTime.Now.Month; int a = DateTime.Now.Year; dtpInicial.Value = Globais.StrToDateTime(string.Format("{0}/{1}/{2}", m, 1, a)); if (m == 12) { a++; } else { m++; } dtpFinal.Value = Globais.StrToDateTime(string.Format("{0}/{1}/{2}", m, 1, a)).AddDays(-1); }
public fGraficoTendencia(char origem) { this.origem = origem; InitializeComponent(); if (origem == 'p') { titulos_pagar = new cTitulosPagar(); } else { titulos_receber = new cTitulosXeceber(); } valores = new ArrayList(); datas = new ArrayList(); dtpInicial.Value = DateTime.Now; int d = DateTime.Now.Day; int m = DateTime.Now.Month; int a = DateTime.Now.Year; System.Globalization.CultureInfo _ci = new System.Globalization.CultureInfo("en-US"); dtpInicial.Value = DateTime.Parse(string.Format("{0}/{1}/{2}", m, 1, a), _ci); if (m == 12) { a++; } else { m++; } dtpFinal.Value = DateTime.Parse(string.Format("{0}/{1}/{2}", m, 1, a), _ci).AddDays(-1); }
void BtnConfirmaClick(object sender, EventArgs e) { string msg = ""; int f = cbxFormas.SelectedIndex; string forma = (f >= 0) ? cbxCodFormas.Items[f].ToString() : ""; cTitulosXeceber titulos = new cTitulosXeceber(); titulos.Recebe(dtpRecebimento.Value, forma, where, ref msg); result = true; Close(); }
public bool GeraRemessa(ref string arquivo, string where) { FileStream fs = AbreArquivo(); StreamWriter sw = new StreamWriter(fs, Encoding.ASCII); GeraHeader(sw); cTitulosXeceber titulos = new cTitulosXeceber(); titulos.DadosRemessa(where); sw.Close(); arquivo = this.arquivo; return(true); }
void MainFormShown(object sender, EventArgs e) { if (!bShow) { return; } cControleAcesso acesso = new cControleAcesso(); if (!Globais.bAdministrador && !acesso.PermissaoSistema(Globais.sUsuario, Globais.sFilial, 6)) { MessageBox.Show("Usuário sem permissão para esse Sistema", "Acesso negado", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); } bShow = false; titulos = new cTitulosXeceber(); CarregaTitulos(); }
void FCadTituloLoad(object sender, EventArgs e) { v = -1; show = false; result = false; if (acao == 'i') { Text = "Sistema SOFT - Inclusão de Título"; edtCodigo.Text = ""; edtSequencia.Text = "0"; edtUsuario.Text = Globais.sUsuario; dtpEntrada.Value = DateTime.Now; dtpVencimento.Value = DateTime.Now; dtpRecebimento.Value = DateTime.Now; dtpRecebimento.Checked = false; rbtFixo.Checked = false; rbtVariavel.Checked = true; float valor = 0; edtValor.Text = valor.ToString("#,###,##0.00"); edtRecebido.Text = valor.ToString("#,###,##0.00"); CarregaNaturezas(); cbxNaturezas.Text = ""; CarregaFormas(); cbxFormas.Text = ""; CarregaPendencias(); cbxPendencias.Text = ""; ckbCancelado.Checked = false; edtMotivo.Text = ""; } else { Text = "Sistema SOFT - Alteração de Título"; edtCodigo.ReadOnly = true; edtSequencia.ReadOnly = true; cTitulosXeceber titulos = new cTitulosXeceber(); cTituloXeceber titulo = new cTituloXeceber(); titulos.Le(nf, seq, ref titulo); edtCodigo.Text = titulo.NRO_NF.ToString(); edtSequencia.Text = titulo.SEQ_TITULO.ToString(); edtUsuario.Text = titulo.COD_USUARIO; dtpEntrada.Value = titulo.DAT_EMISSAO; dtpVencimento.Value = titulo.DAT_VENCIMENTO; edtParceiro.Text = titulo.COD_CLIENTE; //edtPedido.Text = titulo.CHAVE_PEDIDO; edtObservacao.Text = titulo.TXT_OBSERVACAO; if (titulo.chkDAT_RECEBIMENTO) { dtpRecebimento.Value = titulo.DAT_RECEBIMENTO; dtpRecebimento.Checked = true; } else { dtpRecebimento.Value = DateTime.Now; dtpRecebimento.Checked = false; } rbtFixo.Checked = titulo.IDT_TIPO[0] == 'F'; rbtVariavel.Checked = titulo.IDT_TIPO[0] == 'V'; edtValor.Text = titulo.VLR_PREVISTO.ToString("#,###,##0.00"); edtRecebido.Text = titulo.VLR_RECEBIDO.ToString("#,###,##0.00"); CarregaNaturezas(); cbxCodNaturezas.Text = titulo.COD_NATUREZA; int n = IndiceCodigo(cbxCodNaturezas, titulo.COD_NATUREZA); cbxNaturezas.Text = (n >= 0) ? cbxNaturezas.Items[n].ToString() : ""; CarregaFormas(); cbxCodFormas.Text = titulo.COD_FORMA; int f = IndiceCodigo(cbxCodFormas, titulo.COD_FORMA); cbxFormas.Text = (f >= 0) ? cbxFormas.Items[f].ToString() : ""; CarregaPendencias(); cbxCodPendencias.Text = titulo.COD_PENDENCIA; int p = IndiceCodigo(cbxCodPendencias, titulo.COD_PENDENCIA); cbxPendencias.Text = (p >= 0) ? cbxPendencias.Items[p].ToString() : ""; dtpVencimento.Focus(); ckbCancelado.Checked = titulo.IDT_CANCELADO[0] == 'S'; edtMotivo.Text = titulo.DES_MOTIVO; titulos.CarregaPedidos(titulo.NRO_NF, titulo.SEQ_TITULO, cbxPedidos); if (cbxPedidos.Items.Count > 0) { cbxPedidos.Text = cbxPedidos.Items[0].ToString(); } } }
void BtnLoteClick(object sender, EventArgs e) { if (!Valida()) { return; } fLote frm = new fLote(); if (frm.ShowDialog() == DialogResult.Cancel) { return; } float valor = Globais.StrToFloat(edtValor.Text); float recebido = Globais.StrToFloat(edtRecebido.Text); string msg = ""; cTitulosXeceber titulos = new cTitulosXeceber(); int n = cbxNaturezas.SelectedIndex; string natureza = (n >= 0) ? cbxCodNaturezas.Items[n].ToString() : ""; int f = cbxFormas.SelectedIndex; string forma = (f >= 0) ? cbxCodFormas.Items[f].ToString() : ""; int p = cbxPendencias.SelectedIndex; string pendencia = (p >= 0) ? cbxCodPendencias.Items[p].ToString() : ""; ArrayList pedidos = new ArrayList(); foreach (string pedido in cbxPedidos.Items) { pedidos.Add(pedido); } int repeticoes = frm.repeticoes; string frequencia = frm.frequencia; DateTime limite = frm.limite; bool idt_limite = frm.idt_limite; DateTime vencimento = dtpVencimento.Value; string texto = ""; short codigo = Globais.StrToShort(edtSequencia.Text); int r = 0; while ((repeticoes-- > 0) || idt_limite) { if (idt_limite && (vencimento > limite)) { break; } r++; string tipo = "F"; if (rbtVariavel.Checked) { tipo = "V"; } result = titulos.Inclui(nf, codigo, edtUsuario.Text, dtpEntrada.Value, vencimento, edtParceiro.Text, natureza, tipo, pedidos, valor, dtpRecebimento.Checked, dtpRecebimento.Value, recebido, forma, pendencia, edtObservacao.Text, ckbCancelado.Checked ? "S" : "N", edtMotivo.Text, ref msg); codigo++; texto = texto + "\r\n" + codigo.ToString() + " - " + vencimento.ToString("d/M/yyyy"); if (frequencia.Equals("Semanal")) { vencimento = vencimento.AddDays(7); } else if (frequencia.Equals("Quinzenal")) { vencimento = vencimento.AddDays(15); } else if (frequencia.Equals("Mensal")) { vencimento = vencimento.AddMonths(1); } else if (frequencia.Equals("Anual")) { vencimento = vencimento.AddYears(1); } } string titulo = "Foram gerados " + r.ToString() + " títulos"; MessageBox.Show(texto, titulo); Close(); }
void BtnConfirmaClick(object sender, EventArgs e) { if (!Valida()) { return; } float valor = Globais.StrToFloat(edtValor.Text); float recebido = Globais.StrToFloat(edtRecebido.Text); string msg = ""; cTitulosXeceber titulos = new cTitulosXeceber(); int n = cbxNaturezas.SelectedIndex; string natureza = (n >= 0) ? cbxCodNaturezas.Items[n].ToString() : ""; int f = cbxFormas.SelectedIndex; string forma = (f >= 0) ? cbxCodFormas.Items[f].ToString() : ""; int p = cbxPendencias.SelectedIndex; string pendencia = (p >= 0) ? cbxCodPendencias.Items[p].ToString() : ""; //string fornecedor=""; //DateTime data = DateTime.Now; //short orcamento=0; //short pedido=0; //if (cbxPedidos.Text.Trim().Length > 0) //{ //string[] partes = cbxPedidos.Text.Split(' '); //fornecedor = partes[0]; //data = DateTime.Parse(partes[1]); //orcamento = Globais.StrToShort(partes[2]); //pedido = Globais.StrToShort(partes[3]); //} ArrayList pedidos = new ArrayList(); foreach (string pedido in cbxPedidos.Items) { pedidos.Add(pedido); } string tipo = "F"; if (rbtVariavel.Checked) { tipo = "V"; } if (acao == 'i') { result = titulos.Inclui(nf, Globais.StrToShort(edtSequencia.Text), edtUsuario.Text, dtpEntrada.Value, dtpVencimento.Value, edtParceiro.Text, natureza, tipo, pedidos, valor, dtpRecebimento.Checked, dtpRecebimento.Value, recebido, forma, pendencia, edtObservacao.Text, ckbCancelado.Checked ? "S" : "N", edtMotivo.Text, ref msg); if (!result) { MessageBox.Show(msg, "Erro na inclusão" + "\n" + msg, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { result = titulos.Altera(nf, Globais.StrToShort(edtSequencia.Text), edtUsuario.Text, dtpEntrada.Value, dtpVencimento.Value, edtParceiro.Text, natureza, tipo, pedidos, valor, dtpRecebimento.Checked, dtpRecebimento.Value, recebido, forma, pendencia, edtObservacao.Text, ckbCancelado.Checked ? "S" : "N", edtMotivo.Text, //fornecedor, //data, //orcamento, //pedido, ref msg); if (!result) { MessageBox.Show(msg, "Erro na alteração", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } Close(); }
void DgvCadastroCellContentClick(object sender, DataGridViewCellEventArgs e) { if ((bool)dgvCadastro.CurrentRow.Cells["S"].Value) { string fornecedor = dgvCadastro.CurrentRow.Cells["Fornecedor Orçamento"].Value.ToString().Trim(); DateTime data = DateTime.Parse(dgvCadastro.CurrentRow.Cells["Data"].Value.ToString().Trim()); short orcamento = CodOrcamento(dgvCadastro.CurrentRow.Cells["Orçamento"].Value.ToString().Trim()); string pedido = dgvCadastro.CurrentRow.Cells["CodPedido"].Value.ToString().Trim(); if (valor > 0) { DialogResult r = MessageBox.Show("Despesa de Frete?", "Despesa de Frete?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (r == DialogResult.Yes) { float frete = cPedidos.FretePedido(fornecedor, data, orcamento, short.Parse(pedido)); fFrete frm = new fFrete(); frm.frete_atual = frete; frm.valor = valor; frm.ShowDialog(); if (frm.result) { cPedidos.AlteraFrete(fornecedor, data, orcamento, short.Parse(pedido), frm.novo_frete); } } } cTitulosPagar titulosp = new cTitulosPagar(); ArrayList listap = titulosp.CarregaPorPedidoHint(fornecedor, data, orcamento, short.Parse(pedido)); cTitulosXeceber titulosr = new cTitulosXeceber(); ArrayList listar = titulosr.CarregaPorPedidoHint(fornecedor, data, orcamento, short.Parse(pedido), true); if ((listap.Count > 0) || (listar.Count > 0)) { string msg = ""; if (listap.Count > 0) { msg = msg + "Pedido já relacionado com as despesas:"; foreach (string titulo in listap) { msg = msg + "\n" + titulo; } } if (listar.Count > 0) { if (listap.Count > 0) { msg = msg + "\n"; } msg = msg + "Pedido já relacionado com as receitas:"; foreach (string titulo in listar) { msg = msg + "\n" + titulo; } } MessageBox.Show(msg); //dgvCadastro.CurrentRow.Cells["S"].Value = false; //dgvCadastro.CurrentRow.Cells["Fornecedor"].Selected = true; //DgvCadastroCellContentClick(sender, e); return; } dgvCadastro.CurrentRow.DefaultCellStyle.BackColor = Color.SkyBlue; } else { dgvCadastro.CurrentRow.DefaultCellStyle.BackColor = Color.White; } }