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
|
<!--#include file="../Connections/Produits.asp" -->
<%
Set conn = Server.CreateObject("ADODB.Connection")
DSN_BASE="DBQ="& Server.Mappath("../database/produits.mdb")&";Driver={Microsoft Access Driver (*.mdb)};DriverId=25"
conn.Open DSN_BASE
%>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript">
function format_number(pnumber,decimals){
if (isNaN(pnumber)) { return 0};
if (pnumber=='') { return 0};
var snum = new String(pnumber);
var sec = snum.split('.');
var whole = parseFloat(sec[0]);
var result = '';
if(sec.length > 1){
var dec = new String(sec[1]);
dec = String(parseFloat(sec[1])/Math.pow(10,(dec.length - decimals)));
dec = String(whole + Math.round(parseFloat(dec))/Math.pow(10,decimals));
var dot = dec.indexOf('.');
if(dot == -1){
dec += '.';
dot = dec.indexOf('.');
}
while(dec.length <= dot + decimals) { dec += '0'; }
result = dec;
} else{
var dot;
var dec = new String(whole);
dec += '.';
dot = dec.indexOf('.');
while(dec.length <= dot + decimals) { dec += '0'; }
result = dec;
}
return result;
}
</script>
<script type="text/javascript">
function calcul_taux_reduction(anc_p){
var taux;
var red;
for(i=1;i<10;i++){
if(document.getElementById('quantiteInf_'+i).value!=""){
nouv_p=document.getElementById('nouveau_p'+i).value;
nouvPrix=parseFloat(nouv_p);
ancPrix=parseFloat(anc_p);
taux=100-((nouvPrix*100)/ancPrix);
red=ancPrix-nouvPrix;
document.getElementById('ttaux'+i).value=format_number(taux,2)+'%';
document.getElementById('pred'+i).value=format_number(red,2);
}
}
}
function calcul_nouvprix_reduction(anc_p){
var nouv_p;
var red;
for(i=1;i<10;i++){
if(document.getElementById('quantiteInf_'+i).value!=""){
taux=document.getElementById('ttaux'+i).value;
Taux=parseFloat(taux);
ancPrix=parseFloat(anc_p);
red=((ancPrix*Taux)/100);
nouv_p=ancPrix-red;
document.getElementById('nouveau_p'+i).value=format_number(nouv_p,2);
document.getElementById('pred'+i).value=format_number(red,2);
}
}
}
function calcul_nouvprix_taux(anc_p){
var nouv_p;
var taux;
for(i=1;i<10;i++){
if(document.getElementById('quantiteInf_'+i).value!=""){
red=document.getElementById('pred'+i).value;
Red=parseFloat(red);
ancPrix=parseFloat(anc_p);
nouv_p=ancPrix-Red;
taux=((Red*100)/ancPrix);
document.getElementById('ttaux'+i).value=format_number(taux,2)+'%';
document.getElementById('nouveau_p'+i).value=format_number(nouv_p,2);
}
}
}
</script>
<script language="javascript">
// fonction pour le cas d'appui sur la touche entrée
function testsubmit() {
return !!document.promotionform.action;
}
//fonction pour choisir l'action
function gopage(val)
{
if (val=='Enregistrer et Quitter'){
document.promotionform.action ='sauvegarde.asp';
document.promotionform.submit();
window.location='liste_prix.asp';
}
else{
document.promotionform.action ='sauvegarde.asp';
document.promotionform.submit();
window.location='form_promotion.asp';
}
}
</script>
<style type="text/css">
.ds_box {
background-color: #FFF;
border: 1px solid #000;
position: absolute;
z-index: 32767;
}
.ds_tbl {
background-color: #FFF;
}
.ds_head {
background-color: #333;
color: #FFF;
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: bold;
text-align: center;
letter-spacing: 2px;
}
.ds_subhead {
background-color: #CCC;
color: #000;
font-size: 12px;
font-weight: bold;
text-align: center;
font-family: Arial, Helvetica, sans-serif;
width: 32px;
}
.ds_cell {
background-color: #EEE;
color: #000;
font-size: 13px;
text-align: center;
font-family: Arial, Helvetica, sans-serif;
padding: 5px;
cursor: pointer;
}
.ds_cell:hover {
background-color: #F3F3F3;
} /* This hover code won't work for IE */
</style>
<TITLE>Satellite, Alarme, Vidéo surveillance, Sécurité.Toute la technologie avec Electronic Discount</TITLE>
</head>
<body>
<%
'id_prod=request.QueryString("Id_Prod")
sql = "SELECT * FROM produits where Id_Prod=16"
Set prod = Server.CreateObject("ADODB.Recordset")
prod.Open sql, conn, 3, 3
%>
<table width="370" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="color:#29419C"><img src="../image/<%if prod.fields("Image_2")<>"" then%><%=prod.fields("Image_2")%><%else%><%=prod.fields("Image_prod")%><%end if%>" title="<%=lcase(prod.fields("titre_prod"))%>" hspace="5" vspace="15" width="150"></td>
</tr>
<tr>
<td><strong style="color:#29419C">Produit : </strong><%=prod.fields("titre_prod")%></td>
</tr>
<tr>
<td><strong style="color:#29419C">Référence :</strong> <%=ucase(prod.fields("Ref_prod"))%></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td><strong style="color:#29419C">Prix :</strong>
<span style="color:#FF0000; font-weight:bold; font-size:14px"><%
PrixHTprom=prod.fields("PrixHTprom_Prod")
PrixHT_Prod=prod.fields("PrixHT_Prod")
if prod.fields("Prom_Prod")=1 then
prix = formatnumber(PrixHTprom*1.196)
end if
if prod.fields("Prom_Prod")=0 then
prix =formatnumber(PrixHT_Prod*1.196)
end if
response.write(prix)
%> €
</span></td>
</tr>
</table>
<center>
<h1>Prix degressif</h1>
<form action="sauvegarde.asp" name="promotionform" method="POST">
<input type="hidden" name="ancien_prix" id="ancien_p" maxlength=5 size=5 value="<%=prix%>">
<input type="hidden" name="idProd" id="idProd" maxlength=5 size=5 value="<%=prod.fields("Id_Prod")%>">
<table>
<table width="554" border=0>
<tr><th>De</th><th>A</th><th>Nouveau Prix</th><th>Taux</th><th>Reduction</th></tr>
<%
for i =1 to 10
%>
<tr>
<td align="center"><input type="text" name="<% response.write("quantiteInf_"&i) %>" id="<% response.write("quantiteInf_"&i) %>" maxlength=10 size=10 value=""></td>
<td align="center"><input type="text" name="<% response.write("quantiteSup_"&i) %>" id="<% response.write("quantiteSup_"&i) %>" maxlength=10 size=10 value=""></td>
<td align="center"><input type='text' name="<% response.write("nouveau_prix_"&i) %>" id="<% response.write("nouveau_p"&i)%>" maxlength=10 size=10 onChange="calcul_taux_reduction(document.getElementById('ancien_p').value);"></td>
<td align="center"><input type='text' name="<% response.write("taux_"&i) %>" id="<% response.write("ttaux"&i)%>" maxlength=10 size=10 onChange="calcul_nouvprix_reduction(document.getElementById('ancien_p').value);"></td>
<td align="center"><input type='text' name="<% response.write("reduction_"&i) %>" id="<% response.write("pred"&i)%>" maxlength=10 size=10 onChange="calcul_nouvprix_taux(document.getElementById('ancien_p').value);"></td>
</tr>
<%
next
%>
<tr><td colspan="5"><input name="button" type="submit" value="Enregistrer et Quitter" />
</td>
</tr>
</table>
</form>
</center>
</body>
</html> |
Partager