public List <PedidoDatos> SeleccionarPedidos(string cia) { List <PedidoDatos> lista = new List <PedidoDatos>(); DataSet ds = FacturaDatos.SeleccionarTodos(cia); foreach (DataRow row in ds.Tables[0].Rows) { PedidoDatos obj = new PedidoDatos(); obj.cia = row["cia"].ToString(); obj.tipo = row["tipo"].ToString(); obj.documento = row["documento"].ToString(); obj.fecha = Convert.ToDateTime(row["fecha"].ToString()); obj.codCliente = row["codCliente"].ToString(); obj.pago = row["pago"].ToString(); obj.agente = row["agente"].ToString(); obj.moneda = row["moneda"].ToString(); obj.cambio = row["cambio"].ToString(); obj.descripcion = row["descripcion"].ToString(); obj.estado = row["estado"].ToString(); obj.facturaDigital = row["facturaDigital"].ToString(); obj.servGravados = float.Parse(row["servGravados"].ToString()); obj.servExentos = float.Parse(row["servExentos"].ToString()); obj.mercGravadas = float.Parse(row["mercGravadas"].ToString()); obj.mercExentas = float.Parse(row["mercExentas"].ToString()); obj.totalExentas = float.Parse(row["totalExenta"].ToString()); obj.totalGravadas = float.Parse(row["totalGravadas"].ToString()); obj.totalVenta = float.Parse(row["totalVenta"].ToString()); obj.totalDescuento = float.Parse(row["totalDescuento"].ToString()); obj.totalVentaNeta = float.Parse(row["totalVentaNeta"].ToString()); obj.totalImpuesto = float.Parse(row["totalImpuesto"].ToString()); obj.totalComprobante = float.Parse(row["totalComprobante"].ToString()); lista.Add(obj); } return(lista); }
public static bool Actualizar(PedidoFormulario pForm) { var nFecha = pForm.fecha.Split('/'); Pedido nPedido = new Pedido { PedidoID = pForm.id, ///ID testing --> quitar con el identity de data model Fecha = new DateTime(Convert.ToInt32(nFecha[2]), Convert.ToInt32(nFecha[1]), Convert.ToInt32(nFecha[0])), Cliente = pForm.cliente, Menu = pForm.menu, MenuPrecio = Convert.ToInt64(pForm.menuPrecio), Bebida = pForm.bebida, BebidaPrecio = Convert.ToInt64(pForm.bebidaprecio), Postre = pForm.postre, PostrePrecio = Convert.ToInt64(pForm.postreprecio), ConEnvio = 1, Estado = 1, Baja = 0 //0 no esta dado de baja - 1 si esta }; try { var ok = PedidoDatos.AltaOModificacion(nPedido); if (ok && pForm.id != 0) { FacturaDatos.ActualizarImporte(pForm.id, nPedido.MenuPrecio, nPedido.BebidaPrecio, nPedido.PostrePrecio); } return(ok); } catch (Exception ex) { throw ex; } }
public ActionResult FacturaInfo() { FacturaDatos elemento = new FacturaDatos() { FacturaId = 1001, Monto = 1500, Impuesto = 10, Fecha = Convert.ToDateTime("18/08/2020") }; return(View(elemento)); }
public LiquidacionDatos RegistrarFactura(FacturaDatos factura) { LiquidacionDatos liquidacion = Liquidar(factura); factura.Estado = "VIG"; repoFacturacion.RegistrarFactura(factura); foreach (FacturaDetalle detalle in factura.Detalles) { detalle.Estado = "VIG"; detalle.IdFac = factura.IdFac; repoFacturacion.RegistarFacturaDetalle(detalle); } liquidacion.idFac = factura.IdFac; return(liquidacion); }
public static string VerPedido(int p) { Pedido pedidoSeleccionado = (Pedido)BuscarPorId(p);// Factura facturaDePedido = FacturaDatos.BuscarPorPedidoId(pedidoSeleccionado.PedidoID); string formaPago = facturaDePedido.FormaPago == 1 ? "Efectivo" : "Tarjeta"; string cardPedido = "<div class='col-md-4' style='Background-color: #fff; color: #442525; margin-left: 30%;'>" + "<div class='theme-box'> <div class='theme-info'>" + "<div class='clearfix'><h2>" + pedidoSeleccionado.Cliente + "</h2>" + "<h4>" + pedidoSeleccionado.Fecha.ToShortDateString() + "</h4>" + "<div class='theme-downloads'>" + pedidoSeleccionado.Menu + " - $" + pedidoSeleccionado.MenuPrecio + "</div>" + "</div><p> Bebida: " + pedidoSeleccionado.Bebida + " - $" + pedidoSeleccionado.BebidaPrecio + "</p>" + "<div class='buttons'>Postre: " + pedidoSeleccionado.Postre + " - $" + pedidoSeleccionado.PostrePrecio + "</div></div></div>" + "<div class='theme-box'> <div class='theme-info'>" + "<div class='clearfix'><h2> FACTURA N 00000" + facturaDePedido.FacturaID + "</h2>" + "<h4>" + facturaDePedido.Fecha.ToString("dd/MM/yyyy HH:mm") + " - TOTAL: " + facturaDePedido.Total + "</h4>[" + formaPago + "]</div>" + "</div></div>" + "</div>"; return(cardPedido); }
public static bool CambiarEstado(int id) { try { if (PedidoDatos.Pagar(id)) { var ok = FacturaDatos.CambiarFactura(id); return(ok); } else { return(false); } } catch (Exception) { return(false); throw; } }
//Listar todas las enfermedades public List <FacturaEntidad> ObtenerTodos() { List <FacturaEntidad> lista = new List <FacturaEntidad>(); DataSet ds = FacturaDatos.SeleccionarTodos(); foreach (DataRow row in ds.Tables[0].Rows) { FacturaEntidad factu = new FacturaEntidad(); factu.fechaFactura = Convert.ToDateTime(row["Fecha"]); //factu.subTotal = Convert.ToDecimal(row["SubTotal"]); //factu.impuesto = Convert.ToDecimal(row["Impuesto"]); //factu.descuento = Convert.ToDecimal(row["Descuento"]); factu.total = Convert.ToDecimal(row["Total"]); factu.duennoID = Convert.ToInt16(row["DuennoID"]); factu.idDetalle = Convert.ToInt16(row["idDetalle"]); factu.nombreUsuario = row["nombreUsuario"].ToString(); lista.Add(factu); } return(lista); }
internal LiquidacionDatos Liquidar(FacturaDatos factura) { decimal valorBase = 0; foreach (FacturaDetalle detalle in factura.Detalles) { detalle.Subtotal = detalle.Cantidad * detalle.ValorUnidad; valorBase += detalle.Subtotal; detalle.Estado = "VIG"; } factura.ValorBase = valorBase; factura.ValorImpuestos = valorBase * (decimal)0.2; factura.ValorTotal = factura.ValorBase + factura.ValorImpuestos; LiquidacionDatos liquidacion = new LiquidacionDatos { ValorBase = factura.ValorBase, ValorImpuestos = factura.ValorImpuestos, ValorTotal = factura.ValorTotal }; return(liquidacion); }
public void EliminarDetFactura(int idEncFactura) { FacturaDatos datos = new FacturaDatos(); datos.EliminarDetalle(idEncFactura); }
public void Nuevo(FacturaEntidad f) { FacturaDatos.Insertar(f.fechaFactura, f.total, f.duennoID, f.idDetalle, f.usuarioID); }
public void InsertarFactura(FacturaDatos factura) { FacturaDatos fac = new FacturaDatos(); fac.InsertarFactura(factura); }
public LiquidacionDatos RegistrarFactura(FacturaDatos factura) { return(dofactura.RegistrarFactura(factura)); }
public Factura[] ConsultarFacturas() { return(FacturaDatos.RecuperarFactura()); }
public void insertarFactura() { double servGravados = 0; double servExentos = 0; double mercGravadas = 0; double mercExentas = 0; double totalExentas = 0; double totalGravadas = 0; double totalVenta = 0; double totalDescuento = 0; double totalVentaNeta = 0; double totalImpuesto = 0; double totalComprobante = 0; string documento = Convert.ToString(facturaLogica.ObtenerConsecutivos(cia, Global.GlobalVend.caja, "F")[0].consecutivo); facturaLogica.ActualizarConsecutivo(cia, Global.GlobalVend.caja, "F"); List <DetalleFacturaDatos> listaDetalle = new List <DetalleFacturaDatos>(); int secuencia = 1; foreach (DataGridViewRow row in dgvDetalle.Rows) { double subtotal = 0; double subtotalDes = 0; double montoDescuento = 0; double porcImpuesto = 0; double porcDescuento = 0; ArticuloDatos art = new ArticuloDatos(); art = articuloLogica.ObtenerArticulos(cia, Convert.ToString(row.Cells[0].Value))[0]; subtotal = Math.Round((Convert.ToDouble(row.Cells[2].Value) * Convert.ToDouble(row.Cells[3].Value)), 2); porcImpuesto = Math.Round((articuloLogica.ObtenerImpuesto(cia, art.impuesto)[0].porcentaje / 100), 2); porcDescuento = Convert.ToDouble(row.Cells[4].Value) / 100; montoDescuento = subtotal * porcDescuento; subtotalDes = subtotal - montoDescuento; TipoArticuloDatos tipoArticulo = articuloLogica.ObtenerTipoArticulo(cia, art.tipo)[0]; DetalleFacturaDatos detalle = new DetalleFacturaDatos(); detalle.cia = cia; detalle.documento = documento; detalle.secuencia = secuencia; detalle.articulo = Convert.ToString(row.Cells[0].Value); detalle.porcDescuento = (float)Convert.ToDouble(row.Cells[4].Value); detalle.porcImpuesto = (float)articuloLogica.ObtenerImpuesto(cia, art.impuesto)[0].porcentaje; detalle.unidadMedida = "Unid"; detalle.cantidad = (float)Convert.ToDouble(row.Cells[2].Value); detalle.costo = (float)art.costo; detalle.precio = (float)Convert.ToDouble(row.Cells[3].Value); detalle.montoImpuesto = (float)Convert.ToDouble(row.Cells[5].Value); detalle.montoDescuento = (float)montoDescuento; detalle.total = (float)Convert.ToDouble(row.Cells[4].Value); detalle.descripcion = ""; listaDetalle.Add(detalle); secuencia++; if (tipoArticulo.afecta == "N") { if ((Convert.ToDouble(row.Cells[5].Value)) > 0) { servGravados += subtotal; } else { servExentos += subtotal; } } else { if ((Convert.ToDouble(row.Cells[5].Value)) > 0) { mercGravadas += subtotal; } else { mercExentas += subtotal; } } totalDescuento += montoDescuento; totalImpuesto += Convert.ToDouble(row.Cells[5].Value); } totalExentas = servExentos + mercExentas; totalGravadas = servGravados + mercGravadas; totalVenta = totalGravadas + totalExentas; totalVentaNeta = totalVenta - totalDescuento; totalComprobante = totalVentaNeta + totalImpuesto; FacturaDatos facturaI = new FacturaDatos(); facturaI.cia = cia; facturaI.tipo = Convert.ToString(cboTipo.SelectedValue); facturaI.documento = documento; facturaI.caja = Global.GlobalVend.caja; facturaI.fecha = Convert.ToDateTime(txtFecha.Text); facturaI.codCliente = txtCodCliente.Text; facturaI.pago = "0"; facturaI.agente = txtVendedor.Text; facturaI.moneda = Convert.ToString(cboMoneda.SelectedValue); facturaI.cambio = "0"; facturaI.descripcion = txtDescripcion.Text; facturaI.referencia = txtReferencia.Text; facturaI.estado = Convert.ToString(cboEstado.SelectedValue); facturaI.facturaDigital = "0"; facturaI.servGravados = (float)servGravados; facturaI.servExentos = (float)servExentos; facturaI.mercGravadas = (float)mercGravadas; facturaI.mercExentas = (float)mercExentas; facturaI.totalExentas = (float)totalExentas; facturaI.totalGravadas = (float)totalGravadas; facturaI.totalVenta = (float)totalVenta; facturaI.totalDescuento = (float)totalDescuento; facturaI.totalVentaNeta = (float)totalVentaNeta; facturaI.totalImpuesto = (float)totalImpuesto; facturaI.totalComprobante = (float)totalComprobante; facturaLogica.InsertarFactura(facturaI); detalleFacturaLogica.InsertarDetalleFactura(listaDetalle); }
public void CrearFactura(Factura factura) { FacturaDatos.InsertarFactura(factura); }
public int ObtenerUltimaFactura() { FacturaDatos datos = new FacturaDatos(); return datos.SeleccionarUltimaFactura(); }
public void InsertarEncFactura(Factura encabezado) { FacturaDatos datos = new FacturaDatos(); datos.InsertarEncabezado(encabezado); }
public void EliminarEncFactura(int idEncFactura) { FacturaDatos datos = new FacturaDatos(); datos.EliminarEncabezado(idEncFactura); }
public void InsertarDetFactura(Factura detalle) { FacturaDatos datos = new FacturaDatos(); datos.InsertarDetalle(detalle); }