192 lines
6.4 KiB
PHP
Executable File
192 lines
6.4 KiB
PHP
Executable File
<?php
|
|
include_once ("../core/config.php");
|
|
include_once ("funzioni.php");
|
|
$UTENTE = login();
|
|
$DIRITTI = diritti('Admin');
|
|
view_top();
|
|
|
|
if (isset($_POST['id'])) {
|
|
$post = addslashes_array ($_POST);
|
|
extract($post);
|
|
|
|
if ($categoria == 'Nuovo') {
|
|
$categoria = $ncat;
|
|
$query = "INSERT INTO wf_cat_materiale SET nome = '$categoria', attivo = 1";
|
|
$res = mysql_query( $query, $DB_ID );
|
|
}
|
|
|
|
if ($produttore == 'Nuovo') {
|
|
$produttore = $nprod;
|
|
$query = "INSERT INTO wf_prod_materiale SET nome = '$produttore', attivo = 1";
|
|
$res = mysql_query( $query, $DB_ID );
|
|
}
|
|
|
|
$vendita +=0;
|
|
|
|
if ($id) {
|
|
$query = " UPDATE
|
|
wf_materiale
|
|
SET
|
|
nome = '$nome',
|
|
categoria = '$categoria',
|
|
produttore = '$produttore',
|
|
nota = '$nota',
|
|
taglie = UPPER('$taglie'),
|
|
vendita = $vendita
|
|
WHERE
|
|
id = $id
|
|
";
|
|
} else {
|
|
$query = " INSERT INTO
|
|
wf_materiale
|
|
SET
|
|
attivo = 1,
|
|
nome = '$nome',
|
|
categoria = '$categoria',
|
|
produttore = '$produttore',
|
|
nota = '$nota',
|
|
taglie = UPPER('$taglie'),
|
|
vendita = $vendita
|
|
";
|
|
}
|
|
|
|
$res = mysql_query( $query, $DB_ID );
|
|
if ($id == "") {
|
|
$id = mysql_insert_id();
|
|
}
|
|
?>
|
|
<script type="text/javascript">
|
|
document.location.href='materiale_lista.php?id=<?php print $id ?>'
|
|
</script>
|
|
<?php
|
|
exit;
|
|
|
|
|
|
} elseif (isset($_GET['id'])) {
|
|
$id = $_GET['id'];
|
|
}
|
|
?>
|
|
|
|
<form name="" method="post">
|
|
<input type="hidden" name="id" value="<?php print $id ?>">
|
|
<?php
|
|
|
|
$query = " SELECT
|
|
id,
|
|
attivo,
|
|
nome,
|
|
categoria,
|
|
produttore,
|
|
nota,
|
|
taglie,
|
|
vendita
|
|
FROM
|
|
wf_materiale
|
|
WHERE
|
|
id = $id
|
|
";
|
|
|
|
$res = mysql_query( $query, $DB_ID );
|
|
$dato = mysql_fetch_array ( $res );
|
|
|
|
$query = " SELECT
|
|
id,
|
|
nome
|
|
FROM
|
|
wf_cat_materiale
|
|
ORDER BY
|
|
nome
|
|
";
|
|
|
|
$res_cat_materiale = mysql_query( $query, $DB_ID );
|
|
|
|
$query = " SELECT
|
|
id,
|
|
nome
|
|
FROM
|
|
wf_prod_materiale
|
|
ORDER BY
|
|
nome
|
|
";
|
|
|
|
$res_prod_materiale = mysql_query( $query, $DB_ID );
|
|
|
|
$tabella = new html (0,"90%",array(2,15,2,20,2,15,2,15,2,15,2,10,0));
|
|
$tabella->intestazione (array("", "Articolo", "", "Categoria", "", "Produttore", "", "Taglia", "", "Note", "", "Vendita €", ""));
|
|
?>
|
|
<tr>
|
|
<?php
|
|
if ($dato['attivo']) {
|
|
?>
|
|
<td rowspan=2 class="spazioh"><a href="wf_gest.php?azione=wf_mat_off&id=<?php print $dato['id']?>"><img src="<?php print $CONF['base_url'] ?>/img/attivo.gif" ALT="Articolo Attivo" TITLE="Articolo Attivo"></a></td>
|
|
<?php } else { ?>
|
|
<td rowspan=2 class="spazioh"><a href="wf_gest.php?azione=wf_mat_on&id=<?php print $dato['id']?>"><img src="<?php print $CONF['base_url'] ?>/img/non_attivo.gif" ALT="Articolo non Attivo" TITLE="Articolo non Attivo"></a></td>
|
|
<?php } ?>
|
|
<td rowspan=2 class="colip"><input type="text" name=nome value="<?php print $dato['nome'] ?>"></td>
|
|
<td rowspan=2 class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
|
<td class="colip">
|
|
<select name=categoria>
|
|
<option value="">Seleziona</option>
|
|
<?php while ($dato_cat_materiale = mysql_fetch_array ( $res_cat_materiale )) { ?>
|
|
<option value="<?php print $dato_cat_materiale['nome']?>" <?php if ($dato['categoria'] == $dato_cat_materiale['nome']) { print "selected=\"selected\"";}?>><?php print $dato_cat_materiale['nome']?></option>
|
|
<?php } ?>
|
|
<option value="Nuovo">Nuovo</option>
|
|
</select>
|
|
</td>
|
|
<td rowspan=2 class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
|
<td class="colip">
|
|
<select name=produttore>
|
|
<option value="">Seleziona</option>
|
|
<?php while ($dato_prod_materiale = mysql_fetch_array ( $res_prod_materiale )) { ?>
|
|
<option value="<?php print $dato_prod_materiale['nome']?>" <?php if ($dato['produttore'] == $dato_prod_materiale['nome']) { print "selected=\"selected\"";}?>><?php print $dato_prod_materiale['nome']?></option>
|
|
<?php } ?>
|
|
<option value="Nuovo">Nuovo</option>
|
|
</select>
|
|
</td>
|
|
<td rowspan=2 class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
|
<td rowspan=2 class="colip"><input type="text" name=taglie value="<?php print $dato['taglie'] ?>"></td>
|
|
<td rowspan=2 class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
|
<td rowspan=2 class="colip"><input type="text" name=nota value="<?php print $dato['nota'] ?>"></td>
|
|
<td rowspan=2 class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
|
<td rowspan=2 class="colip"><input type="text" name=vendita value="<?php print $dato['vendita'] ?>"></td>
|
|
<td rowspan=2 class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="colip"><input type="text" name=ncat value=""></td>
|
|
<td class="colip"><input type="text" name=nprod value=""></td>
|
|
</tr>
|
|
<?php $tabella->riga(5); ?>
|
|
<tr>
|
|
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
|
<td valign="top" class="descrizione">Inserire il nome del nuovo articolo</td>
|
|
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
|
<td valign="top" class="descrizione">Selezionare la categoria o selezionando "Nuovo" inserire nel campo sottostante la nuova categoria</td>
|
|
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
|
<td valign="top" class="descrizione">Selezionare il produttore o selezionando "Nuovo" inserire nel campo sottostante il nuovo produttore</td>
|
|
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
|
<td valign="top" class="descrizione">Inserire tutte le taglie separate da uno spazio (es. XS S M L XL). Lasciare il campo vuoto se non utile.</td>
|
|
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
|
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
|
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
|
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
|
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
|
</tr>
|
|
|
|
|
|
<?php
|
|
$tabella->riga(5);
|
|
$tabella->close();
|
|
|
|
$tabella = new html (0,"90%",array(5,20,0));
|
|
$tabella->riga(); ?>
|
|
<tr>
|
|
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
|
<td class="spaziov" colspan=10><input type="submit" value="Conferma"></td>
|
|
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
|
</tr>
|
|
|
|
|
|
<?php $tabella->close(); ?>
|
|
</form>
|
|
<?php view_footer(); ?>
|