First commit 20/03/1997

This commit is contained in:
2021-09-08 21:44:52 +02:00
commit 6823005994
300 changed files with 31820 additions and 0 deletions

717
TPV_IVEN.CPP Normal file
View File

@ -0,0 +1,717 @@
#include <io.h>
#include <alloc.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
#include <graphics.h>
#include "c:\program\src_dos\libs\make_bot\make_bot.h"
#include "c:\program\src_dos\libs\bdatos\bdatos.hh"
#include "tpv_def.h"
#define NLINEAS_IVENT 15
extern BDatos B_IVentas2; // Archivo de Ventas 2 de 3 ( Productos Vendidos )
extern INFORME2_VENTAS S_IVentas2; // Productos Vendidos ( 2 de 3 )
extern char DiaActual, MesActual;
extern long RegCompras[31 + 2];// Indice para cado uno de los dias del mes + 2
extern char AjusteCalendario; // Ajuste para los dias del calendario
extern char DiasMes; // Dias que tiene el mes actual
// Empresa a la que se le realizan las gestiones
extern char EmpresaActual[9];
/*************************************\
| |
| Parte Principal del M<>dulo |
| |
\*************************************/
void MuestraComprasDias( void );
void MuestraAyudaIVentas( char columna );
void MuestraDatosIVentas( long RowStart );
void MuestraIVentas( char columna, int linea, char como );
extern void MuestraMesActual( char MesMostrar );
extern void ObtenCoordenadasRef2( char columna, char linea, int *X0, int *Y0, int *X1, int *Y1 );
/*************************************\
| |
| Parte Secundaria del M<>dulo |
| |
| Secci<63>n de Busqueda de Productos |
| |
\*************************************/
extern void ObtenCoordenadasMatch( char Row, int *X0, int *Y0, int *X1, int *Y1 );
void BuscaIVent( char TipoBusqueda, char *CurrRow, long *CurrIVent );
extern void MatchDrawRef( char Row, INFO_PRODUCTOS MRef, char como );
int MatchIVent( INFORME2_VENTAS A, INFORME2_VENTAS B );
extern void EditMatchRef( char Row, INFO_PRODUCTOS * MRef );
extern int ObtenMatchRef( INFO_PRODUCTOS *MRef );
/*************************************\
| |
| Parte Tercera del M<>dulo |
| |
| Secci<63>n para la impresi<73>n |
| |
\*************************************/
void ImprimeVentasProductos(void);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <20> Parte principal del m<>dulo <20>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/**************************************************************************\
|* *|
|* InfoVentaProductos *|
|* *|
|* Descripci<63>n: *|
|* Graficas sobre la venta de productos... *|
|* *|
|* Entradas: (ninguna) *|
|* Salidas: (ninguna) *|
|* *|
\**************************************************************************/
void InfoVentaProductos(void)
{
char buffer[100], ok = 0;
int BPush, OldMes;
char oldCol = -1;
char CurrRow; // Linea sobre la que estamos
char CurrCol; // Columna sobre la que estamos
long CurrIVent; // Producto sobre el que estamos posicionados a golpes
// Actualizasmos el mes y dia actual en curso
DiaActual = FechaGestionActual.da_day;
MesActual = FechaGestionActual.da_mon;
// Calculamos los dias que tiene el mes y el ajuste necesario
CalculaAjusteDias( &AjusteCalendario, &DiasMes, MesActual, FechaGestionActual.da_year );
// Rellenamos la pantalla con un fondo atractivo...
setfillstyle( Config.FillBgS, Config.FillBgC ); bar( 0, 0, 640, 480 );
Imprime_Estaticos( 24, "systm\\Tpv.img"); // Imprime botones estaticos 'Seccion 1'
// Archivo de productos vendidos ( 2 de 3 )
sprintf( buffer, "datos\\%s\\VT2-%04d.M%02d", NEmpresa, FechaGestionActual.da_year, MesActual );
if ( access( buffer, 0 ) != 0 )
{
MesActual = 0;
// Buscamos un mes accesible hacia adelante
do {
// Avanzamos y comprobamos existencia del archivo
MesActual++;
// Archivo de productos vendidos ( 2 de 3 )
sprintf( buffer, "datos\\%s\\VT2-%04d.M%02d", NEmpresa, FechaGestionActual.da_year, MesActual );
if ( access( buffer, 0 ) == 0 )
{
B_IVentas2.CerrarReg(); // Cerramos el antiguo y abrimos el nuevo
if ( B_IVentas2.AbrirReg( buffer, sizeof( INFORME2_VENTAS ) ) == ERROR )
Error( 0x01, "Imposible abrir archivo, Ventas diarias 2 de 3" );
// Solo si contiene datos, sera v<>lido
if ( B_IVentas2.Registros() > 0 )
{
B_IVentas2.CerrarReg(); // Cerramos para una posterior apertura.
break;
}
}
} while( MesActual <= 12 );
}
// Calculamos los dias que tiene el mes y el ajuste necesario
CalculaAjusteDias( &AjusteCalendario, &DiasMes, MesActual, FechaGestionActual.da_year );
// Si no logramos situarnos en un mes posterior, REGRESAMOS!!!
if ( MesActual > 12 )
{
Optar( 0, "Atencion !!!", "No existen ventas", "por lo tanto, no hay", "nada que evaluar...", NULL );
B_IVentas2.CerrarReg();
return;
}
if ( B_IVentas2.AbrirReg( buffer, sizeof( INFORME2_VENTAS ) ) == ERROR )
Error( 0x01, "Imposible abrir archivo, Ventas diarias 2 de 3" );
// Si no hay registros, creamos uno almenos.
if ( B_IVentas2.Registros() == 0 )
{
Optar( 0, "Atencion !!!", "No existen ventas", "por lo tanto, no hay", "nada que evaluar...", NULL );
B_IVentas2.CerrarReg();
return;
}
CurrIVent = 0; CurrRow = 0;
// Mostramos datos hasta que se nos acabe la pantalla
MuestraDatosIVentas( CurrRow + CurrIVent );
if ( B_IVentas2.LeeReg( (void *)&S_IVentas2, 0 ) == ERROR )
Error( 1, B_IVentas2.cError);
MuestraComprasDias();
// Mostramos el mes Actual
MuestraMesActual( MesActual );
CurrCol = 0;
do {
if ( CurrCol != oldCol || CurrCol == 2 )
{
oldCol = CurrCol; MuestraAyudaIVentas( CurrCol );
}
MuestraIVentas( CurrCol, CurrRow, INTENSO );
BPush = Comprueba_Secuencia( 2, NULL );
MuestraIVentas( CurrCol, CurrRow, NORMAL );
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
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 = 4;
break;
// Flecha Derecha
case 77:
case 9:
CurrCol++; if ( CurrCol > 4 ) CurrCol = 0;
break;
// Flecha Arriba
case 72:
if ( (CurrRow + CurrIVent) > 0 )
{
if ( ( CurrRow ) <= 0 )
{
CurrRow = NLINEAS_IVENT - 1; CurrIVent -= NLINEAS_IVENT;
if ( CurrIVent < 0 ) CurrIVent = 0;
while( ( CurrRow + CurrIVent ) >= B_IVentas2.Registros() && CurrRow > 0 ) CurrRow--;
while( ( CurrRow + CurrIVent ) >= B_IVentas2.Registros() && CurrIVent > 0 ) CurrIVent++;
// Mostramos datos hasta que se nos acabe la pantalla
MuestraDatosIVentas( CurrIVent );
} else {
CurrRow --; if ( CurrRow < 0 ) CurrRow = 0;
}
}
if ( B_IVentas2.LeeReg( (void *)&S_IVentas2, (CurrIVent + CurrRow) ) == ERROR )
Error( 1, B_IVentas2.cError);
MuestraComprasDias();
break;
// Flecha Abajo
case 80:
if ( ( CurrRow + CurrIVent ) < B_IVentas2.Registros() - 1 )
{
if ( ( CurrRow ) >= NLINEAS_IVENT - 1 )
{
CurrRow = 0; CurrIVent += NLINEAS_IVENT;
while ( (CurrIVent + CurrRow) >= B_IVentas2.Registros() ) CurrIVent--;
// Mostramos datos hasta que se nos acabe la pantalla
MuestraDatosIVentas( CurrIVent );
} else
CurrRow++;
}
if ( B_IVentas2.LeeReg( (void *)&S_IVentas2, (CurrIVent + CurrRow) ) == ERROR )
Error( 1, B_IVentas2.cError);
MuestraComprasDias();
break;
// Inicio
case 71:
CurrRow = 0;
if ( CurrIVent != 0 )
{
CurrIVent = 0;
// Mostramos datos hasta que se nos acabe la pantalla
MuestraDatosIVentas( CurrIVent );
}
if ( B_IVentas2.LeeReg( (void *)&S_IVentas2, (CurrIVent + CurrRow) ) == ERROR )
Error( 1, B_IVentas2.cError);
MuestraComprasDias();
break;
// Fin
case 79:
CurrRow = 0;
if ( CurrIVent != B_IVentas2.Registros() - NLINEAS_IVENT )
{
CurrIVent = B_IVentas2.Registros() - NLINEAS_IVENT;
if ( CurrIVent < 0 )
{
CurrIVent = 0;
CurrRow = B_IVentas2.Registros()-1;
}
// Mostramos datos hasta que se nos acabe la pantalla
MuestraDatosIVentas( CurrIVent );
}
if ( B_IVentas2.LeeReg( (void *)&S_IVentas2, (CurrIVent + CurrRow) ) == ERROR )
Error( 1, B_IVentas2.cError);
MuestraComprasDias();
break;
}
break;
// Imprimir Informe
case 1:
ImprimeVentasProductos();
break;
// Menu Principal
case 2:
ok = 1;
break;
// MesAnterior
case 3:
OldMes = MesActual;
CurrRow = CurrIVent = 0;
// Buscamos un mes accesible hacia adelante
do {
// Avanzamos y comprobamos existencia del archivo
MesActual--;
// Archivo de productos vendidos ( 2 de 3 )
sprintf( buffer, "datos\\%s\\VT2-%04d.M%02d", NEmpresa, FechaGestionActual.da_year, MesActual );
if ( access( buffer, 0 ) == 0 )
{
B_IVentas2.CerrarReg(); // Cerramos el antiguo y abrimos el nuevo
if ( B_IVentas2.AbrirReg( buffer, sizeof( INFORME2_VENTAS ) ) == ERROR )
Error( 0x01, "Imposible abrir archivo, Ventas diarias 2 de 3" );
// Solo si contiene datos, sera v<>lido
if ( B_IVentas2.Registros() > 0 )
break;
}
} while( MesActual >= 1 );
// Si no logramos situarnos en un mes posterior, REGRESAMOS!!!
if ( MesActual < 1 )
{
MesActual = OldMes;
B_IVentas2.CerrarReg(); // Cerramos el antiguo y abrimos el nuevo
sprintf( buffer, "datos\\%s\\VT2-%04d.M%02d", NEmpresa, FechaGestionActual.da_year, MesActual );
if ( B_IVentas2.AbrirReg( buffer, sizeof( INFORME2_VENTAS ) ) == ERROR )
Error( 0x01, "Imposible abrir archivo, Ventas diarias 2 de 3" );
Optar( 0, "Atencion !!!", "No existen ventas ese mes", "por lo tanto, no hay", "nada que evaluar...", NULL );
}
// Calculamos los dias que tiene el mes y el ajuste necesario
CalculaAjusteDias( &AjusteCalendario, &DiasMes, MesActual, FechaGestionActual.da_year );
MuestraDatosIVentas( CurrIVent );
if ( B_IVentas2.LeeReg( (void *)&S_IVentas2, (CurrIVent + CurrRow) ) == ERROR )
Error( 1, B_IVentas2.cError);
MuestraComprasDias();
// Mostramos el mes Actual
MuestraMesActual( MesActual );
break;
// MesPosterior
case 4:
OldMes = MesActual;
CurrRow = CurrIVent = 0;
// Buscamos un mes accesible hacia adelante
do {
// Avanzamos y comprobamos existencia del archivo
MesActual++;
// Archivo de productos vendidos ( 2 de 3 )
sprintf( buffer, "datos\\%s\\VT2-%04d.M%02d", NEmpresa, FechaGestionActual.da_year, MesActual );
if ( access( buffer, 0 ) == 0 )
{
B_IVentas2.CerrarReg(); // Cerramos el antiguo y abrimos el nuevo
if ( B_IVentas2.AbrirReg( buffer, sizeof( INFORME2_VENTAS ) ) == ERROR )
Error( 0x01, "Imposible abrir archivo, Ventas diarias 2 de 3" );
// Solo si contiene datos, sera v<>lido
if ( B_IVentas2.Registros() > 0 )
break;
}
} while( MesActual <= 12 );
// Si no logramos situarnos en un mes posterior, REGRESAMOS!!!
if ( MesActual > 12 )
{
MesActual = OldMes;
B_IVentas2.CerrarReg(); // Cerramos el antiguo y abrimos el nuevo
sprintf( buffer, "datos\\%s\\VT2-%04d.M%02d", NEmpresa, FechaGestionActual.da_year, MesActual );
if ( B_IVentas2.AbrirReg( buffer, sizeof( INFORME2_VENTAS ) ) == ERROR )
Error( 0x01, "Imposible abrir archivo, Ventas diarias 2 de 3" );
Optar( 0, "Atencion !!!", "No existen ventas ese mes", "por lo tanto, no hay", "nada que evaluar...", NULL );
}
// Calculamos los dias que tiene el mes y el ajuste necesario
CalculaAjusteDias( &AjusteCalendario, &DiasMes, MesActual, FechaGestionActual.da_year );
MuestraDatosIVentas( CurrIVent );
if ( B_IVentas2.LeeReg( (void *)&S_IVentas2, (CurrIVent + CurrRow) ) == ERROR )
Error( 1, B_IVentas2.cError);
MuestraComprasDias();
// Mostramos el mes Actual
MuestraMesActual( MesActual );
break;
// Retroceso R<>pido
case 5:
#ifndef DEMOSTRACION
CurrRow = NLINEAS_IVENT - 1; CurrIVent -= NLINEAS_IVENT;
if ( CurrIVent < 0 ) CurrIVent = 0;
while( ( CurrRow + CurrIVent ) >= B_IVentas2.Registros() && CurrRow > 0 ) CurrRow--;
while( ( CurrRow + CurrIVent ) >= B_IVentas2.Registros() && CurrIVent > 0 ) CurrIVent++;
// Mostramos datos hasta que se nos acabe la pantalla
MuestraDatosIVentas( CurrIVent );
if ( B_IVentas2.LeeReg( (void *)&S_IVentas2, (CurrIVent + CurrRow) ) == ERROR )
Error( 1, B_IVentas2.cError);
MuestraComprasDias();
#endif
break;
// Busqueda Atras
case 6:
// BuscaRef( ATRAS, &CurrRow, &CurrIVent );
break;
// Buscar
case 7:
// BuscaRef( NUEVA_BUSQUEDA, &CurrRow, &CurrIVent );
break;
// Busqueda Adelante
case 8:
// BuscaRef( ADELANTE, &CurrRow, &CurrIVent );
break;
// AvanceR<65>pido
case 9:
#ifndef DEMOSTRACION
CurrRow = 0; CurrIVent += NLINEAS_IVENT;
while ( (CurrIVent + CurrRow) >= B_IVentas2.Registros() ) CurrIVent--;
// Mostramos datos hasta que se nos acabe la pantalla
MuestraDatosIVentas( CurrIVent );
if ( B_IVentas2.LeeReg( (void *)&S_IVentas2, (CurrIVent + CurrRow) ) == ERROR )
Error( 1, B_IVentas2.cError);
MuestraComprasDias();
#endif
break;
case 10:
break;
default:
break;
}
} while( !ok );
B_IVentas2.CerrarReg();
}
/**************************************************************************\
|* *|
|* GraficasComprasMeses *|
|* *|
|* Descripci<63>n: *|
|* Muestra una grafica, donde se reflejan las compras realiz. *|
|* a ese proveedor a lo largo del a<>o... *|
|* *|
|* Entradas: (ninguna) *|
|* Salidas: (ninguna) *|
|* *|
\**************************************************************************/
void MuestraComprasDias(void)
{
char Mensajes[][12] = { "1", "2", "3", "4", "5", "6", "7", "8", "9","10",
"11","12","13","14","15","16","17","18","19","20",
"21","22","23","24","25","26","27","28","29","30",
"31"
};
MuestraGraficas( 10, 15, 380, 95, DiasMes, (long *)S_IVentas2.VentaTotal, Mensajes );
}
/**************************************************************************\
|* *|
|* MuestraDatosIVentas *|
|* *|
|* Descripci<63>n: *|
|* Dado un registro, se muestran sucesivamente este y todos *|
|* los que hay por debajo de <20>l, hasta que se agote la base *|
|* o no quepan mas en la pantalla. *|
|* *|
|* Entradas: Registro por el que comenzar *|
|* Salidas: (ninguna) *|
|* *|
\**************************************************************************/
void MuestraDatosIVentas( long RowStart )
{
int linea, campo;
char dev;
int X0, Y0, X1, Y1;
// Imprimo la NLINEAS_IVENT que caben en la pantalla
dev = OK;
for ( linea=0; linea < NLINEAS_IVENT && dev == OK; linea++ )
{
dev = B_IVentas2.LeeReg( (void *)&S_IVentas2, RowStart + linea );
if ( dev == OK )
// Por cada linea hay 5 campos, ehhh!!!
for ( campo=0; campo < 5; campo++ )
MuestraIVentas( campo, linea, NORMAL );
}
// Ahora limpio los restantes huecos si los hay
if ( dev != OK )
{
linea--;
setfillstyle( SOLID_FILL, Config.TxtBgN );
for ( ; linea < NLINEAS_IVENT; linea++ )
for ( campo=0; campo < 5; campo++ )
{
ObtenCoordenadasRef2( campo, linea, &X0, &Y0, &X1, &Y1 );
bar( X0, Y0, X1, Y1 );
}
}
}
/**************************************************************************\
|* *|
|* MuestraRef2 *|
|* *|
|* Descripci<63>n: *|
|* Reescribe el campo dado, seg<65>n la fila, y la intensidad *|
|* *|
|* Entradas: *|
|* columna campo ha mostar *|
|* linea linea en la que nos encontramos *|
|* como intensidad del texto (NORMAL/INTENSO) *|
|* *|
|* Salidas: (ninguna) *|
|* *|
\**************************************************************************/
void MuestraIVentas( char columna, int linea, char como )
{
char buffer[80], font, Dia;
char buffer1[80], buffer2[80];
long UnidadesVentas, VentaTotal, PrecioCosto;
int X0, Y0, X1, Y1;
ObtenCoordenadasRef2( columna, linea, &X0, &Y0, &X1, &Y1 );
if ( S_IVentas2.CantUnitaria == 0 ) S_IVentas2.CantUnitaria = 1;
UnidadesVentas = 0;
VentaTotal = 0;
PrecioCosto = 0;
for ( Dia=0; Dia < DiasMes; Dia++ )
{
VentaTotal += S_IVentas2.VentaTotal[Dia];
PrecioCosto += S_IVentas2.PrecioCosto[Dia];
for ( font = 0; font < 6; font++ )
UnidadesVentas += S_IVentas2.Cantidad[Dia][font];
}
font = 1;
switch( columna )
{
// Codigo Real
case 0:
sprintf ( buffer, " %09lu", S_IVentas2.CodigoR );
break;
// Nombre del producto
case 1:
sprintf ( buffer, "%30s", S_IVentas2.Nombre );
break;
// Unidades Vendidas
case 2:
if ( S_IVentas2.CantUnitaria == 1 )
{
formatea_long( (long)( UnidadesVentas ), buffer1 );
sprintf ( buffer, "%9s", buffer1 );
} else {
formatea_long( (long)( UnidadesVentas / S_IVentas2.CantUnitaria ), buffer1 );
formatea_long( (long)( UnidadesVentas % S_IVentas2.CantUnitaria ), buffer2 );
sprintf ( buffer, "%6s %6s", buffer1, buffer2 );
font = 0;
}
break;
// Valoracion de la venta
case 3:
formatea_long( (long)( VentaTotal/* PrecioCosto UnidadesVentas*/ ), buffer1 );
sprintf ( buffer, "%12s", buffer1 );
font = 0;
break;
// Beneficio de la venta
case 4:
formatea_long( (long)( ( VentaTotal - PrecioCosto ) ), buffer1 );
sprintf ( buffer, "%12s", buffer1 );
font = 0;
break;
}
setfillstyle( SOLID_FILL, ( como == NORMAL ) ? Config.TxtBgN : Config.TxtBgI );
bar( X0, Y0, X1, Y1 );
setcolor ( ( como == NORMAL ) ? Config.TxtFgN : Config.TxtFgI );
if ( font == 0 ) settextstyle( SMALL_FONT, HORIZ_DIR, 4 );
outtextxy( X0+2, Y0, buffer );
if ( font == 0 ) settextstyle( SMALL_FONT, HORIZ_DIR, 5 );
}
/**************************************************************************\
|* *|
|* MuestraAyudaRef2 *|
|* *|
|* Descripci<63>n: *|
|* Muestra una peque<75>a descripcion del contenido para el campo *|
|* *|
|* Entradas: *|
|* columna campo ha mostar su ayuda *|
|* *|
|* Salidas: (ninguna) *|
|* *|
\**************************************************************************/
void MuestraAyudaIVentas( char columna )
{
char buffer1[80];
switch( columna )
{
// Codigo Real
case 0:
sprintf ( buffer1, "C<EFBFBD>digo del Producto" );
break;
// Nombre del producto
case 1:
sprintf ( buffer1, "Nombre del producto" );
break;
// Stock Actual ( desglosado )
case 2:
sprintf ( buffer1, "Unidades Vendidas ( 1 Caja = %d Unidades )", S_IVentas2.CantUnitaria );
break;
// Valor aproximado
case 3:
sprintf ( buffer1, "Valor aproximado de la venta" );
break;
// Beneficio Estimado
case 4:
sprintf ( buffer1, "Beneficio estimado de la venta" );
break;
}
// Ayuda reducida
setfillstyle( SOLID_FILL, EGA_BLACK ); bar( 7, 457, 498, 473 );
// Imprime la ayudita
setcolor( EGA_WHITE ); outtextxy( 7, 457, buffer1 );
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <20> Parte terciaria del m<>dulo <20>
// <20> <20>
// <20> Secci<63>n de Impresi<73>n <20>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/**************************************************************************\
|* *|
|* ImprimeVentaProductos *|
|* *|
|* Descripci<63>n: *|
|* Imprime el informe de venta de productos, como el que *|
|* estamos visualizando, tambien imprime una gr<67>fica de *|
|* ventas *|
|* *|
|* Entradas: *|
|* Como imprimir las referencias *|
|* *|
|* Salidas: (ninguna) *|
|* *|
\**************************************************************************/
void ImprimeVentasProductos(void)
{
/*
long i, old_reg;
char buffer[80];
char buffer1[80];
char buffer2[80];
FILE *file_out;
old_reg = BRef.RegActual();
if ( !Config.Impresora.Printer )
{
if ( ( file_out = fopen( Config.Impresora.PrintTo, "w" ) ) == NULL )
return;
} else
file_out = stdprn;
fprintf( file_out, "C<>digo Descripci<63>n Stock Valoraci<63>n Beneficio\n\r" );
for ( i=0; i<BRef.Registros(); i++ )
{
BRef.LeeReg( (void *)&SRef, i );
if ( SRef.CantUnitaria == 0 ) SRef.CantUnitaria = 1;
if ( SRef.CantUnitaria == 1 )
{
formatea_long( (long)( SRef.Stock ), buffer1 );
sprintf ( buffer, "%10s", buffer1 );
} else {
formatea_long( (long)( SRef.Stock / SRef.CantUnitaria ), buffer1 );
formatea_long( (long)( SRef.Stock % SRef.CantUnitaria ), buffer2 );
sprintf ( buffer, "%4s %5s", buffer1, buffer2 );
}
fprintf( file_out, "%9lu %-30s %-10s ", SRef.CodigoR, SRef.Descripcion, buffer );
if ( !SRef.Combinado )
formatea_long( (long)( SRef.PrecioCosto * SRef.Stock ), buffer1 );
else
formatea_long( (long)( (float)( SRef.PrecioCosto * ( (float)SRef.Stock / (float)SRef.CantUnitaria ) ) ), buffer1 );
fprintf ( file_out, "%12s ", buffer1 );
if ( !SRef.Combinado )
formatea_long( (long)( ( SRef.PrecioVenta[0] - SRef.PrecioCosto ) * SRef.Stock ), buffer1 );
else
formatea_long( (long)( (float)( ( SRef.PrecioVenta[0] - SRef.PrecioCosto ) * ( (float)SRef.Stock / (float)SRef.CantUnitaria ) ) ), buffer1 );
fprintf ( file_out, "%12s\n\r", buffer1 );
}
if ( !Config.Impresora.Printer )
fclose( file_out );
BRef.LeeReg( (void *)&SRef, old_reg );
*/
}