コード例 #1
0
        private void ObtenerDetalle()
        {
            lblMsjDet.Text = "";

            clsGridDetalle objGridDet = new clsGridDetalle();

            objGridDet.gsNroOrd  = (Int32)Session["NumOrd"];
            objGridDet.gsCodProd = Session["CodPro"].ToString();

            if (Session["varDtDetalle"] != null)
            {
                objGridDet.gsDtDetalle = (DataTable)Session["varDtDetalle"];
            }

            if (objGridDet.ObtenerDetalle())
            {
                //txtProd.Text = (string)Session["CodPro"];
                txtProd.Text             = objGridDet.gsCodProd;
                txtCant.Text             = objGridDet.gsCant.ToString();
                txtVlrServ.Text          = objGridDet.gsValor.ToString();
                ddlTipServ.SelectedValue = objGridDet.gsCodTipSer.ToString();
            }
            else
            {
                lblMsjDet.Text = objGridDet.gError;
            }

            objGridDet = null;
        }
コード例 #2
0
        private void AgregarDetalle()
        {
            lblMsjDet.Text = "";
            clsGridDetalle objGridDet = new clsGridDetalle();

            int.TryParse(txtNumCompra.Text, out intNumCompra);
            int.TryParse(txtCant.Text, out intCant);
            decimal.TryParse(txtVlrServ.Text, out decVlrServ);
            objGridDet.gsNroOrd  = intNumCompra;
            objGridDet.gsCodProd = Convert.ToInt16(ddlProducto.SelectedValue);
            objGridDet.gsCant    = intCant;
            objGridDet.gsValor   = decVlrServ;


            if (Session["varDtDetalle"] != null)
            {
                objGridDet.gsDtDetalle = (DataTable)Session["varDtDetalle"];
            }

            if (objGridDet.AgregarDetalle())
            {
                Session["varDtDetalle"] = objGridDet.gsDtDetalle;
                gvDetalle.DataSource    = (DataTable)Session["varDtDetalle"];
                gvDetalle.DataBind();
                txtValor.Text = objGridDet.gTot.ToString("#,#");
                txtIva.Text   = objGridDet.gIva.ToString("#,#");
            }
            else
            {
                lblMsjDet.Text = objGridDet.gError;
            }

            objGridDet = null;
            LimpiarCampDet();
        }
コード例 #3
0
        private void AgregarDetalle()
        {
            lblMsjDet.Text = "";

            clsGridDetalle objGridDet = new clsGridDetalle();

            if (String.IsNullOrEmpty(txtNumOrd.Text))
            {
                objGridDet.gsNroOrd = 0;
            }
            else
            {
                objGridDet.gsNroOrd = Convert.ToInt32(txtNumOrd.Text);
            }
            objGridDet.gsCodProd   = txtProd.Text;
            objGridDet.gsCant      = Convert.ToInt16(txtCant.Text);
            objGridDet.gsValor     = Convert.ToDecimal(txtVlrServ.Text);
            objGridDet.gsCodTipSer = Convert.ToInt16(ddlTipServ.SelectedValue);

            if (Session["varDtDetalle"] != null)
            {
                objGridDet.gsDtDetalle = (DataTable)Session["varDtDetalle"];
            }

            if (objGridDet.AgregarDetalle())
            {
                Session["varDtDetalle"] = objGridDet.gsDtDetalle;

                gvDetalle.DataSource = (DataTable)Session["varDtDetalle"];
                gvDetalle.DataBind();

                txtValor.Text = objGridDet.gTot.ToString("#,#");
                txtIva.Text   = objGridDet.gIva.ToString("#,#");
            }
            else
            {
                lblMsjDet.Text = objGridDet.gError;
            }

            objGridDet = null;

            LimpiarCampDet();
        }
コード例 #4
0
        private void BorrarDetalle()
        {
            if (gvDetalle.SelectedRow.Cells[2] != null)
            {
                lblMsjDet.Text = "";
                clsGridDetalle   objGridDet   = new clsGridDetalle();
                clsDetalleCompra objDetCompra = new clsDetalleCompra();
                int.TryParse(txtNumCompra.Text, out intNumCompra);
                int.TryParse(txtCant.Text, out intCant);
                decimal.TryParse(txtVlrServ.Text, out decVlrServ);
                int.TryParse(gvDetalle.SelectedRow.Cells[2].Text, out IdProducto);
                objGridDet.gsNroOrd              = intNumCompra;
                objGridDet.gsCodProd             = IdProducto;
                objGridDet.gsValor               = Convert.ToInt32(gvDetalle.SelectedRow.Cells[4].Text);
                objGridDet.gsCant                = Convert.ToInt32(gvDetalle.SelectedRow.Cells[3].Text);
                objDetCompra.gsIdProducto        = IdProducto;
                objDetCompra.gsIdCabCompra       = intNumCompra;
                objDetCompra.gsValor             = Convert.ToInt32(gvDetalle.SelectedRow.Cells[4].Text);
                objDetCompra.gsUnidadesCompradas = Convert.ToInt32(gvDetalle.SelectedRow.Cells[3].Text);


                if (Session["varDtDetalle"] != null)
                {
                    objGridDet.gsDtDetalle = (DataTable)Session["varDtDetalle"];
                }

                if (objGridDet.BorrarDetalle())
                {
                    Session["varExisteMEM"] = "1";
                    if (objDetCompra.EliminarDetalleCompra())
                    {
                        lblMsjDet.Text          = "Detalle eliminada exitosamente";
                        Session["varDtDetalle"] = objGridDet.gsDtDetalle;
                        gvDetalle.DataSource    = (DataTable)Session["varDtDetalle"];
                        gvDetalle.DataBind();
                        txtValor.Text = objGridDet.gTot.ToString("#,#");
                        txtIva.Text   = objGridDet.gIva.ToString("#,#");
                    }
                    else
                    {
                        if (Session["varExisteMEM"] != null & objDetCompra.gError.Contains("NO Existe"))
                        {
                            lblMsjDet.Text          = "Detalle eliminada exitosamente";
                            Session["varDtDetalle"] = objGridDet.gsDtDetalle;
                            gvDetalle.DataSource    = (DataTable)Session["varDtDetalle"];
                            gvDetalle.DataBind();
                            txtValor.Text = objGridDet.gTot.ToString("#,#");
                            txtIva.Text   = objGridDet.gIva.ToString("#,#");
                        }
                        else
                        {
                            lblMsjDet.Text = objDetCompra.gError;
                        }
                    }
                }
                else
                {
                    lblMsjDet.Text = objGridDet.gError;
                }

                objGridDet = null;
                LimpiarCampDet();
            }
            else
            {
                lblMsjDet.Text = "Debe Seleccionar un detalle para eliminar";
            }
        }