Esempio n. 1
0
        private void CargarDatos()
        {
            if (venta != null)
            {
                cliente    = clienteController.SelectOne(venta.ClienteId);
                usocfdi    = usocfdiController.SelectOne(venta.UsoCfdi);
                formaPago  = formaPagoController.SelectOne(venta.FormaPago1);
                metodoPago = metodoPagoController.SelectOne(venta.MetodoPago);


                TxtCliente.Text    = cliente == null ? "" : cliente.RazonSocial.Trim().Equals("") ? cliente.Negocio : cliente.RazonSocial.Trim();
                TxtUsoCFDI.Text    = usocfdi == null ? "" : usocfdi.Descripcion;
                TxtFormaPago.Text  = formaPago == null ? "" : formaPago.Descripcion;;
                TxtMetodoPago.Text = metodoPago == null ? "" : metodoPago.Descripcion;

                Malla.Rows.Clear();
                Malla.Rows.Add();
                Malla.Rows[Malla.RowCount - 1].Cells[0].Value = venta.NoRef;
                Malla.Rows[Malla.RowCount - 1].Cells[1].Value = venta.Total;
                Malla.Rows[Malla.RowCount - 1].Cells[2].Value = venta.EstadoDocId;
                Malla.Rows[Malla.RowCount - 1].Cells[3].Value = venta.DatosCliente;
            }
            else
            {
                TxtCliente.Text    = "";
                TxtUsoCFDI.Text    = "";
                TxtFormaPago.Text  = "";
                TxtMetodoPago.Text = "";
                Malla.Rows.Clear();
                Ambiente.Mensaje("El ticket no existe");
            }
        }
Esempio n. 2
0
 private void TxtFormaPago_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         using (var form = new FrmBusqueda(TxtFormaPago.Text, (int)Ambiente.TipoBusqueda.FormaPago))
         {
             if (form.ShowDialog() == DialogResult.OK)
             {
                 formapago         = form.FormaPago;
                 TxtFormaPago.Text = formapago.Descripcion;
             }
         }
     }
 }
 public bool InsertOne(CFormapago o)
 {
     try
     {
         using (var db = new DymContext())
         {
             db.Add(o);
             return(db.SaveChanges() > 0 ? true : false);
         }
     }
     catch (Exception ex)
     {
         Ambiente.Mensaje("Algo salio mal con: " + MethodBase.GetCurrentMethod().Name + "@" + GetType().Name + "\n" + ex.ToString());
     }
     return(false);
 }
 public bool Update(CFormapago o)
 {
     try
     {
         using (var db = new DymContext())
         {
             db.Entry(o).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
             return(db.SaveChanges() > 0 ? true : false);
         }
     }
     catch (Exception ex)
     {
         Ambiente.Mensaje("Algo salio mal con: " + MethodBase.GetCurrentMethod().Name + "@" + GetType().Name + "\n" + ex.ToString());
     }
     return(false);
 }
Esempio n. 5
0
 private void InicializaCampos()
 {
     formaPago1     = formaPagoController.SelectOne("01");
     TxtTotal.Text  = total.ToString();
     TxtPago1.Text  = total.ToString();
     formaPago2     = null;
     formaPago3     = null;
     totalLetra     = "";
     pago1          = 0;
     pago2          = 0;
     pago3          = 0;
     Cxc            = false;
     tipoDoc        = "TIC";
     CobroConPuntos = false;
     NoTarjeta      = "";
     moneda         = new Moneda();
 }
Esempio n. 6
0
        private void TxtConceptoPago2_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                using (var form = new FrmBusqueda(TxtConceptoPago2.Text.Trim(), (int)Ambiente.TipoBusqueda.FormaPago))
                {
                    form.ShowDialog();
                    if (form.DialogResult == DialogResult.OK)
                    {
                        if (form.FormaPago.FormaPagoId.Equals("05"))
                        {
                            if (cliente == null)
                            {
                                Ambiente.Mensaje("Seleccione un cliente en la venta");
                                DialogResult = DialogResult.Cancel;
                            }
                            else
                            {
                                TxtPago2.Text    = Ambiente.FDinero(cliente.DineroElectronico.ToString());
                                TxtPago2.Enabled = false;

                                TxtPago3.Enabled         = true;
                                TxtPago3.Text            = "";
                                TxtFormaPago3.Text       = "";
                                TxtPago1.Enabled         = true;
                                TxtPago1.Text            = "";
                                TxtFormaPago1.Text       = "";
                                ChkCobrarConPtos.Checked = true;
                                ChkCobrarConPtos.Enabled = false;
                            }
                        }
                        else
                        {
                            if (formaPago1 != null && formaPago3 != null)
                            {
                                if (!formaPago1.FormaPagoId.Equals("05") && !formaPago3.FormaPagoId.Equals("05"))
                                {
                                    ChkCobrarConPtos.Checked = false;
                                    ChkCobrarConPtos.Enabled = true;
                                }
                            }


                            TxtPago3.Enabled = true;
                        }
                        TxtFormaPago2.Text    = form.FormaPago.FormaPagoId;
                        TxtConceptoPago2.Text = form.FormaPago.Descripcion.ToUpper();


                        if (TxtPago1.Text.Trim().Length == 0)
                        {
                            formaPago1 = null;
                        }
                        if (TxtPago2.Text.Trim().Length == 0)
                        {
                            formaPago2 = null;
                        }
                        if (TxtPago3.Text.Trim().Length == 0)
                        {
                            formaPago3 = null;
                        }

                        formaPago2 = form.FormaPago;
                    }
                }
            }
        }
