示例#1
0
        private Hashtable armarHashFactura()
        {
            Hashtable hash   = new Hashtable();
            double    valFac = Convert.ToDouble(txtValorFac.Text);

            hash.Add("mvfac_codigo", String.Format("'{0}'", txtCodFac.Text.Trim()));
            hash.Add("mcli_codigo", String.Format("'{0}'", lblCodProdPadre.Text));
            hash.Add("mcli_codigocliente", String.Format("'{0}'", codCliente));
            hash.Add("mvfac_nombrecliente", String.Format("'{0}'", ManejoClientesLogic.getNombreCliente(codCliente)));
            hash.Add("tvfac_codigo", String.Format("'{0}'", ddlTipoFac.SelectedValue));
            hash.Add("tvest_codigo", String.Format("'{0}'", "AD"));
            hash.Add("mvfac_valor", String.Format("{0}", valFac));
            hash.Add("mvfac_fechatrans", String.Format("'{0}'", DateTime.Now.ToString("yyyy-MM-dd")));
            hash.Add("mvfac_fechapago", String.Format("'{0}'", ManejoClientesLogic.calcularFechaPago(txtFechaCorte.Text, txtFechaPagoFac.Text, valFac)));
            hash.Add("mvfac_diasprorroga", String.Format("{0}", 0));
            hash.Add("mvfac_puntosacum", String.Format("{0}", ManejoClientesLogic.obtenerPuntosFactura(valFac)));
            hash.Add("mvfac_numaval", String.Format("'{0}'", txtAval.Text.Trim()));
            hash.Add("susu_codigo", ManejoClientesLogic.getCodUsuario());

            return(hash);
        }
示例#2
0
        protected void redimir(Object sender, DataGridCommandEventArgs e)
        {
            string codRedencion = ((DataBoundLiteralControl)e.Item.Cells[0].Controls[0]).Text;

            string sql     = String.Format("select mvite_codigo from mvipredencion where mred_consecutivo={0}", codRedencion);
            string codItem = DBFunctions.SingleData(sql);

            sql = String.Format("select COALESCE(mvsal_cantidad, 0) from mvipsaldoitem where mvite_codigo='{0}' and pvbod_codigo='{1}'", codItem, codBodega);
            string cant     = DBFunctions.SingleData(sql);
            int    cantidad = cant == null || cant == "" ? 0 : Convert.ToInt32(cant);

            if (cantidad <= 0)
            {
                Utils.MostrarAlerta(Response, "Este item no tiene existencias!");
            }
            else
            {
                cantidad--;
                sql = String.Format("update mvipsaldoitem set mvsal_cantidad={0} where mvite_codigo='{1}' and pvbod_codigo='{2}'"
                                    , cantidad
                                    , codItem
                                    , codBodega);

                DBFunctions.NonQuery(sql);

                int codUsuario = ManejoClientesLogic.getCodUsuario();
                sql = String.Format("update mvipredencion set tred_codigo='REDIM', susu_codigo={1}, mred_fecha='{2}' where mred_consecutivo={0}"
                                    , codRedencion
                                    , codUsuario
                                    , DateTime.Now.ToString("yyyy-MM-dd"));
                DBFunctions.NonQuery(sql);

                imprimir(sender, e);

                String redirect = String.Format("{0}?process=VIP.Redenciones&codCliente={1}&reporte={2}",
                                                indexPage, codCliente, ViewState["reporte"]);

                Response.Redirect(redirect);
            }
        }