diff --git a/mondumas.egg-info/PKG-INFO b/mondumas.egg-info/PKG-INFO index dc19f33..a3fe2df 100644 --- a/mondumas.egg-info/PKG-INFO +++ b/mondumas.egg-info/PKG-INFO @@ -2,57 +2,55 @@ Metadata-Version: 2.1 Name: mondumas Version: 1.0 Summary: mondumas -Home-page: UNKNOWN +Home-page: Author: Author-email: -License: UNKNOWN -Description: # README # - - Cette application web permet aux collaborateurs de l'entreprise Dumas : - - - de consulter et de gérer les dossiers des clients depuis leur tablette - - de créer un rapport de fuite et le faire signer par le client - - Elle est développée avec les composants open source suivants : - - ## Backend - - - [Python](https://www.python.org/downloads/) 3.7 - - [Pyramid web framework](https://trypyramid.com/) 1.10 - - [MySQL server](https://mysql.com/) 5.7 sur Windows Server 2008 R2 Standard - - [Apache web server](https://apache.org/) 2.4 sur Debian GNU/Linux 9 (stretch) - - ## Frontend - - - [Bootstrap framework](https://getbootstrap.com/) for CSS 3.3.7 - - [Jquery](https://jquery.com/download/) for JavaScript 3.2.1 - - Chameleon templates - - [FormValidation](https://formvalidation.io/) form validator 0.7.0 - - ## Jquery Plugins - - - [DataTables](https://datatables.net/) 1.10.20 - - [Fullcalendar](https://fullcalendar.io/) 3.9.0 - - [fullcalendar Scheduler](https://fullcalendar.io/) 1.9.4 - - [Jquery-ui et jquery-ui-themes](https://jqueryui.com/) 1.12.1 - - [jSignature](https://willowsystems.github.io/jSignature) - - [less.js](http://lesscss.org/) 3.11.1 - - [moment.js](https://momentjs.com/) with-locales.min.js - - - [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo) - - - - 0.0 - --- - - - Initial version - Keywords: web wsgi bfg pylons pyramid -Platform: UNKNOWN Classifier: Programming Language :: Python Classifier: Framework :: Pyramid Classifier: Topic :: Internet :: WWW/HTTP Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Application Provides-Extra: testing + +# README # + +Cette application web permet aux collaborateurs de l'entreprise Dumas : + + - de consulter et de gérer les dossiers des clients depuis leur tablette + - de créer un rapport de fuite et le faire signer par le client + +Elle est développée avec les composants open source suivants : + +## Backend + +- [Python](https://www.python.org/downloads/) 3.7 +- [Pyramid web framework](https://trypyramid.com/) 1.10 +- [MySQL server](https://mysql.com/) 5.7 sur Windows Server 2008 R2 Standard +- [Apache web server](https://apache.org/) 2.4 sur Debian GNU/Linux 9 (stretch) + +## Frontend + +- [Bootstrap framework](https://getbootstrap.com/) for CSS 3.3.7 +- [Jquery](https://jquery.com/download/) for JavaScript 3.2.1 +- Chameleon templates +- [FormValidation](https://formvalidation.io/) form validator 0.7.0 + +## Jquery Plugins + +- [DataTables](https://datatables.net/) 1.10.20 +- [Fullcalendar](https://fullcalendar.io/) 3.9.0 +- [fullcalendar Scheduler](https://fullcalendar.io/) 1.9.4 +- [Jquery-ui et jquery-ui-themes](https://jqueryui.com/) 1.12.1 +- [jSignature](https://willowsystems.github.io/jSignature) +- [less.js](http://lesscss.org/) 3.11.1 +- [moment.js](https://momentjs.com/) with-locales.min.js + + +[Learn Markdown](https://bitbucket.org/tutorials/markdowndemo) + + + +0.0 +--- + +- Initial version diff --git a/mondumas.egg-info/entry_points.txt b/mondumas.egg-info/entry_points.txt index 19e4c93..1454dfe 100644 --- a/mondumas.egg-info/entry_points.txt +++ b/mondumas.egg-info/entry_points.txt @@ -1,4 +1,2 @@ - [paste.app_factory] - main = mondumas:main - [console_scripts] - \ No newline at end of file +[paste.app_factory] +main = mondumas:main diff --git a/mondumas.egg-info/requires.txt b/mondumas.egg-info/requires.txt index 311dd41..bc50042 100644 --- a/mondumas.egg-info/requires.txt +++ b/mondumas.egg-info/requires.txt @@ -8,7 +8,7 @@ SQLAlchemy==1.2.19 transaction zope.sqlalchemy==1.1 waitress -mysqlclient==2.1 +mysqlclient==1.4 docutils pdfkit python-dateutil diff --git a/mondumas/models/devis.py b/mondumas/models/devis.py index c14b7fa..3db1631 100644 --- a/mondumas/models/devis.py +++ b/mondumas/models/devis.py @@ -25,19 +25,23 @@ def execute_query(request, query, params): mark_changed(request.dbsession) transaction.commit() -def get_devis_byName(request, societe, name): - numero = to_int(name) + +def get_dossiers_byName(request, societe, name): + # lires tous les dossiers d'un chantier - if numero > 0: - query = """SELECT date,'DE' AS TYPE, LPAD(no_id,6,'0') AS numero, nomcli, CONCAT(c_nom,'; ',c_adr,'; ',c_ville) AS chantier, COALESCE(totalht,0) AS montant, status, nosin, nopol, nochantier, web - FROM devis WHERE societe=:societe AND no_id >=:name AND web = 'W' LIMIT 300;;""" % (societe, name) - elif len(name) == 0: - query = """SELECT date,'DE' AS TYPE, LPAD(no_id,6,'0') AS numero, nomcli, CONCAT(c_nom,'; ',c_adr,'; ',c_ville) AS chantier, COALESCE(totalht,0) AS montant, status, nosin, nopol, nochantier, web - FROM devis WHERE societe=:societe AND web = 'W' ORDER BY no_id DESC LIMIT 300;""" - else: - query = """(SELECT date,'DE' AS TYPE, LPAD(no_id,6,'0') AS numero, nomcli, CONCAT(c_nom,'; ',c_adr,'; ',c_ville) AS chantier, COALESCE(totalht,0) AS montant, status, nosin, nopol , nochantier, web - FROM devis WHERE societe=:societe AND c_nom LIKE ':name%' AND web = 'W' LIMIT 500)""" - results = request.dbsession.execute(query, {'societe': societe, 'name': name}).fetchall() + query = """select * from ( + SELECT date,'DD' AS TYPE, LPAD(no_id,6,'0') AS numero, nomcli, CONCAT(c_nom,'; ',c_adr,'; ',c_ville) AS chantier, 0 AS montant, status, nosin, societe , no_id as nochantier + FROM dem_devis WHERE societe=:societe AND c_nom LIKE :name + UNION + SELECT date,'DE' AS TYPE, LPAD(no_id,6,'0') AS numero, nomcli, CONCAT(c_nom,'; ',c_adr,'; ',c_ville) AS chantier, COALESCE(totalht,0) AS montant, status, nosin, societe , nochantier + FROM devis WHERE societe=:societe AND c_nom LIKE :name + UNION + SELECT date,'FA' AS TYPE, LPAD(no_id,6,'0') AS numero, nomcli, CONCAT(c_nom,'; ',c_adr,'; ',c_ville) AS chantier, COALESCE(totalht,0) AS montant, status, nosin, societe , nochantier + FROM facture WHERE societe=:societe AND c_nom LIKE :name + ) a + order by date, TYPE + """ + results = request.dbsession.execute(query, {'societe': societe, 'name': name+'%'}).fetchall() return results def get_devfac_by_no(request,nodossier): @@ -235,3 +239,14 @@ def update_devis_cloture(request, nodevis, status, logged_in): query = "UPDATE devis SET STATUS = :status, USERMAJ = :logged_in WHERE societe=:societe AND no_id=:nochantier;" execute_query(request, query, {'societe': societe, 'nochantier': nochantier, 'status': status, 'logged_in': logged_in}) +def update_devis_nochantier(request, societe, no_devis, nochantier): + # extraire type de doc et no de doc à mettre à jour + type = no_devis[0:2] + no_id = no_devis[3:] + if type == 'DE': + # maj le numero du dossier du devis + query = "UPDATE devis SET nochantier = :nochantier WHERE societe=:societe AND no_id=:no_id;" + else: + # maj le numero du dossier de la facture + query = "UPDATE facture SET nochantier = :nochantier WHERE societe=:societe AND no_id=:no_id;" + execute_query(request, query, {'societe': societe, 'nochantier': nochantier, 'no_id': no_id}) diff --git a/mondumas/routes.py b/mondumas/routes.py index 77edd74..b91b04c 100644 --- a/mondumas/routes.py +++ b/mondumas/routes.py @@ -22,8 +22,9 @@ def includeme(config): # devis config.add_route('devis_ligne', '/devis_ligne/{type_ligne}/{nodevis}/{nolig}') config.add_route('devis_lig_mv', '/devis_lig_mv/{move}/{nodevis}/{nolig}') - config.add_route('devis_list', '/devis_list') + config.add_route('devis_list', '/devis_list/{societe}/{nodevis}') config.add_route('devis_create', '/devis_create/{nodossier}') + config.add_route('devis_nochantier', '/devis_nochantier/{societe}/{nodevis}/{nochantier}') config.add_route('devis_web', '/devis_web/{nodevis}') config.add_route('devis_view', '/devis_view/{nodevis}') config.add_route('devis_preview', '/devis_preview/{nodevis}') diff --git a/mondumas/templates/default/home.pt b/mondumas/templates/default/home.pt index 32ebfe3..78ef56f 100644 --- a/mondumas/templates/default/home.pt +++ b/mondumas/templates/default/home.pt @@ -133,11 +133,11 @@
- +
- +
- E-DEVIS + RECHERCHE DEVIS
diff --git a/mondumas/templates/devis/devis_list.pt b/mondumas/templates/devis/devis_list.pt index 2bcc91a..afea3fb 100644 --- a/mondumas/templates/devis/devis_list.pt +++ b/mondumas/templates/devis/devis_list.pt @@ -27,10 +27,9 @@
- +
- +
@@ -53,19 +52,20 @@ Client Chantier Montant - Sinistre - Statut + No chantier + Action - - - ${societe}-${detail.numero}-W - + + ${detail.TYPE}-${detail.numero} ${detail.date.strftime('%d-%m-%Y')} ${detail.nomcli} ${detail.chantier} ${layout.to_euro(detail.montant)} - ${detail.nosin} - ${detail.status} + ${detail.nochantier} + + Joindre + @@ -74,26 +74,53 @@
+ + + diff --git a/mondumas/views/devis.py b/mondumas/views/devis.py index 5a2bb4b..1342cc7 100644 --- a/mondumas/views/devis.py +++ b/mondumas/views/devis.py @@ -21,35 +21,49 @@ from ..models.devis import * @view_config(route_name='devis_list', renderer='../templates/devis/devis_list.pt', permission='view') def devis_list(request): + societe = request.matchdict['societe'] + nodevis = request.matchdict['nodevis'] + try: + int(nodevis) + except: + message = "Numero de Devis incorrect : %s" % societe + '-' + nodevis - url = request.route_url('devis_list') - logged_in = request.authenticated_userid.upper() message = '' - member = get_member_by_id(request, logged_in) - societe_defaut = member.societe - societe = societe_defaut - access_defaut = member.access - liste=[] - name = '' - cb_tous = "non" + dossiers=None if 'form.submitted' in request.params: - name = request.params['name'] societe = request.params['societe'] - - # lire les devis - devis = get_devis_byName(request, societe, name) - if len(devis) == 0: - message = "Devis non trouvé : %s" % name + nodevis = request.params['nodevis'] + + if 'form.joined' in request.params: + md_nochantier = request.params['md_nochantier'] + md_nodevis = request.params['md_nodevis'] + md_societe = request.params['md_societe'] + + # modifier un devis à partir d'un dossier + update_devis_nochantier(request, md_societe, md_nodevis, md_nochantier) + + message = "Le devis %s a été modifié avec succès : " % md_nodevis + + url = request.route_url('devis_list', societe=societe, nodevis=nodevis) + if nodevis != '0': + # lire le devis + devis = get_devis_by_no(request, societe + '-DE' + nodevis) + if devis == None: + message = "Devis non trouvé : %s" % societe + '-' + nodevis + else: + # lire tous les dossiers du chantiers + dossiers = get_dossiers_byName(request, societe, devis.C_NOM) + return { 'page_title': "Rechercher un devis", 'url': url, 'message': message, - 'devis': devis, + 'dossiers': dossiers, 'societe': societe, - 'name': name, + 'nodevis': nodevis, } @view_config(route_name='devis_create', permission='view') @@ -64,6 +78,17 @@ def devis_create(request): request.session.flash(u"Le devis %s a été créé avec succès" % no_devis.last_insert_id, 'success') return HTTPFound(location=request.route_url("dossier_view", nodossier=nodossier) + '#tab_documents') +@view_config(route_name='devis_nochantier', permission='view') +def devis_nochantier(request): + societe = request.matchdict['societe'] + nodevis = request.matchdict['nodevis'] + nochantier = request.matchdict['nochantier'] + + # modifier un devis à partir d'un dossier + update_devis_nochantier(request, societe, nodevis, nochantier) + + request.session.flash(u"Le devis %s a été modifié avec succès : " + nodevis, 'success') + return HTTPFound(location=request.route_url("devis_list", societe=societe, nodevis=nodevis)) @view_config(route_name='devis_view', renderer='../templates/devis/devis_view.pt', permission='view') diff --git a/setup.py b/setup.py index a98d0b3..70f21d2 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ requires = [ 'transaction', 'zope.sqlalchemy == 1.1', 'waitress', - 'mysqlclient == 2.1', + 'mysqlclient == 1.4', 'docutils', 'pdfkit', 'python-dateutil',