diff --git a/README.md b/README.md deleted file mode 100644 index 5eee355..0000000 --- a/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# fattureSanRossore - -[![MIT License](https://img.shields.io/badge/license-MIT-blue)](LICENSE.md) [![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/Noettore/fattureSanRossore)](#) [![GitHub last commit](https://img.shields.io/github/last-commit/Noettore/fattureSanRossore)](https://github.com/Noettore/fattureSanRossore/commit/master) - -## The Project - -Here you can find two distinct utilities: -- [`fattureDownloader`](fattureDownloader), a Go script which lets you download invoices in pdf starting from an .xls file; -- [`traf2000Converter`](traf2000Converter), a Python script which converts a .csv file to a TRAF2000 text file for being imported in TeamSystem's accounting software. - -## Author - -- [**Ettore Dreucci**](https://ettore.dreucci.it) - -## License - -This project is licensed under the MIT License - see the [LICENSE.md](/LICENSE.md) file for details \ No newline at end of file diff --git a/fattureDownloader/README.md b/fattureDownloader/README.md deleted file mode 100644 index 9741f0a..0000000 --- a/fattureDownloader/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# fattureSanRossore Downloader - -[![MIT License](https://img.shields.io/badge/license-MIT-blue)](../LICENSE.md) [![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/Noettore/fattureSanRossore)](#) [![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/Noettore/fattureSanRossore?filename=fattureDownloader%2Fgo.mod)](#) [![GitHub last commit](https://img.shields.io/github/last-commit/Noettore/fattureSanRossore)](https://github.com/Noettore/fattureSanRossore/commit/master) - -## Getting Started - -These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. - -### Prerequisites - -- [Go](https://golang.org/) v1.14 or greater -- [LibreOffice](https://www.libreoffice.org) - -### Installing - -To download and install follow this steps: - -1. Clone this repo (or download it): - - `$ git clone https://github.com/Noettore/fattureSanRossore` - -2. Download dependencies, build and install: - - ``` - $ cd path/to/fattureSanRossore/fattureDownloader - $ go install - ``` - -### Run - -To run you can simply execute the built binary. - -Follow the instruction in the [manual](manual/Manuale.md) (only in italian) - -## Dependencies - -- [github.com/extrame/xls](https://github.com/extrame/xls) -- [github.com/pdfcpu/pdfcpu](https://github.com/pdfcpu/pdfcpu/pkg/api) -- [github.com/sqweek/dialog](https://github.com/sqweek/dialog) -- [mvdan.cc/xurls](https://mvdan.cc/xurls/v2) - -## Author - -- [**Ettore Dreucci**](https://ettore.dreucci.it) - -## License - -This project is licensed under the MIT License - see the [LICENSE.md](../LICENSE.md) file for details \ No newline at end of file diff --git a/fattureDownloader/manual/Manuale.md b/fattureDownloader/manual/Manuale.md deleted file mode 100644 index 33e2962..0000000 --- a/fattureDownloader/manual/Manuale.md +++ /dev/null @@ -1,56 +0,0 @@ -# Manuale operativo `fattureSanRossore.exe` - -L’utility `fattureSanRossore` ha come unico obiettivo quello di scaricare automaticamente le fatture emesse dalla Casa di Cura San Rossore per conto di un medico. - -Per utilizzarla è necessario essere in possesso di un file xls (Microsoft Excel) generato e scaricato dal portale `STAT_FATTURATO_CTERZI` raggiungibile qui: - -[https://report.casadicurasanrossore.it:8443/Reports/Pages/Folder.aspx](https://report.casadicurasanrossore.it:8443/Reports/Pages/Folder.aspx). - -Ecco in dettaglio la procedura da seguire - -## 1. Download del report in formato `xls` - -Al termine di questa procedura avremo a disposizione il report in formato `xls` delle fatture emesse dalla Casa di Cura San Rossore per conto terzi. Il report verrà poi utilizzato nella fase seguente per il download delle fatture. - -1. Aprire l’indirizzo del portale di generazione del report: - - ​ [https://report.casadicurasanrossore.it:8443/Reports/Pages/Folder.aspx](https://report.casadicurasanrossore.it:8443/Reports/Pages/Folder.aspx) - -2. Effettuare il login con le credenziali del medico accreditato - -3. Nella pagina fare click su `STAT_FATTURATO_CTERZI` per aprire la procedura di generazione dei report - - ![](img/1.png) - -4. Modificare le date nei campi `data dal` e `data al` in modo che rispecchino il periodo di interesse - -5. Fare click sul pulsante `Visualizza report` presente nella parte alta della pagina, sulla destra - - ![2](img/2.png) - -6. Fare click sul pulsante raffigurante l’icona di salvataggio - -7. Selezionare l’opzione `Excel` nel menù a tendina - - ![3](img/3.png) - -8. Salvare il file in una posizione nota - -## 2. Avvio della utility e download delle fatture - -1. Avviare la utility facendo doppio click sull’eseguibile `fattureSanRossore-win-0.1.exe` - -2. Nella finestra di dialogo selezionare il report in formato `xls` generato nella fase precedente - - ![4](img/4.png) - -3. Attendere il completamento dei download - - ![5](img/5.png) - -4. Nella finestra di dialogo selezionare la cartella e dare un nome al file `pdf` che conterrà le fatture scaricate - - ![6](img/6.png) - -5. Si aprirà automaticamente il lettore pdf con il file generato - diff --git a/fattureDownloader/manual/Manuale.pdf b/fattureDownloader/manual/Manuale.pdf deleted file mode 100644 index 2900cf1..0000000 Binary files a/fattureDownloader/manual/Manuale.pdf and /dev/null differ diff --git a/fattureDownloader/manual/img/1.png b/fattureDownloader/manual/img/1.png deleted file mode 100644 index 2f7ce8a..0000000 Binary files a/fattureDownloader/manual/img/1.png and /dev/null differ diff --git a/fattureDownloader/manual/img/2.png b/fattureDownloader/manual/img/2.png deleted file mode 100644 index 188ba66..0000000 Binary files a/fattureDownloader/manual/img/2.png and /dev/null differ diff --git a/fattureDownloader/manual/img/3.png b/fattureDownloader/manual/img/3.png deleted file mode 100644 index 951c781..0000000 Binary files a/fattureDownloader/manual/img/3.png and /dev/null differ diff --git a/fattureDownloader/manual/img/4.png b/fattureDownloader/manual/img/4.png deleted file mode 100644 index 9f6c6b8..0000000 Binary files a/fattureDownloader/manual/img/4.png and /dev/null differ diff --git a/fattureDownloader/manual/img/5.png b/fattureDownloader/manual/img/5.png deleted file mode 100644 index 2d3ae33..0000000 Binary files a/fattureDownloader/manual/img/5.png and /dev/null differ diff --git a/fattureDownloader/manual/img/6.png b/fattureDownloader/manual/img/6.png deleted file mode 100644 index f742ea0..0000000 Binary files a/fattureDownloader/manual/img/6.png and /dev/null differ diff --git a/fatture_ccsr.py b/fatture_ccsr.py index b692794..f7a16f0 100644 --- a/fatture_ccsr.py +++ b/fatture_ccsr.py @@ -6,6 +6,42 @@ import wx import converter import exc +class LoginDialog(wx.Dialog): + """login dialog for basic auth download""" + def __init__(self, parent, title): + """constructor""" + super(LoginDialog, self).__init__(parent, wx.ID_ANY, title, size=(350, 150)) + + self.logged_id = False + + user_sizer = wx.BoxSizer(wx.HORIZONTAL) + user_lbl = wx.StaticText(self, wx.ID_ANY, "Username:") + user_sizer.Add(user_lbl, 0, wx.ALL|wx.CENTER, 2) + self.username = wx.TextCtrl(self) + user_sizer.Add(self.username, 0, wx.ALL, 2) + + pass_sizer = wx.BoxSizer(wx.HORIZONTAL) + pass_lbl = wx.StaticText(self, wx.ID_ANY, "Password:") + pass_sizer.Add(pass_lbl, 0, wx.ALL|wx.CENTER, 2) + self.password = wx.TextCtrl(self, wx.ID_ANY, style=wx.TE_PASSWORD|wx.TE_PROCESS_ENTER) + pass_sizer.Add(self.password, 0, wx.ALL, 2) + + login_btn = wx.Button(self, label="Login") + login_btn.Bind(wx.EVT_BUTTON, self.onLogin) + + main_sizer = wx.BoxSizer(wx.VERTICAL) + main_sizer.Add(user_sizer, 0, wx.ALL, 2) + main_sizer.Add(pass_sizer, 0, wx.ALL, 2) + main_sizer.Add(login_btn, 0, wx.ALL|wx.CENTER, 2) + + self.SetSizer(main_sizer) + + def onLogin(self, _): + """check credentials and login""" + if self.username not in ("", None) and self.password.GetValue() not in ("", None): + self.logged_id = True + self.Close() + class FattureCCSRFrame(wx.Frame): """main application frame""" def __init__(self, parent, title): @@ -13,19 +49,22 @@ class FattureCCSRFrame(wx.Frame): self.input_file_ext = None self.output_file_path = None - super(FattureCCSRFrame, self).__init__(parent, title=title, size=(500, 150)) + super(FattureCCSRFrame, self).__init__(parent, wx.ID_ANY, title, size=(500, 120)) panel = wx.Panel(self) vbox = wx.BoxSizer(wx.VERTICAL) hbox1 = wx.BoxSizer(wx.HORIZONTAL) hbox2 = wx.BoxSizer(wx.HORIZONTAL) - self.input_file_picker = wx.FilePickerCtrl(panel, 101, "", "Seleziona il .csv o .xml", "*.csv;*.xml", style=wx.FLP_DEFAULT_STYLE|wx.FLP_USE_TEXTCTRL) + input_file_text = wx.StaticText(panel, wx.ID_ANY, "Seleziona il file scaricato dal portare della CCSR") + + self.input_file_picker = wx.FilePickerCtrl(panel, 101, "", "Seleziona il .xlsx, .csv o .xml", "*.xlsx;*.csv;*.xml", style=wx.FLP_DEFAULT_STYLE|wx.FLP_USE_TEXTCTRL) hbox1.Add(self.input_file_picker, 1, wx.EXPAND, 0) self.input_file_picker.Bind(wx.EVT_FILEPICKER_CHANGED, self.file_picker_changed) self.download_btn = wx.Button(panel, 201, "Scarica Fatture") hbox2.Add(self.download_btn, 0, wx.ALIGN_CENTER) self.download_btn.Bind(wx.EVT_BUTTON, self.btn_onclick) + self.download_btn.Disable() self.traf2000_btn = wx.Button(panel, 202, "Genera TRAF2000") hbox2.Add(self.traf2000_btn, 0, wx.ALIGN_CENTER) @@ -34,6 +73,7 @@ class FattureCCSRFrame(wx.Frame): self.output_file_dialog = wx.FileDialog(panel, "Scegli dove salvare il file TRAF2000", defaultFile="TRAF2000", style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) + vbox.Add(input_file_text, 0, wx.ALIGN_CENTER_HORIZONTAL) vbox.Add(hbox1, 0, wx.EXPAND) vbox.Add(hbox2, 0, wx.ALIGN_CENTER_HORIZONTAL) @@ -49,15 +89,24 @@ class FattureCCSRFrame(wx.Frame): print("ERROR: No input file selected!") return self.input_file_ext = os.path.splitext(self.input_file_path)[1] - if self.input_file_ext not in (".csv", ".xml"): + if self.input_file_ext == ".xlsx": + self.download_btn.Enable() + elif self.input_file_ext in (".csv", ".xml"): + self.traf2000_btn.Enable() + else: print("ERROR: wrong file extension: " + self.input_file_ext) return - self.traf2000_btn.Enable() + def btn_onclick(self, event): """event raised when a button is clicked""" btn_id = event.GetEventObject().GetId() - if btn_id == 202: + if btn_id == 201: + login_dlg = LoginDialog(self, "Inserisci le credenziali di login al portale della CCSR") + login_dlg.ShowModal() + if login_dlg.logged_id: + print("Download") + elif btn_id == 202: if self.output_file_dialog.ShowModal() == wx.ID_OK: self.output_file_path = self.output_file_dialog.GetPath() try: