Просмотр исходного кода

Added another sample/test for FLTK module.

mingodad 13 лет назад
Родитель
Сommit
70f426b10d
3 измененных файлов с 1599 добавлено и 0 удалено
  1. 524 0
      SquiLu-ourbiz/pedidos2-gui.fl
  2. 710 0
      SquiLu-ourbiz/pedidos2-gui.nut
  3. 365 0
      SquiLu-ourbiz/pedidos2.nut

+ 524 - 0
SquiLu-ourbiz/pedidos2-gui.fl

@@ -0,0 +1,524 @@
+# data file for the Fltk User Interface Designer (fluid)
+version 1.0302 
+header_name {.h} 
+code_name {.cxx}
+widget_class PedidosWindow {
+  label Pedidos open
+  xywh {74 62 800 560} type Double labelsize 16 resizable
+  class Base_Window visible
+} {
+  Fl_Menu_Bar menu_bar {open
+    xywh {0 0 800 25} labelsize 16 textsize 16
+  } {
+    Submenu menu_pedido {
+      label {&Pedido (F2)}
+      callback {on_menu_pedido_cb(self)} open
+      xywh {15 15 77 25} labelsize 16
+    } {
+      MenuItem menu_pedido_nuevo {
+        label {Crear un nuevo Pedido}
+        xywh {15 15 37 25} shortcut 0x4006e labelsize 16
+      }
+      MenuItem menu_pedido_guardar {
+        label {Guardar el Pedido}
+        xywh {15 15 37 25} labelsize 16 deactivate
+      }
+      MenuItem menu_pedido_borrar {
+        label {Borrar el  Pedido}
+        xywh {15 15 37 25} labelsize 16 deactivate divider
+      }
+      MenuItem menu_pedido_imprimir {
+        label {Imprimir el Pedido}
+        xywh {15 15 37 25} labelsize 16 deactivate
+      }
+    }
+    Submenu menu_pedidos {
+      label {Pedidos (F3)} open
+      xywh {0 0 77 25} labelsize 16
+    } {
+      MenuItem menu_pedidos_mostrar_existentes {
+        label {Listado de Pedidos existentes}
+        xywh {0 0 37 25} labelsize 16
+      }
+      MenuItem menu_pedidos_modificar_existente {
+        label {Modificar el Pedido selecionado}
+        xywh {0 0 37 25} labelsize 16
+      }
+      MenuItem menu_pedidos_borrar_existente {
+        label {Borrar el Pedido selecionado}
+        xywh {0 0 37 25} labelsize 16 deactivate divider
+      }
+      MenuItem menu_pedidos_imprimir_selecionados {
+        label {Imprimir los Pedidos selecionados}
+        xywh {10 10 37 25} labelsize 16
+      }
+      MenuItem menu_pedidos_imprimir_todos {
+        label {Imprimir todos pedidos aun no impresos}
+        xywh {0 0 37 25} labelsize 16
+      }
+    }
+    Submenu menu_clientes {
+      label {&Clientes (F4)} open
+      xywh {20 20 77 25} labelsize 16
+    } {
+      MenuItem menu_clientes_mostrar_existentes {
+        label {Listado de clientes existentes}
+        xywh {20 20 37 25} labelsize 16
+      }
+      MenuItem menu_clientes_nuevo {
+        label {Añadir un nuevo cliente}
+        xywh {20 20 37 25} labelsize 16
+      }
+      MenuItem menu_clientes_guardar {
+        label {Modificar un cliente existente}
+        xywh {20 20 37 25} labelsize 16 deactivate
+      }
+      MenuItem menu_clientes_borrar {
+        label {Borrar un cliente existente}
+        xywh {20 20 37 25} labelsize 16 deactivate divider
+      }
+      MenuItem menu_clientes_importar {
+        label {Importar clientes}
+        xywh {20 20 37 25} labelsize 16
+      }
+      MenuItem menu_clientes_exportar {
+        label {Exportar clientes}
+        xywh {10 10 37 25} labelsize 16
+      }
+    }
+    Submenu menu_articulos {
+      label {&Artículos (F5)} open
+      xywh {10 10 77 25} labelsize 16
+    } {
+      MenuItem menu_articulos_mostrar_existentes {
+        label {Listado de articulos existentes}
+        xywh {10 10 37 25} labelsize 16
+      }
+      MenuItem menu_articulos_nuevo {
+        label {Añadir un nuevo artículo}
+        xywh {10 10 37 25} labelsize 16
+      }
+      MenuItem menu_articulos_guardar {
+        label {Modificar un artículo existente}
+        xywh {10 10 37 25} labelsize 16 deactivate
+      }
+      MenuItem menu_articulos_borrar {
+        label {Borrar un artículo existente}
+        xywh {10 10 37 25} labelsize 16 deactivate divider
+      }
+      MenuItem menu_articulos_importar {
+        label {Importar artículos}
+        xywh {10 10 37 25} labelsize 16
+      }
+      MenuItem menu_articulos_exportar {
+        label {Exportar artículos}
+        xywh {0 0 37 25} labelsize 16
+      }
+    }
+    Submenu menu_totales {
+      label {&Totales (F6)} open
+      xywh {35 35 77 25} labelsize 16
+    } {
+      MenuItem menu_totales_mostrar_existentes {
+        label {Listado de totales existentes}
+        xywh {35 35 37 25} labelsize 16
+      }
+      MenuItem menu_articulos_imprimir {
+        label {Exportar totales}
+        xywh {25 25 37 25} labelsize 16
+      }
+    }
+    Submenu menu_opciones {
+      label {&Opciones (F9)} open
+      xywh {0 0 77 25} labelsize 16
+    } {
+      MenuItem menu_preguntar_por_impresora {
+        label {Preguntar por impresora}
+        xywh {0 0 37 25} type Toggle labelsize 16 divider
+      }
+      MenuItem menu_imprimir_papel_A4 {
+        label {Imprimir en papel A4}
+        xywh {0 0 37 25} type Radio value 1 labelsize 16
+      }
+      MenuItem menu_imprimir_papel_A5 {
+        label {Imprimir en papel A5}
+        xywh {10 10 37 25} type Radio labelsize 16 divider
+      }
+      MenuItem theme_default {
+        label {Tema por defecto}
+        xywh {0 0 37 25} type Radio value 1
+      }
+      MenuItem theme_gtk {
+        label {Tema GTK+}
+        xywh {10 10 37 25} type Radio
+      }
+      MenuItem theme_plastic {
+        label {Tema Plastico}
+        xywh {20 20 37 25} type Radio
+      }
+    }
+    MenuItem menu_salir {
+      label {&Salir}
+      xywh {0 0 37 25} shortcut 0x80073 labelsize 16
+    }
+  }
+  Fl_Tabs tabs {open
+    xywh {0 25 800 504} labeltype NO_LABEL labelsize 16 labelcolor 7 resizable
+  } {
+    Fl_Group tab_pedido {
+      label {Pedido (F2)} open selected
+      xywh {0 25 800 504} labeltype NO_LABEL labelsize 16
+    } {
+      Fl_Group grupo_pedido_cliente {
+        label {@2 Cliente @2} open
+        xywh {10 47 780 88} box ENGRAVED_BOX color 246 labelsize 16 labelcolor 66
+      } {
+        Fl_Input pedidos_cliente_codigo_r {
+          label {Código}
+          macro_name {pedidos cliente_codigo r}
+          xywh {91 59 100 28} labelsize 16 textsize 16
+          code0 {=add_input_field_to_map("$(0)", "$(1)", $(name));}
+        }
+        Fl_Output pedidos_numero_r {
+          label {Número}
+          macro_name {pedidos numero r}
+          xywh {425 59 134 28} labelsize 16 textsize 16
+          code0 {=add_input_field_to_map("$(0)", "$(1)", $(name));}
+        }
+        Fl_Output pedidos_fecha_r {
+          label Fecha
+          macro_name {pedidos fecha r}
+          xywh {646 59 134 28} labelsize 16 textsize 16
+          code0 {=add_input_field_to_map("$(0)", "$(1)", $(name));}
+        }
+        Fl_Input pedidos_cliente_nombre_r {
+          label Nombre
+          macro_name {pedidos cliente_nombre r}
+          xywh {91 97 694 28} labelsize 16 textsize 16
+          code0 {=add_input_field_to_map("$(0)", "$(1)", $(name));}
+        }
+      }
+      Fl_Browser grid_pedido_lineas {
+        label {@2 Lineas del Pedido @2}
+        xywh {10 145 780 230} type Multi box ENGRAVED_BOX color 175 labelsize 16 align 1 textsize 16 resizable
+        class Fl_Data_Table
+      }
+      Fl_Group grupo_pedido_lineas {
+        label {@2 Añadir / Editar / Borar Artículo @2} open
+        xywh {10 403 780 121} box ENGRAVED_BOX color 167 labelsize 16 labelcolor 57
+      } {
+        Fl_Input pedido_lineas_descripcion {
+          label Descripcion
+          macro_name {pedido_lineas descripcion}
+          xywh {24 430 756 28} labelsize 16 align 5 textsize 16
+          code0 {=add_input_field_to_map("$(0)", "$(1)", $(name));}
+        }
+        Fl_Input pedido_lineas_codigo_r {
+          label {Código}
+          macro_name {pedido_lineas codigo r}
+          tooltip {Para un nuevo pedido pulsar +} xywh {24 486 100 28} labelsize 16 align 5 when 1 textsize 16
+          code0 {=add_input_field_to_map("$(0)", "$(1)", $(name));}
+        }
+        Fl_Input pedido_lineas_bultos {
+          label Bultos
+          macro_name {pedido_lineas bultos}
+          xywh {134 486 90 28} type Float labelsize 16 align 5 textsize 16
+          code0 {=add_input_field_to_map("$(0)", "$(1)", $(name));}
+        }
+        Fl_Choice pedido_lineas_envase {
+          label Envase
+          macro_name {pedido_lineas envase} open
+          xywh {234 486 141 28} down_box BORDER_BOX labelsize 16 align 5 textsize 16
+          code0 {=add_input_field_to_map("$(0)", "$(1)", $(name));}
+        } {}
+        Fl_Input pedido_lineas_peso {
+          label Kilos
+          macro_name {pedido_lineas peso}
+          xywh {385 486 90 28} type Float labelsize 16 align 5 textsize 16
+          code0 {=add_input_field_to_map("$(0)", "$(1)", $(name));}
+        }
+        Fl_Input pedido_lineas_cantidad {
+          label Unidades
+          macro_name {pedido_lineas cantidad}
+          xywh {485 486 90 28} type Float labelsize 16 align 5 textsize 16
+          code0 {=add_input_field_to_map("$(0)", "$(1)", $(name));}
+        }
+        Fl_Button btnImprimirPedido {
+          label {&Imprimir}
+          xywh {660 486 120 28} labelsize 16
+        }
+      }
+      Fl_Output lines_count {
+        label {@<- Lineas}
+        xywh {20 374 30 28} box NO_BOX labelsize 16 align 8 textsize 16
+      }
+    }
+    Fl_Group tab_pedidos_lista {
+      label {Pedidos (F3)} open
+      xywh {0 25 800 504} labeltype NO_LABEL labelsize 16 hide
+    } {
+      Fl_Browser grid_pedidos {
+        label {@2 Lista de Pedidos @2}
+        tooltip {Para ver o editar un pedido seleccionar y presionar la barra de espacio} xywh {10 38 780 405} type Multi box ENGRAVED_BOX color 175 labelsize 16 align 17 textsize 16 resizable
+        class Fl_Data_Table
+      }
+      Fl_Button btnActualizarPedidos {
+        label Actualizar
+        xywh {10 453 120 28} labelsize 16
+      }
+      Fl_Button btnImprimirTodosPedidos {
+        label {Imprimir Todos}
+        xywh {140 453 145 28} labelsize 16
+      }
+      Fl_Button btnExportarPedidos {
+        label Exportar
+        xywh {295 453 120 28} labelsize 16
+      }
+      Fl_Button btnImportarPedidos {
+        label Importar
+        xywh {425 453 120 28} labelsize 16
+      }
+      Fl_Button btnBorrarTodosPedidos {
+        label {Borrar Todos}
+        xywh {670 453 120 28} color 90 labelsize 16 labelcolor 7
+      }
+    }
+    Fl_Group tab_clientes_lista {
+      label {Clientes (F4)} open
+      xywh {0 25 800 504} labeltype NO_LABEL labelsize 16 hide
+    } {
+      Fl_Browser grid_clientes {
+        label {@2 Lista de Clientes @2}
+        xywh {10 38 780 249} type Multi box ENGRAVED_BOX color 175 labelsize 16 align 17 textsize 16 resizable
+        class Fl_Data_Table
+      }
+      Fl_Group editClienteGroup {
+        label {@2 Datos del Cliente @2} open
+        xywh {10 336 780 185} box ENGRAVED_BOX color 246 labelsize 16 labelcolor 66 align 5
+      } {
+        Fl_Input clientes_nombre {
+          label Nombre
+          macro_name {clientes nombre}
+          xywh {91 348 684 28} labelsize 16 textsize 16
+          code0 {=add_input_field_to_map("$(0)", "$(1)", $(name));}
+        }
+        Fl_Input clientes_codigo {
+          label {Código}
+          macro_name {clientes codigo}
+          xywh {91 386 100 28} labelsize 16 textsize 16
+          code0 {=add_input_field_to_map("$(0)", "$(1)", $(name));}
+        }
+        Fl_Input clientes_telefono {
+          label {Teléfono}
+          macro_name {clientes telefono}
+          xywh {285 386 100 28} labelsize 16 textsize 16
+          code0 {=add_input_field_to_map("$(0)", "$(1)", $(name));}
+        }
+        Fl_Check_Button clientes_activo {
+          label Activo
+          macro_name {clientes activo}
+          xywh {405 390 82 20} down_box DOWN_BOX labelsize 16
+          code0 {=add_input_field_to_map("$(0)", "$(1)", $(name));}
+        }
+        Fl_Button btnGuardarCliente {
+          label Guardar
+          xywh {655 386 120 28} labelsize 16
+        }
+        Fl_Input clientes_observaciones {
+          label {Obs.}
+          macro_name {clientes observaciones}
+          xywh {90 422 685 86} type Multiline labelsize 16 align 7 textsize 16
+          code0 {=add_input_field_to_map("$(0)", "$(1)", $(name));}
+        }
+      }
+      Fl_Button btnActualizarClientes {
+        label Actualizar
+        xywh {540 300 120 28} labelsize 16
+      }
+      Fl_Button btnImportarClientes {
+        label Importar
+        xywh {670 300 120 28} labelsize 16
+      }
+    }
+    Fl_Group tab_articulos_lista {
+      label {Artículos (F5)} open
+      xywh {0 25 800 504} labeltype NO_LABEL labelsize 15 hide
+    } {
+      Fl_Browser grid_articulos {
+        label {@2 Lista de Artículos @2}
+        xywh {10 38 780 254} type Multi box ENGRAVED_BOX color 175 labelsize 16 align 17 textsize 16 resizable
+        class Fl_Data_Table
+      }
+      Fl_Group articuloEditGroup {
+        label {@2 Datos del Artículo @2} open
+        xywh {10 338 780 183} box ENGRAVED_BOX color 246 labelsize 16 labelcolor 66 align 5
+      } {
+        Fl_Input articulos_descripcion {
+          label {Descripción}
+          macro_name {articulos descripcion}
+          xywh {108 348 672 28} labelsize 16 textsize 16
+          code0 {=add_input_field_to_map("$(0)", "$(1)", $(name));}
+        }
+        Fl_Input articulos_codigo {
+          label {Código}
+          macro_name {articulos codigo}
+          xywh {90 386 100 28} labelsize 16 textsize 16
+          code0 {=add_input_field_to_map("$(0)", "$(1)", $(name));}
+        }
+        Fl_Check_Button articulos_activo {
+          label Activo
+          macro_name {articulos activo}
+          xywh {205 390 82 20} down_box DOWN_BOX labelsize 16
+          code0 {=add_input_field_to_map("$(0)", "$(1)", $(name));}
+        }
+        Fl_Button btnGuardarArticulo {
+          label Guardar
+          xywh {660 386 120 28} labelsize 16 when 8
+        }
+        Fl_Input articulos_observaciones {
+          label {Obs.}
+          macro_name {articulos observaciones}
+          xywh {90 422 690 86} type Multiline labelsize 16 align 7 textsize 16
+          code0 {=add_input_field_to_map("$(0)", "$(1)", $(name));}
+        }
+        Fl_Check_Button articulos_activo {
+          label Unidades
+          macro_name {articulos activo}
+          xywh {297 390 95 20} down_box DOWN_BOX labelsize 16
+          code0 {=add_input_field_to_map("$(0)", "$(1)", $(name));}
+        }
+        Fl_Check_Button articulos_use_peso {
+          label Peso
+          macro_name {articulos use_peso}
+          xywh {402 390 95 20} down_box DOWN_BOX labelsize 16
+          code0 {=add_input_field_to_map("$(0)", "$(1)", $(name));}
+        }
+        Fl_Check_Button articulos_use_bultos {
+          label Bultos
+          macro_name {articulos use_bultos}
+          xywh {507 390 95 20} down_box DOWN_BOX labelsize 16
+          code0 {=add_input_field_to_map("$(0)", "$(1)", $(name));}
+        }
+      }
+      Fl_Button btnActualizarArticulos {
+        label Actualizar
+        xywh {540 302 120 28} labelsize 16
+      }
+      Fl_Button btnImportarArticulos {
+        label Importar
+        xywh {670 302 120 28} labelsize 16
+      }
+    }
+    Fl_Group tab_totales {
+      label {Totales (F6)} open
+      xywh {0 25 800 504} labeltype NO_LABEL labelsize 16 hide
+    } {
+      Fl_Browser grid_totales {
+        label {@2 Totales @2}
+        xywh {10 35 780 202} type Multi box ENGRAVED_BOX color 175 labelsize 16 align 17 textsize 16 resizable
+        class Fl_Data_Table
+      }
+      Fl_Browser grid_detalle_totales {
+        label {@2 Detalle del Total @2}
+        xywh {10 241 780 202} type Multi box ENGRAVED_BOX color 175 labelsize 16 align 17 textsize 16
+        class Fl_Data_Table
+      }
+      Fl_Button btnActualizarTotales {
+        label Actualizar
+        xywh {10 453 120 28} labelsize 16
+      }
+      Fl_Button btnImprimirTotales {
+        label Imprimir
+        xywh {140 453 120 28} labelsize 16
+      }
+      Fl_Button btnCrearCierreTotales {
+        label {Crear Cierre}
+        xywh {670 453 120 28} labelsize 16
+      }
+    }
+    Fl_Group tab_opciones {
+      label {Opciones (F9)} open
+      xywh {0 25 800 504} labeltype NO_LABEL labelsize 16 hide
+    } {
+      Fl_Group grupo_opciones_impresora {
+        label {Impresión} open
+        xywh {10 60 255 95} box ENGRAVED_BOX color 246 labelsize 18
+      } {
+        Fl_Check_Button preguntar_por_impresora {
+          label {Preguntar por impresora}
+          xywh {20 70 235 28} down_box DOWN_BOX labelsize 16
+        }
+        Fl_Round_Button imprimir_papel_A4 {
+          label {Papel A4}
+          xywh {20 100 100 20} type Radio down_box ROUND_DOWN_BOX value 1 labelsize 16
+        }
+        Fl_Round_Button imprimir_papel_A5 {
+          label {Papel A5}
+          xywh {20 125 100 20} type Radio down_box ROUND_DOWN_BOX labelsize 16
+        }
+      }
+      Fl_Button btnFechaTrabajo {
+        label Fecha
+        xywh {10 165 65 28} labelsize 16
+        code0 {o.hide();}
+      }
+      Fl_Input fecha_de_trabajo {
+        xywh {85 165 118 28} labeltype NO_LABEL labelsize 16 textsize 16
+        code0 {o.hide();}
+      }
+      Fl_Input lista_de_envases {
+        label {Envases (uno por linea)}
+        xywh {10 224 251 258} type Multiline labelsize 16 align 5 textsize 16
+      }
+      Fl_Button btnGuardarEnvases {
+        label {Guardar Envases}
+        xywh {10 492 251 28} labelsize 16
+      }
+    }
+  }
+  Fl_Group status_bar {open
+    xywh {0 530 800 30} box ENGRAVED_BOX color 7 labelsize 16 align 20
+  } {}
+} 
+
+widget_class AyudaWindow {
+  label Ayuda open
+  xywh {31 51 470 390} type Double hide
+  class Fl_Double_Window
+} {
+  Fl_Input ayuda_texto {
+    label Ayuda
+    xywh {10 25 452 313} type Multiline labelsize 16 align 5 textsize 16
+  }
+  Fl_Button btnGuardarAyuda {
+    label Guardar
+    xywh {178 348 115 33} labelsize 16
+  }
+} 
+
+widget_class Ayuda2Window {
+  label Ayuda open
+  xywh {75 157 565 390} type Double hide resizable
+  class Fl_Double_Window
+} {
+  Fl_Group {} {open
+    xywh {10 348 549 34}
+  } {
+    Fl_Input texto_a_buscar {
+      label {Texto a buscar}
+      xywh {10 349 299 33} labelsize 18 align 5 textsize 18 resizable
+    }
+    Fl_Button btnBuscarAyuda {
+      label Buscar
+      xywh {319 349 115 33} labelsize 16
+    }
+    Fl_Button btnGuardarAyuda {
+      label Guardar
+      xywh {444 349 115 33} labelsize 16
+    }
+  }
+  Fl_Text_Editor ayuda_texto {
+    xywh {10 10 550 308} labelsize 18 textsize 18 resizable
+    class Fl_Text_Editor_Buffered
+  }
+} 

