Class NFeUtil

java.lang.Object
org.brerp.sped.nfe.util.NFeUtil

public abstract class NFeUtil extends Object
Utilitários para gerar a NFe.
Author:
Murilo H. Torquato (devCoffee, www.devcoffee.com.br)
  • Field Details

  • Constructor Details

    • NFeUtil

      public NFeUtil()
  • Method Details

    • getFileEventoNfe

      public static File getFileEventoNfe(String fileName, String type, MAttachment attachment) throws Exception
      Metodo responsavel por retornar arquivo do evento NFe
      Parameters:
      fileName -
      type -
      attachment -
      Returns:
      File
      Throws:
      Exception
    • getJasperEventoNfe

      public static net.sf.jasperreports.engine.JasperPrint getJasperEventoNfe(String type, MAttachment attachment) throws Exception
      Metodo responsavel por retornar Jasper do evento NFe
      Parameters:
      type -
      attachment -
      Returns:
      JasperPrint
      Throws:
      Exception
    • geraCabecNFe

      public static String geraCabecNFe()
      Gera o cabeçalho da NFe
      Returns:
      cabecalho
    • replacesNfe

      public static String replacesNfe(String xml)
    • geraRodapDistribuicao

      public static br.inf.portalfiscal.nfe.schema.procnfe.TProtNFe geraRodapDistribuicao(String chNFe, String nProt, String tpAmb, String dhRecbto, String digVal, String cStat, String xMotivo, String verAplic, String cMsg, String xMsg)
      Rodapé padrão Distribuição
      Parameters:
      chNFe -
      nProt -
      tpAmb -
      dhRecbto -
      digVal -
      cStat -
      xMotivo -
      Returns:
      XML
    • generateDistribution

      public static File generateDistribution(MLBRDocFiscal df) throws Exception
      Throws:
      Exception
    • genDANFe

      public static File genDANFe(MLBRDocFiscal df, File xml) throws Exception
      Throws:
      Exception
    • updateAttach

      public static boolean updateAttach(MLBRDocFiscal df, File xml)
      update Attachment
      Parameters:
      nf -
      xml -
      Returns:
      true = success, false = error
    • XMLtoString

      public static String XMLtoString(File xml) throws Exception
      Throws:
      Exception
    • objectToXml

      public static <T> String objectToXml(Object obj) throws javax.xml.bind.JAXBException
      Transforma o Objeto em XML(String)
      Returns:
      String
      Throws:
      NfeException
      javax.xml.bind.JAXBException
    • xmlToObject

      public static <T> T xmlToObject(String xml, Class<T> classe) throws javax.xml.bind.JAXBException
      Transforma o String do XML em Objeto
      Parameters:
      String -
      Class -
      Returns:
      T
      Throws:
      javax.xml.bind.JAXBException
    • getAttachmentEntryFile

      public static File getAttachmentEntryFile(MAttachmentEntry entry)
      Get Attachment
      Parameters:
      entry -
      Returns:
    • stringToTime

      public static Timestamp stringToTime(String dhRecbto)
      String para Timestamp
      Parameters:
      dhRecbto -
      Returns:
    • getNFeConfig

      public static NFeConfig getNFeConfig(Properties ctx, int AD_Org_ID, String trxName) throws Exception
      getNFeInfo
      Parameters:
      ctx -
      Returns:
      envType
      Throws:
      Exception
    • getNFeStatus

      public static String getNFeStatus(String status)
    • validateSize

      public static String validateSize(String str)
      Valida tamanho do Arquivo XML
      Parameters:
      file -
      Returns:
      error or null
    • getXMLSize

      public static Integer getXMLSize(MLBRDocFiscal df)
    • checkXMLFile

      public static String checkXMLFile(MLBRDocFiscal df)
      Verifica a NF e retorna o ID da mesma
      Parameters:
      df - a ser verificado
      Returns:
      ID da NF Eletrônica ou NULL quando houver erro
    • getResource

      public static URL getResource(Class clazz, String name)
      Get Resource to include in XSD File
      Parameters:
      clazz -
      name -
      Returns:
    • packageNameOfClass

      public static String packageNameOfClass(Class clazz)
      packageNameOfClass
      Parameters:
      clazz -
      Returns:
    • getCityCode

      public static String getCityCode(MOrgInfo oi)
      Pega o código da cidade
      Parameters:
      oi -
      Returns:
      region code
    • getRegionCode

      public static int getRegionCode(MOrgInfo oi)
      Pega o código do estado
      Parameters:
      oi -
      Returns:
      region code
    • getJasperDanfeTpImpressao

      public static String getJasperDanfeTpImpressao(MLBRDocFiscal docFiscal)
      Retorna o Nome do Arquivo Jasper para Impressão DANFe
      Parameters:
      tpImp -
      Returns:
    • isBPartnerCashTrx

      public static boolean isBPartnerCashTrx(Properties ctx, I_C_BPartner bp, int AD_Org_ID)
      Retorna se o BP é consumidor não identificado
      Parameters:
      ctx -
      bp -
      Returns:
    • generateQRCodeNFCeURL

      public static String generateQRCodeNFCeURL(MLBRDocFiscal df, String digestValue, String nfeID, String cDest, String vICMS, String tpAmb, boolean isComplete) throws Exception
      Generate QRCode
      Parameters:
      nf -
      digestValue -
      nfeID -
      Returns:
      Throws:
      Exception
    • generateQRCodeNFCeURL

      public static String generateQRCodeNFCeURL(String chNFe, String nVersao, String tpAmb, String cDest, Timestamp dhEmi, String vNF, String vICMS, String digest, String tokenID, String token, String url) throws Exception
      Generate NFC-e QRCode Especs: http://www.nfe.fazenda.gov.br/portal/exibirArquivo.aspx?conteudo=jKHRw% 20g4V%20E=
      Parameters:
      chNFe -
      nVersao -
      tpAmb -
      cDest -
      dhEmi -
      vNF -
      vICMS -
      digest -
      tokenID -
      token -
      url -
      Returns:
      Throws:
      Exception
    • generateQRCodeParamsURL

      public static String generateQRCodeParamsURL(Map<String,String> parametros)
      Monta parâmetros a serem colocados em uma URL
      Parameters:
      parametros -
      Returns:
    • regerarCertificadoNFe

      public static void regerarCertificadoNFe(MOrgInfo infoOrganizacao, Properties ctx)
    • getMessageWhatsApp

      public static String getMessageWhatsApp(String documentNo, String companyName, String CNPJ, boolean isCancelled, String NFe_ID, String mensagemAdicional)
    • getMPPProductBOMLine

      public static MPPProductBOMLine getMPPProductBOMLine(Integer M_Product_ID, MPPProductBOM bom)
    • getQtyUsed

      public static BigDecimal getQtyUsed(MPPProductBOMLine bomLine, BigDecimal productionQty)