//Para a proposta public RptVendasFormaPagto(CliFor cliFor, DateTime dtInicial, DateTime dtFinal, TypeStatusVenda status) { init(dtInicial, dtFinal); var vendas = new VendaFilterManager().FindVendasByPeriodo(cliFor, dtInicial, dtFinal, status, TypeAgrupamentoVendas.Cliente); setReport(vendas); }
public RptSinteticoVenda(CliFor cliFor, DateTime dtInicial, DateTime dtFinal, TypeStatusVenda statusVenda, TypeAgrupamentoVendas agrupar) { var vendas = new VendaFilterManager().FindVendasByPeriodo(cliFor, dtInicial, dtFinal, statusVenda, agrupar); init(vendas, dtInicial, dtFinal); }
public async Task <List <Cheque> > FindChequeCreditoVencidosByCliente(CliFor cliente) { using (var ctx = new BalcaoContext()) { try { //DateTime dataAtual = DateTime.Now; //nao consulta DateTime dataAtual = DateTime.Now.Date; var cheques = await ctx.ChequeDao.WhereAsync(ch => ch.IdCliente == cliente.IdCliFor && ch.DataVencimento <= dataAtual && ch.TipoLancamento == TypeLancamentoFinanceiro.Receber && ch.Situacao != TypeSituacaoCheque.Cancelado && ch.Situacao != TypeSituacaoCheque.Compensado); return(cheques); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.InnerException); return(null); } } }
public XFrmCliForView(CliFor cliFor) : this(cliFor.Classificacao) { this._cliForAnt = indexarCliFor(cliFor); FormsUtil.AddShortcutEscapeOnDispose(this); }
private void validarCredito(CliFor cliFor, Decimal creditoRestante) { var ctx = new BalcaoContext(); var creditos = ctx.CreditoClienteDao.Where(cd => cd.IdCliFor == cliFor.IdCliFor).ToList(); //apague todos os creditos existente foreach (var c in creditos) { ctx.CreditoClienteDao.Delete(c); } if (creditoRestante > 0) { //gere um novo crédito var flag = ctx.CreditoClienteDao.Save(new CreditoCliente(cliFor, creditoRestante, "Saldo restante de parcela quitada")); if (!flag) { XMessageIts.Erro("O crédito restante não pode ser gerado\nValor do crédito:" + creditoRestante, "Atenção"); } else { XMessageIts.Mensagem("Crédito restante gerado com sucesso"); txtCredito.Text = creditoRestante.ToString("N2"); } } }
public CreditoCliente(CliFor cliFor, Decimal valorCredito, String historico = null) { this.ValorCredito = valorCredito; this.DataCredito = DateTime.Now; this.Historico = historico; this.IdCliFor = cliFor != null ? cliFor.IdCliFor : 0; }
public bool salvarCliForProc(CliFor org, Endereco end, Email mail, Telefone tel) { string sql = " InsereCliFor null,null,null,null,'" + org.Razao + "','" + org.Fantasia + "','" + org.Identificacao + "','" + org.Tipo + "','" + org.Nome + "','" + end.Cep + "', '" + end.Logradouro + "','" + end.Numero + "','" + end.Bairro + "','" + end.Cidade + "','" + end.Uf + "', '" + mail.Mail + "','" + mail.DescEmail + "','" + tel.Fixo + "','" + tel.Celular + "'"; Console.WriteLine(sql); try { SqlCommand cmd = new SqlCommand(sql, conn); int res = cmd.ExecuteNonQuery(); if (res > 0) { var = true; } } catch (Exception ex) { Console.WriteLine("erro: " + ex.ToString()); } finally { Conexao.fechaConexao(); } return(var); }
//Movimento nao fiscal public Movimento( CliFor cliForn, EmpresaFilial filialNf, TypeDirecao direcaoMov, string numNF, DateTime dtEmissaoNf, DateTime dtEntradaNf, decimal valorFrete, decimal valorDesconto, decimal valorBaseICMS, decimal valorICMS, decimal valorBaseICMSST, decimal valorICMSST, decimal valorSeguro, decimal valorDespesas, decimal valorTotalProdutos, decimal totalNF, string serie, string subserie) { ItensMovimento = new HashSet <ItemMovimento>(); this.Parcelas = new HashSet <LancamentoFinanceiro>(); if (cliForn != null) { this.IdCliFor = cliForn.IdCliFor; } this.IdFilial = filialNf.IdFilial; this.DirecaoMovimento = direcaoMov; this.NumeroMovimento = numNF; this.DataEmissao = dtEmissaoNf; this.DataEntrada = dtEntradaNf; this.ValorFrete = valorFrete; this.ValorDesconto = valorDesconto; this.ValorBaseICMS = valorBaseICMS; this.ValorICMS = valorICMS; this.ValorBaseICMSST = valorBaseICMSST; this.ValorICMSST = valorICMSST; this.ValorSeguro = valorSeguro; this.ValorDespesasAcessorias = valorDespesas; this.TotalProdutos = valorTotalProdutos; this.TotalMovimento = totalNF; this.Serie = serie; this.SubSerie = subserie; }
public bool ImportToDatabase(DataTable dadosOrigem) { /* Colunas * NOMECLI | CIDADE | UF | NOMEFANT * ENDER | INSCEST | BAIRRO | CGC * CEP | CONTATO | TELEF1 | TELEF2 * TIPO_CLI | RG | LIMITE | DT_CLI */ if (dadosOrigem != null) { var ctx = new BalcaoContext(); List <CliFor> cliForSave = new List <CliFor>(); int i = 0; try { foreach (var cliForItg in dadosOrigem.AsEnumerable()) { CliFor c = new CliFor(); EnderecoCliFor cEnd = new EnderecoCliFor(); c.RazaoSocial = cliForItg["NOMECLI"].ToString(); c.CpfCnpj = cliForItg["CGC"].ToString(); c.Telefone = cliForItg["TELEF1"].ToString(); c.RG = cliForItg["RG"].ToString(); c.DataNascimento = ParseUtil.ToDate(cliForItg["DT_CLI"]); c.Celular = cliForItg["TELEF2"].ToString(); cEnd.TipoEndereco = "Comercial"; cEnd.Complemento = "N/A"; cEnd.Bairro = cliForItg["BAIRRO"].ToString(); cEnd.Cep = cliForItg["CEP"].ToString(); cEnd.Cidade = cliForItg["CIDADE"].ToString(); cEnd.NomeEndereco = cliForItg["ENDER"].ToString(); cEnd.Uf = cliForItg["UF"].ToString(); ValidadorDTO.ValidateWarningAll(cEnd); c.Enderecos.Add(cEnd); cliForSave.Add(c); ValidadorDTO.ValidateWarningAll(c); bool s = ctx.CliForDao.Save(c); if (s) { i++; } } if (cliForSave.Count == i) { XMessageIts.Mensagem("Clientes importados com sucesso!"); } } catch (Exception) { throw; } } return(true); }
public Venda(int idVenda, CliFor cliFor, decimal totalVenda, TypeStatusVenda statusVenda, DateTime dataVenda) { this.IdVenda = idVenda; this.CliFor = cliFor; this.TotalVenda = totalVenda; this.StatusVenda = statusVenda; this.DataVenda = dataVenda; }
public List <LancamentoFinanceiro> GetParcelasBy(CliFor cliFor) { var ctx = new BalcaoContext(); //carrega todas as parcelas do cliente var parcelas = ctx.LancamentosFinanceiros.Where(p => p.IdCliFor == cliFor.IdCliFor).ToList(); return(parcelas); }
public XFrmCreditoCliente(CliFor cliFor) { InitializeComponent(); this.creditos = new List <CreditoCliente>(); this.cliente = cliFor; new TextEditUtil(txtCredito).CustomizeNumberField(); this.groupControlCredito.Text = cliente.RazaoSocial; }
public Atendimento(CliFor c, TypeAtendimento tp, DateTime dtColeta, TypeStatusAtendimento status, string relatorio) { this.IdCliente = c != null ? c.IdCliFor : 0; this.TipoColeta = tp; this.StatusAtendimento = TypeStatusAtendimento.Comunicado; this.DataColeta = dtColeta; this.RelatorioAtendimento = relatorio; }
public ReportParameter(DateTime dtInicio, DateTime dtFim, CliFor cliente, TypeStatusLancamentoFinanceiro status, TypeLancamentoFinanceiro tipo, int idCentroCusto, string codigoMatriz) { this.IdCliente = cliente != null ? cliente.IdCliFor : 0; this.DataInicio = dtInicio; this.DataFim = dtFim; this.Status = (Int16)status; this.Tipo = (Int16)tipo; this.CodigoMatriz = codigoMatriz; this.IdCentroCusto = idCentroCusto; }
private Custeio indexarDados() { string container = textEditContainer.Text; var qtdeContainer = ParseUtil.ToInt(textEditQtdeContainer.Text); var capatazia = ParseUtil.ToDecimal(textEditCapatazia.Text); CliFor cliFor = lookUpCliFor1.CliFor; string exportador = textEditExportador.Text; string fabricante = textEditFabricante.Text; string cotacao = radioGroupCotacao.Text; string unidadeMed = cbUnidadeMed.Text; string transporte = cbTransporte.Text; var cotacaoMoeda = _cotacoes.IsValidIndex(0) ? _cotacoes.First().ValorMoeda : 0M; string moedas = cbMoedas.Text; string paisDestino = cbPaisDestino.Text; string paisOrigem = cbPaisOrigem.Text; string moEditObs = memoEditObs.Text; string destino = textEditDestino.Text; string origem = textEditOrigem.Text; Custeio c = new Custeio() { ValorMoedaEstrangeira = cotacaoMoeda, Container = container, QuantideContainer = qtdeContainer, ValorCapatazia = capatazia, Cliente = cliFor, IdCliente = cliFor.IdCliFor, Exportador = exportador, Fabricante = fabricante, PaisDestino = paisDestino, PaisOrigem = paisOrigem, Observacao = moEditObs, PortoOrigem = origem, PortoDestino = destino, DataCalculo = dtPickerData.Value, DespesasCusteio = _despesas, ItensCusteio = _mercadorias //Moedas = _cotacoes }; c.ICMSTotal = c.CalcICMSTotalBrl(); c.ICMSSTTotal = c.CalcICMSSTTotalBrl(); c.IPITotal = c.CalcIPITotalBrl(); c.IITotal = c.CalcIITotalBrl(); c.PISTotal = c.CalcPISTotalBrl(); c.CofinsTotal = c.CalcCofinsTotalBrl(); c.ValorFobTotal = c.CalcFobTotal(); c.TotalCusteio = c.CalcTotalCusteioReais(); c.ValorMoedaEstrangeira = c.CalcTotalCusteioME(); return(c); }
/// <summary> /// Filtras as parcelas pelo cliente e status /// </summary> public List <LancamentoFinanceiro> FindParcelasBy(CliFor cliFor, TypeStatusLancamentoFinanceiro status) { var ctx = new BalcaoContext(); //filtrando parcelas por cliente var parcelas = ctx.LancamentosFinanceiros.Where(p => p.IdCliFor == cliFor.IdCliFor); //filtrando as parcelas IEnumerable <LancamentoFinanceiro> parcelasFilter = filtrarParcelas(parcelas, status); //recebeu o filtro return(parcelasFilter != null?parcelasFilter.ToList() : null); }
public XFrmCliForListView(CliFor cliFor) : this() { this.WindowState = FormWindowState.Normal; this.colCelular.Visible = false; this.colTelefoneComercial.Visible = false; this.colEmail.Visible = false; this.MaximizeBox = false; this.gridViewCliente.Appearance.Row.Font = new Font("Tahoma", 9F); this.gridControlCliente.DataSource = cliFor; }
private void indexarCliente(CliFor cliente) { if (cliente != null) { var clientes = new List <CliFor>(); clientes.Add(cliente); searchLookUpCliente.Properties.DataSource = clientes; searchLookUpCliente.EditValue = cliente; searchLookUpCliente.Text = cliente.RazaoSocial; gridViewCliente.SelectRow(0); searchLookUpCliente.ReadOnly = true; } }
private MethodInvoker addCliFor() { //executa essa acao la no metodo var actionAddCli = new MethodInvoker(delegate { var frm = new XFrmCliForView(TypeClassificaoCliente.Cliente); frm.ShowDialog(); this.cliFor = frm.ClienteAdd; }); return(actionAddCli); }
public List <Cheque> FindChequeByPeriodo(CliFor cliente, DateTime dtInicio, DateTime dtFinal) { using (var ctx = new BalcaoContext()) { var cheques = ctx.ChequeDao.Where(ch => ch.IdCliente == cliente.IdCliFor && ch.DataLancamento >= dtInicio && ch.DataVencimento <= dtFinal) .OrderBy(ch => ch.DataVencimento) .OrderBy(ch => ch.DataVencimento); return(cheques.ToList()); } }
private void updateCliFor(CliFor novo, BalcaoContext ctx) { var cliFor = ctx.CliFors.Find(cliForAnt.IdCliFor); //atualizando o cliente com os dado dos campos cliFor.Update(novo); //atualize ou save o endereco updateOrSaveEnderecos(ctx, cliFor); if (ctx.CliForDao.Update(cliFor)) { XMessageIts.Mensagem("Os dados do cliente foram atualizados."); } }
private ReportParameter indexarParam(CliFor cliente) { //gera os parametros pro relatório relatorios var status = (TypeStatusLancamentoFinanceiro)radioStatus.SelectedIndex; var tipo = (TypeLancamentoFinanceiro)radioTipoLancamento.SelectedIndex; var cc = lookUpCentroCusto1.CentroCusto != null ? lookUpCentroCusto1.CentroCusto.IdCentroCusto : 0; //var preFiltro = (PreFiltro)cbFiltro.SelectedIndex; //var agrupar = (TypeAgrupamentoVendas)cbAgrupar.SelectedIndex; //encapsula e obtem os paramentros return(new ReportParameter(dtEditInicio.Value, dtEditFinal.Value, cliente, status, tipo, cc, lookUpFilial1.Matriz.CodigoMatriz)); }
public string deletar(CliFor c) { CliForDao login = new CliForDao(); string aviso = null; if (login.DeletaCliForProc(c)) { aviso = "Excluído com sucesso!"; } else { aviso = "Não foi possivel excluir o cliente ou fonecedor"; } return aviso; }
private string VerificarCampos(CliFor i, Endereco e, Email m, Telefone t) { string msg = ""; //email var rg = new Regex(@"^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$"); if (!rg.IsMatch(m.Mail)) msg += " - E-mail não é valido! -\n"; //bairro if (e.Bairro == "") msg += "- Preencha o Bairro! -\n"; //cep rg = new Regex(@"\d{2}[.\s]?\d{3}[-.\s]?\d{3}"); if (!rg.IsMatch(e.Cep)) msg += " - CEP não é valido! -\n"; //Logradouro if (e.Logradouro == "") msg += "- Preencha o Logradouro! -\n"; //Municipio if (e.Cidade == "") msg += "- Preencha o Municipio! -\n"; //CNPJ rg = new Regex(@"(^\d{3}\.\d{3}\.\d{3}\-\d{2}$)|(^\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}$)"); if (!rg.IsMatch(i.Identificacao)) msg += " - CNPJ não é valido! -\n"; //Numero rg = new Regex(@"^\d+$"); if (!rg.IsMatch(e.Numero)) msg += " - Número não é valido! -\n"; //Tel Fixo rg = new Regex(@"^(?:(?:\+|00)?(55)\s?)?(?:\(?([1-9][0-9])\)?\s?)?(?:((?:9\d|[2-9])\d{3})\-?(\d{4}))$"); if (!rg.IsMatch(t.Fixo)) msg += " - Telefone não é valido! -\n"; //Tel Celular rg = new Regex(@"^(?:(?:\+|00)?(55)\s?)?(?:\(?([1-9][0-9])\)?\s?)?(?:((?:9\d|[2-9])\d{3})\-?(\d{4}))$"); if (!rg.IsMatch(t.Celular)) msg += " - Celular não é valido! -\n"; //UF rg = new Regex(@"^[a-zA-Z]{2}$"); if (!rg.IsMatch(e.Uf)) msg += " - UF não é valida! -\n"; //Fantasia if (i.Fantasia == "") msg += "- Preencha o Nome! -\n"; return msg; }
private void tsSalvar_Click(object sender, EventArgs e) { CliFor cli = new CliFor(); Endereco end = new Endereco(); Email mail = new Email(); Telefone tel = new Telefone(); //cliente/fornecedor cli.Razao = txtRazao.Text; cli.Fantasia = txtFantasia.Text; cli.Ie = txtInscEstadual.Text; cli.Im = txtInscMunicipal.Text; //endereço end.Cep = txtCep.Text; end.Logradouro = txtLogradouro.Text; end.Cidade = txtMunicipio.Text; end.Bairro = txtBairro.Text; end.Uf = txtUF.Text; end.Numero = txtNumero.Text; //telefone tel.Fixo = txtTel.Text; tel.Celular = txtCel.Text; //email mail.Mail = txtEmail.Text; try { CliForModel forn = new CliForModel(); string mensagem = forn.salvar(cli, end, mail, tel); if (mensagem != "") { MessageBox.Show(mensagem); } this.Close(); } catch (Exception ex) { MessageBox.Show("Erro: " + ex); } }
public static void FillFieldsTelefoneCliente(CliFor cliente, XRLabel xrLblTelefoneCliente) { if (!string.IsNullOrEmpty(cliente.Telefone)) { xrLblTelefoneCliente.Text = cliente.Telefone; } else if (!string.IsNullOrEmpty(cliente.Celular)) { xrLblTelefoneCliente.Text = cliente.Celular; } else { xrLblTelefoneCliente.Text = cliente.TelefoneComercial; } }
public string alterar(CliFor c, Endereco e, Email m, Telefone t) { CliForDao login = new CliForDao(); string aviso = VerificarCampos(c, e, m, t); if (aviso == "") { if (login.AlteraCliForProc(c, e, m, t)) { aviso = "Alterado com sucesso!"; } else { aviso = "Não foi possivel alterar o cliente ou fonecedor"; } } return aviso; }
public void Update(PartidaContabil nova) { this.ValorPartida = nova.ValorPartida; this.ValorPartida2 = nova.ValorPartida2; this.LocalizacaoFisDoc = nova.LocalizacaoFisDoc; this.Historico = nova.Historico; if (nova.CentroCusto != null) { this.CentroCusto = nova.CentroCusto; this.IdCentroCusto = nova.IdCentroCusto; } if (nova.ContaContabilDebito != null) { this.ContaContabilDebito = nova.ContaContabilDebito; this.IdContaContabilDeb = nova.IdContaContabilDeb; } if (nova.ContaContabilCredito != null) { this.ContaContabilCredito = nova.ContaContabilCredito; this.IdContaContabilCred = nova.IdContaContabilCred; } if (nova.MoedaPrincipal != null) { this.MoedaPrincipal = nova.MoedaPrincipal; this.IdMoeda = nova.IdMoeda; } if (nova.MoedaEstrangeira != null) { this.MoedaEstrangeira = nova.MoedaEstrangeira; this.IdMoeda2 = nova.IdMoeda2; } if (nova.Participante != null) { this.Participante = nova.Participante; this.IdCliFor = nova.IdCliFor; } }
/// <summary> /// Retorna vendas do cliente informado, dentro do período de datas desejado /// </summary> /// <param name="cliente"></param> /// <param name="dtInicio"></param> /// <param name="dtFinal"></param> /// <param name="status"></param> /// <returns></returns> public IQueryable <Venda> FindVendasByPeriodo(CliFor cliente, DateTime dtInicio, DateTime dtFinal, TypeStatusVenda status, TypeAgrupamentoVendas agrupar) { using (var ctx = new BalcaoContext()) { //filtra pelo cliente //Saos as vendas em atraso e aos que vao vencer if (status == TypeStatusVenda.Aberto) { var vendas = ctx.VendaDao.Where(v => v.TipoMovimento == TypeVenda.Venda && v.DataVenda.Date >= dtInicio.Date && v.DataVenda.Date <= dtFinal.Date && v.IdCliForVenda == cliente.IdCliFor); vendas = vendas.Where(v => v.StatusVenda == TypeStatusVenda.Aberto || v.StatusVenda == TypeStatusVenda.Parcial || v.StatusVenda == TypeStatusVenda.Vencida) .OrderBy(v => v.DataVenda); return(vendas); } //StatusVenda.Quitada , StatusVenda.Vencida , StatusVenda.Cancelada else if (status != TypeStatusVenda.Todas) { return(ctx.VendaDao.Where(v => v.TipoMovimento == TypeVenda.Venda && v.DataVenda.Date >= dtInicio.Date && v.DataVenda.Date <= dtFinal.Date && v.StatusVenda == status && v.IdCliForVenda == cliente.IdCliFor) .OrderBy(v => v.DataVenda)); } //Todas else { return(ctx.VendaDao.Where(v => v.TipoMovimento == TypeVenda.Venda && v.DataVenda.Date >= dtInicio.Date && v.DataVenda.Date <= dtFinal.Date && v.IdCliForVenda == cliente.IdCliFor) .OrderBy(v => v.DataVenda)); } } }
/// <summary> ///Obtem os dados do endereco dos campos /// </summary> /// <param name="index"></param> Indice da aba selecionada /// <returns></returns>o endereco com os dados do campos private void setEnderecoCliFor(CliFor c) { var endereco = txtEndereco.Text; var numEnd = txtNumero.Text; var bairro = txtBairro.Text; var complemento = txtComplemento.Text; var uf = lookUpMunicipio1.UF; var cidade = lookUpMunicipio1.Municipio; var cep = cepControl1.TextCep.Text; c.NomeEndereco = endereco; c.NumeroEndereco = numEnd; c.Bairro = bairro; c.Complemento = complemento; c.Cep = cep; c.Uf = uf; c.Cidade = cidade; c.TipoEndereco = Correspondencia; }