First commit 14/02/1999
This commit is contained in:
722
Inicializador.cpp
Normal file
722
Inicializador.cpp
Normal file
@ -0,0 +1,722 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <io.h>
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "Inicializador.h"
|
||||
#include "Inicio1.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma resource "*.dfm"
|
||||
TInitBDE *InitBDE;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TInitBDE::TInitBDE(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
CloseOK = false;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TInitBDE::FormShow(TObject *Sender)
|
||||
{
|
||||
AnsiString FileEmp;
|
||||
AnsiString Directory;
|
||||
|
||||
Directory = MenuInicio -> Empresas -> Directory;
|
||||
|
||||
|
||||
// Repasamos las bases de Datos... (...y las creamos)
|
||||
|
||||
// Productos
|
||||
Info -> Lines -> Insert( 0, "Productos" );
|
||||
Table -> TableName = Directory + "Tb_Ref.db";
|
||||
if ( access( (Table->TableName).c_str(), 0 ) != 0 )
|
||||
{
|
||||
Info -> Lines -> Insert( 0, ">>> Creando..." + Table->TableName);
|
||||
CreaProductos( Table );
|
||||
}
|
||||
Info -> Lines -> Insert( 0, "Productos OK!!!" );
|
||||
|
||||
// Productos Circular (COMBINADOS)
|
||||
Info -> Lines -> Insert( 0, "Productos Circulares" );
|
||||
Table -> TableName = Directory + "Tb_RefC.db";
|
||||
if ( access( (Table -> TableName).c_str(), 0 ) != 0 )
|
||||
{
|
||||
Info -> Lines -> Insert( 0, ">>> Creando..." + Table->TableName);
|
||||
CreaProductosCircular( Table );
|
||||
}
|
||||
Info -> Lines -> Insert( 0, "Productos Circular OK!!!" );
|
||||
|
||||
// Productos Circular (COMBINADOS)
|
||||
Info -> Lines -> Insert( 0, "Productos Seguimiento (Historico)" );
|
||||
Table -> TableName = Directory + "Tb_RefH.DB";
|
||||
if ( access( (Table -> TableName).c_str(), 0 ) != 0 )
|
||||
{
|
||||
Info -> Lines -> Insert( 0, ">>> Creando..." + Table->TableName);
|
||||
CreaProductosHistorico( Table );
|
||||
}
|
||||
Info -> Lines -> Insert( 0, "Productos Seguimiento OK!!!" );
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
// Cuentas Contables
|
||||
Info -> Lines -> Insert( 0, "Contabilidad CuentasContables" );
|
||||
Table -> TableName = Directory + "Tb_CtblCC.db";
|
||||
if ( access( (Table -> TableName).c_str(), 0 ) != 0 )
|
||||
{
|
||||
Info -> Lines -> Insert( 0, ">>> Creando..." + Table->TableName );
|
||||
CreaCtblCC( Table );
|
||||
}
|
||||
Info -> Lines -> Insert( 0, "Ctbl_CC OK!!!" );
|
||||
|
||||
// Parte Contable
|
||||
Info -> Lines -> Insert( 0, "Contabilidad ParteContable" );
|
||||
Table -> TableName = Directory + "Tb_CtblPteC.db";
|
||||
if ( access( (Table -> TableName).c_str(), 0 ) != 0 )
|
||||
{
|
||||
Info -> Lines -> Insert( 0, ">>> Creando..." + Table->TableName );
|
||||
CreaCtblPteC( Table );
|
||||
}
|
||||
Info -> Lines -> Insert( 0, "Parte Contable OK!!!" );
|
||||
|
||||
// Cartera_Prov ( Fraccionamiento del pago de una factura... )
|
||||
Info -> Lines -> Insert( 0, "Cartera Proveedores" );
|
||||
Table -> TableName = Directory + "Tb_CarteraProv.db";
|
||||
if ( access( (Table -> TableName).c_str(), 0 ) != 0 )
|
||||
{
|
||||
Info -> Lines -> Insert( 0, ">>> Creando..." + Table->TableName );
|
||||
CreaCartera( Table );
|
||||
}
|
||||
Info -> Lines -> Insert( 0, "Cartera Proveedores OK!!!" );
|
||||
|
||||
// Cartera_Clt ( Fraccionamiento del pago de una factura... )
|
||||
Info -> Lines -> Insert( 0, "Cartera Clientes" );
|
||||
Table -> TableName = Directory + "Tb_CarteraClt.db";
|
||||
if ( access( (Table -> TableName).c_str(), 0 ) != 0 )
|
||||
{
|
||||
Info -> Lines -> Insert( 0, ">>> Creando..." + Table->TableName );
|
||||
CreaCartera( Table );
|
||||
}
|
||||
Info -> Lines -> Insert( 0, "Cartera Clientes OK!!!" );
|
||||
|
||||
#ifndef TB_DISCONTINUAS
|
||||
// Factura Compras Lineas
|
||||
Info -> Lines -> Insert( 0, "FactCmp Lineas (cuerpo)" );
|
||||
Table -> TableName = Directory + "Compras (cuerpo).db";
|
||||
if ( access( (Table -> TableName).c_str(), 0 ) != 0 )
|
||||
{
|
||||
Info -> Lines -> Insert( 0, ">>> Creando..." + Table->TableName );
|
||||
CreaFacturasCmpL( Table );
|
||||
}
|
||||
Info -> Lines -> Insert( 0, "FactCmp Lineas OK!!!" );
|
||||
|
||||
// Factura Compras Cabecera
|
||||
Info -> Lines -> Insert( 0, "FactCmp Cabecera" );
|
||||
Table -> TableName = Directory + "Compras (cabecera).db";
|
||||
if ( access( (Table -> TableName).c_str(), 0 ) != 0 )
|
||||
{
|
||||
Info -> Lines -> Insert( 0, ">>> Creando..." + Table->TableName );
|
||||
CreaFacturasCmpC( Table );
|
||||
}
|
||||
Info -> Lines -> Insert( 0, "FactCmp Cabecera OK!!!" );
|
||||
|
||||
// Factura Ventas Contabilizaci<63>n
|
||||
Info -> Lines -> Insert( 0, "FactVnt Real" );
|
||||
Table -> TableName = Directory + "Ventas (Factura).db";
|
||||
if ( access( (Table -> TableName).c_str(), 0 ) != 0 )
|
||||
{
|
||||
Info -> Lines -> Insert( 0, ">>> Creando..." + Table->TableName );
|
||||
CreaFacturasVntR( Table );
|
||||
}
|
||||
Info -> Lines -> Insert( 0, "FactVnt Contabilizaci<63>n OK!!!" );
|
||||
|
||||
// Factura Ventas Lineas
|
||||
Info -> Lines -> Insert( 0, "FactVnt Lineas (cuerpo)" );
|
||||
Table -> TableName = Directory + "Ventas (cuerpo).db";
|
||||
if ( access( (Table -> TableName).c_str(), 0 ) != 0 )
|
||||
{
|
||||
Info -> Lines -> Insert( 0, ">>> Creando..." + Table->TableName );
|
||||
CreaFacturasVntL( Table );
|
||||
}
|
||||
Info -> Lines -> Insert( 0, "FactVnt Lineas OK!!!" );
|
||||
|
||||
// Factura Ventas Cabecera
|
||||
Info -> Lines -> Insert( 0, "FactVnt Cabecera" );
|
||||
Table -> TableName = Directory + "Ventas (cabecera).db";
|
||||
if ( access( (Table -> TableName).c_str(), 0 ) != 0 )
|
||||
{
|
||||
Info -> Lines -> Insert( 0, ">>> Creando..." + Table->TableName );
|
||||
CreaFacturasVntC( Table );
|
||||
}
|
||||
Info -> Lines -> Insert( 0, "FactVnt Cabecera OK!!!" );
|
||||
|
||||
// Informe Ventas Cajs
|
||||
Info -> Lines -> Insert( 0, "Informe VntCaja " );
|
||||
Table -> TableName = Directory + "Ventas (caja).db";
|
||||
if ( access( (Table -> TableName).c_str(), 0 ) != 0 )
|
||||
{
|
||||
Info -> Lines -> Insert( 0, ">>> Creando..." + Table->TableName );
|
||||
CreaInformeVntC( Table );
|
||||
}
|
||||
Info -> Lines -> Insert( 0, "Informe VntCaja OK!!!" );
|
||||
|
||||
// Informe Ventas Cajs
|
||||
Info -> Lines -> Insert( 0, "Verificando permisos " );
|
||||
Table -> TableName = Directory + "AccessControl.db";
|
||||
if ( access( (Table -> TableName).c_str(), 0 ) != 0 )
|
||||
{
|
||||
Info -> Lines -> Insert( 0, ">>> Creando..." + Table->TableName );
|
||||
CreaPermisos( Table );
|
||||
}
|
||||
Info -> Lines -> Insert( 0, "permisos correctos OK!!!" );
|
||||
/*
|
||||
// Informe Ventas
|
||||
Info -> Lines -> Insert( 0, "Ventas con factura" );
|
||||
Table -> TableName = Directory + "Ventas (iva).db";
|
||||
if ( access( (Table -> TableName).c_str(), 0 ) != 0 )
|
||||
{
|
||||
Info -> Lines -> Insert( 0, ">>> Creando..." + Table->TableName );
|
||||
CreaFacturasVntR( Table );
|
||||
}
|
||||
Info -> Lines -> Insert( 0, "Ventas con factura OK!!!" );
|
||||
*/
|
||||
#endif
|
||||
|
||||
CloseOK = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TInitBDE::CreaProductos( TTable *TbProdBusq )
|
||||
{
|
||||
// Establecemos la ruta
|
||||
TbProdBusq -> DatabaseName = "TpvWin";
|
||||
// Facilitamos el nombre de la nueva tabla y su tipo
|
||||
// TbProdBusq -> TableName = "Tm_Ref.db";
|
||||
// TbProdBusq -> TableType = ttParadox;
|
||||
|
||||
|
||||
// Usamos la propiedad FielDefs para definir
|
||||
// las columnas que contendr<64> la tabla
|
||||
TbProdBusq -> FieldDefs -> Clear();
|
||||
TbProdBusq -> FieldDefs -> Add("ForcedIndex", ftAutoInc, 0, false );
|
||||
|
||||
TbProdBusq -> FieldDefs -> Add("C<EFBFBD>digo de Barras", ftInteger, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("ID Producto", ftString, 15, false );
|
||||
|
||||
TbProdBusq -> FieldDefs -> Add("Familia", ftInteger, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("Familia2", ftInteger, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("EsNodo", ftSmallint, 0, false );
|
||||
|
||||
TbProdBusq -> FieldDefs -> Add("Nombre del Producto", ftString, 50, false );
|
||||
TbProdBusq -> FieldDefs -> Add("CantUnitaria", ftFloat, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("Precio Costo", ftCurrency, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("I.V.A", ftFloat, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("Precio Venta 1", ftCurrency, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("Cantid Venta 1", ftFloat, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("Precio Venta 2", ftCurrency, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("Cantid Venta 2", ftFloat, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("Precio Venta 3", ftCurrency, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("Cantid Venta 3", ftFloat, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("Precio Venta 4", ftCurrency, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("Cantid Venta 4", ftFloat, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("Precio Venta 5", ftCurrency, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("Cantid Venta 5", ftFloat, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("Stock Actual", ftFloat, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("COMBINADO", ftBoolean, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("StockMinimo", ftInteger, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("StockPedido", ftInteger, 0, false );
|
||||
|
||||
TbProdBusq -> FieldDefs -> Add("ProveedorActual", ftInteger, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("IVA Costo", ftFloat, 0, false );
|
||||
|
||||
TbProdBusq -> FieldDefs -> Add("Localizacion", ftString, 64, false );
|
||||
TbProdBusq -> FieldDefs -> Add("EnviarA", ftSmallint, 0, false );
|
||||
|
||||
TbProdBusq -> FieldDefs -> Add("Seguimiento", ftBoolean, 0, false );
|
||||
|
||||
TbProdBusq -> FieldDefs -> Add("PathImagen", ftString, 80, false );
|
||||
TbProdBusq -> FieldDefs -> Add("URLinfo", ftString, 80, false );
|
||||
TbProdBusq -> FieldDefs -> Add("Fabricante", ftString, 30, false );
|
||||
|
||||
TbProdBusq -> IndexDefs-> Clear();
|
||||
|
||||
TIndexOptions MyIndexOptions;
|
||||
MyIndexOptions << ixPrimary << ixUnique;
|
||||
TbProdBusq->IndexDefs->Add("Primary", "ForcedIndex", MyIndexOptions);
|
||||
TbProdBusq->IndexDefs->Add("FamIdx", "Familia;Familia2;EsNodo", TIndexOptions() << ixCaseInsensitive );
|
||||
TbProdBusq->IndexDefs->Add("NombreProd", "Nombre del Producto", TIndexOptions() << ixCaseInsensitive );
|
||||
|
||||
// Creamos la base...
|
||||
TbProdBusq -> CreateTable();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TInitBDE::CreaProductosCircular( TTable *TbProdBusq )
|
||||
{
|
||||
// Establecemos la ruta
|
||||
TbProdBusq -> DatabaseName = "TpvWin";
|
||||
// Facilitamos el nombre de la nueva tabla y su tipo
|
||||
|
||||
// Usamos la propiedad FielDefs para definir
|
||||
// las columnas que contendr<64> la tabla
|
||||
TbProdBusq -> FieldDefs -> Clear();
|
||||
|
||||
TbProdBusq -> FieldDefs -> Add("CodProdC", ftInteger, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("CodProdE", ftInteger, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("Cantidad", ftFloat, 0, false );
|
||||
|
||||
TbProdBusq -> IndexDefs-> Clear();
|
||||
TbProdBusq->IndexDefs->Add("Primary", "CodProdC;CodProdE", TIndexOptions() << ixPrimary << ixUnique );
|
||||
TbProdBusq->IndexDefs->Add("CCircular", "CodProdC", TIndexOptions() << ixCaseInsensitive );
|
||||
|
||||
// Creamos la base...
|
||||
TbProdBusq -> CreateTable();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TInitBDE::CreaProductosHistorico( TTable *TbProdBusq )
|
||||
{
|
||||
// Establecemos la ruta
|
||||
TbProdBusq -> DatabaseName = "TpvWin";
|
||||
// Facilitamos el nombre de la nueva tabla y su tipo
|
||||
|
||||
// Usamos la propiedad FielDefs para definir
|
||||
// las columnas que contendr<64> la tabla
|
||||
TbProdBusq -> FieldDefs -> Clear();
|
||||
|
||||
TbProdBusq -> FieldDefs -> Add("CodProd", ftInteger, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("Fecha", ftDate, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("Precio Venta", ftCurrency, 0, false );
|
||||
TbProdBusq -> FieldDefs -> Add("Precio Costo", ftCurrency, 0, false );
|
||||
|
||||
TbProdBusq -> IndexDefs-> Clear();
|
||||
TbProdBusq->IndexDefs->Add("Primary", "CodProd;Fecha", TIndexOptions() << ixPrimary << ixUnique );
|
||||
TbProdBusq->IndexDefs->Add("CodProd", "CodProd", TIndexOptions() << ixCaseInsensitive );
|
||||
|
||||
// Creamos la base...
|
||||
TbProdBusq -> CreateTable();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TInitBDE::CreaFacturasCmpL( TTable *TbFacturasD )
|
||||
{
|
||||
// Establecemos la ruta
|
||||
TbFacturasD -> DatabaseName = "TpvWin";
|
||||
// Facilitamos el nombre de la nueva tabla y su tipo
|
||||
TbFacturasD -> TableType = ttParadox;
|
||||
|
||||
// Usamos la propiedad FielDefs para definir
|
||||
// las columnas que contendr<64> la tabla
|
||||
TbFacturasD -> FieldDefs -> Clear();
|
||||
TbFacturasD -> FieldDefs -> Add("MaintenedForced", ftAutoInc, 0, false );
|
||||
TbFacturasD -> FieldDefs -> Add("EnlaceFactura", ftInteger, 0, false );
|
||||
TbFacturasD -> FieldDefs -> Add("CodProducto", ftString, 15, false );
|
||||
TbFacturasD -> FieldDefs -> Add("NombreProducto", ftString, 30, false );
|
||||
TbFacturasD -> FieldDefs -> Add("IVA", ftSmallint, 0, false );
|
||||
TbFacturasD -> FieldDefs -> Add("PrecioC", ftCurrency, 0, false );
|
||||
TbFacturasD -> FieldDefs -> Add("Cantidad", ftFloat, 0, false );
|
||||
TbFacturasD -> FieldDefs -> Add("Dto", ftSmallint, 0, false );
|
||||
TbFacturasD -> IndexDefs-> Clear();
|
||||
|
||||
TbFacturasD->IndexDefs->Add("Primary", "MaintenedForced", TIndexOptions() << ixPrimary << ixUnique );
|
||||
TbFacturasD->IndexDefs->Add("EnlaceFactura (idx)", "EnlaceFactura", TIndexOptions() << ixCaseInsensitive );
|
||||
// Creamos la base...
|
||||
TbFacturasD -> CreateTable();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TInitBDE::CreaFacturasCmpC( TTable *TbFacturasC )
|
||||
{
|
||||
// Establecemos la ruta
|
||||
TbFacturasC -> DatabaseName = "TpvWin";
|
||||
// Facilitamos el nombre de la nueva tabla y su tipo
|
||||
TbFacturasC -> TableType = ttParadox;
|
||||
|
||||
// Usamos la propiedad FielDefs para definir
|
||||
// las columnas que contendr<64> la tabla
|
||||
TbFacturasC -> FieldDefs -> Clear();
|
||||
TbFacturasC -> FieldDefs -> Add("EnlaceFactura", ftAutoInc, 0, true );
|
||||
TbFacturasC -> FieldDefs -> Add("CodFactura", ftString, 15, false );
|
||||
TbFacturasC -> FieldDefs -> Add("CodProveedor", ftInteger, 0, false );
|
||||
TbFacturasC -> FieldDefs -> Add("FechaFactura", ftDate, 0, false );
|
||||
|
||||
TbFacturasC -> FieldDefs -> Add("TotalSin", ftCurrency, 0, false );
|
||||
TbFacturasC -> FieldDefs -> Add("TotalIva", ftCurrency, 0, false );
|
||||
TbFacturasC -> FieldDefs -> Add("UltimoPago", ftDate, 0, false );
|
||||
TbFacturasC -> FieldDefs -> Add("TotalFrac", ftCurrency, 0, false );
|
||||
|
||||
// N<> de Pagos en los que divide la factura
|
||||
TbFacturasC -> FieldDefs -> Add("NumeroPagos", ftSmallint, 0, false );
|
||||
|
||||
TbFacturasC -> FieldDefs -> Add("Descripcion", ftString, 30, false );
|
||||
TbFacturasC -> FieldDefs -> Add("Contabilizada", ftBoolean, 0, false );
|
||||
|
||||
TbFacturasC -> FieldDefs -> Add("Banco_Entidad", ftSmallint, 0, false );
|
||||
TbFacturasC -> FieldDefs -> Add("Banco_Sucursal", ftSmallint, 0, false );
|
||||
TbFacturasC -> FieldDefs -> Add("Banco_DC", ftSmallint, 0, false );
|
||||
TbFacturasC -> FieldDefs -> Add("Banco_NumCuenta", ftString, 10, false );
|
||||
|
||||
TbFacturasC -> FieldDefs -> Add("FormaPago", ftSmallint, 0, false );
|
||||
|
||||
TbFacturasC -> FieldDefs -> Add("Cod_Abono_Albaran", ftInteger, 0, false );
|
||||
TbFacturasC -> FieldDefs -> Add("Abono_o_Albaran", ftBoolean, 0, false );
|
||||
|
||||
TbFacturasC -> IndexDefs-> Clear();
|
||||
|
||||
TbFacturasC->IndexDefs->Add("Primary", "EnlaceFactura", TIndexOptions() << ixPrimary << ixUnique );
|
||||
TbFacturasC->IndexDefs->Add("CodProveedor (idx)", "CodProveedor", TIndexOptions() << ixCaseInsensitive );
|
||||
|
||||
// Creamos la base...
|
||||
TbFacturasC -> CreateTable();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TInitBDE::CreaFacturasVntL( TTable *TbVentasD )
|
||||
{
|
||||
// Establecemos la ruta
|
||||
TbVentasD -> DatabaseName = "TpvWin";
|
||||
// Facilitamos el nombre de la nueva tabla y su tipo
|
||||
TbVentasD -> TableType = ttParadox;
|
||||
|
||||
// Usamos la propiedad FielDefs para definir
|
||||
// las columnas que contendr<64> la tabla
|
||||
TbVentasD -> FieldDefs -> Clear();
|
||||
TbVentasD -> FieldDefs -> Add("MaintenedForced", ftAutoInc, 0, false );
|
||||
TbVentasD -> FieldDefs -> Add("EnlaceFactura", ftInteger, 0, false );
|
||||
/*********************************\ */
|
||||
TbVentasD -> FieldDefs -> Add("CodProductoAux", ftInteger, 0, false );
|
||||
TbVentasD -> FieldDefs -> Add("CodProducto", ftString, 15, false );
|
||||
TbVentasD -> FieldDefs -> Add("NombreProducto", ftString, 30, false );
|
||||
/*********************************\
|
||||
TbVentasD -> FieldDefs -> Add("CodProductoAux", ftInteger, 0, false );
|
||||
/*********************************\ */
|
||||
TbVentasD -> FieldDefs -> Add("IVA", ftSmallint, 0, false );
|
||||
TbVentasD -> FieldDefs -> Add("PrecioC", ftCurrency, 0, false );
|
||||
TbVentasD -> FieldDefs -> Add("Cantidad", ftFloat, 0, false );
|
||||
TbVentasD -> FieldDefs -> Add("Dto", ftSmallint, 0, false );
|
||||
TbVentasD -> IndexDefs-> Clear();
|
||||
|
||||
TbVentasD->IndexDefs->Add("Primary", "MaintenedForced", TIndexOptions() << ixPrimary << ixUnique );
|
||||
TbVentasD->IndexDefs->Add("EnlaceFactura (idx)", "EnlaceFactura", TIndexOptions() << ixCaseInsensitive );
|
||||
// Creamos la base...
|
||||
TbVentasD -> CreateTable();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TInitBDE::CreaFacturasVntC( TTable *TbVentasC )
|
||||
{
|
||||
// Establecemos la ruta
|
||||
TbVentasC -> DatabaseName = "TpvWin";
|
||||
// Facilitamos el nombre de la nueva tabla y su tipo
|
||||
TbVentasC -> TableType = ttParadox;
|
||||
|
||||
// Usamos la propiedad FielDefs para definir
|
||||
// las columnas que contendr<64> la tabla
|
||||
TbVentasC -> FieldDefs -> Clear();
|
||||
// El EnlaceFactura sirve de N<> de Albaran
|
||||
TbVentasC -> FieldDefs -> Add("EnlaceFactura", ftAutoInc, 0, true );
|
||||
// C<>digo de Factura que le corresponde a este albaran (0 de no tener)
|
||||
TbVentasC -> FieldDefs -> Add("CodFactura", ftInteger, 0, false );
|
||||
TbVentasC -> FieldDefs -> Add("CodCliente", ftInteger, 0, false );
|
||||
TbVentasC -> FieldDefs -> Add("CodEmpleado", ftInteger, 0, false );
|
||||
TbVentasC -> FieldDefs -> Add("FechaAlbaran", ftDate, 0, false );
|
||||
TbVentasC -> FieldDefs -> Add("FechaFactura", ftDate, 0, false );
|
||||
TbVentasC -> FieldDefs -> Add("HoraFactura", ftTime, 0, false );
|
||||
|
||||
// Si esta CERRADA = 0
|
||||
// sino --> Indica el n<> de terminal que la mantiene abierta
|
||||
TbVentasC -> FieldDefs -> Add("FacturaAbierta", ftSmallint, 0, false );
|
||||
|
||||
// Totales Sin IVA / Montante del IVA / Fecha del Ultimo pago / Total a Fraccionar
|
||||
TbVentasC -> FieldDefs -> Add("TotalSin", ftCurrency, 0, false );
|
||||
TbVentasC -> FieldDefs -> Add("TotalIva", ftCurrency, 0, false );
|
||||
TbVentasC -> FieldDefs -> Add("UltimoPago", ftDate, 0, false );
|
||||
TbVentasC -> FieldDefs -> Add("TotalFrac", ftCurrency, 0, false );
|
||||
|
||||
// N<> de Pagos en los que divide la factura
|
||||
TbVentasC -> FieldDefs -> Add("NumeroPagos", ftSmallint, 0, false );
|
||||
|
||||
// <20> Desea adjuntar las notas, AL IMPRIMIR ?
|
||||
TbVentasC -> FieldDefs -> Add("ImprimirNotas", ftBoolean, 0, false );
|
||||
TbVentasC -> FieldDefs -> Add("NotasFactura", ftMemo, 0, false );
|
||||
|
||||
// <20> Facturada y CONTABILIZADA ?
|
||||
TbVentasC -> FieldDefs -> Add("Contabilizada", ftBoolean, 0, false );
|
||||
|
||||
TbVentasC -> FieldDefs -> Add("Banco_Entidad", ftSmallint, 0, false );
|
||||
TbVentasC -> FieldDefs -> Add("Banco_Sucursal", ftSmallint, 0, false );
|
||||
TbVentasC -> FieldDefs -> Add("Banco_DC", ftSmallint, 0, false );
|
||||
TbVentasC -> FieldDefs -> Add("Banco_NumCuenta", ftString, 10, false );
|
||||
|
||||
TbVentasC -> FieldDefs -> Add("FormaPago", ftSmallint, 0, false );
|
||||
|
||||
// N<> de la Factura a la que abona
|
||||
TbVentasC -> FieldDefs -> Add("Cod_Abono_Albaran", ftInteger, 0, false );
|
||||
// Esta factura es un ABONO / ALBARAN
|
||||
TbVentasC -> FieldDefs -> Add("Abono_o_Albaran", ftBoolean, 0, false );
|
||||
|
||||
TbVentasC -> IndexDefs-> Clear();
|
||||
|
||||
TbVentasC->IndexDefs->Add("Primary", "EnlaceFactura", TIndexOptions() << ixPrimary << ixUnique );
|
||||
TbVentasC->IndexDefs->Add("CodFactura (idx)", "CodFactura", TIndexOptions() << ixCaseInsensitive );
|
||||
TbVentasC->IndexDefs->Add("CodCliente (idx)", "CodCliente", TIndexOptions() << ixCaseInsensitive );
|
||||
TbVentasC->IndexDefs->Add("CodEmpleado (idx)", "CodEmpleado", TIndexOptions() << ixCaseInsensitive );
|
||||
// Creamos la base...
|
||||
TbVentasC -> CreateTable();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TInitBDE::CreaFacturasVntR( TTable *TbVentasC )
|
||||
{
|
||||
// Establecemos la ruta
|
||||
TbVentasC -> DatabaseName = "TpvWin";
|
||||
// Facilitamos el nombre de la nueva tabla y su tipo
|
||||
TbVentasC -> TableType = ttParadox;
|
||||
|
||||
// Usamos la propiedad FielDefs para definir
|
||||
// las columnas que contendr<64> la tabla
|
||||
TbVentasC -> FieldDefs -> Clear();
|
||||
TbVentasC -> FieldDefs -> Add("idF", ftInteger, 0, true );
|
||||
TbVentasC -> FieldDefs -> Add("idA", ftInteger, 0, true );
|
||||
TbVentasC -> FieldDefs -> Add("cerrada", ftBoolean, 0, false );
|
||||
|
||||
TbVentasC -> IndexDefs-> Clear();
|
||||
|
||||
TbVentasC->IndexDefs->Add("Primary", "idF", TIndexOptions() << ixPrimary );
|
||||
// Creamos la base...
|
||||
TbVentasC -> CreateTable();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TInitBDE::CreaInformeVntC( TTable *TbVentasI )
|
||||
{
|
||||
// Establecemos la ruta
|
||||
TbVentasI -> DatabaseName = "TpvWin";
|
||||
// Facilitamos el nombre de la nueva tabla y su tipo
|
||||
TbVentasI -> TableType = ttParadox;
|
||||
|
||||
// Usamos la propiedad FielDefs para definir
|
||||
// las columnas que contendr<64> la tabla
|
||||
TbVentasI -> FieldDefs -> Clear();
|
||||
TbVentasI -> FieldDefs -> Add("FechaCaja", ftDate, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Inicio", ftTime, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Fin", ftTime, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("IntentosSalir", ftSmallint, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("ExitoSalir", ftSmallint, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Tickets", ftSmallint, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Cancelados", ftSmallint, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Cambios", ftSmallint, 0, false );
|
||||
|
||||
TbVentasI -> FieldDefs -> Add("Cantidad x1", ftSmallint, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Total x1", ftInteger, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Cantidad x5", ftSmallint, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Total x5", ftInteger, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Cantidad x10", ftSmallint, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Total x10", ftInteger, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Cantidad x25", ftSmallint, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Total x25", ftInteger, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Cantidad x50", ftSmallint, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Total x50", ftInteger, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Cantidad x100", ftSmallint, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Total x100", ftInteger, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Cantidad x200", ftSmallint, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Total x200", ftInteger, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Cantidad x500", ftSmallint, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Total x500", ftInteger, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Cantidad x1000", ftSmallint, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Total x1000", ftInteger, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Cantidad x2000", ftSmallint, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Total x2000", ftInteger, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Cantidad x5000", ftSmallint, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Total x5000", ftInteger, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Cantidad x10000", ftSmallint, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Total x10000", ftInteger, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Cantidad xvarios", ftSmallint, 0, false );
|
||||
TbVentasI -> FieldDefs -> Add("Total xvarios", ftInteger, 0, false );
|
||||
|
||||
TbVentasI -> FieldDefs -> Add("Notas", ftMemo, 0, false );
|
||||
|
||||
TbVentasI -> IndexDefs-> Clear();
|
||||
|
||||
TbVentasI->IndexDefs->Add("Primary", "FechaCaja", TIndexOptions() << ixPrimary << ixUnique );
|
||||
// Creamos la base...
|
||||
TbVentasI -> CreateTable();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
void __fastcall TInitBDE::CreaCtblCC( TTable *TbCtblCC )
|
||||
{
|
||||
// Establecemos la ruta
|
||||
TbCtblCC -> DatabaseName = "TpvWin";
|
||||
// Facilitamos el nombre de la nueva tabla y su tipo
|
||||
|
||||
// Usamos la propiedad FielDefs para definir
|
||||
// las columnas que contendr<64> la tabla
|
||||
TbCtblCC -> FieldDefs -> Clear();
|
||||
|
||||
TbCtblCC -> FieldDefs -> Add("CCC", ftInteger, 0, false );
|
||||
TbCtblCC -> FieldDefs -> Add("Descripcion", ftString, 40, false );
|
||||
TbCtblCC -> FieldDefs -> Add("TipoCuenta", ftSmallint, 0, false );
|
||||
|
||||
TbCtblCC -> IndexDefs-> Clear();
|
||||
TbCtblCC->IndexDefs->Add("Primary", "CCC", TIndexOptions() << ixPrimary << ixUnique );
|
||||
TbCtblCC->IndexDefs->Add("TCCC", "TipoCuenta", TIndexOptions() << ixCaseInsensitive );
|
||||
|
||||
// Creamos la base...
|
||||
TbCtblCC -> CreateTable();
|
||||
TbCtblCC -> Open();
|
||||
// Insertamos al cliente an<61>nimo...
|
||||
TbCtblCC -> InsertRecord( ARRAYOFCONST( ( 472000016, "IVA Soportado", 0 ) ) );
|
||||
TbCtblCC -> InsertRecord( ARRAYOFCONST( ( 477000016, "IVA Repercutido", 0 ) ) );
|
||||
TbCtblCC -> Close();
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TInitBDE::CreaCtblPteC( TTable *TbCtblPteC )
|
||||
{
|
||||
// Establecemos la ruta
|
||||
TbCtblPteC -> DatabaseName = "TpvWin";
|
||||
// Facilitamos el nombre de la nueva tabla y su tipo
|
||||
|
||||
// Usamos la propiedad FielDefs para definir
|
||||
// las columnas que contendr<64> la tabla
|
||||
TbCtblPteC -> FieldDefs -> Clear();
|
||||
|
||||
TbCtblPteC -> FieldDefs -> Add("nAsiento", ftInteger, 0, false );
|
||||
TbCtblPteC -> FieldDefs -> Add("nOrden", ftInteger, 0, false );
|
||||
TbCtblPteC -> FieldDefs -> Add("Fecha", ftDate, 0, false );
|
||||
TbCtblPteC -> FieldDefs -> Add("CC", ftInteger, 0, false );
|
||||
TbCtblPteC -> FieldDefs -> Add("Importe", ftCurrency,0, false );
|
||||
TbCtblPteC -> FieldDefs -> Add("DebeHaber",ftBoolean, 0, false );
|
||||
TbCtblPteC -> FieldDefs -> Add("Concepto", ftString, 45, false );
|
||||
TbCtblPteC -> FieldDefs -> Add("FactOrig", ftInteger, 0, false );
|
||||
|
||||
TbCtblPteC -> IndexDefs-> Clear();
|
||||
TbCtblPteC->IndexDefs->Add("Primary", "nAsiento;nOrden", TIndexOptions() << ixPrimary << ixUnique );
|
||||
TbCtblPteC->IndexDefs->Add("Fecha", "Fecha;CC", TIndexOptions() << ixCaseInsensitive );
|
||||
TbCtblPteC->IndexDefs->Add("CCuenta", "CC;Fecha", TIndexOptions() << ixCaseInsensitive );
|
||||
|
||||
// Creamos la base...
|
||||
TbCtblPteC -> CreateTable();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TInitBDE::CreaCartera( TTable *TbCartera )
|
||||
{
|
||||
// Establecemos la ruta
|
||||
TbCartera -> DatabaseName = "TpvWin";
|
||||
// Facilitamos el nombre de la nueva tabla y su tipo
|
||||
|
||||
// Usamos la propiedad FielDefs para definir
|
||||
// las columnas que contendr<64> la tabla
|
||||
TbCartera -> FieldDefs -> Clear();
|
||||
|
||||
TbCartera -> FieldDefs -> Add("EnlaceFactura", ftInteger, 0, false );
|
||||
TbCartera -> FieldDefs -> Add("Fecha", ftDate, 0, false );
|
||||
TbCartera -> FieldDefs -> Add("Importe", ftCurrency, 0, false );
|
||||
TbCartera -> FieldDefs -> Add("Incremento", ftCurrency, 0, false );
|
||||
TbCartera -> FieldDefs -> Add("FormaPago", ftSmallint, 0, false );
|
||||
TbCartera -> FieldDefs -> Add("Pagado", ftBoolean, 0, false );
|
||||
|
||||
TbCartera -> IndexDefs-> Clear();
|
||||
TbCartera->IndexDefs->Add("Primary", "EnlaceFactura;Fecha", TIndexOptions() << ixPrimary << ixUnique );
|
||||
TbCartera->IndexDefs->Add("Fecha", "Fecha;EnlaceFactura;Pagado", TIndexOptions() << ixCaseInsensitive );
|
||||
TbCartera->IndexDefs->Add("Pagos", "Pagado;EnlaceFactura;Fecha", TIndexOptions() << ixCaseInsensitive );
|
||||
|
||||
// Creamos la base...
|
||||
TbCartera -> CreateTable();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TInitBDE::CreaPermisos( TTable *TbPermisos )
|
||||
{
|
||||
// Establecemos la ruta
|
||||
TbPermisos -> DatabaseName = "TpvWin";
|
||||
// Facilitamos el nombre de la nueva tabla y su tipo
|
||||
|
||||
// Usamos la propiedad FielDefs para definir
|
||||
// las columnas que contendr<64> la tabla
|
||||
TbPermisos -> FieldDefs -> Clear();
|
||||
|
||||
TbPermisos -> FieldDefs -> Add("EnlacePersona", ftInteger, 0, false );
|
||||
TbPermisos -> FieldDefs -> Add("PassWord", ftString, 64, false );
|
||||
|
||||
TbPermisos -> FieldDefs -> Add("ArtReferencias", ftBoolean, 0, false );
|
||||
TbPermisos -> FieldDefs -> Add("ArtStockActual", ftBoolean, 0, false );
|
||||
TbPermisos -> FieldDefs -> Add("ArtVentas", ftBoolean, 0, false );
|
||||
|
||||
TbPermisos -> FieldDefs -> Add("ProvInformacion", ftBoolean, 0, false );
|
||||
TbPermisos -> FieldDefs -> Add("ProvCartera", ftBoolean, 0, false );
|
||||
TbPermisos -> FieldDefs -> Add("ProvCompras", ftBoolean, 0, false );
|
||||
|
||||
TbPermisos -> FieldDefs -> Add("CltGestion", ftBoolean, 0, false );
|
||||
TbPermisos -> FieldDefs -> Add("CltCartera", ftBoolean, 0, false );
|
||||
TbPermisos -> FieldDefs -> Add("CltVentas", ftBoolean, 0, false );
|
||||
TbPermisos -> FieldDefs -> Add("CltInformes", ftBoolean, 0, false );
|
||||
|
||||
TbPermisos -> FieldDefs -> Add("CtbCuentas", ftBoolean, 0, false );
|
||||
TbPermisos -> FieldDefs -> Add("CtbParte", ftBoolean, 0, false );
|
||||
TbPermisos -> FieldDefs -> Add("CtbInformes", ftBoolean, 0, false );
|
||||
|
||||
TbPermisos -> FieldDefs -> Add("CmpComprar", ftBoolean, 0, false );
|
||||
TbPermisos -> FieldDefs -> Add("CmpInforme", ftBoolean, 0, false );
|
||||
TbPermisos -> FieldDefs -> Add("CmpListado", ftBoolean, 0, false );
|
||||
|
||||
TbPermisos -> FieldDefs -> Add("EmpFichas", ftBoolean, 0, false );
|
||||
TbPermisos -> FieldDefs -> Add("EmpPermisos", ftBoolean, 0, false );
|
||||
TbPermisos -> FieldDefs -> Add("EmpVentas", ftBoolean, 0, false );
|
||||
TbPermisos -> FieldDefs -> Add("EmpGraficas", ftBoolean, 0, false );
|
||||
|
||||
TbPermisos -> FieldDefs -> Add("VntCaja", ftBoolean, 0, false );
|
||||
TbPermisos -> FieldDefs -> Add("VntBalanceD", ftBoolean, 0, false );
|
||||
TbPermisos -> FieldDefs -> Add("VntBalanceM", ftBoolean, 0, false );
|
||||
|
||||
TbPermisos -> FieldDefs -> Add("MisConfigurar", ftBoolean, 0, false );
|
||||
|
||||
TbPermisos -> IndexDefs-> Clear();
|
||||
TbPermisos->IndexDefs->Add("Primary", "EnlacePersona", TIndexOptions() << ixPrimary << ixUnique );
|
||||
|
||||
// Creamos la base...
|
||||
TbPermisos -> CreateTable();
|
||||
|
||||
TbPermisos -> Open();
|
||||
// Insertamos al cliente an<61>nimo...
|
||||
TVarRec v[] = { 1, "", false, false, false, // Art
|
||||
false, false, false, // Prov
|
||||
false, false, false, false, // Clt
|
||||
false, false, false, // Ctb
|
||||
false, false, false, // Cmp
|
||||
false, true, false, false, // Emp
|
||||
false, false, false, // Vnt
|
||||
false }; // Misc.
|
||||
TbPermisos -> InsertRecord( v, ARRAYSIZE(v) - 1);
|
||||
TbPermisos -> Close();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TInitBDE::Timer1Timer(TObject *Sender)
|
||||
{
|
||||
if ( CloseOK )
|
||||
Close();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user