This commit is contained in:
DeGsoft 2011-07-24 21:48:22 -03:00
Родитель e6ccacde01
Коммит e278f9d172
2121 изменённых файлов: 544865 добавлений и 0 удалений

Двоичные данные
ABM/Articulo/Form/UFProductos.dcu Normal file

Двоичный файл не отображается.

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,582 @@
//******************************************************************************
//* DeGsoft GeN *
//* =========== *
//* GeN(tm) : ERP Software (http://www.degsoft.com.ar/sistemas/GeN) *
//* Copyright (c) 2002-2011 by the Degsoft *
//* For more information visit: http://www.degsoft.com.ar *
//* This program is free software. You can redistribute it and/or modify *
//* it under the terms of the GNU General Public License as published by *
//* the Free Software Foundation; either version 3 of the License. *
//******************************************************************************
unit UFProductos;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DataModule, Grids, DBGrids, DB, ExtCtrls, StdCtrls, Mask,
DBCtrls, Buttons, ComCtrls, IBQuery, IBCustomDataSet, IBTable, OleCtrls,
SHDocVw;
const
EAN_izqA : array[0..9] of PChar=('0001101','0011001','0010011','0111101','0100011','0110001','0101111','0111011','0110111','0001011');
EAN_izqB : array[0..9] of PChar=('0100111','0110011','0011011','0100001','0011101','0111001','0000101','0010001','0001001','0010111');
EAN_dcha : array[0..9] of PChar=('1110010','1100110','1101100','1000010','1011100','1001110','1010000','1000100','1001000','1110100');
CodificaIzq : array[0..9] of PChar=('AAAAA','ABABB','ABBAB','ABBBA','BAABB','BBAAB','BBBAA','BABAB','BABBA','BBABA');
type
TFProductos = class(TForm)
DataSource: TDataSource;
DSTCat: TDataSource;
DSTSubCat: TDataSource;
DSMateriales: TDataSource;
DSRubro: TDataSource;
DSQProve: TDataSource;
MarcaDataSource: TDataSource;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet3: TTabSheet;
Panel3: TPanel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label2: TLabel;
Label14: TLabel;
Label23: TLabel;
DescripcionDBEdit: TDBEdit;
DBEdit1: TDBEdit;
DBLookupComboBox4: TDBLookupComboBox;
BitBtn13: TBitBtn;
Label8: TLabel;
Label19: TLabel;
Label30: TLabel;
Label10: TLabel;
Label5: TLabel;
DBText1: TDBText;
Label16: TLabel;
Label28: TLabel;
Label21: TLabel;
IVADBEdit: TDBEdit;
FleteDBEdit: TDBEdit;
CostoDBEdit: TDBEdit;
Label4: TLabel;
PrecioCtaCteDBEdit: TDBEdit;
DBMemo1: TDBMemo;
TabSheet2: TTabSheet;
Label6: TLabel;
Label15: TLabel;
Label17: TLabel;
Label18: TLabel;
Label20: TLabel;
DBEdit6: TDBEdit;
DBEdit5: TDBEdit;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
DBEdit17: TDBEdit;
DBEdit9: TDBEdit;
Label9: TLabel;
DBEdit21: TDBEdit;
Label32: TLabel;
Label33: TLabel;
Label34: TLabel;
GanaciaDBEdit: TDBEdit;
TabSheet4: TTabSheet;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label7: TLabel;
Label31: TLabel;
Label3: TLabel;
Label22: TLabel;
Precio1DBEdit: TDBEdit;
Precio2DBEdit: TDBEdit;
Precio3DBEdit: TDBEdit;
Precio6DBEdit: TDBEdit;
Precio4DBEdit: TDBEdit;
Precio5DBEdit: TDBEdit;
DBText2: TDBText;
TabSheet5: TTabSheet;
CuentaDataSource: TDataSource;
Label50: TLabel;
CuentaDBLookupComboBox: TDBLookupComboBox;
DBLookupComboBox1: TDBLookupComboBox;
DBLookupComboBox2: TDBLookupComboBox;
DBLookupComboBox7: TDBLookupComboBox;
Label54: TLabel;
Label53: TLabel;
Label51: TLabel;
Label52: TLabel;
Label25: TLabel;
Label26: TLabel;
Label27: TLabel;
RubroDBLookupComboBox: TDBLookupComboBox;
RubroBitBtn: TBitBtn;
MarcaDBLookupComboBox: TDBLookupComboBox;
MarcaBitBtn: TBitBtn;
CategoriaDBLookupComboBox: TDBLookupComboBox;
CategoriaBitBtn: TBitBtn;
Label29: TLabel;
Tabla: TIBTable;
CategoriaT: TIBTable;
SubCategoriaT: TIBTable;
RubroT: TIBTable;
MaterialT: TIBTable;
QTemp: TIBQuery;
Usuario: TIBQuery;
DSUsuarios: TDataSource;
CuentaQuery: TIBQuery;
MarcaT: TIBTable;
ProveedorT: TIBTable;
ConfigQuery: TIBQuery;
Label1: TLabel;
CodigoDBEdit: TDBEdit;
BitBtn4: TBitBtn;
DBNavigator1: TDBNavigator;
Label24: TLabel;
CodigoBarraEdit: TDBEdit;
CodigoBarraBitBtn: TBitBtn;
PaintBox1: TImage;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure RubroBitBtnClick(Sender: TObject);
procedure CodigoBarraBitBtnClick(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Precio6DBEditExit(Sender: TObject);
procedure CategoriaBitBtnClick(Sender: TObject);
procedure MarcaBitBtnClick(Sender: TObject);
procedure DBEdit14Exit(Sender: TObject);
procedure BitBtn13Click(Sender: TObject);
procedure TablaAfterInsert(DataSet: TDataSet);
procedure GanaciaDBEditExit(Sender: TObject);
procedure TablaAfterPost(DataSet: TDataSet);
procedure TablaAfterCancel(DataSet: TDataSet);
procedure TablaAfterDelete(DataSet: TDataSet);
procedure MarcaDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure DBLookupComboBox4Enter(Sender: TObject);
procedure CategoriaDBLookupComboBoxEnter(Sender: TObject);
procedure RubroDBLookupComboBoxEnter(Sender: TObject);
procedure MarcaDBLookupComboBoxEnter(Sender: TObject);
private
{ Private declarations }
public
desc:string;
Precio1, Precio2, Precio3, Precio4, Precio5, Precio6, PrecioCtaCte: Double;
{ Public declarations }
// procedimiento que codifica el número en un nº binario
procedure Codifica(num : string);
// procedimiento para dibujar el cód. de barras a partir del nº binario
procedure Dibujar(matrix : string);
// procedimiento para validar-corregir los códigos
procedure EANCorrecto(var num : string);
Procedure nuevo;
end;
var
FProductos: TFProductos;
implementation
uses UFBuscaArticulos, Color;
{$R *.dfm}
procedure TFProductos.EANCorrecto(var num : string);
var
i,N : byte;
sum : integer;
flag : byte;
begin
sum:=0;
N:=Length(num)-1; //13-1=12
for i:=1 to N do //desde 1 hasta 12
begin
if (i mod 2)=0 then // x mod y = x – (x div y) * y = 1-(0.5)*2
begin
if N=12 then
sum:=sum+StrToInt(num[i])*3
else
sum:=sum+StrToInt(num[i]);
end
else
begin
if N=12 then
sum:=sum+StrToInt(num[i])
else
sum:=sum+StrToInt(num[i])*3;
end;
end;
if sum>99 then
Flag:=10-(sum mod 100)
else
Flag:=10-(sum mod 10);
if Flag=10 then Flag:=0;
if not(StrToInt(num[N+1])=flag) then
num:=copy(num,1,length(num)-1)+IntToStr(Flag);
end;
procedure TFProductos.Codifica(num : string);
var
matrix : string;
i : integer;
begin
num:=CodigoBarraEdit.Text; //numero
matrix:='';
case Length(num) of //mientras sean 13 caracteres
13: begin
EANCorrecto(num); //
CodigoBarraEdit.Text:=num;
matrix:=matrix+'x0x'; // barra inicio
matrix:=matrix+EAN_izqA[StrToInt(num[2])];
for i:=3 to 7 do
if CodificaIzq[StrToInt(num[1])][i-3]='A' then
matrix:=matrix+EAN_izqA[StrToInt(num[i])]
else
matrix:=matrix+EAN_izqB[StrToInt(num[i])];
matrix:=matrix+'0x0x0'; // barra central
matrix:=matrix+EAN_dcha[StrToInt(num[8])];
matrix:=matrix+EAN_dcha[StrToInt(num[9])];
matrix:=matrix+EAN_dcha[StrToInt(num[10])];
matrix:=matrix+EAN_dcha[StrToInt(num[11])];
matrix:=matrix+EAN_dcha[StrToInt(num[12])];
matrix:=matrix+EAN_dcha[StrToInt(num[13])];
matrix:=matrix+'x0x'; // barra final
Dibujar(Matrix);
end;
8: begin
EANCorrecto(num);
CodigoBarraEdit.Text:=num;
matrix:=matrix+'x0x';
matrix:=matrix+EAN_izqA[StrToInt(num[1])];
matrix:=matrix+EAN_izqA[StrToInt(num[2])];
matrix:=matrix+EAN_izqA[StrToInt(num[3])];
matrix:=matrix+EAN_izqA[StrToInt(num[4])];
matrix:=matrix+'0x0x0';
matrix:=matrix+EAN_dcha[StrToInt(num[5])];
matrix:=matrix+EAN_dcha[StrToInt(num[6])];
matrix:=matrix+EAN_dcha[StrToInt(num[7])];
matrix:=matrix+EAN_dcha[StrToInt(num[8])];
matrix:=matrix+'x0x';
Dibujar(Matrix);
end
else
ShowMessage('LONGITUD DE CODIGO NO VALIDA');
end;
end;
procedure TFProductos.Dibujar(matrix : string);
var
i : integer;
begin
with PaintBox1 do begin
Canvas.Brush.Color:= clWhite;
Canvas.FillRect(Rect(0,0,PaintBox1.Width,PaintBox1.Height));
Canvas.Pen.Color:=clBlack;
END;
for i:=1 to Length(Matrix) do
if matrix[i]='1' then
PaintBox1.Canvas.PolyLine([Point(10+i,10),Point(10+i,50)])
else
if matrix[i]='x' then
PaintBox1.Canvas.PolyLine([Point(10+i,10),Point(10+i,55)]);
if Length(CodigoBarraEdit.Text)=13 then
begin
PaintBox1.Canvas.TextOut(3,50,CodigoBarraEdit.Text[1]);
PaintBox1.Canvas.TextOut(17,50,copy(CodigoBarraEdit.Text,2,6));
PaintBox1.Canvas.TextOut(63,50,copy(CodigoBarraEdit.Text,8,6));
end
else
if Length(CodigoBarraEdit.Text)=8 then
begin
PaintBox1.Canvas.TextOut(16,50,copy(CodigoBarraEdit.Text,1,4));
PaintBox1.Canvas.TextOut(48,50,copy(CodigoBarraEdit.Text,5,4));
end;
end;
procedure TFProductos.BitBtn1Click(Sender: TObject);
begin
desc:=CodigoDBEdit.Text;
If (Tabla.State = dsEdit) or (Tabla.State = dsInsert) And (DescripcionDBEdit.Text <> '') then Tabla.Post
else if (DescripcionDBEdit.Text <> '') then ShowMessage('COMPLETE TODOS LOS CAMPOS');
Close;
end;
procedure TFProductos.BitBtn2Click(Sender: TObject);
begin
Tabla.Cancel;
Close;
end;
procedure TFProductos.FormCreate(Sender: TObject);
begin
DM:=TDM.Create(Self);
Tabla.Active := True;
SubCategoriaT.Active := True;
ProveedorT.Active := True;
RubroT.Active := True;
MarcaT.Active := True;
CategoriaT.Active := True;
ConfigQuery.Open;
Precio1:=ConfigQuery.FieldByName('PP1').AsFloat/100+1;
Precio2:=ConfigQuery.FieldByName('PP2').AsFloat/100+1;
Precio3:=ConfigQuery.FieldByName('PP3').AsFloat/100+1;
Precio4:=ConfigQuery.FieldByName('PP4').AsFloat/100+1;
Precio5:=ConfigQuery.FieldByName('PP5').AsFloat/100+1;
Precio6:=ConfigQuery.FieldByName('PP6').AsFloat/100+1;
PrecioCtaCte:=ConfigQuery.FieldByName('PP').AsFloat/100+1;
QTemp.Close;
CuentaQuery.Open;
Tabla.Insert;
end;
procedure TFProductos.BitBtn4Click(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
Tabla.Cancel;
FBuscaArticulo:=TFBuscaArticulo.Create(self);
try
FBuscaArticulo.ShowModal;
finally
If FBuscaArticulo.Tabla.Active =True then
Tabla.Locate('CODIGO',FBuscaArticulo.Tabla.FieldByName('CODIGO').AsInteger,[]);
FBuscaArticulo.Free;
end;
Tabla.Edit;
end;
procedure TFProductos.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then { if it's an enter key }
begin
Key := #0; { eat enter key }
Perform(WM_NEXTDLGCTL, 0, 0); { move to next control }
end;
end;
procedure TFProductos.GanaciaDBEditExit(Sender: TObject);
var costo, flete, iva :double;
begin
if CostoDBEdit.Text = '' then CostoDBEdit.Text:='0';
if FleteDBEdit.Text = '' then FleteDBEdit.Text:='0';
if IVADBEdit.Text = '' then IVADBEdit.Text:='0';
if GanaciaDBEdit.Text = '' then GanaciaDBEdit.Text:='0';
costo:=StrToFloat(CostoDBEdit.Text);
flete:=costo*(StrToFloat(FleteDBEdit.Text)/100);
iva:=costo*(StrToFloat(IVADBEdit.Text)/100);
Precio1DBEdit.Text:=FloatToStr((costo*Precio1)+flete+iva);
Precio2DBEdit.Text:=FloatToStr((costo*Precio2)+flete+iva);
Precio3DBEdit.Text:=FloatToStr((costo*Precio3)+flete+iva);
Precio4DBEdit.Text:=FloatToStr((costo*Precio4)+flete+iva);
Precio5DBEdit.Text:=FloatToStr((costo*Precio5)+flete+iva);
Precio6DBEdit.Text:=FloatToStr((costo*Precio6)+flete+iva);
if GanaciaDBEdit.Text='0' then PrecioCtaCteDBEdit.Text:=FloatToStr((costo*PrecioCtaCte)+flete+iva) else PrecioCtaCteDBEdit.Text:=FloatToStr((costo*(StrToFloat(GanaciaDBEdit.Text)/100+1)+flete+iva));
Label21.Caption:= '= '+FloatToStr(iva);
DBText1.Caption:= FloatToStr(costo+flete);
DBText2.Caption:= FloatToStr(costo+flete+iva);
BitBtn1.SetFocus;
end;
Procedure TFProductos.nuevo;
begin
Tabla.FieldByName('CtaNombre').AsString:='13';
Tabla.FieldByName('CtaTipo').AsString:='13';
Tabla.FieldByName('CtaAnticipo').AsString:='13';
Tabla.FieldByName('CtaIIBB').AsString:='66';
Tabla.FieldByName('CODIGOBARRA').AsString:= '0';
Tabla.FieldByName('Color').AsString:= '0';
Tabla.FieldByName('Categoria').AsString:= '0';
Tabla.FieldByName('SubCategoria').AsString:= '0';
Tabla.FieldByName('Rubro').AsString := '0';
Tabla.FieldByName('Marca').AsString := '0';
Tabla.FieldByName('Proveedor').Value := 1;
DBLookupComboBox4.KeyValue := 0;
DbEdit9.Field.AsString := 'c/u';
DbEdit17.Field.AsDateTime := Date;
Tabla.FieldByName('Costo').AsInteger:= 0;
CostoDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('ImpOtros').AsInteger:= 0;
FleteDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('Tasa').AsInteger:= 0;
IVADBEdit.Field.AsFloat := 0;
Tabla.FieldByName('Precio').AsInteger:= 0;
PrecioCtaCteDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('IIBB').AsInteger:= 0;
end;
procedure TFProductos.RubroBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Rubro.exe')),SW_SHOWNORMAL);
{ RubroForm:=RubroForm.Create(self);
try
RubroForm.ShowModal;
finally
If RubroForm.desc <> '' then
RubroDBLookupComboBox.KeyValue:= RubroForm.desc;
Tabla.FieldByName('Rubro').AsString:=RubroForm.desc;
RubroForm.Free;
end;
RubroT.Close;
RubroT.Open;
MarcaDBLookupComboBox.SetFocus;
}
end;
procedure TFProductos.RubroDBLookupComboBoxEnter(Sender: TObject);
begin
RubroT.Close;
RubroT.Open;
RubroT.Last;
end;
procedure TFProductos.CodigoBarraBitBtnClick(Sender: TObject);
var
i : integer;
begin
if Tabla.State = dsInsert then
begin
QTemp.Close;
QTemp.SQL.Text:='SELECT max(CODIGO) FROM "Articulo"';
QTemp.Open;
i:= 100000 + (QTemp.Fields.Fields[0].AsInteger +1); //agrego el codigo
end
else
begin
i:= 100000 + strtoint(CodigoDBEdit.Text);
IF (Tabla.State <> dsEdit) then Tabla.Edit;
end;
//codigo de barras
CodigoBarraEdit.Text := '1'+inttostr(i)+'2'; //lo incluyo en el codigo de barra
Codifica(CodigoBarraEdit.Text);
CodigoBarraEdit.SelStart:=0;
CodigoBarraEdit.SelLength:=Length(CodigoBarraEdit.Text);
Tabla.FieldByName('CodigoBarra').AsString := CodigoBarraEdit.Text;
end;
procedure TFProductos.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
IF Key = VK_F2 then RubroBitBtn.Click;
IF Key = VK_F3 then MarcaBitBtn.Click;
IF Key = VK_F4 then BitBtn13.Click;
IF Key = VK_F5 then BitBtn4.Click;
IF Key = VK_F6 then CodigoBarraBitBtn.Click;
end;
procedure TFProductos.Precio6DBEditExit(Sender: TObject);
begin
IVADBEdit.SetFocus;
end;
procedure TFProductos.CategoriaBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Categoria.exe')),SW_SHOWNORMAL);
{
FCategorias:=TFCategorias.Create(self);
try
FCategorias.ShowModal;
finally
If FCategorias.desc <> '' then
begin
CategoriaDBLookupComboBox.KeyValue:= FCategorias.desc;
Tabla.FieldByName('Categoria').AsString:=FCategorias.desc;
end;
FCategorias.Free;
end;
CategoriaT.Close;
CategoriaT.Open;
RubroDBLookupComboBox.SetFocus;
}
end;
procedure TFProductos.CategoriaDBLookupComboBoxEnter(Sender: TObject);
begin
CategoriaT.Close;
CategoriaT.Open;
CategoriaT.Last;
end;
procedure TFProductos.MarcaBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Marca.exe')),SW_SHOWNORMAL);
{ MarcaForm:=TMarcaForm.Create(self);
try
MarcaForm.ShowModal;
finally
If MarcaForm.desc <> '' then
begin
MarcaDBLookupComboBox.KeyValue:= MarcaForm.desc;
If (Tabla.State <> dsEdit) and (Tabla.State <> dsInsert) then Tabla.Edit;
Tabla.FieldByName('Marca').AsString:=MarcaForm.desc;
end;
MarcaForm.Free;
end;
MarcaT.Close;
MarcaT.Open;
DBEdit9.SetFocus;
}
end;
procedure TFProductos.MarcaDBLookupComboBoxEnter(Sender: TObject);
begin
MarcaT.Close;
MarcaT.Open;
MarcaT.Last;
end;
procedure TFProductos.MarcaDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
MarcaT.Close;
MarcaT.Open;
MarcaT.Last;
end;
procedure TFProductos.DBEdit14Exit(Sender: TObject);
begin
BitBtn1.SetFocus;
end;
procedure TFProductos.DBLookupComboBox4Enter(Sender: TObject);
begin
ProveedorT.Close;
ProveedorT.Open;
ProveedorT.Last;
end;
procedure TFProductos.BitBtn13Click(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Proveedor.exe')),SW_SHOWNORMAL);
end;
procedure TFProductos.TablaAfterCancel(DataSet: TDataSet);
begin
Tabla.Transaction.RollbackRetaining;
end;
procedure TFProductos.TablaAfterDelete(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFProductos.TablaAfterInsert(DataSet: TDataSet);
begin
If Cancelar then Tabla.Cancel else nuevo;
end;
procedure TFProductos.TablaAfterPost(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
end.

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,563 @@
unit UFProductos;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DataModule, Grids, DBGrids, DB, ExtCtrls, StdCtrls, Mask,
DBCtrls, Buttons, ComCtrls, IBQuery, IBCustomDataSet, IBTable, OleCtrls,
SHDocVw;
const
EAN_izqA : array[0..9] of PChar=('0001101','0011001','0010011','0111101','0100011','0110001','0101111','0111011','0110111','0001011');
EAN_izqB : array[0..9] of PChar=('0100111','0110011','0011011','0100001','0011101','0111001','0000101','0010001','0001001','0010111');
EAN_dcha : array[0..9] of PChar=('1110010','1100110','1101100','1000010','1011100','1001110','1010000','1000100','1001000','1110100');
CodificaIzq : array[0..9] of PChar=('AAAAA','ABABB','ABBAB','ABBBA','BAABB','BBAAB','BBBAA','BABAB','BABBA','BBABA');
type
TFProductos = class(TForm)
DataSource: TDataSource;
DSTCat: TDataSource;
DSTSubCat: TDataSource;
DSMateriales: TDataSource;
DSRubro: TDataSource;
DSQProve: TDataSource;
MarcaDataSource: TDataSource;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet3: TTabSheet;
Panel3: TPanel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label2: TLabel;
Label14: TLabel;
Label23: TLabel;
DescripcionDBEdit: TDBEdit;
DBEdit1: TDBEdit;
DBLookupComboBox4: TDBLookupComboBox;
BitBtn13: TBitBtn;
Label8: TLabel;
Label19: TLabel;
Label30: TLabel;
Label10: TLabel;
Label5: TLabel;
DBText1: TDBText;
Label16: TLabel;
Label28: TLabel;
Label21: TLabel;
IVADBEdit: TDBEdit;
FleteDBEdit: TDBEdit;
CostoDBEdit: TDBEdit;
Label4: TLabel;
PrecioCtaCteDBEdit: TDBEdit;
DBMemo1: TDBMemo;
TabSheet2: TTabSheet;
Label6: TLabel;
Label15: TLabel;
Label17: TLabel;
Label18: TLabel;
Label20: TLabel;
DBEdit6: TDBEdit;
DBEdit5: TDBEdit;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
DBEdit17: TDBEdit;
DBEdit9: TDBEdit;
Label9: TLabel;
DBEdit21: TDBEdit;
Label32: TLabel;
Label33: TLabel;
Label34: TLabel;
GanaciaDBEdit: TDBEdit;
TabSheet4: TTabSheet;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label7: TLabel;
Label31: TLabel;
Label3: TLabel;
Label22: TLabel;
Precio1DBEdit: TDBEdit;
Precio2DBEdit: TDBEdit;
Precio3DBEdit: TDBEdit;
Precio6DBEdit: TDBEdit;
Precio4DBEdit: TDBEdit;
Precio5DBEdit: TDBEdit;
DBText2: TDBText;
TabSheet5: TTabSheet;
CuentaDataSource: TDataSource;
Label50: TLabel;
CuentaDBLookupComboBox: TDBLookupComboBox;
DBLookupComboBox1: TDBLookupComboBox;
DBLookupComboBox2: TDBLookupComboBox;
DBLookupComboBox7: TDBLookupComboBox;
Label54: TLabel;
Label53: TLabel;
Label51: TLabel;
Label52: TLabel;
Label25: TLabel;
Label26: TLabel;
Label27: TLabel;
RubroDBLookupComboBox: TDBLookupComboBox;
RubroBitBtn: TBitBtn;
MarcaDBLookupComboBox: TDBLookupComboBox;
MarcaBitBtn: TBitBtn;
CategoriaDBLookupComboBox: TDBLookupComboBox;
CategoriaBitBtn: TBitBtn;
Label29: TLabel;
Tabla: TIBTable;
CategoriaT: TIBTable;
SubCategoriaT: TIBTable;
RubroT: TIBTable;
MaterialT: TIBTable;
QTemp: TIBQuery;
Usuario: TIBQuery;
DSUsuarios: TDataSource;
CuentaQuery: TIBQuery;
MarcaT: TIBTable;
ProveedorT: TIBTable;
ConfigQuery: TIBQuery;
Label1: TLabel;
CodigoDBEdit: TDBEdit;
BitBtn4: TBitBtn;
DBNavigator1: TDBNavigator;
Label24: TLabel;
CodigoBarraEdit: TDBEdit;
CodigoBarraBitBtn: TBitBtn;
PaintBox1: TImage;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure RubroBitBtnClick(Sender: TObject);
procedure CodigoBarraBitBtnClick(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Precio6DBEditExit(Sender: TObject);
procedure CategoriaBitBtnClick(Sender: TObject);
procedure MarcaBitBtnClick(Sender: TObject);
procedure DBEdit14Exit(Sender: TObject);
procedure BitBtn13Click(Sender: TObject);
procedure TablaAfterInsert(DataSet: TDataSet);
procedure GanaciaDBEditExit(Sender: TObject);
procedure TablaAfterPost(DataSet: TDataSet);
procedure TablaAfterCancel(DataSet: TDataSet);
procedure TablaAfterDelete(DataSet: TDataSet);
procedure MarcaDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure RubroDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure CategoriaDBLookupComboBoxStartDock(Sender: TObject;
var DragObject: TDragDockObject);
procedure DBLookupComboBox4Enter(Sender: TObject);
private
{ Private declarations }
public
desc:string;
Precio1, Precio2, Precio3, Precio4, Precio5, Precio6, PrecioCtaCte: Double;
{ Public declarations }
// procedimiento que codifica el número en un nº binario
procedure Codifica(num : string);
// procedimiento para dibujar el cód. de barras a partir del nº binario
procedure Dibujar(matrix : string);
// procedimiento para validar-corregir los códigos
procedure EANCorrecto(var num : string);
Procedure nuevo;
end;
var
FProductos: TFProductos;
implementation
uses UFBuscaArticulos,
UFCategorias, UFSubCategorias, Color, Marca, RubroF;
{$R *.dfm}
procedure TFProductos.EANCorrecto(var num : string);
var
i,N : byte;
sum : integer;
flag : byte;
begin
sum:=0;
N:=Length(num)-1; //13-1=12
for i:=1 to N do //desde 1 hasta 12
begin
if (i mod 2)=0 then // x mod y = x – (x div y) * y = 1-(0.5)*2
begin
if N=12 then
sum:=sum+StrToInt(num[i])*3
else
sum:=sum+StrToInt(num[i]);
end
else
begin
if N=12 then
sum:=sum+StrToInt(num[i])
else
sum:=sum+StrToInt(num[i])*3;
end;
end;
if sum>99 then
Flag:=10-(sum mod 100)
else
Flag:=10-(sum mod 10);
if Flag=10 then Flag:=0;
if not(StrToInt(num[N+1])=flag) then
num:=copy(num,1,length(num)-1)+IntToStr(Flag);
end;
procedure TFProductos.Codifica(num : string);
var
matrix : string;
i : integer;
begin
num:=CodigoBarraEdit.Text; //numero
matrix:='';
case Length(num) of //mientras sean 13 caracteres
13: begin
EANCorrecto(num); //
CodigoBarraEdit.Text:=num;
matrix:=matrix+'x0x'; // barra inicio
matrix:=matrix+EAN_izqA[StrToInt(num[2])];
for i:=3 to 7 do
if CodificaIzq[StrToInt(num[1])][i-3]='A' then
matrix:=matrix+EAN_izqA[StrToInt(num[i])]
else
matrix:=matrix+EAN_izqB[StrToInt(num[i])];
matrix:=matrix+'0x0x0'; // barra central
matrix:=matrix+EAN_dcha[StrToInt(num[8])];
matrix:=matrix+EAN_dcha[StrToInt(num[9])];
matrix:=matrix+EAN_dcha[StrToInt(num[10])];
matrix:=matrix+EAN_dcha[StrToInt(num[11])];
matrix:=matrix+EAN_dcha[StrToInt(num[12])];
matrix:=matrix+EAN_dcha[StrToInt(num[13])];
matrix:=matrix+'x0x'; // barra final
Dibujar(Matrix);
end;
8: begin
EANCorrecto(num);
CodigoBarraEdit.Text:=num;
matrix:=matrix+'x0x';
matrix:=matrix+EAN_izqA[StrToInt(num[1])];
matrix:=matrix+EAN_izqA[StrToInt(num[2])];
matrix:=matrix+EAN_izqA[StrToInt(num[3])];
matrix:=matrix+EAN_izqA[StrToInt(num[4])];
matrix:=matrix+'0x0x0';
matrix:=matrix+EAN_dcha[StrToInt(num[5])];
matrix:=matrix+EAN_dcha[StrToInt(num[6])];
matrix:=matrix+EAN_dcha[StrToInt(num[7])];
matrix:=matrix+EAN_dcha[StrToInt(num[8])];
matrix:=matrix+'x0x';
Dibujar(Matrix);
end
else
ShowMessage('LONGITUD DE CODIGO NO VALIDA');
end;
end;
procedure TFProductos.Dibujar(matrix : string);
var
i : integer;
begin
with PaintBox1 do begin
Canvas.Brush.Color:= clWhite;
Canvas.FillRect(Rect(0,0,PaintBox1.Width,PaintBox1.Height));
Canvas.Pen.Color:=clBlack;
END;
for i:=1 to Length(Matrix) do
if matrix[i]='1' then
PaintBox1.Canvas.PolyLine([Point(10+i,10),Point(10+i,50)])
else
if matrix[i]='x' then
PaintBox1.Canvas.PolyLine([Point(10+i,10),Point(10+i,55)]);
if Length(CodigoBarraEdit.Text)=13 then
begin
PaintBox1.Canvas.TextOut(3,50,CodigoBarraEdit.Text[1]);
PaintBox1.Canvas.TextOut(17,50,copy(CodigoBarraEdit.Text,2,6));
PaintBox1.Canvas.TextOut(63,50,copy(CodigoBarraEdit.Text,8,6));
end
else
if Length(CodigoBarraEdit.Text)=8 then
begin
PaintBox1.Canvas.TextOut(16,50,copy(CodigoBarraEdit.Text,1,4));
PaintBox1.Canvas.TextOut(48,50,copy(CodigoBarraEdit.Text,5,4));
end;
end;
procedure TFProductos.BitBtn1Click(Sender: TObject);
begin
desc:=CodigoDBEdit.Text;
If (Tabla.State = dsEdit) or (Tabla.State = dsInsert) And (DescripcionDBEdit.Text <> '') then Tabla.Post
else if (DescripcionDBEdit.Text <> '') then ShowMessage('COMPLETE TODOS LOS CAMPOS');
Close;
end;
procedure TFProductos.BitBtn2Click(Sender: TObject);
begin
Tabla.Cancel;
Close;
end;
procedure TFProductos.FormCreate(Sender: TObject);
begin
DM:=TDM.Create(Self);
Tabla.Active := True;
SubCategoriaT.Active := True;
ProveedorT.Active := True;
RubroT.Active := True;
MarcaT.Active := True;
CategoriaT.Active := True;
ConfigQuery.Open;
Precio1:=ConfigQuery.FieldByName('PP1').AsFloat/100+1;
Precio2:=ConfigQuery.FieldByName('PP2').AsFloat/100+1;
Precio3:=ConfigQuery.FieldByName('PP3').AsFloat/100+1;
Precio4:=ConfigQuery.FieldByName('PP4').AsFloat/100+1;
Precio5:=ConfigQuery.FieldByName('PP5').AsFloat/100+1;
Precio6:=ConfigQuery.FieldByName('PP6').AsFloat/100+1;
PrecioCtaCte:=ConfigQuery.FieldByName('PP').AsFloat/100+1;
QTemp.Close;
CuentaQuery.Open;
Tabla.Insert;
end;
procedure TFProductos.BitBtn4Click(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
Tabla.Cancel;
FBuscaArticulo:=TFBuscaArticulo.Create(self);
try
FBuscaArticulo.ShowModal;
finally
If FBuscaArticulo.Tabla.Active =True then
Tabla.Locate('CODIGO',FBuscaArticulo.Tabla.FieldByName('CODIGO').AsInteger,[]);
FBuscaArticulo.Free;
end;
Tabla.Edit;
end;
procedure TFProductos.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then { if it's an enter key }
begin
Key := #0; { eat enter key }
Perform(WM_NEXTDLGCTL, 0, 0); { move to next control }
end;
end;
procedure TFProductos.GanaciaDBEditExit(Sender: TObject);
var costo, flete, iva :double;
begin
if CostoDBEdit.Text = '' then CostoDBEdit.Text:='0';
if FleteDBEdit.Text = '' then FleteDBEdit.Text:='0';
if IVADBEdit.Text = '' then IVADBEdit.Text:='0';
if GanaciaDBEdit.Text = '' then GanaciaDBEdit.Text:='0';
costo:=StrToFloat(CostoDBEdit.Text);
flete:=costo*(StrToFloat(FleteDBEdit.Text)/100);
iva:=costo*(StrToFloat(IVADBEdit.Text)/100);
Precio1DBEdit.Text:=FloatToStr((costo*Precio1)+flete+iva);
Precio2DBEdit.Text:=FloatToStr((costo*Precio2)+flete+iva);
Precio3DBEdit.Text:=FloatToStr((costo*Precio3)+flete+iva);
Precio4DBEdit.Text:=FloatToStr((costo*Precio4)+flete+iva);
Precio5DBEdit.Text:=FloatToStr((costo*Precio5)+flete+iva);
Precio6DBEdit.Text:=FloatToStr((costo*Precio6)+flete+iva);
if GanaciaDBEdit.Text='0' then PrecioCtaCteDBEdit.Text:=FloatToStr((costo*PrecioCtaCte)+flete+iva) else PrecioCtaCteDBEdit.Text:=FloatToStr((costo*(StrToFloat(GanaciaDBEdit.Text)/100+1)+flete+iva));
Label21.Caption:= '= '+FloatToStr(iva);
DBText1.Caption:= FloatToStr(costo+flete);
DBText2.Caption:= FloatToStr(costo+flete+iva);
BitBtn1.SetFocus;
end;
Procedure TFProductos.nuevo;
begin
Tabla.FieldByName('CtaNombre').AsString:='13';
Tabla.FieldByName('CtaTipo').AsString:='13';
Tabla.FieldByName('CtaAnticipo').AsString:='13';
Tabla.FieldByName('CtaIIBB').AsString:='66';
Tabla.FieldByName('CODIGOBARRA').AsString:= '0';
Tabla.FieldByName('Color').AsString:= '0';
Tabla.FieldByName('Categoria').AsString:= '0';
Tabla.FieldByName('SubCategoria').AsString:= '0';
Tabla.FieldByName('Rubro').AsString := '0';
Tabla.FieldByName('Marca').AsString := '0';
Tabla.FieldByName('Proveedor').Value := 1;
DBLookupComboBox4.KeyValue := 0;
DbEdit9.Field.AsString := 'c/u';
DbEdit17.Field.AsDateTime := Date;
Tabla.FieldByName('Costo').AsInteger:= 0;
CostoDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('ImpOtros').AsInteger:= 0;
FleteDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('Tasa').AsInteger:= 0;
IVADBEdit.Field.AsFloat := 0;
Tabla.FieldByName('Precio').AsInteger:= 0;
PrecioCtaCteDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('IIBB').AsInteger:= 0;
end;
procedure TFProductos.RubroBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Rubro.exe')),SW_SHOWNORMAL);
{ RubroForm:=RubroForm.Create(self);
try
RubroForm.ShowModal;
finally
If RubroForm.desc <> '' then
RubroDBLookupComboBox.KeyValue:= RubroForm.desc;
Tabla.FieldByName('Rubro').AsString:=RubroForm.desc;
RubroForm.Free;
end;
RubroT.Close;
RubroT.Open; }
MarcaDBLookupComboBox.SetFocus;
end;
procedure TFProductos.RubroDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
RubroT.Close;
RubroT.Open;
RubroT.Last;
end;
procedure TFProductos.CodigoBarraBitBtnClick(Sender: TObject);
var
i : integer;
begin
if Tabla.State = dsInsert then
begin
QTemp.Close;
QTemp.SQL.Text:='SELECT max(CODIGO) FROM "Articulo"';
QTemp.Open;
i:= 100000 + (QTemp.Fields.Fields[0].AsInteger +1); //agrego el codigo
end
else
begin
i:= 100000 + strtoint(CodigoDBEdit.Text);
IF (Tabla.State <> dsEdit) then Tabla.Edit;
end;
//codigo de barras
CodigoBarraEdit.Text := '1'+inttostr(i)+'2'; //lo incluyo en el codigo de barra
Codifica(CodigoBarraEdit.Text);
CodigoBarraEdit.SelStart:=0;
CodigoBarraEdit.SelLength:=Length(CodigoBarraEdit.Text);
Tabla.FieldByName('CodigoBarra').AsString := CodigoBarraEdit.Text;
end;
procedure TFProductos.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
IF Key = VK_F2 then RubroBitBtn.Click;
IF Key = VK_F3 then MarcaBitBtn.Click;
IF Key = VK_F4 then BitBtn13.Click;
IF Key = VK_F5 then BitBtn4.Click;
IF Key = VK_F6 then CodigoBarraBitBtn.Click;
end;
procedure TFProductos.Precio6DBEditExit(Sender: TObject);
begin
IVADBEdit.SetFocus;
end;
procedure TFProductos.CategoriaBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Categoria.exe')),SW_SHOWNORMAL);
{
FCategorias:=TFCategorias.Create(self);
try
FCategorias.ShowModal;
finally
If FCategorias.desc <> '' then
begin
CategoriaDBLookupComboBox.KeyValue:= FCategorias.desc;
Tabla.FieldByName('Categoria').AsString:=FCategorias.desc;
end;
FCategorias.Free;
end;
CategoriaT.Close;
CategoriaT.Open;
}
RubroDBLookupComboBox.SetFocus;
end;
procedure TFProductos.CategoriaDBLookupComboBoxStartDock(Sender: TObject;
var DragObject: TDragDockObject);
begin
CategoriaT.Close;
CategoriaT.Open;
CategoriaT.Last;
end;
procedure TFProductos.MarcaBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Marca.exe')),SW_SHOWNORMAL);
{ MarcaForm:=TMarcaForm.Create(self);
try
MarcaForm.ShowModal;
finally
If MarcaForm.desc <> '' then
begin
MarcaDBLookupComboBox.KeyValue:= MarcaForm.desc;
If (Tabla.State <> dsEdit) and (Tabla.State <> dsInsert) then Tabla.Edit;
Tabla.FieldByName('Marca').AsString:=MarcaForm.desc;
end;
MarcaForm.Free;
end;
MarcaT.Close;
MarcaT.Open; }
DBEdit9.SetFocus;
end;
procedure TFProductos.MarcaDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
MarcaT.Close;
MarcaT.Open;
MarcaT.Last;
end;
procedure TFProductos.DBEdit14Exit(Sender: TObject);
begin
BitBtn1.SetFocus;
end;
procedure TFProductos.DBLookupComboBox4Enter(Sender: TObject);
begin
ProveedorT.Close;
ProveedorT.Open;
ProveedorT.Last;
end;
procedure TFProductos.BitBtn13Click(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Proveedor.exe')),SW_SHOWNORMAL);
end;
procedure TFProductos.TablaAfterCancel(DataSet: TDataSet);
begin
Tabla.Transaction.RollbackRetaining;
end;
procedure TFProductos.TablaAfterDelete(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFProductos.TablaAfterInsert(DataSet: TDataSet);
begin
If Cancelar then Tabla.Cancel else nuevo;
end;
procedure TFProductos.TablaAfterPost(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
end.

Просмотреть файл

@ -0,0 +1,561 @@
unit UFProductos;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DataModule, Grids, DBGrids, DB, ExtCtrls, StdCtrls, Mask,
DBCtrls, Buttons, ComCtrls, IBQuery, IBCustomDataSet, IBTable, OleCtrls,
SHDocVw;
const
EAN_izqA : array[0..9] of PChar=('0001101','0011001','0010011','0111101','0100011','0110001','0101111','0111011','0110111','0001011');
EAN_izqB : array[0..9] of PChar=('0100111','0110011','0011011','0100001','0011101','0111001','0000101','0010001','0001001','0010111');
EAN_dcha : array[0..9] of PChar=('1110010','1100110','1101100','1000010','1011100','1001110','1010000','1000100','1001000','1110100');
CodificaIzq : array[0..9] of PChar=('AAAAA','ABABB','ABBAB','ABBBA','BAABB','BBAAB','BBBAA','BABAB','BABBA','BBABA');
type
TFProductos = class(TForm)
DataSource: TDataSource;
DSTCat: TDataSource;
DSTSubCat: TDataSource;
DSMateriales: TDataSource;
DSRubro: TDataSource;
DSQProve: TDataSource;
MarcaDataSource: TDataSource;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet3: TTabSheet;
Panel3: TPanel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label2: TLabel;
Label14: TLabel;
Label23: TLabel;
DescripcionDBEdit: TDBEdit;
DBEdit1: TDBEdit;
DBLookupComboBox4: TDBLookupComboBox;
BitBtn13: TBitBtn;
Label8: TLabel;
Label19: TLabel;
Label30: TLabel;
Label10: TLabel;
Label5: TLabel;
DBText1: TDBText;
Label16: TLabel;
Label28: TLabel;
Label21: TLabel;
IVADBEdit: TDBEdit;
FleteDBEdit: TDBEdit;
CostoDBEdit: TDBEdit;
Label4: TLabel;
PrecioCtaCteDBEdit: TDBEdit;
DBMemo1: TDBMemo;
TabSheet2: TTabSheet;
Label6: TLabel;
Label15: TLabel;
Label17: TLabel;
Label18: TLabel;
Label20: TLabel;
DBEdit6: TDBEdit;
DBEdit5: TDBEdit;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
DBEdit17: TDBEdit;
DBEdit9: TDBEdit;
Label9: TLabel;
DBEdit21: TDBEdit;
Label32: TLabel;
Label33: TLabel;
Label34: TLabel;
GanaciaDBEdit: TDBEdit;
TabSheet4: TTabSheet;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label7: TLabel;
Label31: TLabel;
Label3: TLabel;
Label22: TLabel;
Precio1DBEdit: TDBEdit;
Precio2DBEdit: TDBEdit;
Precio3DBEdit: TDBEdit;
Precio6DBEdit: TDBEdit;
Precio4DBEdit: TDBEdit;
Precio5DBEdit: TDBEdit;
DBText2: TDBText;
TabSheet5: TTabSheet;
CuentaDataSource: TDataSource;
Label50: TLabel;
CuentaDBLookupComboBox: TDBLookupComboBox;
DBLookupComboBox1: TDBLookupComboBox;
DBLookupComboBox2: TDBLookupComboBox;
DBLookupComboBox7: TDBLookupComboBox;
Label54: TLabel;
Label53: TLabel;
Label51: TLabel;
Label52: TLabel;
Label25: TLabel;
Label26: TLabel;
Label27: TLabel;
RubroDBLookupComboBox: TDBLookupComboBox;
RubroBitBtn: TBitBtn;
MarcaDBLookupComboBox: TDBLookupComboBox;
MarcaBitBtn: TBitBtn;
CategoriaDBLookupComboBox: TDBLookupComboBox;
CategoriaBitBtn: TBitBtn;
Label29: TLabel;
Tabla: TIBTable;
CategoriaT: TIBTable;
SubCategoriaT: TIBTable;
RubroT: TIBTable;
MaterialT: TIBTable;
QTemp: TIBQuery;
Usuario: TIBQuery;
DSUsuarios: TDataSource;
CuentaQuery: TIBQuery;
MarcaT: TIBTable;
ProveedorT: TIBTable;
ConfigQuery: TIBQuery;
Label1: TLabel;
CodigoDBEdit: TDBEdit;
BitBtn4: TBitBtn;
DBNavigator1: TDBNavigator;
Label24: TLabel;
CodigoBarraEdit: TDBEdit;
CodigoBarraBitBtn: TBitBtn;
PaintBox1: TImage;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure RubroBitBtnClick(Sender: TObject);
procedure CodigoBarraBitBtnClick(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Precio6DBEditExit(Sender: TObject);
procedure CategoriaBitBtnClick(Sender: TObject);
procedure MarcaBitBtnClick(Sender: TObject);
procedure DBEdit14Exit(Sender: TObject);
procedure BitBtn13Click(Sender: TObject);
procedure TablaAfterInsert(DataSet: TDataSet);
procedure GanaciaDBEditExit(Sender: TObject);
procedure TablaAfterPost(DataSet: TDataSet);
procedure TablaAfterCancel(DataSet: TDataSet);
procedure TablaAfterDelete(DataSet: TDataSet);
procedure MarcaDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure RubroDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure DBLookupComboBox4Enter(Sender: TObject);
procedure CategoriaDBLookupComboBoxEnter(Sender: TObject);
private
{ Private declarations }
public
desc:string;
Precio1, Precio2, Precio3, Precio4, Precio5, Precio6, PrecioCtaCte: Double;
{ Public declarations }
// procedimiento que codifica el número en un nº binario
procedure Codifica(num : string);
// procedimiento para dibujar el cód. de barras a partir del nº binario
procedure Dibujar(matrix : string);
// procedimiento para validar-corregir los códigos
procedure EANCorrecto(var num : string);
Procedure nuevo;
end;
var
FProductos: TFProductos;
implementation
uses UFBuscaArticulos,
UFCategorias, UFSubCategorias, Color, Marca, RubroF;
{$R *.dfm}
procedure TFProductos.EANCorrecto(var num : string);
var
i,N : byte;
sum : integer;
flag : byte;
begin
sum:=0;
N:=Length(num)-1; //13-1=12
for i:=1 to N do //desde 1 hasta 12
begin
if (i mod 2)=0 then // x mod y = x – (x div y) * y = 1-(0.5)*2
begin
if N=12 then
sum:=sum+StrToInt(num[i])*3
else
sum:=sum+StrToInt(num[i]);
end
else
begin
if N=12 then
sum:=sum+StrToInt(num[i])
else
sum:=sum+StrToInt(num[i])*3;
end;
end;
if sum>99 then
Flag:=10-(sum mod 100)
else
Flag:=10-(sum mod 10);
if Flag=10 then Flag:=0;
if not(StrToInt(num[N+1])=flag) then
num:=copy(num,1,length(num)-1)+IntToStr(Flag);
end;
procedure TFProductos.Codifica(num : string);
var
matrix : string;
i : integer;
begin
num:=CodigoBarraEdit.Text; //numero
matrix:='';
case Length(num) of //mientras sean 13 caracteres
13: begin
EANCorrecto(num); //
CodigoBarraEdit.Text:=num;
matrix:=matrix+'x0x'; // barra inicio
matrix:=matrix+EAN_izqA[StrToInt(num[2])];
for i:=3 to 7 do
if CodificaIzq[StrToInt(num[1])][i-3]='A' then
matrix:=matrix+EAN_izqA[StrToInt(num[i])]
else
matrix:=matrix+EAN_izqB[StrToInt(num[i])];
matrix:=matrix+'0x0x0'; // barra central
matrix:=matrix+EAN_dcha[StrToInt(num[8])];
matrix:=matrix+EAN_dcha[StrToInt(num[9])];
matrix:=matrix+EAN_dcha[StrToInt(num[10])];
matrix:=matrix+EAN_dcha[StrToInt(num[11])];
matrix:=matrix+EAN_dcha[StrToInt(num[12])];
matrix:=matrix+EAN_dcha[StrToInt(num[13])];
matrix:=matrix+'x0x'; // barra final
Dibujar(Matrix);
end;
8: begin
EANCorrecto(num);
CodigoBarraEdit.Text:=num;
matrix:=matrix+'x0x';
matrix:=matrix+EAN_izqA[StrToInt(num[1])];
matrix:=matrix+EAN_izqA[StrToInt(num[2])];
matrix:=matrix+EAN_izqA[StrToInt(num[3])];
matrix:=matrix+EAN_izqA[StrToInt(num[4])];
matrix:=matrix+'0x0x0';
matrix:=matrix+EAN_dcha[StrToInt(num[5])];
matrix:=matrix+EAN_dcha[StrToInt(num[6])];
matrix:=matrix+EAN_dcha[StrToInt(num[7])];
matrix:=matrix+EAN_dcha[StrToInt(num[8])];
matrix:=matrix+'x0x';
Dibujar(Matrix);
end
else
ShowMessage('LONGITUD DE CODIGO NO VALIDA');
end;
end;
procedure TFProductos.Dibujar(matrix : string);
var
i : integer;
begin
with PaintBox1 do begin
Canvas.Brush.Color:= clWhite;
Canvas.FillRect(Rect(0,0,PaintBox1.Width,PaintBox1.Height));
Canvas.Pen.Color:=clBlack;
END;
for i:=1 to Length(Matrix) do
if matrix[i]='1' then
PaintBox1.Canvas.PolyLine([Point(10+i,10),Point(10+i,50)])
else
if matrix[i]='x' then
PaintBox1.Canvas.PolyLine([Point(10+i,10),Point(10+i,55)]);
if Length(CodigoBarraEdit.Text)=13 then
begin
PaintBox1.Canvas.TextOut(3,50,CodigoBarraEdit.Text[1]);
PaintBox1.Canvas.TextOut(17,50,copy(CodigoBarraEdit.Text,2,6));
PaintBox1.Canvas.TextOut(63,50,copy(CodigoBarraEdit.Text,8,6));
end
else
if Length(CodigoBarraEdit.Text)=8 then
begin
PaintBox1.Canvas.TextOut(16,50,copy(CodigoBarraEdit.Text,1,4));
PaintBox1.Canvas.TextOut(48,50,copy(CodigoBarraEdit.Text,5,4));
end;
end;
procedure TFProductos.BitBtn1Click(Sender: TObject);
begin
desc:=CodigoDBEdit.Text;
If (Tabla.State = dsEdit) or (Tabla.State = dsInsert) And (DescripcionDBEdit.Text <> '') then Tabla.Post
else if (DescripcionDBEdit.Text <> '') then ShowMessage('COMPLETE TODOS LOS CAMPOS');
Close;
end;
procedure TFProductos.BitBtn2Click(Sender: TObject);
begin
Tabla.Cancel;
Close;
end;
procedure TFProductos.FormCreate(Sender: TObject);
begin
DM:=TDM.Create(Self);
Tabla.Active := True;
SubCategoriaT.Active := True;
ProveedorT.Active := True;
RubroT.Active := True;
MarcaT.Active := True;
CategoriaT.Active := True;
ConfigQuery.Open;
Precio1:=ConfigQuery.FieldByName('PP1').AsFloat/100+1;
Precio2:=ConfigQuery.FieldByName('PP2').AsFloat/100+1;
Precio3:=ConfigQuery.FieldByName('PP3').AsFloat/100+1;
Precio4:=ConfigQuery.FieldByName('PP4').AsFloat/100+1;
Precio5:=ConfigQuery.FieldByName('PP5').AsFloat/100+1;
Precio6:=ConfigQuery.FieldByName('PP6').AsFloat/100+1;
PrecioCtaCte:=ConfigQuery.FieldByName('PP').AsFloat/100+1;
QTemp.Close;
CuentaQuery.Open;
Tabla.Insert;
end;
procedure TFProductos.BitBtn4Click(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
Tabla.Cancel;
FBuscaArticulo:=TFBuscaArticulo.Create(self);
try
FBuscaArticulo.ShowModal;
finally
If FBuscaArticulo.Tabla.Active =True then
Tabla.Locate('CODIGO',FBuscaArticulo.Tabla.FieldByName('CODIGO').AsInteger,[]);
FBuscaArticulo.Free;
end;
Tabla.Edit;
end;
procedure TFProductos.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then { if it's an enter key }
begin
Key := #0; { eat enter key }
Perform(WM_NEXTDLGCTL, 0, 0); { move to next control }
end;
end;
procedure TFProductos.GanaciaDBEditExit(Sender: TObject);
var costo, flete, iva :double;
begin
if CostoDBEdit.Text = '' then CostoDBEdit.Text:='0';
if FleteDBEdit.Text = '' then FleteDBEdit.Text:='0';
if IVADBEdit.Text = '' then IVADBEdit.Text:='0';
if GanaciaDBEdit.Text = '' then GanaciaDBEdit.Text:='0';
costo:=StrToFloat(CostoDBEdit.Text);
flete:=costo*(StrToFloat(FleteDBEdit.Text)/100);
iva:=costo*(StrToFloat(IVADBEdit.Text)/100);
Precio1DBEdit.Text:=FloatToStr((costo*Precio1)+flete+iva);
Precio2DBEdit.Text:=FloatToStr((costo*Precio2)+flete+iva);
Precio3DBEdit.Text:=FloatToStr((costo*Precio3)+flete+iva);
Precio4DBEdit.Text:=FloatToStr((costo*Precio4)+flete+iva);
Precio5DBEdit.Text:=FloatToStr((costo*Precio5)+flete+iva);
Precio6DBEdit.Text:=FloatToStr((costo*Precio6)+flete+iva);
if GanaciaDBEdit.Text='0' then PrecioCtaCteDBEdit.Text:=FloatToStr((costo*PrecioCtaCte)+flete+iva) else PrecioCtaCteDBEdit.Text:=FloatToStr((costo*(StrToFloat(GanaciaDBEdit.Text)/100+1)+flete+iva));
Label21.Caption:= '= '+FloatToStr(iva);
DBText1.Caption:= FloatToStr(costo+flete);
DBText2.Caption:= FloatToStr(costo+flete+iva);
BitBtn1.SetFocus;
end;
Procedure TFProductos.nuevo;
begin
Tabla.FieldByName('CtaNombre').AsString:='13';
Tabla.FieldByName('CtaTipo').AsString:='13';
Tabla.FieldByName('CtaAnticipo').AsString:='13';
Tabla.FieldByName('CtaIIBB').AsString:='66';
Tabla.FieldByName('CODIGOBARRA').AsString:= '0';
Tabla.FieldByName('Color').AsString:= '0';
Tabla.FieldByName('Categoria').AsString:= '0';
Tabla.FieldByName('SubCategoria').AsString:= '0';
Tabla.FieldByName('Rubro').AsString := '0';
Tabla.FieldByName('Marca').AsString := '0';
Tabla.FieldByName('Proveedor').Value := 1;
DBLookupComboBox4.KeyValue := 0;
DbEdit9.Field.AsString := 'c/u';
DbEdit17.Field.AsDateTime := Date;
Tabla.FieldByName('Costo').AsInteger:= 0;
CostoDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('ImpOtros').AsInteger:= 0;
FleteDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('Tasa').AsInteger:= 0;
IVADBEdit.Field.AsFloat := 0;
Tabla.FieldByName('Precio').AsInteger:= 0;
PrecioCtaCteDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('IIBB').AsInteger:= 0;
end;
procedure TFProductos.RubroBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Rubro.exe')),SW_SHOWNORMAL);
{ RubroForm:=RubroForm.Create(self);
try
RubroForm.ShowModal;
finally
If RubroForm.desc <> '' then
RubroDBLookupComboBox.KeyValue:= RubroForm.desc;
Tabla.FieldByName('Rubro').AsString:=RubroForm.desc;
RubroForm.Free;
end;
RubroT.Close;
RubroT.Open; }
MarcaDBLookupComboBox.SetFocus;
end;
procedure TFProductos.RubroDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
RubroT.Close;
RubroT.Open;
RubroT.Last;
end;
procedure TFProductos.CodigoBarraBitBtnClick(Sender: TObject);
var
i : integer;
begin
if Tabla.State = dsInsert then
begin
QTemp.Close;
QTemp.SQL.Text:='SELECT max(CODIGO) FROM "Articulo"';
QTemp.Open;
i:= 100000 + (QTemp.Fields.Fields[0].AsInteger +1); //agrego el codigo
end
else
begin
i:= 100000 + strtoint(CodigoDBEdit.Text);
IF (Tabla.State <> dsEdit) then Tabla.Edit;
end;
//codigo de barras
CodigoBarraEdit.Text := '1'+inttostr(i)+'2'; //lo incluyo en el codigo de barra
Codifica(CodigoBarraEdit.Text);
CodigoBarraEdit.SelStart:=0;
CodigoBarraEdit.SelLength:=Length(CodigoBarraEdit.Text);
Tabla.FieldByName('CodigoBarra').AsString := CodigoBarraEdit.Text;
end;
procedure TFProductos.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
IF Key = VK_F2 then RubroBitBtn.Click;
IF Key = VK_F3 then MarcaBitBtn.Click;
IF Key = VK_F4 then BitBtn13.Click;
IF Key = VK_F5 then BitBtn4.Click;
IF Key = VK_F6 then CodigoBarraBitBtn.Click;
end;
procedure TFProductos.Precio6DBEditExit(Sender: TObject);
begin
IVADBEdit.SetFocus;
end;
procedure TFProductos.CategoriaBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Categoria.exe')),SW_SHOWNORMAL);
{
FCategorias:=TFCategorias.Create(self);
try
FCategorias.ShowModal;
finally
If FCategorias.desc <> '' then
begin
CategoriaDBLookupComboBox.KeyValue:= FCategorias.desc;
Tabla.FieldByName('Categoria').AsString:=FCategorias.desc;
end;
FCategorias.Free;
end;
CategoriaT.Close;
CategoriaT.Open;
}
RubroDBLookupComboBox.SetFocus;
end;
procedure TFProductos.CategoriaDBLookupComboBoxEnter(Sender: TObject);
begin
CategoriaT.Close;
CategoriaT.Open;
CategoriaT.Last;
end;
procedure TFProductos.MarcaBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Marca.exe')),SW_SHOWNORMAL);
{ MarcaForm:=TMarcaForm.Create(self);
try
MarcaForm.ShowModal;
finally
If MarcaForm.desc <> '' then
begin
MarcaDBLookupComboBox.KeyValue:= MarcaForm.desc;
If (Tabla.State <> dsEdit) and (Tabla.State <> dsInsert) then Tabla.Edit;
Tabla.FieldByName('Marca').AsString:=MarcaForm.desc;
end;
MarcaForm.Free;
end;
MarcaT.Close;
MarcaT.Open; }
DBEdit9.SetFocus;
end;
procedure TFProductos.MarcaDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
MarcaT.Close;
MarcaT.Open;
MarcaT.Last;
end;
procedure TFProductos.DBEdit14Exit(Sender: TObject);
begin
BitBtn1.SetFocus;
end;
procedure TFProductos.DBLookupComboBox4Enter(Sender: TObject);
begin
ProveedorT.Close;
ProveedorT.Open;
ProveedorT.Last;
end;
procedure TFProductos.BitBtn13Click(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Proveedor.exe')),SW_SHOWNORMAL);
end;
procedure TFProductos.TablaAfterCancel(DataSet: TDataSet);
begin
Tabla.Transaction.RollbackRetaining;
end;
procedure TFProductos.TablaAfterDelete(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFProductos.TablaAfterInsert(DataSet: TDataSet);
begin
If Cancelar then Tabla.Cancel else nuevo;
end;
procedure TFProductos.TablaAfterPost(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
end.

Просмотреть файл

@ -0,0 +1,559 @@
unit UFProductos;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DataModule, Grids, DBGrids, DB, ExtCtrls, StdCtrls, Mask,
DBCtrls, Buttons, ComCtrls, IBQuery, IBCustomDataSet, IBTable, OleCtrls,
SHDocVw;
const
EAN_izqA : array[0..9] of PChar=('0001101','0011001','0010011','0111101','0100011','0110001','0101111','0111011','0110111','0001011');
EAN_izqB : array[0..9] of PChar=('0100111','0110011','0011011','0100001','0011101','0111001','0000101','0010001','0001001','0010111');
EAN_dcha : array[0..9] of PChar=('1110010','1100110','1101100','1000010','1011100','1001110','1010000','1000100','1001000','1110100');
CodificaIzq : array[0..9] of PChar=('AAAAA','ABABB','ABBAB','ABBBA','BAABB','BBAAB','BBBAA','BABAB','BABBA','BBABA');
type
TFProductos = class(TForm)
DataSource: TDataSource;
DSTCat: TDataSource;
DSTSubCat: TDataSource;
DSMateriales: TDataSource;
DSRubro: TDataSource;
DSQProve: TDataSource;
MarcaDataSource: TDataSource;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet3: TTabSheet;
Panel3: TPanel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label2: TLabel;
Label14: TLabel;
Label23: TLabel;
DescripcionDBEdit: TDBEdit;
DBEdit1: TDBEdit;
DBLookupComboBox4: TDBLookupComboBox;
BitBtn13: TBitBtn;
Label8: TLabel;
Label19: TLabel;
Label30: TLabel;
Label10: TLabel;
Label5: TLabel;
DBText1: TDBText;
Label16: TLabel;
Label28: TLabel;
Label21: TLabel;
IVADBEdit: TDBEdit;
FleteDBEdit: TDBEdit;
CostoDBEdit: TDBEdit;
Label4: TLabel;
PrecioCtaCteDBEdit: TDBEdit;
DBMemo1: TDBMemo;
TabSheet2: TTabSheet;
Label6: TLabel;
Label15: TLabel;
Label17: TLabel;
Label18: TLabel;
Label20: TLabel;
DBEdit6: TDBEdit;
DBEdit5: TDBEdit;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
DBEdit17: TDBEdit;
DBEdit9: TDBEdit;
Label9: TLabel;
DBEdit21: TDBEdit;
Label32: TLabel;
Label33: TLabel;
Label34: TLabel;
GanaciaDBEdit: TDBEdit;
TabSheet4: TTabSheet;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label7: TLabel;
Label31: TLabel;
Label3: TLabel;
Label22: TLabel;
Precio1DBEdit: TDBEdit;
Precio2DBEdit: TDBEdit;
Precio3DBEdit: TDBEdit;
Precio6DBEdit: TDBEdit;
Precio4DBEdit: TDBEdit;
Precio5DBEdit: TDBEdit;
DBText2: TDBText;
TabSheet5: TTabSheet;
CuentaDataSource: TDataSource;
Label50: TLabel;
CuentaDBLookupComboBox: TDBLookupComboBox;
DBLookupComboBox1: TDBLookupComboBox;
DBLookupComboBox2: TDBLookupComboBox;
DBLookupComboBox7: TDBLookupComboBox;
Label54: TLabel;
Label53: TLabel;
Label51: TLabel;
Label52: TLabel;
Label25: TLabel;
Label26: TLabel;
Label27: TLabel;
RubroDBLookupComboBox: TDBLookupComboBox;
RubroBitBtn: TBitBtn;
MarcaDBLookupComboBox: TDBLookupComboBox;
MarcaBitBtn: TBitBtn;
CategoriaDBLookupComboBox: TDBLookupComboBox;
CategoriaBitBtn: TBitBtn;
Label29: TLabel;
Tabla: TIBTable;
CategoriaT: TIBTable;
SubCategoriaT: TIBTable;
RubroT: TIBTable;
MaterialT: TIBTable;
QTemp: TIBQuery;
Usuario: TIBQuery;
DSUsuarios: TDataSource;
CuentaQuery: TIBQuery;
MarcaT: TIBTable;
ProveedorT: TIBTable;
ConfigQuery: TIBQuery;
Label1: TLabel;
CodigoDBEdit: TDBEdit;
BitBtn4: TBitBtn;
DBNavigator1: TDBNavigator;
Label24: TLabel;
CodigoBarraEdit: TDBEdit;
CodigoBarraBitBtn: TBitBtn;
PaintBox1: TImage;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure RubroBitBtnClick(Sender: TObject);
procedure CodigoBarraBitBtnClick(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Precio6DBEditExit(Sender: TObject);
procedure CategoriaBitBtnClick(Sender: TObject);
procedure MarcaBitBtnClick(Sender: TObject);
procedure DBEdit14Exit(Sender: TObject);
procedure BitBtn13Click(Sender: TObject);
procedure TablaAfterInsert(DataSet: TDataSet);
procedure GanaciaDBEditExit(Sender: TObject);
procedure TablaAfterPost(DataSet: TDataSet);
procedure TablaAfterCancel(DataSet: TDataSet);
procedure TablaAfterDelete(DataSet: TDataSet);
procedure MarcaDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure DBLookupComboBox4Enter(Sender: TObject);
procedure CategoriaDBLookupComboBoxEnter(Sender: TObject);
procedure RubroDBLookupComboBoxEnter(Sender: TObject);
private
{ Private declarations }
public
desc:string;
Precio1, Precio2, Precio3, Precio4, Precio5, Precio6, PrecioCtaCte: Double;
{ Public declarations }
// procedimiento que codifica el número en un nº binario
procedure Codifica(num : string);
// procedimiento para dibujar el cód. de barras a partir del nº binario
procedure Dibujar(matrix : string);
// procedimiento para validar-corregir los códigos
procedure EANCorrecto(var num : string);
Procedure nuevo;
end;
var
FProductos: TFProductos;
implementation
uses UFBuscaArticulos,
UFCategorias, UFSubCategorias, Color, Marca, RubroF;
{$R *.dfm}
procedure TFProductos.EANCorrecto(var num : string);
var
i,N : byte;
sum : integer;
flag : byte;
begin
sum:=0;
N:=Length(num)-1; //13-1=12
for i:=1 to N do //desde 1 hasta 12
begin
if (i mod 2)=0 then // x mod y = x – (x div y) * y = 1-(0.5)*2
begin
if N=12 then
sum:=sum+StrToInt(num[i])*3
else
sum:=sum+StrToInt(num[i]);
end
else
begin
if N=12 then
sum:=sum+StrToInt(num[i])
else
sum:=sum+StrToInt(num[i])*3;
end;
end;
if sum>99 then
Flag:=10-(sum mod 100)
else
Flag:=10-(sum mod 10);
if Flag=10 then Flag:=0;
if not(StrToInt(num[N+1])=flag) then
num:=copy(num,1,length(num)-1)+IntToStr(Flag);
end;
procedure TFProductos.Codifica(num : string);
var
matrix : string;
i : integer;
begin
num:=CodigoBarraEdit.Text; //numero
matrix:='';
case Length(num) of //mientras sean 13 caracteres
13: begin
EANCorrecto(num); //
CodigoBarraEdit.Text:=num;
matrix:=matrix+'x0x'; // barra inicio
matrix:=matrix+EAN_izqA[StrToInt(num[2])];
for i:=3 to 7 do
if CodificaIzq[StrToInt(num[1])][i-3]='A' then
matrix:=matrix+EAN_izqA[StrToInt(num[i])]
else
matrix:=matrix+EAN_izqB[StrToInt(num[i])];
matrix:=matrix+'0x0x0'; // barra central
matrix:=matrix+EAN_dcha[StrToInt(num[8])];
matrix:=matrix+EAN_dcha[StrToInt(num[9])];
matrix:=matrix+EAN_dcha[StrToInt(num[10])];
matrix:=matrix+EAN_dcha[StrToInt(num[11])];
matrix:=matrix+EAN_dcha[StrToInt(num[12])];
matrix:=matrix+EAN_dcha[StrToInt(num[13])];
matrix:=matrix+'x0x'; // barra final
Dibujar(Matrix);
end;
8: begin
EANCorrecto(num);
CodigoBarraEdit.Text:=num;
matrix:=matrix+'x0x';
matrix:=matrix+EAN_izqA[StrToInt(num[1])];
matrix:=matrix+EAN_izqA[StrToInt(num[2])];
matrix:=matrix+EAN_izqA[StrToInt(num[3])];
matrix:=matrix+EAN_izqA[StrToInt(num[4])];
matrix:=matrix+'0x0x0';
matrix:=matrix+EAN_dcha[StrToInt(num[5])];
matrix:=matrix+EAN_dcha[StrToInt(num[6])];
matrix:=matrix+EAN_dcha[StrToInt(num[7])];
matrix:=matrix+EAN_dcha[StrToInt(num[8])];
matrix:=matrix+'x0x';
Dibujar(Matrix);
end
else
ShowMessage('LONGITUD DE CODIGO NO VALIDA');
end;
end;
procedure TFProductos.Dibujar(matrix : string);
var
i : integer;
begin
with PaintBox1 do begin
Canvas.Brush.Color:= clWhite;
Canvas.FillRect(Rect(0,0,PaintBox1.Width,PaintBox1.Height));
Canvas.Pen.Color:=clBlack;
END;
for i:=1 to Length(Matrix) do
if matrix[i]='1' then
PaintBox1.Canvas.PolyLine([Point(10+i,10),Point(10+i,50)])
else
if matrix[i]='x' then
PaintBox1.Canvas.PolyLine([Point(10+i,10),Point(10+i,55)]);
if Length(CodigoBarraEdit.Text)=13 then
begin
PaintBox1.Canvas.TextOut(3,50,CodigoBarraEdit.Text[1]);
PaintBox1.Canvas.TextOut(17,50,copy(CodigoBarraEdit.Text,2,6));
PaintBox1.Canvas.TextOut(63,50,copy(CodigoBarraEdit.Text,8,6));
end
else
if Length(CodigoBarraEdit.Text)=8 then
begin
PaintBox1.Canvas.TextOut(16,50,copy(CodigoBarraEdit.Text,1,4));
PaintBox1.Canvas.TextOut(48,50,copy(CodigoBarraEdit.Text,5,4));
end;
end;
procedure TFProductos.BitBtn1Click(Sender: TObject);
begin
desc:=CodigoDBEdit.Text;
If (Tabla.State = dsEdit) or (Tabla.State = dsInsert) And (DescripcionDBEdit.Text <> '') then Tabla.Post
else if (DescripcionDBEdit.Text <> '') then ShowMessage('COMPLETE TODOS LOS CAMPOS');
Close;
end;
procedure TFProductos.BitBtn2Click(Sender: TObject);
begin
Tabla.Cancel;
Close;
end;
procedure TFProductos.FormCreate(Sender: TObject);
begin
DM:=TDM.Create(Self);
Tabla.Active := True;
SubCategoriaT.Active := True;
ProveedorT.Active := True;
RubroT.Active := True;
MarcaT.Active := True;
CategoriaT.Active := True;
ConfigQuery.Open;
Precio1:=ConfigQuery.FieldByName('PP1').AsFloat/100+1;
Precio2:=ConfigQuery.FieldByName('PP2').AsFloat/100+1;
Precio3:=ConfigQuery.FieldByName('PP3').AsFloat/100+1;
Precio4:=ConfigQuery.FieldByName('PP4').AsFloat/100+1;
Precio5:=ConfigQuery.FieldByName('PP5').AsFloat/100+1;
Precio6:=ConfigQuery.FieldByName('PP6').AsFloat/100+1;
PrecioCtaCte:=ConfigQuery.FieldByName('PP').AsFloat/100+1;
QTemp.Close;
CuentaQuery.Open;
Tabla.Insert;
end;
procedure TFProductos.BitBtn4Click(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
Tabla.Cancel;
FBuscaArticulo:=TFBuscaArticulo.Create(self);
try
FBuscaArticulo.ShowModal;
finally
If FBuscaArticulo.Tabla.Active =True then
Tabla.Locate('CODIGO',FBuscaArticulo.Tabla.FieldByName('CODIGO').AsInteger,[]);
FBuscaArticulo.Free;
end;
Tabla.Edit;
end;
procedure TFProductos.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then { if it's an enter key }
begin
Key := #0; { eat enter key }
Perform(WM_NEXTDLGCTL, 0, 0); { move to next control }
end;
end;
procedure TFProductos.GanaciaDBEditExit(Sender: TObject);
var costo, flete, iva :double;
begin
if CostoDBEdit.Text = '' then CostoDBEdit.Text:='0';
if FleteDBEdit.Text = '' then FleteDBEdit.Text:='0';
if IVADBEdit.Text = '' then IVADBEdit.Text:='0';
if GanaciaDBEdit.Text = '' then GanaciaDBEdit.Text:='0';
costo:=StrToFloat(CostoDBEdit.Text);
flete:=costo*(StrToFloat(FleteDBEdit.Text)/100);
iva:=costo*(StrToFloat(IVADBEdit.Text)/100);
Precio1DBEdit.Text:=FloatToStr((costo*Precio1)+flete+iva);
Precio2DBEdit.Text:=FloatToStr((costo*Precio2)+flete+iva);
Precio3DBEdit.Text:=FloatToStr((costo*Precio3)+flete+iva);
Precio4DBEdit.Text:=FloatToStr((costo*Precio4)+flete+iva);
Precio5DBEdit.Text:=FloatToStr((costo*Precio5)+flete+iva);
Precio6DBEdit.Text:=FloatToStr((costo*Precio6)+flete+iva);
if GanaciaDBEdit.Text='0' then PrecioCtaCteDBEdit.Text:=FloatToStr((costo*PrecioCtaCte)+flete+iva) else PrecioCtaCteDBEdit.Text:=FloatToStr((costo*(StrToFloat(GanaciaDBEdit.Text)/100+1)+flete+iva));
Label21.Caption:= '= '+FloatToStr(iva);
DBText1.Caption:= FloatToStr(costo+flete);
DBText2.Caption:= FloatToStr(costo+flete+iva);
BitBtn1.SetFocus;
end;
Procedure TFProductos.nuevo;
begin
Tabla.FieldByName('CtaNombre').AsString:='13';
Tabla.FieldByName('CtaTipo').AsString:='13';
Tabla.FieldByName('CtaAnticipo').AsString:='13';
Tabla.FieldByName('CtaIIBB').AsString:='66';
Tabla.FieldByName('CODIGOBARRA').AsString:= '0';
Tabla.FieldByName('Color').AsString:= '0';
Tabla.FieldByName('Categoria').AsString:= '0';
Tabla.FieldByName('SubCategoria').AsString:= '0';
Tabla.FieldByName('Rubro').AsString := '0';
Tabla.FieldByName('Marca').AsString := '0';
Tabla.FieldByName('Proveedor').Value := 1;
DBLookupComboBox4.KeyValue := 0;
DbEdit9.Field.AsString := 'c/u';
DbEdit17.Field.AsDateTime := Date;
Tabla.FieldByName('Costo').AsInteger:= 0;
CostoDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('ImpOtros').AsInteger:= 0;
FleteDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('Tasa').AsInteger:= 0;
IVADBEdit.Field.AsFloat := 0;
Tabla.FieldByName('Precio').AsInteger:= 0;
PrecioCtaCteDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('IIBB').AsInteger:= 0;
end;
procedure TFProductos.RubroBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Rubro.exe')),SW_SHOWNORMAL);
{ RubroForm:=RubroForm.Create(self);
try
RubroForm.ShowModal;
finally
If RubroForm.desc <> '' then
RubroDBLookupComboBox.KeyValue:= RubroForm.desc;
Tabla.FieldByName('Rubro').AsString:=RubroForm.desc;
RubroForm.Free;
end;
RubroT.Close;
RubroT.Open; }
MarcaDBLookupComboBox.SetFocus;
end;
procedure TFProductos.RubroDBLookupComboBoxEnter(Sender: TObject);
begin
RubroT.Close;
RubroT.Open;
RubroT.Last;
end;
procedure TFProductos.CodigoBarraBitBtnClick(Sender: TObject);
var
i : integer;
begin
if Tabla.State = dsInsert then
begin
QTemp.Close;
QTemp.SQL.Text:='SELECT max(CODIGO) FROM "Articulo"';
QTemp.Open;
i:= 100000 + (QTemp.Fields.Fields[0].AsInteger +1); //agrego el codigo
end
else
begin
i:= 100000 + strtoint(CodigoDBEdit.Text);
IF (Tabla.State <> dsEdit) then Tabla.Edit;
end;
//codigo de barras
CodigoBarraEdit.Text := '1'+inttostr(i)+'2'; //lo incluyo en el codigo de barra
Codifica(CodigoBarraEdit.Text);
CodigoBarraEdit.SelStart:=0;
CodigoBarraEdit.SelLength:=Length(CodigoBarraEdit.Text);
Tabla.FieldByName('CodigoBarra').AsString := CodigoBarraEdit.Text;
end;
procedure TFProductos.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
IF Key = VK_F2 then RubroBitBtn.Click;
IF Key = VK_F3 then MarcaBitBtn.Click;
IF Key = VK_F4 then BitBtn13.Click;
IF Key = VK_F5 then BitBtn4.Click;
IF Key = VK_F6 then CodigoBarraBitBtn.Click;
end;
procedure TFProductos.Precio6DBEditExit(Sender: TObject);
begin
IVADBEdit.SetFocus;
end;
procedure TFProductos.CategoriaBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Categoria.exe')),SW_SHOWNORMAL);
{
FCategorias:=TFCategorias.Create(self);
try
FCategorias.ShowModal;
finally
If FCategorias.desc <> '' then
begin
CategoriaDBLookupComboBox.KeyValue:= FCategorias.desc;
Tabla.FieldByName('Categoria').AsString:=FCategorias.desc;
end;
FCategorias.Free;
end;
CategoriaT.Close;
CategoriaT.Open;
}
RubroDBLookupComboBox.SetFocus;
end;
procedure TFProductos.CategoriaDBLookupComboBoxEnter(Sender: TObject);
begin
CategoriaT.Close;
CategoriaT.Open;
CategoriaT.Last;
end;
procedure TFProductos.MarcaBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Marca.exe')),SW_SHOWNORMAL);
{ MarcaForm:=TMarcaForm.Create(self);
try
MarcaForm.ShowModal;
finally
If MarcaForm.desc <> '' then
begin
MarcaDBLookupComboBox.KeyValue:= MarcaForm.desc;
If (Tabla.State <> dsEdit) and (Tabla.State <> dsInsert) then Tabla.Edit;
Tabla.FieldByName('Marca').AsString:=MarcaForm.desc;
end;
MarcaForm.Free;
end;
MarcaT.Close;
MarcaT.Open; }
DBEdit9.SetFocus;
end;
procedure TFProductos.MarcaDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
MarcaT.Close;
MarcaT.Open;
MarcaT.Last;
end;
procedure TFProductos.DBEdit14Exit(Sender: TObject);
begin
BitBtn1.SetFocus;
end;
procedure TFProductos.DBLookupComboBox4Enter(Sender: TObject);
begin
ProveedorT.Close;
ProveedorT.Open;
ProveedorT.Last;
end;
procedure TFProductos.BitBtn13Click(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Proveedor.exe')),SW_SHOWNORMAL);
end;
procedure TFProductos.TablaAfterCancel(DataSet: TDataSet);
begin
Tabla.Transaction.RollbackRetaining;
end;
procedure TFProductos.TablaAfterDelete(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFProductos.TablaAfterInsert(DataSet: TDataSet);
begin
If Cancelar then Tabla.Cancel else nuevo;
end;
procedure TFProductos.TablaAfterPost(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
end.

Просмотреть файл

@ -0,0 +1,567 @@
unit UFProductos;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DataModule, Grids, DBGrids, DB, ExtCtrls, StdCtrls, Mask,
DBCtrls, Buttons, ComCtrls, IBQuery, IBCustomDataSet, IBTable, OleCtrls,
SHDocVw;
const
EAN_izqA : array[0..9] of PChar=('0001101','0011001','0010011','0111101','0100011','0110001','0101111','0111011','0110111','0001011');
EAN_izqB : array[0..9] of PChar=('0100111','0110011','0011011','0100001','0011101','0111001','0000101','0010001','0001001','0010111');
EAN_dcha : array[0..9] of PChar=('1110010','1100110','1101100','1000010','1011100','1001110','1010000','1000100','1001000','1110100');
CodificaIzq : array[0..9] of PChar=('AAAAA','ABABB','ABBAB','ABBBA','BAABB','BBAAB','BBBAA','BABAB','BABBA','BBABA');
type
TFProductos = class(TForm)
DataSource: TDataSource;
DSTCat: TDataSource;
DSTSubCat: TDataSource;
DSMateriales: TDataSource;
DSRubro: TDataSource;
DSQProve: TDataSource;
MarcaDataSource: TDataSource;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet3: TTabSheet;
Panel3: TPanel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label2: TLabel;
Label14: TLabel;
Label23: TLabel;
DescripcionDBEdit: TDBEdit;
DBEdit1: TDBEdit;
DBLookupComboBox4: TDBLookupComboBox;
BitBtn13: TBitBtn;
Label8: TLabel;
Label19: TLabel;
Label30: TLabel;
Label10: TLabel;
Label5: TLabel;
DBText1: TDBText;
Label16: TLabel;
Label28: TLabel;
Label21: TLabel;
IVADBEdit: TDBEdit;
FleteDBEdit: TDBEdit;
CostoDBEdit: TDBEdit;
Label4: TLabel;
PrecioCtaCteDBEdit: TDBEdit;
DBMemo1: TDBMemo;
TabSheet2: TTabSheet;
Label6: TLabel;
Label15: TLabel;
Label17: TLabel;
Label18: TLabel;
Label20: TLabel;
DBEdit6: TDBEdit;
DBEdit5: TDBEdit;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
DBEdit17: TDBEdit;
DBEdit9: TDBEdit;
Label9: TLabel;
DBEdit21: TDBEdit;
Label32: TLabel;
Label33: TLabel;
Label34: TLabel;
GanaciaDBEdit: TDBEdit;
TabSheet4: TTabSheet;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label7: TLabel;
Label31: TLabel;
Label3: TLabel;
Label22: TLabel;
Precio1DBEdit: TDBEdit;
Precio2DBEdit: TDBEdit;
Precio3DBEdit: TDBEdit;
Precio6DBEdit: TDBEdit;
Precio4DBEdit: TDBEdit;
Precio5DBEdit: TDBEdit;
DBText2: TDBText;
TabSheet5: TTabSheet;
CuentaDataSource: TDataSource;
Label50: TLabel;
CuentaDBLookupComboBox: TDBLookupComboBox;
DBLookupComboBox1: TDBLookupComboBox;
DBLookupComboBox2: TDBLookupComboBox;
DBLookupComboBox7: TDBLookupComboBox;
Label54: TLabel;
Label53: TLabel;
Label51: TLabel;
Label52: TLabel;
Label25: TLabel;
Label26: TLabel;
Label27: TLabel;
RubroDBLookupComboBox: TDBLookupComboBox;
RubroBitBtn: TBitBtn;
MarcaDBLookupComboBox: TDBLookupComboBox;
MarcaBitBtn: TBitBtn;
CategoriaDBLookupComboBox: TDBLookupComboBox;
CategoriaBitBtn: TBitBtn;
Label29: TLabel;
Tabla: TIBTable;
CategoriaT: TIBTable;
SubCategoriaT: TIBTable;
RubroT: TIBTable;
MaterialT: TIBTable;
QTemp: TIBQuery;
Usuario: TIBQuery;
DSUsuarios: TDataSource;
CuentaQuery: TIBQuery;
MarcaT: TIBTable;
ProveedorT: TIBTable;
ConfigQuery: TIBQuery;
Label1: TLabel;
CodigoDBEdit: TDBEdit;
BitBtn4: TBitBtn;
DBNavigator1: TDBNavigator;
Label24: TLabel;
CodigoBarraEdit: TDBEdit;
CodigoBarraBitBtn: TBitBtn;
PaintBox1: TImage;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure RubroBitBtnClick(Sender: TObject);
procedure CodigoBarraBitBtnClick(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Precio6DBEditExit(Sender: TObject);
procedure CategoriaBitBtnClick(Sender: TObject);
procedure MarcaBitBtnClick(Sender: TObject);
procedure DBEdit14Exit(Sender: TObject);
procedure BitBtn13Click(Sender: TObject);
procedure TablaAfterInsert(DataSet: TDataSet);
procedure GanaciaDBEditExit(Sender: TObject);
procedure TablaAfterPost(DataSet: TDataSet);
procedure TablaAfterCancel(DataSet: TDataSet);
procedure TablaAfterDelete(DataSet: TDataSet);
procedure MarcaDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure DBLookupComboBox4Enter(Sender: TObject);
procedure CategoriaDBLookupComboBoxEnter(Sender: TObject);
procedure RubroDBLookupComboBoxEnter(Sender: TObject);
procedure MarcaDBLookupComboBoxEnter(Sender: TObject);
private
{ Private declarations }
public
desc:string;
Precio1, Precio2, Precio3, Precio4, Precio5, Precio6, PrecioCtaCte: Double;
{ Public declarations }
// procedimiento que codifica el número en un nº binario
procedure Codifica(num : string);
// procedimiento para dibujar el cód. de barras a partir del nº binario
procedure Dibujar(matrix : string);
// procedimiento para validar-corregir los códigos
procedure EANCorrecto(var num : string);
Procedure nuevo;
end;
var
FProductos: TFProductos;
implementation
uses UFBuscaArticulos,
UFCategorias, UFSubCategorias, Color, Marca, RubroF;
{$R *.dfm}
procedure TFProductos.EANCorrecto(var num : string);
var
i,N : byte;
sum : integer;
flag : byte;
begin
sum:=0;
N:=Length(num)-1; //13-1=12
for i:=1 to N do //desde 1 hasta 12
begin
if (i mod 2)=0 then // x mod y = x – (x div y) * y = 1-(0.5)*2
begin
if N=12 then
sum:=sum+StrToInt(num[i])*3
else
sum:=sum+StrToInt(num[i]);
end
else
begin
if N=12 then
sum:=sum+StrToInt(num[i])
else
sum:=sum+StrToInt(num[i])*3;
end;
end;
if sum>99 then
Flag:=10-(sum mod 100)
else
Flag:=10-(sum mod 10);
if Flag=10 then Flag:=0;
if not(StrToInt(num[N+1])=flag) then
num:=copy(num,1,length(num)-1)+IntToStr(Flag);
end;
procedure TFProductos.Codifica(num : string);
var
matrix : string;
i : integer;
begin
num:=CodigoBarraEdit.Text; //numero
matrix:='';
case Length(num) of //mientras sean 13 caracteres
13: begin
EANCorrecto(num); //
CodigoBarraEdit.Text:=num;
matrix:=matrix+'x0x'; // barra inicio
matrix:=matrix+EAN_izqA[StrToInt(num[2])];
for i:=3 to 7 do
if CodificaIzq[StrToInt(num[1])][i-3]='A' then
matrix:=matrix+EAN_izqA[StrToInt(num[i])]
else
matrix:=matrix+EAN_izqB[StrToInt(num[i])];
matrix:=matrix+'0x0x0'; // barra central
matrix:=matrix+EAN_dcha[StrToInt(num[8])];
matrix:=matrix+EAN_dcha[StrToInt(num[9])];
matrix:=matrix+EAN_dcha[StrToInt(num[10])];
matrix:=matrix+EAN_dcha[StrToInt(num[11])];
matrix:=matrix+EAN_dcha[StrToInt(num[12])];
matrix:=matrix+EAN_dcha[StrToInt(num[13])];
matrix:=matrix+'x0x'; // barra final
Dibujar(Matrix);
end;
8: begin
EANCorrecto(num);
CodigoBarraEdit.Text:=num;
matrix:=matrix+'x0x';
matrix:=matrix+EAN_izqA[StrToInt(num[1])];
matrix:=matrix+EAN_izqA[StrToInt(num[2])];
matrix:=matrix+EAN_izqA[StrToInt(num[3])];
matrix:=matrix+EAN_izqA[StrToInt(num[4])];
matrix:=matrix+'0x0x0';
matrix:=matrix+EAN_dcha[StrToInt(num[5])];
matrix:=matrix+EAN_dcha[StrToInt(num[6])];
matrix:=matrix+EAN_dcha[StrToInt(num[7])];
matrix:=matrix+EAN_dcha[StrToInt(num[8])];
matrix:=matrix+'x0x';
Dibujar(Matrix);
end
else
ShowMessage('LONGITUD DE CODIGO NO VALIDA');
end;
end;
procedure TFProductos.Dibujar(matrix : string);
var
i : integer;
begin
with PaintBox1 do begin
Canvas.Brush.Color:= clWhite;
Canvas.FillRect(Rect(0,0,PaintBox1.Width,PaintBox1.Height));
Canvas.Pen.Color:=clBlack;
END;
for i:=1 to Length(Matrix) do
if matrix[i]='1' then
PaintBox1.Canvas.PolyLine([Point(10+i,10),Point(10+i,50)])
else
if matrix[i]='x' then
PaintBox1.Canvas.PolyLine([Point(10+i,10),Point(10+i,55)]);
if Length(CodigoBarraEdit.Text)=13 then
begin
PaintBox1.Canvas.TextOut(3,50,CodigoBarraEdit.Text[1]);
PaintBox1.Canvas.TextOut(17,50,copy(CodigoBarraEdit.Text,2,6));
PaintBox1.Canvas.TextOut(63,50,copy(CodigoBarraEdit.Text,8,6));
end
else
if Length(CodigoBarraEdit.Text)=8 then
begin
PaintBox1.Canvas.TextOut(16,50,copy(CodigoBarraEdit.Text,1,4));
PaintBox1.Canvas.TextOut(48,50,copy(CodigoBarraEdit.Text,5,4));
end;
end;
procedure TFProductos.BitBtn1Click(Sender: TObject);
begin
desc:=CodigoDBEdit.Text;
If (Tabla.State = dsEdit) or (Tabla.State = dsInsert) And (DescripcionDBEdit.Text <> '') then Tabla.Post
else if (DescripcionDBEdit.Text <> '') then ShowMessage('COMPLETE TODOS LOS CAMPOS');
Close;
end;
procedure TFProductos.BitBtn2Click(Sender: TObject);
begin
Tabla.Cancel;
Close;
end;
procedure TFProductos.FormCreate(Sender: TObject);
begin
DM:=TDM.Create(Self);
Tabla.Active := True;
SubCategoriaT.Active := True;
ProveedorT.Active := True;
RubroT.Active := True;
MarcaT.Active := True;
CategoriaT.Active := True;
ConfigQuery.Open;
Precio1:=ConfigQuery.FieldByName('PP1').AsFloat/100+1;
Precio2:=ConfigQuery.FieldByName('PP2').AsFloat/100+1;
Precio3:=ConfigQuery.FieldByName('PP3').AsFloat/100+1;
Precio4:=ConfigQuery.FieldByName('PP4').AsFloat/100+1;
Precio5:=ConfigQuery.FieldByName('PP5').AsFloat/100+1;
Precio6:=ConfigQuery.FieldByName('PP6').AsFloat/100+1;
PrecioCtaCte:=ConfigQuery.FieldByName('PP').AsFloat/100+1;
QTemp.Close;
CuentaQuery.Open;
Tabla.Insert;
end;
procedure TFProductos.BitBtn4Click(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
Tabla.Cancel;
FBuscaArticulo:=TFBuscaArticulo.Create(self);
try
FBuscaArticulo.ShowModal;
finally
If FBuscaArticulo.Tabla.Active =True then
Tabla.Locate('CODIGO',FBuscaArticulo.Tabla.FieldByName('CODIGO').AsInteger,[]);
FBuscaArticulo.Free;
end;
Tabla.Edit;
end;
procedure TFProductos.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then { if it's an enter key }
begin
Key := #0; { eat enter key }
Perform(WM_NEXTDLGCTL, 0, 0); { move to next control }
end;
end;
procedure TFProductos.GanaciaDBEditExit(Sender: TObject);
var costo, flete, iva :double;
begin
if CostoDBEdit.Text = '' then CostoDBEdit.Text:='0';
if FleteDBEdit.Text = '' then FleteDBEdit.Text:='0';
if IVADBEdit.Text = '' then IVADBEdit.Text:='0';
if GanaciaDBEdit.Text = '' then GanaciaDBEdit.Text:='0';
costo:=StrToFloat(CostoDBEdit.Text);
flete:=costo*(StrToFloat(FleteDBEdit.Text)/100);
iva:=costo*(StrToFloat(IVADBEdit.Text)/100);
Precio1DBEdit.Text:=FloatToStr((costo*Precio1)+flete+iva);
Precio2DBEdit.Text:=FloatToStr((costo*Precio2)+flete+iva);
Precio3DBEdit.Text:=FloatToStr((costo*Precio3)+flete+iva);
Precio4DBEdit.Text:=FloatToStr((costo*Precio4)+flete+iva);
Precio5DBEdit.Text:=FloatToStr((costo*Precio5)+flete+iva);
Precio6DBEdit.Text:=FloatToStr((costo*Precio6)+flete+iva);
if GanaciaDBEdit.Text='0' then PrecioCtaCteDBEdit.Text:=FloatToStr((costo*PrecioCtaCte)+flete+iva) else PrecioCtaCteDBEdit.Text:=FloatToStr((costo*(StrToFloat(GanaciaDBEdit.Text)/100+1)+flete+iva));
Label21.Caption:= '= '+FloatToStr(iva);
DBText1.Caption:= FloatToStr(costo+flete);
DBText2.Caption:= FloatToStr(costo+flete+iva);
BitBtn1.SetFocus;
end;
Procedure TFProductos.nuevo;
begin
Tabla.FieldByName('CtaNombre').AsString:='13';
Tabla.FieldByName('CtaTipo').AsString:='13';
Tabla.FieldByName('CtaAnticipo').AsString:='13';
Tabla.FieldByName('CtaIIBB').AsString:='66';
Tabla.FieldByName('CODIGOBARRA').AsString:= '0';
Tabla.FieldByName('Color').AsString:= '0';
Tabla.FieldByName('Categoria').AsString:= '0';
Tabla.FieldByName('SubCategoria').AsString:= '0';
Tabla.FieldByName('Rubro').AsString := '0';
Tabla.FieldByName('Marca').AsString := '0';
Tabla.FieldByName('Proveedor').Value := 1;
DBLookupComboBox4.KeyValue := 0;
DbEdit9.Field.AsString := 'c/u';
DbEdit17.Field.AsDateTime := Date;
Tabla.FieldByName('Costo').AsInteger:= 0;
CostoDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('ImpOtros').AsInteger:= 0;
FleteDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('Tasa').AsInteger:= 0;
IVADBEdit.Field.AsFloat := 0;
Tabla.FieldByName('Precio').AsInteger:= 0;
PrecioCtaCteDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('IIBB').AsInteger:= 0;
end;
procedure TFProductos.RubroBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Rubro.exe')),SW_SHOWNORMAL);
{ RubroForm:=RubroForm.Create(self);
try
RubroForm.ShowModal;
finally
If RubroForm.desc <> '' then
RubroDBLookupComboBox.KeyValue:= RubroForm.desc;
Tabla.FieldByName('Rubro').AsString:=RubroForm.desc;
RubroForm.Free;
end;
RubroT.Close;
RubroT.Open; }
MarcaDBLookupComboBox.SetFocus;
end;
procedure TFProductos.RubroDBLookupComboBoxEnter(Sender: TObject);
begin
RubroT.Close;
RubroT.Open;
RubroT.Last;
end;
procedure TFProductos.CodigoBarraBitBtnClick(Sender: TObject);
var
i : integer;
begin
if Tabla.State = dsInsert then
begin
QTemp.Close;
QTemp.SQL.Text:='SELECT max(CODIGO) FROM "Articulo"';
QTemp.Open;
i:= 100000 + (QTemp.Fields.Fields[0].AsInteger +1); //agrego el codigo
end
else
begin
i:= 100000 + strtoint(CodigoDBEdit.Text);
IF (Tabla.State <> dsEdit) then Tabla.Edit;
end;
//codigo de barras
CodigoBarraEdit.Text := '1'+inttostr(i)+'2'; //lo incluyo en el codigo de barra
Codifica(CodigoBarraEdit.Text);
CodigoBarraEdit.SelStart:=0;
CodigoBarraEdit.SelLength:=Length(CodigoBarraEdit.Text);
Tabla.FieldByName('CodigoBarra').AsString := CodigoBarraEdit.Text;
end;
procedure TFProductos.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
IF Key = VK_F2 then RubroBitBtn.Click;
IF Key = VK_F3 then MarcaBitBtn.Click;
IF Key = VK_F4 then BitBtn13.Click;
IF Key = VK_F5 then BitBtn4.Click;
IF Key = VK_F6 then CodigoBarraBitBtn.Click;
end;
procedure TFProductos.Precio6DBEditExit(Sender: TObject);
begin
IVADBEdit.SetFocus;
end;
procedure TFProductos.CategoriaBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Categoria.exe')),SW_SHOWNORMAL);
{
FCategorias:=TFCategorias.Create(self);
try
FCategorias.ShowModal;
finally
If FCategorias.desc <> '' then
begin
CategoriaDBLookupComboBox.KeyValue:= FCategorias.desc;
Tabla.FieldByName('Categoria').AsString:=FCategorias.desc;
end;
FCategorias.Free;
end;
CategoriaT.Close;
CategoriaT.Open;
}
RubroDBLookupComboBox.SetFocus;
end;
procedure TFProductos.CategoriaDBLookupComboBoxEnter(Sender: TObject);
begin
CategoriaT.Close;
CategoriaT.Open;
CategoriaT.Last;
end;
procedure TFProductos.MarcaBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Marca.exe')),SW_SHOWNORMAL);
{ MarcaForm:=TMarcaForm.Create(self);
try
MarcaForm.ShowModal;
finally
If MarcaForm.desc <> '' then
begin
MarcaDBLookupComboBox.KeyValue:= MarcaForm.desc;
If (Tabla.State <> dsEdit) and (Tabla.State <> dsInsert) then Tabla.Edit;
Tabla.FieldByName('Marca').AsString:=MarcaForm.desc;
end;
MarcaForm.Free;
end;
MarcaT.Close;
MarcaT.Open; }
DBEdit9.SetFocus;
end;
procedure TFProductos.MarcaDBLookupComboBoxEnter(Sender: TObject);
begin
MarcaT.Close;
MarcaT.Open;
MarcaT.Last;
end;
procedure TFProductos.MarcaDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
MarcaT.Close;
MarcaT.Open;
MarcaT.Last;
end;
procedure TFProductos.DBEdit14Exit(Sender: TObject);
begin
BitBtn1.SetFocus;
end;
procedure TFProductos.DBLookupComboBox4Enter(Sender: TObject);
begin
ProveedorT.Close;
ProveedorT.Open;
ProveedorT.Last;
end;
procedure TFProductos.BitBtn13Click(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Proveedor.exe')),SW_SHOWNORMAL);
end;
procedure TFProductos.TablaAfterCancel(DataSet: TDataSet);
begin
Tabla.Transaction.RollbackRetaining;
end;
procedure TFProductos.TablaAfterDelete(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFProductos.TablaAfterInsert(DataSet: TDataSet);
begin
If Cancelar then Tabla.Cancel else nuevo;
end;
procedure TFProductos.TablaAfterPost(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
end.

Просмотреть файл

@ -0,0 +1,568 @@
unit UFProductos;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DataModule, Grids, DBGrids, DB, ExtCtrls, StdCtrls, Mask,
DBCtrls, Buttons, ComCtrls, IBQuery, IBCustomDataSet, IBTable, OleCtrls,
SHDocVw;
const
EAN_izqA : array[0..9] of PChar=('0001101','0011001','0010011','0111101','0100011','0110001','0101111','0111011','0110111','0001011');
EAN_izqB : array[0..9] of PChar=('0100111','0110011','0011011','0100001','0011101','0111001','0000101','0010001','0001001','0010111');
EAN_dcha : array[0..9] of PChar=('1110010','1100110','1101100','1000010','1011100','1001110','1010000','1000100','1001000','1110100');
CodificaIzq : array[0..9] of PChar=('AAAAA','ABABB','ABBAB','ABBBA','BAABB','BBAAB','BBBAA','BABAB','BABBA','BBABA');
type
TFProductos = class(TForm)
DataSource: TDataSource;
DSTCat: TDataSource;
DSTSubCat: TDataSource;
DSMateriales: TDataSource;
DSRubro: TDataSource;
DSQProve: TDataSource;
MarcaDataSource: TDataSource;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet3: TTabSheet;
Panel3: TPanel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label2: TLabel;
Label14: TLabel;
Label23: TLabel;
DescripcionDBEdit: TDBEdit;
DBEdit1: TDBEdit;
DBLookupComboBox4: TDBLookupComboBox;
BitBtn13: TBitBtn;
Label8: TLabel;
Label19: TLabel;
Label30: TLabel;
Label10: TLabel;
Label5: TLabel;
DBText1: TDBText;
Label16: TLabel;
Label28: TLabel;
Label21: TLabel;
IVADBEdit: TDBEdit;
FleteDBEdit: TDBEdit;
CostoDBEdit: TDBEdit;
Label4: TLabel;
PrecioCtaCteDBEdit: TDBEdit;
DBMemo1: TDBMemo;
TabSheet2: TTabSheet;
Label6: TLabel;
Label15: TLabel;
Label17: TLabel;
Label18: TLabel;
Label20: TLabel;
DBEdit6: TDBEdit;
DBEdit5: TDBEdit;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
DBEdit17: TDBEdit;
DBEdit9: TDBEdit;
Label9: TLabel;
DBEdit21: TDBEdit;
Label32: TLabel;
Label33: TLabel;
Label34: TLabel;
GanaciaDBEdit: TDBEdit;
TabSheet4: TTabSheet;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label7: TLabel;
Label31: TLabel;
Label3: TLabel;
Label22: TLabel;
Precio1DBEdit: TDBEdit;
Precio2DBEdit: TDBEdit;
Precio3DBEdit: TDBEdit;
Precio6DBEdit: TDBEdit;
Precio4DBEdit: TDBEdit;
Precio5DBEdit: TDBEdit;
DBText2: TDBText;
TabSheet5: TTabSheet;
CuentaDataSource: TDataSource;
Label50: TLabel;
CuentaDBLookupComboBox: TDBLookupComboBox;
DBLookupComboBox1: TDBLookupComboBox;
DBLookupComboBox2: TDBLookupComboBox;
DBLookupComboBox7: TDBLookupComboBox;
Label54: TLabel;
Label53: TLabel;
Label51: TLabel;
Label52: TLabel;
Label25: TLabel;
Label26: TLabel;
Label27: TLabel;
RubroDBLookupComboBox: TDBLookupComboBox;
RubroBitBtn: TBitBtn;
MarcaDBLookupComboBox: TDBLookupComboBox;
MarcaBitBtn: TBitBtn;
CategoriaDBLookupComboBox: TDBLookupComboBox;
CategoriaBitBtn: TBitBtn;
Label29: TLabel;
Tabla: TIBTable;
CategoriaT: TIBTable;
SubCategoriaT: TIBTable;
RubroT: TIBTable;
MaterialT: TIBTable;
QTemp: TIBQuery;
Usuario: TIBQuery;
DSUsuarios: TDataSource;
CuentaQuery: TIBQuery;
MarcaT: TIBTable;
ProveedorT: TIBTable;
ConfigQuery: TIBQuery;
Label1: TLabel;
CodigoDBEdit: TDBEdit;
BitBtn4: TBitBtn;
DBNavigator1: TDBNavigator;
Label24: TLabel;
CodigoBarraEdit: TDBEdit;
CodigoBarraBitBtn: TBitBtn;
PaintBox1: TImage;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure RubroBitBtnClick(Sender: TObject);
procedure CodigoBarraBitBtnClick(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Precio6DBEditExit(Sender: TObject);
procedure CategoriaBitBtnClick(Sender: TObject);
procedure MarcaBitBtnClick(Sender: TObject);
procedure DBEdit14Exit(Sender: TObject);
procedure BitBtn13Click(Sender: TObject);
procedure TablaAfterInsert(DataSet: TDataSet);
procedure GanaciaDBEditExit(Sender: TObject);
procedure TablaAfterPost(DataSet: TDataSet);
procedure TablaAfterCancel(DataSet: TDataSet);
procedure TablaAfterDelete(DataSet: TDataSet);
procedure MarcaDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure DBLookupComboBox4Enter(Sender: TObject);
procedure CategoriaDBLookupComboBoxEnter(Sender: TObject);
procedure RubroDBLookupComboBoxEnter(Sender: TObject);
procedure MarcaDBLookupComboBoxEnter(Sender: TObject);
private
{ Private declarations }
public
desc:string;
Precio1, Precio2, Precio3, Precio4, Precio5, Precio6, PrecioCtaCte: Double;
{ Public declarations }
// procedimiento que codifica el número en un nº binario
procedure Codifica(num : string);
// procedimiento para dibujar el cód. de barras a partir del nº binario
procedure Dibujar(matrix : string);
// procedimiento para validar-corregir los códigos
procedure EANCorrecto(var num : string);
Procedure nuevo;
end;
var
FProductos: TFProductos;
implementation
uses UFBuscaArticulos,
UFCategorias, UFSubCategorias, Color, Marca, RubroF;
{$R *.dfm}
procedure TFProductos.EANCorrecto(var num : string);
var
i,N : byte;
sum : integer;
flag : byte;
begin
sum:=0;
N:=Length(num)-1; //13-1=12
for i:=1 to N do //desde 1 hasta 12
begin
if (i mod 2)=0 then // x mod y = x – (x div y) * y = 1-(0.5)*2
begin
if N=12 then
sum:=sum+StrToInt(num[i])*3
else
sum:=sum+StrToInt(num[i]);
end
else
begin
if N=12 then
sum:=sum+StrToInt(num[i])
else
sum:=sum+StrToInt(num[i])*3;
end;
end;
if sum>99 then
Flag:=10-(sum mod 100)
else
Flag:=10-(sum mod 10);
if Flag=10 then Flag:=0;
if not(StrToInt(num[N+1])=flag) then
num:=copy(num,1,length(num)-1)+IntToStr(Flag);
end;
procedure TFProductos.Codifica(num : string);
var
matrix : string;
i : integer;
begin
num:=CodigoBarraEdit.Text; //numero
matrix:='';
case Length(num) of //mientras sean 13 caracteres
13: begin
EANCorrecto(num); //
CodigoBarraEdit.Text:=num;
matrix:=matrix+'x0x'; // barra inicio
matrix:=matrix+EAN_izqA[StrToInt(num[2])];
for i:=3 to 7 do
if CodificaIzq[StrToInt(num[1])][i-3]='A' then
matrix:=matrix+EAN_izqA[StrToInt(num[i])]
else
matrix:=matrix+EAN_izqB[StrToInt(num[i])];
matrix:=matrix+'0x0x0'; // barra central
matrix:=matrix+EAN_dcha[StrToInt(num[8])];
matrix:=matrix+EAN_dcha[StrToInt(num[9])];
matrix:=matrix+EAN_dcha[StrToInt(num[10])];
matrix:=matrix+EAN_dcha[StrToInt(num[11])];
matrix:=matrix+EAN_dcha[StrToInt(num[12])];
matrix:=matrix+EAN_dcha[StrToInt(num[13])];
matrix:=matrix+'x0x'; // barra final
Dibujar(Matrix);
end;
8: begin
EANCorrecto(num);
CodigoBarraEdit.Text:=num;
matrix:=matrix+'x0x';
matrix:=matrix+EAN_izqA[StrToInt(num[1])];
matrix:=matrix+EAN_izqA[StrToInt(num[2])];
matrix:=matrix+EAN_izqA[StrToInt(num[3])];
matrix:=matrix+EAN_izqA[StrToInt(num[4])];
matrix:=matrix+'0x0x0';
matrix:=matrix+EAN_dcha[StrToInt(num[5])];
matrix:=matrix+EAN_dcha[StrToInt(num[6])];
matrix:=matrix+EAN_dcha[StrToInt(num[7])];
matrix:=matrix+EAN_dcha[StrToInt(num[8])];
matrix:=matrix+'x0x';
Dibujar(Matrix);
end
else
ShowMessage('LONGITUD DE CODIGO NO VALIDA');
end;
end;
procedure TFProductos.Dibujar(matrix : string);
var
i : integer;
begin
with PaintBox1 do begin
Canvas.Brush.Color:= clWhite;
Canvas.FillRect(Rect(0,0,PaintBox1.Width,PaintBox1.Height));
Canvas.Pen.Color:=clBlack;
END;
for i:=1 to Length(Matrix) do
if matrix[i]='1' then
PaintBox1.Canvas.PolyLine([Point(10+i,10),Point(10+i,50)])
else
if matrix[i]='x' then
PaintBox1.Canvas.PolyLine([Point(10+i,10),Point(10+i,55)]);
if Length(CodigoBarraEdit.Text)=13 then
begin
PaintBox1.Canvas.TextOut(3,50,CodigoBarraEdit.Text[1]);
PaintBox1.Canvas.TextOut(17,50,copy(CodigoBarraEdit.Text,2,6));
PaintBox1.Canvas.TextOut(63,50,copy(CodigoBarraEdit.Text,8,6));
end
else
if Length(CodigoBarraEdit.Text)=8 then
begin
PaintBox1.Canvas.TextOut(16,50,copy(CodigoBarraEdit.Text,1,4));
PaintBox1.Canvas.TextOut(48,50,copy(CodigoBarraEdit.Text,5,4));
end;
end;
procedure TFProductos.BitBtn1Click(Sender: TObject);
begin
desc:=CodigoDBEdit.Text;
If (Tabla.State = dsEdit) or (Tabla.State = dsInsert) And (DescripcionDBEdit.Text <> '') then Tabla.Post
else if (DescripcionDBEdit.Text <> '') then ShowMessage('COMPLETE TODOS LOS CAMPOS');
Close;
end;
procedure TFProductos.BitBtn2Click(Sender: TObject);
begin
Tabla.Cancel;
Close;
end;
procedure TFProductos.FormCreate(Sender: TObject);
begin
DM:=TDM.Create(Self);
Tabla.Active := True;
SubCategoriaT.Active := True;
ProveedorT.Active := True;
RubroT.Active := True;
MarcaT.Active := True;
CategoriaT.Active := True;
ConfigQuery.Open;
Precio1:=ConfigQuery.FieldByName('PP1').AsFloat/100+1;
Precio2:=ConfigQuery.FieldByName('PP2').AsFloat/100+1;
Precio3:=ConfigQuery.FieldByName('PP3').AsFloat/100+1;
Precio4:=ConfigQuery.FieldByName('PP4').AsFloat/100+1;
Precio5:=ConfigQuery.FieldByName('PP5').AsFloat/100+1;
Precio6:=ConfigQuery.FieldByName('PP6').AsFloat/100+1;
PrecioCtaCte:=ConfigQuery.FieldByName('PP').AsFloat/100+1;
QTemp.Close;
CuentaQuery.Open;
Tabla.Insert;
end;
procedure TFProductos.BitBtn4Click(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
Tabla.Cancel;
FBuscaArticulo:=TFBuscaArticulo.Create(self);
try
FBuscaArticulo.ShowModal;
finally
If FBuscaArticulo.Tabla.Active =True then
Tabla.Locate('CODIGO',FBuscaArticulo.Tabla.FieldByName('CODIGO').AsInteger,[]);
FBuscaArticulo.Free;
end;
Tabla.Edit;
end;
procedure TFProductos.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then { if it's an enter key }
begin
Key := #0; { eat enter key }
Perform(WM_NEXTDLGCTL, 0, 0); { move to next control }
end;
end;
procedure TFProductos.GanaciaDBEditExit(Sender: TObject);
var costo, flete, iva :double;
begin
if CostoDBEdit.Text = '' then CostoDBEdit.Text:='0';
if FleteDBEdit.Text = '' then FleteDBEdit.Text:='0';
if IVADBEdit.Text = '' then IVADBEdit.Text:='0';
if GanaciaDBEdit.Text = '' then GanaciaDBEdit.Text:='0';
costo:=StrToFloat(CostoDBEdit.Text);
flete:=costo*(StrToFloat(FleteDBEdit.Text)/100);
iva:=costo*(StrToFloat(IVADBEdit.Text)/100);
Precio1DBEdit.Text:=FloatToStr((costo*Precio1)+flete+iva);
Precio2DBEdit.Text:=FloatToStr((costo*Precio2)+flete+iva);
Precio3DBEdit.Text:=FloatToStr((costo*Precio3)+flete+iva);
Precio4DBEdit.Text:=FloatToStr((costo*Precio4)+flete+iva);
Precio5DBEdit.Text:=FloatToStr((costo*Precio5)+flete+iva);
Precio6DBEdit.Text:=FloatToStr((costo*Precio6)+flete+iva);
if GanaciaDBEdit.Text='0' then PrecioCtaCteDBEdit.Text:=FloatToStr((costo*PrecioCtaCte)+flete+iva) else PrecioCtaCteDBEdit.Text:=FloatToStr((costo*(StrToFloat(GanaciaDBEdit.Text)/100+1)+flete+iva));
Label21.Caption:= '= '+FloatToStr(iva);
DBText1.Caption:= FloatToStr(costo+flete);
DBText2.Caption:= FloatToStr(costo+flete+iva);
BitBtn1.SetFocus;
end;
Procedure TFProductos.nuevo;
begin
Tabla.FieldByName('CtaNombre').AsString:='13';
Tabla.FieldByName('CtaTipo').AsString:='13';
Tabla.FieldByName('CtaAnticipo').AsString:='13';
Tabla.FieldByName('CtaIIBB').AsString:='66';
Tabla.FieldByName('CODIGOBARRA').AsString:= '0';
Tabla.FieldByName('Color').AsString:= '0';
Tabla.FieldByName('Categoria').AsString:= '0';
Tabla.FieldByName('SubCategoria').AsString:= '0';
Tabla.FieldByName('Rubro').AsString := '0';
Tabla.FieldByName('Marca').AsString := '0';
Tabla.FieldByName('Proveedor').Value := 1;
DBLookupComboBox4.KeyValue := 0;
DbEdit9.Field.AsString := 'c/u';
DbEdit17.Field.AsDateTime := Date;
Tabla.FieldByName('Costo').AsInteger:= 0;
CostoDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('ImpOtros').AsInteger:= 0;
FleteDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('Tasa').AsInteger:= 0;
IVADBEdit.Field.AsFloat := 0;
Tabla.FieldByName('Precio').AsInteger:= 0;
PrecioCtaCteDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('IIBB').AsInteger:= 0;
end;
procedure TFProductos.RubroBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Rubro.exe')),SW_SHOWNORMAL);
{ RubroForm:=RubroForm.Create(self);
try
RubroForm.ShowModal;
finally
If RubroForm.desc <> '' then
RubroDBLookupComboBox.KeyValue:= RubroForm.desc;
Tabla.FieldByName('Rubro').AsString:=RubroForm.desc;
RubroForm.Free;
end;
RubroT.Close;
RubroT.Open; }
MarcaDBLookupComboBox.SetFocus;
end;
procedure TFProductos.RubroDBLookupComboBoxEnter(Sender: TObject);
begin
RubroT.Close;
RubroT.Open;
RubroT.Last;
end;
procedure TFProductos.CodigoBarraBitBtnClick(Sender: TObject);
var
i : integer;
begin
if Tabla.State = dsInsert then
begin
QTemp.Close;
QTemp.SQL.Text:='SELECT max(CODIGO) FROM "Articulo"';
QTemp.Open;
i:= 100000 + (QTemp.Fields.Fields[0].AsInteger +1); //agrego el codigo
end
else
begin
i:= 100000 + strtoint(CodigoDBEdit.Text);
IF (Tabla.State <> dsEdit) then Tabla.Edit;
end;
//codigo de barras
CodigoBarraEdit.Text := '1'+inttostr(i)+'2'; //lo incluyo en el codigo de barra
Codifica(CodigoBarraEdit.Text);
CodigoBarraEdit.SelStart:=0;
CodigoBarraEdit.SelLength:=Length(CodigoBarraEdit.Text);
Tabla.FieldByName('CodigoBarra').AsString := CodigoBarraEdit.Text;
end;
procedure TFProductos.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
IF Key = VK_F2 then RubroBitBtn.Click;
IF Key = VK_F3 then MarcaBitBtn.Click;
IF Key = VK_F4 then BitBtn13.Click;
IF Key = VK_F5 then BitBtn4.Click;
IF Key = VK_F6 then CodigoBarraBitBtn.Click;
end;
procedure TFProductos.Precio6DBEditExit(Sender: TObject);
begin
IVADBEdit.SetFocus;
end;
procedure TFProductos.CategoriaBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Categoria.exe')),SW_SHOWNORMAL);
{
FCategorias:=TFCategorias.Create(self);
try
FCategorias.ShowModal;
finally
If FCategorias.desc <> '' then
begin
CategoriaDBLookupComboBox.KeyValue:= FCategorias.desc;
Tabla.FieldByName('Categoria').AsString:=FCategorias.desc;
end;
FCategorias.Free;
end;
CategoriaT.Close;
CategoriaT.Open;
RubroDBLookupComboBox.SetFocus;
}
end;
procedure TFProductos.CategoriaDBLookupComboBoxEnter(Sender: TObject);
begin
CategoriaT.Close;
CategoriaT.Open;
CategoriaT.Last;
end;
procedure TFProductos.MarcaBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Marca.exe')),SW_SHOWNORMAL);
{ MarcaForm:=TMarcaForm.Create(self);
try
MarcaForm.ShowModal;
finally
If MarcaForm.desc <> '' then
begin
MarcaDBLookupComboBox.KeyValue:= MarcaForm.desc;
If (Tabla.State <> dsEdit) and (Tabla.State <> dsInsert) then Tabla.Edit;
Tabla.FieldByName('Marca').AsString:=MarcaForm.desc;
end;
MarcaForm.Free;
end;
MarcaT.Close;
MarcaT.Open; }
DBEdit9.SetFocus;
end;
procedure TFProductos.MarcaDBLookupComboBoxEnter(Sender: TObject);
begin
MarcaT.Close;
MarcaT.Open;
MarcaT.Last;
end;
procedure TFProductos.MarcaDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
MarcaT.Close;
MarcaT.Open;
MarcaT.Last;
end;
procedure TFProductos.DBEdit14Exit(Sender: TObject);
begin
BitBtn1.SetFocus;
end;
procedure TFProductos.DBLookupComboBox4Enter(Sender: TObject);
begin
ProveedorT.Close;
ProveedorT.Open;
ProveedorT.Last;
end;
procedure TFProductos.BitBtn13Click(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Proveedor.exe')),SW_SHOWNORMAL);
end;
procedure TFProductos.TablaAfterCancel(DataSet: TDataSet);
begin
Tabla.Transaction.RollbackRetaining;
end;
procedure TFProductos.TablaAfterDelete(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFProductos.TablaAfterInsert(DataSet: TDataSet);
begin
If Cancelar then Tabla.Cancel else nuevo;
end;
procedure TFProductos.TablaAfterPost(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
end.

Просмотреть файл

@ -0,0 +1,570 @@
unit UFProductos;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DataModule, Grids, DBGrids, DB, ExtCtrls, StdCtrls, Mask,
DBCtrls, Buttons, ComCtrls, IBQuery, IBCustomDataSet, IBTable, OleCtrls,
SHDocVw;
const
EAN_izqA : array[0..9] of PChar=('0001101','0011001','0010011','0111101','0100011','0110001','0101111','0111011','0110111','0001011');
EAN_izqB : array[0..9] of PChar=('0100111','0110011','0011011','0100001','0011101','0111001','0000101','0010001','0001001','0010111');
EAN_dcha : array[0..9] of PChar=('1110010','1100110','1101100','1000010','1011100','1001110','1010000','1000100','1001000','1110100');
CodificaIzq : array[0..9] of PChar=('AAAAA','ABABB','ABBAB','ABBBA','BAABB','BBAAB','BBBAA','BABAB','BABBA','BBABA');
type
TFProductos = class(TForm)
DataSource: TDataSource;
DSTCat: TDataSource;
DSTSubCat: TDataSource;
DSMateriales: TDataSource;
DSRubro: TDataSource;
DSQProve: TDataSource;
MarcaDataSource: TDataSource;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet3: TTabSheet;
Panel3: TPanel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label2: TLabel;
Label14: TLabel;
Label23: TLabel;
DescripcionDBEdit: TDBEdit;
DBEdit1: TDBEdit;
DBLookupComboBox4: TDBLookupComboBox;
BitBtn13: TBitBtn;
Label8: TLabel;
Label19: TLabel;
Label30: TLabel;
Label10: TLabel;
Label5: TLabel;
DBText1: TDBText;
Label16: TLabel;
Label28: TLabel;
Label21: TLabel;
IVADBEdit: TDBEdit;
FleteDBEdit: TDBEdit;
CostoDBEdit: TDBEdit;
Label4: TLabel;
PrecioCtaCteDBEdit: TDBEdit;
DBMemo1: TDBMemo;
TabSheet2: TTabSheet;
Label6: TLabel;
Label15: TLabel;
Label17: TLabel;
Label18: TLabel;
Label20: TLabel;
DBEdit6: TDBEdit;
DBEdit5: TDBEdit;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
DBEdit17: TDBEdit;
DBEdit9: TDBEdit;
Label9: TLabel;
DBEdit21: TDBEdit;
Label32: TLabel;
Label33: TLabel;
Label34: TLabel;
GanaciaDBEdit: TDBEdit;
TabSheet4: TTabSheet;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label7: TLabel;
Label31: TLabel;
Label3: TLabel;
Label22: TLabel;
Precio1DBEdit: TDBEdit;
Precio2DBEdit: TDBEdit;
Precio3DBEdit: TDBEdit;
Precio6DBEdit: TDBEdit;
Precio4DBEdit: TDBEdit;
Precio5DBEdit: TDBEdit;
DBText2: TDBText;
TabSheet5: TTabSheet;
CuentaDataSource: TDataSource;
Label50: TLabel;
CuentaDBLookupComboBox: TDBLookupComboBox;
DBLookupComboBox1: TDBLookupComboBox;
DBLookupComboBox2: TDBLookupComboBox;
DBLookupComboBox7: TDBLookupComboBox;
Label54: TLabel;
Label53: TLabel;
Label51: TLabel;
Label52: TLabel;
Label25: TLabel;
Label26: TLabel;
Label27: TLabel;
RubroDBLookupComboBox: TDBLookupComboBox;
RubroBitBtn: TBitBtn;
MarcaDBLookupComboBox: TDBLookupComboBox;
MarcaBitBtn: TBitBtn;
CategoriaDBLookupComboBox: TDBLookupComboBox;
CategoriaBitBtn: TBitBtn;
Label29: TLabel;
Tabla: TIBTable;
CategoriaT: TIBTable;
SubCategoriaT: TIBTable;
RubroT: TIBTable;
MaterialT: TIBTable;
QTemp: TIBQuery;
Usuario: TIBQuery;
DSUsuarios: TDataSource;
CuentaQuery: TIBQuery;
MarcaT: TIBTable;
ProveedorT: TIBTable;
ConfigQuery: TIBQuery;
Label1: TLabel;
CodigoDBEdit: TDBEdit;
BitBtn4: TBitBtn;
DBNavigator1: TDBNavigator;
Label24: TLabel;
CodigoBarraEdit: TDBEdit;
CodigoBarraBitBtn: TBitBtn;
PaintBox1: TImage;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure RubroBitBtnClick(Sender: TObject);
procedure CodigoBarraBitBtnClick(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Precio6DBEditExit(Sender: TObject);
procedure CategoriaBitBtnClick(Sender: TObject);
procedure MarcaBitBtnClick(Sender: TObject);
procedure DBEdit14Exit(Sender: TObject);
procedure BitBtn13Click(Sender: TObject);
procedure TablaAfterInsert(DataSet: TDataSet);
procedure GanaciaDBEditExit(Sender: TObject);
procedure TablaAfterPost(DataSet: TDataSet);
procedure TablaAfterCancel(DataSet: TDataSet);
procedure TablaAfterDelete(DataSet: TDataSet);
procedure MarcaDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure DBLookupComboBox4Enter(Sender: TObject);
procedure CategoriaDBLookupComboBoxEnter(Sender: TObject);
procedure RubroDBLookupComboBoxEnter(Sender: TObject);
procedure MarcaDBLookupComboBoxEnter(Sender: TObject);
private
{ Private declarations }
public
desc:string;
Precio1, Precio2, Precio3, Precio4, Precio5, Precio6, PrecioCtaCte: Double;
{ Public declarations }
// procedimiento que codifica el número en un nº binario
procedure Codifica(num : string);
// procedimiento para dibujar el cód. de barras a partir del nº binario
procedure Dibujar(matrix : string);
// procedimiento para validar-corregir los códigos
procedure EANCorrecto(var num : string);
Procedure nuevo;
end;
var
FProductos: TFProductos;
implementation
uses UFBuscaArticulos,
UFCategorias, UFSubCategorias, Color, Marca, RubroF;
{$R *.dfm}
procedure TFProductos.EANCorrecto(var num : string);
var
i,N : byte;
sum : integer;
flag : byte;
begin
sum:=0;
N:=Length(num)-1; //13-1=12
for i:=1 to N do //desde 1 hasta 12
begin
if (i mod 2)=0 then // x mod y = x – (x div y) * y = 1-(0.5)*2
begin
if N=12 then
sum:=sum+StrToInt(num[i])*3
else
sum:=sum+StrToInt(num[i]);
end
else
begin
if N=12 then
sum:=sum+StrToInt(num[i])
else
sum:=sum+StrToInt(num[i])*3;
end;
end;
if sum>99 then
Flag:=10-(sum mod 100)
else
Flag:=10-(sum mod 10);
if Flag=10 then Flag:=0;
if not(StrToInt(num[N+1])=flag) then
num:=copy(num,1,length(num)-1)+IntToStr(Flag);
end;
procedure TFProductos.Codifica(num : string);
var
matrix : string;
i : integer;
begin
num:=CodigoBarraEdit.Text; //numero
matrix:='';
case Length(num) of //mientras sean 13 caracteres
13: begin
EANCorrecto(num); //
CodigoBarraEdit.Text:=num;
matrix:=matrix+'x0x'; // barra inicio
matrix:=matrix+EAN_izqA[StrToInt(num[2])];
for i:=3 to 7 do
if CodificaIzq[StrToInt(num[1])][i-3]='A' then
matrix:=matrix+EAN_izqA[StrToInt(num[i])]
else
matrix:=matrix+EAN_izqB[StrToInt(num[i])];
matrix:=matrix+'0x0x0'; // barra central
matrix:=matrix+EAN_dcha[StrToInt(num[8])];
matrix:=matrix+EAN_dcha[StrToInt(num[9])];
matrix:=matrix+EAN_dcha[StrToInt(num[10])];
matrix:=matrix+EAN_dcha[StrToInt(num[11])];
matrix:=matrix+EAN_dcha[StrToInt(num[12])];
matrix:=matrix+EAN_dcha[StrToInt(num[13])];
matrix:=matrix+'x0x'; // barra final
Dibujar(Matrix);
end;
8: begin
EANCorrecto(num);
CodigoBarraEdit.Text:=num;
matrix:=matrix+'x0x';
matrix:=matrix+EAN_izqA[StrToInt(num[1])];
matrix:=matrix+EAN_izqA[StrToInt(num[2])];
matrix:=matrix+EAN_izqA[StrToInt(num[3])];
matrix:=matrix+EAN_izqA[StrToInt(num[4])];
matrix:=matrix+'0x0x0';
matrix:=matrix+EAN_dcha[StrToInt(num[5])];
matrix:=matrix+EAN_dcha[StrToInt(num[6])];
matrix:=matrix+EAN_dcha[StrToInt(num[7])];
matrix:=matrix+EAN_dcha[StrToInt(num[8])];
matrix:=matrix+'x0x';
Dibujar(Matrix);
end
else
ShowMessage('LONGITUD DE CODIGO NO VALIDA');
end;
end;
procedure TFProductos.Dibujar(matrix : string);
var
i : integer;
begin
with PaintBox1 do begin
Canvas.Brush.Color:= clWhite;
Canvas.FillRect(Rect(0,0,PaintBox1.Width,PaintBox1.Height));
Canvas.Pen.Color:=clBlack;
END;
for i:=1 to Length(Matrix) do
if matrix[i]='1' then
PaintBox1.Canvas.PolyLine([Point(10+i,10),Point(10+i,50)])
else
if matrix[i]='x' then
PaintBox1.Canvas.PolyLine([Point(10+i,10),Point(10+i,55)]);
if Length(CodigoBarraEdit.Text)=13 then
begin
PaintBox1.Canvas.TextOut(3,50,CodigoBarraEdit.Text[1]);
PaintBox1.Canvas.TextOut(17,50,copy(CodigoBarraEdit.Text,2,6));
PaintBox1.Canvas.TextOut(63,50,copy(CodigoBarraEdit.Text,8,6));
end
else
if Length(CodigoBarraEdit.Text)=8 then
begin
PaintBox1.Canvas.TextOut(16,50,copy(CodigoBarraEdit.Text,1,4));
PaintBox1.Canvas.TextOut(48,50,copy(CodigoBarraEdit.Text,5,4));
end;
end;
procedure TFProductos.BitBtn1Click(Sender: TObject);
begin
desc:=CodigoDBEdit.Text;
If (Tabla.State = dsEdit) or (Tabla.State = dsInsert) And (DescripcionDBEdit.Text <> '') then Tabla.Post
else if (DescripcionDBEdit.Text <> '') then ShowMessage('COMPLETE TODOS LOS CAMPOS');
Close;
end;
procedure TFProductos.BitBtn2Click(Sender: TObject);
begin
Tabla.Cancel;
Close;
end;
procedure TFProductos.FormCreate(Sender: TObject);
begin
DM:=TDM.Create(Self);
Tabla.Active := True;
SubCategoriaT.Active := True;
ProveedorT.Active := True;
RubroT.Active := True;
MarcaT.Active := True;
CategoriaT.Active := True;
ConfigQuery.Open;
Precio1:=ConfigQuery.FieldByName('PP1').AsFloat/100+1;
Precio2:=ConfigQuery.FieldByName('PP2').AsFloat/100+1;
Precio3:=ConfigQuery.FieldByName('PP3').AsFloat/100+1;
Precio4:=ConfigQuery.FieldByName('PP4').AsFloat/100+1;
Precio5:=ConfigQuery.FieldByName('PP5').AsFloat/100+1;
Precio6:=ConfigQuery.FieldByName('PP6').AsFloat/100+1;
PrecioCtaCte:=ConfigQuery.FieldByName('PP').AsFloat/100+1;
QTemp.Close;
CuentaQuery.Open;
Tabla.Insert;
end;
procedure TFProductos.BitBtn4Click(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
Tabla.Cancel;
FBuscaArticulo:=TFBuscaArticulo.Create(self);
try
FBuscaArticulo.ShowModal;
finally
If FBuscaArticulo.Tabla.Active =True then
Tabla.Locate('CODIGO',FBuscaArticulo.Tabla.FieldByName('CODIGO').AsInteger,[]);
FBuscaArticulo.Free;
end;
Tabla.Edit;
end;
procedure TFProductos.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then { if it's an enter key }
begin
Key := #0; { eat enter key }
Perform(WM_NEXTDLGCTL, 0, 0); { move to next control }
end;
end;
procedure TFProductos.GanaciaDBEditExit(Sender: TObject);
var costo, flete, iva :double;
begin
if CostoDBEdit.Text = '' then CostoDBEdit.Text:='0';
if FleteDBEdit.Text = '' then FleteDBEdit.Text:='0';
if IVADBEdit.Text = '' then IVADBEdit.Text:='0';
if GanaciaDBEdit.Text = '' then GanaciaDBEdit.Text:='0';
costo:=StrToFloat(CostoDBEdit.Text);
flete:=costo*(StrToFloat(FleteDBEdit.Text)/100);
iva:=costo*(StrToFloat(IVADBEdit.Text)/100);
Precio1DBEdit.Text:=FloatToStr((costo*Precio1)+flete+iva);
Precio2DBEdit.Text:=FloatToStr((costo*Precio2)+flete+iva);
Precio3DBEdit.Text:=FloatToStr((costo*Precio3)+flete+iva);
Precio4DBEdit.Text:=FloatToStr((costo*Precio4)+flete+iva);
Precio5DBEdit.Text:=FloatToStr((costo*Precio5)+flete+iva);
Precio6DBEdit.Text:=FloatToStr((costo*Precio6)+flete+iva);
if GanaciaDBEdit.Text='0' then PrecioCtaCteDBEdit.Text:=FloatToStr((costo*PrecioCtaCte)+flete+iva) else PrecioCtaCteDBEdit.Text:=FloatToStr((costo*(StrToFloat(GanaciaDBEdit.Text)/100+1)+flete+iva));
Label21.Caption:= '= '+FloatToStr(iva);
DBText1.Caption:= FloatToStr(costo+flete);
DBText2.Caption:= FloatToStr(costo+flete+iva);
BitBtn1.SetFocus;
end;
Procedure TFProductos.nuevo;
begin
Tabla.FieldByName('CtaNombre').AsString:='13';
Tabla.FieldByName('CtaTipo').AsString:='13';
Tabla.FieldByName('CtaAnticipo').AsString:='13';
Tabla.FieldByName('CtaIIBB').AsString:='66';
Tabla.FieldByName('CODIGOBARRA').AsString:= '0';
Tabla.FieldByName('Color').AsString:= '0';
Tabla.FieldByName('Categoria').AsString:= '0';
Tabla.FieldByName('SubCategoria').AsString:= '0';
Tabla.FieldByName('Rubro').AsString := '0';
Tabla.FieldByName('Marca').AsString := '0';
Tabla.FieldByName('Proveedor').Value := 1;
DBLookupComboBox4.KeyValue := 0;
DbEdit9.Field.AsString := 'c/u';
DbEdit17.Field.AsDateTime := Date;
Tabla.FieldByName('Costo').AsInteger:= 0;
CostoDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('ImpOtros').AsInteger:= 0;
FleteDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('Tasa').AsInteger:= 0;
IVADBEdit.Field.AsFloat := 0;
Tabla.FieldByName('Precio').AsInteger:= 0;
PrecioCtaCteDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('IIBB').AsInteger:= 0;
end;
procedure TFProductos.RubroBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Rubro.exe')),SW_SHOWNORMAL);
{ RubroForm:=RubroForm.Create(self);
try
RubroForm.ShowModal;
finally
If RubroForm.desc <> '' then
RubroDBLookupComboBox.KeyValue:= RubroForm.desc;
Tabla.FieldByName('Rubro').AsString:=RubroForm.desc;
RubroForm.Free;
end;
RubroT.Close;
RubroT.Open; }
MarcaDBLookupComboBox.SetFocus;
end;
procedure TFProductos.RubroDBLookupComboBoxEnter(Sender: TObject);
begin
RubroT.Close;
RubroT.Open;
RubroT.Last;
end;
procedure TFProductos.CodigoBarraBitBtnClick(Sender: TObject);
var
i : integer;
begin
if Tabla.State = dsInsert then
begin
QTemp.Close;
QTemp.SQL.Text:='SELECT max(CODIGO) FROM "Articulo"';
QTemp.Open;
i:= 100000 + (QTemp.Fields.Fields[0].AsInteger +1); //agrego el codigo
end
else
begin
i:= 100000 + strtoint(CodigoDBEdit.Text);
IF (Tabla.State <> dsEdit) then Tabla.Edit;
end;
//codigo de barras
CodigoBarraEdit.Text := '1'+inttostr(i)+'2'; //lo incluyo en el codigo de barra
Codifica(CodigoBarraEdit.Text);
CodigoBarraEdit.SelStart:=0;
CodigoBarraEdit.SelLength:=Length(CodigoBarraEdit.Text);
Tabla.FieldByName('CodigoBarra').AsString := CodigoBarraEdit.Text;
end;
procedure TFProductos.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
IF Key = VK_F2 then RubroBitBtn.Click;
IF Key = VK_F3 then MarcaBitBtn.Click;
IF Key = VK_F4 then BitBtn13.Click;
IF Key = VK_F5 then BitBtn4.Click;
IF Key = VK_F6 then CodigoBarraBitBtn.Click;
end;
procedure TFProductos.Precio6DBEditExit(Sender: TObject);
begin
IVADBEdit.SetFocus;
end;
procedure TFProductos.CategoriaBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Categoria.exe')),SW_SHOWNORMAL);
{
FCategorias:=TFCategorias.Create(self);
try
FCategorias.ShowModal;
finally
If FCategorias.desc <> '' then
begin
CategoriaDBLookupComboBox.KeyValue:= FCategorias.desc;
Tabla.FieldByName('Categoria').AsString:=FCategorias.desc;
end;
FCategorias.Free;
end;
CategoriaT.Close;
CategoriaT.Open;
RubroDBLookupComboBox.SetFocus;
}
end;
procedure TFProductos.CategoriaDBLookupComboBoxEnter(Sender: TObject);
begin
CategoriaT.Close;
CategoriaT.Open;
CategoriaT.Last;
end;
procedure TFProductos.MarcaBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Marca.exe')),SW_SHOWNORMAL);
{ MarcaForm:=TMarcaForm.Create(self);
try
MarcaForm.ShowModal;
finally
If MarcaForm.desc <> '' then
begin
MarcaDBLookupComboBox.KeyValue:= MarcaForm.desc;
If (Tabla.State <> dsEdit) and (Tabla.State <> dsInsert) then Tabla.Edit;
Tabla.FieldByName('Marca').AsString:=MarcaForm.desc;
end;
MarcaForm.Free;
end;
MarcaT.Close;
MarcaT.Open;
DBEdit9.SetFocus;
}
end;
procedure TFProductos.MarcaDBLookupComboBoxEnter(Sender: TObject);
begin
MarcaT.Close;
MarcaT.Open;
MarcaT.Last;
end;
procedure TFProductos.MarcaDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
MarcaT.Close;
MarcaT.Open;
MarcaT.Last;
end;
procedure TFProductos.DBEdit14Exit(Sender: TObject);
begin
BitBtn1.SetFocus;
end;
procedure TFProductos.DBLookupComboBox4Enter(Sender: TObject);
begin
ProveedorT.Close;
ProveedorT.Open;
ProveedorT.Last;
end;
procedure TFProductos.BitBtn13Click(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Proveedor.exe')),SW_SHOWNORMAL);
end;
procedure TFProductos.TablaAfterCancel(DataSet: TDataSet);
begin
Tabla.Transaction.RollbackRetaining;
end;
procedure TFProductos.TablaAfterDelete(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFProductos.TablaAfterInsert(DataSet: TDataSet);
begin
If Cancelar then Tabla.Cancel else nuevo;
end;
procedure TFProductos.TablaAfterPost(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
end.

Просмотреть файл

@ -0,0 +1,572 @@
unit UFProductos;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DataModule, Grids, DBGrids, DB, ExtCtrls, StdCtrls, Mask,
DBCtrls, Buttons, ComCtrls, IBQuery, IBCustomDataSet, IBTable, OleCtrls,
SHDocVw;
const
EAN_izqA : array[0..9] of PChar=('0001101','0011001','0010011','0111101','0100011','0110001','0101111','0111011','0110111','0001011');
EAN_izqB : array[0..9] of PChar=('0100111','0110011','0011011','0100001','0011101','0111001','0000101','0010001','0001001','0010111');
EAN_dcha : array[0..9] of PChar=('1110010','1100110','1101100','1000010','1011100','1001110','1010000','1000100','1001000','1110100');
CodificaIzq : array[0..9] of PChar=('AAAAA','ABABB','ABBAB','ABBBA','BAABB','BBAAB','BBBAA','BABAB','BABBA','BBABA');
type
TFProductos = class(TForm)
DataSource: TDataSource;
DSTCat: TDataSource;
DSTSubCat: TDataSource;
DSMateriales: TDataSource;
DSRubro: TDataSource;
DSQProve: TDataSource;
MarcaDataSource: TDataSource;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet3: TTabSheet;
Panel3: TPanel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label2: TLabel;
Label14: TLabel;
Label23: TLabel;
DescripcionDBEdit: TDBEdit;
DBEdit1: TDBEdit;
DBLookupComboBox4: TDBLookupComboBox;
BitBtn13: TBitBtn;
Label8: TLabel;
Label19: TLabel;
Label30: TLabel;
Label10: TLabel;
Label5: TLabel;
DBText1: TDBText;
Label16: TLabel;
Label28: TLabel;
Label21: TLabel;
IVADBEdit: TDBEdit;
FleteDBEdit: TDBEdit;
CostoDBEdit: TDBEdit;
Label4: TLabel;
PrecioCtaCteDBEdit: TDBEdit;
DBMemo1: TDBMemo;
TabSheet2: TTabSheet;
Label6: TLabel;
Label15: TLabel;
Label17: TLabel;
Label18: TLabel;
Label20: TLabel;
DBEdit6: TDBEdit;
DBEdit5: TDBEdit;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
DBEdit17: TDBEdit;
DBEdit9: TDBEdit;
Label9: TLabel;
DBEdit21: TDBEdit;
Label32: TLabel;
Label33: TLabel;
Label34: TLabel;
GanaciaDBEdit: TDBEdit;
TabSheet4: TTabSheet;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label7: TLabel;
Label31: TLabel;
Label3: TLabel;
Label22: TLabel;
Precio1DBEdit: TDBEdit;
Precio2DBEdit: TDBEdit;
Precio3DBEdit: TDBEdit;
Precio6DBEdit: TDBEdit;
Precio4DBEdit: TDBEdit;
Precio5DBEdit: TDBEdit;
DBText2: TDBText;
TabSheet5: TTabSheet;
CuentaDataSource: TDataSource;
Label50: TLabel;
CuentaDBLookupComboBox: TDBLookupComboBox;
DBLookupComboBox1: TDBLookupComboBox;
DBLookupComboBox2: TDBLookupComboBox;
DBLookupComboBox7: TDBLookupComboBox;
Label54: TLabel;
Label53: TLabel;
Label51: TLabel;
Label52: TLabel;
Label25: TLabel;
Label26: TLabel;
Label27: TLabel;
RubroDBLookupComboBox: TDBLookupComboBox;
RubroBitBtn: TBitBtn;
MarcaDBLookupComboBox: TDBLookupComboBox;
MarcaBitBtn: TBitBtn;
CategoriaDBLookupComboBox: TDBLookupComboBox;
CategoriaBitBtn: TBitBtn;
Label29: TLabel;
Tabla: TIBTable;
CategoriaT: TIBTable;
SubCategoriaT: TIBTable;
RubroT: TIBTable;
MaterialT: TIBTable;
QTemp: TIBQuery;
Usuario: TIBQuery;
DSUsuarios: TDataSource;
CuentaQuery: TIBQuery;
MarcaT: TIBTable;
ProveedorT: TIBTable;
ConfigQuery: TIBQuery;
Label1: TLabel;
CodigoDBEdit: TDBEdit;
BitBtn4: TBitBtn;
DBNavigator1: TDBNavigator;
Label24: TLabel;
CodigoBarraEdit: TDBEdit;
CodigoBarraBitBtn: TBitBtn;
PaintBox1: TImage;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure RubroBitBtnClick(Sender: TObject);
procedure CodigoBarraBitBtnClick(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Precio6DBEditExit(Sender: TObject);
procedure CategoriaBitBtnClick(Sender: TObject);
procedure MarcaBitBtnClick(Sender: TObject);
procedure DBEdit14Exit(Sender: TObject);
procedure BitBtn13Click(Sender: TObject);
procedure TablaAfterInsert(DataSet: TDataSet);
procedure GanaciaDBEditExit(Sender: TObject);
procedure TablaAfterPost(DataSet: TDataSet);
procedure TablaAfterCancel(DataSet: TDataSet);
procedure TablaAfterDelete(DataSet: TDataSet);
procedure MarcaDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure DBLookupComboBox4Enter(Sender: TObject);
procedure CategoriaDBLookupComboBoxEnter(Sender: TObject);
procedure RubroDBLookupComboBoxEnter(Sender: TObject);
procedure MarcaDBLookupComboBoxEnter(Sender: TObject);
private
{ Private declarations }
public
desc:string;
Precio1, Precio2, Precio3, Precio4, Precio5, Precio6, PrecioCtaCte: Double;
{ Public declarations }
// procedimiento que codifica el número en un nº binario
procedure Codifica(num : string);
// procedimiento para dibujar el cód. de barras a partir del nº binario
procedure Dibujar(matrix : string);
// procedimiento para validar-corregir los códigos
procedure EANCorrecto(var num : string);
Procedure nuevo;
end;
var
FProductos: TFProductos;
implementation
uses UFBuscaArticulos,
UFCategorias, UFSubCategorias, Color, Marca, RubroF;
{$R *.dfm}
procedure TFProductos.EANCorrecto(var num : string);
var
i,N : byte;
sum : integer;
flag : byte;
begin
sum:=0;
N:=Length(num)-1; //13-1=12
for i:=1 to N do //desde 1 hasta 12
begin
if (i mod 2)=0 then // x mod y = x – (x div y) * y = 1-(0.5)*2
begin
if N=12 then
sum:=sum+StrToInt(num[i])*3
else
sum:=sum+StrToInt(num[i]);
end
else
begin
if N=12 then
sum:=sum+StrToInt(num[i])
else
sum:=sum+StrToInt(num[i])*3;
end;
end;
if sum>99 then
Flag:=10-(sum mod 100)
else
Flag:=10-(sum mod 10);
if Flag=10 then Flag:=0;
if not(StrToInt(num[N+1])=flag) then
num:=copy(num,1,length(num)-1)+IntToStr(Flag);
end;
procedure TFProductos.Codifica(num : string);
var
matrix : string;
i : integer;
begin
num:=CodigoBarraEdit.Text; //numero
matrix:='';
case Length(num) of //mientras sean 13 caracteres
13: begin
EANCorrecto(num); //
CodigoBarraEdit.Text:=num;
matrix:=matrix+'x0x'; // barra inicio
matrix:=matrix+EAN_izqA[StrToInt(num[2])];
for i:=3 to 7 do
if CodificaIzq[StrToInt(num[1])][i-3]='A' then
matrix:=matrix+EAN_izqA[StrToInt(num[i])]
else
matrix:=matrix+EAN_izqB[StrToInt(num[i])];
matrix:=matrix+'0x0x0'; // barra central
matrix:=matrix+EAN_dcha[StrToInt(num[8])];
matrix:=matrix+EAN_dcha[StrToInt(num[9])];
matrix:=matrix+EAN_dcha[StrToInt(num[10])];
matrix:=matrix+EAN_dcha[StrToInt(num[11])];
matrix:=matrix+EAN_dcha[StrToInt(num[12])];
matrix:=matrix+EAN_dcha[StrToInt(num[13])];
matrix:=matrix+'x0x'; // barra final
Dibujar(Matrix);
end;
8: begin
EANCorrecto(num);
CodigoBarraEdit.Text:=num;
matrix:=matrix+'x0x';
matrix:=matrix+EAN_izqA[StrToInt(num[1])];
matrix:=matrix+EAN_izqA[StrToInt(num[2])];
matrix:=matrix+EAN_izqA[StrToInt(num[3])];
matrix:=matrix+EAN_izqA[StrToInt(num[4])];
matrix:=matrix+'0x0x0';
matrix:=matrix+EAN_dcha[StrToInt(num[5])];
matrix:=matrix+EAN_dcha[StrToInt(num[6])];
matrix:=matrix+EAN_dcha[StrToInt(num[7])];
matrix:=matrix+EAN_dcha[StrToInt(num[8])];
matrix:=matrix+'x0x';
Dibujar(Matrix);
end
else
ShowMessage('LONGITUD DE CODIGO NO VALIDA');
end;
end;
procedure TFProductos.Dibujar(matrix : string);
var
i : integer;
begin
with PaintBox1 do begin
Canvas.Brush.Color:= clWhite;
Canvas.FillRect(Rect(0,0,PaintBox1.Width,PaintBox1.Height));
Canvas.Pen.Color:=clBlack;
END;
for i:=1 to Length(Matrix) do
if matrix[i]='1' then
PaintBox1.Canvas.PolyLine([Point(10+i,10),Point(10+i,50)])
else
if matrix[i]='x' then
PaintBox1.Canvas.PolyLine([Point(10+i,10),Point(10+i,55)]);
if Length(CodigoBarraEdit.Text)=13 then
begin
PaintBox1.Canvas.TextOut(3,50,CodigoBarraEdit.Text[1]);
PaintBox1.Canvas.TextOut(17,50,copy(CodigoBarraEdit.Text,2,6));
PaintBox1.Canvas.TextOut(63,50,copy(CodigoBarraEdit.Text,8,6));
end
else
if Length(CodigoBarraEdit.Text)=8 then
begin
PaintBox1.Canvas.TextOut(16,50,copy(CodigoBarraEdit.Text,1,4));
PaintBox1.Canvas.TextOut(48,50,copy(CodigoBarraEdit.Text,5,4));
end;
end;
procedure TFProductos.BitBtn1Click(Sender: TObject);
begin
desc:=CodigoDBEdit.Text;
If (Tabla.State = dsEdit) or (Tabla.State = dsInsert) And (DescripcionDBEdit.Text <> '') then Tabla.Post
else if (DescripcionDBEdit.Text <> '') then ShowMessage('COMPLETE TODOS LOS CAMPOS');
Close;
end;
procedure TFProductos.BitBtn2Click(Sender: TObject);
begin
Tabla.Cancel;
Close;
end;
procedure TFProductos.FormCreate(Sender: TObject);
begin
DM:=TDM.Create(Self);
Tabla.Active := True;
SubCategoriaT.Active := True;
ProveedorT.Active := True;
RubroT.Active := True;
MarcaT.Active := True;
CategoriaT.Active := True;
ConfigQuery.Open;
Precio1:=ConfigQuery.FieldByName('PP1').AsFloat/100+1;
Precio2:=ConfigQuery.FieldByName('PP2').AsFloat/100+1;
Precio3:=ConfigQuery.FieldByName('PP3').AsFloat/100+1;
Precio4:=ConfigQuery.FieldByName('PP4').AsFloat/100+1;
Precio5:=ConfigQuery.FieldByName('PP5').AsFloat/100+1;
Precio6:=ConfigQuery.FieldByName('PP6').AsFloat/100+1;
PrecioCtaCte:=ConfigQuery.FieldByName('PP').AsFloat/100+1;
QTemp.Close;
CuentaQuery.Open;
Tabla.Insert;
end;
procedure TFProductos.BitBtn4Click(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
Tabla.Cancel;
FBuscaArticulo:=TFBuscaArticulo.Create(self);
try
FBuscaArticulo.ShowModal;
finally
If FBuscaArticulo.Tabla.Active =True then
Tabla.Locate('CODIGO',FBuscaArticulo.Tabla.FieldByName('CODIGO').AsInteger,[]);
FBuscaArticulo.Free;
end;
Tabla.Edit;
end;
procedure TFProductos.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then { if it's an enter key }
begin
Key := #0; { eat enter key }
Perform(WM_NEXTDLGCTL, 0, 0); { move to next control }
end;
end;
procedure TFProductos.GanaciaDBEditExit(Sender: TObject);
var costo, flete, iva :double;
begin
if CostoDBEdit.Text = '' then CostoDBEdit.Text:='0';
if FleteDBEdit.Text = '' then FleteDBEdit.Text:='0';
if IVADBEdit.Text = '' then IVADBEdit.Text:='0';
if GanaciaDBEdit.Text = '' then GanaciaDBEdit.Text:='0';
costo:=StrToFloat(CostoDBEdit.Text);
flete:=costo*(StrToFloat(FleteDBEdit.Text)/100);
iva:=costo*(StrToFloat(IVADBEdit.Text)/100);
Precio1DBEdit.Text:=FloatToStr((costo*Precio1)+flete+iva);
Precio2DBEdit.Text:=FloatToStr((costo*Precio2)+flete+iva);
Precio3DBEdit.Text:=FloatToStr((costo*Precio3)+flete+iva);
Precio4DBEdit.Text:=FloatToStr((costo*Precio4)+flete+iva);
Precio5DBEdit.Text:=FloatToStr((costo*Precio5)+flete+iva);
Precio6DBEdit.Text:=FloatToStr((costo*Precio6)+flete+iva);
if GanaciaDBEdit.Text='0' then PrecioCtaCteDBEdit.Text:=FloatToStr((costo*PrecioCtaCte)+flete+iva) else PrecioCtaCteDBEdit.Text:=FloatToStr((costo*(StrToFloat(GanaciaDBEdit.Text)/100+1)+flete+iva));
Label21.Caption:= '= '+FloatToStr(iva);
DBText1.Caption:= FloatToStr(costo+flete);
DBText2.Caption:= FloatToStr(costo+flete+iva);
BitBtn1.SetFocus;
end;
Procedure TFProductos.nuevo;
begin
Tabla.FieldByName('CtaNombre').AsString:='13';
Tabla.FieldByName('CtaTipo').AsString:='13';
Tabla.FieldByName('CtaAnticipo').AsString:='13';
Tabla.FieldByName('CtaIIBB').AsString:='66';
Tabla.FieldByName('CODIGOBARRA').AsString:= '0';
Tabla.FieldByName('Color').AsString:= '0';
Tabla.FieldByName('Categoria').AsString:= '0';
Tabla.FieldByName('SubCategoria').AsString:= '0';
Tabla.FieldByName('Rubro').AsString := '0';
Tabla.FieldByName('Marca').AsString := '0';
Tabla.FieldByName('Proveedor').Value := 1;
DBLookupComboBox4.KeyValue := 0;
DbEdit9.Field.AsString := 'c/u';
DbEdit17.Field.AsDateTime := Date;
Tabla.FieldByName('Costo').AsInteger:= 0;
CostoDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('ImpOtros').AsInteger:= 0;
FleteDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('Tasa').AsInteger:= 0;
IVADBEdit.Field.AsFloat := 0;
Tabla.FieldByName('Precio').AsInteger:= 0;
PrecioCtaCteDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('IIBB').AsInteger:= 0;
end;
procedure TFProductos.RubroBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Rubro.exe')),SW_SHOWNORMAL);
{ RubroForm:=RubroForm.Create(self);
try
RubroForm.ShowModal;
finally
If RubroForm.desc <> '' then
RubroDBLookupComboBox.KeyValue:= RubroForm.desc;
Tabla.FieldByName('Rubro').AsString:=RubroForm.desc;
RubroForm.Free;
end;
RubroT.Close;
RubroT.Open;
MarcaDBLookupComboBox.SetFocus;
}
end;
procedure TFProductos.RubroDBLookupComboBoxEnter(Sender: TObject);
begin
RubroT.Close;
RubroT.Open;
RubroT.Last;
end;
procedure TFProductos.CodigoBarraBitBtnClick(Sender: TObject);
var
i : integer;
begin
if Tabla.State = dsInsert then
begin
QTemp.Close;
QTemp.SQL.Text:='SELECT max(CODIGO) FROM "Articulo"';
QTemp.Open;
i:= 100000 + (QTemp.Fields.Fields[0].AsInteger +1); //agrego el codigo
end
else
begin
i:= 100000 + strtoint(CodigoDBEdit.Text);
IF (Tabla.State <> dsEdit) then Tabla.Edit;
end;
//codigo de barras
CodigoBarraEdit.Text := '1'+inttostr(i)+'2'; //lo incluyo en el codigo de barra
Codifica(CodigoBarraEdit.Text);
CodigoBarraEdit.SelStart:=0;
CodigoBarraEdit.SelLength:=Length(CodigoBarraEdit.Text);
Tabla.FieldByName('CodigoBarra').AsString := CodigoBarraEdit.Text;
end;
procedure TFProductos.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
IF Key = VK_F2 then RubroBitBtn.Click;
IF Key = VK_F3 then MarcaBitBtn.Click;
IF Key = VK_F4 then BitBtn13.Click;
IF Key = VK_F5 then BitBtn4.Click;
IF Key = VK_F6 then CodigoBarraBitBtn.Click;
end;
procedure TFProductos.Precio6DBEditExit(Sender: TObject);
begin
IVADBEdit.SetFocus;
end;
procedure TFProductos.CategoriaBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Categoria.exe')),SW_SHOWNORMAL);
{
FCategorias:=TFCategorias.Create(self);
try
FCategorias.ShowModal;
finally
If FCategorias.desc <> '' then
begin
CategoriaDBLookupComboBox.KeyValue:= FCategorias.desc;
Tabla.FieldByName('Categoria').AsString:=FCategorias.desc;
end;
FCategorias.Free;
end;
CategoriaT.Close;
CategoriaT.Open;
RubroDBLookupComboBox.SetFocus;
}
end;
procedure TFProductos.CategoriaDBLookupComboBoxEnter(Sender: TObject);
begin
CategoriaT.Close;
CategoriaT.Open;
CategoriaT.Last;
end;
procedure TFProductos.MarcaBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Marca.exe')),SW_SHOWNORMAL);
{ MarcaForm:=TMarcaForm.Create(self);
try
MarcaForm.ShowModal;
finally
If MarcaForm.desc <> '' then
begin
MarcaDBLookupComboBox.KeyValue:= MarcaForm.desc;
If (Tabla.State <> dsEdit) and (Tabla.State <> dsInsert) then Tabla.Edit;
Tabla.FieldByName('Marca').AsString:=MarcaForm.desc;
end;
MarcaForm.Free;
end;
MarcaT.Close;
MarcaT.Open;
DBEdit9.SetFocus;
}
end;
procedure TFProductos.MarcaDBLookupComboBoxEnter(Sender: TObject);
begin
MarcaT.Close;
MarcaT.Open;
MarcaT.Last;
end;
procedure TFProductos.MarcaDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
MarcaT.Close;
MarcaT.Open;
MarcaT.Last;
end;
procedure TFProductos.DBEdit14Exit(Sender: TObject);
begin
BitBtn1.SetFocus;
end;
procedure TFProductos.DBLookupComboBox4Enter(Sender: TObject);
begin
ProveedorT.Close;
ProveedorT.Open;
ProveedorT.Last;
end;
procedure TFProductos.BitBtn13Click(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Proveedor.exe')),SW_SHOWNORMAL);
end;
procedure TFProductos.TablaAfterCancel(DataSet: TDataSet);
begin
Tabla.Transaction.RollbackRetaining;
end;
procedure TFProductos.TablaAfterDelete(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFProductos.TablaAfterInsert(DataSet: TDataSet);
begin
If Cancelar then Tabla.Cancel else nuevo;
end;
procedure TFProductos.TablaAfterPost(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
end.

Просмотреть файл

@ -0,0 +1,572 @@
unit UFProductos;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DataModule, Grids, DBGrids, DB, ExtCtrls, StdCtrls, Mask,
DBCtrls, Buttons, ComCtrls, IBQuery, IBCustomDataSet, IBTable, OleCtrls,
SHDocVw;
const
EAN_izqA : array[0..9] of PChar=('0001101','0011001','0010011','0111101','0100011','0110001','0101111','0111011','0110111','0001011');
EAN_izqB : array[0..9] of PChar=('0100111','0110011','0011011','0100001','0011101','0111001','0000101','0010001','0001001','0010111');
EAN_dcha : array[0..9] of PChar=('1110010','1100110','1101100','1000010','1011100','1001110','1010000','1000100','1001000','1110100');
CodificaIzq : array[0..9] of PChar=('AAAAA','ABABB','ABBAB','ABBBA','BAABB','BBAAB','BBBAA','BABAB','BABBA','BBABA');
type
TFProductos = class(TForm)
DataSource: TDataSource;
DSTCat: TDataSource;
DSTSubCat: TDataSource;
DSMateriales: TDataSource;
DSRubro: TDataSource;
DSQProve: TDataSource;
MarcaDataSource: TDataSource;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet3: TTabSheet;
Panel3: TPanel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label2: TLabel;
Label14: TLabel;
Label23: TLabel;
DescripcionDBEdit: TDBEdit;
DBEdit1: TDBEdit;
DBLookupComboBox4: TDBLookupComboBox;
BitBtn13: TBitBtn;
Label8: TLabel;
Label19: TLabel;
Label30: TLabel;
Label10: TLabel;
Label5: TLabel;
DBText1: TDBText;
Label16: TLabel;
Label28: TLabel;
Label21: TLabel;
IVADBEdit: TDBEdit;
FleteDBEdit: TDBEdit;
CostoDBEdit: TDBEdit;
Label4: TLabel;
PrecioCtaCteDBEdit: TDBEdit;
DBMemo1: TDBMemo;
TabSheet2: TTabSheet;
Label6: TLabel;
Label15: TLabel;
Label17: TLabel;
Label18: TLabel;
Label20: TLabel;
DBEdit6: TDBEdit;
DBEdit5: TDBEdit;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
DBEdit17: TDBEdit;
DBEdit9: TDBEdit;
Label9: TLabel;
DBEdit21: TDBEdit;
Label32: TLabel;
Label33: TLabel;
Label34: TLabel;
GanaciaDBEdit: TDBEdit;
TabSheet4: TTabSheet;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label7: TLabel;
Label31: TLabel;
Label3: TLabel;
Label22: TLabel;
Precio1DBEdit: TDBEdit;
Precio2DBEdit: TDBEdit;
Precio3DBEdit: TDBEdit;
Precio6DBEdit: TDBEdit;
Precio4DBEdit: TDBEdit;
Precio5DBEdit: TDBEdit;
DBText2: TDBText;
TabSheet5: TTabSheet;
CuentaDataSource: TDataSource;
Label50: TLabel;
CuentaDBLookupComboBox: TDBLookupComboBox;
DBLookupComboBox1: TDBLookupComboBox;
DBLookupComboBox2: TDBLookupComboBox;
DBLookupComboBox7: TDBLookupComboBox;
Label54: TLabel;
Label53: TLabel;
Label51: TLabel;
Label52: TLabel;
Label25: TLabel;
Label26: TLabel;
Label27: TLabel;
RubroDBLookupComboBox: TDBLookupComboBox;
RubroBitBtn: TBitBtn;
MarcaDBLookupComboBox: TDBLookupComboBox;
MarcaBitBtn: TBitBtn;
CategoriaDBLookupComboBox: TDBLookupComboBox;
CategoriaBitBtn: TBitBtn;
Label29: TLabel;
Tabla: TIBTable;
CategoriaT: TIBTable;
SubCategoriaT: TIBTable;
RubroT: TIBTable;
MaterialT: TIBTable;
QTemp: TIBQuery;
Usuario: TIBQuery;
DSUsuarios: TDataSource;
CuentaQuery: TIBQuery;
MarcaT: TIBTable;
ProveedorT: TIBTable;
ConfigQuery: TIBQuery;
Label1: TLabel;
CodigoDBEdit: TDBEdit;
BitBtn4: TBitBtn;
DBNavigator1: TDBNavigator;
Label24: TLabel;
CodigoBarraEdit: TDBEdit;
CodigoBarraBitBtn: TBitBtn;
PaintBox1: TImage;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure RubroBitBtnClick(Sender: TObject);
procedure CodigoBarraBitBtnClick(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Precio6DBEditExit(Sender: TObject);
procedure CategoriaBitBtnClick(Sender: TObject);
procedure MarcaBitBtnClick(Sender: TObject);
procedure DBEdit14Exit(Sender: TObject);
procedure BitBtn13Click(Sender: TObject);
procedure TablaAfterInsert(DataSet: TDataSet);
procedure GanaciaDBEditExit(Sender: TObject);
procedure TablaAfterPost(DataSet: TDataSet);
procedure TablaAfterCancel(DataSet: TDataSet);
procedure TablaAfterDelete(DataSet: TDataSet);
procedure MarcaDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure DBLookupComboBox4Enter(Sender: TObject);
procedure CategoriaDBLookupComboBoxEnter(Sender: TObject);
procedure RubroDBLookupComboBoxEnter(Sender: TObject);
procedure MarcaDBLookupComboBoxEnter(Sender: TObject);
private
{ Private declarations }
public
desc:string;
Precio1, Precio2, Precio3, Precio4, Precio5, Precio6, PrecioCtaCte: Double;
{ Public declarations }
// procedimiento que codifica el número en un nº binario
procedure Codifica(num : string);
// procedimiento para dibujar el cód. de barras a partir del nº binario
procedure Dibujar(matrix : string);
// procedimiento para validar-corregir los códigos
procedure EANCorrecto(var num : string);
Procedure nuevo;
end;
var
FProductos: TFProductos;
implementation
uses UFBuscaArticulos,
UFCategorias, UFSubCategorias, Color, Marca, RubroF;
{$R *.dfm}
procedure TFProductos.EANCorrecto(var num : string);
var
i,N : byte;
sum : integer;
flag : byte;
begin
sum:=0;
N:=Length(num)-1; //13-1=12
for i:=1 to N do //desde 1 hasta 12
begin
if (i mod 2)=0 then // x mod y = x – (x div y) * y = 1-(0.5)*2
begin
if N=12 then
sum:=sum+StrToInt(num[i])*3
else
sum:=sum+StrToInt(num[i]);
end
else
begin
if N=12 then
sum:=sum+StrToInt(num[i])
else
sum:=sum+StrToInt(num[i])*3;
end;
end;
if sum>99 then
Flag:=10-(sum mod 100)
else
Flag:=10-(sum mod 10);
if Flag=10 then Flag:=0;
if not(StrToInt(num[N+1])=flag) then
num:=copy(num,1,length(num)-1)+IntToStr(Flag);
end;
procedure TFProductos.Codifica(num : string);
var
matrix : string;
i : integer;
begin
num:=CodigoBarraEdit.Text; //numero
matrix:='';
case Length(num) of //mientras sean 13 caracteres
13: begin
EANCorrecto(num); //
CodigoBarraEdit.Text:=num;
matrix:=matrix+'x0x'; // barra inicio
matrix:=matrix+EAN_izqA[StrToInt(num[2])];
for i:=3 to 7 do
if CodificaIzq[StrToInt(num[1])][i-3]='A' then
matrix:=matrix+EAN_izqA[StrToInt(num[i])]
else
matrix:=matrix+EAN_izqB[StrToInt(num[i])];
matrix:=matrix+'0x0x0'; // barra central
matrix:=matrix+EAN_dcha[StrToInt(num[8])];
matrix:=matrix+EAN_dcha[StrToInt(num[9])];
matrix:=matrix+EAN_dcha[StrToInt(num[10])];
matrix:=matrix+EAN_dcha[StrToInt(num[11])];
matrix:=matrix+EAN_dcha[StrToInt(num[12])];
matrix:=matrix+EAN_dcha[StrToInt(num[13])];
matrix:=matrix+'x0x'; // barra final
Dibujar(Matrix);
end;
8: begin
EANCorrecto(num);
CodigoBarraEdit.Text:=num;
matrix:=matrix+'x0x';
matrix:=matrix+EAN_izqA[StrToInt(num[1])];
matrix:=matrix+EAN_izqA[StrToInt(num[2])];
matrix:=matrix+EAN_izqA[StrToInt(num[3])];
matrix:=matrix+EAN_izqA[StrToInt(num[4])];
matrix:=matrix+'0x0x0';
matrix:=matrix+EAN_dcha[StrToInt(num[5])];
matrix:=matrix+EAN_dcha[StrToInt(num[6])];
matrix:=matrix+EAN_dcha[StrToInt(num[7])];
matrix:=matrix+EAN_dcha[StrToInt(num[8])];
matrix:=matrix+'x0x';
Dibujar(Matrix);
end
else
ShowMessage('LONGITUD DE CODIGO NO VALIDA');
end;
end;
procedure TFProductos.Dibujar(matrix : string);
var
i : integer;
begin
with PaintBox1 do begin
Canvas.Brush.Color:= clWhite;
Canvas.FillRect(Rect(0,0,PaintBox1.Width,PaintBox1.Height));
Canvas.Pen.Color:=clBlack;
END;
for i:=1 to Length(Matrix) do
if matrix[i]='1' then
PaintBox1.Canvas.PolyLine([Point(10+i,10),Point(10+i,50)])
else
if matrix[i]='x' then
PaintBox1.Canvas.PolyLine([Point(10+i,10),Point(10+i,55)]);
if Length(CodigoBarraEdit.Text)=13 then
begin
PaintBox1.Canvas.TextOut(3,50,CodigoBarraEdit.Text[1]);
PaintBox1.Canvas.TextOut(17,50,copy(CodigoBarraEdit.Text,2,6));
PaintBox1.Canvas.TextOut(63,50,copy(CodigoBarraEdit.Text,8,6));
end
else
if Length(CodigoBarraEdit.Text)=8 then
begin
PaintBox1.Canvas.TextOut(16,50,copy(CodigoBarraEdit.Text,1,4));
PaintBox1.Canvas.TextOut(48,50,copy(CodigoBarraEdit.Text,5,4));
end;
end;
procedure TFProductos.BitBtn1Click(Sender: TObject);
begin
desc:=CodigoDBEdit.Text;
If (Tabla.State = dsEdit) or (Tabla.State = dsInsert) And (DescripcionDBEdit.Text <> '') then Tabla.Post
else if (DescripcionDBEdit.Text <> '') then ShowMessage('COMPLETE TODOS LOS CAMPOS');
Close;
end;
procedure TFProductos.BitBtn2Click(Sender: TObject);
begin
Tabla.Cancel;
Close;
end;
procedure TFProductos.FormCreate(Sender: TObject);
begin
DM:=TDM.Create(Self);
Tabla.Active := True;
SubCategoriaT.Active := True;
ProveedorT.Active := True;
RubroT.Active := True;
MarcaT.Active := True;
CategoriaT.Active := True;
ConfigQuery.Open;
Precio1:=ConfigQuery.FieldByName('PP1').AsFloat/100+1;
Precio2:=ConfigQuery.FieldByName('PP2').AsFloat/100+1;
Precio3:=ConfigQuery.FieldByName('PP3').AsFloat/100+1;
Precio4:=ConfigQuery.FieldByName('PP4').AsFloat/100+1;
Precio5:=ConfigQuery.FieldByName('PP5').AsFloat/100+1;
Precio6:=ConfigQuery.FieldByName('PP6').AsFloat/100+1;
PrecioCtaCte:=ConfigQuery.FieldByName('PP').AsFloat/100+1;
QTemp.Close;
CuentaQuery.Open;
Tabla.Insert;
end;
procedure TFProductos.BitBtn4Click(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
Tabla.Cancel;
FBuscaArticulo:=TFBuscaArticulo.Create(self);
try
FBuscaArticulo.ShowModal;
finally
If FBuscaArticulo.Tabla.Active =True then
Tabla.Locate('CODIGO',FBuscaArticulo.Tabla.FieldByName('CODIGO').AsInteger,[]);
FBuscaArticulo.Free;
end;
Tabla.Edit;
end;
procedure TFProductos.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then { if it's an enter key }
begin
Key := #0; { eat enter key }
Perform(WM_NEXTDLGCTL, 0, 0); { move to next control }
end;
end;
procedure TFProductos.GanaciaDBEditExit(Sender: TObject);
var costo, flete, iva :double;
begin
if CostoDBEdit.Text = '' then CostoDBEdit.Text:='0';
if FleteDBEdit.Text = '' then FleteDBEdit.Text:='0';
if IVADBEdit.Text = '' then IVADBEdit.Text:='0';
if GanaciaDBEdit.Text = '' then GanaciaDBEdit.Text:='0';
costo:=StrToFloat(CostoDBEdit.Text);
flete:=costo*(StrToFloat(FleteDBEdit.Text)/100);
iva:=costo*(StrToFloat(IVADBEdit.Text)/100);
Precio1DBEdit.Text:=FloatToStr((costo*Precio1)+flete+iva);
Precio2DBEdit.Text:=FloatToStr((costo*Precio2)+flete+iva);
Precio3DBEdit.Text:=FloatToStr((costo*Precio3)+flete+iva);
Precio4DBEdit.Text:=FloatToStr((costo*Precio4)+flete+iva);
Precio5DBEdit.Text:=FloatToStr((costo*Precio5)+flete+iva);
Precio6DBEdit.Text:=FloatToStr((costo*Precio6)+flete+iva);
if GanaciaDBEdit.Text='0' then PrecioCtaCteDBEdit.Text:=FloatToStr((costo*PrecioCtaCte)+flete+iva) else PrecioCtaCteDBEdit.Text:=FloatToStr((costo*(StrToFloat(GanaciaDBEdit.Text)/100+1)+flete+iva));
Label21.Caption:= '= '+FloatToStr(iva);
DBText1.Caption:= FloatToStr(costo+flete);
DBText2.Caption:= FloatToStr(costo+flete+iva);
BitBtn1.SetFocus;
end;
Procedure TFProductos.nuevo;
begin
Tabla.FieldByName('CtaNombre').AsString:='13';
Tabla.FieldByName('CtaTipo').AsString:='13';
Tabla.FieldByName('CtaAnticipo').AsString:='13';
Tabla.FieldByName('CtaIIBB').AsString:='66';
Tabla.FieldByName('CODIGOBARRA').AsString:= '0';
Tabla.FieldByName('Color').AsString:= '0';
Tabla.FieldByName('Categoria').AsString:= '0';
Tabla.FieldByName('SubCategoria').AsString:= '0';
Tabla.FieldByName('Rubro').AsString := '0';
Tabla.FieldByName('Marca').AsString := '0';
Tabla.FieldByName('Proveedor').Value := 1;
DBLookupComboBox4.KeyValue := 0;
DbEdit9.Field.AsString := 'c/u';
DbEdit17.Field.AsDateTime := Date;
Tabla.FieldByName('Costo').AsInteger:= 0;
CostoDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('ImpOtros').AsInteger:= 0;
FleteDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('Tasa').AsInteger:= 0;
IVADBEdit.Field.AsFloat := 0;
Tabla.FieldByName('Precio').AsInteger:= 0;
PrecioCtaCteDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('IIBB').AsInteger:= 0;
end;
procedure TFProductos.RubroBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Rubro.exe')),SW_SHOWNORMAL);
{ RubroForm:=RubroForm.Create(self);
try
RubroForm.ShowModal;
finally
If RubroForm.desc <> '' then
RubroDBLookupComboBox.KeyValue:= RubroForm.desc;
Tabla.FieldByName('Rubro').AsString:=RubroForm.desc;
RubroForm.Free;
end;
RubroT.Close;
RubroT.Open;
MarcaDBLookupComboBox.SetFocus;
}
end;
procedure TFProductos.RubroDBLookupComboBoxEnter(Sender: TObject);
begin
RubroT.Close;
RubroT.Open;
RubroT.Last;
end;
procedure TFProductos.CodigoBarraBitBtnClick(Sender: TObject);
var
i : integer;
begin
if Tabla.State = dsInsert then
begin
QTemp.Close;
QTemp.SQL.Text:='SELECT max(CODIGO) FROM "Articulo"';
QTemp.Open;
i:= 100000 + (QTemp.Fields.Fields[0].AsInteger +1); //agrego el codigo
end
else
begin
i:= 100000 + strtoint(CodigoDBEdit.Text);
IF (Tabla.State <> dsEdit) then Tabla.Edit;
end;
//codigo de barras
CodigoBarraEdit.Text := '1'+inttostr(i)+'2'; //lo incluyo en el codigo de barra
Codifica(CodigoBarraEdit.Text);
CodigoBarraEdit.SelStart:=0;
CodigoBarraEdit.SelLength:=Length(CodigoBarraEdit.Text);
Tabla.FieldByName('CodigoBarra').AsString := CodigoBarraEdit.Text;
end;
procedure TFProductos.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
IF Key = VK_F2 then RubroBitBtn.Click;
IF Key = VK_F3 then MarcaBitBtn.Click;
IF Key = VK_F4 then BitBtn13.Click;
IF Key = VK_F5 then BitBtn4.Click;
IF Key = VK_F6 then CodigoBarraBitBtn.Click;
end;
procedure TFProductos.Precio6DBEditExit(Sender: TObject);
begin
IVADBEdit.SetFocus;
end;
procedure TFProductos.CategoriaBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Categoria.exe')),SW_SHOWNORMAL);
{
FCategorias:=TFCategorias.Create(self);
try
FCategorias.ShowModal;
finally
If FCategorias.desc <> '' then
begin
CategoriaDBLookupComboBox.KeyValue:= FCategorias.desc;
Tabla.FieldByName('Categoria').AsString:=FCategorias.desc;
end;
FCategorias.Free;
end;
CategoriaT.Close;
CategoriaT.Open;
RubroDBLookupComboBox.SetFocus;
}
end;
procedure TFProductos.CategoriaDBLookupComboBoxEnter(Sender: TObject);
begin
CategoriaT.Close;
CategoriaT.Open;
CategoriaT.Last;
end;
procedure TFProductos.MarcaBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Marca.exe')),SW_SHOWNORMAL);
{ MarcaForm:=TMarcaForm.Create(self);
try
MarcaForm.ShowModal;
finally
If MarcaForm.desc <> '' then
begin
MarcaDBLookupComboBox.KeyValue:= MarcaForm.desc;
If (Tabla.State <> dsEdit) and (Tabla.State <> dsInsert) then Tabla.Edit;
Tabla.FieldByName('Marca').AsString:=MarcaForm.desc;
end;
MarcaForm.Free;
end;
MarcaT.Close;
MarcaT.Open;
DBEdit9.SetFocus;
}
end;
procedure TFProductos.MarcaDBLookupComboBoxEnter(Sender: TObject);
begin
MarcaT.Close;
MarcaT.Open;
MarcaT.Last;
end;
procedure TFProductos.MarcaDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
MarcaT.Close;
MarcaT.Open;
MarcaT.Last;
end;
procedure TFProductos.DBEdit14Exit(Sender: TObject);
begin
BitBtn1.SetFocus;
end;
procedure TFProductos.DBLookupComboBox4Enter(Sender: TObject);
begin
ProveedorT.Close;
ProveedorT.Open;
ProveedorT.Last;
end;
procedure TFProductos.BitBtn13Click(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Proveedor.exe')),SW_SHOWNORMAL);
end;
procedure TFProductos.TablaAfterCancel(DataSet: TDataSet);
begin
Tabla.Transaction.RollbackRetaining;
end;
procedure TFProductos.TablaAfterDelete(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFProductos.TablaAfterInsert(DataSet: TDataSet);
begin
If Cancelar then Tabla.Cancel else nuevo;
end;
procedure TFProductos.TablaAfterPost(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
end.

Просмотреть файл

@ -0,0 +1,572 @@
unit UFProductos;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DataModule, Grids, DBGrids, DB, ExtCtrls, StdCtrls, Mask,
DBCtrls, Buttons, ComCtrls, IBQuery, IBCustomDataSet, IBTable, OleCtrls,
SHDocVw;
const
EAN_izqA : array[0..9] of PChar=('0001101','0011001','0010011','0111101','0100011','0110001','0101111','0111011','0110111','0001011');
EAN_izqB : array[0..9] of PChar=('0100111','0110011','0011011','0100001','0011101','0111001','0000101','0010001','0001001','0010111');
EAN_dcha : array[0..9] of PChar=('1110010','1100110','1101100','1000010','1011100','1001110','1010000','1000100','1001000','1110100');
CodificaIzq : array[0..9] of PChar=('AAAAA','ABABB','ABBAB','ABBBA','BAABB','BBAAB','BBBAA','BABAB','BABBA','BBABA');
type
TFProductos = class(TForm)
DataSource: TDataSource;
DSTCat: TDataSource;
DSTSubCat: TDataSource;
DSMateriales: TDataSource;
DSRubro: TDataSource;
DSQProve: TDataSource;
MarcaDataSource: TDataSource;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet3: TTabSheet;
Panel3: TPanel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label2: TLabel;
Label14: TLabel;
Label23: TLabel;
DescripcionDBEdit: TDBEdit;
DBEdit1: TDBEdit;
DBLookupComboBox4: TDBLookupComboBox;
BitBtn13: TBitBtn;
Label8: TLabel;
Label19: TLabel;
Label30: TLabel;
Label10: TLabel;
Label5: TLabel;
DBText1: TDBText;
Label16: TLabel;
Label28: TLabel;
Label21: TLabel;
IVADBEdit: TDBEdit;
FleteDBEdit: TDBEdit;
CostoDBEdit: TDBEdit;
Label4: TLabel;
PrecioCtaCteDBEdit: TDBEdit;
DBMemo1: TDBMemo;
TabSheet2: TTabSheet;
Label6: TLabel;
Label15: TLabel;
Label17: TLabel;
Label18: TLabel;
Label20: TLabel;
DBEdit6: TDBEdit;
DBEdit5: TDBEdit;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
DBEdit17: TDBEdit;
DBEdit9: TDBEdit;
Label9: TLabel;
DBEdit21: TDBEdit;
Label32: TLabel;
Label33: TLabel;
Label34: TLabel;
GanaciaDBEdit: TDBEdit;
TabSheet4: TTabSheet;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label7: TLabel;
Label31: TLabel;
Label3: TLabel;
Label22: TLabel;
Precio1DBEdit: TDBEdit;
Precio2DBEdit: TDBEdit;
Precio3DBEdit: TDBEdit;
Precio6DBEdit: TDBEdit;
Precio4DBEdit: TDBEdit;
Precio5DBEdit: TDBEdit;
DBText2: TDBText;
TabSheet5: TTabSheet;
CuentaDataSource: TDataSource;
Label50: TLabel;
CuentaDBLookupComboBox: TDBLookupComboBox;
DBLookupComboBox1: TDBLookupComboBox;
DBLookupComboBox2: TDBLookupComboBox;
DBLookupComboBox7: TDBLookupComboBox;
Label54: TLabel;
Label53: TLabel;
Label51: TLabel;
Label52: TLabel;
Label25: TLabel;
Label26: TLabel;
Label27: TLabel;
RubroDBLookupComboBox: TDBLookupComboBox;
RubroBitBtn: TBitBtn;
MarcaDBLookupComboBox: TDBLookupComboBox;
MarcaBitBtn: TBitBtn;
CategoriaDBLookupComboBox: TDBLookupComboBox;
CategoriaBitBtn: TBitBtn;
Label29: TLabel;
Tabla: TIBTable;
CategoriaT: TIBTable;
SubCategoriaT: TIBTable;
RubroT: TIBTable;
MaterialT: TIBTable;
QTemp: TIBQuery;
Usuario: TIBQuery;
DSUsuarios: TDataSource;
CuentaQuery: TIBQuery;
MarcaT: TIBTable;
ProveedorT: TIBTable;
ConfigQuery: TIBQuery;
Label1: TLabel;
CodigoDBEdit: TDBEdit;
BitBtn4: TBitBtn;
DBNavigator1: TDBNavigator;
Label24: TLabel;
CodigoBarraEdit: TDBEdit;
CodigoBarraBitBtn: TBitBtn;
PaintBox1: TImage;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure RubroBitBtnClick(Sender: TObject);
procedure CodigoBarraBitBtnClick(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Precio6DBEditExit(Sender: TObject);
procedure CategoriaBitBtnClick(Sender: TObject);
procedure MarcaBitBtnClick(Sender: TObject);
procedure DBEdit14Exit(Sender: TObject);
procedure BitBtn13Click(Sender: TObject);
procedure TablaAfterInsert(DataSet: TDataSet);
procedure GanaciaDBEditExit(Sender: TObject);
procedure TablaAfterPost(DataSet: TDataSet);
procedure TablaAfterCancel(DataSet: TDataSet);
procedure TablaAfterDelete(DataSet: TDataSet);
procedure MarcaDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure DBLookupComboBox4Enter(Sender: TObject);
procedure CategoriaDBLookupComboBoxEnter(Sender: TObject);
procedure RubroDBLookupComboBoxEnter(Sender: TObject);
procedure MarcaDBLookupComboBoxEnter(Sender: TObject);
private
{ Private declarations }
public
desc:string;
Precio1, Precio2, Precio3, Precio4, Precio5, Precio6, PrecioCtaCte: Double;
{ Public declarations }
// procedimiento que codifica el número en un nº binario
procedure Codifica(num : string);
// procedimiento para dibujar el cód. de barras a partir del nº binario
procedure Dibujar(matrix : string);
// procedimiento para validar-corregir los códigos
procedure EANCorrecto(var num : string);
Procedure nuevo;
end;
var
FProductos: TFProductos;
implementation
uses UFBuscaArticulos,
UFCategorias, UFSubCategorias, Color;
{$R *.dfm}
procedure TFProductos.EANCorrecto(var num : string);
var
i,N : byte;
sum : integer;
flag : byte;
begin
sum:=0;
N:=Length(num)-1; //13-1=12
for i:=1 to N do //desde 1 hasta 12
begin
if (i mod 2)=0 then // x mod y = x – (x div y) * y = 1-(0.5)*2
begin
if N=12 then
sum:=sum+StrToInt(num[i])*3
else
sum:=sum+StrToInt(num[i]);
end
else
begin
if N=12 then
sum:=sum+StrToInt(num[i])
else
sum:=sum+StrToInt(num[i])*3;
end;
end;
if sum>99 then
Flag:=10-(sum mod 100)
else
Flag:=10-(sum mod 10);
if Flag=10 then Flag:=0;
if not(StrToInt(num[N+1])=flag) then
num:=copy(num,1,length(num)-1)+IntToStr(Flag);
end;
procedure TFProductos.Codifica(num : string);
var
matrix : string;
i : integer;
begin
num:=CodigoBarraEdit.Text; //numero
matrix:='';
case Length(num) of //mientras sean 13 caracteres
13: begin
EANCorrecto(num); //
CodigoBarraEdit.Text:=num;
matrix:=matrix+'x0x'; // barra inicio
matrix:=matrix+EAN_izqA[StrToInt(num[2])];
for i:=3 to 7 do
if CodificaIzq[StrToInt(num[1])][i-3]='A' then
matrix:=matrix+EAN_izqA[StrToInt(num[i])]
else
matrix:=matrix+EAN_izqB[StrToInt(num[i])];
matrix:=matrix+'0x0x0'; // barra central
matrix:=matrix+EAN_dcha[StrToInt(num[8])];
matrix:=matrix+EAN_dcha[StrToInt(num[9])];
matrix:=matrix+EAN_dcha[StrToInt(num[10])];
matrix:=matrix+EAN_dcha[StrToInt(num[11])];
matrix:=matrix+EAN_dcha[StrToInt(num[12])];
matrix:=matrix+EAN_dcha[StrToInt(num[13])];
matrix:=matrix+'x0x'; // barra final
Dibujar(Matrix);
end;
8: begin
EANCorrecto(num);
CodigoBarraEdit.Text:=num;
matrix:=matrix+'x0x';
matrix:=matrix+EAN_izqA[StrToInt(num[1])];
matrix:=matrix+EAN_izqA[StrToInt(num[2])];
matrix:=matrix+EAN_izqA[StrToInt(num[3])];
matrix:=matrix+EAN_izqA[StrToInt(num[4])];
matrix:=matrix+'0x0x0';
matrix:=matrix+EAN_dcha[StrToInt(num[5])];
matrix:=matrix+EAN_dcha[StrToInt(num[6])];
matrix:=matrix+EAN_dcha[StrToInt(num[7])];
matrix:=matrix+EAN_dcha[StrToInt(num[8])];
matrix:=matrix+'x0x';
Dibujar(Matrix);
end
else
ShowMessage('LONGITUD DE CODIGO NO VALIDA');
end;
end;
procedure TFProductos.Dibujar(matrix : string);
var
i : integer;
begin
with PaintBox1 do begin
Canvas.Brush.Color:= clWhite;
Canvas.FillRect(Rect(0,0,PaintBox1.Width,PaintBox1.Height));
Canvas.Pen.Color:=clBlack;
END;
for i:=1 to Length(Matrix) do
if matrix[i]='1' then
PaintBox1.Canvas.PolyLine([Point(10+i,10),Point(10+i,50)])
else
if matrix[i]='x' then
PaintBox1.Canvas.PolyLine([Point(10+i,10),Point(10+i,55)]);
if Length(CodigoBarraEdit.Text)=13 then
begin
PaintBox1.Canvas.TextOut(3,50,CodigoBarraEdit.Text[1]);
PaintBox1.Canvas.TextOut(17,50,copy(CodigoBarraEdit.Text,2,6));
PaintBox1.Canvas.TextOut(63,50,copy(CodigoBarraEdit.Text,8,6));
end
else
if Length(CodigoBarraEdit.Text)=8 then
begin
PaintBox1.Canvas.TextOut(16,50,copy(CodigoBarraEdit.Text,1,4));
PaintBox1.Canvas.TextOut(48,50,copy(CodigoBarraEdit.Text,5,4));
end;
end;
procedure TFProductos.BitBtn1Click(Sender: TObject);
begin
desc:=CodigoDBEdit.Text;
If (Tabla.State = dsEdit) or (Tabla.State = dsInsert) And (DescripcionDBEdit.Text <> '') then Tabla.Post
else if (DescripcionDBEdit.Text <> '') then ShowMessage('COMPLETE TODOS LOS CAMPOS');
Close;
end;
procedure TFProductos.BitBtn2Click(Sender: TObject);
begin
Tabla.Cancel;
Close;
end;
procedure TFProductos.FormCreate(Sender: TObject);
begin
DM:=TDM.Create(Self);
Tabla.Active := True;
SubCategoriaT.Active := True;
ProveedorT.Active := True;
RubroT.Active := True;
MarcaT.Active := True;
CategoriaT.Active := True;
ConfigQuery.Open;
Precio1:=ConfigQuery.FieldByName('PP1').AsFloat/100+1;
Precio2:=ConfigQuery.FieldByName('PP2').AsFloat/100+1;
Precio3:=ConfigQuery.FieldByName('PP3').AsFloat/100+1;
Precio4:=ConfigQuery.FieldByName('PP4').AsFloat/100+1;
Precio5:=ConfigQuery.FieldByName('PP5').AsFloat/100+1;
Precio6:=ConfigQuery.FieldByName('PP6').AsFloat/100+1;
PrecioCtaCte:=ConfigQuery.FieldByName('PP').AsFloat/100+1;
QTemp.Close;
CuentaQuery.Open;
Tabla.Insert;
end;
procedure TFProductos.BitBtn4Click(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
Tabla.Cancel;
FBuscaArticulo:=TFBuscaArticulo.Create(self);
try
FBuscaArticulo.ShowModal;
finally
If FBuscaArticulo.Tabla.Active =True then
Tabla.Locate('CODIGO',FBuscaArticulo.Tabla.FieldByName('CODIGO').AsInteger,[]);
FBuscaArticulo.Free;
end;
Tabla.Edit;
end;
procedure TFProductos.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then { if it's an enter key }
begin
Key := #0; { eat enter key }
Perform(WM_NEXTDLGCTL, 0, 0); { move to next control }
end;
end;
procedure TFProductos.GanaciaDBEditExit(Sender: TObject);
var costo, flete, iva :double;
begin
if CostoDBEdit.Text = '' then CostoDBEdit.Text:='0';
if FleteDBEdit.Text = '' then FleteDBEdit.Text:='0';
if IVADBEdit.Text = '' then IVADBEdit.Text:='0';
if GanaciaDBEdit.Text = '' then GanaciaDBEdit.Text:='0';
costo:=StrToFloat(CostoDBEdit.Text);
flete:=costo*(StrToFloat(FleteDBEdit.Text)/100);
iva:=costo*(StrToFloat(IVADBEdit.Text)/100);
Precio1DBEdit.Text:=FloatToStr((costo*Precio1)+flete+iva);
Precio2DBEdit.Text:=FloatToStr((costo*Precio2)+flete+iva);
Precio3DBEdit.Text:=FloatToStr((costo*Precio3)+flete+iva);
Precio4DBEdit.Text:=FloatToStr((costo*Precio4)+flete+iva);
Precio5DBEdit.Text:=FloatToStr((costo*Precio5)+flete+iva);
Precio6DBEdit.Text:=FloatToStr((costo*Precio6)+flete+iva);
if GanaciaDBEdit.Text='0' then PrecioCtaCteDBEdit.Text:=FloatToStr((costo*PrecioCtaCte)+flete+iva) else PrecioCtaCteDBEdit.Text:=FloatToStr((costo*(StrToFloat(GanaciaDBEdit.Text)/100+1)+flete+iva));
Label21.Caption:= '= '+FloatToStr(iva);
DBText1.Caption:= FloatToStr(costo+flete);
DBText2.Caption:= FloatToStr(costo+flete+iva);
BitBtn1.SetFocus;
end;
Procedure TFProductos.nuevo;
begin
Tabla.FieldByName('CtaNombre').AsString:='13';
Tabla.FieldByName('CtaTipo').AsString:='13';
Tabla.FieldByName('CtaAnticipo').AsString:='13';
Tabla.FieldByName('CtaIIBB').AsString:='66';
Tabla.FieldByName('CODIGOBARRA').AsString:= '0';
Tabla.FieldByName('Color').AsString:= '0';
Tabla.FieldByName('Categoria').AsString:= '0';
Tabla.FieldByName('SubCategoria').AsString:= '0';
Tabla.FieldByName('Rubro').AsString := '0';
Tabla.FieldByName('Marca').AsString := '0';
Tabla.FieldByName('Proveedor').Value := 1;
DBLookupComboBox4.KeyValue := 0;
DbEdit9.Field.AsString := 'c/u';
DbEdit17.Field.AsDateTime := Date;
Tabla.FieldByName('Costo').AsInteger:= 0;
CostoDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('ImpOtros').AsInteger:= 0;
FleteDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('Tasa').AsInteger:= 0;
IVADBEdit.Field.AsFloat := 0;
Tabla.FieldByName('Precio').AsInteger:= 0;
PrecioCtaCteDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('IIBB').AsInteger:= 0;
end;
procedure TFProductos.RubroBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Rubro.exe')),SW_SHOWNORMAL);
{ RubroForm:=RubroForm.Create(self);
try
RubroForm.ShowModal;
finally
If RubroForm.desc <> '' then
RubroDBLookupComboBox.KeyValue:= RubroForm.desc;
Tabla.FieldByName('Rubro').AsString:=RubroForm.desc;
RubroForm.Free;
end;
RubroT.Close;
RubroT.Open;
MarcaDBLookupComboBox.SetFocus;
}
end;
procedure TFProductos.RubroDBLookupComboBoxEnter(Sender: TObject);
begin
RubroT.Close;
RubroT.Open;
RubroT.Last;
end;
procedure TFProductos.CodigoBarraBitBtnClick(Sender: TObject);
var
i : integer;
begin
if Tabla.State = dsInsert then
begin
QTemp.Close;
QTemp.SQL.Text:='SELECT max(CODIGO) FROM "Articulo"';
QTemp.Open;
i:= 100000 + (QTemp.Fields.Fields[0].AsInteger +1); //agrego el codigo
end
else
begin
i:= 100000 + strtoint(CodigoDBEdit.Text);
IF (Tabla.State <> dsEdit) then Tabla.Edit;
end;
//codigo de barras
CodigoBarraEdit.Text := '1'+inttostr(i)+'2'; //lo incluyo en el codigo de barra
Codifica(CodigoBarraEdit.Text);
CodigoBarraEdit.SelStart:=0;
CodigoBarraEdit.SelLength:=Length(CodigoBarraEdit.Text);
Tabla.FieldByName('CodigoBarra').AsString := CodigoBarraEdit.Text;
end;
procedure TFProductos.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
IF Key = VK_F2 then RubroBitBtn.Click;
IF Key = VK_F3 then MarcaBitBtn.Click;
IF Key = VK_F4 then BitBtn13.Click;
IF Key = VK_F5 then BitBtn4.Click;
IF Key = VK_F6 then CodigoBarraBitBtn.Click;
end;
procedure TFProductos.Precio6DBEditExit(Sender: TObject);
begin
IVADBEdit.SetFocus;
end;
procedure TFProductos.CategoriaBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Categoria.exe')),SW_SHOWNORMAL);
{
FCategorias:=TFCategorias.Create(self);
try
FCategorias.ShowModal;
finally
If FCategorias.desc <> '' then
begin
CategoriaDBLookupComboBox.KeyValue:= FCategorias.desc;
Tabla.FieldByName('Categoria').AsString:=FCategorias.desc;
end;
FCategorias.Free;
end;
CategoriaT.Close;
CategoriaT.Open;
RubroDBLookupComboBox.SetFocus;
}
end;
procedure TFProductos.CategoriaDBLookupComboBoxEnter(Sender: TObject);
begin
CategoriaT.Close;
CategoriaT.Open;
CategoriaT.Last;
end;
procedure TFProductos.MarcaBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Marca.exe')),SW_SHOWNORMAL);
{ MarcaForm:=TMarcaForm.Create(self);
try
MarcaForm.ShowModal;
finally
If MarcaForm.desc <> '' then
begin
MarcaDBLookupComboBox.KeyValue:= MarcaForm.desc;
If (Tabla.State <> dsEdit) and (Tabla.State <> dsInsert) then Tabla.Edit;
Tabla.FieldByName('Marca').AsString:=MarcaForm.desc;
end;
MarcaForm.Free;
end;
MarcaT.Close;
MarcaT.Open;
DBEdit9.SetFocus;
}
end;
procedure TFProductos.MarcaDBLookupComboBoxEnter(Sender: TObject);
begin
MarcaT.Close;
MarcaT.Open;
MarcaT.Last;
end;
procedure TFProductos.MarcaDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
MarcaT.Close;
MarcaT.Open;
MarcaT.Last;
end;
procedure TFProductos.DBEdit14Exit(Sender: TObject);
begin
BitBtn1.SetFocus;
end;
procedure TFProductos.DBLookupComboBox4Enter(Sender: TObject);
begin
ProveedorT.Close;
ProveedorT.Open;
ProveedorT.Last;
end;
procedure TFProductos.BitBtn13Click(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Proveedor.exe')),SW_SHOWNORMAL);
end;
procedure TFProductos.TablaAfterCancel(DataSet: TDataSet);
begin
Tabla.Transaction.RollbackRetaining;
end;
procedure TFProductos.TablaAfterDelete(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFProductos.TablaAfterInsert(DataSet: TDataSet);
begin
If Cancelar then Tabla.Cancel else nuevo;
end;
procedure TFProductos.TablaAfterPost(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
end.

Просмотреть файл

@ -0,0 +1,571 @@
unit UFProductos;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DataModule, Grids, DBGrids, DB, ExtCtrls, StdCtrls, Mask,
DBCtrls, Buttons, ComCtrls, IBQuery, IBCustomDataSet, IBTable, OleCtrls,
SHDocVw;
const
EAN_izqA : array[0..9] of PChar=('0001101','0011001','0010011','0111101','0100011','0110001','0101111','0111011','0110111','0001011');
EAN_izqB : array[0..9] of PChar=('0100111','0110011','0011011','0100001','0011101','0111001','0000101','0010001','0001001','0010111');
EAN_dcha : array[0..9] of PChar=('1110010','1100110','1101100','1000010','1011100','1001110','1010000','1000100','1001000','1110100');
CodificaIzq : array[0..9] of PChar=('AAAAA','ABABB','ABBAB','ABBBA','BAABB','BBAAB','BBBAA','BABAB','BABBA','BBABA');
type
TFProductos = class(TForm)
DataSource: TDataSource;
DSTCat: TDataSource;
DSTSubCat: TDataSource;
DSMateriales: TDataSource;
DSRubro: TDataSource;
DSQProve: TDataSource;
MarcaDataSource: TDataSource;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet3: TTabSheet;
Panel3: TPanel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label2: TLabel;
Label14: TLabel;
Label23: TLabel;
DescripcionDBEdit: TDBEdit;
DBEdit1: TDBEdit;
DBLookupComboBox4: TDBLookupComboBox;
BitBtn13: TBitBtn;
Label8: TLabel;
Label19: TLabel;
Label30: TLabel;
Label10: TLabel;
Label5: TLabel;
DBText1: TDBText;
Label16: TLabel;
Label28: TLabel;
Label21: TLabel;
IVADBEdit: TDBEdit;
FleteDBEdit: TDBEdit;
CostoDBEdit: TDBEdit;
Label4: TLabel;
PrecioCtaCteDBEdit: TDBEdit;
DBMemo1: TDBMemo;
TabSheet2: TTabSheet;
Label6: TLabel;
Label15: TLabel;
Label17: TLabel;
Label18: TLabel;
Label20: TLabel;
DBEdit6: TDBEdit;
DBEdit5: TDBEdit;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
DBEdit17: TDBEdit;
DBEdit9: TDBEdit;
Label9: TLabel;
DBEdit21: TDBEdit;
Label32: TLabel;
Label33: TLabel;
Label34: TLabel;
GanaciaDBEdit: TDBEdit;
TabSheet4: TTabSheet;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label7: TLabel;
Label31: TLabel;
Label3: TLabel;
Label22: TLabel;
Precio1DBEdit: TDBEdit;
Precio2DBEdit: TDBEdit;
Precio3DBEdit: TDBEdit;
Precio6DBEdit: TDBEdit;
Precio4DBEdit: TDBEdit;
Precio5DBEdit: TDBEdit;
DBText2: TDBText;
TabSheet5: TTabSheet;
CuentaDataSource: TDataSource;
Label50: TLabel;
CuentaDBLookupComboBox: TDBLookupComboBox;
DBLookupComboBox1: TDBLookupComboBox;
DBLookupComboBox2: TDBLookupComboBox;
DBLookupComboBox7: TDBLookupComboBox;
Label54: TLabel;
Label53: TLabel;
Label51: TLabel;
Label52: TLabel;
Label25: TLabel;
Label26: TLabel;
Label27: TLabel;
RubroDBLookupComboBox: TDBLookupComboBox;
RubroBitBtn: TBitBtn;
MarcaDBLookupComboBox: TDBLookupComboBox;
MarcaBitBtn: TBitBtn;
CategoriaDBLookupComboBox: TDBLookupComboBox;
CategoriaBitBtn: TBitBtn;
Label29: TLabel;
Tabla: TIBTable;
CategoriaT: TIBTable;
SubCategoriaT: TIBTable;
RubroT: TIBTable;
MaterialT: TIBTable;
QTemp: TIBQuery;
Usuario: TIBQuery;
DSUsuarios: TDataSource;
CuentaQuery: TIBQuery;
MarcaT: TIBTable;
ProveedorT: TIBTable;
ConfigQuery: TIBQuery;
Label1: TLabel;
CodigoDBEdit: TDBEdit;
BitBtn4: TBitBtn;
DBNavigator1: TDBNavigator;
Label24: TLabel;
CodigoBarraEdit: TDBEdit;
CodigoBarraBitBtn: TBitBtn;
PaintBox1: TImage;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure RubroBitBtnClick(Sender: TObject);
procedure CodigoBarraBitBtnClick(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Precio6DBEditExit(Sender: TObject);
procedure CategoriaBitBtnClick(Sender: TObject);
procedure MarcaBitBtnClick(Sender: TObject);
procedure DBEdit14Exit(Sender: TObject);
procedure BitBtn13Click(Sender: TObject);
procedure TablaAfterInsert(DataSet: TDataSet);
procedure GanaciaDBEditExit(Sender: TObject);
procedure TablaAfterPost(DataSet: TDataSet);
procedure TablaAfterCancel(DataSet: TDataSet);
procedure TablaAfterDelete(DataSet: TDataSet);
procedure MarcaDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure DBLookupComboBox4Enter(Sender: TObject);
procedure CategoriaDBLookupComboBoxEnter(Sender: TObject);
procedure RubroDBLookupComboBoxEnter(Sender: TObject);
procedure MarcaDBLookupComboBoxEnter(Sender: TObject);
private
{ Private declarations }
public
desc:string;
Precio1, Precio2, Precio3, Precio4, Precio5, Precio6, PrecioCtaCte: Double;
{ Public declarations }
// procedimiento que codifica el número en un nº binario
procedure Codifica(num : string);
// procedimiento para dibujar el cód. de barras a partir del nº binario
procedure Dibujar(matrix : string);
// procedimiento para validar-corregir los códigos
procedure EANCorrecto(var num : string);
Procedure nuevo;
end;
var
FProductos: TFProductos;
implementation
uses UFBuscaArticulos, Color;
{$R *.dfm}
procedure TFProductos.EANCorrecto(var num : string);
var
i,N : byte;
sum : integer;
flag : byte;
begin
sum:=0;
N:=Length(num)-1; //13-1=12
for i:=1 to N do //desde 1 hasta 12
begin
if (i mod 2)=0 then // x mod y = x – (x div y) * y = 1-(0.5)*2
begin
if N=12 then
sum:=sum+StrToInt(num[i])*3
else
sum:=sum+StrToInt(num[i]);
end
else
begin
if N=12 then
sum:=sum+StrToInt(num[i])
else
sum:=sum+StrToInt(num[i])*3;
end;
end;
if sum>99 then
Flag:=10-(sum mod 100)
else
Flag:=10-(sum mod 10);
if Flag=10 then Flag:=0;
if not(StrToInt(num[N+1])=flag) then
num:=copy(num,1,length(num)-1)+IntToStr(Flag);
end;
procedure TFProductos.Codifica(num : string);
var
matrix : string;
i : integer;
begin
num:=CodigoBarraEdit.Text; //numero
matrix:='';
case Length(num) of //mientras sean 13 caracteres
13: begin
EANCorrecto(num); //
CodigoBarraEdit.Text:=num;
matrix:=matrix+'x0x'; // barra inicio
matrix:=matrix+EAN_izqA[StrToInt(num[2])];
for i:=3 to 7 do
if CodificaIzq[StrToInt(num[1])][i-3]='A' then
matrix:=matrix+EAN_izqA[StrToInt(num[i])]
else
matrix:=matrix+EAN_izqB[StrToInt(num[i])];
matrix:=matrix+'0x0x0'; // barra central
matrix:=matrix+EAN_dcha[StrToInt(num[8])];
matrix:=matrix+EAN_dcha[StrToInt(num[9])];
matrix:=matrix+EAN_dcha[StrToInt(num[10])];
matrix:=matrix+EAN_dcha[StrToInt(num[11])];
matrix:=matrix+EAN_dcha[StrToInt(num[12])];
matrix:=matrix+EAN_dcha[StrToInt(num[13])];
matrix:=matrix+'x0x'; // barra final
Dibujar(Matrix);
end;
8: begin
EANCorrecto(num);
CodigoBarraEdit.Text:=num;
matrix:=matrix+'x0x';
matrix:=matrix+EAN_izqA[StrToInt(num[1])];
matrix:=matrix+EAN_izqA[StrToInt(num[2])];
matrix:=matrix+EAN_izqA[StrToInt(num[3])];
matrix:=matrix+EAN_izqA[StrToInt(num[4])];
matrix:=matrix+'0x0x0';
matrix:=matrix+EAN_dcha[StrToInt(num[5])];
matrix:=matrix+EAN_dcha[StrToInt(num[6])];
matrix:=matrix+EAN_dcha[StrToInt(num[7])];
matrix:=matrix+EAN_dcha[StrToInt(num[8])];
matrix:=matrix+'x0x';
Dibujar(Matrix);
end
else
ShowMessage('LONGITUD DE CODIGO NO VALIDA');
end;
end;
procedure TFProductos.Dibujar(matrix : string);
var
i : integer;
begin
with PaintBox1 do begin
Canvas.Brush.Color:= clWhite;
Canvas.FillRect(Rect(0,0,PaintBox1.Width,PaintBox1.Height));
Canvas.Pen.Color:=clBlack;
END;
for i:=1 to Length(Matrix) do
if matrix[i]='1' then
PaintBox1.Canvas.PolyLine([Point(10+i,10),Point(10+i,50)])
else
if matrix[i]='x' then
PaintBox1.Canvas.PolyLine([Point(10+i,10),Point(10+i,55)]);
if Length(CodigoBarraEdit.Text)=13 then
begin
PaintBox1.Canvas.TextOut(3,50,CodigoBarraEdit.Text[1]);
PaintBox1.Canvas.TextOut(17,50,copy(CodigoBarraEdit.Text,2,6));
PaintBox1.Canvas.TextOut(63,50,copy(CodigoBarraEdit.Text,8,6));
end
else
if Length(CodigoBarraEdit.Text)=8 then
begin
PaintBox1.Canvas.TextOut(16,50,copy(CodigoBarraEdit.Text,1,4));
PaintBox1.Canvas.TextOut(48,50,copy(CodigoBarraEdit.Text,5,4));
end;
end;
procedure TFProductos.BitBtn1Click(Sender: TObject);
begin
desc:=CodigoDBEdit.Text;
If (Tabla.State = dsEdit) or (Tabla.State = dsInsert) And (DescripcionDBEdit.Text <> '') then Tabla.Post
else if (DescripcionDBEdit.Text <> '') then ShowMessage('COMPLETE TODOS LOS CAMPOS');
Close;
end;
procedure TFProductos.BitBtn2Click(Sender: TObject);
begin
Tabla.Cancel;
Close;
end;
procedure TFProductos.FormCreate(Sender: TObject);
begin
DM:=TDM.Create(Self);
Tabla.Active := True;
SubCategoriaT.Active := True;
ProveedorT.Active := True;
RubroT.Active := True;
MarcaT.Active := True;
CategoriaT.Active := True;
ConfigQuery.Open;
Precio1:=ConfigQuery.FieldByName('PP1').AsFloat/100+1;
Precio2:=ConfigQuery.FieldByName('PP2').AsFloat/100+1;
Precio3:=ConfigQuery.FieldByName('PP3').AsFloat/100+1;
Precio4:=ConfigQuery.FieldByName('PP4').AsFloat/100+1;
Precio5:=ConfigQuery.FieldByName('PP5').AsFloat/100+1;
Precio6:=ConfigQuery.FieldByName('PP6').AsFloat/100+1;
PrecioCtaCte:=ConfigQuery.FieldByName('PP').AsFloat/100+1;
QTemp.Close;
CuentaQuery.Open;
Tabla.Insert;
end;
procedure TFProductos.BitBtn4Click(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
Tabla.Cancel;
FBuscaArticulo:=TFBuscaArticulo.Create(self);
try
FBuscaArticulo.ShowModal;
finally
If FBuscaArticulo.Tabla.Active =True then
Tabla.Locate('CODIGO',FBuscaArticulo.Tabla.FieldByName('CODIGO').AsInteger,[]);
FBuscaArticulo.Free;
end;
Tabla.Edit;
end;
procedure TFProductos.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then { if it's an enter key }
begin
Key := #0; { eat enter key }
Perform(WM_NEXTDLGCTL, 0, 0); { move to next control }
end;
end;
procedure TFProductos.GanaciaDBEditExit(Sender: TObject);
var costo, flete, iva :double;
begin
if CostoDBEdit.Text = '' then CostoDBEdit.Text:='0';
if FleteDBEdit.Text = '' then FleteDBEdit.Text:='0';
if IVADBEdit.Text = '' then IVADBEdit.Text:='0';
if GanaciaDBEdit.Text = '' then GanaciaDBEdit.Text:='0';
costo:=StrToFloat(CostoDBEdit.Text);
flete:=costo*(StrToFloat(FleteDBEdit.Text)/100);
iva:=costo*(StrToFloat(IVADBEdit.Text)/100);
Precio1DBEdit.Text:=FloatToStr((costo*Precio1)+flete+iva);
Precio2DBEdit.Text:=FloatToStr((costo*Precio2)+flete+iva);
Precio3DBEdit.Text:=FloatToStr((costo*Precio3)+flete+iva);
Precio4DBEdit.Text:=FloatToStr((costo*Precio4)+flete+iva);
Precio5DBEdit.Text:=FloatToStr((costo*Precio5)+flete+iva);
Precio6DBEdit.Text:=FloatToStr((costo*Precio6)+flete+iva);
if GanaciaDBEdit.Text='0' then PrecioCtaCteDBEdit.Text:=FloatToStr((costo*PrecioCtaCte)+flete+iva) else PrecioCtaCteDBEdit.Text:=FloatToStr((costo*(StrToFloat(GanaciaDBEdit.Text)/100+1)+flete+iva));
Label21.Caption:= '= '+FloatToStr(iva);
DBText1.Caption:= FloatToStr(costo+flete);
DBText2.Caption:= FloatToStr(costo+flete+iva);
BitBtn1.SetFocus;
end;
Procedure TFProductos.nuevo;
begin
Tabla.FieldByName('CtaNombre').AsString:='13';
Tabla.FieldByName('CtaTipo').AsString:='13';
Tabla.FieldByName('CtaAnticipo').AsString:='13';
Tabla.FieldByName('CtaIIBB').AsString:='66';
Tabla.FieldByName('CODIGOBARRA').AsString:= '0';
Tabla.FieldByName('Color').AsString:= '0';
Tabla.FieldByName('Categoria').AsString:= '0';
Tabla.FieldByName('SubCategoria').AsString:= '0';
Tabla.FieldByName('Rubro').AsString := '0';
Tabla.FieldByName('Marca').AsString := '0';
Tabla.FieldByName('Proveedor').Value := 1;
DBLookupComboBox4.KeyValue := 0;
DbEdit9.Field.AsString := 'c/u';
DbEdit17.Field.AsDateTime := Date;
Tabla.FieldByName('Costo').AsInteger:= 0;
CostoDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('ImpOtros').AsInteger:= 0;
FleteDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('Tasa').AsInteger:= 0;
IVADBEdit.Field.AsFloat := 0;
Tabla.FieldByName('Precio').AsInteger:= 0;
PrecioCtaCteDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('IIBB').AsInteger:= 0;
end;
procedure TFProductos.RubroBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Rubro.exe')),SW_SHOWNORMAL);
{ RubroForm:=RubroForm.Create(self);
try
RubroForm.ShowModal;
finally
If RubroForm.desc <> '' then
RubroDBLookupComboBox.KeyValue:= RubroForm.desc;
Tabla.FieldByName('Rubro').AsString:=RubroForm.desc;
RubroForm.Free;
end;
RubroT.Close;
RubroT.Open;
MarcaDBLookupComboBox.SetFocus;
}
end;
procedure TFProductos.RubroDBLookupComboBoxEnter(Sender: TObject);
begin
RubroT.Close;
RubroT.Open;
RubroT.Last;
end;
procedure TFProductos.CodigoBarraBitBtnClick(Sender: TObject);
var
i : integer;
begin
if Tabla.State = dsInsert then
begin
QTemp.Close;
QTemp.SQL.Text:='SELECT max(CODIGO) FROM "Articulo"';
QTemp.Open;
i:= 100000 + (QTemp.Fields.Fields[0].AsInteger +1); //agrego el codigo
end
else
begin
i:= 100000 + strtoint(CodigoDBEdit.Text);
IF (Tabla.State <> dsEdit) then Tabla.Edit;
end;
//codigo de barras
CodigoBarraEdit.Text := '1'+inttostr(i)+'2'; //lo incluyo en el codigo de barra
Codifica(CodigoBarraEdit.Text);
CodigoBarraEdit.SelStart:=0;
CodigoBarraEdit.SelLength:=Length(CodigoBarraEdit.Text);
Tabla.FieldByName('CodigoBarra').AsString := CodigoBarraEdit.Text;
end;
procedure TFProductos.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
IF Key = VK_F2 then RubroBitBtn.Click;
IF Key = VK_F3 then MarcaBitBtn.Click;
IF Key = VK_F4 then BitBtn13.Click;
IF Key = VK_F5 then BitBtn4.Click;
IF Key = VK_F6 then CodigoBarraBitBtn.Click;
end;
procedure TFProductos.Precio6DBEditExit(Sender: TObject);
begin
IVADBEdit.SetFocus;
end;
procedure TFProductos.CategoriaBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Categoria.exe')),SW_SHOWNORMAL);
{
FCategorias:=TFCategorias.Create(self);
try
FCategorias.ShowModal;
finally
If FCategorias.desc <> '' then
begin
CategoriaDBLookupComboBox.KeyValue:= FCategorias.desc;
Tabla.FieldByName('Categoria').AsString:=FCategorias.desc;
end;
FCategorias.Free;
end;
CategoriaT.Close;
CategoriaT.Open;
RubroDBLookupComboBox.SetFocus;
}
end;
procedure TFProductos.CategoriaDBLookupComboBoxEnter(Sender: TObject);
begin
CategoriaT.Close;
CategoriaT.Open;
CategoriaT.Last;
end;
procedure TFProductos.MarcaBitBtnClick(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Marca.exe')),SW_SHOWNORMAL);
{ MarcaForm:=TMarcaForm.Create(self);
try
MarcaForm.ShowModal;
finally
If MarcaForm.desc <> '' then
begin
MarcaDBLookupComboBox.KeyValue:= MarcaForm.desc;
If (Tabla.State <> dsEdit) and (Tabla.State <> dsInsert) then Tabla.Edit;
Tabla.FieldByName('Marca').AsString:=MarcaForm.desc;
end;
MarcaForm.Free;
end;
MarcaT.Close;
MarcaT.Open;
DBEdit9.SetFocus;
}
end;
procedure TFProductos.MarcaDBLookupComboBoxEnter(Sender: TObject);
begin
MarcaT.Close;
MarcaT.Open;
MarcaT.Last;
end;
procedure TFProductos.MarcaDBLookupComboBoxKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
MarcaT.Close;
MarcaT.Open;
MarcaT.Last;
end;
procedure TFProductos.DBEdit14Exit(Sender: TObject);
begin
BitBtn1.SetFocus;
end;
procedure TFProductos.DBLookupComboBox4Enter(Sender: TObject);
begin
ProveedorT.Close;
ProveedorT.Open;
ProveedorT.Last;
end;
procedure TFProductos.BitBtn13Click(Sender: TObject);
begin
WinExec(PAnsiChar(AnsiString(Path+'Proveedor.exe')),SW_SHOWNORMAL);
end;
procedure TFProductos.TablaAfterCancel(DataSet: TDataSet);
begin
Tabla.Transaction.RollbackRetaining;
end;
procedure TFProductos.TablaAfterDelete(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFProductos.TablaAfterInsert(DataSet: TDataSet);
begin
If Cancelar then Tabla.Cancel else nuevo;
end;
procedure TFProductos.TablaAfterPost(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
end.

Просмотреть файл

@ -0,0 +1,19 @@
program Articulos;
uses
Forms,
UFProductos in '..\Form\UFProductos.pas' {FProductos},
DataModule in '..\..\..\DataModule\DataModule.pas' {DM: TDataModule},
UFBuscaArticulos in '..\..\..\Buscar\Articulo\Form\UFBuscaArticulos.pas' {FBuscaArticulo},
Color in '..\..\Color\Form\Color.pas' {ColorForm},
ImprimirDM in '..\..\..\DataModule\ImprimirDM.pas' {ImprimirDataModule: TDataModule};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.Title := 'Articulo';
Application.CreateForm(TFProductos, FProductos);
Application.Run;
end.

Просмотреть файл

@ -0,0 +1,124 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{32AACE97-A2F9-4008-AA02-5EBF39BA2350}</ProjectGuid>
<ProjectVersion>12.0</ProjectVersion>
<MainSource>Articulos.dpr</MainSource>
<Config Condition="'$(Config)'==''">Debug</Config>
<DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_OutputDRCFile>true</DCC_OutputDRCFile>
<DCC_ExeOutput>\DeGsoft\GeN</DCC_ExeOutput>
<DCC_DependencyCheckOutputName>D:\DeGsoft\GeN\Articulos.exe</DCC_DependencyCheckOutputName>
<DCC_ImageBase>00400000</DCC_ImageBase>
<DCC_UnitAlias>WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;$(DCC_UnitAlias)</DCC_UnitAlias>
<UsePackages>true</UsePackages>
<DCC_Platform>x86</DCC_Platform>
<DCC_K>false</DCC_K>
<DCC_N>false</DCC_N>
<DCC_S>false</DCC_S>
<DCC_UsePackage>vclx;vcl;vclimg;dbrtl;Rave77VCL;bdertl;rtl;vclactnband;xmlrtl;vcldb;vcldbx;vcltouch;dsnap;dsnapcon;TeeUI;TeeDB;Tee;vclib;ibxpress;adortl;IndyCore;IndySystem;IndyProtocols;inet;intrawebdb_100_140;Intraweb_100_140;VclSmp;vclie;websnap;webdsnap;inetdb;inetdbbde;inetdbxpress;soaprtl;vclribbon;dbexpress;DbxCommonDriver;DataSnapIndy10ServerTransport;DataSnapProviderClient;DbxClientDriver;DataSnapServer;DBXInterBaseDriver;DBXMySQLDriver;dbxcds;DBXFirebirdDriver;DBXSybaseASEDriver;DBXSybaseASADriver;DBXOracleDriver;DBXMSSQLDriver;DBXInformixDriver;DBXDb2Driver</DCC_UsePackage>
<DCC_E>false</DCC_E>
<DCC_F>false</DCC_F>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_DebugInformation>false</DCC_DebugInformation>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="Articulos.dpr">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="..\Form\UFProductos.pas">
<Form>FProductos</Form>
</DCCReference>
<DCCReference Include="..\..\..\DataModule\DataModule.pas">
<Form>DM</Form>
<DesignClass>TDataModule</DesignClass>
</DCCReference>
<DCCReference Include="..\..\..\Buscar\Articulo\Form\UFBuscaArticulos.pas">
<Form>FBuscaArticulo</Form>
</DCCReference>
<DCCReference Include="..\..\Color\Form\Color.pas">
<Form>ColorForm</Form>
</DCCReference>
<DCCReference Include="..\..\..\DataModule\ImprimirDM.pas">
<Form>ImprimirDataModule</Form>
<DesignClass>TDataModule</DesignClass>
</DCCReference>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Debug">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Release">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
<ProjectExtensions>
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
<Borland.ProjectType/>
<BorlandProject>
<Delphi.Personality>
<Parameters>
<Parameters Name="UseLauncher">False</Parameters>
<Parameters Name="LoadAllSymbols">True</Parameters>
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
</Parameters>
<VersionInfo>
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">0</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
<VersionInfo Name="Private">False</VersionInfo>
<VersionInfo Name="DLL">False</VersionInfo>
<VersionInfo Name="Locale">3082</VersionInfo>
<VersionInfo Name="CodePage">1252</VersionInfo>
</VersionInfo>
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"/>
<VersionInfoKeys Name="FileDescription"/>
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"/>
<VersionInfoKeys Name="LegalCopyright"/>
<VersionInfoKeys Name="LegalTrademarks"/>
<VersionInfoKeys Name="OriginalFilename"/>
<VersionInfoKeys Name="ProductName"/>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"/>
</VersionInfoKeys>
<Source>
<Source Name="MainSource">Articulos.dpr</Source>
</Source>
</Delphi.Personality>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
</Project>

Просмотреть файл

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<BorlandProject>
<Transactions>
<Transaction>2010/06/24 18:11:24.968.dproj,D:\RAD Studio\Projects\Project1.dproj=D:\RAD Studio\Projects\DeGsoft\GeN\ABM\Articulo\Project\Articulos.dproj</Transaction>
<Transaction>2011/02/09 18:53:15.281.pas,D:\Projects\DeGsoft\GeN\ABM\Rubro\Form\RubroF.pas=</Transaction>
<Transaction>2011/02/09 18:53:15.281.dfm,D:\Projects\DeGsoft\GeN\ABM\Rubro\Form\RubroF.dfm=</Transaction>
<Transaction>2011/02/09 18:53:21.187.pas,D:\Projects\DeGsoft\GeN\ABM\Categoria\Form\UFCategorias.pas=</Transaction>
<Transaction>2011/02/09 18:53:21.187.dfm,D:\Projects\DeGsoft\GeN\ABM\Categoria\Form\UFCategorias.dfm=</Transaction>
<Transaction>2011/02/09 18:53:29.015.pas,D:\Projects\DeGsoft\GeN\ABM\SubCategoria\Form\UFSubCategorias.pas=</Transaction>
<Transaction>2011/02/09 18:53:29.015.dfm,D:\Projects\DeGsoft\GeN\ABM\SubCategoria\Form\UFSubCategorias.dfm=</Transaction>
</Transactions>
<ProjectSortOrder AutoSort="-1" SortType="1"/>
</BorlandProject>

Просмотреть файл

@ -0,0 +1,75 @@
/* VER210
Generated by the CodeGear Delphi Pascal Compiler
because -GD or --drc was supplied to the compiler.
This file contains compiler-generated resources that
were bound to the executable.
If this file is empty, then no compiler-generated
resources were bound to the produced executable.
*/
STRINGTABLE
BEGIN
END
/* ..\..\..\DataModule\DataModule.dfm */
/* ..\..\Color\Form\Color.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxInheritError.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxCtrls.RES */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxPrintDialog.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxPreviewPageSettings.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxSearchDialog.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxPreview.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxPreview.RES */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxDialogForm.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxPassw.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxProgress.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxClass.RES */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditFormat.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditHighlight.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditSysMemo.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditMemo.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxBarcodeEditor.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportImage.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportHTML.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportXML.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportRTF.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportMail.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportCSV.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportDBF.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportText.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEvaluateForm.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxWatchForm.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxPopupForm.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxDataTree.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxInsp.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxDesgnWorkspace.res */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxConnItemEdit.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxConnEditor.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditTabOrder.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditReportData.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxStdWizard.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxStdWizard.RES */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxNewItem.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditFrame.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditStyle.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditExpr.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditStrings.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditVar.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxAbout.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditPage.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditPicture.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditReport.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditOptions.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditGroup.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditDataBand.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxReportTree.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxDesgn.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxDesgn.RES */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportXLS.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportPDF.dfm */
/* ..\..\..\DataModule\ImprimirDM.dfm */
/* ..\..\..\Buscar\Articulo\Form\UFBuscaArticulos.dfm */
/* ..\form\UFProductos.dfm */
/* D:\Projects\DeGsoft\GeN\ABM\Articulo\Project\Articulos.res */
/* D:\Projects\DeGsoft\GeN\ABM\Articulo\Project\Articulos.drf */

Двоичные данные
ABM/Articulo/Project/Articulos.identcache Normal file

Двоичный файл не отображается.

Двоичные данные
ABM/Articulo/Project/Articulos.res Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,23 @@
program Articulos;
uses
Forms,
UFProductos in '..\Form\UFProductos.pas' {FProductos},
DataModule in '..\..\..\DataModule\DataModule.pas' {DM: TDataModule},
UFBuscaArticulos in '..\..\..\Buscar\Articulo\Form\UFBuscaArticulos.pas' {FBuscaArticulo},
UFCategorias in '..\..\Categoria\Form\UFCategorias.pas' {FCategorias},
UFSubCategorias in '..\..\SubCategoria\Form\UFSubCategorias.pas' {FSubCategorias},
Color in '..\..\Color\Form\Color.pas' {ColorForm},
Marca in '..\..\Marca\Form\Marca.pas' {MarcaForm},
RubroF in '..\..\Rubro\Form\RubroF.pas' {RubroForm},
IngresosBrutos in '..\..\IngresosBrutos\Form\IngresosBrutos.pas' {IngresosBrutosForm};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.Title := 'Articulo';
Application.CreateForm(TFProductos, FProductos);
Application.Run;
end.

Просмотреть файл

@ -0,0 +1,23 @@
program Articulos;
uses
Forms,
UFProductos in '..\Form\UFProductos.pas' {FProductos},
DataModule in '..\..\..\DataModule\DataModule.pas' {DM: TDataModule},
UFBuscaArticulos in '..\..\..\Buscar\Articulo\Form\UFBuscaArticulos.pas' {FBuscaArticulo},
UFCategorias in '..\..\Categoria\Form\UFCategorias.pas' {FCategorias},
UFSubCategorias in '..\..\SubCategoria\Form\UFSubCategorias.pas' {FSubCategorias},
Color in '..\..\Color\Form\Color.pas' {ColorForm},
Marca in '..\..\Marca\Form\Marca.pas' {MarcaForm},
RubroF in '..\..\Rubro\Form\RubroF.pas' {RubroForm},
IngresosBrutos in '..\..\IngresosBrutos\Form\IngresosBrutos.pas' {IngresosBrutosForm};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.Title := 'Articulo';
Application.CreateForm(TFProductos, FProductos);
Application.Run;
end.

Просмотреть файл

@ -0,0 +1,23 @@
program Articulos;
uses
Forms,
UFProductos in '..\Form\UFProductos.pas' {FProductos},
DataModule in '..\..\..\DataModule\DataModule.pas' {DM: TDataModule},
UFBuscaArticulos in '..\..\..\Buscar\Articulo\Form\UFBuscaArticulos.pas' {FBuscaArticulo},
UFCategorias in '..\..\Categoria\Form\UFCategorias.pas' {FCategorias},
UFSubCategorias in '..\..\SubCategoria\Form\UFSubCategorias.pas' {FSubCategorias},
Color in '..\..\Color\Form\Color.pas' {ColorForm},
Marca in '..\..\Marca\Form\Marca.pas' {MarcaForm},
RubroF in '..\..\Rubro\Form\RubroF.pas' {RubroForm},
IngresosBrutos in '..\..\IngresosBrutos\Form\IngresosBrutos.pas' {IngresosBrutosForm};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.Title := 'Articulo';
Application.CreateForm(TFProductos, FProductos);
Application.Run;
end.

Просмотреть файл

@ -0,0 +1,25 @@
program Articulos;
uses
Forms,
UFProductos in '..\Form\UFProductos.pas' {FProductos},
DataModule in '..\..\..\DataModule\DataModule.pas' {DM: TDataModule},
UFBuscaArticulos in '..\..\..\Buscar\Articulo\Form\UFBuscaArticulos.pas' {FBuscaArticulo},
UFCategorias in '..\..\Categoria\Form\UFCategorias.pas' {FCategorias},
UFSubCategorias in '..\..\SubCategoria\Form\UFSubCategorias.pas' {FSubCategorias},
Color in '..\..\Color\Form\Color.pas' {ColorForm},
Marca in '..\..\Marca\Form\Marca.pas' {MarcaForm},
RubroF in '..\..\Rubro\Form\RubroF.pas' {RubroForm},
IngresosBrutos in '..\..\IngresosBrutos\Form\IngresosBrutos.pas' {IngresosBrutosForm},
ImprimirDM in '..\..\..\DataModule\ImprimirDM.pas' {ImprimirDataModule: TDataModule};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.Title := 'Articulo';
Application.CreateForm(TFProductos, FProductos);
Application.CreateForm(TImprimirDataModule, ImprimirDataModule);
Application.Run;
end.

Просмотреть файл

@ -0,0 +1,24 @@
program Articulos;
uses
Forms,
UFProductos in '..\Form\UFProductos.pas' {FProductos},
DataModule in '..\..\..\DataModule\DataModule.pas' {DM: TDataModule},
UFBuscaArticulos in '..\..\..\Buscar\Articulo\Form\UFBuscaArticulos.pas' {FBuscaArticulo},
UFCategorias in '..\..\Categoria\Form\UFCategorias.pas' {FCategorias},
UFSubCategorias in '..\..\SubCategoria\Form\UFSubCategorias.pas' {FSubCategorias},
Color in '..\..\Color\Form\Color.pas' {ColorForm},
Marca in '..\..\Marca\Form\Marca.pas' {MarcaForm},
RubroF in '..\..\Rubro\Form\RubroF.pas' {RubroForm},
IngresosBrutos in '..\..\IngresosBrutos\Form\IngresosBrutos.pas' {IngresosBrutosForm},
ImprimirDM in '..\..\..\DataModule\ImprimirDM.pas' {ImprimirDataModule: TDataModule};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.Title := 'Articulo';
Application.CreateForm(TFProductos, FProductos);
Application.Run;
end.

Просмотреть файл

@ -0,0 +1,23 @@
program Articulos;
uses
Forms,
UFProductos in '..\Form\UFProductos.pas' {FProductos},
DataModule in '..\..\..\DataModule\DataModule.pas' {DM: TDataModule},
UFBuscaArticulos in '..\..\..\Buscar\Articulo\Form\UFBuscaArticulos.pas' {FBuscaArticulo},
UFCategorias in '..\..\Categoria\Form\UFCategorias.pas' {FCategorias},
UFSubCategorias in '..\..\SubCategoria\Form\UFSubCategorias.pas' {FSubCategorias},
Color in '..\..\Color\Form\Color.pas' {ColorForm},
Marca in '..\..\Marca\Form\Marca.pas' {MarcaForm},
RubroF in '..\..\Rubro\Form\RubroF.pas' {RubroForm},
ImprimirDM in '..\..\..\DataModule\ImprimirDM.pas' {ImprimirDataModule: TDataModule};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.Title := 'Articulo';
Application.CreateForm(TFProductos, FProductos);
Application.Run;
end.

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,517 @@
unit ArticuloCelularF;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DataModule, Grids, DBGrids, DB, ADODB, ExtCtrls, StdCtrls, Mask,
DBCtrls, Buttons, ComCtrls;
const
EAN_izqA : array[0..9] of PChar=('0001101','0011001','0010011','0111101','0100011','0110001','0101111','0111011','0110111','0001011');
EAN_izqB : array[0..9] of PChar=('0100111','0110011','0011011','0100001','0011101','0111001','0000101','0010001','0001001','0010111');
EAN_dcha : array[0..9] of PChar=('1110010','1100110','1101100','1000010','1011100','1001110','1010000','1000100','1001000','1110100');
CodificaIzq : array[0..9] of PChar=('AAAAA','ABABB','ABBAB','ABBBA','BAABB','BBAAB','BBBAA','BABAB','BABBA','BBABA');
type
TFProductos = class(TForm)
DataSource: TDataSource;
ADOTCat: TADOTable;
ADOTSubCat: TADOTable;
DSTCat: TDataSource;
DSTSubCat: TDataSource;
TMateriales: TADOTable;
DSMateriales: TDataSource;
AQTemp: TADOQuery;
TRubro: TADOTable;
DSRubro: TDataSource;
QProve: TADOQuery;
DSQProve: TDataSource;
CategoriaADOTable: TADOTable;
CategoriaDataSource: TDataSource;
MarcaADOTable: TADOTable;
MarcaDataSource: TDataSource;
Tabla: TADOQuery;
Panel3: TPanel;
SiBitBtn: TBitBtn;
NoBitBtn: TBitBtn;
Panel1: TPanel;
BitBtn4: TBitBtn;
DBNavigator1: TDBNavigator;
Label1: TLabel;
DBEdit19: TDBEdit;
CuentaQuery: TADOQuery;
CuentaDataSource: TDataSource;
ConfigQuery: TADOQuery;
Label40: TLabel;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
Label2: TLabel;
Label14: TLabel;
Label23: TLabel;
Label8: TLabel;
Label19: TLabel;
Label30: TLabel;
Label10: TLabel;
Label5: TLabel;
DBText1: TDBText;
Label16: TLabel;
Label28: TLabel;
Label21: TLabel;
Label4: TLabel;
Label33: TLabel;
Label34: TLabel;
DBText2: TDBText;
Label24: TLabel;
Label29: TLabel;
Label35: TLabel;
Label36: TLabel;
Label37: TLabel;
Label38: TLabel;
DBEdit2: TDBEdit;
DBLookupComboBox4: TDBLookupComboBox;
IVADBEdit: TDBEdit;
FleteDBEdit: TDBEdit;
CostoDBEdit: TDBEdit;
PrecioCtaCteDBEdit: TDBEdit;
GanaciaDBEdit: TDBEdit;
Edit1: TDBEdit;
diasDBEdit: TDBEdit;
VenceDBEdit: TDBEdit;
DBEdit10: TDBEdit;
EstadoDBComboBox: TDBComboBox;
TabSheet3: TTabSheet;
DBMemo1: TDBMemo;
TabSheet2: TTabSheet;
Label6: TLabel;
Label15: TLabel;
Label17: TLabel;
Label18: TLabel;
Label20: TLabel;
Label9: TLabel;
Label32: TLabel;
Label25: TLabel;
Label26: TLabel;
Label27: TLabel;
Label39: TLabel;
DBEdit6: TDBEdit;
DBEdit5: TDBEdit;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
DBEdit17: TDBEdit;
DBEdit9: TDBEdit;
DBEdit21: TDBEdit;
RubroDBLookupComboBox: TDBLookupComboBox;
BitBtn8: TBitBtn;
MarcaDBLookupComboBox: TDBLookupComboBox;
BitBtn10: TBitBtn;
CategoriaDBLookupComboBox: TDBLookupComboBox;
BitBtn11: TBitBtn;
FechaDBEdit: TDBEdit;
TabSheet4: TTabSheet;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label7: TLabel;
Label31: TLabel;
Label3: TLabel;
Label22: TLabel;
Precio1DBEdit: TDBEdit;
Precio2DBEdit: TDBEdit;
Precio3DBEdit: TDBEdit;
Precio6DBEdit: TDBEdit;
Precio4DBEdit: TDBEdit;
Precio5DBEdit: TDBEdit;
TabSheet5: TTabSheet;
Label50: TLabel;
Label54: TLabel;
Label53: TLabel;
Label51: TLabel;
Label52: TLabel;
CuentaDBLookupComboBox: TDBLookupComboBox;
DBLookupComboBox1: TDBLookupComboBox;
DBLookupComboBox2: TDBLookupComboBox;
DBLookupComboBox7: TDBLookupComboBox;
procedure SiBitBtnClick(Sender: TObject);
procedure NoBitBtnClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure FormShow(Sender: TObject);
procedure BitBtn8Click(Sender: TObject);
procedure NewCodeBar;
procedure BitBtn9Click(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Precio6DBEditExit(Sender: TObject);
procedure BitBtn11Click(Sender: TObject);
procedure BitBtn10Click(Sender: TObject);
procedure DBEdit14Exit(Sender: TObject);
procedure TablaBeforePost(DataSet: TDataSet);
procedure TablaAfterInsert(DataSet: TDataSet);
procedure GanaciaDBEditExit(Sender: TObject);
procedure BitBtn13Exit(Sender: TObject);
procedure VenceDBEditExit(Sender: TObject);
private
{ Private declarations }
public
desc:string;
Precio1, Precio2, Precio3, Precio4, Precio5, Precio6, PrecioCtaCte: Double;
{ Public declarations }
// procedimiento que codifica el número en un nº binario
// procedure Codifica(num : string);
// procedimiento para dibujar el cód. de barras a partir del nº binario
// procedure Dibujar(matrix : string);
// procedimiento para validar-corregir los códigos
// procedure EANCorrecto(var num : string);
Procedure nuevo;
end;
var
FProductos: TFProductos;
implementation
uses UFCategorias, UFSubCategorias, Color, Marca, IngresosBrutos, RubroF,
BuscarArticulosCelularF;
{$R *.dfm}
procedure TFProductos.NewCodeBar;
var
i : integer;
begin
if Tabla.State = dsInsert then
begin
AQTemp.Close;
AQTemp.SQL.Text:='SELECT max(CodPArte) FROM Articulos';
AQTemp.Open;
DBEdit19.Text := IntToStr(AQTemp.Fields.Fields[0].AsInteger +1);
end;
{If (Tabla.State <> dsEdit) or (Tabla.State <> dsInsert) then Tabla.Edit;
//codigo de barras
i:= 100000 + StrToInt(DBEdit19.Text); //agrego el codigo
Edit1.Text := '1'+inttostr(i)+'2'; //lo incluyo en el codigo de barra
Codifica(Edit1.Text);
Edit1.SelStart:=0;
Edit1.SelLength:=Length(Edit1.Text);
Tabla.FieldByName('CodigoBarra').AsString := Edit1.Text; }
end;
{procedure TFProductos.EANCorrecto(var num : string);
var
i,N : byte;
sum : integer;
flag : byte;
begin
sum:=0;
N:=Length(num)-1; //13-1=12
for i:=1 to N do //desde 1 hasta 12
begin
if (i mod 2)=0 then // x mod y = x – (x div y) * y = 1-(0.5)*2
begin
if N=12 then
sum:=sum+StrToInt(num[i])*3
else
sum:=sum+StrToInt(num[i]);
end
else
begin
if N=12 then
sum:=sum+StrToInt(num[i])
else
sum:=sum+StrToInt(num[i])*3;
end;
end;
if sum>99 then
Flag:=10-(sum mod 100)
else
Flag:=10-(sum mod 10);
if Flag=10 then Flag:=0;
if not(StrToInt(num[N+1])=flag) then
num:=copy(num,1,length(num)-1)+IntToStr(Flag);
end;
procedure TFProductos.Codifica(num : string);
var
matrix : string;
i : integer;
begin
num:=Edit1.Text; //numero
matrix:='';
case Length(num) of //mientras sean 13 caracteres
13: begin
EANCorrecto(num); //
Edit1.Text:=num;
matrix:=matrix+'x0x'; // barra inicio
matrix:=matrix+EAN_izqA[StrToInt(num[2])];
for i:=3 to 7 do
if CodificaIzq[StrToInt(num[1])][i-3]='A' then
matrix:=matrix+EAN_izqA[StrToInt(num[i])]
else
matrix:=matrix+EAN_izqB[StrToInt(num[i])];
matrix:=matrix+'0x0x0'; // barra central
matrix:=matrix+EAN_dcha[StrToInt(num[8])];
matrix:=matrix+EAN_dcha[StrToInt(num[9])];
matrix:=matrix+EAN_dcha[StrToInt(num[10])];
matrix:=matrix+EAN_dcha[StrToInt(num[11])];
matrix:=matrix+EAN_dcha[StrToInt(num[12])];
matrix:=matrix+EAN_dcha[StrToInt(num[13])];
matrix:=matrix+'x0x'; // barra final
// Dibujar(Matrix);
end;
8: begin
EANCorrecto(num);
Edit1.Text:=num;
matrix:=matrix+'x0x';
matrix:=matrix+EAN_izqA[StrToInt(num[1])];
matrix:=matrix+EAN_izqA[StrToInt(num[2])];
matrix:=matrix+EAN_izqA[StrToInt(num[3])];
matrix:=matrix+EAN_izqA[StrToInt(num[4])];
matrix:=matrix+'0x0x0';
matrix:=matrix+EAN_dcha[StrToInt(num[5])];
matrix:=matrix+EAN_dcha[StrToInt(num[6])];
matrix:=matrix+EAN_dcha[StrToInt(num[7])];
matrix:=matrix+EAN_dcha[StrToInt(num[8])];
matrix:=matrix+'x0x';
//Dibujar(Matrix);
end
else
ShowMessage('LONGITUD DE CODIGO NO VALIDA');
end;
end; }
procedure TFProductos.SiBitBtnClick(Sender: TObject);
begin
desc:=DBEdit19.Text;
If (Tabla.State = dsEdit) or (Tabla.State = dsInsert) And (Tabla.FieldByName('descripcion').Value <> '') then Tabla.Post;
Tabla.Insert;
Edit1.SetFocus;
end;
procedure TFProductos.NoBitBtnClick(Sender: TObject);
begin
Close;
end;
procedure TFProductos.FormCreate(Sender: TObject);
begin
DM:=TDM.Create(self);
Tabla.Active := True;
AdoTCat.Active := True;
AdoTSubCat.Active := True;
QProve.Active := True;
TRubro.Active := True;
MarcaADOTable.Active := True;
CategoriaADOTable.Active := True;
ConfigQuery.Open;
Precio1:=ConfigQuery.FieldByName('PP1').AsFloat/100+1;
Precio2:=ConfigQuery.FieldByName('PP2').AsFloat/100+1;
Precio3:=ConfigQuery.FieldByName('PP3').AsFloat/100+1;
Precio4:=ConfigQuery.FieldByName('PP4').AsFloat/100+1;
Precio5:=ConfigQuery.FieldByName('PP5').AsFloat/100+1;
Precio6:=ConfigQuery.FieldByName('PP6').AsFloat/100+1;
PrecioCtaCte:=ConfigQuery.FieldByName('PPCtaCte').AsFloat/100+1;
AQTemp.Close;
end;
procedure TFProductos.BitBtn4Click(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
Tabla.Cancel;
BuscaArticuloCelularForm:=TBuscaArticuloCelularForm.Create(self);
try
BuscaArticuloCelularForm.ShowModal;
finally
If BuscaArticuloCelularForm.ATArticulos.Active =True then
Tabla.Locate('CodParte',BuscaArticuloCelularForm.ATArticulos.FieldByName('CodParte').AsInteger,[]);
BuscaArticuloCelularForm.Free;
end;
Tabla.Edit;
end;
procedure TFProductos.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then { if it's an enter key }
begin
Key := #0; { eat enter key }
Perform(WM_NEXTDLGCTL, 0, 0); { move to next control }
end;
end;
procedure TFProductos.FormShow(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
Tabla.Insert;
end;
procedure TFProductos.GanaciaDBEditExit(Sender: TObject);
var costo, flete, iva :double;
begin
if CostoDBEdit.Text = '' then CostoDBEdit.Text:='0';
if FleteDBEdit.Text = '' then FleteDBEdit.Text:='0';
if IVADBEdit.Text = '' then IVADBEdit.Text:='0';
if GanaciaDBEdit.Text = '' then GanaciaDBEdit.Text:='0';
costo:=StrToFloat(CostoDBEdit.Text);
flete:=costo*(StrToFloat(FleteDBEdit.Text)/100);
iva:=costo*(StrToFloat(IVADBEdit.Text)/100);
Precio1DBEdit.Text:=FloatToStr((costo*Precio1)+flete+iva);
Precio2DBEdit.Text:=FloatToStr((costo*Precio2)+flete+iva);
Precio3DBEdit.Text:=FloatToStr((costo*Precio3)+flete+iva);
Precio4DBEdit.Text:=FloatToStr((costo*Precio4)+flete+iva);
Precio5DBEdit.Text:=FloatToStr((costo*Precio5)+flete+iva);
Precio6DBEdit.Text:=FloatToStr((costo*Precio6)+flete+iva);
if GanaciaDBEdit.Text='0' then PrecioCtaCteDBEdit.Text:=FloatToStr((costo*PrecioCtaCte)+flete+iva) else PrecioCtaCteDBEdit.Text:=FloatToStr((costo*(StrToFloat(GanaciaDBEdit.Text)/100+1)+flete+iva));
Label21.Caption:= '= '+FloatToStr(iva);
DBText1.Caption:= FloatToStr(costo+flete);
DBText2.Caption:= FloatToStr(costo+flete+iva);
SiBitBtn.SetFocus;
end;
Procedure TFProductos.nuevo;
begin
Tabla.FieldByName('CtaNombre').AsString:='13';
Tabla.FieldByName('CtaTipo').AsString:='13';
Tabla.FieldByName('CtaAnticipo').AsString:='13';
Tabla.FieldByName('CtaIIBB').AsString:='66';
Tabla.FieldByName('Color').AsString:= 'Otros';
Tabla.FieldByName('Categoria').AsString:= 'Otros';
Tabla.FieldByName('SubCategoria').AsString:= 'Otros';
Tabla.FieldByName('Rubro').AsString := 'Otros';
Tabla.FieldByName('Marca').AsString := 'Otros';
Tabla.FieldByName('Proveedor').Value := 0;
DBLookupComboBox4.KeyValue := 0;
DbEdit9.Field.AsString := 'c/u';
Tabla.FieldByName('Descripcion').AsString:= '.';
DbEdit17.Field.AsDateTime := Date;
Tabla.FieldByName('Costo').AsInteger:= 0;
CostoDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('ImpOtros').AsInteger:= 0;
FleteDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('Tasa').AsInteger:= 0;
IVADBEdit.Field.AsFloat := 0;
Tabla.FieldByName('PrecioCtaCte').AsInteger:= 0;
PrecioCtaCteDBEdit.Field.AsFloat := 0;
Tabla.FieldByName('Fecha').AsDateTime:= date;
FechaDBEdit.Text:=datetostr(date);
EstadoDBComboBox.ItemIndex:=0;
//BitBtn9.Click;
GanaciaDBEdit.Text:=floattostr((PrecioCtaCte-1)*100);
NewCodeBar;
end;
procedure TFProductos.BitBtn8Click(Sender: TObject);
begin
RubroForm:=TRubroForm.Create(self);
try
RubroForm.ShowModal;
finally
If RubroForm.desc <> '' then
RubroDBLookupComboBox.KeyValue:= RubroForm.desc;
Tabla.FieldByName('Rubro').AsString:=RubroForm.desc;
RubroForm.Free;
end;
TRubro.Close;
TRubro.Open;
MarcaDBLookupComboBox.SetFocus;
end;
procedure TFProductos.BitBtn9Click(Sender: TObject);
begin
NewCodeBar;
end;
procedure TFProductos.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
IF Key = VK_F2 then BitBtn8.Click;
IF Key = VK_F3 then BitBtn10.Click;
IF Key = VK_F5 then BitBtn4.Click;
IF Key = VK_F8 then SiBitBtn.Click;
end;
procedure TFProductos.Precio6DBEditExit(Sender: TObject);
begin
IVADBEdit.SetFocus;
end;
procedure TFProductos.BitBtn11Click(Sender: TObject);
begin
FCategorias:=TFCategorias.Create(self);
try
FCategorias.ShowModal;
finally
If FCategorias.desc <> '' then
begin
CategoriaDBLookupComboBox.KeyValue:= FCategorias.desc;
Tabla.FieldByName('Categoria').AsString:=FCategorias.desc;
end;
FCategorias.Free;
end;
CategoriaADOTable.Close;
CategoriaADOTable.Open;
RubroDBLookupComboBox.SetFocus;
end;
procedure TFProductos.BitBtn10Click(Sender: TObject);
begin
MarcaForm:=TMarcaForm.Create(self);
try
MarcaForm.ShowModal;
finally
If MarcaForm.desc <> '' then
begin
MarcaDBLookupComboBox.KeyValue:= MarcaForm.desc;
If (Tabla.State <> dsEdit) and (Tabla.State <> dsInsert) then Tabla.Edit;
Tabla.FieldByName('Marca').AsString:=MarcaForm.desc;
end;
MarcaForm.Free;
end;
MarcaADOTable.Close;
MarcaADOTable.Open;
DBEdit9.SetFocus;
end;
procedure TFProductos.DBEdit14Exit(Sender: TObject);
begin
SiBitBtn.SetFocus;
end;
procedure TFProductos.VenceDBEditExit(Sender: TObject);
function DifFech(Fecha:string):integer;
var
dTemp:TDate;
begin
dTemp := StrToDate(Fecha);
Result:= trunc(dTemp-
StrToDate(FormatDateTime(DateToStr(Date),dTemp))
);
end;
begin
diasDBEdit.Text:=IntToStr( DifFech(VenceDBEdit.Text) );
end;
procedure TFProductos.BitBtn13Exit(Sender: TObject);
begin
QProve.Close;
QProve.Open;
end;
procedure TFProductos.TablaBeforePost(DataSet: TDataSet);
begin
If Tabla.FieldByName('descripcion').Value = '' then Tabla.FieldByName('descripcion').Value := '.';
end;
procedure TFProductos.TablaAfterInsert(DataSet: TDataSet);
begin
If Cancelar then Tabla.Cancel else nuevo;
end;
end.

Просмотреть файл

@ -0,0 +1,23 @@
program ArticuloCelular;
uses
Forms,
ArticuloCelularF in '..\Form\ArticuloCelularF.pas' {FProductos},
DataModule in '..\..\..\DataModule\DataModule.pas' {DM: TDataModule},
UFCategorias in '..\..\Categoria\Form\UFCategorias.pas' {FCategorias},
Color in '..\..\Color\Form\Color.pas' {ColorForm},
Marca in '..\..\Marca\Form\Marca.pas' {MarcaForm},
UFSubCategorias in '..\..\SubCategoria\Form\UFSubCategorias.pas' {FSubCategorias},
RubroF in '..\..\Rubro\Form\RubroF.pas' {RubroForm},
IngresosBrutos in '..\..\IngresosBrutos\Form\IngresosBrutos.pas' {IngresosBrutosForm},
BuscarArticulosCelularF in '..\..\..\Buscar\ArticuloCelular\Form\BuscarArticulosCelularF.pas' {BuscaArticuloCelularForm};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.Title := 'Articulos';
Application.CreateForm(TFProductos, FProductos);
Application.Run;
end.

Просмотреть файл

@ -0,0 +1,134 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{03F869E5-3E78-45A5-A73B-6E68F973CB95}</ProjectGuid>
<ProjectVersion>12.0</ProjectVersion>
<MainSource>ArticuloCelular.dpr</MainSource>
<Config Condition="'$(Config)'==''">Debug</Config>
<DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_ExeOutput>C:\DeGsoft\GeN\</DCC_ExeOutput>
<DCC_DependencyCheckOutputName>C:\DeGsoft\GeN\ArticuloCelular.exe</DCC_DependencyCheckOutputName>
<DCC_ImageBase>00400000</DCC_ImageBase>
<DCC_UnitAlias>WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;$(DCC_UnitAlias)</DCC_UnitAlias>
<UsePackages>true</UsePackages>
<DCC_Platform>x86</DCC_Platform>
<DCC_K>false</DCC_K>
<DCC_N>false</DCC_N>
<DCC_S>false</DCC_S>
<DCC_UsePackage>vclx;vcl;vclimg;dbrtl;Rave77VCL;bdertl;rtl;vclactnband;xmlrtl;vcldb;vcldbx;vcltouch;dsnap;dsnapcon;TeeUI;TeeDB;Tee;vclib;ibxpress;adortl;IndyCore;IndySystem;IndyProtocols;inet;intrawebdb_100_140;Intraweb_100_140;VclSmp;vclie;websnap;webdsnap;inetdb;inetdbbde;inetdbxpress;soaprtl;vclribbon;dbexpress;DbxCommonDriver;DataSnapIndy10ServerTransport;DataSnapProviderClient;DbxClientDriver;DataSnapServer;DBXInterBaseDriver;DBXMySQLDriver;dbxcds;DBXFirebirdDriver;DBXSybaseASEDriver;DBXSybaseASADriver;DBXOracleDriver;DBXMSSQLDriver;DBXInformixDriver;DBXDb2Driver</DCC_UsePackage>
<DCC_E>false</DCC_E>
<DCC_F>false</DCC_F>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_DebugInformation>false</DCC_DebugInformation>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="ArticuloCelular.dpr">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="..\Form\ArticuloCelularF.pas">
<Form>FProductos</Form>
</DCCReference>
<DCCReference Include="..\..\..\DataModule\DataModule.pas">
<Form>DM</Form>
<DesignClass>TDataModule</DesignClass>
</DCCReference>
<DCCReference Include="..\..\Categoria\Form\UFCategorias.pas">
<Form>FCategorias</Form>
</DCCReference>
<DCCReference Include="..\..\Color\Form\Color.pas">
<Form>ColorForm</Form>
</DCCReference>
<DCCReference Include="..\..\Marca\Form\Marca.pas">
<Form>MarcaForm</Form>
</DCCReference>
<DCCReference Include="..\..\SubCategoria\Form\UFSubCategorias.pas">
<Form>FSubCategorias</Form>
</DCCReference>
<DCCReference Include="..\..\Rubro\Form\RubroF.pas">
<Form>RubroForm</Form>
</DCCReference>
<DCCReference Include="..\..\IngresosBrutos\Form\IngresosBrutos.pas">
<Form>IngresosBrutosForm</Form>
</DCCReference>
<DCCReference Include="..\..\..\Buscar\ArticuloCelular\Form\BuscarArticulosCelularF.pas">
<Form>BuscaArticuloCelularForm</Form>
</DCCReference>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Debug">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Release">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
<ProjectExtensions>
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
<Borland.ProjectType/>
<BorlandProject>
<Delphi.Personality>
<Source>
<Source Name="MainSource">ArticuloCelular.dpr</Source>
</Source>
<Parameters>
<Parameters Name="UseLauncher">False</Parameters>
<Parameters Name="LoadAllSymbols">True</Parameters>
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
</Parameters>
<VersionInfo>
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">0</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
<VersionInfo Name="Private">False</VersionInfo>
<VersionInfo Name="DLL">False</VersionInfo>
<VersionInfo Name="Locale">3082</VersionInfo>
<VersionInfo Name="CodePage">1252</VersionInfo>
</VersionInfo>
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"/>
<VersionInfoKeys Name="FileDescription"/>
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"/>
<VersionInfoKeys Name="LegalCopyright"/>
<VersionInfoKeys Name="LegalTrademarks"/>
<VersionInfoKeys Name="OriginalFilename"/>
<VersionInfoKeys Name="ProductName"/>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"/>
</VersionInfoKeys>
</Delphi.Personality>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
</Project>

Просмотреть файл

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<BorlandProject>
<Transactions>
<Transaction>2010/06/24 18:29:42.750.dproj,D:\RAD Studio\Projects\Project1.dproj=D:\RAD Studio\Projects\DeGsoft\GeN\ABM\ArticuloCelular\Project\ArticuloCelular.dproj</Transaction>
</Transactions>
</BorlandProject>

Двоичные данные
ABM/ArticuloCelular/Project/ArticuloCelular.identcache Normal file

Двоичный файл не отображается.

Двоичные данные
ABM/ArticuloCelular/Project/ArticuloCelular.res Normal file

Двоичный файл не отображается.

318
ABM/Caja/Form/CajaF.dfm Normal file
Просмотреть файл

@ -0,0 +1,318 @@
object ABMCajaForm: TABMCajaForm
Left = 0
Top = 0
Caption = 'Caja'
ClientHeight = 466
ClientWidth = 792
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
OnCreate = FormCreate
OnKeyUp = FormKeyUp
PixelsPerInch = 96
TextHeight = 13
object DBGrid1: TDBGrid
Left = 0
Top = 82
Width = 698
Height = 384
Align = alClient
DataSource = DataSource
ReadOnly = True
TabOrder = 0
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'Tahoma'
TitleFont.Style = []
Columns = <
item
Expanded = False
FieldName = 'Detalle'
Width = 387
Visible = True
end
item
Expanded = False
FieldName = 'Debe'
Width = 108
Visible = True
end
item
Expanded = False
FieldName = 'Haber'
Width = 98
Visible = True
end
item
Expanded = False
FieldName = 'Fecha'
Width = 114
Visible = True
end
item
Expanded = False
FieldName = 'Hora'
Width = 100
Visible = True
end>
end
object Panel1: TPanel
Left = 0
Top = 50
Width = 792
Height = 32
Align = alTop
Color = clBlack
ParentBackground = False
TabOrder = 1
object Label3: TLabel
Left = 4
Top = 6
Width = 44
Height = 20
Caption = 'Debe'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -16
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object Label4: TLabel
Left = 255
Top = 6
Width = 50
Height = 20
Caption = 'Haber'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -16
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object Label5: TLabel
Left = 535
Top = 6
Width = 47
Height = 20
Caption = 'Saldo'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -16
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object Debe: TLabel
Left = 53
Top = 10
Width = 21
Height = 13
Caption = '0.00'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
end
object Haber: TLabel
Left = 311
Top = 10
Width = 21
Height = 13
Caption = '0.00'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
end
object Saldo: TLabel
Left = 763
Top = 10
Width = 21
Height = 13
Alignment = taRightJustify
Caption = '0.00'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
end
end
object Panel2: TPanel
Left = 698
Top = 82
Width = 94
Height = 384
Align = alRight
Color = clBlack
ParentBackground = False
TabOrder = 2
object Label10: TLabel
Left = 8
Top = 7
Width = 69
Height = 13
Alignment = taCenter
Caption = 'F4: Ingresar'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
Transparent = True
end
object Label13: TLabel
Left = 8
Top = 37
Width = 61
Height = 13
Alignment = taCenter
Caption = 'F5: Retirar'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
Transparent = True
end
object Label1: TLabel
Left = 17
Top = 207
Width = 58
Height = 13
Alignment = taCenter
Caption = 'Ordenar X'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
Transparent = True
end
object CancelarBitBtn: TBitBtn
Left = 6
Top = 327
Width = 80
Height = 50
Cancel = True
Caption = 'Salir'
DoubleBuffered = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
Glyph.Data = {
DE010000424DDE01000000000000760000002800000024000000120000000100
0400000000006801000000000000000000001000000000000000000000000000
80000080000000808000800000008000800080800000C0C0C000808080000000
FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00388888888877
F7F787F8888888888333333F00004444400888FFF444448888888888F333FF8F
000033334D5007FFF4333388888888883338888F0000333345D50FFFF4333333
338F888F3338F33F000033334D5D0FFFF43333333388788F3338F33F00003333
45D50FEFE4333333338F878F3338F33F000033334D5D0FFFF43333333388788F
3338F33F0000333345D50FEFE4333333338F878F3338F33F000033334D5D0FFF
F43333333388788F3338F33F0000333345D50FEFE4333333338F878F3338F33F
000033334D5D0EFEF43333333388788F3338F33F0000333345D50FEFE4333333
338F878F3338F33F000033334D5D0EFEF43333333388788F3338F33F00003333
4444444444333333338F8F8FFFF8F33F00003333333333333333333333888888
8888333F00003333330000003333333333333FFFFFF3333F00003333330AAAA0
333333333333888888F3333F00003333330000003333333333338FFFF8F3333F
0000}
NumGlyphs = 2
ParentDoubleBuffered = False
ParentFont = False
TabOrder = 0
OnClick = CancelarBitBtnClick
end
object DetalleBitBtn: TBitBtn
Left = 6
Top = 151
Width = 80
Height = 50
Caption = 'Detalle'
DoubleBuffered = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlue
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentDoubleBuffered = False
ParentFont = False
TabOrder = 1
OnClick = DetalleBitBtnClick
end
object FechaBitBtn: TBitBtn
Left = 6
Top = 226
Width = 80
Height = 50
Caption = 'Fecha'
DoubleBuffered = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clRed
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentDoubleBuffered = False
ParentFont = False
TabOrder = 2
OnClick = FechaBitBtnClick
end
end
object DBNavigator1: TDBNavigator
Left = 0
Top = 0
Width = 792
Height = 50
DataSource = DataSource
Align = alTop
TabOrder = 3
Visible = False
end
object DataSource: TDataSource
DataSet = Query
Left = 432
Top = 200
end
object EmpresaQuery: TIBQuery
Database = DM.BaseDatos
Transaction = DM.Transaccion
SQL.Strings = (
'select * from "Empresa"')
Left = 248
Top = 200
end
object Query: TIBQuery
Database = DM.BaseDatos
Transaction = DM.Transaccion
SQL.Strings = (
'SELECT * FROM "Caja" Order by Fecha DESC')
Left = 384
Top = 200
end
object QTemp: TIBQuery
Database = DM.BaseDatos
Transaction = DM.Transaccion
SQL.Strings = (
'SELECT * FROM "Caja" Order by Fecha DESC')
Left = 504
Top = 200
end
end

223
ABM/Caja/Form/CajaF.pas Normal file
Просмотреть файл

@ -0,0 +1,223 @@
unit CajaF;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, DBCtrls, StdCtrls, Buttons, ExtCtrls, Grids, DBGrids,
IBCustomDataSet, IBQuery;
type
TABMCajaForm = class(TForm)
DBGrid1: TDBGrid;
Panel1: TPanel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Debe: TLabel;
Haber: TLabel;
Saldo: TLabel;
Panel2: TPanel;
Label10: TLabel;
Label13: TLabel;
Label1: TLabel;
CancelarBitBtn: TBitBtn;
DetalleBitBtn: TBitBtn;
FechaBitBtn: TBitBtn;
DBNavigator1: TDBNavigator;
DataSource: TDataSource;
EmpresaQuery: TIBQuery;
Query: TIBQuery;
QTemp: TIBQuery;
procedure FechaBitBtnClick(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure DetalleBitBtnClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure QueryAfterDelete(DataSet: TDataSet);
procedure QueryAfterPost(DataSet: TDataSet);
procedure CalculaTotales;
function Procesar(tipo: String):String;
procedure CancelarBitBtnClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
ABMCajaForm: TABMCajaForm;
implementation
uses IngresoDineroF, DataModule;
{$R *.dfm}
procedure TABMCajaForm.CalculaTotales;
VAR i: INTEGER;
begin
Debe.Caption:='0';
Haber.Caption:='0';
Saldo.Caption:='0';
QTemp.SQL.Text:='SELECT Debe - Haber As SubTotal,"'+EmpresaQuery.FieldByName('Nombre').AsString+'" As Empresa,* FROM "Caja"';
QTemp.Open;
for i:=1 to QTemp.RecordCount do
begin
Debe.Caption := FloatToStr(StrToFloat(Debe.Caption) + QTemp.FieldByName('Debe').AsFloat);
Haber.Caption := FloatToStr(StrToFloat(Haber.Caption) + QTemp.FieldByName('Haber').AsFloat);
Saldo.Caption := FloatToStr(StrToFloat(Debe.Caption) - StrToFloat(Haber.Caption));
QTemp.Next;
end;
end;
function TABMCajaForm.Procesar(tipo: String):String;
var numfact, i, OrdTrans : integer;
Fecha, FechaVence, iv: String;
FPagoOK : Boolean;
Detalle, MntContado, MntCheque, NroCheque, DetCheque, DiaCheque, MntTarjeta, NroTarjeta, DetTarjeta, MntOtros, Saldo, Pagado :String;
BalanceAnterior, BalanceTotal, SubTotal, Impuesto, Total : Double;
begin
SubTotal:=0;
Impuesto:=0;
IngresoDineroForm:=TIngresoDineroForm.Create(self);
IngresoDineroForm.Valores(SubTotal, Impuesto, Total);
IF tipo = 'Retiro' then IngresoDineroForm.Retiro := True;
try
IngresoDineroForm.ShowModal;
finally
FPagoOK := IngresoDineroForm.OK;
MntContado := IngresoDineroForm.FEContado.Text;
MntCheque := IngresoDineroForm.FECheque.Text;
NroCheque := IngresoDineroForm.Edit1.Text;
DetCheque := IngresoDineroForm.Edit3.Text;
DiaCheque := IngresoDineroForm.Edit5.Text;
MntTarjeta := IngresoDineroForm.FETarjeta.Text;
NroTarjeta := IngresoDineroForm.Edit2.Text;
DetTarjeta := IngresoDineroForm.Edit4.Text;
MntOtros := IngresoDineroForm.FEOtro.Text;
Detalle := IngresoDineroForm.DetalleEdit.Text;
Saldo := FloatToStr(IngresoDineroForm.Saldo);
Pagado := FloatToStr(IngresoDineroForm.Pagado);
IngresoDineroForm.Free;
end;
if FPagoOK then
begin
// Iniciar la Transaccion
DM.Transaccion.StartTransaction;
try
// Insertar en la tabla de Cheque
if NroCheque <> '' then
begin
QTemp.SQL.Text := 'Insert Into "Cheque" (Numero, Detalle, CodFactura, MntCheque, Fecha, Dias) Values'+
' ('+NroCheque+', '+QuotedStr(DetCheque)+', '+IntToStr(NumFact)+', '+MntCheque+', '+DateToStr(Date)+', '+DiaCheque+')';
QTemp.ExecSQL;
end;
// Insertar en la tabla de Tarjeta
if NroTarjeta <> '' then
begin
QTemp.SQL.Text := 'Insert Into "Tarjeta" (Numero, Detalle, CodFactura, MntTarjeta, Fecha) Values'+
' ('+NroTarjeta+', '+QuotedStr(DetTarjeta)+', '+IntToStr(NumFact)+', '+MntTarjeta+', '+DateToStr(Date)+')';
QTemp.ExecSQL;
end;
IF tipo = 'Retiro' then
begin
// Insertar en la Cuenta Caja
if StrToFloat(MntCheque) > 0 then
begin
QTemp.SQL.Text := 'Insert Into "Caja" (Detalle, Haber, Fecha, Hora) Values'+
' ('+QuotedStr('[Cheque] '+Detalle)+', '+MntCheque+', '+QuotedStr(DateToStr(Date))+', '+QuotedStr(TimeToStr(Time))+')';
QTemp.ExecSQL;
end;
// Insertar en la Cuenta Caja
if StrToFloat(MntContado) > 0 then
begin
QTemp.SQL.Text := 'Insert Into "Caja" (Detalle, Haber, Fecha, Hora) Values'+
' ('+QuotedStr('[Efectivo] '+Detalle)+', '+MntContado+', '+QuotedStr(DateToStr(Date))+', '+QuotedStr(TimeToStr(Time))+')';
QTemp.ExecSQL;
end;
end
else
begin
// Insertar en la Cuenta Caja
if StrToFloat(MntCheque) > 0 then
begin
QTemp.SQL.Text := 'Insert Into "Caja" (Detalle, Debe, Fecha, Hora) Values'+
' ('+QuotedStr('[Cheque] '+Detalle)+', '+MntCheque+', '+QuotedStr(DateToStr(Date))+', '+QuotedStr(TimeToStr(Time))+')';
QTemp.ExecSQL;
end;
// Insertar en la Cuenta Caja
if StrToFloat(MntContado) > 0 then
begin
QTemp.SQL.Text := 'Insert Into "Caja" (Detalle, Debe, Fecha, Hora) Values'+
' ('+QuotedStr('[Efectivo] '+Detalle)+', '+MntContado+', '+QuotedStr(DateToStr(Date))+', '+QuotedStr(TimeToStr(Time))+')';
QTemp.ExecSQL;
end;
end;
// Completa la Transaccion
DM.Transaccion.Commit;
except
on E:Exception do
begin
DM.Transaccion.RollbackRetaining;
//MessageDlg('No fue posible completar la transacción, por favor contacte al administrador',mtError,[mbOK],0);
end;
end;
Query.Close;
Query.Open;
CalculaTotales;
CancelarBitBtn.SetFocus;
end;
end;
procedure TABMCajaForm.CancelarBitBtnClick(Sender: TObject);
begin
close;
end;
procedure TABMCajaForm.DetalleBitBtnClick(Sender: TObject);
begin
Query.SQL.Text:='SELECT * FROM "Caja" Order by Detalle DESC';
Query.Open;
end;
procedure TABMCajaForm.FechaBitBtnClick(Sender: TObject);
begin
Query.SQL.Text:='SELECT * FROM "Caja" Order by Fecha DESC';
Query.Open;
end;
procedure TABMCajaForm.FormCreate(Sender: TObject);
begin
DM:=TDM.Create(Self);
EmpresaQuery.Open;
CalculaTotales;
Query.Open;
end;
procedure TABMCajaForm.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
IF Key = VK_F4 then Procesar('Ingresar');
IF Key = VK_F5 then Procesar('Retiro');
//IF Key = VK_F9 then ImprimirBitBtn.Click;
end;
procedure TABMCajaForm.QueryAfterDelete(DataSet: TDataSet);
begin
CalculaTotales;
end;
procedure TABMCajaForm.QueryAfterPost(DataSet: TDataSet);
begin
CalculaTotales;
end;
end.

18
ABM/Caja/Project/Caja.dpr Normal file
Просмотреть файл

@ -0,0 +1,18 @@
program Caja;
uses
Forms,
CajaF in '..\Form\CajaF.pas' {ABMCajaForm},
DataModule in '..\..\..\DataModule\DataModule.pas' {DM: TDataModule},
IngresoDineroF in '..\..\..\SubOperacion\IngresoDinero\Form\IngresoDineroF.pas' {IngresoDineroForm},
BuscarCheques in '..\..\..\Buscar\Cheque\Form\BuscarCheques.pas' {BuscarChequesForm};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.Title := 'Caja';
Application.CreateForm(TABMCajaForm, ABMCajaForm);
Application.Run;
end.

119
ABM/Caja/Project/Caja.dproj Normal file
Просмотреть файл

@ -0,0 +1,119 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{3B557A72-B92B-466C-B054-7F671E65D740}</ProjectGuid>
<ProjectVersion>12.0</ProjectVersion>
<MainSource>Caja.dpr</MainSource>
<Config Condition="'$(Config)'==''">Debug</Config>
<DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_ExeOutput>C:\DeGsoft\GeN\</DCC_ExeOutput>
<DCC_DependencyCheckOutputName>C:\DeGsoft\GeN\Caja.exe</DCC_DependencyCheckOutputName>
<DCC_ImageBase>00400000</DCC_ImageBase>
<DCC_UnitAlias>WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;$(DCC_UnitAlias)</DCC_UnitAlias>
<UsePackages>true</UsePackages>
<DCC_Platform>x86</DCC_Platform>
<DCC_K>false</DCC_K>
<DCC_N>false</DCC_N>
<DCC_S>false</DCC_S>
<DCC_UsePackage>vclx;vcl;vclimg;dbrtl;Rave77VCL;bdertl;rtl;vclactnband;xmlrtl;vcldb;vcldbx;vcltouch;dsnap;dsnapcon;TeeUI;TeeDB;Tee;vclib;ibxpress;adortl;IndyCore;IndySystem;IndyProtocols;inet;intrawebdb_100_140;Intraweb_100_140;VclSmp;vclie;websnap;webdsnap;inetdb;inetdbbde;inetdbxpress;soaprtl;vclribbon;dbexpress;DbxCommonDriver;DataSnapIndy10ServerTransport;DataSnapProviderClient;DbxClientDriver;DataSnapServer;DBXInterBaseDriver;DBXMySQLDriver;dbxcds;DBXFirebirdDriver;DBXSybaseASEDriver;DBXSybaseASADriver;DBXOracleDriver;DBXMSSQLDriver;DBXInformixDriver;DBXDb2Driver</DCC_UsePackage>
<DCC_E>false</DCC_E>
<DCC_F>false</DCC_F>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_DebugInformation>false</DCC_DebugInformation>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="Caja.dpr">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="..\Form\CajaF.pas">
<Form>ABMCajaForm</Form>
</DCCReference>
<DCCReference Include="..\..\..\DataModule\DataModule.pas">
<Form>DM</Form>
<DesignClass>TDataModule</DesignClass>
</DCCReference>
<DCCReference Include="..\..\..\SubOperacion\IngresoDinero\Form\IngresoDineroF.pas">
<Form>IngresoDineroForm</Form>
</DCCReference>
<DCCReference Include="..\..\..\Buscar\Cheque\Form\BuscarCheques.pas">
<Form>BuscarChequesForm</Form>
</DCCReference>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Debug">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Release">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
<ProjectExtensions>
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
<Borland.ProjectType/>
<BorlandProject>
<Delphi.Personality>
<Parameters>
<Parameters Name="UseLauncher">False</Parameters>
<Parameters Name="LoadAllSymbols">True</Parameters>
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
</Parameters>
<VersionInfo>
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">0</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
<VersionInfo Name="Private">False</VersionInfo>
<VersionInfo Name="DLL">False</VersionInfo>
<VersionInfo Name="Locale">3082</VersionInfo>
<VersionInfo Name="CodePage">1252</VersionInfo>
</VersionInfo>
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"/>
<VersionInfoKeys Name="FileDescription"/>
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"/>
<VersionInfoKeys Name="LegalCopyright"/>
<VersionInfoKeys Name="LegalTrademarks"/>
<VersionInfoKeys Name="OriginalFilename"/>
<VersionInfoKeys Name="ProductName"/>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"/>
</VersionInfoKeys>
<Source>
<Source Name="MainSource">Caja.dpr</Source>
</Source>
</Delphi.Personality>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
</Project>

Просмотреть файл

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<BorlandProject>
<Transactions>
<Transaction>2010/06/24 18:37:40.515.dproj,D:\RAD Studio\Projects\Project1.dproj=D:\RAD Studio\Projects\DeGsoft\GeN\ABM\Caja\Project\Caja.dproj</Transaction>
</Transactions>
</BorlandProject>

Двоичные данные
ABM/Caja/Project/Caja.identcache Normal file

Двоичный файл не отображается.

Двоичные данные
ABM/Caja/Project/Caja.res Normal file

Двоичный файл не отображается.

Двоичные данные
ABM/Capitulo/Form/CapituloF.dcu Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,210 @@
object CapituloForm: TCapituloForm
Left = 429
Top = 300
BorderIcons = [biSystemMenu, biMinimize, biMaximize, biHelp]
BorderStyle = bsSingle
Caption = 'Capitulos'
ClientHeight = 289
ClientWidth = 535
Color = clBlack
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
KeyPreview = True
OldCreateOrder = False
Position = poScreenCenter
OnCreate = FormCreate
OnKeyPress = FormKeyPress
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object DBText1: TDBText
Left = 25
Top = 82
Width = 335
Height = 23
DataField = 'Codigo'
DataSource = DataSource
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -19
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
end
object Label1: TLabel
Left = 25
Top = 61
Width = 40
Height = 13
Caption = 'C'#243'digo'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object Label2: TLabel
Left = 24
Top = 143
Width = 44
Height = 13
Caption = 'Nombre'
FocusControl = DBEdit2
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object DBEdit2: TDBEdit
Left = 25
Top = 162
Width = 335
Height = 32
DataField = 'Descripcion'
DataSource = DataSource
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -19
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
TabOrder = 0
end
object Panel2: TPanel
Left = 390
Top = 0
Width = 145
Height = 289
Align = alRight
Color = clBlack
ParentBackground = False
TabOrder = 1
object Label3: TLabel
Left = 50
Top = 150
Width = 46
Height = 13
Caption = 'Grabar?'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object BitBtn1: TBitBtn
Left = 34
Top = 91
Width = 80
Height = 50
Caption = 'Si'
DoubleBuffered = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
Glyph.Data = {
DE010000424DDE01000000000000760000002800000024000000120000000100
0400000000006801000000000000000000001000000000000000000000000000
80000080000000808000800000008000800080800000C0C0C000808080000000
FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
3333333333333333333333330000333333333333333333333333F33333333333
00003333344333333333333333388F3333333333000033334224333333333333
338338F3333333330000333422224333333333333833338F3333333300003342
222224333333333383333338F3333333000034222A22224333333338F338F333
8F33333300003222A3A2224333333338F3838F338F33333300003A2A333A2224
33333338F83338F338F33333000033A33333A222433333338333338F338F3333
0000333333333A222433333333333338F338F33300003333333333A222433333
333333338F338F33000033333333333A222433333333333338F338F300003333
33333333A222433333333333338F338F00003333333333333A22433333333333
3338F38F000033333333333333A223333333333333338F830000333333333333
333A333333333333333338330000333333333333333333333333333333333333
0000}
ModalResult = 6
NumGlyphs = 2
ParentDoubleBuffered = False
ParentFont = False
TabOrder = 0
OnClick = BitBtn1Click
end
object BitBtn2: TBitBtn
Left = 34
Top = 172
Width = 80
Height = 50
Caption = 'No'
DoubleBuffered = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
Kind = bkNo
ParentDoubleBuffered = False
ParentFont = False
TabOrder = 1
OnClick = BitBtn2Click
end
object BitBtn3: TBitBtn
Left = 34
Top = 24
Width = 80
Height = 50
Caption = 'Buscar'
DoubleBuffered = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clNavy
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentDoubleBuffered = False
ParentFont = False
TabOrder = 2
OnClick = BitBtn3Click
end
object DBNavigator1: TDBNavigator
Left = 13
Top = 239
Width = 120
Height = 32
DataSource = DataSource
VisibleButtons = [nbFirst, nbPrior, nbNext, nbLast, nbInsert, nbDelete]
Hints.Strings = (
'Primer registro'
'Registro anterior'
'Registro siguiente'
#218'ltimo registro'
'Insertar registro'
'Eliminar registro'
'Editar registro'
'Guardar cambios'
'Cancelar edici'#243'n'
'Refrescar datos')
ParentShowHint = False
ShowHint = True
TabOrder = 3
end
end
object DataSource: TDataSource
DataSet = Tabla
Left = 303
Top = 107
end
object Tabla: TIBTable
Database = DM.BaseDatos
Transaction = DM.Transaccion
AfterCancel = TablaAfterCancel
AfterDelete = TablaAfterDelete
AfterPost = TablaAfterPost
TableName = 'Capitulo'
Left = 272
Top = 107
end
end

Просмотреть файл

@ -0,0 +1,121 @@
//******************************************************************************
//* DeGsoft GeN *
//* =========== *
//* GeN(tm) : ERP Software (http://www.degsoft.com.ar/sistemas/GeN) *
//* Copyright (c) 2002-2011 by the Degsoft *
//* For more information visit: http://www.degsoft.com.ar *
//* This program is free software. You can redistribute it and/or modify *
//* it under the terms of the GNU General Public License as published by *
//* the Free Software Foundation; either version 3 of the License. *
//******************************************************************************
unit CapituloF;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask, DBCtrls, ADODB, DB, Buttons, ExtCtrls, DataModule,
IBCustomDataSet, IBTable, OleCtrls, SHDocVw;
type
TCapituloForm = class(TForm)
DBText1: TDBText;
Label1: TLabel;
DataSource: TDataSource;
Label2: TLabel;
DBEdit2: TDBEdit;
Panel2: TPanel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label3: TLabel;
Tabla: TIBTable;
BitBtn3: TBitBtn;
DBNavigator1: TDBNavigator;
procedure BitBtn2Click(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure FormShow(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure TablaAfterCancel(DataSet: TDataSet);
procedure TablaAfterDelete(DataSet: TDataSet);
procedure TablaAfterPost(DataSet: TDataSet);
private
{ Private declarations }
public
{ Public declarations }
end;
var
CapituloForm: TCapituloForm;
implementation
uses BuscarCapituloF;
{$R *.dfm}
procedure TCapituloForm.BitBtn1Click(Sender: TObject);
begin
If (Tabla.State = dsEdit) or (Tabla.State = dsInsert) then
Tabla.Post;
Close;
end;
procedure TCapituloForm.BitBtn2Click(Sender: TObject);
begin
Close;
end;
procedure TCapituloForm.FormCreate(Sender: TObject);
begin
DM:=TDM.Create(Self);
Tabla.Open;
Tabla.Insert;
end;
procedure TCapituloForm.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then { if it's an enter key }
begin
Key := #0; { eat enter key }
Perform(WM_NEXTDLGCTL, 0, 0); { move to next control }
end;
end;
procedure TCapituloForm.FormShow(Sender: TObject);
begin
DBEdit2.SetFocus;
end;
procedure TCapituloForm.BitBtn3Click(Sender: TObject);
begin
Tabla.Cancel;
BuscarCapituloForm:=TBuscarCapituloForm.Create(self);
try
BuscarCapituloForm.ShowModal;
finally
Tabla.Locate('CODIGO',(BuscarCapituloForm.Tabla.FieldByName('CODIGO').AsString),[]);
BuscarCapituloForm.Free;
end;
end;
procedure TCapituloForm.TablaAfterCancel(DataSet: TDataSet);
begin
Tabla.Transaction.RollbackRetaining;
end;
procedure TCapituloForm.TablaAfterDelete(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TCapituloForm.TablaAfterPost(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
end.

Просмотреть файл

@ -0,0 +1,212 @@
object CapituloForm: TCapituloForm
Left = 429
Top = 300
BorderIcons = [biSystemMenu, biMinimize, biMaximize, biHelp]
BorderStyle = bsSingle
Caption = 'Capitulos'
ClientHeight = 289
ClientWidth = 535
Color = clBlack
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
KeyPreview = True
OldCreateOrder = False
Position = poScreenCenter
OnCreate = FormCreate
OnKeyPress = FormKeyPress
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object DBText1: TDBText
Left = 25
Top = 82
Width = 335
Height = 23
DataField = 'Codigo'
DataSource = DataSource
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -19
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
end
object Label1: TLabel
Left = 25
Top = 61
Width = 40
Height = 13
Caption = 'C'#243'digo'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object Label2: TLabel
Left = 24
Top = 143
Width = 44
Height = 13
Caption = 'Nombre'
FocusControl = DBEdit2
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object DBEdit2: TDBEdit
Left = 25
Top = 162
Width = 335
Height = 32
DataField = 'Descripcion'
DataSource = DataSource
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -19
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
TabOrder = 0
end
object Panel2: TPanel
Left = 390
Top = 0
Width = 145
Height = 289
Align = alRight
Color = clBlack
ParentBackground = False
TabOrder = 1
ExplicitLeft = 596
ExplicitHeight = 568
object Label3: TLabel
Left = 50
Top = 150
Width = 46
Height = 13
Caption = 'Grabar?'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object BitBtn1: TBitBtn
Left = 34
Top = 91
Width = 80
Height = 50
Caption = 'Si'
DoubleBuffered = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
Glyph.Data = {
DE010000424DDE01000000000000760000002800000024000000120000000100
0400000000006801000000000000000000001000000000000000000000000000
80000080000000808000800000008000800080800000C0C0C000808080000000
FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
3333333333333333333333330000333333333333333333333333F33333333333
00003333344333333333333333388F3333333333000033334224333333333333
338338F3333333330000333422224333333333333833338F3333333300003342
222224333333333383333338F3333333000034222A22224333333338F338F333
8F33333300003222A3A2224333333338F3838F338F33333300003A2A333A2224
33333338F83338F338F33333000033A33333A222433333338333338F338F3333
0000333333333A222433333333333338F338F33300003333333333A222433333
333333338F338F33000033333333333A222433333333333338F338F300003333
33333333A222433333333333338F338F00003333333333333A22433333333333
3338F38F000033333333333333A223333333333333338F830000333333333333
333A333333333333333338330000333333333333333333333333333333333333
0000}
ModalResult = 6
NumGlyphs = 2
ParentDoubleBuffered = False
ParentFont = False
TabOrder = 0
OnClick = BitBtn1Click
end
object BitBtn2: TBitBtn
Left = 34
Top = 172
Width = 80
Height = 50
Caption = 'No'
DoubleBuffered = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
Kind = bkNo
ParentDoubleBuffered = False
ParentFont = False
TabOrder = 1
OnClick = BitBtn2Click
end
object BitBtn3: TBitBtn
Left = 34
Top = 24
Width = 80
Height = 50
Caption = 'Buscar'
DoubleBuffered = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clNavy
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentDoubleBuffered = False
ParentFont = False
TabOrder = 2
OnClick = BitBtn3Click
end
object DBNavigator1: TDBNavigator
Left = 13
Top = 239
Width = 120
Height = 32
DataSource = DataSource
VisibleButtons = [nbFirst, nbPrior, nbNext, nbLast, nbInsert, nbDelete]
Hints.Strings = (
'Primer registro'
'Registro anterior'
'Registro siguiente'
#218'ltimo registro'
'Insertar registro'
'Eliminar registro'
'Editar registro'
'Guardar cambios'
'Cancelar edici'#243'n'
'Refrescar datos')
ParentShowHint = False
ShowHint = True
TabOrder = 3
end
end
object DataSource: TDataSource
DataSet = Tabla
Left = 303
Top = 107
end
object Tabla: TIBTable
Database = DM.BaseDatos
Transaction = DM.Transaccion
AfterCancel = TablaAfterCancel
AfterDelete = TablaAfterDelete
AfterPost = TablaAfterPost
TableName = 'Capitulo'
Left = 272
Top = 107
end
end

Просмотреть файл

@ -0,0 +1,110 @@
unit CapituloF;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask, DBCtrls, ADODB, DB, Buttons, ExtCtrls, DataModule,
IBCustomDataSet, IBTable, OleCtrls, SHDocVw;
type
TCapituloForm = class(TForm)
DBText1: TDBText;
Label1: TLabel;
DataSource: TDataSource;
Label2: TLabel;
DBEdit2: TDBEdit;
Panel2: TPanel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label3: TLabel;
Tabla: TIBTable;
BitBtn3: TBitBtn;
DBNavigator1: TDBNavigator;
procedure BitBtn2Click(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure FormShow(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure TablaAfterCancel(DataSet: TDataSet);
procedure TablaAfterDelete(DataSet: TDataSet);
procedure TablaAfterPost(DataSet: TDataSet);
private
{ Private declarations }
public
{ Public declarations }
end;
var
CapituloForm: TCapituloForm;
implementation
uses BuscarCapituloF;
{$R *.dfm}
procedure TCapituloForm.BitBtn1Click(Sender: TObject);
begin
If (Tabla.State = dsEdit) or (Tabla.State = dsInsert) then
Tabla.Post;
Close;
end;
procedure TCapituloForm.BitBtn2Click(Sender: TObject);
begin
Close;
end;
procedure TCapituloForm.FormCreate(Sender: TObject);
begin
DM:=TDM.Create(Self);
Tabla.Open;
Tabla.Insert;
end;
procedure TCapituloForm.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then { if it's an enter key }
begin
Key := #0; { eat enter key }
Perform(WM_NEXTDLGCTL, 0, 0); { move to next control }
end;
end;
procedure TCapituloForm.FormShow(Sender: TObject);
begin
DBEdit2.SetFocus;
end;
procedure TCapituloForm.BitBtn3Click(Sender: TObject);
begin
Tabla.Cancel;
BuscarCapituloForm:=TBuscarCapituloForm.Create(self);
try
BuscarCapituloForm.ShowModal;
finally
Tabla.Locate('CODIGO',(BuscarCapituloForm.Tabla.FieldByName('CODIGO').AsString),[]);
BuscarCapituloForm.Free;
end;
end;
procedure TCapituloForm.TablaAfterCancel(DataSet: TDataSet);
begin
Tabla.Transaction.RollbackRetaining;
end;
procedure TCapituloForm.TablaAfterDelete(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TCapituloForm.TablaAfterPost(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
end.

Просмотреть файл

@ -0,0 +1,18 @@
program Capitulo;
uses
Forms,
CapituloF in '..\Form\CapituloF.pas' {CapituloForm},
DataModule in '..\..\..\DataModule\DataModule.pas' {DM: TDataModule},
BuscarCapituloF in '..\..\..\Buscar\Capitulo\Form\BuscarCapituloF.pas' {BuscarCapituloForm},
ImprimirDM in '..\..\..\DataModule\ImprimirDM.pas' {ImprimirDataModule: TDataModule};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.Title := 'Capitulo Contable';
Application.CreateForm(TCapituloForm, CapituloForm);
Application.Run;
end.

Просмотреть файл

@ -0,0 +1,126 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{B0B00644-BFCE-4F85-AD13-7EF329DB038E}</ProjectGuid>
<ProjectVersion>12.0</ProjectVersion>
<MainSource>Capitulo.dpr</MainSource>
<Config Condition="'$(Config)'==''">Debug</Config>
<DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_OutputDRCFile>true</DCC_OutputDRCFile>
<DCC_ExeOutput>\DeGsoft\GeN\</DCC_ExeOutput>
<DCC_DependencyCheckOutputName>F:\DeGsoft\GeN\Capitulo.exe</DCC_DependencyCheckOutputName>
<DCC_ImageBase>00400000</DCC_ImageBase>
<DCC_UnitAlias>WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;$(DCC_UnitAlias)</DCC_UnitAlias>
<UsePackages>true</UsePackages>
<DCC_Platform>x86</DCC_Platform>
<DCC_K>false</DCC_K>
<DCC_N>false</DCC_N>
<DCC_S>false</DCC_S>
<DCC_UsePackage>vclx;vcl;vclimg;dbrtl;Rave77VCL;bdertl;rtl;vclactnband;xmlrtl;vcldb;vcldbx;vcltouch;dsnap;dsnapcon;TeeUI;TeeDB;Tee;vclib;ibxpress;adortl;IndyCore;IndySystem;IndyProtocols;inet;intrawebdb_100_140;Intraweb_100_140;VclSmp;vclie;websnap;webdsnap;inetdb;inetdbbde;inetdbxpress;soaprtl;vclribbon;dbexpress;DbxCommonDriver;DataSnapIndy10ServerTransport;DataSnapProviderClient;DbxClientDriver;DataSnapServer;DBXInterBaseDriver;DBXMySQLDriver;dbxcds;DBXFirebirdDriver;DBXSybaseASEDriver;DBXSybaseASADriver;DBXOracleDriver;DBXMSSQLDriver;DBXInformixDriver;DBXDb2Driver</DCC_UsePackage>
<DCC_E>false</DCC_E>
<DCC_F>false</DCC_F>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_DebugInformation>false</DCC_DebugInformation>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="Capitulo.dpr">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="..\Form\CapituloF.pas">
<Form>CapituloForm</Form>
</DCCReference>
<DCCReference Include="..\..\..\DataModule\DataModule.pas">
<Form>DM</Form>
<DesignClass>TDataModule</DesignClass>
</DCCReference>
<DCCReference Include="..\..\..\Buscar\Capitulo\Form\BuscarCapituloF.pas">
<Form>BuscarCapituloForm</Form>
</DCCReference>
<DCCReference Include="..\..\..\DataModule\ImprimirDM.pas">
<Form>ImprimirDataModule</Form>
<DesignClass>TDataModule</DesignClass>
</DCCReference>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Debug">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Release">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
<ProjectExtensions>
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
<Borland.ProjectType/>
<BorlandProject>
<Delphi.Personality>
<Source>
<Source Name="MainSource">Capitulo.dpr</Source>
</Source>
<Parameters>
<Parameters Name="UseLauncher">False</Parameters>
<Parameters Name="LoadAllSymbols">True</Parameters>
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
</Parameters>
<VersionInfo>
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">0</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
<VersionInfo Name="Private">False</VersionInfo>
<VersionInfo Name="DLL">False</VersionInfo>
<VersionInfo Name="Locale">3082</VersionInfo>
<VersionInfo Name="CodePage">1252</VersionInfo>
</VersionInfo>
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"/>
<VersionInfoKeys Name="FileDescription"/>
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"/>
<VersionInfoKeys Name="LegalCopyright"/>
<VersionInfoKeys Name="LegalTrademarks"/>
<VersionInfoKeys Name="OriginalFilename"/>
<VersionInfoKeys Name="ProductName"/>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"/>
</VersionInfoKeys>
<Excluded_Packages>
<Excluded_Packages Name="$(BDS)\bin\dcloffice2k140.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDS)\bin\bcboffice2k140.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages>
<Excluded_Packages Name="$(BDS)\bin\bcbofficexp140.bpl">Embarcadero C++Builder Office XP Servers Package</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
</Project>

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<BorlandProject>
<Transactions>
<Transaction>2010/06/24 18:50:47.140.dproj,D:\RAD Studio\Projects\Project1.dproj=D:\RAD Studio\Projects\DeGsoft\GeN\ABM\Capitulo\Project\Capitulo.dproj</Transaction>
</Transactions>
<ProjectSortOrder AutoSort="-1" SortType="1"/>
</BorlandProject>

Просмотреть файл

@ -0,0 +1,74 @@
/* VER210
Generated by the CodeGear Delphi Pascal Compiler
because -GD or --drc was supplied to the compiler.
This file contains compiler-generated resources that
were bound to the executable.
If this file is empty, then no compiler-generated
resources were bound to the produced executable.
*/
STRINGTABLE
BEGIN
END
/* ..\..\..\DataModule\DataModule.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxInheritError.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxCtrls.RES */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxPrintDialog.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxPreviewPageSettings.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxSearchDialog.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxPreview.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxPreview.RES */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxDialogForm.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxPassw.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxProgress.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxClass.RES */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditFormat.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditHighlight.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditSysMemo.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditMemo.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxBarcodeEditor.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportImage.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportHTML.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportXML.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportRTF.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportMail.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportCSV.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportDBF.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportText.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEvaluateForm.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxWatchForm.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxPopupForm.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxDataTree.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxInsp.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxDesgnWorkspace.res */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxConnItemEdit.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxConnEditor.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditTabOrder.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditReportData.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxStdWizard.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxStdWizard.RES */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxNewItem.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditFrame.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditStyle.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditExpr.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditStrings.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditVar.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxAbout.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditPage.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditPicture.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditReport.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditOptions.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditGroup.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditDataBand.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxReportTree.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxDesgn.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxDesgn.RES */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportXLS.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportPDF.dfm */
/* ..\..\..\DataModule\ImprimirDM.dfm */
/* ..\..\..\Buscar\Capitulo\Form\BuscarCapituloF.dfm */
/* ..\form\CapituloF.dfm */
/* D:\Projects\DeGsoft\GeN\ABM\Capitulo\Project\Capitulo.res */
/* D:\Projects\DeGsoft\GeN\ABM\Capitulo\Project\Capitulo.drf */

Двоичные данные
ABM/Capitulo/Project/Capitulo.identcache Normal file

Двоичный файл не отображается.

Двоичные данные
ABM/Capitulo/Project/Capitulo.res Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,17 @@
program Capitulo;
uses
Forms,
CapituloF in '..\Form\CapituloF.pas' {CapituloForm},
DataModule in '..\..\..\DataModule\DataModule.pas' {DM: TDataModule},
BuscarCapituloF in '..\..\..\Buscar\Capitulo\Form\BuscarCapituloF.pas' {BuscarCapituloForm};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.Title := 'Capitulo Contable';
Application.CreateForm(TCapituloForm, CapituloForm);
Application.Run;
end.

Просмотреть файл

@ -0,0 +1,19 @@
program Capitulo;
uses
Forms,
CapituloF in '..\Form\CapituloF.pas' {CapituloForm},
DataModule in '..\..\..\DataModule\DataModule.pas' {DM: TDataModule},
BuscarCapituloF in '..\..\..\Buscar\Capitulo\Form\BuscarCapituloF.pas' {BuscarCapituloForm},
ImprimirDM in '..\..\..\DataModule\ImprimirDM.pas' {ImprimirDataModule: TDataModule};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.Title := 'Capitulo Contable';
Application.CreateForm(TCapituloForm, CapituloForm);
Application.CreateForm(TImprimirDataModule, ImprimirDataModule);
Application.Run;
end.

Двоичные данные
ABM/Categoria/Form/UFCategorias.dcu Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,142 @@
object FCategorias: TFCategorias
Left = 450
Top = 246
Caption = 'Categor'#237'as'
ClientHeight = 415
ClientWidth = 359
Color = clBlack
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
OnClose = FormClose
OnCreate = FormCreate
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object Panel1: TPanel
Left = 0
Top = 0
Width = 359
Height = 415
Align = alClient
Caption = 'Panel1'
TabOrder = 0
object Label1: TLabel
Left = 36
Top = 208
Width = 57
Height = 13
Caption = 'Categor'#237'a'
FocusControl = DBEdit1
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object DBEdit1: TDBEdit
Left = 99
Top = 208
Width = 227
Height = 21
DataField = 'DESCRIPCION'
DataSource = DS
TabOrder = 0
end
object DBGrid1: TDBGrid
Left = 36
Top = 66
Width = 290
Height = 124
DataSource = DS
ReadOnly = True
TabOrder = 1
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'MS Sans Serif'
TitleFont.Style = []
Columns = <
item
Expanded = False
FieldName = 'CODIGO'
Visible = True
end
item
Expanded = False
FieldName = 'DESCRIPCION'
Visible = True
end>
end
object DBNavigator1: TDBNavigator
Left = 36
Top = 242
Width = 290
Height = 50
DataSource = DS
Hints.Strings = (
'Primer registro'
'Registro anterior'
'Registro siguiente'
#218'ltimo registro'
'Insertar registro'
'Eliminar registro'
'Editar registro'
'Guardar cambios'
'Cancelar edici'#243'n'
'Refrescar datos')
ParentShowHint = False
ShowHint = True
TabOrder = 2
end
object BitBtn1: TBitBtn
Left = 139
Top = 305
Width = 80
Height = 50
Caption = 'Cerrar'
DoubleBuffered = True
Kind = bkOK
ParentDoubleBuffered = False
TabOrder = 3
OnClick = BitBtn1Click
end
end
object DS: TDataSource
DataSet = Tabla
Left = 67
Top = 350
end
object Tabla: TIBTable
Database = DM.BaseDatos
Transaction = DM.Transaccion
AfterCancel = TablaAfterCancel
AfterDelete = TablaAfterDelete
AfterPost = TablaAfterPost
FieldDefs = <
item
Name = 'CODIGO'
DataType = ftInteger
end
item
Name = 'DESCRIPCION'
DataType = ftWideString
Size = 255
end>
IndexDefs = <
item
Name = 'PK_Categoria'
Fields = 'CODIGO'
Options = [ixUnique]
end>
StoreDefs = True
TableName = 'Categoria'
Left = 35
Top = 350
end
end

Просмотреть файл

@ -0,0 +1,93 @@
//******************************************************************************
//* DeGsoft GeN *
//* =========== *
//* GeN(tm) : ERP Software (http://www.degsoft.com.ar/sistemas/GeN) *
//* Copyright (c) 2002-2011 by the Degsoft *
//* For more information visit: http://www.degsoft.com.ar *
//* This program is free software. You can redistribute it and/or modify *
//* it under the terms of the GNU General Public License as published by *
//* the Free Software Foundation; either version 3 of the License. *
//******************************************************************************
unit UFCategorias;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DataModule, StdCtrls, Buttons, ExtCtrls, DBCtrls, Grids, DBGrids, DB,
Mask, IBCustomDataSet, IBTable, OleCtrls, SHDocVw;
type
TFCategorias = class(TForm)
Panel1: TPanel;
Label1: TLabel;
DBEdit1: TDBEdit;
DBGrid1: TDBGrid;
DBNavigator1: TDBNavigator;
BitBtn1: TBitBtn;
DS: TDataSource;
Tabla: TIBTable;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure BitBtn1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure TablaAfterCancel(DataSet: TDataSet);
procedure TablaAfterDelete(DataSet: TDataSet);
procedure TablaAfterPost(DataSet: TDataSet);
private
{ Private declarations }
public
desc:string;
{ Public declarations }
end;
var
FCategorias: TFCategorias;
implementation
{$R *.dfm}
procedure TFCategorias.FormCreate(Sender: TObject);
begin
DM:=TDM.Create(Self);
Tabla.Active:=true;
end;
procedure TFCategorias.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Tabla.Active:=false;
end;
procedure TFCategorias.BitBtn1Click(Sender: TObject);
begin
desc := DBEdit1.Text;
If (Tabla.State = dsEdit) or (Tabla.State = dsInsert) then If DBEdit1.Text <> '' then
begin
Tabla.Post;
end;
Close;
end;
procedure TFCategorias.FormShow(Sender: TObject);
begin
Tabla.Insert;
end;
procedure TFCategorias.TablaAfterCancel(DataSet: TDataSet);
begin
Tabla.Transaction.RollbackRetaining;
end;
procedure TFCategorias.TablaAfterDelete(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFCategorias.TablaAfterPost(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
end.

Просмотреть файл

@ -0,0 +1,117 @@
object FCategorias: TFCategorias
Left = 450
Top = 246
Caption = 'Categor'#237'as'
ClientHeight = 415
ClientWidth = 359
Color = clBlack
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
OnClose = FormClose
OnCreate = FormCreate
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object Panel1: TPanel
Left = 0
Top = 0
Width = 359
Height = 415
Align = alClient
Caption = 'Panel1'
TabOrder = 0
ExplicitLeft = 206
ExplicitWidth = 364
ExplicitHeight = 566
object Label1: TLabel
Left = 36
Top = 208
Width = 57
Height = 13
Caption = 'Categor'#237'a'
FocusControl = DBEdit1
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object DBEdit1: TDBEdit
Left = 99
Top = 208
Width = 227
Height = 21
DataField = 'Categoria'
DataSource = DS
TabOrder = 0
end
object DBGrid1: TDBGrid
Left = 36
Top = 66
Width = 290
Height = 124
DataSource = DS
ReadOnly = True
TabOrder = 1
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'MS Sans Serif'
TitleFont.Style = []
end
object DBNavigator1: TDBNavigator
Left = 36
Top = 242
Width = 290
Height = 50
DataSource = DS
Hints.Strings = (
'Primer registro'
'Registro anterior'
'Registro siguiente'
#218'ltimo registro'
'Insertar registro'
'Eliminar registro'
'Editar registro'
'Guardar cambios'
'Cancelar edici'#243'n'
'Refrescar datos')
ParentShowHint = False
ShowHint = True
TabOrder = 2
end
object BitBtn1: TBitBtn
Left = 139
Top = 305
Width = 80
Height = 50
Caption = 'Cerrar'
DoubleBuffered = True
Kind = bkOK
ParentDoubleBuffered = False
TabOrder = 3
OnClick = BitBtn1Click
end
end
object DS: TDataSource
DataSet = Tabla
Left = 67
Top = 350
end
object Tabla: TIBTable
Database = DM.BaseDatos
Transaction = DM.Transaccion
AfterCancel = TablaAfterCancel
AfterDelete = TablaAfterDelete
AfterPost = TablaAfterPost
TableName = 'Categoria'
Left = 35
Top = 350
end
end

Просмотреть файл

@ -0,0 +1,143 @@
object FCategorias: TFCategorias
Left = 450
Top = 246
Caption = 'Categor'#237'as'
ClientHeight = 415
ClientWidth = 359
Color = clBlack
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
OnClose = FormClose
OnCreate = FormCreate
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object Panel1: TPanel
Left = 0
Top = 0
Width = 359
Height = 415
Align = alClient
Caption = 'Panel1'
TabOrder = 0
object Label1: TLabel
Left = 36
Top = 208
Width = 57
Height = 13
Caption = 'Categor'#237'a'
FocusControl = DBEdit1
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object DBEdit1: TDBEdit
Left = 99
Top = 208
Width = 227
Height = 21
DataField = 'DESCRIPCION'
DataSource = DS
TabOrder = 0
end
object DBGrid1: TDBGrid
Left = 36
Top = 66
Width = 290
Height = 124
DataSource = DS
ReadOnly = True
TabOrder = 1
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'MS Sans Serif'
TitleFont.Style = []
Columns = <
item
Expanded = False
FieldName = 'CODIGO'
Visible = True
end
item
Expanded = False
FieldName = 'DESCRIPCION'
Visible = True
end>
end
object DBNavigator1: TDBNavigator
Left = 36
Top = 242
Width = 290
Height = 50
DataSource = DS
Hints.Strings = (
'Primer registro'
'Registro anterior'
'Registro siguiente'
#218'ltimo registro'
'Insertar registro'
'Eliminar registro'
'Editar registro'
'Guardar cambios'
'Cancelar edici'#243'n'
'Refrescar datos')
ParentShowHint = False
ShowHint = True
TabOrder = 2
end
object BitBtn1: TBitBtn
Left = 139
Top = 305
Width = 80
Height = 50
Caption = 'Cerrar'
DoubleBuffered = True
Kind = bkOK
ParentDoubleBuffered = False
TabOrder = 3
OnClick = BitBtn1Click
end
end
object DS: TDataSource
DataSet = Tabla
Left = 67
Top = 350
end
object Tabla: TIBTable
Database = DM.BaseDatos
Transaction = DM.Transaccion
AfterCancel = TablaAfterCancel
AfterDelete = TablaAfterDelete
AfterPost = TablaAfterPost
Active = True
FieldDefs = <
item
Name = 'CODIGO'
DataType = ftInteger
end
item
Name = 'DESCRIPCION'
DataType = ftWideString
Size = 255
end>
IndexDefs = <
item
Name = 'PK_Categoria'
Fields = 'CODIGO'
Options = [ixUnique]
end>
StoreDefs = True
TableName = 'Categoria'
Left = 35
Top = 350
end
end

Просмотреть файл

@ -0,0 +1,82 @@
unit UFCategorias;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DataModule, StdCtrls, Buttons, ExtCtrls, DBCtrls, Grids, DBGrids, DB,
Mask, IBCustomDataSet, IBTable, OleCtrls, SHDocVw;
type
TFCategorias = class(TForm)
Panel1: TPanel;
Label1: TLabel;
DBEdit1: TDBEdit;
DBGrid1: TDBGrid;
DBNavigator1: TDBNavigator;
BitBtn1: TBitBtn;
DS: TDataSource;
Tabla: TIBTable;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure BitBtn1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure TablaAfterCancel(DataSet: TDataSet);
procedure TablaAfterDelete(DataSet: TDataSet);
procedure TablaAfterPost(DataSet: TDataSet);
private
{ Private declarations }
public
desc:string;
{ Public declarations }
end;
var
FCategorias: TFCategorias;
implementation
{$R *.dfm}
procedure TFCategorias.FormCreate(Sender: TObject);
begin
DM:=TDM.Create(Self);
Tabla.Active:=true;
end;
procedure TFCategorias.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Tabla.Active:=false;
end;
procedure TFCategorias.BitBtn1Click(Sender: TObject);
begin
desc := DBEdit1.Text;
If (Tabla.State = dsEdit) or (Tabla.State = dsInsert) then If DBEdit1.Text <> '' then
begin
Tabla.Post;
end;
Close;
end;
procedure TFCategorias.FormShow(Sender: TObject);
begin
Tabla.Insert;
end;
procedure TFCategorias.TablaAfterCancel(DataSet: TDataSet);
begin
Tabla.Transaction.RollbackRetaining;
end;
procedure TFCategorias.TablaAfterDelete(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFCategorias.TablaAfterPost(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
end.

Просмотреть файл

@ -0,0 +1,16 @@
program Categoria;
uses
Forms,
DataModule in '..\..\..\DataModule\DataModule.pas' {DM: TDataModule},
UFCategorias in '..\Form\UFCategorias.pas' {FCategorias};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.Title := 'Categoría';
Application.CreateForm(TFCategorias, FCategorias);
Application.Run;
end.

Просмотреть файл

@ -0,0 +1,118 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{99BCD845-F81D-4156-B1DA-6F8A59161ED3}</ProjectGuid>
<ProjectVersion>12.0</ProjectVersion>
<MainSource>Categoria.dpr</MainSource>
<Config Condition="'$(Config)'==''">Debug</Config>
<DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_ExeOutput>\DeGsoft\GeN\</DCC_ExeOutput>
<DCC_DependencyCheckOutputName>F:\DeGsoft\GeN\Categoria.exe</DCC_DependencyCheckOutputName>
<DCC_ImageBase>00400000</DCC_ImageBase>
<DCC_UnitAlias>WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;$(DCC_UnitAlias)</DCC_UnitAlias>
<UsePackages>true</UsePackages>
<DCC_Platform>x86</DCC_Platform>
<DCC_K>false</DCC_K>
<DCC_N>false</DCC_N>
<DCC_S>false</DCC_S>
<DCC_UsePackage>vclx;vcl;vclimg;dbrtl;Rave77VCL;bdertl;rtl;vclactnband;xmlrtl;vcldb;vcldbx;vcltouch;dsnap;dsnapcon;TeeUI;TeeDB;Tee;vclib;ibxpress;adortl;IndyCore;IndySystem;IndyProtocols;inet;intrawebdb_100_140;Intraweb_100_140;VclSmp;vclie;websnap;webdsnap;inetdb;inetdbbde;inetdbxpress;soaprtl;vclribbon;dbexpress;DbxCommonDriver;DataSnapIndy10ServerTransport;DataSnapProviderClient;DbxClientDriver;DataSnapServer;DBXInterBaseDriver;DBXMySQLDriver;dbxcds;DBXFirebirdDriver;DBXSybaseASEDriver;DBXSybaseASADriver;DBXOracleDriver;DBXMSSQLDriver;DBXInformixDriver;DBXDb2Driver</DCC_UsePackage>
<DCC_E>false</DCC_E>
<DCC_F>false</DCC_F>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_DebugInformation>false</DCC_DebugInformation>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="Categoria.dpr">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="..\..\..\DataModule\DataModule.pas">
<Form>DM</Form>
<DesignClass>TDataModule</DesignClass>
</DCCReference>
<DCCReference Include="..\Form\UFCategorias.pas">
<Form>FCategorias</Form>
</DCCReference>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Debug">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Release">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
<ProjectExtensions>
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
<Borland.ProjectType/>
<BorlandProject>
<Delphi.Personality>
<Parameters>
<Parameters Name="UseLauncher">False</Parameters>
<Parameters Name="LoadAllSymbols">True</Parameters>
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
</Parameters>
<VersionInfo>
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">0</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
<VersionInfo Name="Private">False</VersionInfo>
<VersionInfo Name="DLL">False</VersionInfo>
<VersionInfo Name="Locale">3082</VersionInfo>
<VersionInfo Name="CodePage">1252</VersionInfo>
</VersionInfo>
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"/>
<VersionInfoKeys Name="FileDescription"/>
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"/>
<VersionInfoKeys Name="LegalCopyright"/>
<VersionInfoKeys Name="LegalTrademarks"/>
<VersionInfoKeys Name="OriginalFilename"/>
<VersionInfoKeys Name="ProductName"/>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"/>
</VersionInfoKeys>
<Source>
<Source Name="MainSource">Categoria.dpr</Source>
</Source>
<Excluded_Packages>
<Excluded_Packages Name="$(BDS)\bin\bcboffice2k140.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages>
<Excluded_Packages Name="$(BDS)\bin\bcbofficexp140.bpl">Embarcadero C++Builder Office XP Servers Package</Excluded_Packages>
<Excluded_Packages Name="$(BDS)\bin\dcloffice2k140.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
</Project>

Просмотреть файл

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<BorlandProject>
<Transactions>
<Transaction>2010/06/24 18:58:52.500.dproj,D:\RAD Studio\Projects\Project1.dproj=D:\RAD Studio\Projects\DeGsoft\GeN\ABM\Categoria\Project\Categoria.dproj</Transaction>
<Transaction>2010/11/15 17:23:59.421.pas,F:\Projects\DeGsoft\GeN\ABM\Categoria\Form\UFCategorias.pas=F:\Projects\DeGsoft\GeN\ABM\Rubro\Form\RubroF.pas</Transaction>
<Transaction>2010/11/15 17:23:59.421.dfm,F:\Projects\DeGsoft\GeN\ABM\Categoria\Form\UFCategorias.dfm=F:\Projects\DeGsoft\GeN\ABM\Rubro\Form\RubroF.dfm</Transaction>
<Transaction>2010/11/15 17:26:26.031.pas,F:\Projects\DeGsoft\GeN\ABM\Rubro\Form\RubroF.pas=</Transaction>
<Transaction>2010/11/15 17:26:26.031.dfm,F:\Projects\DeGsoft\GeN\ABM\Rubro\Form\RubroF.dfm=</Transaction>
</Transactions>
<ProjectSortOrder AutoSort="-1" SortType="1"/>
</BorlandProject>

Просмотреть файл

@ -0,0 +1,18 @@
/* VER210
Generated by the CodeGear Delphi Pascal Compiler
because -GD or --drc was supplied to the compiler.
This file contains compiler-generated resources that
were bound to the executable.
If this file is empty, then no compiler-generated
resources were bound to the produced executable.
*/
STRINGTABLE
BEGIN
END
/* D:\Projects\DeGsoft\GeN\DataModule\DataModule.dfm */
/* D:\Projects\DeGsoft\GeN\ABM\Categoria\Form\UFCategorias.dfm */
/* D:\Projects\DeGsoft\GeN\ABM\Categoria\Project\Categoria.res */
/* D:\Projects\DeGsoft\GeN\ABM\Categoria\Project\Categoria.drf */

Двоичные данные
ABM/Categoria/Project/Categoria.identcache Normal file

Двоичный файл не отображается.

Двоичные данные
ABM/Categoria/Project/Categoria.res Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,16 @@
program Categoria;
uses
Forms,
UFCategorias in '..\Form\UFCategorias.pas' {FCategorias},
DataModule in '..\..\..\DataModule\DataModule.pas' {DM: TDataModule};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.Title := 'Categoría';
Application.CreateForm(TFCategorias, FCategorias);
Application.Run;
end.

Просмотреть файл

@ -0,0 +1,16 @@
program Categoria;
uses
Forms,
RubroF in '..\..\Rubro\Form\RubroF.pas' {FCategorias},
DataModule in '..\..\..\DataModule\DataModule.pas' {DM: TDataModule};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.Title := 'Categoría';
Application.CreateForm(TFCategorias, FCategorias);
Application.Run;
end.

Просмотреть файл

@ -0,0 +1,16 @@
program Categoria;
uses
Forms,
RubroF in '..\..\Rubro\Form\RubroF.pas' {RubroForm},
DataModule in '..\..\..\DataModule\DataModule.pas' {DM: TDataModule};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.Title := 'Categoría';
Application.CreateForm(TRubroForm, RubroForm);
Application.Run;
end.

Двоичные данные
ABM/Cliente/Form/UFClientes.dcu Normal file

Двоичный файл не отображается.

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,276 @@
//******************************************************************************
//* DeGsoft GeN *
//* =========== *
//* GeN(tm) : ERP Software (http://www.degsoft.com.ar/sistemas/GeN) *
//* Copyright (c) 2002-2011 by the Degsoft *
//* For more information visit: http://www.degsoft.com.ar *
//* This program is free software. You can redistribute it and/or modify *
//* it under the terms of the GNU General Public License as published by *
//* the Free Software Foundation; either version 3 of the License. *
//******************************************************************************
unit UFClientes;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DataModule, ExtCtrls, StdCtrls, Mask, DBCtrls, ComCtrls, DB, ADODB,
Buttons, RpCon, RpConDS, RpRave, RpDefine, RpBase, RpSystem, IBCustomDataSet,
IBQuery, IBStoredProc, IBTable, ImprimirDM, OleCtrls, SHDocVw;
type
TFClientes = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
DataSource: TDataSource;
DSUsuarios: TDataSource;
DBMemo1: TDBMemo;
Label2: TLabel;
Label3: TLabel;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
CodigoDBEdit: TDBEdit;
Label1: TLabel;
VendedorLabel: TLabel;
TabSheet3: TTabSheet;
Label15: TLabel;
CuentaDataSource: TDataSource;
Label24: TLabel;
DBEdit20: TDBEdit;
TabSheet4: TTabSheet;
Label19: TLabel;
DBEdit16: TDBEdit;
Label12: TLabel;
DBEdit13: TDBEdit;
DBEdit23: TDBEdit;
Label28: TLabel;
Label23: TLabel;
DBEdit19: TDBEdit;
DBEdit21: TDBEdit;
Label26: TLabel;
Label5: TLabel;
DBEdit5: TDBEdit;
Label21: TLabel;
Label22: TLabel;
Label10: TLabel;
DBEdit17: TDBEdit;
DBEdit11: TDBEdit;
DBEdit18: TDBEdit;
Label4: TLabel;
DBEdit9: TDBEdit;
TabSheet5: TTabSheet;
Label13: TLabel;
Label14: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label29: TLabel;
Label30: TLabel;
Label31: TLabel;
DBEdit14: TDBEdit;
DBEdit15: TDBEdit;
DBComboBox1: TDBComboBox;
DBEdit1: TDBEdit;
DBCheckBox1: TDBCheckBox;
DBEdit25: TDBEdit;
DBEdit26: TDBEdit;
VendedorDBEdit: TDBEdit;
VendedorBitBtn: TBitBtn;
Label25: TLabel;
DBEdit22: TDBEdit;
Label38: TLabel;
IVALabel: TLabel;
IVADBComboBox: TDBComboBox;
CuentaDBLookupComboBox: TDBLookupComboBox;
Label54: TLabel;
DBLookupComboBox3: TDBLookupComboBox;
DBLookupComboBox1: TDBLookupComboBox;
Label52: TLabel;
Label51: TLabel;
Label20: TLabel;
DBEdit4: TDBEdit;
Label9: TLabel;
DBEdit10: TDBEdit;
Label11: TLabel;
DBEdit12: TDBEdit;
Label6: TLabel;
DBEdit6: TDBEdit;
Label7: TLabel;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
Label8: TLabel;
Label27: TLabel;
DBEdit24: TDBEdit;
DBEdit27: TDBEdit;
Label32: TLabel;
GaranteDBEdit: TDBEdit;
Label33: TLabel;
BuscarGaranteBitBtn: TBitBtn;
GaranteLabel: TLabel;
Panel1: TPanel;
Label34: TLabel;
SiBitBtn: TBitBtn;
NoBitBtn: TBitBtn;
DBNavigator1: TDBNavigator;
ImprimirBitBtn: TBitBtn;
BuscarBitBtn: TBitBtn;
Tabla: TIBTable;
UsuarioT: TIBTable;
CuentaT: TIBTable;
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure FormShow(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure TablaAfterInsert(DataSet: TDataSet);
procedure VendedorBitBtnClick(Sender: TObject);
procedure IVADBComboBoxChange(Sender: TObject);
procedure BuscarGaranteBitBtnClick(Sender: TObject);
procedure BuscarBitBtnClick(Sender: TObject);
procedure SiBitBtnClick(Sender: TObject);
procedure NoBitBtnClick(Sender: TObject);
procedure ImprimirBitBtnClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure TablaAfterCancel(DataSet: TDataSet);
procedure TablaAfterDelete(DataSet: TDataSet);
procedure TablaAfterPost(DataSet: TDataSet);
private
{ Private declarations }
public
desc:string;
{ Public declarations }
end;
var
FClientes: TFClientes;
implementation
uses UFBuscaCliente, BuscarVendedor;
{$R *.dfm}
procedure TFClientes.SiBitBtnClick(Sender: TObject);
begin
desc:=CodigoDBEdit.text;
If (Tabla.State = dsEdit) or (Tabla.State = dsInsert) then Tabla.Post;
Close;
end;
procedure TFClientes.BuscarBitBtnClick(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
Tabla.Cancel;
FBuscaCliente:=TFBuscaCliente.Create(self);
try
FBuscaCliente.ShowModal;
finally
Tabla.Locate('CODIGO',(FBuscaCliente.Tabla.FieldByName('CODIGO').AsString),[]);
FBuscaCliente.Free;
end;
Tabla.Edit;
DBEdit2.SetFocus;
end;
procedure TFClientes.FormCreate(Sender: TObject);
begin
DM:=TDM.Create(Self);
UsuarioT.Open;
CuentaT.open;
Tabla.open;
Tabla.Insert;
end;
procedure TFClientes.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then { if it's an enter key }
begin
Key := #0; { eat enter key }
Perform(WM_NEXTDLGCTL, 0, 0); { move to next control }
end;
end;
procedure TFClientes.FormShow(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
DBEdit2.SetFocus;
end;
procedure TFClientes.ImprimirBitBtnClick(Sender: TObject);
begin
ImprimirDataModule:=TImprimirDataModule.Create(self);
ImprimirDataModule.SImpr('Select * From "Cliente" WHERE CODIGO='+CodigoDBEdit.Text, 'Clientes');
ImprimirDataModule.Free;
end;
procedure TFClientes.IVADBComboBoxChange(Sender: TObject);
begin
if IVADBComboBox.ItemIndex = 0 then IVALabel.Caption := 'Consumidor Final'
else if IVADBComboBox.ItemIndex = 1 then IVALabel.Caption := 'Responsable Monotributo'
else if IVADBComboBox.ItemIndex = 2 then IVALabel.Caption := 'Responsable Inscripto'
else if IVADBComboBox.ItemIndex = 3 then IVALabel.Caption := 'Exento'
else IVALabel.Caption := 'No Responsable';
end;
procedure TFClientes.NoBitBtnClick(Sender: TObject);
begin
Close;
end;
procedure TFClientes.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
IF Key = VK_F3 then VendedorBitBtn.Click;
IF Key = VK_F5 then BuscarBitBtn.Click;
end;
procedure TFClientes.BuscarGaranteBitBtnClick(Sender: TObject);
begin
FBuscaCliente:=TFBuscaCliente.Create(self);
try
FBuscaCliente.ShowModal;
finally
GaranteDBEdit.Text:= FBuscaCliente.Tabla.FieldByName('CODIGO').AsString;
GaranteLabel.Caption:= FBuscaCliente.Tabla.FieldByName('NOMBRE').AsString;
FBuscaCliente.Free;
end;
SiBitBtn.SetFocus;
end;
procedure TFClientes.TablaAfterCancel(DataSet: TDataSet);
begin
Tabla.Transaction.RollbackRetaining;
end;
procedure TFClientes.TablaAfterDelete(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFClientes.TablaAfterInsert(DataSet: TDataSet);
begin
Tabla.FieldByName('CtaNombre').AsString:='9';
Tabla.FieldByName('CtaTipo').AsString:='9';
Tabla.FieldByName('CtaAnticipo').AsString:='9';
VendedorDBEdit.Text :='0';
end;
procedure TFClientes.TablaAfterPost(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFClientes.VendedorBitBtnClick(Sender: TObject);
begin
BuscarVendedorForm:=TBuscarVendedorForm.Create(self);
try
BuscarVendedorForm.ShowModal;
finally
VendedorDBEdit.Text:= BuscarVendedorForm.Tabla.FieldByName('Codigo').AsString;
VendedorLabel.Caption:= BuscarVendedorForm.Tabla.FieldByName('Nombre').AsString;
BuscarVendedorForm.Free;
end;
end;
end.

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,270 @@
unit UFClientes;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DataModule, ExtCtrls, StdCtrls, Mask, DBCtrls, ComCtrls, DB, ADODB,
Buttons, RpCon, RpConDS, RpRave, RpDefine, RpBase, RpSystem, IBCustomDataSet,
IBQuery, IBStoredProc, IBTable, ImprimirDM, OleCtrls, SHDocVw;
type
TFClientes = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
DataSource: TDataSource;
DSUsuarios: TDataSource;
DBMemo1: TDBMemo;
Label2: TLabel;
Label3: TLabel;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
CodigoDBEdit: TDBEdit;
Label1: TLabel;
VendedorLabel: TLabel;
TabSheet3: TTabSheet;
Label15: TLabel;
CuentaDataSource: TDataSource;
Label24: TLabel;
DBEdit20: TDBEdit;
TabSheet4: TTabSheet;
Label19: TLabel;
DBEdit16: TDBEdit;
Label12: TLabel;
DBEdit13: TDBEdit;
DBEdit23: TDBEdit;
Label28: TLabel;
Label23: TLabel;
DBEdit19: TDBEdit;
DBEdit21: TDBEdit;
Label26: TLabel;
Label5: TLabel;
DBEdit5: TDBEdit;
Label21: TLabel;
Label22: TLabel;
Label10: TLabel;
DBEdit17: TDBEdit;
DBEdit11: TDBEdit;
DBEdit18: TDBEdit;
Label4: TLabel;
DBEdit9: TDBEdit;
TabSheet5: TTabSheet;
Label13: TLabel;
Label14: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label29: TLabel;
Label30: TLabel;
Label31: TLabel;
DBEdit14: TDBEdit;
DBEdit15: TDBEdit;
DBComboBox1: TDBComboBox;
DBEdit1: TDBEdit;
DBCheckBox1: TDBCheckBox;
DBEdit25: TDBEdit;
DBEdit26: TDBEdit;
VendedorDBEdit: TDBEdit;
VendedorBitBtn: TBitBtn;
Label25: TLabel;
DBEdit22: TDBEdit;
Label38: TLabel;
IVALabel: TLabel;
IVADBComboBox: TDBComboBox;
CuentaDBLookupComboBox: TDBLookupComboBox;
Label54: TLabel;
DBLookupComboBox3: TDBLookupComboBox;
DBLookupComboBox1: TDBLookupComboBox;
Label52: TLabel;
Label51: TLabel;
Label20: TLabel;
DBEdit4: TDBEdit;
Label9: TLabel;
DBEdit10: TDBEdit;
Label11: TLabel;
DBEdit12: TDBEdit;
Label6: TLabel;
DBEdit6: TDBEdit;
Label7: TLabel;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
Label8: TLabel;
Label27: TLabel;
DBEdit24: TDBEdit;
DBEdit27: TDBEdit;
Label32: TLabel;
GaranteDBEdit: TDBEdit;
Label33: TLabel;
BuscarGaranteBitBtn: TBitBtn;
GaranteLabel: TLabel;
Panel1: TPanel;
Label34: TLabel;
SiBitBtn: TBitBtn;
NoBitBtn: TBitBtn;
DBNavigator1: TDBNavigator;
ImprimirBitBtn: TBitBtn;
BuscarBitBtn: TBitBtn;
Tabla: TIBTable;
UsuarioT: TIBTable;
CuentaT: TIBTable;
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure FormShow(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure TablaAfterInsert(DataSet: TDataSet);
procedure VendedorBitBtnClick(Sender: TObject);
procedure IVADBComboBoxChange(Sender: TObject);
procedure BuscarGaranteBitBtnClick(Sender: TObject);
procedure BuscarBitBtnClick(Sender: TObject);
procedure SiBitBtnClick(Sender: TObject);
procedure NoBitBtnClick(Sender: TObject);
procedure ImprimirBitBtnClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure TablaAfterCancel(DataSet: TDataSet);
procedure TablaAfterDelete(DataSet: TDataSet);
procedure TablaAfterPost(DataSet: TDataSet);
private
{ Private declarations }
public
desc:string;
{ Public declarations }
end;
var
FClientes: TFClientes;
implementation
uses UFBuscaCliente, BuscarVendedor;
{$R *.dfm}
procedure TFClientes.SiBitBtnClick(Sender: TObject);
begin
desc:=CodigoDBEdit.text;
If (Tabla.State = dsEdit) or (Tabla.State = dsInsert) then Tabla.Post;
Close;
end;
procedure TFClientes.BuscarBitBtnClick(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
Tabla.Cancel;
FBuscaCliente:=TFBuscaCliente.Create(self);
try
FBuscaCliente.ShowModal;
finally
Tabla.Locate('CODIGO',(FBuscaCliente.Tabla.FieldByName('CODIGO').AsString),[]);
FBuscaCliente.Free;
end;
Tabla.Edit;
DBEdit2.SetFocus;
end;
procedure TFClientes.FormCreate(Sender: TObject);
begin
DM:=TDM.Create(Self);
UsuarioT.Open;
CuentaT.open;
Tabla.open;
Tabla.Insert;
end;
procedure TFClientes.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then { if it's an enter key }
begin
Key := #0; { eat enter key }
Perform(WM_NEXTDLGCTL, 0, 0); { move to next control }
end;
end;
procedure TFClientes.FormShow(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
DBEdit2.SetFocus;
end;
procedure TFClientes.ImprimirBitBtnClick(Sender: TObject);
begin
with ImprimirDataModule do
begin
Query.SQL.Text:='Select "'+DM.ConfigQuery.FieldByName('Nombre').AsString+'" As Empresa, * From "Cliente" WHERE CODIGO='+CodigoDBEdit.Text;
Query.Open;
RvProject.ProjectFile:=Path+'Report\Clientes.rav';
RvProject.Execute;
Query.Close;
end;
end;
procedure TFClientes.IVADBComboBoxChange(Sender: TObject);
begin
if IVADBComboBox.ItemIndex = 0 then IVALabel.Caption := 'Consumidor Final'
else if IVADBComboBox.ItemIndex = 1 then IVALabel.Caption := 'Responsable Monotributo'
else if IVADBComboBox.ItemIndex = 2 then IVALabel.Caption := 'Responsable Inscripto'
else if IVADBComboBox.ItemIndex = 3 then IVALabel.Caption := 'Exento'
else IVALabel.Caption := 'No Responsable';
end;
procedure TFClientes.NoBitBtnClick(Sender: TObject);
begin
Close;
end;
procedure TFClientes.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
IF Key = VK_F3 then VendedorBitBtn.Click;
IF Key = VK_F5 then BuscarBitBtn.Click;
end;
procedure TFClientes.BuscarGaranteBitBtnClick(Sender: TObject);
begin
FBuscaCliente:=TFBuscaCliente.Create(self);
try
FBuscaCliente.ShowModal;
finally
GaranteDBEdit.Text:= FBuscaCliente.Tabla.FieldByName('CODIGO').AsString;
GaranteLabel.Caption:= FBuscaCliente.Tabla.FieldByName('NOMBRE').AsString;
FBuscaCliente.Free;
end;
SiBitBtn.SetFocus;
end;
procedure TFClientes.TablaAfterCancel(DataSet: TDataSet);
begin
Tabla.Transaction.RollbackRetaining;
end;
procedure TFClientes.TablaAfterDelete(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFClientes.TablaAfterInsert(DataSet: TDataSet);
begin
Tabla.FieldByName('CtaNombre').AsString:='9';
Tabla.FieldByName('CtaTipo').AsString:='9';
Tabla.FieldByName('CtaAnticipo').AsString:='9';
VendedorDBEdit.Text :='0';
end;
procedure TFClientes.TablaAfterPost(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFClientes.VendedorBitBtnClick(Sender: TObject);
begin
BuscarVendedorForm:=TBuscarVendedorForm.Create(self);
try
BuscarVendedorForm.ShowModal;
finally
VendedorDBEdit.Text:= BuscarVendedorForm.Tabla.FieldByName('Codigo').AsString;
VendedorLabel.Caption:= BuscarVendedorForm.Tabla.FieldByName('Nombre').AsString;
BuscarVendedorForm.Free;
end;
end;
end.

Просмотреть файл

@ -0,0 +1,265 @@
unit UFClientes;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DataModule, ExtCtrls, StdCtrls, Mask, DBCtrls, ComCtrls, DB, ADODB,
Buttons, RpCon, RpConDS, RpRave, RpDefine, RpBase, RpSystem, IBCustomDataSet,
IBQuery, IBStoredProc, IBTable, ImprimirDM, OleCtrls, SHDocVw;
type
TFClientes = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
DataSource: TDataSource;
DSUsuarios: TDataSource;
DBMemo1: TDBMemo;
Label2: TLabel;
Label3: TLabel;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
CodigoDBEdit: TDBEdit;
Label1: TLabel;
VendedorLabel: TLabel;
TabSheet3: TTabSheet;
Label15: TLabel;
CuentaDataSource: TDataSource;
Label24: TLabel;
DBEdit20: TDBEdit;
TabSheet4: TTabSheet;
Label19: TLabel;
DBEdit16: TDBEdit;
Label12: TLabel;
DBEdit13: TDBEdit;
DBEdit23: TDBEdit;
Label28: TLabel;
Label23: TLabel;
DBEdit19: TDBEdit;
DBEdit21: TDBEdit;
Label26: TLabel;
Label5: TLabel;
DBEdit5: TDBEdit;
Label21: TLabel;
Label22: TLabel;
Label10: TLabel;
DBEdit17: TDBEdit;
DBEdit11: TDBEdit;
DBEdit18: TDBEdit;
Label4: TLabel;
DBEdit9: TDBEdit;
TabSheet5: TTabSheet;
Label13: TLabel;
Label14: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label29: TLabel;
Label30: TLabel;
Label31: TLabel;
DBEdit14: TDBEdit;
DBEdit15: TDBEdit;
DBComboBox1: TDBComboBox;
DBEdit1: TDBEdit;
DBCheckBox1: TDBCheckBox;
DBEdit25: TDBEdit;
DBEdit26: TDBEdit;
VendedorDBEdit: TDBEdit;
VendedorBitBtn: TBitBtn;
Label25: TLabel;
DBEdit22: TDBEdit;
Label38: TLabel;
IVALabel: TLabel;
IVADBComboBox: TDBComboBox;
CuentaDBLookupComboBox: TDBLookupComboBox;
Label54: TLabel;
DBLookupComboBox3: TDBLookupComboBox;
DBLookupComboBox1: TDBLookupComboBox;
Label52: TLabel;
Label51: TLabel;
Label20: TLabel;
DBEdit4: TDBEdit;
Label9: TLabel;
DBEdit10: TDBEdit;
Label11: TLabel;
DBEdit12: TDBEdit;
Label6: TLabel;
DBEdit6: TDBEdit;
Label7: TLabel;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
Label8: TLabel;
Label27: TLabel;
DBEdit24: TDBEdit;
DBEdit27: TDBEdit;
Label32: TLabel;
GaranteDBEdit: TDBEdit;
Label33: TLabel;
BuscarGaranteBitBtn: TBitBtn;
GaranteLabel: TLabel;
Panel1: TPanel;
Label34: TLabel;
SiBitBtn: TBitBtn;
NoBitBtn: TBitBtn;
DBNavigator1: TDBNavigator;
ImprimirBitBtn: TBitBtn;
BuscarBitBtn: TBitBtn;
Tabla: TIBTable;
UsuarioT: TIBTable;
CuentaT: TIBTable;
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure FormShow(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure TablaAfterInsert(DataSet: TDataSet);
procedure VendedorBitBtnClick(Sender: TObject);
procedure IVADBComboBoxChange(Sender: TObject);
procedure BuscarGaranteBitBtnClick(Sender: TObject);
procedure BuscarBitBtnClick(Sender: TObject);
procedure SiBitBtnClick(Sender: TObject);
procedure NoBitBtnClick(Sender: TObject);
procedure ImprimirBitBtnClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure TablaAfterCancel(DataSet: TDataSet);
procedure TablaAfterDelete(DataSet: TDataSet);
procedure TablaAfterPost(DataSet: TDataSet);
private
{ Private declarations }
public
desc:string;
{ Public declarations }
end;
var
FClientes: TFClientes;
implementation
uses UFBuscaCliente, BuscarVendedor;
{$R *.dfm}
procedure TFClientes.SiBitBtnClick(Sender: TObject);
begin
desc:=CodigoDBEdit.text;
If (Tabla.State = dsEdit) or (Tabla.State = dsInsert) then Tabla.Post;
Close;
end;
procedure TFClientes.BuscarBitBtnClick(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
Tabla.Cancel;
FBuscaCliente:=TFBuscaCliente.Create(self);
try
FBuscaCliente.ShowModal;
finally
Tabla.Locate('CODIGO',(FBuscaCliente.Tabla.FieldByName('CODIGO').AsString),[]);
FBuscaCliente.Free;
end;
Tabla.Edit;
DBEdit2.SetFocus;
end;
procedure TFClientes.FormCreate(Sender: TObject);
begin
DM:=TDM.Create(Self);
UsuarioT.Open;
CuentaT.open;
Tabla.open;
Tabla.Insert;
end;
procedure TFClientes.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then { if it's an enter key }
begin
Key := #0; { eat enter key }
Perform(WM_NEXTDLGCTL, 0, 0); { move to next control }
end;
end;
procedure TFClientes.FormShow(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
DBEdit2.SetFocus;
end;
procedure TFClientes.ImprimirBitBtnClick(Sender: TObject);
begin
ImprimirDataModule:=TImprimirDataModule.Create(self);
ImprimirDataModule.SImpr('Select "'+DM.ConfigQuery.FieldByName('Nombre').AsString+'" As Empresa, * From "Cliente" WHERE CODIGO='+CodigoDBEdit.Text, 'Clientes.fr3');
ImprimirDataModule.Free;
end;
procedure TFClientes.IVADBComboBoxChange(Sender: TObject);
begin
if IVADBComboBox.ItemIndex = 0 then IVALabel.Caption := 'Consumidor Final'
else if IVADBComboBox.ItemIndex = 1 then IVALabel.Caption := 'Responsable Monotributo'
else if IVADBComboBox.ItemIndex = 2 then IVALabel.Caption := 'Responsable Inscripto'
else if IVADBComboBox.ItemIndex = 3 then IVALabel.Caption := 'Exento'
else IVALabel.Caption := 'No Responsable';
end;
procedure TFClientes.NoBitBtnClick(Sender: TObject);
begin
Close;
end;
procedure TFClientes.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
IF Key = VK_F3 then VendedorBitBtn.Click;
IF Key = VK_F5 then BuscarBitBtn.Click;
end;
procedure TFClientes.BuscarGaranteBitBtnClick(Sender: TObject);
begin
FBuscaCliente:=TFBuscaCliente.Create(self);
try
FBuscaCliente.ShowModal;
finally
GaranteDBEdit.Text:= FBuscaCliente.Tabla.FieldByName('CODIGO').AsString;
GaranteLabel.Caption:= FBuscaCliente.Tabla.FieldByName('NOMBRE').AsString;
FBuscaCliente.Free;
end;
SiBitBtn.SetFocus;
end;
procedure TFClientes.TablaAfterCancel(DataSet: TDataSet);
begin
Tabla.Transaction.RollbackRetaining;
end;
procedure TFClientes.TablaAfterDelete(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFClientes.TablaAfterInsert(DataSet: TDataSet);
begin
Tabla.FieldByName('CtaNombre').AsString:='9';
Tabla.FieldByName('CtaTipo').AsString:='9';
Tabla.FieldByName('CtaAnticipo').AsString:='9';
VendedorDBEdit.Text :='0';
end;
procedure TFClientes.TablaAfterPost(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFClientes.VendedorBitBtnClick(Sender: TObject);
begin
BuscarVendedorForm:=TBuscarVendedorForm.Create(self);
try
BuscarVendedorForm.ShowModal;
finally
VendedorDBEdit.Text:= BuscarVendedorForm.Tabla.FieldByName('Codigo').AsString;
VendedorLabel.Caption:= BuscarVendedorForm.Tabla.FieldByName('Nombre').AsString;
BuscarVendedorForm.Free;
end;
end;
end.

Просмотреть файл

@ -0,0 +1,265 @@
unit UFClientes;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DataModule, ExtCtrls, StdCtrls, Mask, DBCtrls, ComCtrls, DB, ADODB,
Buttons, RpCon, RpConDS, RpRave, RpDefine, RpBase, RpSystem, IBCustomDataSet,
IBQuery, IBStoredProc, IBTable, ImprimirDM, OleCtrls, SHDocVw;
type
TFClientes = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
DataSource: TDataSource;
DSUsuarios: TDataSource;
DBMemo1: TDBMemo;
Label2: TLabel;
Label3: TLabel;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
CodigoDBEdit: TDBEdit;
Label1: TLabel;
VendedorLabel: TLabel;
TabSheet3: TTabSheet;
Label15: TLabel;
CuentaDataSource: TDataSource;
Label24: TLabel;
DBEdit20: TDBEdit;
TabSheet4: TTabSheet;
Label19: TLabel;
DBEdit16: TDBEdit;
Label12: TLabel;
DBEdit13: TDBEdit;
DBEdit23: TDBEdit;
Label28: TLabel;
Label23: TLabel;
DBEdit19: TDBEdit;
DBEdit21: TDBEdit;
Label26: TLabel;
Label5: TLabel;
DBEdit5: TDBEdit;
Label21: TLabel;
Label22: TLabel;
Label10: TLabel;
DBEdit17: TDBEdit;
DBEdit11: TDBEdit;
DBEdit18: TDBEdit;
Label4: TLabel;
DBEdit9: TDBEdit;
TabSheet5: TTabSheet;
Label13: TLabel;
Label14: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label29: TLabel;
Label30: TLabel;
Label31: TLabel;
DBEdit14: TDBEdit;
DBEdit15: TDBEdit;
DBComboBox1: TDBComboBox;
DBEdit1: TDBEdit;
DBCheckBox1: TDBCheckBox;
DBEdit25: TDBEdit;
DBEdit26: TDBEdit;
VendedorDBEdit: TDBEdit;
VendedorBitBtn: TBitBtn;
Label25: TLabel;
DBEdit22: TDBEdit;
Label38: TLabel;
IVALabel: TLabel;
IVADBComboBox: TDBComboBox;
CuentaDBLookupComboBox: TDBLookupComboBox;
Label54: TLabel;
DBLookupComboBox3: TDBLookupComboBox;
DBLookupComboBox1: TDBLookupComboBox;
Label52: TLabel;
Label51: TLabel;
Label20: TLabel;
DBEdit4: TDBEdit;
Label9: TLabel;
DBEdit10: TDBEdit;
Label11: TLabel;
DBEdit12: TDBEdit;
Label6: TLabel;
DBEdit6: TDBEdit;
Label7: TLabel;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
Label8: TLabel;
Label27: TLabel;
DBEdit24: TDBEdit;
DBEdit27: TDBEdit;
Label32: TLabel;
GaranteDBEdit: TDBEdit;
Label33: TLabel;
BuscarGaranteBitBtn: TBitBtn;
GaranteLabel: TLabel;
Panel1: TPanel;
Label34: TLabel;
SiBitBtn: TBitBtn;
NoBitBtn: TBitBtn;
DBNavigator1: TDBNavigator;
ImprimirBitBtn: TBitBtn;
BuscarBitBtn: TBitBtn;
Tabla: TIBTable;
UsuarioT: TIBTable;
CuentaT: TIBTable;
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure FormShow(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure TablaAfterInsert(DataSet: TDataSet);
procedure VendedorBitBtnClick(Sender: TObject);
procedure IVADBComboBoxChange(Sender: TObject);
procedure BuscarGaranteBitBtnClick(Sender: TObject);
procedure BuscarBitBtnClick(Sender: TObject);
procedure SiBitBtnClick(Sender: TObject);
procedure NoBitBtnClick(Sender: TObject);
procedure ImprimirBitBtnClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure TablaAfterCancel(DataSet: TDataSet);
procedure TablaAfterDelete(DataSet: TDataSet);
procedure TablaAfterPost(DataSet: TDataSet);
private
{ Private declarations }
public
desc:string;
{ Public declarations }
end;
var
FClientes: TFClientes;
implementation
uses UFBuscaCliente, BuscarVendedor;
{$R *.dfm}
procedure TFClientes.SiBitBtnClick(Sender: TObject);
begin
desc:=CodigoDBEdit.text;
If (Tabla.State = dsEdit) or (Tabla.State = dsInsert) then Tabla.Post;
Close;
end;
procedure TFClientes.BuscarBitBtnClick(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
Tabla.Cancel;
FBuscaCliente:=TFBuscaCliente.Create(self);
try
FBuscaCliente.ShowModal;
finally
Tabla.Locate('CODIGO',(FBuscaCliente.Tabla.FieldByName('CODIGO').AsString),[]);
FBuscaCliente.Free;
end;
Tabla.Edit;
DBEdit2.SetFocus;
end;
procedure TFClientes.FormCreate(Sender: TObject);
begin
DM:=TDM.Create(Self);
UsuarioT.Open;
CuentaT.open;
Tabla.open;
Tabla.Insert;
end;
procedure TFClientes.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then { if it's an enter key }
begin
Key := #0; { eat enter key }
Perform(WM_NEXTDLGCTL, 0, 0); { move to next control }
end;
end;
procedure TFClientes.FormShow(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
DBEdit2.SetFocus;
end;
procedure TFClientes.ImprimirBitBtnClick(Sender: TObject);
begin
ImprimirDataModule:=TImprimirDataModule.Create(self);
ImprimirDataModule.SImpr('Select * From "Cliente" WHERE CODIGO='+CodigoDBEdit.Text, 'Clientes.fr3');
ImprimirDataModule.Free;
end;
procedure TFClientes.IVADBComboBoxChange(Sender: TObject);
begin
if IVADBComboBox.ItemIndex = 0 then IVALabel.Caption := 'Consumidor Final'
else if IVADBComboBox.ItemIndex = 1 then IVALabel.Caption := 'Responsable Monotributo'
else if IVADBComboBox.ItemIndex = 2 then IVALabel.Caption := 'Responsable Inscripto'
else if IVADBComboBox.ItemIndex = 3 then IVALabel.Caption := 'Exento'
else IVALabel.Caption := 'No Responsable';
end;
procedure TFClientes.NoBitBtnClick(Sender: TObject);
begin
Close;
end;
procedure TFClientes.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
IF Key = VK_F3 then VendedorBitBtn.Click;
IF Key = VK_F5 then BuscarBitBtn.Click;
end;
procedure TFClientes.BuscarGaranteBitBtnClick(Sender: TObject);
begin
FBuscaCliente:=TFBuscaCliente.Create(self);
try
FBuscaCliente.ShowModal;
finally
GaranteDBEdit.Text:= FBuscaCliente.Tabla.FieldByName('CODIGO').AsString;
GaranteLabel.Caption:= FBuscaCliente.Tabla.FieldByName('NOMBRE').AsString;
FBuscaCliente.Free;
end;
SiBitBtn.SetFocus;
end;
procedure TFClientes.TablaAfterCancel(DataSet: TDataSet);
begin
Tabla.Transaction.RollbackRetaining;
end;
procedure TFClientes.TablaAfterDelete(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFClientes.TablaAfterInsert(DataSet: TDataSet);
begin
Tabla.FieldByName('CtaNombre').AsString:='9';
Tabla.FieldByName('CtaTipo').AsString:='9';
Tabla.FieldByName('CtaAnticipo').AsString:='9';
VendedorDBEdit.Text :='0';
end;
procedure TFClientes.TablaAfterPost(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFClientes.VendedorBitBtnClick(Sender: TObject);
begin
BuscarVendedorForm:=TBuscarVendedorForm.Create(self);
try
BuscarVendedorForm.ShowModal;
finally
VendedorDBEdit.Text:= BuscarVendedorForm.Tabla.FieldByName('Codigo').AsString;
VendedorLabel.Caption:= BuscarVendedorForm.Tabla.FieldByName('Nombre').AsString;
BuscarVendedorForm.Free;
end;
end;
end.

Просмотреть файл

@ -0,0 +1,265 @@
unit UFClientes;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DataModule, ExtCtrls, StdCtrls, Mask, DBCtrls, ComCtrls, DB, ADODB,
Buttons, RpCon, RpConDS, RpRave, RpDefine, RpBase, RpSystem, IBCustomDataSet,
IBQuery, IBStoredProc, IBTable, ImprimirDM, OleCtrls, SHDocVw;
type
TFClientes = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
DataSource: TDataSource;
DSUsuarios: TDataSource;
DBMemo1: TDBMemo;
Label2: TLabel;
Label3: TLabel;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
CodigoDBEdit: TDBEdit;
Label1: TLabel;
VendedorLabel: TLabel;
TabSheet3: TTabSheet;
Label15: TLabel;
CuentaDataSource: TDataSource;
Label24: TLabel;
DBEdit20: TDBEdit;
TabSheet4: TTabSheet;
Label19: TLabel;
DBEdit16: TDBEdit;
Label12: TLabel;
DBEdit13: TDBEdit;
DBEdit23: TDBEdit;
Label28: TLabel;
Label23: TLabel;
DBEdit19: TDBEdit;
DBEdit21: TDBEdit;
Label26: TLabel;
Label5: TLabel;
DBEdit5: TDBEdit;
Label21: TLabel;
Label22: TLabel;
Label10: TLabel;
DBEdit17: TDBEdit;
DBEdit11: TDBEdit;
DBEdit18: TDBEdit;
Label4: TLabel;
DBEdit9: TDBEdit;
TabSheet5: TTabSheet;
Label13: TLabel;
Label14: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label29: TLabel;
Label30: TLabel;
Label31: TLabel;
DBEdit14: TDBEdit;
DBEdit15: TDBEdit;
DBComboBox1: TDBComboBox;
DBEdit1: TDBEdit;
DBCheckBox1: TDBCheckBox;
DBEdit25: TDBEdit;
DBEdit26: TDBEdit;
VendedorDBEdit: TDBEdit;
VendedorBitBtn: TBitBtn;
Label25: TLabel;
DBEdit22: TDBEdit;
Label38: TLabel;
IVALabel: TLabel;
IVADBComboBox: TDBComboBox;
CuentaDBLookupComboBox: TDBLookupComboBox;
Label54: TLabel;
DBLookupComboBox3: TDBLookupComboBox;
DBLookupComboBox1: TDBLookupComboBox;
Label52: TLabel;
Label51: TLabel;
Label20: TLabel;
DBEdit4: TDBEdit;
Label9: TLabel;
DBEdit10: TDBEdit;
Label11: TLabel;
DBEdit12: TDBEdit;
Label6: TLabel;
DBEdit6: TDBEdit;
Label7: TLabel;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
Label8: TLabel;
Label27: TLabel;
DBEdit24: TDBEdit;
DBEdit27: TDBEdit;
Label32: TLabel;
GaranteDBEdit: TDBEdit;
Label33: TLabel;
BuscarGaranteBitBtn: TBitBtn;
GaranteLabel: TLabel;
Panel1: TPanel;
Label34: TLabel;
SiBitBtn: TBitBtn;
NoBitBtn: TBitBtn;
DBNavigator1: TDBNavigator;
ImprimirBitBtn: TBitBtn;
BuscarBitBtn: TBitBtn;
Tabla: TIBTable;
UsuarioT: TIBTable;
CuentaT: TIBTable;
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure FormShow(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure TablaAfterInsert(DataSet: TDataSet);
procedure VendedorBitBtnClick(Sender: TObject);
procedure IVADBComboBoxChange(Sender: TObject);
procedure BuscarGaranteBitBtnClick(Sender: TObject);
procedure BuscarBitBtnClick(Sender: TObject);
procedure SiBitBtnClick(Sender: TObject);
procedure NoBitBtnClick(Sender: TObject);
procedure ImprimirBitBtnClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure TablaAfterCancel(DataSet: TDataSet);
procedure TablaAfterDelete(DataSet: TDataSet);
procedure TablaAfterPost(DataSet: TDataSet);
private
{ Private declarations }
public
desc:string;
{ Public declarations }
end;
var
FClientes: TFClientes;
implementation
uses UFBuscaCliente, BuscarVendedor;
{$R *.dfm}
procedure TFClientes.SiBitBtnClick(Sender: TObject);
begin
desc:=CodigoDBEdit.text;
If (Tabla.State = dsEdit) or (Tabla.State = dsInsert) then Tabla.Post;
Close;
end;
procedure TFClientes.BuscarBitBtnClick(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
Tabla.Cancel;
FBuscaCliente:=TFBuscaCliente.Create(self);
try
FBuscaCliente.ShowModal;
finally
Tabla.Locate('CODIGO',(FBuscaCliente.Tabla.FieldByName('CODIGO').AsString),[]);
FBuscaCliente.Free;
end;
Tabla.Edit;
DBEdit2.SetFocus;
end;
procedure TFClientes.FormCreate(Sender: TObject);
begin
DM:=TDM.Create(Self);
UsuarioT.Open;
CuentaT.open;
Tabla.open;
Tabla.Insert;
end;
procedure TFClientes.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then { if it's an enter key }
begin
Key := #0; { eat enter key }
Perform(WM_NEXTDLGCTL, 0, 0); { move to next control }
end;
end;
procedure TFClientes.FormShow(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
DBEdit2.SetFocus;
end;
procedure TFClientes.ImprimirBitBtnClick(Sender: TObject);
begin
ImprimirDataModule:=TImprimirDataModule.Create(self);
ImprimirDataModule.SImpr('Select * From "Cliente" WHERE CODIGO='+CodigoDBEdit.Text, 'ClientesDetalle.fr3');
ImprimirDataModule.Free;
end;
procedure TFClientes.IVADBComboBoxChange(Sender: TObject);
begin
if IVADBComboBox.ItemIndex = 0 then IVALabel.Caption := 'Consumidor Final'
else if IVADBComboBox.ItemIndex = 1 then IVALabel.Caption := 'Responsable Monotributo'
else if IVADBComboBox.ItemIndex = 2 then IVALabel.Caption := 'Responsable Inscripto'
else if IVADBComboBox.ItemIndex = 3 then IVALabel.Caption := 'Exento'
else IVALabel.Caption := 'No Responsable';
end;
procedure TFClientes.NoBitBtnClick(Sender: TObject);
begin
Close;
end;
procedure TFClientes.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
IF Key = VK_F3 then VendedorBitBtn.Click;
IF Key = VK_F5 then BuscarBitBtn.Click;
end;
procedure TFClientes.BuscarGaranteBitBtnClick(Sender: TObject);
begin
FBuscaCliente:=TFBuscaCliente.Create(self);
try
FBuscaCliente.ShowModal;
finally
GaranteDBEdit.Text:= FBuscaCliente.Tabla.FieldByName('CODIGO').AsString;
GaranteLabel.Caption:= FBuscaCliente.Tabla.FieldByName('NOMBRE').AsString;
FBuscaCliente.Free;
end;
SiBitBtn.SetFocus;
end;
procedure TFClientes.TablaAfterCancel(DataSet: TDataSet);
begin
Tabla.Transaction.RollbackRetaining;
end;
procedure TFClientes.TablaAfterDelete(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFClientes.TablaAfterInsert(DataSet: TDataSet);
begin
Tabla.FieldByName('CtaNombre').AsString:='9';
Tabla.FieldByName('CtaTipo').AsString:='9';
Tabla.FieldByName('CtaAnticipo').AsString:='9';
VendedorDBEdit.Text :='0';
end;
procedure TFClientes.TablaAfterPost(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFClientes.VendedorBitBtnClick(Sender: TObject);
begin
BuscarVendedorForm:=TBuscarVendedorForm.Create(self);
try
BuscarVendedorForm.ShowModal;
finally
VendedorDBEdit.Text:= BuscarVendedorForm.Tabla.FieldByName('Codigo').AsString;
VendedorLabel.Caption:= BuscarVendedorForm.Tabla.FieldByName('Nombre').AsString;
BuscarVendedorForm.Free;
end;
end;
end.

Просмотреть файл

@ -0,0 +1,265 @@
unit UFClientes;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DataModule, ExtCtrls, StdCtrls, Mask, DBCtrls, ComCtrls, DB, ADODB,
Buttons, RpCon, RpConDS, RpRave, RpDefine, RpBase, RpSystem, IBCustomDataSet,
IBQuery, IBStoredProc, IBTable, ImprimirDM, OleCtrls, SHDocVw;
type
TFClientes = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
DataSource: TDataSource;
DSUsuarios: TDataSource;
DBMemo1: TDBMemo;
Label2: TLabel;
Label3: TLabel;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
CodigoDBEdit: TDBEdit;
Label1: TLabel;
VendedorLabel: TLabel;
TabSheet3: TTabSheet;
Label15: TLabel;
CuentaDataSource: TDataSource;
Label24: TLabel;
DBEdit20: TDBEdit;
TabSheet4: TTabSheet;
Label19: TLabel;
DBEdit16: TDBEdit;
Label12: TLabel;
DBEdit13: TDBEdit;
DBEdit23: TDBEdit;
Label28: TLabel;
Label23: TLabel;
DBEdit19: TDBEdit;
DBEdit21: TDBEdit;
Label26: TLabel;
Label5: TLabel;
DBEdit5: TDBEdit;
Label21: TLabel;
Label22: TLabel;
Label10: TLabel;
DBEdit17: TDBEdit;
DBEdit11: TDBEdit;
DBEdit18: TDBEdit;
Label4: TLabel;
DBEdit9: TDBEdit;
TabSheet5: TTabSheet;
Label13: TLabel;
Label14: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label29: TLabel;
Label30: TLabel;
Label31: TLabel;
DBEdit14: TDBEdit;
DBEdit15: TDBEdit;
DBComboBox1: TDBComboBox;
DBEdit1: TDBEdit;
DBCheckBox1: TDBCheckBox;
DBEdit25: TDBEdit;
DBEdit26: TDBEdit;
VendedorDBEdit: TDBEdit;
VendedorBitBtn: TBitBtn;
Label25: TLabel;
DBEdit22: TDBEdit;
Label38: TLabel;
IVALabel: TLabel;
IVADBComboBox: TDBComboBox;
CuentaDBLookupComboBox: TDBLookupComboBox;
Label54: TLabel;
DBLookupComboBox3: TDBLookupComboBox;
DBLookupComboBox1: TDBLookupComboBox;
Label52: TLabel;
Label51: TLabel;
Label20: TLabel;
DBEdit4: TDBEdit;
Label9: TLabel;
DBEdit10: TDBEdit;
Label11: TLabel;
DBEdit12: TDBEdit;
Label6: TLabel;
DBEdit6: TDBEdit;
Label7: TLabel;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
Label8: TLabel;
Label27: TLabel;
DBEdit24: TDBEdit;
DBEdit27: TDBEdit;
Label32: TLabel;
GaranteDBEdit: TDBEdit;
Label33: TLabel;
BuscarGaranteBitBtn: TBitBtn;
GaranteLabel: TLabel;
Panel1: TPanel;
Label34: TLabel;
SiBitBtn: TBitBtn;
NoBitBtn: TBitBtn;
DBNavigator1: TDBNavigator;
ImprimirBitBtn: TBitBtn;
BuscarBitBtn: TBitBtn;
Tabla: TIBTable;
UsuarioT: TIBTable;
CuentaT: TIBTable;
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure FormShow(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure TablaAfterInsert(DataSet: TDataSet);
procedure VendedorBitBtnClick(Sender: TObject);
procedure IVADBComboBoxChange(Sender: TObject);
procedure BuscarGaranteBitBtnClick(Sender: TObject);
procedure BuscarBitBtnClick(Sender: TObject);
procedure SiBitBtnClick(Sender: TObject);
procedure NoBitBtnClick(Sender: TObject);
procedure ImprimirBitBtnClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure TablaAfterCancel(DataSet: TDataSet);
procedure TablaAfterDelete(DataSet: TDataSet);
procedure TablaAfterPost(DataSet: TDataSet);
private
{ Private declarations }
public
desc:string;
{ Public declarations }
end;
var
FClientes: TFClientes;
implementation
uses UFBuscaCliente, BuscarVendedor;
{$R *.dfm}
procedure TFClientes.SiBitBtnClick(Sender: TObject);
begin
desc:=CodigoDBEdit.text;
If (Tabla.State = dsEdit) or (Tabla.State = dsInsert) then Tabla.Post;
Close;
end;
procedure TFClientes.BuscarBitBtnClick(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
Tabla.Cancel;
FBuscaCliente:=TFBuscaCliente.Create(self);
try
FBuscaCliente.ShowModal;
finally
Tabla.Locate('CODIGO',(FBuscaCliente.Tabla.FieldByName('CODIGO').AsString),[]);
FBuscaCliente.Free;
end;
Tabla.Edit;
DBEdit2.SetFocus;
end;
procedure TFClientes.FormCreate(Sender: TObject);
begin
DM:=TDM.Create(Self);
UsuarioT.Open;
CuentaT.open;
Tabla.open;
Tabla.Insert;
end;
procedure TFClientes.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then { if it's an enter key }
begin
Key := #0; { eat enter key }
Perform(WM_NEXTDLGCTL, 0, 0); { move to next control }
end;
end;
procedure TFClientes.FormShow(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
DBEdit2.SetFocus;
end;
procedure TFClientes.ImprimirBitBtnClick(Sender: TObject);
begin
ImprimirDataModule:=TImprimirDataModule.Create(self);
ImprimirDataModule.SImpr('Select * From "Cliente" WHERE CODIGO='+CodigoDBEdit.Text, 'Clientes.fr3');
ImprimirDataModule.Free;
end;
procedure TFClientes.IVADBComboBoxChange(Sender: TObject);
begin
if IVADBComboBox.ItemIndex = 0 then IVALabel.Caption := 'Consumidor Final'
else if IVADBComboBox.ItemIndex = 1 then IVALabel.Caption := 'Responsable Monotributo'
else if IVADBComboBox.ItemIndex = 2 then IVALabel.Caption := 'Responsable Inscripto'
else if IVADBComboBox.ItemIndex = 3 then IVALabel.Caption := 'Exento'
else IVALabel.Caption := 'No Responsable';
end;
procedure TFClientes.NoBitBtnClick(Sender: TObject);
begin
Close;
end;
procedure TFClientes.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
IF Key = VK_F3 then VendedorBitBtn.Click;
IF Key = VK_F5 then BuscarBitBtn.Click;
end;
procedure TFClientes.BuscarGaranteBitBtnClick(Sender: TObject);
begin
FBuscaCliente:=TFBuscaCliente.Create(self);
try
FBuscaCliente.ShowModal;
finally
GaranteDBEdit.Text:= FBuscaCliente.Tabla.FieldByName('CODIGO').AsString;
GaranteLabel.Caption:= FBuscaCliente.Tabla.FieldByName('NOMBRE').AsString;
FBuscaCliente.Free;
end;
SiBitBtn.SetFocus;
end;
procedure TFClientes.TablaAfterCancel(DataSet: TDataSet);
begin
Tabla.Transaction.RollbackRetaining;
end;
procedure TFClientes.TablaAfterDelete(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFClientes.TablaAfterInsert(DataSet: TDataSet);
begin
Tabla.FieldByName('CtaNombre').AsString:='9';
Tabla.FieldByName('CtaTipo').AsString:='9';
Tabla.FieldByName('CtaAnticipo').AsString:='9';
VendedorDBEdit.Text :='0';
end;
procedure TFClientes.TablaAfterPost(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFClientes.VendedorBitBtnClick(Sender: TObject);
begin
BuscarVendedorForm:=TBuscarVendedorForm.Create(self);
try
BuscarVendedorForm.ShowModal;
finally
VendedorDBEdit.Text:= BuscarVendedorForm.Tabla.FieldByName('Codigo').AsString;
VendedorLabel.Caption:= BuscarVendedorForm.Tabla.FieldByName('Nombre').AsString;
BuscarVendedorForm.Free;
end;
end;
end.

Просмотреть файл

@ -0,0 +1,265 @@
unit UFClientes;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DataModule, ExtCtrls, StdCtrls, Mask, DBCtrls, ComCtrls, DB, ADODB,
Buttons, RpCon, RpConDS, RpRave, RpDefine, RpBase, RpSystem, IBCustomDataSet,
IBQuery, IBStoredProc, IBTable, ImprimirDM, OleCtrls, SHDocVw;
type
TFClientes = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
DataSource: TDataSource;
DSUsuarios: TDataSource;
DBMemo1: TDBMemo;
Label2: TLabel;
Label3: TLabel;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
CodigoDBEdit: TDBEdit;
Label1: TLabel;
VendedorLabel: TLabel;
TabSheet3: TTabSheet;
Label15: TLabel;
CuentaDataSource: TDataSource;
Label24: TLabel;
DBEdit20: TDBEdit;
TabSheet4: TTabSheet;
Label19: TLabel;
DBEdit16: TDBEdit;
Label12: TLabel;
DBEdit13: TDBEdit;
DBEdit23: TDBEdit;
Label28: TLabel;
Label23: TLabel;
DBEdit19: TDBEdit;
DBEdit21: TDBEdit;
Label26: TLabel;
Label5: TLabel;
DBEdit5: TDBEdit;
Label21: TLabel;
Label22: TLabel;
Label10: TLabel;
DBEdit17: TDBEdit;
DBEdit11: TDBEdit;
DBEdit18: TDBEdit;
Label4: TLabel;
DBEdit9: TDBEdit;
TabSheet5: TTabSheet;
Label13: TLabel;
Label14: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label29: TLabel;
Label30: TLabel;
Label31: TLabel;
DBEdit14: TDBEdit;
DBEdit15: TDBEdit;
DBComboBox1: TDBComboBox;
DBEdit1: TDBEdit;
DBCheckBox1: TDBCheckBox;
DBEdit25: TDBEdit;
DBEdit26: TDBEdit;
VendedorDBEdit: TDBEdit;
VendedorBitBtn: TBitBtn;
Label25: TLabel;
DBEdit22: TDBEdit;
Label38: TLabel;
IVALabel: TLabel;
IVADBComboBox: TDBComboBox;
CuentaDBLookupComboBox: TDBLookupComboBox;
Label54: TLabel;
DBLookupComboBox3: TDBLookupComboBox;
DBLookupComboBox1: TDBLookupComboBox;
Label52: TLabel;
Label51: TLabel;
Label20: TLabel;
DBEdit4: TDBEdit;
Label9: TLabel;
DBEdit10: TDBEdit;
Label11: TLabel;
DBEdit12: TDBEdit;
Label6: TLabel;
DBEdit6: TDBEdit;
Label7: TLabel;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
Label8: TLabel;
Label27: TLabel;
DBEdit24: TDBEdit;
DBEdit27: TDBEdit;
Label32: TLabel;
GaranteDBEdit: TDBEdit;
Label33: TLabel;
BuscarGaranteBitBtn: TBitBtn;
GaranteLabel: TLabel;
Panel1: TPanel;
Label34: TLabel;
SiBitBtn: TBitBtn;
NoBitBtn: TBitBtn;
DBNavigator1: TDBNavigator;
ImprimirBitBtn: TBitBtn;
BuscarBitBtn: TBitBtn;
Tabla: TIBTable;
UsuarioT: TIBTable;
CuentaT: TIBTable;
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure FormShow(Sender: TObject);
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure TablaAfterInsert(DataSet: TDataSet);
procedure VendedorBitBtnClick(Sender: TObject);
procedure IVADBComboBoxChange(Sender: TObject);
procedure BuscarGaranteBitBtnClick(Sender: TObject);
procedure BuscarBitBtnClick(Sender: TObject);
procedure SiBitBtnClick(Sender: TObject);
procedure NoBitBtnClick(Sender: TObject);
procedure ImprimirBitBtnClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure TablaAfterCancel(DataSet: TDataSet);
procedure TablaAfterDelete(DataSet: TDataSet);
procedure TablaAfterPost(DataSet: TDataSet);
private
{ Private declarations }
public
desc:string;
{ Public declarations }
end;
var
FClientes: TFClientes;
implementation
uses UFBuscaCliente, BuscarVendedor;
{$R *.dfm}
procedure TFClientes.SiBitBtnClick(Sender: TObject);
begin
desc:=CodigoDBEdit.text;
If (Tabla.State = dsEdit) or (Tabla.State = dsInsert) then Tabla.Post;
Close;
end;
procedure TFClientes.BuscarBitBtnClick(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
Tabla.Cancel;
FBuscaCliente:=TFBuscaCliente.Create(self);
try
FBuscaCliente.ShowModal;
finally
Tabla.Locate('CODIGO',(FBuscaCliente.Tabla.FieldByName('CODIGO').AsString),[]);
FBuscaCliente.Free;
end;
Tabla.Edit;
DBEdit2.SetFocus;
end;
procedure TFClientes.FormCreate(Sender: TObject);
begin
DM:=TDM.Create(Self);
UsuarioT.Open;
CuentaT.open;
Tabla.open;
Tabla.Insert;
end;
procedure TFClientes.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then { if it's an enter key }
begin
Key := #0; { eat enter key }
Perform(WM_NEXTDLGCTL, 0, 0); { move to next control }
end;
end;
procedure TFClientes.FormShow(Sender: TObject);
begin
TabSheet1.PageControl.ActivePageIndex:=0;
DBEdit2.SetFocus;
end;
procedure TFClientes.ImprimirBitBtnClick(Sender: TObject);
begin
ImprimirDataModule:=TImprimirDataModule.Create(self);
ImprimirDataModule.SImpr('Select * From "Cliente" WHERE CODIGO='+CodigoDBEdit.Text, 'Clientes');
ImprimirDataModule.Free;
end;
procedure TFClientes.IVADBComboBoxChange(Sender: TObject);
begin
if IVADBComboBox.ItemIndex = 0 then IVALabel.Caption := 'Consumidor Final'
else if IVADBComboBox.ItemIndex = 1 then IVALabel.Caption := 'Responsable Monotributo'
else if IVADBComboBox.ItemIndex = 2 then IVALabel.Caption := 'Responsable Inscripto'
else if IVADBComboBox.ItemIndex = 3 then IVALabel.Caption := 'Exento'
else IVALabel.Caption := 'No Responsable';
end;
procedure TFClientes.NoBitBtnClick(Sender: TObject);
begin
Close;
end;
procedure TFClientes.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
IF Key = VK_F3 then VendedorBitBtn.Click;
IF Key = VK_F5 then BuscarBitBtn.Click;
end;
procedure TFClientes.BuscarGaranteBitBtnClick(Sender: TObject);
begin
FBuscaCliente:=TFBuscaCliente.Create(self);
try
FBuscaCliente.ShowModal;
finally
GaranteDBEdit.Text:= FBuscaCliente.Tabla.FieldByName('CODIGO').AsString;
GaranteLabel.Caption:= FBuscaCliente.Tabla.FieldByName('NOMBRE').AsString;
FBuscaCliente.Free;
end;
SiBitBtn.SetFocus;
end;
procedure TFClientes.TablaAfterCancel(DataSet: TDataSet);
begin
Tabla.Transaction.RollbackRetaining;
end;
procedure TFClientes.TablaAfterDelete(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFClientes.TablaAfterInsert(DataSet: TDataSet);
begin
Tabla.FieldByName('CtaNombre').AsString:='9';
Tabla.FieldByName('CtaTipo').AsString:='9';
Tabla.FieldByName('CtaAnticipo').AsString:='9';
VendedorDBEdit.Text :='0';
end;
procedure TFClientes.TablaAfterPost(DataSet: TDataSet);
begin
Tabla.Transaction.CommitRetaining;
end;
procedure TFClientes.VendedorBitBtnClick(Sender: TObject);
begin
BuscarVendedorForm:=TBuscarVendedorForm.Create(self);
try
BuscarVendedorForm.ShowModal;
finally
VendedorDBEdit.Text:= BuscarVendedorForm.Tabla.FieldByName('Codigo').AsString;
VendedorLabel.Caption:= BuscarVendedorForm.Tabla.FieldByName('Nombre').AsString;
BuscarVendedorForm.Free;
end;
end;
end.

Просмотреть файл

@ -0,0 +1,19 @@
program Clientes;
uses
Forms,
UFClientes in '..\Form\UFClientes.pas' {FClientes},
DataModule in '..\..\..\DataModule\DataModule.pas' {DM: TDataModule},
UFBuscaCliente in '..\..\..\Buscar\Cliente\Form\UFBuscaCliente.pas' {FBuscaCliente},
BuscarVendedor in '..\..\..\Buscar\Vendedor\Form\BuscarVendedor.pas' {BuscarVendedorForm},
ImprimirDM in '..\..\..\DataModule\ImprimirDM.pas' {ImprimirDataModule: TDataModule};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.Title := 'Cliente';
Application.CreateForm(TFClientes, FClientes);
Application.Run;
end.

Просмотреть файл

@ -0,0 +1,123 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{80439061-9FAF-4192-AB42-C7F73695FF7F}</ProjectGuid>
<ProjectVersion>12.0</ProjectVersion>
<MainSource>Clientes.dpr</MainSource>
<Config Condition="'$(Config)'==''">Debug</Config>
<DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_ExeOutput>\DeGsoft\GeN\</DCC_ExeOutput>
<DCC_DependencyCheckOutputName>F:\DeGsoft\GeN\Clientes.exe</DCC_DependencyCheckOutputName>
<DCC_ImageBase>00400000</DCC_ImageBase>
<DCC_UnitAlias>WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;$(DCC_UnitAlias)</DCC_UnitAlias>
<UsePackages>true</UsePackages>
<DCC_Platform>x86</DCC_Platform>
<DCC_K>false</DCC_K>
<DCC_N>false</DCC_N>
<DCC_S>false</DCC_S>
<DCC_UsePackage>vclx;vcl;vclimg;dbrtl;Rave77VCL;bdertl;rtl;vclactnband;xmlrtl;vcldb;vcldbx;vcltouch;dsnap;dsnapcon;TeeUI;TeeDB;Tee;vclib;ibxpress;adortl;IndyCore;IndySystem;IndyProtocols;inet;intrawebdb_100_140;Intraweb_100_140;VclSmp;vclie;websnap;webdsnap;inetdb;inetdbbde;inetdbxpress;soaprtl;vclribbon;dbexpress;DbxCommonDriver;DataSnapIndy10ServerTransport;DataSnapProviderClient;DbxClientDriver;DataSnapServer;DBXInterBaseDriver;DBXMySQLDriver;dbxcds;DBXFirebirdDriver;DBXSybaseASEDriver;DBXSybaseASADriver;DBXOracleDriver;DBXMSSQLDriver;DBXInformixDriver;DBXDb2Driver</DCC_UsePackage>
<DCC_E>false</DCC_E>
<DCC_F>false</DCC_F>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_DebugInformation>false</DCC_DebugInformation>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="Clientes.dpr">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="..\Form\UFClientes.pas">
<Form>FClientes</Form>
</DCCReference>
<DCCReference Include="..\..\..\DataModule\DataModule.pas">
<Form>DM</Form>
<DesignClass>TDataModule</DesignClass>
</DCCReference>
<DCCReference Include="..\..\..\Buscar\Cliente\Form\UFBuscaCliente.pas">
<Form>FBuscaCliente</Form>
</DCCReference>
<DCCReference Include="..\..\..\Buscar\Vendedor\Form\BuscarVendedor.pas">
<Form>BuscarVendedorForm</Form>
</DCCReference>
<DCCReference Include="..\..\..\DataModule\ImprimirDM.pas">
<Form>ImprimirDataModule</Form>
<DesignClass>TDataModule</DesignClass>
</DCCReference>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Debug">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Release">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
<ProjectExtensions>
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
<Borland.ProjectType/>
<BorlandProject>
<Delphi.Personality>
<Parameters>
<Parameters Name="UseLauncher">False</Parameters>
<Parameters Name="LoadAllSymbols">True</Parameters>
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
</Parameters>
<VersionInfo>
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">0</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
<VersionInfo Name="Private">False</VersionInfo>
<VersionInfo Name="DLL">False</VersionInfo>
<VersionInfo Name="Locale">3082</VersionInfo>
<VersionInfo Name="CodePage">1252</VersionInfo>
</VersionInfo>
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"/>
<VersionInfoKeys Name="FileDescription"/>
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"/>
<VersionInfoKeys Name="LegalCopyright"/>
<VersionInfoKeys Name="LegalTrademarks"/>
<VersionInfoKeys Name="OriginalFilename"/>
<VersionInfoKeys Name="ProductName"/>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"/>
</VersionInfoKeys>
<Source>
<Source Name="MainSource">Clientes.dpr</Source>
</Source>
</Delphi.Personality>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
</Project>

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<BorlandProject>
<Transactions>
<Transaction>2010/06/24 19:02:25.484.dproj,D:\RAD Studio\Projects\Project1.dproj=D:\RAD Studio\Projects\DeGsoft\GeN\ABM\Cliente\Project\Clientes.dproj</Transaction>
</Transactions>
<ProjectSortOrder AutoSort="-1" SortType="1"/>
</BorlandProject>

Просмотреть файл

@ -0,0 +1,75 @@
/* VER210
Generated by the CodeGear Delphi Pascal Compiler
because -GD or --drc was supplied to the compiler.
This file contains compiler-generated resources that
were bound to the executable.
If this file is empty, then no compiler-generated
resources were bound to the produced executable.
*/
STRINGTABLE
BEGIN
END
/* D:\Projects\DeGsoft\GeN\DataModule\DataModule.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxCtrls.RES */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxSearchDialog.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxPreviewPageSettings.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxPreview.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxPreview.RES */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxPrintDialog.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxPassw.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxDialogForm.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxInheritError.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxClass.RES */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxProgress.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportPDF.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportXLS.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxPopupForm.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxDesgnWorkspace.res */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxInsp.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxDataTree.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEvaluateForm.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxWatchForm.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditFormat.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditHighlight.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditSysMemo.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditMemo.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditPage.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditDataBand.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditStrings.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditGroup.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditPicture.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditFrame.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditOptions.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditReport.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxAbout.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditReportData.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditVar.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditExpr.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditStyle.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxNewItem.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxStdWizard.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxStdWizard.RES */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxEditTabOrder.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxConnItemEdit.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxConnEditor.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxDesgn.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxDesgn.RES */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxReportTree.DFM */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportText.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportDBF.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportCSV.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportMail.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportImage.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportRTF.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportXML.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxExportHTML.dfm */
/* c:\archivos de programa\embarcadero\rad studio\7.0\fast4103\libd14\frxBarcodeEditor.DFM */
/* D:\Projects\DeGsoft\GeN\DataModule\ImprimirDM.dfm */
/* D:\Projects\DeGsoft\GeN\Buscar\Cliente\Form\UFBuscaCliente.dfm */
/* D:\Projects\DeGsoft\GeN\Buscar\Vendedor\Form\BuscarVendedor.dfm */
/* D:\Projects\DeGsoft\GeN\ABM\Cliente\Form\UFClientes.dfm */
/* D:\Projects\DeGsoft\GeN\ABM\Cliente\Project\Clientes.res */
/* D:\Projects\DeGsoft\GeN\ABM\Cliente\Project\Clientes.drf */

Двоичные данные
ABM/Cliente/Project/Clientes.identcache Normal file

Двоичный файл не отображается.

Двоичные данные
ABM/Cliente/Project/Clientes.res Normal file

Двоичный файл не отображается.

Двоичные данные
ABM/Cobrador/Form/CobradorF.dcu Normal file

Двоичный файл не отображается.

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше