Puta Seguridad de la chingada

Aquí podrás hablar de cualquier tema que no tenga un sección específica.
Un Programilla hecho en ams Inventario2.0 y con el AMSUnpacker el codigo como la primera blenorragia
------------------------------------Funcion DIAS y FECHA---------------------------
function Fecha()

sDay = System.GetDate(DATE_FMT_DAYOFWEEK);
tDayName={};
tDayName[1] = "Domingo";
tDayName[2] = "Lunes";
tDayName[3] = "Martes";
tDayName[4] = "Miercoles";
tDayName[5] = "Jueves";
tDayName[6] = "Viernes";
tDayName[7] = "Sabado";

nDay = String.ToNumber(sDay); -- porque System.GetDate como resultado una cadena

if nDay ==1 then
sDayName=tDayName[1];
elseif nDay ==2 then
sDayName=tDayName[2];
elseif nDay ==3 then
sDayName=tDayName[3];
elseif nDay ==4 then
sDayName=tDayName[4];
elseif nDay ==5 then
sDayName=tDayName[5];
elseif nDay ==6 then
sDayName=tDayName[6];
elseif nDay ==7 then
sDayName=tDayName[7];
end

sDate = System.GetDate(DATE_FMT_DAY);
sMes = System.GetDate(DATE_FMT_MONTH);
sAno = System.GetDate(DATE_FMT_YEAR);
Label.SetText("Date", sDayName);
Label.SetText("dia", sDate);
Label.SetText("Mes", sMes);
Label.SetText("LblAno", sAno);
end


------------------------------------------Funcion NO---------------------------------------------------------------------
function Salir()
	
    result = Dialog.Message("¿Sistema Inventarios Punto de Ventas 2.0?", "¿Estas seguro que te gustaría salir de Soft Punto de Ventas 1.0?", MB_YESNO, MB_ICONEXCLAMATION, MB_DEFBUTTON1);

    --en el botón se ha presionado
    if result == 7 then
        --Cancelar Salir
        
    else


        --permitir la salida
        Application.Exit();
    end
end

------------------------------------------Funcion NO DialogEx---------------------------------------------------------------------
function SalirEx()
	
    result = Dialog.Message("¿Sistema Inventarios Punto de Ventas 2.0?", "¿Estas seguro que te gustaría salir de este Modulo?", MB_YESNO, MB_ICONEXCLAMATION, MB_DEFBUTTON1);

    --en el botón se ha presionado
    if result == 7 then
        --Cancelar Salir
        
    else


        --permitir la salida
        DialogEx.Close();
    end
end

------------------------------------------Funcion Anular---------------------------------------------------------------------
function SalirEx()
	
    result = Dialog.Message("¿Sistema Inventarios Punto de Ventas 2.0?", "¿Esta seguro que desea anular el procesó, si lo hace se perderá todo lo que ha digitado.?", MB_YESNO, MB_ICONEXCLAMATION, MB_DEFBUTTON1);

    --en el botón se ha presionado
    if result == 7 then
        --Cancelar Salir
        
    else


        --permitir la salida
        DialogEx.Close();
    end
end


------------------------------------------Funcion GuardarEx---------------------------------------------------------------------
function GuardarEx()
	
    result = Dialog.Message("¿Sistema Inventarios Punto de Ventas 2.0?", "¿Esta seguro que desea Guardar esta información?", MB_YESNO, MB_ICONEXCLAMATION, MB_DEFBUTTON1);

    --en el botón se ha presionado
    if result == 7 then
        --Cancelar Salir
       
    else

 DialogEx.ClickObject("BtnGuardar")
        --permitir la salida
       -- DialogEx.Close();
    end
end

---------------------------------**************Funcion Back Up****************-------------------------------------
function backup()
sBackup = Dialog.FolderBrowse("Selecciona carpeta de destino:", _DesktopFolder);
if (sBackup ~= "CANCEL") then
SQLite.Close(db);
File.Copy(_SourceFolder.."\\AutoPlay\\Docs\\Sistema.db", sBackup, true, true, false, true, nil);
error = Application.GetLastError();
if (error ~= 0) then
	Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
