begin process at 2012 02 10 17:17:02
  Trouver un code source :
 
dans
 
Accueil > Forum > 

ASP / ASP3

 > 

Divers

 > 

Autre

 > 

Executé 2 fonction sur un meme evenement


Derniers messages déposésPoser une question dans le forum ou lancer une discussion

Executé 2 fonction sur un meme evenement

mercredi 30 mai 2007 à 16:44:33 | Executé 2 fonction sur un meme evenement

obel

Bonjour,
Comme j'ai pu constater sur ce forum, il y a toujours une solution, alors je me demander si qq1 en n'aurais une pour moi :
sur un bouton j'ai besoin d'executer 2 fonctions :
fonction 1 en C#,  Insert / Select SQL coté serveur etc ...;
fonction 2 en javascript, Generation de signer dans word  coté client.
Aujourd'hui je n'ai pas de solution pour executer les 2 actions avec une seule opération de l'utilisateur.
je me demandais, si qq1 aurai une idée, soit pour piloter word en C# coté serveur avec word sur le serveur bien sur; soit d'exécuter mes 2 fonctions une à la suite de l'autre (C# puis javascript) avec une seule intervention de l'utilisateur ???

Merci d'avance...
Olivier
mercredi 30 mai 2007 à 22:30:04 | Re : Executé 2 fonction sur un meme evenement

Yopyop

re,

tu peux faire cela de la manière suivante (je pense):

Tu éxécutes ton code côté serveur et à la fin de cette fonction, tu génères un script (javascript) qui appelle ton javascript.
De cette manière, lorsque l'utilisateur clique, la page retourne vers le serveur, exécute insert/update, écrit l'appel à ton javascript.
Lorsque la page est affichée sur le poste client, le javascript se lance automatiquement (grâce au petit bout de javascript que tu as ajouté).

yopyop
jeudi 31 mai 2007 à 14:46:24 | Re : Executé 2 fonction sur un meme evenement

obel

Bonjour,

 

merci de ta reponse, mais j'ai un souci c que ma fonction de génération vers word en javascript est sur la page HTLM entre deux balise SCRIPT donc il ne m'est pas pssible de faire un Response.Write()

donc le ne sais pas comment lancer ma fontion qui est dans ma page aspx depuis mon code behind

 

A+

 

Olivier

 

jeudi 31 mai 2007 à 14:46:32 | Re : Executé 2 fonction sur un meme evenement

obel

Bonjour,

 

merci de ta reponse, mais j'ai un souci c que ma fonction de génération vers word en javascript est sur la page HTLM entre deux balise SCRIPT donc il ne m'est pas pssible de faire un Response.Write()

donc le ne sais pas comment lancer ma fontion qui est dans ma page aspx depuis mon code behind

 

A+

 

Olivier

 

jeudi 31 mai 2007 à 21:02:11 | Re : Executé 2 fonction sur un meme evenement

Yopyop

re,
Voici un example en VB:net

=================== Page ASPX ============================
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Page sans titre</title>
    <script language="javascript">
    function SayHello(){
    alert('Hello');
    }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        &nbsp;
        <hr />
        <asp:Button ID="Button1" runat="server" Text="Button" />
        <hr />
        </div>
    </form>
</body>
</html>

=================== Code Behind ===========================
Partial Class Default2
    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim sb As New System.Text.StringBuilder()

        Try
            'Faire insert dans base
            'Ecrire script pour lancer script
            sb.Append("<script>SayHello();</script>")
            If Not Me.ClientScript.IsClientScriptBlockRegistered("_HelloKey") Then
                Me.ClientScript.RegisterClientScriptBlock(Me.Page.GetType(), "_HelloyKey", sb.ToString())
            End If

        Catch ex As Exception

        End Try
    End Sub
End Class

yopyop
vendredi 1 juin 2007 à 09:43:45 | Re : Executé 2 fonction sur un meme evenement

obel

Bonjour,

ton bout de code fonctionne bien sur une appli "vierge" mais sur mon appli j'ai le même message d'erreur que pour un response.write
Càd : Saut de ligne dans la constante !!!!

je pense apres je peux faire erreur mais je crois que le problème viens du fait que j'ai deja des balises script dans mon cde html

Voila c la merde !!!

vendredi 1 juin 2007 à 10:12:45 | Re : Executé 2 fonction sur un meme evenement

Yopyop

re,

Même si tu as déjà des balises script, cela doit fonctionner.

Peux-tu poster le code de ta page ... ou au moins celui de ton javascript ?

Peut-être que ton script utilise une sting et que dans cette string tu as un caractère spécial ..?

yopyop
lundi 4 juin 2007 à 09:46:49 | Re : Executé 2 fonction sur un meme evenement

obel

