Example #1
0
        /// <summary>
        /// Converte essa classe genérica em uma classe ProdutoOrcamentoBenef.
        /// </summary>
        /// <returns></returns>
        public ProdutoOrcamentoBenef ToProdutoOrcamento(uint idProdOrca)
        {
            if (idProdOrca > 0)
            {
                IdProdutoOrcamento = idProdOrca;
            }

            ProdutoOrcamentoBenef pob = new ProdutoOrcamentoBenef();

            pob.IdProdOrcaBenef    = IdProdutoOrcamentoBenef;
            pob.IdProd             = IdProdutoOrcamento;
            pob.BisAlt             = BisAlt;
            pob.BisLarg            = BisLarg;
            pob.EspBisote          = EspBisote;
            pob.EspFuro            = EspFuro;
            pob.IdBenefConfig      = IdBenefConfig;
            pob.LapAlt             = LapAlt;
            pob.LapLarg            = LapLarg;
            pob.Qtde               = Qtd;
            pob.ValorUnit          = _valorUnit;
            pob.Valor              = Valor;
            pob.Custo              = Custo;
            pob.Padrao             = Padrao;
            pob.ValorComissao      = ValorComissao;
            pob.ValorAcrescimo     = ValorAcrescimo;
            pob.ValorAcrescimoProd = ValorAcrescimoProd;
            pob.ValorDesconto      = ValorDesconto;
            pob.ValorDescontoProd  = ValorDescontoProd;

            return(pob);
        }
Example #2
0
        public DadosMemoriaCalculo(ProdutoOrcamentoBenef pob)
        {
            BenefConfig       bc   = BenefConfigDAO.Instance.GetElement(pob.IdBenefConfig);
            ProdutosOrcamento pai  = ProdutosOrcamentoDAO.Instance.GetElement(pob.IdProd);
            BenefConfigPreco  bcp  = BenefConfigPrecoDAO.Instance.GetByIdBenefConfig(null, pob.IdBenefConfig, pai.IdProduto.Value);
            Orcamento         orca = OrcamentoDAO.Instance.GetElement(pai.IdOrcamento);

            Codigo        = pai.CodInterno;
            Ambiente      = pai.Ambiente;
            DescrAmbiente = pai.IdProdParent > 0 ? ProdutosOrcamentoDAO.Instance.ObtemValorCampo <string>("descricao", "idProd=" + pai.IdProdParent.Value) : null;
            _descricao    = " " + bc.DescricaoCompleta.Trim();
            Redondo       = false;
            Qtde          = pob.Qtde;
            ValorTabela   = BenefConfigDAO.Instance.GetValorTabela(bcp, orca.TipoEntrega, orca.IdCliente);
            Custo         = bcp.Custo;
            CustoTotal    = pob.Custo;
            Valor         = pob.ValorUnit;
            ValorTotal    = pob.Valor;

            if (bc.TipoControle == TipoControleBenef.Bisote || bc.TipoControle == TipoControleBenef.Lapidacao)
            {
                _descricao += " " +
                              Utils.MontaDescrLapBis(pob.BisAlt, pob.BisLarg, pob.LapAlt, pob.LapLarg, pob.EspBisote, null, null, false);
            }

            if (bc.TipoCalculo == TipoCalculoBenef.Porcentagem)
            {
                ValorTabela = Math.Round((ValorTabela / 100) * pai.ValorProd.Value, 2);
                Custo       = Math.Round((Custo / 100) * pai.Custo, 2);
            }

            TipoCalculo = 0;
        }
Example #3
0
        public ProdutoOrcamentoBenef[] ToProdutosOrcamento(uint idProdOrca)
        {
            ProdutoOrcamentoBenef[] retorno = new ProdutoOrcamentoBenef[Count];
            int i = 0;

            foreach (GenericBenef b in this)
            {
                retorno[i++] = b.ToProdutoOrcamento(idProdOrca);
            }

            return(retorno);
        }
Example #4
0
 /// <summary>
 /// Cria uma classe genérica de beneficiamento a partir de uma classe ProdutoOrcamentoBenef.
 /// </summary>
 /// <param name="pob"></param>
 public GenericBenef(ProdutoOrcamentoBenef pob)
 {
     _tipo = TipoProdutoBeneficiamento.ProdutoOrcamento;
     IdProdutoOrcamentoBenef = pob.IdProdOrcaBenef;
     IdProdutoOrcamento      = pob.IdProd;
     BisAlt             = pob.BisAlt;
     BisLarg            = pob.BisLarg;
     EspBisote          = pob.EspBisote;
     EspFuro            = pob.EspFuro;
     IdBenefConfig      = pob.IdBenefConfig;
     LapAlt             = pob.LapAlt;
     LapLarg            = pob.LapLarg;
     Qtd                = pob.Qtde;
     _valorUnit         = pob.ValorUnit;
     Valor              = pob.Valor;
     Custo              = pob.Custo;
     Padrao             = pob.Padrao;
     ValorComissao      = pob.ValorComissao;
     ValorAcrescimo     = pob.ValorAcrescimo;
     ValorAcrescimoProd = pob.ValorAcrescimoProd;
     ValorDesconto      = pob.ValorDesconto;
     ValorDescontoProd  = pob.ValorDescontoProd;
 }