elseif error == 0 then
	nRecordID = 1;
	bData = System.GetDate(DATE_FMT_EUROPE);
	sPath = sBackup;
	Dialog.Message("Copia en progreso...", "Copia realiazada con exito!", MB_OK, MB_ICONEXCLAMATION);
	Backup = true;
end	
sDatabaseFile = _SourceFolder.."\\AutoPlay\\Docs\\Sistema.db";
db = SQLite.Open(sDatabaseFile);
	if Backup then
	SQLite.Query(db,"insert or replace into Backup values('".. nRecordID .."', '".. bData .."', '".. sPath .."')")
	nLastError = Application.GetLastError();
		if nLastError ~= SQLite.OK then
			Dialog.Message("Error de Apertura de Base de Datos", SQLite.GetLastErrorString());
		end
	end
end
end

-----------------------------------------------------*****Funcion Restaurar Back Up**********************************---------------------
function Restaurar()
tInfo_Backup = SQLite.QueryToTable(db, "Select * from Backup");
if tInfo_Backup and tInfo_Backup.Rows > 0 then-- si rows es mayor de 0 es que hay datos guardados en backup, por lo tanto los obtenemos.
	sDate =tInfo_Backup.Data[1]["Data"];
	sPath =tInfo_Backup.Data[1]["Path"];
	
else -- Si no es mayor es que no se guardado nada ( por ser la primera vez ) , establecemos nosotros los valores
	sPath = _DesktopFolder;
	sDate = "00/00/0000";
end

--ListBoxEx.AddItem("Listado", "Fecha de creación : "..sDate.."\r\nUbicación : "..sPath, "", "", "")-- Imprimimos datos en el input
 nIndex = ListBoxEx.AddItem("Listado", "|| Fecha de creación : "..sDate.."\r\nUbicación : "..sPath, sDate, tInfo_Backup.Data[1]["Path"], "", 1, LBXITEM_HTML, 0, nil, {16316664,16764057,16316664}, nil);
   ListBoxEx.SetItemGStyle("Listado", nIndex, BACKWARD_DIAGONAL, LBXISTATE_NORMAL);
   ListBoxEx.SetItemIconSize("Listado", nIndex, 20);
 
  ListBoxEx.SetUpdate("Listado", true);
  
tRestore = Dialog.FileBrowse(true, "Selecciona el archivo db",sPath, "All Files (Sistema.db*)|Sistema.db*|", "Sistema.db", "dat", false, false);
sRestore = Table.Concat(tRestore, ";", 1, TABLE_ALL);


if sRestore ~= "CANCEL" then

SQLite.Close(db);-- Cerramos base de datos para poder copiar
 
File.Copy(sRestore, _SourceFolder.."\\AutoPlay\\Docs\\", true, true, false, true, nil);-- copiamos la bd guardada en el dir. de salida
	error = Application.GetLastError();
	if (error ~= 0) then
		Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
	elseif error == 0 then
		Dialog.Message("Restaurando en proceso...", "Restauración realizada con exito!", MB_OK, MB_ICONEXCLAMATION);
		
	end	

sDatabaseFile = _SourceFolder.."\\AutoPlay\\Docs\\Sistema.db";
db = SQLite.Open(sDatabaseFile);-- Abrimos base de Datos
nLastError = Application.GetLastError();
	if nLastError ~= SQLite.OK then
	Dialog.Message("Error de Apertura de Base de Datos", SQLite.GetLastErrorString());
	end
end
DialogEx.Close(0);
end



