Qual: La totalité du code javascript de l'autoremplissage de ville est mis dans soc.js.php

Look: Uniformisation du look de la popup de remplissage automatique de ville
This commit is contained in:
Laurent Destailleur 2005-08-20 16:45:41 +00:00
parent 072ca59dc9
commit d28cf7ac61
2 changed files with 85 additions and 69 deletions

View File

@ -205,7 +205,12 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell(14, 5, $fac->lignes[$i]->remise_percent."%", 0, 'R'); $pdf->MultiCell(14, 5, $fac->lignes[$i]->remise_percent."%", 0, 'R');
} }
// Total TTC // Total TVA
$pdf->SetXY ($postotttc, $curY);
$total = price($fac->lignes[$i]->price * $fac->lignes[$i]->qty);
$pdf->MultiCell(26, 5, $total, 0, 'R', 0);
// Total HT
$pdf->SetXY ($postotttc, $curY); $pdf->SetXY ($postotttc, $curY);
$total = price($fac->lignes[$i]->price * $fac->lignes[$i]->qty); $total = price($fac->lignes[$i]->price * $fac->lignes[$i]->qty);
$pdf->MultiCell(26, 5, $total, 0, 'R', 0); $pdf->MultiCell(26, 5, $total, 0, 'R', 0);

View File

@ -42,10 +42,13 @@
*/ */
require("pre.inc.php"); require("pre.inc.php");
$user->getrights('societe'); $user->getrights('societe');
$langs->load("companies"); $langs->load("companies");
function run_request($table) {
function run_request($table)
{
global $db; global $db;
$sql = "SELECT ville,cp from ".MAIN_DB_PREFIX.$table; $sql = "SELECT ville,cp from ".MAIN_DB_PREFIX.$table;
if(isset($_GET['cp']) && trim($_GET['cp']) != "") { if(isset($_GET['cp']) && trim($_GET['cp']) != "") {
@ -63,13 +66,11 @@ function run_request($table) {
if (!$result) { if (!$result) {
dolibarr_print_error($db); dolibarr_print_error($db);
} }
print $sql; // print $sql;
} }
/* // Sécurité accés client
* Sécurité accés client
*/
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$_GET["action"] = ''; $_GET["action"] = '';
@ -77,6 +78,11 @@ if ($user->societe_id > 0)
$_GET["socid"] = $user->societe_id; $_GET["socid"] = $user->societe_id;
} }
top_htmlhead($head, $title, $target);
print " print "
<script language=\"JavaScript\"> <script language=\"JavaScript\">
<!-- <!--
@ -102,13 +108,17 @@ function change_categorie(urlbase,leselect)
//--> //-->
</script>\n"; </script>\n";
print "<form method=\"post\" action=\"javascript:MAJ(" . $_GET['targetobject'] . ");\" name=\"villes\" enctype=\"application/x-www-form-urlencoded\"> print "<body>";
<table border=\"0\" align=\"center\" width=\"90%\" cellpadding=\"0\" cellspacing=\"0\">
<tr> print "<div><div><div><br>"; // Ouvre 3 div a la place de top_menu car le llxFooter en ferme 3
<td colspan=\"3\" bgcolor=\"#002266\" align=\"center\">
<font color=\"#EEEEFF\" face=\"Arial, Helvetica\" size=\"3\"><b>Recherche code postal: " . $_GET['cp'] . " </b></font> print "<form method=\"post\" action=\"javascript:MAJ(" . $_GET['targetobject'] . ");\" name=\"villes\" enctype=\"application/x-www-form-urlencoded\">";
</td> print "<table class=\"noborder\" align=\"center\" width=\"90%\">";
</tr>\n"; print "<tr class=\"liste_titre\">";
print " <td colspan=\"3\" align=\"center\">";
print " <b>Recherche code postal: " . $_GET['cp'] . " </b>";
print " </td>";
print "</tr>\n";
run_request("societe"); run_request("societe");
@ -118,7 +128,7 @@ if($num == 0) {
$num=$db->num_rows(); $num=$db->num_rows();
} }
//Si on n'a qu'un seul résultat on switche direct et on remplit le formulaire // Si on n'a qu'un seul résultat on switche direct et on remplit le formulaire
if($num <= 1) { if($num <= 1) {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$ville = $obj->ville; $ville = $obj->ville;
@ -129,8 +139,9 @@ document.villes.submit();
</script>\n"; </script>\n";
} }
else { else {
// sinon on affiche la liste des villes dont c'est le code postal ... // Sinon on affiche la liste des villes dont c'est le code postal ...
for($i = 0; $i < $num; $i++){ for($i = 0; $i < $num; $i++)
{
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$ville = $obj->ville; $ville = $obj->ville;
$ville_code = urlencode("$ville"); $ville_code = urlencode("$ville");
@ -144,27 +155,27 @@ else {
else else
$bgcolor="#DDDDFF"; $bgcolor="#DDDDFF";
print "<tr> $var=!$var;
<td bgcolor=\"$bgcolor\" width=\"10%\"> print "<tr ".$bc[$var]."><td width=\"10%\">";
<label><input type=\"radio\" name=\"choix\" value=\"$ville\"> $ville $cp</label> print "<label><input type=\"radio\" name=\"choix\" value=\"$ville\"> $ville $cp</label>";
</td> print "</td></tr>";
</tr>
<tr>\n";
} }
} }
print " <input type=\"hidden\" name=\"nb_i\" value=\"$i\">
<tr> print " <input type=\"hidden\" name=\"nb_i\" value=\"$i\">";
<td align=\"center\" colspan=\"3\" bgcolor=\"#DDDDFF\">
<input type=\"submit\" name=\"envoyer\" value=\"OK\"> - $var=!$var;
<input type=\"button\" value=\"Annuler\" onClick=\"window.close();\"> print "<tr><td align=\"center\" colspan=\"3\">";
</td> print "<input type=\"submit\" class=\"button\" name=\"envoyer\" value=\"".$langs->trans("Modify")."\">";
</tr> print " &nbsp; ";
</table> print "<input type=\"button\" class=\"button\" value=\"".$langs->trans("Cancel")."\" onClick=\"window.close();\">";
</form>\n"; print "</td></tr>";
print "</table></form>\n";
print "<br>";
$db->close(); $db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>"); llxFooter('$Date$ - $Revision$');
?> ?>