lunes, 13 de agosto de 2007

Traductor de numeros a letras en C#

// traductor de numeros a letras
public string[] sUnidades = {"", "un", "dos", "tres", "cuatro", "cinco", "seis", "siete", "ocho", "nueve", "diez",
"once", "doce", "trece", "catorce", "quince", "dieciseis", "diecisiete", "dieciocho", "diecinueve", "veinte",
"veintiún", "veintidos", "veintitres", "veinticuatro", "veinticinco", "veintiseis", "veintisiete", "veintiocho", "veintinueve"};
public string[] sDecenas = {"", "diez", "veinte", "treinta", "cuarenta", "cincuenta", "sesenta", "setenta", "ochenta", "noventa"};
public string[] sCentenas = {"", "ciento", "doscientos", "trescientos", "cuatrocientos", "quinientos", "seiscientos", "setecientos", "ochocientos", "novecientos"};
public string sResultado = "";


public string traduce_numeros (string sNumero) {
double dNumero;
double dNumAux = 0;
char x;
string sAux;

sResultado = " ";
try {
dNumero = Convert.ToDouble (sNumero);
}
catch {
return "";
}

if (dNumero > 999999999999)
return "";

if (dNumero > 999999999) {
dNumAux = dNumero % 1000000000000;
sResultado += Numeros (dNumAux, 1000000000) + " mil ";
}

if (dNumero > 999999) {
dNumAux = dNumero % 1000000000;
sResultado += Numeros (dNumAux, 1000000) + " millones ";
}

if (dNumero > 999) {
dNumAux = dNumero % 1000000;
sResultado += Numeros (dNumAux, 1000) + " mil ";
}

dNumAux = dNumero % 1000;
sResultado += Numeros (dNumAux, 1);


//Enseguida verificamos si contiene punto, si es así, los convertimos a texto.
sAux = dNumero.ToString();

if (sAux.IndexOf(".") >= 0)
sResultado += ObtenerDecimales (sAux);

//Las siguientes líneas convierten el primer caracter a mayúscula.
sAux = sResultado;
x = char.ToUpper (sResultado[1]);
sResultado = x.ToString ();

for (int i = 2; i 999999999999)
return "";

if (dNumero > 999999999) {
dNumAux = dNumero % 1000000000000;
sResultado += Numeros (dNumAux, 1000000000) + " mil ";
}

if (dNumero > 999999) {
dNumAux = dNumero % 1000000000;
sResultado += Numeros (dNumAux, 1000000) + " millones ";
}

if (dNumero > 999) {
dNumAux = dNumero % 1000000;
sResultado += Numeros (dNumAux, 1000) + " mil ";
}

dNumAux = dNumero % 1000;
sResultado += Numeros (dNumAux, 1);


//Enseguida verificamos si contiene punto, si es así, los convertimos a texto.
sAux = dNumero.ToString();

if (sAux.IndexOf(".") >= 0)
sResultado += ObtenerDecimales (sAux);

//Las siguientes líneas convierten el primer caracter a mayúscula.
sAux = sResultado;
x = char.ToUpper (sResultado[1]);
sResultado = x.ToString ();

for (int i = 2; i= 100){
dNumero = dCociente / 100;
sNumero = dNumero.ToString();
iNumero = int.Parse (sNumero[0].ToString());
sTexto += this.sCentenas [iNumero] + " ";
}

dCociente = dCociente % 100;
if (dCociente >= 30){
dNumero = dCociente / 10;
sNumero = dNumero.ToString();
iNumero = int.Parse (sNumero[0].ToString());
if (iNumero > 0)
sTexto += this.sDecenas [iNumero] + " ";

dNumero = dCociente % 10;
sNumero = dNumero.ToString();
iNumero = int.Parse (sNumero[0].ToString());
if (iNumero > 0)
sTexto += "y " + this.sUnidades [iNumero] + " ";
}

else {
dNumero = dCociente;
sNumero = dNumero.ToString();
if (sNumero.Length > 1)
if (sNumero[1] != '.')
iNumero = int.Parse (sNumero[0].ToString() + sNumero[1].ToString());
else
iNumero = int.Parse (sNumero[0].ToString());
else
iNumero = int.Parse (sNumero[0].ToString());
sTexto += this.sUnidades[iNumero] + " ";
}

return sTexto;
}

private string ObtenerDecimales (string sNumero) {
string[] sNumPuntos;
string sTexto = "";
double dNumero = 0;

sNumPuntos = sNumero.Split('.');

dNumero = Convert.ToDouble(sNumPuntos[1]);
sTexto = "peso "+dNumero.ToString().Trim()+"/100 M.N.";
//sTexto = "peso con " + Numeros(dNumero,1);

return sTexto;
}

miércoles, 23 de mayo de 2007

Busqueda de Productos en Caja

Creacion de treeview

