예제 #1
0
        //Pioche dans ABO07
        public static DataTable ListeDesFactures(string centre, string client, string ordre, string periode, string numFacture)
        {
            try
            {
                using (ABO07Entities context = new ABO07Entities())
                {
                    List <object> query = null;
                    using (galadbEntities context1 = new galadbEntities())
                    {
                        CENTFAC MyCENFAC = new CENTFAC();

                        var _LeCENTFAC  = context.CENTFAC;
                        var _LCPROFAC   = context.CPROFAC;
                        var _leCREDFAC  = context.CREDFAC;
                        var _laREDVANCE = context1.REDEVANCE;
                        var _lEVENEMENT = context1.EVENEMENT;
                        //var _ = context1.ENTFAC;
                        var _REDFACT = context1.REDFAC;
                        var _ENTFAC  = context1.ENTFAC;
                        var _PROFAC  = context1.PROFAC;
                        var _AG      = context1.AG;
                        #region
                        if (_leCREDFAC.FirstOrDefault(d => d.CENTRE == centre && d.CLIENT == client && d.FACTURE == numFacture && d.PERIODE == periode) != null)
                        {
                            query.Add(ListeFactureABO07(centre, client, ordre, periode, numFacture));
                        }
                        #endregion

                        #region
                        else
                        {
                            //query = ListeFacturegaladb(centre, client, ordre, periode, numFacture, query, _LeCENTFAC);
                        }
                        #endregion
                    }
                    return(Galatee.Tools.Utility.ListToDataTable(query));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #2
0
        //Edition de facture
        public List <CsFactureClient> ListeDesFactures(string centre, string client, string ordre, string periode, string numFacture)
        {
            try
            {
                CsLafactureClient            entfacs = new CsLafactureClient();
                Galatee.Entity.Model.CENTFAC dt      = Galatee.Entity.Model.EserviceProcedure.ListeFactureABO07(centre, client, ordre, periode, numFacture).FirstOrDefault();
                entfacs._LstProfact = Entities.ConvertObject <CsProduitFacture, Galatee.Entity.Model.CPROFAC>(dt.CPROFAC.ToList());
                entfacs._LstRedFact = Entities.ConvertObject <CsRedevanceFacture, Galatee.Entity.Model.CREDFAC>(dt.CREDFAC.ToList());
                entfacs._LeEntatfac = Entities.ConvertObject <CsEnteteFacture, Galatee.Entity.Model.CENTFAC>(dt);
                decimal?AncSolde = 0;
                //Galatee.Entity.Model.FonctionCaisse.RetourneSoldeClient(entfacs._LeEntatfac.FK_IDCLIENT);

                galadbEntities       context           = new galadbEntities();
                List <UNITECOMPTAGE> _lstUniteComptage = context.UNITECOMPTAGE.ToList();
                List <REDEVANCE>     _lstRedevence     = context.REDEVANCE.ToList();

                List <CsFactureClient> lstFactureEdite = new List <CsFactureClient>();
                int i = 0;
                foreach (CsProduitFacture items in entfacs._LstProfact)
                {
                    foreach (CsRedevanceFacture itemss in entfacs._LstRedFact.OrderBy(p => p.TRANCHE))
                    {
                        CsFactureClient FactureEdite = new CsFactureClient();
                        FactureEdite.Unite = _lstUniteComptage.FirstOrDefault(x => x.CODE == itemss.UNITE).LIBELLE;
                        //FactureEdite.LibelleTranche = _lstRedevence.FirstOrDefault(x => x.PRODUIT == items.PRODUIT && x.CODE  == itemss.REDEVANCE && x.TRANCHE == itemss.TRANCHE).LIBELLE;
                        //FactureEdite.AncienReport = (AncSolde == 0 || AncSolde == null) ? 0 : AncSolde;
                        //new CsFactureClient().MajRedevanceFacture(ref FactureEdite, itemss);
                        //new CsFactureClient().MajProduitFacture(ref FactureEdite, items);
                        //new CsFactureClient().MajEnteteFacture(ref FactureEdite, entfacs._LeEntatfac);
                        FactureEdite.SoldeTotFTTC = FactureEdite.TotFTTC + AncSolde;
                        //FactureEdite.dateExige = Convert.ToDateTime(Convert.ToDateTime(entfacs._LeEntatfac.DFAC) + TimeSpan.FromDays((int)entfacs._LeEntatfac.EXIG )).ToShortDateString();
                        i++;
                        FactureEdite.OrdreAffichage = i;
                        lstFactureEdite.Add(FactureEdite);
                    }
                }
                if (entfacs._LstRedFact.Count < 19)
                {
                    for (int j = i + 1; j <= 19; j++)
                    {
                        CsFactureClient FactureEdite = new CsFactureClient();
                        //if (entfacs._LstProfact != null)
                        //{
                        //    if (entfacs._LstProfact.Count > 0)
                        //        new CsFactureClient().MajProduitFacture(ref FactureEdite, entfacs._LstProfact[0]);
                        //}
                        //if (true)
                        //{
                        //    new CsFactureClient().MajEnteteFacture(ref FactureEdite, entfacs._LeEntatfac);
                        //}

                        FactureEdite.SoldeTotFTTC   = FactureEdite.TotFTTC + AncSolde;
                        FactureEdite.OrdreAffichage = j;
                        lstFactureEdite.Add(FactureEdite);
                    }
                }

                context.Dispose();
                return(lstFactureEdite);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }