First commit 11/11/1991
This commit is contained in:
commit
e1d6aee98f
245
ACERCADE.CPP
Normal file
245
ACERCADE.CPP
Normal file
@ -0,0 +1,245 @@
|
||||
#include<graphics.h>
|
||||
#include<conio.h>
|
||||
|
||||
#include<stdio.h>
|
||||
#include<dos.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
#include "..\libs\make_bot\make_bot.h"
|
||||
#include "sv_graph.h"
|
||||
|
||||
extern void textxy(int x, int y, char *text);
|
||||
|
||||
|
||||
void Circulos(int PosX, int PosY, int RadioX, int RadioY, int Velocidad);
|
||||
void Circulos2(int PosX, int PosY, int RadioX, int RadioY, int Velocidad);
|
||||
void Circulos3(int PosX, int PosY, int RadioX, int RadioY, int Velocidad);
|
||||
|
||||
void Acerca_de(void){
|
||||
struct boton Acerca;
|
||||
|
||||
Acerca.up = 140; Acerca.down = 380;
|
||||
Acerca.left = 220; Acerca.right = 425;
|
||||
ImprimeBoton (1, GRIS_C, BLANCO, GRIS_O, Acerca);
|
||||
Acerca.up = 145; Acerca.down = 375;
|
||||
Acerca.left = 225; Acerca.right = 420;
|
||||
ImprimeBoton (1, GRIS_C, GRIS_O, BLANCO, Acerca);
|
||||
|
||||
textxy(240, 170, "Programa realizado por");
|
||||
textxy(240, 210, " Jos‚ David Guill‚n");
|
||||
|
||||
// Circulos(322, 295, 50, 50, 5);
|
||||
// getch();
|
||||
/*2*/
|
||||
Circulos3(322, 295, 50, 50, 5);
|
||||
|
||||
getch();
|
||||
}
|
||||
|
||||
void Circulos(int PosX, int PosY, int RadioX, int RadioY, int Velocidad){
|
||||
|
||||
// Circulo con apariencia de 3D, por: Jos‚ David Guill‚n
|
||||
|
||||
int x=RadioX,
|
||||
y=0,
|
||||
oldx=RadioX,
|
||||
giro = 0,
|
||||
vez = 0,
|
||||
ciclo = 1,
|
||||
Angulo = 0;
|
||||
|
||||
|
||||
do{
|
||||
|
||||
setcolor(GRIS_C);
|
||||
ellipse(PosX, PosY, 0+ Angulo, 360+ Angulo, abs(oldx), RadioY );
|
||||
ellipse(PosX, PosY, 0/*+*/- Angulo, 360/*+*/- Angulo, RadioX, abs(oldx) );
|
||||
|
||||
if(giro==1)/*{*/ setcolor(NEGRO); else setcolor(BLANCO);
|
||||
|
||||
/// ellipse(PosX, PosY, 90+ Angulo, 270+ Angulo, abs(x), /*abs(y)*/50 );
|
||||
ellipse(PosX, PosY, 0+ Angulo, 90+ Angulo, abs(x), RadioY );
|
||||
ellipse(PosX, PosY, 180- Angulo, 270- Angulo, abs(x), RadioY );
|
||||
|
||||
/// ellipse(PosX, PosY, 0+ Angulo, 180+ Angulo, /*abs(y)*/50, abs(x) );
|
||||
ellipse(PosX, PosY, 90/*+*/- Angulo, 180/*+*/- Angulo, RadioX, abs(x));
|
||||
ellipse(PosX, PosY, 270/*+*/- Angulo, 360/*+*/- Angulo, RadioX, abs(x) );
|
||||
|
||||
|
||||
if(giro==1)/*{*/ setcolor(BLANCO); else setcolor(NEGRO);
|
||||
|
||||
/// ellipse(PosX, PosY, 270+ Angulo, 90+ Angulo, abs(x), /*abs(y)*/50 );
|
||||
ellipse(PosX, PosY, 90+ Angulo, 180+ Angulo, abs(x), RadioY );
|
||||
ellipse(PosX, PosY, 270+ Angulo, 360+ Angulo, abs(x), RadioY );
|
||||
|
||||
/// ellipse(PosX, PosY, 180+ Angulo, 360+ Angulo, /*abs(y)*/50, abs(x) );
|
||||
ellipse(PosX, PosY, 0/*+*/- Angulo, 90/*+*/- Angulo, RadioX, abs(x) );
|
||||
ellipse(PosX, PosY, 180/*+*/- Angulo, 270/*+*/- Angulo, RadioX, abs(x) );
|
||||
|
||||
|
||||
oldx = x;
|
||||
|
||||
x--;
|
||||
if(x<=-(RadioX-1) ) x=RadioX;
|
||||
y--;
|
||||
if(y<=-(RadioY-1) ) y=RadioY;
|
||||
|
||||
if(ciclo == 0 && x == RadioX ) { ciclo = 1; vez = 0; } else
|
||||
if(ciclo == 1 && x == RadioX ) { ciclo = 0; vez = 1; }
|
||||
|
||||
if(vez==0){
|
||||
if(x<0) giro=1; else giro=0;
|
||||
}
|
||||
if(vez==1){
|
||||
if(x<0) giro=0; else giro=1;
|
||||
}
|
||||
delay(20);
|
||||
|
||||
Angulo+= Velocidad; if( Angulo== 360 ) Angulo=0;
|
||||
|
||||
}while(!kbhit());
|
||||
|
||||
}
|
||||
|
||||
void Circulos2(int PosX, int PosY, int RadioX, int RadioY, int Velocidad){
|
||||
|
||||
// Circulo con apariencia de 3D, por: Jos‚ David Guill‚n
|
||||
|
||||
int x=RadioX,
|
||||
y=0,
|
||||
oldx=RadioX, oldx2 = RadioX, oldx3 = RadioX,
|
||||
giro = 0,
|
||||
vez = 0,
|
||||
ciclo = 1,
|
||||
Angulo = 0;
|
||||
|
||||
|
||||
do{
|
||||
|
||||
setcolor(GRIS_C);
|
||||
ellipse(PosX, PosY, 0+ Angulo, 360+ Angulo, abs(oldx), RadioY );
|
||||
ellipse(PosX, PosY, 0/*+*/- Angulo, 360/*+*/- Angulo, RadioX, abs(oldx) );
|
||||
|
||||
if(giro==1)/*{*/ setcolor(NEGRO); else setcolor(BLANCO);
|
||||
|
||||
/// ellipse(PosX, PosY, 90+ Angulo, 270+ Angulo, abs(x), /*abs(y)*/50 );
|
||||
ellipse(PosX, PosY, 0+ Angulo, 90+ Angulo, abs(x), RadioY );
|
||||
ellipse(PosX, PosY, 180- Angulo, 270- Angulo, abs(x), RadioY );
|
||||
|
||||
/// ellipse(PosX, PosY, 0+ Angulo, 180+ Angulo, /*abs(y)*/50, abs(x) );
|
||||
ellipse(PosX, PosY, 90/*+*/- Angulo, 180/*+*/- Angulo, RadioX, abs(x));
|
||||
ellipse(PosX, PosY, 270/*+*/- Angulo, 360/*+*/- Angulo, RadioX, abs(x) );
|
||||
|
||||
|
||||
if(giro==1)/*{*/ setcolor(BLANCO); else setcolor(NEGRO);
|
||||
|
||||
/// ellipse(PosX, PosY, 270+ Angulo, 90+ Angulo, abs(x), /*abs(y)*/50 );
|
||||
ellipse(PosX, PosY, 90+ Angulo, 180+ Angulo, abs(x), RadioY );
|
||||
ellipse(PosX, PosY, 270+ Angulo, 360+ Angulo, abs(x), RadioY );
|
||||
|
||||
/// ellipse(PosX, PosY, 180+ Angulo, 360+ Angulo, /*abs(y)*/50, abs(x) );
|
||||
ellipse(PosX, PosY, 0/*+*/- Angulo, 90/*+*/- Angulo, RadioX, abs(x) );
|
||||
ellipse(PosX, PosY, 180/*+*/- Angulo, 270/*+*/- Angulo, RadioX, abs(x) );
|
||||
|
||||
oldx = oldx2;
|
||||
oldx2 = oldx3;
|
||||
oldx3 = x;
|
||||
|
||||
|
||||
x--;
|
||||
if(x<=-(RadioX-1) ) x=RadioX;
|
||||
y--;
|
||||
if(y<=-(RadioY-1) ) y=RadioY;
|
||||
|
||||
if(ciclo == 0 && x == RadioX ) { ciclo = 1; vez = 0; } else
|
||||
if(ciclo == 1 && x == RadioX ) { ciclo = 0; vez = 1; }
|
||||
|
||||
if(vez==0){
|
||||
if(x<0) giro=1; else giro=0;
|
||||
}
|
||||
if(vez==1){
|
||||
if(x<0) giro=0; else giro=1;
|
||||
}
|
||||
delay(20);
|
||||
|
||||
Angulo+= Velocidad; if( Angulo== 360 ) Angulo=0;
|
||||
|
||||
}while(!kbhit());
|
||||
|
||||
}
|
||||
|
||||
void Circulos3(int PosX, int PosY, int RadioX, int RadioY, int Velocidad){
|
||||
|
||||
// Circulo con apariencia de 3D, por: Jos‚ David Guill‚n
|
||||
|
||||
int x=RadioX,
|
||||
y=0,
|
||||
oldx=RadioX, oldx2 = RadioX, oldx3 = RadioX,
|
||||
giro = 0,
|
||||
vez = 0,
|
||||
ciclo = 1,
|
||||
Angulo = 0;
|
||||
|
||||
|
||||
do{
|
||||
|
||||
setcolor(GRIS_C);
|
||||
ellipse(PosX, PosY, 0+ Angulo, 360+ Angulo, abs(oldx), RadioY );
|
||||
ellipse(PosX, PosY, 0/*+*/- Angulo, 360/*+*/- Angulo, RadioX, abs(oldx) );
|
||||
|
||||
if(giro==1)/*{*/ setcolor(NEGRO); else setcolor(BLANCO);
|
||||
|
||||
/// ellipse(PosX, PosY, 90+ Angulo, 270+ Angulo, abs(x), /*abs(y)*/50 );
|
||||
ellipse(PosX, PosY, 0+ Angulo, 90+ Angulo, abs(x), RadioY );
|
||||
ellipse(PosX, PosY, 180- Angulo, 270- Angulo, abs(x), RadioY );
|
||||
|
||||
/// ellipse(PosX, PosY, 0+ Angulo, 180+ Angulo, /*abs(y)*/50, abs(x) );
|
||||
ellipse(PosX, PosY, 90/*+*/- Angulo, 180/*+*/- Angulo, RadioX, abs(x));
|
||||
ellipse(PosX, PosY, 270/*+*/- Angulo, 360/*+*/- Angulo, RadioX, abs(x) );
|
||||
|
||||
|
||||
if(giro==1)/*{*/ setcolor(BLANCO); else setcolor(NEGRO);
|
||||
|
||||
/// ellipse(PosX, PosY, 270+ Angulo, 90+ Angulo, abs(x), /*abs(y)*/50 );
|
||||
ellipse(PosX, PosY, 90+ Angulo, 180+ Angulo, abs(x), RadioY );
|
||||
ellipse(PosX, PosY, 270+ Angulo, 360+ Angulo, abs(x), RadioY );
|
||||
|
||||
/// ellipse(PosX, PosY, 180+ Angulo, 360+ Angulo, /*abs(y)*/50, abs(x) );
|
||||
ellipse(PosX, PosY, 0/*+*/- Angulo, 90/*+*/- Angulo, RadioX, abs(x) );
|
||||
ellipse(PosX, PosY, 180/*+*/- Angulo, 270/*+*/- Angulo, RadioX, abs(x) );
|
||||
|
||||
oldx = oldx2;
|
||||
oldx2 = oldx3;
|
||||
oldx3 = x;
|
||||
|
||||
|
||||
x--;
|
||||
if(x<=-(RadioX-1) ) x=RadioX;
|
||||
y--;
|
||||
if(y<=-(RadioY-1) ) y=RadioY;
|
||||
|
||||
if(ciclo == 0 && x == RadioX ) { ciclo = 1; vez = 0; } else
|
||||
if(ciclo == 1 && x == RadioX ) { ciclo = 0; vez = 1; }
|
||||
|
||||
if(vez==0){
|
||||
if(x<0) giro=1; else giro=0;
|
||||
}
|
||||
if(vez==1){
|
||||
if(x<0) giro=0; else giro=1;
|
||||
}
|
||||
delay(20);
|
||||
|
||||
Angulo+= Velocidad; if( Angulo== 360 ) Angulo=0;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////
|
||||
giro = 1;
|
||||
////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
}while(!kbhit());
|
||||
|
||||
}
|
BIN
DATOS/BAK/CLIENTES.DAT
Normal file
BIN
DATOS/BAK/CLIENTES.DAT
Normal file
Binary file not shown.
BIN
DATOS/BAK/C_INDICE.DAT
Normal file
BIN
DATOS/BAK/C_INDICE.DAT
Normal file
Binary file not shown.
BIN
DATOS/BAK/SV_C0095.DAT
Normal file
BIN
DATOS/BAK/SV_C0095.DAT
Normal file
Binary file not shown.
BIN
DATOS/BAK/SV_COMP.DAT
Normal file
BIN
DATOS/BAK/SV_COMP.DAT
Normal file
Binary file not shown.
BIN
DATOS/BAK/SV_STOCK.DAT
Normal file
BIN
DATOS/BAK/SV_STOCK.DAT
Normal file
Binary file not shown.
BIN
DATOS/BAK/SV_V0195.DAT
Normal file
BIN
DATOS/BAK/SV_V0195.DAT
Normal file
Binary file not shown.
BIN
DATOS/BAK/SV_V0295.DAT
Normal file
BIN
DATOS/BAK/SV_V0295.DAT
Normal file
Binary file not shown.
BIN
DATOS/BAK/SV_V0395.DAT
Normal file
BIN
DATOS/BAK/SV_V0395.DAT
Normal file
Binary file not shown.
BIN
DATOS/BAK/SV_V0495.DAT
Normal file
BIN
DATOS/BAK/SV_V0495.DAT
Normal file
Binary file not shown.
BIN
DATOS/BAK/SV_V0595.DAT
Normal file
BIN
DATOS/BAK/SV_V0595.DAT
Normal file
Binary file not shown.
BIN
DATOS/BAK/SV_V0695.DAT
Normal file
BIN
DATOS/BAK/SV_V0695.DAT
Normal file
Binary file not shown.
BIN
DATOS/BAK/SV_VEND.DAT
Normal file
BIN
DATOS/BAK/SV_VEND.DAT
Normal file
Binary file not shown.
BIN
DATOS/BAK/SV__REF.DAT
Normal file
BIN
DATOS/BAK/SV__REF.DAT
Normal file
Binary file not shown.
BIN
DATOS/CLIENTES.DAT
Normal file
BIN
DATOS/CLIENTES.DAT
Normal file
Binary file not shown.
BIN
DATOS/C_INDICE.DAT
Normal file
BIN
DATOS/C_INDICE.DAT
Normal file
Binary file not shown.
BIN
DATOS/LITT.CHR
Normal file
BIN
DATOS/LITT.CHR
Normal file
Binary file not shown.
1
DATOS/RUN.BAT
Normal file
1
DATOS/RUN.BAT
Normal file
@ -0,0 +1 @@
|
||||
..\..\..\out\sv
|
BIN
DATOS/SV_C0095.DAT
Normal file
BIN
DATOS/SV_C0095.DAT
Normal file
Binary file not shown.
BIN
DATOS/SV_COMP.DAT
Normal file
BIN
DATOS/SV_COMP.DAT
Normal file
Binary file not shown.
BIN
DATOS/SV_STOCK.DAT
Normal file
BIN
DATOS/SV_STOCK.DAT
Normal file
Binary file not shown.
BIN
DATOS/SV_V0195.DAT
Normal file
BIN
DATOS/SV_V0195.DAT
Normal file
Binary file not shown.
BIN
DATOS/SV_V0295.DAT
Normal file
BIN
DATOS/SV_V0295.DAT
Normal file
Binary file not shown.
BIN
DATOS/SV_V0395.DAT
Normal file
BIN
DATOS/SV_V0395.DAT
Normal file
Binary file not shown.
BIN
DATOS/SV_V0495.DAT
Normal file
BIN
DATOS/SV_V0495.DAT
Normal file
Binary file not shown.
BIN
DATOS/SV_V0595.DAT
Normal file
BIN
DATOS/SV_V0595.DAT
Normal file
Binary file not shown.
BIN
DATOS/SV_V0695.DAT
Normal file
BIN
DATOS/SV_V0695.DAT
Normal file
Binary file not shown.
BIN
DATOS/SV_V0795.DAT
Normal file
BIN
DATOS/SV_V0795.DAT
Normal file
Binary file not shown.
BIN
DATOS/SV_VEND.DAT
Normal file
BIN
DATOS/SV_VEND.DAT
Normal file
Binary file not shown.
BIN
DATOS/SV__REF.DAT
Normal file
BIN
DATOS/SV__REF.DAT
Normal file
Binary file not shown.
9
README.md
Normal file
9
README.md
Normal file
@ -0,0 +1,9 @@
|
||||
#SV
|
||||
|
||||
|
||||
*11/11/1991*
|
||||
|
||||
ToDo: wwtcf?
|
||||
|
||||
|
||||