Esempio n. 7
0
        private void SeleccionaRegistro()
        {
            if (Grid1.Rows.Count <= 0)
            {
                DialogResult = DialogResult.Abort;
                Dispose();
                return;
            }


            switch (Catalogo)
            {
            case (int)Ambiente.TipoBusqueda.Clientes:

                using (var db = new DymContext())
                {
                    Cliente = db.Cliente.Where(x => x.ClienteId ==
                                               Grid1.Rows[Grid1.CurrentCell.RowIndex].Cells[0].Value.ToString().Trim()).FirstOrDefault();
                }

                break;

            case (int)Ambiente.TipoBusqueda.Proveedores:
                using (var db = new DymContext())
                {
                    Proveedor = db.Proveedor.Where(x => x.ProveedorId ==
                                                   Grid1.Rows[Grid1.CurrentCell.RowIndex].Cells[0].Value.ToString().Trim()).FirstOrDefault();
                }
                break;

            case (int)Ambiente.TipoBusqueda.Productos:
                using (var db = new DymContext())
                {
                    Producto = db.Producto.Where(x => x.ProductoId ==
                                                 Grid1.Rows[Grid1.CurrentCell.RowIndex].Cells[0].Value.ToString().Trim()).FirstOrDefault();
                }
                break;

            case (int)Ambiente.TipoBusqueda.Categorias:
                using (var db = new DymContext())
                {
                    Categoria = db.Categoria.Where(x => x.CategoriaId ==
                                                   Grid1.Rows[Grid1.CurrentCell.RowIndex].Cells[0].Value.ToString().Trim()).FirstOrDefault();
                }
                break;

            case (int)Ambiente.TipoBusqueda.Laboratorios:
                using (var db = new DymContext())
                {
                    Laboratorio = db.Laboratorio.Where(x => x.LaboratorioId ==
                                                       Grid1.Rows[Grid1.CurrentCell.RowIndex].Cells[0].Value.ToString().Trim()).FirstOrDefault();
                }
                break;

            case (int)Ambiente.TipoBusqueda.Impuestos:
                using (var db = new DymContext())
                {
                    Impuesto = db.Impuesto.Where(x => x.ImpuestoId ==
                                                 Grid1.Rows[Grid1.CurrentCell.RowIndex].Cells[0].Value.ToString().Trim()).FirstOrDefault();
                }
                break;

            case (int)Ambiente.TipoBusqueda.Sustancias:
                using (var db = new DymContext())
                {
                    Sustancia = db.Sustancia.Where(x => x.SustanciaId ==
                                                   Grid1.Rows[Grid1.CurrentCell.RowIndex].Cells[0].Value.ToString().Trim()).FirstOrDefault();
                }

                break;



            case (int)Ambiente.TipoBusqueda.Estaciones:
                using (var db = new DymContext())
                {
                    Estacion = db.Estacion.Where(x => x.EstacionId ==
                                                 Grid1.Rows[Grid1.CurrentCell.RowIndex].Cells[0].Value.ToString().Trim()).FirstOrDefault();
                }
                break;

            case (int)Ambiente.TipoBusqueda.ClavesSat:
                using (var db = new DymContext())
                {
                    CClaveProdServ = db.CClaveProdServ.Where(x => x.ClaveProdServId ==
                                                             Grid1.Rows[Grid1.CurrentCell.RowIndex].Cells[0].Value.ToString().Trim()).FirstOrDefault();
                }
                break;

            case (int)Ambiente.TipoBusqueda.Presentaciones:

                using (var db = new DymContext())
                {
                    Presentacion = db.Presentacion.Where(x => x.PresentacionId ==
                                                         Grid1.Rows[Grid1.CurrentCell.RowIndex].Cells[0].Value.ToString().Trim()).FirstOrDefault();
                }
                break;

            case (int)Ambiente.TipoBusqueda.UnidadesMedida:
                using (var db = new DymContext())
                {
                    UnidadMedida = db.UnidadMedida.Where(x => x.UnidadMedidaId ==
                                                         Grid1.Rows[Grid1.CurrentCell.RowIndex].Cells[0].Value.ToString().Trim()).FirstOrDefault();
                }
                break;

            case (int)Ambiente.TipoBusqueda.Usuarios:
                using (var db = new DymContext())
                {
                    Usuario = db.Usuario.Where(x => x.UsuarioId ==
                                               Grid1.Rows[Grid1.CurrentCell.RowIndex].Cells[0].Value.ToString().Trim()).FirstOrDefault();
                }
                break;

            case (int)Ambiente.TipoBusqueda.MetodoPago:
                using (var db = new DymContext())
                {
                    MetodoPago = db.CMetodopago.Where(x => x.MetodoPagoId ==
                                                      Grid1.Rows[Grid1.CurrentCell.RowIndex].Cells[0].Value.ToString().Trim()).FirstOrDefault();
                }
                break;

            case (int)Ambiente.TipoBusqueda.FormaPago:
                using (var db = new DymContext())
                {
                    FormaPago = db.CFormapago.Where(x => x.FormaPagoId.Equals(
                                                        Grid1.Rows[Grid1.CurrentCell.RowIndex].Cells[0].Value.ToString().Trim())).FirstOrDefault();
                }
                break;

            case (int)Ambiente.TipoBusqueda.UsoCDFI:
                using (var db = new DymContext())
                {
                    Usocfdi = db.CUsocfdi.Where(x => x.UsoCfdiid ==
                                                Grid1.Rows[Grid1.CurrentCell.RowIndex].Cells[0].Value.ToString().Trim()).FirstOrDefault();
                }
                break;

            case (int)Ambiente.TipoBusqueda.Tickets:
                using (var db = new DymContext())
                {
                    Venta = db.Venta.Where(x => x.NoRef ==
                                           (int)Grid1.Rows[Grid1.CurrentCell.RowIndex].Cells[0].Value).FirstOrDefault();
                }
                break;

            case (int)Ambiente.TipoBusqueda.Empresas:
                using (var db = new DymContext())
                {
                    Empresa = db.Empresa.Where(x => x.EmpresaId ==
                                               (int)Grid1.Rows[Grid1.CurrentCell.RowIndex].Cells[0].Value).FirstOrDefault();
                }
                break;

            case (int)Ambiente.TipoBusqueda.RegimenFiscal:
                using (var db = new DymContext())
                {
                    Regimenfiscal = db.CRegimenfiscal.Where(x => x.RegimenFiscalId.Equals(
                                                                Grid1.Rows[Grid1.CurrentCell.RowIndex].Cells[0].Value.ToString())).FirstOrDefault();
                }
                break;

            case (int)Ambiente.TipoBusqueda.Sucursal:
                using (var db = new DymContext())
                {
                    Sucursal = db.Sucursal.Where(x => x.SucursalId == (int)Grid1.Rows[Grid1.CurrentCell.RowIndex].Cells[0].Value).FirstOrDefault();
                }
                break;

            case (int)Ambiente.TipoBusqueda.Reportes:
                using (var db = new DymContext())
                {
                    Informe = db.Informe.Where(x => x.InformeId.Equals(Grid1.Rows[Grid1.CurrentCell.RowIndex].Cells[0].Value.ToString())).FirstOrDefault();
                }
                break;

            case (int)Ambiente.TipoBusqueda.ConceptoMovsInv:
                using (var db = new DymContext())
                {
                    ConceptoMovInv = db.ConceptoMovInv.Where(x => x.ConceptoMovInvId.Equals(Grid1.Rows[Grid1.CurrentCell.RowIndex].Cells[0].Value.ToString())).FirstOrDefault();
                }
                break;

            case (int)Ambiente.TipoBusqueda.Lotes:
                using (var db = new DymContext())
                {
                    Lote = db.Lote.Where(x => x.LoteId == (int)Grid1.Rows[Grid1.CurrentCell.RowIndex].Cells[0].Value).FirstOrDefault();
                }
                break;

            case (int)Ambiente.TipoBusqueda.TipoInvetario:
                using (var db = new DymContext())
                {
                    TipoInventario = db.TipoInventario.Where(x => x.TipoInventarioId == (int)Grid1.Rows[Grid1.CurrentCell.RowIndex].Cells[0].Value).FirstOrDefault();
                }
                break;

            case (int)Ambiente.TipoBusqueda.Inventarios:
                using (var db = new DymContext())
                {
                    Inventario = db.Inventario.Where(x => x.InventarioId == (int)Grid1.Rows[Grid1.CurrentCell.RowIndex].Cells[0].Value).FirstOrDefault();
                }
                break;

            default:
                MessageBox.Show("Error, no hay enumerador para catalogo");
                break;
            }

            DialogResult = DialogResult.OK;
        }