SV/SV_FACT.CPP
2021-09-08 21:43:28 +02:00

148 lines
3.4 KiB
C++

#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);
}