|
6
RUN2.BAT
Normal file
6
RUN2.BAT
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
..\..\out\sv
|
||||
rem cd datos
|
||||
rem ..\..\..\out\sv
|
||||
rem cd ..
|
||||
exit
|
562
SV.CPP
Normal file
562
SV.CPP
Normal file
@ -0,0 +1,562 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// Nombre: SV .CPP ///
|
||||
/// Modulo: Gr ficos para programa original [SINTITULO] ///
|
||||
/// Descripci¢n: ///
|
||||
/// ///
|
||||
/// Autor: Jos‚ David Guill‚n Dominguez ///
|
||||
/// Fecha: 13 - 01 - 1995 ///
|
||||
/// ///
|
||||
/// Comentario: ///
|
||||
/// ///
|
||||
/// ///
|
||||
/// Compilador Borland C++ 3.0 ///
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <graphics.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <conio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <dos.h>
|
||||
|
||||
|
||||
#include "..\libs\make_bot\make_bot.h"
|
||||
#include "SV_graph.h"
|
||||
#include "sv_util.h"
|
||||
|
||||
extern int x_raton, y_raton; extern char raton;
|
||||
extern int boton_izq, boton_der;
|
||||
extern int dir_raton [32+32];
|
||||
|
||||
extern void Pantalla_Graficas_Compras(struct boton *PGC);
|
||||
extern void Menu_Graficas_de_Compras(int Compras_Ventas);
|
||||
extern void Menu_Graficas_de_Clientes(int Current_Date);
|
||||
extern void Acerca_de(void);
|
||||
extern void desactiva_raton(void);
|
||||
extern void activa_raton(void);
|
||||
extern void inicializa_raton_grafico(int x1, int y1, int x2, int y2, int px, int py);
|
||||
extern void Menu_de_Ventas(int Current_Date);
|
||||
extern void Menu_de_Clientes(void);
|
||||
extern void Menu_de_Vendedores(void);
|
||||
extern void Menu_de_Referencias(void);
|
||||
extern void Menu_de_Clientes_Comp(int Current_Date);
|
||||
extern void Menu_de_Compras(void);
|
||||
// extern void Dibuja_Pantalla_Stock(void);
|
||||
extern void Menu_de_Stock(void);
|
||||
|
||||
|
||||
extern void Menu_de_Facturas(void);
|
||||
extern void Configuracion(void);
|
||||
extern void textxy(int x, int y, char *text);
|
||||
extern int Espera_Tecla_o_Raton(void);
|
||||
void Mensaje(void);
|
||||
|
||||
extern struct Make_Boton PP_S[5];
|
||||
|
||||
void redefine_cursor_raton(int r_e);
|
||||
void BEEP(void);
|
||||
|
||||
|
||||
void EditCursorMP(int Muestra_Oculta, int Columna, int Linea, int Menu_Desplegado);
|
||||
void Contrae_Menu(int Columna);
|
||||
void Despliega_Menu(int Columna);
|
||||
void Menu_Principal(void);
|
||||
int Menu(int Columna, int Linea);
|
||||
|
||||
extern char PunteroRaton;
|
||||
|
||||
int main(void){
|
||||
|
||||
int GD = 9, GM = 2;
|
||||
|
||||
Initialize(GD, GM);
|
||||
|
||||
inicializa_raton_grafico(0, 0, 624, 464, 320, 240);
|
||||
if(raton!=0) desactiva_raton();
|
||||
|
||||
// Menu_de_Vendedores();
|
||||
// Menu_de_Referencias();
|
||||
// Menu_de_Compras();
|
||||
// Menu_de_Stock();
|
||||
|
||||
Menu_Principal();
|
||||
|
||||
// Dibuja_Pantalla_Pricipal();
|
||||
/*
|
||||
Dibuja_Pantalla_Altas_Todos_los_Datos();
|
||||
getch();
|
||||
cleardevice();
|
||||
Dibuja_Pantalla_Altas_Rapida();
|
||||
getch();
|
||||
cleardevice();
|
||||
Dibuja_Pantalla_Vendedores();
|
||||
getch();
|
||||
cleardevice();
|
||||
Dibuja_Pantalla_Referencia();
|
||||
getch();
|
||||
cleardevice();
|
||||
Dibuja_Pantalla_Compras();
|
||||
getch();
|
||||
cleardevice();
|
||||
Dibuja_Pantalla_Stock();
|
||||
|
||||
*/
|
||||
// if (raton == 0) { cprintf("ERROR RATON NECESARIO"); return 1; }
|
||||
|
||||
|
||||
// Espera_Tecla_o_Raton();
|
||||
|
||||
//getch();
|
||||
|
||||
|
||||
|
||||
restorecrtmode(); Mensaje(); return 0;
|
||||
}
|
||||
|
||||
void Mensaje(void){
|
||||
|
||||
clrscr();
|
||||
printf("JD_ ùFuTuRe ViSiOnù\n\n");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void BEEP(void){
|
||||
|
||||
sound(440);
|
||||
delay(50);
|
||||
nosound();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Menu_Principal(void){
|
||||
|
||||
int CurrCol_MP=1, CurrRow_MP=1, Menu_Desplegado=0, key;
|
||||
char finished = 0;
|
||||
|
||||
int N_Row[] = { 5, 3, 3, 5, 5};
|
||||
|
||||
|
||||
|
||||
|
||||
Dibuja_Pantalla_Pricipal();
|
||||
|
||||
do{
|
||||
|
||||
EditCursorMP(1, CurrCol_MP, CurrRow_MP, Menu_Desplegado);
|
||||
if(raton!=0) activa_raton();
|
||||
Espera_Tecla_o_Raton();
|
||||
if(raton!=0) desactiva_raton();
|
||||
EditCursorMP(0, CurrCol_MP, CurrRow_MP, Menu_Desplegado);
|
||||
|
||||
if(kbhit()){
|
||||
key = getch();
|
||||
if(key==13 && Menu_Desplegado == 1)
|
||||
{ finished = Menu(CurrCol_MP, CurrRow_MP); Contrae_Menu(CurrCol_MP); Menu_Desplegado = 0; } else
|
||||
if(key==13 && Menu_Desplegado == 0){ Menu_Desplegado = 1; Despliega_Menu(CurrCol_MP); CurrRow_MP = 1;}
|
||||
if(key==27) { Contrae_Menu(CurrCol_MP); Menu_Desplegado = 0;}
|
||||
if( key == 0 ) {
|
||||
switch( (key=getch()) ){
|
||||
// Flecha Arriba
|
||||
case 72:
|
||||
if( Menu_Desplegado == 1 ) {
|
||||
CurrRow_MP --; if(CurrRow_MP < 1) CurrRow_MP = N_Row[CurrCol_MP - 1];
|
||||
}
|
||||
break;
|
||||
// Flecha Izquierda
|
||||
case 75:
|
||||
case 15:
|
||||
if( Menu_Desplegado == 1 ) Contrae_Menu(CurrCol_MP);
|
||||
CurrCol_MP--; if ( CurrCol_MP < 1 ) CurrCol_MP=5;
|
||||
if( Menu_Desplegado == 1 ) { Despliega_Menu(CurrCol_MP); CurrRow_MP = 1; }
|
||||
break;
|
||||
// Flecha Derecha
|
||||
case 77:
|
||||
case 9:
|
||||
if( Menu_Desplegado == 1 ) Contrae_Menu(CurrCol_MP);
|
||||
CurrCol_MP++; if ( CurrCol_MP > 5 ) CurrCol_MP=1;
|
||||
if( Menu_Desplegado == 1 ) { Despliega_Menu(CurrCol_MP); CurrRow_MP = 1; }
|
||||
break;
|
||||
// Flecha Abajo
|
||||
case 80:
|
||||
if( Menu_Desplegado == 1 ) {
|
||||
CurrRow_MP ++; if(CurrRow_MP > N_Row[CurrCol_MP - 1]) CurrRow_MP = 1;
|
||||
} else {
|
||||
Menu_Desplegado = 1; Despliega_Menu(CurrCol_MP); CurrRow_MP = 1;
|
||||
}
|
||||
break;
|
||||
// INICIO
|
||||
case 71:
|
||||
if( Menu_Desplegado == 0 ) CurrCol_MP = 1; else CurrRow_MP = 1;
|
||||
break;
|
||||
// FIN
|
||||
case 79:
|
||||
if( Menu_Desplegado == 0 ) CurrCol_MP = 5; else CurrRow_MP = N_Row[CurrCol_MP - 1];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* else if(raton!=0 && ( boton_izq==1 || boton_der==1 ) )
|
||||
|
||||
if( (bpush = CheckButon( 9, Comunes))>0 ) {
|
||||
EditCursorComp(1);
|
||||
switch(bpush){
|
||||
}
|
||||
} else CompruebaLineasComp();
|
||||
*/
|
||||
|
||||
}while( !finished );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Despliega_Menu(int Columna){
|
||||
|
||||
int x, n; struct Make_Boton Tmp;
|
||||
char Texto[10][25];
|
||||
|
||||
switch(Columna) {
|
||||
case 1: x = 7; n = 5;
|
||||
strcpy ( Texto[0], " Estado actual ");
|
||||
strcpy ( Texto[1], " Enlazar con ->");
|
||||
strcpy ( Texto[2], " Configuraci¢n ");
|
||||
strcpy ( Texto[3], " MS-DOS Shell ");
|
||||
strcpy ( Texto[4], " ( SALIR ) ");
|
||||
break;
|
||||
case 2: x = 91; n = 3;
|
||||
strcpy ( Texto[0], " Mantenimiento ");
|
||||
strcpy ( Texto[1], " Emision de Facturas -> ");
|
||||
strcpy ( Texto[2], " Altas / Modificaciones ");
|
||||
break;
|
||||
case 3: x = 266; n = 3;
|
||||
strcpy ( Texto[0], " Compras ");
|
||||
strcpy ( Texto[1], " Vendedores ");
|
||||
strcpy ( Texto[2], " Referencias ");
|
||||
break;
|
||||
case 4: x = 395; n = 5;
|
||||
strcpy ( Texto[0], " Stock actual ");
|
||||
strcpy ( Texto[1], " Informe de Ventas ");
|
||||
strcpy ( Texto[2], " Graficas de Ganancias ");
|
||||
strcpy ( Texto[3], " Graficas de Compras ");
|
||||
strcpy ( Texto[4], " Graficas de Clientes ");
|
||||
break;
|
||||
case 5: x = 455; n = 5;
|
||||
strcpy ( Texto[0], " Menus ");
|
||||
strcpy ( Texto[1], " Pantallas de Edici¢n ");
|
||||
strcpy ( Texto[2], " -------------------- ");
|
||||
strcpy ( Texto[3], " Ayuda en Linea ( Off )");
|
||||
strcpy ( Texto[4], " Acerca de... ");
|
||||
break;
|
||||
}
|
||||
|
||||
Tmp.Up = 43; Tmp.Down = 45 + (n*19) + 5;
|
||||
Tmp.Left = x; Tmp.Right = x + textwidth( Texto[0] );
|
||||
Imprime_Boton2 (0, GRIS_C, BLANCO, GRIS_O, Tmp);
|
||||
Tmp.Up = 43 + 2; Tmp.Down = 45 + (n*19) - 2 + 5;
|
||||
Tmp.Left = x + 2; Tmp.Right = x + textwidth( Texto[0] ) - 2;
|
||||
Imprime_Boton2 (0, GRIS_C, GRIS_O, BLANCO, Tmp);
|
||||
|
||||
for(int i=0; i<n; i++)
|
||||
textxy(x, 45+(18*i)+4, Texto[i]);
|
||||
|
||||
}
|
||||
|
||||
void Contrae_Menu(int Columna){
|
||||
|
||||
int x, n; struct Make_Boton Tmp;
|
||||
char Texto[10][25];
|
||||
|
||||
switch(Columna) {
|
||||
case 1: x = 7; n = 5;
|
||||
strcpy ( Texto[0], " Estado actual ");
|
||||
break;
|
||||
case 2: x = 91; n = 3;
|
||||
strcpy ( Texto[0], " Mantenimiento ");
|
||||
break;
|
||||
case 3: x = 266; n = 3;
|
||||
strcpy ( Texto[0], " Compras ");
|
||||
break;
|
||||
case 4: x = 395; n = 5;
|
||||
strcpy ( Texto[0], " Stock actual ");
|
||||
break;
|
||||
case 5: x = 455; n = 5;
|
||||
strcpy ( Texto[0], " Menus ");
|
||||
break;
|
||||
}
|
||||
|
||||
Tmp.Up = 43; Tmp.Down = 45 + (n*19) + 5;
|
||||
Tmp.Left = x; Tmp.Right = x + textwidth( Texto[0] );
|
||||
Imprime_Boton2 (1, GRIS_C, GRIS_C, GRIS_C, Tmp);
|
||||
|
||||
}
|
||||
|
||||
void EditCursorMP(int Muestra_Oculta, int Columna, int Linea, int Menu_Desplegado){
|
||||
struct Make_Boton Tmp;
|
||||
int x/*, n*/; char Texto[10][25];
|
||||
|
||||
switch(Columna) {
|
||||
case 1: x = 7;// n = 5;
|
||||
strcpy ( Texto[0], " Estado actual ");
|
||||
break;
|
||||
case 2: x = 91;// n = 3;
|
||||
strcpy ( Texto[0], " Mantenimiento ");
|
||||
break;
|
||||
case 3: x = 266;// n = 3;
|
||||
strcpy ( Texto[0], " Compras ");
|
||||
break;
|
||||
case 4: x = 395;// n = 5;
|
||||
strcpy ( Texto[0], " Stock actual ");
|
||||
break;
|
||||
case 5: x = 455
|
||||
;// n = 5;
|
||||
strcpy ( Texto[0], " Menus ");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(Menu_Desplegado == 1) {
|
||||
|
||||
if(Muestra_Oculta == 1) {
|
||||
Tmp.Up = 45+ (18*Linea)+4 - 3- 15; Tmp.Down = 45 + (18*Linea)+4 - 3 ;
|
||||
Tmp.Left = x+4; Tmp.Right = x + textwidth( Texto[0] ) - 4;
|
||||
Imprime_Boton2 (0, GRIS_C, BLANCO, GRIS_O, Tmp);
|
||||
|
||||
setcolor(GRIS_C);
|
||||
setfillstyle(SOLID_FILL, GRIS_C);
|
||||
bar(10, 455, 545, 473);
|
||||
// textxy(10, 19, " Archivo ³ Gestion de Clientes ³ Mantenimiento ³ Balances ³ Ayuda");
|
||||
switch(Columna) {
|
||||
case 1:
|
||||
switch(Linea) {
|
||||
case 1: textxy( 15, 455, "Muestra el estado actual de los dispositivos, programa...");
|
||||
break;
|
||||
case 2: textxy( 15, 455, "Permite el enlaze con otras aplicaciones configurables.");
|
||||
break;
|
||||
case 3: textxy( 15, 455, "Reconfigura el programa.");
|
||||
break;
|
||||
case 4: textxy( 15, 455, "Accede a al Sistema con un SHELL permaneciendo residente.");
|
||||
break;
|
||||
case 5: textxy( 15, 455, "Finaliza el programa actual TOTALMENTE.");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
switch(Linea) {
|
||||
case 1: textxy( 15, 455, "Mantenimiento de Clientes ( Compras realizadas por ellos )");
|
||||
break;
|
||||
case 2: textxy( 15, 455, "Impresion de Facturas para Clientes o Empresa.");
|
||||
break;
|
||||
case 3: textxy( 15, 455, "Altas / Bajas / Modificaciones de CLIENTES.");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
switch(Linea) {
|
||||
case 1: textxy( 15, 455, "Compras realizadas por la empresa.");
|
||||
break;
|
||||
case 2: textxy( 15, 455, "Vendedores que posee la empresa.");
|
||||
break;
|
||||
case 3: textxy( 15, 455, "Gesti¢n de los productos actuales.");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
switch(Linea) {
|
||||
case 1: textxy( 15, 455, "Muestra de forma num‚rica y gr fica el Stock Actual.");
|
||||
break;
|
||||
case 2: textxy( 15, 455, "Informe de Ventas sobre el mes seleccionado.");
|
||||
break;
|
||||
case 3: textxy( 15, 455, "Gr ficas de Ganancias Brutas, generales.");
|
||||
break;
|
||||
case 4: textxy( 15, 455, "Gr fica de Compras generales por C¢digo.");
|
||||
break;
|
||||
case 5: textxy( 15, 455, "Graficas de informaci¢n sobre los clientes.");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
switch(Linea) {
|
||||
case 1: textxy( 15, 455, "Muestra ayuda referente a los menus.");
|
||||
break;
|
||||
case 2: textxy( 15, 455, "Ayuda sobre las teclas y macros de Edicion.");
|
||||
break;
|
||||
|
||||
|
||||
case 4: textxy( 15, 455, "Activa la ayuda en linea, y la simulaci¢n de Aprendizaje.");
|
||||
break;
|
||||
case 5: textxy( 15, 455, "Muestra informaci¢n sobre la versi¢n, y copyRight.");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
Tmp.Up = 45+ (18*Linea)+4 - 3 - 15; Tmp.Down = 45 + (18*Linea)+4 - 3;
|
||||
Tmp.Left = x+4; Tmp.Right = x + textwidth( Texto[0] ) - 4;
|
||||
Imprime_Boton2 (0, GRIS_C, GRIS_C, GRIS_C, Tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
if(Muestra_Oculta == 0) {
|
||||
Imprime_Boton2 (0, GRIS_C, GRIS_C, GRIS_C, PP_S[Columna-1]);
|
||||
} else {
|
||||
Imprime_Boton2 (0, NEGRO, GRIS_O, BLANCO, PP_S[Columna-1]);
|
||||
setcolor(GRIS_C);
|
||||
setfillstyle(SOLID_FILL, GRIS_C);
|
||||
bar(10, 455, 545, 473);
|
||||
// textxy(10, 19, " Archivo ³ Gestion de Clientes ³ Mantenimiento ³ Balances ³ Ayuda");
|
||||
switch(Columna) {
|
||||
case 1:
|
||||
textxy( 15, 455, "Operaciones de mantenimiento para los archivos y enlaces.");
|
||||
break;
|
||||
case 2:
|
||||
textxy( 15, 455, "Altas / Bajas / Consultas y Emision de Facturas de Clientes.");
|
||||
break;
|
||||
case 3:
|
||||
textxy( 15, 455, "Mantenimiento de la empresa. ( Compras, Refencias, Vendedores )");
|
||||
break;
|
||||
case 4:
|
||||
textxy( 15, 455, "Balances y Gr ficas sobre el estado de la Empresa.");
|
||||
break;
|
||||
case 5:
|
||||
textxy( 15, 455, "Acceso a la ayuda en linea.");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
int Menu(int Columna, int Linea){
|
||||
int Devuelve = 0;
|
||||
switch(Columna) {
|
||||
case 1:
|
||||
switch(Linea) {
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
Contrae_Menu(1);
|
||||
Configuracion();
|
||||
break;
|
||||
// SHELL TO DOS
|
||||
case 4:
|
||||
if(raton!=0) desactiva_raton();
|
||||
restorecrtmode();
|
||||
printf("Teclee EXIT para regresar al programa anfitri¢n");
|
||||
if ( system( getenv( "COMSPEC") ) != 0 ) { printf("\n\nImposible salir a MS-DOS\n\n"); sleep(5); }
|
||||
Initialize( 9, 2);
|
||||
inicializa_raton_grafico(0, 0, 624, 464, 320, 240);
|
||||
if(raton!=0) desactiva_raton();
|
||||
break;
|
||||
// SALIR
|
||||
case 5:
|
||||
Devuelve = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
switch(Linea) {
|
||||
case 1:
|
||||
Contrae_Menu(2);
|
||||
if ( ( Devuelve = Pide_Fecha_Actual() ) != -1 )
|
||||
Menu_de_Clientes_Comp( Devuelve );
|
||||
Devuelve = 0;
|
||||
break;
|
||||
case 2:
|
||||
Contrae_Menu(2);
|
||||
Menu_de_Facturas();
|
||||
break;
|
||||
case 3:
|
||||
Menu_de_Clientes();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
switch(Linea) {
|
||||
case 1:
|
||||
Menu_de_Compras();
|
||||
break;
|
||||
case 2:
|
||||
Menu_de_Vendedores();
|
||||
break;
|
||||
case 3:
|
||||
Menu_de_Referencias();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
switch(Linea) {
|
||||
case 1:
|
||||
Menu_de_Stock();
|
||||
break;
|
||||
case 2:
|
||||
Contrae_Menu(4);
|
||||
if ( ( Devuelve = Pide_Fecha_Actual() ) != -1 )
|
||||
Menu_de_Ventas(Devuelve);
|
||||
Devuelve = 0;
|
||||
break;
|
||||
case 3:
|
||||
// Enlace con el modulo ganancias
|
||||
Menu_Graficas_de_Compras(1);
|
||||
break;
|
||||
case 4:
|
||||
// Enlace puro
|
||||
Menu_Graficas_de_Compras(0);
|
||||
break;
|
||||
case 5:
|
||||
Contrae_Menu(4);
|
||||
if ( ( Devuelve = Pide_Fecha_Actual() ) != -1 )
|
||||
Menu_Graficas_de_Clientes(Devuelve);
|
||||
Devuelve = 0;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
switch(Linea) {
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
break;
|
||||
case 5:
|
||||
Contrae_Menu(5);
|
||||
Acerca_de();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
Dibuja_Pantalla_Pricipal();
|
||||
|
||||
return Devuelve;
|
||||
}
|
||||
|
88
SV_CFG.CPP
Normal file
88
SV_CFG.CPP
Normal file
@ -0,0 +1,88 @@
|
||||
#include<graphics.h>
|
||||
#include<dos.h>
|
||||
#include<io.h>
|
||||
#include<conio.h>
|
||||
#include<stdio.h>
|
||||
#include<ctype.h>
|
||||
#include<alloc.h>
|
||||
#include<stdlib.h>
|
||||
#include "..\libs\make_bot\make_bot.h"
|
||||
|
||||
|
||||
#define Letra_Boton setcolor(1);
|
||||
#define Azul 1
|
||||
#define Texto_Normal setcolor(63);
|
||||
#define Texto_Negrita setcolor(0);
|
||||
|
||||
extern int x_raton, y_raton, raton;
|
||||
extern int boton_izq, boton_der;
|
||||
|
||||
extern int InputCadenaG(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo);
|
||||
extern void desactiva_raton(void);
|
||||
extern void activa_raton(void);
|
||||
// extern void Anclar_Raton(void);
|
||||
extern void inicializa_raton_grafico(int x1, int y1, int x2, int y2, int px, int py);
|
||||
extern int Espera_Tecla_o_Raton(void);
|
||||
extern void BEEP(void);
|
||||
extern void textxy(int x, int y, char *text);
|
||||
|
||||
|
||||
#define NEGRO 0
|
||||
#define AZUL 1
|
||||
#define ROJO 4
|
||||
#define VERDE 2
|
||||
#define BLANCO 63
|
||||
#define GRIS_O 56
|
||||
#define GRIS_C 7
|
||||
#define AMARILLO 62
|
||||
|
||||
extern void textxy(int x, int y, char *text);
|
||||
|
||||
|
||||
void Dibuja_Pantalla_Configuracion(void);
|
||||
|
||||
void Configuracion(void){
|
||||
|
||||
Dibuja_Pantalla_Configuracion();
|
||||
|
||||
getch();
|
||||
|
||||
}
|
||||
|
||||
void Dibuja_Pantalla_Configuracion(void){
|
||||
|
||||
struct boton DBC[10];
|
||||
|
||||
DBC[0].up = /*140*/130; DBC[0].down = /*255*/400;
|
||||
DBC[0].left= /*200*/150; DBC[0].right= /*370*/465;
|
||||
ImprimeBoton (1, GRIS_C, GRIS_O, BLANCO, DBC[0]);
|
||||
textxy(160+2, 145+2, "PANTALLA DE CONFIGURACION");
|
||||
|
||||
DBC[0].up = /*143*/135; DBC[0].down = /*252*/395;
|
||||
DBC[0].left= /*203*/155; DBC[0].right= /*367*/460;
|
||||
ImprimeBoton (0, GRIS_C, BLANCO, GRIS_O, DBC[0]);
|
||||
|
||||
DBC[0].up = /*235*/370; DBC[0].down = /*250*/390;
|
||||
DBC[0].left= /*210*/160; DBC[0].right= /*270*/230;
|
||||
ImprimeBoton (1, GRIS_C, BLANCO, GRIS_O, DBC[0]);
|
||||
textxy(162, 372, " Aceptar");
|
||||
textxy(162, 373, " _");
|
||||
|
||||
DBC[1].up = /*235*/370; DBC[1].down = /*250*/390;
|
||||
DBC[1].left= /*300*/385; DBC[1].right= /*360*/455;
|
||||
ImprimeBoton (1, GRIS_C, BLANCO, GRIS_O, DBC[1]);
|
||||
textxy(387, 372, " Cancelar");
|
||||
textxy(387, 373, " _");
|
||||
|
||||
DBC[2].up = /*165*/180; DBC[2].down = /*185*/195;
|
||||
DBC[2].left= 235; DBC[2].right= 300;
|
||||
Fuente(SMALL_FONT, 4);
|
||||
textxy(160+2, 175+2, "A¤o para las");
|
||||
textxy(160+2, 185+2, "gestiones...");
|
||||
ImprimeBoton (1, NEGRO, BLANCO, GRIS_O, DBC[2]);
|
||||
textxy(305+2, 185+2, "<--- ( no Backup )");
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
2150
SV_CLIE2.CPP
Normal file
2150
SV_CLIE2.CPP
Normal file
File diff suppressed because it is too large
Load Diff
2257
SV_CLIEN.CPP
Normal file
2257
SV_CLIEN.CPP
Normal file
File diff suppressed because it is too large
Load Diff
1137
SV_COMP.CPP
Normal file
1137
SV_COMP.CPP
Normal file
File diff suppressed because it is too large
Load Diff
25
SV_DATOS.H
Normal file
25
SV_DATOS.H
Normal file
@ -0,0 +1,25 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// Nombre: SV_DATOS.H ///
|
||||
/// Modulo: Cabecera com£n a todos los m¢dulos ///
|
||||
/// Descripci¢n: ///
|
||||
/// ///
|
||||
/// Autor: Jos‚ David Guill‚n Dominguez ///
|
||||
/// Fecha: 21 - 05 - 1995 ///
|
||||
/// ///
|
||||
/// Comentario: ///
|
||||
/// ///
|
||||
/// ///
|
||||
/// Compilador Borland C++ 3.0 ///
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
147
SV_FACT.CPP
Normal file
147
SV_FACT.CPP
Normal file
@ -0,0 +1,147 @@
|
||||
#include "..\libs\make_bot\make_bot.h"
|
||||
#include "SV_graph.h"
|
||||
#include <conio.h>
|
||||
#include <graphics.h>
|
||||
#include "sv_util.h"
|
||||
|
||||
#define Para_Cliente 1
|
||||
#define Para_Empresa 0
|
||||
|
||||
extern struct boton Check[5];
|
||||
extern int x_raton, y_raton, raton;
|
||||
extern int boton_izq, boton_der;
|
||||
|
||||
extern void inicializa_raton_grafico(int x1, int y1, int x2, int y2, int px, int py);
|
||||
extern void textxy(int x, int y, char *text);
|
||||
extern int Espera_Tecla_o_Raton(void);
|
||||
extern void desactiva_raton(void);
|
||||
extern void activa_raton(void);
|
||||
extern void Anclar_Raton(void);
|
||||
extern void BEEP(void);
|
||||
|
||||
|
||||
void Menu_de_Facturas(void);
|
||||
void Prepara_Porcentaje_Circular(void);
|
||||
extern void Imprime_Todas_Facturas(int Para_quien, int Current_Date);
|
||||
|
||||
void Menu_de_Facturas(void){
|
||||
|
||||
int Devuelve, finished=0, bpush;
|
||||
char Select[2] = {0, 1};
|
||||
|
||||
if ( ( Devuelve = Pide_Fecha_Actual( ) ) == -1 ) return;
|
||||
Pantalla_de_Facturas();
|
||||
Prepara_Porcentaje_Circular();
|
||||
|
||||
ImprimeBoton (1, ROJO, BLANCO, GRIS_O, Check[1]);
|
||||
do{
|
||||
|
||||
if(raton!=0) activa_raton();
|
||||
Espera_Tecla_o_Raton();
|
||||
if(raton!=0) desactiva_raton();
|
||||
|
||||
if(kbhit())
|
||||
switch( getch() ){
|
||||
case 0: getch(); break;
|
||||
// EMPRESA
|
||||
case 101:
|
||||
case 69:
|
||||
if( Select[0] == 1 ) {
|
||||
Select[0] = 0;
|
||||
ImprimeBoton (1, NEGRO, BLANCO, GRIS_O, Check[0]);
|
||||
} else {
|
||||
Select[0] = 1;
|
||||
ImprimeBoton (1, ROJO, BLANCO, GRIS_O, Check[0]);
|
||||
}
|
||||
break;
|
||||
// CLIENTE
|
||||
case 67:
|
||||
case 99:
|
||||
if( Select[1] == 1 ) {
|
||||
Select[1] = 0;
|
||||
ImprimeBoton (1, NEGRO, BLANCO, GRIS_O, Check[1]);
|
||||
} else {
|
||||
Select[1] = 1;
|
||||
ImprimeBoton (1, ROJO, BLANCO, GRIS_O, Check[1]);
|
||||
}
|
||||
break;
|
||||
// COMENZAR
|
||||
case 79:
|
||||
case 111:
|
||||
if(Select[0]==1) Imprime_Todas_Facturas(Para_Empresa, Devuelve);
|
||||
if(Select[1]==1) Imprime_Todas_Facturas(Para_Cliente, Devuelve);
|
||||
finished = 1;
|
||||
break;
|
||||
// DETENER
|
||||
case 27:
|
||||
case 68:
|
||||
case 100:
|
||||
finished = 1;
|
||||
break;
|
||||
default: break;
|
||||
} else if(raton!=0 && ( boton_izq==1 || boton_der==1 ) )
|
||||
if( (bpush = CheckButon( 4, Check))>0 ) {
|
||||
switch(bpush){
|
||||
// EMPRESA
|
||||
case 1:
|
||||
if( Select[0] == 1 ) {
|
||||
Select[0] = 0;
|
||||
ImprimeBoton (1, NEGRO, BLANCO, GRIS_O, Check[0]);
|
||||
} else {
|
||||
Select[0] = 1;
|
||||
ImprimeBoton (1, ROJO, BLANCO, GRIS_O, Check[0]);
|
||||
}
|
||||
break;
|
||||
// CLIENTE
|
||||
case 2:
|
||||
if( Select[1] == 1 ) {
|
||||
Select[1] = 0;
|
||||
ImprimeBoton (1, NEGRO, BLANCO, GRIS_O, Check[1]);
|
||||
} else {
|
||||
Select[1] = 1;
|
||||
ImprimeBoton (1, ROJO, BLANCO, GRIS_O, Check[1]);
|
||||
}
|
||||
break;
|
||||
// COMENZAR
|
||||
case 3:
|
||||
if(Select[0]==1) Imprime_Todas_Facturas(Para_Empresa, Devuelve);
|
||||
if(Select[1]==1) Imprime_Todas_Facturas(Para_Cliente, Devuelve);
|
||||
finished = 1;
|
||||
break;
|
||||
// DETENER
|
||||
case 4:
|
||||
finished = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}while(!finished);
|
||||
|
||||
}
|
||||
|
||||
void Prepara_Porcentaje_Circular(void) {
|
||||
setcolor(NEGRO);
|
||||
setfillstyle(SOLID_FILL, NEGRO);
|
||||
pieslice(400, 265, 0, 359, 38);
|
||||
|
||||
setcolor(GRIS_O);
|
||||
arc(400, 265, 300, 110, 40);
|
||||
arc(400, 265, 302, 112, 39);
|
||||
setcolor(BLANCO);
|
||||
arc(400, 265, 110, 300, 40);
|
||||
arc(400, 265, 112, 302, 39);
|
||||
setcolor(GRIS_O);
|
||||
arc(400, 265, 290, 100, 7);
|
||||
arc(400, 265, 291, 101, 6);
|
||||
setcolor(BLANCO);
|
||||
arc(400, 265, 100, 290, 7);
|
||||
arc(400, 265, 101, 291, 6);
|
||||
setcolor(NEGRO);
|
||||
setfillstyle(SOLID_FILL, GRIS_C);
|
||||
pieslice(400, 265, 0, 360, 5);
|
||||
}
|
||||
|
692
SV_GCLIE.CPP
Normal file
692
SV_GCLIE.CPP
Normal file
@ -0,0 +1,692 @@
|
||||
#include<graphics.h>
|
||||
#include<dos.h>
|
||||
#include<conio.h>
|
||||
#include<stdio.h>
|
||||
#include<string.h>
|
||||
#include<ctype.h>
|
||||
#include<alloc.h>
|
||||
#include<stdlib.h>
|
||||
|
||||
|
||||
#include "..\libs\make_bot\make_bot.h"
|
||||
#include "sv_util.h"
|
||||
#include "sv_graph.h"
|
||||
#include "sv_ref_x.h"
|
||||
|
||||
|
||||
#define Letra_Boton setcolor(1);
|
||||
#define Azul 1
|
||||
#define Texto_Normal setcolor(63);
|
||||
#define Texto_Negrita setcolor(0);
|
||||
|
||||
extern int x_raton, y_raton, raton;
|
||||
extern int boton_izq, boton_der;
|
||||
|
||||
extern void desactiva_raton(void);
|
||||
extern void activa_raton(void);
|
||||
extern void Anclar_Raton(void);
|
||||
extern void inicializa_raton_grafico(int x1, int y1, int x2, int y2, int px, int py);
|
||||
extern int Espera_Tecla_o_Raton(void);
|
||||
extern void BEEP(void);
|
||||
extern void textxy(int x, int y, char *text);
|
||||
|
||||
|
||||
extern void Abre_Ficha_Compras(void);
|
||||
extern void GetLineComp(void);
|
||||
|
||||
// extern int Confirma(char *f1, char *f2, char *f3);
|
||||
extern int Comprueba_Impresora(void);
|
||||
|
||||
extern void Abre_Ficha_Stock(void);
|
||||
|
||||
extern void Lee_Datos_Ganancias(unsigned long *Compras_mes);
|
||||
|
||||
void Imprimir_Gra_Compras_C(unsigned long *Compras_mes);
|
||||
|
||||
void Prepara_Pantalla_GC2(void);
|
||||
|
||||
void Lee_Datos_C(unsigned long *Compras_mes);
|
||||
void Muestra_Datos_C(unsigned long *Compras_mes, int Cod);
|
||||
extern void Calcula_Porcentaje_C(unsigned long *Compras_mes);
|
||||
|
||||
struct Comp_inx { unsigned int Fin; };
|
||||
|
||||
|
||||
struct Compras {
|
||||
struct date Fecha;
|
||||
int Ref;
|
||||
int Und;
|
||||
char Cod;
|
||||
};
|
||||
|
||||
////////////
|
||||
extern void Prepara_Porcentaje_Circular(void);
|
||||
extern void GetLineClientes_Compras2(void);
|
||||
extern void Displayado_de_Datos(int Para_quien);
|
||||
extern void Acota_Contenido(void);
|
||||
extern int Viable_Apertura(void);
|
||||
extern void Abre_Ficha_Clientes(void);
|
||||
extern void Abre_Ficha_Clientes_Ncontrato(void);
|
||||
extern void Abre_Ficha_Vendedores(void);
|
||||
extern void Carga_Todos_los_Vendedores(void);
|
||||
extern int CurrRow1_Clien, CurrRow2_Clien;
|
||||
extern int CurrCol1_Clien, CurrCol2_Clien;
|
||||
extern int CurrTopLine_Clien, CurrTopLine_Clien1;
|
||||
extern void GetLineClientes(void);
|
||||
extern void Abre_Ficha_Clientes_Compras(void);
|
||||
|
||||
extern int *Vend_Dir;
|
||||
|
||||
struct Clientes_inx_NContrato {
|
||||
unsigned long Inicio;
|
||||
unsigned int Records;
|
||||
unsigned char Libre;
|
||||
};
|
||||
|
||||
struct Clientes_inx {
|
||||
char Ncontrato_ocupado_SN[10000];
|
||||
unsigned int Fin;
|
||||
};
|
||||
|
||||
struct Clientes {
|
||||
int Address;
|
||||
|
||||
char Nombre[15+1]; char Apellido1[15+1]; char Apellido2[15+1];
|
||||
char DNI[15+1]; unsigned long Telefono1;
|
||||
char Calle1[30+1]; char Num1[5+1];
|
||||
|
||||
char Local[30+1]; unsigned long Telefono2;
|
||||
char Calle2[30+1]; char Num2[5+1];
|
||||
char Poblacion[18+1]; char Provincia[16+1]; unsigned long CP;
|
||||
|
||||
unsigned char GC; unsigned char MR; unsigned char SP;
|
||||
unsigned char DP; unsigned int MA;
|
||||
|
||||
struct date Fecha; int Vend; int NContrato;
|
||||
|
||||
};
|
||||
|
||||
// Se almacenan 1000 registros por archivo
|
||||
// En un caso extremo son: 9 bit ---> Espacio por Dato
|
||||
// 31 ---> Dias por mes
|
||||
// 2 ---> Productos por d¡a
|
||||
// 12 ---> 12 meses
|
||||
// 1000 ---> Clientes
|
||||
//
|
||||
|
||||
struct Clientes_compras { // C UU VEN REF
|
||||
struct date Fecha; // 1 99 999 9999
|
||||
unsigned long Cod_Und_Vend_Ref;
|
||||
};
|
||||
|
||||
struct Vend_inx {
|
||||
unsigned int Fin;
|
||||
};
|
||||
|
||||
struct Vendedores {
|
||||
int Num_V;
|
||||
char Nombre[15+1]; char Apellido1[15+1]; char Apellido2[15+1];
|
||||
char DNI[15+1]; unsigned long Telefono1; unsigned long Telefono2;
|
||||
char Calle[30+1]; char Num[3+1]; char Piso[3+1];
|
||||
char Poblacion[18+1]; char Provincia[16+1]; unsigned long CP;
|
||||
unsigned long CC; unsigned int PP; unsigned int Cr;
|
||||
};
|
||||
/*
|
||||
extern struct Stock_inx { unsigned int Fin; };
|
||||
|
||||
extern struct Stock_actual { int Ref; long Und_0; long Und_1; };
|
||||
*/
|
||||
extern struct Stock_actual Ventas1;
|
||||
extern struct Stock_inx Ventas1_inx;
|
||||
|
||||
extern void Actualizar_Stock(int Referencia, int Unidades, int Codigo);
|
||||
|
||||
|
||||
extern struct JD cabecera;
|
||||
extern struct Clientes Clientes1;
|
||||
extern struct Clientes_inx Clientes1_inx;
|
||||
extern struct Clientes_compras Clientes2;
|
||||
extern struct Clientes_inx_NContrato Clientes1_inx_NContrato;
|
||||
|
||||
// struct Clientes Clientes1_Buscar;
|
||||
|
||||
extern struct Vendedores Vend1;
|
||||
extern struct Vend_inx Vend1_inx;
|
||||
|
||||
extern FILE *Vend; // Fichero Vendedores
|
||||
extern FILE *Stock;
|
||||
extern FILE *Ventas;
|
||||
extern FILE *Clientes; // Fichero Clientes
|
||||
extern FILE *Clientes_C; // Fichero Clientes con las Compras.
|
||||
extern FILE *Clientes_NC; // Fichero Clientes con los n£meros de contrato activos.
|
||||
|
||||
extern int Usa_Pc;
|
||||
|
||||
extern int Start_Comp_Clien;
|
||||
extern int Comp_Clien_Records;
|
||||
extern int oldCNI;
|
||||
|
||||
|
||||
char Buffer_Clien[15][80];
|
||||
|
||||
////////////
|
||||
|
||||
extern struct Compras Comp1;
|
||||
extern struct Comp_inx Comp1_inx;
|
||||
|
||||
struct boton *PGC2;//[7]
|
||||
extern struct boton Comunes[9];
|
||||
|
||||
extern int CurrRowComp1;
|
||||
extern int CurrColComp1;
|
||||
extern int CurrTopLineComp;
|
||||
|
||||
extern unsigned long TOTAL, TOTAL1, TOTAL0;
|
||||
extern int Fecha;
|
||||
int Dir_Pers[15];
|
||||
int Buff_Contr[15];
|
||||
|
||||
void Menu_Graficas_de_Clientes(int Current_Date);
|
||||
|
||||
|
||||
void Menu_Graficas_de_Clientes(int Current_Date){
|
||||
|
||||
Fecha = Current_Date;
|
||||
int i;
|
||||
|
||||
for( i=0; i<15; i++) {
|
||||
Dir_Pers[i] = 0;
|
||||
Buff_Contr[i] = 0;
|
||||
strcpy( Buffer_Clien[i], "\0");
|
||||
}
|
||||
|
||||
int finished = 0, bpush;
|
||||
unsigned long *Compras_mes;
|
||||
|
||||
if( ( PGC2 = (struct boton *) malloc( sizeof(struct boton)*20 ) ) == NULL )
|
||||
{
|
||||
Confirma("Memoria insuficiente", "para crear tablas de", "posisi¢n PGC.");
|
||||
return ;
|
||||
}
|
||||
|
||||
if( ( Compras_mes = (unsigned long *) malloc( sizeof(long)*24 ) ) == NULL )
|
||||
{
|
||||
Confirma("Memoria insuficiente", "para crear tablas de", "Compras_mes.");
|
||||
free(PGC2);
|
||||
return ;
|
||||
}
|
||||
|
||||
for(bpush=0; bpush<24; bpush++)
|
||||
Compras_mes[bpush]=0;
|
||||
|
||||
|
||||
//////////////////
|
||||
if( !Viable_Apertura() ) return ;
|
||||
|
||||
Abre_Ficha_Clientes();
|
||||
Abre_Ficha_Clientes_Ncontrato();
|
||||
|
||||
Abre_Ficha_Referencias();
|
||||
Carga_Referencias();
|
||||
|
||||
if( ( Vend_Dir = (int *) malloc( sizeof(int)*1024 ) ) == NULL )
|
||||
{
|
||||
Confirma("Memoria insuficiente", "para crear tablas para", "Vend_Dir");
|
||||
return ;
|
||||
}
|
||||
Abre_Ficha_Vendedores();
|
||||
Carga_Todos_los_Vendedores();
|
||||
|
||||
|
||||
CurrRow1_Clien = 1;
|
||||
CurrTopLine_Clien1 = 1;
|
||||
GetLineClientes();
|
||||
Abre_Ficha_Clientes_Compras();
|
||||
|
||||
//////////////////
|
||||
|
||||
Lee_Datos_C(Compras_mes);
|
||||
|
||||
Prepara_Pantalla_GC2();
|
||||
|
||||
Calcula_Porcentaje_C(Compras_mes);
|
||||
Muestra_Datos_C(Compras_mes, 1);
|
||||
|
||||
do{
|
||||
|
||||
if(raton!=0) activa_raton();
|
||||
Espera_Tecla_o_Raton();
|
||||
if(raton!=0) desactiva_raton();
|
||||
|
||||
if(kbhit()){
|
||||
if( getch()==0 ) {
|
||||
switch( (getch()) ){
|
||||
// Flecha Arriba
|
||||
case 72:
|
||||
break;
|
||||
// Flecha Izquierda
|
||||
case 75:
|
||||
case 15:
|
||||
break;
|
||||
// Flecha Derecha
|
||||
case 77:
|
||||
case 9:
|
||||
break;
|
||||
// Flecha Abajo
|
||||
case 80:
|
||||
break;
|
||||
// Codigo 1 F2
|
||||
case 60:
|
||||
// Muestra_Datos_C(Compras_mes, 1);
|
||||
break;
|
||||
// Codigo 0 F3
|
||||
case 61:
|
||||
// Muestra_Datos_C(Compras_mes, 0);
|
||||
break;
|
||||
// Codigo 1y0 F4
|
||||
case 62:
|
||||
// Muestra_Datos_C(Compras_mes, 2);
|
||||
break;
|
||||
// Imprimir Compras F5
|
||||
case 63:
|
||||
Imprimir_Gra_Compras_C(Compras_mes);
|
||||
break;
|
||||
// F9 --> A¥ADIR
|
||||
case 67:
|
||||
break;
|
||||
// F10 -> BORRAR
|
||||
case 68:
|
||||
break;
|
||||
// INICIO
|
||||
case 71:
|
||||
break;
|
||||
// FIN
|
||||
case 79:
|
||||
break;
|
||||
// ReP g
|
||||
case 73:
|
||||
// CurrRow = 1;
|
||||
break;
|
||||
// AvP g
|
||||
case 81:
|
||||
break;
|
||||
// Salir F1
|
||||
case 59:
|
||||
finished = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if(raton!=0 && ( boton_izq==1 || boton_der==1 ) )
|
||||
if( (bpush = CheckButon( 9, Comunes))>0 ) {
|
||||
switch(bpush){
|
||||
// Flecha Arriba
|
||||
case 1:
|
||||
break;
|
||||
// Buscar
|
||||
case 2:
|
||||
break;
|
||||
// Flecha Abajo
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
break;
|
||||
// Imprimir
|
||||
case 5:
|
||||
Imprimir_Gra_Compras_C(Compras_mes);
|
||||
break;
|
||||
// A¤adir
|
||||
case 6:
|
||||
break;
|
||||
// Borrar
|
||||
case 7:
|
||||
break;
|
||||
// Salir
|
||||
case 9:
|
||||
finished = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}while(!finished);
|
||||
|
||||
fclose(Clientes); // Fichero Clientes
|
||||
fclose(Clientes_NC); // Fichero Clientes
|
||||
fclose(Clientes_C); // Fichero Clientes
|
||||
fclose(Ref); // Fichero Vendedores
|
||||
|
||||
|
||||
if(Memory_ok==1) farfree(Addr); else free(Ref_inx_addr);
|
||||
free(PGC2);
|
||||
free(Vend_Dir);
|
||||
free(Compras_mes);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Lee_Datos_C(unsigned long *Compras_mes){
|
||||
|
||||
setcolor(ROJO);
|
||||
setfillstyle( SOLID_FILL, ROJO );
|
||||
Pantalla_de_Facturas();
|
||||
/* char Buffer[80]; */
|
||||
int /*day, mon, Ref,*/ Und,/* Cod, Vend,*/ ok, Compara, sustf;
|
||||
unsigned long Suma_Total = 0, /*Suma_IVA = 0,*/ Total;
|
||||
|
||||
int tmp = CurrRow1_Clien, Ptotal;
|
||||
CurrTopLine_Clien1 = 1;
|
||||
Usa_Pc = 1;
|
||||
|
||||
CurrTopLine_Clien = 1;
|
||||
Prepara_Porcentaje_Circular();
|
||||
|
||||
setcolor(4);
|
||||
setfillstyle(SOLID_FILL, 60);
|
||||
|
||||
|
||||
for(CurrRow1_Clien = 1; CurrRow1_Clien <= ( Clientes1_inx.Fin + 1); CurrRow1_Clien++){
|
||||
|
||||
GetLineClientes();
|
||||
if( ( (Clientes1.Address)/100/*0*/ ) != oldCNI ){
|
||||
oldCNI = ( (Clientes1.Address) / 100/*0*/ );
|
||||
fclose(Clientes_C);
|
||||
Abre_Ficha_Clientes_Compras();
|
||||
}
|
||||
Acota_Contenido();
|
||||
|
||||
// Porcentaje();
|
||||
|
||||
Displayado_de_Datos(5);
|
||||
|
||||
setcolor(4);
|
||||
setfillstyle(SOLID_FILL, 60);
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
Suma_Total = 0;
|
||||
|
||||
for(CurrRow2_Clien = 1; (CurrTopLine_Clien + CurrRow2_Clien - 1) <= Comp_Clien_Records; CurrRow2_Clien++) {
|
||||
|
||||
GetLineClientes_Compras2();
|
||||
|
||||
// X 99 999 9999
|
||||
/// Cod = ( Clientes2.Cod_Und_Vend_Ref/1000000000L );
|
||||
|
||||
// day= Clientes2.Fecha.da_day;
|
||||
// mon= Clientes2.Fecha.da_mon;
|
||||
// sprintf(Buffer, "%02d/%02d/%02d", day, mon, Clientes2.Fecha.da_year );
|
||||
// 1 99 999 XXXX
|
||||
/// Ref = ( Clientes2.Cod_Und_Vend_Ref - ((Clientes2.Cod_Und_Vend_Ref/10000)*10000) );
|
||||
// 1 XX 999 9999
|
||||
Und = ( ( Clientes2.Cod_Und_Vend_Ref/10000000L ) - ( ( (Clientes2.Cod_Und_Vend_Ref/10000000L)/100)*100 ) );
|
||||
// 1 99 XXX 9999
|
||||
/// Vend = ( ( Clientes2.Cod_Und_Vend_Ref/10000 ) - ( ( ( Clientes2.Cod_Und_Vend_Ref/10000 ) / 1000) * 1000 ) );
|
||||
|
||||
Total = ( (Und * Ref1.PVP) + ( ( Und * Ref1.PVP*Ref1.P2)/100) );
|
||||
|
||||
Suma_Total += Total;
|
||||
|
||||
if (Usa_Pc == 1)
|
||||
pieslice(400, 265, (( ( 360 * ( ( CurrRow2_Clien * 100 ) / Comp_Clien_Records ) ) / 100 ) - 1), 0, 38);
|
||||
}
|
||||
|
||||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
|
||||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
ok = 0;
|
||||
|
||||
for( Compara=0; Compara<12 && !ok ; Compara++ ) {
|
||||
if( Compras_mes[Compara] < Suma_Total ) {
|
||||
for( sustf = 11; sustf >= Compara; sustf-- ) {
|
||||
|
||||
Compras_mes[sustf] = Compras_mes[sustf-1];
|
||||
|
||||
Dir_Pers[sustf] = Dir_Pers[sustf-1];
|
||||
|
||||
strcpy( Buffer_Clien[sustf], Buffer_Clien[sustf-1]);
|
||||
|
||||
Buff_Contr[sustf] = Buff_Contr[sustf-1];
|
||||
|
||||
}
|
||||
Compras_mes[Compara] = Suma_Total;
|
||||
Dir_Pers[Compara] = CurrRow1_Clien;
|
||||
sprintf( Buffer_Clien[Compara], "%-21s", Clientes1.Local);
|
||||
Buff_Contr[Compara] = Clientes1.NContrato;
|
||||
ok = 1;
|
||||
}
|
||||
}
|
||||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
|
||||
// fprintf( stdprn, "%04d\n\r", Clientes1.NContrato);
|
||||
// fprintf( stdprn, " %s\n\r",Clientes1.Local);
|
||||
// fprintf( stdprn, " %s %s, %s\n\r", Clientes1.Apellido1, Clientes1.Apellido2, Clientes1.Nombre);
|
||||
|
||||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
// Calculamos el porcentaje total realizado
|
||||
// Si todo es el: ( Clientes1_inx.Fin + 1 ) es decir 100 %
|
||||
// CurrRow1_Clien el el X %
|
||||
// X = ( CurrRow1_Clien * 100 ) / ( Clientes1_inx.Fin + 1 )
|
||||
|
||||
// Si 285 es el 100 %
|
||||
// x es el X anterior
|
||||
// x = ( 285 * X ) / 100
|
||||
Ptotal = ( ( 283 * ( ( CurrRow1_Clien * 100 ) / ( Clientes1_inx.Fin + 1 ) ) ) / 100 );
|
||||
bar(167, 172, 167 + Ptotal, 182 );
|
||||
|
||||
Prepara_Porcentaje_Circular();
|
||||
|
||||
}
|
||||
|
||||
CurrRow1_Clien = tmp;
|
||||
|
||||
|
||||
Usa_Pc = 0;
|
||||
|
||||
}
|
||||
|
||||
void Muestra_Datos_C(unsigned long *Compras_mes, int Cod){
|
||||
|
||||
char Buffer[80];
|
||||
|
||||
setcolor(ROJO);
|
||||
|
||||
for(int i=0; i<12; i++){
|
||||
ImprimeBoton (1, NEGRO, BLANCO, GRIS_O, PGC2[i]);
|
||||
|
||||
/// if(Cod == 1){
|
||||
/// setcolor(EGA_LIGHTBLUE);
|
||||
/// sprintf(Buffer, "%18ld", Compras_mes[i*2 + 1] );
|
||||
/// } else if(Cod == 0){
|
||||
/// sprintf(Buffer, "%18ld", Compras_mes[i*2] );
|
||||
/// setcolor(ROJO);
|
||||
/// } else if(Cod == 2){
|
||||
setcolor(EGA_YELLOW);
|
||||
sprintf(Buffer, "%13ld", Compras_mes[i /* *2 + 1 */]/* + Compras_mes[i*2]*/ );
|
||||
/// }
|
||||
outtextxy(PGC2[i].left+2, PGC2[i].up+2, Buffer);
|
||||
}
|
||||
|
||||
Fuente(SMALL_FONT, 4);
|
||||
for(i=0; i<12; i++)
|
||||
textxy( PGC2[i].left - 78 - 40 - 5, PGC2[i].up+2, Buffer_Clien[i] );
|
||||
|
||||
Fuente(SMALL_FONT, 6);
|
||||
// ImprimeBoton (1, NEGRO, BLANCO, GRIS_O, PGC2[12]);
|
||||
// setcolor(BLANCO);
|
||||
/// if(Cod == 1) sprintf(Buffer, "%46ld", TOTAL1 );
|
||||
/// else if(Cod == 0) sprintf(Buffer, "%46ld", TOTAL0 );
|
||||
/// else if(Cod == 2) sprintf(Buffer, "%46ld", TOTAL );
|
||||
|
||||
|
||||
/// outtextxy(PGC2[12].left+2, PGC2[12].up+2, Buffer);
|
||||
|
||||
// bar(152,372, ( 152 + 245 ), 388);
|
||||
|
||||
}
|
||||
|
||||
void Calcula_Porcentaje_C(unsigned long *Compras_mes){
|
||||
|
||||
/* long double */ TOTAL = 0;
|
||||
/* long double */ TOTAL1 = 0;
|
||||
/* long double */ TOTAL0 = 0;
|
||||
|
||||
char Buffer[80];
|
||||
int i, ADD = 15;
|
||||
long P1tmp, P0tmp, Ltmp;
|
||||
|
||||
|
||||
for(i=0; i<12; i++) {
|
||||
TOTAL0 += Compras_mes[ i/* *2 */ ];
|
||||
// TOTAL1 += Compras_mes[ i*2 + 1 ];
|
||||
}
|
||||
TOTAL1 = 0;
|
||||
|
||||
TOTAL = /* TOTAL1 + */ TOTAL0 ;
|
||||
|
||||
setcolor(BLANCO);
|
||||
|
||||
// sprintf(Buffer, "%46ld", TOTAL1 );
|
||||
// outtextxy(PGC2[12].left+2, PGC2[12].up+2, Buffer);
|
||||
|
||||
ImprimeBoton (1, NEGRO, BLANCO, GRIS_O, PGC2[13]);
|
||||
|
||||
// PGC2[13].up = 195; PGC2[13].down = 440;
|
||||
// PGC2[13].left = 5; PGC2[13].right = 549;
|
||||
|
||||
Fuente(SMALL_FONT, 4);
|
||||
|
||||
setcolor(BLANCO);
|
||||
outtextxy( 10, 350 + 15+ 5 - 150, "100 %");
|
||||
|
||||
outtextxy( 10, 350 + 15+ 5 - 75, " 50 %");
|
||||
|
||||
outtextxy( 10, 350 + 15+ 5, " 0 %");
|
||||
|
||||
setcolor(ROJO);
|
||||
outtextxy( 10, 350 + 15+ 5 - 75 - 37, " 75 %");
|
||||
|
||||
outtextxy( 10, 350 + 15+ 5 - 37, " 25 %");
|
||||
|
||||
for(i=0; i<12; i++){
|
||||
|
||||
//bar3d( (ADD + 45 + (i*35 + 2 + i*5) ), 215, (ADD + 45 + (i*35 + 2 + i*5) + 35 ), 350, 10, 1);
|
||||
if ( (Compras_mes[ i /* * 2 + 1 */ ] /* + Compras_mes[ i * 2 ] */ ) != 0 ) {
|
||||
// Porcentaje de las compras 1 en un mes
|
||||
/// P1tmp = (Compras_mes[ i /* * 2 + 1 */ ] * 100)/(Compras_mes[ i /* * 2 + 1 */ ]/* + Compras_mes[ i * 2 ]*/);
|
||||
/// P0tmp = (Compras_mes[ i * 2 ] * 100)/(Compras_mes[ i * 2 + 1 ] + Compras_mes[ i * 2 ]);
|
||||
P0tmp = 0;
|
||||
P1tmp = 100;
|
||||
|
||||
Ltmp = ( ( 150 * ( ( (Compras_mes[ i /* * 2 + 1 */ ] /*+ Compras_mes[ i * 2 ]*/) * 100 ) / TOTAL ) ) / 100 );
|
||||
|
||||
if( P1tmp != 0 && P0tmp == 0 ){
|
||||
setcolor(AZUL);
|
||||
setfillstyle( i, AZUL );
|
||||
bar3d( (ADD + 45 + (i*35 + 2 + i*5) ) - 15 - 5,
|
||||
350 + 15+ 5 - ( (Ltmp * P1tmp) / 100),
|
||||
(ADD + 45 + (i*35 + 2 + i*5) + 35 ) - 15 - 5, 350 + 15+5, 30, 1);
|
||||
}
|
||||
if( P1tmp != 0 && P0tmp != 0 ){
|
||||
setcolor(AZUL);
|
||||
setfillstyle( i, AZUL );
|
||||
bar3d( (ADD + 45 + (i*35 + 2 + i*5) ) - 15 - 5,
|
||||
350 + 15+ 5 - ( (Ltmp * P1tmp) / 100),
|
||||
(ADD + 45 + (i*35 + 2 + i*5) + 35 ) - 15 - 5, 350 + 15+5, 30, 0);
|
||||
}
|
||||
if( P0tmp != 0 ){
|
||||
setcolor(ROJO);
|
||||
setfillstyle( i, ROJO );
|
||||
bar3d( (ADD + 45 + (i*35 + 2 + i*5) ) - 15 - 5,
|
||||
(350 + 15+ 5 - ( (Ltmp * P1tmp) / 100) ) - ( (Ltmp * P0tmp) / 100),
|
||||
(ADD + 45 + (i*35 + 2 + i*5) + 35 ) - 15 - 5,
|
||||
(350 + 15+5 - ( (Ltmp * P1tmp) / 100) ), 30, 1);
|
||||
}
|
||||
|
||||
setcolor(EGA_YELLOW);
|
||||
sprintf(Buffer, " %04d", Buff_Contr[i] );
|
||||
outtextxy( (ADD + 45 + (i*35 + 2 + i*5) ) - 15 - 5 - 5 - 1, 380 - 5, Buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Fuente(SMALL_FONT, 6);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Prepara_Pantalla_GC2(void) {
|
||||
cleardevice();
|
||||
Pantalla_Graficas_Compras_C(PGC2);
|
||||
|
||||
Fuente(SMALL_FONT, 5);
|
||||
|
||||
// Coloca_Nombres_a_botones();
|
||||
/*
|
||||
textxy(Comunes[0].left+2, Comunes[0].up, "C¢digos" );
|
||||
textxy(Comunes[0].left+2, Comunes[0].up+18, " F2" );
|
||||
|
||||
textxy(Comunes[1].left+2, Comunes[1].up, "C¢digos 0" );
|
||||
textxy(Comunes[1].left+2, Comunes[1].up+18, " F3" );
|
||||
|
||||
textxy(Comunes[2].left+2, Comunes[2].up, "Totales" );
|
||||
textxy(Comunes[2].left+2, Comunes[2].up+18, " F4" );
|
||||
*/
|
||||
|
||||
textxy(Comunes[4].left+2, Comunes[4].up, " Imprimir" );
|
||||
textxy(Comunes[4].left+2, Comunes[4].up+18, " F5" );
|
||||
|
||||
textxy(Comunes[8].left+2, Comunes[8].up, " Salir" );
|
||||
textxy(Comunes[8].left+2, Comunes[8].up+18, " F1" );
|
||||
|
||||
|
||||
Fuente(SMALL_FONT, 6);
|
||||
|
||||
}
|
||||
|
||||
void Imprimir_Gra_Compras_C(unsigned long *Compras_mes){
|
||||
|
||||
char mes[][12] = {"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio",
|
||||
"Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"};
|
||||
|
||||
|
||||
if ( Comprueba_Impresora() == 0 ) {
|
||||
Confirma("Error Imprimiendo.", "Impresora Fuera de", "Servicio.");
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf( stdprn, "úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú\n\r");
|
||||
|
||||
for(int i=0; i<12; i++) {
|
||||
|
||||
|
||||
CurrRow1_Clien = Dir_Pers[i];
|
||||
GetLineClientes();
|
||||
|
||||
fprintf( stdprn, "N§ de Contrato: %04d Local: %s\n\r", Clientes1.NContrato, Clientes1.Local);
|
||||
fprintf( stdprn, "Propietario: %s %s %s ", Clientes1.Nombre, Clientes1.Apellido1, Clientes1.Apellido2);
|
||||
fprintf( stdprn, "Tlf: %lu\n\r", Clientes1.Telefono2);
|
||||
fprintf( stdprn, "Valor de las Compras: %10ld\n\r", Compras_mes[i]);
|
||||
fprintf( stdprn, "úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú\n\r");
|
||||
|
||||
}
|
||||
fprintf( stdprn, "\n\r");
|
||||
fprintf( stdprn, "\n\r");
|
||||
fprintf( stdprn, "Indice de ventas referente al mes de %s\n\r", mes[Fecha-1]);
|
||||
|
||||
fputc(12, stdprn);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
440
SV_GCOMP.CPP
Normal file
440
SV_GCOMP.CPP
Normal file
@ -0,0 +1,440 @@
|
||||
#include<graphics.h>
|
||||
#include<dos.h>
|
||||
#include<conio.h>
|
||||
#include<stdio.h>
|
||||
#include<string.h>
|
||||
#include<ctype.h>
|
||||
#include<alloc.h>
|
||||
#include<stdlib.h>
|
||||
|
||||
|
||||
#include "..\libs\make_bot\make_bot.h"
|
||||
#include "sv_util.h"
|
||||
#include "sv_graph.h"
|
||||
#include "sv_ref_x.h"
|
||||
|
||||
|
||||
#define Letra_Boton setcolor(1);
|
||||
#define Azul 1
|
||||
#define Texto_Normal setcolor(63);
|
||||
#define Texto_Negrita setcolor(0);
|
||||
|
||||
extern int x_raton, y_raton, raton;
|
||||
extern int boton_izq, boton_der;
|
||||
|
||||
extern void desactiva_raton(void);
|
||||
extern void activa_raton(void);
|
||||
extern void Anclar_Raton(void);
|
||||
extern void inicializa_raton_grafico(int x1, int y1, int x2, int y2, int px, int py);
|
||||
extern int Espera_Tecla_o_Raton(void);
|
||||
extern void BEEP(void);
|
||||
extern void textxy(int x, int y, char *text);
|
||||
|
||||
|
||||
extern void Abre_Ficha_Compras(void);
|
||||
extern void GetLineComp(void);
|
||||
|
||||
// extern int Confirma(char *f1, char *f2, char *f3);
|
||||
extern int Comprueba_Impresora(void);
|
||||
|
||||
extern void Abre_Ficha_Stock(void);
|
||||
|
||||
extern void Lee_Datos_Ganancias(unsigned long *Compras_mes);
|
||||
|
||||
void Imprimir_Gra_Compras(unsigned long *Compras_mes);
|
||||
void Prepara_Pantalla_GC(void);
|
||||
void Lee_Datos(unsigned long *Compras_mes);
|
||||
void Muestra_Datos(unsigned long *Compras_mes, int Cod);
|
||||
void Calcula_Porcentaje(unsigned long *Compras_mes);
|
||||
struct Comp_inx { unsigned int Fin; };
|
||||
|
||||
|
||||
struct Compras {
|
||||
struct date Fecha;
|
||||
int Ref;
|
||||
int Und;
|
||||
char Cod;
|
||||
};
|
||||
|
||||
extern struct Compras Comp1;
|
||||
extern struct Comp_inx Comp1_inx;
|
||||
|
||||
|
||||
struct boton *PGC;//[7]
|
||||
extern struct boton Comunes[9];
|
||||
|
||||
extern FILE *Comp; // Fichero de Compras
|
||||
|
||||
extern int CurrRowComp1;
|
||||
extern int CurrColComp1;
|
||||
extern int CurrTopLineComp;
|
||||
|
||||
unsigned long TOTAL = 0, TOTAL1 = 0, TOTAL0 = 0;
|
||||
|
||||
|
||||
void Menu_Graficas_de_Compras(int Compras_Ventas);
|
||||
/////////////// Voy a readactar el men£ para que la inicializaci¢n se pueda
|
||||
/////////////// hacer desde varios puntos, y un mismo m¢dulo sirva para dos
|
||||
/////////////// o tres cosas...
|
||||
|
||||
void Menu_Graficas_de_Compras(int Compras_Ventas) {
|
||||
|
||||
int finished = 0, bpush;
|
||||
unsigned long *Compras_mes;
|
||||
|
||||
if( ( PGC = (struct boton *) malloc( sizeof(struct boton)*20 ) ) == NULL )
|
||||
{
|
||||
Confirma("Memoria insuficiente", "para crear tablas de", "posisi¢n PGC.");
|
||||
return ;
|
||||
}
|
||||
|
||||
if( ( Compras_mes = (unsigned long *) malloc( sizeof(long)*24 ) ) == NULL )
|
||||
{
|
||||
Confirma("Memoria insuficiente", "para crear tablas de", "Compras_mes.");
|
||||
free(PGC);
|
||||
return ;
|
||||
}
|
||||
for(bpush=0; bpush<24; bpush++)
|
||||
Compras_mes[bpush]=0;
|
||||
|
||||
|
||||
Prepara_Pantalla_GC();
|
||||
if ( Compras_Ventas == 0 )
|
||||
Abre_Ficha_Compras();
|
||||
Abre_Ficha_Referencias();
|
||||
|
||||
Carga_Referencias();
|
||||
if ( Compras_Ventas == 0 )
|
||||
Lee_Datos(Compras_mes);
|
||||
else if ( Compras_Ventas == 1 )
|
||||
Lee_Datos_Ganancias(Compras_mes);
|
||||
else
|
||||
Lee_Datos_Ganancias(Compras_mes);
|
||||
|
||||
Calcula_Porcentaje(Compras_mes);
|
||||
Muestra_Datos(Compras_mes, 1);
|
||||
|
||||
do{
|
||||
|
||||
if(raton!=0) activa_raton();
|
||||
Espera_Tecla_o_Raton();
|
||||
if(raton!=0) desactiva_raton();
|
||||
|
||||
if(kbhit()){
|
||||
if( getch()==0 ) {
|
||||
switch( (getch()) ){
|
||||
// Flecha Arriba
|
||||
case 72:
|
||||
break;
|
||||
// Flecha Izquierda
|
||||
case 75:
|
||||
case 15:
|
||||
break;
|
||||
// Flecha Derecha
|
||||
case 77:
|
||||
case 9:
|
||||
break;
|
||||
// Flecha Abajo
|
||||
case 80:
|
||||
break;
|
||||
// Codigo 1 F2
|
||||
case 60:
|
||||
Muestra_Datos(Compras_mes, 1);
|
||||
break;
|
||||
// Codigo 0 F3
|
||||
case 61:
|
||||
Muestra_Datos(Compras_mes, 0);
|
||||
break;
|
||||
// Codigo 1y0 F4
|
||||
case 62:
|
||||
Muestra_Datos(Compras_mes, 2);
|
||||
break;
|
||||
// Imprimir Compras F5
|
||||
case 63:
|
||||
Imprimir_Gra_Compras(Compras_mes);
|
||||
break;
|
||||
// F9 --> A¥ADIR
|
||||
case 67:
|
||||
break;
|
||||
// F10 -> BORRAR
|
||||
case 68:
|
||||
break;
|
||||
// INICIO
|
||||
case 71:
|
||||
break;
|
||||
// FIN
|
||||
case 79:
|
||||
break;
|
||||
// ReP g
|
||||
case 73:
|
||||
// CurrRow = 1;
|
||||
break;
|
||||
// AvP g
|
||||
case 81:
|
||||
break;
|
||||
// Salir F1
|
||||
case 59:
|
||||
finished = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if(raton!=0 && ( boton_izq==1 || boton_der==1 ) )
|
||||
if( (bpush = CheckButon( 9, Comunes))>0 ) {
|
||||
switch(bpush){
|
||||
// Flecha Arriba
|
||||
case 1:
|
||||
break;
|
||||
// Buscar
|
||||
case 2:
|
||||
break;
|
||||
// Flecha Abajo
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
break;
|
||||
// Imprimir
|
||||
case 5:
|
||||
Imprimir_Gra_Compras(Compras_mes);
|
||||
break;
|
||||
// A¤adir
|
||||
case 6:
|
||||
break;
|
||||
// Borrar
|
||||
case 7:
|
||||
break;
|
||||
// Salir
|
||||
case 9:
|
||||
finished = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}while(!finished);
|
||||
|
||||
if ( Compras_Ventas == 0 ) fclose(Comp); // Fichero Vendedores
|
||||
fclose(Ref); // Fichero Vendedores
|
||||
if(Memory_ok==1) farfree(Addr); else free(Ref_inx_addr);
|
||||
free(PGC); // Libera la memoria
|
||||
free(Compras_mes);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Lee_Datos(unsigned long *Compras_mes){
|
||||
|
||||
setcolor(ROJO);
|
||||
setfillstyle( SOLID_FILL, ROJO );
|
||||
CurrTopLineComp=1;
|
||||
for(CurrRowComp1 = 1; CurrRowComp1 <= (Comp1_inx.Fin + 1); CurrRowComp1++){
|
||||
|
||||
GetLineComp();
|
||||
Compras_mes[ (Comp1.Fecha.da_mon - 1)*2 + (Comp1.Cod ? 1 : 0 ) ]
|
||||
+= ( Comp1.Cod
|
||||
?
|
||||
(((Ref1.P_und * Ref1.P1)/100) + Ref1.P_und)
|
||||
:
|
||||
( Ref1.P_und )
|
||||
)*Comp1.Und;
|
||||
|
||||
bar(152,372, 152 + ( (240*(CurrRowComp1*100)/(Comp1_inx.Fin + 1)) / 100 ), 388);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Muestra_Datos(unsigned long *Compras_mes, int Cod){
|
||||
|
||||
char Buffer[80];
|
||||
|
||||
setcolor(ROJO);
|
||||
|
||||
for(int i=0; i<12; i++){
|
||||
ImprimeBoton (1, NEGRO, BLANCO, GRIS_O, PGC[i]);
|
||||
|
||||
if(Cod == 1){
|
||||
setcolor(EGA_LIGHTBLUE);
|
||||
sprintf(Buffer, "%18ld", Compras_mes[i*2 + 1] );
|
||||
} else if(Cod == 0){
|
||||
sprintf(Buffer, "%18ld", Compras_mes[i*2] );
|
||||
setcolor(ROJO);
|
||||
} else if(Cod == 2){
|
||||
setcolor(EGA_YELLOW);
|
||||
sprintf(Buffer, "%18ld", Compras_mes[i*2 + 1] + Compras_mes[i*2] );
|
||||
}
|
||||
outtextxy(PGC[i].left+2, PGC[i].up+2, Buffer);
|
||||
|
||||
}
|
||||
|
||||
ImprimeBoton (1, NEGRO, BLANCO, GRIS_O, PGC[12]);
|
||||
setcolor(BLANCO);
|
||||
if(Cod == 1) sprintf(Buffer, "%46ld", TOTAL1 );
|
||||
else if(Cod == 0) sprintf(Buffer, "%46ld", TOTAL0 );
|
||||
else if(Cod == 2) sprintf(Buffer, "%46ld", TOTAL );
|
||||
|
||||
|
||||
outtextxy(PGC[12].left+2, PGC[12].up+2, Buffer);
|
||||
|
||||
// bar(152,372, ( 152 + 245 ), 388);
|
||||
|
||||
}
|
||||
|
||||
void Calcula_Porcentaje(unsigned long *Compras_mes){
|
||||
|
||||
char mes[][11] = { " Enero", "Febrero", " Marzo",
|
||||
" Abril", " Mayo", " Junio",
|
||||
" Julio", "Agosto", "Sept.",
|
||||
"Octub.", "Nov.", "Diciemb."
|
||||
};
|
||||
|
||||
/* long double */ TOTAL = 0;
|
||||
/* long double */ TOTAL1 = 0;
|
||||
/* long double */ TOTAL0 = 0;
|
||||
|
||||
// char Buffer[80];
|
||||
int i, ADD = 15;
|
||||
long P1tmp, P0tmp, Ltmp;
|
||||
|
||||
|
||||
for(i=0; i<12; i++) {
|
||||
TOTAL0 += Compras_mes[ i*2 ];
|
||||
TOTAL1 += Compras_mes[ i*2 + 1 ];
|
||||
}
|
||||
|
||||
TOTAL = TOTAL1 + TOTAL0 ;
|
||||
|
||||
setcolor(BLANCO);
|
||||
|
||||
// sprintf(Buffer, "%46ld", TOTAL1 );
|
||||
// outtextxy(PGC[12].left+2, PGC[12].up+2, Buffer);
|
||||
|
||||
ImprimeBoton (1, NEGRO, BLANCO, GRIS_O, PGC[13]);
|
||||
|
||||
|
||||
|
||||
// PGC[13].up = 195; PGC[13].down = 440;
|
||||
// PGC[13].left = 5; PGC[13].right = 549;
|
||||
|
||||
Fuente(SMALL_FONT, 4);
|
||||
|
||||
setcolor(BLANCO);
|
||||
outtextxy( 10, 350 + 15+ 5 - 150, "100 %");
|
||||
|
||||
outtextxy( 10, 350 + 15+ 5 - 75, " 50 %");
|
||||
|
||||
outtextxy( 10, 350 + 15+ 5, " 0 %");
|
||||
|
||||
setcolor(ROJO);
|
||||
outtextxy( 10, 350 + 15+ 5 - 75 - 37, " 75 %");
|
||||
|
||||
outtextxy( 10, 350 + 15+ 5 - 37, " 25 %");
|
||||
|
||||
for(i=0; i<12; i++){
|
||||
|
||||
//bar3d( (ADD + 45 + (i*35 + 2 + i*5) ), 215, (ADD + 45 + (i*35 + 2 + i*5) + 35 ), 350, 10, 1);
|
||||
if ( (Compras_mes[ i * 2 + 1] + Compras_mes[ i * 2 ]) != 0 ) {
|
||||
// Porcentaje de las compras 1 en un mes
|
||||
P1tmp = (Compras_mes[ i * 2 + 1 ] * 100)/(Compras_mes[ i * 2 + 1] + Compras_mes[ i * 2 ]);
|
||||
P0tmp = (Compras_mes[ i * 2 ] * 100)/(Compras_mes[ i * 2 + 1 ] + Compras_mes[ i * 2 ]);
|
||||
|
||||
Ltmp = ( ( 150 * ( ( (Compras_mes[ i * 2 + 1] + Compras_mes[ i * 2 ]) * 100 ) / TOTAL ) ) / 100 );
|
||||
|
||||
if( P1tmp != 0 && P0tmp == 0 ){
|
||||
setcolor(AZUL);
|
||||
setfillstyle( i, AZUL );
|
||||
bar3d( (ADD + 45 + (i*35 + 2 + i*5) ) - 15 - 5,
|
||||
350 + 15+ 5 - ( (Ltmp * P1tmp) / 100),
|
||||
(ADD + 45 + (i*35 + 2 + i*5) + 35 ) - 15 - 5, 350 + 15+5, 30, 1);
|
||||
}
|
||||
if( P1tmp != 0 && P0tmp != 0 ){
|
||||
setcolor(AZUL);
|
||||
setfillstyle( i, AZUL );
|
||||
bar3d( (ADD + 45 + (i*35 + 2 + i*5) ) - 15 - 5,
|
||||
350 + 15+ 5 - ( (Ltmp * P1tmp) / 100),
|
||||
(ADD + 45 + (i*35 + 2 + i*5) + 35 ) - 15 - 5, 350 + 15+5, 30, 0);
|
||||
}
|
||||
if( P0tmp != 0 ){
|
||||
setcolor(ROJO);
|
||||
setfillstyle( i, ROJO );
|
||||
bar3d( (ADD + 45 + (i*35 + 2 + i*5) ) - 15 - 5,
|
||||
(350 + 15+ 5 - ( (Ltmp * P1tmp) / 100) ) - ( (Ltmp * P0tmp) / 100),
|
||||
(ADD + 45 + (i*35 + 2 + i*5) + 35 ) - 15 - 5,
|
||||
(350 + 15+5 - ( (Ltmp * P1tmp) / 100) ), 30, 1);
|
||||
}
|
||||
setcolor(BLANCO);
|
||||
outtextxy( (ADD + 45 + (i*35 + 2 + i*5) ) - 15 - 5 - 5 - 1, 380 - 5, mes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Fuente(SMALL_FONT, 6);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Prepara_Pantalla_GC(void) {
|
||||
cleardevice();
|
||||
Pantalla_Graficas_Compras(PGC);
|
||||
Fuente(SMALL_FONT, 4);
|
||||
|
||||
// Coloca_Nombres_a_botones();
|
||||
|
||||
textxy(Comunes[0].left+2, Comunes[0].up, "C¢digos 1" );
|
||||
textxy(Comunes[0].left+2, Comunes[0].up+18, " F2" );
|
||||
|
||||
textxy(Comunes[1].left+2, Comunes[1].up, "C¢digos 0" );
|
||||
textxy(Comunes[1].left+2, Comunes[1].up+18, " F3" );
|
||||
|
||||
textxy(Comunes[2].left+2, Comunes[2].up, "Totales" );
|
||||
textxy(Comunes[2].left+2, Comunes[2].up+18, " F4" );
|
||||
|
||||
|
||||
textxy(Comunes[4].left+2, Comunes[4].up, " Imprimir" );
|
||||
textxy(Comunes[4].left+2, Comunes[4].up+18, " F5" );
|
||||
|
||||
textxy(Comunes[8].left+2, Comunes[8].up, " Salir" );
|
||||
textxy(Comunes[8].left+2, Comunes[8].up+18, " F1" );
|
||||
|
||||
|
||||
Fuente(SMALL_FONT, 6);
|
||||
|
||||
}
|
||||
|
||||
void Imprimir_Gra_Compras(unsigned long *Compras_mes){
|
||||
|
||||
|
||||
char mes[][12] = {"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio",
|
||||
"Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"};
|
||||
|
||||
if ( Comprueba_Impresora() == 0 ) {
|
||||
Confirma("Error Imprimiendo.", "Impresora Fuera de", "Servicio.");
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf( stdprn, "\n\r");
|
||||
|
||||
for(int i=0; i<12; i++)
|
||||
fprintf( stdprn, "%-10s ->> Cod.1: %10ld Cod.0: %10ld Total: %15ld\n\r", mes[i], Compras_mes[i*2 + 1], Compras_mes[i*2], Compras_mes[i*2 + 1]+Compras_mes[i*2]);
|
||||
|
||||
fprintf( stdprn, "\n\r");
|
||||
fprintf( stdprn, "\n\r");
|
||||
fprintf( stdprn, "\n\r");
|
||||
fprintf( stdprn, "ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù\n\r");
|
||||
fprintf( stdprn, "TOTAL 1: %20ld\n\r", TOTAL1);
|
||||
fprintf( stdprn, "TOTAL 0: %20ld\n\r", TOTAL0);
|
||||
fprintf( stdprn, "TOTAL : %20ld\n\r", (TOTAL1 + TOTAL0) );
|
||||
fprintf( stdprn, "ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù\n\r");
|
||||
|
||||
fputc(12, stdprn);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
1387
SV_GRAPH.CPP
Normal file
1387
SV_GRAPH.CPP
Normal file
File diff suppressed because it is too large
Load Diff
35
SV_GRAPH.H
Normal file
35
SV_GRAPH.H
Normal file
@ -0,0 +1,35 @@
|
||||
#define NEGRO 0
|
||||
#define AZUL 1
|
||||
#define ROJO 4
|
||||
#define VERDE 2
|
||||
#define BLANCO 63
|
||||
#define GRIS_O 56
|
||||
#define GRIS_C 7
|
||||
#define AMARILLO 62
|
||||
|
||||
void Imprime_Boton2(int D_Bord, char Cf, int Cb1, int Cb2, struct Make_Boton Bot_Imp);
|
||||
void Fuente(int Fuente, int Size );
|
||||
|
||||
|
||||
void Dibuja_Pantalla_Altas_Rapida(struct Make_Boton *PAR);
|
||||
void Dibuja_Pantalla_Pricipal(void);
|
||||
|
||||
void Dibuja_Pantalla_Altas_Todos_los_Datos(struct Make_Boton *PATLD, struct Make_Boton *PATLD_c);
|
||||
void Dibuja_Pantalla_Vendedores(struct Make_Boton *PV);
|
||||
void Dibuja_Pantalla_Referencia(struct Make_Boton *PR);
|
||||
void Dibuja_Pantalla_Compras(struct Make_Boton *PC);
|
||||
void Dibuja_Pantalla_Stock(struct Make_Boton *PS);
|
||||
void Pantalla_de_Facturas(void);
|
||||
|
||||
void Pantalla_Graficas_Compras(struct Make_Boton *PGC);
|
||||
void Pantalla_Graficas_Compras_C(struct Make_Boton *PGC);
|
||||
void Imprime_Boton2(int D_Bord, char Cf, int Cb1, int Cb2, struct Make_Boton Bot_Imp);
|
||||
void Dibuja_Pantalla_Ventas(struct Make_Boton *PVent);
|
||||
struct Make_Boton {
|
||||
/* unsigned */ int Up, Left, Down, Right;
|
||||
unsigned char Cdf, Cb1, Cb2;
|
||||
unsigned char Ab, Pb;
|
||||
unsigned char Isc, Sc;
|
||||
};
|
||||
|
||||
int CheckButon(int nb, struct boton menu[]);
|
723
SV_REF.CPP
Normal file
723
SV_REF.CPP
Normal file
@ -0,0 +1,723 @@
|
||||
#include<graphics.h>
|
||||
#include<conio.h>
|
||||
#include<stdio.h>
|
||||
#include<string.h>
|
||||
#include<ctype.h>
|
||||
#include<alloc.h>
|
||||
#include<stdlib.h>
|
||||
|
||||
|
||||
#include "..\libs\make_bot\make_bot.h"
|
||||
#include "sv_graph.h"
|
||||
#include "sv_util.h"
|
||||
|
||||
/*///////*/
|
||||
#include "sv_ref_x.h"
|
||||
|
||||
#define Letra_Boton setcolor(1);
|
||||
#define Azul 1
|
||||
#define Texto_Normal setcolor(63);
|
||||
#define Texto_Negrita setcolor(0);
|
||||
|
||||
extern int x_raton, y_raton, raton;
|
||||
extern int boton_izq, boton_der;
|
||||
|
||||
extern void desactiva_raton(void);
|
||||
extern void activa_raton(void);
|
||||
extern void Anclar_Raton(void);
|
||||
extern void inicializa_raton_grafico(int x1, int y1, int x2, int y2, int px, int py);
|
||||
extern int Espera_Tecla_o_Raton(void);
|
||||
extern void BEEP(void);
|
||||
|
||||
extern int InputCadenaG(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo);
|
||||
extern int InputCadenaG_l(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo, int Row);
|
||||
|
||||
void Menu_de_Referencias(void);
|
||||
void Mueve_Arriba_Ref(void);
|
||||
void Mueve_Abajo_Ref(void);
|
||||
void EditCursorRef(int ShowHide);
|
||||
void PrintLineRef(void);
|
||||
void PrintWholeScreenRef(void);
|
||||
void Edit_Item_Ref(void);
|
||||
void Abre_Ficha_Referencias(void);
|
||||
void DeleteRecordRef(void);
|
||||
void AddRecordRef(int Imprime);
|
||||
void PutLineRef(void);
|
||||
void GetLineRef(void);
|
||||
void Poner_a_cero_estructura_actual_Ref(void);
|
||||
extern void Coloca_Nombres_a_botones(void);
|
||||
void Imprimir_Referencias(void);
|
||||
void Llena_con_ref_basicas(void);
|
||||
void CompruebaLineasRef(void);
|
||||
|
||||
// extern int Confirma(char *f1, char *f2, char *f3);
|
||||
extern int Comprueba_Impresora(void);
|
||||
|
||||
struct Referencias Ref1;
|
||||
struct Ref_inx Ref1_inx;
|
||||
extern struct JD cabecera;
|
||||
|
||||
struct boton *PR;//[6]
|
||||
extern struct boton Comunes[9];
|
||||
|
||||
FILE *Ref; // Fichero Vendedores
|
||||
|
||||
int CurrRowRef1;
|
||||
int CurrColRef1;
|
||||
int CurrTopLineRef;
|
||||
|
||||
void Menu_de_Referencias(void) {
|
||||
|
||||
int finished = 0, key, bpush;
|
||||
CurrRowRef1 = 6; CurrColRef1 = 1;
|
||||
|
||||
CurrTopLineRef = 1;
|
||||
|
||||
inicializa_raton_grafico(0, 0, 624, 464, 320, 240);
|
||||
if(raton!=0) desactiva_raton();
|
||||
|
||||
if( ( PR = (struct boton *) malloc( sizeof(struct boton)*6 ) ) == NULL )
|
||||
{
|
||||
Confirma("Memoria insuficiente", "para crear tablas de", "posisi¢n PR.");
|
||||
return ;
|
||||
}
|
||||
|
||||
cleardevice();
|
||||
Dibuja_Pantalla_Referencia(PR);
|
||||
Fuente(SMALL_FONT, 5);
|
||||
Coloca_Nombres_a_botones();
|
||||
setcolor(GRIS_C);
|
||||
outtextxy(Comunes[3].left, Comunes[3].up, " SWAP" );
|
||||
outtextxy(Comunes[3].left, Comunes[3].up+18, " F6 " );
|
||||
|
||||
|
||||
Fuente(SMALL_FONT, 6);
|
||||
Abre_Ficha_Referencias();
|
||||
/*/////////*/ Carga_Referencias();
|
||||
PrintWholeScreenRef();
|
||||
GetLineRef();
|
||||
int oldCR1=0, oldCC1=0;
|
||||
|
||||
do{
|
||||
|
||||
if(oldCR1!=CurrRowRef1 || oldCC1!=CurrColRef1 )
|
||||
EditCursorRef(0);
|
||||
|
||||
oldCR1 = CurrRowRef1; oldCC1 = CurrColRef1;
|
||||
|
||||
if(raton!=0) activa_raton();
|
||||
Espera_Tecla_o_Raton();
|
||||
if(raton!=0) desactiva_raton();
|
||||
|
||||
if(kbhit()){
|
||||
EditCursorRef(1);
|
||||
key = getch();
|
||||
if( isprint(key) || isspace(key) ) {
|
||||
EditCursorRef(0);
|
||||
if(key!=13) ungetch(key);
|
||||
Edit_Item_Ref();
|
||||
EditCursorRef(0);
|
||||
} else if( key == 0 ) {
|
||||
switch( (key=getch()) ){
|
||||
// Flecha Arriba
|
||||
case 72:
|
||||
Mueve_Arriba_Ref();
|
||||
break;
|
||||
// Flecha Izquierda
|
||||
case 75:
|
||||
case 15:
|
||||
CurrColRef1--;
|
||||
if ( CurrColRef1<1 ) CurrColRef1=6;
|
||||
break;
|
||||
// Flecha Derecha
|
||||
case 77:
|
||||
case 9:
|
||||
CurrColRef1++;
|
||||
if ( CurrColRef1>6 ) CurrColRef1=1;
|
||||
break;
|
||||
// Flecha Abajo
|
||||
case 80:
|
||||
Mueve_Abajo_Ref();
|
||||
break;
|
||||
// Buscar F2
|
||||
case 60:
|
||||
// BuscarRef();
|
||||
break;
|
||||
// Imprimir Referencias F5
|
||||
case 63:
|
||||
Imprimir_Referencias();
|
||||
break;
|
||||
// F9 --> A¥ADIR
|
||||
case 67:
|
||||
AddRecordRef(1);
|
||||
break;
|
||||
// F10 -> BORRAR
|
||||
case 68:
|
||||
if( Confirma("Desea eliminar la", "Referencia Actual", "") ) DeleteRecordRef();
|
||||
break;
|
||||
// INICIO
|
||||
case 71:
|
||||
CurrColRef1 = 1;
|
||||
break;
|
||||
// FIN
|
||||
case 79:
|
||||
CurrColRef1 = 5;
|
||||
break;
|
||||
// ReP g
|
||||
case 73:
|
||||
// CurrRow = 1;
|
||||
if( CurrTopLineRef > /*28*/26 ) { CurrTopLineRef -= /*28*/26; } else { CurrTopLineRef = 1; }
|
||||
if( CurrTopLineRef < 1 ) { CurrTopLineRef = 1; }
|
||||
if( (CurrTopLineRef + CurrRowRef1 - 1) == 5 ) CurrRowRef1 = 2;
|
||||
PrintWholeScreenRef();
|
||||
GetLineRef();
|
||||
break;
|
||||
// AvP g
|
||||
case 81:
|
||||
// CurrRow = 1;
|
||||
CurrTopLineRef += /*28*/26;
|
||||
if ( (CurrTopLineRef+CurrRowRef1) > Ref1_inx.Fin) { CurrTopLineRef = Ref1_inx.Fin; CurrRowRef1 = 1; }
|
||||
if (CurrTopLineRef==0) CurrTopLineRef = 1;
|
||||
if( (CurrTopLineRef + CurrRowRef1 - 1) == 5 ) CurrRowRef1 = 2;
|
||||
PrintWholeScreenRef();
|
||||
GetLineRef();
|
||||
break;
|
||||
// Salir F1
|
||||
case 59:
|
||||
finished = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
EditCursorRef(0);
|
||||
}
|
||||
} else if(raton!=0 && ( boton_izq==1 || boton_der==1 ) )
|
||||
if( (bpush = CheckButon( 9, Comunes))>0 ) {
|
||||
EditCursorRef(1);
|
||||
switch(bpush){
|
||||
// Flecha Arriba
|
||||
case 1:
|
||||
Mueve_Arriba_Ref();
|
||||
break;
|
||||
// Buscar
|
||||
case 2:
|
||||
// BuscarVend();
|
||||
break;
|
||||
// Flecha Abajo
|
||||
case 3:
|
||||
Mueve_Abajo_Ref();
|
||||
break;
|
||||
case 4:
|
||||
break;
|
||||
// Imprimir
|
||||
case 5:
|
||||
Imprimir_Referencias();
|
||||
break;
|
||||
// A¤adir
|
||||
case 6:
|
||||
AddRecordRef(1);
|
||||
break;
|
||||
// Borrar
|
||||
case 7:
|
||||
if( Confirma("Desea eliminar la", "Referencia Actual", "") ) DeleteRecordRef();
|
||||
break;
|
||||
// Salir
|
||||
case 9:
|
||||
finished = 1;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
EditCursorRef(0);
|
||||
} else CompruebaLineasRef();
|
||||
|
||||
}while(!finished);
|
||||
|
||||
fclose(Ref); // Fichero Vendedores
|
||||
free(PR);
|
||||
|
||||
}
|
||||
|
||||
void Mueve_Abajo_Ref(void){
|
||||
|
||||
int CurrRecord = CurrTopLineRef + CurrRowRef1 - 1;
|
||||
|
||||
if (CurrRowRef1==/*28*/26) {
|
||||
if ( (CurrRecord - 1) >= Ref1_inx.Fin) BEEP();
|
||||
else { CurrTopLineRef++;
|
||||
PrintWholeScreenRef();
|
||||
//ÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜß
|
||||
//ÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜß
|
||||
//ÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜß
|
||||
GetLineRef();
|
||||
// PrintLineRef();
|
||||
}
|
||||
} else {
|
||||
if( (CurrRecord - 1) >= Ref1_inx.Fin) BEEP();
|
||||
else { CurrRowRef1++;
|
||||
if( (CurrTopLineRef + CurrRowRef1 - 1) == 5 ) CurrRowRef1++;
|
||||
GetLineRef();
|
||||
// PrintLineRef();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Mueve_Arriba_Ref(void){
|
||||
int CurrRecord = CurrTopLineRef + CurrRowRef1 - 1;
|
||||
|
||||
if (CurrRowRef1==1) {
|
||||
if ((CurrRecord - 1) <= 0) BEEP();
|
||||
else {
|
||||
CurrTopLineRef--;
|
||||
PrintWholeScreenRef();
|
||||
//ÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜß
|
||||
//ÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜß
|
||||
//ÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜß
|
||||
GetLineRef();
|
||||
// PrintLineRef();
|
||||
}
|
||||
|
||||
} else {
|
||||
if( (CurrRecord - 1) <= 0) BEEP();
|
||||
else { CurrRowRef1--;
|
||||
if( (CurrTopLineRef + CurrRowRef1 - 1) == 5 ){ CurrRowRef1--;
|
||||
if(CurrRowRef1 < 1) { CurrRowRef1=1;
|
||||
CurrTopLineRef --;
|
||||
PrintWholeScreenRef();
|
||||
}
|
||||
}
|
||||
GetLineRef();
|
||||
// PrintLineRef();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void EditCursorRef(int ShowHide) {
|
||||
|
||||
if( (CurrTopLineRef + CurrRowRef1 - 1) != 5 ) {
|
||||
|
||||
char Buffer[80];
|
||||
|
||||
setcolor(GRIS_C);
|
||||
setfillstyle(SOLID_FILL, GRIS_C);
|
||||
bar(10, 455, 545, 473);
|
||||
|
||||
if (!ShowHide) {
|
||||
setcolor(63);
|
||||
setfillstyle(SOLID_FILL, 63); //Û// //Û// //Û// //Û//
|
||||
bar((PR[(CurrColRef1)-1].left+2), PR[(CurrColRef1)-1].up+4+(CurrRowRef1-1)*/*9*//*14*/15+2, PR[(CurrColRef1)-1].right-2, PR[(CurrColRef1)-1].up+/*3*/4+((CurrRowRef1)-1)*/*9*//*14*/15+/*9*/16);
|
||||
setcolor(0);
|
||||
} else {
|
||||
setcolor(0);
|
||||
setfillstyle(SOLID_FILL, 0); //Û// //Û// //Û// //Û//
|
||||
bar((PR[(CurrColRef1)-1].left+2), PR[(CurrColRef1)-1].up+4+(CurrRowRef1-1)*/*9*//*14*/15+2, PR[(CurrColRef1)-1].right-2, PR[(CurrColRef1)-1].up+/*3*/4+((CurrRowRef1)-1)*/*9*//*14*/15+/*9*/16);
|
||||
Texto_Normal
|
||||
}
|
||||
switch(CurrColRef1){
|
||||
case 1:
|
||||
sprintf(Buffer, " %04d", Ref1.Ref);
|
||||
outtextxy( PR[0].left+2, (PR[0].up+2)+(CurrRowRef1-1)*/*9*//*14*/15, Buffer );
|
||||
outtextxy( 15, 455, "N£mero de Referencia. 4 digitos m ximo.");
|
||||
break;
|
||||
case 2:
|
||||
outtextxy( PR[1].left+2, (PR[1].up+2)+(CurrRowRef1-1)*/*9*//*14*/15,Ref1.Concepto );
|
||||
outtextxy( 15, 455, "Concepto para Ref. 20 digitos m ximo.");
|
||||
|
||||
break;
|
||||
case 3:
|
||||
sprintf(Buffer, " % 6ld", Ref1.P_und );
|
||||
outtextxy( PR[2].left+2, (PR[2].up+2)+(CurrRowRef1-1)*/*9*//*14*/15, Buffer );
|
||||
outtextxy( 15, 455, "Precio Costo Unidad. 5 digitos m ximo.");
|
||||
break;
|
||||
case 4:
|
||||
sprintf(Buffer, "%03d", Ref1.P1 );
|
||||
outtextxy( PR[3].left+2, (PR[3].up+2)+(CurrRowRef1-1)*/*9*//*14*/15,Buffer );
|
||||
outtextxy( 15, 455, "I.V.A. original. 2 digitos m ximo.");
|
||||
break;
|
||||
case 5:
|
||||
sprintf(Buffer, " % 6ld", Ref1.PVP );
|
||||
outtextxy( PR[4].left+2, (PR[4].up+2)+(CurrRowRef1-1)*/*9*//*14*/15,Buffer );
|
||||
outtextxy( 15, 455, "Precio Venta Publico. 5 digitos m ximo.");
|
||||
break;
|
||||
case 6:
|
||||
sprintf(Buffer, "%03d", Ref1.P2 );
|
||||
outtextxy( PR[5].left+2, (PR[5].up+2)+(CurrRowRef1-1)*/*9*//*14*/15,Buffer );
|
||||
outtextxy( 15, 455, "I.V.A. original. 2 digitos m ximo.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PrintLineRef(void){
|
||||
|
||||
if( (CurrTopLineRef + CurrRowRef1 - 1) != 5 ) {
|
||||
char Buffer[80];
|
||||
|
||||
Texto_Normal
|
||||
|
||||
sprintf(Buffer, " %04d", Ref1.Ref);
|
||||
outtextxy( PR[0].left+2, (PR[0].up+2)+(CurrRowRef1-1)*/*9*//*14*/15, Buffer );
|
||||
outtextxy( PR[1].left+2, (PR[1].up+2)+(CurrRowRef1-1)*/*9*//*14*/15,Ref1.Concepto );
|
||||
sprintf(Buffer, " % 6ld", Ref1.P_und );
|
||||
outtextxy( PR[2].left+2, (PR[2].up+2)+(CurrRowRef1-1)*/*9*//*14*/15, Buffer );
|
||||
sprintf(Buffer, "%03d", Ref1.P1 );
|
||||
outtextxy( PR[3].left+2, (PR[3].up+2)+(CurrRowRef1-1)*/*9*//*14*/15,Buffer );
|
||||
sprintf(Buffer, " % 6ld", Ref1.PVP );
|
||||
outtextxy( PR[4].left+2, (PR[4].up+2)+(CurrRowRef1-1)*/*9*//*14*/15,Buffer );
|
||||
sprintf(Buffer, "%03d", Ref1.P2 );
|
||||
outtextxy( PR[5].left+2, (PR[5].up+2)+(CurrRowRef1-1)*/*9*//*14*/15,Buffer );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PrintWholeScreenRef(void){
|
||||
|
||||
int tmp = CurrRowRef1;
|
||||
|
||||
for(int i=0; i<6; i++)
|
||||
ImprimeBoton (1, NEGRO, GRIS_O, BLANCO, PR[i]);
|
||||
|
||||
|
||||
for(CurrRowRef1 = 1; CurrRowRef1 < (/*28*/26+1); CurrRowRef1++)
|
||||
|
||||
if ( (CurrTopLineRef + CurrRowRef1 - 1) <= (Ref1_inx.Fin + 1) ) {
|
||||
GetLineRef();
|
||||
PrintLineRef();
|
||||
}
|
||||
|
||||
|
||||
|
||||
CurrRowRef1 = tmp;
|
||||
|
||||
}
|
||||
|
||||
void Edit_Item_Ref(void){
|
||||
char buffer[80]; int oldRef;
|
||||
long CurrRecord = CurrTopLineRef + CurrRowRef1 - 1;
|
||||
switch (CurrColRef1) {
|
||||
case 1:
|
||||
if ( (CurrRecord>5) ) {
|
||||
oldRef = Ref1.Ref;
|
||||
sprintf( buffer, "%d", Ref1.Ref);
|
||||
do{
|
||||
InputCadenaG_l( buffer, 1, 4, 63, 57, PR[0], CurrRowRef1-1);
|
||||
Ref1.Ref = atoi(buffer);
|
||||
}while( ( (Existe_Referencia(Ref1.Ref)) || Ref1.Ref==0 ) && Ref1.Ref != oldRef );
|
||||
} else {
|
||||
while( kbhit() ) getch();
|
||||
}
|
||||
break;
|
||||
case 2: if ( (CurrRecord>5) )
|
||||
InputCadenaG_l( Ref1.Concepto, 0, 20, 63, 57, PR[1], CurrRowRef1-1);
|
||||
else {
|
||||
while( kbhit() ) getch();
|
||||
}
|
||||
break;
|
||||
case 3: sprintf( buffer, "%ld", Ref1.P_und);
|
||||
InputCadenaG_l( buffer, 1, 5, 63, 57, PR[2], CurrRowRef1-1);
|
||||
Ref1.P_und = atol(buffer);
|
||||
break;
|
||||
case 4: sprintf( buffer, "%d", Ref1.P1 );
|
||||
InputCadenaG_l( buffer, 1, 2, 63, 57, PR[3], CurrRowRef1-1);
|
||||
Ref1.P1= atoi( buffer );
|
||||
break;
|
||||
case 5: sprintf( buffer, "%ld", Ref1.PVP );
|
||||
InputCadenaG_l( buffer, 1, 5, 63, 57, PR[4], CurrRowRef1-1);
|
||||
Ref1.PVP = atol( buffer );
|
||||
break;
|
||||
case 6: sprintf( buffer, "%d", Ref1.P2 );
|
||||
InputCadenaG_l( buffer, 1, 2, 63, 57, PR[5], CurrRowRef1-1);
|
||||
Ref1.P2 = atoi( buffer );
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
PutLineRef();
|
||||
/*ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ*/
|
||||
/*Û*/ GetLineRef(); /*Û*/
|
||||
/*ßßßßßßßßßßßßßßßßßßßßßß*/
|
||||
PrintLineRef();
|
||||
|
||||
}
|
||||
|
||||
void Abre_Ficha_Referencias(void){
|
||||
|
||||
char ArchivoDatos[]="SV__REF.DAT";
|
||||
int ok = 0;
|
||||
|
||||
//ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ//
|
||||
//Û Comprueba apertura correcta de Indice, y Datos y creaci¢n... Û//
|
||||
//ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß//
|
||||
|
||||
int LSJ = sizeof(struct JD);
|
||||
int LSI = sizeof(struct Ref_inx);
|
||||
int LSC = sizeof(struct Referencias);
|
||||
|
||||
if ( (Ref = fopen( ArchivoDatos, "r+b"))==NULL) {
|
||||
|
||||
FILE *fa;
|
||||
|
||||
if ( (fa = fopen( ArchivoDatos, "wb" ) )!=NULL ) {
|
||||
|
||||
Poner_a_cero_estructura_actual_Ref();
|
||||
Ref1_inx.Fin = 0;
|
||||
ok = 1;
|
||||
rewind(fa);
|
||||
|
||||
fwrite(&cabecera, LSJ, 1, fa); fseek(fa, (long)LSJ, SEEK_SET);
|
||||
fwrite(&Ref1_inx, LSI, 1, fa); fseek(fa, (long)LSJ+LSI, SEEK_SET);
|
||||
fwrite(&Ref1, LSC, 1, fa);
|
||||
|
||||
if (fclose(fa) == EOF ) exit(1);
|
||||
}
|
||||
|
||||
if ( (Ref = fopen( ArchivoDatos, "r+b"))==NULL) {
|
||||
restorecrtmode();
|
||||
printf("NO SE PUDO ABRIR EL FICHERO INDICE EN LA 2§ PASADA");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
fseek(Ref, (long)LSJ, SEEK_SET);
|
||||
if ( fread(&Ref1_inx, LSI, 1, Ref) != 1 ) {
|
||||
restorecrtmode();
|
||||
printf("NO SE PUDO LEER EN EL FICHERO: INDICE");
|
||||
exit(1);
|
||||
}
|
||||
fseek(Ref, (long)LSJ+LSI, SEEK_SET);
|
||||
if ( fread(&Ref1, LSC, 1, Ref) != 1 ) {
|
||||
restorecrtmode();
|
||||
printf("NO SE PUDO LEER EN EL FICHERO: DATOS");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if(ok) Llena_con_ref_basicas();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void DeleteRecordRef(void) {
|
||||
|
||||
unsigned int CurrRecord;
|
||||
int LSJ = sizeof(struct JD);
|
||||
int LSI = sizeof(struct Ref_inx);
|
||||
int LSC = sizeof(struct Referencias);
|
||||
|
||||
CurrRecord = CurrTopLineRef + CurrRowRef1 - 1;
|
||||
|
||||
if ( (Ref1_inx.Fin == 4) || (CurrRecord<=5) ) BEEP(); else {
|
||||
|
||||
Ref1_inx.Fin -= 1;
|
||||
|
||||
unsigned int p = CurrRecord - 1;
|
||||
|
||||
while( p <= Ref1_inx.Fin ) {
|
||||
|
||||
fseek(Ref, (long)LSJ + LSI + ( LSC * ( p + 1 ) ), SEEK_SET); // Se coloca
|
||||
fread(&Ref1, LSC, 1, Ref); // Y lee
|
||||
|
||||
fseek(Ref, (long)LSJ + LSI + ( LSC * p ), SEEK_SET); // Se coloca
|
||||
fwrite(&Ref1, LSC, 1, Ref); // Y escribe
|
||||
|
||||
p++;
|
||||
};
|
||||
|
||||
fseek(Ref, (long)LSJ, SEEK_SET);
|
||||
fwrite(&Ref1_inx, LSI, 1, Ref); // Acualiza n§ de registros
|
||||
|
||||
/* Û */ if ((CurrRecord - 1) == Ref1_inx.Fin + 1) CurrRowRef1--;
|
||||
/* Û */ if( Ref1_inx.Fin == 4 ) AddRecordRef(1);
|
||||
/* Û */
|
||||
/* ßßßÛ */ PrintWholeScreenRef();
|
||||
/* ß */ GetLineRef();
|
||||
|
||||
// PrintLineRef();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AddRecordRef(int Imprime){
|
||||
|
||||
unsigned int CurrRecord= CurrTopLineRef + CurrRowRef1 - 1;
|
||||
|
||||
int LSJ = sizeof(struct JD);
|
||||
int LSI = sizeof(struct Ref_inx);
|
||||
int LSC = sizeof(struct Referencias);
|
||||
|
||||
if(CurrRecord < 10000 ) {
|
||||
|
||||
long avance = Ref1_inx.Fin /*+ 1*/;
|
||||
|
||||
while( avance >= (CurrRecord-1) ) {
|
||||
|
||||
fseek(Ref, (long)LSJ + LSI + ( LSC * avance ), SEEK_SET); // Se coloca
|
||||
fread(&Ref1, LSC, 1, Ref); // Y lee
|
||||
|
||||
fseek(Ref, (long)LSJ + LSI + ( LSC * (avance + 1) ), SEEK_SET); // Se coloca
|
||||
fwrite(&Ref1, LSC, 1, Ref); // Y escribe
|
||||
|
||||
avance--;
|
||||
};
|
||||
|
||||
// Ref1_inx.Fin = Ref1_inx.Fin + 1;
|
||||
Ref1_inx.Fin++;
|
||||
|
||||
fseek(Ref, (long)LSJ, SEEK_SET);
|
||||
fwrite(&Ref1_inx, LSI, 1, Ref); // Acualiza n§ de registros
|
||||
|
||||
Poner_a_cero_estructura_actual_Ref();
|
||||
|
||||
fseek(Ref, (long)LSJ + LSI + ( LSC * ( CurrTopLineRef + CurrRowRef1 - 1) ), SEEK_SET); // Se coloca
|
||||
fwrite(&Ref1, LSC, 1, Ref); // Y escribe
|
||||
|
||||
CurrRowRef1++;
|
||||
if (CurrRowRef1>/*28*/26) { CurrTopLineRef++; CurrRowRef1--; }
|
||||
if(Imprime) PrintWholeScreenRef();
|
||||
GetLineRef();
|
||||
// PrintLineRef();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void PutLineRef(void){
|
||||
|
||||
int LSJ = sizeof(struct JD);
|
||||
int LSI = sizeof(struct Ref_inx);
|
||||
int LSC = sizeof(struct Referencias);
|
||||
|
||||
int CurrRecord = CurrTopLineRef + CurrRowRef1 - 1;
|
||||
|
||||
fseek(Ref, (long)LSJ + LSI + ( LSC * CurrRecord ) - LSC, SEEK_SET); // Se coloca
|
||||
fwrite(&Ref1, LSC, 1, Ref); // Y escribe
|
||||
|
||||
}
|
||||
|
||||
void GetLineRef(void){
|
||||
|
||||
int LSJ = sizeof(struct JD);
|
||||
int LSI = sizeof(struct Ref_inx);
|
||||
int LSC = sizeof(struct Referencias);
|
||||
|
||||
int CurrRecord = CurrTopLineRef + CurrRowRef1 - 1;
|
||||
|
||||
fseek(Ref, (long)LSJ + LSI + ( LSC * CurrRecord ) - LSC, SEEK_SET); // Se coloca
|
||||
fread(&Ref1, LSC, 1, Ref); // Y lee
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Poner_a_cero_estructura_actual_Ref(void){
|
||||
|
||||
cabecera.esc = 27; strcpy(cabecera.color, "[31;40m");
|
||||
strcpy(cabecera.prog, "Jos‚ David Guill‚n Dominguez");
|
||||
cabecera.nl = 13; cabecera.rt = 10;
|
||||
strcpy(cabecera.autor, " 6 / Mayo / 1995 ");
|
||||
cabecera.pt = 7; cabecera.ef = 26;
|
||||
|
||||
Ref1.Ref = 0; strcpy(Ref1.Concepto, "\0"); Ref1.P_und = 0;
|
||||
Ref1.P1 = 0; Ref1.PVP = 0; Ref1.P2 = 0;
|
||||
}
|
||||
|
||||
void Llena_con_ref_basicas(void){
|
||||
CurrRowRef1=1;
|
||||
Ref1.Ref = 9996; strcpy(Ref1.Concepto, "Grifo-Columna/s.");
|
||||
PutLineRef();
|
||||
AddRecordRef(0);
|
||||
Ref1.Ref = 9997; strcpy(Ref1.Concepto, "Manoreductor/es.");
|
||||
PutLineRef();
|
||||
AddRecordRef(0);
|
||||
Ref1.Ref = 9998; strcpy(Ref1.Concepto, "Serpent¡n/es.");
|
||||
PutLineRef();
|
||||
AddRecordRef(0);
|
||||
Ref1.Ref = 9999; strcpy(Ref1.Concepto, "Dispensador/es.");
|
||||
PutLineRef();
|
||||
AddRecordRef(0);
|
||||
Poner_a_cero_estructura_actual_Ref();
|
||||
AddRecordRef(0);
|
||||
}
|
||||
|
||||
void Imprimir_Referencias(void){
|
||||
|
||||
int LSJ = sizeof(struct JD);
|
||||
int LSI = sizeof(struct Ref_inx);
|
||||
int LSC = sizeof(struct Referencias);
|
||||
int lprint = 3;
|
||||
|
||||
if ( Comprueba_Impresora() == 0 ) {
|
||||
Confirma("Error Imprimiendo.", "Impresora Fuera de", "Servicio.");
|
||||
return;
|
||||
}
|
||||
|
||||
int Curr_Ref = 0;
|
||||
fprintf( stdprn, "\n\r");
|
||||
// 1 2 3 4 5 6 7 8
|
||||
// 123456789þ123456789þ123456789þ123456789þ123456789þ123456789þ123456789þ123456789þ
|
||||
fprintf( stdprn, " Refer. Concepto P.C. I.V.A P.V.P. I.V.A \n\r");
|
||||
fprintf( stdprn, "ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù\n\r");
|
||||
while(Curr_Ref <= Ref1_inx.Fin ){
|
||||
|
||||
fseek(Ref, (long)LSJ + LSI + ( LSC * Curr_Ref ), SEEK_SET); // Se coloca
|
||||
fread(&Ref1, LSC, 1, Ref); // Y lee
|
||||
fprintf( stdprn, " %04d %-20s % 6ld %03d % 6ld %03d \n\r", Ref1.Ref, Ref1.Concepto, Ref1.P_und, Ref1.P1, Ref1.PVP, Ref1.P2);
|
||||
lprint++;
|
||||
if (lprint==55) { lprint = 3;
|
||||
fputc(12, stdprn);
|
||||
fprintf( stdprn, " Refer. Concepto P.C. I.V.A P.V.P. I.V.A \n\r");
|
||||
fprintf( stdprn, "ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù\n\r");
|
||||
}
|
||||
Curr_Ref++;
|
||||
}
|
||||
|
||||
|
||||
fputc(12, stdprn);
|
||||
}
|
||||
|
||||
|
||||
void CompruebaLineasRef(void){
|
||||
// Check una pulsacion sobre un campo, y se situa, si es posible
|
||||
int ok_p=0, inc=0, md=0;
|
||||
int oldr, oldc;
|
||||
// Anclar_Raton();
|
||||
|
||||
do{
|
||||
inc++;
|
||||
if(x_raton >= (PR[(inc)-1].left+2) && x_raton <= (PR[inc-1].right-2) ) { ok_p=1; md = 1;
|
||||
oldc=inc; }
|
||||
if(inc==6) ok_p=1;
|
||||
}while(!ok_p);
|
||||
if(md==1){
|
||||
inc=0; ok_p=0; md = 0;
|
||||
do{
|
||||
inc++;
|
||||
if( (y_raton >= (PR[(oldc)-1].up+4+(inc-1)*15+2)) && (y_raton <= (PR[oldc-1].up+4+(inc-1)*15+16)) ) { ok_p=1; oldr=inc; md = 1;}
|
||||
if(inc==26) ok_p=1;
|
||||
}while(!ok_p);
|
||||
}
|
||||
if( (md==1) && ((CurrTopLineRef + oldr - 1) != 5) && ((CurrColRef1!=oldc) || (CurrRowRef1!=oldr)) )
|
||||
{
|
||||
if( (CurrTopLineRef + oldr - 2 )<= Ref1_inx.Fin ){
|
||||
EditCursorRef(1);
|
||||
CurrColRef1 = oldc;
|
||||
CurrRowRef1 = oldr;
|
||||
GetLineRef();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
134
SV_REF_X.CPP
Normal file
134
SV_REF_X.CPP
Normal file
@ -0,0 +1,134 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <graphics.h>
|
||||
#include <string.h>
|
||||
#include <alloc.h>
|
||||
#include "sv_ref_x.h"
|
||||
|
||||
|
||||
struct direccion far *Addr;
|
||||
|
||||
int *Ref_inx_addr;
|
||||
int Ref_no_valid;
|
||||
char Memory_ok;
|
||||
char Uso_de_la_Memoria;
|
||||
|
||||
|
||||
void BuscaReferencia(int Referencia){
|
||||
|
||||
int LSJ = sizeof(struct JD);
|
||||
int LSI = sizeof(struct Ref_inx);
|
||||
int LSC = sizeof(struct Referencias);
|
||||
|
||||
|
||||
if( Uso_de_la_Memoria == 1 ) {
|
||||
|
||||
Ref_no_valid = 0;
|
||||
int ok=0;
|
||||
int i, Direccion;
|
||||
|
||||
for(i=0; i<(Ref1_inx.Fin+1) && ok==0; i++)
|
||||
|
||||
if ( Addr[i].Ref_inx_Ref == Referencia ) { ok=1; Direccion = i; }
|
||||
|
||||
if ( ok == 0 ) {
|
||||
strcpy(Ref1.Concepto, "REFERENCIA NO VALIDA");
|
||||
Ref1.P_und = 0;
|
||||
Ref_no_valid = 1;
|
||||
} else {
|
||||
fseek(Ref, (long)LSJ + LSI + ( LSC * ( Addr[Direccion].Ref_inx_Addr - 1) ), SEEK_SET); // Se coloca
|
||||
fread(&Ref1, LSC, 1, Ref); // Y lee
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if(Ref_inx_addr[Referencia] == 0){
|
||||
strcpy(Ref1.Concepto, "REFERENCIA NO VALIDA");
|
||||
Ref1.P_und = 0;
|
||||
Ref_no_valid = 1;
|
||||
} else {
|
||||
|
||||
fseek(Ref, (long)LSJ + LSI + ( LSC * (Ref_inx_addr[Referencia]-1) ), SEEK_SET); // Se coloca
|
||||
fread(&Ref1, LSC, 1, Ref); // Y lee
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Carga_Referencias(void){
|
||||
|
||||
int i;
|
||||
int LSJ = sizeof(struct JD);
|
||||
int LSI = sizeof(struct Ref_inx);
|
||||
int LSC = sizeof(struct Referencias);
|
||||
|
||||
|
||||
if( Ref1_inx.Fin >= 5000 ) Uso_de_la_Memoria = 0; else Uso_de_la_Memoria = 1;
|
||||
|
||||
|
||||
if( Uso_de_la_Memoria == 1 ) {
|
||||
// Comienza proceso de carga de las Referencias.
|
||||
// 1§ Comprobamos la memoria disponible, y si hay, asignamos suficiente.
|
||||
if( (Addr = (struct direccion far *)farmalloc( (sizeof(struct direccion) * (Ref1_inx.Fin+1) ) ) ) == NULL ) {
|
||||
Memory_ok = 0;
|
||||
restorecrtmode();
|
||||
exit(1);
|
||||
} else {
|
||||
|
||||
i = 0;
|
||||
// Cargamos las posiciones de las referencias en el archivo.
|
||||
|
||||
while(i <= Ref1_inx.Fin ){
|
||||
|
||||
fseek(Ref, (long)LSJ + LSI + ( LSC * i ), SEEK_SET); // Se coloca
|
||||
fread(&Ref1, LSC, 1, Ref); // Y lee
|
||||
Addr[i].Ref_inx_Ref = Ref1.Ref;
|
||||
Addr[i].Ref_inx_Addr = (i+1);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if( (Ref_inx_addr = (int *)malloc( (sizeof(int) * (10001) ) ) ) == NULL ) {
|
||||
Memory_ok = 0;
|
||||
restorecrtmode();
|
||||
exit(1);
|
||||
} else {
|
||||
|
||||
for(i=0; i<10000; i++) Ref_inx_addr[i] = 0;
|
||||
|
||||
i = 0;
|
||||
// Cargamos las posiciones de las referencias en el archivo.
|
||||
|
||||
while(i <= Ref1_inx.Fin ){
|
||||
fseek(Ref, (long)LSJ + LSI + ( LSC * i ), SEEK_SET); // Se coloca
|
||||
fread(&Ref1, LSC, 1, Ref); // Y lee
|
||||
Ref_inx_addr[Ref1.Ref]=(i+1);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int Existe_Referencia(int Referencia){
|
||||
|
||||
if( Uso_de_la_Memoria == 1 ) {
|
||||
|
||||
Ref_no_valid = 0;
|
||||
int ok=0;
|
||||
int i;
|
||||
|
||||
for(i=0; i<(Ref1_inx.Fin+1) && ok==0; i++)
|
||||
if ( Addr[i].Ref_inx_Ref == Referencia ) ok=1;
|
||||
|
||||
if ( ok == 0 ) return 0; else return 1;
|
||||
|
||||
} else {
|
||||
|
||||
if(Ref_inx_addr[Referencia] == 0) return 0; else return 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
82
SV_REF_X.H
Normal file
82
SV_REF_X.H
Normal file
@ -0,0 +1,82 @@
|
||||
///////////////////////////////////////////
|
||||
/**/ /**///
|
||||
/**/// Referencias [enlace global] /**///
|
||||
/**/ /**///
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/**/ /**/// //
|
||||
/**/ extern void Abre_Ficha_Referencias(void);
|
||||
/**/
|
||||
/**/ int Existe_Referencia(int Referencia);
|
||||
/**/ void BuscaReferencia(int Referencia);
|
||||
/**/ void Carga_Referencias(void); /**/// //
|
||||
/**/ /**/// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/**/ /**/// //
|
||||
/**/ /*extern*/ struct Ref_inx { /**/// //
|
||||
/**/ unsigned int Fin; /**/// //
|
||||
/**/ }; /**/// //
|
||||
/**/ /**/// //
|
||||
/**/ /*extern*/ struct Referencias { /**/// //
|
||||
/**/ int Ref; char Concepto[20+1]; /**/// //
|
||||
/**/ long P_und; int P1; long PVP; /**/// Estructuras de Datos. //
|
||||
/**/ int P2; /**/// //
|
||||
/**/ }; /**/// //
|
||||
/**/ /**/// //
|
||||
/**/ extern struct Ref_inx Ref1_inx; /**/// //
|
||||
/**/ extern struct Referencias Ref1; /**/// //
|
||||
/**/ /**/// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/**/ /**/// //
|
||||
/**/ /*extern*/ struct direccion { /**/// <- Para Memoria = 1 //
|
||||
/**/ int Ref_inx_Ref; /**/// //
|
||||
/**/ int Ref_inx_Addr; /**/// //
|
||||
/**/ }; /**/// //
|
||||
/**/ extern /**///
|
||||
/**/ struct direccion far *Addr; /**///
|
||||
/**/ /**/// //
|
||||
/**/ extern int *Ref_inx_addr; /**/// <- Para Memoria = 0 //
|
||||
/**/ /**/// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/**/ /**/// //
|
||||
/**/ extern int Ref_no_valid; /**/// Si nos quedamos sin memoria, //
|
||||
/**/ extern char Memory_ok; /**/// usaremos un segundo enlaze que //
|
||||
/**/ extern char Uso_de_la_Memoria; /**/// consume menos memoria a grandes //
|
||||
/**/ /**/// cantidades de registros, que no //
|
||||
/**/ /**/// es recomendable usar por debajo //
|
||||
/**/ /**/// de los 5000 registros de 4 bytes//
|
||||
/**/ /**/// //
|
||||
/**/ extern FILE *Ref; /**/// Fichero Referencias //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////
|
||||
/**/ /**///
|
||||
/**/// Cabecera /**///
|
||||
/**/ /**///
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/**/ /**/// //
|
||||
/**/ /*extern*/ struct JD { /**/// Estructura para la cabecera //
|
||||
/**/ char esc; char color[8]; /**/// de todos los ficheros definida //
|
||||
/**/ char prog[40]; char nl; /**/// en alguna parte. //
|
||||
/**/ char rt; char autor[36]; /**/// //
|
||||
/**/ char pt; char ef; /**/// //
|
||||
/**/ }; /**/// //
|
||||
/**/ /**/// //
|
||||
/**/ extern struct JD cabecera; /**/// //
|
||||
/**/ /**/// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef SV_REF_X
|
||||
|
||||
|
||||
/*extern*/ struct Stock_inx { unsigned int Fin; };
|
||||
|
||||
/*extern*/ struct Stock_actual { int Ref; long Und_0; long Und_1; };
|
||||
|
||||
extern struct Stock_actual Stock1;
|
||||
extern struct Stock_inx Stock1_inx;
|
||||
|
||||
extern void Actualizar_Stock(int Referencia, int Unidades, int Codigo);
|
||||
|
||||
#endif
|
883
SV_STOCK.CPP
Normal file
883
SV_STOCK.CPP
Normal file
@ -0,0 +1,883 @@
|
||||
#define SV_REF_X
|
||||
|
||||
#include<graphics.h>
|
||||
#include<dos.h>
|
||||
#include<conio.h>
|
||||
#include<math.h>
|
||||
#include<stdio.h>
|
||||
#include<string.h>
|
||||
#include<ctype.h>
|
||||
#include<alloc.h>
|
||||
#include<stdlib.h>
|
||||
|
||||
|
||||
#include "..\libs\make_bot\make_bot.h"
|
||||
#include "sv_util.h"
|
||||
#include "sv_graph.h"
|
||||
#include "sv_ref_x.h"
|
||||
|
||||
|
||||
#define Letra_Boton setcolor(1);
|
||||
#define Azul 1
|
||||
#define Texto_Normal setcolor(63);
|
||||
#define Texto_Negrita setcolor(0);
|
||||
|
||||
extern int x_raton, y_raton, raton;
|
||||
extern int boton_izq, boton_der;
|
||||
|
||||
extern void desactiva_raton(void);
|
||||
extern void activa_raton(void);
|
||||
extern void Anclar_Raton(void);
|
||||
extern void inicializa_raton_grafico(int x1, int y1, int x2, int y2, int px, int py);
|
||||
extern int Espera_Tecla_o_Raton(void);
|
||||
extern void BEEP(void);
|
||||
|
||||
extern int InputCadenaG(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo);
|
||||
extern int InputCadenaG_l(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo, int Row);
|
||||
extern int InputCadenaG_T4(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo, int RoW);
|
||||
|
||||
void PutLineStock(void);
|
||||
void GetLineStock(void);
|
||||
void Menu_de_Stock(void);
|
||||
void AddRecordStock(void);
|
||||
void PrintLineStock(void);
|
||||
void Edit_Item_Stock(void);
|
||||
void Abre_Ficha_Stock(void);
|
||||
void DeleteRecordStock(void);
|
||||
void Mueve_Abajo_Stock(void);
|
||||
void Mueve_Arriba_Stock(void);
|
||||
void CompruebaLineasStock(void);
|
||||
void PrintWholeScreenStock(void);
|
||||
void EditCursorStock(int ShowHide);
|
||||
void Imprimir_Stock();
|
||||
void Poner_a_cero_estructura_actual_Stock(void);
|
||||
void Recalcula_Porcentaje(int Individual_Seleccionado);
|
||||
|
||||
// void Llena_con_Stock_basicas(void);
|
||||
extern void Coloca_Nombres_a_botones(void);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// extern int Confirma(char *f1, char *f2, char *f3);
|
||||
extern int Comprueba_Impresora(void);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct Stock_inx { unsigned int Fin; };
|
||||
|
||||
|
||||
struct Stock_actual { int Ref; long Und_0; long Und_1; };
|
||||
|
||||
struct Stock_actual Stock1;
|
||||
struct Stock_actual Stock1_Graficas[10];
|
||||
struct Stock_inx Stock1_inx;
|
||||
|
||||
struct boton *PS;//[5]
|
||||
extern struct boton Comunes[9];
|
||||
|
||||
FILE *Stock; // Fichero de Stock
|
||||
|
||||
|
||||
int CurrRowStock1;
|
||||
int CurrColStock1;
|
||||
int CurrTopLineStock;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Menu_de_Stock(void) {
|
||||
|
||||
int finished = 0, key, bpush;
|
||||
CurrRowStock1 = 1; CurrColStock1 = 1;
|
||||
|
||||
CurrTopLineStock = 1;
|
||||
|
||||
inicializa_raton_grafico(0, 0, 624, 464, 320, 240);
|
||||
if(raton!=0) desactiva_raton();
|
||||
|
||||
if( ( PS = (struct boton *) malloc( sizeof(struct boton)*5 ) ) == NULL )
|
||||
{
|
||||
Confirma("Memoria insuficiente", "para crear tablas de", "posisi¢n PS.");
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
cleardevice();
|
||||
Dibuja_Pantalla_Stock(PS);
|
||||
Fuente(SMALL_FONT, 5);
|
||||
setcolor(NEGRO);
|
||||
Coloca_Nombres_a_botones();
|
||||
setcolor(GRIS_C);
|
||||
outtextxy(Comunes[3].left, Comunes[3].up, " SWAP" );
|
||||
outtextxy(Comunes[3].left, Comunes[3].up+18, " F6 " );
|
||||
|
||||
|
||||
Fuente(SMALL_FONT, 4);
|
||||
Abre_Ficha_Stock();
|
||||
Abre_Ficha_Referencias();
|
||||
Carga_Referencias();
|
||||
|
||||
PrintWholeScreenStock();
|
||||
GetLineStock();
|
||||
int oldCR1=0, oldCC1=0;
|
||||
|
||||
do{
|
||||
|
||||
if(oldCR1!=CurrRowStock1 || oldCC1!=CurrColStock1 )
|
||||
EditCursorStock(0);
|
||||
|
||||
oldCR1 = CurrRowStock1; oldCC1 = CurrColStock1;
|
||||
|
||||
if(raton!=0) activa_raton();
|
||||
Espera_Tecla_o_Raton();
|
||||
if(raton!=0) desactiva_raton();
|
||||
|
||||
if(kbhit()){
|
||||
EditCursorStock(1);
|
||||
key = getch();
|
||||
if( isprint(key) || isspace(key) ) {
|
||||
EditCursorStock(0);
|
||||
if(key!=13) ungetch(key);
|
||||
Edit_Item_Stock();
|
||||
Recalcula_Porcentaje(1);
|
||||
EditCursorStock(0);
|
||||
} else if( key == 0 ) {
|
||||
switch( (key=getch()) ){
|
||||
// Flecha Arriba
|
||||
case 72:
|
||||
Mueve_Arriba_Stock();
|
||||
Recalcula_Porcentaje(1);
|
||||
break;
|
||||
// Flecha Izquierda
|
||||
case 75:
|
||||
case 15:
|
||||
CurrColStock1--;
|
||||
if ( CurrColStock1<1 ) CurrColStock1=5;
|
||||
break;
|
||||
// Flecha Derecha
|
||||
case 77:
|
||||
case 9:
|
||||
CurrColStock1++;
|
||||
if ( CurrColStock1>5 ) CurrColStock1=1;
|
||||
break;
|
||||
// Flecha Abajo
|
||||
case 80:
|
||||
Mueve_Abajo_Stock();
|
||||
Recalcula_Porcentaje(1);
|
||||
break;
|
||||
// Buscar F2
|
||||
case 60:
|
||||
// BuscarStock();
|
||||
break;
|
||||
// Imprimir Stock F5
|
||||
case 63:
|
||||
Imprimir_Stock();
|
||||
break;
|
||||
|
||||
// F9 --> A¥ADIR
|
||||
case 67:
|
||||
// if( Confirma("A¥ADIR NUEVO STOCK", "INICIAL", "") )
|
||||
// if ( Pide_Codigo(SV_CFG.COD_Stock) )
|
||||
// AddRecordStock();
|
||||
break;
|
||||
// F10 -> BORRAR
|
||||
case 68:
|
||||
if( Confirma("ELIMINAR TOTALMENTE", "STOCK ACTUAL", "") )
|
||||
// if ( Pide_Codigo(SV_CFG.COD_Stock) )
|
||||
DeleteRecordStock();
|
||||
Recalcula_Porcentaje(1);
|
||||
break;
|
||||
|
||||
// INICIO
|
||||
case 71:
|
||||
CurrColStock1 = 1;
|
||||
break;
|
||||
// FIN
|
||||
case 79:
|
||||
CurrColStock1 = 5;
|
||||
break;
|
||||
// ReP g
|
||||
case 73:
|
||||
// CurrRow = 1;
|
||||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
if( CurrTopLineStock > /*28*/26 ) { CurrTopLineStock -= /*28*/26; } else { CurrTopLineStock = 1; }
|
||||
if( CurrTopLineStock < 1 ) { CurrTopLineStock = 1; }
|
||||
PrintWholeScreenStock();
|
||||
GetLineStock();
|
||||
EditCursorStock(0);
|
||||
Recalcula_Porcentaje(1);
|
||||
break;
|
||||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
// AvP g
|
||||
case 81:
|
||||
// CurrRow = 1;
|
||||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
CurrTopLineStock += /*28*/26;
|
||||
if ( (CurrTopLineStock+CurrRowStock1) > Stock1_inx.Fin) { CurrTopLineStock = Stock1_inx.Fin; CurrRowStock1 = 1; }
|
||||
if (CurrTopLineStock==0) CurrTopLineStock = 1;
|
||||
PrintWholeScreenStock();
|
||||
GetLineStock();
|
||||
EditCursorStock(0);
|
||||
Recalcula_Porcentaje(1);
|
||||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
break;
|
||||
// Salir F1
|
||||
case 59:
|
||||
finished = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
EditCursorStock(0);
|
||||
}
|
||||
} else if(raton!=0 && ( boton_izq==1 || boton_der==1 ) )
|
||||
if( (bpush = CheckButon( 9, Comunes))>0 ) {
|
||||
EditCursorStock(1);
|
||||
switch(bpush){
|
||||
// Flecha Arriba
|
||||
case 1:
|
||||
Mueve_Arriba_Stock();
|
||||
Recalcula_Porcentaje(1);
|
||||
break;
|
||||
// Buscar
|
||||
case 2:
|
||||
// BuscarVend();
|
||||
break;
|
||||
// Flecha Abajo
|
||||
case 3:
|
||||
Mueve_Abajo_Stock();
|
||||
Recalcula_Porcentaje(1);
|
||||
break;
|
||||
case 4:
|
||||
break;
|
||||
// Imprimir
|
||||
case 5:
|
||||
Imprimir_Stock();
|
||||
break;
|
||||
// A¤adir
|
||||
case 6:
|
||||
// if( Confirma("A¥ADIR NUEVO STOCK", "INICIAL", "") )
|
||||
// if ( Pide_Codigo(SV_CFG.COD_Stock) )
|
||||
// AddRecordStock();
|
||||
break;
|
||||
// Borrar
|
||||
case 7:
|
||||
if( Confirma("ELIMINAR TOTALMENTE", "STOCK ACTUAL", "") )
|
||||
// if ( Pide_Codigo(SV_CFG.COD_Stock) )
|
||||
DeleteRecordStock();
|
||||
Recalcula_Porcentaje(1);
|
||||
break;
|
||||
// Salir
|
||||
case 9:
|
||||
finished = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
EditCursorStock(0);
|
||||
} else CompruebaLineasStock();
|
||||
|
||||
}while(!finished);
|
||||
|
||||
fclose(Stock); // Fichero Vendedores
|
||||
fclose(Ref); // Fichero Vendedores
|
||||
free(PS); // Libera la memoria
|
||||
|
||||
if(Memory_ok==1) farfree(Addr); else free(Ref_inx_addr);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Mueve_Abajo_Stock(void){
|
||||
|
||||
int CurrRecord = CurrTopLineStock + CurrRowStock1 - 1;
|
||||
|
||||
if (CurrRowStock1==/*28*/40) {
|
||||
if ( (CurrRecord - 1) >= Stock1_inx.Fin) { BEEP(); EditCursorStock(0); }
|
||||
else { CurrTopLineStock++;
|
||||
PrintWholeScreenStock();
|
||||
//ÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜß
|
||||
//ÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜß
|
||||
//ÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜß
|
||||
GetLineStock();
|
||||
// PrintLineStock();
|
||||
}
|
||||
} else {
|
||||
if( (CurrRecord - 1) >= Stock1_inx.Fin) { BEEP(); EditCursorStock(0); }
|
||||
else { CurrRowStock1++;
|
||||
GetLineStock();
|
||||
// PrintLineStock();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Mueve_Arriba_Stock(void){
|
||||
int CurrRecord = CurrTopLineStock + CurrRowStock1 - 1;
|
||||
|
||||
if (CurrRowStock1==1) {
|
||||
if ((CurrRecord - 1) <= 0) { BEEP(); EditCursorStock(0); }
|
||||
else {
|
||||
CurrTopLineStock--;
|
||||
PrintWholeScreenStock();
|
||||
//ÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜß
|
||||
//ÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜß
|
||||
//ÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜß
|
||||
GetLineStock();
|
||||
// PrintLineStock();
|
||||
}
|
||||
|
||||
} else {
|
||||
if( (CurrRecord - 1) <= 0) BEEP();
|
||||
else { CurrRowStock1--;
|
||||
|
||||
GetLineStock();
|
||||
// PrintLineStock();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void EditCursorStock(int ShowHide) {
|
||||
|
||||
char Buffer[80];
|
||||
|
||||
setcolor(GRIS_C);
|
||||
setfillstyle(SOLID_FILL, GRIS_C);
|
||||
bar(10, 455, 545, 473);
|
||||
|
||||
|
||||
if (!ShowHide) {
|
||||
setcolor(63);
|
||||
setfillstyle(SOLID_FILL, 63);
|
||||
bar((PS[CurrColStock1-1].left+2), PS[CurrColStock1-1].up+(CurrRowStock1-1)*/*15*/12+/*2*/4, PS[CurrColStock1-1].right-2, PS[CurrColStock1-1].up+/*3*/4+((CurrRowStock1)-1)*12+10);
|
||||
setcolor(0);
|
||||
} else {
|
||||
setcolor(0);
|
||||
setfillstyle(SOLID_FILL, 0);
|
||||
bar((PS[CurrColStock1-1].left+2), PS[CurrColStock1-1].up+(CurrRowStock1-1)*/*15*/12+/*2*/4, PS[CurrColStock1-1].right-2, PS[CurrColStock1-1].up+/*3*/4+((CurrRowStock1)-1)*12+10);
|
||||
Texto_Normal
|
||||
}
|
||||
|
||||
if(Ref_no_valid) setcolor(ROJO);
|
||||
|
||||
// struct Stock_actual { int Ref; long Und_0; long Und_1; };
|
||||
|
||||
|
||||
switch(CurrColStock1){
|
||||
// LA REFERENCIA DEBE SER INDEDITABLE...
|
||||
|
||||
case 1: //4
|
||||
sprintf(Buffer, "% 5d", Stock1.Ref );
|
||||
outtextxy( PS[0].left+2, (PS[0].up+3)+(CurrRowStock1-1)*12, Buffer );
|
||||
outtextxy( 15, 455, "Referencia de Producto. 4 digitos m ximo.");
|
||||
break;
|
||||
case 2:
|
||||
outtextxy( PS[1].left+2, (PS[1].up+3)+(CurrRowStock1-1)*12, Ref1.Concepto );
|
||||
outtextxy( 15, 455, "Concepto.");
|
||||
break;
|
||||
case 3:
|
||||
sprintf(Buffer, " % 5d", Stock1.Und_1); // 4
|
||||
outtextxy( PS[2].left+2, (PS[2].up+3)+(CurrRowStock1-1)*12, Buffer);
|
||||
outtextxy( 15, 455, "Unidades con Cod. 1");
|
||||
break;
|
||||
case 4:
|
||||
sprintf(Buffer, " % 5d", Stock1.Und_0); // 4
|
||||
outtextxy( PS[3].left+2, (PS[3].up+3)+(CurrRowStock1-1)*12, Buffer );
|
||||
outtextxy( 15, 455, "Unidades con Cod. 0");
|
||||
break;
|
||||
case 5:
|
||||
sprintf(Buffer, "% 10d", ( Stock1.Und_0 + Stock1.Und_1 ) ); // 4
|
||||
outtextxy( PS[4].left+2, (PS[4].up+3)+(CurrRowStock1-1)*12, Buffer );
|
||||
outtextxy( 15, 455, "Unidades TOTALES.");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PrintLineStock(void){
|
||||
|
||||
char Buffer[80];
|
||||
|
||||
setcolor(0);
|
||||
setfillstyle(SOLID_FILL, 0);
|
||||
bar((PS[0].left+2), PS[0].up+(CurrRowStock1-1)*12+/*2*/4, PS[0].right-2, PS[0].up+(CurrRowStock1-1)*12+10);
|
||||
bar((PS[1].left+2), PS[1].up+(CurrRowStock1-1)*12+/*2*/4, PS[1].right-2, PS[1].up+(CurrRowStock1-1)*12+10);
|
||||
bar((PS[2].left+2), PS[2].up+(CurrRowStock1-1)*12+/*2*/4, PS[2].right-2, PS[2].up+(CurrRowStock1-1)*12+10);
|
||||
bar((PS[3].left+2), PS[3].up+(CurrRowStock1-1)*12+/*2*/4, PS[3].right-2, PS[3].up+(CurrRowStock1-1)*12+10);
|
||||
bar((PS[4].left+2), PS[4].up+(CurrRowStock1-1)*12+/*2*/4, PS[4].right-2, PS[4].up+(CurrRowStock1-1)*12+10);
|
||||
|
||||
Texto_Normal
|
||||
|
||||
if(Ref_no_valid) setcolor(ROJO);
|
||||
//
|
||||
sprintf(Buffer, "% 5d", Stock1.Ref );
|
||||
outtextxy( PS[0].left+2, (PS[0].up+3)+(CurrRowStock1-1)*12, Buffer );
|
||||
outtextxy( PS[1].left+2, (PS[1].up+3)+(CurrRowStock1-1)*12, Ref1.Concepto );
|
||||
sprintf(Buffer, " % 5d", Stock1.Und_1); // 4
|
||||
outtextxy( PS[2].left+2, (PS[2].up+3)+(CurrRowStock1-1)*12, Buffer);
|
||||
sprintf(Buffer, " % 5d", Stock1.Und_0); // 4
|
||||
outtextxy( PS[3].left+2, (PS[3].up+3)+(CurrRowStock1-1)*12, Buffer );
|
||||
sprintf(Buffer, "% 10d", ( Stock1.Und_0 + Stock1.Und_1 ) ); // 4
|
||||
outtextxy( PS[4].left+2, (PS[4].up+3)+(CurrRowStock1-1)*12, Buffer );
|
||||
|
||||
}
|
||||
|
||||
|
||||
void PrintWholeScreenStock(void){
|
||||
|
||||
int tmp = CurrRowStock1;
|
||||
|
||||
for(int i=0; i<5; i++)
|
||||
ImprimeBoton (1, NEGRO, GRIS_O, BLANCO, PS[i]);
|
||||
|
||||
|
||||
for(CurrRowStock1 = 1; CurrRowStock1 < (/*28*/40+1); CurrRowStock1++)
|
||||
|
||||
if ( (CurrTopLineStock + CurrRowStock1 - 1) <= (Stock1_inx.Fin + 1) ) {
|
||||
GetLineStock();
|
||||
PrintLineStock();
|
||||
}
|
||||
|
||||
|
||||
|
||||
CurrRowStock1 = tmp;
|
||||
|
||||
}
|
||||
|
||||
void Edit_Item_Stock(void){
|
||||
|
||||
char buffer[80];
|
||||
|
||||
switch (CurrColStock1) {
|
||||
|
||||
case 1:/*
|
||||
if( Stock1.Ref == -1 ) {
|
||||
sprintf( buffer, "%d", Stock1.Ref);
|
||||
InputCadenaG_T4( buffer, 1, 4, 63, 57, PS[0], CurrRowStock1-1);
|
||||
Stock1.Ref = atoi(buffer);
|
||||
PutLineStock();
|
||||
}
|
||||
*/
|
||||
while( kbhit() ) getch();
|
||||
break;
|
||||
case 2:
|
||||
while( kbhit() ) getch();
|
||||
break;
|
||||
case 3: // int Old_Und_0 = Stock1.Und_0;
|
||||
sprintf( buffer, "%d", Stock1.Und_1);
|
||||
InputCadenaG_T4( buffer, 1, 4, 63, 57, PS[2], CurrRowStock1-1);
|
||||
Stock1.Und_1 = atol(buffer);
|
||||
PutLineStock();
|
||||
break;
|
||||
case 4: // int Old_Und_1 = Stock1.Und_1;
|
||||
sprintf( buffer, "%d", Stock1.Und_0);
|
||||
InputCadenaG_T4( buffer, 1, 4, 63, 57, PS[3], CurrRowStock1-1);
|
||||
Stock1.Und_0 = atol(buffer);
|
||||
PutLineStock();
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
PrintLineStock();
|
||||
|
||||
}
|
||||
|
||||
void Abre_Ficha_Stock(void){
|
||||
|
||||
char ArchivoDatos[]="SV_Stock.DAT";
|
||||
|
||||
//ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ//
|
||||
//Û Stockrueba apertura correcta de Indice, y Datos y creaci¢n... Û//
|
||||
//ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß//
|
||||
|
||||
int LSJ = sizeof(struct JD);
|
||||
int LSI = sizeof(struct Stock_inx);
|
||||
int LSC = sizeof(struct Stock_actual);
|
||||
|
||||
if ( (Stock = fopen( ArchivoDatos, "r+b"))==NULL) {
|
||||
|
||||
FILE *fa;
|
||||
|
||||
if ( (fa = fopen( ArchivoDatos, "wb" ) )!=NULL ) {
|
||||
|
||||
Poner_a_cero_estructura_actual_Stock();
|
||||
Stock1_inx.Fin = 0;
|
||||
rewind(fa);
|
||||
|
||||
fwrite(&cabecera, LSJ, 1, fa); fseek(fa, (long)LSJ, SEEK_SET);
|
||||
fwrite(&Stock1_inx, LSI, 1, fa); fseek(fa, (long)LSJ+LSI, SEEK_SET);
|
||||
fwrite(&Stock1, LSC, 1, fa);
|
||||
|
||||
if (fclose(fa) == EOF ) exit(1);
|
||||
}
|
||||
|
||||
if ( (Stock = fopen( ArchivoDatos, "r+b"))==NULL) {
|
||||
restorecrtmode();
|
||||
printf("NO SE PUDO ABRIR EL FICHERO INDICE EN LA 2§ PASADA");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
fseek(Stock, (long)LSJ, SEEK_SET);
|
||||
if ( fread(&Stock1_inx, LSI, 1, Stock) != 1 ) {
|
||||
restorecrtmode();
|
||||
printf("NO SE PUDO LEER EN EL FICHERO: INDICE");
|
||||
exit(1);
|
||||
}
|
||||
fseek(Stock, (long)LSJ+LSI, SEEK_SET);
|
||||
if ( fread(&Stock1, LSC, 1, Stock) != 1 ) {
|
||||
restorecrtmode();
|
||||
printf("NO SE PUDO LEER EN EL FICHERO: DATOS");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void DeleteRecordStock(void) {
|
||||
|
||||
unsigned int CurrRecord;
|
||||
int LSJ = sizeof(struct JD);
|
||||
int LSI = sizeof(struct Stock_inx);
|
||||
int LSC = sizeof(struct Stock_actual);
|
||||
|
||||
CurrRecord = CurrTopLineStock + CurrRowStock1 - 1;
|
||||
|
||||
if ( (Stock1_inx.Fin == 0) ) { BEEP();
|
||||
|
||||
Poner_a_cero_estructura_actual_Stock();
|
||||
Stock1.Ref=-1;
|
||||
fseek(Stock, (long)LSJ + LSI + ( LSC * ( 0 ) ), SEEK_SET); // Se coloca
|
||||
fwrite(&Stock1, LSC, 1, Stock); // Y escribe
|
||||
/* ßßßÛ */ PrintWholeScreenStock();
|
||||
/* ß */ GetLineStock();
|
||||
EditCursorStock(0);
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
Stock1_inx.Fin -= 1;
|
||||
|
||||
unsigned int p = CurrRecord - 1;
|
||||
|
||||
while( p <= Stock1_inx.Fin ) {
|
||||
|
||||
fseek(Stock, (long)LSJ + LSI + ( LSC * ( p + 1 ) ), SEEK_SET); // Se coloca
|
||||
fread(&Stock1, LSC, 1, Stock); // Y lee
|
||||
|
||||
fseek(Stock, (long)LSJ + LSI + ( LSC * p ), SEEK_SET); // Se coloca
|
||||
fwrite(&Stock1, LSC, 1, Stock); // Y escribe
|
||||
|
||||
p++;
|
||||
};
|
||||
|
||||
fseek(Stock, (long)LSJ, SEEK_SET);
|
||||
fwrite(&Stock1_inx, LSI, 1, Stock); // Acualiza n§ de registros
|
||||
|
||||
/* Û */ if ((CurrRecord - 1) == Stock1_inx.Fin + 1) CurrRowStock1--;
|
||||
/* Û */
|
||||
/* ßßßÛ */ PrintWholeScreenStock();
|
||||
/* ß */ GetLineStock();
|
||||
EditCursorStock(0);
|
||||
|
||||
// PrintLineStock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AddRecordStock(void){
|
||||
|
||||
unsigned int CurrRecord= CurrTopLineStock + CurrRowStock1 - 1;
|
||||
|
||||
int LSJ = sizeof(struct JD);
|
||||
int LSI = sizeof(struct Stock_inx);
|
||||
int LSC = sizeof(struct Stock_actual);
|
||||
|
||||
if(CurrRecord < 10000 ) {
|
||||
|
||||
long avance = Stock1_inx.Fin /*+ 1*/;
|
||||
|
||||
while( avance >= (CurrRecord-1) ) {
|
||||
|
||||
fseek(Stock, (long)LSJ + LSI + ( LSC * avance ), SEEK_SET); // Se coloca
|
||||
fread(&Stock1, LSC, 1, Stock); // Y lee
|
||||
|
||||
fseek(Stock, (long)LSJ + LSI + ( LSC * (avance + 1) ), SEEK_SET); // Se coloca
|
||||
fwrite(&Stock1, LSC, 1, Stock); // Y escribe
|
||||
|
||||
avance--;
|
||||
};
|
||||
|
||||
// Stock1_inx.Fin = Stock1_inx.Fin + 1;
|
||||
Stock1_inx.Fin++;
|
||||
|
||||
fseek(Stock, (long)LSJ, SEEK_SET);
|
||||
fwrite(&Stock1_inx, LSI, 1, Stock); // Acualiza n§ de registros
|
||||
|
||||
Poner_a_cero_estructura_actual_Stock();
|
||||
Stock1.Ref=-1;
|
||||
|
||||
fseek(Stock, (long)LSJ + LSI + ( LSC * ( CurrTopLineStock + CurrRowStock1 - 1) ), SEEK_SET); // Se coloca
|
||||
fwrite(&Stock1, LSC, 1, Stock); // Y escribe
|
||||
|
||||
CurrRowStock1++;
|
||||
if (CurrRowStock1>/*28*/40) { CurrTopLineStock++; CurrRowStock1--; }
|
||||
PrintWholeScreenStock();
|
||||
GetLineStock();
|
||||
EditCursorStock(0);
|
||||
// PrintLineStock();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void PutLineStock(void){
|
||||
|
||||
int LSJ = sizeof(struct JD);
|
||||
int LSI = sizeof(struct Stock_inx);
|
||||
int LSC = sizeof(struct Stock_actual);
|
||||
|
||||
int CurrRecord = CurrTopLineStock + CurrRowStock1 - 1;
|
||||
|
||||
fseek(Stock, (long)LSJ + LSI + ( LSC * CurrRecord ) - LSC, SEEK_SET); // Se coloca
|
||||
fwrite(&Stock1, LSC, 1, Stock); // Y escribe
|
||||
|
||||
}
|
||||
|
||||
void GetLineStock(void){
|
||||
|
||||
int LSJ = sizeof(struct JD);
|
||||
int LSI = sizeof(struct Stock_inx);
|
||||
int LSC = sizeof(struct Stock_actual);
|
||||
|
||||
int CurrRecord = CurrTopLineStock + CurrRowStock1 - 1;
|
||||
|
||||
fseek(Stock, (long)LSJ + LSI + ( LSC * CurrRecord ) - LSC, SEEK_SET); // Se coloca
|
||||
fread(&Stock1, LSC, 1, Stock); // Y lee
|
||||
|
||||
BuscaReferencia(Stock1.Ref);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Poner_a_cero_estructura_actual_Stock(void){
|
||||
|
||||
cabecera.esc = 27; strcpy(cabecera.color, "[31;40m");
|
||||
strcpy(cabecera.prog, "Jos‚ David Guill‚n Dominguez");
|
||||
cabecera.nl = 13; cabecera.rt = 10;
|
||||
strcpy(cabecera.autor, " 6 / Mayo / 1995 ");
|
||||
cabecera.pt = 7; cabecera.ef = 26;
|
||||
|
||||
Stock1.Ref=0; Stock1.Und_1=0; Stock1.Und_0=0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Imprimir_Stock(void){
|
||||
|
||||
int LSJ = sizeof(struct JD);
|
||||
int LSI = sizeof(struct Stock_inx);
|
||||
int LSC = sizeof(struct Stock_actual);
|
||||
int lprint = 3, Curr_Stock = 0;
|
||||
|
||||
if ( Comprueba_Impresora() == 0 ) {
|
||||
Confirma("Error Imprimiendo.", "Impresora Fuera de", "Servicio.");
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf( stdprn, "\n\r");
|
||||
|
||||
|
||||
fprintf( stdprn, " Ref Concepto Und.C.0 Und.C.1 TOTAL\n\r");
|
||||
fprintf( stdprn, "ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù\n\r");
|
||||
|
||||
while( (Curr_Stock <= Stock1_inx.Fin) ){
|
||||
|
||||
fseek(Stock, (long)LSJ + LSI + ( LSC * Curr_Stock ), SEEK_SET); // Se coloca
|
||||
fread(&Stock1, LSC, 1, Stock); // Y lee
|
||||
BuscaReferencia(Stock1.Ref);
|
||||
|
||||
fprintf( stdprn, "% 5d %-20s % 4ld % 4ld % 8ld \n\r", Stock1.Ref, Ref1.Concepto, Stock1.Und_0, Stock1.Und_1, ( Stock1.Und_0 + Stock1.Und_1 ) );
|
||||
|
||||
lprint++;
|
||||
if (lprint==55) { lprint = 3;
|
||||
fputc(12, stdprn);
|
||||
fprintf( stdprn, " Ref Concepto Und.C.0 Und.C.1 TOTAL\n\r");
|
||||
fprintf( stdprn, "ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù\n\r");
|
||||
}
|
||||
Curr_Stock++;
|
||||
}
|
||||
fputc(12, stdprn);
|
||||
GetLineStock();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CompruebaLineasStock(void){
|
||||
// Check una pulsacion sobre un campo, y se situa, si es posible
|
||||
int ok_p=0, inc=0, md=0;
|
||||
int oldr, oldc;
|
||||
// Anclar_Raton();
|
||||
|
||||
do{
|
||||
inc++;
|
||||
if(x_raton >= (PS[(inc)-1].left+2) && x_raton <= (PS[inc-1].right-2) ) { ok_p=1; md = 1;
|
||||
oldc=inc; }
|
||||
if(inc==5) ok_p=1;
|
||||
}while(!ok_p);
|
||||
if(md==1){
|
||||
inc=0; ok_p=0; md = 0;
|
||||
do{
|
||||
inc++;
|
||||
if( (y_raton >= (PS[(oldc)-1].up+4+(inc-1)*15+2)) && (y_raton <= (PS[oldc-1].up+4+(inc-1)*15+16)) ) { ok_p=1; oldr=inc; md = 1;}
|
||||
if(inc==26) ok_p=1;
|
||||
}while(!ok_p);
|
||||
}
|
||||
int newc;
|
||||
|
||||
switch(oldc){
|
||||
case 1:
|
||||
case 2: newc = oldc; break;
|
||||
case 4:
|
||||
case 5: newc = (oldc - 1); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if( (md==1) && ((CurrColStock1!=newc) || (CurrRowStock1!=oldr)) )
|
||||
{
|
||||
|
||||
if( (CurrTopLineStock + oldr - 2 )<= Stock1_inx.Fin ){
|
||||
EditCursorStock(1);
|
||||
switch(oldc){
|
||||
case 1:
|
||||
case 2:
|
||||
CurrColStock1 = oldc;
|
||||
CurrRowStock1 = oldr;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
CurrColStock1 = (oldc-1);
|
||||
CurrRowStock1 = oldr;
|
||||
break;
|
||||
default:
|
||||
EditCursorStock(0);
|
||||
break;
|
||||
}
|
||||
GetLineStock();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Actualizar_Stock(int Referencia, int Unidades, int Codigo){
|
||||
|
||||
int LSJ = sizeof(struct JD);
|
||||
int LSI = sizeof(struct Stock_inx);
|
||||
int LSC = sizeof(struct Stock_actual);
|
||||
|
||||
int ok = 0;
|
||||
int Curr_Stock = 0, Encuentro = 0;
|
||||
|
||||
|
||||
while( (Curr_Stock <= Stock1_inx.Fin) && (ok == 0) ){
|
||||
|
||||
fseek(Stock, (long)LSJ + LSI + ( LSC * Curr_Stock ), SEEK_SET); // Se coloca
|
||||
fread(&Stock1, LSC, 1, Stock); // Y lee
|
||||
|
||||
if( Stock1.Ref == Referencia ) {
|
||||
if(Codigo==1) Stock1.Und_1 += Unidades;
|
||||
else Stock1.Und_0 += Unidades;
|
||||
fseek(Stock, (long)LSJ + LSI + ( LSC * Curr_Stock ), SEEK_SET); // Se coloca
|
||||
fwrite(&Stock1, LSC, 1, Stock); // Y escribe
|
||||
ok = 1;
|
||||
Encuentro = 1;
|
||||
}
|
||||
|
||||
Curr_Stock++;
|
||||
}
|
||||
|
||||
if (Encuentro==0) {
|
||||
Stock1.Ref = Referencia;
|
||||
if(Codigo==1) { Stock1.Und_1 = Unidades; Stock1.Und_0 = 0; }
|
||||
else { Stock1.Und_0 = Unidades; Stock1.Und_1 = 0; }
|
||||
|
||||
fseek(Stock, (long)LSJ + LSI + ( LSC * (Stock1_inx.Fin + 1) ), SEEK_SET); // Se coloca
|
||||
fwrite(&Stock1, LSC, 1, Stock); // Y escribe
|
||||
|
||||
Stock1_inx.Fin ++;
|
||||
|
||||
fseek(Stock, (long)LSJ, SEEK_SET);
|
||||
fwrite(&Stock1_inx, LSI, 1, Stock); // Acualiza n§ de registros
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Recalcula_Porcentaje(int Individual_Seleccionado){
|
||||
|
||||
if( Individual_Seleccionado == 1 ) {
|
||||
|
||||
long P_0, P_1;
|
||||
struct boton Ptmp;
|
||||
|
||||
Ptmp.up = 15; Ptmp.down = 213;
|
||||
Ptmp.left = 349; Ptmp.right = 549;
|
||||
ImprimeBoton (1, NEGRO, GRIS_O, BLANCO, Ptmp);
|
||||
|
||||
// Centro = (449, 114) radio = 80
|
||||
// si (Stock1.Und_0 + Stock1.Und_1) es 100
|
||||
// Stock1.Und_0 es PS
|
||||
|
||||
// si 360 es 100
|
||||
// x es PS
|
||||
if ( (abs(Stock1.Und_0)+abs(Stock1.Und_1) )!= 0 ) {
|
||||
|
||||
P_0 = labs( ( 360 * ( (labs(Stock1.Und_0) * 100) / (labs(Stock1.Und_0)+labs(Stock1.Und_1)) ) ) / 100);
|
||||
P_1 = labs( ( 360 * ( (labs(Stock1.Und_1) * 100) / (labs(Stock1.Und_0)+labs(Stock1.Und_1)) ) ) / 100);
|
||||
// struct Stock_actual { int Ref; long Und_0; long Und_1; };
|
||||
if( Stock1.Und_1 < 0 )
|
||||
{ P_0 += P_1; P_1 = 0; }
|
||||
if( Stock1.Und_0 < 0 )
|
||||
{ P_1 += P_0; P_0 = 0; }
|
||||
if( P_1 != 0 ) {
|
||||
setcolor(ROJO);
|
||||
setfillstyle(9, ROJO);
|
||||
pieslice(449, 114, 0, P_1, 80);
|
||||
}
|
||||
if( P_0 != 0 ) {
|
||||
setcolor(AZUL);
|
||||
setfillstyle(9, AZUL);
|
||||
pieslice(449, 114, ( 360 - P_0 ), 360, 80);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
// struct Stock_actual Stock1_Graficas[10];
|
||||
// bar3d
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
359
SV_TEXT.CPP
Normal file
359
SV_TEXT.CPP
Normal file
@ -0,0 +1,359 @@
|
||||
#include <graphics.h>
|
||||
#include <conio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "..\libs\make_bot\make_bot.h"
|
||||
|
||||
|
||||
extern void BEEP(void);
|
||||
int InputCadenaG(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo);
|
||||
int InputCadenaG_l(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo, int Row);
|
||||
int InputCadenaG_T4(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo, int RoW);
|
||||
|
||||
int InputCadenaG(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo)
|
||||
{
|
||||
|
||||
int ls; // longitud cadena
|
||||
char *s1; // puntero a cadena inicial
|
||||
int c, ok;
|
||||
|
||||
s1 = s; // inicio cadena
|
||||
|
||||
setcolor(cf); // pone color a 0 para borrar
|
||||
setfillstyle(SOLID_FILL, cf);
|
||||
bar(Campo.left+2, Campo.up+2, Campo.right-2, Campo.down-2);
|
||||
|
||||
setcolor(cc); // devuelve el color a su estado
|
||||
|
||||
outtextxy( Campo.left+2, Campo.up+2, s );
|
||||
|
||||
ls = strlen ( s ); // Longitud de actual
|
||||
|
||||
if ( ls < lmax ) {
|
||||
setcolor(4);
|
||||
outtextxy( Campo.left+2+textwidth( s1 ), Campo.up+2, "þ");
|
||||
}
|
||||
|
||||
s += ls; // se coloca en el final
|
||||
|
||||
do{
|
||||
c = getch(); // obtiene tecla
|
||||
|
||||
ok = ( c == 13 || c == 0); // 13 = INTRO || Especiales
|
||||
|
||||
if ( c == 8 && ls > 0 && !ok ) { // 8 = Back Space
|
||||
ls--;
|
||||
s--;
|
||||
|
||||
*s = '\0';
|
||||
|
||||
setcolor(cf);
|
||||
setfillstyle(SOLID_FILL, cf);
|
||||
bar(Campo.left+2, Campo.up+2, Campo.right-2, Campo.down-2);
|
||||
setcolor(cc);
|
||||
outtextxy( Campo.left+2, Campo.up+2, s1 );
|
||||
setcolor(4);
|
||||
outtextxy( Campo.left+2+textwidth( s1 ), Campo.up+2, "þ");
|
||||
setcolor(cc);
|
||||
|
||||
} else {
|
||||
|
||||
if ( !numalp && c >= 32 && c <= 254 /* isprint(c) */ && ls < lmax) {
|
||||
|
||||
*s++ = c;
|
||||
ls++;
|
||||
|
||||
*s = '\0';
|
||||
setcolor(cf);
|
||||
setfillstyle(SOLID_FILL, cf);
|
||||
bar(Campo.left+2, Campo.up+2, Campo.right-2, Campo.down-2);
|
||||
setcolor(cc);
|
||||
|
||||
outtextxy( Campo.left+2, Campo.up+2, s1 );
|
||||
|
||||
if ( ls < lmax ) {
|
||||
setcolor(4);
|
||||
outtextxy( Campo.left+2+textwidth( s1 ), Campo.up+2, "þ");
|
||||
setcolor(cc);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
if ( numalp && isdigit(c) && ls < lmax) {
|
||||
*s++ = c;
|
||||
ls++;
|
||||
|
||||
*s = '\0'; // Cero final
|
||||
setcolor(cf);
|
||||
setfillstyle(SOLID_FILL, cf);
|
||||
bar(Campo.left+2, Campo.up+2, Campo.right-2, Campo.down-2);
|
||||
setcolor(cc);
|
||||
|
||||
outtextxy( Campo.left+2, Campo.up+2, s1 );
|
||||
|
||||
if ( ls < lmax ) {
|
||||
setcolor(4);
|
||||
outtextxy( Campo.left+2+textwidth( s1 ), Campo.up+2, "þ");
|
||||
setcolor(cc);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/*ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ*/
|
||||
else if( c == 27 ) {*s='\0'; ok = 1; }
|
||||
/*ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ*/
|
||||
else BEEP();
|
||||
}
|
||||
}
|
||||
|
||||
}while(!ok);
|
||||
|
||||
ok = 1;
|
||||
*s = ' ';
|
||||
while( ok ) {
|
||||
if(*s==' ') { *s = '\0'; s--;
|
||||
} else { s++; ok = 0; }
|
||||
}
|
||||
|
||||
*s = '\0';
|
||||
|
||||
while(kbhit()) getch(); // Vacia Buffer impidiendo falsas
|
||||
// pulsaciones...
|
||||
|
||||
return ls;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int InputCadenaG_l(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo, int RoW)
|
||||
{
|
||||
|
||||
int ls; // longitud cadena
|
||||
char *s1; // puntero a cadena inicial
|
||||
int c, ok;
|
||||
|
||||
s1 = s; // inicio cadena
|
||||
|
||||
setcolor(cf); // pone color a 0 para borrar
|
||||
setfillstyle(SOLID_FILL, cf);
|
||||
bar(Campo.left+2, Campo.up+4+RoW*/*9*//*14*/15+2, Campo.right-2, Campo.up+4+RoW*/*9*//*14*/15 + /*9*/16);
|
||||
|
||||
setcolor(cc); // devuelve el color a su estado
|
||||
|
||||
outtextxy( Campo.left+2, Campo.up+/*3*/2+RoW*/*9*//*14*/15, s );
|
||||
|
||||
ls = strlen ( s ); // Longitud de actual
|
||||
|
||||
if ( ls < lmax ) {
|
||||
setcolor(4);
|
||||
outtextxy( Campo.left+2+textwidth( s1 ), Campo.up+/*3*/2+RoW*/*9*//*14*/15, "þ");
|
||||
}
|
||||
|
||||
s += ls; // se coloca en el final
|
||||
|
||||
do{
|
||||
c = getch(); // obtiene tecla
|
||||
|
||||
ok = ( c == 13 || c == 0); // 13 = INTRO || Especiales
|
||||
|
||||
if ( c == 8 && ls > 0 && !ok ) { // 8 = Back Space
|
||||
ls--;
|
||||
s--;
|
||||
|
||||
*s = '\0';
|
||||
|
||||
setcolor(cf);
|
||||
setfillstyle(SOLID_FILL, cf);
|
||||
bar(Campo.left+2, Campo.up+4+RoW*/*9*//*14*/15+2, Campo.right-2, Campo.up+4+RoW*/*9*//*14*/15 + /*9*/16);
|
||||
// bar(Campo.left+2, Campo.up+3+RoW*/*9*/14+2, Campo.right-2, Campo.up+3+RoW*/*9*/14 + /*9*/16);
|
||||
setcolor(cc);
|
||||
outtextxy( Campo.left+2, Campo.up+/*3*/2+RoW*/*9*//*14*/15, s1 );
|
||||
setcolor(4);
|
||||
outtextxy( Campo.left+2+textwidth( s1 ), Campo.up+/*3*/2+RoW*/*9*//*14*/15, "þ");
|
||||
setcolor(cc);
|
||||
|
||||
} else {
|
||||
if ( !numalp && c >= 32 && c <= 254 /* isprint(c) */ && ls < lmax) {
|
||||
|
||||
*s++ = c;
|
||||
ls++;
|
||||
|
||||
*s = '\0';
|
||||
setcolor(cf);
|
||||
setfillstyle(SOLID_FILL, cf);
|
||||
bar(Campo.left+2, Campo.up+4+RoW*/*9*//*14*/15+2, Campo.right-2, Campo.up+4+RoW*/*9*//*14*/15 + /*9*/16);
|
||||
// bar(Campo.left+2, Campo.up+3+RoW*/*9*/14+2, Campo.right-2, Campo.up+3+RoW*/*9*/14 + /*9*/16);
|
||||
setcolor(cc);
|
||||
outtextxy( Campo.left+2, Campo.up+/*3*/2+RoW*/*9*//*14*/15, s1 );
|
||||
|
||||
if ( ls < lmax ) {
|
||||
setcolor(4);
|
||||
outtextxy( Campo.left+2+textwidth( s1 ), Campo.up+/*3*/2+RoW*/*9*//*14*/15, "þ");
|
||||
setcolor(cc);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
if ( numalp && isdigit(c) && ls < lmax) {
|
||||
*s++ = c;
|
||||
ls++;
|
||||
|
||||
*s = '\0'; // Cero final
|
||||
setcolor(cf);
|
||||
setfillstyle(SOLID_FILL, cf);
|
||||
bar(Campo.left+2, Campo.up+4+RoW*/*9*//*14*/15+2, Campo.right-2, Campo.up+4+RoW*/*9*//*14*/15 + /*9*/16);
|
||||
// bar(Campo.left+2, Campo.up+3+RoW*/*9*/14+2, Campo.right-2, Campo.up+3+RoW*/*9*/14 + /*9*/16);
|
||||
setcolor(cc);
|
||||
|
||||
outtextxy( Campo.left+2, Campo.up+/*3*/2+RoW*/*9*//*14*/15, s1 );
|
||||
|
||||
if ( ls < lmax ) {
|
||||
setcolor(4);
|
||||
outtextxy( Campo.left+2+textwidth( s1 ), Campo.up+/*3*/+RoW*/*9*//*14*/15, "þ");
|
||||
setcolor(cc);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/*ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ*/
|
||||
else if( c == 27 ) {*s='\0'; ok = 1; }
|
||||
/*ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ*/
|
||||
else BEEP();
|
||||
}
|
||||
}
|
||||
|
||||
}while(!ok);
|
||||
|
||||
ok = 1;
|
||||
*s = ' ';
|
||||
while( ok ) {
|
||||
if(*s==' ') { *s = '\0'; s--;
|
||||
} else { s++; ok = 0; }
|
||||
}
|
||||
|
||||
*s = '\0';
|
||||
|
||||
while(kbhit()) getch(); // Vacia Buffer impidiendo falsas
|
||||
// pulsaciones...
|
||||
|
||||
return ls;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//outtextxy( PS[0].left+2, (PS[0].up+3)+(CurrRowStock1-1)*12, Buffer );
|
||||
|
||||
int InputCadenaG_T4(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo, int RoW)
|
||||
{
|
||||
|
||||
int ls; // longitud cadena
|
||||
char *s1; // puntero a cadena inicial
|
||||
int c, ok;
|
||||
|
||||
s1 = s; // inicio cadena
|
||||
|
||||
setcolor(cf); // pone color a 0 para borrar
|
||||
setfillstyle(SOLID_FILL, cf);
|
||||
bar(Campo.left+2, Campo.up+RoW*12+/*2*/4, Campo.right-2, Campo.up+4+RoW*12 + 10);
|
||||
|
||||
setcolor(cc); // devuelve el color a su estado
|
||||
|
||||
outtextxy( Campo.left+2, Campo.up+3+RoW*12, s );
|
||||
|
||||
ls = strlen ( s ); // Longitud de actual
|
||||
|
||||
if ( ls < lmax ) {
|
||||
setcolor(4);
|
||||
outtextxy( Campo.left+2+textwidth( s1 ), Campo.up+3+RoW*12, "þ");
|
||||
}
|
||||
|
||||
s += ls; // se coloca en el final
|
||||
|
||||
do{
|
||||
c = getch(); // obtiene tecla
|
||||
|
||||
ok = ( c == 13 || c == 0); // 13 = INTRO || Especiales
|
||||
|
||||
if ( c == 8 && ls > 0 && !ok ) { // 8 = Back Space
|
||||
ls--;
|
||||
s--;
|
||||
|
||||
*s = '\0';
|
||||
|
||||
setcolor(cf);
|
||||
setfillstyle(SOLID_FILL, cf);
|
||||
|
||||
bar(Campo.left+2, Campo.up+RoW*12+/*2*/4, Campo.right-2, Campo.up+4+RoW*12 + 10);
|
||||
|
||||
setcolor(cc);
|
||||
outtextxy( Campo.left+2, Campo.up+3+RoW*12, s1 );
|
||||
setcolor(4);
|
||||
outtextxy( Campo.left+2+textwidth( s1 ), Campo.up+3+RoW*12, "þ");
|
||||
setcolor(cc);
|
||||
|
||||
} else {
|
||||
if ( !numalp && c >= 32 && c <= 254 /* isprint(c) */ && ls < lmax) {
|
||||
|
||||
*s++ = c;
|
||||
ls++;
|
||||
|
||||
*s = '\0';
|
||||
setcolor(cf);
|
||||
setfillstyle(SOLID_FILL, cf);
|
||||
bar(Campo.left+2, Campo.up+RoW*12+/*2*/4, Campo.right-2, Campo.up+4+RoW*12 + 10);
|
||||
setcolor(cc);
|
||||
outtextxy( Campo.left+2, Campo.up+3+RoW*12, s1 );
|
||||
|
||||
if ( ls < lmax ) {
|
||||
setcolor(4);
|
||||
outtextxy( Campo.left+2+textwidth( s1 ), Campo.up+3+RoW*12, "þ");
|
||||
setcolor(cc);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
if ( numalp && isdigit(c) && ls < lmax) {
|
||||
*s++ = c;
|
||||
ls++;
|
||||
|
||||
*s = '\0'; // Cero final
|
||||
setcolor(cf);
|
||||
setfillstyle(SOLID_FILL, cf);
|
||||
bar(Campo.left+2, Campo.up+RoW*12+/*2*/4, Campo.right-2, Campo.up+4+RoW*12 + 10);
|
||||
setcolor(cc);
|
||||
|
||||
outtextxy( Campo.left+2, Campo.up+3+RoW*12, s1 );
|
||||
|
||||
if ( ls < lmax ) {
|
||||
setcolor(4);
|
||||
outtextxy( Campo.left+2+textwidth( s1 ), Campo.up+3+RoW*12, "þ");
|
||||
setcolor(cc);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/*ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ*/
|
||||
else if( c == 27 ) {*s='\0'; ok = 1; }
|
||||
/*ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ*/
|
||||
else BEEP();
|
||||
}
|
||||
}
|
||||
|
||||
}while(!ok);
|
||||
|
||||
ok = 1;
|
||||
*s = ' ';
|
||||
while( ok ) {
|
||||
if(*s==' ') { *s = '\0'; s--;
|
||||
} else { s++; ok = 0; }
|
||||
}
|
||||
|
||||
*s = '\0';
|
||||
|
||||
while(kbhit()) getch(); // Vacia Buffer impidiendo falsas
|
||||
// pulsaciones...
|
||||
|
||||
return ls;
|
||||
}
|
497
SV_UTIL.CPP
Normal file
497
SV_UTIL.CPP
Normal file
@ -0,0 +1,497 @@
|
||||
#include<graphics.h>
|
||||
#include<dos.h>
|
||||
#include<io.h>
|
||||
#include<conio.h>
|
||||
#include<stdio.h>
|
||||
// #include<string.h>
|
||||
#include<ctype.h>
|
||||
#include<alloc.h>
|
||||
#include<stdlib.h>
|
||||
#include "sv_util.h"
|
||||
#include "..\libs\make_bot\make_bot.h"
|
||||
|
||||
|
||||
#define Letra_Boton setcolor(1);
|
||||
#define Azul 1
|
||||
#define Texto_Normal setcolor(63);
|
||||
#define Texto_Negrita setcolor(0);
|
||||
|
||||
extern int x_raton, y_raton, raton;
|
||||
extern int boton_izq, boton_der;
|
||||
|
||||
extern int InputCadenaG(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo);
|
||||
extern void desactiva_raton(void);
|
||||
extern void activa_raton(void);
|
||||
// extern void Anclar_Raton(void);
|
||||
extern void inicializa_raton_grafico(int x1, int y1, int x2, int y2, int px, int py);
|
||||
extern int Espera_Tecla_o_Raton(void);
|
||||
extern void BEEP(void);
|
||||
extern void textxy(int x, int y, char *text);
|
||||
|
||||
|
||||
#define NEGRO 0
|
||||
#define AZUL 1
|
||||
#define ROJO 4
|
||||
#define VERDE 2
|
||||
#define BLANCO 63
|
||||
#define GRIS_O 56
|
||||
#define GRIS_C 7
|
||||
#define AMARILLO 62
|
||||
|
||||
extern void textxy(int x, int y, char *text);
|
||||
|
||||
int Comprueba_Impresora(void);
|
||||
int Confirma(char *T1, char *T2, char *T3);
|
||||
int Desde_Hasta(int *Desde, int *Hasta);
|
||||
int Pide_Fecha_Actual(void);
|
||||
int file_exists(char *filename);
|
||||
|
||||
int Confirma(char *T1, char *T2, char *T3){
|
||||
|
||||
void far *ptr;
|
||||
unsigned size;
|
||||
struct boton pregunta[2];
|
||||
int fins_print=0, key_print, bpush, ok = 0;
|
||||
int TFuente;
|
||||
struct textsettingstype textinfo;
|
||||
gettextsettings(&textinfo);
|
||||
TFuente = textinfo.charsize;
|
||||
|
||||
size = imagesize(198, 138, 372, 257);
|
||||
|
||||
/* get byte size of image */
|
||||
Fuente(SMALL_FONT, 5);
|
||||
|
||||
if ( (ptr = farmalloc(size)) == NULL) { Fuente(SMALL_FONT, TFuente); return 0; }
|
||||
|
||||
getimage(198, 138, 372, 257, ptr);
|
||||
|
||||
pregunta[0].up = 140; pregunta[0].down = 255;
|
||||
pregunta[0].left= 200; pregunta[0].right= 370;
|
||||
ImprimeBoton (1, GRIS_C, GRIS_O, BLANCO, pregunta[0]);
|
||||
|
||||
pregunta[0].up = 235; pregunta[0].down = 250;
|
||||
pregunta[0].left= 210; pregunta[0].right= 270;
|
||||
ImprimeBoton (1, GRIS_C, BLANCO, GRIS_O, pregunta[0]);
|
||||
|
||||
pregunta[1].up = 235; pregunta[1].down = 250;
|
||||
pregunta[1].left= 300; pregunta[1].right= 360;
|
||||
ImprimeBoton (1, GRIS_C, BLANCO, GRIS_O, pregunta[1]);
|
||||
|
||||
textxy(212, 237, " Si");
|
||||
textxy(212, 239, " _");
|
||||
textxy(302, 237, " No");
|
||||
textxy(302, 239, " _");
|
||||
|
||||
textxy(210+2, 150+2, T1);
|
||||
textxy(210+2, 165+2, T2);
|
||||
textxy(210+2, 180+2, T3);
|
||||
|
||||
|
||||
//ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
|
||||
do{
|
||||
|
||||
if(raton!=0) activa_raton();
|
||||
Espera_Tecla_o_Raton();
|
||||
if(raton!=0) desactiva_raton();
|
||||
|
||||
if(kbhit()){
|
||||
key_print = getch();
|
||||
switch( toupper(key_print) ){
|
||||
// S Si
|
||||
case 83:
|
||||
ok = 1;
|
||||
fins_print = 1;
|
||||
break;
|
||||
// N No
|
||||
case 78:
|
||||
ok = 0;
|
||||
fins_print = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else
|
||||
if(raton!=0 && boton_izq==1 || boton_der==1) {
|
||||
if( (bpush = CheckButon( 2, pregunta))>0 ) {
|
||||
|
||||
switch(bpush){
|
||||
case 1:
|
||||
ok = 1;
|
||||
fins_print = 1;
|
||||
break;
|
||||
case 2:
|
||||
ok = 0;
|
||||
fins_print = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}while(!fins_print);
|
||||
|
||||
|
||||
|
||||
|
||||
putimage(198, 138, ptr, COPY_PUT);
|
||||
farfree(ptr);
|
||||
Fuente(SMALL_FONT, TFuente);
|
||||
|
||||
return ok;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int Pide_Fecha_Actual(void){
|
||||
|
||||
int Fecha;
|
||||
|
||||
//þþþþþþ void far *ptr;
|
||||
//þþþþþþ unsigned size;
|
||||
char mes[][11] = { " Enero", "Febrero", " Marzo",
|
||||
" Abril", " Mayo", " Junio",
|
||||
" Julio", " Agosto", "Septiemb",
|
||||
"Octubre", "Noviemb", "Diciemb"
|
||||
};
|
||||
|
||||
struct boton pregunta[3];
|
||||
struct boton meses[12];
|
||||
|
||||
int key_print, bpush, ok = 0;
|
||||
int TFuente;
|
||||
|
||||
for( Fecha = 0; Fecha < 4; Fecha++ ){
|
||||
meses[2+3*Fecha].left = 405; meses[2+3*Fecha].right = 455;
|
||||
meses[1+3*Fecha].left = 350; meses[1+3*Fecha].right = 400;
|
||||
meses[0+3*Fecha].left = 295; meses[0+3*Fecha].right = 345;
|
||||
}
|
||||
|
||||
for( Fecha = 0; Fecha < 3; Fecha++ ) {
|
||||
meses[Fecha].up = 80+140; meses[Fecha].down = 80+160;
|
||||
meses[Fecha+3].up = 80+165; meses[Fecha+3].down = 80+185;
|
||||
meses[Fecha+6].up = 80+190; meses[Fecha+6].down = 80+210;
|
||||
meses[Fecha+9].up = 80+215; meses[Fecha+9].down = 80+235;
|
||||
}
|
||||
|
||||
|
||||
struct textsettingstype textinfo;
|
||||
gettextsettings(&textinfo);
|
||||
TFuente = textinfo.charsize;
|
||||
struct date d;
|
||||
getdate(&d);
|
||||
Fecha = d.da_mon;
|
||||
|
||||
/* get byte size of image */
|
||||
//þþþþþþ size = imagesize(198, 138, 372, 257);
|
||||
|
||||
|
||||
|
||||
//þþþþþþ if ( (ptr = farmalloc(size)) == NULL) {
|
||||
//þþþþþþ Fuente(SMALL_FONT, TFuente);
|
||||
//þþþþþþ return Fecha;
|
||||
//þþþþþþ }
|
||||
|
||||
//þþþþþþ getimage(198, 138, 372, 257, ptr);
|
||||
|
||||
|
||||
pregunta[0].up = /*140*/130; pregunta[0].down = /*255*/400;
|
||||
pregunta[0].left= /*200*/150; pregunta[0].right= /*370*/465;
|
||||
ImprimeBoton (1, GRIS_C, GRIS_O, BLANCO, pregunta[0]);
|
||||
|
||||
pregunta[0].up = /*143*/135; pregunta[0].down = /*252*/395;
|
||||
pregunta[0].left= /*203*/155; pregunta[0].right= /*367*/460;
|
||||
ImprimeBoton (0, GRIS_C, BLANCO, GRIS_O, pregunta[0]);
|
||||
|
||||
|
||||
pregunta[0].up = /*235*/370; pregunta[0].down = /*250*/390;
|
||||
pregunta[0].left= /*210*/160; pregunta[0].right= /*270*/230;
|
||||
ImprimeBoton (1, GRIS_C, BLANCO, GRIS_O, pregunta[0]);
|
||||
|
||||
pregunta[1].up = /*235*/370; pregunta[1].down = /*250*/390;
|
||||
pregunta[1].left= /*300*/385; pregunta[1].right= /*360*/455;
|
||||
ImprimeBoton (1, GRIS_C, BLANCO, GRIS_O, pregunta[1]);
|
||||
|
||||
pregunta[2].up = /*165*/175; pregunta[2].down = /*185*/195;
|
||||
pregunta[2].left= 212; pregunta[2].right= /*232*/245;
|
||||
ImprimeBoton (1, GRIS_C, BLANCO, GRIS_O, pregunta[2]);
|
||||
|
||||
Fuente(SMALL_FONT, 4);
|
||||
for( int i = 0; i < 12; i++ ) {
|
||||
ImprimeBoton (1, GRIS_C, GRIS_O, BLANCO, meses[i]);
|
||||
textxy(meses[i].left+4, meses[i].up+3, mes[i]);
|
||||
}
|
||||
ImprimeBoton (1, ROJO, GRIS_O, BLANCO, meses[Fecha-1]);
|
||||
textxy(meses[Fecha-1].left+4, meses[Fecha-1].up+3, mes[Fecha-1]);
|
||||
|
||||
Fuente(SMALL_FONT, 5);
|
||||
|
||||
textxy(162, 372, " Aceptar");
|
||||
textxy(162, 373, " _");
|
||||
textxy(387, 372, " Cancelar");
|
||||
textxy(387, 373, " _");
|
||||
|
||||
textxy(160+2, 145+2, "Introduzca mes a gestionar:");
|
||||
|
||||
// textxy(210+2, 165+2, T2);
|
||||
// textxy(210+2, 180+2, T3);
|
||||
char buffer[80];
|
||||
int Mes=Fecha;
|
||||
|
||||
sprintf( buffer, "% 2d", Fecha);
|
||||
textxy(pregunta[2].left + 4, pregunta[2].up + 2, buffer);
|
||||
|
||||
//ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
|
||||
do{
|
||||
|
||||
if(raton!=0) activa_raton();
|
||||
Espera_Tecla_o_Raton();
|
||||
if(raton!=0) desactiva_raton();
|
||||
|
||||
if(kbhit()){
|
||||
key_print = getch();
|
||||
if( key_print == 13 ) {Fecha = Mes; ok = 1; } else
|
||||
if( isdigit(key_print) ) {
|
||||
// Edita el mes actual
|
||||
sprintf( buffer, "%d", Fecha);
|
||||
do{
|
||||
InputCadenaG( buffer, 1, 4, 63, 57, pregunta[2]);
|
||||
Fecha = atoi(buffer);
|
||||
}while(Fecha<1 || Fecha>12);
|
||||
} else
|
||||
if(key_print==0)
|
||||
switch( getch() ){
|
||||
// Flecha Izquierda
|
||||
case 75:
|
||||
case 15:
|
||||
ImprimeBoton (0, GRIS_C, GRIS_O, BLANCO, meses[Mes-1]);
|
||||
Mes--;
|
||||
if ( (Mes + 1)== 1 ) Mes = 3; else
|
||||
if ( (Mes + 1)== 4 ) Mes = 6; else
|
||||
if ( (Mes + 1)== 7 ) Mes = 9; else
|
||||
if ( (Mes + 1)==10 ) Mes = 12;
|
||||
ImprimeBoton (0, GRIS_C, AZUL, AZUL, meses[Mes-1]);
|
||||
break;
|
||||
// Flecha Derecha
|
||||
case 77:
|
||||
case 9:
|
||||
ImprimeBoton (0, GRIS_C, GRIS_O, BLANCO, meses[Mes-1]);
|
||||
Mes++;
|
||||
if ( (Mes - 1)== 3 ) Mes = 1; else
|
||||
if ( (Mes - 1)== 6 ) Mes = 4; else
|
||||
if ( (Mes - 1)== 9 ) Mes = 7; else
|
||||
if ( (Mes - 1)==12 ) Mes = 10;
|
||||
ImprimeBoton (0, GRIS_C, AZUL, AZUL, meses[Mes-1]);
|
||||
break;
|
||||
// Flecha Abajo
|
||||
case 80:
|
||||
ImprimeBoton (0, GRIS_C, GRIS_O, BLANCO, meses[Mes-1]);
|
||||
Mes += 3; if ( Mes > 12) Mes = Mes - 12;
|
||||
ImprimeBoton (0, GRIS_C, AZUL, AZUL, meses[Mes-1]);
|
||||
break;
|
||||
// Flecha Arriba
|
||||
case 72:
|
||||
ImprimeBoton (0, GRIS_C, GRIS_O, BLANCO, meses[Mes-1]);
|
||||
Mes -= 3; if ( Mes < 1) Mes = 12 + Mes;
|
||||
ImprimeBoton (0, GRIS_C, AZUL, AZUL, meses[Mes-1]);
|
||||
break;
|
||||
}
|
||||
else
|
||||
switch( toupper(key_print) ){
|
||||
// A Aceptar
|
||||
case 65:
|
||||
ok = 1;
|
||||
break;
|
||||
// C Cancelar
|
||||
case 67:
|
||||
ok = 1;
|
||||
Fecha = -1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else
|
||||
if(raton!=0 && boton_izq==1 || boton_der==1) {
|
||||
if( (bpush = CheckButon( 2, pregunta))>0 ) {
|
||||
|
||||
switch(bpush){
|
||||
case 1:
|
||||
ok = 1;
|
||||
break;
|
||||
case 2:
|
||||
ok = 1;
|
||||
Fecha = -1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}while(!ok);
|
||||
|
||||
|
||||
//þþþþþþ putimage(198, 138, ptr, COPY_PUT);
|
||||
//þþþþþþ farfree(ptr);
|
||||
|
||||
|
||||
Fuente(SMALL_FONT, TFuente);
|
||||
|
||||
return Fecha;
|
||||
|
||||
}
|
||||
|
||||
|
||||
int file_exists(char *filename)
|
||||
{
|
||||
return (access(filename, 0) == 0);
|
||||
}
|
||||
|
||||
|
||||
int Comprueba_Impresora(void){
|
||||
|
||||
unsigned int tmp;
|
||||
union REGS Impresora_in, Impresora_out;
|
||||
struct byte {
|
||||
int a : 1;
|
||||
int b : 1;
|
||||
int c : 1;
|
||||
int d : 1;
|
||||
int e : 1;
|
||||
int f : 1;
|
||||
int g : 1;
|
||||
int h : 1;
|
||||
};
|
||||
union bits {
|
||||
char ch;
|
||||
struct byte bit;
|
||||
} Imp_out;
|
||||
|
||||
Impresora_in.h.ah = 0x02;
|
||||
Impresora_in.x.dx = 0x0;
|
||||
|
||||
int86(0x17, &Impresora_in, &Impresora_out);
|
||||
|
||||
return ( Impresora_out.h.ah ? 1 : 0 );
|
||||
|
||||
}
|
||||
|
||||
int Desde_Hasta(int *Desde, int *Hasta){
|
||||
|
||||
int fins_print= 0, key_print, bpush;
|
||||
char buffer[80], devuelve = 0;
|
||||
void far *ptr;
|
||||
unsigned size;
|
||||
struct boton pregunta[4];
|
||||
|
||||
struct date Fecha;
|
||||
getdate(&Fecha);
|
||||
|
||||
*Desde = *Hasta = Fecha.da_day;
|
||||
|
||||
size = imagesize(198, 138, 372, 257);
|
||||
|
||||
/* get byte size of image */
|
||||
|
||||
if ( (ptr = farmalloc(size)) == NULL) return -1;
|
||||
getimage(198, 138, 372, 257, ptr);
|
||||
|
||||
pregunta[0].up = 140; pregunta[0].down = 255;
|
||||
pregunta[0].left= 200; pregunta[0].right= 370;
|
||||
ImprimeBoton (1, ROJO, GRIS_C, BLANCO, pregunta[0]);
|
||||
pregunta[0].up = 150; pregunta[0].down = /*175*/165;
|
||||
pregunta[0].left= /*210*/250; pregunta[0].right= 360;
|
||||
ImprimeBoton (1, NEGRO, GRIS_O, BLANCO, pregunta[0]);
|
||||
pregunta[1].up = 185; pregunta[1].down = /*210*/200;
|
||||
pregunta[1].left= /*210*/250; pregunta[1].right= 360;
|
||||
ImprimeBoton (1, NEGRO, GRIS_O, BLANCO, pregunta[1]);
|
||||
pregunta[2].up = 220; pregunta[2].down = 245;
|
||||
pregunta[2].left= 210; pregunta[2].right= 280;
|
||||
ImprimeBoton (1, GRIS_C, BLANCO, GRIS_O, pregunta[2]);
|
||||
pregunta[3].up = 220; pregunta[3].down = 245;
|
||||
pregunta[3].left= 290; pregunta[3].right= 360;
|
||||
ImprimeBoton (1, GRIS_C, BLANCO, GRIS_O, pregunta[3]);
|
||||
|
||||
Fuente(SMALL_FONT, 4);
|
||||
|
||||
Letra_Boton
|
||||
outtextxy(pregunta[0].left+2 - 40, pregunta[0].up+2, "DESDE");
|
||||
outtextxy(pregunta[1].left+2 - 40, pregunta[1].up+2, "HASTA");
|
||||
outtextxy(pregunta[2].left+2, pregunta[2].up+2, "CANCELAR");
|
||||
outtextxy(pregunta[2].left+2, pregunta[2].up+4, "_");
|
||||
outtextxy(pregunta[3].left+2, pregunta[3].up+2, "ACEPTAR");
|
||||
outtextxy(pregunta[3].left+2, pregunta[3].up+4, "_");
|
||||
|
||||
//ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
|
||||
do{
|
||||
|
||||
if(raton!=0) activa_raton();
|
||||
Espera_Tecla_o_Raton();
|
||||
if(raton!=0) desactiva_raton();
|
||||
|
||||
if(kbhit()){
|
||||
key_print = getch();
|
||||
if(key_print == 27 ) { fins_print = 1; devuelve = -1; } else
|
||||
if(key_print == 'A' || key_print == 'a') { fins_print = 1; } else
|
||||
if(key_print == 'C' || key_print == 'c') { fins_print = 1; devuelve = -1; } else
|
||||
if( isprint(key_print) ) {
|
||||
sprintf( buffer, "%d", *Desde);
|
||||
do{
|
||||
InputCadenaG( buffer, 1, 2, 63, 57, pregunta[0]);
|
||||
*Desde = atol(buffer);
|
||||
}while(*Desde<1 || *Desde>12);
|
||||
|
||||
sprintf( buffer, "%d", *Hasta);
|
||||
do{
|
||||
InputCadenaG( buffer, 1, 2, 63, 57, pregunta[1]);
|
||||
*Hasta = atol(buffer);
|
||||
}while(*Hasta<1 || *Hasta>12);
|
||||
} else
|
||||
if( key_print == 0 ) {
|
||||
switch( (key_print=getch()) ){
|
||||
// F1 Cancelar
|
||||
case 59:
|
||||
fins_print = 1;
|
||||
devuelve = -1;
|
||||
break;
|
||||
// F3 Imprimir Ficha
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else
|
||||
if(raton!=0 && boton_izq==1 || boton_der==1) {
|
||||
if( (bpush = CheckButon( 3, pregunta))>0 ) {
|
||||
/*
|
||||
pregunta[0].up = 140; pregunta[0].down = 255;
|
||||
pregunta[0].left= 200; pregunta[0].right= 370;
|
||||
ImprimeBoton (1, GRIS_O, GRIS_C, BLANCO, pregunta[0]);
|
||||
*/
|
||||
switch(bpush){
|
||||
// Cancelar
|
||||
case 3:
|
||||
fins_print=1;
|
||||
devuelve = -1;
|
||||
break;
|
||||
case 4:
|
||||
fins_print=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}while(!fins_print);
|
||||
|
||||
//ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
|
||||
|
||||
|
||||
putimage(198, 138, ptr, COPY_PUT);
|
||||
farfree(ptr);
|
||||
|
||||
Fuente(SMALL_FONT, 5);
|
||||
|
||||
return devuelve;
|
||||
}
|
5
SV_UTIL.H
Normal file
5
SV_UTIL.H
Normal file
@ -0,0 +1,5 @@
|
||||
extern int Desde_Hasta(int *Desde, int *Hasta);
|
||||
extern int Confirma(char *T1, char *T2, char *T3);
|
||||
extern int Pide_Fecha_Actual(void);
|
||||
extern int file_exists(char *filename);
|
||||
//extern int Comprueba_Impresora(void):
|
1231
SV_VEND.CPP
Normal file
1231
SV_VEND.CPP
Normal file
File diff suppressed because it is too large
Load Diff
850
SV_VENT.CPP
Normal file
850
SV_VENT.CPP
Normal file
@ -0,0 +1,850 @@
|
||||
#define SV_REF_X
|
||||
|
||||
#include<graphics.h>
|
||||
#include<dos.h>
|
||||
#include<conio.h>
|
||||
#include<math.h>
|
||||
#include<stdio.h>
|
||||
#include<string.h>
|
||||
#include<ctype.h>
|
||||
#include<alloc.h>
|
||||
#include<stdlib.h>
|
||||
|
||||
|
||||
#include "..\libs\make_bot\make_bot.h"
|
||||
#include "sv_util.h"
|
||||
#include "sv_graph.h"
|
||||
#include "sv_ref_x.h"
|
||||
|
||||
|
||||
#define Letra_Boton setcolor(1);
|
||||
#define Azul 1
|
||||
#define Texto_Normal setcolor(63);
|
||||
#define Texto_Negrita setcolor(0);
|
||||
|
||||
|
||||
void Poner_a_cero_estructura_actual_Ventas(void);
|
||||
void Abre_Ficha_Ventas(void);
|
||||
void Actualizar_Ventas(int Referencia, int Unidades, int Codigo);
|
||||
|
||||
extern int x_raton, y_raton, raton;
|
||||
extern int boton_izq, boton_der;
|
||||
|
||||
extern void desactiva_raton(void);
|
||||
extern void activa_raton(void);
|
||||
extern void Anclar_Raton(void);
|
||||
extern void inicializa_raton_grafico(int x1, int y1, int x2, int y2, int px, int py);
|
||||
extern int Espera_Tecla_o_Raton(void);
|
||||
extern void BEEP(void);
|
||||
|
||||
extern int InputCadenaG(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo);
|
||||
extern int InputCadenaG_l(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo, int Row);
|
||||
extern int InputCadenaG_T4(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo, int RoW);
|
||||
|
||||
void GetLineVentas(void);
|
||||
void Menu_de_Ventas(int Current_Date);
|
||||
void PrintLineVentas(void);
|
||||
void Mueve_Abajo_Ventas(void);
|
||||
void Mueve_Arriba_Ventas(void);
|
||||
void CompruebaLineasVentas(void);
|
||||
void PrintWholeScreenVentas(void);
|
||||
void EditCursorVentas(int ShowHide);
|
||||
void Imprimir_Ventas(void);
|
||||
// void Recalcula_Porcentaje(int Individual_Seleccionado);
|
||||
|
||||
// void Llena_con_Ventas_basicas(void);
|
||||
extern void Coloca_Nombres_a_botones(void);
|
||||
|
||||
// extern int Confirma(char *f1, char *f2, char *f3);
|
||||
extern int Comprueba_Impresora(void);
|
||||
|
||||
struct Ventas_inx { unsigned int Fin; };
|
||||
|
||||
struct Ventas_actual { int Ref; long Und_0; long Und_1; };
|
||||
|
||||
struct Ventas_actual Ventas1_Graficas[10];
|
||||
|
||||
struct boton *PVent;//[5]
|
||||
extern struct boton Comunes[9];
|
||||
|
||||
|
||||
int CurrRowVentas1;
|
||||
int CurrColVentas1;
|
||||
int CurrTopLineVentas;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct Stock_inx { unsigned int Fin; };
|
||||
|
||||
struct Stock_actual { int Ref; long Und_0; long Und_1; };
|
||||
|
||||
struct Stock_actual Ventas1;
|
||||
struct Stock_inx Ventas1_inx;
|
||||
|
||||
FILE *Ventas;
|
||||
|
||||
|
||||
extern int Fecha;
|
||||
|
||||
|
||||
void Abre_Ficha_Ventas(void){
|
||||
|
||||
|
||||
char ArchivoDatos[]="12345678.1237";
|
||||
struct date Fecha2;
|
||||
getdate(&Fecha2);
|
||||
|
||||
sprintf( ArchivoDatos, "SV_V%02d%02d.dat", Fecha, (Fecha2.da_year - (Fecha2.da_year/100)*100 ) );
|
||||
|
||||
|
||||
//ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ//
|
||||
//Û Stockrueba apertura correcta de Indice, y Datos y creaci¢n... Û//
|
||||
//ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß//
|
||||
|
||||
int LSJ = sizeof(struct JD);
|
||||
int LSI = sizeof(struct Stock_inx);
|
||||
int LSC = sizeof(struct Stock_actual);
|
||||
|
||||
if ( (Ventas = fopen( ArchivoDatos, "r+b"))==NULL) {
|
||||
|
||||
FILE *fa;
|
||||
|
||||
if ( (fa = fopen( ArchivoDatos, "wb" ) )!=NULL ) {
|
||||
|
||||
Poner_a_cero_estructura_actual_Ventas();
|
||||
Ventas1_inx.Fin = 0;
|
||||
rewind(fa);
|
||||
|
||||
fwrite(&cabecera, LSJ, 1, fa); fseek(fa, (long)LSJ, SEEK_SET);
|
||||
fwrite(&Ventas1_inx, LSI, 1, fa); fseek(fa, (long)LSJ+LSI, SEEK_SET);
|
||||
fwrite(&Ventas1, LSC, 1, fa);
|
||||
|
||||
if (fclose(fa) == EOF ) exit(1);
|
||||
}
|
||||
|
||||
if ( (Ventas = fopen( ArchivoDatos, "r+b"))==NULL) {
|
||||
restorecrtmode();
|
||||
printf("NO SE PUDO ABRIR EL FICHERO INDICE EN LA 2§ PASADA");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
fseek(Ventas, (long)LSJ, SEEK_SET);
|
||||
if ( fread(&Ventas1_inx, LSI, 1, Ventas) != 1 ) {
|
||||
restorecrtmode();
|
||||
printf("NO SE PUDO LEER EN EL FICHERO: INDICE");
|
||||
exit(1);
|
||||
}
|
||||
fseek(Ventas, (long)LSJ+LSI, SEEK_SET);
|
||||
if ( fread(&Ventas1, LSC, 1, Ventas) != 1 ) {
|
||||
restorecrtmode();
|
||||
printf("NO SE PUDO LEER EN EL FICHERO: DATOS");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Actualizar_Ventas(int Referencia, int Unidades, int Codigo){
|
||||
|
||||
int LSJ = sizeof(struct JD);
|
||||
int LSI = sizeof(struct Stock_inx);
|
||||
int LSC = sizeof(struct Stock_actual);
|
||||
|
||||
int ok = 0;
|
||||
int Curr_Ventas = 0, Encuentro = 0;
|
||||
|
||||
|
||||
while( (Curr_Ventas <= Ventas1_inx.Fin) && (ok == 0) ){
|
||||
|
||||
fseek(Ventas, (long)LSJ + LSI + ( LSC * Curr_Ventas ), SEEK_SET); // Se coloca
|
||||
fread(&Ventas1, LSC, 1, Ventas); // Y lee
|
||||
|
||||
if( Ventas1.Ref == Referencia ) {
|
||||
if(Codigo==1) Ventas1.Und_1 += Unidades;
|
||||
else Ventas1.Und_0 += Unidades;
|
||||
fseek(Ventas, (long)LSJ + LSI + ( LSC * Curr_Ventas ), SEEK_SET); // Se coloca
|
||||
fwrite(&Ventas1, LSC, 1, Ventas); // Y escribe
|
||||
ok = 1;
|
||||
Encuentro = 1;
|
||||
}
|
||||
|
||||
Curr_Ventas++;
|
||||
}
|
||||
|
||||
if (Encuentro==0) {
|
||||
Ventas1.Ref = Referencia;
|
||||
if(Codigo==1) { Ventas1.Und_1 = Unidades; Ventas1.Und_0 = 0; }
|
||||
else { Ventas1.Und_0 = Unidades; Ventas1.Und_1 = 0; }
|
||||
|
||||
fseek(Ventas, (long)LSJ + LSI + ( LSC * (Ventas1_inx.Fin + 1) ), SEEK_SET); // Se coloca
|
||||
fwrite(&Ventas1, LSC, 1, Ventas); // Y escribe
|
||||
|
||||
Ventas1_inx.Fin ++;
|
||||
|
||||
fseek(Ventas, (long)LSJ, SEEK_SET);
|
||||
fwrite(&Ventas1_inx, LSI, 1, Ventas); // Acualiza n§ de registros
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Poner_a_cero_estructura_actual_Ventas(void){
|
||||
|
||||
cabecera.esc = 27; strcpy(cabecera.color, "[31;40m");
|
||||
strcpy(cabecera.prog, "Jos‚ David Guill‚n Dominguez");
|
||||
cabecera.nl = 13; cabecera.rt = 10;
|
||||
strcpy(cabecera.autor, " 6 / Mayo / 1995 ");
|
||||
cabecera.pt = 7; cabecera.ef = 26;
|
||||
|
||||
Ventas1.Ref=0; Ventas1.Und_1=0; Ventas1.Und_0=0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Menu_de_Ventas(int Current_Date) {
|
||||
|
||||
int finished = 0, key, bpush;
|
||||
CurrRowVentas1 = 1; CurrColVentas1 = 1;
|
||||
|
||||
Fecha = Current_Date;
|
||||
|
||||
CurrTopLineVentas = 1;
|
||||
|
||||
inicializa_raton_grafico(0, 0, 624, 464, 320, 240);
|
||||
if(raton!=0) desactiva_raton();
|
||||
|
||||
if( ( PVent = (struct boton *) malloc( sizeof(struct boton)*15 ) ) == NULL )
|
||||
{
|
||||
Confirma("Memoria insuficiente", "para crear tablas de", "posisi¢n PVent.");
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
cleardevice();
|
||||
Dibuja_Pantalla_Ventas(PVent);
|
||||
Fuente(SMALL_FONT, 5);
|
||||
setcolor(NEGRO);
|
||||
Coloca_Nombres_a_botones();
|
||||
setcolor(GRIS_C);
|
||||
outtextxy(Comunes[3].left, Comunes[3].up, " SWAP" );
|
||||
outtextxy(Comunes[3].left, Comunes[3].up+18, " F6 " );
|
||||
|
||||
|
||||
Fuente(SMALL_FONT, 4);
|
||||
Abre_Ficha_Ventas();
|
||||
Abre_Ficha_Referencias();
|
||||
Carga_Referencias();
|
||||
|
||||
PrintWholeScreenVentas();
|
||||
GetLineVentas();
|
||||
int oldCR1=0, oldCC1=0;
|
||||
|
||||
do{
|
||||
|
||||
if(oldCR1!=CurrRowVentas1 || oldCC1!=CurrColVentas1 )
|
||||
EditCursorVentas(0);
|
||||
|
||||
oldCR1 = CurrRowVentas1; oldCC1 = CurrColVentas1;
|
||||
|
||||
if(raton!=0) activa_raton();
|
||||
Espera_Tecla_o_Raton();
|
||||
if(raton!=0) desactiva_raton();
|
||||
|
||||
if(kbhit()){
|
||||
// EditCursorVentas(1);
|
||||
key = getch();
|
||||
/*
|
||||
if( isprint(key) || isspace(key) ) {
|
||||
EditCursorVentas(0);
|
||||
if(key!=13) ungetch(key);
|
||||
Edit_Item_Ventas();
|
||||
Recalcula_Porcentaje(1);
|
||||
EditCursorVentas(0);
|
||||
} else*/ if( key == 0 ) {
|
||||
|
||||
EditCursorVentas(1);
|
||||
|
||||
switch( (key=getch()) ){
|
||||
// Flecha Arriba
|
||||
case 72:
|
||||
Mueve_Arriba_Ventas();
|
||||
// Recalcula_Porcentaje(1);
|
||||
break;
|
||||
// Flecha Izquierda
|
||||
case 75:
|
||||
case 15:
|
||||
CurrColVentas1--;
|
||||
if ( CurrColVentas1<1 ) CurrColVentas1=8;
|
||||
break;
|
||||
// Flecha Derecha
|
||||
case 77:
|
||||
case 9:
|
||||
CurrColVentas1++;
|
||||
if ( CurrColVentas1>8) CurrColVentas1=1;
|
||||
break;
|
||||
// Flecha Abajo
|
||||
case 80:
|
||||
Mueve_Abajo_Ventas();
|
||||
// Recalcula_Porcentaje(1);
|
||||
break;
|
||||
// Buscar F2
|
||||
case 60:
|
||||
// BuscarVentas();
|
||||
break;
|
||||
// Imprimir Ventas F5
|
||||
case 63:
|
||||
Imprimir_Ventas();
|
||||
break;
|
||||
|
||||
// F9 --> A¥ADIR
|
||||
case 67:
|
||||
// if( Confirma("A¥ADIR NUEVO STOCK", "INICIAL", "") )
|
||||
// if ( Pide_Codigo(SV_CFG.COD_Ventas) )
|
||||
// AddRecordVentas();
|
||||
break;
|
||||
// F10 -> BORRAR
|
||||
case 68:
|
||||
// if( Confirma("ELIMINAR TOTALMENTE", "STOCK ACTUAL", "") )
|
||||
// if ( Pide_Codigo(SV_CFG.COD_Ventas) )
|
||||
// DeleteRecordVentas();
|
||||
// Recalcula_Porcentaje(1);
|
||||
break;
|
||||
|
||||
// INICIO
|
||||
case 71:
|
||||
CurrColVentas1 = 1;
|
||||
break;
|
||||
// FIN
|
||||
case 79:
|
||||
CurrColVentas1 = 5;
|
||||
break;
|
||||
// ReP g
|
||||
case 73:
|
||||
// CurrRow = 1;
|
||||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
if( CurrTopLineVentas > /*28*/26 ) { CurrTopLineVentas -= /*28*/26; } else { CurrTopLineVentas = 1; }
|
||||
if( CurrTopLineVentas < 1 ) { CurrTopLineVentas = 1; }
|
||||
PrintWholeScreenVentas();
|
||||
GetLineVentas();
|
||||
EditCursorVentas(0);
|
||||
// Recalcula_Porcentaje(1);
|
||||
break;
|
||||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
// AvP g
|
||||
case 81:
|
||||
// CurrRow = 1;
|
||||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
CurrTopLineVentas += /*28*/26;
|
||||
if ( (CurrTopLineVentas+CurrRowVentas1) > Ventas1_inx.Fin) { CurrTopLineVentas = Ventas1_inx.Fin; CurrRowVentas1 = 1; }
|
||||
if (CurrTopLineVentas==0) CurrTopLineVentas = 1;
|
||||
PrintWholeScreenVentas();
|
||||
GetLineVentas();
|
||||
EditCursorVentas(0);
|
||||
// Recalcula_Porcentaje(1);
|
||||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
break;
|
||||
// Salir F1
|
||||
case 59:
|
||||
finished = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
EditCursorVentas(0);
|
||||
}
|
||||
} else if(raton!=0 && ( boton_izq==1 || boton_der==1 ) )
|
||||
if( (bpush = CheckButon( 9, Comunes))>0 ) {
|
||||
EditCursorVentas(1);
|
||||
switch(bpush){
|
||||
// Flecha Arriba
|
||||
case 1:
|
||||
Mueve_Arriba_Ventas();
|
||||
// Recalcula_Porcentaje(1);
|
||||
break;
|
||||
// Buscar
|
||||
case 2:
|
||||
// BuscarVend();
|
||||
break;
|
||||
// Flecha Abajo
|
||||
case 3:
|
||||
Mueve_Abajo_Ventas();
|
||||
// Recalcula_Porcentaje(1);
|
||||
break;
|
||||
case 4:
|
||||
break;
|
||||
// Imprimir
|
||||
case 5:
|
||||
Imprimir_Ventas();
|
||||
break;
|
||||
// A¤adir
|
||||
case 6:
|
||||
// if( Confirma("A¥ADIR NUEVO STOCK", "INICIAL", "") )
|
||||
// if ( Pide_Codigo(SV_CFG.COD_Ventas) )
|
||||
// AddRecordVentas();
|
||||
break;
|
||||
// Borrar
|
||||
case 7:
|
||||
// if( Confirma("ELIMINAR TOTALMENTE", "STOCK ACTUAL", "") )
|
||||
// if ( Pide_Codigo(SV_CFG.COD_Ventas) )
|
||||
// DeleteRecordVentas();
|
||||
// Recalcula_Porcentaje(1);
|
||||
break;
|
||||
// Salir
|
||||
case 9:
|
||||
finished = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
EditCursorVentas(0);
|
||||
} else CompruebaLineasVentas();
|
||||
|
||||
}while(!finished);
|
||||
|
||||
fclose(Ventas); // Fichero Vendedores
|
||||
fclose(Ref); // Fichero Vendedores
|
||||
free(PVent); // Libera la memoria
|
||||
|
||||
if(Memory_ok==1) farfree(Addr); else free(Ref_inx_addr);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Mueve_Abajo_Ventas(void){
|
||||
|
||||
int CurrRecord = CurrTopLineVentas + CurrRowVentas1 - 1;
|
||||
|
||||
if (CurrRowVentas1==/*28*/40) {
|
||||
if ( (CurrRecord - 1) >= Ventas1_inx.Fin) { BEEP(); EditCursorVentas(0); }
|
||||
else { CurrTopLineVentas++;
|
||||
PrintWholeScreenVentas();
|
||||
//ÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜß
|
||||
//ÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜß
|
||||
//ÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜß
|
||||
GetLineVentas();
|
||||
// PrintLineVentas();
|
||||
}
|
||||
} else {
|
||||
if( (CurrRecord - 1) >= Ventas1_inx.Fin) { BEEP(); EditCursorVentas(0); }
|
||||
else { CurrRowVentas1++;
|
||||
GetLineVentas();
|
||||
// PrintLineVentas();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Mueve_Arriba_Ventas(void){
|
||||
int CurrRecord = CurrTopLineVentas + CurrRowVentas1 - 1;
|
||||
|
||||
if (CurrRowVentas1==1) {
|
||||
if ((CurrRecord - 1) <= 0) { BEEP(); EditCursorVentas(0); }
|
||||
else {
|
||||
CurrTopLineVentas--;
|
||||
PrintWholeScreenVentas();
|
||||
//ÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜß
|
||||
//ÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜß
|
||||
//ÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜßÜß
|
||||
GetLineVentas();
|
||||
// PrintLineVentas();
|
||||
}
|
||||
|
||||
} else {
|
||||
if( (CurrRecord - 1) <= 0) BEEP();
|
||||
else { CurrRowVentas1--;
|
||||
|
||||
GetLineVentas();
|
||||
// PrintLineVentas();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void EditCursorVentas(int ShowHide) {
|
||||
|
||||
char Buffer[80];
|
||||
long Beneficio1, Beneficio2, Total;
|
||||
|
||||
setcolor(GRIS_C);
|
||||
setfillstyle(SOLID_FILL, GRIS_C);
|
||||
bar(10, 455, 545, 473);
|
||||
|
||||
|
||||
if (!ShowHide) {
|
||||
setcolor(63);
|
||||
setfillstyle(SOLID_FILL, 63);
|
||||
bar((PVent[CurrColVentas1-1].left+2), PVent[CurrColVentas1-1].up+(CurrRowVentas1-1)*/*15*/12+/*2*/4, PVent[CurrColVentas1-1].right-2, PVent[CurrColVentas1-1].up+/*3*/4+((CurrRowVentas1)-1)*12+10);
|
||||
setcolor(0);
|
||||
} else {
|
||||
setcolor(0);
|
||||
setfillstyle(SOLID_FILL, 0);
|
||||
bar((PVent[CurrColVentas1-1].left+2), PVent[CurrColVentas1-1].up+(CurrRowVentas1-1)*/*15*/12+/*2*/4, PVent[CurrColVentas1-1].right-2, PVent[CurrColVentas1-1].up+/*3*/4+((CurrRowVentas1)-1)*12+10);
|
||||
Texto_Normal
|
||||
}
|
||||
|
||||
if(Ref_no_valid) setcolor(ROJO);
|
||||
|
||||
// struct Ventas_actual { int Ref; long Und_0; long Und_1; };
|
||||
|
||||
|
||||
switch(CurrColVentas1){
|
||||
case 1: //4
|
||||
sprintf(Buffer, "% 5d", Ventas1.Ref );
|
||||
outtextxy( PVent[0].left+2, (PVent[0].up+3)+(CurrRowVentas1-1)*12, Buffer );
|
||||
outtextxy( 15, 455, "Referencia de Producto. 4 digitos m ximo.");
|
||||
break;
|
||||
case 2:
|
||||
outtextxy( PVent[1].left+2, (PVent[1].up+3)+(CurrRowVentas1-1)*12, Ref1.Concepto );
|
||||
outtextxy( 15, 455, "Concepto.");
|
||||
break;
|
||||
case 3: /*d*/
|
||||
sprintf(Buffer, " % 5ld", Ventas1.Und_1); // 4
|
||||
outtextxy( PVent[2].left+2, (PVent[2].up+3)+(CurrRowVentas1-1)*12, Buffer);
|
||||
outtextxy( 15, 455, "Unidades con Cod. 1");
|
||||
break;
|
||||
case 4:
|
||||
Beneficio1 =
|
||||
// Precio de venta al cliente + I.V.A
|
||||
( Ref1.PVP + ( ( Ref1.PVP * Ref1.P2 ) / 100 ) ) -
|
||||
// Precio de unitario de coste + I.V.A
|
||||
( Ref1.P_und + ( ( Ref1.P_und * Ref1.P1 ) / 100 ) );
|
||||
Total = Beneficio1 * Ventas1.Und_1;
|
||||
sprintf(Buffer, " % 9ld", Total); // 4
|
||||
outtextxy( PVent[3].left+2, (PVent[3].up+3)+(CurrRowVentas1-1)*12, Buffer);
|
||||
outtextxy( 15, 455, "Ganancias Brutas Cod. 1");
|
||||
break;
|
||||
case 5: /*d*/
|
||||
sprintf(Buffer, " % 5ld", Ventas1.Und_0); // 4
|
||||
outtextxy( PVent[4].left+2, (PVent[4].up+3)+(CurrRowVentas1-1)*12, Buffer );
|
||||
outtextxy( 15, 455, "Unidades con Cod. 0");
|
||||
break;
|
||||
case 6:
|
||||
Beneficio2 =
|
||||
// Precio de venta al cliente + I.V.A
|
||||
( Ref1.PVP + ( ( Ref1.PVP * Ref1.P2 ) / 100 ) ) -
|
||||
// Precio de unitario de coste + I.V.A
|
||||
( Ref1.P_und /*+ ( ( Stock1.P_und * P1 ) / 100 ) */ );
|
||||
Total = Beneficio2 * Ventas1.Und_0;
|
||||
sprintf(Buffer, " % 9ld", Total); // 4
|
||||
outtextxy( PVent[5].left+2, (PVent[5].up+3)+(CurrRowVentas1-1)*12, Buffer);
|
||||
outtextxy( 15, 455, "Ganancias Brutas Cod. 0");
|
||||
break;
|
||||
case 7: /*d*/
|
||||
sprintf(Buffer, " % 7ld", ( Ventas1.Und_1 + Ventas1.Und_0) ); // 4
|
||||
outtextxy( PVent[6].left+2, (PVent[6].up+3)+(CurrRowVentas1-1)*12, Buffer);
|
||||
outtextxy( 15, 455, "Unidades Totales C¢digos. 1 y 0");
|
||||
break;
|
||||
case 8:
|
||||
Beneficio1 =
|
||||
// Precio de venta al cliente + I.V.A
|
||||
( Ref1.PVP + ( ( Ref1.PVP * Ref1.P2 ) / 100 ) ) -
|
||||
// Precio de unitario de coste + I.V.A
|
||||
( Ref1.P_und + ( ( Ref1.P_und * Ref1.P1 ) / 100 ) );
|
||||
|
||||
Beneficio2 =
|
||||
// Precio de venta al cliente + I.V.A
|
||||
( Ref1.PVP + ( ( Ref1.PVP * Ref1.P2 ) / 100 ) ) -
|
||||
// Precio de unitario de coste + I.V.A
|
||||
( Ref1.P_und /*+ ( ( Stock1.P_und * P1 ) / 100 ) */ );
|
||||
Total = Beneficio1 * Ventas1.Und_1 + Beneficio2 * Ventas1.Und_0;
|
||||
|
||||
sprintf(Buffer, " % 12ld", Total); // 4
|
||||
outtextxy( PVent[7].left+2, (PVent[7].up+3)+(CurrRowVentas1-1)*12, Buffer );
|
||||
outtextxy( 15, 455, "Beneficio Total Bruto.");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PrintLineVentas(void){
|
||||
|
||||
char Buffer[80];
|
||||
long Beneficio1, Beneficio2, Total;
|
||||
|
||||
setcolor(0);
|
||||
setfillstyle(SOLID_FILL, 0);
|
||||
bar((PVent[0].left+2), PVent[0].up+(CurrRowVentas1-1)*12+/*2*/4, PVent[0].right-2, PVent[0].up+(CurrRowVentas1-1)*12+10);
|
||||
bar((PVent[1].left+2), PVent[1].up+(CurrRowVentas1-1)*12+/*2*/4, PVent[1].right-2, PVent[1].up+(CurrRowVentas1-1)*12+10);
|
||||
bar((PVent[2].left+2), PVent[2].up+(CurrRowVentas1-1)*12+/*2*/4, PVent[2].right-2, PVent[2].up+(CurrRowVentas1-1)*12+10);
|
||||
bar((PVent[3].left+2), PVent[3].up+(CurrRowVentas1-1)*12+/*2*/4, PVent[3].right-2, PVent[3].up+(CurrRowVentas1-1)*12+10);
|
||||
bar((PVent[4].left+2), PVent[4].up+(CurrRowVentas1-1)*12+/*2*/4, PVent[4].right-2, PVent[4].up+(CurrRowVentas1-1)*12+10);
|
||||
|
||||
Texto_Normal
|
||||
|
||||
if(Ref_no_valid) setcolor(ROJO);
|
||||
|
||||
sprintf(Buffer, "% 5d", Ventas1.Ref );
|
||||
outtextxy( PVent[0].left+2, (PVent[0].up+3)+(CurrRowVentas1-1)*12, Buffer );
|
||||
outtextxy( PVent[1].left+2, (PVent[1].up+3)+(CurrRowVentas1-1)*12, Ref1.Concepto );
|
||||
/*d*/
|
||||
sprintf(Buffer, " % 5ld", Ventas1.Und_1); // 4
|
||||
outtextxy( PVent[2].left+2, (PVent[2].up+3)+(CurrRowVentas1-1)*12, Buffer);
|
||||
Beneficio1 = ( Ref1.PVP + ( ( Ref1.PVP * Ref1.P2 ) / 100 ) ) - ( Ref1.P_und + ( ( Ref1.P_und * Ref1.P1 ) / 100 ) );
|
||||
// Precio de venta al cliente + I.V.A
|
||||
// ( Ref1.PVP + ( ( Ref1.PVP * Ref1.P2 ) / 100 ) ) -
|
||||
// Precio de unitario de coste + I.V.A
|
||||
// ( Ref1.P_und + ( ( Ref1.P_und * Ref1.P1 ) / 100 ) );
|
||||
Total = Beneficio1 * Ventas1.Und_1;
|
||||
sprintf(Buffer, " % 9ld", Total); // 4
|
||||
outtextxy( PVent[3].left+2, (PVent[3].up+3)+(CurrRowVentas1-1)*12, Buffer);
|
||||
/*d*/
|
||||
sprintf(Buffer, " % 5ld", Ventas1.Und_0); // 4
|
||||
outtextxy( PVent[4].left+2, (PVent[4].up+3)+(CurrRowVentas1-1)*12, Buffer );
|
||||
Beneficio2 = ( Ref1.PVP + ( ( Ref1.PVP * Ref1.P2 ) / 100 ) ) - ( Ref1.P_und );
|
||||
// Precio de venta al cliente + I.V.A
|
||||
// ( Stock1.PVP + ( ( Stock1.PVP * P2 ) / 100 ) ) -
|
||||
// Precio de unitario de coste + I.V.A
|
||||
// ( Stock1.P_und /*+ ( ( Stock1.P_und * P1 ) / 100 ) */ );
|
||||
Total = Beneficio2 * Ventas1.Und_0;
|
||||
sprintf(Buffer, " % 9ld", Total); // 4
|
||||
outtextxy( PVent[5].left+2, (PVent[5].up+3)+(CurrRowVentas1-1)*12, Buffer);
|
||||
/*d*/
|
||||
sprintf(Buffer, " % 7ld", (Ventas1.Und_1 + Ventas1.Und_0) ); // 4
|
||||
outtextxy( PVent[6].left+2, (PVent[6].up+3)+(CurrRowVentas1-1)*12, Buffer);
|
||||
|
||||
Total = Beneficio1 * Ventas1.Und_1 + Beneficio2 * Ventas1.Und_0;
|
||||
sprintf(Buffer, " % 12ld", Total); // 4
|
||||
outtextxy( PVent[7].left+2, (PVent[7].up+3)+(CurrRowVentas1-1)*12, Buffer );
|
||||
|
||||
}
|
||||
|
||||
|
||||
void PrintWholeScreenVentas(void){
|
||||
|
||||
int tmp = CurrRowVentas1;
|
||||
|
||||
for(int i=0; i<8; i++)
|
||||
ImprimeBoton (1, NEGRO, GRIS_O, BLANCO, PVent[i]);
|
||||
|
||||
|
||||
for(CurrRowVentas1 = 1; CurrRowVentas1 < (/*28*/40+1); CurrRowVentas1++)
|
||||
|
||||
if ( (CurrTopLineVentas + CurrRowVentas1 - 1) <= (Ventas1_inx.Fin + 1) ) {
|
||||
GetLineVentas();
|
||||
PrintLineVentas();
|
||||
}
|
||||
|
||||
|
||||
|
||||
CurrRowVentas1 = tmp;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void GetLineVentas(void){
|
||||
|
||||
int LSJ = sizeof(struct JD);
|
||||
int LSI = sizeof(struct Ventas_inx);
|
||||
int LSC = sizeof(struct Ventas_actual);
|
||||
|
||||
int CurrRecord = CurrTopLineVentas + CurrRowVentas1 - 1;
|
||||
|
||||
fseek(Ventas, (long)LSJ + LSI + ( LSC * CurrRecord ) - LSC, SEEK_SET); // Se coloca
|
||||
fread(&Ventas1, LSC, 1, Ventas); // Y lee
|
||||
|
||||
BuscaReferencia(Ventas1.Ref);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Imprimir_Ventas(void){
|
||||
|
||||
int LSJ = sizeof(struct JD);
|
||||
int LSI = sizeof(struct Ventas_inx);
|
||||
int LSC = sizeof(struct Ventas_actual);
|
||||
int lprint = 3, Curr_Ventas = 0;
|
||||
long Beneficio1, Beneficio2, Total1, Total2;
|
||||
if ( Comprueba_Impresora() == 0 ) {
|
||||
Confirma("Error Imprimiendo.", "Impresora Fuera de", "Servicio.");
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf( stdprn, "\n\r");
|
||||
|
||||
fprintf( stdprn, "Ref Concepto Und. 1 V. Bruto 1 Und. 0 V. Bruto 0 Unds Total\n\r");
|
||||
fprintf( stdprn, "ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù\n\r");
|
||||
|
||||
while( (Curr_Ventas <= Ventas1_inx.Fin) ){
|
||||
|
||||
fseek(Ventas, (long)LSJ + LSI + ( LSC * Curr_Ventas ), SEEK_SET); // Se coloca
|
||||
fread(&Ventas1, LSC, 1, Ventas); // Y lee
|
||||
BuscaReferencia(Ventas1.Ref);
|
||||
|
||||
Beneficio1 =
|
||||
// Precio de venta al cliente + I.V.A
|
||||
( Ref1.PVP + ( ( Ref1.PVP * Ref1.P2 ) / 100 ) ) -
|
||||
// Precio de unitario de coste + I.V.A
|
||||
( Ref1.P_und + ( ( Ref1.P_und * Ref1.P1 ) / 100 ) );
|
||||
|
||||
Beneficio2 =
|
||||
// Precio de venta al cliente + I.V.A
|
||||
( Ref1.PVP + ( ( Ref1.PVP * Ref1.P2 ) / 100 ) ) -
|
||||
// Precio de unitario de coste + I.V.A
|
||||
( Ref1.P_und /*+ ( ( Stock1.P_und * P1 ) / 100 ) */ );
|
||||
|
||||
Total1 = (Beneficio1*Ventas1.Und_1);
|
||||
Total2 = (Beneficio2*Ventas1.Und_0);
|
||||
|
||||
fprintf( stdprn, "% 4d %-20s % 4ld", Ventas1.Ref, Ref1.Concepto, Ventas1.Und_1);
|
||||
fprintf( stdprn, " % 8ld % 4ld", Total1, Ventas1.Und_0);
|
||||
fprintf( stdprn, " % 8ld % 8ld\n\r", Total2, ( Ventas1.Und_0 + Ventas1.Und_1 ) );
|
||||
|
||||
lprint++;
|
||||
if (lprint==55) { lprint = 3;
|
||||
fputc(12, stdprn);
|
||||
fprintf( stdprn, "Ref Concepto Und. 1 V. Bruto 1 Und. 0 V. Bruto 0 Unds Total\n\r");
|
||||
fprintf( stdprn, "ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù\n\r");
|
||||
}
|
||||
Curr_Ventas++;
|
||||
}
|
||||
|
||||
fputc(12, stdprn);
|
||||
GetLineVentas();
|
||||
}
|
||||
|
||||
|
||||
void CompruebaLineasVentas(void){
|
||||
// Check una pulsacion sobre un campo, y se situa, si es posible
|
||||
int ok_p=0, inc=0, md=0;
|
||||
int oldr, oldc;
|
||||
// Anclar_Raton();
|
||||
|
||||
do{
|
||||
inc++;
|
||||
if(x_raton >= (PVent[(inc)-1].left+2) && x_raton <= (PVent[inc-1].right-2) ) { ok_p=1; md = 1;
|
||||
oldc=inc; }
|
||||
if(inc==5) ok_p=1;
|
||||
}while(!ok_p);
|
||||
if(md==1){
|
||||
inc=0; ok_p=0; md = 0;
|
||||
do{
|
||||
inc++;
|
||||
if( (y_raton >= (PVent[(oldc)-1].up+4+(inc-1)*15+2)) && (y_raton <= (PVent[oldc-1].up+4+(inc-1)*15+16)) ) { ok_p=1; oldr=inc; md = 1;}
|
||||
if(inc==26) ok_p=1;
|
||||
}while(!ok_p);
|
||||
}
|
||||
int newc;
|
||||
|
||||
switch(oldc){
|
||||
case 1:
|
||||
case 2: newc = oldc; break;
|
||||
case 4:
|
||||
case 5: newc = (oldc - 1); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if( (md==1) && ((CurrColVentas1!=newc) || (CurrRowVentas1!=oldr)) )
|
||||
{
|
||||
|
||||
if( (CurrTopLineVentas + oldr - 2 )<= Ventas1_inx.Fin ){
|
||||
EditCursorVentas(1);
|
||||
switch(oldc){
|
||||
case 1:
|
||||
case 2:
|
||||
CurrColVentas1 = oldc;
|
||||
CurrRowVentas1 = oldr;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
CurrColVentas1 = (oldc-1);
|
||||
CurrRowVentas1 = oldr;
|
||||
break;
|
||||
default:
|
||||
EditCursorVentas(0);
|
||||
break;
|
||||
}
|
||||
GetLineVentas();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
void Lee_Datos_Ganancias(unsigned long *Compras_mes){
|
||||
|
||||
setcolor(ROJO);
|
||||
setfillstyle( SOLID_FILL, ROJO );
|
||||
char Buffer[80];
|
||||
|
||||
CurrTopLineVentas = 1;
|
||||
|
||||
struct date Fecha2;
|
||||
getdate(&Fecha2);
|
||||
|
||||
// struct Ventas_actual { int Ref; long Und_0; long Und_1; };
|
||||
|
||||
for(Fecha=1; Fecha<=12; Fecha++ ){
|
||||
|
||||
sprintf( Buffer, "SV_V%02d%02d.dat", Fecha, (Fecha2.da_year - (Fecha2.da_year/100)*100 ) );
|
||||
|
||||
if( file_exists( Buffer ) ){
|
||||
Abre_Ficha_Ventas();
|
||||
for(CurrRowVentas1 = 1; CurrRowVentas1 <= (Ventas1_inx.Fin + 1); CurrRowVentas1++){
|
||||
|
||||
GetLineVentas();
|
||||
// Codigo 1
|
||||
Compras_mes[ (Fecha - 1)*2 + 1 ] += (Ventas1.Und_1*
|
||||
( ( Ref1.PVP + (( Ref1.PVP * Ref1.P2 ) / 100 )) -
|
||||
(Ref1.P_und + ( ( Ref1.P_und * Ref1.P1 ) / 100 ) ) ) );
|
||||
|
||||
// Codigo 0
|
||||
Compras_mes[ (Fecha - 1)*2 ] += (Ventas1.Und_0*
|
||||
( ( Ref1.PVP + ( ( Ref1.PVP * Ref1.P2 ) / 100 ) ) -
|
||||
( Ref1.P_und ) ) );
|
||||
/*
|
||||
Compras_mes[ (Fecha - 1)*2 + (Ventas1.Cod ? 1 : 0 ) ]
|
||||
+= ( Ventas1.Cod
|
||||
?
|
||||
(((Ref1.P_und * Ref1.P1)/100) + Ref1.P_und)
|
||||
:
|
||||
( Ref1.P_und )
|
||||
)*Ventas1.Und;
|
||||
*/
|
||||
bar(152,372, 152 + (20*(CurrRowVentas1-1)) + ( (/*240*/20*(CurrRowVentas1*100)/(Ventas1_inx.Fin + 1)) / 100 ), 388);
|
||||
// ^----------^
|
||||
}
|
||||
fclose(Ventas);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user