def _saldom2(nb_pac2, f7db, f7dg, f7dl, f7dq, _P):
    '''
    Crédit d’impôt emploi d’un salarié à domicile (cases 7DB, 7DG)
    2007-
    '''
    P = _P.ir.reductions_impots.saldom

    isinvalid = f7dg

    if _P.datesim.year in (2007, 2008):
        nbpacmin = nb_pac2 + f7dl
        maxBase = P.max1
        maxDuMaxNonInv = P.max2
        maxNonInv = min_(maxBase + P.pac * nbpacmin, maxDuMaxNonInv)
        maxEffectif = maxNonInv * not_(isinvalid) + P.max3 * isinvalid

    elif _P.datesim.year in (2009, 2010):
        annee1 = f7dq
        nbpacmin = nb_pac2 + f7dl
        maxBase = P.max1 * not_(annee1) + P.max1_1ereAnnee * annee1
        maxDuMaxNonInv = P.max2 * not_(annee1) + P.max2_1ereAnnee * annee1
        maxNonInv = min_(maxBase + P.pac * nbpacmin, maxDuMaxNonInv)
        maxEffectif = maxNonInv * not_(isinvalid) + P.max3 * isinvalid

    elif _P.datesim.year >= 2011:
        # TODO:
        maxEffectif = 0

    return P.taux * min_(f7db, maxEffectif)
Example #2
0
def _plus_value_nette(plus_value_brute, dur_det_immo, _P):
    """
    Calcul de la plus value immobilière nette
    """
    # 40. ABATTEMENT POUR DUREE DE DETENTION
    # 41. NOMBRE D’ANNEES DE DETENTION AU-DELA DE LA 5EME ANNEE
    P = _P.irpp.pv_immo

    if P.datesim:  # TODO:
        taux_reduc = max_(dur_det_immo - P.ann_det1, 0) * P.taux1
    else:
        taux_reduc = (
            max_(dur_det_immo - P.ann_det3, 0) * P.taux3 +
            max_(min_(dur_det_immo, P.ann_det3) - P.ann_det2, 0) * P.taux2 +
            max_(min_(dur_det_immo, P.ann_det2) - P.ann_det1, 0) * P.taux1)

    taux_reduc = min_(taux_reduc, 1.0)
    pv_impos = (1 - taux_reduc) * plus_value_brute

    #    45. MONTANT DE LA PLUS-VALUE BENEFICIANT, SOUS CONDITIONS, DE L’EXONERATION AU TITRE DE LA
    #    PREMIERE CESSION D’UN LOGEMENT EN VUE DE L’ACQUISITION DE LA RESIDENCE PRINCIPALE
    #    (CGI, 1° BIS DU II DE L’ARTICLE 150 U) TODO:
    exo = 0

    pv_net_impos = max_(
        pv_impos - exo, 0
    )  #46. PLUS-VALUE NETTE IMPOSABLE [LIGNE 44 OU (LIGNE 44 – LIGNE 45)] = €
    # 50. PLUS-VALUE NETTE IMPOSABLE GLOBALE =
    # (LIGNE 46 OU TOTAL DES LIGNES 46 SI PLUSIEURS 2048-IMM-SD PAGE 2)

    #Lorsqu’une même cession porte sur des biens pour lesquels sont prévues des règles différentes (acquisitions successives de fractions divises ou indivises notamment),
    #il convient de remplir les lignes 10 à 46 pour chacune des fractions (utiliser plusieurs 2048-IMM-SD page 2).
    return pv_net_impos
def _spfcpi(marpac, f7gq, f7fq, f7fm, f7fl, _P):
    '''
    Souscription de parts de fonds communs de placement dans l'innovation,
    de fonds d'investissement de proximité
    2002-
    '''
    P = _P.ir.reductions_impots.spfcpi
    max1 = P.max * (marpac + 1)

    if _P.datesim.year <= 2002:
        return P.taux1 * min_(f7gq, max1)
    elif _P.datesim.year <= 2006:
        return (P.taux1 * min_(f7gq, max1) +
                P.taux1 * min_(f7fq, max1))
    elif _P.datesim.year <= 2010:
        return (P.taux1 * min_(f7gq, max1) +
                P.taux1 * min_(f7fq, max1) +
                P.taux2 * min_(f7fm, max1))

    elif _P.datesim.year <= 2011:
        return (P.taux1 * min_(f7gq, max1) +
                P.taux1 * min_(f7fq, max1) +
                P.taux2 * min_(f7fm, max1) +
                P.taux3 * min_(f7fl, max1))
    else:
        return f7gq * 0  # TODO:
def _locmeu(f7ij, f7il, f7im, f7ik, f7is, _P):
    '''
    Investissement en vue de la location meublée non professionnelle dans certains établissements ou résidences (case 7IJ)
    2009-
    '''
    P = _P.ir.reductions_impots.locmeu
    return ((max_(min_(P.max, f7ij), min_(P.max, f7il)) + min_(P.max, f7im)) / 9 + f7ik) * P.taux + f7is
