Subversion Repositories Integrator Subversion

Rev

Rev 145 | Rev 158 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 145 Rev 152
Line 73... Line 73...
73
        private Boolean indicadorEmissaoNotaFiscal;
73
        private Boolean indicadorEmissaoNotaFiscal;
74
       
74
       
75
        private Double valorVarejoSimulacao;
75
        private Double valorVarejoSimulacao;
76
        private Boolean sujeitoST;
76
        private Boolean sujeitoST;
77
        private Double aliquotaIPI;
77
        private Double aliquotaIPI;
-
 
78
        private Double aliquotaIPINotaFiscal;
78
        private Double aliquotaIcms;
79
        private Double aliquotaIcms;
-
 
80
        private Double aliquotaIcmsNotaFiscal;
79
        private Double aliquotaIcmsST;
81
        private Double aliquotaIcmsST;
80
        private Double aliquotaFecoep;
82
        private Double aliquotaFecoep;
81
        private Boolean ativo;
83
        private Boolean ativo;
82
       
84
       
83
        private String codigoNCM;
85
        private String codigoNCM;
Line 352... Line 354...
352
        public Double getAliquotaIcms() {
354
        public Double getAliquotaIcms() {
353
                return aliquotaIcms;
355
                return aliquotaIcms;
354
        }
356
        }
355
        public void setAliquotaIcms(Double aliquotaIcms) {
357
        public void setAliquotaIcms(Double aliquotaIcms) {
356
                this.aliquotaIcms = aliquotaIcms;
358
                this.aliquotaIcms = aliquotaIcms;
-
 
359
        }
-
 
360
       
-
 
361
        @Transient
-
 
362
        public Double getAliquotaIcmsNotaFiscal() {
-
 
363
                return aliquotaIcmsNotaFiscal;
-
 
364
        }
-
 
365
        public void setAliquotaIcmsNotaFiscal(Double aliquotaIcmsNotaFiscal) {
-
 
366
                this.aliquotaIcmsNotaFiscal = aliquotaIcmsNotaFiscal;
357
        }
367
        }
358
       
368
       
359
        @Column(name="val_aliquota_icms_st")
369
        @Column(name="val_aliquota_icms_st")