------------------------------------------------------
---------------	Funcion Cargar Logo		--------------
------------------------------------------------------
function Logo()
		tSeleccion = SQLite.QueryToTable(db,"SELECT RecordID FROM Configuracion");
			nLastError = Application.GetLastError();
			if nLastError ~= SQLite.OK then
				Dialog.Message("Error", SQLite.GetLastErrorString());
			end
			if nLastError == SQLite.OK then
				for nRow = 1,tSeleccion.Rows do
			    	nRecordID = tSeleccion.Data[nRow]["RecordID"];
			    
		   	
		ListBox.AddItem("ListBox2", nRecordID, nRow);
			    end
			end
			  
		result = ListBox.GetCount("ListBox2");
		if result >= 1 then
		ListBox.SelectItem("ListBox2", 1)
		
		end
end

------------------------------------------------------Funcion Factura Nueva---------------------------------------------
function Nueva_Factura()
	
    result = Dialog.Message("¿Agregar Nueva Factura?", "¿Quieres Agregar una nueva FACTURA?", MB_YESNO, MB_ICONEXCLAMATION, MB_DEFBUTTON1);

    --en el botón se ha presionado
    if result == 7 then
   DialogEx.Close();
	    else
	--permitir la salida
     
        
	bNewRecord = true;
	DialogEx.Show("Factura Auto")
	Label.SetText("RecordID", "")
	Input.SetText("InpCliente", "");
	ComboBox.ResetContent("ComboCliente");
	Input.SetText("InpPrecio", "");
	Input.SetText("InpDireccion", "");
	Label.SetText("LblFecha", "");
	Label.SetText("LblHora", "");
	
	ComboBox.ResetContent("InpArticulo1");
	ComboBox.ResetContent("InpArticulo2");
	ComboBox.ResetContent("InpArticulo3");
	ComboBox.ResetContent("InpArticulo4");
	ComboBox.ResetContent("InpArticulo5");
	ComboBox.ResetContent("InpArticulo6");
	ComboBox.ResetContent("InpArticulo7");
	ComboBox.ResetContent("InpArticulo8");
	ComboBox.ResetContent("InpArticulo9");
	ComboBox.ResetContent("InpArticulo10");
	
	ComboBox.ResetContent("ComboModelo1");
	ComboBox.ResetContent("ComboModelo2");
	ComboBox.ResetContent("ComboModelo3");
	ComboBox.ResetContent("ComboModelo4");
	ComboBox.ResetContent("ComboModelo5");
	ComboBox.ResetContent("ComboModelo6");
	ComboBox.ResetContent("ComboModelo7");
	ComboBox.ResetContent("ComboModelo8");
	ComboBox.ResetContent("ComboModelo9");
	ComboBox.ResetContent("ComboModelo10");
	
	Input.SetText("InpUnidad1", "");
	Input.SetText("InpUnidad2", "");
	Input.SetText("InpUnidad3", "");
	Input.SetText("InpUnidad4", "");
	Input.SetText("InpUnidad5", "");
	Input.SetText("InpUnidad6", "");
	Input.SetText("InpUnidad7", "");
	Input.SetText("InpUnidad8", "");
	Input.SetText("InpUnidad9", "");
	Input.SetText("InpUnidad10", "");
	ComboBox.ResetContent("InpDescripcion1");
	ComboBox.ResetContent("InpDescripcion2");
	ComboBox.ResetContent("InpDescripcion3");
	ComboBox.ResetContent("InpDescripcion4");
	ComboBox.ResetContent("InpDescripcion5");
	ComboBox.ResetContent("InpDescripcion6");
	ComboBox.ResetContent("InpDescripcion7");
	ComboBox.ResetContent("InpDescripcion8");
	ComboBox.ResetContent("InpDescripcion9");
	ComboBox.ResetContent("InpDescripcion10");
	Input.SetText("ComboPrecio1", "0");
	Input.SetText("ComboPrecio2", "0");
	Input.SetText("ComboPrecio3", "0");
	Input.SetText("ComboPrecio4", "0");
	Input.SetText("ComboPrecio5", "0");
	Input.SetText("ComboPrecio6", "0");
	Input.SetText("ComboPrecio7", "0");
	Input.SetText("ComboPrecio8", "0");
	Input.SetText("ComboPrecio9", "0");
	Input.SetText("ComboPrecio10", "0");
	Input.SetText("InpImpuesto", "");
	Input.SetText("InpTotal", "");
	Input.SetText("InpObservacion", "");
	Input.SetText("InpImporte1", "0");
	Input.SetText("InpImporte2", "0");
	Input.SetText("InpImporte3", "0");
	Input.SetText("InpImporte4", "0");
	Input.SetText("InpImporte5", "0");
	Input.SetText("InpImporte6", "0");
	Input.SetText("InpImporte7", "0");
	Input.SetText("InpImporte8", "0");
	Input.SetText("InpImporte9", "0");
	Input.SetText("InpImporte10", "0");
	Input.SetText("InpObservacion", "");
	Input.SetText("InpExistencia1", "");
	Input.SetText("InpExistencia2", "");
	Input.SetText("InpExistencia3", "");
	Input.SetText("InpExistencia4", "");
	Input.SetText("InpExistencia5", "");
	Input.SetText("InpExistencia6", "");
	Input.SetText("InpExistencia7", "");
	Input.SetText("InpExistencia8", "");
	Input.SetText("InpExistencia9", "");
	Input.SetText("InpExistencia10", "");
	CheckBox.SetChecked("CheckTipoCuenta", true);
	Input.SetText("InpGarantia", "");
	ComboBox.SetText("ComboDLH", "");
	ComboBox.SetText("ComboDLH2", "");
	ComboBox.SetText("ComboDLH3", "");
	ComboBox.SetText("ComboDLH4", "");
	ComboBox.SetText("ComboDLH5", "");
	ComboBox.SetText("ComboDLH6", "");
	ComboBox.SetText("ComboDLH7", "");
	ComboBox.SetText("ComboDLH8", "");
	ComboBox.SetText("ComboDLH9", "");
	ComboBox.SetText("ComboDLH10", "");
	
	
	Input.SetText("InpCodigo1", "");
	Input.SetText("InpCodigo2", "");
	Input.SetText("InpCodigo3", "");
	Input.SetText("InpCodigo4", "");
	Input.SetText("InpCodigo5", "");
	Input.SetText("InpCodigo6", "");
	Input.SetText("InpCodigo7", "");
	Input.SetText("InpCodigo8", "");
	Input.SetText("InpCodigo9", "");
	Input.SetText("InpCodigo10", "");
	ListBoxEx.DeleteAllItems("Listado")
