Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        BtnEnviar.Attributes.Add("onclick", "return Mensagem(\"Confirma o Envio do Pedido ?\");");
        BtnPesqPrd.Attributes.Add("onclick", "ShowDialog('PesqProdutos.aspx','500px','750px');");
        IdPessoa = ((Controle_Dados.Pessoas)(((System.Web.UI.UserControl)(this.Master)).Session["LoginUsuario"])).IdPessoa;
        if (!this.IsPostBack)
        {
            TxtTotal.Style.Add("text-align", "right");
            TxtQtde.Style.Add("text-align", "right");
            TxtVlrUnt.Style.Add("text-align", "right");
            TxtVlrTotal.Style.Add("text-align", "right");

            TxtReferencia.Attributes.Add("onkeypress", "if (event.keyCode < 48 || event.keyCode > 58) {event.keyCode = 0;}");
            TxtQtde.Attributes.Add("onkeypress", "if (event.keyCode < 48 || event.keyCode > 58) {event.keyCode = 0;}");
            TxtSolicitante.Text = ((Controle_Dados.Pessoas)(((System.Web.UI.UserControl)(this.Master)).Session["LoginUsuario"])).RazaoSocial.Trim();

            /*LstFormaPgto.DataSource = Controle.ConsultaTabela("SELECT Id_FormaPgto,FormaPgto FROM FormaPagamento ORDER BY FormaPgto");
             * LstFormaPgto.DataTextField = "FormaPgto";
             * LstFormaPgto.DataValueField = "Id_FormaPgto";
             * LstFormaPgto.DataBind();*/

            if (Request.QueryString["VD"] != null)
            {
                IdVenda               = int.Parse(Request.QueryString["VD"].ToString());
                BtnEnviar.Visible     = false;
                BtnCancelar.Visible   = false;
                TxtReferencia.Enabled = false;
                TxtQtde.Enabled       = false;
                TxtObs.Enabled        = false;
                TxtPrazoPgto.Enabled  = false;
                //LstFormaPgto.Enabled = false;
                GridDados.Columns[6].Visible = false;
            }
            TabItens = new DataTable();
            TabItens = CriarTabela();

            PopuparGrid();
        }
        ERP_SGE       TelaMaster = (ERP_SGE)this.Master;
        ScriptManager Cmp        = (ScriptManager)TelaMaster.FindControl("ScriptManager1");

        Cmp.SetFocus(TxtReferencia);
    }
Exemplo n.º 2
0
    protected void TxtReferencia_TextChanged(object sender, EventArgs e)
    {
        ERP_SGE       TelaMaster = (ERP_SGE)this.Master;
        ScriptManager Cmp        = (ScriptManager)TelaMaster.FindControl("ScriptManager1");

        if (TxtReferencia.Text.Trim() != "")
        {
            CadPrd.Controle = Controle;
            CadPrd.LerDados(TxtReferencia.Text.Trim());
            if (CadPrd.IdProduto > 0)
            {
                if (CadPrd.Ativo == 0)
                {
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Atenção: Produto inativo');", true);
                    Cmp.SetFocus(TxtReferencia);
                    return;
                }
                TxtCodigo.Text    = string.Format("{0:d6}", CadPrd.IdProduto);
                TxtDescricao.Text = CadPrd.Descricao;
                TxtVlrUnt.Text    = string.Format("{0:n2}", CadPrd.PrcAtacado);

                /*if (CadPrd.QtdeCxDist == 1 && CadPrd.QtdeCaixa > 0)
                 *  TxtQtde.Text = CadPrd.QtdeCaixa.ToString();
                 * else
                 *  TxtQtde.Text = "1";*/
                TxtQtde.Text = "0";

                TxtVlrTotal.Text = string.Format("{0:n2}", CadPrd.PrcAtacado * decimal.Parse(TxtQtde.Text));
                Cmp.SetFocus(TxtQtde);
            }
            else
            {
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Atenção: Produto não localizado');", true);
                Cmp.SetFocus(TxtReferencia);
            }
        }
        else
        {
            Cmp.SetFocus(TxtReferencia);
        }
    }
Exemplo n.º 3
0
    protected void TxtQtde_TextChanged(object sender, EventArgs e)
    {
        ERP_SGE       TelaMaster = (ERP_SGE)this.Master;
        ScriptManager Cmp        = (ScriptManager)TelaMaster.FindControl("ScriptManager1");

        if (int.Parse(TxtCodigo.Text) > 0)
        {
            CadPrd.Controle = Controle;
            CadPrd.LerDados(TxtReferencia.Text.Trim());

            decimal Qtde = decimal.Parse(TxtQtde.Text);
            if (CadPrd.QtdeCxDist == 1 && CadPrd.QtdeCaixa > 0)
            {
                if (Qtde < CadPrd.QtdeCaixa)
                {
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Menor quantidade de venda do produto é: " + CadPrd.QtdeCaixa.ToString() + " ');", true);
                    Cmp.SetFocus(TxtQtde);
                    return;
                }
                else
                {
                    if ((Qtde % CadPrd.QtdeCaixa) > 0)
                    {
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Qtde Invalida, Favor Verificar a Quantidade do produto');", true);
                        Cmp.SetFocus(TxtQtde);
                        return;
                    }
                }
            }
            TxtVlrTotal.Text = string.Format("{0:n2}", decimal.Parse(TxtVlrUnt.Text) * decimal.Parse(TxtQtde.Text));
            TabItens.Rows.Add(int.Parse(TxtCodigo.Text), TxtReferencia.Text, TxtDescricao.Text, decimal.Parse(TxtQtde.Text), decimal.Parse(TxtVlrUnt.Text), decimal.Parse(TxtQtde.Text) * decimal.Parse(TxtVlrUnt.Text));

            PopuparGrid();
            LimpaCampos();
        }

        Cmp.SetFocus(TxtReferencia);
    }