Exemplo n.º 1
0
 public List <TipoFormaPago> GetTipoFormaPagoTodos()
 {
     try
     {
         using (SqlConnection cnn = new SqlConnection(this.strConn))
         {
             List <TipoFormaPago> lfp = new List <TipoFormaPago>();
             cnn.Open();
             SqlCommand cmd = new SqlCommand("sp_r_get_tipo_formapago", cnn);
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@id_formapago", 0);
             SqlDataReader dr = cmd.ExecuteReader();
             while (dr.Read())
             {
                 TipoFormaPago fp = new TipoFormaPago();
                 fp.Id_FormaPago = Convert.ToInt32(dr["id_formapago"]);
                 fp.Descripcion  = dr["descripcion"].ToString();
                 fp.Codigo       = dr["codigo"].ToString();
                 lfp.Add(fp);
             }
             dr.Close();
             cnn.Close();
             return(lfp);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        private void RadioCuentaCorriente_CheckedChanged_1(object sender, EventArgs e)
        {
            if (RadioCuentaCorriente.Checked)
            {
                pnlCuentaCorriente.Enabled = true;

                txtApyNom.Clear();

                txtDni.Clear();

                txtDni.Focus();

                _tipoFormaPago = TipoFormaPago.CuentaCorriente;
            }
        }
        private void RadioEfectivo_CheckedChanged_1(object sender, EventArgs e)
        {
            if (RadioEfectivo.Checked)
            {
                pnlCuentaCorriente.Enabled = false;

                txtDni.Text = "99999999";

                txtApyNom.Text = "Consumidor Final";

                _tipoFormaPago = TipoFormaPago.Efectivo;

                nudMontoActual.Value = 0;

                nudMontoRestar.Value = 0;

                RestanteCuentaCorriente.Value = 0;
            }
        }
Exemplo n.º 4
0
 void filtrar(TipoFormaPago tipofp, TipoComprobante tipocomp)
 {
     var data = _formaPagoServicio.Obtener(TipoFormaPago.Efectivo);
     //data = data.Where(x => x.)
 }
        private void cerrarLaMesa(long mesaId, int numeroMesa)
        {
            bool desea_imprimir = true;

            if (rdbCheque.Checked)
            {
                _tfPAgo = TipoFormaPago.Cheque;
            }
            if (rdbEfectivo.Checked)
            {
                _tfPAgo = TipoFormaPago.Efectivo;
                _tPago  = TipoPago.Efectivo;
            }
            if (rdbTarjeta.Checked)
            {
                _tfPAgo = TipoFormaPago.Tarjeta;
                _tPago  = TipoPago.Tarjeta;
            }
            if (rdbCtaCte.Checked)
            {
                _tfPAgo = TipoFormaPago.CuentaCorriente;
                _tPago  = TipoPago.CtaCte;
            }

            var comprobanteMesaDto = _comprobanteSalonServicio.Obtener(mesaId);


            if (nudTotal.Value > 0)
            {
                if (_tfPAgo == TipoFormaPago.CuentaCorriente)
                {
                    bool puede_continuar = _clienteServicio.DescontarDeCuenta(idCliente, comprobanteMesaDto.Total);
                    if (!puede_continuar)
                    {
                        MessageBox.Show("La cuenta del cliente no tiene suficiente saldo");
                        return;
                    }
                }
                else
                {
                    if (_tfPAgo == TipoFormaPago.Cheque)
                    {
                        FormaPagoChequeDTO fp = new FormaPagoChequeDTO
                        {
                            TipoFormaPago = TipoFormaPago.Cheque,
                            Monto         = nudTotal.Value,
                            ComprobanteId = idComprobante,
                            BancoId       = ((BancoDTO)cbBanco.SelectedItem).Id,
                            Dias          = (int)nudDiasCheque.Value,
                            EnteEmisor    = txtEnteCheque.Text,
                            FechaEmision  = dtFechaCheque.Value,
                            Numero        = txtNumeroCheque.Text,
                        };

                        _formaPagoServicio.Generar(fp);
                    }
                    else
                    {
                        if (_tfPAgo == TipoFormaPago.Tarjeta)
                        {
                            FormaPagoTarjetaDTO fp = new FormaPagoTarjetaDTO
                            {
                                TipoFormaPago = TipoFormaPago.Tarjeta,
                                Monto         = nudTotal.Value,
                                ComprobanteId = idComprobante,
                                Numero        = txtNumeroTarjeta.Text,
                                Cupon         = "", //
                                PlanTarjetaId = ((PlanTarjetaDTO)cbPlan.SelectedItem).Id,
                                NumeroTarjeta = txtClaveTarjeta.Text
                            };

                            _formaPagoServicio.Generar(fp);
                        }
                    }
                }
                _comprobanteSalonServicio.FacturarComprobanteSalon(mesaId, comprobanteMesaDto);

                MovimientoDTO movimiento = new MovimientoDTO
                {
                    CajaID        = DatosSistema.CajaId,
                    ComprobanteID = comprobanteMesaDto.ComprobanteId,
                    Tipo          = TipoMovimiento.Ingreso,
                    UsuarioID     = DatosSistema.UsuarioId,
                    Monto         = nudTotal.Value,
                    Fecha         = DateTime.Now,
                };

                _movimientoServicio.GenerarMovimiento(movimiento);

                DetalleCajaDTO detalleCaja = new DetalleCajaDTO
                {
                    CajaId   = DatosSistema.CajaId,
                    Monto    = nudTotal.Value,
                    TipoPago = _tPago
                };
                _detalleCajaServicio.Generar(detalleCaja);
            }
            else
            {
                _comprobanteSalonServicio.Eliminar(comprobanteMesaDto.ComprobanteId);
                desea_imprimir = false;
            }

            var mesaParaCerrar = _mesaServicio.ObtenerPorId(mesaId);

            mesaParaCerrar.estadoMesa = EstadoMesa.Cerrada;
            _mesaServicio.Modificar(mesaParaCerrar);



            if (desea_imprimir)
            {
                const string message = "Desea imprimir/ver comprobante?";
                const string caption = "Comprobante";
                var          result  = MessageBox.Show(message, caption,
                                                       MessageBoxButtons.YesNo,
                                                       MessageBoxIcon.Question);

                if (result == DialogResult.Yes)
                {
                    var f = new FormularioComprobante(comprobanteMesaDto.ComprobanteId);
                    f.ShowDialog();
                }
            }
            this.Close();
        }
Exemplo n.º 6
0
        public IEnumerable <FormaPagoDTO> Obtener(TipoFormaPago tipo)
        {
            using (var context = new ModeloXCommerceContainer())
            {
                switch (tipo)
                {
                case TipoFormaPago.Efectivo:
                    return(context.FormasPagos.OfType <FormaPagoEfectivo>()
                           .Where(x => x.TipoFormaPago == tipo).Select(x => new FormaPagoEfectivoDTO
                    {
                        Id = x.Id,
                        ComprobanteId = x.ComprobanteId,
                        Monto = x.Monto,
                        TipoFormaPago = x.TipoFormaPago
                    }).ToList());

                case TipoFormaPago.Cheque:
                    return(context.FormasPagos.OfType <FormaPagoCheque>()
                           .Where(x => x.TipoFormaPago == tipo).Select(x => new FormaPagoChequeDTO
                    {
                        Id = x.Id,
                        ComprobanteId = x.ComprobanteId,
                        Monto = x.Monto,
                        TipoFormaPago = x.TipoFormaPago,
                        BancoId = x.BancoId,
                        Dias = x.Dias,
                        EnteEmisor = x.EnteEmisor,
                        FechaEmision = x.FechaEmision,
                        Numero = x.Numero,
                    }).ToList());

                case TipoFormaPago.CuentaCorriente:
                    return(context.FormasPagos.OfType <FormaPagoCtaCte>()
                           .Where(x => x.TipoFormaPago == tipo).Select(x => new FormaPagoCtaCteDTO
                    {
                        Id = x.Id,
                        ComprobanteId = x.ComprobanteId,
                        Monto = x.Monto,
                        TipoFormaPago = x.TipoFormaPago,
                        ClienteId = x.ClienteId
                    }).ToList());

                case TipoFormaPago.Tarjeta:
                    return(context.FormasPagos.OfType <FormaPagoTarjeta>()
                           .Where(x => x.TipoFormaPago == tipo).Select(x => new FormaPagoTarjetaDTO
                    {
                        Id = x.Id,
                        ComprobanteId = x.ComprobanteId,
                        Monto = x.Monto,
                        TipoFormaPago = x.TipoFormaPago,
                        Numero = x.Numero,
                        Cupon = x.Cupon,
                        PlanTarjetaId = x.PlanTarjetaId,
                        NumeroTarjeta = x.NumeroTarjeta
                    }).ToList());

                default:
                    throw new Exception("error grave");
                }
            }
        }