----------------------------------------------------------

--Obtener la fecha 
sFecha = System.GetDate(DATE_FMT_EUROPE);
Label.SetText("LblFecha", sFecha)

sHora = System.GetTime(TIME_FMT_AMPM);
Label.SetText("LblHora", sHora)



Fecha()

---------------------------------------

tSeleccion = SQLite.QueryToTable(db,"SELECT * FROM FacturasAutos Order By RecordID ASC");--DESC
	nLastError = Application.GetLastError();
	if nLastError ~= SQLite.OK then
		Dialog.Message("Error", SQLite.GetLastErrorString());
	end
	if nLastError == SQLite.OK then
		for nRow = 1,tSeleccion.Rows do
	    	nRecordID = tSeleccion.Data[nRow]["RecordID"];
			sCliente = tSeleccion.Data[nRow]["Cliente"];
		
			
  nIndex = ListBoxEx.AddItem("Listado", "<b>"..nRecordID.."</b>".." - ".. "<b><i>"..sCliente.."</i></b>", sCliente, nRow, "", 1, LBXITEM_HTML, 0, nil, {16316664,16764057,16316664}, nil);
   ListBoxEx.SetItemGStyle("Listado", nIndex, BACKWARD_DIAGONAL, LBXISTATE_NORMAL);
   ListBoxEx.SetItemIconSize("Listado", nIndex, 15);
 
  ListBoxEx.SetUpdate("Listado", true);

	    end
	end
    end
    
