add base_de_datos
This commit is contained in:
commit
10bb6dc2e5
|
|
@ -0,0 +1,3 @@
|
|||
*.class
|
||||
*.log
|
||||
*.tmp
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
# Proyecto No. 3 Base de datos
|
||||
|
||||
## How compile (Java) (Linux)
|
||||
|
||||
### Dependency
|
||||
- Java 17 ([adoptium](https://adoptium.net))
|
||||
- shell
|
||||
- my_sql
|
||||
- maven
|
||||
- make
|
||||
|
||||
#### My Sql
|
||||
|
||||
##### Install
|
||||
```shell
|
||||
sudo apt update
|
||||
sudo apt update -y
|
||||
|
||||
sudo apt install mysql-server -y
|
||||
|
||||
user = root
|
||||
pass = root
|
||||
|
||||
sudo mysql_secure_installation
|
||||
|
||||
|
||||
sudo systemctl start mysql
|
||||
sudo systemctl enable mysql
|
||||
```
|
||||
|
||||
##### Remove
|
||||
```shell
|
||||
sudo apt remove --purge mysql-server mysql-client mysql-common -y
|
||||
sudo rm -rf /etc/mysql /var/lib/mysql
|
||||
sudo apt autoremove -y
|
||||
sudo apt autoclean
|
||||
```
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
.PHONY: sql sql_export
|
||||
|
||||
all:
|
||||
mvn compile exec:java
|
||||
|
||||
compile:
|
||||
mvn clean compile exec:java
|
||||
|
||||
debug:
|
||||
mvn clean compile -q exec:java
|
||||
|
||||
install:
|
||||
mvn clean install
|
||||
|
||||
jar:
|
||||
mvn clean package
|
||||
mkdir -p build
|
||||
cp target/Proy_final_db-0.0.jar build/
|
||||
java -jar build/Proy_final_db-0.0.jar
|
||||
|
||||
clear_exec:
|
||||
mvn clean compile exec:java
|
||||
|
||||
clean:
|
||||
mvn clean
|
||||
rm -rf target
|
||||
rm -f dependency-reduced-pom.xml
|
||||
rm -f reporte_cliente.pdf
|
||||
rm -f reporte_vendedor.pdf
|
||||
|
||||
sql:
|
||||
cd sql && mysql -u root -proot < 1_db.sql
|
||||
cd sql && mysql -u root db -proot < 2_table.sql
|
||||
cd sql && mysql -u root db -proot < 3_insert.sql
|
||||
cd sql && mysql -u root db -proot < 4_debug.sql
|
||||
|
||||
sql_export:
|
||||
cd sql && mysqldump -u root -proot db > backup.sql
|
||||
|
||||
sql_debug:
|
||||
cd sql && mysql -u root db -proot < 4_debug.sql
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||
http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.proy_final</groupId>
|
||||
<artifactId>Proy_final_db</artifactId>
|
||||
<version>0.0</version>
|
||||
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.33</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>net.sf.jasperreports</groupId>
|
||||
<artifactId>jasperreports</artifactId>
|
||||
<version>6.20.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<configuration>
|
||||
<mainClass>com.proy_final.Proy_final_db</mainClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.10.1</version>
|
||||
<configuration>
|
||||
<source>${maven.compiler.source}</source>
|
||||
<target>${maven.compiler.target}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.5.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<transformers>
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||
<mainClass>com.proy_final.Proy_final_db</mainClass>
|
||||
</transformer>
|
||||
</transformers>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
DROP DATABASE IF EXISTS db;
|
||||
CREATE DATABASE db;
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
-- MySql
|
||||
USE db;
|
||||
|
||||
CREATE TABLE Cliente (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
cedula VARCHAR(15),
|
||||
nombre VARCHAR(30),
|
||||
apellido VARCHAR(30),
|
||||
direccion VARCHAR(50),
|
||||
telefono VARCHAR(7),
|
||||
provincia VARCHAR(2),
|
||||
compra_anual NUMERIC(6)
|
||||
);
|
||||
|
||||
CREATE TABLE Vendedor (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
codigo VARCHAR(4),
|
||||
nombre VARCHAR(20),
|
||||
apellido VARCHAR(20),
|
||||
departamento VARCHAR(2),
|
||||
cargo VARCHAR(20),
|
||||
venta_mensual NUMERIC(6),
|
||||
venta_anual NUMERIC(9)
|
||||
);
|
||||
|
||||
CREATE TABLE Provincia (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
codigo VARCHAR(2),
|
||||
descripcion VARCHAR(30)
|
||||
);
|
||||
|
||||
CREATE TABLE Departamento (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
codigo VARCHAR(2),
|
||||
descripcion VARCHAR(30)
|
||||
);
|
||||
|
||||
|
||||
|
||||
-- --------------------------- Unique
|
||||
|
||||
|
||||
ALTER TABLE Provincia
|
||||
ADD CONSTRAINT provincia_unique_codigo
|
||||
UNIQUE (codigo);
|
||||
|
||||
ALTER TABLE Departamento
|
||||
ADD CONSTRAINT departamento_unique_codigo
|
||||
UNIQUE (codigo);
|
||||
|
||||
|
||||
-- ------------------------------- FK
|
||||
|
||||
ALTER TABLE Vendedor
|
||||
ADD CONSTRAINT fk_Vendedor_Departamento
|
||||
FOREIGN KEY (departamento) -- From Vendedor
|
||||
REFERENCES Departamento(codigo);
|
||||
|
||||
ALTER TABLE Cliente
|
||||
ADD CONSTRAINT fk_Cliente_Provincia
|
||||
FOREIGN KEY (provincia) -- From client
|
||||
REFERENCES Provincia(codigo);
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
INSERT INTO Provincia
|
||||
(codigo, descripcion)
|
||||
VALUES
|
||||
('BT', 'Bocas del Toro'),
|
||||
('CO', 'Coclé'),
|
||||
('CL', 'Colón'),
|
||||
('CH', 'Chiriquí'),
|
||||
('DA', 'Darién'),
|
||||
('HE', 'Herrera'),
|
||||
('LS', 'Los Santos'),
|
||||
('PA', 'Panamá'),
|
||||
('VE', 'Veraguas'),
|
||||
('PO', 'Panamá Oeste'),
|
||||
('EW', 'Emberá-Wounaan'),
|
||||
('GY', 'Guna Yala'),
|
||||
('NB', 'Ngöbe-Buglé'),
|
||||
('NT', 'Naso Tjër Di');
|
||||
|
||||
|
||||
|
||||
INSERT INTO Departamento
|
||||
(codigo, descripcion)
|
||||
VALUES
|
||||
('VT', 'Ventas General'),
|
||||
('ET', 'Eletrodomesticos'),
|
||||
('RP', 'Ropa'),
|
||||
('MB', 'Muebles'),
|
||||
('DA', 'Despensa Alimentaria');
|
||||
|
||||
|
||||
|
||||
INSERT INTO Cliente
|
||||
(cedula, nombre, apellido, direccion, telefono, provincia, compra_anual)
|
||||
VALUES
|
||||
('1-268-4633', 'Sol', 'Bayo', 'El Ejido, Los Santos', '9943529', 'BT', 10),
|
||||
('2-368-4693', 'Karto', 'Ukao', 'Carretera Madden, Chilibre', '8943325', 'CO', 2),
|
||||
('3-248-4693', 'Nardo', 'Karmen', 'Centro Comercial Limajo', '4943329', 'CL', 40),
|
||||
('4-265-4693', 'Carmen', 'Leno', 'Zona Libre', '6943329', 'CH', 2),
|
||||
('5-268-6693', 'Rinaldo', 'Oleno', 'Vista Alegre', '8943329', 'DA', 5),
|
||||
('6-268-4793', 'Fernando', 'Halo', 'Vía José A Arango Juan Díaz', '4945329', 'HE', 7),
|
||||
('7-268-4693', 'Karna', 'Leno', 'Cl 7, Sant', '6345329', 'LS', 9),
|
||||
('8-938-4693', 'Cevella', 'Kinto', 'Ave Las Américas', '6745529', 'PA', 10),
|
||||
('1-264-4623', 'Luna', 'Bayo', 'Av Manuel Espinosa B', '6465729', 'BT', 11),
|
||||
('10-233-3692', 'Sermi', 'Cebin', 'Vía Interamericana', '6953579', 'PO', 2),
|
||||
('11-037-4892', 'Yerkin', 'Tea', 'Av Manuel Espinosa B', '6953529', 'EW', 7),
|
||||
('12-237-4892', 'Fulano', 'Tal', 'Av Ramón Arias Bella Vta', '6946529', 'GY', 5),
|
||||
('8-237-4893', 'Herico', 'Dinal', 'Vúa Rdo J Alfaro', '9943629', 'NB', 6),
|
||||
('4-257-4895', 'Kinto', 'Carbo', 'direccion', '9945624', 'NT', 90),
|
||||
('8-237-4890', 'Jaime', 'Gordon', 'direccion', '9933329', 'LS', 23),
|
||||
('5-537-4892', 'Karmen', 'Galeon', 'direccion', '6933329', 'CO', 44),
|
||||
('8-247-4897', 'Chimel', 'Gadol', 'Ave Las Américas', '6935329', 'CH', 55),
|
||||
('8-237-4896', 'Manche', 'Galeno', 'direccion', '3935529', 'HE', 2),
|
||||
('7-267-4497', 'Fernando', 'Viola', 'direccion', '3935529', 'BT', 2),
|
||||
('8-277-4895', 'Gimena', 'Viola', 'direccion', '3943529', 'PO', 2),
|
||||
('8-277-4899', 'Dano', 'Pinto', 'Zona Libre', '6144127', 'LS', 2),
|
||||
('1-277-4839', 'Gergo', 'Cantor', 'direccion', '6143127', 'NB', 2),
|
||||
('8-277-4837', 'Santa', 'Perres', 'direccion', '5143127', 'CO', 2),
|
||||
('5-977-4837', 'Linera', 'Melon', 'direccion', '8923127', 'PA', 2),
|
||||
('8-977-4837', 'Sergio', 'Pinto', 'Centro Comercial Limajo', '8923467', 'CH', 2),
|
||||
('7-937-4837', 'Kamel', 'Seda', 'direccion', '8923467', 'PO', 77),
|
||||
('8-937-4837', 'Jomek', 'Kaker', 'Centro Comercial Limajo', '6423469', 'BT', 2),
|
||||
('12-967-4831', 'Demi', 'Holcen', 'Vía Interamericana', '4244529', 'LS', 2),
|
||||
('8-964-4832', 'Miker', 'Hazar', 'Ave Las Américas', '6443459', 'PO', 2),
|
||||
('11-257-4837', 'Zalmo', 'Chazar', 'direccion', '6944529', 'CH', 2);
|
||||
|
||||
|
||||
|
||||
-- UPDATE Cliente SET id = 1, nombre = "ddd" WHERE id = 1;
|
||||
|
||||
INSERT INTO Vendedor
|
||||
(codigo, nombre, apellido, departamento, cargo, venta_mensual, venta_anual)
|
||||
VALUES
|
||||
("V1", "Kamicho", "Checo", "VT", "Vendedor", 45, 1503),
|
||||
("V2", "Mecha", "Carmen", "VT", "Vendedor", 76, 903),
|
||||
("V3", "Pala", "Sancho", "ET", "Administrador", 54, 603),
|
||||
("V3", "Chomika", "Checo", "VT", "Vendedor", 34, 103),
|
||||
("V4", "Jagero", "Sanches", "DA", "Vendedor", 42, 425),
|
||||
("V5", "Chaigo", "Felero", "MB", "Administrador", 40, 703),
|
||||
("V6", "Gomes", "Migo", "VT", "Vendedor", 44, 303),
|
||||
("V7", "Yakera", "Velada", "ET", "Vendedor", 57, 603),
|
||||
("V8", "Mila", "Karmela", "VT", "Administrador", 77, 555),
|
||||
("V9", "Batera", "Gotas", "VT", "Vendedor", 87, 903),
|
||||
("V10", "Nailo", "Glamo", "DA", "Administrador", 40, 703),
|
||||
("V11", "Florego", "Chargo", "DA", "Vendedor", 40, 803),
|
||||
("V12", "Hiramo", "Maner", "ET", "Vendedor", 40, 303),
|
||||
("V13", "Yamel", "Sojas", "DA", "Vendedor", 40, 703),
|
||||
("V14", "Gamik", "Fata", "VT", "Vendedor", 40, 573),
|
||||
("V15", "Kamicho", "Checo", "MB", "Vendedor", 40, 403),
|
||||
("V16", "Kopero", "Lamira", "VT", "Vendedor", 40, 703),
|
||||
("V17", "Garbedio", "Checo", "RP", "Administrador", 40, 703),
|
||||
("V18", "FLik", "Melino", "MB", "Vendedor", 40, 703),
|
||||
("V19", "Hadina", "Chago", "RP", "Administrador", 40, 903),
|
||||
("V20", "Nigto", "Goto", "VT", "Administrador", 40, 503);
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
|
||||
-- SELECT * FROM Cliente;
|
||||
|
||||
-- SELECT * FROM Cliente WHERE id = 1;
|
||||
|
||||
|
||||
-- SHOW CREATE TABLE Cliente;
|
||||
|
||||
-- SELECT * FROM Cliente
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
-- MySQL dump 10.13 Distrib 8.4.5, for Linux (x86_64)
|
||||
--
|
||||
-- Host: localhost Database: db
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 8.4.5
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!50503 SET NAMES utf8mb4 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
--
|
||||
-- Table structure for table `Cliente`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `Cliente`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!50503 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `Cliente` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`cedula` varchar(15) DEFAULT NULL,
|
||||
`nombre` varchar(30) DEFAULT NULL,
|
||||
`apellido` varchar(30) DEFAULT NULL,
|
||||
`direccion` varchar(50) DEFAULT NULL,
|
||||
`telefono` varchar(7) DEFAULT NULL,
|
||||
`provincia` varchar(2) DEFAULT NULL,
|
||||
`compra_anual` decimal(6,0) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `fk_Cliente_Provincia` (`provincia`),
|
||||
CONSTRAINT `fk_Cliente_Provincia` FOREIGN KEY (`provincia`) REFERENCES `Provincia` (`codigo`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `Cliente`
|
||||
--
|
||||
|
||||
LOCK TABLES `Cliente` WRITE;
|
||||
/*!40000 ALTER TABLE `Cliente` DISABLE KEYS */;
|
||||
INSERT INTO `Cliente` VALUES (1,'1-268-4633','Sol','Bayo','El Ejido, Los Santos','9943529','BT',10),(2,'2-368-4693','Karto','Ukao','Carretera Madden, Chilibre','8943325','CO',2),(3,'3-248-4693','Nardo','Karmen','Centro Comercial Limajo','4943329','CL',40),(4,'4-265-4693','Carmen','Leno','Zona Libre','6943329','CH',2),(5,'5-268-6693','Rinaldo','Oleno','Vista Alegre','8943329','DA',5),(6,'6-268-4793','Fernando','Halo','Vía José A Arango Juan Díaz','4945329','HE',7),(7,'7-268-4693','Karna','Leno','Cl 7, Sant','6345329','LS',9),(8,'8-938-4693','Cevella','Kinto','Ave Las Américas','6745529','PA',10),(9,'1-264-4623','Luna','Bayo','Av Manuel Espinosa B','6465729','BT',11),(10,'10-233-3692','Sermi','Cebin','Vía Interamericana','6953579','PO',2),(11,'11-037-4892','Yerkin','Tea','Av Manuel Espinosa B','6953529','EW',7),(12,'12-237-4892','Fulano','Tal','Av Ramón Arias Bella Vta','6946529','GY',5),(13,'8-237-4893','Herico','Dinal','Vúa Rdo J Alfaro','9943629','NB',6),(14,'4-257-4895','Kinto','Carbo','direccion','9945624','NT',90),(15,'8-237-4890','Jaime','Gordon','direccion','9933329','LS',23),(16,'5-537-4892','Karmen','Galeon','direccion','6933329','CO',44),(17,'8-247-4897','Chimel','Gadol','Ave Las Américas','6935329','CH',55),(18,'8-237-4896','Manche','Galeno','direccion','3935529','HE',2),(19,'7-267-4497','Fernando','Viola','direccion','3935529','BT',2),(20,'8-277-4895','Gimena','Viola','direccion','3943529','PO',2),(21,'8-277-4899','Dano','Pinto','Zona Libre','6144127','LS',2),(22,'1-277-4839','Gergo','Cantor','direccion','6143127','NB',2),(23,'8-277-4837','Santa','Perres','direccion','5143127','CO',2),(24,'5-977-4837','Linera','Melon','direccion','8923127','PA',2),(25,'8-977-4837','Sergio','Pinto','Centro Comercial Limajo','8923467','CH',2),(26,'7-937-4837','Kamel','Seda','direccion','8923467','PO',77),(27,'8-937-4837','Jomek','Kaker','Centro Comercial Limajo','6423469','BT',2),(28,'12-967-4831','Demi','Holcen','Vía Interamericana','4244529','LS',2),(29,'8-964-4832','Miker','Hazar','Ave Las Américas','6443459','PO',2),(30,'11-257-4837','Zalmo','Chazar','direccion','6944529','CH',2);
|
||||
/*!40000 ALTER TABLE `Cliente` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `Departamento`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `Departamento`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!50503 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `Departamento` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`codigo` varchar(2) DEFAULT NULL,
|
||||
`descripcion` varchar(30) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `departamento_unique_codigo` (`codigo`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `Departamento`
|
||||
--
|
||||
|
||||
LOCK TABLES `Departamento` WRITE;
|
||||
/*!40000 ALTER TABLE `Departamento` DISABLE KEYS */;
|
||||
INSERT INTO `Departamento` VALUES (1,'VT','Ventas General'),(2,'ET','Eletrodomesticos'),(3,'RP','Ropa'),(4,'MB','Muebles'),(5,'DA','Despensa Alimentaria');
|
||||
/*!40000 ALTER TABLE `Departamento` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `Provincia`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `Provincia`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!50503 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `Provincia` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`codigo` varchar(2) DEFAULT NULL,
|
||||
`descripcion` varchar(30) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `provincia_unique_codigo` (`codigo`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `Provincia`
|
||||
--
|
||||
|
||||
LOCK TABLES `Provincia` WRITE;
|
||||
/*!40000 ALTER TABLE `Provincia` DISABLE KEYS */;
|
||||
INSERT INTO `Provincia` VALUES (1,'BT','Bocas del Toro'),(2,'CO','Coclé'),(3,'CL','Colón'),(4,'CH','Chiriquí'),(5,'DA','Darién'),(6,'HE','Herrera'),(7,'LS','Los Santos'),(8,'PA','Panamá'),(9,'VE','Veraguas'),(10,'PO','Panamá Oeste'),(11,'EW','Emberá-Wounaan'),(12,'GY','Guna Yala'),(13,'NB','Ngöbe-Buglé'),(14,'NT','Naso Tjër Di');
|
||||
/*!40000 ALTER TABLE `Provincia` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `Vendedor`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `Vendedor`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!50503 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `Vendedor` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`codigo` varchar(4) DEFAULT NULL,
|
||||
`nombre` varchar(20) DEFAULT NULL,
|
||||
`apellido` varchar(20) DEFAULT NULL,
|
||||
`departamento` varchar(2) DEFAULT NULL,
|
||||
`cargo` varchar(20) DEFAULT NULL,
|
||||
`venta_mensual` decimal(6,0) DEFAULT NULL,
|
||||
`venta_anual` decimal(9,0) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `fk_Vendedor_Departamento` (`departamento`),
|
||||
CONSTRAINT `fk_Vendedor_Departamento` FOREIGN KEY (`departamento`) REFERENCES `Departamento` (`codigo`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `Vendedor`
|
||||
--
|
||||
|
||||
LOCK TABLES `Vendedor` WRITE;
|
||||
/*!40000 ALTER TABLE `Vendedor` DISABLE KEYS */;
|
||||
INSERT INTO `Vendedor` VALUES (1,'V1','Kamicho','Checo','VT','Vendedor',45,1503),(2,'V2','Mecha','Carmen','VT','Vendedor',76,903),(3,'V3','Pala','Sancho','ET','Administrador',54,603),(4,'V3','Chomika','Checo','VT','Vendedor',34,103),(5,'V4','Jagero','Sanches','DA','Vendedor',42,425),(6,'V5','Chaigo','Felero','MB','Administrador',40,703),(7,'V6','Gomes','Migo','VT','Vendedor',44,303),(8,'V7','Yakera','Velada','ET','Vendedor',57,603),(9,'V8','Mila','Karmela','VT','Administrador',77,555),(10,'V9','Batera','Gotas','VT','Vendedor',87,903),(11,'V10','Nailo','Glamo','DA','Administrador',40,703),(12,'V11','Florego','Chargo','DA','Vendedor',40,803),(13,'V12','Hiramo','Maner','ET','Vendedor',40,303),(14,'V13','Yamel','Sojas','DA','Vendedor',40,703),(15,'V14','Gamik','Fata','VT','Vendedor',40,573),(16,'V15','Kamicho','Checo','MB','Vendedor',40,403),(17,'V16','Kopero','Lamira','VT','Vendedor',40,703),(18,'V17','Garbedio','Checo','RP','Administrador',40,703),(19,'V18','FLik','Melino','MB','Vendedor',40,703),(20,'V19','Hadina','Chago','RP','Administrador',40,903),(21,'V20','Nigto','Goto','VT','Administrador',40,503);
|
||||
/*!40000 ALTER TABLE `Vendedor` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2025-07-31 10:40:35
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.proy_final;
|
||||
|
||||
import com.proy_final.mod.Init;
|
||||
|
||||
public class Proy_final_db {
|
||||
public static void main(String[] args) {
|
||||
System.out.printf("Proy_final_db%n");
|
||||
|
||||
Init init = new Init();
|
||||
init.start();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
|
||||
package com.proy_final.mod;
|
||||
|
||||
import com.proy_final.mod.db.DataBase;
|
||||
|
||||
import com.proy_final.mod.uil.menu.NavBar;
|
||||
import com.proy_final.mod.util.settings.Global;
|
||||
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
public class Init extends JFrame implements ActionListener {
|
||||
|
||||
|
||||
|
||||
|
||||
public Init() {
|
||||
this.setTitle("Proy Final");
|
||||
this.setLayout(null);
|
||||
this.setVisible(true);
|
||||
this.setBounds(
|
||||
0,
|
||||
0,
|
||||
1000,
|
||||
900
|
||||
);
|
||||
if (Global.DEBUG) {
|
||||
this.getContentPane().setBackground(Color.GREEN);
|
||||
}
|
||||
this.setExtendedState(JFrame.MAXIMIZED_BOTH);
|
||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void start() {
|
||||
|
||||
this.setJMenuBar(new NavBar(this));
|
||||
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,129 @@
|
|||
package com.proy_final.mod.db;
|
||||
|
||||
import java.sql.*;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.io.InputStream;
|
||||
|
||||
import net.sf.jasperreports.engine.*;
|
||||
import net.sf.jasperreports.view.*;
|
||||
|
||||
public class DataBase {
|
||||
|
||||
private String url, user, pass, sql;
|
||||
private Connection connection;
|
||||
private Statement statement;
|
||||
private ResultSet result_set;
|
||||
|
||||
|
||||
public DataBase() {
|
||||
url = "jdbc:mysql://127.0.0.1:3306/db";
|
||||
user = "root";
|
||||
pass = "root";
|
||||
}
|
||||
|
||||
|
||||
public void open() {
|
||||
try {
|
||||
connection = DriverManager.getConnection(url, user, pass);
|
||||
statement = connection.createStatement();
|
||||
System.out.println("Ok: Database ");
|
||||
} catch(Exception e) {
|
||||
System.out.println("Err: Database: "+e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void close() {
|
||||
try {
|
||||
if (result_set != null) {
|
||||
result_set.close();
|
||||
statement.close();
|
||||
connection.close();
|
||||
}
|
||||
} catch(Exception e){
|
||||
System.out.println("error cerrar "+e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ResultSet executeQuery(String sql) {
|
||||
try {
|
||||
this.open();
|
||||
this.result_set = statement.executeQuery(sql);
|
||||
|
||||
} catch(Exception e) {
|
||||
System.out.println("error queryBD " + e.toString());
|
||||
}
|
||||
return this.result_set;
|
||||
}
|
||||
|
||||
|
||||
public void executeUpdate(String sql) {
|
||||
try {
|
||||
this.open();
|
||||
|
||||
statement.executeUpdate(sql);
|
||||
|
||||
this.close();
|
||||
} catch(Exception e) {
|
||||
System.out.println("error update " + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public Connection getConnection() { return connection; }
|
||||
|
||||
|
||||
|
||||
public static enum EnumReporteType {
|
||||
REPORTECLIENTE,
|
||||
REPORTEVENDEDOR
|
||||
}
|
||||
|
||||
public void reporte(String orden, EnumReporteType reporte_type) {
|
||||
|
||||
try{
|
||||
this.open();
|
||||
|
||||
|
||||
Map<String, Object> parametro = new HashMap<String, Object>();
|
||||
parametro.put("orden", orden);
|
||||
|
||||
InputStream input;
|
||||
switch (reporte_type) {
|
||||
case REPORTECLIENTE:
|
||||
input = getClass().getResourceAsStream("/reports/reporte_cliente.jrxml");
|
||||
break;
|
||||
case REPORTEVENDEDOR:
|
||||
input = getClass().getResourceAsStream("/reports/reporte_vendedor.jrxml");
|
||||
break;
|
||||
default:
|
||||
input = getClass().getResourceAsStream("/reports/reporte_none.jrxml");
|
||||
break;
|
||||
}
|
||||
|
||||
JasperReport jasperReport = JasperCompileManager.compileReport(input);
|
||||
|
||||
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parametro, this.connection);
|
||||
|
||||
|
||||
switch (reporte_type) {
|
||||
case REPORTECLIENTE:
|
||||
JasperExportManager.exportReportToPdfFile(jasperPrint, "reporte_cliente.pdf");
|
||||
break;
|
||||
|
||||
case REPORTEVENDEDOR:
|
||||
JasperExportManager.exportReportToPdfFile(jasperPrint, "reporte_vendedor.pdf");
|
||||
break;
|
||||
|
||||
default:
|
||||
JasperExportManager.exportReportToPdfFile(jasperPrint, "reporte_none.pdf");
|
||||
break;
|
||||
}
|
||||
} catch(Exception e) {
|
||||
System.out.println(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,505 @@
|
|||
package com.proy_final.mod.template;
|
||||
|
||||
import com.proy_final.mod.db.DataBase;
|
||||
import com.proy_final.mod.util.data.Departamento;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import java.sql.*;
|
||||
|
||||
public class Persona {
|
||||
protected String id;
|
||||
protected String nombre;
|
||||
protected String apellido;
|
||||
|
||||
|
||||
protected String sql_command;
|
||||
protected List<String> sql_variables_list = new ArrayList<>();
|
||||
|
||||
|
||||
public List<String> getVariableList() { return this.sql_variables_list; }
|
||||
|
||||
public void setVariableList(List<String> sql_variables_list) { this.sql_variables_list = sql_variables_list; };
|
||||
|
||||
public void setSelfType(EnumPersona self_type) {
|
||||
this.self_type = self_type;
|
||||
}
|
||||
|
||||
protected EnumPersona self_type = EnumPersona.PERSONA;
|
||||
public enum EnumPersona {
|
||||
PERSONA,
|
||||
CLIENTE,
|
||||
VENDEDOR
|
||||
}
|
||||
|
||||
public enum EnumVendedor {
|
||||
VENDEDORID,
|
||||
VENDEDORCODIGO,
|
||||
VENDEDORNOMBRE,
|
||||
VENDEDORAPELLIDO,
|
||||
VENDEDORDEPARTAMENTO,
|
||||
VENDEDORCARGO,
|
||||
VENDEDORVENTAMENSUAL,
|
||||
VENDEDORVENTAANUAL
|
||||
}
|
||||
|
||||
public enum EnumCliente {
|
||||
CLIENTEID,
|
||||
CLIENTECEDULA,
|
||||
CLIENTENOMBRE,
|
||||
CLIENTEAPELLIDO,
|
||||
CLIENTEDIRECCION,
|
||||
CLIENTETELEFONO,
|
||||
CLIENTEPROVINCIA,
|
||||
CLIENTECOMPRAANUAL
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public Persona() {}
|
||||
|
||||
|
||||
public void setDBTableAdd() {
|
||||
switch (this.self_type) {
|
||||
case CLIENTE:
|
||||
this.sql_command = String.format("""
|
||||
INSERT INTO Cliente (cedula, nombre, apellido, direccion, telefono, provincia, compra_anual)
|
||||
VALUES ('%s', '%s', '%s', '%s', '%s', '%s', %s);""",
|
||||
|
||||
this.sql_variables_list.get(EnumCliente.CLIENTECEDULA.ordinal()),
|
||||
this.sql_variables_list.get(EnumCliente.CLIENTENOMBRE.ordinal()),
|
||||
this.sql_variables_list.get(EnumCliente.CLIENTEAPELLIDO.ordinal()),
|
||||
this.sql_variables_list.get(EnumCliente.CLIENTEDIRECCION.ordinal()),
|
||||
this.sql_variables_list.get(EnumCliente.CLIENTETELEFONO.ordinal()),
|
||||
this.sql_variables_list.get(EnumCliente.CLIENTEPROVINCIA.ordinal()),
|
||||
this.sql_variables_list.get(EnumCliente.CLIENTECOMPRAANUAL.ordinal())
|
||||
);
|
||||
break;
|
||||
|
||||
case VENDEDOR:
|
||||
this.sql_command = String.format("""
|
||||
INSERT INTO Vendedor (codigo, nombre, apellido, departamento, cargo, venta_mensual, venta_anual)
|
||||
VALUES ('%s', '%s', '%s', '%s', '%s', %s, %s);""",
|
||||
|
||||
this.sql_variables_list.get(EnumVendedor.VENDEDORCODIGO.ordinal()),
|
||||
this.sql_variables_list.get(EnumVendedor.VENDEDORNOMBRE.ordinal()),
|
||||
this.sql_variables_list.get(EnumVendedor.VENDEDORAPELLIDO.ordinal()),
|
||||
this.sql_variables_list.get(EnumVendedor.VENDEDORDEPARTAMENTO.ordinal()),
|
||||
this.sql_variables_list.get(EnumVendedor.VENDEDORCARGO.ordinal()),
|
||||
this.sql_variables_list.get(EnumVendedor.VENDEDORVENTAMENSUAL.ordinal()),
|
||||
this.sql_variables_list.get(EnumVendedor.VENDEDORVENTAANUAL.ordinal())
|
||||
);
|
||||
|
||||
System.out.println(this.sql_command);
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
new DataBase().executeUpdate(this.sql_command);
|
||||
JOptionPane.showMessageDialog(
|
||||
null,
|
||||
"El registro se grabo",
|
||||
"Agregar status",
|
||||
JOptionPane.INFORMATION_MESSAGE
|
||||
);
|
||||
}
|
||||
|
||||
public void setDBDelete() {
|
||||
|
||||
switch (this.self_type) {
|
||||
case CLIENTE:
|
||||
this.sql_command = String.format("DELETE FROM Cliente WHERE id = %s;", this.id);
|
||||
System.out.println(sql_command);
|
||||
System.out.println(this.id);
|
||||
|
||||
break;
|
||||
|
||||
case VENDEDOR:
|
||||
this.sql_command = String.format("DELETE FROM Vendedor WHERE id = %s;", this.id);
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
new DataBase().executeUpdate(this.sql_command);
|
||||
JOptionPane.showMessageDialog(
|
||||
null,
|
||||
"El registro se elimino",
|
||||
"Eliminar status",
|
||||
JOptionPane.INFORMATION_MESSAGE
|
||||
);
|
||||
}
|
||||
|
||||
public void setDBUpdate() {
|
||||
|
||||
switch (this.self_type) {
|
||||
case CLIENTE:
|
||||
try {
|
||||
if (this.sql_variables_list.get(EnumCliente.CLIENTETELEFONO.ordinal()).equals("")) {
|
||||
this.sql_variables_list.set(EnumCliente.CLIENTETELEFONO.ordinal(), "0");
|
||||
}
|
||||
|
||||
if (this.sql_variables_list.get(EnumCliente.CLIENTECOMPRAANUAL.ordinal()).equals("")) {
|
||||
this.sql_variables_list.set(EnumCliente.CLIENTECOMPRAANUAL.ordinal(), "0");
|
||||
}
|
||||
|
||||
|
||||
// System.out.println("------------------");
|
||||
// System.out.println("Variables");
|
||||
// for (String list : sql_variables_list) {
|
||||
// System.out.println(list);
|
||||
// }
|
||||
// System.out.println("------------------");
|
||||
|
||||
this.sql_command = String.format("""
|
||||
UPDATE Cliente
|
||||
SET cedula = '%s', nombre = '%s', apellido = '%s', direccion = '%s', telefono = '%s', provincia = '%s', compra_anual = %s
|
||||
WHERE id = %s;""",
|
||||
|
||||
this.sql_variables_list.get(EnumCliente.CLIENTECEDULA.ordinal()),
|
||||
this.sql_variables_list.get(EnumCliente.CLIENTENOMBRE.ordinal()),
|
||||
this.sql_variables_list.get(EnumCliente.CLIENTEAPELLIDO.ordinal()),
|
||||
this.sql_variables_list.get(EnumCliente.CLIENTEDIRECCION.ordinal()),
|
||||
this.sql_variables_list.get(EnumCliente.CLIENTETELEFONO.ordinal()),
|
||||
this.sql_variables_list.get(EnumCliente.CLIENTEPROVINCIA.ordinal()),
|
||||
this.sql_variables_list.get(EnumCliente.CLIENTECOMPRAANUAL.ordinal()),
|
||||
|
||||
this.sql_variables_list.get(EnumCliente.CLIENTEID.ordinal())
|
||||
);
|
||||
|
||||
|
||||
System.out.println(this.sql_variables_list.get(EnumCliente.CLIENTETELEFONO.ordinal()));
|
||||
|
||||
|
||||
System.out.println(this.sql_command);
|
||||
|
||||
} catch(Exception e) {
|
||||
System.out.println("Error select: " + e.toString());
|
||||
}
|
||||
break;
|
||||
|
||||
case VENDEDOR:
|
||||
try {
|
||||
|
||||
if (this.sql_variables_list.get(EnumVendedor.VENDEDORVENTAMENSUAL.ordinal()).equals("")) {
|
||||
this.sql_variables_list.set(EnumVendedor.VENDEDORVENTAMENSUAL.ordinal(), "0");
|
||||
}
|
||||
|
||||
if (this.sql_variables_list.get(EnumVendedor.VENDEDORVENTAANUAL.ordinal()).equals("")) {
|
||||
this.sql_variables_list.set(EnumVendedor.VENDEDORVENTAANUAL.ordinal(), "0");
|
||||
}
|
||||
|
||||
this.sql_command = String.format("""
|
||||
UPDATE Vendedor
|
||||
SET codigo = '%s', nombre = '%s', apellido = '%s', departamento = '%s', cargo = '%s', venta_mensual = '%s', venta_anual = %s
|
||||
WHERE id = %s;""",
|
||||
|
||||
|
||||
this.sql_variables_list.get(EnumVendedor.VENDEDORCODIGO.ordinal()),
|
||||
this.sql_variables_list.get(EnumVendedor.VENDEDORNOMBRE.ordinal()),
|
||||
this.sql_variables_list.get(EnumVendedor.VENDEDORAPELLIDO.ordinal()),
|
||||
this.sql_variables_list.get(EnumVendedor.VENDEDORDEPARTAMENTO.ordinal()),
|
||||
this.sql_variables_list.get(EnumVendedor.VENDEDORCARGO.ordinal()),
|
||||
this.sql_variables_list.get(EnumVendedor.VENDEDORVENTAMENSUAL.ordinal()),
|
||||
this.sql_variables_list.get(EnumVendedor.VENDEDORVENTAANUAL.ordinal()),
|
||||
this.sql_variables_list.get(EnumVendedor.VENDEDORID.ordinal())
|
||||
|
||||
|
||||
);
|
||||
|
||||
} catch(Exception e) {
|
||||
System.out.println("Error select: " + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
new DataBase().executeUpdate(sql_command);
|
||||
JOptionPane.showMessageDialog(
|
||||
null,
|
||||
"El registro se modifico",
|
||||
"Modificar status",
|
||||
JOptionPane.INFORMATION_MESSAGE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public List<Persona> getDBTableWhere() {
|
||||
List<Persona> list_table_where = new ArrayList<>();
|
||||
|
||||
switch (this.self_type) {
|
||||
case CLIENTE:
|
||||
try {
|
||||
|
||||
this.sql_command = String.format("SELECT * FROM Cliente WHERE cedula = '%s';", sql_variables_list.get(EnumCliente.CLIENTECEDULA.ordinal()));
|
||||
|
||||
|
||||
System.out.println(this.sql_command);
|
||||
ResultSet result_set = new DataBase().executeQuery(this.sql_command);
|
||||
|
||||
while (result_set.next()) {
|
||||
Persona persona_cliente = new Persona();
|
||||
|
||||
List<String> list_tmp = persona_cliente.getVariableList();
|
||||
|
||||
list_tmp.add(result_set.getString("id"));
|
||||
list_tmp.add(result_set.getString("cedula"));
|
||||
list_tmp.add(result_set.getString("nombre"));
|
||||
list_tmp.add(result_set.getString("apellido"));
|
||||
list_tmp.add(result_set.getString("direccion"));
|
||||
list_tmp.add(result_set.getString("telefono"));
|
||||
list_tmp.add(result_set.getString("provincia"));
|
||||
list_tmp.add(result_set.getString("compra_anual"));
|
||||
|
||||
persona_cliente.setVariableList(list_tmp);
|
||||
|
||||
list_table_where.add(persona_cliente);
|
||||
|
||||
}
|
||||
|
||||
result_set.close();
|
||||
|
||||
} catch(Exception e) {
|
||||
System.out.println("Error select: " + e.toString());
|
||||
}
|
||||
break;
|
||||
|
||||
case VENDEDOR:
|
||||
try {
|
||||
|
||||
this.sql_command = String.format("SELECT * FROM Vendedor WHERE codigo = '%s';", sql_variables_list.get(EnumCliente.CLIENTECEDULA.ordinal()));
|
||||
|
||||
System.out.println(this.sql_command);
|
||||
ResultSet result_set = new DataBase().executeQuery(this.sql_command);
|
||||
|
||||
while (result_set.next()) {
|
||||
Persona persona_vendedor = new Persona();
|
||||
|
||||
List<String> list_tmp = persona_vendedor.getVariableList();
|
||||
|
||||
list_tmp.add(result_set.getString("id"));
|
||||
list_tmp.add(result_set.getString("codigo"));
|
||||
list_tmp.add(result_set.getString("nombre"));
|
||||
list_tmp.add(result_set.getString("apellido"));
|
||||
list_tmp.add(result_set.getString("departamento"));
|
||||
list_tmp.add(result_set.getString("cargo"));
|
||||
list_tmp.add(result_set.getString("venta_mensual"));
|
||||
list_tmp.add(result_set.getString("venta_anual"));
|
||||
|
||||
persona_vendedor.setVariableList(list_tmp);
|
||||
|
||||
list_table_where.add(persona_vendedor);
|
||||
|
||||
}
|
||||
|
||||
result_set.close();
|
||||
|
||||
} catch(Exception e) {
|
||||
System.out.println("Error select: " + e.toString());
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return list_table_where;
|
||||
}
|
||||
|
||||
public List<Persona> getDBTableAll() {
|
||||
List<Persona> list_table_all = new ArrayList<>();
|
||||
|
||||
switch (this.self_type) {
|
||||
case CLIENTE:
|
||||
try {
|
||||
|
||||
this.sql_command = "SELECT * FROM Cliente;";
|
||||
|
||||
ResultSet result_set = new DataBase().executeQuery(this.sql_command);
|
||||
|
||||
|
||||
while (result_set.next()) {
|
||||
Persona persona_cliente = new Persona();
|
||||
|
||||
List<String> list_tmp = persona_cliente.getVariableList();
|
||||
|
||||
list_tmp.add(result_set.getString("id"));
|
||||
list_tmp.add(result_set.getString("cedula"));
|
||||
list_tmp.add(result_set.getString("nombre"));
|
||||
list_tmp.add(result_set.getString("apellido"));
|
||||
list_tmp.add(result_set.getString("direccion"));
|
||||
list_tmp.add(result_set.getString("telefono"));
|
||||
list_tmp.add(result_set.getString("provincia"));
|
||||
list_tmp.add(result_set.getString("compra_anual"));
|
||||
|
||||
persona_cliente.setVariableList(list_tmp);
|
||||
|
||||
list_table_all.add(persona_cliente);
|
||||
}
|
||||
|
||||
result_set.close();
|
||||
|
||||
} catch(Exception e) {
|
||||
System.out.println("Error select: " + e.toString());
|
||||
}
|
||||
break;
|
||||
|
||||
case VENDEDOR:
|
||||
try {
|
||||
|
||||
this.sql_command = "SELECT * FROM Vendedor;";
|
||||
|
||||
ResultSet result_set = new DataBase().executeQuery(this.sql_command);
|
||||
|
||||
|
||||
while (result_set.next()) {
|
||||
Persona persona_vendedor = new Persona();
|
||||
|
||||
List<String> list_tmp = persona_vendedor.getVariableList();
|
||||
|
||||
list_tmp.add(result_set.getString("id"));
|
||||
list_tmp.add(result_set.getString("codigo"));
|
||||
list_tmp.add(result_set.getString("nombre"));
|
||||
list_tmp.add(result_set.getString("apellido"));
|
||||
list_tmp.add(result_set.getString("departamento"));
|
||||
list_tmp.add(result_set.getString("cargo"));
|
||||
list_tmp.add(result_set.getString("venta_mensual"));
|
||||
list_tmp.add(result_set.getString("venta_anual"));
|
||||
|
||||
persona_vendedor.setVariableList(list_tmp);
|
||||
|
||||
list_table_all.add(persona_vendedor);
|
||||
}
|
||||
|
||||
result_set.close();
|
||||
|
||||
} catch(Exception e) {
|
||||
System.out.println("Error select: " + e.toString());
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
list_table_all.add(new Persona());
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return list_table_all;
|
||||
}
|
||||
|
||||
|
||||
public String[] getDBTableTitleRow() {
|
||||
String[] row_table_title = new String[0];
|
||||
|
||||
|
||||
switch (this.self_type) {
|
||||
case CLIENTE:
|
||||
row_table_title = new String[] {
|
||||
"ID",
|
||||
"Cedula",
|
||||
"Nombre",
|
||||
"Apellido",
|
||||
"Direccion",
|
||||
"Telefono",
|
||||
"Provincia",
|
||||
"Compra Anual"
|
||||
};
|
||||
break;
|
||||
|
||||
case VENDEDOR:
|
||||
row_table_title = new String[] {
|
||||
"ID",
|
||||
"Codigo",
|
||||
"Nombre",
|
||||
"Apellido",
|
||||
"Departamento",
|
||||
"Cargo",
|
||||
"Venta Mensuales",
|
||||
"venta Anual"
|
||||
};
|
||||
break;
|
||||
|
||||
default:
|
||||
System.out.println(this.self_type);
|
||||
row_table_title = new String[] {
|
||||
"NULL",
|
||||
};
|
||||
break;
|
||||
}
|
||||
return row_table_title;
|
||||
}
|
||||
|
||||
|
||||
public String[] getDBTableRow() {
|
||||
String[] row_table_row;
|
||||
|
||||
switch (this.self_type) {
|
||||
case CLIENTE:
|
||||
row_table_row = new String[] {
|
||||
this.sql_variables_list.get(EnumCliente.CLIENTEID.ordinal()),
|
||||
this.sql_variables_list.get(EnumCliente.CLIENTECEDULA.ordinal()),
|
||||
this.sql_variables_list.get(EnumCliente.CLIENTENOMBRE.ordinal()),
|
||||
this.sql_variables_list.get(EnumCliente.CLIENTEAPELLIDO.ordinal()),
|
||||
this.sql_variables_list.get(EnumCliente.CLIENTEDIRECCION.ordinal()),
|
||||
this.sql_variables_list.get(EnumCliente.CLIENTETELEFONO.ordinal()),
|
||||
this.sql_variables_list.get(EnumCliente.CLIENTEPROVINCIA.ordinal()),
|
||||
this.sql_variables_list.get(EnumCliente.CLIENTECOMPRAANUAL.ordinal())
|
||||
};
|
||||
break;
|
||||
|
||||
case VENDEDOR:
|
||||
row_table_row = new String[] {
|
||||
this.sql_variables_list.get(EnumVendedor.VENDEDORID.ordinal()),
|
||||
this.sql_variables_list.get(EnumVendedor.VENDEDORCODIGO.ordinal()),
|
||||
this.sql_variables_list.get(EnumVendedor.VENDEDORNOMBRE.ordinal()),
|
||||
this.sql_variables_list.get(EnumVendedor.VENDEDORAPELLIDO.ordinal()),
|
||||
this.sql_variables_list.get(EnumVendedor.VENDEDORDEPARTAMENTO.ordinal()),
|
||||
this.sql_variables_list.get(EnumVendedor.VENDEDORCARGO.ordinal()),
|
||||
this.sql_variables_list.get(EnumVendedor.VENDEDORVENTAMENSUAL.ordinal()),
|
||||
this.sql_variables_list.get(EnumVendedor.VENDEDORVENTAANUAL.ordinal())
|
||||
};
|
||||
break;
|
||||
|
||||
default:
|
||||
row_table_row = new String[] {
|
||||
"null"
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
||||
return row_table_row;
|
||||
}
|
||||
|
||||
|
||||
public String getVendedorID() { return this.sql_variables_list.get(EnumVendedor.VENDEDORID.ordinal()); }
|
||||
public String getVendedorCodigo() { return this.sql_variables_list.get(EnumVendedor.VENDEDORCODIGO.ordinal()); }
|
||||
public String getVendedorNombre() { return this.sql_variables_list.get(EnumVendedor.VENDEDORNOMBRE.ordinal()); }
|
||||
public String getVendedorApellido() { return this.sql_variables_list.get(EnumVendedor.VENDEDORAPELLIDO.ordinal()); }
|
||||
public String getVendedorCargo() { return this.sql_variables_list.get(EnumVendedor.VENDEDORCARGO.ordinal()); }
|
||||
public String getVendedorDepartamento() { return this.sql_variables_list.get(EnumVendedor.VENDEDORDEPARTAMENTO.ordinal()); }
|
||||
public String getVendedorVentaMensual() { return this.sql_variables_list.get(EnumVendedor.VENDEDORVENTAMENSUAL.ordinal()); }
|
||||
public String getVendedorVentaAnual() { return this.sql_variables_list.get(EnumVendedor.VENDEDORVENTAANUAL.ordinal()); }
|
||||
|
||||
|
||||
public String getClienteID() { return this.sql_variables_list.get(EnumCliente.CLIENTEID.ordinal()); }
|
||||
public String getClienteCedula() { return this.sql_variables_list.get(EnumCliente.CLIENTECEDULA.ordinal()); }
|
||||
public String getClienteNombre() { return this.sql_variables_list.get(EnumCliente.CLIENTENOMBRE.ordinal()); }
|
||||
public String getClienteApellido() { return this.sql_variables_list.get(EnumCliente.CLIENTEAPELLIDO.ordinal()); }
|
||||
public String getClienteDirrecion() { return this.sql_variables_list.get(EnumCliente.CLIENTEDIRECCION.ordinal()); }
|
||||
public String getClienteTelefono() { return this.sql_variables_list.get(EnumCliente.CLIENTETELEFONO.ordinal()); }
|
||||
public String getClienteProvincia() { return this.sql_variables_list.get(EnumCliente.CLIENTEPROVINCIA.ordinal()); }
|
||||
public String getClienteCompraAnual() { return this.sql_variables_list.get(EnumCliente.CLIENTECOMPRAANUAL.ordinal()); }
|
||||
|
||||
|
||||
public String getID() { return this.id; }
|
||||
public String getNombre() { return this.nombre; }
|
||||
public String getApellido() { return this.apellido; }
|
||||
|
||||
public void setID(String id) { this.id = id; }
|
||||
public void setNombre(String nombre) { this.nombre = nombre; }
|
||||
public void setApellido(String apellido) { this.apellido = apellido; }
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.proy_final.mod.template;
|
||||
|
||||
|
||||
public class Ubicacion {
|
||||
protected int id;
|
||||
protected String codigo;
|
||||
protected String descripcion;
|
||||
}
|
||||
|
|
@ -0,0 +1,195 @@
|
|||
package com.proy_final.mod.util.data;
|
||||
|
||||
import com.proy_final.mod.template.Persona;
|
||||
import com.proy_final.mod.db.DataBase;
|
||||
import com.proy_final.mod.util.data.Provincia;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import java.sql.*;
|
||||
|
||||
public class Cliente extends Persona {
|
||||
private String id;
|
||||
private String cedula;
|
||||
private String direccion;
|
||||
private String telefono;
|
||||
private String provincia;
|
||||
private String compra_anual;
|
||||
|
||||
|
||||
|
||||
public Cliente() {
|
||||
this.self_type = EnumPersona.CLIENTE;
|
||||
this.id = "";
|
||||
this.cedula = "";
|
||||
this.nombre = "";
|
||||
this.apellido = "";
|
||||
this.direccion = "";
|
||||
this.telefono = "";
|
||||
this.provincia = "";
|
||||
this.compra_anual = "";
|
||||
}
|
||||
|
||||
public Cliente(
|
||||
String id,
|
||||
String cedula,
|
||||
String nombre,
|
||||
String apellido,
|
||||
String direccion,
|
||||
String telefono,
|
||||
String provincia,
|
||||
String compra_anual
|
||||
) {
|
||||
|
||||
{
|
||||
this.self_type = EnumPersona.CLIENTE;
|
||||
this.id = id;
|
||||
this.nombre = nombre;
|
||||
this.apellido = apellido;
|
||||
}
|
||||
|
||||
{
|
||||
this.cedula = cedula;
|
||||
this.direccion = direccion;
|
||||
this.telefono = telefono;
|
||||
this.provincia = provincia;
|
||||
this.compra_anual = compra_anual;
|
||||
}
|
||||
}
|
||||
|
||||
public String[] getArrayVarString() {
|
||||
String[] var_array = new String[] {
|
||||
"ID",
|
||||
"Cedula",
|
||||
"Nombre",
|
||||
"Apellido",
|
||||
"Direccion",
|
||||
"Telefono",
|
||||
"Provincia",
|
||||
"Compra anual",
|
||||
};
|
||||
|
||||
return var_array;
|
||||
}
|
||||
|
||||
public void addClienteTable() {
|
||||
|
||||
this.provincia = new Provincia().getRealProvinciaDB(this.provincia);
|
||||
|
||||
|
||||
String sql_command = String.format("INSERT INTO Cliente (cedula, nombre, apellido, direccion, telefono, provincia, compra_anual) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', %s);", this.cedula, this.nombre, this.apellido, this.direccion, this.telefono, this.provincia, this.compra_anual);
|
||||
new DataBase().executeUpdate(sql_command);
|
||||
}
|
||||
|
||||
public void updateClienteTable() {
|
||||
|
||||
this.provincia = new Provincia().getRealProvinciaDB(this.provincia);
|
||||
|
||||
|
||||
if (this.compra_anual.equals("")) {
|
||||
this.compra_anual = "0";
|
||||
}
|
||||
// cedula, nombre, apellido, direccion, telefono, provincia, compra_anual
|
||||
String sql_command = String.format("UPDATE Cliente SET cedula = '%s', nombre = '%s', apellido = '%s', direccion = '%s', telefono = '%s', provincia = '%s', compra_anual = %s WHERE id = %s;", this.cedula, this.nombre, this.apellido, this.direccion, this.telefono, this.provincia, this.compra_anual, this.id);
|
||||
System.out.println(sql_command);
|
||||
|
||||
new DataBase().executeUpdate(sql_command);
|
||||
}
|
||||
|
||||
|
||||
public void deleteClienteTable() {
|
||||
String sql_command = String.format("DELETE FROM Cliente WHERE id = %s;", this.id);
|
||||
new DataBase().executeUpdate(sql_command);
|
||||
}
|
||||
|
||||
public List<Cliente> getClientTableSelectWhere(String sql_command) {
|
||||
List<Cliente> list_cliente = new ArrayList<>();
|
||||
try {
|
||||
ResultSet result_set;
|
||||
DataBase data_base = new DataBase();
|
||||
|
||||
String sql_command_to_execute = String.format("SELECT * FROM Cliente WHERE cedula = '%s';", sql_command);
|
||||
|
||||
result_set = data_base.executeQuery(sql_command_to_execute);
|
||||
while (result_set.next()) {
|
||||
list_cliente.add(
|
||||
new Cliente(
|
||||
result_set.getString("id"),
|
||||
result_set.getString("cedula"),
|
||||
result_set.getString("nombre"),
|
||||
result_set.getString("apellido"),
|
||||
result_set.getString("direccion"),
|
||||
result_set.getString("telefono"),
|
||||
result_set.getString("provincia"),
|
||||
result_set.getString("compra_anual")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
result_set.close();
|
||||
data_base.close();
|
||||
} catch(Exception e) {
|
||||
System.out.println("Error select: " + e.toString());
|
||||
}
|
||||
|
||||
return list_cliente;
|
||||
}
|
||||
|
||||
public List<Cliente> getClientTable() {
|
||||
List<Cliente> list_cliente = new ArrayList<>();
|
||||
try {
|
||||
ResultSet result_set;
|
||||
DataBase data_base = new DataBase();
|
||||
String sql_command = "select * from Cliente;";
|
||||
|
||||
result_set = data_base.executeQuery(sql_command);
|
||||
|
||||
|
||||
while (result_set.next()) {
|
||||
list_cliente.add(
|
||||
new Cliente(
|
||||
result_set.getString("id"),
|
||||
result_set.getString("cedula"),
|
||||
result_set.getString("nombre"),
|
||||
result_set.getString("apellido"),
|
||||
result_set.getString("direccion"),
|
||||
result_set.getString("telefono"),
|
||||
result_set.getString("provincia"),
|
||||
result_set.getString("compra_anual")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
result_set.close();
|
||||
data_base.close();
|
||||
} catch(Exception e) {
|
||||
System.out.println("Error select: " + e.toString());
|
||||
}
|
||||
|
||||
return list_cliente;
|
||||
}
|
||||
|
||||
|
||||
public String getId() { return this.id; }
|
||||
public String getCedula() { return this.cedula; }
|
||||
|
||||
public String getNombre() { return this.nombre; }
|
||||
public String getApellido() { return this.apellido; }
|
||||
|
||||
|
||||
public String getDireccion() { return this.direccion; }
|
||||
public String getTelefono() { return this.telefono; }
|
||||
public String getProvincia() { return this.provincia; }
|
||||
public String getCompra_anual() { return this.compra_anual; }
|
||||
|
||||
|
||||
public void setCedula(String cedula) { this.cedula = cedula; }
|
||||
public void setNombre(String nombre) { this.nombre = nombre; }
|
||||
public void setApellido(String apellido) { this.apellido = apellido; }
|
||||
public void setDireccion(String direccion) { this.direccion = direccion; }
|
||||
public void setTelefono(String telefono) { this.telefono = telefono; }
|
||||
public void setProvincia(String provincia) { this.provincia = provincia; }
|
||||
public void setCompraAnual(String anual) { this.compra_anual = compra_anual; }
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package com.proy_final.mod.util.data;
|
||||
|
||||
import com.proy_final.mod.template.Ubicacion;
|
||||
|
||||
public class Departamento extends Ubicacion {
|
||||
|
||||
|
||||
public Departamento() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public String getRealDepartamentoComboBox (String departamento_db) {
|
||||
switch (departamento_db) {
|
||||
case "VT": return "Ventas General";
|
||||
case "ET": return "Eletrodomesticos";
|
||||
case "RP": return "Ropa";
|
||||
case "MB": return "Muebles";
|
||||
case "DA": return "Despensa Alimentaria";
|
||||
default:
|
||||
return "NN";
|
||||
}
|
||||
}
|
||||
|
||||
public String getRealDepartamentoDB (String departamento_combo_box) {
|
||||
switch (departamento_combo_box) {
|
||||
case "Ventas General": return "VT";
|
||||
case "Eletrodomesticos": return "ET";
|
||||
case "Ropa": return "RP";
|
||||
case "Muebles": return "MB";
|
||||
case "Despensa Alimentaria": return "DA";
|
||||
default:
|
||||
return "NN";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package com.proy_final.mod.util.data;
|
||||
|
||||
import com.proy_final.mod.template.Ubicacion;
|
||||
|
||||
public class Provincia extends Ubicacion {
|
||||
public enum EnumUbicacion {
|
||||
BocasDelToro,
|
||||
Cocle,
|
||||
Colón,
|
||||
Chiriquí,
|
||||
Darién,
|
||||
Herrera,
|
||||
LosSantos,
|
||||
Panama,
|
||||
Veraguas,
|
||||
PanamaOeste,
|
||||
EmberaWounaan,
|
||||
GunaYala,
|
||||
NgöbeBugle,
|
||||
NasoTjërDi
|
||||
}
|
||||
|
||||
public String getRealProvinciaComboBox (String provincia_db) {
|
||||
switch (provincia_db) {
|
||||
case "BT": return "1 Bocas del Toro";
|
||||
case "CO": return "2 Coclé";
|
||||
case "CL": return "3 Colón";
|
||||
case "CH": return "4 Chiriquí";
|
||||
case "DA": return "5 Darién";
|
||||
case "HE": return "6 Herrera";
|
||||
case "LS": return "7 Los Santos";
|
||||
case "PA": return "8 Panamá";
|
||||
case "VE": return "9 Veraguas";
|
||||
case "PO": return "10 Panamá Oeste";
|
||||
case "EW": return "11 Emberá-Wounaan";
|
||||
case "GY": return "12 Guna Yala";
|
||||
case "NB": return "13 Ngöbe-Buglé";
|
||||
case "NT": return "14 Naso Tjër Di";
|
||||
default:
|
||||
return "NN";
|
||||
}
|
||||
}
|
||||
|
||||
public String getRealProvinciaDB (String provincia_combo_box) {
|
||||
switch (provincia_combo_box) {
|
||||
case "1 Bocas del Toro": return "BT";
|
||||
case "2 Coclé": return "CO";
|
||||
case "3 Colón": return "CL";
|
||||
case "4 Chiriquí": return "CH";
|
||||
case "5 Darién": return "DA";
|
||||
case "6 Herrera": return "HE";
|
||||
case "7 Los Santos": return "LS";
|
||||
case "8 Panamá": return "PA";
|
||||
case "9 Veraguas": return "VE";
|
||||
case "10 Panamá Oeste": return "PO";
|
||||
case "11 Emberá-Wounaan": return "EW";
|
||||
case "12 Guna Yala": return "GY";
|
||||
case "13 Ngöbe-Buglé": return "NB";
|
||||
case "14 Naso Tjër Di": return "NT";
|
||||
default:
|
||||
return "NN";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
package com.proy_final.mod.util.data;
|
||||
|
||||
import com.proy_final.mod.template.Persona;
|
||||
import com.proy_final.mod.db.DataBase;
|
||||
import com.proy_final.mod.util.data.Departamento;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import java.sql.*;
|
||||
|
||||
public class Vendedor extends Persona {
|
||||
|
||||
private String codigo;
|
||||
private String cargo;
|
||||
private String departamento;
|
||||
private String venta_mensual;
|
||||
private String venta_anual;
|
||||
|
||||
|
||||
public Vendedor() {
|
||||
{
|
||||
this.self_type = EnumPersona.VENDEDOR;
|
||||
this.id = "";
|
||||
this.nombre = "";
|
||||
this.apellido = "";
|
||||
}
|
||||
|
||||
{
|
||||
this.codigo = "";
|
||||
this.cargo = "";
|
||||
this.departamento = "";
|
||||
this.venta_mensual = "";
|
||||
this.venta_anual = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Vendedor (
|
||||
String id,
|
||||
String nombre,
|
||||
String apellido,
|
||||
|
||||
String codigo,
|
||||
String cargo,
|
||||
String departamento,
|
||||
String venta_mensual,
|
||||
String venta_anual
|
||||
) {
|
||||
{
|
||||
this.self_type = EnumPersona.VENDEDOR;
|
||||
this.id = id;
|
||||
this.nombre = nombre;
|
||||
this.apellido = apellido;
|
||||
}
|
||||
|
||||
{
|
||||
this.codigo = codigo;
|
||||
this.cargo = cargo;
|
||||
this.departamento = departamento;
|
||||
this.venta_mensual = venta_mensual;
|
||||
this.venta_anual = venta_anual;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getCodigo() { return this.codigo; }
|
||||
public String getCargo() { return this.cargo; }
|
||||
public String getDepartamento() { return this.departamento; }
|
||||
public String getVentaMensual() { return this.venta_mensual; }
|
||||
public String getVentaAnual() { return this.venta_anual; }
|
||||
|
||||
|
||||
public void setCodigo(String codigo) { this.codigo = codigo; }
|
||||
public void setDepartamento(String departamento) { this.departamento = departamento; }
|
||||
public void setCargo(String cargo) { this.cargo = cargo; }
|
||||
public void setVentaMensual(String venta_mensual) { this.venta_mensual = venta_mensual; }
|
||||
public void setVentaAnual(String venta_anual) { this.venta_anual = venta_anual; }
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package com.proy_final.mod.uil.menu;
|
||||
|
||||
import com.proy_final.mod.util.view.PanelPresentacion;
|
||||
import com.proy_final.mod.util.view.PanelMantenimientoBoxCliente;
|
||||
import com.proy_final.mod.util.view.PanelMantenimientoBoxVendedor;
|
||||
import com.proy_final.mod.util.view.PanelReporteCliente;
|
||||
import com.proy_final.mod.util.view.PanelReporteVendedor;
|
||||
|
||||
import com.proy_final.mod.util.menu.inicio.MenuInicioPresentacion;
|
||||
|
||||
import com.proy_final.mod.util.menu.mantenimiento.MenuMantenimientoCliente;
|
||||
import com.proy_final.mod.util.menu.mantenimiento.MenuMantenimientoVendedor;
|
||||
|
||||
import com.proy_final.mod.util.menu.reporte.MenuReporteCliente;
|
||||
import com.proy_final.mod.util.menu.reporte.MenuReporteVendedor;
|
||||
|
||||
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JMenuBar;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
|
||||
public class NavBar extends JMenuBar {
|
||||
|
||||
|
||||
|
||||
private PanelPresentacion view_PanelPresentacion = new PanelPresentacion();
|
||||
private PanelMantenimientoBoxCliente view_PanelCliente = new PanelMantenimientoBoxCliente();
|
||||
private PanelMantenimientoBoxVendedor view_PanelVendedor = new PanelMantenimientoBoxVendedor();
|
||||
|
||||
private PanelReporteCliente view_PanelReporteCliente = new PanelReporteCliente();
|
||||
private PanelReporteVendedor view_PanelReporteVendedor = new PanelReporteVendedor();
|
||||
|
||||
|
||||
public NavBar (JFrame main_frame) {
|
||||
|
||||
|
||||
{
|
||||
JMenu menu_inicio = new JMenu("Inicio");
|
||||
|
||||
MenuInicioPresentacion menu_inicio_presentacion = new MenuInicioPresentacion(main_frame, this.view_PanelPresentacion);
|
||||
menu_inicio.add(menu_inicio_presentacion);
|
||||
|
||||
|
||||
JMenuItem menu_inicio_salir = new JMenuItem("Salir");
|
||||
menu_inicio_salir.addActionListener(e -> {
|
||||
System.exit(0);
|
||||
});
|
||||
menu_inicio.add(menu_inicio_salir);
|
||||
|
||||
this.add(menu_inicio);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
|
||||
JMenu menu_mantenimiento = new JMenu("Mantenimiento");
|
||||
|
||||
MenuMantenimientoCliente menu_mantenimiento_cliente = new MenuMantenimientoCliente(main_frame, this.view_PanelCliente);
|
||||
menu_mantenimiento.add(menu_mantenimiento_cliente);
|
||||
|
||||
MenuMantenimientoVendedor menu_mantenimiento_vendedor = new MenuMantenimientoVendedor(main_frame, this.view_PanelVendedor);
|
||||
menu_mantenimiento.add(menu_mantenimiento_vendedor);
|
||||
|
||||
this.add(menu_mantenimiento);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
JMenu menu_reporte = new JMenu("Reporte");
|
||||
|
||||
|
||||
MenuReporteCliente menu_reporte_cliente = new MenuReporteCliente(main_frame, this.view_PanelReporteCliente);
|
||||
menu_reporte.add(menu_reporte_cliente);
|
||||
|
||||
MenuReporteVendedor menu_reporte_vendedor = new MenuReporteVendedor(main_frame, this.view_PanelReporteVendedor);
|
||||
menu_reporte.add(menu_reporte_vendedor);
|
||||
|
||||
this.add(menu_reporte);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.proy_final.mod.util.menu.inicio;
|
||||
|
||||
import com.proy_final.mod.util.view.PanelPresentacion;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
public class MenuInicioPresentacion extends JMenuItem {
|
||||
|
||||
public MenuInicioPresentacion(JFrame main_frame, PanelPresentacion panel_presentacion) {
|
||||
super("Presentacion");
|
||||
|
||||
this.addActionListener(e -> {
|
||||
main_frame.setContentPane(panel_presentacion);
|
||||
main_frame.revalidate();
|
||||
main_frame.repaint();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.proy_final.mod.util.menu.mantenimiento;
|
||||
|
||||
import com.proy_final.mod.util.view.PanelMantenimientoBoxCliente;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
public class MenuMantenimientoCliente extends JMenuItem {
|
||||
|
||||
public MenuMantenimientoCliente(JFrame main_frame, PanelMantenimientoBoxCliente panel_cliente) {
|
||||
super("Cliente");
|
||||
|
||||
this.addActionListener(e -> {
|
||||
main_frame.setContentPane(panel_cliente);
|
||||
main_frame.revalidate();
|
||||
main_frame.repaint();
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.proy_final.mod.util.menu.mantenimiento;
|
||||
|
||||
import com.proy_final.mod.util.view.PanelMantenimientoBoxVendedor;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
|
||||
|
||||
public class MenuMantenimientoVendedor extends JMenuItem {
|
||||
|
||||
public MenuMantenimientoVendedor(JFrame main_frame, PanelMantenimientoBoxVendedor panel_vendedor) {
|
||||
super("Vendedor");
|
||||
|
||||
this.addActionListener(e -> {
|
||||
main_frame.setContentPane(panel_vendedor);
|
||||
main_frame.revalidate();
|
||||
main_frame.repaint();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.proy_final.mod.util.menu.reporte;
|
||||
|
||||
|
||||
|
||||
import com.proy_final.mod.util.view.PanelReporteCliente;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
|
||||
|
||||
public class MenuReporteCliente extends JMenuItem {
|
||||
|
||||
public MenuReporteCliente(JFrame main_frame, PanelReporteCliente panel_reporte_cliente) {
|
||||
super("Reporte de Cliente");
|
||||
|
||||
this.addActionListener(e -> {
|
||||
main_frame.setContentPane(panel_reporte_cliente);
|
||||
main_frame.revalidate();
|
||||
main_frame.repaint();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.proy_final.mod.util.menu.reporte;
|
||||
|
||||
|
||||
import com.proy_final.mod.util.view.PanelReporteVendedor;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
|
||||
|
||||
public class MenuReporteVendedor extends JMenuItem {
|
||||
|
||||
public MenuReporteVendedor(JFrame main_frame, PanelReporteVendedor panel_reporte_vendedor) {
|
||||
super("Reporte de Vendedor");
|
||||
|
||||
this.addActionListener(e -> {
|
||||
main_frame.setContentPane(panel_reporte_vendedor);
|
||||
main_frame.revalidate();
|
||||
main_frame.repaint();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.proy_final.mod.util.settings;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
|
||||
public class Global {
|
||||
public static boolean DEBUG = false;
|
||||
|
||||
public static Color BGCOLOR = new Color(226, 240, 217);
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.proy_final.mod.util.struct;
|
||||
|
||||
public class Vec2x2 {
|
||||
private int x_pos, y_pos;
|
||||
private int x_size, y_size;
|
||||
|
||||
public Vec2x2() {
|
||||
this.x_pos = 0;
|
||||
this.y_pos = 0;
|
||||
this.x_size = 0;
|
||||
this.y_size = 0;
|
||||
}
|
||||
|
||||
public Vec2x2(int x_pos, int y_pos, int x_size, int y_size) {
|
||||
this.x_pos = x_pos;
|
||||
this.y_pos = y_pos;
|
||||
this.x_size = x_size;
|
||||
this.y_size = y_size;
|
||||
}
|
||||
|
||||
public void setXPos(int x_pos) { this.x_pos = x_pos; }
|
||||
public void setYPos(int y_pos) { this.y_pos = y_pos; }
|
||||
public void setXSize(int x_size) { this.x_size = x_size; }
|
||||
public void setYSize(int y_size) { this.y_size = y_size; }
|
||||
|
||||
|
||||
public int getXPos() { return this.x_pos; }
|
||||
public int getYPos() { return this.y_pos; }
|
||||
public int getXSize() { return this.x_size; }
|
||||
public int getYSize() { return this.y_size; }
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.proy_final.mod.util.view;
|
||||
|
||||
import com.proy_final.mod.util.view.gui.PanelMantenimientoBox;
|
||||
|
||||
public class PanelMantenimientoBoxCliente extends PanelMantenimientoBox {
|
||||
public PanelMantenimientoBoxCliente() {
|
||||
super("Cliente", EnumPanel.MANTENIMIENTOCLIENTE);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.proy_final.mod.util.view;
|
||||
|
||||
import com.proy_final.mod.util.view.gui.PanelMantenimientoBox;
|
||||
|
||||
public class PanelMantenimientoBoxVendedor extends PanelMantenimientoBox {
|
||||
public PanelMantenimientoBoxVendedor() {
|
||||
super("Vendedor", EnumPanel.MANTENIMIENTOVENDEDOR);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package com.proy_final.mod.util.view;
|
||||
|
||||
|
||||
import com.proy_final.mod.util.struct.Vec2x2;
|
||||
import com.proy_final.mod.util.settings.Global;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JLabel;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
|
||||
public class PanelPresentacion extends JPanel {
|
||||
public PanelPresentacion() {
|
||||
this.setLayout(null);
|
||||
if (Global.DEBUG) {
|
||||
this.setBackground(Color.BLUE);
|
||||
} else {
|
||||
this.setBackground(Global.BGCOLOR);
|
||||
}
|
||||
|
||||
|
||||
String[] menu_info = new String[] {
|
||||
String.format(" %65s ", "Proyecto No. 3 Base de datos"),
|
||||
String.format(" %65s ", "Universidad Facultad: "),
|
||||
String.format(" %65s ", "Carrera: "),
|
||||
String.format(" %65s ", "Materia: "),
|
||||
String.format(" %65s ", "Profesor: "),
|
||||
String.format(" %65s ", "Grupo: " ),
|
||||
String.format(" %65s ", "Cedula: "),
|
||||
String.format(" %65s ", "Fecha: "),
|
||||
};
|
||||
|
||||
|
||||
Vec2x2 label_data_vec = new Vec2x2(315, 130, 700, 50);
|
||||
for (int i = 0; i < menu_info.length; i = i + 1 ) {
|
||||
JLabel label_data_show = new JLabel(menu_info[i]);
|
||||
label_data_show.setFont(new Font("Arial", Font.PLAIN, 18));
|
||||
|
||||
label_data_show.setBounds(
|
||||
label_data_vec.getXPos(),
|
||||
label_data_vec.getYPos(),
|
||||
label_data_vec.getXSize(),
|
||||
label_data_vec.getYSize()
|
||||
);
|
||||
|
||||
if (Global.DEBUG) {
|
||||
label_data_show.setOpaque(true);
|
||||
label_data_show.setBackground(Color.RED);
|
||||
}
|
||||
|
||||
label_data_vec.setYPos(label_data_vec.getYPos() + 60);
|
||||
this.add(label_data_show);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
package com.proy_final.mod.util.view;
|
||||
|
||||
|
||||
|
||||
import com.proy_final.mod.util.struct.Vec2x2;
|
||||
import com.proy_final.mod.util.settings.Global;
|
||||
import com.proy_final.mod.db.DataBase;
|
||||
|
||||
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JPanel;
|
||||
import java.awt.Color;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.swing.JRadioButton;
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
public class PanelReporteCliente extends JPanel {
|
||||
|
||||
public enum EnumRarioButton {
|
||||
Cedula,
|
||||
Nombre,
|
||||
Apellido,
|
||||
MontoDeCompra,
|
||||
ID
|
||||
}
|
||||
|
||||
public PanelReporteCliente() {
|
||||
this.setLayout(null);
|
||||
if (Global.DEBUG) {
|
||||
this.setBackground(Color.ORANGE);
|
||||
} else {
|
||||
this.setBackground(Global.BGCOLOR);
|
||||
}
|
||||
|
||||
List<JRadioButton> list_radio_button = new ArrayList<>();
|
||||
|
||||
String[] radio_string = new String[] {
|
||||
"ID",
|
||||
"Cedula",
|
||||
"Nombre",
|
||||
"Apellido",
|
||||
"Monto de compra",
|
||||
};
|
||||
|
||||
|
||||
Vec2x2 radio_button_vec = new Vec2x2(100, 130, 250, 50);
|
||||
|
||||
|
||||
ButtonGroup group_button = new ButtonGroup();
|
||||
for (String string : radio_string) {
|
||||
|
||||
JRadioButton radio_button = new JRadioButton(string);
|
||||
radio_button.setBounds(
|
||||
radio_button_vec.getXPos(),
|
||||
radio_button_vec.getYPos(),
|
||||
radio_button_vec.getXSize(),
|
||||
radio_button_vec.getYSize()
|
||||
);
|
||||
radio_button_vec.setYPos(radio_button_vec.getYPos() + 60);
|
||||
|
||||
group_button.add(radio_button);
|
||||
list_radio_button.add(radio_button);
|
||||
|
||||
this.add(radio_button);
|
||||
}
|
||||
|
||||
JButton button_reporte = new JButton("Reportar");
|
||||
button_reporte.setBounds(
|
||||
radio_button_vec.getXPos(),
|
||||
radio_button_vec.getYPos(),
|
||||
radio_button_vec.getXSize(),
|
||||
radio_button_vec.getYSize()
|
||||
);
|
||||
this.add(button_reporte);
|
||||
|
||||
button_reporte.addActionListener(e ->
|
||||
{
|
||||
|
||||
|
||||
String orden = "c.id ASC";
|
||||
if (list_radio_button.get(0).isSelected()) { orden = "c.id ASC"; }
|
||||
|
||||
if (list_radio_button.get(1).isSelected()) { orden = "c.cedula ASC"; }
|
||||
|
||||
if (list_radio_button.get(2).isSelected()) { orden = "c.nombre ASC"; }
|
||||
|
||||
if (list_radio_button.get(3).isSelected()) { orden = "c.apellido ASC"; }
|
||||
|
||||
if (list_radio_button.get(4).isSelected()) { orden = "c.compra_anual ASC"; }
|
||||
|
||||
new DataBase().reporte(orden, DataBase.EnumReporteType.REPORTECLIENTE);
|
||||
|
||||
JOptionPane.showMessageDialog(
|
||||
null,
|
||||
"Reporte terminado",
|
||||
"Reporte Status",
|
||||
JOptionPane.INFORMATION_MESSAGE
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
package com.proy_final.mod.util.view;
|
||||
|
||||
|
||||
|
||||
|
||||
import com.proy_final.mod.util.struct.Vec2x2;
|
||||
import com.proy_final.mod.db.DataBase;
|
||||
import com.proy_final.mod.util.settings.Global;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import java.awt.Color;
|
||||
|
||||
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JPanel;
|
||||
import java.awt.Color;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.swing.JRadioButton;
|
||||
import javax.swing.ButtonGroup;
|
||||
|
||||
|
||||
public class PanelReporteVendedor extends JPanel {
|
||||
public PanelReporteVendedor() {
|
||||
this.setLayout(null);
|
||||
if (Global.DEBUG) {
|
||||
this.setBackground(Color.RED);
|
||||
} else {
|
||||
this.setBackground(Global.BGCOLOR);
|
||||
}
|
||||
|
||||
|
||||
|
||||
List<JRadioButton> list_radio_button = new ArrayList<>();
|
||||
|
||||
String[] radio_string = new String[] {
|
||||
"ID",
|
||||
"Codigo",
|
||||
"Nombre",
|
||||
"Apellido",
|
||||
"Departamento",
|
||||
"Cargo",
|
||||
"Venta mensual",
|
||||
"Venta anual",
|
||||
};
|
||||
|
||||
Vec2x2 radio_button_vec = new Vec2x2(100, 90, 250, 50);
|
||||
|
||||
|
||||
ButtonGroup group_button = new ButtonGroup();
|
||||
for (String string : radio_string) {
|
||||
|
||||
JRadioButton radio_button = new JRadioButton(string);
|
||||
radio_button.setBounds(
|
||||
radio_button_vec.getXPos(),
|
||||
radio_button_vec.getYPos(),
|
||||
radio_button_vec.getXSize(),
|
||||
radio_button_vec.getYSize()
|
||||
);
|
||||
radio_button_vec.setYPos(radio_button_vec.getYPos() + 60);
|
||||
|
||||
group_button.add(radio_button);
|
||||
list_radio_button.add(radio_button);
|
||||
|
||||
this.add(radio_button);
|
||||
}
|
||||
|
||||
JButton button_reporte = new JButton("Reportar");
|
||||
button_reporte.setBounds(
|
||||
radio_button_vec.getXPos(),
|
||||
radio_button_vec.getYPos(),
|
||||
radio_button_vec.getXSize(),
|
||||
radio_button_vec.getYSize()
|
||||
);
|
||||
this.add(button_reporte);
|
||||
|
||||
button_reporte.addActionListener(e ->
|
||||
{
|
||||
String orden = "v.id ASC";
|
||||
if (list_radio_button.get(0).isSelected()) { orden = "v.id ASC"; }
|
||||
|
||||
if (list_radio_button.get(1).isSelected()) { orden = "v.codigo ASC"; }
|
||||
|
||||
if (list_radio_button.get(2).isSelected()) { orden = "v.nombre ASC"; }
|
||||
|
||||
if (list_radio_button.get(3).isSelected()) { orden = "v.apellido ASC"; }
|
||||
|
||||
if (list_radio_button.get(4).isSelected()) { orden = "d.codigo ASC"; }
|
||||
|
||||
if (list_radio_button.get(5).isSelected()) { orden = "v.cargo ASC"; }
|
||||
|
||||
if (list_radio_button.get(6).isSelected()) { orden = "v.venta_mensual ASC"; }
|
||||
|
||||
if (list_radio_button.get(7).isSelected()) { orden = "v.venta_anual ASC"; }
|
||||
|
||||
new DataBase().reporte(orden, DataBase.EnumReporteType.REPORTEVENDEDOR);
|
||||
|
||||
JOptionPane.showMessageDialog(
|
||||
null,
|
||||
"Reporte terminado",
|
||||
"Reporte Status",
|
||||
JOptionPane.INFORMATION_MESSAGE
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,118 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"
|
||||
name="report"
|
||||
pageWidth="612"
|
||||
pageHeight="792"
|
||||
columnWidth="555"
|
||||
leftMargin="20"
|
||||
rightMargin="20"
|
||||
topMargin="20"
|
||||
bottomMargin="20"
|
||||
uuid="8719778f-f224-48a9-8e3e-2a8816e95643">
|
||||
|
||||
<parameter name="orden" class="java.lang.String"/>
|
||||
|
||||
<queryString>
|
||||
<![CDATA[
|
||||
SELECT
|
||||
c.id,
|
||||
c.cedula,
|
||||
c.nombre,
|
||||
c.apellido,
|
||||
c.direccion,
|
||||
c.telefono,
|
||||
p.descripcion AS provincia,
|
||||
c.compra_anual
|
||||
FROM Cliente AS c
|
||||
JOIN Provincia AS p ON c.provincia = p.codigo
|
||||
ORDER BY $P!{orden};
|
||||
]]>
|
||||
</queryString>
|
||||
|
||||
<field name="id" class="java.lang.Integer"/>
|
||||
<field name="cedula" class="java.lang.String"/>
|
||||
<field name="nombre" class="java.lang.String"/>
|
||||
<field name="apellido" class="java.lang.String"/>
|
||||
<field name="direccion" class="java.lang.String"/>
|
||||
<field name="telefono" class="java.lang.String"/>
|
||||
<field name="provincia" class="java.lang.String"/>
|
||||
<field name="compra_anual" class="java.lang.Integer"/>
|
||||
|
||||
|
||||
<columnHeader>
|
||||
<band height="20">
|
||||
<staticText>
|
||||
<reportElement x="0" y="0" width="100" height="20"/>
|
||||
<text><![CDATA[ID]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="30" y="0" width="100" height="20"/>
|
||||
<text><![CDATA[Cedula]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="110" y="0" width="100" height="20"/>
|
||||
<text><![CDATA[Nombre]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="170" y="0" width="100" height="20"/>
|
||||
<text><![CDATA[Apellido]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="250" y="0" width="100" height="20"/>
|
||||
<text><![CDATA[Direccion]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="350" y="0" width="100" height="20"/>
|
||||
<text><![CDATA[Telefono]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="400" y="0" width="100" height="20"/>
|
||||
<text><![CDATA[Provincia]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="500" y="0" width="100" height="20"/>
|
||||
<text><![CDATA[Compra anual]]></text>
|
||||
</staticText>
|
||||
</band>
|
||||
</columnHeader>
|
||||
|
||||
<detail>
|
||||
<band height="20">
|
||||
<textField>
|
||||
<reportElement x="0" y="0" width="100" height="20"/>
|
||||
<textFieldExpression><![CDATA[$F{id}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField>
|
||||
<reportElement x="30" y="0" width="100" height="20"/>
|
||||
<textFieldExpression><![CDATA[$F{cedula}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField>
|
||||
<reportElement x="110" y="0" width="100" height="20"/>
|
||||
<textFieldExpression><![CDATA[$F{nombre}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField>
|
||||
<reportElement x="170" y="0" width="100" height="20"/>
|
||||
<textFieldExpression><![CDATA[$F{apellido}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField>
|
||||
<reportElement x="250" y="0" width="100" height="20"/>
|
||||
<textFieldExpression><![CDATA[$F{direccion}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField>
|
||||
<reportElement x="350" y="0" width="100" height="20"/>
|
||||
<textFieldExpression><![CDATA[$F{telefono}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField>
|
||||
<reportElement x="400" y="0" width="100" height="20"/>
|
||||
<textFieldExpression><![CDATA[$F{provincia}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField>
|
||||
<reportElement x="500" y="0" width="100" height="20"/>
|
||||
<textFieldExpression><![CDATA[$F{compra_anual}]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</detail>
|
||||
|
||||
</jasperReport>
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"
|
||||
name="report"
|
||||
pageWidth="612"
|
||||
pageHeight="792"
|
||||
columnWidth="555"
|
||||
leftMargin="20"
|
||||
rightMargin="20"
|
||||
topMargin="20"
|
||||
bottomMargin="20"
|
||||
uuid="8719778f-f224-48a9-8e3e-2a8816e95643">
|
||||
|
||||
<parameter name="orden" class="java.lang.String"/>
|
||||
|
||||
<queryString>
|
||||
<![CDATA[
|
||||
SELECT
|
||||
v.id,
|
||||
v.codigo,
|
||||
v.nombre,
|
||||
v.apellido,
|
||||
d.descripcion AS departamento,
|
||||
v.cargo,
|
||||
v.venta_mensual,
|
||||
v.venta_anual
|
||||
FROM Vendedor AS v
|
||||
JOIN Departamento AS d ON v.departamento = d.codigo
|
||||
ORDER BY $P!{orden};
|
||||
]]>
|
||||
</queryString>
|
||||
|
||||
<field name="id" class="java.lang.Integer"/>
|
||||
<field name="codigo" class="java.lang.String"/>
|
||||
<field name="nombre" class="java.lang.String"/>
|
||||
<field name="apellido" class="java.lang.String"/>
|
||||
<field name="departamento" class="java.lang.String"/>
|
||||
<field name="cargo" class="java.lang.String"/>
|
||||
<field name="venta_mensual" class="java.lang.Integer"/>
|
||||
<field name="venta_anual" class="java.lang.Integer"/>
|
||||
|
||||
|
||||
<columnHeader>
|
||||
<band height="20">
|
||||
<staticText>
|
||||
<reportElement x="0" y="0" width="100" height="20"/>
|
||||
<text><![CDATA[ID]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="30" y="0" width="100" height="20"/>
|
||||
<text><![CDATA[Codigo]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="90" y="0" width="100" height="20"/>
|
||||
<text><![CDATA[Nombre]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="150" y="0" width="100" height="20"/>
|
||||
<text><![CDATA[Apellido]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="230" y="0" width="100" height="20"/>
|
||||
<text><![CDATA[Departamento]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="330" y="0" width="100" height="20"/>
|
||||
<text><![CDATA[Cargo]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="420" y="0" width="100" height="20"/>
|
||||
<text><![CDATA[Venta mensual]]></text>
|
||||
</staticText>
|
||||
<staticText>
|
||||
<reportElement x="500" y="0" width="100" height="20"/>
|
||||
<text><![CDATA[Venta anual]]></text>
|
||||
</staticText>
|
||||
</band>
|
||||
</columnHeader>
|
||||
|
||||
<detail>
|
||||
<band height="20">
|
||||
<textField>
|
||||
<reportElement x="0" y="0" width="100" height="20"/>
|
||||
<textFieldExpression><![CDATA[$F{id}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField>
|
||||
<reportElement x="30" y="0" width="100" height="20"/>
|
||||
<textFieldExpression><![CDATA[$F{codigo}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField>
|
||||
<reportElement x="90" y="0" width="100" height="20"/>
|
||||
<textFieldExpression><![CDATA[$F{nombre}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField>
|
||||
<reportElement x="150" y="0" width="100" height="20"/>
|
||||
<textFieldExpression><![CDATA[$F{apellido}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField>
|
||||
<reportElement x="230" y="0" width="100" height="20"/>
|
||||
<textFieldExpression><![CDATA[$F{departamento}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField>
|
||||
<reportElement x="330" y="0" width="100" height="20"/>
|
||||
<textFieldExpression><![CDATA[$F{cargo}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField>
|
||||
<reportElement x="420" y="0" width="100" height="20"/>
|
||||
<textFieldExpression><![CDATA[$F{venta_mensual}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField>
|
||||
<reportElement x="500" y="0" width="100" height="20"/>
|
||||
<textFieldExpression><![CDATA[$F{venta_anual}]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</detail>
|
||||
|
||||
</jasperReport>
|
||||
Loading…
Reference in New Issue