br_nfe 2.1.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/Gemfile +1 -0
- data/Gemfile.lock +12 -2
- data/README.markdown +3 -1
- data/Rakefile +20 -1
- data/lib/br_nfe/active_model/associations.rb +11 -0
- data/lib/br_nfe/active_model/has_many.rb +65 -0
- data/lib/br_nfe/active_model/has_one.rb +57 -0
- data/lib/br_nfe/active_model_base.rb +38 -1
- data/lib/br_nfe/base.rb +9 -0
- data/lib/br_nfe/calculos/fatores_de_multiplicacao.rb +67 -0
- data/lib/br_nfe/calculos/modulo11.rb +54 -0
- data/lib/br_nfe/calculos/modulo11_fator_de2a9.rb +83 -0
- data/lib/br_nfe/calculos/modulo11_fator_de2a9_resto_zero.rb +29 -0
- data/lib/br_nfe/constants.rb +46 -1
- data/lib/br_nfe/endereco.rb +6 -2
- data/lib/br_nfe/helper/cpf_cnpj.rb +8 -1
- data/lib/br_nfe/person.rb +32 -3
- data/lib/br_nfe/product/destinatario.rb +45 -0
- data/lib/br_nfe/product/emitente.rb +14 -1
- data/lib/br_nfe/product/evento/base.rb +146 -0
- data/lib/br_nfe/product/evento/cancelamento.rb +46 -0
- data/lib/br_nfe/product/gateway/base.rb +16 -43
- data/lib/br_nfe/product/gateway/web_service_am.rb +140 -0
- data/lib/br_nfe/product/gateway/web_service_ba.rb +140 -0
- data/lib/br_nfe/product/gateway/web_service_ce.rb +162 -0
- data/lib/br_nfe/product/gateway/web_service_go.rb +140 -0
- data/lib/br_nfe/product/gateway/web_service_mg.rb +140 -0
- data/lib/br_nfe/product/gateway/web_service_ms.rb +140 -0
- data/lib/br_nfe/product/gateway/web_service_mt.rb +140 -0
- data/lib/br_nfe/product/gateway/web_service_pe.rb +140 -0
- data/lib/br_nfe/product/gateway/web_service_pr.rb +140 -0
- data/lib/br_nfe/product/gateway/web_service_rs.rb +140 -0
- data/lib/br_nfe/product/gateway/web_service_sp.rb +140 -0
- data/lib/br_nfe/product/gateway/web_service_svan.rb +162 -0
- data/lib/br_nfe/product/gateway/web_service_svc_an.rb +131 -0
- data/lib/br_nfe/product/gateway/web_service_svc_rs.rb +20 -0
- data/lib/br_nfe/product/gateway/web_service_svrs.rb +111 -10
- data/lib/br_nfe/product/nf_xml_value.rb +278 -0
- data/lib/br_nfe/product/nfe/adicao_importacao.rb +76 -0
- data/lib/br_nfe/product/nfe/cobranca/duplicata.rb +44 -0
- data/lib/br_nfe/product/nfe/cobranca/fatura.rb +64 -0
- data/lib/br_nfe/product/nfe/cobranca/pagamento.rb +99 -0
- data/lib/br_nfe/product/nfe/declaracao_importacao.rb +221 -0
- data/lib/br_nfe/product/nfe/detalhe_exportacao.rb +89 -0
- data/lib/br_nfe/product/nfe/item.rb +678 -0
- data/lib/br_nfe/product/nfe/item_tax/cofins.rb +138 -0
- data/lib/br_nfe/product/nfe/item_tax/cofins_st.rb +68 -0
- data/lib/br_nfe/product/nfe/item_tax/icms.rb +593 -0
- data/lib/br_nfe/product/nfe/item_tax/icms_uf_destino.rb +169 -0
- data/lib/br_nfe/product/nfe/item_tax/importacao.rb +62 -0
- data/lib/br_nfe/product/nfe/item_tax/ipi.rb +179 -0
- data/lib/br_nfe/product/nfe/item_tax/issqn.rb +256 -0
- data/lib/br_nfe/product/nfe/item_tax/pis.rb +138 -0
- data/lib/br_nfe/product/nfe/item_tax/pis_st.rb +68 -0
- data/lib/br_nfe/product/nfe/processo_referencia.rb +48 -0
- data/lib/br_nfe/product/nfe/transporte/base.rb +264 -0
- data/lib/br_nfe/product/nfe/transporte/transportador.rb +15 -0
- data/lib/br_nfe/product/nfe/transporte/veiculo.rb +53 -0
- data/lib/br_nfe/product/nfe/transporte/volume.rb +89 -0
- data/lib/br_nfe/product/nota_fiscal.rb +1173 -0
- data/lib/br_nfe/product/operation/base.rb +255 -0
- data/lib/br_nfe/product/operation/nfe_autorizacao.rb +118 -0
- data/lib/br_nfe/product/operation/nfe_consulta_protocolo.rb +61 -0
- data/lib/br_nfe/product/operation/nfe_download_nf.rb +86 -0
- data/lib/br_nfe/product/operation/nfe_inutilizacao.rb +168 -0
- data/lib/br_nfe/product/operation/nfe_recepcao_evento.rb +70 -0
- data/lib/br_nfe/product/operation/nfe_ret_autorizacao.rb +63 -0
- data/lib/br_nfe/product/operation/nfe_status_servico.rb +46 -0
- data/lib/br_nfe/product/response/base.rb +97 -0
- data/lib/br_nfe/product/response/build/base.rb +287 -0
- data/lib/br_nfe/product/response/build/nfe_autorizacao.rb +102 -0
- data/lib/br_nfe/product/response/build/nfe_consulta_protocolo.rb +133 -0
- data/lib/br_nfe/product/response/build/nfe_inutilizacao.rb +53 -0
- data/lib/br_nfe/product/response/build/nfe_ret_autorizacao.rb +65 -0
- data/lib/br_nfe/product/response/build/nfe_status_servico.rb +43 -0
- data/lib/br_nfe/product/response/event.rb +89 -0
- data/lib/br_nfe/product/response/nfe_autorizacao.rb +12 -0
- data/lib/br_nfe/product/response/nfe_consulta_protocolo.rb +13 -0
- data/lib/br_nfe/product/response/nfe_inutilizacao.rb +89 -0
- data/lib/br_nfe/product/response/nfe_ret_autorizacao.rb +9 -0
- data/lib/br_nfe/product/response/nfe_status_servico.rb +31 -0
- data/lib/br_nfe/product/xml/_signed_info_sh1.xml.slim +9 -0
- data/lib/br_nfe/product/xml/_tc_cpf_cnpj.xml.slim +7 -0
- data/lib/br_nfe/product/xml/signature_sh1.xml.slim +12 -0
- data/lib/br_nfe/product/xml/v1_00/evento/infEventoCancelamento.xml.slim +19 -0
- data/lib/br_nfe/product/xml/v1_00/root/NfeDownloadNf.xml.slim +5 -0
- data/lib/br_nfe/product/xml/v1_00/root/NfeRecepcaoEvento.xml.slim +7 -0
- data/lib/br_nfe/product/xml/v2_00/_tc_endereco.xml.slim +19 -0
- data/lib/br_nfe/product/xml/v2_00/_tc_infNFe.xml.slim +39 -0
- data/lib/br_nfe/product/xml/v2_00/infInut.xml.slim +12 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/NFe.xml.slim +4 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_cobr.xml.slim +19 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_dest.xml.slim +14 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_det.xml.slim +7 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_emit.xml.slim +19 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_entrega.xml.slim +11 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_exporta.xml.slim +2 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_ide.xml.slim +24 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_infAdic.xml.slim +13 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_retirada.xml.slim +11 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_total.xml.slim +50 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_transp.xml.slim +35 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/_tc_imposto.xml.slim +31 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/_tc_prod.xml.slim +37 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS00.xml.slim +6 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS10.xml.slim +16 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS101.xml.slim +4 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS102.xml.slim +3 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS20.xml.slim +6 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS201.xml.slim +15 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS202.xml.slim +14 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS30.xml.slim +12 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS40.xml.slim +7 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS500.xml.slim +6 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS51.xml.slim +13 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS60.xml.slim +5 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS70.xml.slim +18 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS90.xml.slim +21 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS900.xml.slim +25 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/_tc_COFINS.xml.slim +26 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/_tc_COFINS_ST.xml.slim +7 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/_tc_ICMS.xml.slim +45 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/_tc_II.xml.slim +4 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/_tc_IPI.xml.slim +30 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/_tc_PIS.xml.slim +26 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/_tc_PIS_ST.xml.slim +7 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/prod/_tc_di.xml.slim +13 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/transp/_tc_retTransp.xml.slim +6 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/transp/_tc_transporta.xml.slim +17 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/transp/_tc_vol.xml.slim +15 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe.xml.slim +3 -0
- data/lib/br_nfe/product/xml/v2_00/root/NfeAutorizacao.xml.slim +5 -0
- data/lib/br_nfe/product/xml/v2_00/root/NfeInutilizacao.xml.slim +4 -0
- data/lib/br_nfe/product/xml/v2_00/root/NfeRetAutorizacao.xml.slim +3 -0
- data/lib/br_nfe/product/xml/v2_00/root/NfeStatusServico.xml.slim +4 -0
- data/lib/br_nfe/product/xml/v2_01/root/NfeConsultaProtocolo.xml.slim +4 -0
- data/lib/br_nfe/product/xml/v3_10/_tc_infNFe.xml.slim +44 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/_tc_dest.xml.slim +25 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/_tc_det.xml.slim +14 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/_tc_exporta.xml.slim +4 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/_tc_ide.xml.slim +26 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/_tc_pag.xml.slim +7 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/_tc_total.xml.slim +78 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/det/_tc_imposto.xml.slim +37 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/det/_tc_prod.xml.slim +48 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/det/imposto/ICMS/_tc_ICMS20.xml.slim +12 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/det/imposto/ICMS/_tc_ICMS30.xml.slim +17 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/det/imposto/ICMS/_tc_ICMS40.xml.slim +7 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/det/imposto/ICMS/_tc_ICMS51.xml.slim +19 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/det/imposto/ICMS/_tc_ICMS70.xml.slim +23 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/det/imposto/ICMS/_tc_ICMS90.xml.slim +26 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/det/imposto/_tc_ICMSUFDest.xml.slim +8 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/det/imposto/_tc_ISSQN.xml.slim +35 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/det/prod/_tc_det_export.xml.slim +8 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/det/prod/_tc_di.xml.slim +28 -0
- data/lib/br_nfe/product/xml/v3_10/root/NfeAutorizacao.xml.slim +6 -0
- data/lib/br_nfe/service/base.rb +1 -105
- data/lib/br_nfe/service/betha/v1/cancela_nfse.rb +1 -1
- data/lib/br_nfe/service/response/default.rb +1 -1
- data/lib/br_nfe/service/simpliss/v1/base.rb +2 -0
- data/lib/br_nfe/version.rb +2 -2
- data/lib/br_nfe.rb +180 -22
- data/lib/config/locales/br_nfe/en/product/nfe/cobranca/fatura.yml +6 -0
- data/lib/config/locales/br_nfe/en/product/nfe/declaracao_importacao.yml +10 -0
- data/lib/config/locales/br_nfe/en/product/nfe/item.yml +20 -0
- data/lib/config/locales/br_nfe/en/product/nfe/item_tax/icms_uf_destino.yml +8 -0
- data/lib/config/locales/br_nfe/en/product/nfe/transporte/base.yml +9 -0
- data/lib/config/locales/br_nfe/en/product/nota_fiscal.yml +21 -0
- data/lib/config/locales/br_nfe/en/product/operation/nfe_autorizacao.yml +10 -0
- data/lib/config/locales/br_nfe/en/product/operation/nfe_recepcao_evento.yml +6 -0
- data/lib/config/locales/br_nfe/pt-BR/product/nfe/cobranca/fatura.yml +6 -0
- data/lib/config/locales/br_nfe/pt-BR/product/nfe/declaracao_importacao.yml +10 -0
- data/lib/config/locales/br_nfe/pt-BR/product/nfe/item.yml +20 -0
- data/lib/config/locales/br_nfe/pt-BR/product/nfe/item_tax/icms_uf_destino.yml +8 -0
- data/lib/config/locales/br_nfe/pt-BR/product/nfe/transporte/base.yml +9 -0
- data/lib/config/locales/br_nfe/pt-BR/product/nota_fiscal.yml +21 -0
- data/lib/config/locales/br_nfe/pt-BR/product/operation/nfe_autorizacao.yml +10 -0
- data/lib/config/locales/br_nfe/pt-BR/product/operation/nfe_recepcao_evento.yml +6 -0
- data/test/br_nfe/association/have_destinatario_test.rb +8 -8
- data/test/br_nfe/association/have_emitente_test.rb +6 -6
- data/test/br_nfe/base_test.rb +15 -4
- data/test/br_nfe/endereco_test.rb +15 -0
- data/test/br_nfe/person_test.rb +55 -6
- data/test/br_nfe/product/destinatario_test.rb +26 -0
- data/test/br_nfe/product/emitente_test.rb +1 -2
- data/test/br_nfe/product/evento/base_test.rb +58 -0
- data/test/br_nfe/product/evento/cancelamento_test.rb +32 -0
- data/test/br_nfe/product/gateway/web_service_am_test.rb +242 -0
- data/test/br_nfe/product/gateway/web_service_ba_test.rb +242 -0
- data/test/br_nfe/product/gateway/web_service_ce_test.rb +242 -0
- data/test/br_nfe/product/gateway/web_service_go_test.rb +242 -0
- data/test/br_nfe/product/gateway/web_service_mg_test.rb +242 -0
- data/test/br_nfe/product/gateway/web_service_ms_test.rb +242 -0
- data/test/br_nfe/product/gateway/web_service_mt_test.rb +408 -0
- data/test/br_nfe/product/gateway/web_service_pe_test.rb +408 -0
- data/test/br_nfe/product/gateway/web_service_pr_test.rb +408 -0
- data/test/br_nfe/product/gateway/web_service_rs_test.rb +407 -0
- data/test/br_nfe/product/gateway/web_service_sp_test.rb +408 -0
- data/test/br_nfe/product/gateway/web_service_svan_test.rb +242 -0
- data/test/br_nfe/product/gateway/web_service_svc_an_test.rb +185 -0
- data/test/br_nfe/product/gateway/web_service_svc_rs_test.rb +185 -0
- data/test/br_nfe/product/gateway/web_service_svrs_test.rb +208 -2
- data/test/br_nfe/product/nfe/adicao_importacao_test.rb +19 -0
- data/test/br_nfe/product/nfe/cobranca/duplicata_test.rb +19 -0
- data/test/br_nfe/product/nfe/cobranca/fatura_test.rb +32 -0
- data/test/br_nfe/product/nfe/cobranca/pagamento_test.rb +105 -0
- data/test/br_nfe/product/nfe/declaracao_importacao_test.rb +116 -0
- data/test/br_nfe/product/nfe/detalhe_exportacao_test.rb +97 -0
- data/test/br_nfe/product/nfe/item_tax/cofins_st_test.rb +22 -0
- data/test/br_nfe/product/nfe/item_tax/cofins_test.rb +113 -0
- data/test/br_nfe/product/nfe/item_tax/icms_test.rb +1011 -0
- data/test/br_nfe/product/nfe/item_tax/icms_uf_destino_test.rb +99 -0
- data/test/br_nfe/product/nfe/item_tax/importacao_test.rb +23 -0
- data/test/br_nfe/product/nfe/item_tax/ipi_test.rb +160 -0
- data/test/br_nfe/product/nfe/item_tax/issqn_test.rb +84 -0
- data/test/br_nfe/product/nfe/item_tax/pis_st_test.rb +22 -0
- data/test/br_nfe/product/nfe/item_tax/pis_test.rb +113 -0
- data/test/br_nfe/product/nfe/item_test.rb +381 -0
- data/test/br_nfe/product/nfe/processo_referencia_test.rb +30 -0
- data/test/br_nfe/product/nfe/transporte/base_test.rb +182 -0
- data/test/br_nfe/product/nfe/transporte/transportador_test.rb +13 -0
- data/test/br_nfe/product/nfe/transporte/veiculo_test.rb +13 -0
- data/test/br_nfe/product/nfe/transporte/volume_test.rb +42 -0
- data/test/br_nfe/product/nota_fiscal_test.rb +662 -0
- data/test/br_nfe/product/operation/base_test.rb +538 -0
- data/test/br_nfe/product/operation/nfe_autorizacao_test.rb +378 -0
- data/test/br_nfe/product/operation/nfe_consulta_protocolo_test.rb +349 -0
- data/test/br_nfe/product/operation/nfe_download_nf_test.rb +93 -0
- data/test/br_nfe/product/operation/nfe_inutilizacao_test.rb +210 -0
- data/test/br_nfe/product/operation/nfe_recepcao_evento_test.rb +84 -0
- data/test/br_nfe/product/operation/nfe_ret_autorizacao_test.rb +309 -0
- data/test/br_nfe/product/operation/nfe_status_servico_test.rb +122 -0
- data/test/br_nfe/product/response/base_test.rb +75 -0
- data/test/br_nfe/product/response/build/base_test.rb +34 -0
- data/test/br_nfe/product/response/nfe_ret_autorizacao_test.rb +14 -0
- data/test/br_nfe/service/association/have_intermediario_test.rb +10 -10
- data/test/br_nfe/service/base_test.rb +9 -206
- data/test/br_nfe/service/betha/v1/cancela_nfse_test.rb +8 -6
- data/test/br_nfe/service/betha/v1/consulta_lote_rps_test.rb +6 -3
- data/test/br_nfe/service/betha/v1/consulta_nfs_por_rps_test.rb +6 -3
- data/test/br_nfe/service/betha/v1/consulta_nfse_test.rb +7 -4
- data/test/br_nfe/service/betha/v1/consulta_situacao_lote_rps_test.rb +12 -9
- data/test/br_nfe/service/betha/v1/recepcao_lote_rps_test.rb +6 -3
- data/test/br_nfe/service/rps_test.rb +2 -2
- data/test/br_nfe/service/simpliss/v1/cancela_nfse_test.rb +6 -3
- data/test/br_nfe/service/simpliss/v1/consulta_lote_rps_test.rb +7 -4
- data/test/br_nfe/service/simpliss/v1/consulta_nfs_por_rps_test.rb +7 -4
- data/test/br_nfe/service/simpliss/v1/consulta_nfse_test.rb +8 -5
- data/test/br_nfe/service/simpliss/v1/consulta_situacao_lote_rps_test.rb +9 -6
- data/test/br_nfe/service/simpliss/v1/recepcao_lote_rps_test.rb +6 -3
- data/test/br_nfe/service/thema/v1/cancela_nfse_test.rb +6 -3
- data/test/br_nfe/service/thema/v1/consulta_lote_rps_test.rb +6 -3
- data/test/br_nfe/service/thema/v1/consulta_nfs_por_rps_test.rb +6 -3
- data/test/br_nfe/service/thema/v1/consulta_nfse_test.rb +8 -5
- data/test/br_nfe/service/thema/v1/consulta_situacao_lote_rps_test.rb +9 -6
- data/test/br_nfe/service/thema/v1/recepcao_lote_rps_limitado_test.rb +6 -3
- data/test/br_nfe/service/thema/v1/recepcao_lote_rps_test.rb +6 -3
- data/test/factories/person.rb +1 -1
- data/test/factories/product/destinatario.rb +11 -0
- data/test/factories/product/emitente.rb +1 -1
- data/test/factories/product/evento/base.rb +9 -0
- data/test/factories/product/evento/cancelamento.rb +10 -0
- data/test/factories/product/gateway/web_service_am.rb +5 -0
- data/test/factories/product/gateway/web_service_ba.rb +5 -0
- data/test/factories/product/nfe/adicao_importacao.rb +7 -0
- data/test/factories/product/nfe/cobranca/duplicata.rb +7 -0
- data/test/factories/product/nfe/cobranca/fatura.rb +8 -0
- data/test/factories/product/nfe/cobranca/pagamento.rb +9 -0
- data/test/factories/product/nfe/declaracao_importacao.rb +10 -0
- data/test/factories/product/nfe/detalhe_exportacao.rb +5 -0
- data/test/factories/product/nfe/item.rb +24 -0
- data/test/factories/product/nfe/item_tax/cofins.rb +5 -0
- data/test/factories/product/nfe/item_tax/cofins_st.rb +5 -0
- data/test/factories/product/nfe/item_tax/icms.rb +9 -0
- data/test/factories/product/nfe/item_tax/icms_uf_destino.rb +11 -0
- data/test/factories/product/nfe/item_tax/importacao.rb +8 -0
- data/test/factories/product/nfe/item_tax/ipi.rb +6 -0
- data/test/factories/product/nfe/item_tax/issqn.rb +9 -0
- data/test/factories/product/nfe/item_tax/pis.rb +5 -0
- data/test/factories/product/nfe/item_tax/pis_st.rb +5 -0
- data/test/factories/product/nfe/processo_referencia.rb +6 -0
- data/test/factories/product/nfe/transporte/base.rb +5 -0
- data/test/factories/product/nfe/transporte/transportador.rb +7 -0
- data/test/factories/product/nfe/transporte/veiculo.rb +7 -0
- data/test/factories/product/nfe/transporte/volume.rb +5 -0
- data/test/factories/product/nota_fiscal.rb +22 -0
- data/test/factories/product/{base.rb → operation/base.rb} +1 -1
- data/test/factories/product/operation/nfe_autorizacao.rb +590 -0
- data/test/factories/product/operation/nfe_consulta_protocolo.rb +13 -0
- data/test/factories/product/operation/nfe_download_nf.rb +15 -0
- data/test/factories/product/operation/nfe_inutilizacao.rb +19 -0
- data/test/factories/product/operation/nfe_recepcao_evento.rb +14 -0
- data/test/factories/product/operation/nfe_ret_autorizacao.rb +13 -0
- data/test/factories/product/{consulta_status_servico.rb → operation/nfe_status_servico.rb} +1 -1
- data/test/factories/product/response/base.rb +12 -0
- data/test/factories/product/response/build/base.rb +6 -0
- data/test/factories/product/response/nfe_ret_autorizacao.rb +13 -0
- data/test/factories/service/emitente.rb +1 -1
- data/test/fixtures/product/operation/nfe_autorizacao/nfe_signed.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_autorizacao/async_fail.xml +21 -0
- data/test/fixtures/product/response/v3.10/nfe_autorizacao/async_success.xml +25 -0
- data/test/fixtures/product/response/v3.10/nfe_autorizacao/nfe/with_proc.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_autorizacao/nfe/without_proc.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_autorizacao/original_xml.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_autorizacao/sync_fail.xml +32 -0
- data/test/fixtures/product/response/v3.10/nfe_autorizacao/sync_success.xml +33 -0
- data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/event_xml/event_1.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/event_xml/event_2.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/event_xml/event_3.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/event_xml/event_cancel.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/event_xml/one_event.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/fail.xml +22 -0
- data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/nfe_original/with_proc.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/nfe_original/without_proc.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/success_many_with_cancel.xml +198 -0
- data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/success_many_without_cancel.xml +199 -0
- data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/success_one.xml +89 -0
- data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/success_without.xml +34 -0
- data/test/fixtures/product/response/v3.10/nfe_inutilizacao/fail.xml +29 -0
- data/test/fixtures/product/response/v3.10/nfe_inutilizacao/success.xml +30 -0
- data/test/fixtures/product/response/v3.10/nfe_recepcao_evento/cancelamento/fail.xml +34 -0
- data/test/fixtures/product/response/v3.10/nfe_recepcao_evento/cancelamento/success.xml +36 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/lot_fail.xml +22 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/lot_ok_one_invoice_fail.xml +33 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/lot_ok_one_invoice_fail_and_one_ok.xml +46 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/lot_ok_one_invoice_ok.xml +34 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/lot_ok_two_invoice_fail.xml +46 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/lot_ok_two_invoice_ok.xml +46 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/nfe/nf_2_with_protocol.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/nfe/nf_2_without_protocol.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/nfe/nf_3_with_protocol.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/nfe/nf_3_without_protocol.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/original_xml/lot.xml +2 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/original_xml/nfe.xml +2 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/original_xml/nfeProc.xml +4 -0
- data/test/fixtures/product/response/v3.10/nfe_status_servico/fail.xml +23 -0
- data/test/fixtures/product/response/v3.10/nfe_status_servico/success.xml +22 -0
- data/test/fixtures/product/schemas/CCe_v1.00.xsd +11 -0
- data/test/fixtures/product/schemas/EPEC_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/LeiauteCadastroEmissorDFe_v1.01.xsd +234 -0
- data/test/fixtures/product/schemas/SuframaInternaliza_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/SuframaVistoria_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/atuCadEmiDFe_v1.01.xsd +9 -0
- data/test/fixtures/product/schemas/cabecMsg_v1.02.xsd +29 -0
- data/test/fixtures/product/schemas/cadEmiDFe_v1.01.xsd +9 -0
- data/test/fixtures/product/schemas/cancNFe_v2.00.xsd +9 -0
- data/test/fixtures/product/schemas/confRecebto_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/consCad_v2.00.xsd +9 -0
- data/test/fixtures/product/schemas/consDPEC_v1.01.xsd +9 -0
- data/test/fixtures/product/schemas/consNFeDest_v1.01.xsd +10 -0
- data/test/fixtures/product/schemas/consReciNFe_v2.00.xsd +9 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/consReciNFe_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/consSitNFe_v2.01.xsd +10 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/consSitNFe_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/consStatServ_v2.00.xsd +9 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/consStatServ_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/distDFeInt_v1.00.xsd +71 -0
- data/test/fixtures/product/schemas/downloadNFe_v1.00.xsd +10 -0
- data/test/fixtures/product/schemas/e110110_v1.00.xsd +58 -0
- data/test/fixtures/product/schemas/e110111_v1.00.xsd +42 -0
- data/test/fixtures/product/schemas/e110140_v1.00.xsd +124 -0
- data/test/fixtures/product/schemas/e111500_v1.00.xsd +69 -0
- data/test/fixtures/product/schemas/e111501_v1.00.xsd +69 -0
- data/test/fixtures/product/schemas/e111502_v1.00.xsd +50 -0
- data/test/fixtures/product/schemas/e111503_v1.00.xsd +50 -0
- data/test/fixtures/product/schemas/e210200_v1.00.xsd +32 -0
- data/test/fixtures/product/schemas/e210210_v1.00.xsd +32 -0
- data/test/fixtures/product/schemas/e210220_v1.00.xsd +45 -0
- data/test/fixtures/product/schemas/e210240_v1.00.xsd +44 -0
- data/test/fixtures/product/schemas/e411500_v1.00.xsd +134 -0
- data/test/fixtures/product/schemas/e411501_v1.00.xsd +134 -0
- data/test/fixtures/product/schemas/e411502_v1.00.xsd +95 -0
- data/test/fixtures/product/schemas/e411503_v1.00.xsd +95 -0
- data/test/fixtures/product/schemas/e990900_v1.00.xsd +87 -0
- data/test/fixtures/product/schemas/e990910_v1.00.xsd +81 -0
- data/test/fixtures/product/schemas/envCCe_v1.00.xsd +10 -0
- data/test/fixtures/product/schemas/envCancelPProrrogNFe_v1.0.xsd +50 -0
- data/test/fixtures/product/schemas/envConfRecebto_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/envDPEC_v1.01.xsd +9 -0
- data/test/fixtures/product/schemas/envEPEC_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/envEventoCancNFe_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/envEvento_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/envFiscoNfe_v1.0.xsd +179 -0
- data/test/fixtures/product/schemas/envPProrrogNFe_v1.0.xsd +65 -0
- data/test/fixtures/product/schemas/envRemIndus_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/envSuframaInternaliza_v1.00.xsd +10 -0
- data/test/fixtures/product/schemas/envSuframaVistoria_v1.00.xsd +10 -0
- data/test/fixtures/product/schemas/enviNFe_v2.00.xsd +9 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/enviNFe_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/eventoCancNFe_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/eventoEPEC_v0.01.xsd +267 -0
- data/test/fixtures/product/schemas/eventoEPEC_v1.00.xsd +267 -0
- data/test/fixtures/product/schemas/eventoRemIndus_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/inutNFe_v2.00.xsd +9 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/inutNFe_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/leiauteCCe_v1.00.xsd +418 -0
- data/test/fixtures/product/schemas/leiauteCancNFe_v2.00.xsd +143 -0
- data/test/fixtures/product/schemas/leiauteConfRecebto_v1.00.xsd +406 -0
- data/test/fixtures/product/schemas/leiauteConsNFeDest_v1.01.xsd +483 -0
- data/test/fixtures/product/schemas/leiauteConsSitNFe_v2.01.xsd +548 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/leiauteConsSitNFe_v3.10.xsd +502 -502
- data/test/fixtures/product/schemas/leiauteConsStatServ_v2.00.xsd +98 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/leiauteConsStatServ_v3.10.xsd +97 -97
- data/test/fixtures/product/schemas/leiauteConsultaCadastro_v1.01.xsd +355 -0
- data/test/fixtures/product/schemas/leiauteConsultaCadastro_v2.00.xsd +404 -0
- data/test/fixtures/product/schemas/leiauteDPEC_v1.01.xsd +464 -0
- data/test/fixtures/product/schemas/leiauteDownloadNFe_v1.00.xsd +149 -0
- data/test/fixtures/product/schemas/leiauteEPEC_v1.00.xsd +459 -0
- data/test/fixtures/product/schemas/leiauteEventoCancNFe_v1.00.xsd +394 -0
- data/test/fixtures/product/schemas/leiauteEvento_v1.00.xsd +373 -0
- data/test/fixtures/product/schemas/leiauteInutNFe_v2.00.xsd +193 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/leiauteInutNFe_v3.10.xsd +192 -192
- data/test/fixtures/product/schemas/leiauteNFe_v2.00.xsd +6661 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/leiauteNFe_v3.10.xsd +6060 -6060
- data/test/fixtures/product/schemas/leiauteRemIndus_v1.00.xsd +382 -0
- data/test/fixtures/product/schemas/leiauteSRE_v1.00.xsd +372 -0
- data/test/fixtures/product/schemas/leiauteSuframaInternaliza_v1.00.xsd +642 -0
- data/test/fixtures/product/schemas/leiauteSuframaVistoria_v1.00.xsd +648 -0
- data/test/fixtures/product/schemas/nfe_v2.00.xsd +9 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/nfe_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/procCCeNFe_v1.00.xsd +10 -0
- data/test/fixtures/product/schemas/procCancNFe_v2.00.xsd +9 -0
- data/test/fixtures/product/schemas/procConfRecebtoNFe_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/procEPEC_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/procEventoCancNFe_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/procEventoNFe_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/procEventoNFe_v99.99.xsd +37 -0
- data/test/fixtures/product/schemas/procInutNFe_v2.00.xsd +9 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/procInutNFe_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/procNFe_v2.00.xsd +9 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/procNFe_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/procRemIndus_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/resEvento_v1.00.xsd +94 -0
- data/test/fixtures/product/schemas/resNFe_v1.00.xsd +110 -0
- data/test/fixtures/product/schemas/retAtuCadEmiDFe_v1.01.xsd +9 -0
- data/test/fixtures/product/schemas/retCancNFe_v2.00.xsd +9 -0
- data/test/fixtures/product/schemas/retConsCad_v2.00.xsd +9 -0
- data/test/fixtures/product/schemas/retConsDPEC_v1.01.xsd +9 -0
- data/test/fixtures/product/schemas/retConsReciNFe_v2.00.xsd +9 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/retConsReciNFe_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/retConsSitNFe_v2.01.xsd +10 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/retConsSitNFe_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/retConsStatServ_v2.00.xsd +9 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/retConsStatServ_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/retDPEC_v1.01.xsd +9 -0
- data/test/fixtures/product/schemas/retDistDFeInt_v1.00.xsd +84 -0
- data/test/fixtures/product/schemas/retDownloadNFe_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/retEnvCCe_v1.00.xsd +10 -0
- data/test/fixtures/product/schemas/retEnvCancelPProrrogNFe_v1.0.xsd +231 -0
- data/test/fixtures/product/schemas/retEnvConfRecebto_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/retEnvEPEC_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/retEnvEventoCancNFe_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/retEnvEvento_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/retEnvFiscoNFe_v1.0.xsd +234 -0
- data/test/fixtures/product/schemas/retEnvRemIndus_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/retEnvSuframaInternaliza_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/retEnvSuframaVistoria_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/retEnviNFe_v2.00.xsd +9 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/retEnviNFe_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/retEventoEPEC_v0.01.xsd +207 -0
- data/test/fixtures/product/schemas/retInutNFe_v2.00.xsd +9 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/retInutNFe_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/retPProrrogNFe_v1.0.xsd +233 -0
- data/test/fixtures/product/schemas/retconsNFeDest_v1.01.xsd +9 -0
- data/test/fixtures/product/schemas/tiposBasico_v1.03.xsd +816 -0
- data/test/fixtures/product/schemas/tiposBasico_v1.03_OPENSSL.xsd +816 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/tiposBasico_v3.10.xsd +571 -571
- data/test/fixtures/product/schemas/tiposBasico_v3.10_OPENSSL.xsd +877 -0
- data/test/fixtures/product/schemas/tiposDistDFe_v1.00.xsd +217 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/xmldsig-core-schema_v1.01.xsd +97 -97
- data/test/fixtures/product/wsdl/NFeRetAutorizacao.xml +80 -0
- data/test/fixtures/product/wsdl/NfeAutorizacao.xml +107 -0
- data/test/fixtures/product/wsdl/NfeConsulta2.xml +80 -0
- data/test/fixtures/product/wsdl/NfeStatusServico2.xml +70 -0
- data/test/fixtures/product/wsdl/nfeinutilizacao2.xml +80 -0
- data/test/fixtures/service/wsdl/betha/v1/cancelar_nfse.xml +178 -0
- data/test/fixtures/service/wsdl/betha/v1/consultar_lote_rps.xml +339 -0
- data/test/fixtures/service/wsdl/betha/v1/consultar_nfse.xml +348 -0
- data/test/fixtures/service/wsdl/betha/v1/consultar_nfse_por_rps.xml +365 -0
- data/test/fixtures/service/wsdl/betha/v1/consultar_situacao_lote_rps.xml +74 -0
- data/test/fixtures/service/wsdl/betha/v1/recepcionar_lote_rps.xml +299 -0
- data/test/fixtures/service/wsdl/simpliss/v1/nfseservice.xml +1 -0
- data/test/fixtures/service/wsdl/thema/v1/nfse_cancelamento.xml +82 -0
- data/test/fixtures/service/wsdl/thema/v1/nfse_consulta.xml +235 -0
- data/test/fixtures/service/wsdl/thema/v1/nfse_remessa.xml +185 -0
- data/test/test_helper.rb +369 -1
- metadata +711 -33
- data/lib/br_nfe/product/base.rb +0 -82
- data/lib/br_nfe/product/consulta_status_servico.rb +0 -35
- data/lib/br_nfe/product/value_nf.rb +0 -9
- data/lib/br_nfe/product/xml/v3_10/consulta_status_servico.xml.slim +0 -4
- data/test/br_nfe/product/base_test.rb +0 -150
- data/test/br_nfe/product/consulta_status_servico_test.rb +0 -59
@@ -0,0 +1,593 @@
|
|
1
|
+
########################################################################################
|
2
|
+
####################################### NOTA 1 #######################################
|
3
|
+
# No grupo (ICMSPart) Partilha do ICMS entre a UF de origem e
|
4
|
+
# UF de destino ou a UF na legislação, campos:
|
5
|
+
# -pBCOp("Percentual da BC operação própria")
|
6
|
+
# - UFST("UF para qual é devido o ICMS ST")
|
7
|
+
# -> Refere-se às operações com veículos automotores novos efetuados por meio de
|
8
|
+
# faturamento direto para consumidor, cujo percentual de partilha do ICMS é
|
9
|
+
# definido pelo Convênio ICMS 51/00.
|
10
|
+
# ------------------------------------------------------------------------------------
|
11
|
+
# No grupo (ICMSST) ICMS ST - repasse de ICMS ST retido anteriormente em
|
12
|
+
# operações interestaduais com repasses através do Substituto Tributário.
|
13
|
+
# -> ICMS ST que foi retido e recolhido antecipadamente pela UF do remetente,
|
14
|
+
# em operações interestaduais e que será repassado a UF de destino.
|
15
|
+
#
|
16
|
+
# Os grupos ICMSST e ICMSPart ainda não serão desenvolvidos pois são exclusivamente
|
17
|
+
# para venda de "veiculos novos"
|
18
|
+
#########################################################################################
|
19
|
+
#
|
20
|
+
module BrNfe
|
21
|
+
module Product
|
22
|
+
module Nfe
|
23
|
+
module ItemTax
|
24
|
+
class Icms < BrNfe::ActiveModelBase
|
25
|
+
# ORIGEM DA MERCADORIA
|
26
|
+
# 0 - Nacional, exceto as indicadas nos códigos 3, 4, 5 e 8;
|
27
|
+
# 1 - Estrangeira - Importação direta, exceto a indicada no código 6;
|
28
|
+
# 2 - Estrangeira - Adquirida no mercado interno, exceto a indicada no código 7;
|
29
|
+
# 3 - Nacional, mercadoria ou bem com Conteúdo de Importação superior
|
30
|
+
# a 40% e inferior ou igual a 70%;
|
31
|
+
# 4 - Nacional, cuja produção tenha sido feita em conformidade com os processos
|
32
|
+
# produtivos básicos de que tratam as legislações citadas nos Ajustes;
|
33
|
+
# 5 - Nacional, mercadoria ou bem com Conteúdo de Importação inferior ou
|
34
|
+
# igual a 40%;
|
35
|
+
# 6 - Estrangeira - Importação direta, sem similar nacional, constante em
|
36
|
+
# lista da CAMEX e gás natural;
|
37
|
+
# 7 - Estrangeira - Adquirida no mercado interno, sem similar nacional,
|
38
|
+
# constante lista CAMEX e gás natural.
|
39
|
+
# 8 - Nacional, mercadoria ou bem com Conteúdo de Importação superior a 70%;
|
40
|
+
#
|
41
|
+
# <b>Type: </b> _Number_
|
42
|
+
# <b>Required: </b> _Yes_
|
43
|
+
# <b>Example: </b> _1_
|
44
|
+
# <b>Length: </b> _1_
|
45
|
+
# <b>Default: </b> _0_ <- Fixed if nil
|
46
|
+
# <b>tag: </b> orig
|
47
|
+
#
|
48
|
+
attr_accessor :origem
|
49
|
+
def origem
|
50
|
+
@origem.to_i
|
51
|
+
end
|
52
|
+
alias_attribute :orig, :origem
|
53
|
+
|
54
|
+
# CÓDIGO DA SITUAÇÃO TRIBUTÁRIA (CST) OU
|
55
|
+
# CÓDIGO DE SITUAÇÃO DA OPERAÇÃO - SIMPLES NACIONAL (CSOSN)
|
56
|
+
# 00 - Tributada integralmente
|
57
|
+
# 10 - Tributada e com cobrança do icms por substituição tributária
|
58
|
+
# 20 - Com redução de base de cálculo
|
59
|
+
# 30 - Isenta ou não tributada e com cobrança do icms por substituição tributária
|
60
|
+
# 40 - Isenta
|
61
|
+
# 41 - Não tributada
|
62
|
+
# 50 - Suspensão
|
63
|
+
# 51 - Diferimento
|
64
|
+
# 60 - Icms cobrado anteriormente por substituição tributária
|
65
|
+
# 70 - Com redução de base de cálculo e cobrança do icms por substituição tributária
|
66
|
+
# 90 - Outras
|
67
|
+
# 101 - Tributada pelo Simples Nacional com permissão de crédito
|
68
|
+
# 102 - Tributada pelo Simples Nacional sem permissão de crédito
|
69
|
+
# 103 - Isenção do ICMS no Simples Nacional para faixa de receita bruta
|
70
|
+
# 201 - Tributada pelo Simples Nacional com permissão de crédito e com cobrança do ICMS por ST
|
71
|
+
# 202 - Tributada pelo Simples Nacional sem permissão de crédito e com cobrança do ICMS por ST
|
72
|
+
# 203 - Isenção do ICMS no Simples Nacional para faixa de receita bruta e com cobrança do ICMS por ST
|
73
|
+
# 300 - Imune
|
74
|
+
# 400 - Não tributada pelo Simples Nacional
|
75
|
+
# 500 - ICMS cobrado anteriormente por substituição tributária (substituído) ou por antecipação
|
76
|
+
# 900 - Outros
|
77
|
+
#
|
78
|
+
# <b>Type: </b> _Number_ <- string
|
79
|
+
# <b>Required: </b> _Yes_
|
80
|
+
# <b>Example: </b> _00_
|
81
|
+
# <b>Length: </b> _min: 2, max: 3_
|
82
|
+
# <b>tag: </b> CST ou CSOSN
|
83
|
+
#
|
84
|
+
attr_accessor :codigo_cst
|
85
|
+
def codigo_cst
|
86
|
+
"#{@codigo_cst}".rjust(2, '0') if @codigo_cst.present?
|
87
|
+
end
|
88
|
+
alias_attribute :CST, :codigo_cst
|
89
|
+
alias_attribute :CSOSN, :codigo_cst
|
90
|
+
|
91
|
+
# Modalidade de determinação da BC do ICMS
|
92
|
+
# 0=Margem Valor Agregado (%);
|
93
|
+
# 1=Pauta (Valor);
|
94
|
+
# 2=Preço Tabelado Máx. (valor);
|
95
|
+
# 3=Valor da operação.
|
96
|
+
#
|
97
|
+
# Utilizado nos CSTs: [00 10 20 51 90 900]
|
98
|
+
#
|
99
|
+
# <b>Type: </b> _Number_
|
100
|
+
# <b>Required: </b> _CST: [00 10 20 90]_
|
101
|
+
# <b>Example: </b> _0_
|
102
|
+
# <b>Length: </b> _1_
|
103
|
+
# <b>tag: </b> modBC
|
104
|
+
#
|
105
|
+
attr_accessor :modalidade_base_calculo
|
106
|
+
def modalidade_base_calculo
|
107
|
+
@modalidade_base_calculo.to_i if @modalidade_base_calculo.present?
|
108
|
+
end
|
109
|
+
alias_attribute :modBC, :modalidade_base_calculo
|
110
|
+
|
111
|
+
# PERCENTUAL REDUÇÃO DE BASE DE CÁLCULO DO ICMS
|
112
|
+
# Utilizado nos CSTs: [20 51 70 90 900]
|
113
|
+
#
|
114
|
+
# <b>Type: </b> _Float_
|
115
|
+
# <b>Required: </b> _CST: [20 70]_
|
116
|
+
# <b>Example: </b> _45.00_
|
117
|
+
# <b>Length: </b> _13v2-4_
|
118
|
+
# <b>tag: </b> pRedBC
|
119
|
+
#
|
120
|
+
attr_accessor :reducao_base_calculo
|
121
|
+
alias_attribute :pRedBC, :reducao_base_calculo
|
122
|
+
|
123
|
+
# VALOR DA BASE DE CÁLCULO DO ICMS
|
124
|
+
# Valor base utilizado para calcular o valor d ICMS
|
125
|
+
# Utilizado nos CSTs: [00 10 20 51 70 90 900]
|
126
|
+
#
|
127
|
+
# <b>Type: </b> _Float_
|
128
|
+
# <b>Required: </b> _CST: [00 10 20 70 90]_
|
129
|
+
# <b>Example: </b> _350.00_
|
130
|
+
# <b>Length: </b> _13v2_
|
131
|
+
# <b>tag: </b> vBC
|
132
|
+
#
|
133
|
+
attr_accessor :total_base_calculo
|
134
|
+
alias_attribute :vBC, :total_base_calculo
|
135
|
+
|
136
|
+
# ALÍQUOTA DO ICMS
|
137
|
+
# Percentual do imposto do ICMS
|
138
|
+
# Utilizado nos CSTs: [00 10 20 51 70 90 900]
|
139
|
+
#
|
140
|
+
# <b>Type: </b> _Float_
|
141
|
+
# <b>Required: </b> _CST: [00 10 20 70 90]_
|
142
|
+
# <b>Example: </b> _17.00_
|
143
|
+
# <b>Length: </b> _13v2-4_
|
144
|
+
# <b>tag: </b> pICMS
|
145
|
+
#
|
146
|
+
attr_accessor :aliquota
|
147
|
+
alias_attribute :pICMS, :aliquota
|
148
|
+
|
149
|
+
# VALOR DO ICMS
|
150
|
+
# Valor total do ICMS
|
151
|
+
# Utilizado nos CSTs: [00 10 20 51 70 900]
|
152
|
+
# O calculo se dá através da base de cálculo x alíquota
|
153
|
+
# EX:
|
154
|
+
# total_base_calculo = 200.00
|
155
|
+
# aliquota = 17.0%
|
156
|
+
# total = 200*17% = 34.00
|
157
|
+
#
|
158
|
+
# <b>Type: </b> _Float_
|
159
|
+
# <b>Required: </b> _CST: [00 10 20 70]_
|
160
|
+
# <b>Example: </b> _120.00_
|
161
|
+
# <b>Length: </b> _13v2_
|
162
|
+
# <b>tag: </b> vICMS
|
163
|
+
#
|
164
|
+
attr_accessor :total
|
165
|
+
def total
|
166
|
+
@total ||= calculate_total
|
167
|
+
end
|
168
|
+
alias_attribute :vICMS, :total
|
169
|
+
|
170
|
+
# Modalidade de determinação da BC do ICMS ST
|
171
|
+
# Utilizado nos CSTs: [10 30 70 201 202 203 900]
|
172
|
+
# 0=Preço tabelado ou máximo sugerido;
|
173
|
+
# 1=Lista Negativa (valor);
|
174
|
+
# 2=Lista Positiva (valor);
|
175
|
+
# 3=Lista Neutra (valor);
|
176
|
+
# 4=Margem Valor Agregado (%);
|
177
|
+
# 5=Pauta (valor)
|
178
|
+
#
|
179
|
+
# <b>Type: </b> _Number_
|
180
|
+
# <b>Required: </b> _CST: [10 30 70 201 202 203]_
|
181
|
+
# <b>Example: </b> _2_
|
182
|
+
# <b>Length: </b> _1_
|
183
|
+
# <b>tag: </b> modBCST
|
184
|
+
#
|
185
|
+
attr_accessor :modalidade_base_calculo_st
|
186
|
+
def modalidade_base_calculo_st
|
187
|
+
@modalidade_base_calculo_st.to_i if @modalidade_base_calculo_st.present?
|
188
|
+
end
|
189
|
+
alias_attribute :modBCST, :modalidade_base_calculo_st
|
190
|
+
|
191
|
+
# PERCENTUAL DA MARGEM DE VALOR ADICIONADO DO ICMS ST
|
192
|
+
# Utilizado nos CSTs: [10 30 70 201 202 203 900]
|
193
|
+
# MVA ST original – é a margem de valor agregado prevista
|
194
|
+
# na legislação do Estado do destinatário para suas operações
|
195
|
+
# internas com produto sujeito ao regime de substituição tributária;
|
196
|
+
#
|
197
|
+
# <b>Type: </b> _Float_
|
198
|
+
# <b>Required: </b> _No_
|
199
|
+
# <b>Example: </b> _120.00_
|
200
|
+
# <b>Length: </b> _13v2-4_
|
201
|
+
# <b>tag: </b> pMVAST
|
202
|
+
#
|
203
|
+
attr_accessor :mva_st
|
204
|
+
alias_attribute :pMVAST, :mva_st
|
205
|
+
|
206
|
+
# PERCENTUAL REDUÇÃO DE BASE DE CÁLCULO DO ICMS ST
|
207
|
+
# Utilizado nos CSTs: [10 30 70 201 202 203 900]
|
208
|
+
#
|
209
|
+
# <b>Type: </b> _Float_
|
210
|
+
# <b>Required: </b> _No_
|
211
|
+
# <b>Example: </b> _45.00_
|
212
|
+
# <b>Length: </b> _13v2-4_
|
213
|
+
# <b>tag: </b> pRedBCST
|
214
|
+
#
|
215
|
+
attr_accessor :reducao_base_calculo_st
|
216
|
+
alias_attribute :pRedBCST, :reducao_base_calculo_st
|
217
|
+
|
218
|
+
# VALOR DA BASE DE CÁLCULO DO ICMS ST
|
219
|
+
# Utilizado nos CSTs: [10 30 70 201 202 203 900]
|
220
|
+
#
|
221
|
+
# <b>Type: </b> _Float_
|
222
|
+
# <b>Required: </b> _CST: [10 30 70 201 202 203]_
|
223
|
+
# <b>Example: </b> _1450.00_
|
224
|
+
# <b>Length: </b> _13v2_
|
225
|
+
# <b>tag: </b> vBCST
|
226
|
+
#
|
227
|
+
attr_accessor :total_base_calculo_st
|
228
|
+
alias_attribute :vBCST, :total_base_calculo_st
|
229
|
+
|
230
|
+
# ALÍQUOTA DO ICMS ST
|
231
|
+
# Utilizado nos CSTs: [10 30 70 201 202 203 900]
|
232
|
+
# Percentual do imposto do ICMS
|
233
|
+
#
|
234
|
+
# <b>Type: </b> _Float_
|
235
|
+
# <b>Required: </b> _CST: [10 30 70 201 202 203]_
|
236
|
+
# <b>Example: </b> _17.00_
|
237
|
+
# <b>Length: </b> _13v2-4_
|
238
|
+
# <b>tag: </b> pICMSST
|
239
|
+
#
|
240
|
+
attr_accessor :aliquota_st
|
241
|
+
alias_attribute :pICMSST, :aliquota_st
|
242
|
+
|
243
|
+
# VALOR DO ICMS ST
|
244
|
+
# Utilizado nos CSTs: [10 30 70 201 202 203 900]
|
245
|
+
#
|
246
|
+
# <b>Type: </b> _Float_
|
247
|
+
# <b>Required: </b> _CST: [10 30 70 201 202 203]_
|
248
|
+
# <b>Example: </b> _120.00_
|
249
|
+
# <b>Length: </b> _13v2_
|
250
|
+
# <b>tag: </b> vICMSST
|
251
|
+
#
|
252
|
+
attr_accessor :total_st
|
253
|
+
alias_attribute :vICMSST, :total_st
|
254
|
+
|
255
|
+
# VALOR DO ICMS DESONERADO
|
256
|
+
# Utilizado nos CSTs: [20 30 40 41 50 70]
|
257
|
+
#
|
258
|
+
# <b>Type: </b> _Float_
|
259
|
+
# <b>Required: </b> _No_
|
260
|
+
# <b>Example: </b> _75.5_
|
261
|
+
# <b>Length: </b> _13v2_
|
262
|
+
# <b>tag: </b> vICMSDeson
|
263
|
+
#
|
264
|
+
attr_accessor :total_desoneracao
|
265
|
+
alias_attribute :vICMSDeson, :total_desoneracao
|
266
|
+
|
267
|
+
# MOTIVO DA DESONERAÇÃO DO ICMS
|
268
|
+
# Campo será preenchido quando o campo anterior estiver
|
269
|
+
# preenchido. Informar o motivo da desoneração:
|
270
|
+
#
|
271
|
+
# Utilizado nos CSTs: [20 30 70]
|
272
|
+
# 3=Uso na agropecuária;
|
273
|
+
# 9=Outros;
|
274
|
+
# 12=Órgão de fomento e desenvolvimento agropecuário.
|
275
|
+
#
|
276
|
+
# Utilizado nos CSTs: [40 41 50]
|
277
|
+
# 1=Táxi;
|
278
|
+
# 2=Deficiente Físico <- Revogada a partir da versão 3.01
|
279
|
+
# 3=Produtor Agropecuário;
|
280
|
+
# 4=Frotista/Locadora;
|
281
|
+
# 5=Diplomático/Consular;
|
282
|
+
# 6=Utilitários e Motocicletas da Amazônia Ocidental e Áreas de
|
283
|
+
# Livre Comércio (Resolução 714/88 e 790/94 – CONTRAN e suas alterações);
|
284
|
+
# 7=SUFRAMA;
|
285
|
+
# 8=Venda a Órgão Público;
|
286
|
+
# 9=Outros. (NT 2011/004);
|
287
|
+
# 10=Deficiente Condutor (Convênio ICMS 38/12);
|
288
|
+
# 11=Deficiente Não Condutor (Convênio ICMS 38/12).
|
289
|
+
#
|
290
|
+
# <b>Type: </b> _Number_
|
291
|
+
# <b>Required: </b> _No_ (yes if total_desoneracao)
|
292
|
+
# <b>Example: </b> _9_
|
293
|
+
# <b>Length: </b> _1 OR 2_
|
294
|
+
# <b>tag: </b> motDesICMS
|
295
|
+
#
|
296
|
+
attr_accessor :motivo_desoneracao
|
297
|
+
def motivo_desoneracao
|
298
|
+
@motivo_desoneracao.to_i if @motivo_desoneracao.present?
|
299
|
+
end
|
300
|
+
alias_attribute :motDesICMS, :motivo_desoneracao
|
301
|
+
|
302
|
+
# VALOR DO ICMS DA OPERAÇÃO
|
303
|
+
# Informar o valor do ICMS como se não tivesse diferimento
|
304
|
+
#
|
305
|
+
# Utilizado nos CSTs: [51]
|
306
|
+
#
|
307
|
+
# <b>Type: </b> _Float_
|
308
|
+
# <b>Required: </b> _No_
|
309
|
+
# <b>Example: </b> _75.5_
|
310
|
+
# <b>Length: </b> _13v2_
|
311
|
+
# <b>tag: </b> vICMSOp
|
312
|
+
#
|
313
|
+
attr_accessor :total_icms_operacao
|
314
|
+
alias_attribute :vICMSOp, :total_icms_operacao
|
315
|
+
|
316
|
+
# PERCENTUAL DO DIFERIMENTO
|
317
|
+
# No caso de diferimento total, informar o percentual de difereimento = 100
|
318
|
+
# Utilizado nos CSTs: [51]
|
319
|
+
#
|
320
|
+
# <b>Type: </b> _Float_
|
321
|
+
# <b>Required: </b> _No_
|
322
|
+
# <b>Example: </b> _75.5_
|
323
|
+
# <b>Length: </b> _13v2-4_
|
324
|
+
# <b>tag: </b> pDif
|
325
|
+
#
|
326
|
+
attr_accessor :percentual_diferimento
|
327
|
+
alias_attribute :pDif, :percentual_diferimento
|
328
|
+
|
329
|
+
# VALOR DO ICMS DIFERIDO
|
330
|
+
#
|
331
|
+
# Utilizado nos CSTs: [51]
|
332
|
+
#
|
333
|
+
# <b>Type: </b> _Float_
|
334
|
+
# <b>Required: </b> _No_
|
335
|
+
# <b>Example: </b> _75.5_
|
336
|
+
# <b>Length: </b> _13v2_
|
337
|
+
# <b>tag: </b> vICMSDif
|
338
|
+
#
|
339
|
+
attr_accessor :total_icms_diferido
|
340
|
+
alias_attribute :vICMSDif, :total_icms_diferido
|
341
|
+
|
342
|
+
# VALOR DA BC DO ICMS ST RETIDO
|
343
|
+
# Valor da BC do ICMS ST cobrado anteriormente por ST (v2.0).
|
344
|
+
# O valor pode ser omitido quando a legislação não exigir a sua
|
345
|
+
# informação. (NT 2011/004)
|
346
|
+
#
|
347
|
+
# Utilizado nos CSTs: [60 500]
|
348
|
+
#
|
349
|
+
# <b>Type: </b> _Float_
|
350
|
+
# <b>Required: </b> _No_
|
351
|
+
# <b>Example: </b> _75.5_
|
352
|
+
# <b>Length: </b> _13v2_
|
353
|
+
# <b>tag: </b> vBCSTRet
|
354
|
+
#
|
355
|
+
attr_accessor :total_base_calculo_st_retido
|
356
|
+
alias_attribute :vBCSTRet, :total_base_calculo_st_retido
|
357
|
+
|
358
|
+
# VALOR DO ICMS ST RETIDO
|
359
|
+
# Valor do ICMS ST cobrado anteriormente por ST (v2.0). O valor
|
360
|
+
# pode ser omitido quando a legislação não exigir a sua
|
361
|
+
# informação. (NT 2011/004)
|
362
|
+
#
|
363
|
+
# Utilizado nos CSTs: [60 500]
|
364
|
+
#
|
365
|
+
# <b>Type: </b> _Float_
|
366
|
+
# <b>Required: </b> _No_ (Yes if total_base_calculo_st_retido > 0)
|
367
|
+
# <b>Example: </b> _75.5_
|
368
|
+
# <b>Length: </b> _13v2_
|
369
|
+
# <b>tag: </b> vICMSSTRet
|
370
|
+
#
|
371
|
+
attr_accessor :total_st_retido
|
372
|
+
alias_attribute :vICMSSTRet, :total_st_retido
|
373
|
+
|
374
|
+
# ALÍQUOTA APLICÁVEL DE CÁLCULO DO CRÉDITO (SIMPLES NACIONAL).
|
375
|
+
#
|
376
|
+
# Utilizado nos CSTs: [101 201 900]
|
377
|
+
#
|
378
|
+
# <b>Type: </b> _Float_
|
379
|
+
# <b>Required: </b> _CST: [101 201]_
|
380
|
+
# <b>Example: </b> _75.5_
|
381
|
+
# <b>Length: </b> _13v2-4_
|
382
|
+
# <b>tag: </b> pCredSN
|
383
|
+
#
|
384
|
+
attr_accessor :aliquota_credito_sn
|
385
|
+
alias_attribute :pCredSN, :aliquota_credito_sn
|
386
|
+
|
387
|
+
# VALOR CRÉDITO DO ICMS QUE PODE SER APROVEITADO
|
388
|
+
# nos termos do art. 23 da LC 123 (Simples Nacional)
|
389
|
+
#
|
390
|
+
# Utilizado nos CSTs: [101 201]
|
391
|
+
#
|
392
|
+
# <b>Type: </b> _Float_
|
393
|
+
# <b>Required: </b> _CST: [101 201 900]_
|
394
|
+
# <b>Example: </b> _75.5_
|
395
|
+
# <b>Length: </b> _13v2_
|
396
|
+
# <b>tag: </b> vCredICMSSN
|
397
|
+
#
|
398
|
+
attr_accessor :total_credito_sn
|
399
|
+
alias_attribute :vCredICMSSN, :total_credito_sn
|
400
|
+
|
401
|
+
|
402
|
+
###################################################################
|
403
|
+
########################### VALIDAÇÕES ###########################
|
404
|
+
validates :origem, inclusion: {in: 0..8}
|
405
|
+
validates :codigo_cst, inclusion: {in: %w[00 10 20 30 40 41 50 51 60 70 90 101 102 103 201 202 203 300 400 500 900]}
|
406
|
+
validates :codigo_cst, presence: true
|
407
|
+
validates :reducao_base_calculo, :reducao_base_calculo_st, numericality: {
|
408
|
+
greater_than_or_equal_to: 0.0, less_than_or_equal_to: 100.0
|
409
|
+
}, allow_blank: true
|
410
|
+
|
411
|
+
with_options if: lambda{|r| r.codigo_cst == '00' } do |record|
|
412
|
+
record.validates :aliquota, numericality: {greater_than_or_equal_to: 0.0}
|
413
|
+
record.validates :aliquota, presence: true
|
414
|
+
record.validates :total_base_calculo, numericality: {greater_than_or_equal_to: 0.0}
|
415
|
+
record.validates :total_base_calculo, presence: true
|
416
|
+
record.validates :modalidade_base_calculo, inclusion: {in: 0..3}
|
417
|
+
record.validates :modalidade_base_calculo, presence: true
|
418
|
+
end
|
419
|
+
with_options if: lambda{|r| r.codigo_cst == '10' } do |record|
|
420
|
+
record.validates :mva_st, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
421
|
+
record.validates :total_st, numericality: {greater_than_or_equal_to: 0.0}
|
422
|
+
record.validates :total_st, presence: true
|
423
|
+
record.validates :aliquota, numericality: {greater_than_or_equal_to: 0.0}
|
424
|
+
record.validates :aliquota, presence: true
|
425
|
+
record.validates :aliquota_st, numericality: {greater_than_or_equal_to: 0.0}
|
426
|
+
record.validates :aliquota_st, presence: true
|
427
|
+
record.validates :total_base_calculo, numericality: {greater_than_or_equal_to: 0.0}
|
428
|
+
record.validates :total_base_calculo, presence: true
|
429
|
+
record.validates :total_base_calculo_st, numericality: {greater_than_or_equal_to: 0.0}
|
430
|
+
record.validates :total_base_calculo_st, presence: true
|
431
|
+
record.validates :modalidade_base_calculo, inclusion: {in: 0..3}
|
432
|
+
record.validates :modalidade_base_calculo, presence: true
|
433
|
+
record.validates :modalidade_base_calculo_st, inclusion: {in: 0..5}
|
434
|
+
record.validates :modalidade_base_calculo_st, presence: true
|
435
|
+
end
|
436
|
+
with_options if: lambda{|r| r.codigo_cst == '20' } do |record|
|
437
|
+
record.validates :aliquota, numericality: {greater_than_or_equal_to: 0.0}
|
438
|
+
record.validates :aliquota, presence: true
|
439
|
+
record.validates :total_desoneracao, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
440
|
+
record.validates :motivo_desoneracao, inclusion: {in: [3,9,12]}, allow_blank: true
|
441
|
+
validates :motivo_desoneracao, presence: true, if: lambda{|r| r.codigo_cst == '20' && r.total_desoneracao.present? }
|
442
|
+
record.validates :total_base_calculo, numericality: {greater_than_or_equal_to: 0.0}
|
443
|
+
record.validates :total_base_calculo, presence: true
|
444
|
+
record.validates :reducao_base_calculo, presence: true
|
445
|
+
record.validates :modalidade_base_calculo, inclusion: {in: 0..3}
|
446
|
+
record.validates :modalidade_base_calculo, presence: true
|
447
|
+
end
|
448
|
+
with_options if: lambda{|r| r.codigo_cst == '30' } do |record|
|
449
|
+
record.validates :mva_st, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
450
|
+
record.validates :total_st, numericality: {greater_than_or_equal_to: 0.0}
|
451
|
+
record.validates :total_st, presence: true
|
452
|
+
record.validates :aliquota_st, numericality: {greater_than_or_equal_to: 0.0}
|
453
|
+
record.validates :aliquota_st, presence: true
|
454
|
+
record.validates :total_desoneracao, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
455
|
+
record.validates :motivo_desoneracao, inclusion: {in: [3,9,12]}, allow_blank: true
|
456
|
+
validates :motivo_desoneracao, presence: true, if: lambda{|r| r.codigo_cst == '30' && r.total_desoneracao.present? }
|
457
|
+
record.validates :total_base_calculo_st, numericality: {greater_than_or_equal_to: 0.0}
|
458
|
+
record.validates :total_base_calculo_st, presence: true
|
459
|
+
record.validates :modalidade_base_calculo_st, inclusion: {in: 0..5}
|
460
|
+
record.validates :modalidade_base_calculo_st, presence: true
|
461
|
+
end
|
462
|
+
with_options if: lambda{|r| r.codigo_cst.in?(%w[40 41 50]) } do |record|
|
463
|
+
record.validates :total_desoneracao, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
464
|
+
record.validates :motivo_desoneracao, inclusion: {in: 1..11}, allow_blank: true
|
465
|
+
validates :motivo_desoneracao, presence: true, if: lambda{|r| r.codigo_cst.in?(%w[40 41 50]) && r.total_desoneracao.present? }
|
466
|
+
end
|
467
|
+
with_options if: lambda{|r| r.codigo_cst == '51' } do |record|
|
468
|
+
record.validates :modalidade_base_calculo, inclusion: {in: 0..3}, allow_blank: true
|
469
|
+
record.validates :total_icms_operacao, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
470
|
+
record.validates :total_icms_diferido, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
471
|
+
record.validates :percentual_diferimento, numericality: {greater_than_or_equal_to: 0.0, less_than_or_equal_to: 100.0}, allow_blank: true
|
472
|
+
end
|
473
|
+
|
474
|
+
with_options if: lambda{|r| r.codigo_cst == '70' } do |record|
|
475
|
+
record.validates :mva_st, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
476
|
+
record.validates :total_st, numericality: {greater_than_or_equal_to: 0.0}
|
477
|
+
record.validates :total_st, presence: true
|
478
|
+
record.validates :aliquota, numericality: {greater_than_or_equal_to: 0.0}
|
479
|
+
record.validates :aliquota, presence: true
|
480
|
+
record.validates :aliquota_st, numericality: {greater_than_or_equal_to: 0.0}
|
481
|
+
record.validates :aliquota_st, presence: true
|
482
|
+
record.validates :total_desoneracao, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
483
|
+
record.validates :motivo_desoneracao, inclusion: {in: [3,9,12]}, allow_blank: true
|
484
|
+
validates :motivo_desoneracao, presence: true, if: lambda{|r| r.codigo_cst == '70' && r.total_desoneracao.present? }
|
485
|
+
record.validates :total_base_calculo, numericality: {greater_than_or_equal_to: 0.0}
|
486
|
+
record.validates :total_base_calculo, presence: true
|
487
|
+
record.validates :total_base_calculo_st, numericality: {greater_than_or_equal_to: 0.0}
|
488
|
+
record.validates :total_base_calculo_st, presence: true
|
489
|
+
record.validates :modalidade_base_calculo, inclusion: {in: 0..3}
|
490
|
+
record.validates :modalidade_base_calculo, presence: true
|
491
|
+
record.validates :modalidade_base_calculo_st, inclusion: {in: 0..5}
|
492
|
+
record.validates :modalidade_base_calculo_st, presence: true
|
493
|
+
end
|
494
|
+
|
495
|
+
with_options if: lambda{|r| r.codigo_cst == '90' } do |record|
|
496
|
+
record.validates :aliquota, numericality: {greater_than_or_equal_to: 0.0}
|
497
|
+
record.validates :aliquota, presence: true
|
498
|
+
record.validates :total_desoneracao, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
499
|
+
record.validates :motivo_desoneracao, inclusion: {in: [3,9,12]}, allow_blank: true
|
500
|
+
validates :motivo_desoneracao, presence: true, if: lambda{|r| r.codigo_cst == '90' && r.total_desoneracao.present? }
|
501
|
+
record.validates :total_base_calculo, numericality: {greater_than_or_equal_to: 0.0}
|
502
|
+
record.validates :total_base_calculo, presence: true
|
503
|
+
record.validates :modalidade_base_calculo, inclusion: {in: 0..3}
|
504
|
+
record.validates :modalidade_base_calculo, presence: true
|
505
|
+
record.validates :aliquota_st, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
506
|
+
end
|
507
|
+
with_options if: lambda{|r| r.codigo_cst == '90' && r.aliquota_st.present? } do |record|
|
508
|
+
record.validates :mva_st, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
509
|
+
record.validates :total_st, numericality: {greater_than_or_equal_to: 0.0}
|
510
|
+
record.validates :total_st, presence: true
|
511
|
+
record.validates :total_base_calculo_st, numericality: {greater_than_or_equal_to: 0.0}
|
512
|
+
record.validates :total_base_calculo_st, presence: true
|
513
|
+
record.validates :modalidade_base_calculo_st, inclusion: {in: 0..5}
|
514
|
+
record.validates :modalidade_base_calculo_st, presence: true
|
515
|
+
end
|
516
|
+
|
517
|
+
with_options if: lambda{|r| r.codigo_cst == '101' } do |record|
|
518
|
+
record.validates :total_credito_sn, presence: true
|
519
|
+
record.validates :total_credito_sn, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
520
|
+
record.validates :aliquota_credito_sn, presence: true
|
521
|
+
record.validates :aliquota_credito_sn, numericality: {greater_than_or_equal_to: 0.0, less_than_or_equal_to: 100.0}, allow_blank: true
|
522
|
+
end
|
523
|
+
with_options if: lambda{|r| r.codigo_cst == '201' } do |record|
|
524
|
+
record.validates :modalidade_base_calculo_st, presence: true
|
525
|
+
record.validates :modalidade_base_calculo_st, inclusion: {in: 0..5}
|
526
|
+
record.validates :mva_st, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
527
|
+
record.validates :total_base_calculo_st, numericality: {greater_than_or_equal_to: 0.0}
|
528
|
+
record.validates :total_base_calculo_st, presence: true
|
529
|
+
record.validates :aliquota_st, numericality: {greater_than_or_equal_to: 0.0}
|
530
|
+
record.validates :aliquota_st, presence: true
|
531
|
+
record.validates :total_st, numericality: {greater_than_or_equal_to: 0.0}
|
532
|
+
record.validates :total_st, presence: true
|
533
|
+
record.validates :total_credito_sn, presence: true
|
534
|
+
record.validates :total_credito_sn, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
535
|
+
record.validates :aliquota_credito_sn, presence: true
|
536
|
+
record.validates :aliquota_credito_sn, numericality: {greater_than_or_equal_to: 0.0, less_than_or_equal_to: 100.0}, allow_blank: true
|
537
|
+
end
|
538
|
+
with_options if: lambda{|r| r.codigo_cst.in?(%w[202 203]) } do |record|
|
539
|
+
record.validates :modalidade_base_calculo_st, presence: true
|
540
|
+
record.validates :modalidade_base_calculo_st, inclusion: {in: 0..5}
|
541
|
+
record.validates :mva_st, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
542
|
+
record.validates :total_base_calculo_st, numericality: {greater_than_or_equal_to: 0.0}
|
543
|
+
record.validates :total_base_calculo_st, presence: true
|
544
|
+
record.validates :aliquota_st, numericality: {greater_than_or_equal_to: 0.0}
|
545
|
+
record.validates :aliquota_st, presence: true
|
546
|
+
record.validates :total_st, numericality: {greater_than_or_equal_to: 0.0}
|
547
|
+
record.validates :total_st, presence: true
|
548
|
+
end
|
549
|
+
|
550
|
+
with_options if: lambda{|r| r.codigo_cst.in?(['60','500']) && r.total_base_calculo_st_retido.to_f > 0.0 } do |record|
|
551
|
+
record.validates :total_st_retido, presence: true
|
552
|
+
record.validates :total_st_retido, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
553
|
+
end
|
554
|
+
|
555
|
+
with_options if: lambda{|r| r.codigo_cst == '900'} do |record|
|
556
|
+
record.validates :aliquota, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
557
|
+
record.validates :aliquota_st, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
558
|
+
record.validates :aliquota_credito_sn, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
559
|
+
end
|
560
|
+
with_options if: lambda{|r| r.codigo_cst == '900' && r.aliquota.to_f > 0.0 } do |record|
|
561
|
+
record.validates :total_base_calculo, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
562
|
+
record.validates :total_base_calculo, presence: true
|
563
|
+
record.validates :total, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
564
|
+
record.validates :modalidade_base_calculo, inclusion: {in: 0..3}
|
565
|
+
record.validates :modalidade_base_calculo, presence: true
|
566
|
+
end
|
567
|
+
with_options if: lambda{|r| r.codigo_cst == '900' && r.aliquota_st.to_f > 0.0 } do |record|
|
568
|
+
record.validates :mva_st, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
569
|
+
record.validates :total_base_calculo_st, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
570
|
+
record.validates :total_base_calculo_st, presence: true
|
571
|
+
record.validates :total_st, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
572
|
+
record.validates :total_st, presence: true
|
573
|
+
record.validates :modalidade_base_calculo_st, inclusion: {in: 0..5}
|
574
|
+
record.validates :modalidade_base_calculo_st, presence: true
|
575
|
+
end
|
576
|
+
with_options if: lambda{|r| r.codigo_cst == '900' && r.aliquota_credito_sn.to_f > 0.0 } do |record|
|
577
|
+
record.validates :total_credito_sn, numericality: {greater_than_or_equal_to: 0.0}, allow_blank: true
|
578
|
+
record.validates :total_credito_sn, presence: true
|
579
|
+
end
|
580
|
+
|
581
|
+
private
|
582
|
+
|
583
|
+
def calculate_total
|
584
|
+
(total_base_calculo.to_f * (aliquota.to_f/100.0)).round(2)
|
585
|
+
end
|
586
|
+
|
587
|
+
|
588
|
+
|
589
|
+
end
|
590
|
+
end
|
591
|
+
end
|
592
|
+
end
|
593
|
+
end
|