Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Arrumando a casa

  • Loading branch information...
commit 4f50a1933a370661260aedf3a45bf9a54c6899d8 1 parent 7b0dc8e
@maurogeorge maurogeorge authored
View
5 .gitignore
@@ -1,5 +0,0 @@
-.buildpath
-.project
-.settings
-
-*.swp
View
15 .gitmodules
@@ -1,15 +0,0 @@
-[submodule "boleto-lib/bancos/748"]
- path = boleto-lib/bancos/748
- url = git@github.com:drupalista-br/Boleto-Sicredi.git
-[submodule "boleto-lib/bancos/001"]
- path = boleto-lib/bancos/001
- url = git@github.com:drupalista-br/Boleto-BB.git
-[submodule "boleto-lib/bancos/104"]
- path = boleto-lib/bancos/104
- url = git@github.com:drupalista-br/Boleto-Caixa.git
-[submodule "boleto-lib/bancos/237"]
- path = boleto-lib/bancos/237
- url = git@github.com:drupalista-br/Boleto-Bradesco.git
-[submodule "boleto-lib/bancos/341"]
- path = boleto-lib/bancos/341
- url = git@github.com:drupalista-br/Boleto-Sicredi.git
View
14 COPYRIGHT.txt
@@ -1,14 +0,0 @@
-All the Boleto package code is Copyright 2011 by the original authors.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program as the file LICENSE.txt; if not, please see
-http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
View
339 LICENSE.txt
@@ -1,339 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
View
345 README.txt
@@ -1,345 +0,0 @@
-@author Francisco Luz <franciscoferreiraluz at yahoo dot com dot au>
-@package Boleto
-@version 1.0 Beta
-
-TOPICOS
- 1. Visão Geral
- 2. Instalação (integrar o API)
- 3. Reportando Bugs, Pedindo Ajuda e Fazendo Sugestões
- 4. Propriedades do Objeto
- 5. Implementando novos Bancos
- 6. Debugging
- 7. Publicando a sua Implementação
-
-1. VISÃO GERAL
-
- O que mudou entre Boletophp 0.17 e Boleto 1.0?
-
- - O código foi totalmente re-escrito usando o conceito de OOP;
-
- - Ficou muito mais fácil de integrar a qualquer aplicação externa utilizando-se do conceito de API. Assim
- o usuário desenvolvedor não precisa mexer nas bibliotecas do pacote, o que facilita ainda as atualizações;
-
- - Ficou mais simples de se implementar novos bancos bem como novas carteiras, pois a classe principal (Boleto)
- faz todo o trabalho pesado.
-
-2. INSTALAÇÃO (Integrar o API)
-
- Ao descompactar o arquivo do pacote que você baixou, terás uma pasta que conterá, entre outros, um arquivo
- de exemplo (example.php) para integrar o API e uma subpasta chamada boleto-lib.
-
- Esta subpasta (boleto-lib) é a nossa biblioteca.
-
- Para fazer uso desta biblioteca em sua aplicação proceda da seguinte forma:
-
- a) Copie a pasta boleto-lib para um diretorio dentro de sua pasta pública.
- Por exemplo: www/bibliotecas/boleto-lib
-
- b) Acesse https://github.com/drupalista-br/Boleto/wiki/Projeto-Boletophp-API e faça o download dos
- plugin(s) que implementa(m) o(s) os banco(s) que você trabalha para a emissão de boletos.
-
- c) Vá até a pasta boleto-lib/bancos e crie uma sub pasta. O nome desta sub-pasta deverá ser o código
- do banco. Seguindo o nosso exemplo, se baixarmos a implementação do Banco do Brasil então ficaria
- assim:
-
- www/bibliotecas/boleto-lib/001
-
- d) Copie os arquivos da implementação para dentro da pasta que você criou na letra "c" acima.
- Novamente seguindo o nosso exemplo do Banco do Brasil, o arquivo da classe que extends Boleto
- ficará localizado em:
-
- www/bibliotecas/boleto-lib/001/Banco_001.php
-
- NOTAS: Se a implementação do banco que queira trabalhar ainda não estiver disponível então
- leia as instruções no item "5. IMPLEMENTANDO NOVOS BANCOS" para desenvolver o seu próprio
- plugin, uma vez que tiver pronto disponibilize o código para que este possa ser
- publicado no projeto.
-
- d) Para integrar o Boleto API a sua aplicação, por exemplo www/gera-boleto.php
- (http://localhost/gera-boleto.php), proceda da seguinte forma:
-
- - Dentro de gera-boleto.php crie uma array com os argumentos a serem passados.
-
- NOTA: Veja o arquivo exemplo.php que acompanha o pacote para uma lista de todos os
- argumentos possíveis.
-
- Leia o arquivo readme.txt da implementação de cada banco localizado em
- www/bibliotecas/boleto-lib/bancos/XXX/readme.txt onde XXX é o código do banco,
- para saber mas detalhes no formato e requisitos de validação de campos específicos.
-
- Para o argumento 'library_location', em nosso exemplo, ficaria 'bibliotecas/boleto-lib'
-
- - Inclua o arquivo da biblioteca com o seguinde código:
- include_once($argumentos['library_location'].'/Boleto.class.php');
-
- - Instancie um novo objeto. Por exemplo:
- $boleto = new Boleto($argumentos);
-
- - Para imprimir as propriedades do objeto faça assim:
- echo '<pre>';
- print_r($boleto);
-
- visite http://localhost/gera-boleto.php para visualizar as propriedades do objeto que vc
- acabou de instanciar.
-
- - Você notará que a propriedade output (a última da estrutura) estará vazia. Veja mais detalhes
- em "4. PROPRIEDADES DO OBJETO" logo abaixo, mas basicamente se você quizer fazer a renderização do html
- chame o método output() assim:
-
- $boleto->output();
-
- Pronto, agora ao recarregar o seu navegador em http://localhost/gera-boleto.php será impresso o boleto.
-
- - Agora se você precisa apenas dos valores da propriedade output para customizar a sua propria renderização,
- basta passar o valor FALSE na chamada do método output(). Assim:
-
- $boleto->output(FALSE);
-
- Logo abaixo coloque:
- echo '<pre>';
- print_r($boleto);
-
- recarregue http://localhost/gera-boleto.php e verá que agora a propriedade "output" estará populada pronta
- para ser usada, mas o html não é renderizado desta vez.
-
-
-3. REPORTANDO BUGS, PEDINDO AJUDA E FAZENDO SUGESTÕES
-
- A sua pergunta, sugestão ou informação de bug é muitíssimo bem vinda, entretando peço gentilmente que não envie
- emails para mim ou quaisquer outros colaboradores do projeto e sim poste na lista de Issues de cada repositório.
-
- Digo "cada repositório" porque a biblioteca principal (Boleto) é um repositório assim como as implementações
- de bancos são também, cada um deles, um repositório em separado, justamente para facilitar o desenvolvimento,
- melhoramento e manutenção.
-
- A razão para se postar na lista de Issues ao invés de enviar emails é muito simples:
-
- 1o. O projeto é uma comunidade onde todos devem participar ajudando da forma que podem, assim a sua dúvida,
- sugestão, pedido, erro, será de grande valia para outros que também precisam da mesma informação,
- que, uma vez online, ela vai ficar lá ajundando a comunidade por toda a eternidade ;)
-
- 2o. Postando online você poderá ser respondido por qualquer pessoa que estiver disponível, pois, como
- já dito, todos são encorajados a participar da forma que podem.
-
- Tente ser descritivo no título do seu poste para que as pessoas possam encontra-lo facilmente quando
- estiverem pesquisando nos issues ou mesmo no Google.
-
- Por exemplo:
- "Erro no boleto" não fica muito claro do que se trata, agora
- "Undefined variable $blahblah na linha 8 do arquivo blahblah ao instanciar um novo objeto"
- fica muito mas nitido do que se trata, e assim diminui as duplicações nos Issues.
-
- CORRIGINDO PROBLEMAS OU MELHORANDO O CÓDIGO
-
- Não é obrigatório mas facilita muito se ao enviar uma correção para um bug ou melhoria no código você
- pudesse fazer por meio de um arquivo patch. Informações em http://pt.wikipedia.org/wiki/Patch_(Unix)
-
- Mas postar o código ou anexar arquivos que não sejam patches nos Issues também são bem vindos.
-
- PESQUISAR ANTES DE POSTAR
-
- Outra forma de ajudar é tomando alguns minutos do seu tempo pesquisando na lista de Issues e lendo as
- instruções, tais como este readme, antes de abrir um novo Issue, pois na maioria dos casos a pergunda
- já possui uma resposta disponível.
-
-
-4. PROPRIEDADES DO OBJETO
-
- bank_code - Código do banco.
-
- bank_name - Nome do Banco.
-
- is_implemented - Informa se existe uma classe que extende a classe principal (Boleto), ou seja, se o banco
- está implementado.
- 0 = Não está implementado, 1 = Está implementado. Veja "IMPLEMENTANDO NOVOS BANCOS" logo abaixo.
-
- A implementação de cada banco se dá por uma sub classe (child) que extende a classe Boleto (parent).
-
- warnings - Contém mensagens que podem ajudar a identificar a causa de problemas, tais como inconsistência nos argumentos
- enviados, etc.
-
- methods - Lista de todos os métodos presentes tanto na classe Boleto (parent) como na classe do banco (child)
-
- settings - Contém valores de configuração do objeto.
-
- arguments - Contém todos os valores dos argumentos que foram passados pela aplicação integradora bem como valores
- declarados como padrão que não foram explicitamente passados.
-
- computed - Contém os valores resultantes de transformações no processo de criação do objeto.
-
- febraban - Esta propriedade é a chave central para o cálculo da linha digitável e o código de barras. As específicações
- dos valores seguem esta regra:
-
- Posições 01 a 03 - Código do banco sem o dígito (contem 3 dígitos)
- Posição 04 - Código da Moeda (9-Real) (contem 1 dígito)
- Posição 05 - Dígito verificador do código de barras (contem 1 dígito)
- Posição 06 a 09 - Fator de vencimento (contem 4 dígitos)
- Posições 10 a 19 - Valor Nominal do Título (contem 10 dígitos)
- Posições 20 a 44 - Campo Livre para uso dos bancos (contem 25 dígitos)
-
- NOTA: As posições 20 a 44, por serem de uso dos bancos, é calculado pela classe (child) que implementa o banco.
- Veja "IMPLEMENTANDO NOVOS BANCOS" para mais detalhes.
-
- output - Contém todos os valores que serão impressos nos campos do boleto.
-
- NOTA: Esta propriedade so é populada quando o método output() é explicitamente chamado. Veja
- "INSTALAÇÃO (Integrar o API)" acima.
-
-5. IMPLEMENTANDO NOVOS BANCOS
-
- A classe principal desta biblioteca chama-se Boleto localizada em ../boleto-lib/Boleto.class.php e é a responsavel pelo
- gerenciamento da sub classe (child) que implementa o banco e também responsavel pelos cálculos que geram os valores
- prontos a serem impressos no boleto.
-
- As classes children que implementam caracteristicas específicas de cada banco devem obedecer a este padrão
- de nome e localização:
-
- ../boleto-lib/XXX/Banco_XXX.php
-
- Onde XXX é o código do banco com 3 dígitos.
-
- Na pasta ../boleto-lib/XXX, além do arquivo Banco_XXX.php, deverá conter também:
-
- (obrigatório) logo.jpg - A logomarca do banco
-
- (obrigatório) readme.txt - Instruções específica do banco sendo implementado que fogem a regra geral.
-
- (opcional) layout.tpl.php - Se este arquivo existir então o API desconsiderara o template padrão, que é
- ../boleto-lib/boleto.tpl.php e usará o layout definido pela implementação do banco.
-
- Dê uma olhada na implementação do Banco do Brasil para ver um exemplo
- disto na prática.
-
- (opcional) style.css - Mesmo caso do layout.tpl.php. Se este arquivo existir ele será usado ao invés
- do style padrão, que é ../boleto-lib/style.css. O Banco do Brasil é um bom exemplo.
-
- Uma vez que você criar o arquivo Banco_XXX.php você deverá proceder da seguinte forma:
- (dê uma olhada nos implementações já existentes para ver na prática)
-
- <?php
-
- //O nome da classe child deverá ter o mesmo nome do arquivo.
- //Substitua XXX pelo código do banco
-
- class Banco_XXX extends Boleto{
-
- /**IMPORTANTE: Nunca sobrescreva qualquer valor da propriedade $boleto->arguments
- Ao invés disto salve resultados em $boleto->computed['..nome do campo ..'] */
-
- //Este método é obrigatório
- function setUp($boleto){
-
- //Este método "setUp($boleto)" é chamado logo no comeco da criação do objeto.
- //Aqui você tem a chance de configurar informações da biblioteca, como o nome do banco por exemplo.
-
- ....Seu código vai aqui.....
-
- //Para imprimir na tela todas as propriedades do objeto disponiveis:
- echo '<pre>';
- print_r($boleto);
-
- }
-
- //Este método é obrigatório
- function febraban_20to44($boleto){
-
- //Para imprimir na tela todas as propriedades do objeto disponiveis:
- echo '<pre>';
- print_r($boleto);
-
- //aqui será onde você deverá construir os 25 dígitos que fazem parte do
- //campo livre de uso do banco
-
- ......Seu código vai aqui ....
-
- //no final salve o seu valor na propriedade febraban, assim:
-
- $boleto->febraban['20-44'] = $meu_valor_com_25_dígitos;
-
- }
-
- //Este método é opcional
- function custom($boleto){
-
- //Este é o ultimo método chamado pelo construtor e aqui você tem a chance de fazer os retoques finais
- //no objeto caso seja necessário
-
- ....Seu código vai aqui ....
-
- }
-
-
- //Este método também é opcional e não é chamado pelo construtor, ou seja,
- //ele so é chamado depois que o método output() é explicitamente chamado. Veja "INSTALAÇÃO (Integrar o API)".
-
- function outputValues($boleto){
-
- //aqui você terá a chance de modificar ou incluir campos na propriedade "output" do objeto.
-
- ....Seu código vai aqui ....
-
- }
-
- //Parabéns você acabou de implementar um novo banco
-
- }
-
- ?>
-
-6. DEBUGGING
-
- Independente se você esta tentando integrar o API à sua aplicação ou desenvolvendo uma implementação para
- um determinado banco, as vezes as coisas podem não funcionar como o esperado.
-
- Assim fique sempre de olho na propriedade do objeto chamada "warnings", pois se houver alguma mensagem la
- (que não quer dizer necessáriamente que algo esta errado, por isso chama-se warnings) esta poderá te dar uma
- pista do que esta causando o resultado indesejado.
-
-7. PUBLICANDO A SUA IMPLEMENTAÇÃO
-
- NOTA: Os releases de implementações precisam ser sob a versão 2 or higher da GNU General Public License
-
- Uma vez que sua nova implementação estiver pronta, você pode publica-la de duas formas:
-
- 1a Opção: CRIAR SEU PROPRIO REPOSITORIO NO GITHUB.COM OU QUALQUER OUTRO SERVICO DE SUA ESCOLHA
- (Precisa ter conhecimentos em Git http://pt.wikipedia.org/wiki/Git)
-
- a) Crie uma conta no github.com (ou outro serviço que lhe agrade. Hospedagem é gratuita para projetos
- Open Source), caso já não tenha uma, e crie um repositório chamado Boleto-Nome do Banco
-
- b) Faça os commits e pushes necessários para publicar no repositório.
-
- b) Crie uma Wiki no repositório seguindo o padrão dos bancos já implementados.
- Veja a pagina Wiki da Caixa por exemplo em
- https://github.com/drupalista-br/Boleto-Caixa/wiki/Projeto-Boletophp-API-|-Caixa-Econômica-Federal
-
- c) Abra um novo Issue em https://github.com/drupalista-br/Boleto/issues e poste o link da pagina Wiki
- que você criou.
-
- Após a sua implementação for testada e aprovada, o seu link será adicionada a lista de Implementações
- da pagina da biblioteca principal em
- https://github.com/drupalista-br/Boleto/wiki/Projeto-Boletophp-API.
-
- 2a Opção: USAR A CONTA DO DRUPALISTA-BR NO GITHUB.COM
-
- a) Compacte os arquivos de sua implementação e coloque em qualquer lugar na internet onde possa ser
- baixado.
-
- c) Abra um novo Issue em https://github.com/drupalista-br/Boleto/issues e poste o link para que
- possa ser baixado e testado.
-
- d) Uma vez aprovado eu criarei um novo repositório na conta do drupalista-br onde a sua
- implementação será publicada. Sera dado os devidos creditos a sua autoria, mas o release
- tem que ser sob a versão 2 or higher da GNU General Public License.
-
- NOTA: Caso você deseje, poder de administrador poderá ser dada a você para administrar o
- repositório de sua implementação.
-
- Entretanto é imprecindivel que você saiba usar a ferramenta git. Informações sobre o git em
- http://pt.wikipedia.org/wiki/Git
-
- Sim, o git pode ser usado no Windows, antes que alguém pergunte. Entretanto peço gentilmente
- que não poste perguntas sobre o git na lista de Issues pois existem varios lugares
- mais apropriados na internet que melhor podem sanar suas dúvidas a respeito do assunto.
-
-
View
741 boleto-lib/Boleto.class.php
@@ -1,741 +0,0 @@
-<?php
-/**
- * Project: Boletophp
- * File: Boleto.class.php
- *
- * This code is released under the GNU General Public License.
- * See COPYRIGHT.txt and LICENSE.txt.
- *
- * This library was built based on Boletophp v0.17
- * Many thanks to the mantainers and collaborators of Boletophp project at boletophp.com.br.
- *
- * If you would like to collaborate by suggesting code and documentation enhancements or
- * by extending new issuer bank implamentations then please check out readme.txt
- *
- * @file This is the main Boleto class
- * @copyright 2011 Drupalista.com.br
- * @author Francisco Luz <franciscoferreiraluz at yahoo dot com dot au>
- * @package Boleto
- * @version 1.0 Beta
- *
- */
-
-/**
- * Indicate that an warning should be issued
- */
-define('BOLETO_WARNING', 'warning');
-
-class Boleto {
- /**
- * Issuer bank code
- */
- public $bank_code;
- public $bank_name;
- private $is_implemented = TRUE;
-
- /**
- * Hold warnings issued by the library itself and the bank issuer plugins.
- */
- public $warnings = array();
-
- /**
- * Method registration.
- */
- private $methods = array('child' => '',
- 'parent' => '',);
-
- /**
- * General settings.
- */
- public $settings = array('bank_logo' => '',
- // folder location for images.
- 'images' => '',
- 'style' => '',
- 'fator_vencimento_base' => '07-10-1997',
- // location and name of the html template file to render the output.
- 'template' => '',
- 'bar_code' => array(// thinner bar width.
- 'fino' => 1,
- // thicker bar width.
- 'largo' => 3,
- // bar height.
- 'altura' => 50,
- 'black_bar' => 'p.png',
- 'white_bar' => 'b.png',
- '#_strips' => 226,
- 'bar_codes' => array('00110',
- '10001',
- '01001',
- '11000',
- '00101',
- '10100',
- '01100',
- '00011',
- '10010',
- '01010',
- ),
- ),
- );
- /**
- * Arguments sent by the application using this library.
- */
- public $arguments = array('library_location' => '',
- 'merchant_logo' => '',
- 'nosso_numero' => '',
- 'agencia' => '',
- 'agencia_dv' => '',
- 'conta' => '',
- 'conta_dv' => '',
- 'valor_boleto' => '',
- 'numero_documento' => '',
- 'endereco' => '',
- 'cidade_uf' => '',
- 'cedente' => '',
- 'sacado' => '',
- 'carteira_nosso_numero' => '',
- 'cpf_cnpj' => '',
- // Client's address line 1, includes street name and number.
- 'endereco1' => '',
- // Client's address line 2, includes city, state and zip code.
- 'endereco2' => '',
- 'demonstrativo1' => '',
- 'demonstrativo2' => '',
- 'demonstrativo3' => '',
- 'instrucoes1' => '',
- 'instrucoes2' => '',
- 'instrucoes3' => '',
- 'instrucoes4' => '',
- 'data_documento' => '',
- 'data_vencimento' => '',
- 'data_processamento' => '',
- 'carteira' => 'SR',
- 'title' => '',
- 'local_pagamento' => 'Pag&aacute;vel em qualquer Banco at&eacute; o vencimento',
- 'especie' => 'R$',
- 'quantidade' => '',
- 'valor_unitario' => '',
- 'especie_doc' => '',
- 'avalista' => '',
- 'aceite' => 'N',
- 'desconto_abatimento' => '0.00',
- 'outras_deducoes' => '0.00',
- 'mora_multa' => '0.00',
- 'outros_acrescimos' => '0.00',
- );
- /**
- * Holds values that went through some sort of processing.
- */
- public $computed = array('codigo_banco_com_dv' => '',
- 'valor_cobrado' => '',
- 'data_vencimento' => '',
- // human readable line.
- 'linha_digitavel' => '',
- 'nosso_numero' => '',
- 'bar_code' => array(// final drawn.
- 'strips' => '',
- // strip widths for debug checking.
- 'widths' => ''),
- );
- /**
- * Holds the values calculated accordingly to the FEBRABAN specification.
- */
- public $febraban = array('1-3' => '', // Codigo do banco sem o digito.
- '4-4' => 9, // Codigo da Moeda (9-Real).
- '5-5' => '', // Dígito verificador do código de barras.
- '6-9' => '', // Fator de vencimento.
- '10-19' => '', // Valor Nominal do Titulo.
- '20-44' => '', // Campo Livre. Set by child class (issuer bank implementation).
- );
- /**
- * @see the method output()
- */
- public $output = array();
-
- public function __construct($arguments){
- $this->arguments['data_documento'] = date('d-m-Y');
- $this->arguments['data_processamento'] = $this->arguments['data_documento'];
-
- // assign the arguments sent through.
- foreach($arguments as $argument => $value){
- $this->arguments[$argument] = $value;
- }
- // set default html head title.
- if(!isset($arguments['title'])){
- $this->arguments['title'] = $this->arguments['cedente'];
- }
- $this->bank_code = trim($arguments['bank_code']);
-
- // check if the issuer bank is implemented by a child class.
- if(!@file_exists(dirname(__FILE__).'/bancos/'.$this->bank_code.'/Banco_'.$this->bank_code.'.php') ) {
- $this->is_implemented = 0;
- }else{
- // include class implementation file.
- include_once(dirname(__FILE__).'/bancos/'.$this->bank_code.'/Banco_'.$this->bank_code.'.php');
- // get methods declared at child class.
- $methods = get_class_methods('Banco_'.$this->bank_code);
- $child = TRUE;
- foreach($methods as $key => $method){
- // everything listed before construct belongs to the child implementation.
- if($method == '__construct'){
- $child = FALSE;
- }
- if($child){
- $this->methods['child'][] = $method;
-
- }else{
- $this->methods['parent'][] = $method;
- }
- }
- }
- // Call start up methods.
- $startUp = array('settings',
- 'data_vencimento',
- 'fator_vencimento',
- 'codigo_banco_com_dv',
- 'febraban',
- 'linha_digitavel',
- 'barcode', // generate bar code strips.
- );
-
- foreach($startUp as $methodName) {
- call_user_func(array('Boleto', $methodName));
- }
- }
-
- /**
- * Calculates a check digit from any given number based on the modulo 10 specification.
- *
- * @param String $num
- * The number you wish to calcule the check digit from.
- * @see Documentation at http:// www.febraban.org.br/Acervo1.asp?id_texto=195&id_pagina=173&palavra=
- * @return String
- * The check digit number.
- */
- public function modulo_10($num) {
- $numtotal10 = 0;
- $fator = 2;
-
- // Separacao dos numeros.
- for ($i = strlen($num); $i > 0; $i--) {
- // pega cada numero isoladamente.
- $numeros[$i] = substr($num,$i-1,1);
- // Efetua multiplicacao do numero pelo (falor 10).
- $temp = $numeros[$i] * $fator;
- $temp0=0;
- foreach (preg_split('// ',$temp,-1,PREG_SPLIT_NO_EMPTY) as $k=>$v){ $temp0+=$v; }
- $parcial10[$i] = $temp0; // $numeros[$i] * $fator;
- // monta sequencia para soma dos digitos no (modulo 10).
- $numtotal10 += $parcial10[$i];
- if ($fator == 2) {
- $fator = 1;
- } else {
- // intercala fator de multiplicacao (modulo 10).
- $fator = 2;
- }
- }
-
- $resto = $numtotal10 % 10;
- $digito = 10 - $resto;
-
- // make it zero if check digit is 10.
- $digito = ($digito == 10) ? 0 : $digito;
-
- return $digito;
- }
-
- /**
- * Calculates a check digit from any given number based on the modulo 11 specification.
- *
- * @param string $num
- * The number you wish to calcule the check digit from
- * @param string $base
- * Optional. This is defaulted to 9
- * @see Documentation at http:// www.febraban.org.br/Acervo1.asp?id_texto=195&id_pagina=173&palavra=
- * @return array
- * The returned array keys are digito and resto
- */
- public function modulo_11($num, $base=9){
- $fator = 2;
-
- $soma = 0;
- /* Separacao dos numeros */
- for ($i = strlen($num); $i > 0; $i--) {
- // pega cada numero isoladamente
- $numeros[$i] = substr($num,$i-1,1);
- // Efetua multiplicacao do numero pelo falor
- $parcial[$i] = $numeros[$i] * $fator;
- // Soma dos digitos
- $soma += $parcial[$i];
- if ($fator == $base) {
- // restaura fator de multiplicacao para 2
- $fator = 1;
- }
- $fator++;
- }
- $result = array('digito' => ($soma * 10) % 11,
- 'resto' => $soma % 11, // Remainder
- );
- if($result['digito'] == 10){
- $result['digito'] = 0;
- }
-
- return $result;
- }
-
- /**
- * Calculation of "Due Date" field
- * Argument values expected: -1 == Cash against document
- * Integer Number == Number of days added on top of issuing date
- * dd-mm-yyy == Set date
- *
- * If argument is not present then it adds 5 days on top of issuing date.
- */
- public function data_vencimento(){
- /** set defaults**/
- // making sure we got a dash "-" instead of forward slah "/" for vencimento.
- $this->computed['data_vencimento'] = str_replace('/','-', $this->arguments['data_vencimento']);
- // adds 5 days on top of issuing date.
- $vencimento = '+5';
- $vencimento_value = date('d-m-Y', strtotime($vencimento.' days'));
-
- // check if an argument for vencimento has been set.
- if(!empty($this->arguments['data_vencimento'])){
- if(is_numeric($this->arguments['data_vencimento'])){
- // cash against document.
- if($this->arguments['data_vencimento'] == -1){
- $vencimento_value = 'Contra Apresenta&ccedil;&atilde;o';
- }else{
- // for any other integer.
- $vencimento = '+'.$this->arguments['data_vencimento'];
- $vencimento_value = date('d-m-Y', strtotime($vencimento.' days'));
- }
- }else{
- // an actual date was sent through.
- $vencimento_value = $this->computed['data_vencimento'];
- // check if date is in a valide format.
- $date_check = explode('-', $vencimento_value);
- if(!checkdate($date_check[1], $date_check[0], $date_check[2])){
- $this->setWarning(array('data_vencimento', 'Invalido. Certifique-se que tenha informado ou -1 ou um numero inteiro ou uma data no formato dd-mm-yyyy.<br>'));
- }
- }
- }
- $this->computed['data_vencimento'] = $vencimento_value;
- }
-
- /**
- * Calculates the "Due date" 4 digits factor number.
- * It is the positions from 6 to 9 in the Febraban array.
- *
- * script from http:// phpbrasil.com/articles/print.php/id/1034
- */
- public function fator_vencimento(){
- $from = $this->settings['fator_vencimento_base'];
- $to = $this->computed['data_vencimento'];
-
- if($this->arguments['data_vencimento'] == -1){
- // "Due Date" is Cash against document.
- $days = '0000';
- }else{
- // Usar DD-MM-AA ou DD-MM-AAAA.
- list($from_day, $from_month, $from_year) = explode("-", $from);
- list($to_day, $to_month, $to_year) = explode("-", $to);
- $from_date = mktime(0, 0, 0, $from_month, $from_day, $from_year);
- $to_date = mktime(0, 0, 0, $to_month, $to_day, $to_year);
-
- $days = round(($to_date - $from_date) / 86400);
- }
- // assign value to febraban array property.
- $this->febraban['6-9'] = $days;
- }
-
- /**
- * Calculates the check digit for bank code.
- */
- public function codigo_banco_com_dv() {
- if (!empty($this->arguments['bank_code_cd'])) {
- $this->computed['codigo_banco_com_dv'] = $this->bank_code.'-'.$this->arguments['bank_code_cd'];
- }
- else{
- // set codigo_banco_com_dv.
- $bank_code_checkDigit = $this->modulo_11($this->bank_code);
- $this->computed['codigo_banco_com_dv'] = $this->bank_code.'-'.$bank_code_checkDigit['digito'];
-
- }
- }
-
- /**
- * Calculates and construct the FEBRABAN specification.
- *
- * 01-03 (3) -> Código do banco sem o digito.
- * 04-04 (1) -> Código da Moeda (9-Real).
- * 05-05 (1) -> Dígito verificador do código de barras.
- * 06-09 (4) -> Fator de vencimento.
- * 10-19 (10) -> Valor Nominal do Título.
- * 20-44 (25) -> Campo Livre.
- * This is calculated at child's class implementation by febraban20to44().
- *
- * @see Documentation at http://www.febraban.org.br/Acervo1.asp?id_texto=195&id_pagina=173&palavra=
- */
- public function febraban(){
- // Positions 1 to 3.
- $this->febraban['1-3'] = $this->bank_code;
- // Position 4 has a pre set value of 9.
- // Positions 6-9 is done at fator_vencimento().
-
- // remove decimal separator from valor_cobrado
- $vc = str_replace('.','', $this->computed['valor_cobrado']);
- // Positions 10 to 19.
- $this->febraban['10-19'] = str_pad($vc, 10, 0, STR_PAD_LEFT);
-
- if($this->is_implemented) {
- // Check if method is implemented.
- if(in_array('febraban_20to44', $this->methods['child'])){
- // Positions 20 to 44 vary from bank to bank, so we call the child extention.
- $child = 'Banco_'.$this->bank_code;
- call_user_func(array($child, 'febraban_20to44'), $this);
- }
- }
- // Calculate the check digit (position 5) of all 43 number set.
- $checkDigit = '';
- foreach($this->febraban as $value){
- $checkDigit .= $value;
- }
- $checkDigit = $this->modulo_11($checkDigit);
- $resto = $checkDigit['resto'];
- if($resto == 0 || $resto == 1 || $resto == 10){
- $checkDigit['digito'] = 1;
- }else{
- $checkDigit['digito'] = 11 - $resto;
- }
- // Position 5 (check digit for the whole set).
- $this->febraban['5-5'] = $checkDigit['digito'];
-
- // Check if febraban property is complying with the rules and
- // Create an array of allowed lenghs for each febraban block.
- $rules = array('1-3' => 3, '4-4' => 1, '5-5' => 1, '6-9' => 4, '10-19' => 10, '20-44' => 25);
-
- foreach($this->febraban as $key => $value){
- $lengh = strlen($value);
- if($lengh != $rules[$key]){
- $this->setWarning(array("febraban[$key]", "possui $lengh digitos enquanto deveria ter $rules[$key]."));
- }
- }
-
- // Check if child class wants to do any custom stuff before object delivering.
- if($this->is_implemented) {
- if(in_array('custom', $this->methods['child'])){
- // When present, this is the last method to be called in the construction chain.
- $childClass = 'Banco_'.$this->bank_code;
- call_user_func(array($childClass, 'custom'), $this);
- }
- }
-
- }
-
- /**
- * Assembles the human readable code set (linha digitavel).
- */
- public function linha_digitavel(){
-
- // Break down febraban positions 20 to 44 into 3 blocks of 5, 10 and 10 characters each.
- $blocks = array('20-24' => substr($this->febraban['20-44'], 0, 5),
- '25-34' => substr($this->febraban['20-44'], 5, 10),
- '35-44' => substr($this->febraban['20-44'], 15, 10),
- );
-
- // Concatenates bankCode + currencyCode + first block of 5 characters and
- // calculates its check digit for part1.
- $checkDigit = $this->modulo_10($this->bank_code.$this->febraban['4-4'].$blocks['20-24']);
-
- // Shift in a dot on block 20-24 (5 characters) at its 2nd position.
- $blocks['20-24'] = substr_replace($blocks['20-24'], '.', 1, 0);
-
- // Concatenates bankCode + currencyCode + first block of 5 characters + checkDigit.
- $part1 = $this->bank_code.$this->febraban['4-4'].$blocks['20-24'].$checkDigit;
-
- // calculates part2 check digit from 2nd block of 10 characters.
- $checkDigit = $this->modulo_10($blocks['25-34']);
-
- $part2 = $blocks['25-34'].$checkDigit;
- // shift in a dot at its 6th position.
- $part2 = substr_replace($part2, '.', 5, 0);
-
- // calculates part3 check digit from 3rd block of 10 characters.
- $checkDigit = $this->modulo_10($blocks['35-44']);
-
- // as part2, we do the same process again for part3.
- $part3 = $blocks['35-44'].$checkDigit;
- $part3 = substr_replace($part3, '.', 5, 0);
-
- // check digit for the human readable number.
- $cd = $this->febraban['5-5'];
- // put part4 together.
- $part4 = $this->febraban['6-9'].$this->febraban['10-19'];
-
- // now put everything together.
- $this->computed['linha_digitavel'] = "$part1 $part2 $part3 $cd $part4";
-
- // now validates the human readable number.
- $lengh = strlen($this->computed['linha_digitavel']);
- if($lengh != 54){
- $lengh -= 7;
- $this->setWarning(array("linha_digitavel", "possui $lengh digitos enquanto deveria ter 47."));
- }
- }
-
- /**
- * Pre settting.
- */
- public function settings(){
- $this->bank_name = 'Ops!!! Aparentemente o banco informado nao esta implementado. No juice for you.';
- $this->settings['images'] = $this->arguments['library_location'].'/imagens';
- $this->settings['bank_logo'] = $this->settings['images'].'/bank_logo_default.jpg';
- $this->settings['style'] = $this->arguments['library_location'].'/style.css';
- $this->settings['template'] = dirname(__FILE__).'/boleto.tpl.php';
-
- // calculate valor_cobrado (total amount).
- $subtractions = $this->arguments['desconto_abatimento'] + $this->arguments['outras_deducoes'];
- $additions = $this->arguments['mora_multa'] + $this->arguments['outros_acrescimos'];
- $this->computed['valor_cobrado'] = ($this->arguments['valor_boleto'] - $subtractions) + $additions;
-
- // format valor_boleto.
- $this->arguments['valor_boleto'] = number_format($this->arguments['valor_boleto'], 2, '.', '');
- // format valor_cobrado.
- $this->computed['valor_cobrado'] = number_format($this->computed['valor_cobrado'], 2, '.', '');
-
- // check some basic settings.
- if($this->is_implemented){
- // check if these files exists.
- $files = array('bank_logo' => array('#file_name' => 'logo.jpg',
- '#required' => 1,),
- 'template' => array('#file_name' => 'layout.tpl.php',
- '#required' => 0,),
- 'style' => array('#file_name' => 'style.css',
- '#required' => 0,),
- 'readme' => array('#file_name' => 'README.txt',
- '#required' => 1),
- );
- $location = $this->arguments['library_location'].'/bancos/'.$this->bank_code;
- $true_path = dirname(__FILE__).'/bancos/'.$this->bank_code;
-
- foreach($files as $key => $value){
- $filename = $value['#file_name'];
-
- if(@file_exists($true_path.'/'.$filename)){
- if($key == 'template'){
- $this->settings[$key] = $true_path.'/'.$filename;
- }else{
- $this->settings[$key] = $location.'/'.$filename;
- }
-
- }elseif($value['#required']){
- // set warning.
- $this->setWarning(array($key, "O arquivo $location/$filename nao pode ser encontrado."));
- }
- }
-
- // check if child method is implemented.
- if(in_array('setUp', $this->methods['child']) && in_array('febraban_20to44', $this->methods['child'])){
- $childClass = 'Banco_'.$this->bank_code;
- call_user_func(array($childClass, 'setUp'), $this);
- }else{
- // set warning.
- $this->setWarning(array('settings', 'Os metodos setUp e febraban_20to44 nao foram encontradas na implementacao do banco. Leia o arquivo readme.txt para mais informacoes.'));
- }
- }
- }
-
- /**
- * Generate bar code strips.
- */
- public function barcode(){
- // assemble code from febraban array.
- $code = '';
- foreach($this->febraban as $value){
- $code .= $value;
- }
-
- // get bar code values from settings.
- $barcodes = $this->settings['bar_code']['bar_codes'];
-
- // apply bar codes to the febraban code.
- for($f1=9;$f1>=0;$f1--){
- for($f2=9;$f2>=0;$f2--){
- $f = ($f1 * 10) + $f2 ;
- $texto = '';
- for($i=1;$i<6;$i++){
- $texto .= substr($barcodes[$f1],($i-1),1) . substr($barcodes[$f2],($i-1),1);
- }
- $barcodes[$f] = $texto;
- }
- }
- // get bar width from settings.
- $thinner = $this->settings['bar_code']['fino'];
- $thicker = $this->settings['bar_code']['largo'];
- // get bar height.
- $height = $this->settings['bar_code']['altura'];
-
- // get the black and white bar images.
- $black = $this->settings['images'].'/'.$this->settings['bar_code']['black_bar'];
- $white = $this->settings['images'].'/'.$this->settings['bar_code']['white_bar'];
-
- // create a sequence of black and white strips.
- $total = $this->settings['bar_code']['#_strips'];
- for($i = 0; $i <= $total; $i++){
- // white for odd numbers and black for even numbers. Actually what matters is black being the first to start off.
- if($i&1){
- $img_strips[] = $white;
- }else{
- $img_strips[] = $black;
- }
- }
-
- // Set strip widths.
- // Start code bit.
- $img_widths = array($thinner, $thinner, $thinner, $thinner);
-
- // main code.
- if((strlen($code) % 2) <> 0){
- $code = "0" . $code;
- }
- while (strlen($code) > 0) {
- $i = round(substr($code,0,2));
- $code = $this->direita($code, strlen($code)-2);
- $f = $barcodes[$i];
- for($i=1;$i<11;$i+=2){
- if (substr($f,($i-1),1) == "0") {
- $f1 = $thinner;
- }else{
- $f1 = $thicker ;
- }
- $img_widths[] = $f1;
-
- if (substr($f,$i,1) == "0") {
- $f2 = $thinner;
- }else{
- $f2 = $thicker;
- }
- $img_widths[] = $f2;
- }
- }
- // stop code bit.
- $img_widths[] = $thicker;
- $img_widths[] = $thinner;
- $img_widths[] = $thinner;
-
- // render the output.
- foreach($img_widths as $key => $width){
- // rendering.
- $img = $img_strips[$key];
- $this->computed['bar_code']['strips'] .= "<img src=$img width=$width height=$height border=0>";
-
- // strip widths for debug checking.
- $this->computed['bar_code']['widths'] .= $width;
- }
- }
- /**
- * Helper function for barcode().
- *
- * @param String $entra
- * TODO: Document this.
- * @param String $comp
- * TODO: Document this.
- * @return String
- * TODO: Document this.
- */
- private function direita($entra,$comp){
- return substr($entra,strlen($entra)-$comp,$comp);
- }
-
- /**
- * Render boleto.
- * This method is not trigged at the start up. It gotta be called after instantiation.
- *
- * @param Boolean
- * Whether or not the array values generated by this method should be rendered in the template.
- *
- */
- public function output($render = TRUE){
- // Boleto fields that get printed out in the template.
- $this->output = array('title' => $this->arguments['title'],
- 'linha_digitavel' => $this->computed['linha_digitavel'],
- 'valor_boleto' => number_format($this->arguments['valor_boleto'], 2, ',', '.'),
- 'cpf_cnpj' => $this->arguments['cpf_cnpj'],
- 'endereco' => $this->arguments['endereco'],
- 'cidade_uf' => $this->arguments['cidade_uf'],
- 'bank_logo_path' => $this->settings['bank_logo'],
- 'images' => $this->settings['images'],
- 'style' => $this->settings['style'],
- 'codigo_banco_com_dv' => $this->computed['codigo_banco_com_dv'],
- 'cedente' => $this->arguments['cedente'],
- 'especie' => $this->arguments['especie'],
- 'quantidade' => $this->arguments['quantidade'],
- 'data_vencimento' => $this->computed['data_vencimento'],
- 'desconto_abatimento' => number_format($this->arguments['desconto_abatimento'], 2, ',', '.'),
- 'outras_deducoes' => number_format($this->arguments['outras_deducoes'], 2, ',', '.'),
- 'mora_multa' => number_format($this->arguments['mora_multa'], 2, ',', '.'),
- 'outros_acrescimos' => number_format($this->arguments['outros_acrescimos'], 2, ',', '.'),
- 'valor_cobrado' => number_format($this->computed['valor_cobrado'], 2, ',', '.'),
- 'sacado' => $this->arguments['sacado'],
- 'demonstrativo1' => $this->arguments['demonstrativo1'],
- 'demonstrativo2' => $this->arguments['demonstrativo2'],
- 'demonstrativo3' => $this->arguments['demonstrativo3'],
- 'local_pagamento' => $this->arguments['local_pagamento'],
- 'data_documento' => $this->arguments['data_documento'],
- 'numero_documento' => $this->arguments['numero_documento'],
- 'agencia_codigo_cedente'=> $this->arguments['agencia'].' / '.$this->arguments['conta'].'-'.$this->arguments['conta_dv'],
- 'nosso_numero' => $this->computed['nosso_numero'],
- 'especie_doc' => $this->arguments['especie_doc'],
- 'aceite' => $this->arguments['aceite'],
- 'data_processamento' => $this->arguments['data_processamento'],
- 'carteira' => $this->arguments['carteira'],
- 'valor_unitario' => $this->arguments['valor_unitario'],
- 'instrucoes1' => $this->arguments['instrucoes1'],
- 'instrucoes2' => $this->arguments['instrucoes2'],
- 'instrucoes3' => $this->arguments['instrucoes3'],
- 'instrucoes4' => $this->arguments['instrucoes4'],
- 'endereco1' => $this->arguments['endereco1'],
- 'endereco2' => $this->arguments['endereco2'],
- 'avalista' => $this->arguments['avalista'],
- 'codigo_barras' => $this->computed['bar_code']['strips'],
- );
- // check if merchant logo exists.
- if (!empty($this->arguments['merchant_logo'])) {
- $this->output['merchant_logo'] = $this->arguments['merchant_logo'];
- }
- else {
- // set default.
- $this->output['merchant_logo'] = $this->settings['images'].'/merchant_logo.png';
- }
- // check if child class wants to change anything before rendering it out.
- if($this->is_implemented) {
- if(in_array('outputValues', $this->methods['child'])){
- $childClass = 'Banco_'.$this->bank_code;
- // call child class method.
- call_user_func(array($childClass, 'outputValues'), $this);
- }
- }
- // it's time for rendering it. Yaaay!!!
- if($render){
- include_once($this->settings['template']);
- }
- }
-
- /**
- * Set Warnings.
- *
- * @param Array $message
- * The array key holds the field name and the array Value holds the Message to be set or unset.
- * @param Boolean $action
- * Whether or not the current warning should be added to the warning parameter
- *
- */
- public function setWarning($message, $action = TRUE){
- if($action){
- $this->warnings[$message[0]] = $message[1];
- }else{
- unset($this->warnings[$message[0]]);
- }
- }
-}
-?>
1  boleto-lib/bancos/001
@@ -1 +0,0 @@
-Subproject commit 1ed20a50a744d5ca4055d85be2886e1607ecc61a
1  boleto-lib/bancos/104
@@ -1 +0,0 @@
-Subproject commit 3ba1506a9b1fbaec9ae9b62b12d3ccd448d6c6d3
1  boleto-lib/bancos/237
@@ -1 +0,0 @@
-Subproject commit 219f8529108c09b5eeb7c2b420eb2c3c52fc63f2
1  boleto-lib/bancos/341
@@ -1 +0,0 @@
-Subproject commit 7e0ccb3d62b611d05eea6439e8bfeb519b3c0853
1  boleto-lib/bancos/748
@@ -1 +0,0 @@
-Subproject commit c7938edcedae23f4780d3d5e140675a79086a31f
View
659 boleto-lib/boleto.tpl.php
@@ -1,659 +0,0 @@
-<?php
- /**
- * This code is released under the GNU General Public License.
- * See COPYRIGHT.txt and LICENSE.txt.
- *
- * This library is built based on Boletophp v0.17
- * Many thanks to the mantainers and collaborators of Boletophp project at boletophp.com.br.
- *
- * @file Html template that renders the Boleto output.
- * @link http://www.drupalista.com.br/downloads/bibliotecas/boleto
- * @copyright 2011 Drupalista.com.br
- * @author Francisco Luz <franciscoferreiraluz at yahoo dot com dot au>
- * @package Boleto
- * @version 1.0 Beta
- *
- *
- */
-
-//convert array into string variables
-foreach($this->output as $key => $value){
- ${$key} = $value;
-}
-
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<HTML>
- <HEAD>
- <TITLE><?php echo $title; ?></TITLE>
- <META http-equiv=Content-Type content=text/html charset=ISO-8859-1>
- <meta name="Generator" content="Projeto BoletoPHP - www.boletophp.com.br - Licen&ccedil;a GPL" />
- <link type="text/css" rel="stylesheet" media="all" href="<?php echo $style; ?>" />
- </head>
-<BODY>
- <table cellspacing=0 cellpadding=0 border=0 width=666>
- <tr>
- <td valign=top class=cp><DIV ALIGN="CENTER">Instru&ccedil;&otilde;es de Impress&atilde;o</DIV></TD>
- </TR>
- <TR>
- <TD valign=top class=cp><DIV ALIGN="left"><p>
- <li>Imprima em impressora jato de tinta (ink jet) ou laser em qualidade normal ou alta (N&atilde;o use modo econ&ocirc;mico).<br>
- <li>Utilize folha A4 (210 x 297 mm) ou Carta (216 x 279 mm) e margens m&iacute;nimas &agrave; esquerda e &agrave; direita do formul&aacute;rio.<br>
- <li>Corte na linha indicada. N&atilde;o rasure, risque, fure ou dobre a regi&atilde;o onde se encontra o c&oacute;digo de barras.<br>
- <li>Caso n&atilde;o apare&ccedil;a o c&oacute;digo de barras no final, clique em F5 para atualizar esta tela.
- <li>Caso tenha problemas ao imprimir, copie a sequencia num&eacute;rica abaixo e pague no caixa eletr&ocirc;nico ou no internet banking:<br><br>
- <span class="ld2">
- &nbsp;&nbsp;&nbsp;&nbsp;Linha Digit&aacute;vel: &nbsp;<?php echo $linha_digitavel; ?><br>
- &nbsp;&nbsp;&nbsp;&nbsp;Valor: &nbsp;&nbsp;R$ <?php echo $valor_cobrado; ?><br>
- </span></DIV>
- </td>
- </tr>
- </table>
- <br>
- <table cellspacing=0 cellpadding=0 border=0 width=666>
- <TBODY>
- <TR><TD class="ct"><img height=1 src="<?php echo $images; ?>/6.png" width=665 border=0></TD>
- </TR>
- <TR><TD class=ct width=666><div align=right>
- <b class=cp>Recibo do Sacado</b></div>
- </TD>
- </tr>
- </tbody>
- </table>
- <table cellspacing=5 cellpadding=0 border=0 width=666>
- <tr><td width=41></TD>
- </tr>
- </table>
- <table cellspacing=5 cellpadding=0 border=0 width=666 align=Default>
- <tr>
- <td width=41><IMG src="<?php echo $merchant_logo; ?>"></td>
- <td class=ti width=455><?php echo $cedente; ?><br>
- <?php echo $cpf_cnpj; ?><br>
- <?php echo $endereco; ?><br>
- <?php echo $cidade_uf; ?><br>
- </td>
- <td align=RIGHT width=150 class=ti>&nbsp;</td>
- </tr>
- </table>
- <BR>
-<table cellspacing=0 cellpadding=0 border=0 width=666>
- <tr><td class=cp width=150>
- <span class="campo"><IMG src="<?php echo $bank_logo_path; ?>" width="150" height="40" border=0></span></td>
- <td width=3 valign=bottom><img height=22 src="<?php echo $images; ?>/3.png" width=2 border=0></td>
- <td class=cpt width=58 valign=bottom><div align=center><font class=bc><?php echo $codigo_banco_com_dv; ?></font></div></td>
- <td width=3 valign=bottom><img height=22 src="<?php echo $images; ?>/3.png" width=2 border=0></td>
- <td class=ld align=right width=453 valign=bottom><span class=ld><span class="campotitulo"><?php echo $linha_digitavel; ?></span></span></td>
- </tr>
- <tbody>
- <tr>
- <td colspan=5><img height=2 src="<?php echo $images; ?>/2.png" width=666 border=0></td>
- </tr>
- </tbody>
-</table>
-<table cellspacing=0 cellpadding=0 border=0>
- <tbody>
- <tr>
- <?php
- $widths = array(268, 156, 34, 53, 120,);
- $titles = array('Cedente', 'Ag&ecirc;ncia/C&oacute;digo do Cedente', 'Esp&eacute;cie', 'Quantidade', 'Nosso n&uacute;mero',);
-
- foreach($widths as $key => $width){
- $title = $titles[$key];
- echo "<td class=ct valign=top width=7 height=13> <img height=13 src='$images/1.png' width=1 border=0></td>".
- "<td class=ct valign=top width=$width height=13>$title</td>";
- }
- ?>
- </tr>
- <tr>
- <?php
- $widths = array(268, 156, 34, 53, 53);
- $values = array($cedente, $agencia_codigo_cedente, $especie, $quantidade, $nosso_numero);
-
- foreach($widths as $key => $width){
- $value = $values[$key];
- echo "<td class=cp valign=top width=7 height=12><img height=12 src='$images/1.png' width=1 border=0></td>".
- "<td class=cp valign=top width=$width height=12 class='campo'>$value</td>";
- }
- ?>
- </tr>
- <tr>
- <?php
- $widths = array(7, 268, 7, 156, 7, 34, 7, 53, 7, 120);
- foreach($widths as $width){
- echo "<td valign=top width=$width height=1><img height=1 src='$images/2.png' width=$width border=0></td>";
- }
- ?>
- </tr>
- </tbody>
-</table>
-<table cellspacing=0 cellpadding=0 border=0>
- <tbody>
- <tr>
- <?php
- $widths = array('colspan' => 3, 132, 134, 180,);
- $titles = array('N&uacute;mero do documento', 'CPF/CNPJ', 'Vencimento', 'Valor documento', );
- $count = 0;
- foreach($widths as $key => $width){
- $title = $titles[$count]; $count += 1;
- $key = (is_numeric($key)) ? 'width' : $key;
- echo "<td class=ct valign=top width=7 height=13> <img height=13 src='$images/1.png' width=1 border=0></td>".
- "<td class=ct valign=top $key=$width height=13>$title</td>";
- }
- ?>
- </tr>
- <tr>
- <?php
- $widths = array('colspan' => 3, 132, 134, 180, );
- $values = array($numero_documento, $cpf_cnpj, $data_vencimento, $valor_boleto,);
- $alighs = array('left', 'left', 'left', 'right');
- $count = 0;
- foreach($widths as $key => $width){
- $value = $values[$count]; $aligh = $alighs[$count]; $count += 1;
- $key = (is_numeric($key)) ? 'width' : $key;
- echo "<td class=cp valign=top width=7 height=12><img height=12 src='$images/1.png' width=1 border=0></td>".
- "<td class=cp valign=top $key=$width height=12 align=$aligh class='campo'>$value</td>";
- }
- ?>
- </tr>
- <tr>
- <?php
- $widths = array(7, 113, 7, 72, 7, 132, 7, 134, 7, 180);
- foreach($widths as $width){
- echo "<td valign=top width=$width height=1><img height=1 src='$images/2.png' width=$width border=0></td>";
- }
- ?>
- </tr>
- </tbody>
-</table>
-<table cellspacing=0 cellpadding=0 border=0>
- <tbody>
- <tr>
- <?php
- $widths = array(113, 112, 113, 113, 180,);
- $titles = array('(-) Desconto / Abatimentos', '(-) Outras dedu&ccedil;&otilde;es', '(+) Mora / Multa', '(+) Outros acr&eacute;scimos', '(=) Valor cobrado', );
-
- foreach($widths as $key => $width){
- $title = $titles[$key];
- echo "<td class=ct valign=top width=7 height=13><img height=13 src='$images/1.png' width=1 border=0></td>".
- "<td class=ct valign=top width=$width height=13>$title</td>";
- }
- ?>
- </tr>
- <tr>
- <?php
- $widths = array(113, 112, 113, 113, 180,);
- $values = array($desconto_abatimento, $outras_deducoes, $mora_multa, $outros_acrescimos, $valor_cobrado,);
-
- foreach($widths as $key => $width){
- $value = $values[$key];
- echo "<td class=cp valign=top width=7 height=12><img height=12 src='$images/1.png' width=1 border=0></td>".
- "<td class=cp valign=top width=$width height=12 align=right class='campo'>$value</td>";
- }
- ?>
- </tr>
- <tr>
- <?php
- $widths = array(7, 113, 7, 112, 7, 113, 7, 113, 7, 180);
- foreach($widths as $width){
- echo "<td valign=top width=$width height=1><img height=1 src='$images/2.png' width=$width border=0></td>";
- }
- ?>
- </tr>
- </tbody>
-</table>
-<table cellspacing=0 cellpadding=0 border=0>
- <tbody>
- <tr>
- <td class=ct valign=top width=7 height=13><img height=13 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td class=ct valign=top width=659 height=13>Sacado</td>
- </tr>
- <tr>
- <td class=cp valign=top width=7 height=12><img height=12 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td class=cp valign=top width=659 height=12><span class="campo"><?php echo $sacado; ?></span></td>
- </tr>
- <tr>
- <td valign=top width=7 height=1><img height=1 src="<?php echo $images; ?>/2.png" width=7 border=0></td>
- <td valign=top width=659 height=1><img height=1 src="<?php echo $images; ?>/2.png" width=659 border=0></td>
- </tr>
- </tbody>
-</table>
-<table cellspacing=0 cellpadding=0 border=0>
- <tbody>
- <tr>
- <td class=ct width=7 height=12></td>
- <td class=ct width=564>Demonstrativo</td>
- <td class=ct width=7 height=12></td>
- <td class=ct width=88>Autentica&ccedil;&atilde;o mec&acirc;nica</td>
- </tr>
- <tr>
- <td width=7></td>
- <td class=cp width=564>
- <span class="campo">
- <?php echo $demonstrativo1; ?>
- <br><?php echo $demonstrativo2; ?>
- <br><?php echo $demonstrativo3; ?>
- <br>
- </span>
- </td>
- <td width=7></td>
- <td width=88></td>
- </tr>
- </tbody>
-</table>
-<table cellspacing=0 cellpadding=0 border=0 width=666>
- <tbody>
- <tr>
- <td width=7></td>
- <td width=500 class=cp><br><br><br></td>
- <td width=159></td>
- </tr>
- </tbody>
-</table>
-<table cellspacing=0 cellpadding=0 border=0 width=666>
- <tr>
- <td class=ct width=666></td>
- </tr>
- <tbody>
- <tr>
- <td class=ct width=666><div align=right>Corte na linha pontilhada</div></td>
- </tr>
- <tr>
- <td class=ct width=666><img height=1 src="<?php echo $images; ?>/6.png" width=665 border=0></td>
- </tr>
- </tbody>
-</table>
-<br>
-<table cellspacing=0 cellpadding=0 border=0 width=666>
- <tr>
- <td class=cp width=150><span class="campo"><IMG src="<?php echo $bank_logo_path; ?>" width="150" height="40" border=0></span></td>
- <td width=3 valign=bottom><img height=22 src="<?php echo $images; ?>/3.png" width=2 border=0></td>
- <td class=cpt width=58 valign=bottom><div align=center><font class=bc><?php echo $codigo_banco_com_dv; ?></font></div></td>
- <td width=3 valign=bottom><img height=22 src="<?php echo $images; ?>/3.png" width=2 border=0></td>
- <td class=ld align=right width=453 valign=bottom><span class=ld><span class="campotitulo"><?php echo $linha_digitavel; ?></span></span></td>
- </tr>
- <tbody>
- <tr>
- <td colspan=5><img height=2 src="<?php echo $images; ?>/2.png" width=666 border=0></td>
- </tr>
- </tbody>
-</table>
-<table cellspacing=0 cellpadding=0 border=0>
- <tbody>
- <tr>
- <td class=ct valign=top width=7 height=13><img height=13 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td class=ct valign=top width=472 height=13>Local de pagamento</td>
- <td class=ct valign=top width=7 height=13><img height=13 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td class=ct valign=top width=180 height=13>Vencimento</td>
- </tr>
- <tr>
- <td class=cp valign=top width=7 height=12><img height=12 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td class=cp valign=top width=472 height=12>Pag&aacute;vel em qualquer Banco at&eacute; o vencimento</td>
- <td class=cp valign=top width=7 height=12><img height=12 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td class=cp valign=top align=right width=180 height=12><span class="campo"><?php echo $data_vencimento; ?></span>
- </td>
- </tr>
- <tr>
- <td valign=top width=7 height=1><img height=1 src="<?php echo $images; ?>/2.png" width=7 border=0></td>
- <td valign=top width=472 height=1><img height=1 src="<?php echo $images; ?>/2.png" width=472 border=0></td>
- <td valign=top width=7 height=1><img height=1 src="<?php echo $images; ?>/2.png" width=7 border=0></td>
- <td valign=top width=180 height=1><img height=1 src="<?php echo $images; ?>/2.png" width=180 border=0></td>
- </tr>
- </tbody>
-</table>
-<table cellspacing=0 cellpadding=0 border=0>
- <tbody>
- <tr>
- <td class=ct valign=top width=7 height=13><img height=13 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td class=ct valign=top width=472 height=13>Cedente</td>
- <td class=ct valign=top width=7 height=13><img height=13 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td class=ct valign=top width=180 height=13>Ag&ecirc;ncia/C&oacute;digo cedente</td>
- </tr>
- <tr>
- <td class=cp valign=top width=7 height=12><img height=12 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td class=cp valign=top width=472 height=12><span class="campo"><?php echo $cedente; ?></span></td>
- <td class=cp valign=top width=7 height=12><img height=12 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td class=cp valign=top align=right width=180 height=12><span class="campo"><?php echo $agencia_codigo_cedente; ?></span></td>
- </tr>
- <tr>
- <td valign=top width=7 height=1><img height=1 src="<?php echo $images; ?>/2.png" width=7 border=0></td>
- <td valign=top width=472 height=1><img height=1 src="<?php echo $images; ?>/2.png" width=472 border=0></td>
- <td valign=top width=7 height=1><img height=1 src="<?php echo $images; ?>/2.png" width=7 border=0></td>
- <td valign=top width=180 height=1><img height=1 src="<?php echo $images; ?>/2.png" width=180 border=0></td>
- </tr>
- </tbody>
-</table>
-<table cellspacing=0 cellpadding=0 border=0>
-<tbody>
- <tr>
- <?php
- $widths = array(113, 133, 62, 34, 102, 180,);
- $titles = array('Data do documento', 'N<u>o</u> documento', 'Esp&eacute;cie doc.', 'Aceite', 'Data processamento', 'Nosso n&uacute;mero',);
-
- foreach($widths as $key => $width){
- $title = $titles[$key];
- echo "<td class=ct valign=top width=7 height=13> <img height=13 src='$images/1.png' width=1 border=0></td>".
- "<td class=ct valign=top width=$width height=13>$title</td>";
- }
- ?>
- </tr>
- <tr>
- <?php
- $widths = array(113, 133, 62, 34, 102, 180,);
- $values = array($data_documento, $numero_documento, $especie_doc, $aceite, $data_processamento, $nosso_numero,);
- $alighs = array('left', 'left','left','left','left','right',);
-
- foreach($widths as $key => $width){
- $value = $values[$key]; $aligh = $alighs[$key];
- echo "<td class=cp valign=top width=7 height=12><img height=12 src='$images/1.png' width=1 border=0></td>".
- "<td class=cp valign=top width=$width height=12 align=$aligh class='campo'>$value</td>";
- }
- ?>
- </tr>
- <tr>
- <?php
- $widths = array(7, 113, 7, 133, 7, 62, 7, 34, 7, 102, 7, 180);
- foreach($widths as $width){
- echo "<td valign=top width=$width height=1><img height=1 src='$images/2.png' width=$width border=0></td>";
- }
- ?>
- </tr>
-</tbody>
-</table>
-<table cellspacing=0 cellpadding=0 border=0>
-<tbody>
- <tr>
- <?php
- $widths = array('COLSPAN' => 3, 83, 43, 103, 102, 180,);
- $titles = array('Uso do banco', 'Carteira', 'Esp&eacute;cie', 'Quantidade', 'Valor Documento', '(=) Valor documento',);
- $count = 0;
- foreach($widths as $key => $width){
- $title = $titles[$count]; $count += 1;
- $key = (is_numeric($key)) ? 'width' : $key;
-
- echo "<td class=ct valign=top width =7 height=13> <img height=13 src='$images/1.png' width=1 border=0></td>".
- "<td class=ct valign=top $key=$width height=13>$title</td>";
- }
- ?>
- </tr>
- <tr>
- <td class=cp valign=top width=7 height=12><img height=12 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td valign=top class=cp height=12 COLSPAN="3"><div align=left> </div></td>
- <td class=cp valign=top width=7 height=12><img height=12 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td class=cp valign=top width=83><div align=left> <span class="campo"><?php echo $carteira; ?></span></div></td>
- <td class=cp valign=top width=7 height=12><img height=12 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td class=cp valign=top width=43><div align=left><span class="campo"><?php echo $especie; ?></span>
- </div></td>
- <td class=cp valign=top width=7 height=12><img height=12 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td class=cp valign=top width=103><span class="campo"><?php echo $quantidade; ?></span>
- </td>
- <td class=cp valign=top width=7 height=12><img height=12 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td class=cp valign=top width=102>
- <span class="campo"><?php echo $valor_unitario; ?></span></td>
- <td class=cp valign=top width=7 height=12> <img height=12 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td class=cp valign=top align=right width=180 height=12><span class="campo"><?php echo $valor_boleto; ?></span></td>
- </tr>
- <tr>
- <?php
- $widths = array(7, 75, 7, 31, 7, 83, 7, 43, 7, 103, 7, 102, 7, 180);
- foreach($widths as $width){
- echo "<td valign=top width=$width height=1><img height=1 src='$images/2.png' width=$width border=0></td>";
- }
- ?>
- </tr>
-</tbody>
-
-</table>
-<table cellspacing=0 cellpadding=0 border=0 width=666>
-<tbody>
- <tr>
- <td align=right width=10>
-<table cellspacing=0 cellpadding=0 border=0 align=left>
-<tbody>
- <tr> <td class=ct valign=top width=7 height=13><img height=13 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- </tr>
- <tr>
- <td class=cp valign=top width=7 height=12><img height=12 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- </tr>
- <tr>
- <td valign=top width=7 height=1><img height=1 src="<?php echo $images; ?>/2.png" width=1 border=0></td>
- </tr>
-</tbody>
-</table></td>
- <td valign=top width=468 rowspan=5>
- <font class=ct>Instru&ccedil;&otilde;es (Texto de responsabilidade do cedente)</font>
- <br><br>
- <span class=cp><FONT class=campo><?php echo $instrucoes1; ?>
- <br><?php echo $instrucoes2; ?>
- <br><?php echo $instrucoes3; ?>
- <br><?php echo $instrucoes4; ?>
- </FONT>
- <br><br>
- </span>
- </td>
- <td align=right width=188>
-<table cellspacing=0 cellpadding=0 border=0>
-<tbody>
- <tr>
- <td class=ct valign=top width=7 height=13><img height=13 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td class=ct valign=top width=180 height=13>(-) Desconto / Abatimentos</td>
- </tr>
- <tr>
- <td class=cp valign=top width=7 height=12><img height=12 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td class=cp valign=top align=right width=180 height=12><?php echo $desconto_abatimento; ?></td>
- </tr>
- <tr>
- <td valign=top width=7 height=1><img height=1 src="<?php echo $images; ?>/2.png" width=7 border=0></td>
- <td valign=top width=180 height=1><img height=1 src="<?php echo $images; ?>/2.png" width=180 border=0></td>
- </tr>
-</tbody>
-</table></td>
- </tr>
- <tr>
- <td align=right width=10>
-
-<table cellspacing=0 cellpadding=0 border=0 align=left>
-<tbody>
- <tr>
- <td class=ct valign=top width=7 height=13><img height=13 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- </tr>
- <tr>
- <td class=cp valign=top width=7 height=12><img height=12 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- </tr>
- <tr>
- <td valign=top width=7 height=1><img height=1 src="<?php echo $images; ?>/2.png" width=1 border=0></td>
- </tr>
-</tbody>
-</table></td>
- <td align=right width=188>
-<table cellspacing=0 cellpadding=0 border=0>
-<tbody>
- <tr>
- <td class=ct valign=top width=7 height=13><img height=13 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td class=ct valign=top width=180 height=13>(-) Outras dedu&ccedil;&otilde;es</td>
- </tr>
- <tr>
- <td class=cp valign=top width=7 height=12> <img height=12 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td class=cp valign=top align=right width=180 height=12><?php echo $outras_deducoes; ?></td>
- </tr>
- <tr>
- <td valign=top width=7 height=1><img height=1 src="<?php echo $images; ?>/2.png" width=7 border=0></td>
- <td valign=top width=180 height=1><img height=1 src="<?php echo $images; ?>/2.png" width=180 border=0></td>
- </tr>
-</tbody>
-</table></td>
- </tr>
- <tr>
- <td align=right width=10>
-<table cellspacing=0 cellpadding=0 border=0 align=left>
-<tbody>
- <tr>
- <td class=ct valign=top width=7 height=13><img height=13 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- </tr>
- <tr>
- <td class=cp valign=top width=7 height=12><img height=12 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- </tr>
- <tr>
- <td valign=top width=7 height=1><img height=1 src="<?php echo $images; ?>/2.png" width=1 border=0></td>
- </tr>
-</tbody>
-</table></td>
- <td align=right width=188>
-
-<table cellspacing=0 cellpadding=0 border=0>
-<tbody>
- <tr>
- <td class=ct valign=top width=7 height=13><img height=13 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td class=ct valign=top width=180 height=13>(+) Mora / Multa</td>
- </tr>
- <tr>
- <td class=cp valign=top width=7 height=12><img height=12 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td class=cp valign=top align=right width=180 height=12><?php echo $mora_multa; ?></td>
- </tr>
- <tr>
- <td valign=top width=7 height=1> <img height=1 src="<?php echo $images; ?>/2.png" width=7 border=0></td>
- <td valign=top width=180 height=1><img height=1 src="<?php echo $images; ?>/2.png" width=180 border=0></td>
- </tr>
-</tbody>
-</table></td>
- </tr>
- <tr>
- <td align=right width=10>
-<table cellspacing=0 cellpadding=0 border=0 align=left>
-<tbody>
- <tr>
- <td class=ct valign=top width=7 height=13><img height=13 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- </tr>
- <tr>
- <td class=cp valign=top width=7 height=12><img height=12 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- </tr>
- <tr>
- <td valign=top width=7 height=1><img height=1 src="<?php echo $images; ?>/2.png" width=1 border=0></td>
- </tr>
-</tbody>
-</table></td>
- <td align=right width=188>
-
-<table cellspacing=0 cellpadding=0 border=0>
-<tbody>
- <tr>
- <td class=ct valign=top width=7 height=13><img height=13 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td class=ct valign=top width=180 height=13>(+) Outros acr&eacute;scimos</td>
- </tr>
- <tr>
- <td class=cp valign=top width=7 height=12><img height=12 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td class=cp valign=top align=right width=180 height=12><?php echo $outros_acrescimos; ?></td>
- </tr>
- <tr>
- <td valign=top width=7 height=1><img height=1 src="<?php echo $images; ?>/2.png" width=7 border=0></td>
- <td valign=top width=180 height=1><img height=1 src="<?php echo $images; ?>/2.png" width=180 border=0></td>
- </tr>
-</tbody>
-</table></td>
- </tr>
- <tr>
- <td align=right width=10>
-<table cellspacing=0 cellpadding=0 border=0 align=left>
-<tbody>
- <tr>
- <td class=ct valign=top width=7 height=13><img height=13 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- </tr>
- <tr>
- <td class=cp valign=top width=7 height=12><img height=12 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- </tr>
-</tbody>
-</table></td>
- <td align=right width=188>
-<table cellspacing=0 cellpadding=0 border=0>
-<tbody>
- <tr>
- <td class=ct valign=top width=7 height=13><img height=13 src="<?php echo $images; ?>/1.png" width=1 border=0></td>
- <td class=ct valign=top width=180 height=13>(=) Valor cobrado</td>