<?php require_once('Connections/dulceria.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO `libreta de ventas` (ID_VENTAS, FECHA, MERCANCIA, ID_MERCANCIA, ID_EMPLEADO) VALUES (%s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['ID_VENTAS'], "int"),
                       GetSQLValueString($_POST['FECHA'], "date"),
                       GetSQLValueString($_POST['MERCANCIA'], "int"),
                       GetSQLValueString($_POST['ID_MERCANCIA'], "int"),
                       GetSQLValueString($_POST['ID_EMPLEADO'], "int"));

  mysql_select_db($database_dulceria, $dulceria);
  $Result1 = mysql_query($insertSQL, $dulceria) or die(mysql_error());

  $insertGoTo = "libreta ventas.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
?><html>
<head>
<title>Libreta ventas</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body,td,th {
	color: #F0F0F0;
}
.Estilo1 {color: #000000}
body {
	background-color: #FFFFFF;
	background-image: url(img/fondo%20amarilo.jpg);
}
.Estilo2 {color: #00CC00}
.Estilo3 {color: #669900}
.Estilo4 {
	font-size: xx-large;
	color: #000000;
}
.style10 {font-family: Arial, Helvetica, sans-serif}
.style12 {font-size: 36px; color: #000000; font-family: Arial, Helvetica, sans-serif; }
.style12 {font-size: 40px
}
.style13 {font-size: 36px;
	color: #000000;
	font-family: Geneva, Arial, Helvetica, sans-serif;
}
.style14 {font-size: 36px}
.style4 {font-size: 24px;
	color: #000000;
	font-family: Arial, Helvetica, sans-serif;
}
#apDiv1 {position:absolute;
	width:429px;
	height:50px;
	z-index:1;
	left: 315px;
	top: 15px;
}
#apDiv2 {
	position:absolute;
	width:855px;
	height:29px;
	z-index:2;
	left: 64px;
	top: 1079px;
}
-->
</style>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<div align="center"><span class="Estilo2 Estilo3"><img src="img/logo dulceria.jpg" alt="logo dulceria" width="100" height="90
"></span><span class="style4"> </span>
    <div id="apDiv1">
      <p class="style12 style14"><font face="monotype corsiva">DELICIOUS CANDYS</font></p>
    </div>
  <span class="style13"><font face="monotype corsiva">Para el ni&ntilde;o que llevas dentro</font></span><span class="style12">.</span><span class="style10">..</span><br>
</div>
<table width="90%" border="3" cellspacing="4" cellpadding="2" align="center">
  <!--DWLayoutTable-->
  <tr valign="top">
    <td width="132" rowspan="2" align="center"><p>&nbsp;</p>
        <p>
          <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','156','height','44','src','button20','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgcolor','#FFCC00','movie','button20' ); //end AC code
      </script>
          <noscript>
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="156" height="44">
            <param name="movie" value="button20.swf">
            <param name="quality" value="high">
            <param name="bgcolor" value="#FFCC00">
            <embed src="button20.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="156" height="44" bgcolor="#FFCC00"></embed>
          </object>
          </noscript>
        </p>
      <p>
          <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','156','height','44','src','button21','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgcolor','#FFCC00','movie','button21' ); //end AC code
      </script>
        <noscript>
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="156" height="44">
            <param name="movie" value="button21.swf">
            <param name="quality" value="high">
            <param name="bgcolor" value="#FFCC00">
            <embed src="button21.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="156" height="44" bgcolor="#FFCC00"></embed>
          </object>
          </noscript>
        </p>
      <p>
        <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','156','height','44','src','button22','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgcolor','#FFCC00','movie','button22' ); //end AC code
      </script>
        <noscript>
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="156" height="44">
            <param name="movie" value="button22.swf">
            <param name="quality" value="high">
            <param name="bgcolor" value="#FFCC00">
            <embed src="button22.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="156" height="44" bgcolor="#FFCC00"></embed>
          </object>
          </noscript>
      </p>
      <p>
          <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','156','height','44','src','button24','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgcolor','#FFCC00','movie','button24' ); //end AC code
      </script>
        <noscript>
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="156" height="44">
            <param name="movie" value="button24.swf">
            <param name="bgcolor" value="#FFCC00">
            <param name="QUALITY" value="high">
            <embed src="button24.swf" width="156" height="44" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#FFCC00"></embed>
          </object>
          </noscript>
        </p>
      <p>
          <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','156','height','44','src','button25','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgcolor','#FFCC00','movie','button25' ); //end AC code
      </script>
        <noscript>
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="156" height="44">
            <param name="movie" value="button25.swf">
            <param name="quality" value="high">
            <param name="bgcolor" value="#FFCC00">
            <embed src="button25.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="156" height="44" bgcolor="#FFCC00"></embed>
          </object>
          </noscript>
        </p>
      <p class="style8 Estilo1">&nbsp; </p>
      <p class="style8 Estilo1">&nbsp;</p>
      <p class="style8 Estilo1">&nbsp;</p>
      <p class="style8 Estilo1">&nbsp;</p>
      <p class="style8 Estilo1">&nbsp;</p>
      <p class="style8 Estilo1">&nbsp;</p>
      <p class="style8 Estilo1">&nbsp;</p>
      <p class="style8 Estilo1">&nbsp;</p>
      <p class="style8 Estilo1">&nbsp;</p>
      <p class="style8 Estilo1">&nbsp;</p>
      <p class="style8 Estilo1">&nbsp;</p>
      <p class="style8 Estilo1">&nbsp;</p>
      <p class="style8 Estilo1">
      <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','156','height','44','title','pagina principal','src','button11','quality','high','pluginspage','http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash','bgcolor','#FFCC66','movie','button11' ); //end AC code
      </script>
      <noscript>
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="156" height="44" title="pagina principal">
        <param name="movie" value="button11.swf">
        <param name="quality" value="high">
        <param name="bgcolor" value="#FFCC66">
        <embed src="button11.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="156" height="44" bgcolor="#FFCC66"></embed>
      </object>
      </noscript>
</p></td> 
    <td width="729" height="2"></td>
  </tr>
  <tr valign="top">
    <td height="939" valign="top"><form action="" method="post" name="form2" class="Estilo4">
      <div align="center">
        <p>Libreta ventas </p>
        <p>&nbsp;</p>
      </div>
    </form>
      <form name="form3" method="post" action="">
      <form action="<?php echo $editFormAction; ?>" method="post" name="form1" class="Estilo1">
        <table align="center" bgcolor="#FFCC00">
          <tr valign="baseline">
            <td nowrap align="right"><span class="Estilo1">ID_VENTAS:</span></td>
            <td><p>
              <input type="text" name="ID_VENTAS" value="" size="32">
            </p>
            <p>&nbsp; </p></td>
          </tr>
          <tr valign="baseline">
            <td nowrap align="right"><span class="Estilo1">FECHA:</span></td>
            <td><p>
              <input type="text" name="FECHA" value="" size="32">
            </p>
            <p>&nbsp; </p></td>
          </tr>
          <tr valign="baseline">
            <td nowrap align="right"><span class="Estilo1">MERCANCIA:</span></td>
            <td><p>
              <input type="text" name="MERCANCIA" value="" size="32">
            </p>
            <p>&nbsp; </p></td>
          </tr>
          <tr valign="baseline">
            <td nowrap align="right"><span class="Estilo1">ID_MERCANCIA:</span></td>
            <td><p>
              <input type="text" name="ID_MERCANCIA" value="" size="32">
            </p>
            <p>&nbsp; </p></td>
          </tr>
          <tr valign="baseline">
            <td nowrap align="right"><span class="Estilo1">ID_EMPLEADO:</span></td>
            <td><p>
              <input type="text" name="ID_EMPLEADO" value="" size="32">
            </p>
            <p>&nbsp; </p></td>
          </tr>
          <tr valign="baseline">
            <td nowrap align="right"><p class="Estilo1">&nbsp;</p>
            </td>
            <td><input type="submit" value="Registrar venta"></td>
          </tr>
        </table>
        <input type="hidden" name="MM_insert" value="form1">
      </form>
      <p class="Estilo1">&nbsp;</p>
      <div align="center" class="Estilo1"></div>
      </form></td>
  </tr>
  
  
  <tr>
    <td height="2" valign="top"></td>
    <td></td>
  </tr>
</table>
<table width="90%" border="0" cellspacing="0" cellpadding="4" align="center">
  <!--DWLayoutTable-->
  <tr align="center"> 
    <td height="1"></td>
  </tr>
</table>
<div id="apDiv2">
  <div align="right" class="Estilo1"><strong>&copy;2011 Valdez melo Jose Filiberto</strong></div>
</div>
</body>
</html>

