Ajout des modules initiaux
darcs-hash:20070124114812-f46e9-171ef12f1e1b89ae005adf4aab6f6535fb9289e6.gz
This commit is contained in:
parent
8713311bc1
commit
ed3ab40ccd
80 changed files with 4852 additions and 5 deletions
140
intranet/modules/gestionFactures/main.py
Executable file
140
intranet/modules/gestionFactures/main.py
Executable file
|
@ -0,0 +1,140 @@
|
|||
#! /usr/bin/env python
|
||||
# -*- coding: iso-8859-15 -*-
|
||||
# ##################################################################################################### #
|
||||
# Factures (gestion)
|
||||
# ##################################################################################################### #
|
||||
# Description:
|
||||
# Permet de chercher dans les facture, d'en créditer et d'en supprimer
|
||||
# Informations:
|
||||
#
|
||||
# Pages:
|
||||
# index:afiche le formulaire et les factures
|
||||
#
|
||||
# ##################################################################################################### #
|
||||
import cherrypy, sys, os, datetime
|
||||
import crans.cp
|
||||
from ClassesIntranet.ModuleBase import ModuleBase
|
||||
|
||||
class main(ModuleBase):
|
||||
_droits = ["Imprimeur"]
|
||||
def title(self):
|
||||
return "Gestion factures"
|
||||
def category(self):
|
||||
return "Imprimeur"
|
||||
|
||||
def index(self, message = '', erreur = ''):
|
||||
if cherrypy.session.has_key('gestion_factures-current_search'):
|
||||
del cherrypy.session['gestion_factures-current_search']
|
||||
return self.displayTemplate()
|
||||
index.exposed = True
|
||||
|
||||
def search(self, fid=None, uid=None, aid=None):
|
||||
cherrypy.session['gestion_factures-current_search'] = {
|
||||
"fid":fid,
|
||||
"uid":uid,
|
||||
"aid":aid,
|
||||
}
|
||||
return self.displayTemplate()
|
||||
search.exposed = True
|
||||
|
||||
|
||||
|
||||
def displayTemplate(self, message = '', erreur = ''):
|
||||
t = {}
|
||||
t['message'] = message
|
||||
t['error'] = erreur
|
||||
if cherrypy.session.has_key('gestion_factures-current_search'):
|
||||
fid = cherrypy.session['gestion_factures-current_search']['fid']
|
||||
uid = cherrypy.session['gestion_factures-current_search']['uid']
|
||||
aid = cherrypy.session['gestion_factures-current_search']['aid']
|
||||
t['listeFactures'] = self.buildInvoiceList(
|
||||
fid = fid,
|
||||
uid = uid,
|
||||
aid = aid,
|
||||
)
|
||||
|
||||
else:
|
||||
fid = ""
|
||||
uid = ""
|
||||
aid = ""
|
||||
t["form"] = []
|
||||
t["form"]+= [{'name':'fid', 'label':'fid', 'value':fid}]
|
||||
t["form"]+= [{'name':'uid', 'label':'login', 'value':uid}]
|
||||
t["form"]+= [{'name':'aid', 'label':'aid', 'value':aid}]
|
||||
|
||||
return {
|
||||
'template' :'factures-gestion',
|
||||
'values' :t,
|
||||
'stylesheets' :['cransFactures.css'],
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
def buildInvoiceList(self, fid=None, uid=None, aid=None):
|
||||
############## liste des factures ##############
|
||||
if fid:
|
||||
search_string = "fid=%s" % str(fid)
|
||||
liste_factures_ldap = cherrypy.session['LDAP'].search(search_string)['facture']
|
||||
elif uid:
|
||||
search_string = "uid=%s" % str(uid)
|
||||
try:
|
||||
liste_factures_ldap = cherrypy.session['LDAP'].search(search_string)['adherent'][0].factures()
|
||||
except:
|
||||
liste_factures_ldap = []
|
||||
elif aid:
|
||||
search_string = "aid=%s" % str(aid)
|
||||
try:
|
||||
liste_factures_ldap = cherrypy.session['LDAP'].search(search_string)['adherent'][0].factures()
|
||||
except:
|
||||
liste_factures_ldap = []
|
||||
else:
|
||||
return []
|
||||
liste_factures_affichees = []
|
||||
for f in liste_factures_ldap:
|
||||
try:
|
||||
facture = {}
|
||||
facture['no'] = f.numero()
|
||||
facture['adherent'] = f.proprietaire().mail()
|
||||
facture['montant'] = f.total()
|
||||
facture['payee'] = f.recuPaiement()
|
||||
facture['intitule'] = f.articles()[0]['designation']
|
||||
facture['details'] = [
|
||||
{
|
||||
'intitule':art['designation'],
|
||||
'quantite':art['nombre'],
|
||||
'prixUnitaire':art['pu'],
|
||||
'prixTotal':art['pu']*art['nombre'],
|
||||
} for art in f.articles()]
|
||||
liste_factures_affichees.append(facture)
|
||||
except:
|
||||
crans.cp.log("Facture non affichable : fid=%s" % str(f.numero()), "GESTION FACTURES", 1)
|
||||
|
||||
return liste_factures_affichees
|
||||
|
||||
def delFacture(self, fid):
|
||||
try:
|
||||
# trrouver la factures
|
||||
fact = cherrypy.session['LDAP'].search('fid=' + fid, 'w')['facture'][0]
|
||||
# la supprimer
|
||||
fact.delete()
|
||||
except Exception, e:
|
||||
crans.cp.log(unicode(e), "GESTION FACTURES", 1)
|
||||
return self.index(erreur=u"Probleme lors de la suppression")
|
||||
crans.cp.log(u"Facture supprimee [fid=%s]" % fid, "GESTION FACTURES")
|
||||
return self.displayTemplate(message=u"Facture suprimée")
|
||||
delFacture.exposed = True
|
||||
|
||||
def crediteFacture(self, fid):
|
||||
try:
|
||||
# trrouver la factures
|
||||
fact = cherrypy.session['LDAP'].search('fid=' + fid, 'w')['facture'][0]
|
||||
# la supprimer
|
||||
fact.recuPaiement(cherrypy.session['uid'])
|
||||
fact.save()
|
||||
except Exception, e:
|
||||
crans.cp.log("pb crédit", "GESTION FACTURES", 1)
|
||||
return self.index(erreur=u"Problème lors du crédit")
|
||||
crans.cp.log("Facture creditee [fid=%s]" % fid, "GESTION FACTURES")
|
||||
return self.displayTemplate(message=u"Facture créditée")
|
||||
crediteFacture.exposed = True
|
205
intranet/modules/gestionFactures/static/cransFactures.css
Normal file
205
intranet/modules/gestionFactures/static/cransFactures.css
Normal file
|
@ -0,0 +1,205 @@
|
|||
/********************************************
|
||||
* <!-- disposition générale -->
|
||||
********************************************/
|
||||
#globalDiv {
|
||||
//padding-left:20%;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
ul#actionMenu {
|
||||
list-style-type:none;
|
||||
width:18%;
|
||||
padding:0;
|
||||
float:left;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size:1.4em;
|
||||
margin:2px;
|
||||
}
|
||||
td, tr {
|
||||
margin:0;
|
||||
}
|
||||
|
||||
#factureListDiv {
|
||||
padding:5px;
|
||||
background:#fad163;
|
||||
float:left;
|
||||
width:75%;
|
||||
}
|
||||
|
||||
#factureListDiv table#listeFactures {
|
||||
padding:0;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.factureRow {
|
||||
margin:2px;
|
||||
position:relative;
|
||||
}
|
||||
|
||||
.help_text {
|
||||
background:#fff7D7;
|
||||
font-weight:normal;
|
||||
padding:10px 20px;
|
||||
|
||||
}
|
||||
|
||||
.factureRow .factureSummary {
|
||||
background:#fff7D7;
|
||||
height:30px;
|
||||
font-weight:bold;
|
||||
padding:10px 20px;
|
||||
}
|
||||
|
||||
.factureRow .factureSummary span.intitule {
|
||||
float:left;
|
||||
}
|
||||
|
||||
.factureRow .factureSummary span.montant {
|
||||
float:right;
|
||||
text-align:right;
|
||||
}
|
||||
|
||||
.tdNoFactures {
|
||||
text-align:center;
|
||||
font-size:1.2em;
|
||||
background-color:#fff7D7;
|
||||
color:#666;
|
||||
margin:0;
|
||||
padding:5px;
|
||||
}
|
||||
|
||||
.facturePayee {
|
||||
}
|
||||
.factureNonPayee .factureSummary {
|
||||
color:red;
|
||||
}
|
||||
|
||||
|
||||
.actions {
|
||||
display:block;
|
||||
float:right;
|
||||
font-size:0.9em;
|
||||
font-weight:normal;
|
||||
}
|
||||
.actions a {
|
||||
margin:2px 10px;
|
||||
}
|
||||
|
||||
/********************************************
|
||||
* <!-- factures - details -->
|
||||
********************************************/
|
||||
|
||||
table.factureDetails {
|
||||
background: #fff7D7 url(fondFacturesDetails.png) repeat-x top;
|
||||
padding:1%;
|
||||
width:96%;
|
||||
margin:0 1% 10px 1%;
|
||||
}
|
||||
|
||||
.tdTotalDetail,
|
||||
.tdTotalDetailIntitule {
|
||||
border-top:thin black solid;
|
||||
}
|
||||
|
||||
.tdTotalDetailIntitule {
|
||||
text-align:right;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
table.factureDetails th {
|
||||
border-bottom:thin black solid;
|
||||
}
|
||||
table.factureDetails th,
|
||||
table.factureDetails td {
|
||||
border-right:thin black solid;
|
||||
margin:0;
|
||||
padding:5px 20px;
|
||||
}
|
||||
|
||||
/********************************************
|
||||
* <!-- factures - divers -->
|
||||
********************************************/
|
||||
.note {
|
||||
display:block;
|
||||
font-size:small;
|
||||
margin:3px;
|
||||
font-weight:normal;
|
||||
}
|
||||
.note {
|
||||
color:#666
|
||||
}
|
||||
|
||||
.linkToggle {
|
||||
display:block;
|
||||
float:left;
|
||||
height:15px;
|
||||
width:15px;
|
||||
background:transparent url(fl.png) top left;
|
||||
margin-right:1px;
|
||||
}
|
||||
|
||||
/********************************************
|
||||
* <!-- factures - historique -->
|
||||
********************************************/
|
||||
|
||||
table#historique_sous {
|
||||
width:100%;
|
||||
}
|
||||
|
||||
table#historique_sous td {
|
||||
background:#fff7D7;
|
||||
padding:5px;
|
||||
text-align:center;
|
||||
border-top:2px #fad163 solid;
|
||||
}
|
||||
|
||||
table#historique_sous th {
|
||||
background:#fff7D7;
|
||||
padding:5px;
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
/********************************************
|
||||
* <!-- factures - recherche -->
|
||||
********************************************/
|
||||
|
||||
form.search {
|
||||
display:block;
|
||||
border: thin black solid;
|
||||
padding:.2em 1em;
|
||||
float:left;
|
||||
//position:absolute;
|
||||
width:18%;
|
||||
//top:0;
|
||||
//left:0;
|
||||
margin:0 1%;
|
||||
}
|
||||
|
||||
form.search input {
|
||||
max-width:95%;
|
||||
margin:.3em;
|
||||
float:left;
|
||||
border: thin gray solid;
|
||||
}
|
||||
|
||||
form.search label {
|
||||
padding-top:7px;
|
||||
display:block;
|
||||
width:4em;
|
||||
float:left;
|
||||
clear:left;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
form.search h3 {
|
||||
margin:.2em 0;
|
||||
}
|
||||
|
||||
form.search input.button {
|
||||
margin:.5em;
|
||||
text-align:center;
|
||||
clear:left;
|
||||
}
|
||||
|
BIN
intranet/modules/gestionFactures/static/fl.png
Normal file
BIN
intranet/modules/gestionFactures/static/fl.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3 KiB |
BIN
intranet/modules/gestionFactures/static/fondFacturesDetails.png
Normal file
BIN
intranet/modules/gestionFactures/static/fondFacturesDetails.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3 KiB |
BIN
intranet/modules/gestionFactures/static/icon.png
Normal file
BIN
intranet/modules/gestionFactures/static/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
|
@ -0,0 +1,45 @@
|
|||
<div id="messagePlaceHolder"></div>
|
||||
|
||||
<div id="globalDiv" onclick="setMessage();">
|
||||
<ul id="actionMenu">
|
||||
<li><a href="index">Mes factures PayPal</a></li>
|
||||
<li><a href="historique">Historique des transactions</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<div id="factureListDiv">
|
||||
<h1>Historique</h1>
|
||||
<div style="overflow:auto;">
|
||||
<table id="historique_sous" cellspacing="0">
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Intitulé</th>
|
||||
<th>Débit</th>
|
||||
<th>Crédit</th>
|
||||
</tr>
|
||||
#for anItem in $historic_items
|
||||
<tr>
|
||||
<td>$anItem.date</td>
|
||||
<td>$anItem.intitule</td>
|
||||
#if $anItem.type=="debit"
|
||||
<td>$anItem.montant</td>
|
||||
#else
|
||||
<td> <!-- evite que opera fasse des trucs bizarres... --></td>
|
||||
#end if
|
||||
#if $anItem.type=="credit"
|
||||
<td>$anItem.montant</td>
|
||||
#else
|
||||
<td> <!-- evite que opera fasse des trucs bizarres... --></td>
|
||||
#end if
|
||||
</tr>
|
||||
#end for
|
||||
#if $historic_items == []
|
||||
<tr><td colspan="4" style="color:gray;">
|
||||
AUCUNE TRANSACTION ENREGISTRÉE
|
||||
</td></tr>
|
||||
#end if
|
||||
</table>
|
||||
</div>
|
||||
<!-- ********************** Menu ********************** -->
|
||||
</div>
|
||||
</div>
|
107
intranet/modules/gestionFactures/templates/factures.tmpl
Normal file
107
intranet/modules/gestionFactures/templates/factures.tmpl
Normal file
|
@ -0,0 +1,107 @@
|
|||
<div id="messagePlaceHolder"></div>
|
||||
|
||||
#if $message != ''
|
||||
<script type="text/javascript">setMessage('$message.replace("\'","\\\'")')</script>
|
||||
#end if
|
||||
|
||||
#if $error != ''
|
||||
<script type="text/javascript">setMessage('$error.replace("\'","\\\'")', 'errorMessage')</script>
|
||||
#end if
|
||||
|
||||
<script type="text/javascript">
|
||||
function showDetail(id){
|
||||
slideDown(id, {duration:0.4});
|
||||
var element = document.getElementById("togglelink" + id);
|
||||
element.onclick=null;
|
||||
element.style.backgroundPosition='bottom left';
|
||||
setTimeout("var element = document.getElementById(\'togglelink" + id + "\');element.onclick=function () {hideDetail(\'" + id + "\'); return false;};",450);
|
||||
return false;
|
||||
}
|
||||
function hideDetail(id){
|
||||
slideUp(id, {duration:0.4});
|
||||
var element = document.getElementById("togglelink" + id);
|
||||
element.onclick=null;
|
||||
element.style.backgroundPosition="top left";
|
||||
setTimeout("var element = document.getElementById(\'togglelink" + id + "\');element.onclick=function () {showDetail(\'" + id + "\'); return false;};",450);
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<div id="globalDiv">
|
||||
<ul id="actionMenu">
|
||||
<li><a href="index">Mes factures PayPal</a></li>
|
||||
<li><a href="historique">Historique des transactions</a></li>
|
||||
</ul>
|
||||
|
||||
<div id="factureListDiv">
|
||||
<h1>Mes factures PayPal</h1>
|
||||
<!-- <table id="listeFactures" cellspacing="0" border="0"> -->
|
||||
#for f in $listeFactures
|
||||
#if $f.payee
|
||||
<div class="factureRow facturePayee">
|
||||
#else
|
||||
<div class="factureRow factureNonPayee">
|
||||
#end if
|
||||
<div class="factureSummary">
|
||||
<span class="intitule">
|
||||
#if $f.details.__len__() > 1
|
||||
<a href="#" class="linkToggle" id="togglelinkfacture$f.no" onclick="showDetail('facture$f.no'); return false;"></a>
|
||||
#end if
|
||||
$f.intitule
|
||||
#if not $f.payee
|
||||
(non payée)
|
||||
#end if
|
||||
|
||||
</span>
|
||||
<span class="montant">
|
||||
$f.montant €
|
||||
</span>
|
||||
<span class="note" style="float:left;clear: left;">Crée le -</span>
|
||||
#if not $f.payee
|
||||
<span class="actions">
|
||||
<a href="delFacture?no=$f.no">Annuler</a>
|
||||
<a href="$f.paypal">Payer avec PayPal</a>
|
||||
</span>
|
||||
#else
|
||||
<span class="note" style="float:right;clear:right;">Payée</span>
|
||||
#end if
|
||||
|
||||
</div>
|
||||
#if $f.details.__len__() > 1
|
||||
<div id="facture$f.no" style="display:none;">
|
||||
<table cellspacing="0" border="0" class="factureDetails">
|
||||
<tr>
|
||||
<th style="width:80%">Description</th>
|
||||
<th>Prix unitaire</th>
|
||||
<th>Quantité</th>
|
||||
<th>total</th>
|
||||
</tr>
|
||||
#for unDetail in $f.details
|
||||
<tr>
|
||||
<td>$unDetail.intitule</td>
|
||||
<td>$unDetail.prixUnitaire €</td>
|
||||
<td>$unDetail.quantite</td>
|
||||
<td>$unDetail.prixTotal €</td>
|
||||
</tr>
|
||||
#end for
|
||||
<tr>
|
||||
<td colspan="3" class="tdTotalDetailIntitule">
|
||||
Total
|
||||
</td>
|
||||
<td class="tdTotalDetail">$f.montant €</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
#end if
|
||||
#end for
|
||||
|
||||
#if $listeFactures == []
|
||||
<div class="factureRow tdNoFactures">
|
||||
AUCUNE TRANSACTION PAYPAL ENREGISTRÉE
|
||||
</div>
|
||||
#end if
|
||||
</div>
|
||||
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue