Facturas de cliente: informe (no terminado) y repaso general.

git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@224 0c75b7a4-871f-7646-8a2f-f78d34cc349f
This commit is contained in:
David Arranz 2008-01-15 10:31:41 +00:00
parent 640a00fa9a
commit 9092beef66
9 changed files with 865 additions and 573 deletions

View File

@ -24,7 +24,7 @@ type
function BuscarTodasPendientesComision(IdAgente: Integer; IdComision: Integer; IdFacturasAsociadas: String): IBizFacturaCliente;
procedure Ver(AFactura : IBizFacturaCliente);
procedure VerTodos(AFacturas: IBizFacturaCliente);
function Nuevo : IBizFacturaCliente;
function Nuevo (withInsert: Boolean = True) : IBizFacturaCliente;
function Anadir(AFactura : IBizFacturaCliente) : Boolean; overload;
function AnadirAbono(AFactura : IBizFacturaCliente) : Boolean;
function Anadir(AFacturas : IBizFacturaCliente; AListaAlbaranes : IBizAlbaranCliente): Boolean; overload;
@ -90,7 +90,7 @@ type
function Buscar(const ID: Integer): IBizFacturaCliente;
function BuscarTodos: IBizFacturaCliente;
function BuscarTodasPendientesComision(IdAgente: Integer; IdComision: Integer; IdFacturasAsociadas: String): IBizFacturaCliente;
function Nuevo : IBizFacturaCliente;
function Nuevo (withInsert: Boolean = True) : IBizFacturaCliente;
procedure Ver(AFactura : IBizFacturaCliente);
procedure VerTodos(AFacturas: IBizFacturaCliente);
function Duplicar(AFactura: IBizFacturaCliente): IBizFacturaCliente;
@ -921,14 +921,15 @@ begin
end;
end;
function TFacturasClienteController.Nuevo: IBizFacturaCliente;
function TFacturasClienteController.Nuevo(withInsert: Boolean = True): IBizFacturaCliente;
var
AFactura : IBizFacturaCliente;
begin
AFactura := FDataModule.NewItem;
FiltrarEmpresa(AFactura);
AFactura.DataTable.Active := True;
AFactura.Insert;
if WithInsert then
AFactura.Insert;
Result := AFactura;
end;

View File

