Exemplo n.º 1
0
        private void MostrarProductos()
        {
            NOrden Persona = new NOrden();

            DTVDetalle.Columns.Clear();
            DTVDetalle.DataSource = Persona.DetalleOrden(Convert.ToInt32(ClienteCache.IDENTIFICACION), DocumentoCache.ID);
        }
Exemplo n.º 2
0
        private void dataListado_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == dataListado.Columns["EliminarServicio"].Index)
            {
                DialogResult Opcion;
                Opcion = MessageBox.Show("Realmente desea Eliminar El Registro", "Sistema de Ventas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (Opcion == DialogResult.OK)
                {
                    String Codigo;
                    String Rpta = "";

                    Codigo = Convert.ToString(this.dataListado.CurrentRow.Cells["id"].Value);
                    NDetalleEquipo.Eliminar(Convert.ToInt32(Codigo));
                    NDetalleRepuesto.Eliminar(Convert.ToInt32(Codigo));
                    NDetalleTrabajo.Eliminar(Convert.ToInt32(Codigo));
                    Rpta = NOrden.Eliminar(Convert.ToInt32(Codigo));


                    if (Rpta.Equals("OK"))
                    {
                        this.MensajeOk("Se ELimino Correctamente el Registro");
                    }
                    else
                    {
                        this.MensajeError(Rpta);
                    }

                    this.Mostrar();
                }
            }
            else
            {
                if (e.ColumnIndex == dataListado.Columns["EditarServicio"].Index)
                {
                    this.txtIdOrden.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["idOrden"].Value);
                    // this.txtFecha.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["fecha"].Value);
                    // this.txtPrecio.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["precio"].Value);
                    this.txtCliente.Text  = Convert.ToString(this.dataListado.CurrentRow.Cells["cliente_nombre"].Value);
                    this.txtEmpleado.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["empleado_nombre"].Value);
                    this.txtTecnico.Text  = Convert.ToString(this.dataListado.CurrentRow.Cells["tecnico_nombre"].Value);
                    this.crearTablas();
                    this.buscarDetalles();
                    this.ordenarDetalle();
                    usar = true;
                    this.pListas.Visible   = false;
                    this.IsEditar          = true;
                    this.IsNuevo           = false;
                    this.pRegistro.Visible = true;
                    this.txtFecha.Focus();
                    this.cargarComboTecnico();
                    this.cargarComboCliente();
                    this.cargarComboEmpleado();
                    this.sumarMontoTotal();
                }
            }
        }
Exemplo n.º 3
0
 private void Btngrabar_Click(object sender, EventArgs e)
 {
     if (Cont != 0)
     {
         if (string.IsNullOrEmpty(Txtdireccion.Text))
         {
             MessageBox.Show("Debe asociar una dirección de entrega");
         }
         else
         {
             NOrden Orden     = new NOrden();
             int    NumFila   = 0;
             int    Prioridad = 0;
             if (TotalO <= 500)
             {
                 Prioridad = 0;
             }
             if (500 < TotalO && TotalO <= 1000)
             {
                 Prioridad = 1;
             }
             if (TotalO > 1000)
             {
                 Prioridad = 2;
             }
             try
             {
                 Orden.InserOrder(ClienteCache.IDENTIFICACION, Txtdireccion.Text, Prioridad, TotalO);
                 foreach (DataGridViewRow Fila in DTVDetalle.Rows)
                 {
                     try
                     {
                         Orden.InsertarDetalle(DocumentoCache.NumOdr, DTVDetalle.Rows[NumFila].Cells[0].Value.ToString(), Convert.ToInt32(DTVDetalle.Rows[NumFila].Cells[2].Value), Convert.ToDouble(DTVDetalle.Rows[NumFila].Cells[3].Value), Convert.ToDouble(DTVDetalle.Rows[NumFila].Cells[4].Value));
                         NumFila++;
                     }
                     catch (Exception Error)
                     {
                         MessageBox.Show("Error" + Error);
                     }
                 }
                 MessageBox.Show("Registros grabados correctamente");
                 DTVDetalle.Rows.Clear();
             }
             catch (Exception error)
             {
                 MessageBox.Show("ERROR INESPERADO" + error);
             }
         }
     }
 }
