480 lines
11 KiB
JavaScript
480 lines
11 KiB
JavaScript
var ursprung='';
|
||
var sprung=0;
|
||
var ziel='';
|
||
felder = new Array("document.form.besteller","form.strasse","plz","ort" );
|
||
|
||
function del()
|
||
{//WegdaCookie(document.cookie,0,0);
|
||
}
|
||
|
||
|
||
|
||
function del_wk()
|
||
{
|
||
document.form.B_.value = "";
|
||
// document.cookie = "=";
|
||
WegdaCookie(document.cookie,0,0);
|
||
}
|
||
|
||
|
||
function onload1() {
|
||
zahlungsarten();
|
||
berechne();
|
||
}
|
||
|
||
|
||
|
||
function zahlungsarten () {
|
||
|
||
// ***************************************************************
|
||
// Zahlungsarten eintragen ist aber nicht wichtig
|
||
// ***************************************************************
|
||
|
||
if(get_z4()!="") {
|
||
element = new Option(get_z4(),get_p4(), false, true);
|
||
document.form.Versand_____.options[3] = element;
|
||
}
|
||
|
||
if(get_z3()!="") {
|
||
element = new Option(get_z3(),get_p3(), false, true);
|
||
document.form.Versand_____.options[2] = element;
|
||
}
|
||
if(get_z2()!="") {
|
||
element = new Option(get_z2(),get_p2(), false, true);
|
||
document.form.Versand_____.options[1] = element;
|
||
}
|
||
if(get_z1()!="") {
|
||
element = new Option(get_z1(),get_p1(), false, true);
|
||
document.form.Versand_____.options[0] = element;
|
||
}
|
||
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
function berechne () {
|
||
|
||
anmerkung = 0;
|
||
anmerkungg = 0;
|
||
versand = "";
|
||
versand = "2.45";
|
||
versandz = 0;
|
||
// cookie in B_ schreiben
|
||
|
||
c = document.cookie;
|
||
|
||
|
||
//if(documern.Name________.value == "debug")alert(c);
|
||
|
||
px1 = 0;
|
||
px2 = 0;
|
||
// 1. Test ob Warenkorb brauchbar
|
||
px1 = c.indexOf('p1r2i');
|
||
if (px1<0) c = ""; // Warenkorb hat keine Positionen
|
||
|
||
//if(documern.Name________.value == "debug") alert(c);
|
||
|
||
c = c+";";
|
||
l = c.length;
|
||
|
||
|
||
document.form.B_.value = "";
|
||
|
||
// alert(c+" "+l);
|
||
// alert(l);
|
||
|
||
if ( l > 7 ) {
|
||
|
||
|
||
i = 0;
|
||
w = true;
|
||
pos = 0;
|
||
len1 = 0;
|
||
f = 0;
|
||
position = 0;
|
||
|
||
pos_gpreis = 0.0;
|
||
pos_epreis = 0.0;
|
||
pos_menge = 0.0;
|
||
spos_gpreis = " ";
|
||
|
||
sum_gpreis = 0.0;
|
||
rabatt = " ";
|
||
sum_vpreis = 0.0;
|
||
|
||
ssum_gpreis = " ";
|
||
|
||
|
||
while( w == true) {
|
||
|
||
px1 = c.indexOf('p1r2i');
|
||
c = c.substr(px1+6,l); // vorne abschneiden
|
||
|
||
px2 = c.indexOf(';');
|
||
|
||
pos = 1;
|
||
|
||
sub1 = c.substr(0,px2); // eine Position im String
|
||
c = c.substr(px2+1,l); // Position wird rausgeschnitten
|
||
len1 = sub1.length; // L<>nge Positionsstring
|
||
|
||
// alert(c);
|
||
// alert("sub1: "+sub1);
|
||
|
||
// eine Position ermittelt
|
||
|
||
// alert("|"+sub1+" "+len1);
|
||
|
||
ab1 = 0;
|
||
ab2 = 0;
|
||
ab3 = 0;
|
||
for (f=0;f<len1;f++){ if(sub1.substr(f,1)=="|") { if(ab2!=0) ab3 = f;
|
||
if(ab1!=0&&ab2==0) ab2 = f;
|
||
if(ab1==0) ab1 = f;
|
||
}
|
||
} // for
|
||
|
||
artikel = sub1.substr(0,ab1);
|
||
text = sub1.substr(ab1+1,ab2-ab1-1);
|
||
menge = sub1.substr(ab2+1,ab3-ab2-1);
|
||
preis = sub1.substr(ab3+1,len1-ab3);
|
||
|
||
// wegen Mozilla !!
|
||
pl = preis.length;
|
||
if(preis.substr(pl-1,1)== '=') preis = preis.substr(0,pl-1);
|
||
|
||
|
||
pos_menge = menge;
|
||
pos_epreis = preis;
|
||
pos_gpreis = pos_menge * pos_epreis;
|
||
|
||
sum_gpreis = sum_gpreis + pos_gpreis;
|
||
|
||
//spos_gpreis = pos_gpreis.toString();
|
||
spos_gpreis = pos_gpreis.toFixed(2); // 2 Nachkommastellen
|
||
|
||
|
||
lg = spos_gpreis.length
|
||
if (spos_gpreis.indexOf('.')== -1) spos_gpreis = spos_gpreis+".00";
|
||
if (spos_gpreis.indexOf('.')== lg-2 ) spos_gpreis = spos_gpreis+"0";
|
||
|
||
|
||
fixlen = 7;
|
||
spos_gpreis = spos_gpreis.substr(0,fixlen);
|
||
alen = spos_gpreis.length;
|
||
text1 = "";
|
||
for(n=0;n<fixlen-alen;n++) text1 = text1+" ";
|
||
text1 = text1+spos_gpreis;
|
||
spos_gpreis = text1;
|
||
|
||
apos = "0";
|
||
position = position +1;
|
||
apos = position;
|
||
text1 = "";
|
||
if (position <10 ) text1 = "0";
|
||
text1 = text1+apos;
|
||
apos = text1;
|
||
|
||
|
||
fixlen = 11;
|
||
artikel = artikel.substr(0,fixlen);
|
||
alen = artikel.length;
|
||
text1 = artikel;
|
||
for(n=0;n<fixlen-alen;n++) text1 = text1+" ";
|
||
artikel = text1;
|
||
|
||
|
||
fixlen = 30;
|
||
text = text.substr(0,fixlen);
|
||
alen = text.length;
|
||
text1 = text;
|
||
//for(n=0;n<fixlen-alen;n++) text1 = text1+" ";
|
||
text = text1;
|
||
|
||
fixlen = 5;
|
||
menge = menge.substr(0,fixlen);
|
||
alen = menge.length;
|
||
text1 = "";
|
||
for(n=0;n<fixlen-alen;n++) text1 = text1+" ";
|
||
text1 = text1+menge;
|
||
menge = text1;
|
||
|
||
fixlen = 6;
|
||
preis = preis.substr(0,fixlen);
|
||
text1 = ""
|
||
alen = preis.length;
|
||
for(n=0;n<fixlen-alen;n++) text1 = text1+" ";
|
||
if (alen == 4) text1 = " " + text1;
|
||
text1 = text1+preis;
|
||
preis = text1;
|
||
|
||
//alert("|"+artikel);
|
||
//alert(text);
|
||
//alert(menge);
|
||
//alert(preis);
|
||
|
||
//b WegdaCookie(sub1,0,0);
|
||
|
||
|
||
text1 = " "+apos+""+menge+"St<53>ck "+artikel+" Preis:"+preis+"<22> Summe:"+spos_gpreis+"<22> "+text+"\n";
|
||
|
||
|
||
lg = artikel.length;
|
||
if (artikel.indexOf('a')==lg-1) if (versandz < 1)versandz = 1;
|
||
if (artikel.indexOf('b')==lg-1) if (versandz < 2)versandz = 2;
|
||
if (artikel.indexOf('c')==lg-1) if (versandz < 3)versandz = 3;
|
||
if (artikel.indexOf('d')==lg-1) if (versandz < 4)versandz = 4;
|
||
if (artikel.indexOf('e')==lg-1) if (versandz < 5)versandz = 5;
|
||
if (artikel.indexOf('f')==lg-1) if (versandz < 6)versandz = 6;
|
||
if (artikel.indexOf('g')==lg-1) if (versandz < 7)versandz = 7;
|
||
if (artikel.indexOf('h')==lg-1) if (versandz < 8)versandz = 8;
|
||
if (artikel.indexOf('x')==lg-2) anmerkung = 1;
|
||
if (artikel.indexOf('g')==lg-1) anmerkungg = 1;
|
||
if (artikel.indexOf('h')==lg-1) anmerkungg = 1;
|
||
|
||
|
||
document.form.B_.value = document.form.B_.value + text1;
|
||
|
||
if(c.indexOf('p1r2i') < 0 ) break;
|
||
} // end while ----------------------------------------------------------
|
||
|
||
if (versandz == 1) versand = "4.45";
|
||
if (versandz == 2) versand = "5.95";
|
||
if (versandz == 3) versand = "8.95";
|
||
if (versandz == 4) versand = "9.95";
|
||
if (versandz == 5) versand = "14.95";
|
||
if (versandz == 6) versand = "19.95";
|
||
if (versandz == 7) versand = "159.00";
|
||
if (versandz == 8) versand = "159.00";
|
||
|
||
gesammtpreis = sum_gpreis.toFixed(2); // 2 Nachkommastellen
|
||
|
||
//if (sum_gpreis > 49.99) if (sum_gpreis < 100) sum_gpreis = sum_gpreis /100 * 97 ;
|
||
//if (sum_gpreis > 99.99) if (sum_gpreis < 150) sum_gpreis = sum_gpreis /100 * 96 ;
|
||
//if (sum_gpreis > 149.99) sum_gpreis = sum_gpreis /100 * 95 ;
|
||
|
||
|
||
if (sum_gpreis > 350) if (versand == "5.95") versand = "8.95";
|
||
if (sum_gpreis > 150) if (versand == "4.45") versand = "5.95";
|
||
|
||
|
||
//ssum_gpreis = sum_gpreis.toString();
|
||
|
||
ssum_gpreis = sum_gpreis.toFixed(2); // 2 Nachkommastellen
|
||
|
||
lg = ssum_gpreis.length;
|
||
if (ssum_gpreis.indexOf('.')== lg-1) ssum_gpreis = ssum_gpreis + ".00";
|
||
if (ssum_gpreis.indexOf('.')== lg-2 ) ssum_gpreis = ssum_gpreis +"0";
|
||
|
||
|
||
|
||
|
||
|
||
lx1 = ssum_gpreis.indexOf('.');
|
||
ssum_gpreis = ssum_gpreis.substr(0,lx1+3);
|
||
|
||
|
||
fixlen = 10;
|
||
ssum_gpreis = ssum_gpreis.substr(0,fixlen);
|
||
alen = ssum_gpreis.length;
|
||
text1 = "";
|
||
for(n=0;n<fixlen-alen;n++) text1 = text1+" ";
|
||
|
||
text1 = text1+ssum_gpreis;
|
||
ssum_gpreis = text1;
|
||
//
|
||
//
|
||
text1 = "\n";
|
||
document.form.B_.value = document.form.B_.value + text1;
|
||
|
||
rabatt = " ";
|
||
|
||
//if (gesammtpreis > 49.99) if (gesammtpreis < 100) rabatt = " vom Warenwert " +gesammtpreis+" Euro wurden 3% Rabatt abgezogen!";
|
||
//if (gesammtpreis > 99.99) if (gesammtpreis < 150) rabatt = " vom Warenwert " +gesammtpreis+" Euro wurden 4% Rabatt abgezogen!";
|
||
|
||
|
||
//if (gesammtpreis > 149.99) rabatt = " vom Warenwert " +gesammtpreis+" Euro wurden 5% Rabatt abgezogen!";
|
||
|
||
|
||
|
||
|
||
|
||
|
||
text1 = "Warenwert Summe: "+get_waehrung()+ssum_gpreis+rabatt+"\n";
|
||
document.form.B_.value = document.form.B_.value + text1;
|
||
//
|
||
//
|
||
vtext = "";
|
||
vpreis = "";
|
||
|
||
|
||
if (get_z1() != "") if(document.form.Versand_____.options[0].selected) vtext = get_z1();
|
||
if (get_z2() != "") if(document.form.Versand_____.options[1].selected) vtext = get_z2();
|
||
if (get_z3() != "") if(document.form.Versand_____.options[2].selected) vtext = get_z3();
|
||
if (get_z4() != "") if(document.form.Versand_____.options[3].selected) vtext = get_z4();
|
||
|
||
if (get_z1() != "") if(document.form.Versand_____.options[0].selected) vpreis = get_p1();
|
||
if (get_z2() != "") if(document.form.Versand_____.options[1].selected) vpreis = get_p2();
|
||
if (get_z3() != "") if(document.form.Versand_____.options[2].selected) vpreis = get_p3();
|
||
if (get_z4() != "") if(document.form.Versand_____.options[3].selected) vpreis = get_p4();
|
||
|
||
if (vpreis > 0 ) {
|
||
|
||
if (versand > 0) vpreis = versand; //Versand wird erh<72>ht;
|
||
|
||
|
||
sum_vpreis = vpreis;
|
||
|
||
|
||
sum_gpreis += (sum_vpreis * 1);
|
||
|
||
fixlen = 6;
|
||
vpreis = vpreis.substr(0,fixlen);
|
||
alen = vpreis.length;
|
||
text1 = "";
|
||
//for(n=0;n<fixlen-alen;n++) text1 = text1+" ";
|
||
text1 = text1+vpreis;
|
||
vpreis = text1;
|
||
|
||
fixlen = 12;
|
||
vtext = vtext.substr(0,fixlen);
|
||
alen = vtext.length;
|
||
text1 = "";
|
||
for(n=0;n<fixlen-alen;n++) text1 = text1+" ";
|
||
text1 = text1+vtext;
|
||
vtext = text1;
|
||
|
||
text1 = "Versandkosten incl: "+get_waehrung()+" "+vpreis+"\n";
|
||
document.form.B_.value = document.form.B_.value + text1;
|
||
|
||
} // Ende Berechnung der Versandkosten
|
||
|
||
|
||
ssum_gpreis = sum_gpreis.toString();
|
||
|
||
//alert(ssum_gpreis);
|
||
|
||
lg = ssum_gpreis.length
|
||
if (ssum_gpreis.indexOf('.')== -1) ssum_gpreis = ssum_gpreis + ".00";
|
||
if (ssum_gpreis.indexOf('.')== lg-2 ) ssum_gpreis = ssum_gpreis +"0";
|
||
|
||
lx1 = ssum_gpreis.indexOf('.');
|
||
ssum_gpreis = ssum_gpreis.substr(0,lx1+3);
|
||
|
||
|
||
fixlen = 10;
|
||
ssum_gpreis = ssum_gpreis.substr(0,fixlen);
|
||
alen = ssum_gpreis.length;
|
||
text1 = "";
|
||
for(n=0;n<fixlen-alen;n++) text1 = text1+" ";
|
||
text1 = text1+ssum_gpreis;
|
||
ssum_gpreis = text1;
|
||
//
|
||
//
|
||
|
||
if (vpreis > 0 ) {
|
||
|
||
text1 = "Rechnungssumme: "+get_waehrung()+ssum_gpreis+"\n";
|
||
document.form.B_.value = document.form.B_.value + text1;
|
||
|
||
|
||
mwst = sum_gpreis; // Endpreis <20>bernehmen
|
||
mwst = mwst/119*19;
|
||
mwst = mwst.toFixed(2); // 2 Nachkommastellen
|
||
|
||
|
||
text1 ="enth<74>lt 19% MwSt: "+get_waehrung()+" "+mwst+"\n\n";
|
||
document.form.B_.value = document.form.B_.value + text1;
|
||
|
||
if (anmerkung > 0)text1 = "Wir pr<70>fen, ob der gew<65>nschte Sonderposten verf<72>gbar ist. Best<73>tigung erfolgt per extra Mail!\n\n";
|
||
if (anmerkung > 0)document.form.B_.value = document.form.B_.value + text1;
|
||
|
||
|
||
if ( versand == "159.00")text1 = "Sie brauchen das Geld f<>r die Maschine nicht gleich <20>berweisen. In den n<>chsten\n";
|
||
if ( versand == "159.00")document.form.B_.value = document.form.B_.value + text1;
|
||
|
||
if ( versand == "159.00")text1 = "Tagen erhalten Sie eine Anzahlungsrechnung, die Sie dann bitte <20>berweisen.\n\n";
|
||
if ( versand == "159.00")document.form.B_.value = document.form.B_.value + text1;
|
||
|
||
} // end Vpreis > 0
|
||
|
||
|
||
|
||
|
||
if (get_text1().length > 0) document.form.B_.value = document.form.B_.value + get_text1()+"\n";
|
||
|
||
|
||
} // end if l > 7
|
||
} // end function
|
||
|
||
function CookieSetzen (name, wert, verfall, pfad, domain, sicher) {
|
||
|
||
document.cookie = name + "=" + escape (wert) +
|
||
((verfall) ? "; expires=" + verfall.toGMTString() : "") +
|
||
((pfad) ? "; path=" + pfad : "") +
|
||
((domain) ? "; domain=" + domain : "") +
|
||
((sicher) ? "; secure=" + sicher : "");
|
||
}
|
||
|
||
|
||
function WegdaCookie(name, pfad, domain) {
|
||
|
||
Ehemals = new Date ();
|
||
Ehemals.setTime (Ehemals.getTime () - (365 * 24 * 60 * 60 * 1000));
|
||
|
||
CookieSetzen (name, "", Ehemals, pfad, domain);
|
||
|
||
}
|
||
|
||
|
||
function d(pos1)
|
||
{
|
||
|
||
npos1 = 0;
|
||
zpos1 = 0;
|
||
len1 = 0;
|
||
len2 = 0;
|
||
|
||
npos1 = pos1;
|
||
|
||
if(document.form.Name________.value == "debug") alert(document.cookie);
|
||
else {
|
||
|
||
c = document.cookie;
|
||
c = c+";";
|
||
|
||
npos1 = 0;
|
||
|
||
while (true) {
|
||
|
||
px1 = c.indexOf('p1r2i');
|
||
c = c.substr(px1,l); // vorne abschneiden
|
||
px2 = c.indexOf(';');
|
||
|
||
sub1 = c.substr(0,px2); // eine Position im String
|
||
c = c.substr(px2+1,l); // Position wird rausgeschnitten
|
||
len1 = sub1.length; // L<>nge Positionsstring
|
||
|
||
npos1 = npos1 +1;
|
||
if (npos1 == pos1) break;
|
||
|
||
}
|
||
|
||
|
||
// eine Position ermittelt
|
||
// alert(sub1);
|
||
// alert(c);
|
||
|
||
alert("Position "+pos1+" gel<65>scht !");
|
||
|
||
WegdaCookie(sub1,0,0);
|
||
|
||
|
||
berechne();
|
||
|
||
}
|
||
} |