OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 149 | Rev 177 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 149 Rev 156
Line 13... Line 13...
13
 
13
 
14
 package org.openconcerto.erp.generationEcritures;
14
 package org.openconcerto.erp.generationEcritures;
15
 
15
 
16
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
16
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
17
import org.openconcerto.erp.core.finance.accounting.element.JournalSQLElement;
17
import org.openconcerto.erp.core.finance.accounting.element.JournalSQLElement;
-
 
18
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
18
import org.openconcerto.erp.model.PrixHT;
19
import org.openconcerto.erp.model.PrixHT;
19
import org.openconcerto.erp.model.PrixTTC;
20
import org.openconcerto.erp.model.PrixTTC;
20
import org.openconcerto.sql.model.SQLRow;
21
import org.openconcerto.sql.model.SQLRow;
-
 
22
import org.openconcerto.sql.model.SQLRowAccessor;
21
import org.openconcerto.sql.model.SQLRowValues;
23
import org.openconcerto.sql.model.SQLRowValues;
22
import org.openconcerto.sql.model.SQLTable;
24
import org.openconcerto.sql.model.SQLTable;
23
 
25
 
24
import java.util.Date;
26
import java.util.Date;
25
 
27
 
Line 89... Line 91...
89
        this.putValue("DEBIT", Long.valueOf(0));
91
        this.putValue("DEBIT", Long.valueOf(0));
90
        this.putValue("CREDIT", Long.valueOf(prixHT.getLongValue()));
92
        this.putValue("CREDIT", Long.valueOf(prixHT.getLongValue()));
91
        SQLRow rowEcr = ajoutEcriture();
93
        SQLRow rowEcr = ajoutEcriture();
92
        // addAssocAnalytiqueFromProvider(rowEcr, avoirRow);
94
        // addAssocAnalytiqueFromProvider(rowEcr, avoirRow);
93
 
95
 
-
 
96
        SQLRowAccessor taxe = TaxeCache.getCache().getRowFromId(avoirRow.getForeignID("ID_TAXE"));
94
        if (prixTVA.getLongValue() > 0) {
97
        if (prixTVA.getLongValue() > 0) {
95
            // compte TVA
98
            // compte TVA
96
            int idCompteTVA = rowPrefsCompte.getInt("ID_COMPTE_PCE_TVA_ACHAT");
99
            int idCompteTVA = rowPrefsCompte.getInt("ID_COMPTE_PCE_TVA_ACHAT");
97
            if (avoirRow.getBoolean("IMMO")) {
100
            if (avoirRow.getBoolean("IMMO")) {
98
                idCompteTVA = rowPrefsCompte.getInt("ID_COMPTE_PCE_TVA_IMMO");
101
                idCompteTVA = rowPrefsCompte.getInt("ID_COMPTE_PCE_TVA_IMMO");
99
                if (idCompteTVA <= 1) {
102
                if (idCompteTVA <= 1) {
100
                    idCompteTVA = ComptePCESQLElement.getIdComptePceDefault("TVAImmo");
103
                    idCompteTVA = ComptePCESQLElement.getIdComptePceDefault("TVAImmo");
101
                }
104
                }
102
            } else {
105
            } else {
-
 
106
                if (rowFourn.getBoolean("UE")) {
-
 
107
                    idCompteTVA = taxe.getForeignID("ID_COMPTE_PCE_DED_INTRA");
-
 
108
                    if (idCompteTVA <= 1) {
-
 
109
                        idCompteTVA = rowPrefsCompte.getInt("ID_COMPTE_PCE_TVA_INTRA");
-
 
110
                        if (idCompteTVA <= 1) {
-
 
111
                            idCompteTVA = ComptePCESQLElement.getIdComptePceDefault("TVAIntraComm");
-
 
112
                        }
-
 
113
                    }
-
 
114
                } else {
103
                idCompteTVA = rowPrefsCompte.getInt("ID_COMPTE_PCE_TVA_ACHAT");
115
                    idCompteTVA = rowPrefsCompte.getInt("ID_COMPTE_PCE_TVA_ACHAT");
104
                if (idCompteTVA <= 1) {
116
                    if (idCompteTVA <= 1) {
105
                    idCompteTVA = ComptePCESQLElement.getIdComptePceDefault("TVADeductible");
117
                        idCompteTVA = ComptePCESQLElement.getIdComptePceDefault("TVADeductible");
106
                }
118
                    }
107
            }
119
                }
-
 
120
            }
108
 
121
 
109
            this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteTVA));
122
            this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteTVA));
110
            this.putValue("DEBIT", Long.valueOf(0));
123
            this.putValue("DEBIT", Long.valueOf(0));
111
            this.putValue("CREDIT", Long.valueOf(prixTVA.getLongValue()));
124
            this.putValue("CREDIT", Long.valueOf(prixTVA.getLongValue()));
112
            ajoutEcriture();
125
            ajoutEcriture();
113
 
126
 
114
            if (rowFourn.getBoolean("UE")) {
127
            if (rowFourn.getBoolean("UE")) {
-
 
128
                int idCompteTVAIntra = taxe.getForeignID("ID_COMPTE_PCE_COLLECTE_INTRA");
-
 
129
                if (idCompteTVAIntra <= 1) {
115
                int idCompteTVAIntra = rowPrefsCompte.getInt("ID_COMPTE_PCE_TVA_INTRA");
130
                    idCompteTVAIntra = rowPrefsCompte.getInt("ID_COMPTE_PCE_TVA_INTRA");
116
                if (idCompteTVAIntra <= 1) {
131
                    if (idCompteTVAIntra <= 1) {
117
                    idCompteTVAIntra = ComptePCESQLElement.getIdComptePceDefault("TVAIntraComm");
132
                        idCompteTVAIntra = ComptePCESQLElement.getIdComptePceDefault("TVAIntraComm");
118
                }
133
                    }
-
 
134
                }
119
                this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteTVAIntra));
135
                this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteTVAIntra));
120
                this.putValue("DEBIT", Long.valueOf(prixTVA.getLongValue()));
136
                this.putValue("DEBIT", Long.valueOf(prixTVA.getLongValue()));
121
                this.putValue("CREDIT", Long.valueOf(0));
137
                this.putValue("CREDIT", Long.valueOf(0));
122
                ajoutEcriture();
138
                ajoutEcriture();
123
            }
139
            }