public void Facturar() { // MessageBox.Show(sucursal1); ven.generarNumeroVentas(); //lineas comun opcionesdb opcion = new opcionesdb(); String NomTabla = ""; Hashtable crit = new Hashtable(); Hashtable reg = new Hashtable(); //Modificar Venta agregar nueva factura NomTabla = "Ventas"; calcularutilidad(); // MessageBox.Show(Convert.ToString(ven.NVenta)); crit.Add("TipoVenta", "FACTURA"); crit.Add("Numero", Convert.ToString(ven.NVenta)); crit.Add("TotalReal", Convert.ToString(CalcularTotalReal()).Replace(",", ".")); crit.Add("TotalVenta", radTextBox2.Text.Replace(",", ".")); crit.Add("Fecha", fact.pasarfecha()); crit.Add("CodigoSucursal", sucursal1); crit.Add("Comentario", txtComentarios.Text); crit.Add("Gravado", Convert.ToString(CalcularTotalReal())); crit.Add("IVA", Convert.ToString(this.IvATotal()).Replace(",", ".")); crit.Add("PagoACuenta", Convert.ToString(this.PagoACTotal()).Replace(",", ".")); crit.Add("Renta", Convert.ToString(this.RentaFinal()).Replace(",", ".")); crit.Add("Utilidad", Convert.ToString(this.UtilidadFinal()).Replace(",", ".")); // crit.Add(); opcion.InsertarRegistro(NomTabla, crit); }
private void btnagregarsucursal_Click(object sender, EventArgs e) { if (this.txtCodSucur.Text == "") { MessageBox.Show("Debe llenar el campo Codigo"); } else if (this.txtNombreSucur.Text == "") { MessageBox.Show("Debe llenar el campo Nombre"); } else { sucursal sucu = new sucursal(txtCodSucur.Text, txtNombreSucur.Text); //Lineas de codigos en comun para todos los metodos. opcionesdb opciones = new opcionesdb(); String NomTabla = "Sucursal"; Hashtable crit = new Hashtable(); //Lineas con detalles especificos por metodo. crit.Add("CodigoSucursal", sucu.Codigosucursal.ToString()); crit.Add("Nombre", sucu.Nombre.ToString()); opciones.InsertarRegistro(NomTabla, crit); // MessageBox.Show("Sucursal Agregada Satisfactoriamente'¡¡¡¡¡"); cargarSucursales(); } }
private void btnGuardar_Click(object sender, EventArgs e) { if (this.txtNombre.Text == "") { MessageBox.Show("Debe llenar el campo Nombre"); } else if (this.txtGananciaNueva.Text == "") { MessageBox.Show("Debe llenar el campo Ganancia"); } else { //Lineas de codigos en comun para todos los metodos. opcionesdb opciones = new opcionesdb(); String NomTabla = "TipoPrecio"; Hashtable crit = new Hashtable(); //Lineas con detalles especificos por metodo. crit.Add("TipoPrecio", txtNombre.Text); crit.Add("Formula", txtGananciaNueva.Text); opciones.InsertarRegistro(NomTabla, crit); txtNombre.Text = ""; txtGananciaNueva.Text = ""; labelMensajes.Text = "Nueva categoria creada exitosamente."; txtGananciaModificar.Text = ""; cargarCombox(); } }
public void agregar(TipoPrecio TipoPrec) { //Lineas de codigos en comun para todos los metodos. opcionesdb opciones = new opcionesdb(); String NomTabla = "TipoPrecio"; Hashtable crit = new Hashtable(); //Lineas con detalles especificos por metodo. crit.Add("TipoPrecio", TipoPrec.TipoPrecio1.ToString()); crit.Add("Formula", TipoPrec.Formula.ToString()); opciones.InsertarRegistro(NomTabla, crit); }
public void agregar(producto product) { //Lineas de codigos en comun para todos los metodos. opcionesdb opciones = new opcionesdb(); String NomTabla = "productos"; Hashtable crit = new Hashtable(); //Lineas con detalles especificos por metodo. crit.Add("CodigoBarra", product.CodigoBarra.ToString()); crit.Add("Nombre", product.Nombre.ToString()); opciones.InsertarRegistro(NomTabla, crit); }
public void registrarCompra() { // opcione.iniciarTransaccion(); inventario[] invet = Productos; String NomTabla = "Compras"; Hashtable crit = new Hashtable(); //Lineas con detalles especificos por metodo. crit.Add("CodigoProveedor", Proveedor[0].CodigoProveedor.ToString()); crit.Add("TipoCompra", "2"); crit.Add("CodigoSucursal", sucursal[0].Codigosucursal.ToString()); crit.Add("Gravado", Total); double iva = total * 0.13; crit.Add("IVA", Decimal.Round(System.Convert.ToDecimal(iva), 2)); crit.Add("Percepcion", 0); String fech = Convert.ToString(Fecha); crit.Add("Fecha", fech.Substring(0, 10)); crit.Add("NDocumento", NDoc1); opcione.InsertarRegistro(NomTabla, crit); DataTable tabla = opcione.obtenerIdCompra(); DataRow row; row = tabla.Rows[0]; // opcione.CommitTransaccion(); // int contadorArrayVistaPrevia=0; VistaCompra = new Hashtable[invet.Length]; for (int f = 0; f < invet.Length; f++) { inventario inv = new inventario(); inv = invet[f]; inv.registrarInventario(System.Convert.ToInt32(row["idComp"])); VistaCompra[f] = inv.ViCompra; //for(int h=0;h<inv.ContardorArray;h++){ // contadorArrayVistaPrevia = contadorArrayVistaPrevia+1; // VCompra[contadorArrayVistaPrevia].CodigoBarra = inv.VCompra[h].CodigoBarra; // VCompra[contadorArrayVistaPrevia].Correlativo = inv.VCompra[h].Correlativo; //} } }
public void ModificarDetalle() { opcionesdb opcion = new opcionesdb(); Hashtable crit = new Hashtable(); Hashtable reg = new Hashtable(); ventas ven = new ventas(); //Modificar Detalle Venta Actualizar los Productos //obtener correlativos int filas = radGridView4.Rows.Count; String corre; String barra; double precioR; double precioVenta; for (int f = 0; f < filas; f++) { String NomTabla2 = "DetalleVenta"; barra = radGridView4.Rows[f].Cells[0].Value.ToString(); corre = radGridView4.Rows[f].Cells[1].Value.ToString(); precioR = Convert.ToDouble(radGridView4.Rows[f].Cells[2].Value.ToString()); precioVenta = Convert.ToDouble(radGridView4.Rows[f].Cells[3].Value.ToString()); crit.Add("NVenta", this.ObtenerNventa()); crit.Add("CodigoBarra", barra); crit.Add("Correlativo", corre); crit.Add("PrecioReal", precioR.ToString().Replace(",", ".")); crit.Add("PrecioVenta", precioVenta.ToString().Replace(",", ".")); //MessageBox.Show(barra + " " + corre+precioR+precioVenta); opcion.InsertarRegistro(NomTabla2, crit); reg.Clear(); crit.Clear(); } }
public void registrarVenta() { opcionesdb op = new opcionesdb(); String NTabla = "Ventas"; generarNumeroVentas(); //Insertar registro en la tabla de ventas. Hashtable crit = new Hashtable(); crit.Add("TipoVenta", TipoVenta); crit.Add("Numero", NVenta); crit.Add("TotalReal", totalVenta.ToString().Replace(",", ".")); crit.Add("TotalVenta", totalVen.ToString().Replace(",", ".")); String fech = Convert.ToString(Fecha); crit.Add("Fecha", fech.Substring(0, 10)); crit.Add("CodigoSucursal", sucursales[0].Codigosucursal); crit.Add("Comentario", Comentario); crit.Add("Gravado", VentaGradava.ToString().Replace(",", ".")); crit.Add("IVA", Iva.ToString().Replace(",", ".")); crit.Add("PagoACuenta", PagoCuenta.ToString().Replace(",", ".")); crit.Add("Renta", renta.ToString().Replace(",", ".")); crit.Add("Utilidad", utilidad.ToString().Replace(",", ".")); op.InsertarRegistro("Ventas", crit); //Insetar registros en la tabla de detalle de venta. DataTable tab2 = new DataTable(); tab2 = op.obtenerNVenta(NTabla, "NVentas"); DataRow row2; int NumVentas; row2 = tab2.Rows[0]; NumVentas = System.Convert.ToInt32(row2["NVentas"].ToString()); for (int p = 0; p < producto.Length; p++) { producto[] prd = producto[p].Pro; Hashtable crits = new Hashtable(); crits.Add("NVenta", NumVentas); crits.Add("CodigoBarra", prd[p].CodigoBarra); crits.Add("Correlativo", producto[p].Correlativo); crits.Add("PrecioReal", producto[p].Costo.ToString().Replace(",", ".")); crits.Add("PrecioVenta", producto[p].PrecioVenta.ToString().Replace(",", ".")); op.InsertarRegistro("DetalleVenta", crits); //Eliminamos en la tabla precio las tuplas de los productos con un codigo de barra espesifico y correlativo. producto[] prdR = producto[p].Pro; Hashtable critR = new Hashtable(); critR.Add("CodigoBarra", prdR[p].CodigoBarra); critR.Add("Correlativo", producto[p].Correlativo); op.EliminarRegistro("Precios", critR); //Eliminamos en la tabla Inventario las tuplas de los productos con un codigo de barra espesifico y correlativo. producto[] prdRx = producto[p].Pro; Hashtable critRx = new Hashtable(); critRx.Add("CodigoBarra", prdRx[p].CodigoBarra); critRx.Add("Correlativo", producto[p].Correlativo); op.EliminarRegistro("Inventario", critRx); // MessageBox.Show("Codigo de Barra: " + prd[p].CodigoBarra + " " + prdR[p].CodigoBarra + " " + prdRx[p].CodigoBarra); } }
public void registrarInventario(int idCompra) { producto[] pro = Producto; //op.iniciarTransaccion(); String NomTabla = "Inventario"; String codBarra = pro[0].CodigoBarra; String NTabla = "inventario"; DataTable tab = new DataTable(); tab = op.obtenerCorrelativo(NTabla, codBarra); DataRow row; if (tab.Rows.Count == 0) { correlativo = 0; } else { row = tab.Rows[0]; correlativo = System.Convert.ToInt32(row["correlativo"].ToString()) + 1; } DataTable tabe = new DataTable(); tabe = op.ObtenerTodasTuplas("TipoPrecio"); DataRow row2; rowGridView[] tipoPre = Filasprecios1; for (int i = 0; i < pro.Length; i++) { //Vista previa compras //ContardorArray = i; //vCompra = new arrayVistaCompra[pro.Length]; //-------------------- //Lineas con detalles especificos por metodo. Hashtable crit = new Hashtable(); crit.Add("CodigoBarra", pro[i].CodigoBarra); crit.Add("Correlativo", correlativo + i); ViCompra.Add(correlativo + i + "*" + pro[i].CodigoBarra, pro[i].CodigoBarra); // ViCompra.Add("Correlativo", correlativo + i); //vCompra[ContardorArray].CodigoBarra = pro[i].CodigoBarra; //vCompra[ContardorArray].Correlativo = (correlativo + i)+""; crit.Add("Gravado", Costo); crit.Add("id_compra", idCompra); op.InsertarRegistro(NomTabla, crit); // op.CommitTransaccion(); for (int x = 0; x < tipoPre.Length; x++) { Hashtable crity = new Hashtable(); crity.Add("CodigoBarra", pro[i].CodigoBarra); crity.Add("Correlativo", correlativo + i); crity.Add("Gravado", tipoPre[x].Cells1.ToString().Replace(",", ".")); crity.Add("TipoPrecio", tipoPre[x].Cells0); op.InsertarRegistro("Precios", crity); } //for(int x=0; x<3; x++){ // Hashtable crity = new Hashtable(); // crity.Add("CodigoBarra", pro[i].CodigoBarra); // crity.Add("Correlativo", correlativo+i); // row2 = tabe.Rows[x]; // if(x==0){ // crity.Add("Gravado", (Costo+(System.Convert.ToDouble(row2["Formula"])/100) * Costo)); // crity.Add("TipoPrecio", "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"); // } // op.InsertarRegistro("Precios", crity); //} } }