$sessie=$_COOKIE["UwHomePage-sessie"];
if ($sessie==''){
print "
helaas uw sessie is verlopen";
exit;
}
print "";
include ('config.ini');
include ('bedrijfsgegevens.php');
include ('soort_shop.php');
include ('manager/soort_shop.php');
/*
//'".addslashes($sessie)."'";
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// uitzoeken of de klant al een klantenkaart heeft, en of er al 50 punten opstaan.
//zoja dan -5 euro aan winkelwagentje toevoegen en bij de volgende stap 50 punten aftrekken van spaarkaart.
//eerst zoeken we het huisnummer van de klant op en plaatsen dat achter de postcode
$plaats = strcspn($adres,"0123456789");
$huisnummer = substr($adres,$plaats);
$huisnummer = strtoupper($huisnummer);
//print "huisnummer = ".$huisnummer."
";
$pc = trim($pc);
$pc1 = substr($pc,0,4);
$pc2 = substr($pc,-2);
$pc2 = strtoupper($pc2);
$pc = $pc1.$pc2;
//print "postcode = ".$pc."
";
$klantnummer = $pc.$huisnummer;
//print $klantnummer ;
$query= "SELECT ID, bestellingen FROM klanten where klantnummer ='".addslashes($klantnummer)."'";
$klantID = mysql_query($query)or die('
Error, ophalen klantgegevens mislukt ' . mysql_error());
while ($line = mysql_fetch_array($klantID, MYSQL_ASSOC)) {
foreach ($line as $col_value) {
if ($counter==0)
{
$KlantIDb=$col_value;
}
if ($counter==1)
{
$Klantbestellingenb=$col_value;
}
$counter++;
}
$counter=0;
}
//print $klantIDb." punten = ".$Klantbestellingenb."
";
if ($Klantbestellingenb >= 50){
// kijken of de bestelling groter is dan 5 euro en zoja winkelwagentje aanpassen
$query= "SELECT aantal,aantstaffel,vrkprijs,actprijs FROM winkelwagen where sessie =".$sessie ;
$result =mysql_query($query) or die('
Error, kan de tabel winkelwagen niet lezen, raadpleeg het opperhoofd: ' . mysql_error() );
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
foreach ($line as $col_value) {
if ($counter==0)
{
$aantal=$col_value;
}
if ($counter==1)
{
$aantstaffel=$col_value;
}
if ($counter==2)
{
$vrkprijs=$col_value;
}
if ($counter==3)
{
$actprijs=$col_value;
}
$counter++;
}
$counter=0;
$prijsaantal= $aantal * $vrkprijs;
$prijsstaffel = $aantstaffel * $actprijs;
$ordergrootte = $ordergrootte + $prijsaantal + $prijsstaffel;
}
//print $ordergrootte;
if ($ordergrootte >5.00){
//print "winkelwagentje aanpassen...
";
$bestellingen = $Klantbestellingenb - 50;
$query="INSERT INTO winkelwagen (sessie,code,aantal,vrkprijs ) VALUES('$sessie','Korting spaarkaart','1','-5.00')";
mysql_query($query)or die('
Error, invoegen korting in winkelwagen mislukt ' . mysql_error());
$query= "update klanten set bestellingen = '".$bestellingen."' WHERE klantnummer ='".addslashes($klantnummer)."'";
$result =mysql_query($query) or die('Error, update spaarkaart mislukt: ' . mysql_error() );
}
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$query= "update winkelwagen set naam ='".$naam."' WHERE sessie =".$sessie;
$result =mysql_query($query) or die('Error, update winkelwagen - naam - mislukt: ' . mysql_error() );
$query= "update winkelwagen set adres ='".$adres."' WHERE sessie =".$sessie;
$result =mysql_query($query) or die('Error, update winkelwagen - adres - mislukt: ' . mysql_error() );
$query= "update winkelwagen set pc ='".$pc."' WHERE sessie =".$sessie;
$result =mysql_query($query) or die('Error, update winkelwagen - pc - mislukt: ' . mysql_error() );
$query= "update winkelwagen set woonplaats ='".$woonplaats."' WHERE sessie =".$sessie;
$result =mysql_query($query) or die('Error, update winkelwagen - wpl - mislukt: ' . mysql_error() );
$query= "update winkelwagen set telefoon ='".$telefoon."' WHERE sessie =".$sessie;
$result =mysql_query($query) or die('Error, update winkelwagen - tel - mislukt: ' . mysql_error() );
$query= "update winkelwagen set email ='".$email."' WHERE sessie =".$sessie;
$result =mysql_query($query) or die('Error, update winkelwagen - email - mislukt: ' . mysql_error() );
*/
print "";
print "F A C T U U R ";
print "
";
print "Dit is een pro-forma factuur, de definitieve factuur ontvangt u bij uw bestelling.
";
print "Uw bestelling wordt verzonden na ontvangst van uw betaling.
";
//***************************************************************************************************************************
//**************************************************************************************************************************
$query= "SELECT * FROM kassa where sessie =".$sessie ;
$result =mysql_query($query) or die('
Error, kan de tabel winkelwagen niet lezen :
' . mysql_error() );
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
foreach ($line as $col_value) {
if ($counter==0)
{
$ID=$col_value;
}
if ($counter==1)
{
$sessieB=$col_value;
}
if ($counter==2)
{
$product=$col_value;
}
if ($counter==3)
{
$shop=$col_value;
}
if ($counter==4)
{
$aantal=$col_value;
}
if ($counter==5)
{
$klant=$col_value;
}
if ($counter==6)
{
$datbest=$col_value;
}
if ($counter==7)
{
$datbeta=$col_value;
}
if ($counter==8)
{
$datfact=$col_value;
}
if ($counter==9)
{
$datgele=$col_value;
}
$counter++;
}
$counter=0;
$loop++;
if ($loop == '1'){
//print "klant : ".$klant;
// klantgegevens ophalen
$query= "SELECT * FROM klanten where ID =".$klant ;
$result2 =mysql_query($query) or die('
Error, kan de tabel klanten niet lezen :
' . mysql_error() );
while ($line = mysql_fetch_array($result2, MYSQL_ASSOC)) {
foreach ($line as $col_value) {
if ($counter==0)
{
$ID=$col_value;
}
if ($counter==1)
{
$klantnummer=$col_value;
}
if ($counter==2)
{
$pass=$col_value;
}
if ($counter==3)
{
$naam=$col_value;
}
if ($counter==4)
{
$adres=$col_value;
}
if ($counter==5)
{
$pc=$col_value;
}
if ($counter==6)
{
$woonplaats=$col_value;
}
if ($counter==7)
{
$land=$col_value;
}
if ($counter==8)
{
$geboortedatum=$col_value;
}
if ($counter==9)
{
$tel1=$col_value;
}
if ($counter==10)
{
$mobiel1=$col_value;
}
if ($counter==11)
{
$email1=$col_value;
}
if ($counter==12)
{
$entiteit=$col_value;
}
if ($counter==13)
{
$user=$col_value;
}
if ($counter==14)
{
$Badres=$col_value;
}
if ($counter==15)
{
$Bpc=$col_value;
}
if ($counter==16)
{
$Bwoonplaats=$col_value;
}
if ($counter==17)
{
$Bnaam=$col_value;
}
$counter++;
}
$counter=0;
// einde klantgegevens ophalen
}
print " ";
print "";
print "Voor : | ".$naam." | | Van : | ".$bedrijfsnaam." |
";
print "Adres | ".$adres." | | Adres | ".$bedrijfsadres." |
";
print "Postcode | ".$pc." | | Postcode | ".$bedrijfspc." |
";
print "Woonplaats | ".$woonplaats." | | Woonplaats | ".$bedrijfswoonplaats." |
";
print "Telefoon | ".$tel1." | | Telefoon | ".$bedrijfstelefoon." |
";
print "E-mail | ".$email1." | | Fax | ".$bedrijfsfax." |
";
print "Ordernummer : | ".$sessieB." | | E-mail | ".$bedrijfsemail." |
";
print " | | | KVK | ".$bedrijfskvk." |
";
print " | | | BTW | ".$bedrijfsbtw." |
";
print " | | | Bank | ".$bedrijfsbank." |
";
print "
";
Print "
";
// opbouw tabel
print "";
print "Aantal | ";
print "Artikel | ";
print "prijs / stuk | ";
print "prijs | ";
print "
";
print "
|
";
// opbouw tabel
}// einde loop=1
//************************************************************************************************************************
// per besteld artikel gegevens opvragen en tonen
$query= "SELECT * FROM ".$shop." where ID ='".addslashes($product)."'";
$result3 =mysql_query($query) or die('
Error, kan de tabel producten niet lezen :
' . mysql_error() );
while ($line = mysql_fetch_array($result3, MYSQL_ASSOC)) {
foreach ($line as $col_value) {
if ($counter==0)
{
$codeb=$col_value;
}
if ($counter==1)
{
$cat=$col_value;
}
if ($counter==2)
{
$subcat=$col_value;
}
if ($counter==3)
{
$merk=$col_value;
}
if ($counter==4)
{
$type=$col_value;
}
if ($counter==5)
{
$leverancier=$col_value;
}
if ($counter==6)
{
$inkprijs=$col_value;
}
if ($counter==7)
{
$vrkprijs=$col_value;
}
if ($counter==8)
{
$tekst1=$col_value;
}
if ($counter==9)
{
$tekst2=$col_value;
}
if ($counter==10)
{
$foto=$col_value;
}
if ($counter==11)
{
$levertijd=$col_value;
}
if ($counter==12)
{
$actie=$col_value;
}
if ($counter==13)
{
$voorraad=$col_value;
}
if ($counter==14)
{
$verwijderd=$col_value;
}
if ($counter==15)
{
$gewicht=$col_value;
}
$counter++;
}
$counter=0;
$gewichtaantal = $aantal * $gewicht / 100 ;
$gewichttotaal = $gewichttotaal + $gewichtaantal;
$prijs = $aantal*$vrkprijs;
$vrkprijss = number_format($vrkprijs, 2, ',', '');
$prijss = number_format($prijs, 2, ',', '');
$subtotaal = $subtotaal + $prijs;
print "";
print $aantal." ";
print " | ";
print "".$tekst1." | ";
print "€ ".$vrkprijss." | € ".$prijss." | ";
print "
";
//print "
|
";
// einde per besteld artikel gegevens opvragen en tonen
// **************************************************************************************************************************
}
} // terug naar bestellijst (db winkelwagen)
if ($gewichttotaal <= '20'){$gewichtsklasse= '1';}
if ($gewichttotaal >= '20'){ if ($gewichttotaal <= '50'){$gewichtsklasse= '2';}}
if ($gewichttotaal >= '50'){ if ($gewichttotaal <= '100'){$gewichtsklasse= '3';}}
if ($gewichttotaal >= '100'){ if ($gewichttotaal <= '250'){$gewichtsklasse= '4';}}
if ($gewichttotaal >= '250'){ if ($gewichttotaal <= '500'){$gewichtsklasse= '5';}}
if ($gewichttotaal >= '500'){ if ($gewichttotaal <= '3000'){$gewichtsklasse= '6';}}
if ($gewichttotaal >= '3000'){ if ($gewichttotaal <= '10000'){$gewichtsklasse= '7';}}
if ($woonplaats == 'Riel'){$gewichtsklasse= '7';}
if ($woonplaats == 'riel'){$gewichtsklasse= '7';}
if ($woonplaats == 'RIEL'){$gewichtsklasse= '7';}
if ($woonplaats == 'rIEL'){$gewichtsklasse= '7';}
if ($gewichtsklasse == '1'){ $verzendkosten = 0.44;}
if ($gewichtsklasse == '2'){ $verzendkosten = 0.88;}
if ($gewichtsklasse == '3'){ $verzendkosten = 1.32;}
if ($gewichtsklasse == '4'){ $verzendkosten = 1.76;}
if ($gewichtsklasse == '5'){ $verzendkosten = 2.20;}
if ($gewichtsklasse == '6'){ $verzendkosten = 2.64;}
if ($gewichtsklasse == '7'){ $verzendkosten = 0.00;}
if ($gewichttotaal <= '20'){$gewichttotaal='minder dan 20';}
print "
|
";
print "Gewicht van deze order: | ";
$totaal = $subtotaal + $verzendkosten;
$btw = $subtotaal * 0.19;
$subtotaal = number_format($subtotaal, 2, ',', '');
$totaal = number_format($totaal, 2, ',', '');
$btw = number_format($btw, 2, ',', '');
$verzendkosten = number_format($verzendkosten, 2, ',', '');
print "".$gewichttotaal." gram | ";
print "";
print "";
print "Subtotaal | € ".$subtotaal." | ";
print " | | ";
print "Verzendkosten | € ".$verzendkosten." | ";
print " | | ";
print "Totaal | € ".$totaal." | ";
print " | | ";
print " | | ";
print "BTW in deze rekening | € ".$btw." | ";
print " |
";
print "
|
";
Print "
";
print "U kunt uw betaling overmaken op ".$bedrijfsbank." t.n.v. ".$bedrijfsnaam."
";
print "onder vermelding van het ordernummer ".$sessie."
";
print "