OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 149 Rev 151
Line 258... Line 258...
258
        // createConnexion();
258
        // createConnexion();
259
        try {
259
        try {
260
            SQLUtils.executeAtomic(Configuration.getInstance().getSystemRoot().getDataSource(), new SQLUtils.SQLFactory<Object>() {
260
            SQLUtils.executeAtomic(Configuration.getInstance().getSystemRoot().getDataSource(), new SQLUtils.SQLFactory<Object>() {
261
                @Override
261
                @Override
262
                public Object create() throws SQLException {
262
                public Object create() throws SQLException {
-
 
263
 
263
                    final int imported = importReceipts(tickets, null);
264
                    final int imported = importReceipts(tickets, null);
264
 
265
 
265
                    // mark imported
266
                    // mark imported
266
                    for (Ticket ticket : tickets) {
267
                    for (Ticket ticket : tickets) {
267
                        final ReceiptCode code = ticket.getReceiptCode();
268
                        final ReceiptCode code = ticket.getReceiptCode();
Line 376... Line 377...
376
                long longValueTotalTVA = calc.getTotalTVA().movePointRight(2).setScale(0, RoundingMode.HALF_UP).longValue();
377
                long longValueTotalTVA = calc.getTotalTVA().movePointRight(2).setScale(0, RoundingMode.HALF_UP).longValue();
377
                rowVals.put("TOTAL_TVA", longValueTotalTVA);
378
                rowVals.put("TOTAL_TVA", longValueTotalTVA);
378
 
379
 
379
                // Paiements
380
                // Paiements
380
                for (Paiement paiement : ticket.getPaiements()) {
381
                for (Paiement paiement : ticket.getPaiements()) {
381
                    if (paiement.getMontantInCents() > 0 && paiement.getType() != Paiement.SOLDE) {
382
                    if (paiement.getMontantInCents() != 0 && paiement.getType() != Paiement.SOLDE) {
382
 
383
 
383
                        SQLRowValues rowValsElt = new SQLRowValues(eltEnc.getTable());
384
                        SQLRowValues rowValsElt = new SQLRowValues(eltEnc.getTable());
384
                        SQLRowValues rowValsEltMode = new SQLRowValues(eltMode.getTable());
385
                        SQLRowValues rowValsEltMode = new SQLRowValues(eltMode.getTable());
385
                        if (paiement.getType() == Paiement.CB) {
386
                        if (paiement.getType() == Paiement.CB) {
386
                            rowValsEltMode.put("ID_TYPE_REGLEMENT", TypeReglementSQLElement.CB);
387
                            rowValsEltMode.put("ID_TYPE_REGLEMENT", TypeReglementSQLElement.CB);
Line 683... Line 684...
683
        }
684
        }
684
 
685
 
685
    }
686
    }
686
 
687
 
687
    public void print(Printable ticket) {
688
    public void print(Printable ticket) {
-
 
689
        print(ticket, 0);
-
 
690
    }
-
 
691
 
-
 
692
    public void print(Printable ticket, int additionnalCopy) {
688
        print(ticket, this.ticketPrinterConf1);
693
        print(ticket, this.ticketPrinterConf1, additionnalCopy);
689
        print(ticket, this.ticketPrinterConf2);
694
        print(ticket, this.ticketPrinterConf2, additionnalCopy);
690
    }
695
    }
691
 
696
 
692
    public void printOnceOnFirstPrinter(Printable ticket) {
697
    public void printOnceOnFirstPrinter(Printable ticket) {
693
        if (this.ticketPrinterConf1.isValid()) {
698
        if (this.ticketPrinterConf1.isValid()) {
694
            final TicketPrinter prt = this.ticketPrinterConf1.createTicketPrinter();
699
            final TicketPrinter prt = this.ticketPrinterConf1.createTicketPrinter();
695
            ticket.print(prt, this.ticketPrinterConf1.getTicketWidth());
700
            ticket.print(prt, this.ticketPrinterConf1.getTicketWidth());
696
        }
701
        }
697
    }
702
    }
698
 
703
 
699
    public void print(Printable ticket, TicketPrinterConfiguration conf) {
704
    public void print(Printable ticket, TicketPrinterConfiguration conf) {
-
 
705
        print(ticket, conf, 0);
-
 
706
    }
-
 
707
 
-
 
708
    public void print(Printable ticket, TicketPrinterConfiguration conf, int additionnalCopy) {
-
 
709
        int copyCount = conf.getCopyCount() + additionnalCopy;
700
        if (conf.isValid() && conf.getCopyCount() > 0) {
710
        if (conf.isValid() && copyCount > 0) {
701
            final TicketPrinter prt = conf.createTicketPrinter();
711
            final TicketPrinter prt = conf.createTicketPrinter();
702
            for (int i = 0; i < conf.getCopyCount(); i++) {
712
            for (int i = 0; i < copyCount; i++) {
703
                ticket.print(prt, conf.getTicketWidth());
713
                ticket.print(prt, conf.getTicketWidth());
704
            }
714
            }
705
        }
715
        }
706
    }
716
    }
707
 
717