<?php
include_once ("lib/fpdf/funci.php");
$conex = conectar();
/*
//Mestro de Articulos
$vtart = "create table if not exists vtart
         (vtartcart  char(15)      not null,
          vtartnart  char(25)      not null,
          vtartdesc  char(40)      not null,
          vtartumed  char(3)       not null,
          vtartcate  char(20)      not null,
          vtartubic  char(15)      not null,
          vtartcant  decimal(10,2) not null,
          vtartpcom  decimal(10,2) not null,
          vtartpven  decimal(10,2) not null,
          vtartsmax  decimal(10,2) not null,
          vtartsmin  decimal(10,2) not null,
          vtartestf  smallint(1)   not null,
          vtartfpro  date          not null,
          vtartusua  char(15)      not null,
          vtartstat  smallint(1)   not null,
          unique index vtart1 (vtartcart))";
          mysql_query($vtart);

//Cabecera de Ventas
$vtcab = "create table if not exists vtcab
         (vtcabntra  int     auto_increment,
          vtcabnfac  int(10)       not null,
          vtcabccli  int(11)       not null,
          vtcabncli  char(40)      not null,
          vtcabtven  decimal(10,2) not null,
          vtcabdcto  decimal(10,2) not null,
          vtcabfpag  smallint(1)   not null,
          vtcabcheq  int(10)               ,
          vtcabbanc  char(30)              ,
          vtcabfech  date          not null,
          vtcabgest  int(4)        not null,
          vtcabhora  time          not null,
          vtcabusua  char(15)      not null,
          vtcabstat  smallint(1)   not null,
          primary key (vtcabntra))";
          mysql_query($vtcab);

//Detalle de Ventas
$vtdet = "create table if not exists vtdet
         (vtdetiden  int     auto_increment,
          vtdetntra  int(10)       not null,
          vtdetcart  char(15)      not null,
          vtdetnart  char(25)      not null,
          vtdetcant  decimal(10,2) not null,
          vtdetpven  decimal(10,2) not null,
          vtdetimpt  decimal(10,2) not null,
          vtdetfech  date          not null,
          vtdetgest  int(4)        not null,
          vtdetstat  smallint(1)   not null,
          primary key (vtdetiden)          ,
          index vtdet1 (vtdetntra))";
          mysql_query($vtdet);

//Clientes
$vtcli = "create table if not exists vtcli
         (vtcliccli  int(11)       not null,
          vtclincli  char(40)      not null,
          vtclidire  char(35)              ,
          vtclitelf  int(10)               ,
          vtclimail  char(35)              ,
          vtclifpro  date          not null,
          vtcliusua  char(15)      not null,
          vtclistat  smallint(1)   not null,
          unique index vtcli1 (vtcliccli))";
          mysql_query($vtcli);

//Usuarios
$vtusr = "create table if not exists vtusr
         (vtusriden  int           auto_increment,
          vtusrusua  char(15)      not null unique,
          vtusrnomb  char(40)      not null,
          vtusrmail  char(40)      not null unique,
          vtusrpawd  int(12)       not null,
          vtusrcalm  int(6)        not null,
          vtusrauto  smallint(1)   not null,
          vtusrstat  smallint(1)   not null,
          vtusrfreg  date          not null,
          primary key (vtusriden))";
          mysql_query($vtusr);

//Categorias
$vtcat = "create table if not exists vtcat
         (vtcatiden  int     auto_increment,
          vtcatdesc  char(20)      not null unique,
          vtcatfpro  date          not null,
          vtcatusua  char(15)      not null,
          primary key (vtcatiden))";
          mysql_query($vtcat);

//Unidad de Medida
$vtumd = "create table if not exists vtumd
         (vtumdiden  int           auto_increment,
          vtumddesc  char(15)      not null,
          vtumdumed  char(3)       not null,
          primary key (vtumdiden))";
          mysql_query($vtumd);

//Abastecimiento
$vtaba = "create table if not exists vtaba
         (vtabaiden  int           auto_increment,
          vtabacart  char(15)      not null,
          vtabacant  decimal(10,2) not null,
          vtabalote  char(12)              ,
          vtabafven  date                  ,
          vtabapcom  decimal(10,2) not null,
          vtabafpro  date          not null,
          vtabausua  char(15)      not null,
          primary key (vtabaiden))";
          mysql_query($vtaba);

//Maestro de Ubicaciones
$vtubi = "create table if not exists vtubi
         (vtubiiden  int     auto_increment,
          vtubidesc  char(35)      not null,
          vtubiubic  char(15)      not null,
          primary key (vtubiiden))";
          mysql_query($vtubi);

//Stock X Almacenes
$vtalm = "create table if not exists vtalm
         (vtalmiden  int           auto_increment,
          vtalmcalm  int(6)        not null,
          vtalmcart  char(15)      not null,
          vtalmcant  decimal(10,2) not null,
          vtalmlote  char(12)              ,
          vtalmfven  date                  ,
          vtalmfpro  date          not null,
          vtalmusua  char(15)      not null,
          vtalmstat  smallint(1)   not null,
          primary key (vtalmiden)          ,
          index vtalm1 (vtalmcalm,vtalmcart))";
          mysql_query($vtalm);

//Productos con Lote y Fecha de Vencimiento
$vtven = "create table if not exists vtven
         (vtveniden  smallint(1)   not null,
          vtvendesc  char(2)       not null,
          primary key (vtveniden))";
          mysql_query($vtven);

//Eliminar Maestro de Almacenes
$tbade = "create table if not exists vtade
         (vtadeiden  int           auto_increment,
          vtadecalm  int(6)        not null,
          vtadedesc  char(30)      not null,
          vtadestat  smallint(1)   not null,
          primary key (vtadeiden))";
          mysql_query($tbade);
*/
//Maestro de Almacenes
$vtcal = "create table if not exists vtcal
         (vtcalcalm  int(6)        not null,
          vtcaldesc  char(30)      not null,
          vtcalstat  smallint(1)   not null,
          unique index (vtcalcalm))";
          mysql_query($vtcal);

/*
//Forma de Pago
$vtfpg = "create table if not exists vtfpg
         (vtfpgiden  smallint(1)   auto_increment,
          vtfpgdesc  char(12)      not null,
          primary key (vtfpgiden))";
          mysql_query($vtfpg);

$fecha = date;
$user = "insert into vtusr values (0,'admin','Usuario Administrador','admin@outlook.com',568812,0,1,0,'$fecha')";
mysql_query($user);
*/
?>