360
        public Double getAliquotaIcmsST() {
370
        public Double getAliquotaIcmsST() {
361
                return aliquotaIcmsST;
371
                return aliquotaIcmsST;
Line 376... Line 386...
376
        public Double getAliquotaIPI() {
386
        public Double getAliquotaIPI() {
377
                return aliquotaIPI;
387
                return aliquotaIPI;
378
        }
388
        }
379
        public void setAliquotaIPI(Double aliquotaIPI) {
389
        public void setAliquotaIPI(Double aliquotaIPI) {
380
                this.aliquotaIPI = aliquotaIPI;
390
                this.aliquotaIPI = aliquotaIPI;
-
 
391
        }
-
 
392
       
-
 
393
        @Transient
-
 
394
        public Double getAliquotaIPINotaFiscal() {
-
 
395
                return aliquotaIPINotaFiscal;
-
 
396
        }
-
 
397
        public void setAliquotaIPINotaFiscal(Double aliquotaIPINotaFiscal) {
-
 
398
                this.aliquotaIPINotaFiscal = aliquotaIPINotaFiscal;
381
        }
399
        }
382
       
400
       
383
        @Column(name="ind_ativo")
401
        @Column(name="ind_ativo")
384
        public Boolean getAtivo() {
402
        public Boolean getAtivo() {
385
                return ativo;
403
                return ativo;
Line 769... Line 787...
769
                }
787
                }
770
                if (VerificadorUtil.naoEstaNulo(produtoNota.getProd().getCEST())) {
788
                if (VerificadorUtil.naoEstaNulo(produtoNota.getProd().getCEST())) {
771
                        this.setCodigoEST(produtoNota.getProd().getCEST());
789
                        this.setCodigoEST(produtoNota.getProd().getCEST());
772
                }
790
                }
773
               
791
               
774
                Double aliquotaIPI = null;
-
 
775
                for (JAXBElement<?> elemento : produtoNota.getImposto().getContent()) {
792
                for (JAXBElement<?> elemento : produtoNota.getImposto().getContent()) {
776
                        if (elemento.getDeclaredType().equals(nfce.java.TNFe.InfNFe.Det.Imposto.ICMS.class)) {
793
                        if (elemento.getDeclaredType().equals(nfce.java.TNFe.InfNFe.Det.Imposto.ICMS.class)) {
777
                                nfce.java.TNFe.InfNFe.Det.Imposto.ICMS icms = (nfce.java.TNFe.InfNFe.Det.Imposto.ICMS) elemento.getValue();
794
                                nfce.java.TNFe.InfNFe.Det.Imposto.ICMS icms = (nfce.java.TNFe.InfNFe.Det.Imposto.ICMS) elemento.getValue();
778
                                if (VerificadorUtil.naoEstaNulo(icms.getICMS00())) {
795
                                if (VerificadorUtil.naoEstaNulo(icms.getICMS00())) {
779
                                        this.setAliquotaIcms(Double.valueOf(icms.getICMS00().getPICMS()));
-
 
-
 
796
                                        Double aliquotaIcms = Double.valueOf(icms.getICMS00().getPICMS());
-
 
797
                                        if (aliquotaIcms > 0.0) {
-
 
798
                                                this.setAliquotaIcmsNotaFiscal(aliquotaIcms);
-
 
799
                                                this.setAliquotaIcms(aliquotaIcms);
-
 
800
                                        } else {
-
 
801
                                                this.setAliquotaIcmsNotaFiscal(0.0);
-
 
802
                                                this.setAliquotaIcms(ConstantesSEC.NotaFiscal.Imposto.ALIQUOTA_INTERNA_ICMS_PADRAO_12);
-
 
803
                                        }
780
                                }
804
                                }
781
                        }
805
                        }
782
                        if (elemento.getDeclaredType().equals(nfce.java.TIpi.class)) {
806
                        if (elemento.getDeclaredType().equals(nfce.java.TIpi.class)) {
783
                                nfce.java.TIpi ipi = (nfce.java.TIpi) elemento.getValue();
807
                                nfce.java.TIpi ipi = (nfce.java.TIpi) elemento.getValue();
784
                                if (VerificadorUtil.naoEstaNulo(ipi.getIPITrib())) {
808
                                if (VerificadorUtil.naoEstaNulo(ipi.getIPITrib())) {
785
                                        aliquotaIPI = Double.valueOf(ipi.getIPITrib().getPIPI());
-
 
786
                                        this.setAliquotaIPI(aliquotaIPI);
-
 
-
 
809
                                        Double aliquotaIPITrib = Double.valueOf(ipi.getIPITrib().getPIPI());
-
 
810
                                        if (aliquotaIPITrib > 0.0) {
-
 
811
                                                this.setAliquotaIPINotaFiscal(aliquotaIPITrib);
-
 
812
                                        }
787
                                }
813
                                }
788
                        }
814
                        }
-
 
815
                }
-
 
816
                if (VerificadorUtil.estaNulo(getAliquotaIcms())) {
-
 
817
                        this.setAliquotaIcmsNotaFiscal(0.0);
-
 
818
                        this.setAliquotaIcms(ConstantesSEC.NotaFiscal.Imposto.ALIQUOTA_INTERNA_ICMS_PADRAO_12);
789
                }
819
                }
790
               
820
               
791
                if (VerificadorUtil.estaNulo(this.getValorCompra())) {
821
                if (VerificadorUtil.estaNulo(this.getValorCompra())) {
792
                        if (VerificadorUtil.naoEstaNulo(produtoNota.getProd().getVUnCom())) {
822
                        if (VerificadorUtil.naoEstaNulo(produtoNota.getProd().getVUnCom())) {
793
                                this.setValorCompra(retornarValorComDesconto(produtoNota.getProd()));
823
                                this.setValorCompra(retornarValorComDesconto(produtoNota.getProd()));
Line 1060... Line 1090...
1060
                this.setAtivo(true);
1090
                this.setAtivo(true);
1061
        }
1091
        }
1062
       
1092
       
1063
        @Transient
1093
        @Transient
1064
        public void atualizarAliquotas(Fornecedor fornecedor) {
1094
        public void atualizarAliquotas(Fornecedor fornecedor) {
-
 
1095
                if (VerificadorUtil.naoEstaNulo(getTributacao())) {
-
 
1096
                        setAliquotaIPI(getTributacao().getAliquotaIPI());
-
 
1097
                }
-
 
1098
                               
1065
                if (VerificadorUtil.naoEstaNulo(getTributacao())
1099
                if (VerificadorUtil.naoEstaNulo(getTributacao())
1066
                                && VerificadorUtil.naoEstaNulo(getAliquotaIcms())
1100
                                && VerificadorUtil.naoEstaNulo(getAliquotaIcms())
1067
                                && VerificadorUtil.naoEstaNulo(fornecedor)) {
1101
                                && VerificadorUtil.naoEstaNulo(fornecedor)) {
1068
                        if (getTributacao().getSujeitoST() && fornecedor.getSujeitoST()) {
1102
                        if (getTributacao().getSujeitoST() && fornecedor.getSujeitoST()) {
1069
                                setAliquotaIcmsST(getTributacao().mvaPorIcms(getAliquotaIcms()));
1103
                                setAliquotaIcmsST(getTributacao().mvaPorIcms(getAliquotaIcms()));
Line 1134... Line 1168...
1134
        public Double calculoOperacao() {
1168
        public Double calculoOperacao() {
1135
                Double aliquota = ConstantesSEC.NotaFiscal.Imposto.ALIQUOTA_MEDIA_SIMPLES_NACIONAL_11 +
1169
                Double aliquota = ConstantesSEC.NotaFiscal.Imposto.ALIQUOTA_MEDIA_SIMPLES_NACIONAL_11 +
1136
                                ConstantesSEC.NotaFiscal.Imposto.ALIQUOTA_MEDIA_COMISSOES_2 +
1170
                                ConstantesSEC.NotaFiscal.Imposto.ALIQUOTA_MEDIA_COMISSOES_2 +
1137
                                ConstantesSEC.NotaFiscal.Imposto.ALIQUOTA_MEDIA_CARTAO_2;
1171
                                ConstantesSEC.NotaFiscal.Imposto.ALIQUOTA_MEDIA_CARTAO_2;
1138
                return VerificadorUtil.naoEstaNulo(getValorVarejoSimulacao())? calculoTributosCompra() + (getValorVarejoSimulacao()*aliquota/100) : 0.0;
1172
                return VerificadorUtil.naoEstaNulo(getValorVarejoSimulacao())? calculoTributosCompra() + (getValorVarejoSimulacao()*aliquota/100) : 0.0;
-
 
1173
        }
-
 
1174
       
-
 
1175
        @Transient
-
 
1176
        public String valorCalculoOperacao() {
-
 
1177
                return StringUtil.formatarValor(calculoOperacao());
1139
        }
1178
        }
1140
       
1179
       
1141
        @Transient
1180
        @Transient
1142
        public Double calculoValorAposCustos() {
1181
        public Double calculoValorAposCustos() {
1143
                return VerificadorUtil.naoEstaNulo(getValorVarejoSimulacao())? getValorVarejoSimulacao() - calculoOperacao() : 0.0;
1182
                return VerificadorUtil.naoEstaNulo(getValorVarejoSimulacao())? getValorVarejoSimulacao() - calculoOperacao() : 0.0;
Line 1159... Line 1198...
1159
                        return StringUtil.formatarValorComDigitos(calculoMargemAposCustos().toString(), 2);
1198
                        return StringUtil.formatarValorComDigitos(calculoMargemAposCustos().toString(), 2);
1160
                } catch (Exception e) {
1199
                } catch (Exception e) {
1161
                        e.printStackTrace();
1200
                        e.printStackTrace();
1162
                }
1201
                }
1163
                return "";
1202
                return "";
-
 
1203
        }
-
 
1204
       
-
 
1205
        @Transient
-
 
1206
        public Double calculoPrecoMinimo() {
-
 
1207
                Double valorVarejoSimulacao = getValorVarejoSimulacao();
-
 
1208
                setValorVarejoSimulacao(this.getValorCompra());
-
 
1209
                Double valorMinimo = this.calculoOperacao();
-
 
1210
                Double margem = 0.0;
-
 
1211
                valorMinimo = valorMinimo + (valorMinimo / 100);
-
 
1212
                if (valorMinimo > 0.0) {
-
 
1213
                        while (margem < 15.0) {
-
 
1214
                                valorMinimo = valorMinimo + (valorMinimo / 100);
-
 
1215
                                setValorVarejoSimulacao(valorMinimo);
-
 
1216
                                margem = calculoMargemAposCustos();
-
 
1217
                        }
-
 
1218
                }
-
 
1219
                setValorVarejoSimulacao(valorVarejoSimulacao);
-
 
1220
                return valorMinimo;
1164
        }
1221
        }
1165
       
1222
       
1166
}
1223
}