00001 <?
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 require_once("class_customer.php");
00022 $sub_action=(isset($_REQUEST['sa']))?$_REQUEST['sa']:"";
00023 var_dump($_REQUEST);
00028 ?>
00029
00030 <?
00031
00032
00033 if ( isset ($_POST['delete']) )
00034 {
00035 echo 'delete';
00036 $f_id=$_REQUEST['f_id'];
00037
00038 $fiche=new Customer($cn,$f_id);
00039 $fiche->remove();
00040 $sub_action="list";
00041 }
00043
00044 if ( $sub_action=="insert" )
00045 {
00046 $retour=sprintf('<A class="two" HREF="%s"><input type="button" value="Retour"></A>',
00047 urldecode($_REQUEST['url']));
00048
00049 $customer=new Customer($cn);
00050 $customer->Save($_REQUEST['fd_id']);
00051 echo $retour;
00052 echo "<table>";
00053 echo $customer->Display(true);
00054 echo "</table>";
00055 echo $retour;
00056
00057 }
00059
00060 if ( isset ($_POST['mod']))
00061 {
00062
00063 $f_id=$_REQUEST['f_id'];
00064
00065 $client=new Customer($cn,$f_id);
00066 $client->Save();
00067 }
00068
00069 if ( $sub_action == "" )
00070 $sub_action="list";
00072
00073 if ( $sub_action=="blank")
00074 {
00075 $retour=sprintf('<A class="two" HREF="%s"><input type="button" value="Retour"></A>',
00076 "commercial.php?p_action=client");
00077 echo '<div class="u_redcontent">';
00078
00079 echo $retour;
00080 $c=new Customer($cn);
00081 echo '<form method="post" action="commercial.php"';
00082 echo '<input type="hidden" name="p_action" value="client">';
00083 echo '<input type="hidden" name="sa" value="insert">';
00084 echo '<input type="hidden" name="fd_id" value="'.$_GET['fd_id'].'">';
00085 echo '<input type="hidden" name="url" value="'.$_GET['url'].'">';
00086 echo $c->blank($_GET['fd_id']);
00087 echo '<input type="Submit" value="Sauve">';
00088 echo '</form>';
00089 echo $retour;
00090 echo '</div>';
00091 }
00093
00094 if ( $sub_action == "list" )
00095 {
00096 ?>
00097 <div class="u_content">
00098 <span>
00099 <form method="get" action="commercial.php">
00100 <?
00101 $a=(isset($_GET['query']))?$_GET['query']:"";
00102 printf ('<input type="text" name="query" value="%s">',
00103 $a);
00104 ?>
00105 <input type="submit" name="submit_query" value="recherche">
00106 <input type="hidden" name="p_action" value="client">
00107 </form>
00108 </span>
00109 <span>
00110 <form method="get" action="commercial.php">
00111 <input type="hidden" name="url" <? $url=urlencode($_SERVER['REQUEST_URI']);echo 'value="'.$url.'"'; ?>
00112 <input type="hidden" name="p_action" value="client">
00113
00114 <?
00115 $w=new widget("select");
00116 $w->name="fd_id";
00117 $w->value= make_array($cn,"select fd_id,fd_label from fiche_def where ".
00118 " frd_id=".FICHE_TYPE_CLIENT);
00119 echo $w->IOValue();
00120 ?>
00121 <input type="hidden" name="sa" value="blank">
00122 <input type="submit" name="submit_query" value="Ajout Client">
00123
00124 </form>
00125 </span>
00126 <?
00127 $client=new Customer($cn);
00128 $search=(isset($_GET['query']))?$_GET['query']:"";
00129
00130 echo '<div class="u_redcontent">';
00131 echo $client->Summary($search);
00132 echo '</div>';
00133 echo '<div style="position:absolute;right:1%;width:10%;color:blue;background-color:lightgrey;margin-top:10px;">';
00134 echo "<strong>Action :</strong> Ajout, mise à jour ou effacement";
00135 echo " <ul>";
00136 echo "<li>C - Contact</li>";
00137 echo "<li>F - Facture</li>";
00138 echo "<li>FC - Courrier</li>";
00139 echo "</ul>";
00140
00141 echo '</div>';
00142 echo '</div>';
00143
00144 }
00146
00147 if ( $sub_action == 'detail' )
00148 {
00149 $f_id=$_REQUEST['f_id'];
00150 echo '<div class="u_redcontent">';
00151 $client=new Customer($cn,$f_id);
00152 $retour=sprintf('<A class="two" HREF="%s"><input type="button" value="Retour"></A>',
00153 urldecode($_REQUEST['url']));
00154 echo $retour;
00155 echo '<form action="'.$_REQUEST['url'].'" method="post">';
00156 echo $client->Display(false);
00157 $w=new widget("hidden");
00158 $w->name="p_action";
00159 $w->value="client";
00160 echo $w->IOValue();
00161 $w->name="f_id";
00162 $w->value=$f_id;
00163 echo $w->IOValue();
00164
00165 echo $w->Submit('mod','Sauver les modifications');
00166 echo $w->Reset("Annuler");
00167 echo $w->Submit('delete','Effacer cette fiche');
00168 echo '</form>';
00169 echo $retour;
00170 echo '<div>';
00171 }
00172 html_page_stop();
00173 ?>