Exemplo n.º 4
0
        private void MostrarPersona()
        {
            NOrden Persona = new NOrden();

            DTVDcumentos.DataSource = Persona.Mostrar(Convert.ToInt32(Txtcliente.Text));
        }
Exemplo n.º 5
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string rpta           = "";
                int    cantidad       = 0;
                float  precioUnitario = 0;
                if (this.txtEmpleado.Text == string.Empty && this.txtCliente.Text == string.Empty)
                {
                    MensajeError("Falta ingresar Algunos Datos, seran Remarcados");
                    errorIcono.SetError(this.txtEmpleado, "Ingrese Nombre del Empleado");
                    errorIcono.SetError(this.txtCliente, "Ingrese Nombre del Cliente");
                }
                else
                {
                    if (this.IsNuevo)
                    {
                        rpta = NOrden.Insertar(Convert.ToDateTime(txtFecha.Text), Convert.ToSingle(txtTotal.Text),
                                               Convert.ToInt32(txtEmpleado.Value), Convert.ToInt32(txtCliente.Value), Convert.ToInt32(txtTecnico.Value));
                        ///detalle
                        for (int i = 0; i < detalleEquipo.RowCount; i++)
                        {
                            NDetalleEquipo.Insertar(Convert.ToInt32(detalleEquipo.Rows[i].Cells["id"].Value));
                        }
                        ///detalle
                        for (int i = 0; i < detalleTrabajo.RowCount; i++)
                        {
                            NDetalleTrabajo.Insertar(Convert.ToInt32(detalleTrabajo.Rows[i].Cells["id"].Value));
                        }
                        ///detalle Repuestp
                        for (int i = 0; i < detalleRepuesto.RowCount; i++)
                        {
                            cantidad       = Convert.ToInt32(detalleRepuesto.Rows[i].Cells["Cantidad"].Value);
                            precioUnitario = Convert.ToSingle(detalleRepuesto.Rows[i].Cells["Precio"].Value);
                            NDetalleRepuesto.Insertar(cantidad, precioUnitario, Convert.ToInt32(detalleRepuesto.Rows[i].Cells["id"].Value));
                        }
                    }
                    else
                    {
                        rpta = NVenta.Editar(Convert.ToInt32(txtIdOrden.Text), Convert.ToDateTime(txtFecha.Text), Convert.ToSingle(txtTotal.Text), Convert.ToInt32(txtCliente.Value), Convert.ToInt32(txtEmpleado.Value));
                        NDetalleEquipo.Eliminar(Convert.ToInt32(this.txtIdOrden.Text));
                        NDetalleTrabajo.Eliminar(Convert.ToInt32(this.txtIdOrden.Text));
                        NDetalleRepuesto.Eliminar(Convert.ToInt32(this.txtIdOrden.Text));
                        ///detalle
                        for (int i = 0; i < detalleEquipo.RowCount; i++)
                        {
                            NDetalleEquipo.Editar(Convert.ToInt32(detalleEquipo.Rows[i].Cells["id"].Value), Convert.ToInt32(txtIdOrden.Text));
                        }
                        ///detalle
                        for (int i = 0; i < detalleTrabajo.RowCount; i++)
                        {
                            NDetalleTrabajo.Editar(Convert.ToInt32(detalleTrabajo.Rows[i].Cells["id"].Value), Convert.ToInt32(txtIdOrden.Text));
                        }
                        ///detalle
                        for (int i = 0; i < detalleRepuesto.RowCount; i++)
                        {
                            cantidad       = Convert.ToInt32(detalleRepuesto.Rows[i].Cells["Cantidad"].Value);
                            precioUnitario = Convert.ToSingle(detalleRepuesto.Rows[i].Cells["Precio"].Value);
                            NDetalleRepuesto.Editar(cantidad, precioUnitario, Convert.ToInt32(detalleRepuesto.Rows[i].Cells["id"].Value), Convert.ToInt32(txtIdOrden.Text));
                        }


                        if (rpta.Equals("OK"))
                        {
                            if (this.IsNuevo)
                            {
                                this.MensajeOk("Se inserto Correctamente El Registro");
                            }
                            else
                            {
                                this.MensajeOk("Se Actualizo Correctamente El Registro");
                            }
                        }
                        else
                        {
                            this.MensajeError(rpta);
                        }
                        this.IsNuevo  = false;
                        this.IsEditar = false;
                        this.Limpiar();
                        this.usar = false;
                        this.pRegistro.Visible = false;
                        this.pListas.Visible   = true;
                        this.Mostrar();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Exemplo n.º 6
0
 private void Mostrar()
 {
     this.dataListado.DataSource = NOrden.Mostrar();
     this.OcultarColumnas();
     lblTotal.Text = "Total de Registro: " + Convert.ToString(dataListado.Rows.Count);
 }
Exemplo n.º 7
0
        private void Btnagregar_Click(object sender, EventArgs e)
        {
            NOrden Producto = new NOrden();
            string Nombre   = Producto.NombreProducto(Txtcodigo.Text);

            if (string.IsNullOrEmpty(Nombre) && string.IsNullOrEmpty(Txtnombre.Text))
            {
                MessageBox.Show("Debe suministrar un nombre para crear el producto");
            }
            else
            {
                bool Existe  = false;
                int  NumFila = 0;
                if (Cont == 0)
                {
                    if (string.IsNullOrEmpty(Nombre))
                    {
                        Nombre = Txtnombre.Text;
                    }
                    DTVDetalle.Rows.Add(Txtcodigo.Text, Nombre, Txtcantidad.Text, Txtvalor.Text);
                    double Total = Convert.ToDouble(DTVDetalle.Rows[Cont].Cells[2].Value) * Convert.ToDouble(DTVDetalle.Rows[Cont].Cells[3].Value);
                    DTVDetalle.Rows[Cont].Cells[4].Value = Total;
                    Cont++;
                    Txtcodigo.Clear();
                    Txtnombre.Clear();
                    Txtcantidad.Clear();
                    Txtvalor.Clear();
                }
                else
                {
                    foreach (DataGridViewRow Fila in DTVDetalle.Rows)
                    {
                        if (Fila.Cells[0].Value.ToString() == Txtcodigo.Text)
                        {
                            Existe  = true;
                            NumFila = Fila.Index;
                        }
                    }
                    if (Existe == true)
                    {
                        DTVDetalle.Rows[NumFila].Cells[2].Value = (Convert.ToDouble(Txtcantidad.Text) + Convert.ToDouble(DTVDetalle.Rows[NumFila].Cells[2].Value)).ToString();
                        DTVDetalle.Rows[NumFila].Cells[3].Value = (Convert.ToDouble(Txtvalor.Text) + Convert.ToDouble(DTVDetalle.Rows[NumFila].Cells[3].Value)).ToString();
                        double Total = Convert.ToDouble(DTVDetalle.Rows[NumFila].Cells[2].Value) * Convert.ToDouble(DTVDetalle.Rows[NumFila].Cells[3].Value);
                        DTVDetalle.Rows[NumFila].Cells[4].Value = Total;
                        Txtcodigo.Clear();
                        Txtnombre.Clear();
                        Txtcantidad.Clear();
                        Txtvalor.Clear();
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(Nombre))
                        {
                            Nombre = Txtnombre.Text;
                        }
                        DTVDetalle.Rows.Add(Txtcodigo.Text, Nombre, Txtcantidad.Text, Txtvalor.Text);
                        double Total = Convert.ToDouble(DTVDetalle.Rows[Cont].Cells[2].Value) * Convert.ToDouble(DTVDetalle.Rows[Cont].Cells[3].Value);
                        DTVDetalle.Rows[Cont].Cells[4].Value = Total;
                        Cont++;
                        Txtcodigo.Clear();
                        Txtnombre.Clear();
                        Txtcantidad.Clear();
                        Txtvalor.Clear();
                    }
                }
                TotalO = 0;
                foreach (DataGridViewRow Fila in DTVDetalle.Rows)
                {
                    TotalO += Convert.ToDouble(Fila.Cells[4].Value);
                }
                Lbltotal.Text = TotalO.ToString();
                Txtcodigo.Focus();
            }
        }