+ 710 - 0
SquiLu-ourbiz/pedidos2-gui.nut

@@ -0,0 +1,710 @@
+class PedidosWindow extends Base_Window {
+  
+  // Declaration of class members
+  menu_bar = null;
+  menu_pedido_nuevo = null;
+  menu_pedido_guardar = null;
+  menu_pedido_borrar = null;
+  menu_pedido_imprimir = null;
+  menu_pedidos_mostrar_existentes = null;
+  menu_pedidos_modificar_existente = null;
+  menu_pedidos_borrar_existente = null;
+  menu_pedidos_imprimir_selecionados = null;
+  menu_pedidos_imprimir_todos = null;
+  menu_clientes_mostrar_existentes = null;
+  menu_clientes_nuevo = null;
+  menu_clientes_guardar = null;
+  menu_clientes_borrar = null;
+  menu_clientes_importar = null;
+  menu_clientes_exportar = null;
+  menu_articulos_mostrar_existentes = null;
+  menu_articulos_nuevo = null;
+  menu_articulos_guardar = null;
+  menu_articulos_borrar = null;
+  menu_articulos_importar = null;
+  menu_articulos_exportar = null;
+  menu_totales_mostrar_existentes = null;
+  menu_articulos_imprimir = null;
+  menu_preguntar_por_impresora = null;
+  menu_imprimir_papel_A4 = null;
+  menu_imprimir_papel_A5 = null;
+  theme_default = null;
+  theme_gtk = null;
+  theme_plastic = null;
+  menu_salir = null;
+  tabs = null;
+  tab_pedido = null;
+  grupo_pedido_cliente = null;
+  pedidos_cliente_codigo_r = null;
+  pedidos_numero_r = null;
+  pedidos_fecha_r = null;
+  pedidos_cliente_nombre_r = null;
+  grid_pedido_lineas = null;
+  grupo_pedido_lineas = null;
+  pedido_lineas_descripcion = null;
+  pedido_lineas_codigo_r = null;
+  pedido_lineas_bultos = null;
+  pedido_lineas_envase = null;
+  pedido_lineas_peso = null;
+  pedido_lineas_cantidad = null;
+  btnImprimirPedido = null;
+  lines_count = null;
+  tab_pedidos_lista = null;
+  grid_pedidos = null;
+  btnActualizarPedidos = null;
+  btnImprimirTodosPedidos = null;
+  btnExportarPedidos = null;
+  btnImportarPedidos = null;
+  btnBorrarTodosPedidos = null;
+  tab_clientes_lista = null;
+  grid_clientes = null;
+  editClienteGroup = null;
+  clientes_nombre = null;
+  clientes_codigo = null;
+  clientes_telefono = null;
+  clientes_activo = null;
+  btnGuardarCliente = null;
+  clientes_observaciones = null;
+  btnActualizarClientes = null;
+  btnImportarClientes = null;
+  tab_articulos_lista = null;
+  grid_articulos = null;
+  articuloEditGroup = null;
+  articulos_descripcion = null;
+  articulos_codigo = null;
+  articulos_activo = null;
+  btnGuardarArticulo = null;
+  articulos_observaciones = null;
+  articulos_use_peso = null;
+  articulos_use_bultos = null;
+  btnActualizarArticulos = null;
+  btnImportarArticulos = null;
+  tab_totales = null;
+  grid_totales = null;
+  grid_detalle_totales = null;
+  btnActualizarTotales = null;
+  btnImprimirTotales = null;
+  btnCrearCierreTotales = null;
+  tab_opciones = null;
+  grupo_opciones_impresora = null;
+  preguntar_por_impresora = null;
+  imprimir_papel_A4 = null;
+  imprimir_papel_A5 = null;
+  btnFechaTrabajo = null;
+  fecha_de_trabajo = null;
+  lista_de_envases = null;
+  btnGuardarEnvases = null;
+  status_bar = null;
+  
+  constructor(px=74, py=62, pw=800, ph=560, pl=_tr("Pedidos")){
+    base.constructor(px, py, pw, ph, pl);
+    // Create member functions and widgets
+    {
+      local o = Fl_Menu_Bar(0, 0, 800, 25);
+      menu_bar = o;
+      o.textsize(16);
+      o.labelsize(16);
+      {
+        //menu_pedido &Pedido (F2)
+        menu_pedido_nuevo = o.add(_tr("&Pedido (F2)/Crear un nuevo Pedido"), 262254);
+        menu_pedido_guardar = o.add(_tr("&Pedido (F2)/Guardar el Pedido"), 0, null, null, 1);
+        menu_pedido_borrar = o.add(_tr("&Pedido (F2)/Borrar el  Pedido"), 0, null, null, 129);
+        menu_pedido_imprimir = o.add(_tr("&Pedido (F2)/Imprimir el Pedido"), 0, null, null, 1);
+        //menu_pedidos Pedidos (F3)
+        menu_pedidos_mostrar_existentes = o.add(_tr("Pedidos (F3)/Listado de Pedidos existentes"), 0);
+        menu_pedidos_modificar_existente = o.add(_tr("Pedidos (F3)/Modificar el Pedido selecionado"), 0);
+        menu_pedidos_borrar_existente = o.add(_tr("Pedidos (F3)/Borrar el Pedido selecionado"), 0, null, null, 129);
+        menu_pedidos_imprimir_selecionados = o.add(_tr("Pedidos (F3)/Imprimir los Pedidos selecionados"), 0);
+        menu_pedidos_imprimir_todos = o.add(_tr("Pedidos (F3)/Imprimir todos pedidos aun no impresos"), 0);
+        //menu_clientes &Clientes (F4)
+        menu_clientes_mostrar_existentes = o.add(_tr("&Clientes (F4)/Listado de clientes existentes"), 0);
+        menu_clientes_nuevo = o.add(_tr("&Clientes (F4)/Añadir un nuevo cliente"), 0);
+        menu_clientes_guardar = o.add(_tr("&Clientes (F4)/Modificar un cliente existente"), 0, null, null, 1);
+        menu_clientes_borrar = o.add(_tr("&Clientes (F4)/Borrar un cliente existente"), 0, null, null, 129);
+        menu_clientes_importar = o.add(_tr("&Clientes (F4)/Importar clientes"), 0);
+        menu_clientes_exportar = o.add(_tr("&Clientes (F4)/Exportar clientes"), 0);
+        //menu_articulos &Artículos (F5)
+        menu_articulos_mostrar_existentes = o.add(_tr("&Artículos (F5)/Listado de articulos existentes"), 0);
+        menu_articulos_nuevo = o.add(_tr("&Artículos (F5)/Añadir un nuevo artículo"), 0);
+        menu_articulos_guardar = o.add(_tr("&Artículos (F5)/Modificar un artículo existente"), 0, null, null, 1);
+        menu_articulos_borrar = o.add(_tr("&Artículos (F5)/Borrar un artículo existente"), 0, null, null, 129);
+        menu_articulos_importar = o.add(_tr("&Artículos (F5)/Importar artículos"), 0);
+        menu_articulos_exportar = o.add(_tr("&Artículos (F5)/Exportar artículos"), 0);
+        //menu_totales &Totales (F6)
+        menu_totales_mostrar_existentes = o.add(_tr("&Totales (F6)/Listado de totales existentes"), 0);
+        menu_articulos_imprimir = o.add(_tr("&Totales (F6)/Exportar totales"), 0);
+        //menu_opciones &Opciones (F9)
+        menu_preguntar_por_impresora = o.add(_tr("&Opciones (F9)/Preguntar por impresora"), 0, null, null, 130);
+        menu_imprimir_papel_A4 = o.add(_tr("&Opciones (F9)/Imprimir en papel A4"), 0, null, null, 12);
+        menu_imprimir_papel_A5 = o.add(_tr("&Opciones (F9)/Imprimir en papel A5"), 0, null, null, 136);
+        theme_default = o.add(_tr("&Opciones (F9)/Tema por defecto"), 0, null, null, 12);
+        theme_gtk = o.add(_tr("&Opciones (F9)/Tema GTK+"), 0, null, null, 8);
+        theme_plastic = o.add(_tr("&Opciones (F9)/Tema Plastico"), 0, null, null, 8);
+        menu_salir = o.add(_tr("&Salir"), 0);
+      }
+    }
+    {
+      local o = Fl_Tabs(0, 25, 800, 504);
+      tabs = o;
+      o.labelcolor(7);
+      o.labeltype(FL_NO_LABEL);
+      o.labelsize(16);
+      {
+        {
+          local o = Fl_Group(0, 25, 800, 504, _tr("Pedido (F2)"));
+          tab_pedido = o;
+          o.labelsize(16);
+          o.labeltype(FL_NO_LABEL);
+          {
+            {
+              local o = Fl_Group(10, 47, 780, 88, _tr("@2 Cliente @2"));
+              grupo_pedido_cliente = o;
+              o.labelcolor(66);
+              o.labelsize(16);
+              o.color(246);
+              o.box(FL_ENGRAVED_BOX);
+              {
+                {
+                  local o = Fl_Input(91, 59, 100, 28, _tr("Código"));
+                  pedidos_cliente_codigo_r = o;
+                  o.textsize(16);
+                  o.labelsize(16);
+                  add_input_field_to_map("pedidos", "cliente_codigo", pedidos_cliente_codigo_r);
+                }
+                {
+                  local o = Fl_Output(425, 59, 134, 28, _tr("Número"));
+                  pedidos_numero_r = o;
+                  o.textsize(16);
+                  o.labelsize(16);
+                  add_input_field_to_map("pedidos", "numero", pedidos_numero_r);
+                }
+                {
+                  local o = Fl_Output(646, 59, 134, 28, _tr("Fecha"));
+                  pedidos_fecha_r = o;
+                  o.textsize(16);
+                  o.labelsize(16);
+                  add_input_field_to_map("pedidos", "fecha", pedidos_fecha_r);
+                }
+                {
+                  local o = Fl_Input(91, 97, 694, 28, _tr("Nombre"));
+                  pedidos_cliente_nombre_r = o;
+                  o.textsize(16);
+                  o.labelsize(16);
+                  add_input_field_to_map("pedidos", "cliente_nombre", pedidos_cliente_nombre_r);
+                }
+              }
+              o.end();
+            }
+            {
+              local o = Fl_Data_Table(10, 145, 780, 230, _tr("@2 Lineas del Pedido @2"));
+              grid_pedido_lineas = o;
+              o.textsize(16);
+              o.align(1);
+              o.box(FL_ENGRAVED_BOX);
+              o.color(175);
+              o.labelsize(16);
+              o.end();
+              Fl_Group.current().resizable(o);
+            }
+            {
+              local o = Fl_Group(10, 403, 780, 121, _tr("@2 Añadir / Editar / Borar Artículo @2"));
+              grupo_pedido_lineas = o;
+              o.labelcolor(57);
+              o.labelsize(16);
+              o.color(167);
+              o.box(FL_ENGRAVED_BOX);
+              {
+                {
+                  local o = Fl_Input(24, 430, 756, 28, _tr("Descripcion"));
+                  pedido_lineas_descripcion = o;
+                  o.textsize(16);
+                  o.align(5);
+                  o.labelsize(16);
+                  add_input_field_to_map("pedido_lineas", "descripcion", pedido_lineas_descripcion);
+                }
+                {
+                  local o = Fl_Input(24, 486, 100, 28, _tr("Código"));
+                  pedido_lineas_codigo_r = o;
+                  o.textsize(16);
+                  o.align(5);
+                  o.when(1);
+                  o.tooltip(_tr("Para un nuevo pedido pulsar +"));
+                  o.labelsize(16);
+                  add_input_field_to_map("pedido_lineas", "codigo", pedido_lineas_codigo_r);
+                }
+                {
+                  local o = Fl_Float_Input(134, 486, 90, 28, _tr("Bultos"));
+                  pedido_lineas_bultos = o;
+                  o.textsize(16);
+                  o.align(5);
+                  o.labelsize(16);
+                  add_input_field_to_map("pedido_lineas", "bultos", pedido_lineas_bultos);
+                }
+                {
+                  local o = Fl_Choice(234, 486, 141, 28, _tr("Envase"));
+                  pedido_lineas_envase = o;
+                  o.textsize(16);
+                  o.align(5);
+                  o.down_box(FL_BORDER_BOX);
+                  o.labelsize(16);
+                  add_input_field_to_map("pedido_lineas", "envase", pedido_lineas_envase);
+                }
+                {
+                  local o = Fl_Float_Input(385, 486, 90, 28, _tr("Kilos"));
+                  pedido_lineas_peso = o;
+                  o.textsize(16);
+                  o.align(5);
+                  o.labelsize(16);
+                  add_input_field_to_map("pedido_lineas", "peso", pedido_lineas_peso);
+                }
+                {
+                  local o = Fl_Float_Input(485, 486, 90, 28, _tr("Unidades"));
+                  pedido_lineas_cantidad = o;
+                  o.textsize(16);
+                  o.align(5);
+                  o.labelsize(16);
+                  add_input_field_to_map("pedido_lineas", "cantidad", pedido_lineas_cantidad);
+                }
+                {
+                  local o = Fl_Button(660, 486, 120, 28, _tr("&Imprimir"));
+                  btnImprimirPedido = o;
+                  o.labelsize(16);
+                }
+              }
+              o.end();
+            }
+            {
+              local o = Fl_Output(20, 374, 30, 28, _tr("@<- Lineas"));
+              lines_count = o;
+              o.textsize(16);
+              o.align(8);
+              o.box(FL_NO_BOX);
+              o.labelsize(16);
+            }
+          }
+          o.end();
+        }
+        {
+          local o = Fl_Group(0, 25, 800, 504, _tr("Pedidos (F3)"));
+          tab_pedidos_lista = o;
+          o.labelsize(16);
+          o.labeltype(FL_NO_LABEL);
+          {
+            {
+              local o = Fl_Data_Table(10, 38, 780, 405, _tr("@2 Lista de Pedidos @2"));
+              grid_pedidos = o;
+              o.textsize(16);
+              o.align(17);
+              o.tooltip(_tr("Para ver o editar un pedido seleccionar y presionar la barra de espacio"));
+              o.box(FL_ENGRAVED_BOX);
+              o.labelsize(16);
+              o.color(175);
+              o.end();
+              Fl_Group.current().resizable(o);
+            }
+            {
+              local o = Fl_Button(10, 453, 120, 28, _tr("Actualizar"));
+              btnActualizarPedidos = o;
+              o.labelsize(16);
+            }
+            {
+              local o = Fl_Button(140, 453, 145, 28, _tr("Imprimir Todos"));
+              btnImprimirTodosPedidos = o;
+              o.labelsize(16);
+            }
+            {
+              local o = Fl_Button(295, 453, 120, 28, _tr("Exportar"));
+              btnExportarPedidos = o;
+              o.labelsize(16);
+            }
+            {
+              local o = Fl_Button(425, 453, 120, 28, _tr("Importar"));
+              btnImportarPedidos = o;
+              o.labelsize(16);
+            }
+            {
+              local o = Fl_Button(670, 453, 120, 28, _tr("Borrar Todos"));
+              btnBorrarTodosPedidos = o;
+              o.labelcolor(7);
+              o.color(90);
+              o.labelsize(16);
+            }
+          }
+          o.end();
+        }
+        {
+          local o = Fl_Group(0, 25, 800, 504, _tr("Clientes (F4)"));
+          tab_clientes_lista = o;
+          o.labelsize(16);
+          o.labeltype(FL_NO_LABEL);
+          {
+            {
+              local o = Fl_Data_Table(10, 38, 780, 249, _tr("@2 Lista de Clientes @2"));
+              grid_clientes = o;
+              o.textsize(16);
+              o.align(17);
+              o.box(FL_ENGRAVED_BOX);
+              o.color(175);
+              o.labelsize(16);
+              o.end();
+              Fl_Group.current().resizable(o);
+            }
+            {
+              local o = Fl_Group(10, 336, 780, 185, _tr("@2 Datos del Cliente @2"));
+              editClienteGroup = o;
+              o.align(5);
+              o.box(FL_ENGRAVED_BOX);
+              o.color(246);
+              o.labelsize(16);
+              o.labelcolor(66);
+              {
+                {
+                  local o = Fl_Input(91, 348, 684, 28, _tr("Nombre"));
+                  clientes_nombre = o;
+                  o.textsize(16);
+                  o.labelsize(16);
+                  add_input_field_to_map("clientes", "nombre", clientes_nombre);
+                }
+                {
+                  local o = Fl_Input(91, 386, 100, 28, _tr("Código"));
+                  clientes_codigo = o;
+                  o.textsize(16);
+                  o.labelsize(16);
+                  add_input_field_to_map("clientes", "codigo", clientes_codigo);
+                }
+                {
+                  local o = Fl_Input(285, 386, 100, 28, _tr("Teléfono"));
+                  clientes_telefono = o;
+                  o.textsize(16);
+                  o.labelsize(16);
+                  add_input_field_to_map("clientes", "telefono", clientes_telefono);
+                }
+                {
+                  local o = Fl_Check_Button(405, 390, 82, 20, _tr("Activo"));
+                  clientes_activo = o;
+                  o.labelsize(16);
+                  o.down_box(FL_DOWN_BOX);
+                  add_input_field_to_map("clientes", "activo", clientes_activo);
+                }
+                {
+                  local o = Fl_Button(655, 386, 120, 28, _tr("Guardar"));
+                  btnGuardarCliente = o;
+                  o.labelsize(16);
+                }
+                {
+                  local o = Fl_Multiline_Input(90, 422, 685, 86, _tr("Obs."));
+                  clientes_observaciones = o;
+                  o.textsize(16);
+                  o.align(7);
+                  o.labelsize(16);
+                  add_input_field_to_map("clientes", "observaciones", clientes_observaciones);
+                }
+              }
+              o.end();
+            }
+            {
+              local o = Fl_Button(540, 300, 120, 28, _tr("Actualizar"));
+              btnActualizarClientes = o;
+              o.labelsize(16);
+            }
+            {
+              local o = Fl_Button(670, 300, 120, 28, _tr("Importar"));
+              btnImportarClientes = o;
+              o.labelsize(16);
+            }
+          }
+          o.end();
+        }
+        {
+          local o = Fl_Group(0, 25, 800, 504, _tr("Artículos (F5)"));
+          tab_articulos_lista = o;
+          o.labelsize(15);
+          o.labeltype(FL_NO_LABEL);
+          {
+            {
+              local o = Fl_Data_Table(10, 38, 780, 254, _tr("@2 Lista de Artículos @2"));
+              grid_articulos = o;
+              o.textsize(16);
+              o.align(17);
+              o.box(FL_ENGRAVED_BOX);
+              o.color(175);
+              o.labelsize(16);
+              o.end();
+              Fl_Group.current().resizable(o);
+            }
+            {
+              local o = Fl_Group(10, 338, 780, 183, _tr("@2 Datos del Artículo @2"));
+              articuloEditGroup = o;
+              o.align(5);
+              o.box(FL_ENGRAVED_BOX);
+              o.color(246);
+              o.labelsize(16);
+              o.labelcolor(66);
+              {
+                {
+                  local o = Fl_Input(108, 348, 672, 28, _tr("Descripción"));
+                  articulos_descripcion = o;
+                  o.textsize(16);
+                  o.labelsize(16);
+                  add_input_field_to_map("articulos", "descripcion", articulos_descripcion);
+                }
+                {
+                  local o = Fl_Input(90, 386, 100, 28, _tr("Código"));
+                  articulos_codigo = o;
+                  o.textsize(16);
+                  o.labelsize(16);
+                  add_input_field_to_map("articulos", "codigo", articulos_codigo);
+                }
+                {
+                  local o = Fl_Check_Button(205, 390, 82, 20, _tr("Activo"));
+                  articulos_activo = o;
+                  o.labelsize(16);
+                  o.down_box(FL_DOWN_BOX);
+                  add_input_field_to_map("articulos", "activo", articulos_activo);
+                }
+                {
+                  local o = Fl_Button(660, 386, 120, 28, _tr("Guardar"));
+                  btnGuardarArticulo = o;
+                  o.when(8);
+                  o.labelsize(16);
+                }
+                {
+                  local o = Fl_Multiline_Input(90, 422, 690, 86, _tr("Obs."));
+                  articulos_observaciones = o;
+                  o.textsize(16);
+                  o.align(7);
+                  o.labelsize(16);
+                  add_input_field_to_map("articulos", "observaciones", articulos_observaciones);
+                }
+                {
+                  local o = Fl_Check_Button(297, 390, 95, 20, _tr("Unidades"));
+                  articulos_activo = o;
+                  o.labelsize(16);
+                  o.down_box(FL_DOWN_BOX);
+                  add_input_field_to_map("articulos", "activo", articulos_activo);
+                }
+                {
+                  local o = Fl_Check_Button(402, 390, 95, 20, _tr("Peso"));
+                  articulos_use_peso = o;
+                  o.labelsize(16);
+                  o.down_box(FL_DOWN_BOX);
+                  add_input_field_to_map("articulos", "use_peso", articulos_use_peso);
+                }
+                {
+                  local o = Fl_Check_Button(507, 390, 95, 20, _tr("Bultos"));
+                  articulos_use_bultos = o;
+                  o.labelsize(16);
+                  o.down_box(FL_DOWN_BOX);
+                  add_input_field_to_map("articulos", "use_bultos", articulos_use_bultos);
+                }
+              }
+              o.end();
+            }
+            {
+              local o = Fl_Button(540, 302, 120, 28, _tr("Actualizar"));
+              btnActualizarArticulos = o;
+              o.labelsize(16);
+            }
+            {
+              local o = Fl_Button(670, 302, 120, 28, _tr("Importar"));
+              btnImportarArticulos = o;
+              o.labelsize(16);
+            }
+          }
+          o.end();
+        }
+        {
+          local o = Fl_Group(0, 25, 800, 504, _tr("Totales (F6)"));
+          tab_totales = o;
+          o.labelsize(16);
+          o.labeltype(FL_NO_LABEL);
+          {
+            {
+              local o = Fl_Data_Table(10, 35, 780, 202, _tr("@2 Totales @2"));
+              grid_totales = o;
+              o.textsize(16);
+              o.align(17);
+              o.box(FL_ENGRAVED_BOX);
+              o.color(175);
+              o.labelsize(16);
+              o.end();
+              Fl_Group.current().resizable(o);
+            }
+            {
+              local o = Fl_Data_Table(10, 241, 780, 202, _tr("@2 Detalle del Total @2"));
+              grid_detalle_totales = o;
+              o.textsize(16);
+              o.align(17);
+              o.box(FL_ENGRAVED_BOX);
+              o.color(175);
+              o.labelsize(16);
+              o.end();
+            }
+            {
+              local o = Fl_Button(10, 453, 120, 28, _tr("Actualizar"));
+              btnActualizarTotales = o;
+              o.labelsize(16);
+            }
+            {
+              local o = Fl_Button(140, 453, 120, 28, _tr("Imprimir"));
+              btnImprimirTotales = o;
+              o.labelsize(16);
+            }
+            {
+              local o = Fl_Button(670, 453, 120, 28, _tr("Crear Cierre"));
+              btnCrearCierreTotales = o;
+              o.labelsize(16);
+            }
+          }
+          o.end();
+        }
+        {
+          local o = Fl_Group(0, 25, 800, 504, _tr("Opciones (F9)"));
+          tab_opciones = o;
+          o.labelsize(16);
+          o.labeltype(FL_NO_LABEL);
+          {
+            {
+              local o = Fl_Group(10, 60, 255, 95, _tr("Impresión"));
+              grupo_opciones_impresora = o;
+              o.labelsize(18);
+              o.color(246);
+              o.box(FL_ENGRAVED_BOX);
+              {
+                {
+                  local o = Fl_Check_Button(20, 70, 235, 28, _tr("Preguntar por impresora"));
+                  preguntar_por_impresora = o;
+                  o.labelsize(16);
+                  o.down_box(FL_DOWN_BOX);
+                }
+                {
+                  local o = Fl_Round_Button(20, 100, 100, 20, _tr("Papel A4"));
+                  imprimir_papel_A4 = o;
+                  o.labelsize(16);
+                  o.value(1);
+                  o.type(102);
+                  o.down_box(FL_ROUND_DOWN_BOX);
+                }
+                {
+                  local o = Fl_Round_Button(20, 125, 100, 20, _tr("Papel A5"));
+                  imprimir_papel_A5 = o;
+                  o.labelsize(16);
+                  o.type(102);
+                  o.down_box(FL_ROUND_DOWN_BOX);
+                }
+              }
+              o.end();
+            }
+            {
+              local o = Fl_Button(10, 165, 65, 28, _tr("Fecha"));
+              btnFechaTrabajo = o;
+              o.labelsize(16);
+              o.hide();
+            }
+            {
+              local o = Fl_Input(85, 165, 118, 28);
+              fecha_de_trabajo = o;
+              o.textsize(16);
+              o.labeltype(FL_NO_LABEL);
+              o.labelsize(16);
+              o.hide();
+            }
+            {
+              local o = Fl_Multiline_Input(10, 224, 251, 258, _tr("Envases (uno por linea)"));
+              lista_de_envases = o;
+              o.textsize(16);
+              o.align(5);
+              o.labelsize(16);
+            }
+            {
+              local o = Fl_Button(10, 492, 251, 28, _tr("Guardar Envases"));
+              btnGuardarEnvases = o;
+              o.labelsize(16);
+            }
+          }
+          o.end();
+        }
+      }
+      o.end();
+      Fl_Group.current().resizable(o);
+    }
+    {
+      local o = Fl_Group(0, 530, 800, 30);
+      status_bar = o;
+      o.box(FL_ENGRAVED_BOX);
+      o.labelsize(16);
+      o.align(20);
+      o.color(7);
+      o.end();
+    }
+  }
+}
+
+class AyudaWindow extends Fl_Double_Window {
+  
+  // Declaration of class members
+  ayuda_texto = null;
+  btnGuardarAyuda = null;
+  
+  constructor(px=31, py=51, pw=470, ph=390, pl=_tr("Ayuda")){
+    base.constructor(px, py, pw, ph, pl);
+    // Create member functions and widgets
+    {
+      local o = Fl_Multiline_Input(10, 25, 452, 313, _tr("Ayuda"));
+      ayuda_texto = o;
+      o.textsize(16);
+      o.align(5);
+      o.labelsize(16);
+    }
+    {
+      local o = Fl_Button(178, 348, 115, 33, _tr("Guardar"));
+      btnGuardarAyuda = o;
+      o.labelsize(16);
+    }
+  }
+}
+
+class Ayuda2Window extends Fl_Double_Window {
+  
+  // Declaration of class members
+  texto_a_buscar = null;
+  btnBuscarAyuda = null;
+  btnGuardarAyuda = null;
+  ayuda_texto = null;
+  
+  constructor(px=75, py=157, pw=565, ph=390, pl=_tr("Ayuda")){
+    base.constructor(px, py, pw, ph, pl);
+    // Create member functions and widgets
+    {
+      local o = Fl_Group(10, 348, 549, 34);
+      {
+        {
+          local o = Fl_Input(10, 349, 299, 33, _tr("Texto a buscar"));
+          texto_a_buscar = o;
+          o.textsize(18);
+          o.align(5);
+          o.labelsize(18);
+          Fl_Group.current().resizable(o);
+        }
+        {
+          local o = Fl_Button(319, 349, 115, 33, _tr("Buscar"));
+          btnBuscarAyuda = o;
+          o.labelsize(16);
+        }
+        {
+          local o = Fl_Button(444, 349, 115, 33, _tr("Guardar"));
+          btnGuardarAyuda = o;
+          o.labelsize(16);
+        }
+      }
+      o.end();
+    }
+    {
+      local o = Fl_Text_Editor_Buffered(10, 10, 550, 308);
+      ayuda_texto = o;
+      o.labelsize(18);
+      o.textsize(18);
+      Fl_Group.current().resizable(o);
+    }
+  }
+}

