Nouveau fichier
This commit is contained in:
parent
aad0f3d548
commit
e5b864cfc4
143
htdocs/compta/ventilation/fiche.php
Normal file
143
htdocs/compta/ventilation/fiche.php
Normal file
@ -0,0 +1,143 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
$mesg = '';
|
||||
|
||||
if ($_POST["action"] == 'ventil' && $user->rights->compta->ventiler)
|
||||
{
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."facturedet";
|
||||
$sql .= " SET fk_code_ventilation = ".$_POST["codeventil"];
|
||||
$sql .= " WHERE rowid = ".$_GET["id"];
|
||||
|
||||
$db->query($sql);
|
||||
}
|
||||
|
||||
llxHeader("","","Fiche ventilation");
|
||||
|
||||
if ($cancel == $langs->trans("Cancel"))
|
||||
{
|
||||
$action = '';
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT rowid, numero, intitule";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."compta_compte_generaux";
|
||||
$sql .= " ORDER BY numero ASC";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row();
|
||||
$cgs[$row[0]] = $row[1] . ' ' . $row[2];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Création
|
||||
*
|
||||
*/
|
||||
$form = new Form($db);
|
||||
|
||||
if($_GET["id"] && $user->rights->compta->ventiler)
|
||||
{
|
||||
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_taux, l.remise_percent, l.subprice, ".$db->pdate("l.date_start")." as date_start, ".$db->pdate("l.date_end")." as date_end, l.fk_code_ventilation ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as l";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " WHERE f.rowid = l.fk_facture AND f.fk_statut = 1 AND l.rowid = ".$_GET["id"];
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num_lignes = $db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
if ($num_lignes)
|
||||
{
|
||||
|
||||
$objp = $db->fetch_object();
|
||||
|
||||
|
||||
if($objp->fk_code_ventilation == 0)
|
||||
{
|
||||
print '<form action="fiche.php?id='.$_GET["id"].'" method="post">'."\n";
|
||||
print '<input type="hidden" name="action" value="ventil">';
|
||||
}
|
||||
|
||||
|
||||
print_titre("Ventilation");
|
||||
|
||||
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print '<tr><td>Facture</td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$objp->facid.'">'.$objp->facnumber.'</a></td></tr>';
|
||||
|
||||
print '<tr><td width="20%">Ligne</td>';
|
||||
print '<td>'.stripslashes(nl2br($objp->description)).'</td></tr>';
|
||||
print '<tr><td width="20%">Email de commande</td><td>';
|
||||
|
||||
if($objp->fk_code_ventilation == 0)
|
||||
{
|
||||
print $form->select_array("codeventil",$cgs, $objp->fk_code_ventilation);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $cgs[$objp->fk_code_ventilation];
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
if($objp->fk_code_ventilation == 0)
|
||||
{
|
||||
print '<tr><td> </td><td><input type="submit" value="'.$langs->trans("Ventiler").'"></td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Error";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Error";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Error";
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
105
htdocs/compta/ventilation/index.php
Normal file
105
htdocs/compta/ventilation/index.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/*!
|
||||
\file htdocs/compta/index.php
|
||||
\ingroup compta
|
||||
\brief Page accueil zone comptabilité
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
$user->getrights('banque');
|
||||
|
||||
$langs->load("compta");
|
||||
|
||||
/*
|
||||
* Sécurité accés client
|
||||
*/
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socidp = $user->societe_id;
|
||||
}
|
||||
|
||||
llxHeader("","Accueil Compta");
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'add_bookmark')
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark WHERE fk_soc = ".$socidp." AND fk_user=".$user->id;
|
||||
if (! $db->query($sql) )
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_soc, dateb, fk_user) VALUES ($socidp, now(),".$user->id.");";
|
||||
if (! $db->query($sql) )
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'del_bookmark')
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark WHERE rowid=$bid";
|
||||
$result = $db->query($sql);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Affichage page
|
||||
*
|
||||
*/
|
||||
print_titre("Espace ventilation");
|
||||
|
||||
print '<table border="0" width="100%">';
|
||||
|
||||
print '<tr><td valign="top" width="30%">';
|
||||
|
||||
/*
|
||||
* Zone recherche facture
|
||||
*/
|
||||
print '<form method="post" action="facture.php">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<td colspan="2">Rechercher une facture</td></tr>';
|
||||
print "<tr $bc[0]><td>";
|
||||
print $langs->trans("Ref").' : <input type="text" name="sf_ref"> <input type="submit" value="'.$langs->trans("Search").'" class="flat"></td></tr>';
|
||||
print "</table></form><br>";
|
||||
|
||||
print '</td><td width="70%"> ';
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
119
htdocs/compta/ventilation/liste.php
Normal file
119
htdocs/compta/ventilation/liste.php
Normal file
@ -0,0 +1,119 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/*! \file htdocs/compta/facture.php
|
||||
\ingroup facture
|
||||
\brief Page de création d'une facture
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
$user->getrights('facture');
|
||||
$user->getrights('banque');
|
||||
|
||||
if (!$user->rights->facture->lire)
|
||||
accessforbidden();
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
require_once "../../facture.class.php";
|
||||
require_once "../../paiement.class.php";
|
||||
|
||||
|
||||
if ($_GET["socidp"]) { $socidp=$_GET["socidp"]; }
|
||||
/*
|
||||
* Sécurité accés client
|
||||
*/
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socidp = $user->societe_id;
|
||||
}
|
||||
|
||||
llxHeader('',$langs->trans("Bill"),'Facture');
|
||||
|
||||
/*
|
||||
* Lignes de factures
|
||||
*
|
||||
*/
|
||||
$page = $_GET["page"];
|
||||
if ($page < 0) $page = 0;
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_taux, l.remise_percent, l.subprice, ".$db->pdate("l.date_start")." as date_start, ".$db->pdate("l.date_end")." as date_end, l.fk_code_ventilation ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as l";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " WHERE f.rowid = l.fk_facture AND f.fk_statut = 1 AND fk_code_ventilation = 0";
|
||||
$sql .= " ORDER BY l.rowid DESC";
|
||||
$sql .= $db->plimit($limit+1,$offset);
|
||||
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num_lignes = $db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
print_barre_liste("Lignes de facture à ventiler",$page,"liste.php","",$sortfield,$sortorder,'',$num_lignes);
|
||||
|
||||
if ($num_lignes)
|
||||
{
|
||||
echo '<table class="noborder" width="100%">';
|
||||
print "<tr class=\"liste_titre\"><td>Facture</td>";
|
||||
print '<td width="54%">'.$langs->trans("Description").'</td>';
|
||||
print '<td width="20%" align="right">'.$langs->trans("VAT").'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
$var=True;
|
||||
while ($i < min($num_lignes, $limit))
|
||||
{
|
||||
$objp = $db->fetch_object();
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$objp->facid.'">'.$objp->facnumber.'</a></td>';
|
||||
|
||||
|
||||
print '<td>'.stripslashes(nl2br($objp->description)).'</td>';
|
||||
|
||||
print '<td align="right"><a href="fiche.php?id='.$objp->rowid.'">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
|
||||
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print $db->error();
|
||||
}
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
107
htdocs/compta/ventilation/pre.inc.php
Normal file
107
htdocs/compta/ventilation/pre.inc.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/*!
|
||||
\file htdocs/compta/pre.inc.php
|
||||
\ingroup compta
|
||||
\brief Fichier gestionnaire du menu compta
|
||||
*/
|
||||
|
||||
require("../../main.inc.php");
|
||||
$user->getrights('');
|
||||
|
||||
function llxHeader($head = "", $title="", $help_url='')
|
||||
{
|
||||
global $user, $conf, $langs;
|
||||
|
||||
top_menu($head, $title);
|
||||
|
||||
$menu = new Menu();
|
||||
|
||||
// Les recettes
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/compta/clients.php", $langs->trans("Customers"));
|
||||
|
||||
if ($user->comm > 0 && $conf->commercial->enabled && $conf->propal->enabled)
|
||||
{
|
||||
$langs->load("propal");
|
||||
$menu->add(DOL_URL_ROOT."/compta/propal.php",$langs->trans("Prop"));
|
||||
}
|
||||
|
||||
if ($conf->contrat->enabled)
|
||||
{
|
||||
$langs->load("contracts");
|
||||
$menu->add(DOL_URL_ROOT."/contrat/",$langs->trans("Contracts"));
|
||||
}
|
||||
|
||||
if ($conf->don->enabled)
|
||||
{
|
||||
$langs->load("donations");
|
||||
$menu->add(DOL_URL_ROOT."/compta/dons/",$langs->trans("Donations"));
|
||||
}
|
||||
|
||||
if ($conf->facture->enabled)
|
||||
{
|
||||
$langs->load("bills");
|
||||
$menu->add(DOL_URL_ROOT."/compta/facture.php",$langs->trans("Bills"));
|
||||
}
|
||||
|
||||
|
||||
// Les dépenses
|
||||
if ($conf->fournisseur->enabled)
|
||||
{
|
||||
$langs->load("suppliers");
|
||||
$menu->add(DOL_URL_ROOT."/fourn/index.php", $langs->trans("Suppliers"));
|
||||
}
|
||||
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
$menu->add(DOL_URL_ROOT."/compta/deplacement/", "Déplacement");
|
||||
}
|
||||
|
||||
if ($conf->compta->enabled && $conf->compta->tva && $user->societe_id == 0)
|
||||
{
|
||||
$menu->add(DOL_URL_ROOT."/compta/tva/index.php",$langs->trans("VAT"));
|
||||
}
|
||||
|
||||
if ($conf->compta->enabled)
|
||||
{
|
||||
$menu->add(DOL_URL_ROOT."/compta/charges/index.php","Charges");
|
||||
}
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/compta/ventilation/",$langs->trans("Ventilation"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/compta/ventilation/liste.php",$langs->trans("A ventiler"));
|
||||
|
||||
if ($user->rights->compta->ventilation->param)
|
||||
$menu->add(DOL_URL_ROOT."/compta/param/",$langs->trans("Param"));
|
||||
|
||||
if (! $user->compta)
|
||||
{
|
||||
$menu->clear();
|
||||
$menu->add(DOL_URL_ROOT."/",$langs->trans("Home"));
|
||||
}
|
||||
|
||||
left_menu($menu->liste, $help_url);
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user