ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/Ledger/LedgerTranFixes.py
Revision: 782
Committed: Mon Aug 8 01:27:47 2022 UTC (3 years, 7 months ago) by nino.borges
Content type: text/x-python
File size: 1163 byte(s)
Log Message:
general usage update.

File Contents

# User Rev Content
1 nino.borges 644 """
2     LedgerTranFixes
3    
4     Created by
5     Emanuel Borges
6     12.20.2017
7    
8     This program will take the transactions that just have a minus and amount and change to positive with
9     a dollar sign.
10    
11     """
12    
13     import re
14    
15    
16     if __name__ == '__main__':
17 nino.borges 782 fileNumber = '202206'
18 nino.borges 770
19     workFile = "/home/nino/Nextcloud/Nino And May/Fin/Amanda To-Do/_Ready/DoneLedger%s.txt"% fileNumber
20     outputFile = open("/home/nino/Nextcloud/Documents/Ledger/pvisaCorrectionOutput%s.txt"% fileNumber,'w')
21 nino.borges 644 contents = open(workFile).readlines()
22     for line in contents:
23     if line[:13] == " Expenses:":
24     newline = line.split(" ")
25     oldAmount = newline[-1]
26     if "-" in oldAmount:
27     newAmount = oldAmount.replace("-","$")
28     else:
29     newAmount = "$-" + oldAmount
30     if "." in newAmount:
31     pass
32     else:
33     newAmount = newAmount.replace("\n",".00\n")
34     test = newAmount.split(".")[-1]
35     if len(test) <3:
36     newAmount = newAmount.replace("\n","0\n")
37     line = line.replace(oldAmount,newAmount)
38     outputFile.write(line)
39     outputFile.close()