private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { List <Form> OpenForms = new List <Form>(); ventas ventas = new ventas(); Cotizaciones cot = new Cotizaciones(); foreach (Form frm in Application.OpenForms) { if (frm.Name == "ventas") { ventas = (ventas)frm; ventas.txtProducto.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString(); ventas.txtDescripcion.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString(); // ventas.txtPallet.Text = dataGridView1.CurrentRow.Cells[7].Value.ToString(); ventas.textBox5.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString(); ventas.textBox4.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString(); ventas.txtPrecio.Text = dataGridView1.CurrentRow.Cells[4].Value.ToString(); ventas.cantidad.Text = dataGridView1.CurrentRow.Cells[5].Value.ToString(); ventas.txtUniMedAduana.Text = dataGridView1.CurrentRow.Cells[6].Value.ToString(); ventas.txtSAT.Text = dataGridView1.CurrentRow.Cells[7].Value.ToString(); ventas.txtAduana.Text = dataGridView1.CurrentRow.Cells[8].Value.ToString(); ventas.txtFraccion.Text = dataGridView1.CurrentRow.Cells[10].Value.ToString(); ventas.txtMedida.Text = dataGridView1.CurrentRow.Cells[9].Value.ToString(); this.Close(); break; } else if (frm.Name == "Cotizaciones") { cot = (Cotizaciones)frm; cot.txtProducto.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString(); cot.txtDescripcion.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString(); cot.txtMedida.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString(); //cot.txtPallet.Text = dataGridView1.CurrentRow.Cells[7].Value.ToString(); cot.txtTam.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString(); cot.txtPrecio.Text = dataGridView1.CurrentRow.Cells[4].Value.ToString(); cot.txtCan.Text = dataGridView1.CurrentRow.Cells[5].Value.ToString(); this.Close(); break; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button1_Click(object sender, EventArgs e) { if (cotizaciones == null) { cotizaciones = new Cotizaciones(); cotizaciones.Owner = this; cotizaciones.FormClosed += ventas_FormClosed; cotizaciones.Date.Value = DateTime.Today; cotizaciones.Expiration.Value = DateTime.Today; cotizaciones.Show(); } else { cotizaciones.Activate(); } }
private void button1_Click(object sender, EventArgs e) { ventas inf = new ventas(); compras com = new compras(); Cotizaciones coti = new Cotizaciones(); if (dataGridView1.SelectedRows.Count > 0) { if (cmdReporte.Text.Equals("Ventas")) { inf.txtFolio.Text = dataGridView1.CurrentRow.Cells["Id"].Value.ToString(); inf.dateTimePicker1.Text = dataGridView1.CurrentRow.Cells["date"].Value.ToString(); inf.txtIva.Text = dataGridView1.CurrentRow.Cells["iva"].Value.ToString(); inf.txtNumCliente.Text = dataGridView1.CurrentRow.Cells["num"].Value.ToString(); //inf.txtCajasContenido.Text = dataGridView1.CurrentRow.Cells["cajas"].Value.ToString(); inf.comboBox3.Text = dataGridView1.CurrentRow.Cells["nombreP"].Value.ToString(); inf.comboMoneda.Text = dataGridView1.CurrentRow.Cells["currency"].Value.ToString(); inf.txtCondiciones.Text = dataGridView1.CurrentRow.Cells["cond"].Value.ToString(); inf.txtLugarExpe.Text = dataGridView1.CurrentRow.Cells["lugar"].Value.ToString(); inf.txtSubtotal.Text = dataGridView1.CurrentRow.Cells["subtotal"].Value.ToString(); inf.txtTotal.Text = dataGridView1.CurrentRow.Cells["total"].Value.ToString(); //inf.txtCajasContenido.Text = dataGridView1.CurrentRow.Cells[""].Value.ToString(); inf.dateTimePicker1.Enabled = false; inf.txtIva.Enabled = false; //inf.txtCajasContenido.Enabled = false; inf.comboBox3.Enabled = false; inf.txtLugarExpe.Enabled = false; inf.txtCondiciones.Enabled = false; inf.comboMoneda.Enabled = false; inf.txtPallet.Enabled = false; inf.txtCantidad.Enabled = false; inf.cantidad.Text = "0"; inf.button2.Visible = false; inf.btnArticulo.Visible = false; inf.btnMostrar.Visible = true; inf.button4.Visible = false; inf.btnAgregarProd.Visible = false; inf.btnEliminar.Visible = false; inf.btnMostrar.Visible = false; //inf.txtFolio.Visible = false; inf.dataGridView1.Visible = false; inf.dataGridView2.Visible = true; inf.textBox3.Enabled = false; inf.ShowDialog(); } else if (cmdReporte.Text.Equals("Compras")) { com.txtFolioCompra.Text = dataGridView1.CurrentRow.Cells["Id"].Value.ToString(); com.dateTimePicker1.Text = dataGridView1.CurrentRow.Cells["fecha"].Value.ToString(); //com.txtTipo.Text = dataGridView1.CurrentRow.Cells["tipo"].Value.ToString(); //com.txtName.Text = dataGridView1.CurrentRow.Cells["product"].Value.ToString(); //com.txtPrecioUnitario.Text = dataGridView1.CurrentRow.Cells["price"].Value.ToString(); com.prov.Text = dataGridView1.CurrentRow.Cells["provider"].Value.ToString(); com.txtNoPro.Text = dataGridView1.CurrentRow.Cells["numberP"].Value.ToString(); com.txtTot.Text = dataGridView1.CurrentRow.Cells["total"].Value.ToString(); //com.txtCantidad.Text = dataGridView1.CurrentRow.Cells["amountPurchased"].Value.ToString(); //com.txtTotalCompra.Text = dataGridView1.CurrentRow.Cells["total"].Value.ToString(); //com.txtDescripcion.Text = dataGridView1.CurrentRow.Cells["description"].Value.ToString(); com.dateTimePicker1.Enabled = false; com.txtTipo.Enabled = false; com.dataGridView1.Visible = false; com.dataGridView2.Visible = true; com.button2.Visible = false; com.prov.Enabled = false; com.txtTot.Enabled = false; com.txtPrecioUnitario.Enabled = false; com.txtName.Enabled = false; com.txtDescripcion.Enabled = false; com.btnGuardar.Visible = false; com.btrRegreso.Visible = false; com.button1.Visible = false; com.button3.Visible = false; com.ShowDialog(); } else if (cmdReporte.Text.Equals("Cotizaciones")) { coti.txtFolio.Text = dataGridView1.CurrentRow.Cells["Id"].Value.ToString(); coti.Date.Text = dataGridView1.CurrentRow.Cells["date"].Value.ToString(); coti.pallet.Text = dataGridView1.CurrentRow.Cells["pallet"].Value.ToString(); coti.Expiration.Text = dataGridView1.CurrentRow.Cells["expiration"].Value.ToString(); coti.IdClient.Text = dataGridView1.CurrentRow.Cells["idCliente"].Value.ToString(); coti.ico.Text = dataGridView1.CurrentRow.Cells["icoterm"].Value.ToString(); coti.Customer.Text = dataGridView1.CurrentRow.Cells["customerName"].Value.ToString(); coti.txtTotal.Text = dataGridView1.CurrentRow.Cells["total"].Value.ToString(); coti.txtSubtotal.Text = dataGridView1.CurrentRow.Cells["subtotal"].Value.ToString(); coti.divisa.Text = dataGridView1.CurrentRow.Cells["currency"].Value.ToString(); coti.txtIva.Text = dataGridView1.CurrentRow.Cells["IVA"].Value.ToString(); coti.place.Text = dataGridView1.CurrentRow.Cells["place"].Value.ToString(); coti.Condicion.Text = dataGridView1.CurrentRow.Cells["cond"].Value.ToString(); coti.textBox1.Text = dataGridView1.CurrentRow.Cells["producto"].Value.ToString(); coti.flete.Text = dataGridView1.CurrentRow.Cells["flete"].Value.ToString(); coti.txtCan.Text = "0"; coti.Date.Enabled = false; coti.pallet.Enabled = false; coti.place.Enabled = false; coti.textBox1.Enabled = false; coti.Expiration.Enabled = false; coti.ico.Enabled = false; coti.divisa.Enabled = false; coti.txtIva.Enabled = false; coti.Customer.Enabled = false; coti.Condicion.Enabled = false; coti.flete.Enabled = false; coti.txtPallet.Enabled = false; coti.txtMedida.Enabled = false; coti.btnArticulo.Visible = false; coti.btnAgregarProd.Visible = false; coti.btnEliminar.Visible = false; coti.button2.Visible = false; coti.button3.Visible = false; coti.button1.Visible = false; coti.button5.Visible = false; coti.TablaDeVenta.Visible = false; coti.dataGridView1.Visible = true; coti.ShowDialog(); } } else { MessageBox.Show("Seleccione una fila por favor"); } }