def _ecodev(f7uh, rbg_int, _P):
    '''
    Sommes versées sur un compte épargne codéveloppement (case 7UH)
    2009
    '''
    P = _P.ir.reductions_impots.ecodev
    return min_(f7uh, min_(P.base * rbg_int, P.max))  # page3 ligne 18
    def function(self, simulation, period):
        '''
        Épargne retraite - PERP, PRÉFON, COREM et CGOS
        2004-
        '''
        period = period.start.offset('first-of', 'month').period('year')
        f6ps_holder = simulation.compute('f6ps', period)
        f6rs_holder = simulation.compute('f6rs', period)
        f6ss_holder = simulation.compute('f6ss', period)

        f6ps = self.filter_role(f6ps_holder, role = VOUS)
        f6pt = self.filter_role(f6ps_holder, role = CONJ)
        f6pu = self.filter_role(f6ps_holder, role = PAC1)

        f6rs = self.filter_role(f6rs_holder, role = VOUS)
        f6rt = self.filter_role(f6rs_holder, role = CONJ)
        f6ru = self.filter_role(f6rs_holder, role = PAC1)

        f6ss = self.filter_role(f6ss_holder, role = VOUS)
        f6st = self.filter_role(f6ss_holder, role = CONJ)
        f6su = self.filter_role(f6ss_holder, role = PAC1)

        # TODO: En théorie, les plafonds de déductions (ps, pt, pu) sont calculés sur
        # le formulaire 2041 GX
        return period, ((f6ps == 0) * (f6rs + f6ss) +
                (f6ps != 0) * min_(f6rs + f6ss, f6ps) +
                (f6pt == 0) * (f6rt + f6st) +
                (f6pt != 0) * min_(f6rt + f6st, f6pt) +
                (f6pu == 0) * (f6ru + f6su) +
                (f6pu != 0) * min_(f6ru + f6su, f6pu))
def _plus_value_nette(period, plus_value_brute, dur_det_immo, pv_immo = law.ir.pv_immo):
    """
    Calcul de la plus value immobilière nette
    """
    # 40. ABATTEMENT POUR DUREE DE DETENTION
    # 41. NOMBRE D’ANNEES DE DETENTION AU-DELA DE LA 5EME ANNEE
    if period.start:  # TODO:
        taux_reduc = max_(dur_det_immo - pv_immo.ann_det1, 0) * pv_immo.taux1
    else:
        taux_reduc = (max_(dur_det_immo - pv_immo.ann_det3, 0) * pv_immo.taux3
            + max_(min_(dur_det_immo, pv_immo.ann_det3) - pv_immo.ann_det2, 0) * pv_immo.taux2
            + max_(min_(dur_det_immo, pv_immo.ann_det2) - pv_immo.ann_det1, 0) * pv_immo.taux1)

    taux_reduc = min_(taux_reduc, 1.0)
    pv_impos = (1 - taux_reduc) * plus_value_brute

    # 45. MONTANT DE LA PLUS-VALUE BENEFICIANT, SOUS CONDITIONS, DE L’EXONERATION AU TITRE DE LA
    # PREMIERE CESSION D’UN LOGEMENT EN VUE DE L’ACQUISITION DE LA RESIDENCE PRINCIPALE
    # (CGI, 1° BIS DU II DE L’ARTICLE 150 U) TODO:
    exo = 0

    pv_net_impos = max_(pv_impos - exo, 0)  # 46. PLUS-VALUE NETTE IMPOSABLE [LIGNE 44 OU (LIGNE 44 – LIGNE 45)] = €
    # 50. PLUS-VALUE NETTE IMPOSABLE GLOBALE =
    # (LIGNE 46 OU TOTAL DES LIGNES 46 SI PLUSIEURS 2048-IMM-SD PAGE 2)

    # Lorsqu’une même cession porte sur des biens pour lesquels sont prévues des règles différentes (acquisitions
    # successives de fractions divises ou indivises notamment), il convient de remplir les lignes 10 à 46 pour chacune
    # des fractions (utiliser plusieurs 2048-IMM-SD page 2).
    return pv_net_impos
def _cotsyn(f7ac,
            f7ae,
            f7ag,
            sal,
            cho,
            rst,
            _P,
            _option={
                'sal': ALL,
                'cho': ALL,
                'rst': ALL
            }):
    '''
    Cotisations syndicales
    2002-
    '''
    P = _P.ir.reductions_impots.cotsyn
    tx = P.seuil

    salv, salc, salp = sal[VOUS], sal[CONJ], sal[PAC1]
    chov, choc, chop = cho[VOUS], cho[CONJ], cho[PAC1]
    rstv, rstc, rstp = rst[VOUS], rst[CONJ], rst[PAC1]
    maxv = (salv + chov + rstv) * tx
    maxc = (salc + choc + rstc) * tx
    maxp = (salp + chop + rstp) * tx

    return P.taux * (min_(f7ac, maxv) + min_(f7ae, maxc) + min_(f7ag, maxp))
    def function(self, simulation, period):
        period = period.this_year
        f6ps_holder = simulation.compute('f6ps', period)
        f6rs_holder = simulation.compute('f6rs', period)
        f6ss_holder = simulation.compute('f6ss', period)

        f6ps = self.filter_role(f6ps_holder, role = VOUS)
        f6pt = self.filter_role(f6ps_holder, role = CONJ)
        f6pu = self.filter_role(f6ps_holder, role = PAC1)

        f6rs = self.filter_role(f6rs_holder, role = VOUS)
        f6rt = self.filter_role(f6rs_holder, role = CONJ)
        f6ru = self.filter_role(f6rs_holder, role = PAC1)

        f6ss = self.filter_role(f6ss_holder, role = VOUS)
        f6st = self.filter_role(f6ss_holder, role = CONJ)
        f6su = self.filter_role(f6ss_holder, role = PAC1)

        # TODO: En théorie, les plafonds de déductions (ps, pt, pu) sont calculés sur
        # le formulaire 2041 GX
        return period, ((f6ps == 0) * (f6rs + f6ss) +
                (f6ps != 0) * min_(f6rs + f6ss, f6ps) +
                (f6pt == 0) * (f6rt + f6st) +
                (f6pt != 0) * min_(f6rt + f6st, f6pt) +
                (f6pu == 0) * (f6ru + f6su) +
                (f6pu != 0) * min_(f6ru + f6su, f6pu))