Salut et merci beaucoup pour ton aide,
voici le code complet de ma page, je souhaite générer 2 évements sur Enregistrer()
<%@ Page Language="c#" DEBUG="true" %>
<%@ import Namespace="System.Data.SqlClient" %>
<%@ import Namespace="System.Data.SqlTypes" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.IO" %>
<%@ import Namespace="System" %>
<%@ import Namespace="System.Collections" %>
<%@ import Namespace="System.Globalization" %>
<%@ import Namespace="System.Threading" %>
<script runat="server">

 

 String parametre ="server=ITPC1;uid=sa;pwd=FAXCAY;database=SODEL";

 
 
  
 /***********************************************************
                         Variables de transfert Client-Serveur
         ***********************************************************/

               int tailleA_poste;
               String[] tabA_poste_num;
              String[] tabA_poste_corp;
     String[] tabA_poste_intervenant;
  String[] tabA_poste_montant;
  String[] tabA_poste_tva;
  String[] tabA_poste_montant_TT;
  int tailleB_poste;
               String[] tabB_poste_num;
              String[] tabB_poste_corp;
     String[] tabB_poste_intervenant;
  String[] tabB_poste_montant;
  String[] tabB_poste_tva;
  String[] tabB_poste_montant_TT;

 

 

 


 /***********************************************************
          Chargement de la page
     ***********************************************************/
 void Page_Load (Object o, EventArgs e)
     {
                 
  if (! IsPostBack) // On  charge que la 1ere fois
                {
   
                 String id = Session["id"].ToString();
     
   
   //////////////////////////////////////////////////
   ///Requete pour affichage du bouton Recap Berim //
   /////////////////////////////////////////////////   
   
     SqlConnection conB = new SqlConnection(parametre); 
   String requeteB= "SELECT count(*) AS NBerim FROM POSTE WHERE BERIM='1' AND COM_ID ='"+id+"'";
   // on ouvre la connection
                        conB.Open();
                        // Préparation d'une commande
                        SqlCommand maCommandeB=conB.CreateCommand();
                        maCommandeB.CommandText=requeteB;
                 // Envoie de la requete
                 SqlDataReader resultatB= maCommandeB.ExecuteReader();
                 // On se met sur la ligne de resultats
                 resultatB.Read();
   String NB_berim=(String)resultatB["NBerim"].ToString();
   conB.Close();
   if (NB_berim!="0")
   {
    generer_recap_berim.Visible= true;
    recap_berim_doc.Visible=true;
   }
   else
   {
    generer_recap_berim.Visible= false;
    recap_berim_doc.Visible=false;
   }


   //////////////////////////////////////////////////
   ///Requete pour affichage du bouton Recap  //
   /////////////////////////////////////////////////   
   
     SqlConnection conC = new SqlConnection(parametre); 
   String requeteC= "SELECT count(*) AS Nrecap FROM POSTE WHERE BERIM='0' AND COM_ID ='"+id+"'";
   // on ouvre la connection
                        conC.Open();
                        // Préparation d'une commande
                        SqlCommand maCommandeC=conC.CreateCommand();
                        maCommandeC.CommandText=requeteC;
                 // Envoie de la requete
                 SqlDataReader resultatC= maCommandeC.ExecuteReader();
                 // On se met sur la ligne de resultats
                 resultatC.Read();
   String NB_recap=(String)resultatC["Nrecap"].ToString();
   conC.Close();
   if (NB_recap!="0")
   {
    generer_recap.Visible= true;
    recap_doc.Visible=true;
   }
   else
   {
    generer_recap.Visible= false;
    recap_doc.Visible=false;
   }

 


       

   // On charge la dropdownlist :  CORP D'ETAT
                 /****************************************************************/
                 // Declaration de la connection
   SqlConnection con1 = new SqlConnection(parametre);
                 String requete1 ="SELECT * FROM CORP order by CORP_NOM";
                 con1.Open();
                 SqlDataAdapter mdacorpetat= new SqlDataAdapter(requete1,con1);
                 // Utilisation du SQLDataSet
                 DataSet mdscorpetat= new DataSet();
                 // On donne un nom et on charge le dataSet, grace au SqlAdapter
                 mdacorpetat.Fill(mdscorpetat,"CORP");
                 // On lie le datasource à la dropdownlist
                 corpetat.DataSource=mdscorpetat;
                 corpetat.DataTextField="CORP_NOM"; // nom de la colonne
                 corpetat.DataValueField="CORP_ID"; // nom de la clef
                  corpetat.DataBind();
   con1.Close();
   // On charge la dropdownlist :  INTERVENANT
                 /****************************************************************/
                        
                 requete1 ="SELECT * FROM INTERVENANT order by INTER_NOM";
                 con1.Open();
                 SqlDataAdapter mdaintervenant= new SqlDataAdapter(requete1,con1);
                 // Utilisation du SQLDataSet
                 DataSet mdsintervenant= new DataSet();
                 // On donne un nom et on charge le dataSet, grace au SqlAdapter
                 mdaintervenant.Fill(mdsintervenant,"INTERVENANT");
                 // On lie le datasource à la dropdownlist
                 intervenant.DataSource=mdsintervenant;
                 intervenant.DataTextField="INTER_NOM"; // nom de la colonne
                 intervenant.DataValueField="INTER_ID"; // nom de la clef
                 intervenant.DataBind();
   con1.Close();

   // On charge la dropdownlist : TVA
                         /****************************************************************/
   
                         // Chargement de la dropdownlist periode de facturation
                         requete1 ="SELECT * FROM TVA  ";
                         con1.Open();
                         SqlDataAdapter mdaTva= new SqlDataAdapter(requete1,con1);
                         // Utilisation du SQLDataSet
                         DataSet mdsTva= new DataSet();
                         // On donne un nom et on charge le dataSet, grace au SqlAdapter
                         mdaTva.Fill(mdsTva,"TVA_TAUX");
                         // On lie le datasource à la dropdownlist
                         Tva.DataSource=mdsTva;
                         Tva.DataTextField="TVA_TAUX"; // nom de la colonne
                         Tva.DataValueField="TVA_ID"; // nom de la clef
                         Tva.DataBind();
    con1.Close();


   // Declaration de la connection
   SqlConnection con = new SqlConnection(parametre);                
   String requete = "SELECT count(*) as nb  FROM  POSTE WHERE COM_ID='"+id+"' ";
   // on ouvre la connection
                        con.Open();
                        // Préparation d'une commande
                        SqlCommand maCommande=con.CreateCommand();
                        maCommande.CommandText=requete;
                 // Envoie de la requete
                 SqlDataReader resultat= maCommande.ExecuteReader();
                 // On se met sur la ligne de resultats
                 resultat.Read();
   String nb =(String)resultat["NB"].ToString();
   con.Close();
   if (nb!="0")
   {
    /////////////////////////////////
    ///Tableau des Postes         //
    /////////////////////////////////   
     /// Selection et Affichage des postes dans le repeaterposte correspondant si 1 valeur presente
                //******************************************************************************************************************/
                requete ="SELECT BERIM,POS_NUM,BON_NUM,CORP_NOM,POS_MONTANT,INTER_NOM, (POS_MONTANT*(1+TVA_TAUX/100)) AS POS_MONTANT_TTC,TVA_TAUX,CONVERT(char,POS_DATE_DEBUT,103) AS POSDATEDEBUT,CONVERT(char,POS_DATE_FIN,103) AS POSDATEFIN FROM POSTE, INTERVENANT, CORP,TVA WHERE TVA.TVA_ID=POSTE.TVA_ID AND CORP.CORP_ID=POSTE.CORP_ID AND INTERVENANT.INTER_ID= POSTE.INTER_ID AND COM_ID ='"+id+"'";
    // Utilisation du SQLDataAdapter pour realiser la requete
    con.Open();
                SqlDataAdapter monDataAdapterposte= new SqlDataAdapter(requete,con);
                // Utilisation du SQLDataSet (datasource)
                DataSet monDataSetposte= new DataSet();
                // On donne un nom et on charge le dataSet, grace au SqlAdapter
                monDataAdapterposte.Fill(monDataSetposte,"COM_ID");
                monRepeaterposte.DataSource= monDataSetposte.Tables["COM_ID"].DefaultView;
                monRepeaterposte.DataBind();   
    con.Close();
   
   
    // On crée la requete
                  requete= "SELECT ROUND ( SUM(POS_MONTANT),2 ) AS TOTALHT,ROUND ( SUM(POS_MONTANT*(1+TVA_TAUX/100)),2 ) AS TOTALTTC,ROUND ( SUM(POS_MONTANT*(1+TVA_TAUX/100)-POS_MONTANT),2 ) AS TOTALTVA FROM POSTE, TVA WHERE POSTE.TVA_ID=TVA.TVA_ID AND COM_ID='"+id+"'";
    con.Open();
    // Préparation d'une commande
                  SqlCommand maCommande1=con.CreateCommand();
                  maCommande1.CommandText=requete;
                  // Envoie de la requete
                  SqlDataReader resultat1= maCommande1.ExecuteReader();
                  // On se met sur la ligne de resultats
                  resultat1.Read();
    if (resultat1["TOTALHT"].ToString() !="")
    {
     label2.Visible=true;
     label21.Visible=true;
     label22.Visible=true;
     label2.Text="Total des montants HT : ";
     label21.Text="Total des montants TVA : ";
     label22.Text="Total des montants TTC : ";
     label3.Visible=true;
     label4.Visible=true;
     label5.Visible=true;
           double s2=(double)resultat1["TOTALHT"];
     double s3=(double)resultat1["TOTALTVA"];
     double s4=(double)resultat1["TOTALTTC"];
    
    
     label3.Text=""+s2+"  € ";
     label4.Text=""+s3+"  € ";
     label5.Text=""+s4+"  € ";
    }
    else
    {
     label2.Visible=false;
     label3.Visible=false;
     label4.Visible=false;
     label5.Visible=false;
    }
    con.Close();

    
    
    /////////////////////////////////////////////////
    ///Tableau des Postes pour génération de recap //
    ////////////////////////////////////////////////   
   
    // On crée la requete
    requete1= "SELECT count(*) AS NB FROM POSTE WHERE BERIM='0' AND COM_ID ='"+id+"'";
    // on ouvre la connection
                         con.Open();
                         // Préparation d'une commande
                         SqlCommand maCommande0=con.CreateCommand();
                         maCommande0.CommandText=requete1;
                  // Envoie de la requete
                  SqlDataReader resultat0= maCommande0.ExecuteReader();
                  // On se met sur la ligne de resultats
                  resultat0.Read();
    tailleA_poste=resultat0.GetInt32(0);
    con.Close();

 

    if (tailleA_poste !=0)
    {
    // On crée la requete
                  requete= "SELECT ROUND ( SUM(POS_MONTANT),2 ) AS TOTALHT,ROUND ( SUM(POS_MONTANT*(1+TVA_TAUX/100)),2 ) AS TOTALTTC,ROUND ( SUM(POS_MONTANT*(1+TVA_TAUX/100)-POS_MONTANT),2 ) AS TOTALTVA FROM POSTE, TVA WHERE POSTE.TVA_ID=TVA.TVA_ID AND BERIM='0' AND  COM_ID='"+id+"'";
    // on ouvre la connection
                         con.Open();
                         // Préparation d'une commande
                         SqlCommand maCommande000=con.CreateCommand();
                         maCommande000.CommandText=requete;
                  // Envoie de la requete
                  SqlDataReader resultat000= maCommande000.ExecuteReader();
                  // On se met sur la ligne de resultats
                  resultat000.Read();
    double totalhtre=(double)resultat000["TOTALHT"];
    double totaltvare=(double)resultat000["TOTALTVA"];   
    double totalttcre=(double)resultat000["TOTALTTC"];
    totalhtreloc.Value=totalhtre.ToString().Replace(",",".");
    totaltvareloc.Value=totaltvare.ToString().Replace(",",".");
    totalttcreloc.Value=totalttcre.ToString().Replace(",",".");
    con.Close();
      
    
               

    // Préparation d'une commande
                  SqlCommand maCommandex=con.CreateCommand();
                  maCommandex.CommandText=requete;
   

    requete ="SELECT BERIM,BON_NUM,CORP_NOM,POS_MONTANT,INTER_NOM, (POS_MONTANT*(1+TVA_TAUX/100)) AS MONTANT_TTC,TVA_TAUX,CONVERT(char,POS_DATE_DEBUT,103) AS POSDATEDEBUT,CONVERT(char,POS_DATE_FIN,103) AS POSDATEFIN FROM POSTE, INTERVENANT, CORP,TVA WHERE TVA.TVA_ID=POSTE.TVA_ID AND CORP.CORP_ID=POSTE.CORP_ID AND INTERVENANT.INTER_ID= POSTE.INTER_ID AND BERIM='0' AND COM_ID ='"+id+"'";
    con.Open();
        // Préparation d'une commande
                  maCommandex.CommandText=requete;
        SqlDataReader resultatx= maCommandex.ExecuteReader();
                 

                 tabA_poste_num=new String[tailleA_poste+1];
                  tabA_poste_corp=new String[tailleA_poste+1];
                  tabA_poste_intervenant=new String[tailleA_poste+1];
    tabA_poste_montant=new String[tailleA_poste+1];
    tabA_poste_tva=new String[tailleA_poste+1];
    tabA_poste_montant_TT=new String[tailleA_poste+1];
               
    // On se met sur la ligne de resultat
                  int cpt=0;
                  while ( resultatx.Read())
                  {
         tabA_poste_num[cpt]=resultatx["BON_NUM"].ToString().Trim().Replace("\r\n"," ");
         tabA_poste_corp[cpt]=resultatx["CORP_NOM"].ToString().Trim().Replace("\r\n"," ");
         tabA_poste_intervenant[cpt]=resultatx["INTER_NOM"].ToString().Trim().Replace("\r\n"," ");
     tabA_poste_montant[cpt]=resultatx["POS_MONTANT"].ToString().Trim().Replace("\r\n"," ");
                          tabA_poste_tva[cpt]=resultatx["TVA_TAUX"].ToString().Trim().Replace("\r\n"," ");
     tabA_poste_montant_TT[cpt]=resultatx["MONTANT_TTC"].ToString().Trim().Replace("\r\n"," ");
     cpt++;
    }
   
   
    resultatx.Close();
    con.Close(); 
   
    }
  
    ///////////////////////////////////////////////////////
    ///Tableau des Postes pour génération de recap_berim //
    //////////////////////////////////////////////////////   
   
      // On crée la requete
    requete1= "SELECT count(*) AS NB FROM POSTE WHERE BERIM='1' AND COM_ID ='"+id+"'";
    // on ouvre la connection
                         con.Open();
                         // Préparation d'une commande
                         SqlCommand maCommande00=con.CreateCommand();
                         maCommande00.CommandText=requete1;
                  // Envoie de la requete
                  SqlDataReader resultat00= maCommande00.ExecuteReader();
                  // On se met sur la ligne de resultats
                  resultat00.Read();
    tailleB_poste=resultat00.GetInt32(0);
    con.Close();

    if (tailleB_poste !=0)
    {
    // On crée la requete
                  requete= "SELECT ROUND ( SUM(POS_MONTANT),2 ) AS TOTALHT,ROUND ( SUM(POS_MONTANT*(1+TVA_TAUX/100)),2 ) AS TOTALTTC,ROUND ( SUM(POS_MONTANT*(1+TVA_TAUX/100)-POS_MONTANT),2 ) AS TOTALTVA FROM POSTE, TVA WHERE POSTE.TVA_ID=TVA.TVA_ID AND BERIM='1' AND  COM_ID='"+id+"'";
    // on ouvre la connection
                         con.Open();
                         // Préparation d'une commande
                         SqlCommand maCommande0000=con.CreateCommand();
                         maCommande0000.CommandText=requete;
                  // Envoie de la requete
                  SqlDataReader resultat0000= maCommande0000.ExecuteReader();
                  // On se met sur la ligne de resultats
                  resultat0000.Read();
    double totalhtbe=(double)resultat0000["TOTALHT"];
    double totaltvabe=(double)resultat0000["TOTALTVA"];   
    double totalttcbe=(double)resultat0000["TOTALTTC"];
    totalhtberim.Value=totalhtbe.ToString().Replace(",",".");
    totaltvaberim.Value=totaltvabe.ToString().Replace(",",".");
    totalttcberim.Value=totalttcbe.ToString().Replace(",",".");
    con.Close();
    
    

    // Préparation d'une commande
                  SqlCommand maCommande0x=con.CreateCommand();
                  maCommande0x.CommandText=requete;
   
    requete ="SELECT BERIM,BON_NUM,CORP_NOM,POS_MONTANT,INTER_NOM, (POS_MONTANT*(1+TVA_TAUX/100)) AS MONTANT_TTC,TVA_TAUX,CONVERT(char,POS_DATE_DEBUT,103) AS POSDATEDEBUT,CONVERT(char,POS_DATE_FIN,103) AS POSDATEFIN FROM POSTE, INTERVENANT, CORP,TVA WHERE TVA.TVA_ID=POSTE.TVA_ID AND CORP.CORP_ID=POSTE.CORP_ID AND INTERVENANT.INTER_ID= POSTE.INTER_ID AND BERIM='1' AND COM_ID ='"+id+"'";
    con.Open();
        // Préparation d'une commande
                  maCommande0x.CommandText=requete;
        SqlDataReader resultat0x= maCommande0x.ExecuteReader();
                 

                 tabB_poste_num=new String[tailleB_poste+1];
                  tabB_poste_corp=new String[tailleB_poste+1];
                  tabB_poste_intervenant=new String[tailleB_poste+1];
    tabB_poste_montant=new String[tailleB_poste+1];
    tabB_poste_tva=new String[tailleB_poste+1];
    tabB_poste_montant_TT=new String[tailleB_poste+1];
               
    // On se met sur la ligne de resultat
                  int cpt1=0;
                  while ( resultat0x.Read())
                  {
         tabB_poste_num[cpt1]=resultat0x["BON_NUM"].ToString().Trim().Replace("\r\n"," ");
         tabB_poste_corp[cpt1]=resultat0x["CORP_NOM"].ToString().Trim().Replace("\r\n"," ");
         tabB_poste_intervenant[cpt1]=resultat0x["INTER_NOM"].ToString().Trim().Replace("\r\n"," ");
     tabB_poste_montant[cpt1]=resultat0x["POS_MONTANT"].ToString().Trim().Replace("\r\n"," ");
                          tabB_poste_tva[cpt1]=resultat0x["TVA_TAUX"].ToString().Trim().Replace("\r\n"," ");
     tabB_poste_montant_TT[cpt1]=resultat0x["MONTANT_TTC"].ToString().Trim().Replace("\r\n"," ");
     cpt1++;
    }
   
   
    resultat0x.Close();
    con.Close(); 

    }

   
    
    }
  }// fin du postback
  


  


  

  ////////////////////////////////////////////
  ///Affichage des liens vers les Documents //
  ///////////////////////////////////////////
 
    
  String trav = Session["id"].ToString();

  if (!File.Exists("\\\\localhost\\Doc\\recap\\recap_"+trav+".doc"))
  {
                                recap_doc.Enabled=false;
    
    
         
  }
  else
  {
   recap_doc.NavigateUrl="\\Doc\\recap\\recap_"+trav+".doc";
                        recap_doc.Target="_new";
   recap_doc.Enabled=true; 
   generer_recap.Visible= false;
      
  }

  

  if (!File.Exists("\\\\localhost\\Doc\\recap\\recap_berim_"+trav+".doc"))
  {
                                recap_berim_doc.Enabled=false;
    
         
  }
  else
  {
   recap_berim_doc.NavigateUrl="\\Doc\\recap\\recap_berim_"+trav+".doc";
                        recap_berim_doc.Target="_new";
   recap_berim_doc.Enabled=true;  
    generer_recap_berim.Visible= false;   
  }

  

  if(Session["id"] != null)
              {
   //On recupere l'id en session
                  String id = Session["id"].ToString();
   // On recupere le delais d'execution
                 /**********************************************/
                 // Declaration de la connection
   SqlConnection con = new SqlConnection(parametre);                
   String requete = "SELECT PERIODE.PERI_POID FROM COMMANDE, PERIODE WHERE PERIODE.PERI_ID=COMMANDE.PERI_ID  AND COM_ID='"+id+"' ";
   // on ouvre la connection
                        con.Open();
                        // Préparation d'une commande
                        SqlCommand maCommande0=con.CreateCommand();
                        maCommande0.CommandText=requete;
                 // Envoie de la requete
                 SqlDataReader resultat0= maCommande0.ExecuteReader();
                 // On se met sur la ligne de resultats
                 resultat0.Read();
   
   

   // On recupere les informations sur la commande
                 /**********************************************/
   requete = "SELECT CONVERT(char,(COM_DATE + "+resultat0["PERI_POID"]+") ,103) AS COMDATEFIN, CONVERT(char,COM_DATE,103) AS COMDATE,CONVERT(char,COM_DATE_DEBUT,103) AS COMDATEDEBUT, COM_ID,COM_NUM,LOCATAIRE,AFFECTATION,BATIMENT,ETAGE,PERIODE_TMP,CITE_NOM,DISTRICT_NOM,RESP_NOM FROM COMMANDE,CITE, DISTRICT, RESPONSABLE, PERIODE WHERE DISTRICT.DISTRICT_ID=CITE.DISTRICT_ID AND CITE.RESP_ID=RESPONSABLE.RESP_ID AND PERIODE.PERI_ID=COMMANDE.PERI_ID AND COMMANDE.CITE_ID=CITE.CITE_ID AND COM_ID='"+id+"' ";
   // on ouvre la connection
                        con.Close();
   con.Open();
                        // Préparation d'une commande
                        SqlCommand maCommande=con.CreateCommand();
                        maCommande.CommandText=requete;
                 // Envoie de la requete
                 SqlDataReader resultat= maCommande.ExecuteReader();
                 // On se met sur la ligne de resultats
                 resultat.Read();
   num.Value=(String)resultat["COM_ID"].ToString();
   com_num.Text=(String)resultat["COM_NUM"].ToString();
   locataire.Text =(String)resultat["LOCATAIRE"].ToString();
                     affectation.Text =(String)resultat["AFFECTATION"].ToString();
   batiment.Text =(String)resultat["BATIMENT"].ToString();
   etage.Text =(String)resultat["ETAGE"].ToString();
   date.Text =(String)resultat["COMDATE"].ToString();
   datedebut.Text =(String)resultat["COMDATEDEBUT"].ToString();
   periode.Text =(String)resultat["PERIODE_TMP"].ToString();
   cite.Text =(String)resultat["CITE_NOM"].ToString();
   district.Text =(String)resultat["DISTRICT_NOM"].ToString();
   responsable.Text =(String)resultat["RESP_NOM"].ToString();
   datefin.Text = (String)resultat["COMDATEFIN"].ToString();
   con.Close();
   date_day.Value =DateTime.Now.ToString("dd/MM/yyyy");


  
   }
               else
               {
                  erreur.Text="Problème réseaux :Refaire la sélection";  
               }
                
  }
   
 
 /*****************************************************************************************
        Fonction permettant de déclencher l'évènement validation qui correspond au bouton valider
    *******************************************************************************************/

  void selectionner(Object o, RepeaterCommandEventArgs  e)
  {
   
   try
   {
    String id = Session["id"].ToString();
    String identifiant=((LinkButton)e.CommandSource).Text;
    // Declaration de la connection
    SqlConnection con = new SqlConnection(parametre);                
    // On recupere les informations du poste
                  /**********************************************/
    String requete = "SELECT POS_NUM,INTER_NOM FROM POSTE, INTERVENANT WHERE INTERVENANT.INTER_ID=POSTE.INTER_ID AND BON_NUM='"+identifiant+"' AND COM_ID='"+id+"' ";
    // on ouvre la connection
    con.Open();
                         // Préparation d'une commande
                         SqlCommand maCommande=con.CreateCommand();
                         maCommande.CommandText=requete;
                  // Envoie de la requete
                  SqlDataReader resultat= maCommande.ExecuteReader();
                  // On se met sur la ligne de resultats
                  resultat.Read();
    String Intervenant=(String)resultat["INTER_NOM"].ToString();
    String Identifiant=(String)resultat["POS_NUM"].ToString();
    con.Close(); 
    if (Intervenant=="Atec")
    {
   
     Session.Add("id",id);
     Session.Add("poste_id",Identifiant);
     Response.Redirect("poste.aspx");
    }
    else
    {
    Response.Redirect("cotraitant.aspx");
    }
   
   
                   }
   catch(SqlException err)
   {
   Response.Redirect("erreur.aspx");
   }
  }
