コード例 #1
0
ファイル: test.py プロジェクト: FelixAkk/masin
class Masin(QtGui.QMainWindow):
  def __init__(self, parent=None):
    QtGui.QWidget.__init__(self, parent)
    self.ui = Ui_MainWindow()
    self.ui.setupUi(self)
    
    self.signals()

    self.gci = Gcinvoice()

  def gnuCashClick(self):
    filename = QtGui.QFileDialog.getOpenFileName(self, 'Choose File', '.')
    self.ui.gnuCashEditline.setText(filename)

  def latexTemplateClick(self):
    filename = QtGui.QFileDialog.getOpenFileName(self, 'Choose File', '.')
    self.ui.latexTemplateEditline.setText(filename)

  def outputFilenameClick(self):
    filename = QtGui.QFileDialog.getOpenFileName(self, 'Create File', '.')
    self.ui.outputFilenameEditline.setText(filename)

  def signals(self):
    QtCore.QObject.connect(self.ui.gnuCashButton, QtCore.SIGNAL("clicked()"), self.gnuCashClick)
    QtCore.QObject.connect(self.ui.latexTemplateButton, QtCore.SIGNAL("clicked()"), self.latexTemplateClick)
    QtCore.QObject.connect(self.ui.outputFilenameButton, QtCore.SIGNAL("clicked()"), self.outputFilenameClick)
    QtCore.QObject.connect(self.ui.generateButton, QtCore.SIGNAL("clicked()"), self.generateClick)

  def generateClick(self):
    self.gci.parse(str(self.ui.gnuCashEditline.text()))
    self.gci.createInvoice(invoiceid=str(self.ui.invoiceNumberSpinbox.text()), template=str(self.ui.latexTemplateEditline.text()), outfile=str(self.ui.outputFilenameEditline.text()))
    print "done"
コード例 #2
0
ファイル: test.py プロジェクト: FelixAkk/masin
  def __init__(self, parent=None):
    QtGui.QWidget.__init__(self, parent)
    self.ui = Ui_MainWindow()
    self.ui.setupUi(self)
    
    self.signals()

    self.gci = Gcinvoice()
コード例 #3
0
ファイル: masin.py プロジェクト: FelixAkk/masin
class Masin(QtGui.QMainWindow):
	def __init__(self, parent=None):
		QtGui.QWidget.__init__(self, parent)
		self.ui = Ui_MainWindow()
		self.ui.setupUi(self)
		
		self.signals()
	
		self.gci = Gcinvoice()
	
		self.defaultBullShit()
	
	def defaultBullShit(self):
		self.ui.gnuCashEditline.setText("D:\\AerixSVN\\documents\\aerix_accounting.gnucash")
		self.ui.latexTemplateEditline.setText("D:\\Aerix\\facturen\\masin\\example\\invoice_template.tex")
		self.ui.outputFilenameEditline.setText("D:\\Aerix\\facturen\\masin\\src\\lol.tex")
		self.ui.invoiceNumberSpinbox.setValue(8)

	def gnuCashClick(self):
		filename = QtGui.QFileDialog.getOpenFileName(self, 'Choose GnuCash Data File', '.')
		self.ui.gnuCashEditline.setText(filename)

	def latexTemplateClick(self):
		filename = QtGui.QFileDialog.getOpenFileName(self, 'Choose Template File', '.')
		self.ui.latexTemplateEditline.setText(filename)

	def outputFilenameClick(self):
		filename = QtGui.QFileDialog.getSaveFileName(self, 'Create Output File', '.')
		self.ui.outputFilenameEditline.setText(filename)

	def signals(self):
		QtCore.QObject.connect(self.ui.gnuCashButton, QtCore.SIGNAL("clicked()"), self.gnuCashClick)
		QtCore.QObject.connect(self.ui.latexTemplateButton, QtCore.SIGNAL("clicked()"), self.latexTemplateClick)
		QtCore.QObject.connect(self.ui.outputFilenameButton, QtCore.SIGNAL("clicked()"), self.outputFilenameClick)
		QtCore.QObject.connect(self.ui.generateButton, QtCore.SIGNAL("clicked()"), self.generateClick)

	def generateClick(self):
		self.gci.parse(str(self.ui.gnuCashEditline.text()))
		self.gci.createInvoice(invoiceid=str(self.ui.invoiceNumberSpinbox.text()), template=str(self.ui.latexTemplateEditline.text()), outfile=str(self.ui.outputFilenameEditline.text()))
		print "done"
コード例 #4
0
ファイル: load.py プロジェクト: morristech/applemonweb
                           InvoiceLineItem, InvoiceLineAction, Payment)

gcfile = 'accounting.gnucash'
infile = 'payments.csv'


def str2date(text):
    year = int(text.split('/')[2])
    if year > 99:
        date = datetime.strptime(text.strip(), '%m/%d/%Y').date()
    else:
        date = datetime.strptime(text.strip(), '%m/%d/%y').date()
    return date


gc = Gcinvoice()
gc.parse(gcfile)

for obj in [Client, Project, Invoice, InvoiceLineItem, InvoiceLineAction,
            Payment]:
    table = obj._meta.db_table
    with django.db.connection.cursor() as cursor:
        cursor.execute("DELETE FROM '{}'".format(table))
        cursor.execute(
            "DELETE FROM sqlite_sequence where name = %s",
            [table],
        )

for customer in gc.customers.values():
    if customer['full_name'] == "DELETEME":
        continue