-
-
Save eluizbr/df9a4b8adf8a9d9ca746 to your computer and use it in GitHub Desktop.
boleto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def print_teste_boleto(boleto, banco_nome,nosso_num,numero): | |
# Caixa Formato normal - uma pagina por folha A4 | |
# pdf = BoletoPDF('static/pdf/%s-%s-%s.pdf' %(banco_nome,numero,nosso_num)) | |
# for i in range(1): | |
# pdf.drawBoleto(boleto) | |
# pdf.nextPage() | |
# pdf.save() | |
# Formato carnê - uma pagina por folha A4 | |
pdf = BoletoPDF('static/pdf/%s-%s-%s.pdf' %(banco_nome,numero,nosso_num), True) | |
for i in range(1): | |
pdf.drawBoletoCarneDuplo(boleto, boleto) | |
pdf.nextPage() | |
pdf.save() | |
def print_itau(num_pedido=None): | |
pedido = Pedido.objects.get(num_pedido=num_pedido) | |
entrega = EnderecoEntrega.objects.get(pedido_id=pedido.id) | |
cliente = Cliente.objects.get(id=pedido.cpf_id) | |
parcelas = int(pedido.parcelas) | |
contador = 1 | |
while contador <= parcelas: | |
boletos_pedido = PagamentoPedido.objects.get(pedido_num_id=pedido.id,parcela=contador) | |
cliente_nome = cliente.nome + ' - ' + cliente.cpf | |
cliente_endereco = cliente.endereco + ',' + cliente.numero + ', ' + cliente.bairro | |
cliente_cidade = cliente.cidade + ' - ' + cliente.estado + ' - ' + cliente.cep | |
d = BoletoItau() | |
d.carteira = '175' | |
d.cedente = 'Empresa ACME LTDA' | |
d.cedente_documento = "102.323.777-01" | |
d.cedente_endereco = "Rua Acme, 123 - Centro - Sao Paulo/SP - CEP: 12345-678" | |
d.agencia_cedente = '1565' | |
d.conta_cedente = '32414' | |
d.data_vencimento = boletos_pedido.vencimento | |
d.data_documento = boletos_pedido.vencimento | |
d.data_processamento = boletos_pedido.vencimento | |
d.valor = int(boletos_pedido.valor) | |
d.valor_documento = int(boletos_pedido.valor) | |
d.nosso_numero = str(boletos_pedido.nosso_num) | |
d.numero_documento = str(boletos_pedido.nosso_num) | |
d.instrucoes = [ | |
"1 - Sr. Caixa, cobrar multa de 2% após o vencimento", | |
"2 - Receber até 10 dias após o vencimento", | |
] | |
d.demonstrativo = [ | |
"1 - Serviço Teste R$ 255,00", | |
"2 - Total R$ 255,00", | |
] | |
d.sacado = [ | |
cliente_nome, | |
cliente_endereco, | |
cliente_cidade | |
] | |
print_teste_boleto(d, 'itau',boletos_pedido.nosso_num,pedido.num_pedido) | |
contador += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment