Repaso informes

git-svn-id: https://192.168.0.254/svn/Proyectos.Noviseda_FactuGES2/trunk@35 f33bb606-9f5c-448d-9c99-757f00063c96
This commit is contained in:
roberto 2010-01-19 10:41:49 +00:00
parent d8d65672a2
commit 3add333cc1
12 changed files with 128 additions and 166 deletions

View File

@ -42,8 +42,8 @@ type
function Duplicar(AFactura: IBizFacturaCliente): IBizFacturaCliente; function Duplicar(AFactura: IBizFacturaCliente): IBizFacturaCliente;
function GenerarAbono(AFactura: IBizFacturaCliente): IBizFacturaCliente; function GenerarAbono(AFactura: IBizFacturaCliente): IBizFacturaCliente;
procedure Preview(AFactura : IBizFacturaCliente; AllItems: Boolean = false; const Marca: Integer); procedure Preview(AFactura : IBizFacturaCliente; AllItems: Boolean = false; const Marca: Integer = 0);
procedure Print(AFactura : IBizFacturaCliente; AllItems: Boolean = false; const Marca: Integer); procedure Print(AFactura : IBizFacturaCliente; AllItems: Boolean = false; const Marca: Integer = 0);
procedure RecalcularImportes(AFactura: IBizFacturaCliente); procedure RecalcularImportes(AFactura: IBizFacturaCliente);
function EsModificable(AFactura: IBizFacturaCliente): Boolean; function EsModificable(AFactura: IBizFacturaCliente): Boolean;
@ -108,10 +108,8 @@ type
function GenerarAbono(AFactura: IBizFacturaCliente): IBizFacturaCliente; function GenerarAbono(AFactura: IBizFacturaCliente): IBizFacturaCliente;
procedure RecuperarCliente(AFactura : IBizFacturaCliente); procedure RecuperarCliente(AFactura : IBizFacturaCliente);
procedure Preview(AFactura : IBizFacturaCliente; AllItems: Boolean = false; procedure Preview(AFactura : IBizFacturaCliente; AllItems: Boolean = false; const Marca: Integer = 0);
const VerSello: Boolean = True; const VerCopia: Boolean = True); procedure Print(AFactura : IBizFacturaCliente; AllItems: Boolean = false; const Marca: Integer = 0);
procedure Print(AFactura : IBizFacturaCliente; AllItems: Boolean = false;
const VerSello: Boolean = True; const VerCopia: Boolean = True);
procedure RecalcularImportes(AFactura: IBizFacturaCliente); procedure RecalcularImportes(AFactura: IBizFacturaCliente);
function EsModificable(AFactura: IBizFacturaCliente): Boolean; function EsModificable(AFactura: IBizFacturaCliente): Boolean;
@ -813,7 +811,7 @@ var
AEMail : String; AEMail : String;
AListaEmail : TStringList; AListaEmail : TStringList;
begin begin
if not Assigned(AFactura) then { if not Assigned(AFactura) then
raise Exception.Create ('Factura no asignado (EnviarFacturaPorEMail)'); raise Exception.Create ('Factura no asignado (EnviarFacturaPorEMail)');
if AFactura.DataTable.Active then if AFactura.DataTable.Active then
@ -847,6 +845,7 @@ begin
AReportController := NIL; AReportController := NIL;
HideHourglassCursor; HideHourglassCursor;
end; end;
}
end; end;
function TFacturasClienteController.EsEliminable(AFactura: IBizFacturaCliente): Boolean; function TFacturasClienteController.EsEliminable(AFactura: IBizFacturaCliente): Boolean;
@ -1041,8 +1040,7 @@ begin
Result := AFactura; Result := AFactura;
end; end;
procedure TFacturasClienteController.Preview(AFactura: IBizFacturaCliente; AllItems: Boolean = false; procedure TFacturasClienteController.Preview(AFactura: IBizFacturaCliente; AllItems: Boolean = false; const Marca: Integer = 0);
const VerSello: Boolean = True; const VerCopia: Boolean = True);
var var
AReportController : IFacturasClienteReportController; AReportController : IFacturasClienteReportController;
ID_Facturas: TIntegerList; ID_Facturas: TIntegerList;
@ -1069,7 +1067,7 @@ begin
else else
ID_Facturas.Add(AFactura.ID); ID_Facturas.Add(AFactura.ID);
AReportController.Preview(ID_Facturas, VerSello, VerCopia); AReportController.Preview(ID_Facturas, Marca);
finally finally
AReportController := NIL; AReportController := NIL;
@ -1077,8 +1075,7 @@ begin
end; end;
end; end;
procedure TFacturasClienteController.Print(AFactura: IBizFacturaCliente; AllItems: Boolean = false; procedure TFacturasClienteController.Print(AFactura: IBizFacturaCliente; AllItems: Boolean = false; Const Marca: Integer = 0);
const VerSello: Boolean = True; const VerCopia: Boolean = True);
var var
AReportController : IFacturasClienteReportController; AReportController : IFacturasClienteReportController;
ID_Facturas: TIntegerList; ID_Facturas: TIntegerList;
@ -1105,7 +1102,7 @@ begin
else else
ID_Facturas.Add(AFactura.ID); ID_Facturas.Add(AFactura.ID);
AReportController.Print(ID_Facturas, VerSello, VerCopia); AReportController.Print(ID_Facturas, Marca);
finally finally
AReportController := NIL; AReportController := NIL;

View File

@ -12,8 +12,6 @@ type
['{A0F41767-4FF6-4BAE-9FC9-894DD721D756}'] ['{A0F41767-4FF6-4BAE-9FC9-894DD721D756}']
procedure Preview(const AListaID : TIntegerList; const Marca: Integer); procedure Preview(const AListaID : TIntegerList; const Marca: Integer);
procedure Print(const AListaID : TIntegerList; const Marca: Integer); procedure Print(const AListaID : TIntegerList; const Marca: Integer);
function ExportToWord(const AID: Integer; const AFileName : String = ''; const VerSello: Boolean = True): Boolean;
function ExportToPDF(const AID: Integer; const AFileName : String = ''; const VerSello: Boolean = True): Boolean;
end; end;
TFacturasClienteReportController = class(TControllerBase, IFacturasClienteReportController) TFacturasClienteReportController = class(TControllerBase, IFacturasClienteReportController)
@ -26,8 +24,6 @@ type
procedure Preview(const AListaID : TIntegerList; const Marca: Integer); procedure Preview(const AListaID : TIntegerList; const Marca: Integer);
procedure Print(const AListaID : TIntegerList; const Marca: Integer); procedure Print(const AListaID : TIntegerList; const Marca: Integer);
function ExportToWord(const AID: Integer; const AFileName : String = ''; const VerSello: Boolean = True): Boolean;
function ExportToPDF(const AID: Integer; const AFileName : String = ''; const VerSello: Boolean = True): Boolean;
end; end;
@ -59,54 +55,6 @@ begin
inherited; inherited;
end; end;
function TFacturasClienteReportController.ExportToPDF(const AID: Integer; const AFileName: String = ''; const VerSello: Boolean = True): Boolean;
var
AStream: Binary;
begin
Result := False;
if EsCadenaVacia(AFileName) then
Exit;
ShowHourglassCursor;
try
AStream := FDataModule.GetRptPDFFactura(AID, VerSello);
try
AStream.SaveToFile(AFileName);
Result := True;
finally
FreeAndNil(AStream);
end;
finally
HideHourglassCursor;
end;
end;
function TFacturasClienteReportController.ExportToWord(const AID: Integer;
const AFileName: String = ''; const VerSello: Boolean = True): Boolean;
var
AStream: Binary;
AFile : String;
begin
Result := False;
AFile := AFileName;
if EsCadenaVacia(AFile) and (not PreguntarFicheroWordExportar(AFile)) then
Exit;
ShowHourglassCursor;
try
AStream := FDataModule.GetRptWordFactura(AID, VerSello);
try
AStream.SaveToFile(AFile);
Result := True;
finally
FreeAndNil(AStream);
end;
finally
HideHourglassCursor;
end;
end;
procedure TFacturasClienteReportController.Preview(const AListaID : TIntegerList; const Marca: Integer); procedure TFacturasClienteReportController.Preview(const AListaID : TIntegerList; const Marca: Integer);
var var
AStream: Binary; AStream: Binary;

View File

@ -64,6 +64,11 @@ begin
end; end;
end; end;
function TDataModuleFacturasCliente.NewItem: IBizFacturaCliente;
begin
//
end;
function TDataModuleFacturasCliente._GetDetalles: IBizDetallesFacturaCliente; function TDataModuleFacturasCliente._GetDetalles: IBizDetallesFacturaCliente;
var var
ADetalles : TDAMemDataTable; ADetalles : TDAMemDataTable;

View File

@ -8,9 +8,7 @@ uses
type type
IDataModuleFacturasClienteReport = interface IDataModuleFacturasClienteReport = interface
['{D241A912-78C6-4C65-AEBF-8DDEFE35F511}'] ['{D241A912-78C6-4C65-AEBF-8DDEFE35F511}']
function GetRptFacturas(const AListaID: TIntegerList; const VerSello: Boolean = True; const VerCopia: Boolean = True): Binary; function GetRptFacturas(const AListaID: TIntegerList; const Marca: Integer): Binary;
function GetRptWordFactura(const AID: Integer; const VerSello: Boolean = True): Binary;
function GetRptPDFFactura(const AID: Integer; const VerSello: Boolean = True): Binary;
end; end;
implementation implementation

View File

@ -70,6 +70,22 @@ inherited fDialogOpcionesImpresionFacturasCliente: TfDialogOpcionesImpresionFact
Caption = 'Indicar '#39'COPIA'#39' en la cabecera' Caption = 'Indicar '#39'COPIA'#39' en la cabecera'
TabOrder = 1 TabOrder = 1
end end
object cxRadioButton1: TcxRadioButton
Left = 50
Top = 4
Width = 113
Height = 17
Caption = 'cxRadioButton1'
TabOrder = 2
end
object cxRadioButton2: TcxRadioButton
Left = 50
Top = 84
Width = 113
Height = 17
Caption = 'cxRadioButton1'
TabOrder = 3
end
end end
inherited ActionList1: TActionList inherited ActionList1: TActionList
Top = 16 Top = 16

View File

@ -4,12 +4,14 @@ interface
uses uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uDialogBase, ActnList, StdCtrls, ExtCtrls; Dialogs, uDialogBase, ActnList, StdCtrls, ExtCtrls, cxRadioGroup;
type type
TfDialogOpcionesImpresionFacturasCliente = class(TfDialogBase) TfDialogOpcionesImpresionFacturasCliente = class(TfDialogBase)
cbCopia: TCheckBox; cbCopia: TCheckBox;
cbContabilidad: TCheckBox; cbContabilidad: TCheckBox;
cxRadioButton1: TcxRadioButton;
cxRadioButton2: TcxRadioButton;
procedure actAceptarExecute(Sender: TObject); procedure actAceptarExecute(Sender: TObject);
procedure actCancelarExecute(Sender: TObject); procedure actCancelarExecute(Sender: TObject);
private private
@ -38,8 +40,8 @@ begin
begin begin
if True then if True then
AVerSello := ; // AVerSello := ;
AVerCopia := AEditor.cbVerCopia.Checked; // AVerCopia := AEditor.cbVerCopia.Checked;
end; end;
finally finally
AEditor.Release; AEditor.Release;

View File

