retouche get tarifs

This commit is contained in:
2021-06-04 12:26:13 +02:00
parent 83860d3c21
commit 1356fc2255
9 changed files with 117 additions and 188 deletions

View File

@@ -302,36 +302,37 @@ def ajax_client(request):
@view_config(route_name='ajax_texte')
def ajax_texte(request):
recherche = request.GET['recherche']
type = recherche[:2]
lib = recherche[2:]
groupe = request.GET['groupe']
libelle = request.GET['libelle']
# import pdb;pdb.set_trace()
# lire les articles commencant par
items = get_article(request, type, lib)
items = get_article(request, 'LIB', groupe, libelle)
liste=[]
for row in items:
if type == 'AR':
d = '%s | %s | %s' % (row.ref_cli2, row.LIBART, to_euro(row.PRIXHT2))
if groupe == 'TEXTE':
d = row.libelle
else:
d = row.LIBART
d = '%s | %s | %s' % (row.ref, row.libelle, to_euro(row.prixht))
liste.append(d)
return Response(json.dumps(liste))
@view_config(route_name='ajax_article')
def ajax_article(request):
groupe = request.GET['groupe']
ref = request.GET['ref']
# lire l'article
items = get_article(request, 'REF2', ref)
items = get_article(request, 'REF', groupe, ref)
# puis retourne son libellé et son prixht
liste=[]
d = {}
d['ref'] = items.ref_cli2
d['ref'] = items.ref
d['libelle'] = items.libelle
d['prixht'] = "%.2f" % items.PRIXHT2
d['prixht'] = "%.2f" % items.prixht
liste.append(d)
return Response(json.dumps(liste))