public string GetPiedToString(
            Societe societe,
            Exercice exercice,
            List <LigneFc> ligneFcSuspendues)
        {
            if (societe == null || exercice == null)
            {
                return(string.Empty);
            }
            var count                         = ligneFcSuspendues.Select(x => x.NumeroFacture).ToList().Count();
            var totalPrixVenteHt              = ligneFcSuspendues.Sum(x => x.PrixVenteHt);
            var totalMontantFodec             = ligneFcSuspendues.Sum(x => x.MontantFodec);
            var totalMontantDroitConsommation = ligneFcSuspendues.Sum(x => x.MontantDroitConsommation);
            var totalMontantTva               = ligneFcSuspendues.Sum(x => x.MontantTva);
            var result                        = "TF";

            result += societe.MatriculFiscal.PadLeft(7, '0');
            result += societe.MatriculCle.PadLeft(1, '0');
            result += societe.MatriculCategorie.PadLeft(1, '0');
            result += societe.MatriculEtablissement.PadLeft(3, '0');
            result += exercice.Annee.PadLeft(4, '0');
            result += "T";
            result += Trimestre.ToString().PadLeft(1);
            result += count.ToString().PadLeft(6, '0');
            result += string.Empty.PadLeft(230, ' ');
            result += (totalPrixVenteHt * 1000).ToString("0").PadLeft(15, '0');
            result += "00000";
            result += (totalMontantFodec * 1000).ToString("0").PadLeft(15, '0');
            result += "00000";
            result += (totalMontantDroitConsommation * 1000).ToString("0").PadLeft(15, '0');
            result += "00000";
            result += (totalMontantTva * 1000).ToString("0").PadLeft(15, '0');
            return(result);
        }
        public string GetEntetFcToString(Societe societe, Exercice exercice)
        {
            if (societe == null || exercice == null)
            {
                return(string.Empty);
            }

            var result = "EF";

            result += societe.MatriculFiscal.PadLeft(7, '0');
            result += societe.MatriculCle.PadLeft(1, '0');
            result += societe.MatriculCategorie.PadLeft(1, '0');
            result += societe.MatriculEtablissement.PadLeft(3, '0');
            result += exercice.Annee.PadLeft(4, '0');
            result += "T";
            result += Trimestre.ToString().PadLeft(1);
            result += societe.RaisonSocial.PadRight(40, ' ');
            result += societe.Activite.PadRight(40, ' ');
            result += societe.Ville.PadRight(40, ' ');
            result += societe.Adresse.PadRight(72, ' ');
            result += "0000"; // numero?????? n'existe pas dans la Tunisie
            result += societe.CodePostal.PadLeft(4, '0');
            result += " ".PadRight(111, ' ');
            return(result);
        }
        public string GetToString(Societe societe, DeclarationCnss declaration, Exercice exercice)
        {
            if (societe == null || declaration == null || exercice == null)
            {
                return(string.Empty);
            }
            string result = string.Empty;

            result += societe.NumeroEmployeur.PadLeft(8, '0');
            result += societe.CleEmployeur.PadLeft(2, '0');
            result += CodeExploitation.PadLeft(4, '0');
            result += declaration.Trimestre.ToString().PadLeft(1);
            result += exercice.Annee.PadLeft(4, '0');
            result += Page.ToString().PadLeft(3, '0');
            result += Ligne.ToString().PadLeft(2, '0');
            result += NumeroCnss.PadLeft(8, '0');
            result += CleCnss.PadLeft(2, '0');
            string identite = (Prenom.Trim() + " " + AutresNom.Trim() + " " + Nom.Trim() + " " + NomJeuneFille.Trim());

            result += Helper.StrTr(identite.PadRight(60)).ToUpper();
            result += Cin.PadLeft(8, '0');
            decimal total = Brut1 + Brut2 + Brut3;

            result += ((double)(total * 1000)).ToString("0").PadLeft(10, '0');
            result += string.Empty.PadLeft(10, '0');

            if (result.Length != 122)
            {
                throw new InvalidOperationException(
                          "Le nombre de caractère est invalide! Année [" + exercice + "] Trimestre " +
                          declaration.Trimestre);
            }

            return(result);
        }
        public string GetToString(Societe societe, DeclarationFc declaration, Exercice exercice)
        {
            if (societe == null || declaration == null || exercice == null)
            {
                return(string.Empty);
            }
            var result = string.Empty;

            result  = "DF";
            result += societe.MatriculFiscal.PadLeft(7, '0');
            result += societe.MatriculCle.PadLeft(1, '0');
            result += societe.MatriculCategorie.PadLeft(1, '0');
            result += societe.MatriculEtablissement.PadLeft(3, '0');
            result += exercice.Annee.PadLeft(4, '0');
            result += "T";
            result += declaration.Trimestre.ToString().PadLeft(1);
            result += NumeroOrdre.ToString().PadLeft(6, '0');
            result += NumeroFacture.PadRight(20, ' ');
            result += DateFacture.ToString("ddMMyyyy");
            result += ((int)TypeClient).ToString("0");
            result += IdentifiantClient.PadRight(13, ' ');
            result += NomPrenomClient.PadRight(40, ' ');
            result += AdresseClient.PadLeft(120, ' ');
            result += NumeroAutorisation.PadRight(20, ' ');
            result += DateAutorisation.ToString("ddMMyyyy");
            result += (PrixVenteHt * 1000).ToString("0").PadLeft(15, '0');
            result += (TauxFodec * 1000).ToString("0").PadLeft(5, '0');
            result += (MontantFodec * 1000).ToString("0").PadLeft(15, '0');
            result += (TauxDroitConsommation * 1000).ToString("0").PadLeft(5, '0');
            result += (MontantDroitConsommation * 1000).ToString("0").PadLeft(15, '0');
            result += (TauxTva * 1000).ToString("0").PadLeft(5, '0');
            result += (MontantTva * 1000).ToString("0").PadLeft(15, '0');

            return(result);
        }
        public string GetPiedBcToString(
            Societe societe,
            Exercice exercice,
            List <LigneBc> ligneBcSuspendues)
        {
            if (societe == null || exercice == null)
            {
                return(string.Empty);
            }
            var count           = ligneBcSuspendues.Select(x => x.NumeroBonCommande).ToList().Distinct().Count();
            var totalPrixAchat  = ligneBcSuspendues.Sum(x => x.PrixAchatHorsTaxe);
            var totalMontantTva = ligneBcSuspendues.Sum(x => x.MontantTva);

            var result = "TF";

            result += societe.MatriculFiscal.PadLeft(7, '0');
            result += societe.MatriculCle.PadLeft(1, '0');
            result += societe.MatriculCategorie.PadLeft(1, '0');
            result += societe.MatriculEtablissement.PadLeft(3, '0');
            result += exercice.Annee.PadLeft(4, '0');
            result += "T";
            result += Trimestre.ToString().PadLeft(1);
            result += count.ToString().PadLeft(6, '0');
            result += string.Empty.PadLeft(142, ' ');
            result += (totalPrixAchat * 1000).ToString("0").PadLeft(15, '0');
            result += (totalMontantTva * 1000).ToString("0").PadLeft(15, '0');
            return(result);
        }
        public string GetToString(Societe societe, DeclarationBc declaration, Exercice exercice)
        {
            if (societe == null || declaration == null || exercice == null)
            {
                return(string.Empty);
            }

            string result = "DF";

            result += societe.MatriculFiscal.PadLeft(7, '0');
            result += societe.MatriculCle.PadLeft(1, '0');
            result += societe.MatriculCategorie.PadLeft(1, '0');
            result += societe.MatriculEtablissement.PadLeft(3, '0');
            result += exercice.Annee.PadLeft(4, '0');
            result += "T";
            result += declaration.Trimestre.ToString().PadLeft(1);
            result += NumeroOrdre.ToString().PadLeft(6, '0');
            result += NumeroAutorisation.PadRight(30, ' ');
            result += NumeroBonCommande.PadLeft(13, ' ');
            result += DateBonCommande.ToString("ddMMyyyy");
            result += Identifiant.PadLeft(13, '0');
            result += RaisonSocialFournisseur.PadRight(40, ' ');
            result += NumeroFacture.PadLeft(30, ' ');
            result += DateFacture.ToString("ddMMyyyy");
            result += (PrixAchatHorsTaxe * 1000).ToString("0").PadLeft(15, '0');
            result += (MontantTva * 1000).ToString("0").PadLeft(15, '0');
            result += "<";
            result += ObjetFacture.PadRight(320, ' ');
            result += "/>";

            return(result);
        }