Example #1
0
    def refresh(self):
        # Aggiornamento TreeView
        idArticolo = self.id_articolo_filter_customcombobox1.getId()
        if idArticolo is None:
            self._treeViewModel.clear()
            messageInfo(transient=self._visualizzazione.getTopLevel(), msg='Selezionare un articolo !')
            return

        idListino = findIdFromCombobox(self.id_listino_filter_combobox1)
        daDataListino = stringToDate(self.da_data_listino_filter_entry.get_text())
        aDataListino = stringToDate(self.a_data_listino_filter_entry.get_text())

        self.numRecords = ListinoArticolo().count(idArticolo=idArticolo,
                                                            idListino=idListino,
                                                            listinoAttuale=None,
#                                                            daDataListino =daDataListino,
#                                                            aDataListino=aDataListino
                                                            )

        self._refreshPageCount()

        liss = ListinoArticolo().select(orderBy=self.orderBy,
                                                    idArticolo=idArticolo,
                                                    idListino=idListino,
                                                    listinoAttuale=None,
#                                                    daDataListino=daDataListino,
#                                                    aDataListino=aDataListino,
                                                    offset = self.offset,
                                                    batchSize = self.batchSize)


        self._treeViewModel.clear()

        for l in liss:
            przDet = mN(l.prezzo_dettaglio or 0)
            przIngr = mN(l.prezzo_ingrosso or 0)
            ricDett = '%-6.3f' % calcolaRicarico(float(l.ultimo_costo or 0),
                                                 float(l.prezzo_dettaglio or 0),
                                                 float(l.percentuale_iva or 0))
            margDett = '%-6.3f' % calcolaMargine(float(l.ultimo_costo or 0),
                                                 float(l.prezzo_dettaglio or 0),
                                                 float(l.percentuale_iva or 0))
            ricIngr = '%-6.3f' % calcolaRicarico(float(l.ultimo_costo or 0),
                                                 float(l.prezzo_ingrosso or 0))
            margIngr = '%-6.3f' % calcolaMargine(float(l.ultimo_costo or 0),
                                                 float(l.prezzo_ingrosso or 0))

            self._treeViewModel.append((l,
                                        (l.denominazione or ''),
                                        dateToString(l.data_listino),
                                        przDet, ricDett, margDett,
                                        przIngr, ricIngr, margIngr,
                                        (l.ultimo_costo or 0)))
Example #2
0
    def salvaFile(self):
        data_inizio = stringToDate(self.data_inizio_entry.get_text())
        nome_file = 'ESTRATTO_RIBA_' + data_inizio.strftime('%m_%y') + ".txt"
        fileDialog = gtk.FileChooserDialog(title='Salvare il file',
                                           parent=self.getTopLevel(),
                                           action= GTK_FILE_CHOOSER_ACTION_SAVE,
                                           buttons=(gtk.STOCK_CANCEL,
                                                    GTK_RESPONSE_CANCEL,
                                                    gtk.STOCK_SAVE,
                                                    GTK_RESPONSE_OK),
                                           backend=None)
        fileDialog.set_current_name(nome_file)
        fileDialog.set_current_folder(Environment.documentsDir)

        response = fileDialog.run()

        if ( (response == GTK_RESPONSE_CANCEL) or ( response == GTK_RESPONSE_DELETE_EVENT)) :
            fileDialog.destroy()
        elif response == GTK_RESPONSE_OK:
            filename = fileDialog.get_filename()
            if not filename:
                messageInfo(msg="Nessun nome scelto per il file")
            else:
                fileDialog.destroy()
                self.generatore.write(filename)
Example #3
0
    def on_genera_report_button_clicked(self, button):
        self.generatore = PGRiBa(self, self.__creditore)
        self.generatore.bind(self.progressbar1)
        data_inizio = stringToDate(self.data_inizio_entry.get_text())
        data_fine = stringToDate(self.data_fine_entry.get_text())

        pageData = {
            'file': 'riba_export.html',
            'creditore': self.__creditore,
            'data_inizio': data_inizio,
            'data_fine': data_fine,
        }
        res = 0
        try:
            res = self.generatore.analizza(data_inizio, data_fine, pageData=pageData)
        except RuntimeError as e:
            messageError(msg=str(e))
        if res != 0:
            self.salva_file_button.set_sensitive(True)
            renderHTML(self.view, renderTemplate(pageData))
Example #4
0
 def saveDao(self, tipo=None):
     id_banca = findIdFromCombobox(self.id_banca_ccb.combobox)
     if id_banca is None:
         obligatoryField(self.dialogTopLevel, self.id_banca_ccb.combobox)
     self.dao.id_banca = id_banca
     self.dao.numero_conto = self.numero_conto_entry.get_text()
     self.dao.data_riporto = stringToDate(self.data_widget.get_text())
     self.dao.valore_riporto = self.valore_smentry.get_text() or Decimal(0)
     self.dao.codice_sia = self.codice_sia_entry.get_text()
     self.dao.banca_predefinita = self.banca_pref_check.get_active()
     self.dao.id_azienda = self._anagrafica._idAzienda
     self.dao.persist()