2026-01-30-v2
This commit is contained in:
133
bdGrupoSanchoToro/extensiones/apuntes.cs
Normal file
133
bdGrupoSanchoToro/extensiones/apuntes.cs
Normal file
@@ -0,0 +1,133 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Microsoft.VisualBasic.CompilerServices;
|
||||
|
||||
namespace bdGrupoSanchoToro.db
|
||||
{
|
||||
public partial class apuntes
|
||||
{
|
||||
private string _NumeroCuentaTmp;
|
||||
public string NumeroCuentaTmp
|
||||
{
|
||||
get
|
||||
{
|
||||
return _NumeroCuentaTmp;
|
||||
}
|
||||
set
|
||||
{
|
||||
_NumeroCuentaTmp = value;
|
||||
OnPropertyChanged("NumeroCuentaTmp");
|
||||
}
|
||||
}
|
||||
public double SaldoCuentaTmp { get; set; }
|
||||
public string DescripcionCuentaTmp { get; set; }
|
||||
public static void EstableceSaldoTmp(List<apuntes> lap)
|
||||
{
|
||||
double SaldoAnterior = 0;
|
||||
foreach (var ap in lap)
|
||||
{
|
||||
SaldoAnterior = SaldoAnterior + ap.Debe - ap.Haber;
|
||||
ap.SaldoCuentaTmp = SaldoAnterior;
|
||||
}
|
||||
}
|
||||
public static List<Tipo> ListaTiposDocumentos()
|
||||
{
|
||||
var lEstados = new List<Tipo>();
|
||||
foreach (TiposDocumentos Enumeracion in Enum.GetValues(typeof(TiposDocumentos)))
|
||||
lEstados.Add(new Tipo() { id = (int)Enumeracion, Descripcion = Enumeracion.ToString().Replace("_", " ") });
|
||||
return lEstados;
|
||||
}
|
||||
|
||||
|
||||
public double DebeAnterior(tscGrupoSanchoToro bd, DateOnly Fecha)
|
||||
{
|
||||
try
|
||||
{
|
||||
var aps = bd.apuntes.Where(X => X.idCuentaNavigation.idCuenta == this.idCuenta & X.idAsientoNavigation.Fecha < Fecha).ToList();
|
||||
return aps.Sum(x => x.Debe);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception(ex.Message, ex);
|
||||
}
|
||||
}
|
||||
public double HaberAnterior(tscGrupoSanchoToro bd, DateOnly Fecha)
|
||||
{
|
||||
try
|
||||
{
|
||||
var aps = bd.apuntes.Where(X => X.idCuenta == this.idCuenta & X.idAsientoNavigation.Fecha < Fecha).ToList();
|
||||
return aps.Sum(x => x.Haber);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception(ex.Message, ex);
|
||||
}
|
||||
}
|
||||
private bool? _Conciliado;
|
||||
public bool Conciliado
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Conciliado.HasValue)
|
||||
return (bool)_Conciliado;
|
||||
else if (ConciliacionActual_TMP != null)
|
||||
{
|
||||
if (ConciliacionActual_TMP.idConciliacion != this.idConciliacion)
|
||||
return false;
|
||||
else
|
||||
return this.idConciliacion.HasValue;
|
||||
}
|
||||
else
|
||||
return this.idConciliacion.HasValue;
|
||||
}
|
||||
set
|
||||
{
|
||||
_Conciliado = value;
|
||||
if (value)
|
||||
this.idConciliacionNavigation = this.ConciliacionActual_TMP;
|
||||
else
|
||||
this.idConciliacion = null;
|
||||
}
|
||||
}
|
||||
public string ConciliadoEn
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ConciliacionActual_TMP != null && this.idConciliacion.HasValue && this.idConciliacion != ConciliacionActual_TMP.idConciliacion)
|
||||
return "Nº Conc.: " + this.idConciliacion + " (" + this.idConciliacionNavigation.Anno.ToString + "-" + this.idConciliacionNavigation.Mes.ToString + ")";
|
||||
else
|
||||
return "";
|
||||
}
|
||||
}
|
||||
public conciliacionesbancarias ConciliacionActual_TMP { get; set; }
|
||||
public double Saldo
|
||||
{
|
||||
get
|
||||
{
|
||||
return Math.Round(Debe - Haber, 2);
|
||||
}
|
||||
}
|
||||
public double Diferencia
|
||||
{
|
||||
get
|
||||
{
|
||||
return Debe - Haber;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class Tipo
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string Descripcion { get; set; }
|
||||
}
|
||||
|
||||
public enum TiposDocumentos
|
||||
{
|
||||
RECIBO = 1,
|
||||
FACTURA = 2,
|
||||
OTRO = 99
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user