Tabla Mysql
Versión 11 (Guillermo Zdanowicz, 23/03/2016 23:31) → Versión 12/17 (Guillermo Zdanowicz, 29/03/2016 20:06)
h1. Tabla Mysql
h2. TABLA: *proveedores*
<pre>
CREATE TABLE `proveedores` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`identificacion` varchar(100) NOT NULL,
`nombre` varchar(100) NULL,
`direccion` varchar(50) NULL,
`telefono` varchar(50) NULL,
`cuil` varchar(50) NOT NULL,
`codigo_banco` varchar(50) NULL,
`cbu` varchar(50) NULL,
`idposicioniva` int(11) NOT NULL default 0,
`email` varchar(80) NULL,
`actividad` varchar(80) NULL,
`observaciones` varchar(200) NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `identificacion` (`identificacion`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
</pre>
h2. TABLA: *posiciones_iva*
<pre>
*Esta tabla puede ser un arreglo de valores fijos*
<pre>
CREATE TABLE `posiciones_iva` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`descripcion` varchar(200) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
</pre>
h2. TABLA: *compras*
<pre>
CREATE TABLE `compras` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idproveedor` int(11) NOT NULL,
`descripcion` varchar(200) NOT NULL,
`fecha_factura` date NULL,
`importe` float NOT NULL DEFAULT '0.0',
`fecha_recepcion` date NULL,
`comprobante` varchar(80) NULL,
`pagado` int(1) NOT NULL DEFAULT '0',
`observaciones` varchar(200) NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
</pre>
h2. TABLA: *imputaciones*
<pre>
CREATE TABLE `imputaciones` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idcompra` int(11) NOT NULL,
`idcuenta` int(11) NOT NULL,
`importe` float unsigned NOT NULL DEFAULT '0',
`observaciones` varchar(200) NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (idcompra) REFERENCES compras(id) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
</pre>
h2. TABLA: *cuentas*
<pre>
CREATE TABLE `cuentas` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`codigo` varchar(8) NOT NULL,
`descripcion` varchar(200) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
</pre>
h2. TABLA: *pagos*
<pre>
CREATE TABLE `pagos` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idcompra` int(11) NOT NULL,
`descripcion` varchar(200) NOT NULL,
`fecha_pago` date NULL,
`importe` float unsigned NOT NULL DEFAULT '0',
`comprobante` varchar(80) NULL,
`pagado` int(1) NOT NULL DEFAULT '0',
`modo_pago` varchar(200) NULL,
`observaciones` varchar(200) NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (idcompra) REFERENCES compras(id) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
</pre>
h2. TABLA: *proveedores*
<pre>
CREATE TABLE `proveedores` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`identificacion` varchar(100) NOT NULL,
`nombre` varchar(100) NULL,
`direccion` varchar(50) NULL,
`telefono` varchar(50) NULL,
`cuil` varchar(50) NOT NULL,
`codigo_banco` varchar(50) NULL,
`cbu` varchar(50) NULL,
`idposicioniva` int(11) NOT NULL default 0,
`email` varchar(80) NULL,
`actividad` varchar(80) NULL,
`observaciones` varchar(200) NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `identificacion` (`identificacion`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
</pre>
h2. TABLA: *posiciones_iva*
<pre>
*Esta tabla puede ser un arreglo de valores fijos*
<pre>
CREATE TABLE `posiciones_iva` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`descripcion` varchar(200) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
</pre>
h2. TABLA: *compras*
<pre>
CREATE TABLE `compras` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idproveedor` int(11) NOT NULL,
`descripcion` varchar(200) NOT NULL,
`fecha_factura` date NULL,
`importe` float NOT NULL DEFAULT '0.0',
`fecha_recepcion` date NULL,
`comprobante` varchar(80) NULL,
`pagado` int(1) NOT NULL DEFAULT '0',
`observaciones` varchar(200) NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
</pre>
h2. TABLA: *imputaciones*
<pre>
CREATE TABLE `imputaciones` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idcompra` int(11) NOT NULL,
`idcuenta` int(11) NOT NULL,
`importe` float unsigned NOT NULL DEFAULT '0',
`observaciones` varchar(200) NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (idcompra) REFERENCES compras(id) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
</pre>
h2. TABLA: *cuentas*
<pre>
CREATE TABLE `cuentas` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`codigo` varchar(8) NOT NULL,
`descripcion` varchar(200) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
</pre>
h2. TABLA: *pagos*
<pre>
CREATE TABLE `pagos` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idcompra` int(11) NOT NULL,
`descripcion` varchar(200) NOT NULL,
`fecha_pago` date NULL,
`importe` float unsigned NOT NULL DEFAULT '0',
`comprobante` varchar(80) NULL,
`pagado` int(1) NOT NULL DEFAULT '0',
`modo_pago` varchar(200) NULL,
`observaciones` varchar(200) NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (idcompra) REFERENCES compras(id) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
</pre>