Example #10
0
def _rev_cat_rvcm(marpac, deficit_rcm, f2ch, f2dc, f2ts, f2ca, f2fu, f2go, f2gr, f2tr, _P):
    ''' REVENUS DES VALEURS ET CAPITAUX MOBILIERS '''
    P = _P.ir.rvcm
    if _P.datesim.year > 2004: f2gr = 0

    ## Calcul du revenu catégoriel
    #1.2 Revenus des valeurs et capitaux mobiliers
    b12 = min_(f2ch, P.abat_assvie*(1 + marpac))
    TOT1 = f2ch-b12
    # Part des frais s'imputant sur les revenus déclarés case DC
    den = ((f2dc + f2ts)!=0)*(f2dc + f2ts) + ((f2dc + f2ts)==0)
    F1 =  f2ca/den*f2dc
    
    # Revenus de capitaux mobiliers nets de frais, ouvrant droit à abattement
    # partie négative (à déduire des autres revenus nets de frais d'abattements
    g12a = - min_(f2dc*P.abatmob_taux - F1,0)
    # partie positive
    g12b = max_(f2dc*P.abatmob_taux - F1,0)
    
    rev = g12b + f2gr + f2fu*P.abatmob_taux

    # Abattements, limité au revenu
    h12 = P.abatmob*(1 + marpac)
    TOT2 = max_(0,rev - h12)
    i121= -min_(0,rev - h12)
    
    # Pars des frais s'imputant sur les revenus déclarés ligne TS
    F2 = f2ca - F1
    TOT3 = (f2ts - F2) + f2go*P.majGO + f2tr - g12a

    DEF = deficit_rcm

    return max_(TOT1 + TOT2 + TOT3 - DEF, 0)
Example #11
0
def _isf_apres_plaf(tot_impot, revetproduits, isf_avant_plaf, _P):
    """
    Impôt sur la fortune après plafonnement
    """
    ## si ISF avant plafonnement n'excède pas seuil 1= la limitation du plafonnement ne joue pas ##
    ## si entre les deux seuils; l'allègement est limité au 1er seuil ##
    ## si ISF avant plafonnement est supérieur au 2nd seuil, l'allègement qui résulte du plafonnement est limité à 50% de l'ISF ##

    P = _P.isf.plaf
    # Plafonnement supprimé pour l'année 2012
    if _P.datesim.year <= 2011:
        plafonnement = max_(tot_impot - revetproduits, 0)
        limitationplaf = (
            (isf_avant_plaf <= P.seuil1) * plafonnement +
            (P.seuil1 <= isf_avant_plaf) *
            (isf_avant_plaf <= P.seuil2) * min_(plafonnement, P.seuil1) +
            (isf_avant_plaf >= P.seuil2) *
            min_(isf_avant_plaf * P.taux, plafonnement))
        return max_(isf_avant_plaf - limitationplaf, 0)

    elif _P.datesim.year == 2012:
        return isf_avant_plaf

    else:
        plafond = max_(0, tot_impot -
                       revetproduits)  # case PU sur la déclaration d'impôt
        return max_(isf_avant_plaf - plafond, 0)
Example #12
0
    def function(self, simulation, period):
        '''
        Épargne retraite - PERP, PRÉFON, COREM et CGOS
        2004-
        '''
        period = period.start.offset('first-of', 'month').period('year')
        f6ps_holder = simulation.compute('f6ps', period)
        f6rs_holder = simulation.compute('f6rs', period)
        f6ss_holder = simulation.compute('f6ss', period)

        f6ps = self.filter_role(f6ps_holder, role=VOUS)
        f6pt = self.filter_role(f6ps_holder, role=CONJ)
        f6pu = self.filter_role(f6ps_holder, role=PAC1)

        f6rs = self.filter_role(f6rs_holder, role=VOUS)
        f6rt = self.filter_role(f6rs_holder, role=CONJ)
        f6ru = self.filter_role(f6rs_holder, role=PAC1)

        f6ss = self.filter_role(f6ss_holder, role=VOUS)
        f6st = self.filter_role(f6ss_holder, role=CONJ)
        f6su = self.filter_role(f6ss_holder, role=PAC1)

        # TODO: En théorie, les plafonds de déductions (ps, pt, pu) sont calculés sur
        # le formulaire 2041 GX
        return period, ((f6ps == 0) * (f6rs + f6ss) +
                        (f6ps != 0) * min_(f6rs + f6ss, f6ps) + (f6pt == 0) *
                        (f6rt + f6st) + (f6pt != 0) * min_(f6rt + f6st, f6pt) +
                        (f6pu == 0) * (f6ru + f6su) +
                        (f6pu != 0) * min_(f6ru + f6su, f6pu))
    def function(self, simulation, period):
        """
        Pensions alimentaires
        """
        period = period.start.offset("first-of", "year").period("year")
        f6gi = simulation.calculate("f6gi", period)
        f6gj = simulation.calculate("f6gj", period)
        f6gp = simulation.calculate("f6gp", period)
        f6el = simulation.calculate("f6el", period)
        f6em = simulation.calculate("f6em", period)
        f6gu = simulation.calculate("f6gu", period)
        penalim = simulation.legislation_at(period.start).ir.charges_deductibles.penalim

        max1 = penalim.max
        taux_jgt_2006 = penalim.taux_jgt_2006
        # TODO: si vous subvenez seul(e) à l'entretien d'un enfant marié ou
        # pacsé ou chargé de famille, quel que soit le nmbre d'enfants du jeune
        # foyer, la déduction est limitée à 2*max
        # S'il habite chez ses parents, max 3359, sinon 5698
        return (
            period,
            (
                min_(f6gi * (1 + taux_jgt_2006), max1)
                + min_(f6gj * (1 + taux_jgt_2006), max1)
                + min_(f6el, max1)
                + min_(f6em, max1)
                + f6gp * (1 + taux_jgt_2006)
                + f6gu
            ),
        )