@ -13,7 +13,7 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
inherited JvNavPanelHeader: TJvNavPanelHeader inherited JvNavPanelHeader: TJvNavPanelHeader
Width = 902 Width = 902
Caption = 'Nueva factura de cliente' Caption = 'Nueva factura de cliente'
ExplicitWidth = 812 ExplicitWidth = 902
inherited Image1: TImage inherited Image1: TImage
Left = 875 Left = 875
Picture.Data = { Picture.Data = {
@ -39,7 +39,7 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
end end
inherited lblDesbloquear: TcxLabel inherited lblDesbloquear: TcxLabel
Left = 777 Left = 777
ExplicitLeft = 687 ExplicitLeft = 777
AnchorX = 822 AnchorX = 822
AnchorY = 14 AnchorY = 14
end end
@ -174,6 +174,7 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
ExplicitWidth = 505 ExplicitWidth = 505
inherited dxLayoutControl1: TdxLayoutControl inherited dxLayoutControl1: TdxLayoutControl
Width = 505 Width = 505
ExplicitWidth = 505
inherited edtlNombre: TcxDBTextEdit inherited edtlNombre: TcxDBTextEdit
Style.LookAndFeel.SkinName = '' Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = ''
@ -183,20 +184,20 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
Width = 224 Width = 224
end end
inherited edtNIFCIF: TcxDBTextEdit inherited edtNIFCIF: TcxDBTextEdit
Left = 321 Left = 338
Style.LookAndFeel.SkinName = '' Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 321 ExplicitLeft = 338
end end
inherited Button3: TBitBtn inherited Button3: TBitBtn
Left = 232 Left = 249
ExplicitLeft = 232 ExplicitLeft = 249
end end
inherited Button4: TButton inherited Button4: TButton
Left = 401 Left = 418
ExplicitLeft = 401 ExplicitLeft = 418
end end
inherited edtPersonaContacto: TcxDBTextEdit inherited edtPersonaContacto: TcxDBTextEdit
Style.LookAndFeel.SkinName = '' Style.LookAndFeel.SkinName = ''
@ -207,8 +208,8 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
Width = 403 Width = 403
end end
inherited Button5: TButton inherited Button5: TButton
Left = 401 Left = 418
ExplicitLeft = 401 ExplicitLeft = 418
end end
inherited edtDireccion: TcxMemo inherited edtDireccion: TcxMemo
Style.LookAndFeel.SkinName = '' Style.LookAndFeel.SkinName = ''
@ -234,6 +235,8 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
object pagContenido: TTabSheet object pagContenido: TTabSheet
Caption = 'Contenido' Caption = 'Contenido'
ImageIndex = 1 ImageIndex = 1
ExplicitLeft = 0
ExplicitTop = 0
ExplicitWidth = 798 ExplicitWidth = 798
ExplicitHeight = 282 ExplicitHeight = 282
inline frViewDetallesFacturaCliente1: TfrViewDetallesFacturaCliente inline frViewDetallesFacturaCliente1: TfrViewDetallesFacturaCliente
@ -256,112 +259,107 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
ExplicitHeight = 282 ExplicitHeight = 282
inherited ToolBar1: TToolBar inherited ToolBar1: TToolBar
Width = 888 Width = 888
Height = 51 Height = 46
ExplicitWidth = 798 ExplicitWidth = 888
ExplicitHeight = 73 ExplicitHeight = 46
inherited ToolButton3: TToolButton inherited ToolButton3: TToolButton
Wrap = False Wrap = False
end end
inherited ToolButton4: TToolButton inherited ToolButton4: TToolButton
Left = 278 Left = 278
Top = 0 Top = 0
Wrap = True
ExplicitLeft = 278 ExplicitLeft = 278
ExplicitTop = 0 ExplicitTop = 0
end end
inherited FontName: TJvFontComboBox
Left = 334
Top = 0
ExplicitLeft = 334
ExplicitTop = 0
end
inherited ToolButton14: TToolButton inherited ToolButton14: TToolButton
Left = 479 Left = 0
Top = 0 Wrap = False
ExplicitLeft = 479 ExplicitLeft = 0
ExplicitTop = 0 end
inherited FontName: TJvFontComboBox
Left = 65
Top = 22
ExplicitLeft = 65
ExplicitTop = 22
end end
inherited FontSize: TEdit inherited FontSize: TEdit
Left = 544 Left = 210
Top = 0 Top = 22
Width = 248 Width = 248
ExplicitLeft = 544 ExplicitLeft = 210
ExplicitTop = 0 ExplicitTop = 22
ExplicitWidth = 248 ExplicitWidth = 248
end end
inherited UpDown1: TUpDown inherited UpDown1: TUpDown
Left = 792 Left = 458
Top = 0 Top = 22
ExplicitLeft = 792 ExplicitLeft = 458
ExplicitTop = 0 ExplicitTop = 22
end end
inherited ToolButton13: TToolButton inherited ToolButton13: TToolButton
Left = 0 Left = 475
Top = 0 Top = 22
Wrap = True ExplicitLeft = 475
ExplicitLeft = 0 ExplicitTop = 22
ExplicitTop = 0
ExplicitHeight = 27
end
inherited ToolButton11: TToolButton
Left = 0
Top = 27
ExplicitLeft = 0
ExplicitTop = 27
end
inherited ToolButton12: TToolButton
Left = 141
Top = 27
Wrap = False
ExplicitLeft = 141
ExplicitTop = 27
ExplicitHeight = 22
end
inherited ToolButton9: TToolButton
Left = 149
Top = 27
ExplicitLeft = 149
ExplicitTop = 27
end
inherited ToolButton10: TToolButton
Left = 294
Top = 27
ExplicitLeft = 294
ExplicitTop = 27
end end
inherited ToolButton6: TToolButton inherited ToolButton6: TToolButton
Left = 419 Left = 483
Top = 27 Top = 22
ExplicitLeft = 419 ExplicitLeft = 483
ExplicitTop = 27 ExplicitTop = 22
end end
inherited ToolButton7: TToolButton inherited ToolButton7: TToolButton
Left = 485 Left = 549
Top = 27 Top = 22
Wrap = False ExplicitLeft = 549
ExplicitLeft = 485 ExplicitTop = 22
ExplicitTop = 27
end end
inherited ToolButton8: TToolButton inherited ToolButton8: TToolButton
Left = 552 Left = 616
Top = 27 Top = 22
ExplicitLeft = 552 ExplicitLeft = 616
ExplicitTop = 27 ExplicitTop = 22
end
inherited ToolButton12: TToolButton
Left = 699
Top = 22
ExplicitLeft = 699
ExplicitTop = 22
end
inherited ToolButton9: TToolButton
Left = 707
Top = 22
ExplicitLeft = 707
ExplicitTop = 22
end
inherited ToolButton10: TToolButton
Left = 852
Top = 22
ExplicitLeft = 852
ExplicitTop = 22
end
inherited ToolButton11: TToolButton
Left = 977
Top = 22
ExplicitLeft = 977
ExplicitTop = 22
end end
end end
inherited cxGrid: TcxGrid inherited cxGrid: TcxGrid
Top = 77 Top = 72
Width = 888 Width = 888
Height = 246 Height = 251
ExplicitTop = 77
ExplicitWidth = 798 ExplicitWidth = 798
ExplicitHeight = 183 ExplicitHeight = 183
end end
inherited TBXDock1: TTBXDock inherited TBXDock1: TTBXDock
Top = 51 Top = 46
Width = 888 Width = 888
ExplicitTop = 73
ExplicitWidth = 798 ExplicitWidth = 798
inherited TBXToolbar1: TTBXToolbar inherited TBXToolbar1: TTBXToolbar
ExplicitWidth = 838 ExplicitWidth = 762
end end
end end
inherited cxGridPopupMenu: TcxGridPopupMenu inherited cxGridPopupMenu: TcxGridPopupMenu

View File

@ -329,19 +329,17 @@ end;
procedure TfEditorFacturaCliente.ImprimirInterno; procedure TfEditorFacturaCliente.ImprimirInterno;
var var
AVerSello: Boolean;
AVerCopia: Boolean;
AllItems: Boolean; AllItems: Boolean;
AMarca: Integer;
begin begin
inherited; inherited;
AllItems := False; AllItems := False;
AVerSello := True; AMarca := 0;
AVerCopia := True;
//Preguntamos si desea que en las facturas se vea el Sello //Preguntamos si desea que en las facturas se vea el Sello
if ElegirOpcionesImpresionFacturaCliente(AVerSello, AVerCopia) then if ElegirOpcionesImpresionFacturaCliente(AMarca) then
FController.Print(FFactura, AllItems, AVerSello, AVerCopia); FController.Print(FFactura, AllItems, AMarca);
end; end;
procedure TfEditorFacturaCliente.OnClienteChanged(Sender: TObject); procedure TfEditorFacturaCliente.OnClienteChanged(Sender: TObject);
@ -419,19 +417,17 @@ end;
procedure TfEditorFacturaCliente.PrevisualizarInterno; procedure TfEditorFacturaCliente.PrevisualizarInterno;
var var
AVerSello: Boolean;
AVerCopia: Boolean;
AllItems: Boolean; AllItems: Boolean;
AMarca: Integer;
begin begin
inherited; inherited;
AllItems := False; AllItems := False;
AVerSello := True; AMarca := 0;
AVerCopia := True;
//Preguntamos si desea que en las facturas se vea el Sello //Preguntamos si desea que en las facturas se vea el Sello
if ElegirOpcionesImpresionFacturaCliente(AVerSello, AVerCopia) then if ElegirOpcionesImpresionFacturaCliente(AMarca) then
FController.Preview(FFactura, AllItems, AVerSello, AVerCopia); FController.Preview(FFactura, AllItems, AMarca);
end; end;
procedure TfEditorFacturaCliente.RecalcularPortePorUnidad; procedure TfEditorFacturaCliente.RecalcularPortePorUnidad;

View File

@ -337,7 +337,7 @@ begin
//Preguntamos si desea que en las facturas se vea el Sello //Preguntamos si desea que en las facturas se vea el Sello
if ElegirOpcionesImpresionFacturaCliente(AMarca) then if ElegirOpcionesImpresionFacturaCliente(AMarca) then
if Assigned(AFacturas) then if Assigned(AFacturas) then
FController.Print(AFacturas, AllItems, AVerSello, AVerCopia); FController.Print(AFacturas, AllItems, AMarca);
end; end;
end; end;
end; end;

View File

@ -2,6 +2,7 @@ inherited fEditorFacturasClientePreview: TfEditorFacturasClientePreview
Caption = 'Previsualizar la factura' Caption = 'Previsualizar la factura'
ClientWidth = 622 ClientWidth = 622
ExplicitWidth = 630 ExplicitWidth = 630
ExplicitHeight = 240
PixelsPerInch = 96 PixelsPerInch = 96
TextHeight = 13 TextHeight = 13
inherited JvNavPanelHeader: TJvNavPanelHeader inherited JvNavPanelHeader: TJvNavPanelHeader

View File

@ -39,12 +39,13 @@ var
I: Integer; I: Integer;
begin begin
// inherited; <- No llamar al padre // inherited; <- No llamar al padre
if not Assigned(Controller) then { if not Assigned(Controller) then
raise Exception.Create('No se ha asignado el controlador necesario'); raise Exception.Create('No se ha asignado el controlador necesario');
for I := 0 to ListaID.Count - 1 do for I := 0 to ListaID.Count - 1 do
if (Controller as IFacturasClienteReportController).ExportToWord(ListaID[I]) then if (Controller as IFacturasClienteReportController).ExportToWord(ListaID[I]) then
ShowInfoMessage('La factura se ha exportado correctamente.'); ShowInfoMessage('La factura se ha exportado correctamente.');
}
end; end;
end. end.