/******************************************************************************/
/* Files to Include                                                           */
/******************************************************************************/

#include "Process.h"


void ImpressionTotalisateur(unsigned long tot2,float tot1, char partielGlobal)
{
char                reponse[80] = {0};
char                chaine1[20];
char                Impr_longueur;
int                 indice;
int                 interi;
int                 interi2;
float               interf;
float               interf2;
unsigned long       interul;

if (PAR.Impr_TypeTicket == 1)
{
    if (PAR.Impr_PiedPageLigne3[0] != 0)
    {
        Impr_longueur = strlen(&PAR.Impr_PiedPageLigne3[0]);
        sprintf(reponse,"%s%c",PAR.Impr_PiedPageLigne3,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
    }
    if (PAR.Impr_PiedPageLigne2[0] != 0)
    {
        Impr_longueur = strlen(&PAR.Impr_PiedPageLigne2[0]);
        sprintf(reponse,"%s%c",PAR.Impr_PiedPageLigne2,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
    }
    if (PAR.Impr_PiedPageLigne1[0] != 0)
    {
        Impr_longueur = strlen(&PAR.Impr_PiedPageLigne1[0]);
        sprintf(reponse,"%s%c",PAR.Impr_PiedPageLigne1,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
    }

    if (partielGlobal == 1)
        sprintf(chaine1, "Tot partiel =");
    else
        sprintf(chaine1, "Tot global =");
    
    switch (PAR.EchelonTotalisation)
    {
        case  1 :
        case  2 :
        case  3 : sprintf(reponse,"%s %lu%04.3f t%c", chaine1, tot2, tot1, 0x0A); break;
        case  4 :
        case  5 :
        case  6 : sprintf(reponse,"%s %lu%03.2f t%c", chaine1, tot2, tot1, 0x0A); break;
        case  7 :
        case  8 :
        case  9 : sprintf(reponse,"%s %lu%02.1f t%c", chaine1, tot2, tot1, 0x0A); break;
        case 10 :
        case 11 :
        case 12 : sprintf(reponse,"%s %lu%01.0f t%c", chaine1, tot2, tot1, 0x0A); break;
    }
    
    Impr_longueur = strlen(reponse);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur);

    sprintf(reponse,"No ticket = %06i%c", PAR.Impr_NumTicket, 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 19);
    
    sprintf(reponse,"%c%c/%c%c/%c%c%c%c          %c%c:%c%c:%c%c%c",EXP.Date[6],EXP.Date[7],
            EXP.Date[4],EXP.Date[5],EXP.Date[0],EXP.Date[1],EXP.Date[2],EXP.Date[3],
            EXP.Heure[0],EXP.Heure[1],EXP.Heure[2],EXP.Heure[3],EXP.Heure[4],EXP.Heure[5],0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 29);

    if (PAR.Impr_EnteteLigne3[0] != 0)
    {
        Impr_longueur = strlen(&PAR.Impr_EnteteLigne3[0]);
        sprintf(reponse,"%s%c",PAR.Impr_EnteteLigne3,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
    }
    if (PAR.Impr_EnteteLigne2[0] != 0)
    {
        Impr_longueur = strlen(&PAR.Impr_EnteteLigne2[0]);
        sprintf(reponse,"%s%c",PAR.Impr_EnteteLigne2,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
    }
    if (PAR.Impr_EnteteLigne1[0] != 0)
    {
        Impr_longueur = strlen(&PAR.Impr_EnteteLigne1[0]);
        sprintf(reponse,"%s%c",PAR.Impr_EnteteLigne1,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
    }

    if (PAR.Impr_MotCommande & 0x01 == 0x01)
    {
        sprintf(reponse,"%c%c%c%c",0x1D,0x50,0x01,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, 4);
    }

    if (PAR.Impr_NbLignesVides > 0)
    {
        for (indice=1; indice <= PAR.Impr_NbLignesVides; indice++)
        {
            sprintf(reponse,"%c",0x0A);
            EnvoieSerie1(COMM_IMPRIMANTE, reponse, 1);
        }
    }
}

if (PAR.Impr_TypeTicket == 2)                                                   // SPINNKOP
{
    sprintf(reponse,"%c%c/%c%c/%c%c%c%c          %c%c:%c%c:%c%c%c",EXP.Date[6],EXP.Date[7],
            EXP.Date[4],EXP.Date[5],EXP.Date[0],EXP.Date[1],EXP.Date[2],EXP.Date[3],
            EXP.Heure[0],EXP.Heure[1],EXP.Heure[2],EXP.Heure[3],EXP.Heure[4],EXP.Heure[5],0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 29);

    sprintf(reponse,"--------------------------------%c%c%c%c",0x0A, 0x0A, 0x0A, 0x0A, 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 35);

    if (PAR.Impr_PiedPageLigne3[0] != 0)
    {
        Impr_longueur = strlen(&PAR.Impr_PiedPageLigne3[0]);
        sprintf(reponse,"%s%c",PAR.Impr_PiedPageLigne3,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
    }
    if (PAR.Impr_PiedPageLigne2[0] != 0)
    {
        Impr_longueur = strlen(&PAR.Impr_PiedPageLigne2[0]);
        sprintf(reponse,"%s%c",PAR.Impr_PiedPageLigne2,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
    }
    if (PAR.Impr_PiedPageLigne1[0] != 0)
    {
        Impr_longueur = strlen(&PAR.Impr_PiedPageLigne1[0]);
        sprintf(reponse,"%s%c",PAR.Impr_PiedPageLigne1,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
    }

    sprintf(reponse,"%c%c%c--------------------------------%c",0x0A, 0x0A, 0x0A, 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 35);

    Impr_longueur = strlen(&PAR.Impr_Camion[0]);
    sprintf(reponse," %s%c",PAR.Impr_Camion,0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+2);
    sprintf(reponse,"Camion=%c", 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 8);

    Impr_longueur = strlen(&PAR.Impr_Destination[0]);
    sprintf(reponse," %s%c",PAR.Impr_Destination,0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+2);
    sprintf(reponse,"Destination=%c", 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 13);

    Impr_longueur = strlen(&PAR.Impr_Client[0]);
    sprintf(reponse," %s%c",PAR.Impr_Client,0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+2);
    sprintf(reponse,"Client=%c", 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 8);

    Impr_longueur = strlen(&PAR.Impr_Produit[0]);
    sprintf(reponse," %s%c",PAR.Impr_Produit,0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+2);
    sprintf(reponse,"Produit=%c", 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 9);

    sprintf(reponse,"--------------------------------%c", 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 33);

    if (partielGlobal == 1)
        sprintf(chaine1, "Tot partiel =");
    else
        sprintf(chaine1, "Tot global =");
    
    switch (PAR.EchelonTotalisation)
    {
        case  1 :
        case  2 :
        case  3 : sprintf(reponse,"%s %lu%04.3f t%c", chaine1, tot2, tot1, 0x0A); break;
        case  4 :
        case  5 :
        case  6 : sprintf(reponse,"%s %lu%03.2f t%c", chaine1, tot2, tot1, 0x0A); break;
        case  7 :
        case  8 :
        case  9 : sprintf(reponse,"%s %lu%02.1f t%c", chaine1, tot2, tot1, 0x0A); break;
        case 10 :
        case 11 :
        case 12 : sprintf(reponse,"%s %lu%01.0f t%c", chaine1, tot2, tot1, 0x0A); break;
    }
    
    Impr_longueur = strlen(reponse);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur);

    sprintf(reponse,"--------------------------------%c", 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 33);

    sprintf(reponse,"No ticket = %06i%c", PAR.Impr_NumTicket, 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 19);
    
    sprintf(reponse,"%c%c/%c%c/%c%c%c%c          %c%c:%c%c:%c%c%c",EXP.Date[6],EXP.Date[7],
            EXP.Date[4],EXP.Date[5],EXP.Date[0],EXP.Date[1],EXP.Date[2],EXP.Date[3],
            EXP.Heure[0],EXP.Heure[1],EXP.Heure[2],EXP.Heure[3],EXP.Heure[4],EXP.Heure[5],0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 29);

    sprintf(reponse,"--------------------------------%c", 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 33);

    if (PAR.Impr_EnteteLigne3[0] != 0)
    {
        Impr_longueur = strlen(&PAR.Impr_EnteteLigne3[0]);
        sprintf(reponse,"%s%c",PAR.Impr_EnteteLigne3,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
    }
    if (PAR.Impr_EnteteLigne2[0] != 0)
    {
        Impr_longueur = strlen(&PAR.Impr_EnteteLigne2[0]);
        sprintf(reponse,"%s%c",PAR.Impr_EnteteLigne2,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
    }
    if (PAR.Impr_EnteteLigne1[0] != 0)
    {
        Impr_longueur = strlen(&PAR.Impr_EnteteLigne1[0]);
        sprintf(reponse,"%s%c",PAR.Impr_EnteteLigne1,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
    }

    sprintf(reponse,"--------------------------------%c", 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 33);

    if (PAR.Impr_MotCommande & 0x01 == 0x01)
    {
        sprintf(reponse,"%c%c%c%c",0x1D,0x50,0x01,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, 4);
    }

    if (PAR.Impr_NbLignesVides > 0)
    {
        for (indice=1; indice <= PAR.Impr_NbLignesVides; indice++)
        {
            sprintf(reponse,"%c",0x0A);
            EnvoieSerie1(COMM_IMPRIMANTE, reponse, 1);
        }
    }
}

if (PAR.Impr_TypeTicket == 3)                                                   // Pese essieux
{
    sprintf(reponse,"%c%c/%c%c/%c%c%c%c          %c%c:%c%c:%c%c%c",EXP.Date[6],EXP.Date[7],
            EXP.Date[4],EXP.Date[5],EXP.Date[0],EXP.Date[1],EXP.Date[2],EXP.Date[3],
            EXP.Heure[0],EXP.Heure[1],EXP.Heure[2],EXP.Heure[3],EXP.Heure[4],EXP.Heure[5],0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 29);

    sprintf(reponse,"--------------------------------%c%c%c%c",0x0A, 0x0A, 0x0A, 0x0A, 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 35);

    if (PAR.Impr_PiedPageLigne3[0] != 0)
    {
        Impr_longueur = strlen(&PAR.Impr_PiedPageLigne3[0]);
        sprintf(reponse,"%s%c",PAR.Impr_PiedPageLigne3,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
    }
    if (PAR.Impr_PiedPageLigne2[0] != 0)
    {
        Impr_longueur = strlen(&PAR.Impr_PiedPageLigne2[0]);
        sprintf(reponse,"%s%c",PAR.Impr_PiedPageLigne2,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
    }
    if (PAR.Impr_PiedPageLigne1[0] != 0)
    {
        Impr_longueur = strlen(&PAR.Impr_PiedPageLigne1[0]);
        sprintf(reponse,"%s%c",PAR.Impr_PiedPageLigne1,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
    }

    sprintf(reponse,"%c%c%c--------------------------------%c",0x0A, 0x0A, 0x0A, 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 36);

    PAR.Impr_Produit[20] = 0;
    PAR.Impr_Client[20] = 0;
    PAR.Impr_Destination[20] = 0;
    PAR.Impr_Camion[20] = 0;
        
    Impr_longueur = strlen(&PAR.Impr_Camion[0]);
    sprintf(reponse,"Camion=   %s%c", PAR.Impr_Camion, 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur +11);

    Impr_longueur = strlen(&PAR.Impr_Destination[0]);
    sprintf(reponse,"Dest=     %s%c", PAR.Impr_Destination, 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur +11);

    Impr_longueur = strlen(&PAR.Impr_Client[0]);
    sprintf(reponse,"Client=   %s%c", PAR.Impr_Client, 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur +11);

    Impr_longueur = strlen(&PAR.Impr_Produit[0]);
    sprintf(reponse,"Produit=  %s%c", PAR.Impr_Produit, 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur +11);

    sprintf(reponse,"--------------------------------%c", 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 33);

    interul = EXP.PEs_PoidsTotalEssieuxReel; interf = interul;
    sprintf(reponse,"Total =  %06.0f kg%c", interf, 0x0A);
    Impr_longueur = strlen(reponse);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur);

    sprintf(reponse,"--------------------------------%c", 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 33);

    for (indice=EXP.PEs_NbEssieuxPeses; indice>=1; indice--)
    {
        interf = EXP.PEs_PoidsEssieu[indice]; interf = interf/1000;
        sprintf(reponse,"Essieu %02d = %05.0f kg%c", indice, interf, 0x0A);
        Impr_longueur = strlen(reponse);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur);
    }

    sprintf(reponse,"--------------------------------%c", 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 33);

    sprintf(reponse,"No ticket = %06i%c", PAR.Impr_NumTicket, 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 19);
    
    sprintf(reponse,"%c%c/%c%c/%c%c%c%c          %c%c:%c%c:%c%c%c",EXP.Date[6],EXP.Date[7],
            EXP.Date[4],EXP.Date[5],EXP.Date[0],EXP.Date[1],EXP.Date[2],EXP.Date[3],
            EXP.Heure[0],EXP.Heure[1],EXP.Heure[2],EXP.Heure[3],EXP.Heure[4],EXP.Heure[5],0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 29);

    sprintf(reponse,"--------------------------------%c", 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 33);

    if (PAR.Impr_EnteteLigne3[0] != 0)
    {
        Impr_longueur = strlen(&PAR.Impr_EnteteLigne3[0]);
        sprintf(reponse,"%s%c",PAR.Impr_EnteteLigne3,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
    }
    if (PAR.Impr_EnteteLigne2[0] != 0)
    {
        Impr_longueur = strlen(&PAR.Impr_EnteteLigne2[0]);
        sprintf(reponse,"%s%c",PAR.Impr_EnteteLigne2,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
    }
    if (PAR.Impr_EnteteLigne1[0] != 0)
    {
        Impr_longueur = strlen(&PAR.Impr_EnteteLigne1[0]);
        sprintf(reponse,"%s%c",PAR.Impr_EnteteLigne1,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
    }

    sprintf(reponse,"--------------------------------%c", 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 33);

    if (PAR.Impr_MotCommande & 0x01 == 0x01)
    {
        sprintf(reponse,"%c%c%c%c",0x1D,0x50,0x01,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, 4);
    }

    if (PAR.Impr_NbLignesVides > 0)
    {
        for (indice=1; indice <= PAR.Impr_NbLignesVides; indice++)
        {
            sprintf(reponse,"%c",0x0A);
            EnvoieSerie1(COMM_IMPRIMANTE, reponse, 1);
        }
    }
}

if (PAR.Impr_TypeTicket == 4)                                                   // EQIOM
{
    sprintf(reponse,"%c%c/%c%c/%c%c%c%c             %c%c:%c%c:%c%c%c",EXP.Date[6],EXP.Date[7],
            EXP.Date[4],EXP.Date[5],EXP.Date[0],EXP.Date[1],EXP.Date[2],EXP.Date[3],
            EXP.Heure[0],EXP.Heure[1],EXP.Heure[2],EXP.Heure[3],EXP.Heure[4],EXP.Heure[5],0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 32);

    if ((PAR.Impr_PiedPageLigne3[0] != 0)
            || (PAR.Impr_PiedPageLigne2[0] != 0)
            || (PAR.Impr_PiedPageLigne1[0] != 0))
    {
        sprintf(reponse,"--------------------------------%c%c%c%c",0x0A, 0x0A, 0x0A, 0x0A, 0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, 35);
    }
    
    if (PAR.Impr_PiedPageLigne3[0] != 0)
    {
        Impr_longueur = strlen(&PAR.Impr_PiedPageLigne3[0]);
        sprintf(reponse,"%s%c",PAR.Impr_PiedPageLigne3,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
    }
    if (PAR.Impr_PiedPageLigne2[0] != 0)
    {
        Impr_longueur = strlen(&PAR.Impr_PiedPageLigne2[0]);
        sprintf(reponse,"%s%c",PAR.Impr_PiedPageLigne2,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
    }
    if (PAR.Impr_PiedPageLigne1[0] != 0)
    {
        Impr_longueur = strlen(&PAR.Impr_PiedPageLigne1[0]);
        sprintf(reponse,"%s%c",PAR.Impr_PiedPageLigne1,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
    }
    
    sprintf(reponse,"--------------------------------%c", 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 33);

    interf = PAR.DebitMaxLot; interf = interf/10000;
    sprintf(reponse,"Debit max   lot   : %7.2ft/h%c", interf,0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 31);

    interf = EXP.DebitMoyenLot; interf = interf/10000;
    sprintf(reponse,"Debit moyen lot   : %7.2ft/h%c", interf,0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 31);

    sprintf(reponse,"--------------------------------%c", 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 33);

    interi = PAR.TempsArret/3600;
    interi2 = (PAR.TempsArret -interi*3600)/60;
    sprintf(reponse,"Tps arret         : %5dh%02dmin%c", interi,interi2,0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 32);

    interi = PAR.TempsMarcheVide/3600;
    interi2 = (PAR.TempsMarcheVide -interi*3600)/60;
    sprintf(reponse,"Tps marche vide   : %5dh%02dmin%c", interi,interi2,0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 32);

    interi = PAR.TempsMarcheTotalisation/3600;
    interi2 = (PAR.TempsMarcheTotalisation -interi*3600)/60;
    sprintf(reponse,"Tps marche charge : %5dh%02dmin%c", interi,interi2,0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 32);

    sprintf(reponse,"--------------------------------%c", 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 33);

    
    tot1 = PAR.TotalPartiel1;
    tot2 = PAR.TotalPartiel2;
    switch (PAR.EchelonTotalisation)
    {
        case  1 :
        case  2 :
        case  3 : sprintf(reponse,"Total : %lu%04.3f t%c", tot2, tot1, 0x0A); break;
        case  4 :
        case  5 :
        case  6 : sprintf(reponse,"Total : %lu%03.2f t%c", tot2, tot1, 0x0A); break;
        case  7 :
        case  8 :
        case  9 : sprintf(reponse,"Total : %lu%02.1f t%c", tot2, tot1, 0x0A); break;
        case 10 :
        case 11 :
        case 12 : sprintf(reponse,"Total : %lu%01.0f t%c", tot2, tot1, 0x0A); break;
    }
    Impr_longueur = strlen(reponse);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur);

    sprintf(reponse,"--------------------------------%c", 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 33);

    sprintf(reponse,"%c%c/%c%c/%c%c%c%c  %c%c:%c%c%c",PAR.DateDerniereRAZ[0],PAR.DateDerniereRAZ[1],
            PAR.DateDerniereRAZ[3],PAR.DateDerniereRAZ[4],PAR.DateDerniereRAZ[6],PAR.DateDerniereRAZ[7],PAR.DateDerniereRAZ[8],
            PAR.DateDerniereRAZ[9],PAR.DateDerniereRAZ[11],PAR.DateDerniereRAZ[12],PAR.DateDerniereRAZ[14],PAR.DateDerniereRAZ[15],0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 18);

    sprintf(reponse,"Date derniere RAZ : %c", 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 21);

    sprintf(reponse,"--------------------------------%c", 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 33);

    sprintf(reponse,"Num. serie : %c%c%c%c%c%c%c",PAR.NumSerie[0],PAR.NumSerie[1],PAR.NumSerie[2],PAR.NumSerie[3],
            PAR.NumSerie[4],PAR.NumSerie[5],0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, 20);

    sprintf(reponse,"No ticket  : %06i%c", PAR.Impr_NumTicket, 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, strlen(reponse));
    
    sprintf(reponse,"%c%c/%c%c/%c%c%c%c             %c%c:%c%c:%c%c%c",EXP.Date[6],EXP.Date[7],
            EXP.Date[4],EXP.Date[5],EXP.Date[0],EXP.Date[1],EXP.Date[2],EXP.Date[3],
            EXP.Heure[0],EXP.Heure[1],EXP.Heure[2],EXP.Heure[3],EXP.Heure[4],EXP.Heure[5],0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, strlen(reponse));

    if ((PAR.Impr_EnteteLigne3[0] != 0)
            || (PAR.Impr_EnteteLigne2[0] != 0)
            || (PAR.Impr_EnteteLigne1[0] != 0))
    {
        sprintf(reponse,"--------------------------------%c", 0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, 33);
    }
    
    if (PAR.Impr_EnteteLigne3[0] != 0)
    {
        Impr_longueur = strlen(&PAR.Impr_EnteteLigne3[0]);
        sprintf(reponse,"%s%c",PAR.Impr_EnteteLigne3,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
    }
    if (PAR.Impr_EnteteLigne2[0] != 0)
    {
        Impr_longueur = strlen(&PAR.Impr_EnteteLigne2[0]);
        sprintf(reponse,"%s%c",PAR.Impr_EnteteLigne2,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
    }
    if (PAR.Impr_EnteteLigne1[0] != 0)
    {
        Impr_longueur = strlen(&PAR.Impr_EnteteLigne1[0]);
        sprintf(reponse,"%s%c",PAR.Impr_EnteteLigne1,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
    }

    sprintf(reponse,"--------------------------------%c", 0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, strlen(reponse));

    if (PAR.Impr_MotCommande & 0x01 == 0x01)
    {
        sprintf(reponse,"%c%c%c%c",0x1D,0x50,0x01,0x0A);
        EnvoieSerie1(COMM_IMPRIMANTE, reponse, 4);
    }

    if (PAR.Impr_NbLignesVides > 0)
    {
        for (indice=1; indice <= PAR.Impr_NbLignesVides; indice++)
        {
            sprintf(reponse,"%c",0x0A);
            EnvoieSerie1(COMM_IMPRIMANTE, reponse, 1);
        }
    }
}
}

void Impression_BdC_Debut(void)
{
char                reponse[80] = {0};
char                chaine1[20];
char                Impr_longueur;
int                 indice;
float               interf;
unsigned long       interul;

sprintf(reponse,"%c%c/%c%c/%c%c%c%c          %c%c:%c%c:%c%c%c",EXP.Date[6],EXP.Date[7],
         EXP.Date[4],EXP.Date[5],EXP.Date[0],EXP.Date[1],EXP.Date[2],EXP.Date[3],
        EXP.Heure[0],EXP.Heure[1],EXP.Heure[2],EXP.Heure[3],EXP.Heure[4],EXP.Heure[5],0x0A);
EnvoieSerie1(COMM_IMPRIMANTE, reponse, 29);

sprintf(reponse,"--------------------------------%c%c%c%c",0x0A, 0x0A, 0x0A, 0x0A, 0x0A);
EnvoieSerie1(COMM_IMPRIMANTE, reponse, 35);

if (PAR.Impr_EnteteLigne1[0] != 0)
{
    Impr_longueur = strlen(&PAR.Impr_EnteteLigne1[0]);
    sprintf(reponse,"%s%c",PAR.Impr_EnteteLigne1,0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
}
if (PAR.Impr_EnteteLigne2[0] != 0)
{
    Impr_longueur = strlen(&PAR.Impr_EnteteLigne2[0]);
    sprintf(reponse,"%s%c",PAR.Impr_EnteteLigne2,0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
}
if (PAR.Impr_EnteteLigne3[0] != 0)
{
    Impr_longueur = strlen(&PAR.Impr_EnteteLigne3[0]);
    sprintf(reponse,"%s%c",PAR.Impr_EnteteLigne3,0x0A);
    EnvoieSerie1(COMM_IMPRIMANTE, reponse, Impr_longueur+1);
}

sprintf(reponse,"%c%c%c--------------------------------%c",0x0A, 0x0A, 0x0A, 0x0A);
EnvoieSerie1(COMM_IMPRIMANTE, reponse, strlen(reponse));

PAR.Impr_NumTicket++;
sprintf(reponse,"Num. production = %06i%c", PAR.Impr_NumTicket, 0x0A);
EnvoieSerie1(COMM_IMPRIMANTE, reponse, strlen(reponse));
    
sprintf(reponse,"%c%c%c--------------------------------%c",0x0A, 0x0A, 0x0A, 0x0A);
EnvoieSerie1(COMM_IMPRIMANTE, reponse, strlen(reponse));
}


void Impression_BdC_Batch(void)
{
char                reponse[80] = {0};

switch (PAR.NbChiffreVirgPoids)
{
    case 0 : sprintf(reponse,"Batch %03i = %05.0f kg%c", EXP.BdC_NbBatchProduit, EXP.BdC_PoidsDernierBatch, 0x0A); break;
    case 1 : sprintf(reponse,"Batch %03i = %06.1f kg%c", EXP.BdC_NbBatchProduit, EXP.BdC_PoidsDernierBatch, 0x0A); break;
    case 2 : sprintf(reponse,"Batch %03i = %06.2f kg%c", EXP.BdC_NbBatchProduit, EXP.BdC_PoidsDernierBatch, 0x0A); break;
    case 3 : sprintf(reponse,"Batch %03i = %06.3f kg%c", EXP.BdC_NbBatchProduit, EXP.BdC_PoidsDernierBatch, 0x0A); break;
}
EnvoieSerie1(COMM_IMPRIMANTE, reponse, strlen(reponse));
}

void Impression_BdC_Fin(void)
{
char                reponse[80] = {0};

sprintf(reponse,"%c%c%c--------------------------------%c",0x0A, 0x0A, 0x0A, 0x0A);
EnvoieSerie1(COMM_IMPRIMANTE, reponse, strlen(reponse));

sprintf(reponse,"%c%c/%c%c/%c%c%c%c          %c%c:%c%c:%c%c%c",EXP.Date[6],EXP.Date[7],
         EXP.Date[4],EXP.Date[5],EXP.Date[0],EXP.Date[1],EXP.Date[2],EXP.Date[3],
        EXP.Heure[0],EXP.Heure[1],EXP.Heure[2],EXP.Heure[3],EXP.Heure[4],EXP.Heure[5],0x0A);
EnvoieSerie1(COMM_IMPRIMANTE, reponse, strlen(reponse));

sprintf(reponse,"--------------------------------%c%c%c%c",0x0A, 0x0A, 0x0A, 0x0A, 0x0A);
EnvoieSerie1(COMM_IMPRIMANTE, reponse, strlen(reponse));

sprintf(reponse,"Consigne     = %05.0f%c", EXP.Dep_Consigne, 0x0A);
EnvoieSerie1(COMM_IMPRIMANTE, reponse, strlen(reponse));
    
sprintf(reponse,"Totalisation = %05.0f%c", EXP.Dep_PoidsEnCours, 0x0A);
EnvoieSerie1(COMM_IMPRIMANTE, reponse, strlen(reponse));
    
sprintf(reponse,"Nb batchs    = %06i%c", EXP.BdC_NbBatchProduit, 0x0A);
EnvoieSerie1(COMM_IMPRIMANTE, reponse, strlen(reponse));
    
sprintf(reponse,"--------------------------------%c%c%c%c",0x0A, 0x0A, 0x0A, 0x0A, 0x0A);
EnvoieSerie1(COMM_IMPRIMANTE, reponse, strlen(reponse));
}