Example #14
0
def _saldom2(nb_pac2, f7db, f7dg, f7dl, f7dq, _P):
    '''
    Crédit d’impôt emploi d’un salarié à domicile (cases 7DB, 7DG)
    2007-
    '''
    P = _P.ir.reductions_impots.saldom

    isinvalid = f7dg

    if _P.datesim.year in (2007, 2008):
        nbpacmin = nb_pac2 + f7dl
        maxBase = P.max1
        maxDuMaxNonInv = P.max2
        maxNonInv = min_(maxBase + P.pac * nbpacmin, maxDuMaxNonInv)
        maxEffectif = maxNonInv * not_(isinvalid) + P.max3 * isinvalid

    elif _P.datesim.year in (2009, 2010):
        annee1 = f7dq
        nbpacmin = nb_pac2 + f7dl
        maxBase = P.max1 * not_(annee1) + P.max1_1ereAnnee * annee1
        maxDuMaxNonInv = P.max2 * not_(annee1) + P.max2_1ereAnnee * annee1
        maxNonInv = min_(maxBase + P.pac * nbpacmin, maxDuMaxNonInv)
        maxEffectif = maxNonInv * not_(isinvalid) + P.max3 * isinvalid

    elif _P.datesim.year >= 2011:
        # TODO:
        maxEffectif = 0

    return P.taux * min_(f7db, maxEffectif)
def _ecodev(f7uh, rbg_int, _P):
    '''
    Sommes versées sur un compte épargne codéveloppement (case 7UH)
    2009
    '''
    P = _P.ir.reductions_impots.ecodev
    return min_(f7uh, min_(P.base * rbg_int, P.max))  # page3 ligne 18
def _cappme(marpac, f7cf, f7cl, f7cm, f7cn, f7cu, _P):
    """
    Souscriptions au capital des PME
    2002-
    """
    P = _P.ir.reductions_impots.cappme
    base = f7cf
    if _P.datesim.year >= 2003:
        base += f7cl
    if _P.datesim.year >= 2004:
        base += f7cm
    if _P.datesim.year >= 2005:
        base += f7cn
    seuil = P.seuil * (marpac + 1)

    if _P.datesim.year <= 2008:
        return P.taux * min_(base, seuil)
    elif _P.datesim.year <= 2010:
        seuil_tpe = P.seuil_tpe * (marpac + 1)
        return P.taux * (min_(base, seuil) + min_(f7cu, seuil_tpe))
    elif _P.datesim.year <= 2011:
        seuil_tpe = P.seuil_tpe * (marpac + 1)
        return P.taux * (min_(base, seuil) + min_(f7cu, seuil_tpe))  # TODO: Modify and add f7cq, check taux
    else:
        return f7cu * 0
    def function(self, simulation, period):
        period = period.this_year
        f6ps_holder = simulation.compute('f6ps', period)
        f6rs_holder = simulation.compute('f6rs', period)
        f6ss_holder = simulation.compute('f6ss', period)

        f6ps = self.filter_role(f6ps_holder, role=VOUS)
        f6pt = self.filter_role(f6ps_holder, role=CONJ)
        f6pu = self.filter_role(f6ps_holder, role=PAC1)

        f6rs = self.filter_role(f6rs_holder, role=VOUS)
        f6rt = self.filter_role(f6rs_holder, role=CONJ)
        f6ru = self.filter_role(f6rs_holder, role=PAC1)

        f6ss = self.filter_role(f6ss_holder, role=VOUS)
        f6st = self.filter_role(f6ss_holder, role=CONJ)
        f6su = self.filter_role(f6ss_holder, role=PAC1)

        # TODO: En théorie, les plafonds de déductions (ps, pt, pu) sont calculés sur
        # le formulaire 2041 GX
        return period, ((f6ps == 0) * (f6rs + f6ss) +
                        (f6ps != 0) * min_(f6rs + f6ss, f6ps) + (f6pt == 0) *
                        (f6rt + f6st) + (f6pt != 0) * min_(f6rt + f6st, f6pt) +
                        (f6pu == 0) * (f6ru + f6su) +
                        (f6pu != 0) * min_(f6ru + f6su, f6pu))
def _cd_eparet(self, f6ps_holder, f6rs_holder, f6ss_holder):
    '''
    Épargne retraite - PERP, PRÉFON, COREM et CGOS
    2004-
    '''
    f6ps = self.filter_role(f6ps_holder, role = VOUS)
    f6pt = self.filter_role(f6ps_holder, role = CONJ)
    f6pu = self.filter_role(f6ps_holder, role = PAC1)

    f6rs = self.filter_role(f6rs_holder, role = VOUS)
    f6rt = self.filter_role(f6rs_holder, role = CONJ)
    f6ru = self.filter_role(f6rs_holder, role = PAC1)

    f6ss = self.filter_role(f6ss_holder, role = VOUS)
    f6st = self.filter_role(f6ss_holder, role = CONJ)
    f6su = self.filter_role(f6ss_holder, role = PAC1)

    # TODO: En théorie, les plafonds de déductions (ps, pt, pu) sont calculés sur
    # le formulaire 2041 GX
    return ((f6ps == 0) * (f6rs + f6ss) +
            (f6ps != 0) * min_(f6rs + f6ss, f6ps) +
            (f6pt == 0) * (f6rt + f6st) +
            (f6pt != 0) * min_(f6rt + f6st, f6pt) +
            (f6pu == 0) * (f6ru + f6su) +
            (f6pu != 0) * min_(f6ru + f6su, f6pu))
