Como Sumo valores y los pongo en mySQL lo estoy haciendo desde Dreamweaver
asi es que aqui te va el codigo:
<?php require_once('../Connections/connRecaudacion.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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 ventas (fecha_venta, cajera_venta, turno_venta, r_pan, r_molde, r_frio, r_envasado, r_fiambreria, r_pasteles, r_empanadas, r_bresler, r_fono, r_integral, r_helados, r_panpascua, valor_guias, boletas_nulas, gastos, anticipos) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['fecha'], "text"),
GetSQLValueString($_POST['cajera'], "text"),
GetSQLValueString($_POST['turno'], "text"),
GetSQLValueString($_POST['pan'], "double"),
GetSQLValueString($_POST['molde'], "double"),
GetSQLValueString($_POST['frio'], "double"),
GetSQLValueString($_POST['envasado'], "double"),
GetSQLValueString($_POST['fiambreria'], "double"),
GetSQLValueString($_POST['pasteles'], "double"),
GetSQLValueString($_POST['empanadas'], "double"),
GetSQLValueString($_POST['bresler'], "double"),
GetSQLValueString($_POST['fono'], "double"),
GetSQLValueString($_POST['integral'], "double"),
GetSQLValueString($_POST['helados'], "double"),
GetSQLValueString($_POST['panpascua'], "double"),
GetSQLValueString($_POST['valorguias'], "double"),
GetSQLValueString($_POST['boletanula'], "double"),
GetSQLValueString($_POST['gastos'], "double"),
GetSQLValueString($_POST['anticipos'], "double"));
mysql_select_db($database_connRecaudacion, $connRecaudacion);
$Result1 = mysql_query($insertSQL, $connRecaudacion) or die(mysql_error());
$insertGoTo = "mrecauda.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
<html>
<head>
<title>Ingresando datos</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#ffffff">
<form name="form1" method="POST" action="<?php echo $editFormAction; ?>">
<table width="474" border="1" align="center" cellspacing="0">
<tr>
<td colspan="2" rowspan="3"> </td>
<td width="36"><div align="right">Fecha </div></td>
<td width="150"><div align="left">
<input name="fecha" type="text" id="fecha" value="2003/mm/dd" size="13">
</div></td>
</tr>
<tr>
<td><div align="right">Cajera</div></td>
<td><div align="left">
<input name="cajera" type="text" id="cajera" size="25">
</div></td>
</tr>
<tr>
<td><div align="right">Turno</div></td>
<td><div align="left">
<input name="turno" type="text" id="turno" size="15">
</div></td>
</tr>
<tr>
<td colspan="4" bgcolor="#FFCC00"><div align="center"><strong>Ingresos</strong></div></td>
</tr>
<tr>
<td width="153">Pan<br>
<input name="pan" type="text" id="pan" size="13"></td>
<td width="117">Mode<br>
<input name="molde" type="text" id="molde" size="13"></td>
<td colspan="2">Frio<br>
<input name="frio" type="text" id="frio" size="13"></td>
</tr>
<tr>
<td>Envasado<br>
<input name="envasado" type="text" id="envasado" size="13"></td>
<td>Fiambrería<br>
<input name="fiambreria" type="text" id="fiambreria" size="13"></td>
<td colspan="2">Pasteles<br>
<input name="pasteles" type="text" id="pasteles" size="13"></td>
</tr>
<tr>
<td>Empanadas<br>
<input name="empanadas" type="text" id="empanadas" size="13"></td>
<td>Bresler<br>
<input name="bresler" type="text" id="bresler" size="13"></td>
<td colspan="2">Fono<br>
<input name="fono" type="text" id="fono" size="13"></td>
</tr>
<tr>
<td>Integral<br>
<input name="integral" type="text" id="integral" size="13"></td>
<td>Helados<br>
<input name="helados" type="text" id="helados" size="13"></td>
<td colspan="2">Pan Pascua<br>
<input name="panpascua" type="text" id="panpascua" size="13"></td>
</tr>
<tr>
<td colspan="2" rowspan="3"> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2">Total Registrado </td>
</tr>
<tr>
<td colspan="2">Valores x Guias
<input name="valorguias" type="text" id="valorguias" size="13"></td>
</tr>
<tr>
<td colspan="4" bgcolor="#FFCC00"><p align="center"><strong>Gastos Generales</strong></p> </td>
</tr>
<tr>
<td>Boletas Nulas<br>
<input name="boletanula" type="text" id="boletanula" size="13"></td>
<td colspan="3" rowspan="3"> </td>
</tr>
<tr>
<td>Gastos<br>
<input name="gastos" type="text" id="gastos" size="13"></td>
</tr>
<tr>
<td>Anticipos<br>
<input name="anticipos" type="text" id="anticipos" size="13"></td>
</tr>
<tr>
<td colspan="2" rowspan="3"> </td>
<td colspan="2">Total Descuentos </td>
</tr>
<tr>
<td colspan="2">Total Deposito </td>
</tr>
<tr>
<td colspan="2">Diferencia Caja </td>
</tr>
</table>
<br>
<input type="submit" name="Submit" value="Guardar">
<input type="reset" name="Submit2" value="Limpiar">
<input type="hidden" name="MM_insert" value="form1">
</form>
</div></td>
</tr>
</table>
<p> </p></td>
<td rowspan="2" valign="top"><img name="panaderos" src="../img/panaderos.jpg" width="218" height="160" border="0" alt=""></td>
<td height="166"><img src="../img/png/spacer.gif" width="1" height="166" border="0" alt=""></td>
<td></td>
</tr>
<tr>
<td rowspan="2"><img src="../img/png/spacer.gif" width="1" height="160" border="0" alt=""></td>
<td height="22"></td>
</tr>
<tr>
</div></td>
<td></td>
</tr>
</table>
</body>
</html> |