end


------------------------------------------Funcion Productos---------------------------------------------------------------------
function Productos()
	
    result = Dialog.Message("¿Datos del Proveedor?", "¿Este Producto ya esta registrado Quieres cargar los datos?", MB_YESNO, MB_ICONEXCLAMATION, MB_DEFBUTTON1);

    --en el botón se ha presionado
    if result == 7 then
        --Dialog.TimedMessage("Alerta", "Este Proveedor ya esta Registrado", 3000, MB_ICONINFORMATION)
        
    else


        --permitir la salida
sSearch = Input.GetText("InpNombre");
if sSearch ~= "" then
	tblRS = SQLite.QueryToTable(db, "Select * from AltasPoductos where (Codigo LIKE '%"..Input.GetText("InpNombre").."%')")
	nLastError = Application.GetLastError();
	if nLastError ~= SQLite.OK then
		Dialog.Message("Error", SQLite.GetLastErrorString());
	end
	 
			if nLastError == SQLite.OK then
			for nRow = 1,tblRS.Rows do
				nRecordID = tblRS.Data[nRow]["RecordID"];
				sCodigo = tblRS.Data[nRow]["Codigo"];
				sCodFabricante = tblRS.Data[nRow]["CodFabricante"];
	sRubro = tblRS.Data[nRow]["Rubro"]
	sProveedor = tblRS.Data[nRow]["Proveedor"];
	sDescripcion = tblRS.Data[nRow]["Descripcion"];
	sArticuloOferta = tblRS.Data[nRow]["ArticuloOferta"]
	sArticuloActivo = tblRS.Data[nRow]["ArticuloActivo"];
	sArticuloFactura = tblRS.Data[nRow]["ArticuloFactura"];
	sCostoBruto = tblRS.Data[nRow]["CostoBruto"];
	sExistencia = tblRS.Data[nRow]["Existencia"];

	sPrecio1 = tblRS.Data[nRow]["Precio1"];
	sPrecio2 = tblRS.Data[nRow]["Precio2"];
	sPrecio3 = tblRS.Data[nRow]["Precio3"]
	sPrecio4 = tblRS.Data[nRow]["Precio4"];
	sPrecio5 = tblRS.Data[nRow]["Precio5"];
	sPrecio6 = tblRS.Data[nRow]["Precio6"]
	sPrecio7 = tblRS.Data[nRow]["Precio7"];
	sPrecio8 = tblRS.Data[nRow]["Precio8"];
	sPrecio9 = tblRS.Data[nRow]["Precio9"];
	sPrecio10 = tblRS.Data[nRow]["Precio10"];
	
	
	
				
				

	
	
				
		StatusDlg.Show(MB_ICONNONE, false);
		StatusDlg.SetMeterRange(1, 50);
		
		StatusDlg.SetMeterPos(1);
		StatusDlg.SetTitle("Refrescar la Busqueda por Nombre");
		StatusDlg.SetMeterRange(1, nCount);
	    	--*******************************************************      y el RecordID
	Input.SetText("InpNombre", sCodigo);
	Input.SetText("InpCodFabricante", sCodFabricante);
	Input.SetText("InpRubro", sRubro);
	ComboBox.SetText("ComboProveedor", sProveedor);
	Input.SetText("InpDescripcion", sDescripcion);
	if sArticuloOferta == true then
		CheckBox.SetChecked("CheckOferta", true);
	else
		CheckBox.SetChecked("CheckOferta", false);
	end
	
	if sArticuloActivo == true then
		CheckBox.SetChecked("CheckActivo", true);
	else
		CheckBox.SetChecked("CheckActivo", false);
	end
	
	if sArticuloFactura == true then
		CheckBox.SetChecked("CheckFactura", true);
	else
		CheckBox.SetChecked("CheckFactura", false);
	end
	
	Input.SetText("InpCostoBruto", sCostoBruto);
	Input.SetText("InpExistencia", sExistencia);
	
	Input.SetText("InpPrecio1", sPrecio1);
	Input.SetText("InpPrecio2", sPrecio2);
	Input.SetText("InpPrecio3", sPrecio3);
	Input.SetText("InpPrecio4", sPrecio4);
	Input.SetText("InpPrecio5", sPrecio5);
	Input.SetText("InpPrecio6", sPrecio6);
	Input.SetText("InpPrecio7", sPrecio7);
	Input.SetText("InpPrecio8", sPrecio8);
	Input.SetText("InpPrecio9", sPrecio9);
	Input.SetText("InpPrecio10", sPrecio10);
							  
	  	   	
	  	   	end
	      end
	     StatusDlg.Hide();
	     else 
	    

	   end         	



	
    end
