"Jbeal/scripts is public repo"

This commit is contained in:
Doug Le Tough 2017-11-14 08:09:39 +01:00
parent 4f25b1304a
commit 6c72844e64
8 changed files with 53 additions and 30 deletions

View File

@ -270,7 +270,6 @@ div.input_block label {
display: block;
float: left;
width: 200px;
text-align: center;
font-weight: bold;
background-color: #FF5D00;
height: 20px;
@ -284,7 +283,7 @@ div.input_block select, div.input_block input {
float: right;
padding: 0 4px 0 4px;
margin-left: 4px;
text-align: right;
text-align: left;
background-color: #FFFFFF;
border-style: solid;
border-width: 1px;

View File

@ -270,7 +270,6 @@ div.input_block label {
display: block;
float: left;
width: 200px;
text-align: center;
font-weight: bold;
background-color: #FF5D00;
height: 20px;
@ -284,7 +283,7 @@ div.input_block select, div.input_block input {
float: right;
padding: 0 4px 0 4px;
margin-left: 4px;
text-align: right;
text-align: left;
background-color: #FFFFFF;
border-style: solid;
border-width: 1px;

View File

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

View File

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

View File

@ -10,7 +10,7 @@
{% block bodyheader %}
<body>
{% endblock %}
<div class='main_wrapper'>
<div id='main_wrapper' class='main_wrapper'>
<div class='center'>
<div class='banner' title='Stock Tetalab'>
Tetastock
@ -20,8 +20,8 @@
<input type='image' class='menu_button' src='/static/images/menu.png' title='Afficher/Cacher menu' value='' onclick='javascript:switch_css("{{ css }}");' />
<input type='image' src='/static/images/logout.png' title='Se deconnecter' value='' onclick='javascript:logout();' />
</div>
<div class='content_wrapper'>
<div class='left_menu'>
<div id='content_wrapper' class='content_wrapper'>
<div id='left_menu' class='left_menu'>
{% block left_menu %}
<div class='left_menu_item_selected' onclick='javascript:document.location="/";'>
Accueil
@ -36,7 +36,7 @@
Fournisseurs
</div>{% endblock %}
</div>
<div class='content'>
<div id='content' class='content'>
{% block content %}
<h1>Tetastock</h1>
<div class='note'>

View File

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

View File

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

View File

@ -413,18 +413,6 @@ def new_componant():
return 'KO'
return 'OK'
@app.route('/componants/in')
@resume_session
def in_componants():
""" Incoming order """
return render_template('wip.html', css=session[u'css'])
@app.route('/componants/out')
@resume_session
def out_componants():
""" Outgoing order """
return render_template('wip.html', css=session[u'css'])
## Componants update result set
@app.route('/componants/update', methods=['GET', 'POST'])
@resume_session
@ -480,6 +468,43 @@ def update_componants():
sync_cookies(response, session)
return response
########################################################################
# Orders
########################################################################
def compute_mean_price(componant_id, price, quantity):
""" Compute mean price """
try:
componant_id = int(componant_id)
price = float(price)
quantity = float(quantity)
except ValueError:
# bad parameters
return -1
componant = Stock_componants.query.filter_by(id=componant_id).first()
if componant:
actual_mean_price = componant.mean_price
actual_quantity = componant.quantity
actual_total = actual_mean_price * actual_quantity
order_total = price * quantity
grand_total = order_total + actual_total
new_mean_price = grand_total / (actual_quantity + quantity)
return new_mean_price
# Componant does not exist
return -1
@app.route('/orders/in/<componant_id>')
@resume_session
def in_componants(componant_id):
""" Incoming order """
return render_template('wip.html', css=session[u'css'])
@app.route('/orders/out/<componant_id>')
@resume_session
def out_componants(componant_id):
""" Outgoing order """
return render_template('wip.html', css=session[u'css'])
########################################################################
# Providers
########################################################################