/*****************************************************************************************
        Fonction permettant de déclencher l'évènement validation qui correspond au bouton valider
    *******************************************************************************************/

  void Enregistrer(Object o,EventArgs e)
  {
  
   try
   {
   SqlConnection con = new SqlConnection(parametre);
                        // on complete les infos
                        String requete= "INSERT INTO CHRONO (DATE_CHRONO) VALUES ('"+date_day.Value+"')";
                        con.Open();
   // Préparation d'une commande
                        SqlCommand maCommande=con.CreateCommand();
                        maCommande.CommandText=requete;
                        // Envoie de la requete
                        maCommande.ExecuteNonQuery();
       con.Close(); 
   //////////////////////////////////////////////////////////////////////////////////////////
   ///  ICI declanchement de la fonction générer coté client /////
   ////////////////////////////////////////////////////////////////////////////////////////

                     
   }
   catch(SqlException err)
   {
   Response.Redirect("erreur.aspx");
   }
  }
 /*****************************************************************************************
        Fonction permettant de déclencher l'ajout d'un poste "ajouter"
    *******************************************************************************************/

 void ajout_poste(Object o,EventArgs e)
  { 

   
   String id = Session["id"].ToString(); 
   String scorpetat= corpetat.SelectedItem.Value;
                String sintervenant= intervenant.SelectedItem.Value;  
   String sTva= Tva.SelectedItem.Value;
   String sberim="";
  try
  { 

   if (berim.Checked != true)
          {
    sberim = "0";
        }
   else
    {
    sberim = "1";
       
    }
   
   SqlConnection con = new SqlConnection(parametre);
                        // on complete les infos
                        String requete= "INSERT INTO POSTE (COM_ID,BON_NUM,INTER_ID,CORP_ID,BERIM,POS_MONTANT,POS_DATE_DEBUT,POS_DATE_FIN,TVA_ID) VALUES ('"+num.Value+"','"+bon.Text.Replace("'","''")+"','"+sintervenant+"','"+scorpetat+"','"+sberim+"','"+montant.Text.Replace("'","''")+"','"+pdatedebut.Text+"','"+pdatefin.Text+"','"+sTva+"')";
                        con.Open();
   // Préparation d'une commande
                        SqlCommand maCommande=con.CreateCommand();
                        maCommande.CommandText=requete;
                        // Envoie de la requete
                        maCommande.ExecuteNonQuery();
       con.Close();
   
   

   
   
   Response.Redirect("macommande.aspx");
                }
  catch(SqlException err)
  {
  Response.Redirect("erreur.aspx");
  }
  }

 

