Exemplo n.º 1
0
 private void TFServicosSalao_Load(object sender, EventArgs e)
 {
     pnl_Pecas.set_FormatZero();
     this.Icon = Utils.ResourcesUtils.TecnoAliance_ICO;
     if (rpeca == null)
     {
         BS_Pecas.AddNew();
         (BS_Pecas.Current as CamadaDados.Servicos.TRegistro_LanServicosPecas).Quantidade = 1;
     }
     else
     {
         if (rpeca.Vl_acrescimo > decimal.Zero && rpeca.Pc_acrescimo.Equals(decimal.Zero))
         {
             rpeca.Pc_acrescimo = Math.Round(decimal.Divide(decimal.Multiply(rpeca.Vl_acrescimo, 100), rpeca.Vl_subtotal), 5, MidpointRounding.AwayFromZero);
         }
         if (rpeca.Vl_desconto > decimal.Zero && rpeca.Pc_desconto.Equals(decimal.Zero))
         {
             rpeca.Pc_desconto = Math.Round(decimal.Divide(decimal.Multiply(rpeca.Vl_desconto, 100), rpeca.Vl_subtotal), 5, MidpointRounding.AwayFromZero);
         }
         BS_Pecas.DataSource = rpeca;
         CD_Produto.Enabled  = false;
         DS_Produto.Enabled  = false;
         if (!string.IsNullOrEmpty(Cd_clifor))
         {
             rProg = CamadaNegocio.Faturamento.ProgEspecialVenda.TCN_ProgEspecialVenda.BuscarProg(CD_Empresa,
                                                                                                  Cd_clifor,
                                                                                                  CD_Produto.Text,
                                                                                                  CD_TabelaPreco,
                                                                                                  null);
         }
     }
 }
Exemplo n.º 2
0
        private void TFLan_Pecas_Ordem_Servico_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Utils.Parametros.pubCultura))
            {
                Idioma.TIdioma.AjustaCultura(this);
            }
            pnl_Pecas.set_FormatZero();
            Icon           = ResourcesUtils.TecnoAliance_ICO;
            Height         = 456;
            St_obrigaCusto = CamadaNegocio.ConfigGer.TCN_CadParamGer.BuscaVlBool("ST_OBRIGAR_CUSTO_UNIT_ORC",
                                                                                 null).Equals(true);
            if (!St_alterar)
            {
                BS_Pecas.AddNew();
            }
            else
            {
                if (rpeca.lFichaTecOS.Count > 0)
                {
                    Height = 600;
                    (BS_Pecas.Current as TRegistro_LanServicosPecas).lFichaTecOS.ForEach(p =>
                    {
                        p.Vl_unitario = TCN_LanPrecoItem.Busca_ConsultaPreco(CD_Empresa, p.Cd_item, CD_TabelaPreco, null);
                    });
                    if (Vl_Unitario.Enabled)
                    {
                        Vl_Unitario.Value = (BS_Pecas.Current as TRegistro_LanServicosPecas).lFichaTecOS.Sum(p => p.Vl_Subtotal);
                        vl_custo.Value    = (BS_Pecas.Current as TRegistro_LanServicosPecas).lFichaTecOS.Sum(p => p.Vl_TotCusto);
                    }
                    vl_custo.Enabled       = vl_custo.Value.Equals(decimal.Zero) && St_obrigaCusto;
                    tot_itensFichaTec.Text = (BS_Pecas.Current as TRegistro_LanServicosPecas).lFichaTecOS.Sum(p => p.Vl_Subtotal).
                                             ToString("N2", new System.Globalization.CultureInfo("pt-BR"));
                }
                if (rpeca.Vl_acrescimo > decimal.Zero && rpeca.Pc_acrescimo.Equals(decimal.Zero))
                {
                    rpeca.Pc_acrescimo = Math.Round(decimal.Divide(decimal.Multiply(rpeca.Vl_acrescimo, 100), rpeca.Vl_subtotal), 5, MidpointRounding.AwayFromZero);
                }
                if (rpeca.Vl_desconto > decimal.Zero && rpeca.Pc_desconto.Equals(decimal.Zero))
                {
                    rpeca.Pc_desconto = Math.Round(decimal.Divide(decimal.Multiply(rpeca.Vl_desconto, 100), rpeca.Vl_subtotal), 5, MidpointRounding.AwayFromZero);
                }
                BS_Pecas.DataSource = rpeca;
                CD_Produto.Enabled  = false;
                DS_Produto.Enabled  = false;
                CD_Local.Enabled    = !pSt_servico && !St_consumoInterno;
                BB_Local.Enabled    = !pSt_servico && !St_consumoInterno;
                ID_Tecnico.Enabled  = pSt_servico;
                BB_Tecnico.Enabled  = pSt_servico;
                if (!string.IsNullOrEmpty(Cd_clifor))
                {
                    rProg = CamadaNegocio.Faturamento.ProgEspecialVenda.TCN_ProgEspecialVenda.BuscarProg(CD_Empresa,
                                                                                                         Cd_clifor,
                                                                                                         CD_Produto.Text,
                                                                                                         CD_TabelaPreco,
                                                                                                         null);
                }
            }
            if (!St_alterar)
            {
                ID_Tecnico.Text = Cd_tecnico;
                DS_Funcao.Text  = Nm_tecnico;
            }
            vl_custo.Enabled    = vl_custo.Value.Equals(decimal.Zero) && St_obrigaCusto;
            Vl_Unitario.Enabled = string.IsNullOrEmpty(CD_TabelaPreco) ||
                                  CamadaNegocio.Diversos.TCN_Usuario_RegraEspecial.ValidaRegra(Utils.Parametros.pubLogin,
                                                                                               "PERMITIR INFORMAR PREÇO VENDA",
                                                                                               null);

            vl_custo.Visible   = St_obrigaCusto;
            lbCusto.Visible    = St_obrigaCusto;
            CD_Local.Enabled   = !pSt_servico;
            BB_Local.Enabled   = !pSt_servico;
            st_servico.Checked = pSt_servico;
            if (pSt_servico)
            {
                BB_NovoProduto.Text = "(F8)\r\nServiço";
            }
            if (St_consumoInterno)
            {
                CD_Local.Enabled = false;
                BB_Local.Enabled = false;
            }
        }