def _cd_sofipe(f6cc, rbg_int, marpac, sofipe = law.ir.charges_deductibles.sofipe):
    '''
    Souscriptions au capital des SOFIPÊCHE (case CC de la déclaration
    complémentaire)
    2002-2006
    '''
    max1 = min_(sofipe.taux * rbg_int, sofipe.max * (1 + marpac))
    return min_(f6cc, max1)
def _cd_cinema(f6aa, rbg_int, cinema = law.ir.charges_deductibles.cinema):
    '''
    Souscriptions en faveur du cinéma ou de l’audiovisuel (case AA de la
    déclaration n° 2042 complémentaire)
    2002-2005
    '''
    max1 = min_(cinema.taux * rbg_int, cinema.max)
    return min_(f6aa, max1)
def _cd_ecodev(f6eh, rbg_int, ecodev = law.ir.charges_deductibles.ecodev):
    '''
    Versements sur un compte épargne codéveloppement (case EH de la déclaration
    complémentaire)
    2007-2008
    '''
    max1 = min_(ecodev.taux * rbg_int, ecodev.max)
    return min_(f6eh, max1)
def _sofipe(marpac, rbg_int, f7gs, _P):
    '''
    Souscription au capital d’une SOFIPECHE (case 7GS)
    2009-
    '''
    P = _P.ir.reductions_impots.sofipe
    max1 = min_(P.max*(marpac+1), P.base*rbg_int) # page3 ligne 18
    return P.taux*min_(f7gs, max1)
def _sofica(f7gn, f7fn, rng, P = law.ir.reductions_impots.sofica):
    '''
    Souscriptions au capital de SOFICA
    2006-
    '''
    max0 = min_(P.taux1 * max_(rng, 0), P.max)
    max1 = min_(0, max0 - f7gn)
    return P.taux2 * min_(f7gn, max0) + P.taux3 * min_(f7fn, max1)
def _sofipe(marpac, rbg_int, f7gs, _P):
    '''
    Souscription au capital d’une SOFIPECHE (case 7GS)
    2009-
    '''
    P = _P.ir.reductions_impots.sofipe
    max1 = min_(P.max * (marpac + 1), P.base * rbg_int)  # page3 ligne 18
    return P.taux * min_(f7gs, max1)
def _locmeu(f7ij, f7il, f7im, f7ik, f7is, _P):
    '''
    Investissement en vue de la location meublée non professionnelle dans certains établissements ou résidences (case 7IJ)
    2009-
    '''
    P = _P.ir.reductions_impots.locmeu
    return (
        (max_(min_(P.max, f7ij), min_(P.max, f7il)) + min_(P.max, f7im)) / 9 +
        f7ik) * P.taux + f7is
def _resimm(f7ra, f7rb, _P):
    '''
    Travaux de restauration immobilière (cases 7RA et 7RB)
    2009-
    '''
    P = _P.ir.reductions_impots.resimm
    max1 = P.max
    max2 = max_(max1 - f7rb, 0)
    return P.taux_rb*min_(f7rb, max1)+ P.taux_ra*min_(f7ra, max2)
def _preetu_2008_(f7uk, f7vo, f7td, _P):
    '''
    Crédit d’impôt pour souscription de prêts étudiants (cases 7UK, 7VO et 7TD)
    2008-
    '''
    P = _P.ir.credits_impot.preetu

    max1 = P.max * f7vo
    return P.taux * min_(f7uk, P.max) + P.taux * min_(f7td, max1)
def _cd_ecodev(f6eh, rbg_int, _P):
    '''
    Versements sur un compte épargne codéveloppement (case EH de la déclaration 
    complémentaire)
    2007-2008
    '''
    P = _P.ir.charges_deductibles
    max1 = min_(P.ecodev.taux * rbg_int, P.ecodev.max)
    return min_(f6eh, max1)
def _resimm(f7ra, f7rb, P = law.ir.reductions_impots.resimm):
    '''
    Travaux de restauration immobilière (cases 7RA et 7RB)
    2009-
    '''
    # TODO: add f7rc, f7rd, f7re, f7rf, f7sx, f7sy ... param inserted DONE
    max1 = P.max
    max2 = max_(max1 - f7rb, 0)
    return P.taux_rb * min_(f7rb, max1) + P.taux_ra * min_(f7ra, max2)
def _sofipe(marpac, rbg_int, f7gs, _P, P = law.ir.reductions_impots.sofipe):
    """
    Souscription au capital d’une SOFIPECHE (case 7GS)
    2009-2011
    """
    if _P.datesim.year >= 2011:
        return rbg_int * 0
    max1 = min_(P.max * (marpac + 1), P.base * rbg_int)  # page3 ligne 18
    return P.taux * min_(f7gs, max1)
def _cd_cinema(f6aa, rbg_int, _P):
    '''
    Souscriptions en faveur du cinéma ou de l’audiovisuel (case AA de la 
    déclaration n° 2042 complémentaire)
    2002-2005
    '''
    P = _P.ir.charges_deductibles
    max1 = min_(P.cinema.taux * rbg_int, P.cinema.max)
    return min_(f6aa, max1)
def _cd_percap_2003_2006(f6cb, f6da, marpac, _P, percap = law.ir.charges_deductibles.percap):
    '''
    Pertes en capital consécutives à la souscription au capital de sociétés
    nouvelles ou de sociétés en difficulté (cases CB et DA de la déclaration
    complémentaire)
    '''
    max_cb = percap.max_cb * (1 + marpac)
    max_da = percap.max_da * (1 + marpac)
    return min_(min_(f6cb, max_cb) + min_(f6da, max_da), max_da)
def _resimm(f7ra, f7rb, _P):
    '''
    Travaux de restauration immobilière (cases 7RA et 7RB)
    2009-
    '''
    P = _P.ir.reductions_impots.resimm
    max1 = P.max
    max2 = max_(max1 - f7rb, 0)
    return P.taux_rb * min_(f7rb, max1) + P.taux_ra * min_(f7ra, max2)
