1 Commits

Author SHA1 Message Date
dependabot[bot]
95b6308447 Bump pypdf2 from 1.26.0 to 1.27.9
Bumps [pypdf2](https://github.com/py-pdf/PyPDF2) from 1.26.0 to 1.27.9.
- [Release notes](https://github.com/py-pdf/PyPDF2/releases)
- [Changelog](https://github.com/py-pdf/pypdf/blob/1.27.9/CHANGELOG)
- [Commits](https://github.com/py-pdf/PyPDF2/compare/1.26.0...1.27.9)

---
updated-dependencies:
- dependency-name: pypdf2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-30 22:20:58 +00:00
5 changed files with 27 additions and 65 deletions

2
.gitignore vendored
View File

@@ -28,5 +28,3 @@ __pycache__/*
!fatture_ccsr/fatture_ccsr.spec
*.wxg
.venv
config.ini
certificates/*

View File

@@ -12,7 +12,7 @@ def download_input_file(parent):
"""download input file"""
start_date = parent.start_date_picker.GetValue().Format("%d/%m/%Y")
end_date = parent.end_date_picker.GetValue().Format("%d/%m/%Y")
input_file_url = parent.config['REPORT_SERVER']['URL']+'/reportserver?/STAT_FATTURATO_CTERZI&dataI='+start_date+'&dataF='+end_date+'&rs:Format=EXCELOPENXML'
input_file_url = 'https://report.casadicurasanrossore.it:8443/reportserver?/STAT_FATTURATO_CTERZI&dataI='+start_date+'&dataF='+end_date+'&rs:Format=EXCELOPENXML'
try:
downloaded_input_file = parent.session.get(input_file_url)
except requests.exceptions.RequestException:

View File

@@ -2,14 +2,13 @@
import os
import sys
import argparse
import getopt
import subprocess
import atexit
import wx
import wx.adv
import requests
import requests_ntlm
import configparser
import downloader
import traf2000_converter
@@ -24,26 +23,14 @@ class FattureCCSRFrame(wx.Frame):
def __init__(self, *args, **kwds):
self.verbose = False
try:
parser = argparse.ArgumentParser(prog='fatture_ccsr')
parser.add_argument('-v', '--verbose', action='store_true')
parser.add_argument('-c', '--configfile', action='store', )
input_args = parser.parse_args()
except (argparse.ArgumentError, argparse.ArgumentTypeError) as e:
print(f"Error in parsing arguments: {e}")
sys.exit(2)
if input_args.verbose:
self.verbose = True
if input_args.configfile:
config_file = input_args.configfile
else:
config_file = "./config.ini"
try:
self.config = configparser.ConfigParser()
self.config.read_file(open(config_file))
except Exception as e:
print(f"Error in reading the config file: {e}")
opts, _ = getopt.getopt(sys.argv[1:], "v", ["verbose="])
for opt, _ in opts:
if opt == '-h':
print("fatture_ccsr -v|--verbose")
elif opt in ('-v', '--verbose'):
self.verbose = True
except getopt.GetoptError:
print("fatture_ccsr -v|--verbose")
sys.exit(2)
atexit.register(self.exit_handler)
@@ -56,9 +43,7 @@ class FattureCCSRFrame(wx.Frame):
self.input_files = list()
self.log_dialog = None
self.session = requests.Session()
self.session.verify = self.config['REPORT_SERVER'].get('CA_BUNDLE', True)
self.panel = wx.Panel(self, wx.ID_ANY, style=wx.BORDER_NONE | wx.FULL_REPAINT_ON_RESIZE | wx.TAB_TRAVERSAL)
self.main_sizer = wx.BoxSizer(wx.VERTICAL)
@@ -300,7 +285,7 @@ class LoginDialog(wx.Dialog):
session = self.GetParent().session
session.auth = requests_ntlm.HttpNtlmAuth("sanrossore\\"+self.username.GetValue(), self.password.GetValue())
try:
login = session.get(self.GetParent().config['REPORT_SERVER']['URL']+'/Reports/browse/')
login = session.get('https://report.casadicurasanrossore.it:8443/Reports/browse/')
if login.status_code == 200:
self.logged_in = True
self.username.SetValue('')

View File

@@ -13,7 +13,7 @@ def download_input_file(parent):
"""download input file from CCSR SSRS web service"""
start_date = parent.start_date_picker.GetValue().Format("%d/%m/%Y")
end_date = parent.end_date_picker.GetValue().Format("%d/%m/%Y")
input_file_url = parent.config['REPORT_SERVER']['URL']+'/reportserver?/STAT_FATTURATO_CTERZI&dataI='+start_date+'&dataF='+end_date+'&rs:Format=XML'
input_file_url = 'https://report.casadicurasanrossore.it:8443/reportserver?/STAT_FATTURATO_CTERZI&dataI='+start_date+'&dataF='+end_date+'&rs:Format=XML'
try:
downloaded_input_file = parent.session.get(input_file_url)
except requests.exceptions.RequestException:
@@ -138,12 +138,6 @@ def convert(parent):
return
with open(output_file_path, "w") as traf2000_file:
trf_ditta = parent.config['TRAF2000']['TRF-DITTA']
trf_aliq = parent.config['TRAF2000']['TRF-ALIQ']
trf_aliq_bollo = parent.config['TRAF2000']['TRF-ALIQ-BOLLO']
trf_conto_ric = parent.config['TRAF2000']['TRF-CONTO-RIC']
trf_conto_ric_bollo = parent.config['TRAF2000']['TRF-CONTO-RIC-BOLLO']
parent.log_dialog.nc_text.AppendText("Note di credito:\n")
wx.Yield()
@@ -168,7 +162,7 @@ def convert(parent):
wx.Yield()
continue
line = [trf_ditta, "3", "0", "00000"] # TRF-DITTA + TRF-VERSIONE + TRF-TARC + TRF-COD-CLIFOR
line = ["04103", "3", "0", "00000"] # TRF-DITTA + TRF-VERSIONE + TRF-TARC + TRF-COD-CLIFOR
line.append(invoice["ragioneSociale"][:32]+' '*(32-len(invoice["ragioneSociale"]))) # TRF-RASO
line.append(' '*30) # TRF-IND
line.append('00000') # TRF-CAP
@@ -215,9 +209,9 @@ def convert(parent):
imponibile = '0'*(11-len(imponibile)) + imponibile + "+"
line.append(imponibile) # TRF-IMPONIB
if desc != "Bollo":
line.append(trf_aliq) # TRF-ALIQ
line.append('308') # TRF-ALIQ
else:
line.append(trf_aliq_bollo) # TRF-ALIQ
line.append('315') # TRF-ALIQ
line.append('0'*16) # TRF-ALIQ-AGRICOLA + TRF-IVA11 + TRF-IMPOSTA
for _ in range(8-count):
@@ -241,9 +235,9 @@ def convert(parent):
else:
imponibile = '0'*(11-len(imponibile)) + imponibile + "+"
if desc != "Bollo":
line.append(trf_conto_ric) # TRF-CONTO-RIC
line.append('4004300') # TRF-CONTO-RIC
else:
line.append(trf_conto_ric_bollo) # TRF-CONTO-RIC
line.append('4004500') # TRF-CONTO-RIC
line.append(imponibile) # TRF-IMP-RIC
for _ in range(8-count):
@@ -288,17 +282,17 @@ def convert(parent):
wx.Yield()
#RECORD 5 per Tessera Sanitaria
line.append(trf_ditta + '3' + '5') # TRF5-DITTA + TRF5-VERSIONE + TRF5-TARC
line.append('04103' + '3' + '5') # TRF5-DITTA + TRF5-VERSIONE + TRF5-TARC
line.append(' '*1200) # TRF-ART21-CONTRATTO
line.append('0'*6 + invoice["cf"]) # TRF-A21CO-ANAG + # TRF-A21CO-COFI
total = str(invoice["importoTotale"] - invoice["bollo"])
total = '0'*(13-len(total)) + total + "+"
line.append(invoice["dataFattura"] + 'S' + trf_aliq + total + '0'*14 + '0' + invoice["numFattura"][4:9] + '00' + 'N' + ' '*39) # TRF-A21CO-DATA + TRF-A21CO-FLAG + TRF-A21CO-ALQ + TRF-A21CO-IMPORTO + TRF-A21CO-IMPOSTA + TRF-A21CO-NDOC + TRF-A21CO-FLAG-OPPOS + FILLER
line.append(invoice["dataFattura"] + 'S' + '308' + total + '0'*14 + '0' + invoice["numFattura"][4:9] + '00' + 'N' + ' '*39) # TRF-A21CO-DATA + TRF-A21CO-FLAG + TRF-A21CO-ALQ + TRF-A21CO-IMPORTO + TRF-A21CO-IMPOSTA + TRF-A21CO-NDOC + TRF-A21CO-FLAG-OPPOS + FILLER
if invoice["bollo"] != 0:
line.append('0'*6 + invoice["cf"]) # TRF-A21CO-ANAG + # TRF-A21CO-COFI
bollo = str(invoice["bollo"])
bollo = '0'*(13-len(bollo)) + bollo + "+"
line.append(invoice["dataFattura"] + 'S' + trf_aliq_bollo + bollo + '0'*14 + '0' + invoice["numFattura"][4:9] + '00' + 'N' + ' '*39) # TRF-A21CO-DATA + TRF-A21CO-FLAG + TRF-A21CO-ALQ + TRF-A21CO-IMPORTO + TRF-A21CO-IMPOSTA + TRF-A21CO-NDOC + TRF-A21CO-FLAG-OPPOS + FILLER
line.append(invoice["dataFattura"] + 'S' + '315' + bollo + '0'*14 + '0' + invoice["numFattura"][4:9] + '00' + 'N' + ' '*39) # TRF-A21CO-DATA + TRF-A21CO-FLAG + TRF-A21CO-ALQ + TRF-A21CO-IMPORTO + TRF-A21CO-IMPOSTA + TRF-A21CO-NDOC + TRF-A21CO-FLAG-OPPOS + FILLER
else:
line.append('0'*6 + ' '*16 + '0'*8 + ' ' + '000' + '0'*14 + '0'*14 + '0'*8 + 'N' + ' '*39) # TRF-A21CO-ANAG + TRF-A21CO-COFI + TRF-A21CO-DATA + TRF-A21CO-FLAG + TRF-A21CO-ALQ + TRF-A21CO-IMPORTO + TRF-A21CO-IMPOSTA + TRF-A21CO-NDOC + TRF-A21CO-FLAG-OPPOS + FILLER
line.append(('0'*6 + ' '*16 + '0'*8 + ' ' + '000' + '0'*14 + '0'*14 + '0'*8 + 'N' + ' '*39)*48) # TRF-A21CO-ANAG + TRF-A21CO-COFI + TRF-A21CO-DATA + TRF-A21CO-FLAG + TRF-A21CO-ALQ + TRF-A21CO-IMPORTO + TRF-A21CO-IMPOSTA + TRF-A21CO-NDOC + TRF-A21CO-FLAG-OPPOS + FILLER
@@ -327,7 +321,7 @@ def convert(parent):
wx.Yield()
#RECORD 1 per num. doc. originale
line.append(trf_ditta + '3' + '1') # TRF1-DITTA + TRF1-VERSIONE + TRF1-TARC
line.append('04103' + '3' + '1') # TRF1-DITTA + TRF1-VERSIONE + TRF1-TARC
line.append('0'*7 + ' '*3 + '0'*14) # TRF-NUM-AUTOFATT + TRF-SERIE-AUTOFATT + TRF-COD-VAL + TRF-TOTVAL
line.append((' '*8 + '0'*24 + ' ' + '0'*36 + ' '*2 + '0'*9 + ' '*5)*20) # TRF-NOMENCLATURA + TRF-IMP-LIRE + TRF-IMP-VAL + TRF-NATURA + TRF-MASSA + TRF-UN-SUPPL + TRF-VAL-STAT + TRF-REGIME + TRF-TRASPORTO + TRF-PAESE-PROV + TRF-PAESE-ORIG + TRF-PAESE-DEST + TRF-PROV-DEST + TRF-PROV-ORIG + TRF-SEGNO-RET
line.append(' ' + '0'*6 + ' '*173) # TRF-INTRA-TIPO + TRF-MESE-ANNO-RIF + SPAZIO

View File

@@ -1,21 +1,6 @@
# HTTP requests and NTLM authentication
requests>=2.28.0
requests-ntlm>=1.1.0
# GUI framework
wxPython>=4.1.0
# Excel file parsing
openpyxl>=3.7.0
# PDF manipulation
PyPDF2>=2.0.0
# String utilities
Unidecode>=1.2.0
# XML parsing and validation
lxml>=4.6.0
# Numerical operations
numpy>=1.20.0
requests_ntlm==1.1.0
wxPython==4.0.7
requests==2.24.0
openpyxl==3.0.5
Unidecode==1.1.2
PyPDF2==1.27.9