Exemplo n.º 1
0
        public List <CsLclient> RetourneTauxDeEncaissement(List <int> IdCentre)
        {
            List <string>    lstPeriode         = DetermineListePeriode(1, 12, System.DateTime.Today);
            List <CsLclient> lesFactureRetourne = new List <CsLclient>();
            List <CsLclient> lesFacture         = new DBReports().RetourneFactureGenere(IdCentre, lstPeriode);
            List <CsLclient> lesReglement       = new DBReports().RetourneFactureRecouvre(IdCentre, lstPeriode);

            if (lesFacture != null && lesFacture.Count != 0)
            {
                CsLclient lafacturePeriode = lesFacture.First();
                lafacturePeriode.MONTANTENCAISSE = lesReglement.FirstOrDefault(t => t.REFEM == lesFacture.First().REFEM) == null ? 0 :
                                                   lesReglement.FirstOrDefault(t => t.REFEM == lesFacture.First().REFEM).MONTANT.Value;
                lafacturePeriode.MONTANTEMIS      = lafacturePeriode.MONTANT.Value;
                lafacturePeriode.TAUXRECOUVREMENT = (lafacturePeriode.MONTANTENCAISSE / lafacturePeriode.MONTANTEMIS) * 100;
                lesFactureRetourne.Add(lafacturePeriode);

                CsLclient AutreFacture = new CsLclient();
                AutreFacture.MONTANTEMIS     = lesFacture.Where(t => t.REFEM != lesFacture.First().REFEM).Sum(y => y.MONTANT.Value);
                AutreFacture.MONTANTENCAISSE = lesReglement.Where(t => t.REFEM != lesFacture.First().REFEM) == null ? 0 :
                                               lesReglement.Where(t => t.REFEM != lesFacture.First().REFEM).Sum(y => y.MONTANT.Value);
                AutreFacture.REFEM            = "AUTRE";
                AutreFacture.TAUXRECOUVREMENT = (AutreFacture.MONTANTENCAISSE / AutreFacture.MONTANTEMIS) * 100;

                lesFactureRetourne.Add(AutreFacture);
            }
            return(lesFactureRetourne);
        }
Exemplo n.º 2
0
        public List <CsLclient> RetourneTauxDeRecouvrement(List <int> IdCentre)
        {
            List <string> lstPeriode = DetermineListePeriode(1, 12, System.DateTime.Today);

            List <CsLclient> lesFacture   = new DBReports().RetourneFactureGenere(IdCentre, lstPeriode);
            List <CsLclient> lesReglement = new DBReports().RetourneFactureRecouvre(IdCentre, lstPeriode);
            List <CsLclient> lesTaux      = new List <CsLclient>();
            List <string>    lstCateg     = new List <string>();
            var lstCate = lesFacture.Select(p => p.LIBELLECATEGORIE).Distinct();

            foreach (var item in lstCate)
            {
                lstCateg.Add(item);
            }

            foreach (string item in lstPeriode)
            {
                foreach (string categ in lstCateg)
                {
                    CsLclient l = new CsLclient();
                    l.REFEM       = item;
                    l.LIBELLESITE = categ;
                    l.MONTANTEMIS = lesFacture.FirstOrDefault(i => i.REFEM == item && i.LIBELLECATEGORIE == categ) != null?lesFacture.FirstOrDefault(i => i.REFEM == item && i.LIBELLECATEGORIE == categ).MONTANT.Value : 0;

                    l.MONTANTENCAISSE = lesReglement.FirstOrDefault(i => i.REFEM == item && i.LIBELLECATEGORIE == categ) != null?lesReglement.FirstOrDefault(i => i.REFEM == item && i.LIBELLECATEGORIE == categ).MONTANT.Value : 0;

                    l.TAUXRECOUVREMENT = (l.MONTANTENCAISSE / l.MONTANTEMIS) * 100;
                    lesTaux.Add(l);
                }
            }
            return(lesTaux);
        }