Ejemplo n.º 1
0
 def BillNextID(self, vendor):
   ''' Return the next Bill ID. '''
   from gnucash.gnucash_core_c import gncInvoiceNextID
   return gncInvoiceNextID(self.get_instance(),vendor.GetEndOwner().get_instance()[1])
income = root.lookup_by_name("Earned Income")
assert(income != None)
if income.GetType() == -1:
  print "Didn't get income account exiting"
  session.end()
  quit()
assets = root.lookup_by_name("Assets")
recievables = assets.lookup_by_name("Accounts Recievable")
comm_table = book.get_table()
gbp = comm_table.lookup("CURRENCY", "GBP")
customer = book.CustomerLookupByID(CUSTOMER_ID)
assert(customer != None)
assert(isinstance(customer, Customer))

from gnucash.gnucash_core_c import gncInvoiceNextID
iID = gncInvoiceNextID(book.get_instance(),customer.GetEndOwner().get_instance()[1]) 
invoice = Invoice(book, iID, gbp, customer)
assert(invoice != None)
assert(isinstance(invoice, Invoice))
invoice.SetDateOpened(datetime.date.today())



csv_line="date,task,duration,rate\r\n"
csv_file.write(csv_line)
for line in data:
  date = line[0]
  task = line[2]
  duration = str(line[3])
  (h, m, s) = duration.split(':')
  d_duration = float(int(h) * 3600 + int(m) * 60 + int(s))/3600 # Convert to a decimal fraction
Ejemplo n.º 3
0
 def InvoiceNextID(self, customer):
   ''' Return the next invoice ID.
   '''
   from gnucash.gnucash_core_c import gncInvoiceNextID
   return gncInvoiceNextID(self.get_instance(),customer.GetEndOwner().get_instance()[1])
Ejemplo n.º 4
0
 def BillNextID(self, vendor):
   ''' Return the next Bill ID. '''
   from gnucash.gnucash_core_c import gncInvoiceNextID
   return gncInvoiceNextID(self.get_instance(),vendor.GetEndOwner().get_instance()[1])
Ejemplo n.º 5
0
 def InvoiceNextID(self, customer):
   ''' Return the next invoice ID.
   '''
   from gnucash.gnucash_core_c import gncInvoiceNextID
   return gncInvoiceNextID(self.get_instance(),customer.GetEndOwner().get_instance()[1])
Ejemplo n.º 6
0
 def InvoiceNextID(self, customer):
     ''' Return the next invoice ID.
   This works but I'm not entirely happy with it.  FIX ME'''
     from gnucash.gnucash_core_c import gncInvoiceNextID
     return gncInvoiceNextID(self.get_instance(),
                             customer.GetEndOwner().get_instance()[1])
Ejemplo n.º 7
0
 def InvoiceNextID(self, customer):
   ''' Return the next invoice ID.
   This works but I'm not entirely happy with it.  FIX ME'''
   from gnucash.gnucash_core_c import gncInvoiceNextID
   return gncInvoiceNextID(self.get_instance(),customer.GetEndOwner().get_instance()[1])
Ejemplo n.º 8
0
income = root.lookup_by_name("Earned Income")
assert (income != None)
if income.GetType() == -1:
    print "Didn't get income account exiting"
    session.end()
    quit()
assets = root.lookup_by_name("Assets")
recievables = assets.lookup_by_name("Accounts Recievable")
comm_table = book.get_table()
gbp = comm_table.lookup("CURRENCY", "GBP")
customer = book.CustomerLookupByID(CUSTOMER_ID)
assert (customer != None)
assert (isinstance(customer, Customer))

from gnucash.gnucash_core_c import gncInvoiceNextID
iID = gncInvoiceNextID(book.get_instance(),
                       customer.GetEndOwner().get_instance()[1])
invoice = Invoice(book, iID, gbp, customer)
assert (invoice != None)
assert (isinstance(invoice, Invoice))
invoice.SetDateOpened(datetime.date.today())

csv_line = "date,task,duration,rate\r\n"
csv_file.write(csv_line)
for line in data:
    date = line[0]
    task = line[2]
    duration = str(line[3])
    (h, m, s) = duration.split(':')
    d_duration = float(int(h) * 3600 + int(m) * 60 +
                       int(s)) / 3600  # Convert to a decimal fraction
    #print d_duration