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

View File

@ -12,8 +12,6 @@ type
['{A0F41767-4FF6-4BAE-9FC9-894DD721D756}']
procedure Preview(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;
TFacturasClienteReportController = class(TControllerBase, IFacturasClienteReportController)
@ -26,8 +24,6 @@ type
procedure Preview(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;
@ -59,54 +55,6 @@ begin
inherited;
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);
var
AStream: Binary;

View File

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

View File

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

View File

@ -70,6 +70,22 @@ inherited fDialogOpcionesImpresionFacturasCliente: TfDialogOpcionesImpresionFact
Caption = 'Indicar '#39'COPIA'#39' en la cabecera'
TabOrder = 1
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
inherited ActionList1: TActionList
Top = 16

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -39,12 +39,13 @@ var
I: Integer;
begin
// 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');
for I := 0 to ListaID.Count - 1 do
if (Controller as IFacturasClienteReportController).ExportToWord(ListaID[I]) then
ShowInfoMessage('La factura se ha exportado correctamente.');
}
end;
end.