Initial release. Usable. default tip
authorviric@vicerveza
Thu, 18 May 2006 23:47:03 +0200
changeset 0 c270c8b5ddea
Initial release. Usable.
.hgignore
classes.inc
db-config.inc
db.sql
getdb.inc
index.php
llista-butxaques.php
llista-ingressos.php
llista-moviments.php
llistes.inc
locale/Makefile
locale/butxaques.po
locale/ca/LC_MESSAGES/butxaques.po
locale/eo/LC_MESSAGES/butxaques.po
readme.txt
status-butxaques.php
strings.inc
update-butxaca.php
update-ingres.php
update-moviment.php
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Thu May 18 23:47:03 2006 +0200
@@ -0,0 +1,1 @@
+\.mo$
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/classes.inc	Thu May 18 23:47:03 2006 +0200
@@ -0,0 +1,292 @@
+<?php
+
+include("strings.inc");
+
+class ingres
+{
+var $dia;
+var $mes;
+var $any;
+var $hora;
+var $minut;
+var $modificat; // Timestamp
+var $rao;
+var $butxaca;
+var $tipus;
+var $diners;
+var $comentari;
+
+function data()
+{
+	return mktime($this->hora, $this->minut, 0, $this->mes, $this->dia,
+		$this->any);
+}
+
+function setData($data)
+{
+	$this->dia = date('d',$data);
+	$this->mes = date('m',$data);
+	$this->any = date('Y',$data);
+	$this->hora = date('H',$data);
+	$this->minut = date('i',$data);
+}
+
+function DBAfegir($connexio)
+{
+	$query = "INSERT INTO ingressos
+	(data,data_modif,rao,quantitat,
+		butxaca,comentari) 
+		VALUES(";
+	$query .= "FROM_UNIXTIME(" . mktime($this->hora,
+			$this->minut,
+			0,
+			$this->mes,
+			$this->dia,
+			$this->any) . "), ";
+	$query .= "FROM_UNIXTIME(". time() . "), ";
+	$query .= "'" . strtosql( $this->rao) . "', ";
+	if($this->tipus == "ingres")
+		$query .= $this->diners . ", ";
+	else
+		$query .= "-". $this->diners . ", ";
+	$query .= $this->butxaca . ", ";
+	$query .= "'" . strtosql( $this->comentari) . "'); ";
+
+
+	$resultat = mysql_query($query, $connexio);
+
+	if (!$resultat)
+	{
+		echo mysql_errno().": ".mysql_error()."<BR>";
+		return 1;
+	}
+
+	return 0;
+}
+
+function DBModificar($connexio, $data_vella)
+{
+	$query = "UPDATE ingressos SET ";
+	$query .= "data=FROM_UNIXTIME(" . $this->data() . "), ";
+	$query .= "data_modif=FROM_UNIXTIME(". time() . "), ";
+	$query .= "rao='" . strtosql( $this->rao) . "', ";
+	$query .= "quantitat=";
+	if($this->tipus == "ingres")
+		$query .= $this->diners . ", ";
+	else
+		$query .= "-". $this->diners . ", ";
+	$query .= "butxaca=" . $this->butxaca . ", ";
+	$query .= "comentari='" . strtosql( $this->comentari) . "' ";
+	$query .= "WHERE data=FROM_UNIXTIME(" . $data_vella . ");";
+
+
+	$resultat = mysql_query($query, $connexio);
+
+	if (!$resultat)
+	{
+		echo mysql_errno().": ".mysql_error()."<BR>";
+		return 1;
+	}
+
+	return 0;
+}
+
+function DBBorrar($connexio)
+{
+	$query = "DELETE FROM ingressos WHERE UNIX_TIMESTAMP(data) = ";
+	$query .= $this->data() . ";";
+
+	$resultat = mysql_query($query,$connexio);
+	if (!$resultat)
+	{
+		echo mysql_errno().": ".mysql_error()."<BR>";
+		return 1;
+	}
+	return 0;
+	
+}
+
+function ingres($connexio=-1, $data=0)
+{
+	// De nul
+	if ($connexio==-1)
+	{
+		$this->dia = date('d');
+		$this->mes = date('m');
+		$this->any = date('Y');
+		$this->hora = date('H');
+		$this->minut = date('i');
+		$this->rao = "";
+		$this->butxaca = -1;
+		$this->tipus = "despesa";
+		$this->diners = 0;
+		$this->comentari = "";
+	}
+	else
+	{
+		$query = "SELECT UNIX_TIMESTAMP(data),
+		UNIX_TIMESTAMP(data_modif), rao, butxaca, quantitat,
+		comentari FROM ingressos WHERE UNIX_TIMESTAMP(data) = ";
+		$query .= $data . ";";
+
+		$resultat = mysql_query($query,$connexio);
+		if (!$resultat)
+		{
+			echo mysql_errno().": ".mysql_error()."<BR>";
+			return 1; // Què passa amb un return aquí?
+		}
+		
+		// Només hi haurà un resultat
+		$fila = mysql_fetch_row($resultat);
+		
+		settype($fila[4], float);
+
+		$this->dia = date('d',$fila[0]);
+		$this->mes = date('m',$fila[0]);
+		$this->any = date('Y',$fila[0]);
+		$this->hora = date('H',$fila[0]);
+		$this->minut = date('i',$fila[0]);
+		$this->modificat = $fila[1];
+		$this->rao = $fila[2];
+		$this->butxaca = $fila[3];
+		if ($fila[4] > 0)
+			$this->tipus = "ingres";
+		else
+			$this->tipus = "despesa";
+		$this->diners = abs($fila[4]);
+		$this->comentari = $fila[5];
+
+	}
+}
+
+}
+
+class moviment
+{
+var $dia;
+var $mes;
+var $any;
+var $hora;
+var $minut;
+var $modificat; // Timestamp
+var $rao;
+var $butxaca_origen;
+var $butxaca_desti;
+var $diners;
+var $comentari;
+
+
+function data()
+{
+	return mktime($this->hora, $this->minut, 0, $this->mes, $this->dia,
+		$this->any);
+}
+function setData($data)
+{
+	$this->dia = date('d',$data);
+	$this->mes = date('m',$data);
+	$this->any = date('Y',$data);
+	$this->hora = date('H',$data);
+	$this->minut = date('i',$data);
+}
+
+function DBAfegir($connexio)
+{
+	$query = "INSERT INTO moviments
+	(data,data_modif,rao,quantitat,
+		butxaca_origen,butxaca_desti,comentari) 
+		VALUES(";
+	$query .= "FROM_UNIXTIME(" . $this->data() . "), ";
+	$query .= "FROM_UNIXTIME(". time() . "), ";
+	$query .= "'" . strtosql( $this->rao) . "', ";
+	$query .= $this->diners . ", ";
+	$query .= $this->butxaca_origen . ", ";
+	$query .= $this->butxaca_desti . ", ";
+	$query .= "'" . strtosql( $this->comentari) . "'); ";
+
+
+	$resultat = mysql_query($query, $connexio);
+
+	if (!$resultat)
+	{
+		echo mysql_errno().": ".mysql_error()."<BR>";
+		return 1;
+	}
+
+	return 0;
+}
+
+function DBBorrar($connexio)
+{
+	$query = "DELETE FROM moviments WHERE UNIX_TIMESTAMP(data) = ";
+	$query .= mktime($this->hora,
+			$this->minut,
+			0,
+			$this->mes,
+			$this->dia,
+			$this->any) . ";";
+
+	$resultat = mysql_query($query,$connexio);
+	if (!$resultat)
+	{
+		echo mysql_errno().": ".mysql_error()."<BR>";
+		return 1;
+	}
+	return 0;
+	
+}
+
+function moviment($connexio=-1, $data=0)
+{
+	// De nul
+	if ($connexio==-1)
+	{
+		$this->dia = date('d');
+		$this->mes = date('m');
+		$this->any = date('Y');
+		$this->hora = date('H');
+		$this->minut = date('i');
+		$this->rao = "";
+		$this->butxaca_origen = -1;
+		$this->butxaca_desti = -1;
+		$this->diners = 0;
+		$this->comentari = "";
+	}
+	else
+	{
+		$query = "SELECT UNIX_TIMESTAMP(data),
+		UNIX_TIMESTAMP(data_modif), rao, butxaca_origen, butxaca_desti,
+		quantitat,
+		comentari FROM moviments WHERE UNIX_TIMESTAMP(data) = ";
+		$query .= $data . ";";
+
+		$resultat = mysql_query($query,$connexio);
+		if (!$resultat)
+		{
+			echo mysql_errno().": ".mysql_error()."<BR>";
+			return 1; // Què passa amb un return aquí?
+		}
+		
+		// Només hi haurà un resultat
+		$fila = mysql_fetch_row($resultat);
+		
+		settype($fila[4], float);
+
+		$this->dia = date('d',$fila[0]);
+		$this->mes = date('m',$fila[0]);
+		$this->any = date('Y',$fila[0]);
+		$this->hora = date('H',$fila[0]);
+		$this->minut = date('i',$fila[0]);
+		$this->modificat = $fila[1];
+		$this->rao = $fila[2];
+		$this->butxaca_origen = $fila[3];
+		$this->butxaca_desti = $fila[4];
+		$this->diners = abs($fila[5]);
+		$this->comentari = $fila[6];
+
+	}
+}
+
+}
+
+?>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/db-config.inc	Thu May 18 23:47:03 2006 +0200
@@ -0,0 +1,6 @@
+<?php
+$mysql_server = "localhost";
+$mysql_user = "userblabla";
+$mysql_password = "passblabla";
+$mysql_db = "dbblabla";
+?>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/db.sql	Thu May 18 23:47:03 2006 +0200
@@ -0,0 +1,44 @@
+-- use prova_pis;
+drop table if exists moviments ;
+drop table if exists ingressos ;
+drop table if exists butxaques ;
+
+CREATE TABLE butxaques (
+	id	MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
+	nom	VARCHAR(50) NOT NULL,
+	principal	BOOL,
+
+	PRIMARY KEY (id)
+	) TYPE = InnoDB;
+
+-- ingressos i despeses
+CREATE TABLE ingressos (
+	data	TIMESTAMP NOT NULL,
+	data_modif	TIMESTAMP NOT NULL,
+	rao	TINYTEXT NULL,
+	quantitat	DECIMAL(18,10) SIGNED NOT NULL,
+	butxaca		MEDIUMINT UNSIGNED NOT NULL,
+	comentari	TEXT,
+
+	PRIMARY KEY (data),
+	INDEX (butxaca),
+	FOREIGN KEY (butxaca) REFERENCES butxaques (id)
+	) TYPE = InnoDB;
+
+-- moviments de diners entre butxaques
+CREATE TABLE moviments (
+	data	TIMESTAMP NOT NULL,
+	data_modif	TIMESTAMP NOT NULL,
+	rao	TINYTEXT NOT NULL,
+	quantitat	DECIMAL(18,10) SIGNED NOT NULL,
+	comentari	TEXT,
+	butxaca_origen		MEDIUMINT UNSIGNED NOT NULL,
+	butxaca_desti		MEDIUMINT UNSIGNED NOT NULL,
+
+	PRIMARY KEY (data),
+	INDEX (butxaca_origen),
+	INDEX (butxaca_desti),
+	FOREIGN KEY (butxaca_origen) REFERENCES butxaques (id),
+	FOREIGN KEY (butxaca_desti) REFERENCES butxaques (id)
+	) TYPE = InnoDB;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/getdb.inc	Thu May 18 23:47:03 2006 +0200
@@ -0,0 +1,55 @@
+<?php
+	include("db-config.inc");
+
+	function obtenir_butxaques($connection)
+	{
+		$resultat = mysql_query("SELECT id,nom FROM butxaques ORDER BY nom ASC", $connection);
+
+		if (!$resultat)
+		{
+?>
+			<p> <STRONG>ERROR:</STRONG> Error al obtenir
+				<STRONG>gent</STRONG>! </p>
+<?php
+			echo "Error MYSQL:" . mysql_errno().": ".mysql_error()."<BR>";
+		}
+
+		while ($fila = mysql_fetch_row($resultat))
+			$butxaques[$fila[0]] = $fila[1];
+		return $butxaques;
+	}
+
+	// FUNCIONS PER GENERAR CODI HTML
+
+	function select_butxaques($variable, $default=-1)
+	{
+		global $butxaques;
+
+		echo "<SELECT name=\"$variable\">\n";
+
+		foreach(array_keys($butxaques) as $i)
+		{
+			echo "<OPTION value=\"" .$i . "\"";
+			if ($default == $i)
+				echo " selected";
+			echo ">" . strtohtml($butxaques[$i]) . "\n";
+		}
+
+		echo "</SELECT>";
+	}
+
+	function strforquotes($cadena)
+	{
+		$new= ereg_replace("\"", "&quotes;", $cadena);
+
+		return $new;
+	}
+
+	function strfromquotes($cadena)
+	{
+		$new= ereg_replace("&quotes;", "\"", $cadena);
+
+		return $new;
+	}
+
+?>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/index.php	Thu May 18 23:47:03 2006 +0200
@@ -0,0 +1,49 @@
+<?php
+/***** Informació de LOCALE *****/
+echo setlocale(LC_ALL, 'ca_XX');
+$textdomain = "butxaques";
+bindtextdomain($textdomain, "./locale");
+textdomain($textdomain);
+bind_textdomain_codeset($textdomain, "utf-8");
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<html>
+<head>
+<title><?php echo _("Control de butxaques") . " - " . _("Nou ingrés/despesa");?></title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+</head>
+
+<body>
+<?php
+echo "<h1 align=center>" . _("Control de butxaques") . "</h1>\n";
+echo "<h2" . _("Nou ingrés/despesa") . "</h1>\n";
+?>
+<center>
+<table border=1>
+<tr>
+	<th><?php echo _("Ingressos/Despeses") ?>
+	<th><?php echo _("Moviments entre butxaques") ?>
+	<th><?php echo _("Butxaques") ?>
+<tr>
+	<td align=center><a href="update-ingres"><?php
+		echo _("Nou Ingrés/Despesa") ?></a>
+	<td align=center><a href="update-moviment"><?php
+		echo _("Nou Moviment") ?></a>
+	<td align=center><a href="update-butxaca"><?php
+		echo _("Nova Butxaca") ?></a>
+<tr>
+	<td align=center><a href="llista-ingressos"><?php
+		echo _("Llista d'Ingressos/Despeses") ?></a>
+	<td align=center><a href="llista-moviments"><?php
+		echo _("Llista de Moviments") ?></a>
+	<td align=center><a href="llista-butxaques"><?php
+		echo _("Llista de Butxaques") ?></a>
+<tr>
+	<td align=center COLSPAN=3><a href="status-butxaques"><?php
+		echo _("Estat de les butxaques") ?></a>
+</table>
+</center>
+
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/llista-butxaques.php	Thu May 18 23:47:03 2006 +0200
@@ -0,0 +1,39 @@
+<?php
+/***** Informació de LOCALE *****/
+echo setlocale(LC_ALL, 'ca_XX');
+$textdomain = "butxaques";
+bindtextdomain($textdomain, "./locale");
+textdomain($textdomain);
+bind_textdomain_codeset($textdomain, "utf-8");
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<html>
+<head>
+<title><?php echo _("Control de butxaques")." - ".
+	_("Llista de butxaques");?></title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
+</head>
+
+<body>
+<?php
+echo "<h1 align=center>" . _("Control de butxaques") . "</h1>\n";
+echo "<h2>" . _("Llista de butxaques") . "</h2>\n";
+
+	include("getdb.inc");
+	include("llistes.inc");
+
+	// Fem la connexió
+	$connexio = mysql_connect($mysql_server, $mysql_user,
+	$mysql_password);
+	mysql_select_db($mysql_db, $connexio);
+
+	llistes::LlistaButxaques($connexio);
+
+?>
+
+
+<p><A HREF="index"><?php echo _("Tornar al menú principal");?></A></p>
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/llista-ingressos.php	Thu May 18 23:47:03 2006 +0200
@@ -0,0 +1,42 @@
+<?php
+/***** Informació de LOCALE *****/
+echo setlocale(LC_ALL, 'ca_XX');
+$textdomain = "butxaques";
+bindtextdomain($textdomain, "./locale");
+textdomain($textdomain);
+bind_textdomain_codeset($textdomain, "utf-8");
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<html>
+<head>
+<title><?php echo _("Control de butxaques")." - ".
+	_("Llista d'ingressos/despeses");?></title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
+</head>
+
+<body>
+<?php
+echo "<h1 align=center>" . _("Control de butxaques") . "</h1>\n";
+echo "<h2>" . _("Llista d'ingressos/despeses") . "</h2>\n";
+
+	include("getdb.inc");
+	include("llistes.inc");
+
+	// Fem la connexió
+	$connexio = mysql_connect($mysql_server, $mysql_user,
+	$mysql_password);
+	mysql_select_db($mysql_db, $connexio);
+
+	if (isset($_GET["ordre"]))
+		llistes::LlistaIngressos($connexio, $_GET["ordre"]);
+	else
+		llistes::LlistaIngressos($connexio);
+
+?>
+
+
+<p><A HREF="index"><?php echo _("Tornar al menú principal");?></A></p>
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/llista-moviments.php	Thu May 18 23:47:03 2006 +0200
@@ -0,0 +1,42 @@
+<?php
+/***** Informació de LOCALE *****/
+echo setlocale(LC_ALL, 'ca_XX');
+$textdomain = "butxaques";
+bindtextdomain($textdomain, "./locale");
+textdomain($textdomain);
+bind_textdomain_codeset($textdomain, "utf-8");
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<html>
+<head>
+<title><?php echo _("Control de butxaques")." - ".
+	_("Llista de moviments");?></title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
+</head>
+
+<body>
+<?php
+echo "<h1 align=center>" . _("Control de butxaques") . "</h1>\n";
+echo "<h2>" . _("Llista de moviments") . "</h2>\n";
+
+	include("getdb.inc");
+	include("llistes.inc");
+
+	// Fem la connexió
+	$connexio = mysql_connect($mysql_server, $mysql_user,
+	$mysql_password);
+	mysql_select_db($mysql_db, $connexio);
+
+	if (isset($_GET["ordre"]))
+		llistes::LlistaMoviments($connexio, $_GET["ordre"]);
+	else
+		llistes::LlistaMoviments($connexio);
+
+?>
+
+
+<p><A HREF="index"><?php echo _("Tornar al menú principal");?></A></p>
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/llistes.inc	Thu May 18 23:47:03 2006 +0200
@@ -0,0 +1,236 @@
+<?php
+
+include("./strings.inc");
+
+class llistes
+{
+
+function LlistaButxaques($connexio)
+{
+?>
+<table border=1>
+<tr>
+	<th><?php echo _("ID") ?>
+	<th><?php echo _("Nom") ?>
+<?php
+
+	$butxaques = obtenir_butxaques($connexio);
+
+	foreach(array_keys($butxaques) as $i)
+	{
+		echo "<TR>\n";
+		echo "\t<TD>" . $i . "\n";
+		echo "\t<TD>" . strtohtml($butxaques[$i]) . "\n";
+	}
+
+	
+?>
+
+</table>
+<?php
+	return 0;
+}
+
+function LlistaMoviments($connexio, $ordre=1)
+{
+?>
+<table border=1>
+<tr>
+	<th><a href="llista-moviments?ordre=1"><?php echo _("Data") ?></a>
+	<th><a href="llista-moviments?ordre=2"><?php echo _("Modificat") ?></a>
+	<th><?php echo _("Orígen") ?>
+	<th><?php echo _("Destí") ?>
+	<th><?php echo _("Diners") ?>
+	<th><?php echo _("Raó") ?>
+<?php
+	$butxaques = obtenir_butxaques($connexio);
+
+	if ($ordre == 1)
+		$query ="SELECT UNIX_TIMESTAMP(data),
+		UNIX_TIMESTAMP(data_modif), butxaca_origen,
+		butxaca_desti, quantitat, rao FROM moviments
+		ORDER BY data DESC;";
+	else
+		$query ="SELECT UNIX_TIMESTAMP(data),
+		UNIX_TIMESTAMP(data_modif), butxaca_origen,
+		butxaca_desti, quantitat, rao FROM moviments
+		ORDER BY data_modif DESC;";
+	$resultat = mysql_query($query, $connexio);
+
+	if (!$resultat)
+	{
+		echo mysql_errno().": ".mysql_error()."<BR>";
+		return 1;
+	}
+
+	while ($fila = mysql_fetch_row($resultat))
+	{
+		echo "<TR>\n";
+		echo "\t<TD><a href=\"update-moviment?id=". $fila[0].
+			"\">" . date("d/m/Y H:i",$fila[0]) .
+			"</a>\n";
+		echo "\t<TD>". date("d/m/Y H:i",$fila[1]) ."\n";
+		echo "\t<TD>" . strtohtml($butxaques[$fila[2]]) . "\n";
+		echo "\t<TD>" . strtohtml($butxaques[$fila[3]]) . "\n";
+		echo "\t<TD>" . sprintf("%.2f", $fila[4]) . "\n";
+		echo "\t<TD>" . strtohtml($fila[5]) . "\n";
+	}
+
+	
+?>
+
+</table>
+<?php
+	return 0;
+}
+
+function LlistaIngressos($connexio, $ordre=1)
+// 1 = per data. altres, per data_modif
+{
+?>
+<table border=1>
+<tr>
+	<th><a href="llista-ingressos?ordre=1"><?php echo _("Data") ?></a>
+	<th><a href="llista-ingressos?ordre=2"><?php echo _("Modificat") ?></a>
+	<th><?php echo _("Butxaca") ?>
+	<th><?php echo _("Diners") ?>
+	<th><?php echo _("Raó") ?>
+<?php
+	$butxaques = obtenir_butxaques($connexio);
+
+	if ($ordre == 1)
+		$query ="SELECT UNIX_TIMESTAMP(data),
+			UNIX_TIMESTAMP(data_modif), butxaca,
+			quantitat, rao FROM ingressos ORDER BY data DESC;";
+	else
+		$query ="SELECT UNIX_TIMESTAMP(data),
+			UNIX_TIMESTAMP(data_modif), butxaca,
+			quantitat, rao FROM ingressos ORDER BY data_modif DESC;";
+	$resultat = mysql_query($query, $connexio);
+
+	if (!$resultat)
+	{
+		echo mysql_errno().": ".mysql_error()."<BR>";
+		return 1;
+	}
+
+	while ($fila = mysql_fetch_row($resultat))
+	{
+		echo "<TR>\n";
+		echo "\t<TD><a href=\"update-ingres?id=". $fila[0].
+			"\">" . date("d/m/Y H:i",$fila[0]) .
+			"</a>\n";
+		echo "\t<TD>". date("d/m/Y H:i",$fila[1]) ."\n";
+		echo "\t<TD>" . strtohtml($butxaques[$fila[2]]) . "\n";
+		echo "\t<TD>" . pricetohtml( $fila[3]) . "\n";
+		echo "\t<TD>" . strtohtml($fila[4]) . "\n";
+			"</a>\n";
+	}
+
+	
+?>
+
+</table>
+<?php
+	return 0;
+}
+
+function StatusButxaques($connexio)
+{
+?>
+<table border=1>
+<tr>
+	<th><?php echo _("Butxaca") ?>
+	<th><?php echo _("Ingressos") ?>
+	<th><?php echo _("Despeses") ?>
+	<th><?php echo _("Moviments negatius") ?>
+	<th><?php echo _("Moviments positius") ?>
+	<th><?php echo _("Total") ?>
+<?php
+	$butxaques = obtenir_butxaques($connexio);
+
+	$total = 0;
+	
+	foreach(array_keys($butxaques) as $i)
+	{
+		echo "<tr>";
+		echo "<td>" . $butxaques[$i]. "\n";
+
+		// Ingressos
+		$query ="SELECT SUM(quantitat) FROM ingressos WHERE
+		butxaca =" . $i. " AND quantitat > 0;";
+		$resultat = mysql_query($query, $connexio);
+
+		if (!$resultat)
+		{
+			echo mysql_errno().": ".mysql_error()."<BR>";
+			return 1;
+		}
+
+		$fila = mysql_fetch_row($resultat);
+		$ingressos = $fila[0];
+		echo "<td>" . pricetohtml($fila[0]). "\n";
+
+		// Despeses
+		$query ="SELECT SUM(quantitat) FROM ingressos WHERE
+		butxaca =" . $i. " AND quantitat < 0;";
+		$resultat = mysql_query($query, $connexio);
+
+		if (!$resultat)
+		{
+			echo mysql_errno().": ".mysql_error()."<BR>";
+			return 1;
+		}
+
+		$fila = mysql_fetch_row($resultat);
+		echo "<td>" . pricetohtml($fila[0]). "\n";
+		$ingressos = $ingressos + $fila[0];
+
+		// Moviments negatius
+		$query ="SELECT SUM(quantitat) FROM moviments WHERE
+		butxaca_origen =" . $i. ";";
+		$resultat = mysql_query($query, $connexio);
+
+		if (!$resultat)
+		{
+			echo mysql_errno().": ".mysql_error()."<BR>";
+			return 1;
+		}
+
+		$fila = mysql_fetch_row($resultat);
+		echo "<td>" . pricetohtml(-$fila[0]). "\n";
+		$ingressos = $ingressos - $fila[0];
+
+		// Moviments positius
+		$query ="SELECT SUM(quantitat) FROM moviments WHERE
+		butxaca_desti =" . $i. ";";
+		$resultat = mysql_query($query, $connexio);
+
+		if (!$resultat)
+		{
+			echo mysql_errno().": ".mysql_error()."<BR>";
+			return 1;
+		}
+
+		$fila = mysql_fetch_row($resultat);
+		echo "<td>" . pricetohtml($fila[0]). "\n";
+		$ingressos = $ingressos + $fila[0];
+
+		echo "<td>" . pricetohtml($ingressos) . "\n";
+		$total = $total + $ingressos;
+	}
+
+	echo "<tr>\n";
+	echo "<th>". _("Total"). "<td><td><td><td><td>" . pricetohtml($total).
+		"\n";
+
+	
+?>
+
+</table>
+<?php
+	return 0;
+}
+
+} // Fi de classe
+?>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locale/Makefile	Thu May 18 23:47:03 2006 +0200
@@ -0,0 +1,3 @@
+SOURCE=../index.php ../llista-butxaques.php ../llista-ingressos.php ../llista-moviments.php ../llistes.inc ../strings.inc ../classes.inc ../status-butxaques.php ../update-butxaca.php ../update-ingres.php ../update-moviment.php
+butxaques.po: $(SOURCE)
+	xgettext -L PHP --from-code utf-8 -o butxaques.po $(SOURCE)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locale/butxaques.po	Thu May 18 23:47:03 2006 +0200
@@ -0,0 +1,268 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2005-09-28 12:49+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../index.php:12 ../index.php:18 ../llista-butxaques.php:12
+#: ../llista-butxaques.php:20 ../llista-ingressos.php:12
+#: ../llista-ingressos.php:20 ../llista-moviments.php:12
+#: ../llista-moviments.php:20 ../status-butxaques.php:12
+#: ../status-butxaques.php:20 ../update-butxaca.php:12
+#: ../update-butxaca.php:19 ../update-ingres.php:12 ../update-ingres.php:19
+#: ../update-moviment.php:12 ../update-moviment.php:19
+msgid "Control de butxaques"
+msgstr ""
+
+#: ../index.php:12 ../index.php:19 ../update-ingres.php:12
+#: ../update-ingres.php:37
+msgid "Nou ingrés/despesa"
+msgstr ""
+
+#: ../index.php:24
+msgid "Ingressos/Despeses"
+msgstr ""
+
+#: ../index.php:25
+msgid "Moviments entre butxaques"
+msgstr ""
+
+#: ../index.php:26
+msgid "Butxaques"
+msgstr ""
+
+#: ../index.php:29
+msgid "Nou Ingrés/Despesa"
+msgstr ""
+
+#: ../index.php:31
+msgid "Nou Moviment"
+msgstr ""
+
+#: ../index.php:33
+msgid "Nova Butxaca"
+msgstr ""
+
+#: ../index.php:36
+msgid "Llista d'Ingressos/Despeses"
+msgstr ""
+
+#: ../index.php:38
+msgid "Llista de Moviments"
+msgstr ""
+
+#: ../index.php:40
+msgid "Llista de Butxaques"
+msgstr ""
+
+#: ../index.php:43 ../status-butxaques.php:13 ../status-butxaques.php:21
+msgid "Estat de les butxaques"
+msgstr ""
+
+#: ../llista-butxaques.php:13 ../llista-butxaques.php:21
+msgid "Llista de butxaques"
+msgstr ""
+
+#: ../llista-butxaques.php:36 ../llista-ingressos.php:39
+#: ../llista-moviments.php:39 ../status-butxaques.php:36
+#: ../update-butxaca.php:70 ../update-ingres.php:187
+#: ../update-moviment.php:176
+msgid "Tornar al menú principal"
+msgstr ""
+
+#: ../llista-ingressos.php:13 ../llista-ingressos.php:21
+msgid "Llista d'ingressos/despeses"
+msgstr ""
+
+#: ../llista-moviments.php:13 ../llista-moviments.php:21
+msgid "Llista de moviments"
+msgstr ""
+
+#: ../llistes.inc:13
+msgid "ID"
+msgstr ""
+
+#: ../llistes.inc:14
+msgid "Nom"
+msgstr ""
+
+#: ../llistes.inc:39 ../llistes.inc:93 ../update-ingres.php:51
+#: ../update-moviment.php:51
+msgid "Data"
+msgstr ""
+
+#: ../llistes.inc:40 ../llistes.inc:94
+msgid "Modificat"
+msgstr ""
+
+#: ../llistes.inc:41
+msgid "Orígen"
+msgstr ""
+
+#: ../llistes.inc:42
+msgid "Destí"
+msgstr ""
+
+#: ../llistes.inc:43 ../llistes.inc:96 ../update-ingres.php:102
+#: ../update-moviment.php:91
+msgid "Diners"
+msgstr ""
+
+#: ../llistes.inc:44 ../llistes.inc:97 ../update-ingres.php:106
+#: ../update-moviment.php:95
+msgid "Raó"
+msgstr ""
+
+#: ../llistes.inc:95 ../llistes.inc:143 ../update-ingres.php:86
+msgid "Butxaca"
+msgstr ""
+
+#: ../llistes.inc:144
+msgid "Ingressos"
+msgstr ""
+
+#: ../llistes.inc:145
+msgid "Despeses"
+msgstr ""
+
+#: ../llistes.inc:146
+msgid "Moviments negatius"
+msgstr ""
+
+#: ../llistes.inc:147
+msgid "Moviments positius"
+msgstr ""
+
+#: ../llistes.inc:148 ../llistes.inc:224
+msgid "Total"
+msgstr ""
+
+#: ../update-butxaca.php:12 ../update-butxaca.php:20
+msgid "Nova butxaca"
+msgstr ""
+
+#: ../update-butxaca.php:31
+msgid "Nom de la butxaca"
+msgstr ""
+
+#: ../update-butxaca.php:35
+msgid "Afegir butxaca"
+msgstr ""
+
+#: ../update-butxaca.php:36 ../update-ingres.php:130
+#: ../update-moviment.php:119
+msgid "Ressetejar formulari"
+msgstr ""
+
+#: ../update-butxaca.php:60
+msgid "<STRONG>ERROR:</STRONG> Error al actualitzar"
+msgstr ""
+
+#: ../update-butxaca.php:61
+#, php-format
+msgid "les dades a <STRONG>%s</STRONG>!"
+msgstr ""
+
+#: ../update-butxaca.php:66
+msgid "<p>Inserció efectuada correctament.</p>"
+msgstr ""
+
+#: ../update-ingres.php:41
+msgid "Modificar ingrés/despesa"
+msgstr ""
+
+#: ../update-ingres.php:46
+msgid "Dades de l'ingrés/despesa"
+msgstr ""
+
+#: ../update-ingres.php:63 ../update-moviment.php:63
+msgid "Hora"
+msgstr ""
+
+#: ../update-ingres.php:80 ../update-moviment.php:79
+msgid "Data de la última modificació"
+msgstr ""
+
+#: ../update-ingres.php:90
+msgid "Ingrés o despesa"
+msgstr ""
+
+#: ../update-ingres.php:94
+msgid "Ingrés"
+msgstr ""
+
+#: ../update-ingres.php:100
+msgid "Despesa"
+msgstr ""
+
+#: ../update-ingres.php:110 ../update-moviment.php:99
+msgid "Comentari"
+msgstr ""
+
+#: ../update-ingres.php:120 ../update-moviment.php:109
+msgid "Modificar"
+msgstr ""
+
+#: ../update-ingres.php:126 ../update-moviment.php:115
+msgid "Afegir"
+msgstr ""
+
+#: ../update-ingres.php:150 ../update-moviment.php:139
+msgid "Inserció efectuada correctament"
+msgstr ""
+
+#: ../update-ingres.php:152 ../update-moviment.php:141
+msgid "<strong>Error insertant.</strong>"
+msgstr ""
+
+#: ../update-ingres.php:170 ../update-moviment.php:161
+msgid "Modificació efectuada correctament"
+msgstr ""
+
+#: ../update-ingres.php:172 ../update-moviment.php:163
+msgid "<strong>Error modificant.</strong>"
+msgstr ""
+
+#: ../update-ingres.php:180 ../update-moviment.php:169
+msgid "Entrada eliminada correctament"
+msgstr ""
+
+#: ../update-ingres.php:182 ../update-moviment.php:171
+msgid "<strong>Error eliminant.</strong>"
+msgstr ""
+
+#: ../update-ingres.php:193 ../update-moviment.php:182
+msgid "[ELIMINAR]"
+msgstr ""
+
+#: ../update-moviment.php:12 ../update-moviment.php:37
+msgid "Nou moviment"
+msgstr ""
+
+#: ../update-moviment.php:41
+msgid "Modificar moviment"
+msgstr ""
+
+#: ../update-moviment.php:46
+msgid "Dades del moviment"
+msgstr ""
+
+#: ../update-moviment.php:85
+msgid "Butxaca origen"
+msgstr ""
+
+#: ../update-moviment.php:88
+msgid "Butxaca destí"
+msgstr ""
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locale/ca/LC_MESSAGES/butxaques.po	Thu May 18 23:47:03 2006 +0200
@@ -0,0 +1,24 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2005-09-27 11:56+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../prova.php:12 ../prova.php:16
+msgid "Control de butxaques"
+msgstr ""
+
+#: ../prova.php:21
+msgid "Ingressos"
+msgstr ""
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locale/eo/LC_MESSAGES/butxaques.po	Thu May 18 23:47:03 2006 +0200
@@ -0,0 +1,268 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: butxaques 0.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2005-09-28 12:49+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: Lluís Batlle <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../index.php:12 ../index.php:18 ../llista-butxaques.php:12
+#: ../llista-butxaques.php:20 ../llista-ingressos.php:12
+#: ../llista-ingressos.php:20 ../llista-moviments.php:12
+#: ../llista-moviments.php:20 ../status-butxaques.php:12
+#: ../status-butxaques.php:20 ../update-butxaca.php:12
+#: ../update-butxaca.php:19 ../update-ingres.php:12 ../update-ingres.php:19
+#: ../update-moviment.php:12 ../update-moviment.php:19
+msgid "Control de butxaques"
+msgstr "Poŝkontrolo"
+
+#: ../index.php:12 ../index.php:19 ../update-ingres.php:12
+#: ../update-ingres.php:37
+msgid "Nou ingrés/despesa"
+msgstr "Nova enspezo/elspezo"
+
+#: ../index.php:24
+msgid "Ingressos/Despeses"
+msgstr "Enspezoj/Elspezoj"
+
+#: ../index.php:25
+msgid "Moviments entre butxaques"
+msgstr "Movoj inter poŝoj"
+
+#: ../index.php:26
+msgid "Butxaques"
+msgstr "Poŝoj"
+
+#: ../index.php:29
+msgid "Nou Ingrés/Despesa"
+msgstr "Nova Enspezo/Elspezo"
+
+
+#: ../index.php:31
+msgid "Nou Moviment"
+msgstr "Nova Movo"
+
+#: ../index.php:33
+msgid "Nova Butxaca"
+msgstr "Nova Poŝo"
+
+#: ../index.php:36
+msgid "Llista d'Ingressos/Despeses"
+msgstr "Listo de Enspezoj/Elspezoj"
+
+#: ../index.php:38
+msgid "Llista de Moviments"
+msgstr "Listo de Movoj"
+
+#: ../index.php:40
+msgid "Llista de Butxaques"
+msgstr "Listo de Poŝoj"
+
+#: ../index.php:43 ../status-butxaques.php:13 ../status-butxaques.php:21
+msgid "Estat de les butxaques"
+msgstr "Stato de la poŝoj"
+
+#: ../llista-butxaques.php:13 ../llista-butxaques.php:21
+msgid "Llista de butxaques"
+msgstr "Listo de poŝoj"
+
+#: ../llista-butxaques.php:36 ../llista-ingressos.php:39
+#: ../llista-moviments.php:39 ../status-butxaques.php:36
+#: ../update-butxaca.php:70 ../update-ingres.php:187
+#: ../update-moviment.php:176
+msgid "Tornar al menú principal"
+msgstr "Reiri al ĉefa menuo"
+
+#: ../llista-ingressos.php:13 ../llista-ingressos.php:21
+msgid "Llista d'ingressos/despeses"
+msgstr "Listo de enspezoj/Elspezoj"
+
+#: ../llista-moviments.php:13 ../llista-moviments.php:21
+msgid "Llista de moviments"
+msgstr "Listo de movoj"
+
+#: ../llistes.inc:13
+msgid "ID"
+msgstr "ID"
+
+#: ../llistes.inc:14
+msgid "Nom"
+msgstr "Nomo"
+
+#: ../llistes.inc:39 ../llistes.inc:93 ../update-ingres.php:51
+#: ../update-moviment.php:51
+msgid "Data"
+msgstr "Dato"
+
+#: ../llistes.inc:40 ../llistes.inc:94
+msgid "Modificat"
+msgstr "Modifita"
+
+#: ../llistes.inc:41
+msgid "Orígen"
+msgstr "El"
+
+#: ../llistes.inc:42
+msgid "Al"
+msgstr ""
+
+#: ../llistes.inc:43 ../llistes.inc:96 ../update-ingres.php:102
+#: ../update-moviment.php:91
+msgid "Diners"
+msgstr "Mono"
+
+#: ../llistes.inc:44 ../llistes.inc:97 ../update-ingres.php:106
+#: ../update-moviment.php:95
+msgid "Raó"
+msgstr "Kialo"
+
+#: ../llistes.inc:95 ../llistes.inc:143 ../update-ingres.php:86
+msgid "Butxaca"
+msgstr "Poŝo"
+
+#: ../llistes.inc:144
+msgid "Ingressos"
+msgstr "Enspezoj"
+
+#: ../llistes.inc:145
+msgid "Despeses"
+msgstr "Elspezoj"
+
+#: ../llistes.inc:146
+msgid "Moviments negatius"
+msgstr "Negativaj movoj"
+
+#: ../llistes.inc:147
+msgid "Moviments positius"
+msgstr "Pozitivaj movoj"
+
+#: ../llistes.inc:148 ../llistes.inc:224
+msgid "Total"
+msgstr "Ĉiome"
+
+#: ../update-butxaca.php:12 ../update-butxaca.php:20
+msgid "Nova butxaca"
+msgstr "Nova poŝo"
+
+#: ../update-butxaca.php:31
+msgid "Nom de la butxaca"
+msgstr "Nomo de la poŝo"
+
+#: ../update-butxaca.php:35
+msgid "Afegir butxaca"
+msgstr "Aldoni poŝon"
+
+#: ../update-butxaca.php:36 ../update-ingres.php:130
+#: ../update-moviment.php:119
+msgid "Ressetejar formulari"
+msgstr "Vakuigi la enketon"
+
+#: ../update-butxaca.php:60
+msgid "<STRONG>ERROR:</STRONG> Error al actualitzar"
+msgstr ""
+
+#: ../update-butxaca.php:61
+#, php-format
+msgid "les dades a <STRONG>%s</STRONG>!"
+msgstr ""
+
+#: ../update-butxaca.php:66
+msgid "<p>Inserció efectuada correctament.</p>"
+msgstr ""
+
+#: ../update-ingres.php:41
+msgid "Modificar ingrés/despesa"
+msgstr ""
+
+#: ../update-ingres.php:46
+msgid "Dades de l'ingrés/despesa"
+msgstr ""
+
+#: ../update-ingres.php:63 ../update-moviment.php:63
+msgid "Hora"
+msgstr ""
+
+#: ../update-ingres.php:80 ../update-moviment.php:79
+msgid "Data de la última modificació"
+msgstr ""
+
+#: ../update-ingres.php:90
+msgid "Ingrés o despesa"
+msgstr ""
+
+#: ../update-ingres.php:94
+msgid "Ingrés"
+msgstr ""
+
+#: ../update-ingres.php:100
+msgid "Despesa"
+msgstr ""
+
+#: ../update-ingres.php:110 ../update-moviment.php:99
+msgid "Comentari"
+msgstr ""
+
+#: ../update-ingres.php:120 ../update-moviment.php:109
+msgid "Modificar"
+msgstr ""
+
+#: ../update-ingres.php:126 ../update-moviment.php:115
+msgid "Afegir"
+msgstr ""
+
+#: ../update-ingres.php:150 ../update-moviment.php:139
+msgid "Inserció efectuada correctament"
+msgstr ""
+
+#: ../update-ingres.php:152 ../update-moviment.php:141
+msgid "<strong>Error insertant.</strong>"
+msgstr ""
+
+#: ../update-ingres.php:170 ../update-moviment.php:161
+msgid "Modificació efectuada correctament"
+msgstr ""
+
+#: ../update-ingres.php:172 ../update-moviment.php:163
+msgid "<strong>Error modificant.</strong>"
+msgstr ""
+
+#: ../update-ingres.php:180 ../update-moviment.php:169
+msgid "Entrada eliminada correctament"
+msgstr ""
+
+#: ../update-ingres.php:182 ../update-moviment.php:171
+msgid "<strong>Error eliminant.</strong>"
+msgstr ""
+
+#: ../update-ingres.php:193 ../update-moviment.php:182
+msgid "[ELIMINAR]"
+msgstr "[FORIGI]"
+
+#: ../update-moviment.php:12 ../update-moviment.php:37
+msgid "Nou moviment"
+msgstr "Nova movo"
+
+#: ../update-moviment.php:41
+msgid "Modificar moviment"
+msgstr ""
+
+#: ../update-moviment.php:46
+msgid "Dades del moviment"
+msgstr ""
+
+#: ../update-moviment.php:85
+msgid "Butxaca origen"
+msgstr ""
+
+#: ../update-moviment.php:88
+msgid "Butxaca destí"
+msgstr ""
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/readme.txt	Thu May 18 23:47:03 2006 +0200
@@ -0,0 +1,21 @@
+Instruccions per a instal·lar-ho...
+
+Crees un usuari de mysql, que tingui accés a una base de dades.
+Aquesta mateixa configuració l'escrius en un fitxer així, anomenat
+db-config.inc:
+<?php
+$mysql_server = "localhost";
+$mysql_user = "usuari";
+$mysql_password = "xxxxx";
+$mysql_db = "viric_butxaques";
+?>
+
+(sense línies en blanc abans i després)
+
+Llavors, crees les taules així:
+mysql -u usuari -p base_de_dades < db.sql
+
+i ja pots fer servir el programa. Primer crees una 'Butxaca'. I llavors ja va
+tot.
+
+Apa!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/status-butxaques.php	Thu May 18 23:47:03 2006 +0200
@@ -0,0 +1,39 @@
+<?php
+/***** Informació de LOCALE *****/
+echo setlocale(LC_ALL, 'ca_XX');
+$textdomain = "butxaques";
+bindtextdomain($textdomain, "./locale");
+textdomain($textdomain);
+bind_textdomain_codeset($textdomain, "utf-8");
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<html>
+<head>
+<title><?php echo _("Control de butxaques")." - ".
+	_("Estat de les butxaques");?></title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
+</head>
+
+<body>
+<?php
+echo "<h1 align=center>" . _("Control de butxaques") . "</h1>\n";
+echo "<h2>" . _("Estat de les butxaques") . "</h2>\n";
+
+	include("getdb.inc");
+	include("llistes.inc");
+
+	// Fem la connexió
+	$connexio = mysql_connect($mysql_server, $mysql_user,
+	$mysql_password);
+	mysql_select_db($mysql_db, $connexio);
+
+	llistes::StatusButxaques($connexio);
+
+?>
+
+
+<p><A HREF="index"><?php echo _("Tornar al menú principal");?></A></p>
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/strings.inc	Thu May 18 23:47:03 2006 +0200
@@ -0,0 +1,24 @@
+<?php
+function strtohtml($cadena)
+{
+	$new= ereg_replace("[<]", "&lt;", $cadena);
+	$new= ereg_replace("[>]", "&gt;'", $cadena);
+	$new= ereg_replace("[&]", "&amp;'", $cadena);
+
+	return $new;
+}
+
+function strtosql($cadena)
+{
+	return ereg_replace("'", "'", $cadena);
+}
+
+function pricetohtml($price)
+{
+	if ($price < 0)
+		return sprintf("<FONT COLOR=\"FF0000\">%.2f</FONT>", $price);
+	else
+		return sprintf("%.2f", $price);
+
+}
+?>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/update-butxaca.php	Thu May 18 23:47:03 2006 +0200
@@ -0,0 +1,73 @@
+<?php
+/***** Informació de LOCALE *****/
+echo setlocale(LC_ALL, 'ca_XX');
+$textdomain = "butxaques";
+bindtextdomain($textdomain, "./locale");
+textdomain($textdomain);
+bind_textdomain_codeset($textdomain, "utf-8");
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<html>
+<head>
+<title><?php echo _("Control de butxaques")." - "._("Nova butxaca");?></title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
+</head>
+
+<body>
+<?php
+echo "<h1 align=center>" . _("Control de butxaques") . "</h1>\n";
+echo "<h2>" . _("Nova butxaca") . "</h2>\n";
+
+include ("./strings.inc");
+
+if (!isset($_POST["afegir"]))
+{
+?>
+
+<FORM method=post action="update-butxaca">
+<table>
+<tr>
+	<th><?php echo _("Nom de la butxaca") ?>
+	<td><input type="text" name="nom" size=20 maxlength=50>
+</table>
+<center>
+<input type=submit value="<?php echo _("Afegir butxaca");?>" name=afegir>
+<input type=reset value="<?php echo _("Ressetejar formulari");?>">
+</center>
+</form>
+<?php
+}
+else // if afegir
+{
+	// ****** Falta comprovar si el nom és NULL
+	include("getdb.inc");
+
+	// Fem la connexió
+	$connexio = mysql_connect($mysql_server, $mysql_user,
+	$mysql_password);
+	mysql_select_db($mysql_db, $connexio);
+
+	// Escrivim
+	$query = "INSERT INTO butxaques (nom) VALUES('" .
+		strtosql($_POST["nom"]) . "');";
+
+	$resultat = mysql_query($query, $connexio);
+
+	if (!$resultat)
+	{
+		echo "<p>";
+		echo sprintf(_("<STRONG>ERROR:</STRONG> Error al actualitzar" .
+			"les dades a <STRONG>%s</STRONG>!"), "butxaques");
+		echo "</p>";
+		echo mysql_errno().": ".mysql_error()."<BR>";
+	}
+	else
+		echo _("<p>Inserció efectuada correctament.</p>");
+}
+?>
+
+<p><A HREF="index"><?php echo _("Tornar al menú principal");?></A></p>
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/update-ingres.php	Thu May 18 23:47:03 2006 +0200
@@ -0,0 +1,209 @@
+<?php
+/***** Informació de LOCALE *****/
+echo setlocale(LC_ALL, 'ca_XX');
+$textdomain = "butxaques";
+bindtextdomain($textdomain, "./locale");
+textdomain($textdomain);
+bind_textdomain_codeset($textdomain, "utf-8");
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<html>
+<head>
+<title><?php echo _("Control de butxaques")." - "._("Nou ingrés/despesa");?></title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
+</head>
+
+<body>
+<?php
+echo "<h1 align=center>" . _("Control de butxaques") . "</h1>\n";
+
+include("./getdb.inc");
+include("./classes.inc");
+
+// Fem la connexió
+$connexio = mysql_connect($mysql_server, $mysql_user,
+$mysql_password);
+mysql_select_db($mysql_db, $connexio);
+
+$butxaques = obtenir_butxaques($connexio);
+
+if (!isset($_POST["afegir"]) && !isset($_GET["eliminar"]) &&
+	!isset($_POST["modificar"]))
+{
+	if (!isset($_GET["id"]))
+	{
+		$formulari = new ingres();
+		echo "<h2>" . _("Nou ingrés/despesa") . "</h2>\n";
+	}
+	else
+	{
+		echo "<h2>" . _("Modificar ingrés/despesa") . "</h2>\n";
+		$formulari = new ingres($connexio, $_GET["id"]);
+	}
+?>
+
+<p><?php echo _("Dades de l'ingrés/despesa");?></p>
+
+<FORM method=post action="update-ingres">
+<table>
+<tr>
+<th><?php echo _("Data");?>
+<td>
+<input type="text" name="dia" size=2 maxlength=2 value="<?php
+	    echo $formulari->dia;
+         ?>">
+      <input type="text" name="mes" size=2 maxlength=2 value="<?php
+	    echo $formulari->mes;
+         ?>">
+      <input type="text" name="any" size=4 maxlength=4 value="<?php
+	    echo $formulari->any;
+         ?>">
+<tr>
+<th><?php echo _("Hora");?>
+<td>
+<input type="text" name="hora" size=2 maxlength=2 value="<?php
+	    echo $formulari->hora;
+        ?>">
+      <input type="text" name="minut" size=2 maxlength=2
+      value="<?php
+	    echo $formulari->minut;
+         ?>">
+
+<?php
+	if (isset($_GET["id"])) // Modificació
+	{
+		//*** Truquilllo
+		echo "<input type=hidden name=data_vella value=\"".
+			$formulari->data(). "\">";
+		echo "<tr>\n";
+		echo "<th>". _("Data de la última modificació"). "\n";
+		echo "<td>" . date("d/m/Y H:i", $formulari->modificat) . "\n";
+	}
+?>
+
+<tr>
+	<th><?php echo _("Butxaca");?>
+	<td><?php select_butxaques("butxaca", $formulari->butxaca);?>
+
+<tr>
+	<th><?php echo _("Ingrés o despesa");?>
+	<td><input type=radio name="tipus" value="ingres"<?php
+		if ($formulari->tipus == "ingres")
+			echo "checked"; ?>><?php
+		echo _("Ingrés"); ?>
+<tr>
+	<td>
+	<td><input type=radio name="tipus" value="despesa"<?php
+		if ($formulari->tipus != "ingres")
+			echo "checked"; ?>><?php
+		echo _("Despesa"); ?>
+<tr>
+	<th><?php echo _("Diners") ?>
+	<td><input type="text" name="diners" size=10 maxlength=20 value="<?php
+		echo $formulari->diners; ?>">
+<tr>
+	<th><?php echo _("Raó") ?>
+	<td><input type="text" name="rao" size=30 maxlength=250 value="<?php
+		echo $formulari->rao; ?>">
+<tr>
+	<th><?php echo _("Comentari") ?>
+	<td><textarea type="text" name="comentari" rows=3 cols=40><?php
+		echo $formulari->comentari;
+	?></textarea>
+</table>
+<center>
+<?php
+	if (isset($_GET["id"])) // Modificació
+	{
+		echo "<input type=submit value=\"";
+		echo _("Modificar");
+		echo "\" name=modificar>";
+	}
+	else
+	{
+		echo "<input type=submit value=\"";
+		echo _("Afegir");
+		echo "\" name=afegir>";
+	}
+?>
+<input type=reset value="<?php echo _("Ressetejar formulari");?>">
+</center>
+
+<?php
+}
+elseif (isset($_POST["afegir"]))
+{
+	$formulari = new ingres();
+	$formulari->dia = $_POST[dia];
+	$formulari->mes = $_POST[mes];
+	$formulari->any = $_POST[any];
+	$formulari->hora = $_POST[hora];
+	$formulari->minut = $_POST[minut];
+	$formulari->rao = $_POST[rao];
+	$formulari->comentari = $_POST[comentari];
+	$formulari->tipus = $_POST[tipus];
+	$formulari->diners = $_POST[diners];
+	$formulari->butxaca = $_POST[butxaca];
+
+	if ($formulari->diners == 0)
+	{
+		echo "<p>". _("<strong>Error:</strong> La quantitat de diners ha de ser diferent de zero.") . "</p>";
+	}
+	else
+	if($formulari->DBAfegir($connexio) == 0)
+		echo "<p>". _("Inserció efectuada correctament") . "</p>";
+	else
+		echo "<p>". _("<strong>Error insertant.</strong>") . "</p>";
+}
+elseif (isset($_POST["modificar"]))
+{
+
+	$formulari = new ingres($connexio, $_POST["data_vella"]);
+	$formulari->dia = $_POST[dia];
+	$formulari->mes = $_POST[mes];
+	$formulari->any = $_POST[any];
+	$formulari->hora = $_POST[hora];
+	$formulari->minut = $_POST[minut];
+	$formulari->rao = $_POST[rao];
+	$formulari->comentari = $_POST[comentari];
+	$formulari->diners = $_POST[diners];
+	$formulari->tipus = $_POST[tipus];
+	$formulari->butxaca = $_POST[butxaca];
+
+	if ($formulari->diners == 0)
+	{
+		echo "<p>". _("<strong>Error:</strong> La quantitat de diners ha de ser diferent de zero.") . "</p>";
+	}
+	else
+	if($formulari->DBModificar($connexio,$_POST["data_vella"]) == 0)
+		echo "<p>". _("Modificació efectuada correctament") . "</p>";
+	else
+		echo "<p>". _("<strong>Error modificant.</strong>") . "</p>";
+
+
+}
+elseif (isset($_GET["eliminar"])) // if eliminar, borrem
+{
+	$formulari = new ingres($connexio, $_GET["id"]);
+	if ($formulari->DBBorrar($connexio) == 0)
+		echo "<p>". _("Entrada eliminada correctament") . "</p>";
+	else
+		echo "<p>". _("<strong>Error eliminant.</strong>") . "</p>";
+}
+mysql_close($connexio);
+?>
+
+<p><A HREF="index"><?php echo _("Tornar al menú principal");?></A></p>
+<?php
+	if (isset($_GET["id"]) && !isset($_GET["eliminar"])) // Modificació
+	{
+		echo "<p align=right><a href=\"update-ingres?eliminar=1&id=".
+			$formulari->data(). "\">";
+		echo _("[ELIMINAR]");
+		echo "</A></p>";
+	}
+?>
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/update-moviment.php	Thu May 18 23:47:03 2006 +0200
@@ -0,0 +1,198 @@
+<?php
+/***** Informació de LOCALE *****/
+echo setlocale(LC_ALL, 'ca_XX');
+$textdomain = "butxaques";
+bindtextdomain($textdomain, "./locale");
+textdomain($textdomain);
+bind_textdomain_codeset($textdomain, "utf-8");
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<html>
+<head>
+<title><?php echo _("Control de butxaques")." - "._("Nou moviment");?></title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
+</head>
+
+<body>
+<?php
+echo "<h1 align=center>" . _("Control de butxaques") . "</h1>\n";
+
+include("./getdb.inc");
+include("./classes.inc");
+
+// Fem la connexió
+$connexio = mysql_connect($mysql_server, $mysql_user,
+$mysql_password);
+mysql_select_db($mysql_db, $connexio);
+
+$butxaques = obtenir_butxaques($connexio);
+
+if (!isset($_POST["afegir"]) && !isset($_GET["eliminar"]) &&
+	!isset($_POST["modificar"]))
+{
+	if (!isset($_GET["id"]))
+	{
+		$formulari = new moviment();
+		echo "<h2>" . _("Nou moviment") . "</h2>\n";
+	}
+	else
+	{
+		echo "<h2>" . _("Modificar moviment") . "</h2>\n";
+		$formulari = new moviment($connexio, $_GET["id"]);
+	}
+?>
+
+<p><?php echo _("Dades del moviment");?></p>
+
+<FORM method=post action="update-moviment">
+<table>
+<tr>
+<th><?php echo _("Data");?>
+<td>
+<input type="text" name="dia" size=2 maxlength=2 value="<?php
+	    echo $formulari->dia;
+         ?>">
+      <input type="text" name="mes" size=2 maxlength=2 value="<?php
+	    echo $formulari->mes;
+         ?>">
+      <input type="text" name="any" size=4 maxlength=4 value="<?php
+	    echo $formulari->any;
+         ?>">
+<tr>
+<th><?php echo _("Hora");?>
+<td>
+<input type="text" name="hora" size=2 maxlength=2 value="<?php
+	    echo $formulari->hora;
+        ?>">
+      <input type="text" name="minut" size=2 maxlength=2
+      value="<?php
+	    echo $formulari->minut;
+         ?>">
+<?php
+	if (isset($_GET["id"])) // Modificació
+	{
+		//*** Truquilllo
+		echo "<input type=hidden name=data_vella value=\"".
+			$formulari->data(). "\">";
+		echo "<tr>\n";
+		echo "<th>". _("Data de la última modificació"). "\n";
+		echo "<td>" . date("d/m/Y H:i", $formulari->modificat) . "\n";
+	}
+?>
+
+<tr>
+	<th><?php echo _("Butxaca origen");?>
+	<td><?php select_butxaques("butxaca_origen", $formulari->butxaca_origen);?>
+<tr>
+	<th><?php echo _("Butxaca destí");?>
+	<td><?php select_butxaques("butxaca_desti", $formulari->butxaca_desti);?>
+<tr>
+	<th><?php echo _("Diners") ?>
+	<td><input type="text" name="diners" size=10 maxlength=20 value="<?php
+		echo $formulari->diners; ?>">
+<tr>
+	<th><?php echo _("Raó") ?>
+	<td><input type="text" name="rao" size=30 maxlength=250 value="<?php
+		echo $formulari->rao; ?>">
+<tr>
+	<th><?php echo _("Comentari") ?>
+	<td><textarea type="text" name="comentari" rows=3 cols=40><?php
+		echo $formulari->comentari;
+	?></textarea>
+</table>
+<center>
+<?php
+	if (isset($_GET["id"])) // Modificació
+	{
+		echo "<input type=submit value=\"";
+		echo _("Modificar");
+		echo "\" name=modificar>";
+	}
+	else
+	{
+		echo "<input type=submit value=\"";
+		echo _("Afegir");
+		echo "\" name=afegir>";
+	}
+?>
+<input type=reset value="<?php echo _("Ressetejar formulari");?>">
+</center>
+
+<?php
+}
+elseif (isset($_POST["afegir"])) // if afegir, afegim
+{
+	$formulari = new moviment();
+	$formulari->dia = $_POST[dia];
+	$formulari->mes = $_POST[mes];
+	$formulari->any = $_POST[any];
+	$formulari->hora = $_POST[hora];
+	$formulari->minut = $_POST[minut];
+	$formulari->rao = $_POST[rao];
+	$formulari->comentari = $_POST[comentari];
+	$formulari->diners = $_POST[diners];
+	$formulari->butxaca_origen = $_POST[butxaca_origen];
+	$formulari->butxaca_desti = $_POST[butxaca_desti];
+
+	if ($formulari->diners == 0)
+	{
+		echo "<p>". _("<strong>Error:</strong> La quantitat de diners ha de ser diferent de zero.") . "</p>";
+	}
+	else
+	if ($formulari->butxaca_origen == $formulari->butxaca_desti)
+	{
+		echo "<p>". _("<strong>Error:</strong> Les butxaques orígen i destí han de ser diferents.") . "</p>";
+	}
+	else
+	if($formulari->DBAfegir($connexio) == 0)
+		echo "<p>". _("Inserció efectuada correctament") . "</p>";
+	else
+		echo "<p>". _("<strong>Error insertant.</strong>") . "</p>";
+	
+
+}
+elseif (isset($_POST["modificar"]))
+{
+
+	$formulari = new moviment($connexio, $_POST["data_vella"]);
+	$formulari->dia = $_POST[dia];
+	$formulari->mes = $_POST[mes];
+	$formulari->any = $_POST[any];
+	$formulari->hora = $_POST[hora];
+	$formulari->minut = $_POST[minut];
+	$formulari->rao = $_POST[rao];
+	$formulari->comentari = $_POST[comentari];
+	$formulari->diners = $_POST[diners];
+	$formulari->butxaca_origen = $_POST[butxaca_origen];
+	$formulari->butxaca_desti = $_POST[butxaca_desti];
+
+	if($formulari->DBModificar($connexio,$_POST["data_vella"]) == 0)
+		echo "<p>". _("Modificació efectuada correctament") . "</p>";
+	else
+		echo "<p>". _("<strong>Error modificant.</strong>") . "</p>";
+}
+elseif (isset($_GET["eliminar"])) // if eliminar, borrem
+{
+	$formulari = new moviment($connexio, $_GET["id"]);
+	if ($formulari->DBBorrar($connexio) == 0)
+		echo "<p>". _("Entrada eliminada correctament") . "</p>";
+	else
+		echo "<p>". _("<strong>Error eliminant.</strong>") . "</p>";
+}
+mysql_close($connexio);
+?>
+
+<p><A HREF="index"><?php echo _("Tornar al menú principal");?></A></p>
+<?php
+	if (isset($_GET["id"]) && !isset($_GET["eliminar"])) // Modificació
+	{
+		echo "<p align=right><a href=\"update-moviment?eliminar=1&id=".
+			$formulari->data(). "\">";
+		echo _("[ELIMINAR]");
+		echo "</A></p>";
+	}
+?>
+
+</body>
+</html>