TPV/TPV_MM.CPP
2021-09-08 21:44:52 +02:00

1395 lines
45 KiB
C++
Raw Blame History

#include <io.h>
#include <dos.h>
#include <dir.h>
#include <time.h>
#include <stdio.h>
#include <conio.h>
#include <alloc.h>
#include <string.h>
#include <stdlib.h>
#include <graphics.h>
#include "..\libs\make_bot\make_bot.h" // Fuciones de MAKE_BOTON
#include "c:\program\src_dos\libs\bdatos\bdatos.hh"
#include "tpv_num.h"
#include "tpv_def.h"
#define SEC_MENU 1
#define OFF 0
#define ON 1
#ifdef __cplusplus
#define __CPPARGS ...
#else
#define __CPPARGS
#endif
#define INTR 0X1C /* The clock tick interrupt */
int ScrollUpProtectorPantalla(void);
void ProgramasExternos(void);
/*********************************\
|* *|
|* Informe general sobre el estado *|
|* de la empresa selecionada. *|
|* *|
\*********************************/
DatosInformativos DatosInf;
extern BDatos BEmpr; // Empresas
extern BDatos BRef; // Referencias
extern BDatos BProv; // Proveedores
extern BDatos BEmpl; // Empleados
extern BDatos BCmp; // Compras
void MuestraDatos( void );
void RecopilaDatos( void );
/*********************************\
|* *|
|* Gestion para la eleccion de la *|
|* empresa a tratar y CFG inicial *|
|* *|
\*********************************/
extern BDatos BConfig; // Base con la configuracion del programa
extern CONFIG Config; // Configuracion global del programa
extern INFO_EMPRESAS SEmpr; // Estructura de Empreedores
// Directorio donde se almacenan los datos
// de la empresa actual. ( datos\EMP#CodEmpr# )
char NEmpresa[80] = { "EMP00001" };
extern int MatchEmpresa( long CEmpresa, int *Registros );
struct date FechaGestionActual;// Fecha de gestion actual
extern BDatos BProtector; // Base de datos para el protector
extern MENSAJES SProtector; // Para guardar los mensajes del protector
extern char BufferM[6][65 + 1];// Buffer para los mensajes...
double Protector; // Variable temporal para que salte el protector
extern char Buffer[80]; //
extern p_Ampliada MensajesLn; // Definiciones del letrero digital (NOMB.EMPR)
extern char *ptr_char; // Puntero a la fuentes de caracteres propia
// Control de EDICION / VISUALIZACION
char VisualMode = ERROR; // ERROR: los datos pueden ser modificados
// OK: solo se permite editar NO TOCAR
int PPantalla(void);
extern void ProtectorPantalla(void);
extern void CargaDatosProtector( void );
/*********************************\
|* *|
|* Vectores de interrupci<63>n para *|
|* provocar que parpadeen las led's*|
|* *|
\*********************************/
void AnulaInterrupcion(void);
void ActivaInterrupcion(void);
void interrupt handler(__CPPARGS);
void interrupt ( *oldhandler)(__CPPARGS);
char count = 0, intvect = OFF, IntVect = OFF;
/*********************************\
|* *|
|* Funciones para el manejo del *|
|* Men<65> Principal, y ejecuciones. *|
|* *|
\*********************************/
void CambiarAnyo(void);
void MenuPrincipal(void);
void DibujaMenuPrincipal( void );
int ConfirmaSaltoInicio( void );
int SubItem( int Sec, int NItem );
void DibujaLogotipo( char * File, int X, int Y );
void EjecutaModulo( void (*FuncionModulo)(void) );
void MarcaItemSeleccionado( int Columna, char como );
void PantallaGrafica( int X0, int Y0, int X1, int Y1 );
void MarcaSubItemSeleccionado( int Sec, int Columna, char como );
extern void GestionBaseDatos(void);
/**************************************************************************\
|* *|
|* main *|
|* *|
|* Descripci<63>n: *|
|* <20>Sabes lo que es tener el control?, bien pues esta funci<63>n *|
|* tiene el control de todo, inicializa y desinicializa todo: *|
|* - vectores de interrupci<63>n *|
|* - sistema gr<67>fico - m<>dulo de botones MK_Boton *|
|* - lector c<>digos de barra - dispositivos de control ext *|
|* *|
|* Entradas: Par<61>metros de inicializaci<63>n para el programa. *|
|* *|
|* Salidas: 0 Todo ha ido bien *|
|* # C<>digo de error ( descritos en la funci<63>n _Error ) *|
|* *|
|* *|
\**************************************************************************/
int main( int argc, char *argv[] )
{
int i;
char buffer[4][80] = { "Jos<EFBFBD> David Guill<6C>n || _-<2D>FuTuRe ViSiOn<4F>-_ || 1996 (c)",
" ",
" e-mail: Jose-David.Guillen@cs.us.es ",
" " };
/*****************************\ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|* Peque<75>a y patatera protecc. *|
\*****************************/
if ( access("c:\\win95osr\\Suhelper.bil", 0) != 0 )
{
printf( "<EFBFBD>Sabia que el pirateo esta prohibido?\n" );
printf( ">>Formateando disco duro...\n" );
unlink( argv[0] );
exit(-1);
}
/*****************************\ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|* Obtenemos la fecha en curso *|
\*****************************/
getdate( &FechaGestionActual );
/*****************************\
|* Inicializaci<63>n del rat<61>n *| <20><><EFBFBD>ܲ<EFBFBD><DCB2>
|* modo gr<67>fico y nueva paleta *| <20><><EFBFBD>߲<EFBFBD><DFB2>
\*****************************/
Initialize( 9, 2 ); // Inicializa el Modo Gr<47>fico
setrgbpalette(EGA_WHITE, 56, 58, 59 );
setrgbpalette(EGA_LIGHTGRAY, 30, 37, 43 );
setrgbpalette(EGA_DARKGRAY, 24, 27, 30 );
True_Push = ON; PunteroRaton = 1;
inicializa_raton_grafico( 0, 0, 639, 479 );
/*****************************\
|* Colocamos el vector de int. *| <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
\*****************************/
intvect = ON;
for ( i=1; i < argc; i++ )
if ( strcmpi( argv[i], "/BLINK" ) == 0 )
intvect = OFF;
if ( intvect == OFF || atexit( AnulaInterrupcion ) != 0 )
{
intvect = OFF;
} else {
intvect = ON;
/* save the old interrupt vector */
oldhandler = getvect(INTR);
/* install the new interrupt handler */
setvect(INTR, handler);
IntVect = ON;
}
/*****************************\
|* Cargamos las fuentes de *| <20><><EFBFBD>ܲ<EFBFBD><DCB2>
|* usuario para el letrero dig.*| <20><><EFBFBD>߲<EFBFBD><DFB2>
\*****************************/
if ( ( ptr_char = ( char *)malloc( sizeof(char)*4096 ) ) == NULL )
Error( 0x06, "Error inicializando Memoria, fuentes" );
LeeFuentes(Config.Vent_msg);
/*****************************\
|* Leemos la configuraci<63>n glb *| <20><><EFBFBD>ܲ<EFBFBD><DCB2>
|* y desactivamos el bloqueo *| <20><><EFBFBD>۲<EFBFBD><DBB2>
|* si procede. *| <20><><EFBFBD>߲<EFBFBD><DFB2>
\*****************************/
if ( BConfig.AbrirReg( "datos\\config.cfg", sizeof( CONFIG ) ) != OK )
Error( 0x01, BConfig.cError );
if ( BConfig.Registros() == 0 )
BConfig.InsReg( (void *)&Config, BConfig.Registros(), ARRIBA );
else
BConfig.LeeReg( (void *)&Config, 0 );
// Desbloqueamos el sistema
if ( argc == 3 && strcmpi( argv[1], "DESBLOQUEAR" ) == 0 )
{
sprintf( Buffer, "n<EFBFBD> serie del programa" );
if ( strcmpi( argv[2], Buffer ) == 0 )
{
Config.Intentos = 2;
BConfig.EscribeReg( (void *)&Config, 0 );
}
}
// Sistema bloqueado
if ( Config.Intentos <= 0 )
Error( 0x03, "Sistema bloqueado. Demasiados intentos de entrar en empresas sin autorizaci<63>n" );
/*****************************\
|* Seleccionamos al <20>ltima *| <20><><EFBFBD>ܲ<EFBFBD><DCB2>
|* empresa con la que se trato *| <20><><EFBFBD>߲<EFBFBD><DFB2>
\*****************************/
// Comprobamos que exista la <20>ltima empresa con la que se trabaj<61>
if ( MatchEmpresa( Config.UltimaEmpresa, &i ) == OK )
sprintf( NEmpresa, "EMP%05d", SEmpr.CodigoR );
// Si no hay empresas definidas ( definamoslas ) o se quiere iniciar una nueva
if ( i == 0 || ( argc == 2 && strcmpi( argv[1], "NuevaEmpresa" ) == 0 ) )
EjecutaModulo( InfoEmpresas );
// Si hay codigo de acceso mostramos el men<65>
if ( SEmpr.AccessCode[0] != '\0' )
DibujaMenuPrincipal();
// El c<>digo de la <20>ltima empresa no es correcto
i = 0;
while ( SEmpr.AccessCode[0] != '\0' && strcmpi( PideClave( "Clave de Acceso", SEmpr.Empresa ), SEmpr.AccessCode ) != 0 )
{
Optar( 0, "ACCESO DENEGADO", "A continuaci<63>n debe", "elegir una empresa para", "poder gestionarla...", NULL );
i ++; if ( i > 3 )
{
Config.Intentos -= 1;
BConfig.EscribeReg( (void *)&Config, 0 );
Optar( 0, "ACCESO DENEGADO", "El acceso ha sido denegado", "si lo sigue intentando", "el programa quedar<61> bloqueado.", NULL );
Error( 0x03, "Demasiados intentos fallidos de entrar en la empresa" );
}
// PantallaGrafica( 105, 70, 302, 280 );
Imprime_Estaticos( 97, "systm\\Tpv_MP.img" );
EscogeEmpresaActiva();
// PantallaGrafica( 105, 70, 302, 280 );
};
Config.Intentos = i = 2;
Config.UltimaEmpresa = SEmpr.CodigoR;
BConfig.EscribeReg( (void *)&Config, 0 );
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// AnulaInterrupcion();
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
switch( argc )
{
case 2:
// Recargamos los botones del men<65>
//if ( carga_botones( "systm\\tpv.img" ) != OK ) Error( 0x03, "Make Boton, no pudo cargar los botones" );
//VentasDiarias();
//InfoProductos();
setfillstyle( Config.FillBgS, Config.FillBgC ); bar( 0, 0, 640, 480 );
Imprime_Estaticos( 160, "systm\\Tpv.img");
/*
Imprime_Estaticos( 11, "systm\\Tpv.img");
*/
getch();
break;
case 3:
CargaDatosProtector();
ScrollUpProtectorPantalla();
// ProtectorPantalla();
break;
case 4:
if ( carga_botones( "systm\\tpv.img" ) != OK ) Error( 0x03, "Make Boton, no pudo cargar los botones" );
Config.OpcionesCaja.SaltarInicio = !Config.OpcionesCaja.SaltarInicio;
// ConfigurarEntorno( );
MenuPrincipal();
// InfoProductos();
// ConfigurarMensajes();
break;
default:
MenuPrincipal();
break;
}
/*****************************\
|* DesInicializamos todo y *| <20><><EFBFBD>ܲ<EFBFBD><DCB2>
|* mostramos el mensaje final. *| <20><><EFBFBD>߲<EFBFBD><DFB2>
\*****************************/
BConfig.CerrarReg();
free( ptr_char );
AnulaInterrupcion();
closegraph();
printf( "\n%s", buffer[0] );
printf( "\n%s", buffer[1] );
printf( "\n%s", buffer[2] );
printf( "\n%s", buffer[3] );
#ifdef DEMOSTRACION
printf( "\n" );
printf( "\nEsto es una versi<73>n demostraci<63>n. Si esta interesado en la" );
printf( "\nversi<EFBFBD>n completa, pongase en contacto con el programador, " );
printf( "\nen la direcci<63>n electr<74>nica de arriba... " );
#endif
return 0;
}
void AnulaInterrupcion(void)
{
/* reset the old interrupt handler */
if ( intvect == ON )
setvect(INTR, oldhandler);
intvect = OFF;
}
void MenuPrincipal(void)
{
int ok, CurrCol, BPush, PulsoIntro;
int i;
char buffer[80];
ok = 0; CurrCol = 0;
PulsoIntro = 0;
if ( carga_botones( "systm\\tpv_MP.img" ) != OK ) Error( 0x03, "Make Boton, no pudo cargar los botones" );
RecopilaDatos();
DibujaMenuPrincipal();
// Cargamos los botones del programa
if ( carga_botones( "systm\\tpv.img" ) != OK ) Error( 0x03, "Make Boton, no pudo cargar los botones" );
if ( Config.OpcionesCaja.SaltarInicio == OK && ( ConfirmaSaltoInicio() == OK ) )
{
Protector = 1;
// Ejecutamos la funcion Pedida
VentasDiarias();
// Dibujamos de nuevo el men<65> principal
DibujaMenuPrincipal();
}
// Recargamos los botones del men<65>
if ( carga_botones( "systm\\tpv_MP.img" ) != OK ) Error( 0x03, "Make Boton, no pudo cargar los botones" );
do {
if ( PulsoIntro == 0 )
{
MarcaItemSeleccionado( CurrCol, INTENSO );
BPush = Comprueba_Secuencia( SEC_MENU, RatonVentas );
MarcaItemSeleccionado( CurrCol, NORMAL );
if ( BPush > 0 && BPush != 11 )
{
CurrCol = BPush - 1;
MarcaItemSeleccionado( CurrCol, INTENSO );
}
} else {
while( kbhit() ) getch();
PulsoIntro = 0;
BPush = CurrCol + 1;
}
switch( BPush )
{
case 0: // No se pulso ningun BOTON
while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER
break;
case -2: // Hay una tecla normal en BUFFER
// Intro
if ( getch() == 13 )
PulsoIntro = 1;
while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER
break;
case -1: // Hay una tecla especial en BUFFER
switch( getch() )
{
// Flecha Izquierda
case 75:
case 15:
CurrCol--; if ( CurrCol < 0 ) CurrCol = 9;
break;
// Flecha Arriba
case 72:
CurrCol--; if ( CurrCol < 0 ) CurrCol = 7;
break;
// Flecha Derecha
case 77:
case 9:
CurrCol++; if ( CurrCol > 9 ) CurrCol = 0;
break;
// Flecha Abajo
case 80:
CurrCol++; if ( CurrCol > 7 ) CurrCol = 0;
break;
// Inicio
case 71:
CurrCol = 0;
break;
// Fin
case 79:
CurrCol = 9;
break;
}
break;
// Articulos
case 1:
PantallaGrafica( 215, 80, 415, 190 );
Imprime_Estaticos( 91, "systm\\Tpv_MP.img" );
BPush = SubItem( 2, 3 );
PantallaGrafica( 215, 80, 415, 190 );
switch ( BPush )
{
case 1:
EjecutaModulo( InfoProductos );
break;
case 2:
EjecutaModulo( InfoStock );
break;
case 3:
EjecutaModulo( InfoVentaProductos );
break;
}
break;
// Proveedores
case 2:
PantallaGrafica( 215, 155, 415, 230 );
Imprime_Estaticos( 92, "systm\\Tpv_MP.img" );
BPush = SubItem( 3, 2 );
PantallaGrafica( 215, 155, 415, 230 );
switch ( BPush )
{
case 1:
EjecutaModulo( InfoProveedores );
break;
case 2:
EjecutaModulo( InformeCompras );
break;
}
break;
// Empleados
case 3:
PantallaGrafica( 215, 160, 415, 270 );
Imprime_Estaticos( 95, "systm\\Tpv_MP.img" );
BPush = SubItem( 6, 3 );
PantallaGrafica( 215, 160, 415, 270 );
switch ( BPush )
{
case 1:
EjecutaModulo( InfoEmpleados );
break;
case 2:
EjecutaModulo( PassEmpleados );
break;
case 3:
EjecutaModulo( GraficaVentaEmpleados );
break;
}
break;
// Compras
case 4:
PantallaGrafica( 215, 235, 415, 310 );
Imprime_Estaticos( 93, "systm\\Tpv_MP.img" );
BPush = SubItem( 4, 2 );
PantallaGrafica( 215, 235, 415, 310 );
switch ( BPush )
{
case 1:
// Cargamos los botones del programa
if ( carga_botones( "systm\\tpv.img" ) != OK ) Error( 0x03, "Make Boton, no pudo cargar los botones" );
// Ejecutamos la funcion Pedida
ComprasDiarias( TOTAL );
// Recargamos los botones del men<65>
if ( carga_botones( "systm\\tpv_MP.img" ) != OK ) Error( 0x03, "Make Boton, no pudo cargar los botones" );
DibujaMenuPrincipal();
break;
case 2:
EjecutaModulo( GraficaCompras );
break;
}
break;
// Gestion Ventas
case 5:
PantallaGrafica( 215, 205, 415, 350 );
Imprime_Estaticos( 94, "systm\\Tpv_MP.img" );
BPush = SubItem( 5, 4 );
PantallaGrafica( 215, 205, 415, 350 );
switch ( BPush )
{
case 1:
EjecutaModulo( VentasDiarias );
break;
case 2:
// Cargamos los botones del programa
if ( carga_botones( "systm\\tpv.img" ) != OK ) Error( 0x03, "Make Boton, no pudo cargar los botones" );
// Ejecutamos la funcion Pedida
BalanceDiario_Mensual( DIARIO );
// Recargamos los botones del men<65>
if ( carga_botones( "systm\\tpv_MP.img" ) != OK ) Error( 0x03, "Make Boton, no pudo cargar los botones" );
DibujaMenuPrincipal();
break;
case 3:
// Cargamos los botones del programa
if ( carga_botones( "systm\\tpv.img" ) != OK ) Error( 0x03, "Make Boton, no pudo cargar los botones" );
// Ejecutamos la funcion Pedida
BalanceDiario_Mensual( MENSUAL );
// Recargamos los botones del men<65>
if ( carga_botones( "systm\\tpv_MP.img" ) != OK ) Error( 0x03, "Make Boton, no pudo cargar los botones" );
DibujaMenuPrincipal();
break;
case 4:
PantallaGrafica( 215, 240, 415, 350 );
Imprime_Estaticos( 98, "systm\\Tpv_MP.img" );
BPush = SubItem( 9, 3 );
PantallaGrafica( 215, 240, 415, 350 );
switch( BPush )
{
// Ficha de clientes
case 1:
EjecutaModulo( FichaClientes );
break;
// Consultas de clientes
case 2:
EjecutaModulo( CompraClientes );
break;
// Datos de Interes
case 3:
EjecutaModulo( DatosClientes );
break;
}
break;
}
break;
// Programas Externos
case 6:
ProgramasExternos();
break;
// Miscelanea
case 7:
PantallaGrafica( 215, 215, 415, 430 );
Imprime_Estaticos( 96, "systm\\Tpv_MP.img" );
BPush = SubItem( 7, 6 );
PantallaGrafica( 215, 215, 415, 430 );
switch ( BPush )
{
case 1:
EjecutaModulo( ConfigurarMensajes );
LeeFuentes(Config.Vent_msg);
break;
case 2:
CargaDatosProtector();
EjecutaModulo( ProtectorPantalla );
LeeFuentes(Config.Vent_msg);
break;
case 3:
break;
case 4:
EjecutaModulo( GestionBaseDatos );
break;
case 5:
break;
case 6:
EjecutaModulo( ConfigurarEntorno );
break;
}
break;
// Salir
case 8:
ok = 1;
break;
// Seleccionar empresa
case 9:
Imprime_Estaticos( 97, "systm\\Tpv_MP.img" );
EscogeEmpresaActiva();
i = 0;
while ( SEmpr.AccessCode[0] != '\0' && strcmpi( PideClave( "Clave de Acceso", SEmpr.Empresa ), SEmpr.AccessCode ) != 0 )
{
Optar( 0, "ACCESO DENEGADO", "A continuaci<63>n debe", "elegir una empresa para", "poder gestionarla...", NULL );
i ++; if ( i > 3 )
{
Config.Intentos -= 1;
BConfig.EscribeReg( (void *)&Config, 0 );
BConfig.CerrarReg();
Optar( 0, "ACCESO DENEGADO", "El acceso ha sido denegado", "si lo sigue intentando", "el programa quedar<61> bloqueado.", NULL );
Error( 0x03, "Demasiados intentos fallidos de entrar en la empresa" );
}
// PantallaGrafica( 105, 70, 302, 280 );
Imprime_Estaticos( 97, "systm\\Tpv_MP.img" );
EscogeEmpresaActiva();
// PantallaGrafica( 105, 70, 302, 280 );
};
Config.Intentos = i = 2;
Config.UltimaEmpresa = SEmpr.CodigoR;
BConfig.EscribeReg( (void *)&Config, 0 );
sprintf( buffer, "datos\\%s\\tpv.pcx", NEmpresa );
DibujaMenuPrincipal();
sprintf( Buffer, "%s ", SEmpr.Empresa );
break;
// Gestion Empresas
case 10:
EjecutaModulo( InfoEmpresas );
// Comprobamos que exista la <20>ltima empresa con la que se trabaj<61>
if ( MatchEmpresa( Config.UltimaEmpresa, &i ) == OK )
{
sprintf( NEmpresa, "EMP%05d", SEmpr.CodigoR );
} else {
PulsoIntro = 1;
CurrCol = 9 - 1;
}
sprintf( Buffer, "%s ", SEmpr.Empresa );
break;
// Cambio de a<>o
case 11:
EjecutaModulo( CambiarAnyo );
break;
}
} while ( !ok );
}
void EjecutaModulo( void (*FuncionModulo)(void) )
{
Protector = 1;
// Cargamos los botones del programa
if ( carga_botones( "systm\\tpv.img" ) != OK ) Error( 0x03, "Make Boton, no pudo cargar los botones" );
// Ejecutamos la funcion Pedida
FuncionModulo();
// Recargamos los botones del men<65>
if ( carga_botones( "systm\\tpv_MP.img" ) != OK ) Error( 0x03, "Make Boton, no pudo cargar los botones" );
DibujaMenuPrincipal();
}
void MarcaItemSeleccionado( int Columna, char como )
{
Imprime_Bordes( SEC_MENU, ( Columna + 1 ), ( como == NORMAL ) ? -1 : 11 );
}
void MarcaSubItemSeleccionado( int Sec, int Columna, char como )
{
Imprime_Bordes( Sec, ( Columna + 1 ), ( como == NORMAL ) ? -1 : 11 );
}
void DibujaMenuPrincipal(void)
{
int i, Center;
char buffer[80];
char NombreMenu[8][80] = { "Articulos", "Proveedores", "Empleados",
"Compras", "Gestion Ventas", "Programas Externos",
"Miscelanea", "Salir" };
// Rellenamos la pantalla con un fondo atractivo...
setfillstyle( Config.FillBgS, Config.FillBgC ); bar( 0, 0, 640, 480 );
Imprime_Estaticos( 90, "systm\\tpv_MP.img" );
settextstyle( SMALL_FONT, HORIZ_DIR, 6 );
for ( i = 0; i < 8; i++ )
{
Center = (200 - textwidth( NombreMenu[i] ) ) / 2;
setcolor( EGA_BLACK ); outtextxy( 422 + Center, 164 + 40*i, NombreMenu[i] );
setcolor( EGA_WHITE ); outtextxy( 423 + Center, 165 + 40*i, NombreMenu[i] );
}
sprintf( buffer, "datos\\%s\\tpv.pcx", NEmpresa );
if ( access( buffer, 0 ) != 0 )
strcpy( buffer, "systm\\Tpv.pcx" );
DibujaLogotipo( buffer, 25, 5 );
Protector = 0;
sprintf( Buffer, "%s ", SEmpr.Empresa );
MensajesLn.x = 117; MensajesLn.y = 291;
MensajesLn.ndigitos = 11;
MensajesLn.AX = 2; MensajesLn.AY = 2;
MensajesLn.C1 = Config.DigBg; MensajesLn.C2 = Config.DigFg;
MuestraDatos();
}
/***************************************************************************\
|* *|
|* INT CLK *|
|* *|
|* Descripci<63>n: *|
|* interrupci<63>n para el parpadeo de los led's *|
|* *|
|* Entradas: (indeterminadas) *|
|* *|
|* *|
|* *|
|* Salidas: (ninguna) *|
|* *|
\***************************************************************************/
void interrupt handler(__CPPARGS)
{
/* increase the global counter */
if ( IntVect == ON )
{
count = (count++)%16;
if ( count == 1 )
{
setpalette( 11, EGA_GREEN );
setpalette( 13, EGA_LIGHTGREEN );
}
else if ( count == 8 )
{
setpalette( 11, EGA_RED );
setpalette( 13, EGA_LIGHTRED );
}
}
/* call the old routine */
oldhandler();
}
void DibujaLogotipo( char * File, int X, int Y )
{
FILE *fp;
int alto, ancho; unsigned char byte;
int contador;
char color[17] = { 0, EGA_RED, EGA_GREEN, EGA_LIGHTGRAY,
EGA_LIGHTRED, EGA_LIGHTRED, EGA_LIGHTRED, EGA_LIGHTRED,
EGA_LIGHTRED, EGA_LIGHTRED, EGA_LIGHTRED, EGA_LIGHTRED,
EGA_LIGHTRED, EGA_LIGHTRED, EGA_LIGHTRED, EGA_LIGHTRED, EGA_LIGHTRED };
if ( ( fp = fopen ( File, "rb" ) ) != NULL )
{
// Saltamos la cabecera
fseek( fp, 128, SEEK_SET );
for(alto=0; alto<279; alto++)
{
for(ancho=0; ancho<240; )
{
byte=getc(fp);
if(byte<=0xC0)
{
if ( byte != 255 )
putpixel( ancho+X, alto+Y, color[byte%16] );
ancho++;
}
else
{
contador=byte&0x3F; byte=getc(fp);
if ( byte != 255 )
for(; contador>0; contador--)
{
putpixel( ancho+X, alto+Y, color[byte%16] );
ancho++;
}
else
ancho += contador;
}
}
}
fclose( fp );
}
}
void PantallaGrafica( int X0, int Y0, int X1, int Y1 )
{
static void far *ImagenFondo;
static Memoria = 0;
if ( Memoria == 1 )
{
putimage( X0, Y0, ImagenFondo, COPY_PUT );
farfree( ImagenFondo );
Memoria = 0;
} else
if ( ( ImagenFondo = farmalloc( JD_imagesize( X0, Y0, X1, Y1 ) ) ) != NULL )
{
Memoria = 1;
getimage( X0, Y0, X1, Y1, ImagenFondo );
} else {
Error( 0x04, "Memoria insuficiente" );
}
}
int SubItem( int Sec, int NItem )
{
int ok, PulsoIntro, CurrSubCol, BPush;
int dev = -1;
ok = 0; PulsoIntro = 0; CurrSubCol = 0;
do {
if ( PulsoIntro == 0 )
{
MarcaSubItemSeleccionado( Sec, CurrSubCol, INTENSO );
BPush = Comprueba_Secuencia( Sec, NULL );//RatonVentas );
MarcaSubItemSeleccionado( Sec, CurrSubCol, NORMAL );
} else {
PulsoIntro = 0;
BPush = CurrSubCol + 1;
}
switch( BPush )
{
case 0: // No se pulso ningun BOTON
while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER
ok = 1; dev = -1;
break;
case -2: // Hay una tecla normal en BUFFER
// Intro
if ( (BPush = getch()) == 13 )
PulsoIntro = 1;
else if ( BPush == 27 ) { ok = 1; dev = -1; }
while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER
break;
case -1: // Hay una tecla especial en BUFFER
switch( getch() )
{
// Flecha Izquierda
case 75:
case 15:
// Flecha Arriba
case 72:
CurrSubCol--; if ( CurrSubCol < 0 ) CurrSubCol = NItem-1;
break;
// Flecha Derecha
case 77:
case 9:
ok = 1;
dev = -1;
break;
// Flecha Abajo
case 80:
CurrSubCol++; if ( CurrSubCol > (NItem-1) ) CurrSubCol = 0;
break;
// Inicio
case 71:
CurrSubCol = 0;
break;
// Fin
case 79:
CurrSubCol = 9;
break;
default:
while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER
}
break;
//
default:
if ( BPush <= NItem && BPush > 0 )
{
ok = 1;
dev = BPush;
}
break;
}
} while ( !ok );
return dev;
}
#define POS_INICIAL 200
int ScrollUpProtectorPantalla( void )
{
p_Ampliada LetraG;
time_t first;
FILE *ftexto;
int POS_Y;
char far *VGARam = (char far *)MK_FP( 0xA000, 0);
char *Buf2Num;
char buff_MSG[100], DRAW, ok, i;
LeeFuentes(Config.Prot_fnt);
sprintf( buff_MSG, "datos\\%s\\Scroll.txt", NEmpresa );
if ( (ftexto = fopen( buff_MSG, "r" ) ) == NULL )
{
// Optar( 0, "<22> NO EXISTEN MENSAJES !", "No existen mensajes que", "mostrar, asi que esto", "no va a funcionar.", NULL );
return 1;
}
LetraG . x = 0; LetraG . y = POS_INICIAL-16*2;
LetraG . ndigitos = 40;
LetraG . AX = 1; LetraG . AY = 2;
LetraG . C1 = 0; LetraG . C2 = Config.DigFg+5;
LetraG . C3 = -1;
desactiva_raton();
// Cambiamos a 320x200
IntVect = OFF;
restorecrtmode();
asm mov al, 0x13
asm mov ah, 0x00
asm int 0x10
POS_Y = POS_INICIAL-1;
sprintf( buff_MSG, "TPV v1.1 JD Soft. 1997 (c)" );
DRAW = 1;
do {
// Si hemos terminado con esta linea, fin...
POS_Y --;
if ( POS_Y <= ( POS_INICIAL - 16*2 ) )
{
if ( 1 == 1 || POS_Y <= ( POS_INICIAL - 16*2 - 4 ) )
{
DRAW = 1;
// Obtenemos la linea siguiente
do {
if ( fgets( buff_MSG, 95, ftexto ) == NULL )
{
rewind( ftexto );
if ( fgets( buff_MSG, 95, ftexto ) == NULL )
{
fclose( ftexto );
Error( 0x00, "Algo raro pasa con el archivo de mensajes" );
}
}
i = strlen( buff_MSG ) - 1;
for ( ; i < 40; i++ )
buff_MSG[i] = 32;
buff_MSG[41] = '\0';
if ( buff_MSG[0] == '@' )
{
ok = 0;
Buf2Num = buff_MSG;
LetraG . C1 = LetraG . C2 = 0;
while ( *(Buf2Num++) != ',' )
if ( (*Buf2Num -'0') >= 0 && (*Buf2Num -'0') <= 9 )
LetraG . C1 = LetraG . C1*10 + (*Buf2Num - '0');
// *(Buf2Num--);
while ( *(Buf2Num++) != '\n' && *Buf2Num != '\0' )
if ( (*Buf2Num -'0') >= 0 && (*Buf2Num -'0') <= 9 )
LetraG . C2 = LetraG . C2*10 + (*Buf2Num - '0');
LetraG . C2 = LetraG . C2 / 10;
} else ok = 1;
}while( !ok );
// Reseteamos la posici<63>n
POS_Y = POS_INICIAL-1;
} else DRAW = 0;
}
LetraG . y = POS_Y;
// Esperamos al retrace vertical
asm mov dx,3DAh
l1:
asm in al,dx
asm and al,08h
asm jnz l1
l2:
asm in al,dx
asm and al,08h
asm jz l2
_fmemcpy( &VGARam[0], &VGARam[320], 63680 );
if ( DRAW )
FuenteAmplia( buff_MSG, &LetraG );
} while( !kbhit() );
fclose( ftexto );
while ( kbhit() ) getch();
// Cambiamos a 640x480
asm mov al, 0x03
asm mov ah, 0x00
asm int 0x10
setgraphmode( 2 );
inicializa_raton_grafico( 0, 0, 639, 479 );
//////////
setrgbpalette(EGA_WHITE, 56, 58, 59 );
setrgbpalette(EGA_LIGHTGRAY, 30, 37, 43 );
setrgbpalette(EGA_DARKGRAY, 24, 27, 30 );
IntVect = ON;
ungetch( 255 );
return 0;
}
void Error( int code, char *MensajeError )
{
free( ptr_char );
AnulaInterrupcion();
restorecrtmode();
BConfig.CerrarReg();
printf( "\nSe produjo un codigo de error %d, subcodigo no disponible ", code );
switch( code )
{
case 0:
printf( "\n Error Desconocido " );
break;
case 1:
printf( "\n BDatos gener<65> el error de salida. |ERROR DE ACCESO| " );
break;
case 2:
printf( "\n Make Boton gener<65> el error de salida " );
break;
case 3:
printf( "\n Fall<6C> en alg<6C>n punto del men<65> principal" );
break;
};
printf( "\n> %s_", MensajeError );
exit(code);
}
void CambiarAnyo( void )
{
int VisualYear, ok;
char Mes[12+1][15] = { "cuadratura", "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" };
char buffer[80], buffer1[80];
getdate( &FechaGestionActual );
sprintf( buffer1, "Hoy es %d de %s de %d", FechaGestionActual.da_day, Mes[FechaGestionActual.da_mon], FechaGestionActual.da_year );
sprintf( buffer, "A<EFBFBD>o visual: [ %04d ]", FechaGestionActual.da_year );
Optar( ENCUADRE, "Revisi<EFBFBD>n de la Fecha", buffer1, "", buffer, NULL );
VisualYear = FechaGestionActual.da_year;
ok = 0;
do {
switch( Comprueba_Secuencia( SEC_OPTAR, NULL ) )
{
case 0: // No se pulso ningun BOTON
case -1:
while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER
break;
case -2:
do {
sprintf( buffer, "%d", VisualYear );
// . .
if ( (ok = (InputCadenaG( buffer, 1, 4, Config.TxtFgN, Config.TxtBgN, 350, 200 /*- 2*/ + 20*3, 350+50, 200 /*- 2*/-2 + 20*4) >> 8) ) )
break;
} while ( strlen( buffer ) != 4 );
if ( !ok )
VisualYear = atoi( buffer );
setfillstyle( SOLID_FILL, 7 );
bar( 350, 200 /*- 2*/ + 20*3, 350+50, 200 /*- 2*/-2 + 20*4 );
sprintf( buffer, "%d", VisualYear );
setcolor( 0 ); outtextxy( 350, 200 + 20*3, buffer );
ok = 0;
break;
case 1:
ok = 1;
break;
case 2:
ok = 1;
VisualYear = FechaGestionActual.da_year;
break;
}
// Obtenemos el a<>o a visualizar
// VisualYear = "" " "" ""
} while( !ok );
Optar( ENCUADRE, "Revisi<EFBFBD>n de la Fecha", "", "", buffer, NULL );
VisualMode = ERROR;
if ( VisualYear > FechaGestionActual.da_year )
Optar( 0, "Cambio del A<>o", "No puede visualizar datos", "que aun no existen...", NULL );
else
if ( VisualYear < FechaGestionActual.da_year )
{
Optar( 0, "Cambio del A<>o", "Modo visualizaci<63>n, no se", "permitir<EFBFBD> editar ning<6E>n dato.", NULL );
VisualMode = OK;
FechaGestionActual.da_day = 1;
FechaGestionActual.da_mon = 1;
FechaGestionActual.da_year = VisualYear;
}
}
/**************************************************************************\
|* *|
|* RecopilaDatos *|
|* *|
|* Descripci<63>n: *|
|* Recopila todos los datos utilies, de la empresa seleccionada*|
|* *|
|* Entradas: (ninguna) *|
|* *|
|* Salidas: (ninguna) *|
|* *|
\**************************************************************************/
void RecopilaDatos( void )
{
char buffer[80];
long RegComp[31 + 2];
int scl, ctot, clib;
long bcl;
struct ffblk ffblk;
union REGS r;
int done, i;
int MesActual = FechaGestionActual.da_mon;
// Recopilaci<63>n de datos sobre: Empresas
sprintf( buffer, "datos\\empresas.dbf" );
if ( access( buffer, 0 ) == 0 && BEmpr.AbrirReg( buffer, sizeof( INFO_EMPRESAS ) ) != ERROR )
{
DatosInf.NumEmpr = (int)BEmpr.Registros();
DatosInf.EmprAct = SEmpr.CodigoR;
strcpy( DatosInf.NEmpresa, SEmpr.Empresa );
BEmpr.CerrarReg();
} else
DatosInf.NumEmpr = 0;
// Recopilaci<63>n de datos sobre: Articulos
sprintf( buffer, "datos\\%s\\info_ref.dbf", NEmpresa );
if ( access( buffer, 0 ) == 0 && BRef.AbrirReg( buffer, sizeof( INFO_PRODUCTOS ) ) != ERROR )
{
DatosInf.NumProd = BRef.Registros();
BRef.CerrarReg();
} else
DatosInf.NumProd = 0;
sprintf( buffer, "datos\\%s\\info_prv.%03d", NEmpresa, ( FechaGestionActual.da_year - (FechaGestionActual.da_year/1000)*1000 ) );
if ( access( buffer, 0 ) == 0 && BProv.AbrirReg( buffer, sizeof( INFO_PROVEEDORES ) ) != ERROR )
{
DatosInf.NumProv = (int)BProv.Registros();
BProv.CerrarReg();
} else
DatosInf.NumProv = 0;
sprintf( buffer, "datos\\%s\\info_emp.dbf", NEmpresa );
if ( access( buffer, 0 ) == 0 && BEmpl.AbrirReg( buffer, sizeof( INFO_EMPLEADOS ) ) != ERROR )
{
DatosInf.NumEmpl = (int)BEmpl.Registros();
BEmpl.CerrarReg();
} else
DatosInf.NumEmpl = 0;
DatosInf.NumComp[0] = DatosInf.NumComp[1] = 0;
sprintf( buffer, "datos\\%s\\Cmp-%04d.M%02d", NEmpresa, FechaGestionActual.da_year, MesActual );
if ( access( buffer, 0 ) == 0 && BCmp.AbrirReg( buffer, sizeof( COMPRAS ) ) != ERROR )
{
BCmp.CargaDatosUsuario( (void *)RegComp, sizeof(long)*32 );
for ( i = 1; i <= 31; i++ )
DatosInf.NumComp[0] += (int)RegComp[i];
DatosInf.NumComp[1] = (int)RegComp[FechaGestionActual.da_day];
BCmp.CerrarReg();
}
// Datos de interes vario: Espacio Libre en disco
char unidad = bdos(0x19,0,0);
r.h.ah = 0x36;
r.h.dl = unidad+1;
intdos(&r,&r);
scl = r.x.ax; /*sectores por cluster*/
bcl = (long)scl*r.x.cx; /*bytes por cluster*/
ctot = r.x.dx; /*clusters total*/
clib = r.x.bx; /*clusters libres*/
DatosInf.EspacioLib = (clib*bcl);
// Datos de interes vario:
// Espacio consumido por las bases de datos ( del la EMPRESA ACTUAL )
DatosInf.EspacioCon = 0;
sprintf( buffer, "datos\\%s\\*.*", NEmpresa );
done = findfirst( buffer, &ffblk, 0);
while (!done)
{
DatosInf.EspacioCon += ffblk.ff_fsize;
done = findnext(&ffblk);
}
}
/**************************************************************************\
|* *|
|* MuestraDatos *|
|* *|
|* Descripci<63>n: *|
|* Muestra los datos previamente recopilados. *|
|* *|
|* Entradas: (ninguna) *|
|* *|
|* Salidas: (ninguna) *|
|* *|
\**************************************************************************/
#define NUM_LINEAS 15
void MuestraDatos( void )
{
static char LineaActual = 0;
p_Ampliada InfoDatos;
char buffer[120];
int i;
LineaActual = 0;
InfoDatos.x = 30;
InfoDatos.ndigitos = 32;
InfoDatos.AX = 1; InfoDatos.AY = 1;
InfoDatos.C1 = 0; InfoDatos.C2 = Config.TxtFgI;
InfoDatos.C3 = 0;
for ( i = 0; i < NUM_LINEAS; i++ )
{
switch( ( LineaActual + i ) % NUM_LINEAS )
{
case 0:
sprintf( buffer, "Existen %d empresas definidas ", DatosInf.NumEmpr );
break;
case 1:
buffer[0] = ' ';
buffer[1] = '\0';
break;
case 2:
sprintf( buffer, ">>--> Datos referentes a: " );
break;
case 3:
sprintf( buffer, "< %ld %s > ", DatosInf.EmprAct, DatosInf.NEmpresa );
break;
case 4:
buffer[0] = ' ';
buffer[1] = '\0';
break;
case 5:
sprintf( buffer, "Numero de articulos: %5ld ", DatosInf.NumProd );
break;
case 6:
sprintf( buffer, "Numero de proveedores: %5d ", DatosInf.NumProv );
break;
case 7:
sprintf( buffer, "Numero de empleados: %5d ", DatosInf.NumEmpl );
break;
case 8:
sprintf( buffer, "Compras hoy: %d de %d ", DatosInf.NumComp[1], DatosInf.NumComp[0] );
break;
case 9:
buffer[0] = ' ';
buffer[1] = '\0';
break;
case 10:
buffer[0] = ' ';
buffer[1] = '\0';
break;
case 11:
sprintf( buffer, "Espacio ocup: %ld Kb de %d Mb ", DatosInf.EspacioCon / 1024, DatosInf.EspacioLib / 1048576L );
break;
case 12:
if ( SEmpr.AccessCode[0] != '\0' )
sprintf( buffer, "Posee codigo de acceso global " );
else
sprintf( buffer, "Sin codigo de acceso global " );
break;
default:
buffer[0] = ' ';
buffer[1] = '\0';
break;
};
InfoDatos.y = 330 + 8*i;
// No tenemos mas remedio que acceder a los datos privados:
InfoDatos.BitByte = 0; InfoDatos.currByte = 0;
Fuente_Amplia( buffer, &InfoDatos );
}
LineaActual = ( LineaActual++ ) % NUM_LINEAS;
}
/**************************************************************************\
|* *|
|* ConfirmaSaltoInicio *|
|* *|
|* Descripci<63>n: *|
|* Confirma que el salto hacia ventas diarias a de producirse. *|
|* Se dispone de tan solo 30 segundos. *|
|* (solo si esta en modo autom<6F>tico) *|
|* *|
|* Entradas: (ninguna) *|
|* *|
|* Salidas: Confirmaci<63>n del salto *|
|* *|
\**************************************************************************/
#define TIEMPO_DE_ESPERA 15
int ConfirmaSaltoInicio( void )
{
time_t t, dt;
p_graphics TiempoRestante = { 415, 265, 2, 2, 2, Config.NumFg, Config.NumBg, Config.NumLn };
Optar( ENCUADRE, "Confirmaci<EFBFBD>n de salto", NULL );
Imprime_Estaticos( 500, "systm\\Tpv.img" );
Numero_Digital( -1, &TiempoRestante );
t = time( NULL );
do {
dt = ( time( NULL ) - t );
Numero_Digital( TIEMPO_DE_ESPERA - dt, &TiempoRestante );
} while( dt < TIEMPO_DE_ESPERA );
Optar( ENCUADRE, "Confirmaci<EFBFBD>n de salto", NULL );
// return ERROR;
return OK;
}
void ProgramasExternos(void)
{
Imprime_Estaticos( 99, "systm\\Tpv_MP.img" );
getch();
}