Ejemplo n.º 1
0
        private void LlenarGridServicios(int IDPromocion)
        {
            try
            {
                if (IDPromocion > 0)
                {
                    Servicio_Negocio SN    = new Servicio_Negocio();
                    List <Producto>  Lista = SN.ObtenerServiciosXIDPromocion(Comun.Conexion, IDPromocion);
                    this.dgvServiciosPromocion.AutoGenerateColumns = false;
                    this.dgvServiciosPromocion.DataSource          = null;
                    this.dgvServiciosPromocion.DataSource          = Lista;

                    List <Usuario> ListaEmpleados = ObtenerListaEmpleados();
                    foreach (DataGridViewRow Fila in this.dgvServiciosPromocion.Rows)
                    {
                        DataGridViewComboBoxCell Combo = (DataGridViewComboBoxCell)Fila.Cells["Empleado"];
                        Combo.DataSource    = ListaEmpleados;//this.ClonarLista(ListaEmpleados);
                        Combo.DisplayMember = "Nombre";
                        Combo.ValueMember   = "IDEmpleado";
                        if (ListaEmpleados.Count > 0)
                        {
                            Combo.Value = ListaEmpleados[0].IDEmpleado;
                        }
                    }
                }
                else
                {
                    this.dgvServiciosPromocion.DataSource = null;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
 private void LlenarComboServicios()
 {
     try
     {
         Servicio DatosAux = new Servicio {
             Conexion = Comun.Conexion, IncluirSelect = true
         };
         Servicio_Negocio SN = new Servicio_Negocio();
         this.cmbServicio.DataSource    = SN.LlenarComboCatServicios(DatosAux);
         this.cmbServicio.DisplayMember = "NombreServicio";
         this.cmbServicio.ValueMember   = "IDServicio";
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 3
0
 private void BusquedaServicio(string TextoServicio)
 {
     try
     {
         Servicio DatosAux = new Servicio {
             Conexion = Comun.Conexion, NombreServicio = TextoServicio, BuscarTodos = false
         };
         Servicio_Negocio PN = new Servicio_Negocio();
         PN.ObtenerCatServicioBusqueda(DatosAux);
         this.dgvServicios.AutoGenerateColumns = false;
         this.dgvServicios.DataSource          = DatosAux.TablaDatos;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 4
0
 private void LlenarGridCatServicio(bool Band)
 {
     try
     {
         Servicio DatosAux = new Servicio {
             Conexion = Comun.Conexion, BuscarTodos = Band
         };
         Servicio_Negocio PN = new Servicio_Negocio();
         PN.ObtenerCatServicio(DatosAux);
         this.dgvServicios.AutoGenerateColumns = false;
         this.dgvServicios.DataSource          = DatosAux.TablaDatos;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 5
0
 private void LlenarGridProductos(string IDEmpleado, string IDServicio)
 {
     try
     {
         if (!string.IsNullOrEmpty(IDEmpleado) && !string.IsNullOrEmpty(IDServicio))
         {
             Servicio DatosAux = new Servicio {
                 Conexion = Comun.Conexion, IDServicio = IDServicio, IDEmpleado = IDEmpleado, IDSucursal = Comun.IDSucursalCaja
             };
             Servicio_Negocio SN    = new Servicio_Negocio();
             List <Producto>  Lista = SN.ObtenerProductosXIDServicio(DatosAux);
             this.dgvProductosXServicio.AutoGenerateColumns = false;
             this.dgvProductosXServicio.DataSource          = null;
             this.dgvProductosXServicio.DataSource          = Lista;
             foreach (DataGridViewRow Fila in this.dgvProductosXServicio.Rows)
             {
                 Producto AuxProd = this.ObtenerProductoXID(Fila.Cells["IDProducto"].Value.ToString(), Lista);
                 if (!string.IsNullOrEmpty(AuxProd.IDProducto))
                 {
                     DataGridViewComboBoxCell Combo = (DataGridViewComboBoxCell)Fila.Cells["ClaveProduccion"];
                     Combo.DataSource    = AuxProd.ListaClaves;
                     Combo.DisplayMember = "ClaveProduccion";
                     Combo.ValueMember   = "IDAsignacion";
                     if (AuxProd.ListaClaves.Count > 0)
                     {
                         Combo.Value = AuxProd.ListaClaves[0].IDAsignacion;
                     }
                 }
             }
         }
         else
         {
             this.dgvProductosXServicio.DataSource = null;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 6
0
 private void EliminarServicio(Servicio Datos)
 {
     try
     {
         Datos.Conexion        = Comun.Conexion;
         Datos.IDUsuario       = Comun.IDUsuario;
         Datos.Opcion          = 3;
         Datos.TablaMonederos  = this.GenerarTablaMonedero();
         Datos.TablaProductos  = this.GenerarTablaProducto();
         Datos.FechaInicioTemp = DateTime.Today;
         Datos.FechaFinTemp    = DateTime.Today;
         Datos.Imagen          = new byte[0];
         Servicio_Negocio ProdNeg = new Servicio_Negocio();
         ProdNeg.ABCCatServicio(Datos);
         if (Datos.Completado)
         {
             MessageBox.Show("Registro Eliminado.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
             Int32 RowToDelete = this.dgvServicios.Rows.GetFirstRow(DataGridViewElementStates.Selected);
             if (RowToDelete > -1)
             {
                 this.dgvServicios.Rows.RemoveAt(RowToDelete);
             }
             else
             {
                 this.LlenarGridCatServicio(false);
             }
         }
         else
         {
             MessageBox.Show("Error al guardar los datos. Contacte a Soporte Técnico.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
             LogError.AddExcFileTxt(new Exception(Datos.MensajeError), "frmCatServicios ~ EliminarServicio -> Método");
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 7
0
        public void CargarComboBox()
        {
            Tipo_Documento_Negocio Docu_Neg = new Tipo_Documento_Negocio();

            //////////////LISTAR FAMILIA/////////////////
            cmb_Documento_Vta.ItemsSource       = Docu_Neg.ListarDocumento();
            cmb_Documento_Vta.DisplayMemberPath = "descr_documento";
            cmb_Documento_Vta.SelectedValuePath = "id_documento";

            TallerNegocio TallerN = new TallerNegocio();

            //////////////LISTAR taller/////////////////
            cmb_taller_Vta.ItemsSource       = TallerN.ListarTaller();
            cmb_taller_Vta.DisplayMemberPath = "nombre";
            cmb_taller_Vta.SelectedValuePath = "id_taller";


            Servicio_Negocio Serv_N = new Servicio_Negocio();

            //////////////LISTAR ESTADO/////////////////
            cmb_servicio_Vta.ItemsSource       = Serv_N.ListaServicio();
            cmb_servicio_Vta.DisplayMemberPath = "Descripción";
            cmb_servicio_Vta.SelectedValuePath = "ID";

            //////////////LISTAR FAMILIA/////////////////
            Compartido_Negocio ComparN = new Compartido_Negocio();

            cmb_Familia_prod_Vta.ItemsSource       = ComparN.ListarFamProd();
            cmb_Familia_prod_Vta.DisplayMemberPath = "descr_familia";
            cmb_Familia_prod_Vta.SelectedValuePath = "id_familia_prod";

            Cliente_Negocio ClienN = new Cliente_Negocio();

            cmb_Cliente_Vta.ItemsSource       = ClienN.ListarClienteCMB();
            cmb_Cliente_Vta.DisplayMemberPath = "nombre_cliente";
            cmb_Cliente_Vta.SelectedValuePath = "id_cliente";
        }
Ejemplo n.º 8
0
        /// ///////////////////////////////////////
        /// //////////SERVICIOS////////////////////
        /// ///////////////////////////////////////

        private void Btn_Agregar_serv_Click(object sender, RoutedEventArgs e)
        {
            decimal              total     = 0;
            Servicio_Negocio     Serv_Neg  = new Servicio_Negocio();
            List <Servicios_dto> list_serv = new List <Servicios_dto>();

            if (cmb_Documento_Vta.Text == "")
            {
                MessageBox.Show("Favor de seleccionar tipo de documento");
                limpiar();
            }
            else
            {
                if (cmb_servicio_Vta.Text == "")
                {
                    MessageBox.Show("Debe seleccionar un servicio");
                }
                else
                {
                    bool    existe        = false;
                    string  id_serv       = cmb_servicio_Vta.SelectedValue.ToString();
                    int     cantidad_serv = int.Parse(txt_Cant_servicios.Text);
                    string  txt_tipo      = "S";
                    decimal subT          = 0;
                    decimal IVA           = 0;

                    // Aqui trae lo previamente guardado en la grilla, si la variable se session esta nula no entra
                    if (Application.Current.Properties["ListadoVenta"] != null)
                    {
                        // trae lo que esta en la variable de sesion
                        var jsonValueToGet = JsonConvert.DeserializeObject(Application.Current.Properties["ListadoVenta"].ToString());

                        // lo convierte en un array
                        JArray jsonPreservar = JArray.Parse(jsonValueToGet.ToString());

                        //lo recorre para añadir al listado que luego se mostrará en la grilla
                        foreach (JObject item in jsonPreservar.Children <JObject>())
                        {
                            // estos datos vienen de la grilla, creamosla entidad para añadir al listado
                            Servicios_dto entidad = new Servicios_dto();

                            entidad.ID          = int.Parse(item["ID"].ToString());
                            entidad.Descripción = item["Descripción"].ToString();
                            entidad.Cantidad    = int.Parse(item["Cantidad"].ToString());
                            entidad.Total       = decimal.Parse(item["Total"].ToString()).ToString("n2");
                            entidad.Precio      = decimal.Parse(item["Precio"].ToString()).ToString("n2");
                            entidad.T           = item["T"].ToString();


                            if (cmb_Documento_Vta.Text == "Factura")
                            {
                                subT  = ((total + decimal.Parse(entidad.Total)) * 81) / 100;
                                IVA   = ((total + decimal.Parse(entidad.Total)) * 19) / 100;
                                total = total + decimal.Parse(entidad.Total);
                            }
                            else
                            {
                                subT  = ((total + decimal.Parse(entidad.Total)) * 81) / 100;
                                IVA   = ((total + decimal.Parse(entidad.Total)) * 19) / 100;
                                total = total + decimal.Parse(entidad.Total);
                            }

                            list_serv.Add(entidad);
                            if (id_serv == item["ID"].ToString() && item["T"].ToString() == "S")
                            {
                                existe = true;
                            }
                        }
                    }

                    if (existe)
                    {
                        MessageBox.Show(" El Servicio : " + cmb_servicio_Vta.Text + " ya existe en el listado");
                    }
                    else
                    {
                        DataTable respuesta = Serv_Neg.Buscar_SERV_id(id_serv);
                        foreach (DataRow item in respuesta.Rows)
                        {
                            Servicios_dto entidad = new Servicios_dto();


                            entidad.ID          = int.Parse(item["ID_SERVICIO"].ToString());
                            entidad.Descripción = item["DESC_SERVICIO"].ToString();
                            entidad.Cantidad    = cantidad_serv;
                            entidad.Precio      = decimal.Parse(item["VALOR_SERVICIO"].ToString()).ToString("n2");
                            entidad.Total       = (decimal.Parse(item["VALOR_SERVICIO"].ToString()) * cantidad_serv).ToString("n2");
                            entidad.T           = txt_tipo;


                            if (cmb_Documento_Vta.Text == "Factura")
                            {
                                subT  = ((total + decimal.Parse(entidad.Total)) * 81) / 100;
                                IVA   = ((total + decimal.Parse(entidad.Total)) * 19) / 100;
                                total = total + decimal.Parse(entidad.Total);
                            }
                            else
                            {
                                subT  = ((total + decimal.Parse(entidad.Total)) * 81) / 100;
                                IVA   = ((total + decimal.Parse(entidad.Total)) * 19) / 100;
                                total = total + decimal.Parse(entidad.Total);
                            }
                            list_serv.Add(entidad);
                        }
                    }

                    // actualiza variable de sesion con los datos actuales de la grilla
                    var jsonValueToSave = JsonConvert.SerializeObject(list_serv);
                    Application.Current.Properties["ListadoVenta"] = jsonValueToSave;


                    txt_Sub.Text   = subT.ToString("n2");
                    txt_iva.Text   = IVA.ToString("n2");
                    txt_total.Text = total.ToString("n2");
                    Dt_G_list_pedido.ItemsSource = list_serv;
                }

                limpiar();
            }
        }