</script>

<html>
<head><script language="JavaScript"> 
 

 function SayHello()
 {
     alert('Hello');
 } 
 
        var g_Debug=false;

        function GetNewDocOnTemplate(p_TemplateUrl)
        {
        var l_WordApp = new ActiveXObject("Word.Application");
        if (g_Debug) l_WordApp.Visible=true;
        l_WordApp.Documents.Add(p_TemplateUrl);
        return l_WordApp;
        }

       
        function NewPropertyOnDoc(p_WordApp,p_PropertyName,p_PropertyValue,p_PropertyType){
         p_WordApp.ActiveDocument.CustomDocumentProperties.Add(p_PropertyName,false,p_PropertyType,p_PropertyValue,0);
        //Attention les champs sont mis  jour dans SaveAndQuitDocTo
        }


       
        function SaveAndQuitDocTo(p_WordApp,p_SaveUrl)
        {
        // p_WordApp.ActiveDocument.Fields.Update();//Met  jour les champs dans le document
  
  p_WordApp.ActiveDocument.Fields.Update(); //modif OBEL 29/12/2004 compatibilité office 2003 et XP
  
  for(i=1;i<=p_WordApp.ActiveDocument.Sections.Count;i++)
  {
   p_WordApp.ActiveDocument.Sections(i).Headers(1).Range.Fields.Update();
   p_WordApp.ActiveDocument.Sections(i).Footers(1).Range.Fields.Update();
   p_WordApp.ActiveDocument.Sections(i).Headers(2).Range.Fields.Update();
   p_WordApp.ActiveDocument.Sections(i).Footers(2).Range.Fields.Update();
  } 

     
   if (!g_Debug) {
        p_WordApp.ActiveDocument.SaveAs(p_SaveUrl);
        p_WordApp.Quit(false);
        }
        delete p_WordApp;       
        }


/****************************************************************************************************************************************/
//    Fonction assurant la génération du TABLEAU DES RECAP
/****************************************************************************************************************************************/
 
            var tailleA_poste;      
            tabA_poste_num= new Array();
            tabA_poste_intervenant= new Array();
            tabA_poste_corp=new Array();
     tabA_poste_montant= new Array();
     tabA_poste_tva=new Array();
            tabA_poste_montant_TT=new Array();
          
         function init_posteA(poste_num,poste_corp,poste_intervenant,poste_montant,poste_tva,poste_montant_TT,indice)
            {
               
  tabA_poste_num[indice]= poste_num;
             tabA_poste_corp[indice]= poste_corp;
  tabA_poste_intervenant[indice]= poste_intervenant;
      tabA_poste_montant[indice]= poste_montant;
      tabA_poste_tva[indice]= poste_tva;
             tabA_poste_montant_TT[indice]= poste_montant_TT;

            }

        function init_tailleA_poste(val)
            {   
                tailleA_poste=val;   
            }

