コード例 #1
0
        /// <summary>
        /// Metodo encargado de llenar la clase y el detalle
        /// </summary>
        /// <returns></returns>
        private Ventas LLenaClase()
        {
            Ventas pro = new Ventas();

            pro.VentasId  = (int)VentasIdNumericUpDown.Value;
            pro.ClienteId = Convert.ToInt32(ClienteComboBox.SelectedIndex);
            // pro.TipoPago = TipoPagoTextBox.Text;
            pro.TipoPago      = TipoUsuariocomboBox.Text;
            pro.ItebisVenta   = Convert.ToDecimal(ItebisTextBox.Text);
            pro.SubTotalVenta = Convert.ToDecimal(SubTotalTextBox.Text);
            pro.CostoVenta    = Convert.ToDecimal(TotalTextBox.Text);
            foreach (DataGridViewRow item in ventaDataGridView.Rows)
            {
                pro.AgregarDetalle(
                    ToInt(item.Cells["VentaDetalleId"].Value),
                    ToInt(item.Cells["VentaId"].Value),
                    ToInt(item.Cells["ProductoId"].Value),
                    ToInt(item.Cells["ClienteId"].Value),
                    ToInt(item.Cells["Cantidad"].Value),
                    ToInt(item.Cells["Precio"].Value),
                    ToInt(item.Cells["Descuento"].Value),
                    ToInt(item.Cells["Total"].Value));
                ventaDataGridView.Columns["VentaDetalleId"].Visible = false;
                ventaDataGridView.Columns["VentaId"].Visible        = false;
                ventaDataGridView.Columns["ProductoId"].Visible     = false;
                ventaDataGridView.Columns["ClienteId"].Visible      = false;
            }

            return(pro);
        }
コード例 #2
0
        private Ventas LlenaClase()
        {
            Ventas venta = new Ventas();

            venta.VentaId   = Convert.ToInt32(IdNumericUpDown.Value);
            venta.ClienteId = Convert.ToInt32(ClienteComboBox.SelectedValue);
            venta.Fecha     = FechaDateTimePicker.Value;
            venta.SubTotal  = Convert.ToDecimal(SubTotalTextBox.Text);
            venta.ITBIS     = Convert.ToDecimal(ItbisTextBox.Text);
            venta.Total     = Convert.ToDecimal(TotalTextBox.Text);

            foreach (DataGridViewRow item in FacturaDetalleDataGridView.Rows)
            {
                venta.AgregarDetalle(
                    ToInt(item.Cells["Id"].Value),
                    ToInt(item.Cells["VentaId"].Value),
                    ToInt(item.Cells["ProductoId"].Value),
                    item.Cells["Descripcion"].Value.ToString(),
                    ToDecimal(item.Cells["Cantidad"].Value),
                    ToDecimal(item.Cells["Precio"].Value),
                    ToDecimal(item.Cells["Importe"].Value)
                    );
            }

            FacturaDetalleDataGridView.Columns["Id"].Visible      = false;
            FacturaDetalleDataGridView.Columns["VentaId"].Visible = false;

            return(venta);
        }
コード例 #3
0
        private Ventas LlenaClase()
        {
            Ventas ventas = new Ventas();

            ventas.VentaId         = Convert.ToInt32(VentaIdNumericUpDown.Value);
            ventas.Fecha           = FechaVentaDateTimePicker.Value;
            ventas.Descripcion     = DescripcionTextBox.Text;
            ventas.UsuarioId       = Convert.ToInt32(UsuariosComboBox.SelectedValue);
            ventas.NombreCliente   = NombreClienteTextBox.Text;
            ventas.TelefonoCliente = TelefonomaskedTextBox.Text;
            ventas.SubTotal        = Convert.ToDecimal(SubTotalTextBox.Text);
            ventas.Itbis           = Convert.ToDecimal(ItbisTextBox.Text);
            ventas.Total           = Convert.ToDecimal(TotalTextBox.Text);

            foreach (DataGridViewRow item in VentaDetalleDataGridView.Rows)
            {
                ventas.AgregarDetalle
                    (ToInt(item.Cells["VDetalleId"].Value),
                    ventas.VentaId,
                    ToInt(item.Cells["productoId"].Value),
                    Convert.ToString(item.Cells["producto"].Value),
                    ToInt(item.Cells["Cantidad"].Value),
                    ToInt(item.Cells["Precio"].Value),
                    ToInt(item.Cells["Importe"].Value));
            }
            return(ventas);
        }