Ponto de Equilíbrio Financeiro usando tkinter

O Ponto de Equilíbrio Financeiro é o mínimo que uma empresa deve faturar para não ter prejuízo.


Ao atingir este valor, a empresa não tem lucro e nem prejuízo, ou seja, ficar no zero a zero.


Esta é a meta mínima da mínima da mínima que seu negócio precisa alcançar.


Se o faturamento for inferior ao Ponto de Equilíbrio, inevitavelmente você terá prejuízo!


apagar.png


 


import tkinter

class compintapp_tk(tkinter.Tk):
def __init__(self,parent):
tkinter.Tk.__init__(self,parent)
self.parent = parent
self.initialize()

def initialize(self):
self.grid()
## Title ---------------------------------------
titlelbl = tkinter.Label(self, text="Calcular do ponto de"
" Equilíbrio Financeiro "
"da Empresa",
anchor="center",fg="white"
,bg="blue")
titlelbl.grid(column=0,row=0,columnspan=3,
sticky='EW')

## Input Labels --------------------------------------------------
gflbl = tkinter.Label(self, text=" Estimativa dos "
"Gastos Fixos: ",

anchor="w",fg="white",
bg="SlateGray4")
gflbl.grid(column=0,row=1,columnspan=1,
sticky='EW')
separadorlbl = tkinter.Label(self, text="Estimativa"
" dos Custos Variáveis",
anchor="center", fg="white"
, bg="green")
separadorlbl.grid(column=0, row=2, columnspan=3,
sticky='EW')

custosfmtlbl = tkinter.Label(self, text="% Custo Fornecedor/"
"Matéria-Prima/"
"Terceirizações:",

anchor="w", fg="white",
bg="SlateGray4")
custosfmtlbl.grid(column=0, row=3, columnspan=1,
sticky='EW')

impostoslbl = tkinter.Label(self, text="% Impostos sobre a"
" Fatura:"
" ",

anchor="w", fg="white",
bg="SlateGray4")
impostoslbl.grid(column=0, row=4, columnspan=1,
sticky='EW')

cvendaslbl = tkinter.Label(self, text="Comissão de Vendas:"
" ",

anchor="w", fg="white",
bg="SlateGray4")
cvendaslbl.grid(column=0, row=5, columnspan=1,
sticky='EW')

tcartaolbl = tkinter.Label(self, text="% Taxas do cartão de "
"crédito/débito :",

anchor="w", fg="white",
bg="SlateGray4")
tcartaolbl.grid(column=0, row=6, columnspan=1,
sticky='EW')
toutrolbl = tkinter.Label(self, text="Outros %",
anchor="w", fg="white",
bg="SlateGray4")
toutrolbl.grid(column=0, row=7, columnspan=1,
sticky='EW')

pequilibrolbl = tkinter.Label(self, text="Ponto de"
" Equilíbrio",
anchor="w", fg="white",
bg="SlateGray4")
pequilibrolbl.grid(column=0, row=9, columnspan=1,
sticky='EW')



## end of input labels ------------------------------------------------
## Input Boxes --------------------------------------------------------

self.gfixo = tkinter.DoubleVar()
gastofixo = tkinter.Entry(self,textvariable=self.gfixo)
gastofixo.grid(column=1,row=1, sticky='EW')

self.cfmt = tkinter.DoubleVar()
custofmt = tkinter.Entry(self, textvariable=self.cfmt)
custofmt.grid(column=1, row=3, sticky='EW')

self.imp = tkinter.DoubleVar()
imposto = tkinter.Entry(self, textvariable=self.imp)
imposto.grid(column=1, row=4, sticky='EW')

self.cvendas = tkinter.DoubleVar()
vendas = tkinter.Entry(self, textvariable=self.cvendas)
vendas.grid(column=1, row=5, sticky='EW')

self.tcartao = tkinter.DoubleVar()
taxacartao = tkinter.Entry(self, textvariable=self.tcartao)
taxacartao.grid(column=1, row=6, sticky='EW')

self.outro = tkinter.DoubleVar()
toutro = tkinter.Entry(self, textvariable=self.outro)
toutro.grid(column=1, row=7, sticky='EW')





## end of input boxes -------------------------------------------------
## Button
button = tkinter.Button(self,text="Calcular",
command=self.OnButtonClick)
button.grid(column=0,row=8,columnspan=3)
## end of button

## Output labels
self.pe = tkinter.StringVar()
pontoequibrio = tkinter.Label(self,
textvariable=self.pe,
anchor="e",fg="red",
bg="yellow")
pontoequibrio.grid(column=1,row=9,columnspan=2,
sticky='EW')

## end of output labels -----------------------------------------------

self.grid_columnconfigure(0,weight=1)
self.resizable(True,False)

def OnButtonClick(self):
p = self.gfixo.get()
a = self.imp.get()
b = self.cvendas.get()
c = self.tcartao.get()
d = self.outro.get()
e = self.cfmt.get()
custov=100-(a+b+c+d+e)
percentagem=custov/100
pontoequili = round((p/percentagem),2)
self.pe.set(pontoequili)

if __name__ == "__main__":
app = compintapp_tk(None)
app.title('Calcular o Ponto Equilíbrio')
app.mainloop()

 

Comentários

Mensagens populares deste blogue

Criar Cartões de Visita

12 signos egípcios

Calcular a percentagem de ocupação