end


------------------------------------------Funcion Proveedores---------------------------------------------------------------------
function Proveedores()
	
    result = Dialog.Message("¿Datos del Proveedor?", "¿Este Proveedor ya esta registrado Quieres cargar los datos?", MB_YESNO, MB_ICONEXCLAMATION, MB_DEFBUTTON1);

    --en el botón se ha presionado
    if result == 7 then
        --Dialog.TimedMessage("Alerta", "Este Proveedor ya esta Registrado", 3000, MB_ICONINFORMATION)
        
    else


        --permitir la salida
sSearch = Input.GetText("InpNombre");
if sSearch ~= "" then
	tblRS = SQLite.QueryToTable(db, "Select * from Proveedores where (Codigo LIKE '%"..Input.GetText("InpNombre").."%')")
	nLastError = Application.GetLastError();
	if nLastError ~= SQLite.OK then
		Dialog.Message("Error", SQLite.GetLastErrorString());
	end
	 
			if nLastError == SQLite.OK then
			for nRow = 1,tblRS.Rows do
				nRecordID = tblRS.Data[nRow]["RecordID"];
				sCodigo = tblRS.Data[nRow]["Codigo"];
				sRazonSocial = tblRS.Data[nRow]["RazonSocial"];
				sNombreFantasia = tblRS.Data[nRow]["NombreFantasia"]
				sContacto = tblRS.Data[nRow]["Contacto"];
				sDomicilio = tblRS.Data[nRow]["Domicilio"];
				sLocalidad = tblRS.Data[nRow]["Localidad"]
				sCodigoPostal = tblRS.Data[nRow]["CodigoPostal"];
				sProvincia = tblRS.Data[nRow]["Provincia"];
				sTelefono = tblRS.Data[nRow]["Telefono"];
				sFax = tblRS.Data[nRow]["Fax"];
				sEMail = tblRS.Data[nRow]["EMail"];
				sIncluirenPrecios = tblRS.Data[nRow]["IncluirenPrecios"];
				
				

	
	
				
		StatusDlg.Show(MB_ICONNONE, false);
		StatusDlg.SetMeterRange(1, 50);
		
		StatusDlg.SetMeterPos(1);
		StatusDlg.SetTitle("Refrescar la Busqueda por Nombre");
		StatusDlg.SetMeterRange(1, nCount);
	    	--*******************************************************      y el RecordID
								Input.SetText("InpNombre", sCodigo);
								Input.SetText("InpRazonSocial", sRazonSocial);
								Input.SetText("InpNombre", sNombreFantasia);
								Input.SetText("InpContacto", sContacto);
								Input.SetText("InpDomicilio", sDomicilio);
								Input.SetText("InpEdad", sLocalidad);
								Input.SetText("InpCodigoPostal", sCodigoPostal);
								Input.SetText("InpProvincia", sProvincia);
								Input.SetText("InpTelefono", sTelefono);
								Input.SetText("InpIdentidad", sFax);
								Input.SetText("InpEMail", sEMail);
								if sIncluirenPrecios == "true" then
									CheckBox.SetChecked("CheckIncluirenPrecios", true);
								else
									CheckBox.SetChecked("CheckIncluirenPrecios", false);
								end
							  
	  	   	
	  	   	end
	      end
	     StatusDlg.Hide();
	     else 
	    

	   end         	



	
    end