/****************************************************************************************************************************************/
//    Fonction assurant la génération du TABLEAU DES RECAP berim
/****************************************************************************************************************************************/
 
            var tailleB_poste;      
            tabB_poste_num= new Array();
            tabB_poste_intervenant= new Array();
            tabB_poste_corp=new Array();
     tabB_poste_montant= new Array();
     tabB_poste_tva=new Array();
            tabB_poste_montant_TT=new Array();
          
         function init_posteB(poste_num,poste_corp,poste_intervenant,poste_montant,poste_tva,poste_montant_TT,indice)
            {
               
  tabB_poste_num[indice]= poste_num;
             tabB_poste_corp[indice]= poste_corp;
  tabB_poste_intervenant[indice]= poste_intervenant;
      tabB_poste_montant[indice]= poste_montant;
      tabB_poste_tva[indice]= poste_tva;
             tabB_poste_montant_TT[indice]= poste_montant_TT;

            }

        function init_tailleB_poste(val)
            {   
                tailleB_poste=val;   
            }

 

 


    /***********************************************************
                     Generer la fiche recap
    ***********************************************************/
         function generer(choix)
         {
              


  if (choix == 'recap_reloc')
  {
  var g_WordApp=GetNewDocOnTemplate("\\\\localhost\\Doc\\modele\\recap.dot");
  var num = window.document.getElementById("num").value;
  var date_day = window.document.getElementById("date_day").value; 
  var com_num = window.document.getElementById("com_num").value;
  var affectation = window.document.getElementById("affectation").value;
   var cite = window.document.getElementById("cite").value;
   var district = window.document.getElementById("district").value;
  var responsable = window.document.getElementById("responsable").value;
  var totalht = window.document.getElementById("totalhtreloc").value;
  var totaltva = window.document.getElementById("totaltvareloc").value;
  var totalttc = window.document.getElementById("totalttcreloc").value;
  
  // Insertion des valeurs dans les renvois
    NewPropertyOnDoc(g_WordApp,"num",num,4);// 4 ou TYPE_TEXTE;
  NewPropertyOnDoc(g_WordApp,"date_day",date_day,4);// 4 ou TYPE_TEXTE;  
       NewPropertyOnDoc(g_WordApp,"com_num",com_num,4);// 4 ou TYPE_TEXTE; 
  NewPropertyOnDoc(g_WordApp,"affectation",affectation,4);// 4 ou TYPE_TEXTE;
       NewPropertyOnDoc(g_WordApp,"cite",cite,4);// 4 ou TYPE_TEXTE;
  NewPropertyOnDoc(g_WordApp,"district",district,4);// 4 ou TYPE_TEXTE;
       NewPropertyOnDoc(g_WordApp,"responsable",responsable,4);// 4 ou TYPE_TEXTE;   
  NewPropertyOnDoc(g_WordApp,"totalht",totalht,4);// 4 ou TYPE_TEXTE;
  NewPropertyOnDoc(g_WordApp,"totaltva",totaltva,4);// 4 ou TYPE_TEXTE;
   NewPropertyOnDoc(g_WordApp,"totalttc",totalttc,4);// 4 ou TYPE_TEXTE;
         
  //  Gestion des postes   Insertion des postes dans le tableau
         var cel1 =6;
         for(i=2;i<=tailleA_poste+1;i++)
       {
   myRange=g_WordApp.ActiveDocument.Tables(1).Cell(i,1).Range;
                 myRange.InsertAfter(tabA_poste_num[i-2]);
                    
                 myRange=g_WordApp.ActiveDocument.Tables(1).Cell(cel1,2).Range;
                 myRange.InsertAfter(tabA_poste_corp[i-2]);
                
   myRange=g_WordApp.ActiveDocument.Tables(1).Cell(cel1,3).Range;
                 myRange.InsertAfter(tabA_poste_intervenant[i-2]);
                              
   myRange=g_WordApp.ActiveDocument.Tables(1).Cell(cel1,4).Range;
                 myRange.InsertAfter(tabA_poste_montant[i-2]);
    
   myRange=g_WordApp.ActiveDocument.Tables(1).Cell(cel1,5).Range;
                 myRange.InsertAfter(tabA_poste_tva[i-2]);
   
   myRange=g_WordApp.ActiveDocument.Tables(1).Cell(cel1,6).Range;
                 myRange.InsertAfter(tabA_poste_montant_TT[i-2]);
         
                 if(i< (tailleA_poste+1) )
                 {   
                        g_WordApp.ActiveDocument.Tables(1).Rows.Add();
                        cel1=cel1+2;   
                 }              
         }
  //Sauver et quitter
       SaveAndQuitDocTo(g_WordApp,"\\\\localhost\\Doc\\recap\\recap_"+num+".doc"); 
 
 
  }
  
  if (choix == 'recap_berim')
  {
  var g_WordApp=GetNewDocOnTemplate("\\\\localhost\\Doc\\modele\\recap.dot");
  var num = window.document.getElementById("num").value;
  var date_day = window.document.getElementById("date_day").value; 
  var com_num = window.document.getElementById("com_num").value;
  var affectation = window.document.getElementById("affectation").value;
   var cite = window.document.getElementById("cite").value;
   var district = window.document.getElementById("district").value;
  var responsable = window.document.getElementById("responsable").value;
  var totalht = window.document.getElementById("totalhtberim").value;
  var totaltva = window.document.getElementById("totaltvaberim").value;
  var totalttc = window.document.getElementById("totalttcberim").value;
  
  // Insertion des valeurs dans les renvois
         NewPropertyOnDoc(g_WordApp,"num",num,4);// 4 ou TYPE_TEXTE;
  NewPropertyOnDoc(g_WordApp,"date_day",date_day,4);// 4 ou TYPE_TEXTE;  
  NewPropertyOnDoc(g_WordApp,"com_num",com_num,4);// 4 ou TYPE_TEXTE; 
       NewPropertyOnDoc(g_WordApp,"affectation",affectation,4);// 4 ou TYPE_TEXTE;
       NewPropertyOnDoc(g_WordApp,"cite",cite,4);// 4 ou TYPE_TEXTE;
  NewPropertyOnDoc(g_WordApp,"district",district,4);// 4 ou TYPE_TEXTE;
       NewPropertyOnDoc(g_WordApp,"responsable",responsable,4);// 4 ou TYPE_TEXTE;   
  NewPropertyOnDoc(g_WordApp,"totalht",totalht,4);// 4 ou TYPE_TEXTE;
  NewPropertyOnDoc(g_WordApp,"totaltva",totaltva,4);// 4 ou TYPE_TEXTE;
   NewPropertyOnDoc(g_WordApp,"totalttc",totalttc,4);// 4 ou TYPE_TEXTE;
         
  //  Gestion des postes   Insertion des postes dans le tableau
         var cel1 =6;
         for(i=2;i<=tailleB_poste+1;i++)
       {
   myRange=g_WordApp.ActiveDocument.Tables(1).Cell(i,1).Range;
                 myRange.InsertAfter(tabB_poste_num[i-2]);
                    
                 myRange=g_WordApp.ActiveDocument.Tables(1).Cell(cel1,2).Range;
                 myRange.InsertAfter(tabB_poste_corp[i-2]);
                
   myRange=g_WordApp.ActiveDocument.Tables(1).Cell(cel1,3).Range;
                 myRange.InsertAfter(tabB_poste_intervenant[i-2]);
                              
   myRange=g_WordApp.ActiveDocument.Tables(1).Cell(cel1,4).Range;
                 myRange.InsertAfter(tabB_poste_montant[i-2]);
    
   myRange=g_WordApp.ActiveDocument.Tables(1).Cell(cel1,5).Range;
                 myRange.InsertAfter(tabB_poste_tva[i-2]);
   
   myRange=g_WordApp.ActiveDocument.Tables(1).Cell(cel1,6).Range;
                 myRange.InsertAfter(tabB_poste_montant_TT[i-2]);
         
                 if(i< (tailleB_poste+1) )
                 {   
                        g_WordApp.ActiveDocument.Tables(1).Rows.Add();
                        cel1=cel1+2;   
                 }              
         }


  //Sauver et quitter
       SaveAndQuitDocTo(g_WordApp,"\\\\localhost\\Doc\\recap\\recap_berim_"+num+".doc"); 
 
       
  }

      

     window.location.reload();
            alert("La fiche de recap est générée");
     window.scrollTo(0,300); 


         }

 </script>
       

    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
    <link href="../../imgs/menu/veolia.css" type="text/css" rel="StyleSheet" />
    <meta content="MSHTML 6.00.2600.0" name="GENERATOR" />