def _cd_sofipe(f6cc, rbg_int, marpac, _P):
    '''
    Souscriptions au capital des SOFIPÊCHE (case CC de la déclaration 
    complémentaire)
    2002-2006
    '''
    P = _P.ir.charges_deductibles
    max1 = min_(P.sofipe.taux * rbg_int, P.sofipe.max * (1 + marpac))
    return min_(f6cc, max1)
def _sofica(f7gn, f7fn, rng, _P):
    """
    Souscriptions au capital de SOFICA
    2006-
    """
    P = _P.ir.reductions_impots.sofica

    max0 = min_(P.taux1 * max_(rng, 0), P.max)
    max1 = min_(0, max0 - f7gn)
    return P.taux2 * min_(f7gn, max0) + P.taux3 * min_(f7fn, max1)
def _quaenv_2009(marpac, nb_pac2, f7we, f7wf, f7wg, f7wh, f7wk, f7wq, f7sb, f7sc, f7sd, f7se, rfr, _P):
    '''
    Crédits d’impôt pour dépenses en faveur de la qualité environnementale
    (cases 7WF, 7WG, 7WH, 7WK, 7WQ, 7SB, 7SC, 7SD, 7SE)
    2009
    '''
    P = _P.ir.credits_impot.quaenv
    max0 = P.max * (1 + marpac) + P.pac1 * nb_pac2

    max1 = max_(0, max0 - f7wf)
    max2 = max_(0, max1 - f7se)
    max3 = max_(0, max2 - f7wk)
    max4 = max_(0, max3 - f7sd)
    max5 = max_(0, max4 - f7wg)
    max6 = max_(0, max5 - f7sc)
    max7 = max_(0, max6 - f7wh)
    max8 = max_(0, max7 - f7sb)

    return or_(not_(f7we), rfr < 45000) * (P.taux_wf * min_(f7wf, max0) +
                P.taux_se * min_(f7se, max1) +
                P.taux_wk * min_(f7wk, max2) +
                P.taux_sd * min_(f7sd, max3) +
                P.taux_wg * min_(f7wg, max4) +
                P.taux_sc * min_(f7sc, max5) +
                P.taux_wh * min_(f7wh, max6) +
                P.taux_sb * min_(f7sb, max7) +
                P.taux_wq * min_(f7wq, max8))
def _invrev(marpac, f7gs, f7gt, f7xg, f7gu, f7gv, P = law.ir.reductions_impots.invrev):
    '''
    Investissements locatifs dans les résidences de tourisme situées dans une zone de
    revitalisation rurale (cases GS, GT, XG, GU et GV)
    2002-2003
    TODO 1/4 codé en dur
    '''
    return (P.taux_gs * min_(f7gs, P.seuil_gs * (1 + marpac)) / 4 +
             P.taux_gu * min_(f7gu, P.seuil_gu * (1 + marpac)) / 4 +
             P.taux_xg * min_(f7xg, P.seuil_xg * (1 + marpac)) / 4 +
             P.taux_gt * f7gt + P.taux_gt * f7gv)
def _sofica(f7gn, f7fn, rng, _P):
    '''
    Souscriptions au capital de SOFICA
    2006-
    '''
    P = _P.ir.reductions_impots.sofica

    max0 = min_(P.taux1 * max_(rng, 0), P.max)
    max1 = min_(0, max0 - f7gn)
    return P.taux2*min_(f7gn, max0) + \
           P.taux3*min_(f7fn, max1)
def _aidper_2010_2011(marpac, nb_pac2, f7sf, f7wi, f7wj, f7wl, _P):
    '''
    Crédits d’impôt pour dépenses en faveur de l’aide aux personnes
    (cases 7SF, 7WI, 7WJ, 7WL).
    2010-2011
    '''
    P = _P.ir.credits_impot.aidper
    max0 = P.max * (1 + marpac) + P.pac1 * nb_pac2

    max1 = max_(0, max0 - f7wl - f7sf)
    max2 = max_(0, max1 - f7wj)
    return P.taux_wl * min_(f7wl+f7sf, max0) + P.taux_wj * min_(f7wj, max1)  + P.taux_wi * min_(f7wi, max2)
def _cd_eparet(f6ps, f6rs, f6ss, f6pt, f6rt, f6st, f6pu, f6ru, f6su, _P):
    '''
    Épargne retraite - PERP, PRÉFON, COREM et CGOS
    2004-
    '''
    # TODO: En théorie, les plafonds de déductions (ps, pt, pu) sont calculés sur
    # le formulaire 2041 GX
    return ((f6ps == 0) * (f6rs + f6ss) +
            (f6ps != 0) * min_(f6rs + f6ss, f6ps) + (f6pt == 0) *
            (f6rt + f6st) + (f6pt != 0) * min_(f6rt + f6st, f6pt) +
            (f6pu == 0) * (f6ru + f6su) +
            (f6pu != 0) * min_(f6ru + f6su, f6pu))
    def function(self, simulation, period):
        '''
        Souscriptions en faveur du cinéma ou de l’audiovisuel (case AA de la
        déclaration n° 2042 complémentaire)
        '''
        period = period.this_year
        f6aa = simulation.calculate('f6aa', period)
        rbg_int = simulation.calculate('rbg_int', period)
        cinema = simulation.legislation_at(period.start).impot_revenu.charges_deductibles.cinema

        max1 = min_(cinema.taux * rbg_int, cinema.max)
        return period, min_(f6aa, max1)
    def function(self, simulation, period):
        '''
        Versements sur un compte épargne codéveloppement (case EH de la déclaration
        complémentaire)
        '''
        period = period.this_year
        f6eh = simulation.calculate('f6eh', period)
        rbg_int = simulation.calculate('rbg_int', period)
        ecodev = simulation.legislation_at(period.start).impot_revenu.charges_deductibles.compte_epargne_codev

        plafond = min_(ecodev.plafond_pct_rng * rbg_int, ecodev.plafond)
        return period, min_(f6eh, plafond)
