Quantcast
Channel: Problema con el precio
Viewing all articles
Browse latest Browse all 3

Problema con el precio

$
0
0

hola muy buenas tardes tengo un problema se podría decir

les explico a la hora de ingresar datos con su cantidad y su precio. por ejemplo 75 cantidad, el precio 1000 = a 7500000 

pero cuando guardo ese registro en el precio me sale asi 999.99 

la cantidad esta como int, en la base y el precio en decimal 5,2

decimal Precio, Total;
                    int Cantidad;
                    dgv_ingresa.Rows.Add();
                    int Index = dgv_ingresa.Rows.Count - 1;
                    dgv_ingresa.Rows[Index].Cells[0].Value = txt_usuario.Text;
                    dgv_ingresa.Rows[Index].Cells[1].Value = string.Format("{0} / {1}", txt_empresa.Text, txt_contacto.Text);
                    dgv_ingresa.Rows[Index].Cells[2].Value = dtp_ingreso.Value;
                    dgv_ingresa.Rows[Index].Cells[3].Value = txt_producto.Text;
                    dgv_ingresa.Rows[Index].Cells[4].Value = txt_cantidad.Text;
                    dgv_ingresa.Rows[Index].Cells[5].Value = txt_precio.Text;
                    dgv_ingresa.Rows[Index].Cells[7].Value = dtp_vencimiento.Value;
                    dgv_ingresa.Rows[Index].Cells[8].Value = txt_codigo_usuario.Text;
                    dgv_ingresa.Rows[Index].Cells[9].Value = txt_codigo_producto.Text;
                    dgv_ingresa.Rows[Index].Cells[10].Value = txt_codigo_proveedor.Text;
                    Cantidad = Convert.ToInt32(txt_cantidad.Text);
                    Precio = Convert.ToDecimal(txt_precio.Text);
                    Total = Cantidad * Precio;
                    dgv_ingresa.Rows[Index].Cells[6].Value = Total.ToString();
                    btn_aplicar.Enabled = true;
                    Limpiar();
                    UpdateIngreso();

aquí se hace el calculo. 

    private void btn_aplicar_Click(object sender, EventArgs e)
        {
            try
            {
                for (int i = 0; i < dgv_ingresa.Rows.Count; i++)
                {
                    Modelo_Ingreso MDI = new Modelo_Ingreso();
                    MDI.IdUsuario = Convert.ToInt32(dgv_ingresa.Rows[i].Cells[8].Value);
                    MDI.IdProveedor = Convert.ToInt32(dgv_ingresa.Rows[i].Cells[10].Value);
                    MDI.FechaIngreso = Convert.ToDateTime(dgv_ingresa.Rows[i].Cells[2].Value);
                    _Id_Ingreso = BLI.InsertIngreso(MDI);


                    MTI.IdProducto = Convert.ToInt32(dgv_ingresa.Rows[i].Cells[9].Value);
                    MTI.IdIngreso = _Id_Ingreso;
                    MTI.Cantidad = Convert.ToInt32(dgv_ingresa.Rows[i].Cells[4].Value);
                    MTI.Precio = Convert.ToDecimal(dgv_ingresa.Rows[i].Cells[5].Value);
                    MTI.Vencimiento = Convert.ToDateTime(dgv_ingresa.Rows[i].Cells[7].Value);
                    BTI.InsertDetalleIngreso(MTI);
                    Ocutar();
                    Limpiar();
                }
                dgv_ingresa.Rows.Clear();

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally { }
        }

y aqui lo inserto


Viewing all articles
Browse latest Browse all 3


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>