Esempio n. 1
0
        protected void Generar_Anticipo(string numero)
        {
            string plantilla = "";
            string nlchar = "`", redChar = "^";
            int    anchoTiquete = Tiquetes.anchoTiquete;

            try
            {
                string       strLinea = "";
                StreamReader strArchivo;
                strArchivo = File.OpenText(ConfigurationManager.AppSettings["PathToPapeleria"] + "\\PlantillaAnticipo.txt");
                strLinea   = strArchivo.ReadLine();
                //La primera linea puede contener el ancho del tiquete
                try
                {
                    anchoTiquete = Int16.Parse(strLinea);
                    strLinea     = strArchivo.ReadLine();
                }
                catch {}

                while (strLinea != null)
                {
                    plantilla += strLinea + nlchar;
                    strLinea   = strArchivo.ReadLine();
                }
                strArchivo.Close();
            }
            catch
            {
                Utils.MostrarAlerta(Response, "No se ha creado la plantilla de anticipos, no se pudo imprimir.");
                return;
            }



            //descripcion=Tiquetes.CortarTexto(dsAnticipo.Tables[0].Rows[0]["DESCRIPCION"].ToString(),anchoTiquete);

            txtAnticipo = Plantillas.GenerarAnticipo(numero, plantilla, nlchar, redChar, anchoTiquete);

            //plantilla=plantilla.Replace("<DESCRIPCION>",descripcion);
        }
Esempio n. 2
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                DatasToControls bind = new DatasToControls();
                Agencias.TraerAgenciasUsuario(ddlAgencia);

                if (ddlAgencia.Items.Count > 0)
                {
                    ddlAgencia_SelectedIndexChanged(sender, e);
                }
                btnGuardar.Attributes.Add("onClick", "return(validarGasto());");
                strImprime = "";
                if (Request.QueryString["act"] != null && Request.QueryString["ant"] != null)
                {
                    if (Tools.Browser.IsMobileBrowser())
                    {
                        string plantilla = "";
                        string nlchar = "`", redChar = "^";
                        int    anchoTiquete = Tiquetes.anchoTiquete;
                        try
                        {
                            string       strLinea = "";
                            StreamReader strArchivo;
                            strArchivo = File.OpenText(ConfigurationManager.AppSettings["PathToPapeleria"] + "\\PlantillaAnticipoMovil.txt");
                            strLinea   = strArchivo.ReadLine();
                            //La primera linea puede contener el ancho del tiquete
                            try
                            {
                                anchoTiquete = Int16.Parse(strLinea);
                                strLinea     = strArchivo.ReadLine();
                            }
                            catch {}

                            while (strLinea != null)
                            {
                                plantilla += strLinea + nlchar;
                                strLinea   = strArchivo.ReadLine();
                            }
                            strArchivo.Close();
                        }
                        catch
                        {
                            Response.Write("<script language='javascript'>alert('No se ha creado la plantilla de anticipos moviles, no se pudo imprimir.');</script>");
                            return;
                        }
                        strImprime = Plantillas.GenerarAnticipo(Request.QueryString["ant"], plantilla, nlchar, redChar, anchoTiquete);
                    }
                    else
                    {
                        Response.Write("<script language='javascript'>alert('El anticipo/servicio ha sido registrado con el número " + Request.QueryString["ant"] + ".');" +
                                       "window.open('../aspx/AMS.Comercial.Anticipo.aspx?ant=" + Request.QueryString["ant"] + "','ANTICIPO" + Request.QueryString["ant"] + "',\"width=340,height=290,top=0,left=0,toolbar=no,menubar=no,status=no,scrollbars=no,history=no\");" +
                                       "</script>");
                    }
                }
                txtFecha.Text = DateTime.Now.ToString("yyyy-MM-dd");
                if (ConfigurationManager.AppSettings["DiferenteFechaAnticipo"] == "SI")
                {
                    txtFecha.Enabled = true;
                }
                else
                {
                    txtFecha.Enabled = false;
                }

                txtCantidad.Attributes.Add("onkeyup", "NumericMask(this);Totales();");
                txtValorUnidad.Attributes.Add("onkeyup", "NumericMask(this);Totales();");
            }
        }