From 7ecb3ab91be8542ea053563982b51672f43db451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ch=C3=A9rifBALDE?= Date: Tue, 30 Aug 2022 14:38:33 +0200 Subject: [PATCH] 30/08/22 - 15h --- ela_factures_mgt.py | 70 +++++++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/ela_factures_mgt.py b/ela_factures_mgt.py index b4fa4be..c0e23f2 100644 --- a/ela_factures_mgt.py +++ b/ela_factures_mgt.py @@ -455,50 +455,61 @@ def createOrder(diction): if part_account[0]['invoice_telephone']: new_data['invoice_telephone'] = part_account[0]['invoice_telephone'] + total_ht = 0 + new_data['total_ht'] = total_ht + new_data['total_tva'] = mycommon.tryFloat(str(total_ht)) * MYSY_GV.TVA_TAUX + new_data['total_ttc'] = mycommon.tryFloat(str(total_ht)) + mycommon.tryFloat(str(new_data['total_tva'])) + # Recuperation ds données de payement coll_part_payment = MYSY_GV.dbname['payement_mode'] part_account = coll_part_payment.find({'client_recid': user_recid, 'valide': '1'}) - if( part_account.count() <= 0 ): + + total_ttc_float = mycommon.tryFloat(str(new_data['total_ttc'])) + print( "str(new_data['total_ttc']) === "+str(total_ttc_float)) + + if( part_account.count() <= 0 and total_ttc_float > 0): mycommon.myprint( - str(inspect.stack()[0][3]) + "Aucune donnée de payement, Impossible de créer la commande ") - return False, "Aucune donnée de payement,, Impossible de créer la commande ", None + str(inspect.stack()[0][3]) + " Aucune donnée de payement, Impossible de créer la commande ") + return False, " Aucune donnée de payement,, Impossible de créer la commande ", None - if ("type" in part_account[0].keys()): - if part_account[0]['type']: - new_data['type_payment'] = part_account[0]['type'] + # Les données de payement ne sont utilisées que si le montatn > 0 + if( total_ttc_float > 0 ): + if ("type" in part_account[0].keys()): + if part_account[0]['type']: + new_data['type_payment'] = part_account[0]['type'] - if ("bic" in part_account[0].keys()): - if part_account[0]['bic']: - new_data['bic_payment'] = part_account[0]['bic'] + if ("bic" in part_account[0].keys()): + if part_account[0]['bic']: + new_data['bic_payment'] = part_account[0]['bic'] - if ("cvv_carte" in part_account[0].keys()): - if part_account[0]['cvv_carte']: - new_data['cvv_carte_payment'] = part_account[0]['cvv_carte'] + if ("cvv_carte" in part_account[0].keys()): + if part_account[0]['cvv_carte']: + new_data['cvv_carte_payment'] = part_account[0]['cvv_carte'] - if ("date_exp_carte" in part_account[0].keys()): - if part_account[0]['date_exp_carte']: - new_data['date_exp_carte_payment'] = part_account[0]['date_exp_carte'] + if ("date_exp_carte" in part_account[0].keys()): + if part_account[0]['date_exp_carte']: + new_data['date_exp_carte_payment'] = part_account[0]['date_exp_carte'] - if ("iban" in part_account[0].keys()): - if part_account[0]['iban']: - new_data['iban_payment'] = part_account[0]['iban'] + if ("iban" in part_account[0].keys()): + if part_account[0]['iban']: + new_data['iban_payment'] = part_account[0]['iban'] - if ("nom_carte" in part_account[0].keys()): - if part_account[0]['nom_carte']: - new_data['nom_carte_payment'] = part_account[0]['nom_carte'] + if ("nom_carte" in part_account[0].keys()): + if part_account[0]['nom_carte']: + new_data['nom_carte_payment'] = part_account[0]['nom_carte'] - if ("nom_compte" in part_account[0].keys()): - if part_account[0]['nom_compte']: - new_data['nom_compte_payment'] = part_account[0]['nom_compte'] + if ("nom_compte" in part_account[0].keys()): + if part_account[0]['nom_compte']: + new_data['nom_compte_payment'] = part_account[0]['nom_compte'] - if ("num_carte" in part_account[0].keys()): - if part_account[0]['num_carte']: - new_data['num_carte_payment'] = part_account[0]['num_carte'] + if ("num_carte" in part_account[0].keys()): + if part_account[0]['num_carte']: + new_data['num_carte_payment'] = part_account[0]['num_carte'] new_data['nb_product'] = str(nb_line) i = 0 - total_ht = 0 + while (i < nb_line): print("PRODUIT N° " + str((i + 1)) + " : " ) line_dict = json.loads(diction[str(i)]) @@ -525,9 +536,6 @@ def createOrder(diction): i = i + 1 - new_data['total_ht'] = total_ht - new_data['total_tva'] = mycommon.tryFloat( str(total_ht) ) * MYSY_GV.TVA_TAUX - new_data['total_ttc'] = mycommon.tryFloat(str(total_ht))+mycommon.tryFloat(str(new_data['total_tva'])) print(" new_data['total_ht'] = "+str(new_data['total_ht']) + " -- new_data['total_tva'] " +str(new_data['total_tva'])+ " -- new_data['total_ttc'] = "+ str(new_data['total_ttc']))