private void cbxSucursal_Seleccion(object sender, SelectionChangedEventArgs e)
 {
     if (cbxSucursal.SelectedValue != null)
     {
         try
         {
             int sucursal = int.Parse(cbxSucursal.SelectedValue.ToString());
             cbxEmpleado.SelectedIndex = -1;
             cbxEmpleado.IsEnabled     = false;
             CargarTablaProductos();
             txtNombreEmpleado.Text = "";
             EmpleadosNEG         empleadosNEG   = new EmpleadosNEG();
             List <EmpleadosVIEW> listaEmpleados = empleadosNEG.ListarTodosEmpleadosSucursal(sucursal);
             if (listaEmpleados.Count > 0)
             {
                 cbxEmpleado.ItemsSource       = listaEmpleados;
                 cbxEmpleado.DisplayMemberPath = "NUM_ID";
                 cbxEmpleado.SelectedValuePath = "ID";
                 cbxEmpleado.IsEnabled         = true;
             }
             SucursalNEG sucursalNEG = new SucursalNEG();
             var         datos       = sucursalNEG.CargarSucursal(sucursal);
             txtDireccion.Text = datos.DIRECCION;
             txtTelFijo.Text   = datos.NUMERO_TELEFONO.ToString();
         }
         catch (Exception ex)
         {
             MessageBox.Show("Error:\n" + ex.TargetSite + "\n" + ex.Message.ToString());
         }
     }
 }
        private void CargarCombos()
        {
            ClientesNEG clientesNEG = new ClientesNEG();
            SucursalNEG sucursalNEG = new SucursalNEG();
            ReservaNEG  reservaNEG  = new ReservaNEG();

            try
            {
                txtNombreSucursal.Text = sucursalNEG.CargarSucursal(sucursal).NOMBRE;
                txtNombreCliente.Text  = clientesNEG.CargarCliente(cliente).NOMBRE + " " + clientesNEG.CargarCliente(cliente).APELLIDO;

                List <ReservaVIEW> listaServicio = reservaNEG.FiltrarRequerimientos3("CLIENTES", sucursal, cliente.ToString());
                if (listaServicio.Count > 0)
                {
                    cbxOrdenTrabajo.ItemsSource       = listaServicio;
                    cbxOrdenTrabajo.DisplayMemberPath = "ID";
                    cbxOrdenTrabajo.SelectedValuePath = "ID";
                }
                else
                {
                    cbxOrdenTrabajo.ItemsSource = null;
                    MessageBox.Show("No existen Orden de Trabajo perdientes en pago para este cliente");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:\n" + ex.TargetSite + "\n" + ex.Message.ToString());
            }
        }
Exemplo n.º 3
0
        private void CargarCombos()
        {
            MultiMonedaNEG multiMonedaNEG = new MultiMonedaNEG();
            EmpleadosNEG   empleadosNEG   = new EmpleadosNEG();

            try
            {
                List <MULTI_MONEDA> listaMultiMoneda = multiMonedaNEG.ListarMultiMoneda();
                if (listaMultiMoneda.Count > 0)
                {
                    cbxMoneda.ItemsSource       = listaMultiMoneda;
                    cbxMoneda.DisplayMemberPath = "TIPO_MODONEDA";
                    cbxMoneda.SelectedValuePath = "ID";
                }
                cbxEmpleado.SelectedIndex = -1;
                cbxEmpleado.IsEnabled     = false;
                txtNombreEmpleado.Text    = "";
                List <EmpleadosVIEW> listaEmpleados = empleadosNEG.ListarTodosEmpleadosSucursal(ordenPedidoCarga.SUCURSAL_ID);
                if (listaEmpleados.Count > 0)
                {
                    cbxEmpleado.ItemsSource       = listaEmpleados;
                    cbxEmpleado.DisplayMemberPath = "NUM_ID";
                    cbxEmpleado.SelectedValuePath = "ID";
                    cbxEmpleado.IsEnabled         = true;
                }
                SucursalNEG sucursalNEG = new SucursalNEG();
                var         datos       = sucursalNEG.CargarSucursal(ordenPedidoCarga.SUCURSAL_ID);
                txtDireccion.Text = datos.DIRECCION;
                txtTelFijo.Text   = datos.NUMERO_TELEFONO.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:\n" + ex.TargetSite + "\n" + ex.Message.ToString());
            }
        }
        private void dgDatos_MouseDoubleClick(object sender, EventArgs e)
        {
            DataRowView dr          = dgDatos.SelectedItem as DataRowView;
            DataRow     dr1         = dr.Row;
            int         id          = Convert.ToInt32(dr1.ItemArray[0]);
            SucursalNEG sucursalNEG = new SucursalNEG();
            var         datos       = sucursalNEG.CargarSucursal(id);

            txtNombre.Text           = datos.NOMBRE;
            txtDireccion.Text        = datos.DIRECCION;
            txtTelefono.Text         = datos.NUMERO_TELEFONO.ToString();
            cbxEmpresa.SelectedValue = datos.MULTI_EMPRESA_ID;
            cbxEstado.SelectedValue  = datos.ESTADO_SUCURSAL_ID;
            lblId.Content            = datos.ID;
        }
        private void CargarCombos()
        {
            SucursalNEG  sucursalNEG  = new SucursalNEG();
            CategoriaNEG categoriaNEG = new CategoriaNEG();
            MarcaNEG     marcaNEG     = new MarcaNEG();
            ProductosNEG productosNEG = new ProductosNEG();

            cbxTipoProducto.IsEnabled = false;

            try
            {
                txtNombreSucursal.Text = sucursalNEG.CargarSucursal(sucursal).NOMBRE;

                List <CATEGORIA> listaCategoria = categoriaNEG.ListarCategorias();
                if (listaCategoria.Count > 0)
                {
                    cbxCategoria.ItemsSource       = listaCategoria;
                    cbxCategoria.DisplayMemberPath = "NOMBRE";
                    cbxCategoria.SelectedValuePath = "ID";
                }

                List <MARCA> listaMarca = marcaNEG.ListarMarcas();
                if (listaMarca.Count > 0)
                {
                    cbxMarca.ItemsSource       = listaMarca;
                    cbxMarca.DisplayMemberPath = "NOMBRE";
                    cbxMarca.SelectedValuePath = "ID";
                }

                List <ProductosVIEW> listaProductos = productosNEG.ListarTodosProductosSucursal(sucursal);
                if (listaProductos.Count > 0)
                {
                    cbxProducto.ItemsSource       = listaProductos;
                    cbxProducto.DisplayMemberPath = "NOMBRE";
                    cbxProducto.SelectedValuePath = "ID";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:\n" + ex.TargetSite + "\n" + ex.Message.ToString());
            }
        }
Exemplo n.º 6
0
        private void CargarFormulario(OrdenPedidoVIEW data)
        {
            lblIdOrdenPedido.Content      = data.ID.ToString();
            txtFolio.Text                 = dataRow["FOLIO"].ToString();
            txtproveedor.Text             = data.PROVEEDOR;
            txtRutProveedor.Text          = dataRow["RUT PROVEEDOR"].ToString();
            dpkFechaCreacion.SelectedDate = data.FECHA_CREACION;
            txtSucursal.Text              = data.SUCURSAL;
            SucursalNEG sucursalNEG = new SucursalNEG();
            var         datos       = sucursalNEG.CargarSucursal(data.SUCURSAL_ID);

            txtDireccion.Text         = datos.DIRECCION;
            txtTelFijo.Text           = datos.NUMERO_TELEFONO.ToString();
            txtEmailSucursal.Text     = data.EMAIL_SUCURSAL.ToString();
            cbxMoneda.SelectedValue   = data.MULTI_MONEDA_ID;
            cbxEmpleado.SelectedValue = data.EMPLEADO_ID;
            txtEmailProveedor.Text    = data.EMAIL_PROVEEDOR;

            int          empleado     = int.Parse(cbxEmpleado.SelectedValue.ToString());
            EmpleadosNEG empleadosNEG = new EmpleadosNEG();
            var          datos1       = empleadosNEG.CargarEmpleado(empleado);

            txtNombreEmpleado.Text = datos1.NOMBRE + " " + datos1.APELLIDO;

            DetalleOrdenPedidoNEG       detalleOrdenPedidoNEG = new DetalleOrdenPedidoNEG();
            List <DETALLE_ORDEN_PEDIDO> listaDetalle          = detalleOrdenPedidoNEG.CargarlistaDetalleOrden(data.ID);

            foreach (var fila in listaDetalle)
            {
                AgregarItemTablaProductos(fila.PRODUCTO_ID, fila.NOMBRE_PRODUCTO, int.Parse(fila.CANTIDAD.ToString()), Convert.ToDecimal(fila.PRECIO_COMPRA), Convert.ToDecimal(fila.MONTO_TOTAL));
            }

            int            moneda         = int.Parse(cbxMoneda.SelectedValue.ToString());
            MultiMonedaNEG multiMonedaNEG = new MultiMonedaNEG();
            var            datos2         = multiMonedaNEG.CargarMultiMoneda(moneda);
            decimal        valorMoneda    = Convert.ToDecimal(datos2.MONTO);
            decimal        costoCLP       = Convert.ToDecimal(txtCostoTotal.Text);

            txtCostoMoneda.Text = string.Format("{0:n2}", (Math.Truncate((costoCLP / valorMoneda))));
        }
Exemplo n.º 7
0
        private void CargarCombos()
        {
            ServiciosNEG serviciosNEG = new ServiciosNEG();
            SucursalNEG  sucursalNEG  = new SucursalNEG();

            try
            {
                txtNombreSucursal.Text = sucursalNEG.CargarSucursal(sucursal).NOMBRE;

                List <ServiciosVIEW> listaServicio = serviciosNEG.FiltrarServicios("ID SUCURSAL", sucursal.ToString());
                if (listaServicio.Count > 0)
                {
                    cbxSerivioc.ItemsSource       = listaServicio;
                    cbxSerivioc.DisplayMemberPath = "TIPO_SERVICIO";
                    cbxSerivioc.SelectedValuePath = "ID";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:\n" + ex.TargetSite + "\n" + ex.Message.ToString());
            }
        }
        private void CargarBoleta(DataRow dataRow)
        {
            CargarTablaDetalle();
            int                idBoleta           = int.Parse(dataRow["ID"].ToString());
            VentasDAL          ventas             = new VentasDAL();
            AnulacionVentasDAL anulacionVentasDAL = new AnulacionVentasDAL();

            datosDocumentoPagoVIEW = ventas.CargarDatos(idBoleta);
            VENTAS       datoVenta    = ventas.ObtenerVentaId(idBoleta);
            SucursalNEG  sucursalNEG  = new SucursalNEG();
            EmpleadosNEG empleadosNEG = new EmpleadosNEG();

            txtCliente.Text  = datosDocumentoPagoVIEW.NOMBRE_CLIENTE + " " + datosDocumentoPagoVIEW.APELLIDO_CLIENTE;
            txtSucursal.Text = sucursalNEG.CargarSucursal(datoVenta.SUCURSAL_ID).NOMBRE;
            txtEmpleado.Text = empleadosNEG.CargarEmpleado(datoVenta.EMPLEADO_ID).NOMBRE + " " + empleadosNEG.CargarEmpleado(datoVenta.EMPLEADO_ID).APELLIDO;
            dpkFechaCreacion.SelectedDate = datoVenta.FECHA_VENTA;
            string folio = idBoleta.ToString();

            for (int i = 0; i < 9; i++)
            {
                if (folio.Length < 8)
                {
                    folio = "0" + folio;
                }
            }

            txtFolio.Text         = folio;
            txtTipoDocumento.Text = datosDocumentoPagoVIEW.TIPO_DOCUMENTO;
            txtestadoVenta.Text   = anulacionVentasDAL.ValidaEstadoVenta(idBoleta);
            txtMoneda.Text        = datosDocumentoPagoVIEW.TIPO_MONEDA;
            double neto = Convert.ToDouble(datosDocumentoPagoVIEW.TOTAL) / 1.19;

            txtNeto.Text = string.Format("{0:n2}", (neto));
            double iva = neto * 0.19;

            txtIva.Text         = string.Format("{0:n2}", iva);
            txtTotal.Text       = string.Format("{0:n2}", (Convert.ToDouble(datosDocumentoPagoVIEW.TOTAL)));
            txtTotalMoneda.Text = string.Format("{0:n2}", (datosDocumentoPagoVIEW.TOTAL * datosDocumentoPagoVIEW.COSTO_MONEDA));
            //ORDEN DE TRABAJO N°"
            List <DETALLE_VENTAS> listaDetalles = ventas.ListarDetalleVenta(idBoleta);

            foreach (var x in listaDetalles)
            {
                if (x.SERVICIO_ID == 1 && x.PRODUCTO_ID == 1)
                {//OT
                    string    idOrden = x.NOMBRE_PRODUCTO.Split('°')[1];
                    DataTable tabla   = ((DataView)dgDetalleDocumento.ItemsSource).ToTable();
                    DataRow   fila    = tabla.NewRow();
                    fila["CANTIDAD"]    = 1;
                    fila["TIPO ITEM"]   = "OT";
                    fila["ID ITEM"]     = idOrden;
                    fila["NOMBRE ITEM"] = x.NOMBRE_PRODUCTO;
                    fila["P UNITARIO"]  = x.PRECIO_VENTA;
                    fila["TOTAL"]       = x.PRECIO_VENTA;
                    tabla.Rows.Add(fila);
                    dgDetalleDocumento.ItemsSource = tabla.DefaultView;
                }
                else if (x.PRODUCTO_ID == 1 && x.SERVICIO_ID > 1)
                {//serv
                    DataTable tabla = ((DataView)dgDetalleDocumento.ItemsSource).ToTable();
                    DataRow   fila  = tabla.NewRow();
                    fila["CANTIDAD"]    = 1;
                    fila["TIPO ITEM"]   = "SER";
                    fila["ID ITEM"]     = x.SERVICIO_ID;
                    fila["NOMBRE ITEM"] = x.NOMBRE_PRODUCTO;
                    fila["P UNITARIO"]  = x.PRECIO_VENTA;
                    fila["TOTAL"]       = x.MONTO_TOTAL;
                    tabla.Rows.Add(fila);
                    dgDetalleDocumento.ItemsSource = tabla.DefaultView;
                }
                else if (x.PRODUCTO_ID > 1 && x.SERVICIO_ID == 1)
                {//prod
                    DataTable tabla = ((DataView)dgDetalleDocumento.ItemsSource).ToTable();
                    DataRow   fila  = tabla.NewRow();
                    fila["CANTIDAD"]    = x.CANTIDAD;
                    fila["TIPO ITEM"]   = "PRO";
                    fila["ID ITEM"]     = x.PRODUCTO_ID;
                    fila["NOMBRE ITEM"] = x.NOMBRE_PRODUCTO;
                    fila["P UNITARIO"]  = x.PRECIO_VENTA;
                    fila["TOTAL"]       = x.MONTO_TOTAL;
                    tabla.Rows.Add(fila);
                    dgDetalleDocumento.ItemsSource = tabla.DefaultView;
                }
            }
        }