</head>
<body> 
    <p>
    </p>
    <table cellspacing="0" cellpadding="0" border="0">
        <tbody>
            <tr>
                <td colspan="3">
                    <table cellspacing="0" cellpadding="0" width="100%" border="0">
                        <tbody>
                            <tr>
                                <td width="50">
                                    <img alt="" src="../../imgs/icons/soleils.GIF" border="0" /></td>
                                <td>
                                    <font class="inplacedisplayid303992siteid53"><font color="#a6007b"><strong>Ajouter un Chantier </strong></font></font></td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
            <tr>
                <td colspan="3">
                    <br />
                </td>
            </tr>
            <tr>
                <td width="7">
                    <img height="7" src="../../imgs/box/box_com/corner_tl.gif" width="7" /></td>
                <td background="../../imgs/box/box_com/tranche_t.gif">
                    <img height="7" src="../../imgs/box/box_com/pix_10x10.gif" width="10" /></td>
                <td width="7">
                    <img height="7" src="../../imgs/box/box_com/corner_tr.gif" width="7" /></td>
            </tr>
            <tr>
                <td background="../../imgs/box/box_com/tranche_l.gif">
                    <img height="1" src="../../imgs/box/box_com/pix_10x10.gif" width="1" /></td>
                <td>
                    <form runat="server">
                    <!-- LES CONTROLES -->
                        <asp:ValidationSummary id="valSum" runat="server" ShowSummary="false" ShowMessageBox="true" HeaderText="Erreurs dans le formulaire:"></asp:ValidationSummary>
                        <asp:RegularExpressionValidator id="RangeValidator1" runat="server" Display="none" ErrorMessage="Le format de la date de travaux n'est pas correct : jj/mm/aaaa" ControlToValidate="pdatedebut"  ValidationExpression="[\d]{2}/[\d]{2}/[\d]{4}" enable="no"></asp:RegularExpressionValidator>
   <asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server" Display="none" ErrorMessage="La date de debut de travaux est obligatoire" ControlToValidate="pdatedebut"  ></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator id="RangeValidator2" runat="server" Display="none" ErrorMessage="Le format de la date de travaux n'est pas correct : jj/mm/aaaa" ControlToValidate="pdatefin"  ValidationExpression="[\d]{2}/[\d]{2}/[\d]{4}" enable="no"></asp:RegularExpressionValidator>
   <asp:RequiredFieldValidator id="RequiredFieldValidator2" runat="server" Display="none" ErrorMessage="La date de fin de travaux est obligatoire" ControlToValidate="pdatefin" ></asp:RequiredFieldValidator>
                        <asp:RequiredFieldValidator id="RequiredFieldValidator3" runat="server" Display="none" ErrorMessage="Le numero de Bon est obligatoire" ControlToValidate="bon" ></asp:RequiredFieldValidator>
                        
   <table width="90%">
                            <tbody>
                                <tr>
                                    <td>
                                        <table width="90%" align="center">
                                            <tbody>
                                                <tr>
                                                    <td align="left">
                                                        <table width="90%" align="left" border="0">
                                                            <tbody>
                                                                <tr>
         <td align="middle" colspan="4">
                                              <asp:Label id="erreur" runat="server"></asp:Label>
         
                                           </td>
        </tr>
        <tr>
                                                                    <td valign="center" nowrap="nowrap" align="middle" colspan="4" height="20">
                                                                        <font face="Arial" size="2">
                                                                        <asp:Label id="message" runat="server" ></asp:Label>
         
                                                                        </font></td>
                                                                </tr>
        <tr>
                                                                    <td nowrap="nowrap" >
                                                                        <font face="Arial" size="2">Numéro Interne :</font>
                                                                    </td>
                                                                    <td>
                                                                        <asp:Textbox id="com_num" runat="server" Font-size="10" Font-Names="Tahoma" width="200" Rows="1" Enabled="false" ></asp:Textbox>
                                                                      </td>
             <td nowrap="nowrap">
                                                                        <font face="Arial" size="2">Numéro d'affectation :</font>
                                                                    </td>
                                                                    <td>
                                                                        <asp:Textbox id="affectation" runat="server" Font-size="10" Font-Names="Tahoma" width="200" Enabled="false"></asp:Textbox>
                                                                    </td>
                                                                </tr>
        
        <tr>
                                                                    <td nowrap="nowrap">
                                                                        <font face="Arial" size="2">Nom du locataire :</font>
                                                                    </td>
                                                                    <td>
                                                                        <asp:Textbox id="locataire" runat="server" Font-size="10" Font-Names="Tahoma" width="200" Rows="1" Enabled="false"></asp:Textbox>
                                                                    </td>
          
         <td nowrap="nowrap">
                                                                        <font face="Arial" size="2">Nom de l'agence :</font>
                                                                    </td>
                                                                    <td>
                                                                        <asp:Textbox id="district" runat="server" Font-size="10" Font-Names="Tahoma" width="200" Rows="1" Enabled="false"></asp:Textbox>
                                                                    </td>
                                                                </tr>
        <tr>
                                                                    <td nowrap="nowrap">
                                                                        <font face="Arial" size="2">Nom de la cité :</font>
                                                                    </td>
                                                                    <td>
                                                                        <asp:Textbox id="cite" runat="server" Font-size="10" Font-Names="Tahoma" width="200" Rows="1" Enabled="false"></asp:Textbox>
                                                                    </td>
            <td nowrap="nowrap">
                                                                        <font face="Arial" size="2">Nom du responsable :</font>
                                                                    </td>
                                                                    <td>
                                                                        <asp:Textbox id="responsable" runat="server" Font-size="10" Font-Names="Tahoma" width="200" Rows="1" Enabled="false" ></asp:Textbox>
                                                                    </td>
                                                                </tr>       
        <tr>
                                                                    <td nowrap="nowrap">
                                                                        <font face="Arial" size="2">Batiment :</font>
                                                                    </td>
                                                                    <td>
                                                                        <asp:Textbox id="batiment" runat="server" Font-size="10" Font-Names="Tahoma" width="200" Rows="1" Enabled="false" ></asp:Textbox>
                                                                    </td>
            <td nowrap="nowrap">
                                                                        <font face="Arial" size="2">Date commande :
                                                                    </td>
                                                                    <td>
                                                                        <asp:Textbox id="date" runat="server" Font-size="10" Font-Names="Tahoma" width="200" Rows="1" Enabled="false"></asp:Textbox>
                                                                    </td>
                                                                </tr>
        <tr>
                                                                    <td nowrap="nowrap">
                                                                        <font face="Arial" size="2">Etage :</font>
                                                                    </td>
                                                                    <td>
                                                                        <asp:Textbox id="etage" runat="server" Font-size="10" Font-Names="Tahoma" width="200" Rows="1" Enabled="false"></asp:Textbox>
                                                                    </td>
            <td nowrap="nowrap">
                                                                        <font face="Arial" size="2">Date de debut :
                                                                    </td>
                                                                    <td>
                                                                        <asp:Textbox id="datedebut" runat="server" Font-size="10" Font-Names="Tahoma"  width="200" Rows="1" Enabled="false"></asp:Textbox>
                                                                    </td>
                                                                </tr>
        <tr>
                                                                    <td nowrap="nowrap">
                                                                        <font face="Arial" size="2">Délais d'éxécution:</font>
                                                                    </td>
                                                                    <td width="520">
                                                                        <asp:Textbox id="periode" runat="server" width="200" Enabled="false" ></asp:Textbox>
                                                                    </td>
            <td nowrap="nowrap">
                                                                        <font face="Arial" size="2">Date de fin de chantier :
                                                                    </td>
                                                                    <td>
                                                                        <asp:Textbox id="datefin" runat="server" Font-size="10" Font-Names="Tahoma" width="200" Rows="1" Enabled="false"></asp:Textbox>
                                                                    </td>
                                                                </tr>
        <tr>
                                                                    <td align="middle" colspan="4" height="20">
                                                                        <hr align="center" />
                                                                    </td>
                                                                </tr>
        <tr>
                                                                     <td align="left"colspan="4">
         <table width="90%">
            <tbody>
          <tr> <th>
                                                    <font size="2" face="arial">N° de Bon :</font>
              </th>
           <th>
                                                    <font size="2" face="arial">Berim :</font>
              </th>
              <th>
                                                    <font size="2" face="arial">Corp d'état :</font>
              </th>
           <th>
                                                    <font size="2" face="arial">Co-Traitants :</font>
              </th>
           <th>
                                                    <font size="2" face="arial">Date de début :</font>
              </th>
           <th>
                                                    <font size="2" face="arial">Date de fin :</font>
              </th>
           <th>
                                                    <font size="2" face="arial">Tva :</font>
              </th>
           <th>
                                                    <font size="2" face="arial">Montant :</font>
              </th>
           
     
                                   </tr>
                                     
          <tr>  
           <td align="middle">
                                                    <asp:Textbox id="bon"  runat="server" Font-size="10"  Width="80px" maxlength="10" Font-Names="Tahoma" ToolTip="Ajouter le Numéro de bon du client"></asp:Textbox>
           </td>
           <td align="middle">
                                                    <asp:CheckBox id="berim"  runat="server" Font-size="10"  Width="30px" Font-Names="Tahoma"></asp:CheckBox>
           </td>
           <td align="middle">
            <asp:DropDownList id="corpetat"  runat="server" Font-size="10"  Width="90px" Font-Names="Tahoma" ToolTip="Selectionner le Corp d'etat"></asp:DropDownList>
           </td>
           <td align="middle">
            <asp:DropDownList id="intervenant"  runat="server" Font-size="10" Width="90px" Font-Names="Tahoma" ToolTip="Selectionner l'intervenant"></asp:DropDownList>
           </td>      
           <td align="middle">
            <asp:Textbox id="pdatedebut" runat="server" Font-size="10"  Width="100px" maxlength="10" Font-Names="Tahoma" ToolTip="Ajouter la date de debut des travaux (jj/mm/aaaa)"></asp:Textbox>
           </td>
           <td align="middle">
            <asp:Textbox id="pdatefin" runat="server" Font-size="10"  Width="100px" maxlength="10" Font-Names="Tahoma" ToolTip="Ajouter la date de fin des travaux (jj/mm/aaaa) "></asp:Textbox>
           </td>
           <td align="middle">
            <asp:DropDownList id="Tva"  runat="server" Font-size="10" Width="50px" Font-Names="Tahoma" ToolTip="Selectionner le taux de TVA"></asp:DropDownList>
           </td>
           <td align="middle">
            <asp:Textbox id="montant" runat="server" Font-size="10"  Width="80px" maxlength="10" Font-Names="Tahoma" ToolTip="Ajouter le Montant du poste"></asp:Textbox>
           </td>
           
           <td nowrap="nowrap" align="right" colspan="3">
                                                     <asp:Button id="ajout" onclick="ajout_poste" runat="server" Width="50px" Font-Names="Tahoma" ToolTip="Ajouter un Poste" Font-Bold="True" Text="+"></asp:Button>
                                             </td>
          </tr>
          </tbody>
         </table>
         </td>
                                                                </tr>
                                                                <tr>
                                                                    <td nowrap="nowrap" align="right" colspan="4" height="10">
                                                                        &nbsp;
                                                                    </td>
                                                                </tr>
        <tr>
                                                                     <td align="middle" colspan="4">
         <table width="100%">
            <tbody>
          <asp:Repeater id="monRepeaterposte" runat="server" OnItemCommand="selectionner" >
                                             <HeaderTemplate>
                                 
               <tr bgcolor="#FFE7F7">
            <th>
             <font size="2" face="arial">N°de bon :</font>
            </th>                                                                   
                        
            <th>
             <font size="2" face="arial">Berim : </font>
            </th>
      
            <th>
             <font size="2" face="arial">Corp d'état :</font>
            </th>
            <th>
             <font size="2" face="arial">Intervenant :</font>
            </th>
            <th>
             <font size="2" face="arial">Date de début :</font>
            </th>
               
            <th>
             <font size="2" face="arial">Date de fin :</font>
            </th>
            <th>
             <font size="2" face="arial">Montant HT en € :</font>
            </th>
            <th>
             <font size="2" face="arial">Taux Tva en % :</font>
            </th>
            
    
            
           </tr>
         </HeaderTemplate>
                                             <ItemTemplate>
                                                    
                    <tr bgcolor="#F5F5F5" >
                                                   <td width="10%" align="center" class="opcion2">
                                                      <asp:linkbutton runat="server" CausesValidation="False" id="lien" Text=<%#DataBinder.Eval(Container.DataItem,"BON_NUM")%>   /></asp:Linkbutton>
                  </td>
            <td width="5%" align="center">
             <font size="2" face="arial"><asp:CheckBox id="berim" Runat="Server"  Checked='<%# Eval("BERIM") %>' /></font>
            </td>
            <td width="12%" align="center">
             <font size="2" face="arial"><%#DataBinder.Eval(Container.DataItem,"CORP_NOM")%></font>
            </td>
            <td width="15%" align="center">
             <font size="2" face="arial"><%#DataBinder.Eval(Container.DataItem,"INTER_NOM")%></font>
            </td>      
            
            <td width="14%" align="center">
             <font size="2" face="arial"><%#DataBinder.Eval(Container.DataItem,"POSDATEDEBUT")%></font>
            </td>
            <td width="12%" align="center">
             <font size="2" face="arial"><%#DataBinder.Eval(Container.DataItem,"POSDATEFIN")%></font>
            </td>
            <td width="16%" align="center">
             <font size="2" face="arial"><%#DataBinder.Eval(Container.DataItem,"POS_MONTANT")%></font>
            </td>
            <td width="10%" align="center">
             <font size="2" face="arial"><%#DataBinder.Eval(Container.DataItem,"TVA_TAUX")%></font>
            </td>
                
            </tr>
                                        
         </ItemTemplate>
         </asp:Repeater>
         </tbody>
        </table>
        <!-- On charge -->
               <%           
                      for(int i=0;i<tailleA_poste;i++)
                      {
                   %> <script>
                          init_posteA("<%=tabA_poste_num[i]%>","<%=tabA_poste_corp[i]%>","<%=tabA_poste_intervenant[i]%>","<%=tabA_poste_montant[i]%>","<%=tabA_poste_tva[i]%>","<%=tabA_poste_montant_TT[i]%>",<%=i%>);
                      </script>
               <% 
                     }          
                 
                   %> <script>
                          init_tailleA_poste(<%=tailleA_poste%>);</script>
        <!-- On charge -->
               <%           
                      for(int i=0;i<tailleB_poste;i++)
                      {
                   %> <script>
                          init_posteB("<%=tabB_poste_num[i]%>","<%=tabB_poste_corp[i]%>","<%=tabB_poste_intervenant[i]%>","<%=tabB_poste_montant[i]%>","<%=tabB_poste_tva[i]%>","<%=tabB_poste_montant_TT[i]%>",<%=i%>);
                      </script>
               <% 
                     }          
                 
                   %> <script>
                          init_tailleB_poste(<%=tailleB_poste%>);</script>
                                                      </td> 
        
                                                  </tr>
                                               <tr>
         <td nowrap="nowrap" align="right" colspan="4">
          
           <asp:Label id="label2" Font-Bold="True" runat="server" Visible="false" ></asp:Label>
           <asp:Label id="label3" runat="server" Visible="false" ></asp:Label>
          
           
         </td>
        </tr>
        <tr>
         <td nowrap="nowrap" align="right" colspan="4">
          
           <asp:Label id="label21" Font-Bold="True" runat="server" Visible="false" ></asp:Label>
           <asp:Label id="label4" runat="server" Visible="false" ></asp:Label>
          
           
         </td>
        </tr><tr>
         <td nowrap="nowrap" align="right" colspan="4">
          
           <asp:Label id="label22" Font-Bold="True" runat="server" Visible="false" ></asp:Label>
           <asp:Label id="label5" runat="server" Visible="false" ></asp:Label>
          
           
         </td>
        </tr>

        <tr>
                                                                    <td align="middle" colspan="4" height="20">
                                                                        <input id="totalhtreloc" type="hidden" runat="server" />
          <input id="num" type="hidden" runat="server" />
         <input id="totaltvareloc" type="hidden" runat="server" />
         <input id="totalttcreloc" type="hidden" runat="server" />
         <hr align="center" /><input id="totalhtberim" type="hidden" runat="server" />
         <input id="totaltvaberim" type="hidden" runat="server" />
         <input id="totalttcberim" type="hidden" runat="server" />
         <input id="validation" type="hidden" runat="server" />
         <input id="date_day" type="hidden" runat="server" />  
                                                                    </td>
                                                                </tr>
        <tr>
        
                                                                     <td align="middle" colspan="4">
         <table width="90%">
                                                                            <tbody>
                                                                                <tr>
          <td align="middle" width="40%">   
                                                                          <asp:Button id="generer_recap" onclick="Enregistrer" runat="server" CausesValidation="False" OnClientClick="Javascript:generer('recap_reloc')" Text="Recap Reloc"></asp:Button>
                                                                  
          </td>
          <td align="middle" width="40%">   
                                                                          <asp:Button id="generer_recap_berim" onclick="Enregistrer" runat="server" CausesValidation="False" OnClientClick="Javascript:generer('recap_berim')"  Text="Recap Berim"></asp:Button>
                                                                  
          </td>
          </tr>   
                                                                            </tbody>
                                                                        </table>                       
            </td>
                                                                </tr>
        <tr>
                                                                    <td align="middle" colspan="4" height="20">
                                                                        <hr align="center" />
                                                                    </td>
                                                                </tr>
        <tr>
        
                                                                     <td align="middle" colspan="4">
         <table width="90%">
                                                                            <tbody>
                                                                                <tr>
           
          <td align="middle" width="40%" class="opcionmenu"> 
           <asp:HyperLink id="recap_doc" runat="server" Target="_self" Enabled="False"><u>Recap</u></asp:HyperLink></td>
              <td align="middle" width="40%" class="opcionmenu"> 
           <asp:HyperLink id="recap_berim_doc" runat="server" Target="_self" Enabled="False"><u>recap_berim</u></asp:HyperLink></td>
          </tr>   
                                                                            </tbody>
                                                                        </table>                       
            </td>
                                                                </tr>
          </tbody>
                                                        </table>
                                                    </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                       
                    </form>
                </td>
                <td background="../../imgs/box/box_com/tranche_r.gif">
                    <img height="1" src="../../imgs/box/box_com/pix_10x10.gif" width="1" /></td>
            </tr>
            <tr>
                <td>
                    <img height="7" src="../../imgs/box/box_com/corner_bl.gif" width="7" /></td>
                <td background="../../imgs/box/box_com/tranche_b.gif">
                    <img height="7" src="../../imgs/box/box_com/pix_10x10.gif" width="10" /></td>
                <td>
                    <img height="7" src="../../imgs/box/box_com/corner_br.gif" width="7" /></td>
            </tr>
            <tr>
                <td>
                    <br />
                </td>
            </tr>
        </tbody>
    </table>
    <table width="85%">
        <tbody>
            <tr>
                <td width="3">
                    <img src="../../imgs/icons/home_bullet.gif" />
                </td>
                <td class="opcionmenu" align="middle" height="10">
                    <i><font size="2"><a href="../accueil.aspx"> Accueil</a></font></i></td>
                <td width="3">
                    <img src="../../imgs/icons/home_bullet.gif" />
                </td>
                <td class="opcionmenu" align="middle" height="10">
                    <i><a href="../fournisseurs/indexFournisseurs.aspx"> Fournisseurs</a> </i></td>
                <td width="3">
                    <img src="../../imgs/icons/home_bullet.gif" />
                </td>
                <td class="opcionmenu" align="middle" height="10">
                    <i><a href="../affaires/indexAffaires.aspx"> Affaires</a> </i></td>
                <td width="3">
                    <img src="../../imgs/icons/home_bullet.gif" />
                </td>
                <td class="opcionmenu" align="middle" height="10">
                    <i><a href="../achats/indexAchats.aspx"> D.A.</a> </i></td>
                <td width="3">
                    <img src="../../imgs/icons/home_bullet.gif" />
                </td>
                <td class="opcionmenu" align="middle" height="10">
                    <i><a href="../AO/indexAO.aspx"> A.O.</a> </i></td>
                <td width="3">
                    <img src="../../imgs/icons/home_bullet.gif" />
                </td>
                <td class="opcionmenu" align="middle" height="10">
                    <i><a href="../commandes/indexCommandes.aspx"> Commandes</a> </i></td>
                <td width="3">
                    <img src="../../imgs/icons/home_bullet.gif" />
                </td>
                <td class="opcionmenu" align="middle" height="10">
                    <i><a href="../indexSuivi.aspx"> Suivi</a></i></td>
                <td width="3">
                    <img src="../../imgs/icons/home_bullet.gif" />
                </td>
                <td class="opcionmenu" align="middle" height="10">
                    <i><a href="../indexBilan.aspx"> Bilan</a> </i></td>
                <td width="3">
                    <img src="../../imgs/icons/home_bullet.gif" />
                </td>
                <td class="opcionmenu" align="middle" height="10">
                    <i><a href="../main.aspx"> Déconnexion</a> </i></td>
            </tr>

        </tbody>
    </table>