Example #43
0
def _teicaa(f5qm, f5rm):
    '''
    Taxe exceptionelle sur l'indemnité compensatrice des agents d'assurance
    '''
    #     H90_a1 = 0*max_(0,min_(f5qm,23000))
    H90_a2 = .04*max_(0,min_(f5qm - 23000,107000))
    H90_a3 = .026*max_(0,f5qm - 107000)
    #     H90_b1 = 0*max_(0,min_(f5rm,23000))
    H90_b2 = .04*max_(0,min_(f5qm-23000,107000))
    H90_b3 = .026*max_(0,f5qm - 107000)
    
    return H90_a2 + H90_a3 + H90_b2 + H90_b3
def _invrev(marpac, f7gs, f7gt, f7xg, f7gu, f7gv, _P):
    '''
    Investissements locatifs dans les résidences de tourisme situées dans une zone de 
    revitalisation rurale (cases GS, GT, XG, GU et GV)
    2002-2003
    TODO 1/4 codé en dur
    '''
    P = _P.ir.reductions_impots.invrev
    return (P.taux_gs * min_(f7gs, P.seuil_gs * (1 + marpac)) / 4 +
            P.taux_gu * min_(f7gu, P.seuil_gu * (1 + marpac)) / 4 +
            P.taux_xg * min_(f7xg, P.seuil_xg * (1 + marpac)) / 4 +
            P.taux_gt * f7gt + P.taux_gt * f7gv)
Example #45
0
def _isf_imm_non_bati(b1bc, b1be, b1bh, b1bk, P = law.isf.nonbat):
    '''
    Immeubles non bâtis
    '''
    # forêts
    b1bd = b1bc * P.taux_f
    # bien ruraux loués à long terme
    b1bf = min_(b1be, P.seuil) * P.taux_r1
    b1bg = max_(b1be - P.seuil, 0) * P.taux_r2
    # part de groupements forestiers- agricoles fonciers
    b1bi = min_(b1bh, P.seuil) * P.taux_r1
    b1bj = max_(b1bh - P.seuil, 0) * P.taux_r2
    return b1bd + b1bf + b1bg + b1bi + b1bj + b1bk
    def function(self, simulation, period):
        '''
        Versements sur un compte épargne codéveloppement (case EH de la déclaration
        complémentaire)
        '''
        period = period.this_year
        f6eh = simulation.calculate('f6eh', period)
        rbg_int = simulation.calculate('rbg_int', period)
        ecodev = simulation.legislation_at(
            period.start).impot_revenu.charges_deductibles.compte_epargne_codev

        plafond = min_(ecodev.plafond_pct_rng * rbg_int, ecodev.plafond)
        return period, min_(f6eh, plafond)
Example #47
0
def _preetu(f7uk, f7vo, f7td, _P):
    '''
    Crédit d’impôt pour souscription de prêts étudiants (cases 7UK, 7VO et 7TD)
    2005-
    '''
    P = _P.ir.credits_impot.preetu
    
    if   _P.datesim.year == 2005:  max1 = P.max
    elif _P.datesim.year >= 2006:  max1 = P.max*(1+f7vo)
    if _P.datesim.year in (2005,2006,2007):
        return P.taux*min_(f7uk, max1)
    elif _P.datesim.year >=2008:
        return P.taux*min_(f7uk, P.max) + P.taux*min_(f7td, max1)
    def function(self, simulation, period):
        '''
        Souscriptions en faveur du cinéma ou de l’audiovisuel (case AA de la
        déclaration n° 2042 complémentaire)
        '''
        period = period.this_year
        f6aa = simulation.calculate('f6aa', period)
        rbg_int = simulation.calculate('rbg_int', period)
        cinema = simulation.legislation_at(
            period.start).impot_revenu.charges_deductibles.cinema

        max1 = min_(cinema.taux * rbg_int, cinema.max)
        return period, min_(f6aa, max1)
def _cd_penali(f6gi, f6gj, f6gp, f6el, f6em, f6gu, _P):
    '''
    Pensions alimentaires
    '''
    P = _P.ir.charges_deductibles.penalim
    max1 = P.max
    taux_jgt_2006 = P.taux_jgt_2006
    # TODO: si vous subvenez seul(e) à l'entretien d'un enfant marié ou
    # pacsé ou chargé de famille, quel que soit le nmbre d'enfants du jeune
    # foyer, la déduction est limitée à 2*max
    return (min_(f6gi * (1 + taux_jgt_2006), max1) +
            min_(f6gj * (1 + taux_jgt_2006), max1) + min_(f6el, max1) +
            min_(f6em, max1) + f6gp * (1 + taux_jgt_2006) + f6gu)
    def function(self, simulation, period):
        '''
        Versements sur un compte épargne codéveloppement (case EH de la déclaration
        complémentaire)
        2007-2008
        '''
        period = period.start.offset('first-of', 'month').period('year')
        f6eh = simulation.calculate('f6eh', period)
        rbg_int = simulation.calculate('rbg_int', period)
        ecodev = simulation.legislation_at(period.start).ir.charges_deductibles.ecodev

        max1 = min_(ecodev.taux * rbg_int, ecodev.max)
        return period, min_(f6eh, max1)
