Main Page | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

client.inc.php

Go to the documentation of this file.
00001 <?
00002 /*
00003  *   This file is part of PhpCompta.
00004  *
00005  *   PhpCompta is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   PhpCompta is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with PhpCompta; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 /* $Revision$ */
00020 // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
00021 require_once("class_customer.php");
00022 $sub_action=(isset($_REQUEST['sa']))?$_REQUEST['sa']:"";
00023 
00028 ?>
00029 
00030 <?
00031 // Menu
00032 // Remove a card
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 }
00042 //-----------------------------------------------------
00043 // Add card
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 }
00058 //-----------------------------------------------------
00059 // Save modification
00060 if ( isset ($_POST['mod'])) 
00061 {
00062   // modification is asked
00063   $f_id=$_REQUEST['f_id'];
00064 
00065   $client=new Customer($cn,$f_id);
00066   $client->Save();
00067 }
00068 // by default open liste
00069 if ( $sub_action  == "" ) 
00070       $sub_action="list";
00071 //-----------------------------------------------------
00072 //Display a blank card 
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 }
00092 //-----------------------------------------------------
00093 // list
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  // echo '<div style="position:absolute;left:15%;width:67%;margin-top:20px;">';
00130  echo '<div class="u_redcontent">';
00131  echo $client->Summary($search);
00132  echo '</div>';
00133  echo '</div>';
00134 
00135 }
00136 //-----------------------------------------------------
00137 // Show Detail
00138 if ( $sub_action == 'detail' )
00139 {
00140   $f_id=$_REQUEST['f_id'];
00141   echo '<div class="u_redcontent">';
00142   $client=new Customer($cn,$f_id);
00143   $retour=sprintf('<A class="two" HREF="%s"><input type="button" value="Retour"></A>',
00144                   urldecode($_REQUEST['url']));
00145   echo $retour;
00146   echo '<form action="'.$_REQUEST['url'].'" method="post">'; 
00147   echo $client->Display(false);
00148   $w=new widget("hidden");
00149   $w->name="p_action";
00150   $w->value="client";
00151   echo $w->IOValue();
00152   $w->name="f_id";
00153   $w->value=$f_id;
00154   echo $w->IOValue();
00155 
00156   echo $w->Submit('mod','Sauver les modifications');
00157   echo $w->Reset("Annuler");
00158   echo $w->Submit('delete','Effacer cette fiche');
00159   echo '</form>';
00160   echo $retour;
00161   echo '<div>';
00162 }
00163 html_page_stop();
00164 ?>

Generated on Wed Jun 28 02:07:23 2006 for phpcompta by  doxygen 1.4.4