public void llenarRadGridView3() { this.radGridView3.MasterTemplate.Rows.Clear(); GridView = new rowGridView[radGridView1.Rows.Count]; for (int i = 0; i < radGridView1.Rows.Count; i++) { radGridView3.Rows.AddNew(); int f = radGridView3.Rows.Count; GridView[f - 1] = new rowGridView(); GridView[f - 1].Cells0 = this.radGridView1.Rows[f - 1].Cells[0].Value + ""; this.radGridView3.Rows[f - 1].Cells[0].Value = this.radGridView1.Rows[f - 1].Cells[0].Value; GridView[f - 1].Cells1 = this.radGridView1.Rows[f - 1].Cells[1].Value + ""; this.radGridView3.Rows[f - 1].Cells[1].Value = this.radGridView1.Rows[f - 1].Cells[1].Value; //Subtotal GridView[f - 1].Cells2 = this.radGridView1.Rows[f - 1].Cells[3].Value + ""; this.radGridView3.Rows[f - 1].Cells[2].Value = this.radGridView1.Rows[f - 1].Cells[2].Value; // GridView[f - 1].Cells3 = this.radGridView1.Rows[f - 1].Cells[2].Value + ""; this.radGridView3.Rows[f - 1].Cells[3].Value = this.radGridView1.Rows[f - 1].Cells[3].Value; GridView[f - 1].Cells24 = this.radGridView1.Rows[f - 1].Cells[4].Value + ""; this.radGridView3.Rows[f - 1].Cells[4].Value = this.radGridView1.Rows[f - 1].Cells[4].Value; GridView[f - 1].Cells25 = this.radGridView1.Rows[f - 1].Cells[5].Value + ""; this.radGridView3.Rows[f - 1].Cells[5].Value = this.radGridView1.Rows[f - 1].Cells[5].Value; calcularTotal2(); } }
public void ObtenerTodos() { detalleborrador detalle = new detalleborrador(listSucursal.SelectedValue.ToString()); int filas = radGridView3.Rows.Count; rowGridView grid = new rowGridView(); DataTable todos = new DataTable(); String ids; opcionesdb opcion = new opcionesdb(); String NomTabla = "DetalleVenta"; Hashtable crit = new Hashtable(); Hashtable reg = new Hashtable(); //Obtener Id de Venta // int fila = System.Convert.ToInt32(radGridView1.MasterGridViewInfo.CurrentIndex.ToString()); // String id = radGridView1.Rows[fila].Cells[0].Value.ToString(); //MessageBox.Show(id); //obtenerdetalle //Lineas con detalles especificos por metodo. reg.Add("CodigoBarra", "CodigoBarra"); reg.Add("Correlativo", "Correlativo"); reg.Add("PrecioReal", "PrecioReal"); reg.Add("PrecioVenta", "PrecioVenta"); for (int f = 0; f < filas; f++) { ids = radGridView3.Rows[f].Cells[0].Value.ToString(); crit.Add("NVenta", ids); DataTable tabla = opcion.BuscarRegistro(NomTabla, crit, reg); todos = tabla.Clone(); for (int a = 0; a < tabla.Rows.Count; a++) { todos.ImportRow(tabla.Rows[a]); } detalle.llenarDetalle(todos); tabla.Clear(); crit.Clear(); } detalle.HabilitarFact(); detalle.Show(); }
public void obtenerPrecio(double Ocosto) { DataTable tabe = new DataTable(); tabe = op.ObtenerTodasTuplas("TipoPrecio"); DataRow row2; rowGridView[] precios = new rowGridView[tabe.Rows.Count]; for (int x = 0; x < tabe.Rows.Count; x++) { row2 = tabe.Rows[x]; precios[x] = new rowGridView(); precios[x].Cells0 = row2["TipoPrecio"] + ""; // precios[x].Cells1 = Ocosto + (System.Convert.ToDouble(row2["Formula"]) / 100) * Ocosto + ""; precios[x].Cells1 = Decimal.Round(System.Convert.ToDecimal((Ocosto * (1.13)) / (System.Convert.ToDouble(1) - (System.Convert.ToDouble(row2["Formula"]) / 100))), 2) + ""; // row2 = tabe.Rows[x]; // if (x == 0) // { // Costo + (System.Convert.ToDouble(row2["Formula"]) / 100) * Costo)); // "Maximo"); // } // else if (x == 1) // { // crity.Add("Gravado", (Costo + (System.Convert.ToDouble(row2["Formula"]) / 100) * Costo)); // crity.Add("TipoPrecio", "Minimo"); // } // else if (x == 2) // { // crity.Add("Gravado", (Costo + (System.Convert.ToDouble(row2["Formula"]) / 100) * Costo)); // crity.Add("TipoPrecio", "Normal"); // } } Filasprecios1 = precios; }
private void btnRegistrar_Click(object sender, EventArgs e) { Hashtable[] vistaCompra = new Hashtable[1]; if (validar()) { compra compr = new compra(); // proveedor prov = new proveedor(radDropDownList1.SelectedItem.Value.ToString(), radDropDownList1.SelectedItem.DisplayValue.ToString()); sucursal[] arraySucursales = new sucursal[1]; arraySucursales[0] = new sucursal(radDropDownList2.SelectedItem.Value.ToString(), radDropDownList2.SelectedItem.DisplayValue.ToString()); // arraySucursales[0].Codigosucursal = radDropDownList2.SelectedItem.Value.ToString(); // arraySucursales[0].Nombre = radDropDownList2.SelectedItem.DisplayValue.ToString(); proveedor[] arrayProveedores = new proveedor[1]; arrayProveedores[0] = new proveedor(radDropDownList1.SelectedItem.Value.ToString(), radDropDownList1.SelectedItem.DisplayValue.ToString()); // arrayProveedores[0].CodigoProveedor = radDropDownList1.SelectedItem.Value.ToString(); // arrayProveedores[0].Nombre = radDropDownList1.SelectedItem.DisplayValue.ToString(); compr.Sucursal = arraySucursales; compr.Proveedor = arrayProveedores; compr.NDoc1 = txtNumDoc.Text; int f = 0; for (int t = 0; t < radGridView1.Rows.Count; t++) { f = f + System.Convert.ToInt32(this.radGridView1.Rows[t].Cells[3].Value); } inventario[] inventar = new inventario[radGridView1.Rows.Count]; int cantidad = 0; // MessageBox.Show("variable radGridView1.Rows.Count = " + radGridView1.Rows.Count); for (int t = 0; t < radGridView1.Rows.Count; t++) { cantidad = System.Convert.ToInt32(this.radGridView1.Rows[t].Cells[3].Value); producto[] arrayProduc = new producto[cantidad]; // MessageBox.Show("variable cantidad = " + cantidad); for (int i = 0; i < cantidad; i++) { // MessageBox.Show("variable i = " + i + " variable t = " + t); arrayProduc[i] = new producto(this.radGridView1.Rows[t].Cells[0].Value + "", this.radGridView1.Rows[t].Cells[1].Value + ""); arrayProduc[i].CodigoBarra = this.radGridView1.Rows[t].Cells[0].Value + ""; arrayProduc[i].Nombre = this.radGridView1.Rows[t].Cells[1].Value + ""; } //inventario invet = new inventario(); //invet.Producto = arrayProduc inventar[t] = new inventario(); inventar[t].Producto = arrayProduc; // precio preci = new precio(); // preci.Monto = System.Convert.ToDouble(this.radGridView1.Rows[t].Cells[2].Value); // invet.Costo = System.Convert.ToDouble(this.radGridView1.Rows[t].Cells[2].Value); inventar[t].Costo = System.Convert.ToDouble(this.radGridView1.Rows[t].Cells[2].Value); fila = new rowGridView[cantidadTiposPrecios]; for (int i = 0; i < cantidadTiposPrecios; i++) { fila[i] = new rowGridView(); fila[i].Cells0 = radGridView2.Rows[i].Cells[0].Value + ""; } int numColumnas = this.radGridView1.Columns.Count; for (int tr = 0; tr < numColumnas - 4; tr++) { fila[tr].Cells1 = radGridView1.Rows[t].Cells[4 + tr].Value + ""; // f = f + System.Convert.ToInt32(this.radGridView1.Rows[t].Cells[4+tr].Value); } inventar[t].Filasprecios1 = fila; } compr.Productos = inventar; String fech = Convert.ToString(radDateTimePicker1.Value); compr.Fecha = radDateTimePicker1.Value; // compr.Fecha = fech.Substring(0, 10); compr.calcularTotal(); compr.registrarCompra(); this.radGridView1.MasterTemplate.Rows.Clear(); labelMsjExito.Text = "Venta registrada exitosamente."; //Limpiar los texbox. txtCosto.Text = ""; radTextBox3.Text = ""; //txtCantidad.Text = ""; radTextBox1.Text = ""; txtTotal.Text = ""; radTextBox1.Focus(); vistaCompra = compr.VistaCompra; vistaPreviaCompras vista = new vistaPreviaCompras(vistaCompra); vista.Show(); } else { MessageBox.Show("Verifique que todos los campos obligatorios esten llenados."); } }