public static string ActualizarStockProd_Anulada(int idDetalleVenta) { DDetalleVenta Obj = new DDetalleVenta(); Obj.IdDetalleVenta = idDetalleVenta; return(Obj.ActualizarStockProd_Anulada(Obj)); }
public static string InsertarAdicPedido(int idVenta, int idProducto, int cantidad, decimal precioVenta, decimal descuento, string nota, string tipo, string barra, DataTable dtDetalleMenu, string estado) { DDetalleVenta Obj = new DDetalleVenta(); Obj.IdVenta = idVenta; Obj.IdProducto = idProducto; Obj.Cantidad = cantidad; Obj.PrecioVenta = precioVenta; Obj.Descuento = descuento; Obj.Nota = nota; Obj.Barra = barra; Obj.Tipo = tipo; Obj.Estado = estado; List <DDetalleVentaMenu> detallesMenu = new List <DDetalleVentaMenu>(); foreach (DataRow row in dtDetalleMenu.Rows) { DDetalleVentaMenu detalleM = new DDetalleVentaMenu(); detalleM.IdProducto = Convert.ToInt32(row["Cod"].ToString()); detalleM.Cantidad = Convert.ToInt32(row["Cant"].ToString()); detalleM.Barra = row["Barra"].ToString(); detallesMenu.Add(detalleM); } return(Obj.InsertarAdic(Obj, detallesMenu)); }
//Método insertar que llame al metodo insertar de la clase Dcategoria public static string Insertar(int idcliente, int idtrabajador, DateTime fecha, string tipo_comprobante, string serie, string correlativo, decimal igv, DataTable dtdetalles) { DVenta Obj = new DVenta(); Obj.Idtrabajador = idtrabajador; Obj.Idcliente = idcliente; Obj.Fecha = fecha; Obj.Tipo_Comprobante = tipo_comprobante; Obj.Serie = serie; Obj.Correlativo = correlativo; Obj.Igv = igv; List <DDetalleVenta> detalles = new List <DDetalleVenta>(); foreach (DataRow row in dtdetalles.Rows) { DDetalleVenta detalle = new DDetalleVenta(); detalle.IdDetalle_ingreso = Convert.ToInt32(row["iddetalle_ingreso"].ToString()); detalle.Cantidad = Convert.ToInt32(row["cantidad"].ToString()); detalle.PrecioVenta = Convert.ToDecimal(row["precio_venta"].ToString()); detalle.Descuento = Convert.ToDecimal(row["descuento"].ToString()); detalles.Add(detalle); } return(Obj.Insertar(Obj, detalles)); }
public static string Eliminar(int idVenta) { DDetalleVenta Obj = new DDetalleVenta(); Obj.IdVenta = idVenta; return(Obj.Eliminar(Obj)); }
public static string Insertar(int idcliente, int idtrabajador, DateTime fecha, string tipocomprobante, string serie, string correlativo, decimal iva, DataTable dtDetalles) { DVenta Venta = new DVenta(); Venta.IdCliente = idcliente; Venta.IdTrabajador = idtrabajador; Venta.Fecha = fecha; Venta.TipoComprobante = tipocomprobante; Venta.Serie = serie; Venta.Correlativo = correlativo; Venta.IVA = iva; List <DDetalleVenta> detalles = new List <DDetalleVenta>(); foreach (DataRow row in dtDetalles.Rows) { DDetalleVenta detalle = new DDetalleVenta(); detalle.IdDetalleIngreso = Convert.ToInt32(row["IdDetalleIngreso"].ToString()); detalle.Cantidad = Convert.ToInt32(row["Cantidad"].ToString()); detalle.PrecioVenta = Convert.ToDecimal(row["PrecioVenta"].ToString()); detalle.Descuento = Convert.ToDecimal(row["Descuento"].ToString()); detalles.Add(detalle); } return(Venta.Insertar(Venta, detalles)); }
public static string InsertarPedidoPagadoR(int?idCliente, int?idMesa, DateTime fecha, string estado, string formaPago, decimal descuento, int idTrabajador, string modo, int nroCaja, string tipoCompr, int serie, decimal igv, string estadoComp, decimal monto, decimal efectivo, decimal tarjeta, decimal redondeo, DataTable dtDetalle, decimal vuelto, DateTime fechaEntrega, decimal adelanto, int idTrabajador_Cobro, string obs, string motivo, string cliente, string telefono, string tipoCliente) { DVenta Obj = new DVenta(); Obj.IdCliente = idCliente; Obj.IdMesa = idMesa; Obj.Fecha = fecha; Obj.Estado = estado; Obj.FormaPago = formaPago; Obj.Descuento = descuento; Obj.IdTrabajador = idTrabajador; Obj.Modo = modo; Obj.NroCaja = nroCaja; Obj.FechaEntrega = fechaEntrega; Obj.Adelanto = adelanto; Obj.IdTrabajador_Cobro = idTrabajador_Cobro; Obj.Obs = obs; Obj.Motivo = motivo; Obj.Cliente = cliente; Obj.Telefono = telefono; Obj.TipoCliente = tipoCliente; List <DDetalleVenta> detalles = new List <DDetalleVenta>(); foreach (DataRow row in dtDetalle.Rows) { DDetalleVenta detalle = new DDetalleVenta(); detalle.IdProducto = Convert.ToInt32(row["Cod"].ToString()); detalle.Cantidad = Convert.ToInt32(row["Cant"].ToString()); detalle.PrecioVenta = Convert.ToDecimal(row["Precio_Un"].ToString()); detalle.Descuento = Convert.ToDecimal(row["Descuento"].ToString()); detalle.Nota = row["Nota"].ToString(); detalle.Tipo = row["Tipo"].ToString(); detalle.Barra = row["Barra"].ToString(); detalle.Estado = "Reservada"; detalles.Add(detalle); } DComprobante Obj1 = new DComprobante(); Obj1.TipoComprobante = tipoCompr; Obj1.Serie = serie; Obj1.Igv = igv; Obj1.Fecha = fecha; Obj1.Estado = estadoComp; Obj1.IdCliente = idCliente; Obj1.Monto = monto; Obj1.Efectivo = efectivo; Obj1.Tarjeta = tarjeta; Obj1.Redondeo = redondeo; Obj1.FormaPago = formaPago; Obj1.Vuelto = vuelto; return(Obj.InsertarPedido_Pagado(Obj, detalles, Obj1)); }
public static DataTable Buscar(int idVenta) { DDetalleVenta Obj = new DDetalleVenta(); // Obj.Opcion = opcion; Obj.IdVenta = idVenta; return(Obj.BuscarNombre(Obj)); }
public static string InsertarPedidoDelivery(int?idCliente, int?idMesa, DateTime fecha, string estado, string formaPago, decimal descuento, int idTrabajador, string modo, int nroCaja, string tipoCompr, decimal vuelto, string estadoD, DataTable dtDetalle, decimal total, decimal pagaCon, string repartidor, decimal dctoInd, DateTime fechaEntrega, decimal adelanto, int idTrabajador_Cobro, string obs, string motivo, string cliente, string telefono, string tipoCliente, decimal saldo) { DVenta Obj = new DVenta(); Obj.IdCliente = idCliente; Obj.IdMesa = idMesa; Obj.Fecha = fecha; Obj.Estado = estado; Obj.FormaPago = formaPago; Obj.Descuento = descuento; Obj.IdTrabajador = idTrabajador; Obj.Modo = modo; Obj.NroCaja = nroCaja; Obj.FechaEntrega = fechaEntrega; Obj.Adelanto = adelanto; Obj.IdTrabajador_Cobro = idTrabajador_Cobro; Obj.Obs = obs; Obj.Motivo = motivo; Obj.Cliente = cliente; Obj.Telefono = telefono; Obj.TipoCliente = tipoCliente; Obj.Saldo = saldo; List <DDetalleVenta> detalles = new List <DDetalleVenta>(); foreach (DataRow row in dtDetalle.Rows) { DDetalleVenta detalle = new DDetalleVenta(); detalle.IdProducto = Convert.ToInt32(row["Cod"].ToString()); detalle.Kilogramos = Convert.ToDecimal(row["Kg"].ToString()); detalle.Unidad = Convert.ToDecimal(row["NroUnid"].ToString()); detalle.PrecioVenta = Convert.ToDecimal(row["Precio_Un"].ToString()); detalle.Descuento = Convert.ToDecimal(row["Descuento"].ToString()); detalle.Nota = row["Nota"].ToString(); detalle.Tipo = row["Tipo"].ToString(); detalle.Barra = row["Barra"].ToString(); detalle.Estado = row["Estado"].ToString(); detalles.Add(detalle); } DDelivery Obj1 = new DDelivery(); Obj1.TipoCompr = tipoCompr; Obj1.Vuelto = vuelto; Obj1.Estado = estadoD; Obj1.Total = total; Obj1.PagaCon = pagaCon; Obj1.Repartidor = repartidor; Obj1.DctoInd = dctoInd; return(Obj.InsertarPedidoDelivery(Obj, detalles, Obj1)); }
public static string EditarNotaPedido(int idDetalle, string nota, decimal descuento) { DDetalleVenta Obj = new DDetalleVenta(); Obj.IdDetalleVenta = idDetalle; Obj.Nota = nota; Obj.Descuento = descuento; return(Obj.EditarNota(Obj)); }
public static string EditarDetalleVenta(int idDetalle, decimal descuento, decimal importe) { DDetalleVenta Obj = new DDetalleVenta(); Obj.IdDetalleVenta = idDetalle; Obj.Descuento = descuento; Obj.PrecioVenta = importe; return(Obj.EditarDetalleVenta(Obj)); }
public static string EditarStockProductoR(int cantidad, int idProducto) { DDetalleVenta Obj = new DDetalleVenta(); Obj.Cantidad = cantidad; Obj.IdProducto = idProducto; return(Obj.EditarStockProductoR(Obj)); }
public static string Insertar(int cantidad, float precioVenta, int idProducto) { DDetalleVenta Obj = new DDetalleVenta(); Obj.Cantidad = cantidad; Obj.PrecioVenta = precioVenta; Obj.IdProducto = idProducto; return(Obj.Insertar(Obj)); }
public static string InsertarPedidoPagadoCredCor(int?idCliente, int?idMesa, DateTime fecha, string estado, string formaPago, decimal descuento, int idTrabajador, string modo, int nroCaja, DataTable dtDetalle, DataTable dtDetalleMenu, DateTime fechaEntrega, decimal adelanto, int idTrabajador_Cobro, string obs, string motivo, string cliente, string telefono, string tipoCliente) { DVenta Obj = new DVenta(); Obj.IdCliente = idCliente; Obj.IdMesa = idMesa; Obj.Fecha = fecha; Obj.Estado = estado; Obj.FormaPago = formaPago; Obj.Descuento = descuento; Obj.IdTrabajador = idTrabajador; Obj.Modo = modo; Obj.NroCaja = nroCaja; Obj.FechaEntrega = fechaEntrega; Obj.Adelanto = adelanto; Obj.IdTrabajador_Cobro = idTrabajador_Cobro; Obj.Obs = obs; Obj.Motivo = motivo; Obj.Cliente = cliente; Obj.Telefono = telefono; Obj.TipoCliente = tipoCliente; List <DDetalleVenta> detalles = new List <DDetalleVenta>(); foreach (DataRow row in dtDetalle.Rows) { DDetalleVenta detalle = new DDetalleVenta(); detalle.IdProducto = Convert.ToInt32(row["Cod"].ToString()); detalle.Cantidad = Convert.ToInt32(row["Cant"].ToString()); detalle.PrecioVenta = Convert.ToDecimal(row["Precio_Un"].ToString()); detalle.Descuento = Convert.ToDecimal(row["Descuento"].ToString()); detalle.Nota = row["Nota"].ToString(); detalle.Tipo = row["Tipo"].ToString(); detalle.Barra = row["Barra"].ToString(); detalle.Estado = row["Estado"].ToString(); detalles.Add(detalle); } List <DDetalleVentaMenu> detallesMenu = new List <DDetalleVentaMenu>(); foreach (DataRow row in dtDetalleMenu.Rows) { DDetalleVentaMenu detalleM = new DDetalleVentaMenu(); detalleM.IdProducto = Convert.ToInt32(row["Cod"].ToString()); detalleM.Cantidad = Convert.ToInt32(row["Cant"].ToString()); detalleM.Barra = row["Barra"].ToString(); detallesMenu.Add(detalleM); } return(Obj.InsertarPedido_PagadoCreCort(Obj, detalles, detallesMenu)); }
public static bool Insertar(int idventa, int iddina, int cantidad, decimal precio, decimal descuento) { DDetalleVenta objDetalleVenta = new DDetalleVenta(); objDetalleVenta.IdVenta = idventa; objDetalleVenta.IdDetalleIngresoArticulo = iddina; objDetalleVenta.Cantidad = cantidad; objDetalleVenta.Precio = precio; objDetalleVenta.Descuento = descuento; return(objDetalleVenta.Insertar(objDetalleVenta)); }
private void CargarDetalle() { DDetalleVenta detalle = new DDetalleVenta(); foreach (DataRow row in detalle.SeleccionarDetalle(Serie, Numero).Rows) { ListViewItem Items = new ListViewItem(row["Codigo"].ToString()); Items.SubItems.Add(row["Nombre"].ToString()); Items.SubItems.Add(row["Unidad"].ToString()); Items.SubItems.Add(row["Precio"].ToString()); Items.SubItems.Add(row["Cantidad"].ToString()); Items.SubItems.Add(row["Importe"].ToString()); MLVDetalle.Items.Add(Items); } }
public static string InsertarAdicPedido(int idVenta, int idProducto, int cantidad, decimal precioVenta, decimal descuento, string nota, string tipo, string barra, string estado) { DDetalleVenta Obj = new DDetalleVenta(); Obj.IdVenta = idVenta; Obj.IdProducto = idProducto; Obj.Cantidad = cantidad; Obj.PrecioVenta = precioVenta; Obj.Descuento = descuento; Obj.Nota = nota; Obj.Barra = barra; Obj.Tipo = tipo; Obj.Estado = estado; return(Obj.InsertarAdic(Obj)); }
public static string EditarEstadoDetalle(string estado, int idDetalle) { DDetalleVenta Obj = new DDetalleVenta(); return(Obj.EditarEstadoDetalleVenta(estado, idDetalle)); }
private void button3_Click_1(object sender, EventArgs e) { timer2.Start(); button2.Enabled = true; try { //int cantidad = NDesechos.CantidadProductoPeso(comboBox4.Text); //int maxcantidad = Convert.ToInt32(cantidad) - Convert.ToInt32(textBox5.Text); DataTable datos = new DataTable(); var pv = new DExistencias(); pv.idcentro = Convert.ToInt32(comboBox2.SelectedValue); pv.iddesecho = Convert.ToInt32(comboBox4.SelectedValue); datos = NExistencias.pesoyvolumen(pv); peso = datos.Rows[0][0].ToString(); double maxcantidad = Convert.ToDouble(peso) - Convert.ToDouble(textBox5.Text); if (maxcantidad < 0) { MessageBox.Show("La cantidad ingresada es mayor a la que esta guardada", "Error"); } else { var upex = new DExistencias(); upex.idcentro = Convert.ToInt32(comboBox2.SelectedValue); upex.iddesecho = Convert.ToInt32(comboBox4.SelectedValue); //upex.preciocosto = Convert.ToDouble(textBox4.Text); //upex.precioventa = Convert.ToDouble(textBox6.Text); //se suma la cantidad y el peso a lo que ya esta en la base de datos upex.cantidadpeso = Convert.ToDouble(peso) - Convert.ToDouble(textBox5.Text); if (NExistencias.Actualizarexistenciaventa(upex)) { // MessageBox.Show("Se actualizo con exito", "Aviso"); decimal TOT = Convert.ToInt32(textBox6.Text) * Convert.ToInt32(textBox5.Text); textBox7.Text = TOT.ToString(); lista = new List <DDetalleVenta>(); d = new DDetalleVenta(); d.idventa = Convert.ToInt32(textBox1.Text); d.iddetalleventa = Convert.ToInt32(textBox4.Text); d.iddesecho = Convert.ToInt32(comboBox4.SelectedValue); d.cantidad = Convert.ToInt32(textBox5.Text); d.precio = Convert.ToDecimal(textBox6.Text); d.subtotal = Convert.ToDecimal(textBox7.Text); lista.Add(d); var i = new DEncabezadoVentas(); i.listardetalleventa = lista; if (NEncabezadoVenta.DetalleEncabezado(i)) { dataGridView1.Columns["Column1"].Visible = false; dataGridView1.Columns["Column2"].Visible = false; dataGridView1.Rows.Add(d.iddetalleventa, d.cantidad, d.iddesecho, comboBox4.Text, d.precio, d.subtotal); int result = dataGridView1.Rows.Cast <DataGridViewRow>().Sum(x => Convert.ToInt32(x.Cells["Column5"].Value)); textBox8.Text = result.ToString(); //MessageBox.Show("Se agrego correctamente"); var actuatotal = new DEncabezadoVentas(); actuatotal.idventa = Convert.ToInt32(textBox1.Text); actuatotal.total = Convert.ToDecimal(textBox8.Text); if (NEncabezadoVenta.ActualizarTotalVenta(actuatotal)) { // MessageBox.Show("Se actualizo Correctamente el Total", "Aviso"); MessageBox.Show("Se agrego correctamente", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox5.Clear(); textBox6.Clear(); textBox7.Clear(); desechos(); } else { MessageBox.Show("Verifique sus datos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("No se agrego", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("No se realizo la actualizacion, verifique sus datos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void GuardarVenta() { string tipocomprobante = CbxTipoComprobante.SelectedValue.ToString(); string ventaserie = "####"; string ventacorrelativo = "########"; DVenta venta = new DVenta(); if (venta.ObtenerSerieCorrelativo(tipocomprobante) != null) { DataRow row = venta.ObtenerSerieCorrelativo(tipocomprobante); ventaserie = row["Serie"].ToString(); ventacorrelativo = row["Correlativo"].ToString(); } Venta beVenta = new Venta { Cliente = Convert.ToInt32(LblIDCliente.Text), Empleado = FrmPrincipal.AccesoUsernameID, TipoComprobante = tipocomprobante, Serie = ventaserie, Numero = ventacorrelativo, Fecha = Convert.ToDateTime(DateTime.Now), Hora = Convert.ToDateTime(DateTime.Now), SubTotal = Venta_SubTotal, Igv = Venta_Igv, Total = Venta_Total, Estado = 1 }; DVenta boVenta = new DVenta(); if (boVenta.Agregar(beVenta) == true) { if (MLVDetalle.Items.Count > 0) { DDetalleVenta boDetalleVenta = new DDetalleVenta(); foreach (ListViewItem items in MLVDetalle.Items) { DetalleVenta beDetalleVenta = new DetalleVenta { Serie = beVenta.Serie, Numero = beVenta.Numero, Producto = items.SubItems[0].Text, Precio = Convert.ToDouble(items.SubItems[3].Text), Cantidad = Convert.ToInt32(items.SubItems[4].Text), Importe = Convert.ToDouble(items.SubItems[5].Text) }; //Agregar dettalle compra if (boDetalleVenta.Agregar(beDetalleVenta) == true) { int cantidadfinal = 0; double costounitariofinal = 0; double costototalfinal = 0; //Obteniendo Ultimo Movimiento DMovimiento boM = new DMovimiento(); Movimiento datos = boM.SeleccionarUltimoMovimientoProducto(beDetalleVenta.Producto); if (!string.IsNullOrEmpty(datos.Producto)) { //Si hay datos cantidadfinal = datos.CantidadFinal - beDetalleVenta.Cantidad; costounitariofinal = datos.CostoUnitarioFinal; double costofinaly = Math.Round((costounitariofinal * beDetalleVenta.Cantidad), 2); costototalfinal = datos.CostoTotalFinal - costofinaly; //Movimiento Movimiento beMovimiento = new Movimiento { Fecha = DateTime.Now, TipoComprobante = beVenta.TipoComprobante, Serie = beVenta.Serie, Numero = beVenta.Numero, TipoOperacion = "01", Producto = beDetalleVenta.Producto, CantidadEntrada = 0, CostoUnitarioEntrada = 0, CostoTotalEntrada = 0, CantidadSalida = beDetalleVenta.Cantidad, CostoUnitarioSalida = costounitariofinal, CostoTotalSalida = costofinaly, CantidadFinal = cantidadfinal, CostoUnitarioFinal = costounitariofinal, CostoTotalFinal = costototalfinal }; DMovimiento boMovimiento = new DMovimiento(); if (boMovimiento.Agregar(beMovimiento) == true) { Inventario beInventario = new Inventario { Producto = beMovimiento.Producto, ValorUnitario = beMovimiento.CostoUnitarioFinal, Existencias = beMovimiento.CantidadFinal, ValorInventario = beMovimiento.CostoTotalFinal }; DInventario boInventario = new DInventario(); boInventario.Modificar(beInventario); } } } } } //message FrmVentas frm = Owner as FrmVentas; frm.Listar(); Close(); FrmPrincipal.Main.ChangeMessage("La Venta se ingreso correctamente", "Success"); } else { FrmPrincipal.Main.ChangeMessage("Algo salio mal", "Failed"); } }
public static DataTable mostrarIDDetalleVenra(int idVenta) { DDetalleVenta Obj = new DDetalleVenta(); return(Obj.mostrarIdDetalleVenta(idVenta)); }