コード例 #1
0
	def save_invoice_button_clicked (self, button):
		if self.request_po_attachment and not self.attachment:
			dialog = self.get_object('missing_attachment_dialog')
			result = dialog.run()
			dialog.hide()
			if result == Gtk.ResponseType.CANCEL:
				return 
			elif result == 0:
				import pdf_attachment
				paw = pdf_attachment.PdfAttachmentWindow(self.window)
				paw.connect("pdf_optimized", self.optimized_callback)
				return
		invoice_number = self.get_object('entry6').get_text()
		self.cursor.execute("UPDATE purchase_orders "
							"SET (amount_due, invoiced, total, "
								"invoice_description) = "
							"(%s, True, %s, %s) WHERE id = %s", 
							(self.total, self.total, invoice_number, 
							self.purchase_order_id))
		post_purchase_order (self.total, self.purchase_order_id)
		self.cursor.execute("SELECT accrual_based FROM settings")
		if self.cursor.fetchone()[0] == True:
			post_purchase_order_accounts (self.purchase_order_id, 
											datetime.today())
		DB.commit()
		self.window.destroy()
コード例 #2
0
	def edit_attachment_activated (self, menuitem):
		selection = self.get_object('incoming_invoices_tree_selection')
		model, path = selection.get_selected_rows()
		if path == []:
			return
		file_id = model[path][0]
		import pdf_attachment
		paw = pdf_attachment.PdfAttachmentWindow(self.window)
		paw.connect("pdf_optimized", self.optimized_callback, file_id)
コード例 #3
0
	def add_exemption_clicked (self, widget):
		selection = self.get_object('treeview-selection2')
		model, path = selection.get_selected_rows()
		if path == []:
			return
		exemption_id = model[path][0]
		import pdf_attachment
		paw = pdf_attachment.PdfAttachmentWindow(self.window)
		paw.window.set_modal(True)
		paw.connect("pdf_optimized", self.optimized_callback, exemption_id)
コード例 #4
0
	def view_attachment_activated (self, menuitem):
		selection = self.get_object('incoming_invoices_tree_selection')
		model, path = selection.get_selected_rows()
		if path == []:
			return
		file_id = model[path][0]
		self.cursor.execute("SELECT attached_pdf FROM incoming_invoices "
							"WHERE id = %s "
							"AND attached_pdf IS NOT NULL", (file_id,))
		for row in self.cursor.fetchall():
			file_name = "/tmp/Attachment.pdf"
			file_data = row[0]
			with open(file_name,'wb') as f:
				f.write(file_data)
				subprocess.call(["xdg-open", file_name])
			DB.rollback()
			break
		else: # no pdf found, give the user the option to attach one
			import pdf_attachment
			paw = pdf_attachment.PdfAttachmentWindow(self.window)
			paw.connect("pdf_optimized", self.optimized_callback, file_id)
コード例 #5
0
	def attach_button_clicked (self, button):
		import pdf_attachment
		paw = pdf_attachment.PdfAttachmentWindow(self.window)
		paw.connect("pdf_optimized", self.optimized_callback)
コード例 #6
0
 def run_attach_dialog(self, po_id):
     import pdf_attachment
     paw = pdf_attachment.PdfAttachmentWindow(self.window)
     paw.connect("pdf_optimized", self.optimized_callback, po_id)