@ -7,33 +7,70 @@ uses
Dialogs, frxClass, frxDBSet, uDAScriptingProvider,
uDADataTable, uDACDSDataTable, DB, uDAClasses, frxChart, frxGradient,
frxChBox, frxCross, frxOLE, frxBarcode, frxRich, uDABINAdapter, uROTypes,
uDAInterfaces, uDADataStreamer, IBCustomDataSet, IBQuery, IBDatabase;
uDAInterfaces, uDADataStreamer, IBCustomDataSet, IBQuery, IBDatabase,
uDAMemDataTable;
type
TRptFacturasCliente = class(TDataModule)
DADataCabecera: TDADataSource;
DADataDetalles: TDADataSource;
tbl_FacturaCliente: TDACDSDataTable;
tbl_DetallesFacturaCliente: TDACDSDataTable;
frxDBCabecera: TfrxDBDataset;
frxDBDetalles: TfrxDBDataset;
DADataVencimientos: TDADataSource;
tbl_Vencimientos: TDACDSDataTable;
frxDBDataset1: TfrxDBDataset;
schReport: TDASchema;
DataDictionary: TDADataDictionary;
frxReport: TfrxReport;
frxBarCodeObject1: TfrxBarCodeObject;
frxOLEObject1: TfrxOLEObject;
frxCrossObject1: TfrxCrossObject;
frxCheckBoxObject1: TfrxCheckBoxObject;
frxGradientObject1: TfrxGradientObject;
IBDatabase1: TIBDatabase;
IBTransaction1: TIBTransaction;
DataSource1: TDataSource;
DataSource2: TDataSource;
cabecera: TIBQuery;
detalles: TIBQuery;
schReport: TDASchema;
DABINAdapter: TDABINAdapter;
DADSCabecera: TDADataSource;
DADSDetalles: TDADataSource;
tbl_Detalles: TDAMemDataTable;
tbl_Cabecera: TDAMemDataTable;
frxCheckBoxObject1: TfrxCheckBoxObject;
frxChartObject1: TfrxChartObject;
frxGradientObject1: TfrxGradientObject;
frxCrossObject1: TfrxCrossObject;
frxOLEObject1: TfrxOLEObject;
frxBarCodeObject1: TfrxBarCodeObject;
frxRichObject1: TfrxRichObject;
frxReport: TfrxReport;
cabeceraID: TIntegerField;
cabeceraID_EMPRESA: TIntegerField;
cabeceraREFERENCIA: TIBStringField;
cabeceraTIPO: TIBStringField;
cabeceraFECHA_FACTURA: TDateField;
cabeceraBASE_IMPONIBLE: TIBBCDField;
cabeceraSITUACION: TIBStringField;
cabeceraDESCUENTO: TFloatField;
cabeceraIMPORTE_DESCUENTO: TIBBCDField;
cabeceraIVA: TFloatField;
cabeceraIMPORTE_IVA: TIBBCDField;
cabeceraRE: TFloatField;
cabeceraIMPORTE_RE: TIBBCDField;
cabeceraIMPORTE_TOTAL: TIBBCDField;
cabeceraOBSERVACIONES: TMemoField;
cabeceraNIF_CIF: TIBStringField;
cabeceraID_CLIENTE: TIntegerField;
cabeceraNOMBRE: TIBStringField;
cabeceraCALLE: TIBStringField;
cabeceraPROVINCIA: TIBStringField;
cabeceraPOBLACION: TIBStringField;
cabeceraCODIGO_POSTAL: TIBStringField;
cabeceraRECARGO_EQUIVALENCIA: TSmallintField;
cabeceraIMPORTE_NETO: TIBBCDField;
cabeceraIMPORTE_PORTE: TIBBCDField;
cabeceraFORMA_PAGO: TIBStringField;
detallesID: TIntegerField;
detallesID_FACTURA: TIntegerField;
detallesPOSICION: TIntegerField;
detallesTIPO_DETALLE: TIBStringField;
detallesCONCEPTO: TIBStringField;
detallesCANTIDAD: TIntegerField;
detallesIMPORTE_UNIDAD: TIBBCDField;
detallesDESCUENTO: TFloatField;
detallesIMPORTE_TOTAL: TIBBCDField;
detallesVISIBLE: TSmallintField;
procedure DataModuleCreate(Sender: TObject);
private
FConnection: IDAConnection;
@ -76,7 +113,7 @@ var
begin
Result := Binary.Create;
FConnection.BeginTransaction;
//FConnection.BeginTransaction; <--- Creo que no va a hacer falta.
try
ID_Facturas := TStringList.Create;
@ -89,7 +126,7 @@ begin
frxReport.PreviewPages.SaveToStream(Result);
finally
FConnection.RollbackTransaction;
//FConnection.RollbackTransaction; <--- Creo que no va a hacer falta.
end;
end;
@ -103,9 +140,9 @@ begin
AStream := TMemoryStream.Create;
try
dsMaster := schReport.NewDataset(FConnection, ds_InformeFacturasCliente, ['ID'], [ID]);
{ dsMaster := schReport.NewDataset(FConnection, ds_InformeFacturasCliente, ['ID'], [ID]);
dsDetail := schReport.NewDataset(FConnection, ds_InformeFacturasCliente_Detalles, ['ID_FACTURA'], [ID], False);
dsVencimientos := schReport.NewDataset(FConnection, ds_InformeFacturasCliente_Vencimientos, ['ID_FACTURA'], [ID], False);
dsVencimientos := schReport.NewDataset(FConnection, ds_InformeFacturasCliente_Vencimientos, ['ID_FACTURA'], [ID], False);}
{ AStream.Clear;
DABINAdapter.WriteDataset(AStream, dsMaster, [woRows, woSchema], -1);
@ -119,6 +156,18 @@ begin
DABINAdapter.WriteDataset(AStream, dsVencimientos, [woRows, woSchema], -1);
DABINAdapter.ReadDataset(AStream, tbl_Vencimientos, TRUE, '', TRUE, TRUE);}
frxDBCabecera.DataSource := DADSCabecera;
frxDBDetalles.DataSource := DADSDetalles;
// tbl_Cabecera.ParamByName('ID').AsInteger := AID;
//tbl_Capitulos.ParamByName('ID_FACTURA').AsInteger := AID;
// tbl_Detalles.ParamByName('ID_FACTURA').AsInteger := AID;
//tbl_Resumen.ParamByName('ID_FACTURA').AsInteger := AID;
{ tbl_Cabecera.Active := True;
tbl_Capitulos.Active := True;
tbl_Detalles.Active := True;
tbl_Resumen.Active := True;}
frxReport.LoadFromFile(DarRutaInformes + rptFacturaCliente, True);
frxReport.PrepareReport(False);

View File

