Rev 144 | Rev 195 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 144 | Rev 145 | ||
|---|---|---|---|
| Line 295... | Line 295... | ||
| 295 | @Transient |
295 | @Transient |
| 296 | public Tributacao getTributacaoDoProduto() { |
296 | public Tributacao getTributacaoDoProduto() { |
| 297 | return VerificadorUtil.naoEstaNulo(getProduto())? getProduto().getTributacao() : null; |
297 | return VerificadorUtil.naoEstaNulo(getProduto())? getProduto().getTributacao() : null; |
| 298 | }
|
298 | }
|
| 299 | 299 | ||
| - | 300 | @Transient |
|
| 300 | public Double retornarPercentualLucroBrutoUnidadeComercial() { |
301 | public Double retornarPercentualLucroBrutoUnidadeComercial() { |
| 301 | if (VerificadorUtil.naoEstaNulo(getValorUnidadeComercial()) && VerificadorUtil.naoEstaNulo(getProduto().getValorVarejo())) { |
- | |
| 302 | return (getProduto().getValorVarejo() / getValorUnidadeComercial()) - 1.0; |
- | |
| - | 302 | try { |
|
| - | 303 | Produto produtoClone = produto.clone(); |
|
| - | 304 | if (VerificadorUtil.naoEstaNulo(getValorUnidadeComercial()) && VerificadorUtil.naoEstaNulo(getProduto().getValorVarejo())) { |
|
| - | 305 | getProduto().setValorCompra(getValorUnidadeComercial()); |
|
| - | 306 | produtoClone.setValorCompra(getValorUnidadeComercial()); |
|
| - | 307 | produtoClone.setValorVarejoSimulacao(produtoClone.getValorVarejo()); |
|
| - | 308 | }
|
|
| - | 309 | return produtoClone.calculoMargemAposCustos(); |
|
| - | 310 | } catch (CloneNotSupportedException e) { |
|
| - | 311 | e.printStackTrace(); |
|
| 303 | }
|
312 | }
|
| 304 | return 0.0; |
313 | return 0.0; |
| 305 | }
|
314 | }
|
| 306 | - | ||
| - | 315 | ||
| - | 316 | @Transient |
|
| - | 317 | public String retornarCorPercentualLucroBrutoUnidadeComercial() { |
|
| - | 318 | try { |
|
| - | 319 | Produto produtoClone = produto.clone(); |
|
| - | 320 | if (VerificadorUtil.naoEstaNulo(getValorUnidadeComercial()) && VerificadorUtil.naoEstaNulo(getProduto().getValorVarejo())) { |
|
| - | 321 | getProduto().setValorCompra(getValorUnidadeComercial()); |
|
| - | 322 | produtoClone.setValorCompra(getValorUnidadeComercial()); |
|
| - | 323 | produtoClone.setValorVarejoSimulacao(produtoClone.getValorVarejo()); |
|
| - | 324 | }
|
|
| - | 325 | return produtoClone.retornarCorMargemLucro(); |
|
| - | 326 | } catch (CloneNotSupportedException e) { |
|
| - | 327 | e.printStackTrace(); |
|
| - | 328 | }
|
|
| - | 329 | return "black"; |
|
| - | 330 | }
|
|
| - | 331 | ||
| 307 | @Transient |
332 | @Transient |
| 308 | public void atualizarDadosNfe(nfce.java.TNFe.InfNFe.Det produtoNota) { |
333 | public void atualizarDadosNfe(nfce.java.TNFe.InfNFe.Det produtoNota) { |
| 309 | this.setUnidadeComercial(produtoNota.getProd().getUCom()); |
334 | this.setUnidadeComercial(produtoNota.getProd().getUCom()); |
| 310 | if (VerificadorUtil.naoEstaNulo(produtoNota.getProd().getQCom())) { |
335 | if (VerificadorUtil.naoEstaNulo(produtoNota.getProd().getQCom())) { |
| 311 | this.setQuantidade(new Double(produtoNota.getProd().getQCom()).intValue()); |
336 | this.setQuantidade(new Double(produtoNota.getProd().getQCom()).intValue()); |