OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 156 Rev 174
Line 63... Line 63...
63
    private DeviseField textTotalHT, textTotalHTSel;
63
    private DeviseField textTotalHT, textTotalHTSel;
64
    private DeviseField textTotalTVA, textTotalTVASel;
64
    private DeviseField textTotalTVA, textTotalTVASel;
65
    private DeviseField textTotalTTC, textTotalTTCSel;
65
    private DeviseField textTotalTTC, textTotalTTCSel;
66
    private DeviseField textPortHT;
66
    private DeviseField textPortHT;
67
    private DeviseField textRemiseHT, textTotalEco, textTotalEcoSel;
67
    private DeviseField textRemiseHT, textTotalEco, textTotalEcoSel;
-
 
68
    private JTextField textTVAFix;
68
    private JTextField textPoids;
69
    private JTextField textPoids;
69
    private DeviseField textTotalDevise, textTotalDeviseSel;
70
    private DeviseField textTotalDevise, textTotalDeviseSel;
70
    private DeviseField textService, textServiceSel;
71
    private DeviseField textService, textServiceSel;
71
    private DeviseField textHA, textHASel;
72
    private DeviseField textHA, textHASel;
72
    private JTextField marge, margeSel;
73
    private JTextField marge, margeSel;
Line 112... Line 113...
112
        this.textTotalTTC = textTotalTTC;
113
        this.textTotalTTC = textTotalTTC;
113
        this.textPortHT = textPortHT;
114
        this.textPortHT = textPortHT;
114
        this.textRemiseHT = textRemiseHT;
115
        this.textRemiseHT = textRemiseHT;
115
        this.textService = textService;
116
        this.textService = textService;
116
        this.textFraisDoc = new DeviseField();
117
        this.textFraisDoc = new DeviseField();
-
 
118
        this.textTVAFix = new DeviseField();
117
        this.textFraisDocSel = new DeviseField();
119
        this.textFraisDocSel = new DeviseField();
118
        this.textTotalHTSel = new DeviseField(true);
120
        this.textTotalHTSel = new DeviseField(true);
119
        this.textServiceSel = new DeviseField();
121
        this.textServiceSel = new DeviseField();
120
        this.textTotalEcoSel = new DeviseField();
122
        this.textTotalEcoSel = new DeviseField();
121
        this.textTotalTTCSel = new DeviseField();
123
        this.textTotalTTCSel = new DeviseField();
Line 145... Line 147...
145
        reconfigure(this.textService);
147
        reconfigure(this.textService);
146
        reconfigure(this.textHA);
148
        reconfigure(this.textHA);
147
        reconfigure(this.marge);
149
        reconfigure(this.marge);
148
        reconfigure(this.textTotalHTSel);
150
        reconfigure(this.textTotalHTSel);
149
        reconfigure(this.textFraisDoc);
151
        reconfigure(this.textFraisDoc);
-
 
152
        reconfigure(this.textTVAFix);
150
        reconfigure(this.textFraisDocSel);
153
        reconfigure(this.textFraisDocSel);
151
        reconfigure(this.textTotalEcoSel);
154
        reconfigure(this.textTotalEcoSel);
152
        reconfigure(this.textTotalTVASel);
155
        reconfigure(this.textTotalTVASel);
153
        reconfigure(this.textTotalTTCSel);
156
        reconfigure(this.textTotalTTCSel);
154
        reconfigure(this.textServiceSel);
157
        reconfigure(this.textServiceSel);
Line 437... Line 440...
437
    public void setTextFraisDoc(DeviseField textFraisDoc, SQLRequestComboBox boxTVA) {
440
    public void setTextFraisDoc(DeviseField textFraisDoc, SQLRequestComboBox boxTVA) {
438
        this.textFraisDoc = textFraisDoc;
441
        this.textFraisDoc = textFraisDoc;
439
        this.selFraisDocTVA = boxTVA;
442
        this.selFraisDocTVA = boxTVA;
440
    }
443
    }
441
 
444
 
-
 
445
    public void setTextFixTVA(JTextField textTVAFix) {
-
 
446
        this.textTVAFix = textTVAFix;
-
 
447
    }
-
 
448
 
442
    public void setIntraComm(boolean intraComm) {
449
    public void setIntraComm(boolean intraComm) {
443
        this.intraComm = intraComm;
450
        this.intraComm = intraComm;
444
        updateTotal();
451
        updateTotal();
445
    }
452
    }
446
 
453
 
Line 511... Line 518...
511
     * 
518
     * 
512
     */
519
     */
513
    public void updateTotal() {
520
    public void updateTotal() {
514
 
521
 
515
        final long valRemiseHT;
522
        final long valRemiseHT;
516
        final BigDecimal valPortHT, fraisDoc;
523
        final BigDecimal valPortHT, fraisDoc, tvaFix;
517
 
524
 
518
        clearTextField();
525
        clearTextField();
519
        // Clone rows to be thread safe
526
        // Clone rows to be thread safe
520
        final List<SQLRowValues> vals = articleTable.getRowValuesAtLevel(1);
527
        final List<SQLRowValues> vals = articleTable.getRowValuesAtLevel(1);
521
        final List<SQLRowValues> list = new ArrayList<SQLRowValues>(vals.size());
528
        final List<SQLRowValues> list = new ArrayList<SQLRowValues>(vals.size());
Line 617... Line 624...
617
            rowValsFraisDoc.put("SERVICE", Boolean.TRUE);
624
            rowValsFraisDoc.put("SERVICE", Boolean.TRUE);
618
        } else {
625
        } else {
619
            rowValsFraisDoc = null;
626
            rowValsFraisDoc = null;
620
        }
627
        }
621
 
628
 
-
 
629
        // Fix TVA si écart avec facture fournisseur
-
 
630
        if (textTVAFix.getText().trim().length() > 0) {
-
 
631
            if (!textTVAFix.getText().trim().equals("-")) {
-
 
632
                long p = GestionDevise.parseLongCurrency(textTVAFix.getText().trim());
-
 
633
                tvaFix = new BigDecimal(p).movePointLeft(2);
-
 
634
            } else {
-
 
635
                tvaFix = BigDecimal.ZERO;
-
 
636
            }
-
 
637
        } else {
-
 
638
            tvaFix = BigDecimal.ZERO;
-
 
639
        }
-
 
640
 
622
        final Boolean isServiceActive = bServiceActive;
641
        final Boolean isServiceActive = bServiceActive;
623
        if (worker != null) {
642
        if (worker != null) {
624
            worker.cancel(true);
643
            worker.cancel(true);
625
        }
644
        }
626
        worker = new SwingWorker<TotalCalculator, Object>() {
645
        worker = new SwingWorker<TotalCalculator, Object>() {
Line 704... Line 723...
704
 
723
 
705
                if (rowValsFraisDoc != null) {
724
                if (rowValsFraisDoc != null) {
706
                    calc.addLine(rowValsFraisDoc, null, 0, false);
725
                    calc.addLine(rowValsFraisDoc, null, 0, false);
707
                }
726
                }
708
 
727
 
-
 
728
                calc.addTVAAdjust(tvaFix);
-
 
729
 
709
                // Verification du resultat ht +tva = ttc
730
                // Verification du resultat ht +tva = ttc
710
                calc.checkResult();
731
                calc.checkResult();
711
                if (Thread.currentThread().isInterrupted()) {
732
                if (Thread.currentThread().isInterrupted()) {
712
                    throw new InterruptedException();
733
                    throw new InterruptedException();
713
                }
734
                }