+ 365 - 0
SquiLu-ourbiz/pedidos2.nut

@@ -0,0 +1,365 @@
+function _tr(str) {return str;}
+
+class Fl_Multiline_Output extends Fl_Output {
+	constructor(px, py, pw, ph, pl=null){
+		base.constructor(px, py, pw, ph, pl);
+		type(4);
+	}
+}
+
+enum Fl_Data_Table_Events {e_none, e_event, e_select, e_insert, e_update, e_delete};
+
+class Fl_Data_Table extends Flv_Data_Table {
+	_cols_info = null;
+	_data = null;
+	_call_this = null;
+	_forPrint = null;
+
+	constructor(px, py, pw, ph, pl=null){
+		base.constructor(px, py, pw, ph, pl);
+		_cols_info = [];
+		_data = [];
+		_forPrint = false;
+		has_scrollbar(FLVS_BOTH);
+	}
+
+	function for_print(bval){_forPrint = bval; }
+
+	function resize(ax, ay, aw, ah){
+		base.resize(ax, ay, aw, ah);
+		calc_cols();
+	}
+
+	function clear_data_rows(){
+		row(0);
+		rows(0);
+		_data.clear();
+	}
+	function recalc_data(){
+		rows(_data.size());
+		redraw();
+	}
+
+	function set_data(data_array){
+		_data = data_array;
+		recalc_data();
+	}
+
+	function set_new_data(data_array){
+		clear_data_rows();
+		_data = data_array;
+		local mycols = _data[0];
+		_data.remove(0);
+		set_cols(mycols);
+		recalc_data();
+	}
+
+	function get_data_value(arow, acol){ return _data[arow][acol];}
+
+	function get_value(arow, acol){
+		if(acol < 0)
+		{
+		    if(arow < 0) return "#";
+		    return format("%d", arrow+1);
+		}
+		if(arow < 0) return _cols_info[acol].header;
+
+		local ci = _cols_info[acol];
+
+		local value = _data[arow][acol];
+
+		switch(ci.format)
+		{
+			case 'M': return math.number_format(value.size() ? value.tofloat() : 0, 2);
+			break;
+			case 'P': return math.number_format(value.size() ? value.tofloat() : 0, 3);
+			break;
+			case 'N': return math.number_format(value.size() ? value.tofloat() : 0, -6);
+			break;
+			case 'Z': //Empty when zero
+			case 'D': //Zero monetary //ZM':
+			{
+			    if(value == "0" || value == "") return "";
+			    else
+			    {
+				if(ci.format == 'Z') return math.number_format(value.tofloat(), -6);
+				else return math.number_format(value.tofloat(), 2);
+			    }
+			}
+			break;
+			case 'B': return (value == "1" ? "@-3+" : "");
+			break;
+			case 'S': return value.tostring();
+			break;
+			case '@': return value.replace("@", "@@"); //escape any @ 	{
+			break;
+		}
+		return value;
+	}
+
+	function get_style(style, Row, Col){
+		base.get_style(style, Row, Col);
+		if(Row >= 0 && Col >= 0)
+		{
+		    local rs = row_style().get(Row);
+		    local cs = col_style().get(Col);
+		    local have_bg = 0;
+		    if(cs.background_defined()) have_bg = cs.background();
+		    else if(rs.background_defined()) have_bg = rs.background();
+
+		    if((Row % 2) == 0)
+		    {
+			if(have_bg)
+			    //s:background(fltk.fl_color_average(207, have_bg, 0.5))
+			    style.background(have_bg);
+			else
+			    style.background(207);
+		    }
+		    else
+		    {
+			if(have_bg)
+			    //s:background(have_bg)
+			    style.background(fl_color_average(FL_WHITE, have_bg, 0.5));
+			else
+			    style.background(FL_WHITE);
+		    }
+		}
+		else if(_forPrint)
+		{
+		    style.frame(FL_NO_BOX);
+		}
+	}
+
+	function handle(event){
+		switch(event){
+			case FL_RELEASE:{
+				local done = false;
+				if(Fl.event_clicks() > 0){
+					row_selected(Fl_Data_Table_Events.e_update);
+					done = true;
+				}
+				if(done){
+					Fl.event_clicks(0);
+					return 1;
+				}
+			}
+			break;
+			case FL_KEYBOARD:
+				local key = Fl.event_key();
+				switch(key){
+					case FL_KP_Plus:
+						if(Fl.event_ctrl()) break;
+					case FL_Insert:
+						row_selected(Fl_Data_Table_Events.e_insert);
+					break;
+					//case FL_KP_Minus:
+					//    if(Fl::event_ctrl()) break;
+					case FL_Delete:
+						row_selected(Fl_Data_Table_Events.e_delete);
+					break;
+					case FL_KP_Enter:
+					case FL_Enter:
+					case FL_Key_Space:
+						if(!Fl.event_ctrl()){
+							row_selected(Fl_Data_Table_Events.e_update);
+						}
+					break;
+				}
+			break;
+		}
+		local rc = base.handle(event);
+		return rc;
+	}
+	function row_selected(ev){ if(_call_this) _call_this.row_selected(this, ev);}
+	function set_cols(mycols, size_absolute=false){
+		_cols_info.clear();
+		for(local i=0, max_cols=mycols.size(); i < max_cols; ++i){
+		    local col_info = {};
+		    parse_field_header(mycols[i], col_info);
+		    _cols_info.push(col_info);
+		}
+		cols(_cols_info.size());
+		calc_cols(size_absolute);
+	}
+	function parse_field_header(str, col_info){
+		local ci = str.split('|');
+		local ci_size = ci.size();
+		local curr_ci = 0;
+		col_info.colname <- (ci_size > curr_ci++) ? ci[curr_ci-1] : "?";
+		col_info.header <- (ci_size > curr_ci++) ? ci[curr_ci-1] : "?";
+		col_info.width <- (ci_size > curr_ci++) ? ci[curr_ci-1].tofloat() : 10;
+		col_info.align <- (ci_size > curr_ci++) ? ci[curr_ci-1][0] : 'L';
+		col_info.format <- (ci_size > curr_ci++) ? ci[curr_ci-1][0] : '\0';
+		col_info.color <- (ci_size > curr_ci++) ? ci[curr_ci-1].tointeger() : 0;
+		col_info.bgcolor <- (ci_size > curr_ci++) ? ci[curr_ci-1].tointeger() : 0;
+		if(ci_size == 1) {
+			col_info.colname = str;
+			col_info.header = str;
+		}
+	}
+	function calc_cols(size_absolute=false){
+		calc_cols_width(size_absolute);
+		for(local k=0, len = cols(); k < len; ++k)
+		{
+		    local v = _cols_info[k];
+		    //v.header = _tr(v.header.c_str());
+		    local col_align;
+		    switch(v.align)
+		    {
+		    case 'C':
+			col_align = FL_ALIGN_CENTER;
+			break;
+		    case 'R':
+			col_align = FL_ALIGN_RIGHT;
+			break;
+		    default:
+			col_align = FL_ALIGN_LEFT;
+		    }
+		    local cs = col_style().get(k);
+		    cs.align(col_align);
+		    if(v.color) cs.foreground(v.color);
+		    if(v.bgcolor) cs.background(v.bgcolor);
+		}
+	}
+	function calc_cols_width(size_absolute=false){
+		if(size_absolute){
+			for(local k=0, len = cols(); k < len; ++k)
+			{
+			    local cs = col_style().get(k);
+			    cs.width(_cols_info[k].width);
+			}
+			return;
+		}
+		local grid_width, total_widths, char_width;
+		grid_width = w();
+		if(has_scrollbar()) grid_width -= scrollbar_width();
+		//char_width = self:labelsize() --fltk.fl_width('w')
+		//it seems that if not set the text font on fluid
+		//we get segfault here
+		fl_font(textfont(), textsize());
+		local gs = global_style();
+		gs.height(fl_height()+fl_descent());
+		char_width = fl_width("w");
+		draw_offset(char_width/3);
+		//print(grid_width, char_width)
+
+		total_widths = 0;
+		for(local k=0, len = cols(); k < len; ++k)
+		{
+		    local v = _cols_info[k].width;
+		    if(v > 0) total_widths += ((v * char_width) + 1);
+		}
+
+		for(local k=0, len = cols(); k < len; ++k)
+		{
+		    local v = _cols_info[k];
+		    local col_width = v.width;
+		    if( col_width < 0)	col_width = grid_width - total_widths;
+		    else col_width *= char_width;
+		    local cs = col_style().get(k);
+		    cs.width(col_width);
+		}
+	}
+	function get_selection(ar_out, withIds=false){
+	}
+	function clear_selection(){
+	}
+	function get_row_id(arow=null){
+		if(arow == null) arow = row();
+		return _data[arow][0].tointeger();
+	}	
+}
+
+class Base_Window extends Fl_Window {
+	_db_map = null;
+	
+	constructor(px, py, pw, ph, pl){
+		base.constructor(px, py, pw, ph, pl);
+		_db_map = {};
+	}
+	function add_input_field_to_map(tbl, fldname, fld){
+		local tbl_map = _db_map.get(tbl, false);
+		if(!tbl_map){
+			tbl_map = {};
+			_db_map[tbl] <- tbl_map;
+		}
+		tbl_map[fldname] <- fld;
+	}
+}
+
+class Fl_Multiline_Input extends Fl_Input {
+	constructor(px, py, pw, ph, pl=null){
+		base.constructor(px, py, pw, ph, pl);
+		type(4);
+	}
+}
+
+dofile("pedidos2-gui.nut");
+
+class Pedidos2 extends PedidosWindow {
+  
+	// Declaration of class members
+  
+	constructor(){
+		base.constructor();
+	}
+	
+	function row_selected(sender, ev){
+	}
+	
+	function handle(event){
+		if (event == FL_KEYBOARD && Fl.event_command() == 0){
+			local key = Fl.event_key();
+			//print(key)
+			switch(key){
+				case FL_Menu: menu_bar_navigate(); break;
+				case FL_F+1: mostrar_ventana_ayuda(); break;
+				case FL_F+2: mostrar_ventana_pedido(); break;
+				case FL_F+3: mostrar_ventana_pedidos(); break;
+				case FL_F+4: mostrar_ventana_clientes(); break;
+				case FL_F+5: mostrar_ventana_articulos(); break;
+				case FL_F+6: mostrar_ventana_totales(); break;
+				case FL_F+9: mostrar_ventana_opciones(); break;
+			}
+		}
+		
+		return base.handle(event);
+	}
+	function menu_bar_navigate(){
+		local mb = menu_bar;
+		local v = mb.menu().pulldown(mb.x(), mb.y(), mb.w(), mb.h(), mb.menu_at(0), mb, null, 1);
+		mb.picked(v);
+	}
+	function mostrar_ventana_ayuda(){
+	}
+	function mostrar_ventana_pedido(){
+		tabs.value(tab_pedido);
+	}
+	function mostrar_ventana_pedidos(){
+		tabs.value(tab_pedidos_lista);
+	}
+	function mostrar_ventana_clientes(){
+		tabs.value(tab_clientes_lista);
+	}
+	function mostrar_ventana_articulos(){
+		tabs.value(tab_articulos_lista);
+	}
+	function mostrar_ventana_totales(){
+		tabs.value(tab_totales);
+	}
+	function mostrar_ventana_opciones(){
+		tabs.value(tab_opciones);
+	}
+}
+
+Fl.scheme("gtk+");
+Fl.visual(FL_RGB);
+//allow arrow keys navigation
+Fl.option(Fl.OPTION_ARROW_FOCUS, true);
+
+local win = new Pedidos2();
+//local win = new SalesTaxRatesEditWindow();
+win->resizable(win);
+win->show_main();
+
+Fl.run();