1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350
| <?php require_once('../Connections/ProgFacture.php'); ?><?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) {
$insertSQL = sprintf("INSERT INTO devis (DevisId, ClientId, DevisDate, DevisType) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['DevisId'], "int"),
GetSQLValueString($_POST['ClientId'], "int"),
GetSQLValueString($_POST['DevisDate'], "date"),
GetSQLValueString($_POST['DevisType'], "text"));
mysql_select_db($database_ProgFacture, $ProgFacture);
$Result1 = mysql_query($insertSQL, $ProgFacture) or die(mysql_error());
$id_recupere = $_POST['DevisId'];
$insertGoTo = "CreationDevis.php?recordID2=".$id_recupere;
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
$colname_rsinfoClient = "-1";
if (isset($_GET['recordID'])) {
$colname_rsinfoClient = (get_magic_quotes_gpc()) ? $_GET['recordID'] : addslashes($_GET['recordID']);
}
mysql_select_db($database_ProgFacture, $ProgFacture);
$query_rsinfoClient = sprintf("SELECT * FROM client WHERE ClientId = %s", $colname_rsinfoClient);
$rsinfoClient = mysql_query($query_rsinfoClient, $ProgFacture) or die(mysql_error());
$row_rsinfoClient = mysql_fetch_assoc($rsinfoClient);
$totalRows_rsinfoClient = mysql_num_rows($rsinfoClient);
$maxRows_rsDevis = 5;
$pageNum_rsDevis = 0;
if (isset($_GET['pageNum_rsDevis'])) {
$pageNum_rsDevis = $_GET['pageNum_rsDevis'];
}
$startRow_rsDevis = $pageNum_rsDevis * $maxRows_rsDevis;
$colname_rsDevis = "-1";
if (isset($_GET['recordID'])) {
$colname_rsDevis = (get_magic_quotes_gpc()) ? $_GET['recordID'] : addslashes($_GET['recordID']);
}
mysql_select_db($database_ProgFacture, $ProgFacture);
$query_rsDevis = sprintf("SELECT * FROM devis WHERE DevisType = 'Devis' AND ClientId = %s ORDER by DevisId DESC", $colname_rsDevis);
$query_limit_rsDevis = sprintf("%s LIMIT %d, %d", $query_rsDevis, $startRow_rsDevis, $maxRows_rsDevis);
$rsDevis = mysql_query($query_limit_rsDevis, $ProgFacture) or die(mysql_error());
$row_rsDevis = mysql_fetch_assoc($rsDevis);
if (isset($_GET['totalRows_rsDevis'])) {
$totalRows_rsDevis = $_GET['totalRows_rsDevis'];
} else {
$all_rsDevis = mysql_query($query_rsDevis);
$totalRows_rsDevis = mysql_num_rows($all_rsDevis);
}
$totalPages_rsDevis = ceil($totalRows_rsDevis/$maxRows_rsDevis)-1;
$colname_rsFacture = "-1";
if (isset($GET['recordID'])) {
$colname_rsFacture = (get_magic_quotes_gpc()) ? $GET['recordID'] : addslashes($GET['recordID']);
}
mysql_select_db($database_ProgFacture, $ProgFacture);
$query_rsFacture = sprintf("SELECT * FROM devis WHERE DevisType = 'Facture' AND DevisId = %s ORDER BY DevisId DESC", $colname_rsFacture);
$rsFacture = mysql_query($query_rsFacture, $ProgFacture) or die(mysql_error());
$row_rsFacture = mysql_fetch_assoc($rsFacture);
$totalRows_rsFacture = mysql_num_rows($rsFacture);
//récuperation du numéro de facture le plus élevé//
mysql_select_db($database_ProgFacture, $ProgFacture);
$query_rsMaxDevis = "SELECT MAX(DevisId) AS nbre FROM devis";
$rsMaxDevis = mysql_query($query_rsMaxDevis, $ProgFacture) or die(mysql_error());
$row_rsMaxDevis = mysql_fetch_assoc($rsMaxDevis);
$totalRows_rsMaxDevis = mysql_num_rows($rsMaxDevis);
?>
<html>
<head>
<title>Fac</title>
<body>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td colspan="2" bgcolor="#00009C"><table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="30" background="/ps4000 2007/Image/FondDossier2.jpg"><table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<th width="245" scope="col">Client</th>
<th width="256" scope="col">Documents</th>
<th width="242" scope="col">Admin</th>
<th width="57" scope="col"> </th>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" bgcolor="#FFFFFF"> </td>
</tr>
<tr>
<td width="21%" valign="top"><table width="200" border="0" cellspacing="2" cellpadding="1">
<tr>
<td bgcolor="#FFFFFF"> </td>
<td bgcolor="#000099"><a href="/ps4000 2007/Client/RechercheClient.php">Rechercher un autre client </a></td>
<td bgcolor="#FFFFFF"> </td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> </td>
<td bgcolor="#000099"><a href="../Client/ModifierClient.php?recordID=<?php echo $row_rsinfoClient['ClientId']; ?>" class="Style3">Modifier les données de ce client.</a></td>
<td bgcolor="#FFFFFF"> </td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> </td>
<td bgcolor="#000099"><span class="Style6"><a href="javascript:history.back()"><< Retour </a></span></td>
<td bgcolor="#FFFFFF"> </td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> </td>
<td bgcolor="#000099"><div align="center">
<form name="form2" method="POST" action="<?php echo $editFormAction; ?>">
<span class="Style10">
<input name="DevisNom2" type="hidden" id="DevisNom2" value="<?php echo $row_rsinfoClient['ClientNom']; ?>" />
<input name="ClientId" type="hidden" id="ClientId" value="<?php echo $row_rsinfoClient['ClientId']; ?>" size="8" />
<input name="DevisType" type="hidden" id="DevisType" value="Devis" size="8" />
<br />
<input name="DevisDate" type="Hidden" id="DevisDate" value="<? echo date("Y-m-d") ?>" />
<input type="text" name="DevisId" id="DevisId" value="<?php $max = $row_rsMaxDevis['nbre'];
$maxOne = $max+1;
echo $maxOne; ?>">
</span>
<input type="submit" name="Submit2" value="Creer New Doc">
<input type="hidden" name="MM_insert" value="form2">
</form>
</div></td>
<td bgcolor="#FFFFFF"> </td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> </td>
<td bgcolor="#000099"><div align="center"></div></td>
<td bgcolor="#FFFFFF"> </td>
</tr>
</table></td>
<td width="79%" valign="top"><div align="center">
<form name="form1" method="post" action="">
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<th valign="middle" bgcolor="#000000" scope="col"><div align="left">
<p class="Style9 Style7"><strong>Documents de
<input type="hidden" value="<?php echo $row_rsinfoClient['ClientId']; ?>" id="ClientId" name="ClientId" />
<?php echo $row_rsinfoClient['ClientTitre']; ?> <?php echo $row_rsinfoClient['ClientNom']; ?> <?php echo $row_rsinfoClient['ClientPrenom']; ?></strong></p>
</div></th>
<th scope="col"> </th>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td>
<?php if($totalRows_rsDevis){?>
<table width="300" border="1" cellpadding="0" cellspacing="0">
<tr>
<td colspan="4" bgcolor="#000000"><span class="Style12">Nombre de Devis:<?php echo $totalRows_rsDevis; ?> </span></td>
</tr>
<tr>
<td bgcolor="#000000"><div align="center"><span class="Style7">Numéro:</span></div></td>
<td colspan="3" bgcolor="#000000"><div align="center"><span class="Style7">Date:</span></div></td>
</tr>
<?php do { ?>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td>DEV
<?php
$nbr = $row_rsDevis['DevisId'];
$nbr = sprintf( "%04d", $nbr );
echo $nbr; // affiche 0000
?>
<?php echo $row_rsinfoClient['ClientNom']; ?>:
<?
$dateEn = $row_rsDevis['DevisDate'];
$annee = substr($dateEn,2,2);
$mois = substr($dateEn,5,2);
echo $mois;
echo $annee;
?>
<input type="hidden" name="DevisId" value="<?php echo $row_rsDevis['DevisId']; ?>"></td>
</tr>
</table></td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td><?
$dateEn = $row_rsDevis['DevisDate'];
list($jour, $mois, $annee) = explode("-",$dateEn);
$array = array($annee,$mois,$jour);
$dateFr = implode("/",$array);
echo $dateFr;
?></td>
</tr>
</table></td>
<td bgcolor="#00009C"><div align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td><a href="DevisPrevisualisation.php?recordID=<?php echo $row_rsDevis['ClientId']; ?>&recordID2=<?php echo $row_rsDevis['DevisId']; ?>"><strong>V</strong></a></td>
</tr>
</table>
</div></td>
<td bgcolor="#FF0000"><div align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="center"><a href="DeleteDevis.php?recordID=<?php echo $row_rsinfoClient['ClientId']; ?>&recordID2=<?php echo $row_rsDevis['DevisId']; ?>" class="Style16"><strong>X</strong></a></div></td>
</tr>
</table>
</div></td>
</tr>
<?php } while ($row_rsDevis = mysql_fetch_assoc($rsDevis)); ?>
</table>
<?php }
else {?>
<table width="300" border="1" cellpadding="0" cellspacing="0" bgcolor="#000000">
<tr>
<td><table width="300" border="0" cellspacing="0" cellpadding="2">
<tr>
<td><div align="center"><strong><span class="Style7">Aucun devis en attente. </span></strong></div></td>
</tr>
</table></td>
</tr>
</table>
<? }?></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td><?php if($totalRows_rsFacture){?>
<table width="300" border="1" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3" bgcolor="#000000"><span class="Style7"></span><span class="Style7">Nombre de Facture:<?php echo $totalRows_rsFacture; ?> </span></td>
</tr>
<tr>
<td bgcolor="#000000"><div align="center"><span class="Style7">Numéro:</span></div></td>
<td colspan="2" bgcolor="#000000"><div align="center"><span class="Style7">Date:</span></div></td>
</tr>
<?php do { ?>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td>FAC
<?php
$nbr = $row_rsFacture['DevisNumber'];
$nbr = sprintf( "%04d", $nbr );
echo $nbr; // affiche 0000
?>
<?php echo $row_rsinfoClient['ClientNom']; ?>:
<?
$dateEn = $row_rsFacture['DevisDate'];
$annee = substr($dateEn,2,2);
$mois = substr($dateEn,5,2);
echo $mois;
echo $annee;
?>
<input type="hidden" name="DevisId2" value="<?php echo $row_rsFacture['DevisId']; ?>"></td>
</tr>
</table></td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td><?
$dateEn = $row_rsFacture['DevisDate'];
list($jour, $mois, $annee) = explode("-",$dateEn);
$array = array($annee,$mois,$jour);
$dateFr = implode("/",$array);
echo $dateFr;
?></td>
</tr>
</table></td>
<td bgcolor="#00009C"><div align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td><div align="center"><a href="DevisPrevisualisation.php?recordID=<?php echo $row_rsFacture['ClientId']; ?>&recordID2=<?php echo $row_rsFacture['DevisId']; ?>"><strong>V</strong></a></div></td>
</tr>
</table>
</div></td>
</tr>
<?php } while ($row_rsFacture = mysql_fetch_assoc($rsDevis)); ?>
</table>
<?php }
else {?>
<table width="300" border="1" cellpadding="0" cellspacing="0" bgcolor="#000000">
<tr>
<td><table width="300" border="0" cellspacing="0" cellpadding="2">
<tr>
<td><div align="center"><strong><span class="Style7">Aucune Facture . </span></strong></div></td>
</tr>
</table></td>
</tr>
</table>
<? }?></td>
<td> </td>
</tr>
<tr>
<td><div align="right"></div></td>
<td> </td>
</tr>
</table>
</form>
</div></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($rsinfoClient);
mysql_free_result($rsDevis);
mysql_free_result($rsFacture);
?> |
Partager