¡Bien!, he terminado mi proyecto pero seguirá en desarrollo, les comparto mi código fuente y algunas capturas de pantalla:
--Reaksoft Corporation (C) 2009 - 2013
--Locsoft (C) 2013
--Sistema para Neuron Lap's y PC
--Código Fuente en LUA para Autoplay Media Studio
--Página principal: OnShow
Window.SetSize(Application.GetWndHandle(), 510,520);
--Página principal: Botón 1: OnClic
Page.Jump("Page2");
--Botón 2: OnClic
Page.Jump("Page3");
--Label2: OnClic
Window.SetSize(Application.GetWndHandle(), 1000,530);
--Label3: OnClic
Window.SetSize(Application.GetWndHandle(), 510,530);
--Página de creación de nuevas ordenes de servicio: OnPreload
dId = "Fin de orden";
--Página de creación de nuevas ordenes de servicio: OnShow
local a;
for a=1, 10, 1 do
Input.SetText("Input"..a,"");
end
Window.SetSize(Application.GetWndHandle(), 720, 710);
Fecha = System.GetDate(DATE_FMT_US);
Input.SetText("Input1",Fecha);
--Botón: "Menú principal"
result = Dialog.Message("Ordenes de servicio", "¿Desea ir al Menú Principal?, se perderá cualquier orden no guardada.", MB_YESNO, MB_ICONQUESTION, MB_DEFBUTTON1);
if (result == 6) then
Page.Jump("Page1");
end
--Botón: "Guardar orden"
NuOr = Input.GetText("Input11");
local a;
aCont = true;
tbDataToSave = {};
for a=1, 11, 1 do
allInput=Input.GetText("Input"..a);
if (allInput == "") then
aCont=false;
end
end
if not (aCont) then
Dialog.Message("Guardar nueva orden", "No hay suficiente información para continuar, revise que el formulario este completo.", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);
Application.ExitScript();
else
Gdr=Dialog.FileBrowse(false, "Guardar orden de servicio", Shell.GetFolder(SHF_DESKTOP), "Archivos de Texto (*.txt)|*.txt|", NuOr , ".txt", false, false);
if (Gdr[1] ~= "CANCEL") and (Gdr[1] ~="") then
for a=1, 11, 1 do
Table.Insert(tbDataToSave, a, Input.GetText("Input"..a));
end
end
Dialog.Message("Guardar nueva orden", "Orden guardada correctamente.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
TextFile.WriteFromTable(Gdr[1], tbDataToSave, false);
TextFile.WriteFromString(Gdr[1], String.Replace(TextFile.ReadToString(Gdr[1]), TextFile.ReadToString(Gdr[1]), TextFile.ReadToString(Gdr[1]).."\r\n".. dId, true), false);
if (Application.GetLastError() ==0) then
for a=1, 11, 1 do
Input.SetText("Input"..a,"");
end
Fecha = System.GetDate(DATE_FMT_US);
Input.SetText("Input1",Fecha);
Input.SetText("Input11","Número de la nueva orden de servicio");
Page.SetFocus("Input11");
else
Dialog.Message("Guardar nueva orden", "Hubo un error al crear orden, intentalo de nuevo.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end
end
--Botón: "Nueva Orden"
result = Dialog.Message("Nueva orden de servicio", "Se eliminarán todos los datos del formulario, ¿desea continuar?", MB_YESNO, MB_ICONQUESTION, MB_DEFBUTTON1);
if (result == 6) then
local a;
for a=1, 10, 1 do
Input.SetText("Input"..a,"");
end
Fecha = System.GetDate(DATE_FMT_US);
Input.SetText("Input1",Fecha);
Input.SetText("Input11","Número de la nueva orden de servicio");
Page.SetFocus("Input11");
end
--Botón: "Abrir Orden"
tbDataToGet = {};
tbRestL={};
nCL = 0;
Abr=Dialog.FileBrowse(true, "Abrir orden de servicio", Shell.GetFolder(SHF_DESKTOP), "(*.txt)|*.txt|","",".txt",false,false);
if (Abr[1] ~="CANCEL") and (Abr[1] ~="")then
if (String.Find(TextFile.ReadToString(Abr[1]), "\r\n"..dId, 1, true) == -1) then
Dialog.Message("Abrir orden de servicio", "Archivo no válido.\r\n\r\nEste archivo no fue creado a base de este sistema. \r\n\r\nSelecciona un archivo válido e intentalo nuevamente.", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);
Application.ExitScript();
else
TextFile.WriteFromString(Abr[1], String.Replace(TextFile.ReadToString(Abr[1]), "\r\n"..dId, "", true), false);
end
tbDataGet = TextFile.ReadToTable(Abr[1]);
Line = "";
for nLine, sData in pairs (tbDataGet) do
if (nLine == 1) then
Input.SetText("Input1", sData);
end
if (nLine == 2) then
Input.SetText("Input2", sData);
end
if (nLine == 3) then
Input.SetText("Input3", sData);
end
if (nLine == 4) then
Input.SetText("Input4", sData);
end
if (nLine == 5) then
Input.SetText("Input5", sData);
end
if (nLine == 6) then
Input.SetText("Input6", sData);
end
if (nLine == 7) then
Input.SetText("Input7", sData);
end
if (nLine == 8) then
Input.SetText("Input8", sData);
end
if (nLine == 9) then
Input.SetText("Input9", sData);
end
if (nLine == 10) then
Input.SetText("Input10", sData);
end
if (nLine == 11) then
Input.SetText("Input11", sData);
end
TextFile.WriteFromString(Abr[1], String.Replace(TextFile.ReadToString(Abr[1]), TextFile.ReadToString(Abr[1]), TextFile.ReadToString(Abr[1]).."\r\n"..dId, true), true);
end
end
--Botón: "Menú Principal"
result = Dialog.Message("Ordenes de servicio", "¿Desea ir al Menú Principal?, se perderá cualquier orden no guardada.", MB_YESNO, MB_ICONQUESTION, MB_DEFBUTTON1);
if (result == 6) then
Page.Jump("Page1");
end
--Página 3 "Prestamos a locatarios"
--OnShow de la misma página
local a;
for a=1, 10, 1 do
Input.SetText("Input"..a,"");
end
Window.SetSize(Application.GetWndHandle(), 720, 610);
Fecha = System.GetDate(DATE_FMT_US);
Input.SetText("Input1",Fecha);
--OnPreload de la misma página
dId = "Fin de registro de préstamo para locatario";
--Botón "Guardar registro"
local a;
aCont = true;
tbDataToSave = {};
for a=1, 10, 1 do
allInput=Input.GetText("Input"..a);
if (allInput == "") then
aCont=false;
end
end
if not (aCont) then
Dialog.Message("Guardar nuevo registro de préstamo a locatario", "No hay suficiente información para continuar, revise que el formulario este completo.", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);
Application.ExitScript();
else
Gdr=Dialog.FileBrowse(false, "Guardar registro", Shell.GetFolder(SHF_DESKTOP), "Archivos de Texto (*.txt)|*.txt|", "Número de registro" , ".txt", false, false);
if (Gdr[1] ~= "CANCEL") and (Gdr[1] ~="") then
for a=1, 10, 1 do
Table.Insert(tbDataToSave, a, Input.GetText("Input"..a));
end
end
Dialog.Message("Guardar nuevo registro", "Préstamo guardado correctamente.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
TextFile.WriteFromTable(Gdr[1], tbDataToSave, false);
TextFile.WriteFromString(Gdr[1], String.Replace(TextFile.ReadToString(Gdr[1]), TextFile.ReadToString(Gdr[1]), TextFile.ReadToString(Gdr[1]).."\r\n".. dId, true), false);
if (Application.GetLastError() ==0) then
for a=1, 10, 1 do
Input.SetText("Input"..a,"");
end
Fecha = System.GetDate(DATE_FMT_US);
Input.SetText("Input1",Fecha);
Page.SetFocus("Input1");
else
Dialog.Message("Guardar nuevo registro", "Hubo un error al crear el registro, intentalo de nuevo.", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);
end
end
--Botón: "Nuevo registro"
result = Dialog.Message("Nuevo registro de préstamo a locatario", "Se eliminarán todos los datos del formulario, ¿desea continuar?", MB_YESNO, MB_ICONQUESTION, MB_DEFBUTTON1);
if (result == 6) then
local a;
for a=1, 10, 1 do
Input.SetText("Input"..a,"");
end
Fecha = System.GetDate(DATE_FMT_US);
Input.SetText("Input1",Fecha);
end
--Botón: "Abrir registro"
tbDataToGet = {};
tbRestL={};
nCL = 0;
Abr=Dialog.FileBrowse(true, "Abrir registro de préstamo a locaterio", Shell.GetFolder(SHF_DESKTOP), "(*.txt)|*.txt|","",".txt",false,false);
if (Abr[1] ~="CANCEL") and (Abr[1] ~="")then
if (String.Find(TextFile.ReadToString(Abr[1]), "\r\n"..dId, 1, true) == -1) then
Dialog.Message("Abrir registro", "Archivo no válido.\r\n\r\nEste archivo no fue creado a base de este sistema. \r\n\r\nSelecciona un archivo válido e intentalo nuevamente.", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);
Application.ExitScript();
else
TextFile.WriteFromString(Abr[1], String.Replace(TextFile.ReadToString(Abr[1]), "\r\n"..dId, "", true), false);
end
tbDataGet = TextFile.ReadToTable(Abr[1]);
Line = "";
for nLine, sData in pairs (tbDataGet) do
if (nLine == 1) then
Input.SetText("Input1", sData);
end
if (nLine == 2) then
Input.SetText("Input2", sData);
end
if (nLine == 3) then
Input.SetText("Input3", sData);
end
if (nLine == 4) then
Input.SetText("Input4", sData);
end
if (nLine == 5) then
Input.SetText("Input5", sData);
end
if (nLine == 6) then
Input.SetText("Input6", sData);
end
if (nLine == 7) then
Input.SetText("Input7", sData);
end
if (nLine == 8) then
Input.SetText("Input8", sData);
end
if (nLine == 9) then
Input.SetText("Input9", sData);
end
if (nLine == 10) then
Input.SetText("Input10", sData);
end
TextFile.WriteFromString(Abr[1], String.Replace(TextFile.ReadToString(Abr[1]), TextFile.ReadToString(Abr[1]), TextFile.ReadToString(Abr[1]).."\r\n"..dId, true), true);
end
end
--Botón: "Menú Principal"
result = Dialog.Message("Ordenes de servicio", "¿Desea ir al Menú Principal?, se perderá cualquier orden no guardada.", MB_YESNO, MB_ICONQUESTION, MB_DEFBUTTON1);
if (result == 6) then
Page.Jump("Page1");
end
(Sugiero que no se mueva a Dudas Solucionadas ya que presiento que varias personas van a querer aportar al código)