def _invfor(marpac, f7un, _P):
    '''
    Investissements forestiers
    '''
    P = _P.ir.reductions_impots.invfor
    if _P.datesim.year <= 2002:
        seuil = P.seuil * (marpac + 1)
        return P.taux * min_(f7un, seuil)
    elif _P.datesim.year <= 2008:
        return P.taux * f7un
    else:
        seuil = 0  # TODO vérifier la notice à partir de 2009
        return P.taux * min_(f7un, seuil)
Example #52
0
def _isf_imm_non_bati(b1bc, b1be, b1bh, b1bk, _P):
    '''
    Immeubles non bâtis
    '''
    P = _P.isf.nonbat
    # forêts
    b1bd = b1bc * P.taux_f
    # bien ruraux loués à long terme
    b1bf = min_(b1be, P.seuil) * P.taux_r1
    b1bg = max_(b1be - P.seuil, 0) * P.taux_r2
    # part de groupements forestiers- agricoles fonciers
    b1bi = min_(b1bh, P.seuil) * P.taux_r1
    b1bj = max_(b1bh - P.seuil, 0) * P.taux_r2
    return b1bd + b1bf + b1bg + b1bi + b1bj + b1bk
Example #53
0
    def function(self, simulation, period):
        '''
        Versements sur un compte épargne codéveloppement (case EH de la déclaration
        complémentaire)
        2007-2008
        '''
        period = period.start.offset('first-of', 'month').period('year')
        f6eh = simulation.calculate('f6eh', period)
        rbg_int = simulation.calculate('rbg_int', period)
        ecodev = simulation.legislation_at(
            period.start).ir.charges_deductibles.ecodev

        max1 = min_(ecodev.taux * rbg_int, ecodev.max)
        return period, min_(f6eh, max1)
def _invlst(marpac, f7xc, f7xd, f7xe, f7xf, f7xg, f7xh, f7xi, f7xj, f7xk, f7xl,
            f7xm, f7xn, f7xo, _P):
    '''
    Investissements locatifs dans le secteur de touristique
    2004-
    '''
    P = _P.ir.reductions_impots.invlst
    seuil1 = P.seuil1 * (1 + marpac)
    seuil2 = P.seuil2 * (1 + marpac)
    seuil3 = P.seuil3 * (1 + marpac)

    if _P.datesim.year == 2004: xc = P.taux_xc * min_(f7xc, seuil1 / 4)
    else: xc = P.taux_xc * min_(f7xc, seuil1 / 6)
    xd = P.taux_xd * f7xd
    xe = P.taux_xe * min_(f7xe, seuil1 / 6)
    xf = P.taux_xf * f7xf
    xg = P.taux_xg * min_(f7xg, seuil2)
    xh = P.taux_xh * min_(f7xh, seuil3)
    xi = P.taux_xi * min_(f7xi, seuil1 / 4)
    xj = P.taux_xj * f7xj
    xk = P.taux_xk * f7xk
    xl = P.taux_xl * min_(f7xl, seuil1 / 6)
    xm = P.taux_xm * f7xm
    xn = P.taux_xn * min_(f7xn, seuil1 / 6)
    xo = P.taux_xo * f7xo
    return xc + xd + xe + xf + xg + xh + xi + xj + xk + xl + xm + xn + xo
Example #55
0
    def function(self, simulation, period):
        '''
        Souscriptions en faveur du cinéma ou de l’audiovisuel (case AA de la
        déclaration n° 2042 complémentaire)
        2002-2005
        '''
        period = period.start.offset('first-of', 'month').period('year')
        f6aa = simulation.calculate('f6aa', period)
        rbg_int = simulation.calculate('rbg_int', period)
        cinema = simulation.legislation_at(
            period.start).ir.charges_deductibles.cinema

        max1 = min_(cinema.taux * rbg_int, cinema.max)
        return period, min_(f6aa, max1)
def _cd_percap(f6cb, f6da, marpac, _P):
    '''
    Pertes en capital consécutives à la souscription au capital de sociétés 
    nouvelles ou de sociétés en difficulté (cases CB et DA de la déclaration 
    complémentaire)
    '''
    P = _P.ir.charges_deductibles
    if _P.datesim.year <= 2002:
        max_cb = P.percap.max_cb * (1 + marpac)
        return min_(f6cb, max_cb)
    elif _P.datesim.year <= 2006:
        max_cb = P.percap.max_cb * (1 + marpac)
        max_da = P.percap.max_da * (1 + marpac)
        return min_(min_(f6cb, max_cb) + min_(f6da, max_da), max_da)
Example #57
0
    def function(self, simulation, period):
        '''
        Souscriptions au capital des SOFIPÊCHE (case CC de la déclaration
        complémentaire)
        2002-2006
        '''
        period = period.start.offset('first-of', 'month').period('year')
        f6cc = simulation.calculate('f6cc', period)
        rbg_int = simulation.calculate('rbg_int', period)
        marpac = simulation.calculate('marpac', period)
        sofipe = simulation.legislation_at(
            period.start).ir.charges_deductibles.sofipe

        max1 = min_(sofipe.taux * rbg_int, sofipe.max * (1 + marpac))
        return period, min_(f6cc, max1)
    def function(self, simulation, period):
        '''
        Souscriptions au capital des SOFIPÊCHE (case CC de la déclaration
        complémentaire)
        '''
        period = period.this_year
        f6cc = simulation.calculate('f6cc', period)
        rbg_int = simulation.calculate('rbg_int', period)
        maries_ou_pacses = simulation.calculate('maries_ou_pacses', period)
        sofipeche = simulation.legislation_at(
            period.start).impot_revenu.charges_deductibles.sofipeche

        plafond = min_(sofipeche.plafond_pct_rng * rbg_int,
                       sofipeche.plafond * (1 + maries_ou_pacses))
        return period, min_(f6cc, plafond)