</body>
</html>

lundi 4 juin 2007 à 12:52:16 | Re : Executé 2 fonction sur un meme evenement

Yopyop

ouch ...

Voici une page qui fonctionne (en ASP.NET 2.0... vb.net)

<%

@PageLanguage="VB" %>

<!

DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<

scriptrunat="server">

Private Sub Test()

Response.Write("Test")

End Sub

Private Sub WriteFunctionCall()

Dim sJSCode As String = "<script language=javascript>SayHello();" & "<" & "/script>"

If Not Me.ClientScript.IsClientScriptBlockRegistered("_jsAlert") Then

Me.ClientScript.RegisterClientScriptBlock(Me.GetType, "_jsAlert", sJSCode)

End If

End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)

Me.Test()

Me.WriteFunctionCall()

End Sub

</

script>

<

htmlxmlns="http://www.w3.org/1999/xhtml">

<

headrunat="server">

<title>Untitled Page</title>

<scriptlanguage="javascript">

function SayHello(){

alert(

'Hello');

}

</script>

</

head>

<

body>

<formid="form1"runat="server">

<div>

<asp:ButtonID="Button1"runat="server"OnClick="Button1_Click"Text="Button"/>

</div>

</form>

</

body>

</

html>=========================

J'ai splitter le tag de fermeture car Visual studio me faisait chi...:
Dim sJSCode As String = "<script language=javascript>SayHello();" & "<" & "/script>"