void crea_treeview_busqueda()
{
treeViewEngineBusca2 = new TreeStore(typeof(string),
typeof(string),
typeof(string),
typeof(string),
typeof(string),
typeof(string),
typeof(string),
typeof(string),
typeof(string),
typeof(string),
typeof(string),
typeof(string),
typeof(string),
typeof(string),
typeof(string),
typeof(string),
typeof(string),
typeof(string),
typeof(string),
typeof(bool),
typeof(bool),
typeof(bool));
lista_de_producto.Model = treeViewEngineBusca2;

lista_de_producto.RulesHint = true;

lista_de_producto.RowActivated += on_selecciona_producto_clicked; // Doble click selecciono producto*/

TreeViewColumn col_idproducto = new TreeViewColumn();
CellRendererText cellr0 = new CellRendererText();
col_idproducto.Title = "ID Producto"; // titulo de la cabecera de la columna, si está visible
col_idproducto.PackStart(cellr0, true);
col_idproducto.AddAttribute (cellr0, "text", 0); // la siguiente columna será 1 en vez de 1
col_idproducto.SortColumnId = (int) Column_prod.col_idproducto;

TreeViewColumn col_desc_producto = new TreeViewColumn();
CellRendererText cellr1 = new CellRendererText();
col_desc_producto.Title = "Descripcion de Producto"; // titulo de la cabecera de la columna, si está visible
col_desc_producto.PackStart(cellr1, true);
col_desc_producto.AddAttribute (cellr1, "text", 1); // la siguiente columna será 1 en vez de 1
col_desc_producto.SortColumnId = (int) Column_prod.col_desc_producto;
//cellr0.Editable = true; // Permite edita este campo

TreeViewColumn col_precioprod = new TreeViewColumn();
CellRendererText cellrt2 = new CellRendererText();
col_precioprod.Title = "Precio Producto";
col_precioprod.PackStart(cellrt2, true);
col_precioprod.AddAttribute (cellrt2, "text", 2); // la siguiente columna será 1 en vez de 2
col_precioprod.SortColumnId = (int) Column_prod.col_precioprod;

TreeViewColumn col_ivaprod = new TreeViewColumn();
CellRendererText cellrt3 = new CellRendererText();
col_ivaprod.Title = "I.V.A.";
col_ivaprod.PackStart(cellrt3, true);
col_ivaprod.AddAttribute (cellrt3, "text", 3); // la siguiente columna será 2 en vez de 3
col_ivaprod.SortColumnId = (int) Column_prod.col_ivaprod;

TreeViewColumn col_totalprod = new TreeViewColumn();
CellRendererText cellrt4 = new CellRendererText();
col_totalprod.Title = "Total";
col_totalprod.PackStart(cellrt4, true);
col_totalprod.AddAttribute (cellrt4, "text", 4); // la siguiente columna será 3 en vez de 4
col_totalprod.SortColumnId = (int) Column_prod.col_totalprod;

TreeViewColumn col_descuentoprod = new TreeViewColumn();
CellRendererText cellrt5 = new CellRendererText();
col_descuentoprod.Title = "% Descuento";
col_descuentoprod.PackStart(cellrt5, true);
col_descuentoprod.AddAttribute (cellrt5, "text", 5); // la siguiente columna será 5 en vez de 6
col_descuentoprod.SortColumnId = (int) Column_prod.col_descuentoprod;

TreeViewColumn col_preciocondesc = new TreeViewColumn();
CellRendererText cellrt6 = new CellRendererText();
col_preciocondesc.Title = "Precio con Desc.";
col_preciocondesc.PackStart(cellrt6, true);
col_preciocondesc.AddAttribute (cellrt6, "text", 6); // la siguiente columna será 6 en vez de 7
col_preciocondesc.SortColumnId = (int) Column_prod.col_preciocondesc;

TreeViewColumn col_grupoprod = new TreeViewColumn();
CellRendererText cellrt7 = new CellRendererText();
col_grupoprod.Title = "Grupo Producto";
col_grupoprod.PackStart(cellrt7, true);
col_grupoprod.AddAttribute (cellrt7, "text", 7); // la siguiente columna será 7 en vez de 8
col_grupoprod.SortColumnId = (int) Column_prod.col_grupoprod;

TreeViewColumn col_grupo1prod = new TreeViewColumn();
CellRendererText cellrt8 = new CellRendererText();
col_grupo1prod.Title = "Grupo1 Producto";
col_grupo1prod.PackStart(cellrt8, true);
col_grupo1prod.AddAttribute (cellrt8, "text", 8); // la siguiente columna será 9 en vez de
col_grupo1prod.SortColumnId = (int) Column_prod.col_grupo1prod;

TreeViewColumn col_grupo2prod = new TreeViewColumn();
CellRendererText cellrt9 = new CellRendererText();
col_grupo2prod.Title = "Grupo2 Producto";
col_grupo2prod.PackStart(cellrt9, true);
col_grupo2prod.AddAttribute (cellrt9, "text", 9); // la siguiente columna será 10 en vez de 9
col_grupo2prod.SortColumnId = (int) Column_prod.col_grupo2prod;

lista_de_producto.AppendColumn(col_idproducto); // 0
lista_de_producto.AppendColumn(col_desc_producto); // 1
lista_de_producto.AppendColumn(col_precioprod); //2
lista_de_producto.AppendColumn(col_ivaprod); // 3
lista_de_producto.AppendColumn(col_totalprod); // 4
lista_de_producto.AppendColumn(col_descuentoprod); //5
lista_de_producto.AppendColumn(col_preciocondesc); // 6
lista_de_producto.AppendColumn(col_grupoprod); //7
lista_de_producto.AppendColumn(col_grupo1prod); //8
lista_de_producto.AppendColumn(col_grupo2prod); //9

}

Pantalla de Caja

martes, 17 de abril de 2007

Pantalla de Internamiento


Esta es la pantalla de Internamiento

Esta es la Pantalla de Registro de Paciente

jueves, 18 de enero de 2007

Ya voy a publicar el modulo de admision y registro con sus respectivas pantallas