Beispiel #1
0
        public static DataTable Mostrar(int idDeuda)
        {
            DatosDetalleDeuda detalleDeuda = new DatosDetalleDeuda();

            detalleDeuda.IdDeuda = idDeuda;
            return(detalleDeuda.Mostrar(detalleDeuda));
        }
Beispiel #2
0
        public static string AgregarPago(DataRow pago)
        {
            DatosDetalleDeuda detalleDeuda = new DatosDetalleDeuda();

            detalleDeuda.IdDetalleDeuda = Convert.ToInt32(pago["IdDetalleDeuda"]);
            detalleDeuda.NumeroPago     = Convert.ToInt32(pago["NumeroPago"]);
            detalleDeuda.Monto          = Convert.ToDecimal(pago["Monto"]);
            detalleDeuda.FechaPago      = Convert.ToDateTime(pago["FechaPago"]);
            detalleDeuda.Pagado         = true;
            return(detalleDeuda.AgregarPago(detalleDeuda));
        }
Beispiel #3
0
        public static string Insertar(int idCaja, int idCliente, int idEmpleado, DateTime fecha, string tipoComprobante, string serie,
                                      string correlativo, decimal iva, decimal descuento, decimal total, string estado, DataTable dtDetalles, DataTable dtDeuda, DataTable dtDetallesDeuda, bool primerPago)
        {
            DatosVenta Venta = new DatosVenta();

            Venta.IdCaja          = idCaja;
            Venta.IdCliente       = idCliente;
            Venta.IdEmpleado      = idEmpleado;
            Venta.Fecha           = fecha;
            Venta.TipoComprobante = tipoComprobante;
            Venta.Serie           = serie;
            Venta.Correlativo     = correlativo;
            Venta.IVA             = iva;
            Venta.Descuento       = descuento;
            Venta.Total           = total;
            Venta.Estado          = estado;
            List <DatosDetalleVenta> Detalles = new List <DatosDetalleVenta>();

            foreach (DataRow rowDetalle in dtDetalles.Rows)
            {
                DatosDetalleVenta detalle = new DatosDetalleVenta();
                detalle.IdDetalleVenta = Convert.ToInt32(rowDetalle["IdDetalleVenta"].ToString());
                detalle.IdArticulo     = Convert.ToInt32(rowDetalle["IdArticulo"].ToString());
                detalle.Cantidad       = Convert.ToDecimal(rowDetalle["Cantidad"].ToString());
                detalle.PrecioVenta    = Convert.ToDecimal(rowDetalle["PrecioVenta"].ToString());
                detalle.Descuento      = Convert.ToDecimal(rowDetalle["Descuento"].ToString());
                detalle.Subtotal       = Convert.ToDecimal(rowDetalle["Subtotal"].ToString());
                Detalles.Add(detalle);
            }
            List <DatosDeuda>        Deuda         = new List <DatosDeuda>();
            List <DatosDetalleDeuda> DetallesDeuda = new List <DatosDetalleDeuda>();
            DatosDeuda deuda = new DatosDeuda();

            deuda.CantidadPagos = Convert.ToInt32(dtDeuda.Rows[0]["CantidadPagos"].ToString());
            deuda.TotalPagado   = Convert.ToDecimal(dtDeuda.Rows[0]["TotalPagado"].ToString());
            deuda.Interes       = Convert.ToDecimal(dtDeuda.Rows[0]["Interes"].ToString());
            deuda.Descripcion   = Convert.ToString(dtDeuda.Rows[0]["Descripcion"].ToString());
            Deuda.Add(deuda);
            foreach (DataRow rowDetalleDeuda in dtDetallesDeuda.Rows)
            {
                DatosDetalleDeuda detalleDeuda = new DatosDetalleDeuda();
                detalleDeuda.NumeroPago = Convert.ToInt32(rowDetalleDeuda["NumeroPago"].ToString());
                detalleDeuda.Monto      = Convert.ToDecimal(rowDetalleDeuda["Monto"].ToString());
                detalleDeuda.FechaPago  = Convert.ToDateTime(rowDetalleDeuda["FechaPago"].ToString());
                if (primerPago)
                {
                    detalleDeuda.Pagado = true;
                    primerPago          = false;
                }
                DetallesDeuda.Add(detalleDeuda);
            }
            return(Venta.Insertar(Venta, Detalles, Deuda, DetallesDeuda));
        }