def Entrada(self): dataInicio = QDate.toString( self.dt_inicio.date(), "yyyy-MM-dd") dataFim = QDate.toString( self.dt_fim.date(), "yyyy-MM-dd") busca = CrudContaAReceber() busca.dataRecebimento = dataInicio busca.dataFim = dataFim busca.movEntrada() # Setando a data referente a busca self.lb_inicioMovimento.setText(QDate.toString( self.dt_inicio.date(), "dd-MM-yyyy")) self.lb_fimMovimento.setText(QDate.toString( self.dt_fim.date(), "dd-MM-yyyy")) self.lb_inicioDespesa.setText(QDate.toString( self.dt_inicio.date(), "dd-MM-yyyy")) self.lb_fimDespesa.setText(QDate.toString( self.dt_fim.date(), "dd-MM-yyyy")) self.lb_entradaPendente.setText(str(busca.valorAReceber)) self.lb_entradaRecebido.setText(str(busca.valorRecebido)) if busca.valorAReceber > 0.01: # Grafico if busca.valorRecebido: valor = busca.valorRecebido / busca.valorAReceber * 100 # formato self.pr_receita.setFormat("%.02f%%" % (valor)) # Max e valor self.pr_receita.setMaximum(busca.valorAReceber) self.pr_receita.setValue(busca.valorRecebido) self.detalheEntrada() pass
def ReceberParcela(self, id): if not self.tx_valorPago.text(): self.tx_valorPago.setFocus() elif not self.cb_formaPagamento.currentData(): self.cb_formaPagamento.setFocus() else: INSERI = CrudContaAReceber() INSERI.id = self.tx_Cod.text() INSERI.valorRecebido = self.tx_valorPago.text().replace(",", ".") INSERI.formaPagamento = self.cb_formaPagamento.currentData() INSERI.dataRecebimento = QDate.toString( QDate.currentDate(), "yyyy-MM-dd") INSERI.receberConta() self.BuscaContaAReceber(self.tx_Cod.text()) pass
def detalheEntrada(self): dataInicio = QDate.toString(self.dt_inicio.date(), "yyyy-MM-dd") dataFim = QDate.toString(self.dt_fim.date(), "yyyy-MM-dd") busca = CrudContaAReceber() busca.dataRecebimento = dataInicio busca.dataFim = dataFim busca.detalheEntrada() while self.tb_receita.rowCount() > 0: self.tb_receita.removeRow(0) i = 0 while i < len(busca.categoria): self.tb_receita.insertRow(i) self.conteudoTabelaLeft( self.tb_receita, i, 0, busca.categoria[i] + " - " + busca.formaPagamento[i]) self.conteudoTabela(self.tb_receita, i, 1, "R$ " + str(busca.valorRecebido[i])) i += 1 pass
def Receber(self, id): if self.tb_Parcelas.cellWidget(id, 3).text(): # Recebendo parcela INSERI = CrudContaAReceber() INSERI.id = self.tb_Parcelas.item(id, 0).text() INSERI.valorRecebido = self.tb_Parcelas.cellWidget( id, 3).text().replace(",", ".") INSERI.formaPagamento = self.cb_FormaPagamento.currentData() INSERI.dataRecebimento = QDate.toString(QDate.currentDate(), "yyyy-MM-dd") # Inserindo valor recebido no DB INSERI.receberConta() # Atualizando valor Recebido INSERI = CrudVenda() INSERI.id = self.tx_Cod.text() INSERI.valorRecebido = self.tb_Parcelas.cellWidget( id, 3).text().replace(",", ".") # Executando o update no DB INSERI.Receber() # Recalculando valores if self.tx_valorRecebido.text(): valorRecebido = float(self.tx_valorRecebido.text()) + float( INSERI.valorRecebido) else: valorRecebido = float(INSERI.valorRecebido) self.tx_valorRecebido.setText(format(valorRecebido, '.2f')) self.TotalFinal() # populando tabelas de parcelas a receber self.ParcelasAReceber()