Si tu es en 1.1 je t'envoie un code identique (et cette fois je le ferai en c# )

yopyop
lundi 4 juin 2007 à 14:08:34 | Re : Executé 2 fonction sur un meme evenement

obel

Merci de venir a mon secours !!!
Mais comme je te le disais plus sur une autre page j'ai pas de souci avec ta fonction ou avec n'importe quelle fonction du type Response.Write etc....
mais avec cette page ou j'utilise un tableau entre 2 balises Script pour ma generation de tableau de variable vers word est là ça merde :

 <!-- On charge -->
               <%           
                      for(int i=0;i<tailleA_poste;i++)
                      {
                   %> <script>
                          init_posteA("<%=tabA_poste_num[i]%>","<%=tabA_poste_corp[i]%>","<%=tabA_poste_intervenant[i]%>","<%=tabA_poste_montant[i]%>","<%=tabA_poste_tva[i]%>","<%=tabA_poste_montant_TT[i]%>",<%=i%>);
                      </script>
               <% 
                     }          
                 
                   %> <script>
                          init_tailleA_poste(<%=tailleA_poste%>);</script>
        <!-- On charge -->
               <%           
                      for(int i=0;i<tailleB_poste;i++)
                      {
                   %> <script>
                          init_posteB("<%=tabB_poste_num[i]%>","<%=tabB_poste_corp[i]%>","<%=tabB_poste_intervenant[i]%>","<%=tabB_poste_montant[i]%>","<%=tabB_poste_tva[i]%>","<%=tabB_poste_montant_TT[i]%>",<%=i%>);
                      </script>
               <% 
                     }          
                 
                   %> <script>
                          init_tailleB_poste(<%=tailleB_poste%>);</script>


je pense que c cette parti de code qui fou le bordel ....

++++


1 2 3

Cette discussion est classée dans : fonction, serveur, word, coté, executé


Répondre à ce message

Sujets en rapport avec ce message

trasformation word en pdf [ par ronan ] Bonjour, je souhaite transformer un document word qui est sur mon serveur en un document pdf.Acrobat writer est installé sur le serveur.Quelqu'un as t Pb d'appel d'un script coté serveur [ par guinou ] Bonjour,Voila j'ai 3 frames. Dans la 3eme frame j'appel une procedure vbscript coté serveur via javascript, stockée en entête dans la 2eme frame.J'uti Word et l'asp [ par bruyetde ] Salut, J'ai un besoin assez urgent de faire communiquer une page ASP et Word. Je sais ce n'est peut être pas ce qu'il y a de plus simple, mais le cadr cacher les sources coté serveur [ par willinfeo ] Bonjour à tous,je dois installer un site asp sur un intranet chez un client et j'aimerai cacher les sources. Quelles sont les solutions possibles ?Mer Imprimer document Word script VBS [ par gaborus ] Voila mon problème est surement très simple1 serveur 2000 avec IIS (et word 97)1 page asp avec du script VBS qui permet d'imprimer un template depuis variable coté serveur vers coté client [ par martok ] Bonjour, je suis stagiaire et j'ai un problème dans mon projet de stage.J'utilise ASP avec visual interdev 6.0.Voila mon problème :Je souhaite modifie créer un fichier en mémoire [ par hacko ] Bonjour,Je cherche à créer un fichier en mémoire du coté serveur, pour l'envoyer en téléchargement du coté client.Le fichier ne doit jamais être écrit Valider un formualire coté serveur [ par Troyan ] bonjour,dans un soucis d'assurance et surtout d'automatisation !je voulais connaitre la methode pour pouvoir construire et valider un formulaire coté Passage de valeurs par POST coté serveur [ par fr64 ] Bonjour, L'instruction suivante permet de faire une redirection coté serveur avec passage de paramêtres dans l'url (équivalent de la méthode GET d'un existance de synchronisation ou de variables coté serveur ? [ par yamzy ] bonjour,Je dois inscrire les urls des pages visitées avec d'autres données dans un fichiers texte. (comme le fichier log). Le problème est que c'est q


Nos sponsors


Sondage...

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

Consulter la suite du CalendriCode

Photothèque

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 8,206 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales