Repaso informes
git-svn-id: https://192.168.0.254/svn/Proyectos.Noviseda_FactuGES2/trunk@33 f33bb606-9f5c-448d-9c99-757f00063c96
This commit is contained in:
parent
912834d4ac
commit
d8d65672a2
@ -42,10 +42,8 @@ type
|
||||
function Duplicar(AFactura: IBizFacturaCliente): IBizFacturaCliente;
|
||||
function GenerarAbono(AFactura: IBizFacturaCliente): 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);
|
||||
procedure Print(AFactura : IBizFacturaCliente; AllItems: Boolean = false; const Marca: Integer);
|
||||
|
||||
procedure RecalcularImportes(AFactura: IBizFacturaCliente);
|
||||
function EsModificable(AFactura: IBizFacturaCliente): Boolean;
|
||||
|
||||
@ -10,8 +10,8 @@ uses
|
||||
type
|
||||
IFacturasClienteReportController = interface(IControllerBase)
|
||||
['{A0F41767-4FF6-4BAE-9FC9-894DD721D756}']
|
||||
procedure Preview(const AListaID : TIntegerList; const VerSello: Boolean = True; const VerCopia: Boolean = True);
|
||||
procedure Print(const AListaID : TIntegerList; const VerSello: Boolean = True; const VerCopia: Boolean = True);
|
||||
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;
|
||||
@ -24,8 +24,8 @@ type
|
||||
constructor Create; override;
|
||||
destructor Destroy; override;
|
||||
|
||||
procedure Preview(const AListaID : TIntegerList; const VerSello: Boolean = True; const VerCopia: Boolean = True);
|
||||
procedure Print(const AListaID : TIntegerList; const VerSello: Boolean = True; const VerCopia: Boolean = True);
|
||||
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;
|
||||
@ -107,7 +107,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TFacturasClienteReportController.Preview(const AListaID : TIntegerList; const VerSello: Boolean = True; const VerCopia: Boolean = True);
|
||||
procedure TFacturasClienteReportController.Preview(const AListaID : TIntegerList; const Marca: Integer);
|
||||
var
|
||||
AStream: Binary;
|
||||
AEditor : IEditorFacturasClientePreview;
|
||||
@ -116,7 +116,7 @@ begin
|
||||
|
||||
ShowHourglassCursor;
|
||||
try
|
||||
AStream := FDataModule.GetRptFacturas(AListaID, VerSello, VerCopia);
|
||||
AStream := FDataModule.GetRptFacturas(AListaID, Marca);
|
||||
try
|
||||
CreateEditor('EditorFacturasClientePreview', IEditorFacturasClientePreview, AEditor);
|
||||
if Assigned(AEditor) then
|
||||
@ -137,7 +137,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TFacturasClienteReportController.Print(const AListaID : TIntegerList; const VerSello: Boolean = True; const VerCopia: Boolean = True);
|
||||
procedure TFacturasClienteReportController.Print(const AListaID : TIntegerList; const Marca: Integer);
|
||||
var
|
||||
AStream: Binary;
|
||||
AEditor : IEditorFacturasClientePreview;
|
||||
@ -146,7 +146,7 @@ begin
|
||||
|
||||
ShowHourglassCursor;
|
||||
try
|
||||
AStream := FDataModule.GetRptFacturas(AListaID, VerSello, VerCopia);
|
||||
AStream := FDataModule.GetRptFacturas(AListaID, Marca);
|
||||
try
|
||||
CreateEditor('EditorFacturasClientePreview', IEditorFacturasClientePreview, AEditor);
|
||||
if Assigned(AEditor) then
|
||||
|
||||
@ -33,9 +33,7 @@ type
|
||||
function NewItem : IBizFacturaCliente;
|
||||
|
||||
// Report
|
||||
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
|
||||
@ -54,41 +52,18 @@ begin
|
||||
RORemoteService.Message := dmConexion.Message;
|
||||
end;
|
||||
|
||||
function TDataModuleFacturasCliente.GetRptFacturas(const AListaID: TIntegerList; const VerSello: Boolean = True; const VerCopia: Boolean = True): Binary;
|
||||
function TDataModuleFacturasCliente.GetRptFacturas(const AListaID: TIntegerList; const Marca: Integer): Binary;
|
||||
var
|
||||
AParam : TIntegerArray;
|
||||
begin
|
||||
AParam := AListaID.ToIntegerArray;
|
||||
try
|
||||
Result := (RORemoteService as IsrvFacturasCliente).GenerarInforme(AParam, VerSello, VerCopia);
|
||||
Result := (RORemoteService as IsrvFacturasCliente).GenerarInforme(AParam, Marca);
|
||||
finally
|
||||
FreeANDNIL(AParam);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TDataModuleFacturasCliente.GetRptPDFFactura(const AID: Integer; const VerSello: Boolean = True): Binary;
|
||||
var
|
||||
AParam : TIntegerArray;
|
||||
begin
|
||||
AParam := TIntegerArray.Create;
|
||||
try
|
||||
AParam.Add(AID);
|
||||
Result := (RORemoteService as IsrvFacturasCliente).GenerarInformeEnPDF(AParam, VerSello);
|
||||
finally
|
||||
FreeANDNIL(AParam);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TDataModuleFacturasCliente.GetRptWordFactura(const AID: Integer; const VerSello: Boolean = True): Binary;
|
||||
begin
|
||||
Result := (RORemoteService as IsrvFacturasCliente).GenerarInformeEnWord(AID, VerSello)
|
||||
end;
|
||||
|
||||
function TDataModuleFacturasCliente.NewItem: IBizFacturaCliente;
|
||||
begin
|
||||
Result := GetItem(ID_NULO)
|
||||
end;
|
||||
|
||||
function TDataModuleFacturasCliente._GetDetalles: IBizDetallesFacturaCliente;
|
||||
var
|
||||
ADetalles : TDAMemDataTable;
|
||||
|
||||
@ -105,7 +105,7 @@ type
|
||||
FDesglosado : Boolean;
|
||||
|
||||
//Genera cada una de las facturas a imprimir
|
||||
procedure _GenerarFactura(const ID: Integer; const VerSello: Boolean = True; const VerCopia: Boolean = True);
|
||||
procedure _GenerarFactura(const ID: Integer; const Marca: Integer);
|
||||
|
||||
procedure PrepararTablaInforme(ATabla: TDAMemDataTable);
|
||||
procedure PrepararTablaResumenInforme(ATabla: IDADataset);
|
||||
@ -113,7 +113,7 @@ type
|
||||
procedure IniciarParametrosInforme;
|
||||
procedure RecuperarNombresClientes;
|
||||
public
|
||||
function GenerarFactura(const ListaID : TIntegerArray; const VerSello: Boolean = True; const VerCopia: Boolean = True): Binary;
|
||||
function GenerarFactura(const ListaID : TIntegerArray; const Marca: Integer): Binary;
|
||||
function GenerarFacturaEnPDF(const ListaID : TIntegerArray; const VerSello: Boolean = True): Binary;
|
||||
function GenerarInformeIVA(const IdEmpresa: Integer; const FechaInicio: Variant; const FechaFin: Variant; const ListaIDClientes: TIntegerArray; const Desglosado: Boolean; const ImporteMinimo: Currency): Binary;
|
||||
function GenerarInformeListadoFacturas(const IdEmpresa: Integer; const FechaInicio: Variant; const FechaFin: Variant; const FechaVenInicio: Variant; const FechaVenFin: Variant; const ListaIDClientes: TIntegerArray; const Desglosado: Boolean; const ImporteMinimo: Currency): Binary;
|
||||
@ -171,7 +171,7 @@ begin
|
||||
FreeANDNIL(FListaNombresClientes);
|
||||
end;
|
||||
|
||||
function TRptFacturasCliente.GenerarFactura(const ListaID: TIntegerArray; const VerSello: Boolean = True; const VerCopia: Boolean = True): Binary;
|
||||
function TRptFacturasCliente.GenerarFactura(const ListaID: TIntegerArray; const Marca: Integer): Binary;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
@ -179,7 +179,7 @@ begin
|
||||
try
|
||||
//Vamos generando todos y cada una de las facturas recibidas
|
||||
for i := 0 to ListaID.Count - 1 do
|
||||
_GenerarFactura(ListaID.Items[i], VerSello, VerCopia);
|
||||
_GenerarFactura(ListaID.Items[i], Marca);
|
||||
|
||||
frxReport.PreviewPages.SaveToStream(Result);
|
||||
finally
|
||||
@ -194,7 +194,7 @@ begin
|
||||
try
|
||||
//Vamos generando todos y cada una de las facturas recibidas
|
||||
for i := 0 to ListaID.Count - 1 do
|
||||
_GenerarFactura(ListaID.Items[i], VerSello);
|
||||
// _GenerarFactura(ListaID.Items[i], VerSello);
|
||||
|
||||
frxPDFExport1.Stream := Result;
|
||||
frxReport.Export(frxPDFExport1)
|
||||
@ -651,7 +651,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TRptFacturasCliente._GenerarFactura(const ID: Integer; const VerSello: Boolean = True; const VerCopia: Boolean = True);
|
||||
procedure TRptFacturasCliente._GenerarFactura(const ID: Integer; const Marca: Integer);
|
||||
var
|
||||
AInforme: Variant;
|
||||
|
||||
@ -677,7 +677,7 @@ begin
|
||||
frxReport.LoadFromFile(AInforme, True);
|
||||
|
||||
//La primera impresion siempre es sin la etiqueta copia
|
||||
frxReport.Variables.Variables['VerCopia'] := 0;
|
||||
frxReport.Variables.Variables['Marca'] := 0;
|
||||
frxReport.PrepareReport(False);
|
||||
// if VerCopia then
|
||||
// begin
|
||||
|
||||
@ -34,7 +34,7 @@ type
|
||||
private
|
||||
protected
|
||||
{ IsrvFacturasCliente methods }
|
||||
function GenerarInforme(const ListaID: TIntegerArray; const VerSello: Boolean = True; const VerCopia: Boolean = True): Binary;
|
||||
function GenerarInforme(const ListaID: TIntegerArray; const Marca: Integer): Binary;
|
||||
function GenerarInformeEnWord(const ID: Integer; const VerSello: Boolean = True): Binary;
|
||||
function GenerarInformeEnPDF(const ListaID: TIntegerArray; const VerSello: Boolean = True): Binary;
|
||||
end;
|
||||
@ -95,13 +95,13 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TsrvFacturasCliente.GenerarInforme(const ListaID: TIntegerArray; const VerSello: Boolean = True; const VerCopia: Boolean = True): Binary;
|
||||
function TsrvFacturasCliente.GenerarInforme(const ListaID: TIntegerArray; const Marca: Integer): Binary;
|
||||
var
|
||||
AReportGenerator : TRptFacturasCliente;
|
||||
begin
|
||||
AReportGenerator := TRptFacturasCliente.Create(nil);
|
||||
try
|
||||
Result := AReportGenerator.GenerarFactura(ListaID, VerSello, VerCopia);
|
||||
Result := AReportGenerator.GenerarFactura(ListaID, Marca);
|
||||
finally
|
||||
FreeAndNIL(AReportGenerator);
|
||||
end;
|
||||
|
||||
@ -1,471 +0,0 @@
|
||||
unit uEditorFacturaCliente;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, uEditorDBItem, DB, uDADataTable, JvAppStorage,
|
||||
JvAppRegistryStorage, JvComponent, JvFormPlacement, ImgList,
|
||||
PngImageList, StdActns, ActnList, ComCtrls, TBX, TB2Item, TB2Dock,
|
||||
TB2Toolbar, ExtCtrls, JvExControls, JvNavigationPane,
|
||||
uViewFacturaCliente, uCustomView, uViewBase, uViewTotales,
|
||||
StdCtrls, pngimage, AppEvnts, JvComponentBase,
|
||||
uBizFacturasCliente, uBizTiposIVA,
|
||||
|
||||
|
||||
uIEditorFacturaCliente, uFacturasClienteController, uViewDetallesBase,
|
||||
uViewDetallesFacturaCliente, dxLayoutLookAndFeels, JvExComCtrls, JvStatusBar,
|
||||
uViewDetallesDTO, uViewDetallesArticulos, uTiposIVAController, uDAInterfaces,
|
||||
cxControls, cxContainer, cxEdit, cxTextEdit, cxDBEdit, Grids, DBGrids,
|
||||
uViewDetallesArticulosParaVenta, cxLabel;
|
||||
|
||||
|
||||
type
|
||||
TfEditorFacturaCliente = class(TfEditorDBItem, IEditorFacturaCliente)
|
||||
frViewFacturaCliente1: TfrViewFacturaCliente;
|
||||
frViewTotales1: TfrViewTotales;
|
||||
frViewDetallesFacturaCliente1: TfrViewDetallesFacturaCliente;
|
||||
actEnviarEMail: TAction;
|
||||
TBXSeparatorItem6: TTBXSeparatorItem;
|
||||
TBXItem7: TTBXItem;
|
||||
TBXSubmenuItem2: TTBXSubmenuItem;
|
||||
TBXItem33: TTBXItem;
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure frViewClienteFactura1edtlNombrePropertiesEditValueChanged(Sender: TObject);
|
||||
procedure dsDataTableDataChange(Sender: TObject; Field: TField);
|
||||
procedure CustomEditorClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure frViewClienteFacturaedtlNombrePropertiesChange(Sender: TObject);
|
||||
procedure pgPaginasChanging(Sender: TObject; var AllowChange: Boolean);
|
||||
// procedure frViewTotales1edtDescuentoPropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
|
||||
procedure frViewTotales1bTiposIVAClick(Sender: TObject);
|
||||
// procedure frViewTotales1eIVAPropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
|
||||
// procedure frViewTotales1cbRecargoEquivalenciaPropertiesEditValueChanged(Sender: TObject);
|
||||
// procedure frViewTotales1ePortePropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
|
||||
procedure frViewTotales1ePorteEditing(Sender: TObject; var CanEdit: Boolean);
|
||||
procedure actEnviarEMailExecute(Sender: TObject);
|
||||
procedure actEnviarEMailUpdate(Sender: TObject);
|
||||
|
||||
private
|
||||
procedure RecalcularPortePorUnidad;
|
||||
|
||||
protected
|
||||
FController : IFacturasClienteController;
|
||||
FFactura: IBizFacturaCliente;
|
||||
FTiposIVAController : ITiposIVAController;
|
||||
FTiposIVA: IBizTipoIVA;
|
||||
FViewFactura: IViewFacturaCliente;
|
||||
function GetController : IFacturasClienteController;
|
||||
procedure SetController (const Value : IFacturasClienteController);
|
||||
function GetFactura: IBizFacturaCliente;
|
||||
procedure SetFactura(const Value: IBizFacturaCliente);
|
||||
|
||||
function GetViewFactura: IViewFacturaCliente;
|
||||
procedure SetViewFactura(const Value: IViewFacturaCliente);
|
||||
|
||||
property ViewFacturaCliente: IViewFacturaCliente read GetViewFactura write SetViewFactura;
|
||||
|
||||
procedure OnClienteChanged(Sender: TObject);
|
||||
|
||||
procedure GuardarInterno; override;
|
||||
procedure EliminarInterno; override;
|
||||
procedure ImprimirInterno; override;
|
||||
procedure PrevisualizarInterno; override;
|
||||
|
||||
procedure PonerTitulos(const ATitulo: string = ''); override;
|
||||
public
|
||||
destructor Destroy; override;
|
||||
property Controller : IFacturasClienteController read GetController write SetController;
|
||||
property Factura: IBizFacturaCliente read GetFactura write SetFactura;
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); override; //Importante en este punto se deben de quitar los eventos que puedan afectar a la tabla una vez se cierre el editor.
|
||||
end;
|
||||
|
||||
implementation
|
||||
{$R *.dfm}
|
||||
|
||||
uses
|
||||
uBizContactos, uDataModuleUsuarios, uFactuGES_App,
|
||||
uDetallesFacturaClienteController, uDialogUtils, uDataTableUtils,
|
||||
uDialogOpcionesImpresionFacturasCliente;
|
||||
// uGenerarAlbaranesCliFacCliUtils;
|
||||
|
||||
|
||||
{ TfEditorFacturaCliente }
|
||||
|
||||
{
|
||||
**************************** TfEditorFacturaCliente ****************************
|
||||
}
|
||||
|
||||
procedure TfEditorFacturaCliente.actEnviarEMailExecute(Sender: TObject);
|
||||
begin
|
||||
inherited;
|
||||
FController.EnviarFacturaPorEMail(Factura);
|
||||
end;
|
||||
|
||||
procedure TfEditorFacturaCliente.actEnviarEMailUpdate(Sender: TObject);
|
||||
begin
|
||||
inherited;
|
||||
(Sender as TAction).Enabled := HayDatos;
|
||||
end;
|
||||
|
||||
constructor TfEditorFacturaCliente.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
pgPaginas.ActivePageIndex := 0;
|
||||
ViewFacturaCliente := frViewFacturaCliente1;
|
||||
FTiposIVAController := TTiposIVAController.Create;
|
||||
end;
|
||||
|
||||
procedure TfEditorFacturaCliente.CustomEditorClose(Sender: TObject;
|
||||
var Action: TCloseAction);
|
||||
begin
|
||||
inherited;
|
||||
Factura := NIL;
|
||||
FTiposIVA := NIL;
|
||||
|
||||
FTiposIVAController := Nil;
|
||||
FController := NIL;
|
||||
FViewFactura := NIL;
|
||||
end;
|
||||
|
||||
destructor TfEditorFacturaCliente.Destroy;
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TfEditorFacturaCliente.dsDataTableDataChange(Sender: TObject;
|
||||
Field: TField);
|
||||
begin
|
||||
inherited;
|
||||
if Assigned(FFactura) and (not (FFactura.DataTable.Fetching) or
|
||||
not (FFactura.DataTable.Opening) or not (FFactura.DataTable.Closing)) then
|
||||
PonerTitulos;
|
||||
end;
|
||||
|
||||
procedure TfEditorFacturaCliente.EliminarInterno;
|
||||
var
|
||||
ACadena : String;
|
||||
begin
|
||||
if Factura.TIPO = CTE_TIPO_FACTURA then
|
||||
ACadena := '¿Desea borrar esta factura de cliente?'
|
||||
else
|
||||
ACadena := '¿Desea borrar este abono a cliente?';
|
||||
|
||||
if (Application.MessageBox(PChar(ACadena), 'Atención', MB_YESNO) = IDYES) then
|
||||
begin
|
||||
//Es el caso de querer borrar una factura pendiente cuyos recibos tienen devoluciones
|
||||
if not FController.Eliminar(Factura) then
|
||||
Application.MessageBox('La factura no ha podido ser eliminada porque tiene recibos con pagos o devoluciones emitidas.', 'Atención', MB_OK);
|
||||
inherited;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfEditorFacturaCliente.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
begin
|
||||
inherited;
|
||||
|
||||
frViewTotales1.cbRecargoEquivalencia.Properties.OnEditValueChanged := nil;
|
||||
frViewTotales1.eIVA.Properties.OnValidate := nil;
|
||||
frViewTotales1.ePorte.Properties.OnValidate := nil;
|
||||
end;
|
||||
|
||||
procedure TfEditorFacturaCliente.FormShow(Sender: TObject);
|
||||
begin
|
||||
inherited;
|
||||
|
||||
if not Assigned(FViewFactura) then
|
||||
raise Exception.Create('No hay ninguna vista asignada');
|
||||
|
||||
if not Assigned(Factura) then
|
||||
raise Exception.Create('No hay ninguna factura asignada');
|
||||
|
||||
Factura.DataTable.Active := True;
|
||||
end;
|
||||
|
||||
procedure TfEditorFacturaCliente.frViewClienteFactura1edtlNombrePropertiesEditValueChanged(Sender: TObject);
|
||||
begin
|
||||
inherited;
|
||||
with (Sender as TcxDBTextEdit) do
|
||||
Enabled := (FFactura.ID <> 0)
|
||||
end;
|
||||
|
||||
procedure TfEditorFacturaCliente.frViewClienteFacturaedtlNombrePropertiesChange(
|
||||
Sender: TObject);
|
||||
begin
|
||||
inherited;
|
||||
PonerTitulos;
|
||||
end;
|
||||
|
||||
procedure TfEditorFacturaCliente.frViewTotales1bTiposIVAClick(Sender: TObject);
|
||||
begin
|
||||
inherited;
|
||||
FTiposIVAController.VerTodos(FTiposIVA);
|
||||
end;
|
||||
|
||||
{
|
||||
procedure TfEditorFacturaCliente.frViewTotales1cbRecargoEquivalenciaPropertiesEditValueChanged(
|
||||
Sender: TObject);
|
||||
begin
|
||||
inherited;
|
||||
if Assigned(Factura) then
|
||||
begin
|
||||
Factura.Edit;
|
||||
if frViewTotales1.cbRecargoEquivalencia.Checked then
|
||||
Factura.RECARGO_EQUIVALENCIA := 1
|
||||
else
|
||||
Factura.RECARGO_EQUIVALENCIA := 0;
|
||||
end;
|
||||
end;
|
||||
}
|
||||
|
||||
{
|
||||
procedure TfEditorFacturaCliente.frViewTotales1edtDescuentoPropertiesValidate(
|
||||
Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption;
|
||||
var Error: Boolean);
|
||||
begin
|
||||
inherited;
|
||||
Factura.DESCUENTO := DisplayValue;
|
||||
end;
|
||||
}
|
||||
{
|
||||
procedure TfEditorFacturaCliente.frViewTotales1eIVAPropertiesValidate(
|
||||
Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption;
|
||||
var Error: Boolean);
|
||||
begin
|
||||
inherited;
|
||||
Factura.Edit;
|
||||
Factura.ID_TIPO_IVA := ((frViewTotales1.dsTiposIVA.DataTable) as IBizTipoIVA).ID;
|
||||
end;
|
||||
}
|
||||
procedure TfEditorFacturaCliente.frViewTotales1ePorteEditing(Sender: TObject;
|
||||
var CanEdit: Boolean);
|
||||
begin
|
||||
inherited;
|
||||
if FFactura.TIPO = CTE_TIPO_ABONO then
|
||||
CanEdit := False;
|
||||
end;
|
||||
|
||||
{
|
||||
procedure TfEditorFacturaCliente.frViewTotales1ePortePropertiesValidate(
|
||||
Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption;
|
||||
var Error: Boolean);
|
||||
begin
|
||||
inherited;
|
||||
|
||||
if (not VarIsNull(DisplayValue)) and (Length(DisplayValue) > 0) then
|
||||
FFactura.IMPORTE_PORTE := DisplayValue
|
||||
else
|
||||
FFactura.IMPORTE_PORTE := 0;
|
||||
|
||||
// RecalcularPortePorUnidad; En los documentos de cliente el porte no se desglosa por articulo
|
||||
end;
|
||||
}
|
||||
|
||||
function TfEditorFacturaCliente.GetController: IFacturasClienteController;
|
||||
begin
|
||||
Result := FController;
|
||||
end;
|
||||
|
||||
function TfEditorFacturaCliente.GetFactura: IBizFacturaCliente;
|
||||
begin
|
||||
Result := FFactura;
|
||||
end;
|
||||
|
||||
function TfEditorFacturaCliente.GetViewFactura: IViewFacturaCliente;
|
||||
begin
|
||||
Result := FViewFactura;
|
||||
end;
|
||||
|
||||
procedure TfEditorFacturaCliente.GuardarInterno;
|
||||
var
|
||||
bEsNuevo : Boolean;
|
||||
begin
|
||||
inherited;
|
||||
|
||||
ShowHourglassCursor;
|
||||
//frViewDetallesFacturaCliente1.SaveGridStatus; // Para guardar estado del grid
|
||||
frViewDetallesFacturaCliente1.BeginUpdate; // Para que no se mueva el foco
|
||||
try
|
||||
bEsNuevo := FFactura.EsNuevo;
|
||||
FController.Guardar(FFactura);
|
||||
finally
|
||||
frViewDetallesFacturaCliente1.EndUpdate;
|
||||
//frViewDetallesFacturaCliente1.RestoreGridStatus;
|
||||
HideHourglassCursor;
|
||||
end;
|
||||
|
||||
if bEsNuevo then
|
||||
begin
|
||||
if FFactura.TIPO = CTE_TIPO_FACTURA then
|
||||
ShowInfoMessage('La factura se ha dado de alta con el código ' + FFactura.REFERENCIA)
|
||||
else
|
||||
begin
|
||||
ShowInfoMessage('El abono se ha dado de alta con el código ' + FFactura.REFERENCIA);
|
||||
//Preguntamos is desea hacer una orden de devolución asociada
|
||||
// if (Application.MessageBox('¿Desea crear una orden de devolución para el abono?', 'Atención', MB_YESNO) = IDYES) then
|
||||
// GenerarAlbaranCli(FFactura);
|
||||
end;
|
||||
end;
|
||||
|
||||
Modified := False;
|
||||
end;
|
||||
|
||||
procedure TfEditorFacturaCliente.ImprimirInterno;
|
||||
var
|
||||
AVerSello: Boolean;
|
||||
AVerCopia: Boolean;
|
||||
AllItems: Boolean;
|
||||
|
||||
begin
|
||||
inherited;
|
||||
AllItems := False;
|
||||
AVerSello := True;
|
||||
AVerCopia := True;
|
||||
|
||||
//Preguntamos si desea que en las facturas se vea el Sello
|
||||
if ElegirOpcionesImpresionFacturaCliente(AVerSello, AVerCopia) then
|
||||
FController.Print(FFactura, AllItems, AVerSello, AVerCopia);
|
||||
end;
|
||||
|
||||
procedure TfEditorFacturaCliente.OnClienteChanged(Sender: TObject);
|
||||
begin
|
||||
FFactura.Cliente := ViewFacturaCliente.ViewClienteFactura.Cliente;
|
||||
|
||||
if not (FFactura.DataTable.State in dsEditModes) then
|
||||
FFactura.DataTable.Edit;
|
||||
|
||||
// Actualizar IVA y RE a partir del tipo de IVA del cliente.
|
||||
Factura.IVA := ((frViewTotales1.dsTiposIVA.DataTable) as IBizTipoIVA).IVA;
|
||||
if FFactura.Cliente.RECARGO_EQUIVALENCIA = 1 then
|
||||
Factura.RE := ((frViewTotales1.dsTiposIVA.DataTable) as IBizTipoIVA).RE
|
||||
else
|
||||
Factura.RE := 0;
|
||||
|
||||
//Desactivado porque en presupuestos no utilizan el catálogo de clientes
|
||||
// Si la factura tiene detalles hay que mirar si los descuentos y otros campos
|
||||
// para los artículos hay que cambiarlos.
|
||||
// if (FFactura.Detalles.RecordCount > 0) then
|
||||
// FController.DetallesController.ActualizarDetalles(FFactura.Detalles, FFactura.Cliente);
|
||||
end;
|
||||
|
||||
procedure TfEditorFacturaCliente.pgPaginasChanging(Sender: TObject;
|
||||
var AllowChange: Boolean);
|
||||
var
|
||||
ACadena : String;
|
||||
begin
|
||||
inherited;
|
||||
|
||||
if (not Assigned(FFactura)) or (FFactura.ID_CLIENTE = ID_NULO) then
|
||||
begin
|
||||
if FFactura.TIPO = CTE_TIPO_FACTURA then
|
||||
ACadena := 'Antes debe elegir un cliente para esta factura'
|
||||
else
|
||||
ACadena := 'Antes debe elegir un cliente para este abono';
|
||||
ShowWarningMessage(ACadena);
|
||||
AllowChange := False;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfEditorFacturaCliente.PonerTitulos(const ATitulo: string);
|
||||
var
|
||||
FTitulo : String;
|
||||
begin
|
||||
FTitulo := ATitulo;
|
||||
if (FTitulo = '') and Assigned(Factura) then
|
||||
begin
|
||||
if Factura.EsNuevo then
|
||||
if Factura.TIPO = CTE_TIPO_FACTURA then
|
||||
FTitulo := 'Nueva factura de cliente'
|
||||
else
|
||||
FTitulo := 'Nuevo abono a cliente'
|
||||
else
|
||||
if Factura.TIPO = CTE_TIPO_FACTURA then
|
||||
FTitulo := 'Factura de cliente' + ' - ' + FFactura.Cliente.Nombre
|
||||
else
|
||||
FTitulo := 'Abono a cliente' + ' - ' + FFactura.Cliente.Nombre
|
||||
end;
|
||||
|
||||
inherited PonerTitulos(FTitulo);
|
||||
|
||||
Self.Caption := FTitulo + ' (' + AppFactuGES.EmpresaActiva.NOMBRE + ')';
|
||||
end;
|
||||
|
||||
procedure TfEditorFacturaCliente.PrevisualizarInterno;
|
||||
var
|
||||
AVerSello: Boolean;
|
||||
AVerCopia: Boolean;
|
||||
AllItems: Boolean;
|
||||
|
||||
begin
|
||||
inherited;
|
||||
AllItems := False;
|
||||
AVerSello := True;
|
||||
AVerCopia := True;
|
||||
|
||||
//Preguntamos si desea que en las facturas se vea el Sello
|
||||
if ElegirOpcionesImpresionFacturaCliente(AVerSello, AVerCopia) then
|
||||
FController.Preview(FFactura, AllItems, AVerSello, AVerCopia);
|
||||
end;
|
||||
|
||||
procedure TfEditorFacturaCliente.RecalcularPortePorUnidad;
|
||||
begin
|
||||
//Esta lógica se llamará en el editor porque es para facilitar el rellenado de información del documento
|
||||
//no puede ir en la clase de negocio porque no es una lógica que tenga sentido fuera del editor.
|
||||
if Assigned(Controller)
|
||||
and Assigned(Controller.DetallesController) then
|
||||
Controller.DetallesController.DesglosarPorteDetalles(FFactura.IMPORTE_PORTE, FFactura.Detalles)
|
||||
end;
|
||||
|
||||
procedure TfEditorFacturaCliente.SetController(const Value: IFacturasClienteController);
|
||||
begin
|
||||
FController := Value;
|
||||
|
||||
if Assigned(FController) then
|
||||
begin
|
||||
ViewFacturaCliente.Controller := FController;
|
||||
frViewDetallesFacturaCliente1.Controller := Controller.DetallesController;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfEditorFacturaCliente.SetFactura(const Value: IBizFacturaCliente);
|
||||
begin
|
||||
FFactura := Value;
|
||||
|
||||
if Assigned(FFactura) then
|
||||
begin
|
||||
dsDataTable.DataTable := FFactura.DataTable;
|
||||
frViewTotales1.DADataSource.DataTable := FFactura.DataTable;
|
||||
|
||||
FTiposIVA := FTiposIVAController.BuscarTodos;
|
||||
frViewTotales1.dsTiposIVA.DataTable := FTiposIVA.DataTable;
|
||||
FTiposIVA.DataTable.Active := True;
|
||||
|
||||
if Assigned(FViewFactura) then
|
||||
begin
|
||||
ViewFacturaCliente.ViewClienteFactura.OnClienteChanged := NIL;
|
||||
try
|
||||
FViewFactura.Factura := FFactura;
|
||||
frViewDetallesFacturaCliente1.Detalles := FFactura.Detalles;
|
||||
frViewDetallesFacturaCliente1.Factura := FFactura; //Para poder sacar los descuento del articulos segun el cliente seleccionado
|
||||
finally
|
||||
ViewFacturaCliente.ViewClienteFactura.OnClienteChanged := OnClienteChanged;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else begin
|
||||
ViewFacturaCliente.ViewClienteFactura.OnClienteChanged := NIL;
|
||||
dsDataTable.DataTable := NIL;
|
||||
frViewTotales1.DADataSource.DataTable := NIL;
|
||||
frViewTotales1.dsTiposIVA.DataTable := NIL;
|
||||
end
|
||||
end;
|
||||
|
||||
procedure TfEditorFacturaCliente.SetViewFactura(const Value: IViewFacturaCliente);
|
||||
begin
|
||||
FViewFactura := Value;
|
||||
|
||||
if Assigned(FViewFactura) and Assigned(Factura) then
|
||||
FViewFactura.Factura := Factura;
|
||||
end;
|
||||
|
||||
end.
|
||||
@ -397,13 +397,12 @@ var
|
||||
Respuesta : Integer;
|
||||
AFacturas: IBizFacturaCliente;
|
||||
AllItems: Boolean;
|
||||
AVerSello: Boolean;
|
||||
AVerCopia: Boolean;
|
||||
AMarca: Integer;
|
||||
|
||||
begin
|
||||
AFacturas := Nil;
|
||||
AllItems := False;
|
||||
AVerSello := True;
|
||||
AVerCopia := True;
|
||||
AMarca := 0;
|
||||
|
||||
if MultiSelect and Assigned(ViewGrid) then
|
||||
AllItems := (ViewGrid.NumSeleccionados > 1);
|
||||
@ -430,9 +429,9 @@ begin
|
||||
AFacturas := Facturas;
|
||||
|
||||
//Preguntamos si desea que en las facturas se vea el Sello
|
||||
if ElegirOpcionesImpresionFacturaCliente(AVerSello, AVerCopia) then
|
||||
if ElegirOpcionesImpresionFacturaCliente(AMarca) then
|
||||
if Assigned(AFacturas) then
|
||||
FController.Preview(AFacturas, AllItems, AVerSello, AVerCopia);
|
||||
FController.Preview(AFacturas, AllItems, AMarca);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -246,9 +246,7 @@
|
||||
</Parameter>
|
||||
<Parameter Name="ListaID" DataType="TIntegerArray" Flag="In" >
|
||||
</Parameter>
|
||||
<Parameter Name="VerSello" DataType="Boolean" Flag="In" >
|
||||
</Parameter>
|
||||
<Parameter Name="VerCopia" DataType="Boolean" Flag="In" >
|
||||
<Parameter Name="Marca" DataType="Integer" Flag="In" >
|
||||
</Parameter>
|
||||
</Parameters>
|
||||
</Operation>
|
||||
|
||||
@ -500,7 +500,7 @@ type
|
||||
{ IsrvFacturasCliente }
|
||||
IsrvFacturasCliente = interface(IDataAbstractService)
|
||||
['{56B4FFF0-AB1B-46B2-BA16-ABD5360F6311}']
|
||||
function GenerarInforme(const ListaID: TIntegerArray; const VerSello: Boolean; const VerCopia: Boolean): Binary;
|
||||
function GenerarInforme(const ListaID: TIntegerArray; const Marca: Integer): Binary;
|
||||
function GenerarInformeEnWord(const ID: Integer; const VerSello: Boolean): Binary;
|
||||
function GenerarInformeEnPDF(const ListaID: TIntegerArray; const VerSello: Boolean): Binary;
|
||||
end;
|
||||
@ -515,7 +515,7 @@ type
|
||||
protected
|
||||
function __GetInterfaceName:string; override;
|
||||
|
||||
function GenerarInforme(const ListaID: TIntegerArray; const VerSello: Boolean; const VerCopia: Boolean): Binary;
|
||||
function GenerarInforme(const ListaID: TIntegerArray; const Marca: Integer): Binary;
|
||||
function GenerarInformeEnWord(const ID: Integer; const VerSello: Boolean): Binary;
|
||||
function GenerarInformeEnPDF(const ListaID: TIntegerArray; const VerSello: Boolean): Binary;
|
||||
end;
|
||||
@ -1657,14 +1657,13 @@ begin
|
||||
result := 'srvFacturasCliente';
|
||||
end;
|
||||
|
||||
function TsrvFacturasCliente_Proxy.GenerarInforme(const ListaID: TIntegerArray; const VerSello: Boolean; const VerCopia: Boolean): Binary;
|
||||
function TsrvFacturasCliente_Proxy.GenerarInforme(const ListaID: TIntegerArray; const Marca: Integer): Binary;
|
||||
begin
|
||||
try
|
||||
result := nil;
|
||||
__Message.InitializeRequestMessage(__TransportChannel, 'FactuGES', __InterfaceName, 'GenerarInforme');
|
||||
__Message.Write('ListaID', TypeInfo(FactuGES_Intf.TIntegerArray), ListaID, []);
|
||||
__Message.Write('VerSello', TypeInfo(Boolean), VerSello, []);
|
||||
__Message.Write('VerCopia', TypeInfo(Boolean), VerCopia, []);
|
||||
__Message.Write('Marca', TypeInfo(Integer), Marca, []);
|
||||
__Message.Finalize;
|
||||
|
||||
__TransportChannel.Dispatch(__Message);
|
||||
|
||||
@ -762,11 +762,10 @@ begin
|
||||
end;
|
||||
|
||||
procedure TsrvFacturasCliente_Invoker.Invoke_GenerarInforme(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
{ function GenerarInforme(const ListaID: TIntegerArray; const VerSello: Boolean; const VerCopia: Boolean): Binary; }
|
||||
{ function GenerarInforme(const ListaID: TIntegerArray; const Marca: Integer): Binary; }
|
||||
var
|
||||
ListaID: FactuGES_Intf.TIntegerArray;
|
||||
VerSello: Boolean;
|
||||
VerCopia: Boolean;
|
||||
Marca: Integer;
|
||||
lResult: Binary;
|
||||
__lObjectDisposer: TROObjectDisposer;
|
||||
begin
|
||||
@ -774,10 +773,9 @@ begin
|
||||
lResult := nil;
|
||||
try
|
||||
__Message.Read('ListaID', TypeInfo(FactuGES_Intf.TIntegerArray), ListaID, []);
|
||||
__Message.Read('VerSello', TypeInfo(Boolean), VerSello, []);
|
||||
__Message.Read('VerCopia', TypeInfo(Boolean), VerCopia, []);
|
||||
__Message.Read('Marca', TypeInfo(Integer), Marca, []);
|
||||
|
||||
lResult := (__Instance as IsrvFacturasCliente).GenerarInforme(ListaID, VerSello, VerCopia);
|
||||
lResult := (__Instance as IsrvFacturasCliente).GenerarInforme(ListaID, Marca);
|
||||
|
||||
__Message.InitializeResponseMessage(__Transport, 'FactuGES', 'srvFacturasCliente', 'GenerarInformeResponse');
|
||||
__Message.Write('Result', TypeInfo(Binary), lResult, []);
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user