end

-------------------------Funcion para Consulta en Grid-----------------------------------------
function BindGrid(dbHandle, sGridName, sQuery)
	bLoadingData = true;
	--conjunto de la red para volver a dibujar NO	
	Grid.SetRedraw(sGridName, false, false)
	
	tblRS = SQLite.QueryToTable(dbHandle, sQuery)
	
	if tblRS ~= nil then
		if tblRS.Rows > 0 then
			-- Borrar columnas
			Grid.SetColumnCount(sGridName, 0);
			Grid.SetRowCount(sGridName, tblRS.Rows+1);
			--Pegar Número de columnas y información de la cabecera
			Grid.SetColumnCount(sGridName, tblRS.Columns)
			--Ocultar la columna ROWID
			Grid.SetColumnWidth(sGridName, 0, 0, false)

			Grid.SetFixedRowCount(sGridName, 1)
			for nCols=1, tblRS.Columns do
				Grid.SetCellText(sGridName, 0, nCols -1, tblRS.ColumnNames[nCols], false)
			end
			
			--******************************--
			--**  Rellenar la cuadrícula con datos **--
			--******************************--
			--establecer el número de filas
			Grid.SetRowCount(sGridName, tblRS.Rows+1)
			--caminar por las filas
			for nRows=1, tblRS.Rows do
				--a pie de las columnas
				for nCols=1, tblRS.Columns do
					--establecer el texto de la celda
					Grid.SetCellText(sGridName, nRows, nCols - 1, tblRS.Data[nRows][tblRS.ColumnNames[nCols]], false);
					--establecidos par / impar color de la fila
					if nRows/2 == Math.Floor(nRows/2) then
						tblColors={Background=16777215,Text=0};
					else
					--Color Celeste: 15720102 
						tblColors={Background=15720102,Text=0};
						 --tblColors={Background=13369343,Text=0};
						
					end
					Grid.SetCellColors(sGridName, nRows, nCols-1, tblColors, false)
				end
			end
		else
			nResult = Dialog.Message("Registro Empty Set", "La consulta no ha obtenido ningún resultado.", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1)
		end
	else
		nResult = Dialog.Message("Registro Empty Set", "La consulta no ha obtenido ningún resultado.", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1)
	end
	Grid.SetRedraw(sGridName, true, true)
	bLoadingData=false;
end

------------------------------------------------------------------------------------
------------------------------------------------------------------------------------
--#############################################
function enumerate()
 rOwCount = Grid.GetRowCount("Grid1");
	for count = 1,rOwCount do
	Grid.SetCellText("Grid1", count, 0, "00"..count, true);
	
	end
	Grid.AutoSizeColumn("Grid1", 0, GVS_DEFAULT, true, true);

end
--##################################################
function loadAnsetprops()
tTableHeader = {"Nº", "Libreta","Registro","Nombre","Apellido", "Edad", "Fecha", "Telefono", "Direccion", "Curso", "Seccion", "Modalidad", "Jornada", "Pago", "Mensualidad", "MatriPor", "Foto", "Partida", "Traslado", "Certificacion", "Acta", "Calificaciones"};
for i=0,21,1 do 
	sHeader = tTableHeader[i+1]; 
	Grid.SetCellText("Grid1", 0, i, sHeader, true);
	--Grid.AutoSizeColumn("Grid1", i, GVS_BOTH, true, true);
	Grid.ExpandColumnsToFit("Grid1", true, true);

end

enumerate()

end

--######################################################

function FindSelectedGrid(strGrid)
	
		local x= 0;
		while (x<(Grid.GetRowCount(strGrid)-1)) do -- minus 1 for the header - Remove if no header
			x = x+1;
			 for count = 1,21 do
				if (Grid.IsCellSelected(strGrid, x, count))== true then
				  
					return x;
				end
			end
		end