@ -190,75 +190,111 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
ExplicitHeight = 283
inherited ToolBar1: TToolBar
Width = 774
Height = 51
ExplicitWidth = 774
inherited ToolButton4: TToolButton
ExplicitHeight = 51
inherited ToolButton3: TToolButton
Wrap = False
end
inherited ToolButton4: TToolButton
Left = 278
Top = 0
ExplicitLeft = 278
ExplicitTop = 0
end
inherited ToolButton14: TToolButton
Left = 334
Top = 0
Wrap = True
Wrap = False
ExplicitLeft = 334
ExplicitTop = 0
end
inherited FontName: TJvFontComboBox
Left = 0
ExplicitLeft = 0
Left = 399
Top = 0
ExplicitLeft = 399
ExplicitTop = 0
end
inherited FontSize: TEdit
Left = 145
Left = 544
Top = 0
Width = 57
ExplicitLeft = 145
ExplicitLeft = 544
ExplicitTop = 0
ExplicitWidth = 57
end
inherited UpDown1: TUpDown
Left = 202
ExplicitLeft = 202
Left = 601
Top = 0
ExplicitLeft = 601
ExplicitTop = 0
end
inherited ToolButton13: TToolButton
Left = 219
ExplicitLeft = 219
Left = 0
Top = 0
Wrap = True
ExplicitLeft = 0
ExplicitTop = 0
ExplicitHeight = 30
end
inherited ToolButton6: TToolButton
Left = 227
ExplicitLeft = 227
Left = 0
Top = 30
ExplicitLeft = 0
ExplicitTop = 30
end
inherited ToolButton7: TToolButton
Left = 261
ExplicitLeft = 261
Left = 66
Top = 30
ExplicitLeft = 66
ExplicitTop = 30
end
inherited ToolButton8: TToolButton
Left = 295
ExplicitLeft = 295
Left = 133
Top = 30
ExplicitLeft = 133
ExplicitTop = 30
end
inherited ToolButton12: TToolButton
Left = 329
ExplicitLeft = 329
Left = 216
Top = 30
ExplicitLeft = 216
ExplicitTop = 30
end
inherited ToolButton9: TToolButton
Left = 337
ExplicitLeft = 337
Left = 224
Top = 30
ExplicitLeft = 224
ExplicitTop = 30
end
inherited ToolButton10: TToolButton
Left = 371
ExplicitLeft = 371
Left = 369
Top = 30
ExplicitLeft = 369
ExplicitTop = 30
end
inherited ToolButton11: TToolButton
Left = 405
ExplicitLeft = 405
Left = 494
Top = 30
ExplicitLeft = 494
ExplicitTop = 30
end
end
inherited cxGrid: TcxGrid
Top = 77
Width = 774
Height = 211
Height = 206
ExplicitTop = 72
ExplicitWidth = 774
ExplicitHeight = 211
end
inherited TBXDock1: TTBXDock
Top = 51
Width = 774
ExplicitWidth = 780
ExplicitTop = 51
ExplicitWidth = 774
inherited TBXToolbar1: TTBXToolbar
ExplicitWidth = 548
ExplicitWidth = 626
end
end
end

View File

@ -1,9 +1,6 @@
inherited frViewDetallesFacturaCliente: TfrViewDetallesFacturaCliente
inherited cxGrid: TcxGrid
inherited cxGridView: TcxGridDBTableView
inherited cxGridViewTIPO: TcxGridDBColumn
Visible = False
end
inherited cxGridViewIMPORTEPORTE: TcxGridDBColumn
Visible = False
end

View File

@ -8,7 +8,7 @@ uses
cxDataStorage, cxEdit, DB, cxDBData, cxImageComboBox, cxCurrencyEdit,
cxSpinEdit, dxPSGlbl, dxPSUtl, dxPSEngn, dxPrnPg, dxBkgnd, dxWrap, dxPrnDev,
dxPSCompsProvider, dxPSFillPatterns, dxPSEdgePatterns, ImgList, PngImageList,
cxGridCustomPopupMenu, cxGridPopupMenu, dxPSCore, dxPScxCommon, dxPScxGridLnk,
cxGridCustomPopupMenu, cxGridPopupMenu, dxPSCore, dxPScxCommon, dxPScxGrid6Lnk,
uDADataTable, cxGridLevel, cxGridCustomTableView, cxGridTableView,
cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid, dxPgsDlg,
ActnList, TB2Item, TBX, TB2Toolbar, TBXDkPanels, TB2Dock, uViewFiltroBase;

View File

