From 98880cf704d2d277735cd1bd2a8c7cc9d31b1cad Mon Sep 17 00:00:00 2001 From: chitsanupongkiw Date: Tue, 7 Oct 2025 10:17:15 +0700 Subject: [PATCH 01/11] Update main_program.py --- main_program.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main_program.py b/main_program.py index 91f7181..92cc86b 100644 --- a/main_program.py +++ b/main_program.py @@ -1,7 +1,7 @@ from modules import file_handler, auth, account def main(): - print("kuy O.K") + print("kuy O.K"lw)s print("yim") if __name__ == "__main__": From cf023816a97424751c832a22fc997abb624b0af3 Mon Sep 17 00:00:00 2001 From: chitsanupongkiw Date: Tue, 7 Oct 2025 10:21:35 +0700 Subject: [PATCH 02/11] Update main_program.py --- main_program.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main_program.py b/main_program.py index 92cc86b..6c5ed94 100644 --- a/main_program.py +++ b/main_program.py @@ -1,7 +1,7 @@ from modules import file_handler, auth, account def main(): - print("kuy O.K"lw)s + print("kuy O.KUY") print("yim") if __name__ == "__main__": From c9897709849c549bb7e703ff6993e7671a653e75 Mon Sep 17 00:00:00 2001 From: chitsanupongkiw Date: Tue, 7 Oct 2025 10:23:44 +0700 Subject: [PATCH 03/11] Update main_program.py --- main_program.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main_program.py b/main_program.py index 6c5ed94..9af77bd 100644 --- a/main_program.py +++ b/main_program.py @@ -1,8 +1,8 @@ from modules import file_handler, auth, account def main(): - print("kuy O.KUY") - print("yim") + print("kuy O.KUY")aass + print("yim")aa if __name__ == "__main__": main() From a3a7fa69625f2b6bffab56f36d84422bdc735473 Mon Sep 17 00:00:00 2001 From: chitsanupongkiw Date: Tue, 7 Oct 2025 10:25:57 +0700 Subject: [PATCH 04/11] Update main_program.py --- main_program.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main_program.py b/main_program.py index 9af77bd..6c5ed94 100644 --- a/main_program.py +++ b/main_program.py @@ -1,8 +1,8 @@ from modules import file_handler, auth, account def main(): - print("kuy O.KUY")aass - print("yim")aa + print("kuy O.KUY") + print("yim") if __name__ == "__main__": main() From 11219c8dee370df85883b92d034fa9d57814da87 Mon Sep 17 00:00:00 2001 From: yuxhin200x Date: Tue, 7 Oct 2025 13:07:46 +0700 Subject: [PATCH 05/11] Update account.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ดูหี --- modules/account.py | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/account.py b/modules/account.py index e9732ee..4cc9889 100644 --- a/modules/account.py +++ b/modules/account.py @@ -1,2 +1,3 @@ # modules/account.py # พวกระบบบัญชี (ยังไม่ทำจริง แค่โครง) +print("hee") From 0f6df80dcc337cb2f4c757785853a91f2bd87d62 Mon Sep 17 00:00:00 2001 From: yuxhin200x Date: Tue, 7 Oct 2025 13:14:30 +0700 Subject: [PATCH 06/11] Update account.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit กำลังเย็ดหี --- modules/account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/account.py b/modules/account.py index 4cc9889..51108c2 100644 --- a/modules/account.py +++ b/modules/account.py @@ -1,3 +1,3 @@ # modules/account.py # พวกระบบบัญชี (ยังไม่ทำจริง แค่โครง) -print("hee") +print("หี ควย แตด หน้าหี") From 38bf647919eecf4107227be93a64f27c07e28954 Mon Sep 17 00:00:00 2001 From: yuxhin200x Date: Tue, 7 Oct 2025 14:09:29 +0700 Subject: [PATCH 07/11] asdqweqwewqe --- modules/account.py | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/account.py b/modules/account.py index 51108c2..a78d41c 100644 --- a/modules/account.py +++ b/modules/account.py @@ -1,3 +1,4 @@ # modules/account.py # พวกระบบบัญชี (ยังไม่ทำจริง แค่โครง) print("หี ควย แตด หน้าหี") +#asdwqweqewqwe \ No newline at end of file From 200d58a1b77d777f07215cf39a6ec03d635d7182 Mon Sep 17 00:00:00 2001 From: yuxhin200x Date: Thu, 9 Oct 2025 22:25:47 +0700 Subject: [PATCH 08/11] account --- modules/account.py | 179 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 178 insertions(+), 1 deletion(-) diff --git a/modules/account.py b/modules/account.py index 2493019..bf7473d 100644 --- a/modules/account.py +++ b/modules/account.py @@ -6,4 +6,181 @@ # "MR", "Pokpong", "Numberone", # "123-4-56789-0", "655576", # "2025-10-07T21:35:00+07:00" -# ) \ No newline at end of file +# ) + +# modules/account.py +# พวกระบบบัญชี (ยังไม่ทำจริง แค่โครง) +#asdwqweqewqwe +from logging import exception + +import file_handler +# modules/account.py +# พวกระบบบัญชี (ยังไม่ทำจริง แค่โครง) +#asdwqweqewqwe + +import datetime +import random +import file_handler +from modules.file_handler import read_transaction_file + + +# file_handler.append_transaction_log_file( +# account_number="123-4-56789-0", +# transaction_id="TXN0001", +# #timestamp="2025-10-07T21:35:00+07:00", +# type_i="deposit", +# amount=15000.1, +# balance=655576.1, +# target="" +# ) + +# file_handler.append_account_file( +# "MR", "Pokpong", "Numberone", +# "123-4-56789-0", "655576", +# "2025-10-07T21:35:00+07:00" +# ) + +#randomตัวเลขธุรกรรม +def transaction_id_generator(): + x = random.randint(100000000000000000,999999999999999999) + return str(x) + +#ฝากเงิน +def add_transaction_deposit(account_number,amount): + plus_num = 0 + dep = file_handler.read_transaction_file(account_number) + lol = len(dep) + for i in range(lol): + acc_num = dep[i].split(",")[3] + new_balance = dep[i].split(",")[4] + Deletepoint = acc_num.find(".") + Deletepoint1 = new_balance.find(".") + cut = acc_num[:Deletepoint] + cut1 = new_balance[:Deletepoint1] + if i == lol - 1: + decimal = float(cut) + decimal1 = float(cut1) + plus_num += decimal1 + print(plus_num) + print(cut,cut1) + timestamps = datetime.datetime.now().isoformat() + file_handler.append_transaction_log_file( + account_number=account_number, + transaction_id=transaction_id_generator(), + timestamp=timestamps[0:19], + type_i="deposit", + amount=amount, + balance= amount+plus_num, + target="") + +#เซ็คเลขบัญชีว่ามีอยู่จริงมั้ย +def add_transaction_firstdeposit(account_number,amount): + checkfile = False + check = False + num_acc = file_handler.read_accounts_file() + for i in range(len(num_acc)): + acc_num = num_acc[i].split(",")[3] + if acc_num == account_number : + check = True + print(acc_num) + break + + try: + file_handler.read_transaction_file(account_number) + except: + checkfile = True + if check == True and checkfile == True: + timestamps = datetime.datetime.now().isoformat() + file_handler.append_transaction_log_file( + account_number=account_number, + transaction_id=transaction_id_generator(), + timestamp=timestamps[0:19], + type_i="deposit", + amount=amount, + balance=amount, + target="") + return {"status":"success","msg":"มันไม่มีบัญชี"} + else: + return {"status":"error","msg":"มันไม่มีบัญชี"} + +#ถอนเงิน +def add_transaction_withdrawal(account_number,amount): + plus_num = 0 + dep = file_handler.read_transaction_file(account_number) + lol = len(dep) + for i in range(lol): + acc_num = dep[i].split(",")[3] + new_balance = dep[i].split(",")[4] + Deletepoint = acc_num.find(".") + Deletepoint1 = new_balance.find(".") + cut = acc_num[:Deletepoint] + cut1 = new_balance[:Deletepoint1] + if i == lol - 1: + decimal = float(cut) + decimal1 = float(cut1) + plus_num -= decimal1 + timestamps = datetime.datetime.now().isoformat() + file_handler.append_transaction_log_file( + account_number=account_number, + transaction_id=transaction_id_generator(), + timestamp=timestamps[0:19], + type_i="withdrawal", + amount=amount, + balance= amount-plus_num, + target="") + +#เซ็กยอดเงิน +def check_balance(account_number): + dep = file_handler.read_transaction_file(account_number) + lol = len(dep) + for i in range(lol): + acc_num = dep[i].split(",")[4] + if i == lol - 1: + return acc_num + +#โอนเงิน +def add_transaction_transfer(account_number,account_numberv2,amount): + plus_num = 0 + dep = file_handler.read_transaction_file(account_number) + lol = len(dep) + for i in range(lol): + acc_num = dep[i].split(",")[3] + new_balance = dep[i].split(",")[4] + Deletepoint = acc_num.find(".") + Deletepoint1 = new_balance.find(".") + cut = acc_num[:Deletepoint] + cut1 = new_balance[:Deletepoint1] + if i == lol - 1: + decimal = float(cut) + decimal1 = float(cut1) + plus_num -= decimal1 + timestamps = datetime.datetime.now().isoformat() + file_handler.append_transaction_log_file( + account_number=account_number, + transaction_id=transaction_id_generator(), + timestamp=timestamps[0:19], + type_i="transfer", + amount=amount, + balance= amount-plus_num, + target=account_numberv2 + ) + add_transaction_firstdeposit(account_numberv2,abs(amount)) + if len(file_handler.read_transaction_file(account_numberv2))>= 2: + add_transaction_deposit(account_numberv2, abs(amount)) + + + + +# x = add_transaction_firstdeposit(account_number="123-4-56789-1",amount=20000.0) +#y = add_transaction_deposit("123-4-56789-0",3000.00) +#m = add_transaction_withdrawal("123-4-56789-0",-3000.00) +#c = check_balance("123-4-56789-0") +o = add_transaction_transfer("123-4-56789-0","123-4-56789-1",-1000.00) +print(o) + + + + + + + From e6ec58e80ca1f1512df58479d8a37c44cff8f7bb Mon Sep 17 00:00:00 2001 From: yuxhin200x Date: Fri, 10 Oct 2025 16:21:16 +0700 Subject: [PATCH 09/11] pok --- modules/account.py | 35 ++--------------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/modules/account.py b/modules/account.py index bf7473d..5e18cef 100644 --- a/modules/account.py +++ b/modules/account.py @@ -1,45 +1,13 @@ # modules/account.py # พวกระบบบัญชี (ยังไม่ทำจริง แค่โครง) #asdwqweqewqwe -# import file_handler -# file_handler.append_account_file( -# "MR", "Pokpong", "Numberone", -# "123-4-56789-0", "655576", -# "2025-10-07T21:35:00+07:00" -# ) -# modules/account.py -# พวกระบบบัญชี (ยังไม่ทำจริง แค่โครง) -#asdwqweqewqwe from logging import exception - -import file_handler -# modules/account.py -# พวกระบบบัญชี (ยังไม่ทำจริง แค่โครง) -#asdwqweqewqwe - import datetime import random import file_handler from modules.file_handler import read_transaction_file - -# file_handler.append_transaction_log_file( -# account_number="123-4-56789-0", -# transaction_id="TXN0001", -# #timestamp="2025-10-07T21:35:00+07:00", -# type_i="deposit", -# amount=15000.1, -# balance=655576.1, -# target="" -# ) - -# file_handler.append_account_file( -# "MR", "Pokpong", "Numberone", -# "123-4-56789-0", "655576", -# "2025-10-07T21:35:00+07:00" -# ) - #randomตัวเลขธุรกรรม def transaction_id_generator(): x = random.randint(100000000000000000,999999999999999999) @@ -168,7 +136,8 @@ def add_transaction_transfer(account_number,account_numberv2,amount): if len(file_handler.read_transaction_file(account_numberv2))>= 2: add_transaction_deposit(account_numberv2, abs(amount)) - +#ถอนเงินที่ตู้ +b1000 # x = add_transaction_firstdeposit(account_number="123-4-56789-1",amount=20000.0) From 70938b022c9f186ec7b5906475dbfc19f026038b Mon Sep 17 00:00:00 2001 From: yuxhin200x Date: Fri, 10 Oct 2025 16:21:39 +0700 Subject: [PATCH 10/11] pok --- modules/account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/account.py b/modules/account.py index 5e18cef..d70fb56 100644 --- a/modules/account.py +++ b/modules/account.py @@ -137,7 +137,7 @@ def add_transaction_transfer(account_number,account_numberv2,amount): add_transaction_deposit(account_numberv2, abs(amount)) #ถอนเงินที่ตู้ -b1000 + # x = add_transaction_firstdeposit(account_number="123-4-56789-1",amount=20000.0) From f558ae9f28a9c29f7ad8cbd236a337052e2680fe Mon Sep 17 00:00:00 2001 From: Pokpong Limpaphan <235639172+pokpong-dev@users.noreply.github.com> Date: Fri, 10 Oct 2025 16:33:22 +0700 Subject: [PATCH 11/11] Update account.py --- modules/account.py | 177 ++++++++++++++++++++++++--------------------- 1 file changed, 96 insertions(+), 81 deletions(-) diff --git a/modules/account.py b/modules/account.py index d70fb56..0d20078 100644 --- a/modules/account.py +++ b/modules/account.py @@ -16,30 +16,34 @@ def transaction_id_generator(): #ฝากเงิน def add_transaction_deposit(account_number,amount): plus_num = 0 - dep = file_handler.read_transaction_file(account_number) - lol = len(dep) - for i in range(lol): - acc_num = dep[i].split(",")[3] - new_balance = dep[i].split(",")[4] - Deletepoint = acc_num.find(".") - Deletepoint1 = new_balance.find(".") - cut = acc_num[:Deletepoint] - cut1 = new_balance[:Deletepoint1] - if i == lol - 1: - decimal = float(cut) - decimal1 = float(cut1) - plus_num += decimal1 - print(plus_num) - print(cut,cut1) - timestamps = datetime.datetime.now().isoformat() - file_handler.append_transaction_log_file( - account_number=account_number, - transaction_id=transaction_id_generator(), - timestamp=timestamps[0:19], - type_i="deposit", - amount=amount, - balance= amount+plus_num, - target="") + try: + dep = file_handler.read_transaction_file(account_number) + lol = len(dep) + for i in range(lol): + acc_num = dep[i].split(",")[3] + new_balance = dep[i].split(",")[4] + Deletepoint = acc_num.find(".") + Deletepoint1 = new_balance.find(".") + cut = acc_num[:Deletepoint] + cut1 = new_balance[:Deletepoint1] + if i == lol - 1: + decimal = float(cut) + decimal1 = float(cut1) + plus_num += decimal1 + print(plus_num) + print(cut,cut1) + timestamps = datetime.datetime.now().isoformat() + file_handler.append_transaction_log_file( + account_number=account_number, + transaction_id=transaction_id_generator(), + timestamp=timestamps[0:19], + type_i="deposit", + amount=amount, + balance= amount+plus_num, + target="") + return {"status":"success","msg":"สำเร็จ"} + except FileNotFoundError: + return {"status":"error","msg":"มันไม่มีบัญชี"} #เซ็คเลขบัญชีว่ามีอยู่จริงมั้ย def add_transaction_firstdeposit(account_number,amount): @@ -67,74 +71,86 @@ def add_transaction_firstdeposit(account_number,amount): amount=amount, balance=amount, target="") - return {"status":"success","msg":"มันไม่มีบัญชี"} + return {"status":"success","msg":"สำเร็จ"} else: return {"status":"error","msg":"มันไม่มีบัญชี"} #ถอนเงิน def add_transaction_withdrawal(account_number,amount): plus_num = 0 - dep = file_handler.read_transaction_file(account_number) - lol = len(dep) - for i in range(lol): - acc_num = dep[i].split(",")[3] - new_balance = dep[i].split(",")[4] - Deletepoint = acc_num.find(".") - Deletepoint1 = new_balance.find(".") - cut = acc_num[:Deletepoint] - cut1 = new_balance[:Deletepoint1] - if i == lol - 1: - decimal = float(cut) - decimal1 = float(cut1) - plus_num -= decimal1 - timestamps = datetime.datetime.now().isoformat() - file_handler.append_transaction_log_file( - account_number=account_number, - transaction_id=transaction_id_generator(), - timestamp=timestamps[0:19], - type_i="withdrawal", - amount=amount, - balance= amount-plus_num, - target="") + try: + dep = file_handler.read_transaction_file(account_number) + lol = len(dep) + for i in range(lol): + acc_num = dep[i].split(",")[3] + new_balance = dep[i].split(",")[4] + Deletepoint = acc_num.find(".") + Deletepoint1 = new_balance.find(".") + cut = acc_num[:Deletepoint] + cut1 = new_balance[:Deletepoint1] + if i == lol - 1: + decimal = float(cut) + decimal1 = float(cut1) + plus_num -= decimal1 + timestamps = datetime.datetime.now().isoformat() + file_handler.append_transaction_log_file( + account_number=account_number, + transaction_id=transaction_id_generator(), + timestamp=timestamps[0:19], + type_i="withdrawal", + amount=amount, + balance= amount-plus_num, + target="") + return {"status":"success","msg":"สำเร็จ"} + except FileNotFoundError: + return {"status":"error","msg":"มันไม่มีบัญชี"} + #เซ็กยอดเงิน def check_balance(account_number): - dep = file_handler.read_transaction_file(account_number) - lol = len(dep) - for i in range(lol): - acc_num = dep[i].split(",")[4] - if i == lol - 1: - return acc_num + try: + dep = file_handler.read_transaction_file(account_number) + lol = len(dep) + for i in range(lol): + acc_num = dep[i].split(",")[4] + if i == lol - 1: + return {"status":"success","msg":acc_num} + except FileNotFoundError: + return {"status":"error","msg":"มันไม่มีบัญชี"} #โอนเงิน def add_transaction_transfer(account_number,account_numberv2,amount): plus_num = 0 - dep = file_handler.read_transaction_file(account_number) - lol = len(dep) - for i in range(lol): - acc_num = dep[i].split(",")[3] - new_balance = dep[i].split(",")[4] - Deletepoint = acc_num.find(".") - Deletepoint1 = new_balance.find(".") - cut = acc_num[:Deletepoint] - cut1 = new_balance[:Deletepoint1] - if i == lol - 1: - decimal = float(cut) - decimal1 = float(cut1) - plus_num -= decimal1 - timestamps = datetime.datetime.now().isoformat() - file_handler.append_transaction_log_file( - account_number=account_number, - transaction_id=transaction_id_generator(), - timestamp=timestamps[0:19], - type_i="transfer", - amount=amount, - balance= amount-plus_num, - target=account_numberv2 - ) - add_transaction_firstdeposit(account_numberv2,abs(amount)) - if len(file_handler.read_transaction_file(account_numberv2))>= 2: - add_transaction_deposit(account_numberv2, abs(amount)) + try: + dep = file_handler.read_transaction_file(account_number) + lol = len(dep) + for i in range(lol): + acc_num = dep[i].split(",")[3] + new_balance = dep[i].split(",")[4] + Deletepoint = acc_num.find(".") + Deletepoint1 = new_balance.find(".") + cut = acc_num[:Deletepoint] + cut1 = new_balance[:Deletepoint1] + if i == lol - 1: + decimal = float(cut) + decimal1 = float(cut1) + plus_num -= decimal1 + timestamps = datetime.datetime.now().isoformat() + file_handler.append_transaction_log_file( + account_number=account_number, + transaction_id=transaction_id_generator(), + timestamp=timestamps[0:19], + type_i="transfer", + amount=amount, + balance= amount-plus_num, + target=account_numberv2 + ) + add_transaction_firstdeposit(account_numberv2,abs(amount)) + if len(file_handler.read_transaction_file(account_numberv2))>= 2: + add_transaction_deposit(account_numberv2, abs(amount)) + except FileNotFoundError: + return {"status":"error","msg":"มันไม่มีบัญชี"} + #ถอนเงินที่ตู้ @@ -144,8 +160,7 @@ def add_transaction_transfer(account_number,account_numberv2,amount): #y = add_transaction_deposit("123-4-56789-0",3000.00) #m = add_transaction_withdrawal("123-4-56789-0",-3000.00) #c = check_balance("123-4-56789-0") -o = add_transaction_transfer("123-4-56789-0","123-4-56789-1",-1000.00) -print(o) +