"Jbeal/scripts is public repo"
This commit is contained in:
parent
4f25b1304a
commit
6c72844e64
@ -270,7 +270,6 @@ div.input_block label {
|
|||||||
display: block;
|
display: block;
|
||||||
float: left;
|
float: left;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
text-align: center;
|
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
background-color: #FF5D00;
|
background-color: #FF5D00;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
@ -284,7 +283,7 @@ div.input_block select, div.input_block input {
|
|||||||
float: right;
|
float: right;
|
||||||
padding: 0 4px 0 4px;
|
padding: 0 4px 0 4px;
|
||||||
margin-left: 4px;
|
margin-left: 4px;
|
||||||
text-align: right;
|
text-align: left;
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
|
@ -270,7 +270,6 @@ div.input_block label {
|
|||||||
display: block;
|
display: block;
|
||||||
float: left;
|
float: left;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
text-align: center;
|
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
background-color: #FF5D00;
|
background-color: #FF5D00;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
@ -284,7 +283,7 @@ div.input_block select, div.input_block input {
|
|||||||
float: right;
|
float: right;
|
||||||
padding: 0 4px 0 4px;
|
padding: 0 4px 0 4px;
|
||||||
margin-left: 4px;
|
margin-left: 4px;
|
||||||
text-align: right;
|
text-align: left;
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
{% block top_menu %}
|
{% block top_menu %}
|
||||||
<span class='top_menu_item' onclick='javascript:document.location="/componants";'>Rechercher un composant</span>
|
<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_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="/orders/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/out";'>Sortie de stock</span>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block left_menu %}
|
{% block left_menu %}
|
||||||
@ -30,9 +30,9 @@
|
|||||||
À moins de vouloir corriger une erreur de saisie, ou de saisir un inventaire <br/>
|
À 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>
|
vous ne devez <strong>PAS</strong> modifier directement les quantités d'un composant.</p>
|
||||||
<p>Cliquez sur les liens suivants pour saisir des
|
<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
|
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>
|
</div>
|
||||||
<div id='edit' class='main_block'>
|
<div id='edit' class='main_block'>
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
{% block title %}Liste des composants{% endblock %}
|
{% block title %}Liste des composants{% endblock %}
|
||||||
{% block top_menu %}
|
{% block top_menu %}
|
||||||
<span class='top_menu_item_selected' onclick='javascript:document.location="/componants";'>Gestion des composants</span>
|
<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="/orders/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/out";'>Sortie de stock</span>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block left_menu %}
|
{% block left_menu %}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
{% block bodyheader %}
|
{% block bodyheader %}
|
||||||
<body>
|
<body>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
<div class='main_wrapper'>
|
<div id='main_wrapper' class='main_wrapper'>
|
||||||
<div class='center'>
|
<div class='center'>
|
||||||
<div class='banner' title='Stock Tetalab'>
|
<div class='banner' title='Stock Tetalab'>
|
||||||
Tetastock
|
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' 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();' />
|
<input type='image' src='/static/images/logout.png' title='Se deconnecter' value='' onclick='javascript:logout();' />
|
||||||
</div>
|
</div>
|
||||||
<div class='content_wrapper'>
|
<div id='content_wrapper' class='content_wrapper'>
|
||||||
<div class='left_menu'>
|
<div id='left_menu' class='left_menu'>
|
||||||
{% block left_menu %}
|
{% block left_menu %}
|
||||||
<div class='left_menu_item_selected' onclick='javascript:document.location="/";'>
|
<div class='left_menu_item_selected' onclick='javascript:document.location="/";'>
|
||||||
Accueil
|
Accueil
|
||||||
@ -36,7 +36,7 @@
|
|||||||
Fournisseurs
|
Fournisseurs
|
||||||
</div>{% endblock %}
|
</div>{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
<div class='content'>
|
<div id='content' class='content'>
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Tetastock</h1>
|
<h1>Tetastock</h1>
|
||||||
<div class='note'>
|
<div class='note'>
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
{% block top_menu %}
|
{% block top_menu %}
|
||||||
<span class='top_menu_item' onclick='javascript:document.location="/componants";'>Rechercher un composant</span>
|
<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_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="/orders/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/out";'>Sortie de stock</span>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block left_menu %}
|
{% block left_menu %}
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
{% block title %}Liste des composants{% endblock %}
|
{% block title %}Liste des composants{% endblock %}
|
||||||
{% block top_menu %}
|
{% block top_menu %}
|
||||||
<span class='top_menu_item_selected' onclick='javascript:document.location="/componants";'>Gestion des composants</span>
|
<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="/orders/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/out";'>Sortie de stock</span>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block left_menu %}
|
{% block left_menu %}
|
||||||
|
49
tetastock.py
49
tetastock.py
@ -413,18 +413,6 @@ def new_componant():
|
|||||||
return 'KO'
|
return 'KO'
|
||||||
return 'OK'
|
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
|
## Componants update result set
|
||||||
@app.route('/componants/update', methods=['GET', 'POST'])
|
@app.route('/componants/update', methods=['GET', 'POST'])
|
||||||
@resume_session
|
@resume_session
|
||||||
@ -480,6 +468,43 @@ def update_componants():
|
|||||||
sync_cookies(response, session)
|
sync_cookies(response, session)
|
||||||
return response
|
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
|
# Providers
|
||||||
########################################################################
|
########################################################################
|
||||||
|
Loading…
Reference in New Issue
Block a user