Browse Source

"Jbeal/scripts is public repo"

Doug Le Tough 2 years ago
parent
commit
6c72844e64

+ 1
- 2
static/style/style_neutral.css View File

@@ -270,7 +270,6 @@ div.input_block label {
270 270
   display: block;
271 271
   float: left;
272 272
   width: 200px;
273
-  text-align: center;
274 273
   font-weight: bold;
275 274
   background-color: #FF5D00;
276 275
   height: 20px;
@@ -284,7 +283,7 @@ div.input_block select, div.input_block input {
284 283
   float: right;
285 284
   padding: 0 4px 0 4px;
286 285
   margin-left: 4px;
287
-  text-align: right;
286
+  text-align: left;
288 287
   background-color: #FFFFFF;
289 288
   border-style: solid;
290 289
   border-width: 1px;

+ 1
- 2
static/style/style_tth.css View File

@@ -270,7 +270,6 @@ div.input_block label {
270 270
   display: block;
271 271
   float: left;
272 272
   width: 200px;
273
-  text-align: center;
274 273
   font-weight: bold;
275 274
   background-color: #FF5D00;
276 275
   height: 20px;
@@ -284,7 +283,7 @@ div.input_block select, div.input_block input {
284 283
   float: right;
285 284
   padding: 0 4px 0 4px;
286 285
   margin-left: 4px;
287
-  text-align: right;
286
+  text-align: left;
288 287
   background-color: #FFFFFF;
289 288
   border-style: solid;
290 289
   border-width: 1px;

+ 4
- 4
templates/componant.html View File

@@ -3,8 +3,8 @@
3 3
         {% block top_menu %}
4 4
         <span class='top_menu_item' onclick='javascript:document.location="/componants";'>Rechercher un composant</span>
5 5
         <span class='top_menu_item_selected' onclick='javascript:document.location="/componants/{{ componant.id }}";'>Éditer un composant</span>
6
-        <span class='top_menu_item' onclick='javascript:document.location="/componants/in";'>Entrée de stock</span>
7
-        <span class='top_menu_item' onclick='javascript:document.location="/componants/out";'>Sortie de stock</span>
6
+        <span class='top_menu_item' onclick='javascript:document.location="/orders/in";'>Entrée de stock</span>
7
+        <span class='top_menu_item' onclick='javascript:document.location="/orders/out";'>Sortie de stock</span>
8 8
         {% endblock %}
9 9
 
10 10
           {% block left_menu %}
@@ -30,9 +30,9 @@
30 30
                 À moins de vouloir corriger une erreur de saisie, ou de saisir un inventaire <br/>
31 31
                 vous ne devez <strong>PAS</strong> modifier directement les quantités d'un composant.</p>
32 32
                 <p>Cliquez sur les liens suivants pour saisir des
33
-                <span class='top_menu_item_selected' onclick='javascript:document.location="/componant/in/{{ componant.id }}"'>entrées</span> 
33
+                <span class='top_menu_item_selected' onclick='javascript:document.location="/orders/in/{{ componant.id }}"'>entrées</span> 
34 34
                 ou
35
-                <span class='top_menu_item_selected' onclick='javascript:document.location="/componant/out/{{ componant.id }}"'>sorties</span> de stock.</p>
35
+                <span class='top_menu_item_selected' onclick='javascript:document.location="/orders/out/{{ componant.id }}"'>sorties</span> de stock.</p>
36 36
               </div>
37 37
             </div>
38 38
             <div id='edit' class='main_block'>

+ 2
- 2
templates/componants.html View File

@@ -5,8 +5,8 @@
5 5
 {% block title %}Liste des composants{% endblock %}
6 6
         {% block top_menu %}
7 7
         <span class='top_menu_item_selected' onclick='javascript:document.location="/componants";'>Gestion des composants</span>
8
-        <span class='top_menu_item' onclick='javascript:document.location="/componants/in";'>Entrée de stock</span>
9
-        <span class='top_menu_item' onclick='javascript:document.location="/componants/out";'>Sortie de stock</span>
8
+        <span class='top_menu_item' onclick='javascript:document.location="/orders/in";'>Entrée de stock</span>
9
+        <span class='top_menu_item' onclick='javascript:document.location="/orders/out";'>Sortie de stock</span>
10 10
         {% endblock %}
11 11
         
12 12
           {% block left_menu %}

+ 4
- 4
templates/index.html View File

@@ -10,7 +10,7 @@
10 10
 {% block bodyheader %}
11 11
 <body>
12 12
 {% endblock %}
13
-  <div class='main_wrapper'>
13
+  <div id='main_wrapper' class='main_wrapper'>
14 14
     <div class='center'>
15 15
       <div class='banner' title='Stock Tetalab'>
16 16
         Tetastock
@@ -20,8 +20,8 @@
20 20
         <input type='image' class='menu_button' src='/static/images/menu.png' title='Afficher/Cacher menu' value='' onclick='javascript:switch_css("{{ css }}");' />
21 21
         <input type='image' src='/static/images/logout.png' title='Se deconnecter' value='' onclick='javascript:logout();' />
22 22
       </div>
23
-      <div class='content_wrapper'>
24
-        <div class='left_menu'>
23
+      <div id='content_wrapper' class='content_wrapper'>
24
+        <div id='left_menu' class='left_menu'>
25 25
           {% block left_menu %}
26 26
           <div class='left_menu_item_selected' onclick='javascript:document.location="/";'>
27 27
             Accueil
@@ -36,7 +36,7 @@
36 36
             Fournisseurs
37 37
           </div>{% endblock %}
38 38
         </div>
39
-        <div class='content'>
39
+        <div id='content' class='content'>
40 40
           {% block content %}
41 41
           <h1>Tetastock</h1>
42 42
           <div class='note'>

+ 2
- 2
templates/new_componant.html View File

@@ -6,8 +6,8 @@
6 6
         {% block top_menu %}
7 7
         <span class='top_menu_item' onclick='javascript:document.location="/componants";'>Rechercher un composant</span>
8 8
         <span class='top_menu_item_selected' onclick='javascript:document.location="/componants/new";'>Nouveau composant</span>
9
-        <span class='top_menu_item' onclick='javascript:document.location="/componants/in";'>Entrée de stock</span>
10
-        <span class='top_menu_item' onclick='javascript:document.location="/componants/out";'>Sortie de stock</span>
9
+        <span class='top_menu_item' onclick='javascript:document.location="/orders/in";'>Entrée de stock</span>
10
+        <span class='top_menu_item' onclick='javascript:document.location="/orders/out";'>Sortie de stock</span>
11 11
         {% endblock %}
12 12
         
13 13
           {% block left_menu %}

+ 2
- 2
templates/test.html View File

@@ -5,8 +5,8 @@
5 5
 {% block title %}Liste des composants{% endblock %}
6 6
         {% block top_menu %}
7 7
         <span class='top_menu_item_selected' onclick='javascript:document.location="/componants";'>Gestion des composants</span>
8
-        <span class='top_menu_item' onclick='javascript:document.location="/componants/in";'>Entrée de stock</span>
9
-        <span class='top_menu_item' onclick='javascript:document.location="/componants/out";'>Sortie de stock</span>
8
+        <span class='top_menu_item' onclick='javascript:document.location="/orders/in";'>Entrée de stock</span>
9
+        <span class='top_menu_item' onclick='javascript:document.location="/orders/out";'>Sortie de stock</span>
10 10
         {% endblock %}
11 11
         
12 12
           {% block left_menu %}

+ 37
- 12
tetastock.py View File

@@ -413,18 +413,6 @@ def new_componant():
413 413
     return 'KO'
414 414
   return 'OK'
415 415
 
416
-@app.route('/componants/in')
417
-@resume_session
418
-def in_componants():
419
-  """ Incoming order """
420
-  return render_template('wip.html', css=session[u'css'])
421
-
422
-@app.route('/componants/out')
423
-@resume_session
424
-def out_componants():
425
-  """ Outgoing order """
426
-  return render_template('wip.html', css=session[u'css'])
427
-
428 416
 ## Componants update result set
429 417
 @app.route('/componants/update', methods=['GET', 'POST'])
430 418
 @resume_session
@@ -480,6 +468,43 @@ def update_componants():
480 468
   sync_cookies(response, session)
481 469
   return response
482 470
 
471
+########################################################################
472
+# Orders
473
+########################################################################
474
+def compute_mean_price(componant_id, price, quantity):
475
+  """ Compute mean price """
476
+  try:
477
+    componant_id = int(componant_id)
478
+    price = float(price)
479
+    quantity = float(quantity)
480
+  except ValueError:
481
+    # bad parameters
482
+    return -1
483
+  componant = Stock_componants.query.filter_by(id=componant_id).first()
484
+  if componant:
485
+    actual_mean_price = componant.mean_price
486
+    actual_quantity = componant.quantity
487
+    actual_total = actual_mean_price * actual_quantity
488
+    order_total = price * quantity
489
+    grand_total = order_total + actual_total
490
+    new_mean_price = grand_total / (actual_quantity + quantity)
491
+    return new_mean_price
492
+  # Componant does not exist
493
+  return -1
494
+
495
+@app.route('/orders/in/<componant_id>')
496
+@resume_session
497
+def in_componants(componant_id):
498
+  """ Incoming order """
499
+  return render_template('wip.html', css=session[u'css'])
500
+
501
+@app.route('/orders/out/<componant_id>')
502
+@resume_session
503
+def out_componants(componant_id):
504
+  """ Outgoing order """
505
+  return render_template('wip.html', css=session[u'css'])
506
+
507
+
483 508
 ########################################################################
484 509
 # Providers
485 510
 ########################################################################

Loading…
Cancel
Save