<?
$host = "localhost";
$usuario1 = "root";
$db = "gromero";
$conexion=mysql_connect($host, $usuario1) or die("Error: " . mysql_error());
mysql_select_db($db,$conexion);
$qry =mysql_query("SELECT MAX(folio) AS folio FROM folio");
if ($row = mysql_fetch_row($qry)) {
$id = trim($row[0]);
}
$id2=$id+1;
$folio = 'A'.str_pad($id2,4,'0',STR_PAD_LEFT);
echo $id;
echo 'dato' + $qry;
?>
<!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" />
<title>Enviar Pedido...</title>
<style type="text/css">
<!--
html { background-image: url(images/glowcolor.png); }
#Layer3 {
background-image: url(images/ddc.jpg);
background-position: center;
width:800px;
}
.Estilo16 {font-family: Arial, Helvetica, sans-serif}
-->
</style>
<script type="text/javascript">
function alerta(){
alert('desea imprimir')
print();
window.close();
}
</script>
<script>
var INPUT_NAME_PREFIX = 'inputName'; // this is being set via script
var RADIO_NAME = 'totallyrad'; // this is being set via script
var TABLE_NAME = 'tbl'; // this should be named in the HTML
var ROW_BASE = 1; // first number (for display)
var hasLoaded = false;
window.onload=fillInRows;
function fillInRows()
{
hasLoaded = true;
addRowToTable();
addRowToTable();
}
function sumar() {
var n1 = document.tbl.cantidad["value"];
var n2 = document.tbl.precio["value"];
document.tbl.total["value"]=parseFloat(n1)*parseFloat(n2)
document.write("Longitud del array: " + miArray.length)
for (i=0;i<miArray.length;i++){
document.write(miArray[i])
}
}
function addRowToTable(num)
{
if (hasLoaded) {
var tbl = document.getElementById(TABLE_NAME);
var nextRow = tbl.tBodies[0].rows.length;
var iteration = nextRow + ROW_BASE;
if (num == null) {
num = nextRow;
} else {
num + ROW_BASE;
}
var row = tbl.tBodies[0].insertRow(num);
row.className = 'classy' + (iteration % 2);
var cell1 = row.insertCell(0);
var txtInp = document.createElement('input');
txtInp.setAttribute('type', 'text');
txtInp.setAttribute('name', "articulo[]");
txtInp.setAttribute('size', '43');
cell1.appendChild(txtInp);
var cell2 = row.insertCell(1);
var txtInp = document.createElement('input');
txtInp.setAttribute('type', 'text');
txtInp.setAttribute('name', "cantidad[]");
txtInp.setAttribute('size', '6');
cell2.appendChild(txtInp);
var cell3 = row.insertCell(2);
var txtInp = document.createElement('input');
txtInp.type = 'text'; // 6
txtInp.name = 'precio[]'; // 6
txtInp.size = 7;
txtInp.onkeyup = function(){addHiddenNeto(this.value)}
txtInp.onfocus = function(){setHiddenNeto(this.value)}
cell3.appendChild(txtInp);
var cell4 = row.insertCell(3);
var txtInp = document.createElement('input');
txtInp.setAttribute('type', 'text');
txtInp.setAttribute('name', "total[]");
txtInp.setAttribute('size', '5');
txtInp.setAttribute("onFocus", 'sumar ()');
cell4.appendChild(txtInp);
var cell5 = row.insertCell(4);
var btnEl = document.createElement('input');
btnEl.setAttribute('type', 'image');
btnEl.setAttribute('src', 'images/borra.jpg');
btnEl.onclick = function () {deleteCurrentRow(this)};
cell5.appendChild(btnEl);
var cell6 = row.insertCell(5);
var btnadd = document.createElement('input');
btnadd.setAttribute('type', 'button');
btnadd.setAttribute('value', 'AGREGA');
btnadd.setAttribute('onClick', 'addRowToTable ()');
cell6.appendChild(btnadd);
row.myRow = new myRowObject(txtInp);
}
}
function deleteCurrentRow(obj)
{
if (hasLoaded) {
var delRow = obj.parentNode.parentNode;
var tbl = delRow.parentNode.parentNode;
var rIndex = delRow.sectionRowIndex;
var rowArray = new Array(delRow);
deleteRows(rowArray);
reorderRows(tbl, rIndex);
}
}
function deleteRows(rowObjArray)
{
if (hasLoaded) {
for (var i=0; i<rowObjArray.length; i++) {
var rIndex = rowObjArray[i].sectionRowIndex;
rowObjArray[i].parentNode.deleteRow(rIndex);
}
}
}
</script>
<style type="text/css">
<!--
#tbl td, th { padding: 0.5em; }
.classy0 { background-color: #234567; color: #89abcd; }
.classy1 { background-color: #89abcd; color: #234567; }
-->
</style>
<script type="text/javascript">
function MostrarFecha()
{
var nombres_dias = new Array("Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado")
var nombres_meses = new Array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre")
var fecha_actual = new Date()
dia_mes = fecha_actual.getDate()
dia_semana = fecha_actual.getDay()
mes = fecha_actual.getMonth() + 1
anio = fecha_actual.getFullYear()
document.write( dia_mes + " de " + nombres_meses[mes - 1] + " de " + anio)
}
</script>
</head>
<body>
<center>
<div id="Layer3">
<fieldset>
<table style=' color:white ' align="center">
<td align="right"><a href="cerrarsesion.php"><font face="calibri" color="#FFFFFF">CERRAR SESION</font></a></td>
<tr>
<td><table>
<tr>
<td><div align="center">
<table style=' color:white ' width="40%" border="0" align="right">
<tr>
<!-- Para que muestre la fecha -->
<font color="white"> <p align="right"> <strong> FECHA: </strong>
<script language="JavaScript" type="text/javascript">
MostrarFecha();
</script><p align="left" <td width="14%"> <strong> ADMIN: </strong></td></p>
</p> </font>
</tr>
</table>
</div></td>
</tr>
<tr>
<td><form name="tbl" action="incompra.php" method="post">
<strong><p align="center"><font color="white">DATOS DE COMPRA </font></p> </strong>
<table style=' color:white ' id="tbl" align="center">
<tr>
<td colspan="4"><p align="right">FOLIO:</p> </td>
<td colspan="4"><label>
<input name="folio" type="text" id="folio" value="<?php echo $folio; ?>" readonly="readonly"/>
</label></td>
</tr>
<tr>
<td colspan="4"><p align="right">No. FACTURA:</p> </td>
<td colspan="4"><label>
<input name="factura" type="text" onKeyUp="this.value = this.value.toUpperCase();"/>
</label></td>
</tr>
<tr>
<td>
<p align="center">
<label>
<?php
$sql = "Select nombre from proveedor ";
$result = mysql_query( $sql);
?>
<font face="calibri" color="#FFFFFF"> PROVEEDOR </font> <select name="nombre" tabindex="marca" style="width:290px">
<option>-----------SELECCIONE PROVEEDOR-----------</option>
<?php while ( $row = mysql_fetch_array($result) ) {?>
<option style='text-transform: uppercase'> <?php echo $row[0];?> </option>
<?php } ?>
</select>
</label>
</p>
</td>
</tr>
<tr>
<th>ARTICULO</th><th>CANTIDAD</th><th>PRECIO</th><th>TOTAL</th><th>BORRAR</th><th>AGREGAR</th>
</tr>
</table>
<br/>
<center>
<input type="image" src="images/continuar_id.gif" type="submit" value="imprimir Factura" />
</center>
</form></td>
</tr>
</table></td>
</tr>
</table>
</fieldset>
</div></center>
<br/>
</body>
</html>