2003-03-11 16:27:34 +01:00
< ? PHP
/* Copyright ( C ) 2003 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2004-02-02 23:55:10 +01:00
* Copyright ( C ) 2004 Laurent Destailleur < eldy @ users . sourceforge . net >
2003-03-11 16:27:34 +01:00
*
* 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 " );
2003-03-11 17:01:45 +01:00
llxHeader ();
if ( ! $user -> admin )
{
print " Forbidden " ;
llxfooter ();
exit ;
}
2003-03-11 16:27:34 +01:00
// positionne la variable pour le test d'affichage de l'icone
$facture_addon_var = FACTURE_ADDON ;
2003-04-13 16:25:45 +02:00
$facture_addon_var_pdf = FACTURE_ADDON_PDF ;
2003-05-13 21:08:04 +02:00
$facture_rib_number_var = FACTURE_RIB_NUMBER ;
2004-02-02 23:03:12 +01:00
$facture_chq_number_var = FACTURE_CHQ_NUMBER ;
2004-02-08 18:00:18 +01:00
$facture_tva_option = FACTURE_TVAOPTION ;
2003-03-11 16:27:34 +01:00
if ( $action == 'set' )
{
2004-02-01 01:55:46 +01:00
$sql = " REPLACE INTO " . MAIN_DB_PREFIX . " const SET name = 'FACTURE_ADDON', value=' " . $value . " ', visible=0, type='chaine' " ;
2003-03-11 16:27:34 +01:00
if ( $db -> query ( $sql ))
{
// la constante qui a <20> t<EFBFBD> lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coh<6F> rent
$facture_addon_var = $value ;
}
}
2004-02-02 23:03:12 +01:00
if ( $action == 'setribchq' )
2003-05-13 21:08:04 +02:00
{
2004-02-02 23:03:12 +01:00
$sql = " REPLACE INTO " . MAIN_DB_PREFIX . " const SET name = 'FACTURE_RIB_NUMBER', value=' " . $rib . " ', visible=0 " ;
2003-05-13 21:08:04 +02:00
if ( $db -> query ( $sql ))
{
// la constante qui a <20> t<EFBFBD> lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coh<6F> rent
2004-02-02 23:03:12 +01:00
$facture_rib_number_var = $rib ;
}
$sql = " REPLACE INTO " . MAIN_DB_PREFIX . " const SET name = 'FACTURE_CHQ_NUMBER', value=' " . $chq . " ', visible=0 " ;
if ( $db -> query ( $sql ))
{
// la constante qui a <20> t<EFBFBD> lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coh<6F> rent
$facture_chq_number_var = $chq ;
2003-05-13 21:08:04 +02:00
}
}
2003-04-13 16:25:45 +02:00
if ( $action == 'setpdf' )
{
2004-02-01 01:55:46 +01:00
$sql = " REPLACE INTO " . MAIN_DB_PREFIX . " const SET name = 'FACTURE_ADDON_PDF', value=' " . $value . " ', visible=0 " ;
2003-04-13 16:25:45 +02:00
if ( $db -> query ( $sql ))
{
// la constante qui a <20> t<EFBFBD> lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coh<6F> rent
$facture_addon_var_pdf = $value ;
}
}
2004-02-08 18:00:18 +01:00
if ( $action == 'settvaoption' )
{
$sql = " REPLACE INTO " . MAIN_DB_PREFIX . " const SET name = 'FACTURE_TVAOPTION', value=' " . $optiontva . " ', visible=0, type='chaine' " ;
if ( $db -> query ( $sql ))
{
// la constante qui a <20> t<EFBFBD> lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coh<6F> rent
$facture_tva_option = $optiontva ;
}
}
2003-03-11 16:27:34 +01:00
$dir = " ../includes/modules/facture/ " ;
2004-02-11 21:12:58 +01:00
print_titre ( " Module de num<75> rotation des factures " );
2003-03-11 16:27:34 +01:00
2004-02-08 18:00:18 +01:00
print '<table border="1" cellpadding="3" cellspacing="0" width=\"100%\">' ;
2003-03-11 16:27:34 +01:00
print '<TR class="liste_titre">' ;
print '<td>Nom</td>' ;
print '<td>Info</td>' ;
2004-02-08 18:00:18 +01:00
print '<td align="center" width="60">Activ<69> </td>' ;
print '<td width="80"> </td>' ;
2003-03-11 16:27:34 +01:00
print " </TR> \n " ;
clearstatcache ();
$handle = opendir ( $dir );
while (( $file = readdir ( $handle )) !== false )
{
2003-03-11 16:37:30 +01:00
if ( is_dir ( $dir . $file ) && substr ( $file , 0 , 1 ) <> '.' && substr ( $file , 0 , 3 ) <> 'CVS' )
2003-03-11 16:27:34 +01:00
{
2004-02-11 21:12:58 +01:00
print '<tr class="pair"><td width=\"100\">' ;
2003-03-11 16:27:34 +01:00
echo " $file " ;
print " </td><td> \n " ;
$func = $file . " _get_num_explain " ;
print $func ();
print '</td><td align="center">' ;
if ( $facture_addon_var == " $file " )
{
2003-06-24 16:36:32 +02:00
print '<img src="' . DOL_URL_ROOT . '/theme/' . $conf -> theme . '/img/tick.png" border="0"></a>' ;
2004-02-08 18:00:18 +01:00
print '</td><td align="center">' ;
print ' ' ;
2003-03-11 16:27:34 +01:00
}
else
{
2004-02-08 18:00:18 +01:00
print ' ' ;
print '</td><td align="center">' ;
print '<a href="facture.php?action=set&value=' . $file . '">Activer</a>' ;
2003-03-11 16:27:34 +01:00
}
2004-02-08 18:00:18 +01:00
print " </td></tr> \n " ;
2003-03-11 16:27:34 +01:00
}
}
closedir ( $handle );
print '</table>' ;
2003-04-13 16:25:45 +02:00
/*
* PDF
*/
print_titre ( " Mod<EFBFBD> les de facture pdf " );
2004-02-08 18:00:18 +01:00
print '<table border="1" cellpadding="3" cellspacing="0" width=\"100%\">' ;
2003-04-13 16:25:45 +02:00
print '<TR class="liste_titre">' ;
print '<td>Nom</td>' ;
print '<td>Info</td>' ;
2004-02-08 18:00:18 +01:00
print '<td align="center" width="60">Activ<69> </td>' ;
print '<td width="80"> </td>' ;
2003-04-13 16:25:45 +02:00
print " </TR> \n " ;
clearstatcache ();
$handle = opendir ( $dir );
while (( $file = readdir ( $handle )) !== false )
{
if ( substr ( $file , strlen ( $file ) - 12 ) == '.modules.php' && substr ( $file , 0 , 4 ) == 'pdf_' )
{
$name = substr ( $file , 4 , strlen ( $file ) - 16 );
$classname = substr ( $file , 0 , strlen ( $file ) - 12 );
2004-02-11 21:12:58 +01:00
print '<tr class="pair"><td width=\"100\">' ;
2003-04-13 16:25:45 +02:00
echo " $name " ;
print " </td><td> \n " ;
require_once ( $dir . $file );
$obj = new $classname ();
print $obj -> description ;
print '</td><td align="center">' ;
2003-04-13 16:32:45 +02:00
if ( $facture_addon_var_pdf == " $name " )
2003-04-13 16:25:45 +02:00
{
2003-06-24 16:36:32 +02:00
print '<img src="' . DOL_URL_ROOT . '/theme/' . $conf -> theme . '/img/tick.png" border="0"></a>' ;
2004-02-08 18:00:18 +01:00
print '</td><td align="center">' ;
print ' ' ;
2003-04-13 16:25:45 +02:00
}
else
{
2004-02-08 18:00:18 +01:00
print ' ' ;
print '</td><td align="center">' ;
print '<a href="facture.php?action=setpdf&value=' . $name . '">Activer</a>' ;
2003-04-13 16:25:45 +02:00
}
2004-02-08 18:00:18 +01:00
print " </td></tr> \n " ;
2003-04-13 16:25:45 +02:00
}
}
closedir ( $handle );
print '</table>' ;
2003-03-11 16:27:34 +01:00
2003-05-13 21:08:04 +02:00
/*
*
*
*/
2004-02-02 23:03:12 +01:00
print_titre ( " Mode de r<> glement <20> afficher sur les factures " );
2003-05-13 21:08:04 +02:00
2004-02-08 18:00:18 +01:00
print '<table border="1" cellpadding="3" cellspacing="0" width=\"100%\">' ;
2004-02-02 23:03:12 +01:00
print '<form action="facture.php" method="post">' ;
print '<input type="hidden" name="action" value="setribchq">' ;
print '<tr class="liste_titre">' ;
2004-02-08 18:00:18 +01:00
print '<td>Mode r<> glement <20> proposer</td>' ;
print '<td><input type="submit" value="Modifier"></td>' ;
2004-02-02 23:03:12 +01:00
print " </tr> \n " ;
print '<tr class="pair">' ;
2004-02-08 18:00:18 +01:00
print " <td>Proposer paiement par RIB sur le compte</td> " ;
2004-02-02 23:03:12 +01:00
print " <td><select name= \" rib \" > " ;
print '<option value="0">Ne pas afficher</option>' ;
2004-02-01 01:55:46 +01:00
$sql = " SELECT rowid, label FROM " . MAIN_DB_PREFIX . " bank_account " ;
2003-05-13 21:08:04 +02:00
if ( $db -> query ( $sql ))
{
$num = $db -> num_rows ();
$i = 0 ;
while ( $i < $num )
{
$row = $db -> fetch_row ( $i );
if ( $facture_rib_number_var == $row [ 0 ])
{
2004-02-02 23:03:12 +01:00
print '<option value="' . $row [ 0 ] . '" selected>' . $row [ 1 ] . '</option>' ;
2003-05-13 21:08:04 +02:00
}
else
{
print '<option value="' . $row [ 0 ] . '">' . $row [ 1 ] . '</option>' ;
}
$i ++ ;
}
}
2004-02-02 23:03:12 +01:00
print " </select></td></tr> " ;
print '<tr class="pair">' ;
2004-02-08 18:00:18 +01:00
print " <td>Proposer paiement par ch<63> que <20> l'ordre et adresse du titulaire du compte</td> " ;
2004-02-02 23:03:12 +01:00
print " <td><select name= \" chq \" > " ;
print '<option value="0">Ne pas afficher</option>' ;
$sql = " SELECT rowid, label FROM " . MAIN_DB_PREFIX . " bank_account " ;
if ( $db -> query ( $sql ))
{
$num = $db -> num_rows ();
$i = 0 ;
while ( $i < $num )
{
$row = $db -> fetch_row ( $i );
if ( $facture_chq_number_var == $row [ 0 ])
{
print '<option value="' . $row [ 0 ] . '" selected>' . $row [ 1 ] . '</option>' ;
}
else
{
print '<option value="' . $row [ 0 ] . '">' . $row [ 1 ] . '</option>' ;
}
$i ++ ;
}
}
print " </select></td></tr> " ;
2003-05-13 21:08:04 +02:00
print " </form> " ;
2004-02-02 23:03:12 +01:00
print " </table> " ;
2003-05-13 21:08:04 +02:00
$db -> close ();
2003-06-22 14:16:11 +02:00
/*
* Repertoire
*/
print_titre ( " Chemins d'acc<63> s aux documents " );
2004-02-08 18:00:18 +01:00
print '<table border="1" cellpadding="3" cellspacing="0" width=\"100%\">' ;
2003-06-22 14:16:11 +02:00
print '<TR class="liste_titre">' ;
print '<td>Nom</td><td>Valeur</td>' ;
print " </TR> \n " ;
2004-02-11 21:12:58 +01:00
print '<tr class="pair"><td width=\"140\">R<> pertoire</td><td>' . FAC_OUTPUTDIR . '</td></tr>' ;
print '<tr class="pair"><td width=\"140\">URL</td><td><a href="' . FAC_OUTPUT_URL . '">' . FAC_OUTPUT_URL . '</a></td></tr>' ;
2003-06-22 14:16:11 +02:00
print " </table> " ;
2004-02-08 18:00:18 +01:00
/*
* Options fiscale
*/
print_titre ( " Options fiscales de facturation de la TVA " );
print '<table border="1" cellpadding="3" cellspacing="0" width=\"100%\">' ;
print '<form action="facture.php" method="post">' ;
print '<input type="hidden" name="action" value="settvaoption">' ;
print '<TR class="liste_titre">' ;
print '<td>Option</td><td>Description</td>' ;
print '<td><input type="submit" value="Modifier"></td>' ;
print " </TR> \n " ;
2004-02-11 21:12:58 +01:00
print " <tr class= \" pair \" ><td width= \" 140 \" ><input type= \" radio \" name= \" optiontva \" value= \" reel \" " . ( $facture_tva_option != " franchise " ? " checked " : " " ) . " > Option r<> el</td> " ;
2004-02-08 18:00:18 +01:00
print " <td colspan= \" 2 \" >L'option 'r<> el' est la plus courante. Elle est <20> destination des entreprises et professions lib<69> rales. \n Chaque produits/service vendu est soumis <20> la TVA (Dolibarr propose le taux standard par d<> faut <20> la cr<63> ation d'une facture). Cette derni<6E> re est r<> cup<75> r<EFBFBD> e l'ann<6E> e suivante suite <20> la d<> claration TVA pour les produits/services achet<65> s et est revers<72> e <20> l'<27> tat pour les produits/services vendus.</td></tr> \n " ;
2004-02-11 21:12:58 +01:00
print " <tr class= \" pair \" ><td width= \" 140 \" ><input type= \" radio \" name= \" optiontva \" value= \" franchise \" " . ( $facture_tva_option == " franchise " ? " checked " : " " ) . " > Option franchise</td> " ;
2004-02-11 21:17:50 +01:00
print " <td colspan= \" 2 \" >L'option 'franchise' est utilis<69> e par les particuliers ou professions lib<69> rales <20> titre occasionnel avec de petits chiffres d'affaires. \n Chaque produits/service vendu est soumis <20> une TVA de 0 (Dolibarr propose le taux 0 par d<> faut <20> la cr<63> ation d'une facture cliente). Il n'y a pas de d<> claration ou r<> cup<75> ration de TVA, et les factures qui g<> rent l'option affichent la mention obligatoire \" TVA non applicable - art-293B du CGI \" .</td></tr> \n " ;
2004-02-08 18:00:18 +01:00
print " </form> " ;
print " </table> " ;
2003-06-22 14:16:11 +02:00
llxFooter ( " <em>Dernière modification $Date $ révision $Revision $ </em> " );
2003-03-11 16:27:34 +01:00
?>