@ -1,6 +1,6 @@
inherited frViewFacturaCliente: TfrViewFacturaCliente
Width = 451
Height = 304
Width = 822
Height = 317
Align = alClient
OnCreate = CustomViewCreate
OnDestroy = CustomViewDestroy
@ -9,16 +9,18 @@ inherited frViewFacturaCliente: TfrViewFacturaCliente
object dxLayoutControl1: TdxLayoutControl
Left = 0
Top = 0
Width = 451
Height = 304
Width = 822
Height = 317
Align = alClient
ParentBackground = True
TabOrder = 0
AutoContentSizes = [acsWidth, acsHeight]
LookAndFeel = dxLayoutOfficeLookAndFeel1
ExplicitWidth = 451
ExplicitHeight = 304
DesignSize = (
451
304)
822
317)
object eReferencia: TcxDBTextEdit
Left = 124
Top = 30
@ -79,7 +81,7 @@ inherited frViewFacturaCliente: TfrViewFacturaCliente
Width = 301
end
inline frViewClienteFactura: TfrViewDatosYSeleccionCliente
Left = 310
Left = 427
Top = 30
Width = 314
Height = 215
@ -91,7 +93,7 @@ inherited frViewFacturaCliente: TfrViewFacturaCliente
ParentFont = False
TabOrder = 5
ReadOnly = False
ExplicitLeft = 310
ExplicitLeft = 427
ExplicitTop = 30
ExplicitWidth = 314
ExplicitHeight = 215
@ -126,13 +128,13 @@ inherited frViewFacturaCliente: TfrViewFacturaCliente
Width = 327
end
inherited edtCodigoPostal: TcxDBTextEdit
Left = 192
Left = 281
DataBinding.DataSource = DADataSource
ExplicitLeft = 192
ExplicitLeft = 281
end
inherited Button3: TBitBtn
Left = 82
ExplicitLeft = 82
Left = 171
ExplicitLeft = 171
end
end
end
@ -141,7 +143,6 @@ inherited frViewFacturaCliente: TfrViewFacturaCliente
Top = 84
DataBinding.DataField = 'ID_FORMA_PAGO'
DataBinding.DataSource = DADataSource
Properties.GridMode = True
Properties.ImmediatePost = True
Properties.KeyFieldNames = 'ID'
Properties.ListColumns = <
@ -150,7 +151,9 @@ inherited frViewFacturaCliente: TfrViewFacturaCliente
end>
Properties.ListOptions.GridLines = glNone
Properties.ListOptions.ShowHeader = False
Properties.ListOptions.SyncMode = True
Properties.ListSource = dsFormaPago
Properties.PostPopupValueOnTab = True
Style.BorderColor = clWindowFrame
Style.BorderStyle = ebs3D
Style.HotTrack = False
@ -168,7 +171,7 @@ inherited frViewFacturaCliente: TfrViewFacturaCliente
Width = 78
end
object bFormasPago: TButton
Left = 150
Left = 267
Top = 84
Width = 132
Height = 23

View File

@ -123,6 +123,8 @@ inherited frViewFacturasCliente: TfrViewFacturasCliente
object cxGridViewREFERENCIA_COMISION: TcxGridDBColumn
Caption = 'Liquidaci'#243'n'
DataBinding.FieldName = 'REFERENCIA_COMISION'
Visible = False
VisibleForCustomization = False
Width = 54
end
end
@ -147,6 +149,14 @@ inherited frViewFacturasCliente: TfrViewFacturasCliente
inherited dxLayoutControl1: TdxLayoutControl
Width = 531
ExplicitWidth = 531
inherited txtFiltroTodo: TcxTextEdit
ExplicitWidth = 273
Width = 273
end
inherited edtFechaIniFiltro: TcxDateEdit
ExplicitWidth = 121
Width = 121
end
inherited edtFechaFinFiltro: TcxDateEdit
Left = 248
ExplicitLeft = 248

View File

@ -9,7 +9,7 @@ uses
dxPSEngn, dxPrnPg, dxBkgnd, dxWrap, dxPrnDev, dxPSCompsProvider,
dxPSFillPatterns, dxPSEdgePatterns, cxImageComboBox, cxTextEdit, ImgList,
PngImageList, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
dxPSCore, dxPScxCommon, dxPScxGridLnk, ActnList, uDADataTable,
dxPSCore, dxPScxCommon, dxPScxGrid6Lnk, ActnList, uDADataTable,
cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGrid,
cxImage, Grids, DBGrids, uBizFacturasCliente, cxGridCustomPopupMenu,
cxGridPopupMenu, cxCalendar, cxCurrencyEdit, uViewFiltroBase, TB2Item, TBX,