end
------------------------Exportal a Excel--------------------------------------

require("luacom")
oConnection, oRecordSet = nil, nil
ADODB = {
	Trim = function (s) return String.TrimLeft(String.TrimRight(s)); end,
	Open = function(sConnect)
		oConnection = luacom.CreateObject("ADODB.Connection");
		if oConnection ~= nil then
			oConnection.ConnectionString = sConnect;
			oConnection:Open();
		end
	end,
	Close = function ()
		if oConnection then oConnection:Close(); oConnection = nil; end
		if oRecordSet then oRecordSet = nil; end
		collectgarbage();
	end,
	Exec = function(sStatement)
		if oConnection then
			if sStatement == "%BEGIN" then oConnection:BeginTrans(); return
			elseif sStatement == "%COMMIT" then oConnection:CommitTrans(); return
			elseif sStatement == "%ROLLBACK" then oConnection:RollbackTrans(); return
			end
			if not oRecordSet then oRecordSet = luacom.CreateObject("ADODB.RecordSet");
			elseif oRecordSet.State ~= 0 then oRecordSet:Close();
			end
			oRecordSet:Open(sStatement, oConnection);
		end
	end,
	GetRows = function ()
		if not oRecordSet then return nil; end
		local tRows = {};
		while not oRecordSet.EOF do
			nRow = #tRows + 1;
			tRows[nRow] = {};
			for i = 1, oRecordSet.Fields.Count do
				tRows[nRow][i] = ADODB.Trim(oRecordSet.Fields:Item(i - 1).Value);
			end
			oRecordSet:MoveNext();
		end
		return (#tRows > 0) and tRows or nil;
	end
};

------------------------Final Exportal a Excel--------------------------------




-------------------------------Funcion Buscar en Grid---------------------------

-----------------------------------------------------------------------------
function FindCellText(strGrid,strText,nColour)
	function ResetCellColor()
	
		iColumnCount = Grid.GetColumnCount(strGrid);
		iRowCount = Grid.GetRowCount(strGrid);

		for iThisRow = 0, iRowCount do
	
		
			for iThisColumn = 0, iColumnCount do
		
				if cEllColor then
				Grid.SetCellColors(strGrid, iThisRow, iThisColumn, {Background=cEllColor.Background,Text=cEllColor.Text}, false);
				
		    	end
			end
				
		end

 	end
	function MakeCellColour(iCellColumn, iCellRow)
     
	Grid.SetCellColors(strGrid, iCellRow, iCellColumn, {Background=nColour,Text=0}, true);
	
	end
ResetCellColor()
Grid.Refresh(strGrid);

str_String2Find = strText;

 if (str_String2Find ~= "") then
	iColumnCount = Grid.GetColumnCount(strGrid);

	iRowCount = Grid.GetRowCount(strGrid);

	for iThisRow = 0, iRowCount do

	
		for iThisColumn = 0, iColumnCount do
			
			str_ThisCellText = Grid.GetCellText(strGrid, iThisRow, iThisColumn);
				
				iFoundAt = String.Find(str_ThisCellText, str_String2Find, 1, false);
		
				if iFoundAt ~= -1 then

		        cEllColor = Grid.GetCellColors(strGrid, iThisRow, iThisColumn);
				
				MakeCellColour(iThisColumn, iThisRow)
				
			    end
	 	       
	 	 end

 	end
 else

 end

end
_PageFirstAutoPlay\Audio\High1.oggAutoPlay\Audio\Click1.ogg
Pues qué te puedo decir :tableflip-1414031937: :shrug-1414032234: Imagen
que cosas la de la seguridad de AMS se parece mucho a mi código el que te mande los demos por correo.

el único detalle que tomara tiempo es re construir el proyecto la parte gráfica pero el código se obtiene por completo.