2011-11-14 17:40:41 +00:00
|
|
|
|
unit uViewFacturasCliente;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
|
Dialogs, uViewGrid, uViewPreview, cxStyles, cxCustomData, cxGraphics,
|
|
|
|
|
|
cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, dxPSGlbl, dxPSUtl,
|
|
|
|
|
|
dxPSEngn, dxPrnPg, dxBkgnd, dxWrap, dxPrnDev, dxPSCompsProvider,
|
|
|
|
|
|
dxPSFillPatterns, dxPSEdgePatterns, cxImageComboBox, cxTextEdit, ImgList,
|
|
|
|
|
|
PngImageList, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
|
|
|
|
|
dxPSCore, dxPScxCommon, dxPScxGrid6Lnk, ActnList, uDADataTable,
|
|
|
|
|
|
cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGrid,
|
|
|
|
|
|
cxImage, Grids, DBGrids, uBizFacturasCliente, cxGridCustomPopupMenu,
|
|
|
|
|
|
cxGridPopupMenu, cxCalendar, cxCurrencyEdit, uViewFiltroBase, TB2Item, TBX,
|
|
|
|
|
|
TB2Toolbar, TBXDkPanels, TB2Dock, dxPgsDlg, uDAInterfaces, uCustomView,
|
|
|
|
|
|
uViewBase;
|
|
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
IViewFacturasCliente = interface(IViewGrid)
|
|
|
|
|
|
['{927A005F-5D71-4C37-B9E7-10292F9D467C}']
|
|
|
|
|
|
function GetFacturas: IBizFacturaCliente;
|
|
|
|
|
|
procedure SetFacturas(const Value: IBizFacturaCliente);
|
|
|
|
|
|
property Facturas: IBizFacturaCliente read GetFacturas write SetFacturas;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
TfrViewFacturasCliente = class(TfrViewGrid, IViewFacturasCliente)
|
|
|
|
|
|
PngImageList: TPngImageList;
|
|
|
|
|
|
cxGridViewNOMBRE: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewREFERENCIA: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewFECHA_FACTURA: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewSITUACION: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewBASE_IMPONIBLE: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewIMPORTE_DESCUENTO: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewDESCUENTO: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewIMPORTE_IVA: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewIMPORTE_TOTAL: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewIVA: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewNIF_CIF: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewCALLE: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewPROVINCIA: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewCODIGO_POSTAL: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewPOBLACION: TcxGridDBColumn;
|
|
|
|
|
|
cxStylePagada: TcxStyle;
|
|
|
|
|
|
cxGridPendientes: TcxGridLevel;
|
|
|
|
|
|
cxStyleAbono: TcxStyle;
|
2023-02-10 17:16:11 +00:00
|
|
|
|
cxGridParcialmentePagadas: TcxGridLevel;
|
2011-11-14 17:40:41 +00:00
|
|
|
|
cxGridViewREFERENCIA_COMISION: TcxGridDBColumn;
|
|
|
|
|
|
cxStylePendientes: TcxStyle;
|
|
|
|
|
|
cxStyleParciales: TcxStyle;
|
|
|
|
|
|
actCliente: TAction;
|
|
|
|
|
|
actProvincia: TAction;
|
|
|
|
|
|
TBXItem2: TTBXItem;
|
|
|
|
|
|
TBXSeparatorItem1: TTBXSeparatorItem;
|
|
|
|
|
|
TBXItem3: TTBXItem;
|
|
|
|
|
|
TBXSeparatorItem2: TTBXSeparatorItem;
|
|
|
|
|
|
cxGridViewTIPO: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewTIENDA: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewNOMBRE_COMERCIAL: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewNOMBRE_CLIENTE: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewIMPORTE_RE: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewRE: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewREF_CONTRATO: TcxGridDBColumn;
|
2013-10-24 15:51:37 +00:00
|
|
|
|
cxGridViewFECHA_VENCIMIENTO: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewREF_CLI_CONTRATO: TcxGridDBColumn;
|
2016-01-12 10:46:50 +00:00
|
|
|
|
cxGridViewIMPORTE_RETENIDO: TcxGridDBColumn;
|
2016-11-10 17:05:04 +00:00
|
|
|
|
cxGridViewPROCEDENCIA_CLIENTE: TcxGridDBColumn;
|
|
|
|
|
|
actProcedencia: TAction;
|
|
|
|
|
|
TBXSeparatorItem3: TTBXSeparatorItem;
|
|
|
|
|
|
TBXItem4: TTBXItem;
|
2022-06-23 15:49:41 +00:00
|
|
|
|
cxGridViewTIPO_OPERACION: TcxGridDBColumn;
|
2023-02-10 17:16:11 +00:00
|
|
|
|
cxGridPagadas: TcxGridLevel;
|
|
|
|
|
|
cxGridViewAGENTE: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewDELEGACION: TcxGridDBColumn;
|
|
|
|
|
|
actComercial: TAction;
|
|
|
|
|
|
actDelegacion: TAction;
|
|
|
|
|
|
TBXSeparatorItem4: TTBXSeparatorItem;
|
|
|
|
|
|
TBXItem5: TTBXItem;
|
|
|
|
|
|
TBXSeparatorItem5: TTBXSeparatorItem;
|
|
|
|
|
|
TBXItem6: TTBXItem;
|
|
|
|
|
|
cxGridViewFAC_PRO_GRADEN: TcxGridDBColumn;
|
|
|
|
|
|
actTienda: TAction;
|
|
|
|
|
|
TBXSeparatorItem6: TTBXSeparatorItem;
|
|
|
|
|
|
TBXItem7: TTBXItem;
|
2023-05-29 14:17:23 +00:00
|
|
|
|
cxGridViewREFERENCIA_CLIENTE: TcxGridDBColumn;
|
2023-12-04 14:04:07 +00:00
|
|
|
|
cxStyleProforma: TcxStyle;
|
|
|
|
|
|
cxGridProformas: TcxGridLevel;
|
|
|
|
|
|
cxGridViewPAIS: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewIDIOMA: TcxGridDBColumn;
|
2024-02-05 10:15:29 +00:00
|
|
|
|
actPais: TAction;
|
|
|
|
|
|
TBXSeparatorItem7: TTBXSeparatorItem;
|
|
|
|
|
|
TBXItem8: TTBXItem;
|
2011-11-14 17:40:41 +00:00
|
|
|
|
procedure cxGridViewStylesGetContentStyle(Sender: TcxCustomGridTableView;
|
|
|
|
|
|
ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem;
|
|
|
|
|
|
out AStyle: TcxStyle);
|
|
|
|
|
|
procedure cxGridActiveTabChanged(Sender: TcxCustomGrid; ALevel: TcxGridLevel);
|
|
|
|
|
|
procedure actClienteExecute(Sender: TObject);
|
|
|
|
|
|
procedure actProvinciaExecute(Sender: TObject);
|
|
|
|
|
|
procedure actProvinciaUpdate(Sender: TObject);
|
|
|
|
|
|
procedure actClienteUpdate(Sender: TObject);
|
2016-11-10 17:05:04 +00:00
|
|
|
|
procedure actProcedenciaExecute(Sender: TObject);
|
|
|
|
|
|
procedure actProcedenciaUpdate(Sender: TObject);
|
2023-02-10 17:16:11 +00:00
|
|
|
|
procedure actComercialExecute(Sender: TObject);
|
|
|
|
|
|
procedure actComercialUpdate(Sender: TObject);
|
|
|
|
|
|
procedure actDelegacionExecute(Sender: TObject);
|
|
|
|
|
|
procedure actDelegacionUpdate(Sender: TObject);
|
|
|
|
|
|
procedure actTiendaExecute(Sender: TObject);
|
|
|
|
|
|
procedure actTiendaUpdate(Sender: TObject);
|
2024-02-05 10:15:29 +00:00
|
|
|
|
procedure actPaisExecute(Sender: TObject);
|
|
|
|
|
|
procedure actPaisUpdate(Sender: TObject);
|
2011-11-14 17:40:41 +00:00
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
//Filtros relativos a la vista
|
|
|
|
|
|
procedure AnadirFiltroSituaciones;
|
|
|
|
|
|
procedure AnadirFiltroFechas;
|
|
|
|
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
FFacturas: IBizFacturaCliente;
|
|
|
|
|
|
function GetFacturas: IBizFacturaCliente;
|
|
|
|
|
|
procedure SetFacturas(const Value: IBizFacturaCliente);
|
|
|
|
|
|
|
|
|
|
|
|
public
|
|
|
|
|
|
procedure AnadirOtrosFiltros; override;
|
2022-06-23 15:49:41 +00:00
|
|
|
|
procedure ConfigView; override;
|
2011-11-14 17:40:41 +00:00
|
|
|
|
property Facturas: IBizFacturaCliente read GetFacturas write SetFacturas;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
2023-12-04 14:04:07 +00:00
|
|
|
|
uDataModuleFacturasCliente, schFacturasClienteClient_Intf, DateUtils,
|
|
|
|
|
|
uViewGridBase, uFactuGES_App;
|
2011-11-14 17:40:41 +00:00
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
{ TfrViewFacturasCliente }
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewFacturasCliente.actClienteExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if (cxGridViewNOMBRE.GroupIndex < 0) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
cxGridViewNOMBRE.GroupIndex := cxGridView.GroupedColumnCount;
|
|
|
|
|
|
cxGridViewNOMBRE.Visible := False;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
cxGridViewNOMBRE.GroupIndex := -1;
|
|
|
|
|
|
cxGridViewNOMBRE.Visible := True;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewFacturasCliente.actClienteUpdate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
(Sender as TAction).Checked := not (cxGridViewNOMBRE.GroupIndex < 0);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2023-02-10 17:16:11 +00:00
|
|
|
|
procedure TfrViewFacturasCliente.actComercialExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if (cxGridViewAGENTE.GroupIndex < 0) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
cxGridViewAGENTE.GroupIndex := cxGridView.GroupedColumnCount;
|
|
|
|
|
|
cxGridViewAGENTE.Visible := False;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
cxGridViewAGENTE.GroupIndex := -1;
|
|
|
|
|
|
cxGridViewAGENTE.Visible := True;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewFacturasCliente.actComercialUpdate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
(Sender as TAction).Checked := not (cxGridViewAGENTE.GroupIndex < 0);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewFacturasCliente.actDelegacionExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if (cxGridViewDELEGACION.GroupIndex < 0) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
cxGridViewDELEGACION.GroupIndex := cxGridView.GroupedColumnCount;
|
|
|
|
|
|
cxGridViewDELEGACION.Visible := False;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
cxGridViewDELEGACION.GroupIndex := -1;
|
|
|
|
|
|
cxGridViewDELEGACION.Visible := True;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewFacturasCliente.actDelegacionUpdate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
(Sender as TAction).Checked := not (cxGridViewDELEGACION.GroupIndex < 0);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2024-02-05 10:15:29 +00:00
|
|
|
|
procedure TfrViewFacturasCliente.actPaisExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if (cxGridViewPAIS.GroupIndex < 0) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
cxGridViewPAIS.GroupIndex := cxGridView.GroupedColumnCount;
|
|
|
|
|
|
cxGridViewPAIS.Visible := False;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
cxGridViewPAIS.GroupIndex := -1;
|
|
|
|
|
|
cxGridViewPAIS.Visible := True;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewFacturasCliente.actPaisUpdate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
(Sender as TAction).Checked := not (cxGridViewPAIS.GroupIndex < 0);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2016-11-10 17:05:04 +00:00
|
|
|
|
procedure TfrViewFacturasCliente.actProcedenciaExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if (cxGridViewPROCEDENCIA_CLIENTE.GroupIndex < 0) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
cxGridViewPROCEDENCIA_CLIENTE.GroupIndex := cxGridView.GroupedColumnCount;
|
|
|
|
|
|
cxGridViewPROCEDENCIA_CLIENTE.Visible := False;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
cxGridViewPROCEDENCIA_CLIENTE.GroupIndex := -1;
|
|
|
|
|
|
cxGridViewPROCEDENCIA_CLIENTE.Visible := True;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewFacturasCliente.actProcedenciaUpdate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
(Sender as TAction).Checked := not (cxGridViewPROCEDENCIA_CLIENTE.GroupIndex < 0);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2011-11-14 17:40:41 +00:00
|
|
|
|
procedure TfrViewFacturasCliente.actProvinciaExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if (cxGridViewPROVINCIA.GroupIndex < 0) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
cxGridViewPROVINCIA.GroupIndex := cxGridView.GroupedColumnCount;
|
|
|
|
|
|
cxGridViewPROVINCIA.Visible := False;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
cxGridViewPROVINCIA.GroupIndex := -1;
|
|
|
|
|
|
cxGridViewPROVINCIA.Visible := True;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewFacturasCliente.actProvinciaUpdate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
(Sender as TAction).Checked := not (cxGridViewPROVINCIA.GroupIndex < 0);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2023-02-10 17:16:11 +00:00
|
|
|
|
procedure TfrViewFacturasCliente.actTiendaExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if (cxGridViewTIENDA.GroupIndex < 0) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
cxGridViewTIENDA.GroupIndex := cxGridView.GroupedColumnCount;
|
|
|
|
|
|
cxGridViewTIENDA.Visible := False;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
cxGridViewTIENDA.GroupIndex := -1;
|
|
|
|
|
|
cxGridViewTIENDA.Visible := True;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewFacturasCliente.actTiendaUpdate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
(Sender as TAction).Checked := not (cxGridViewTIENDA.GroupIndex < 0);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2011-11-14 17:40:41 +00:00
|
|
|
|
procedure TfrViewFacturasCliente.AnadirFiltroFechas;
|
|
|
|
|
|
var
|
|
|
|
|
|
Columna: TcxGridDBColumn;
|
|
|
|
|
|
Fecha1, Fecha2: Variant;
|
|
|
|
|
|
FFiltro : TcxFilterCriteriaItemList;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Fecha1 := frViewFiltroBase1.edtFechaIniFiltro.EditValue;
|
|
|
|
|
|
Fecha2 := frViewFiltroBase1.edtFechaFinFiltro.EditValue;
|
|
|
|
|
|
|
|
|
|
|
|
if not VarIsNull(Fecha1)
|
|
|
|
|
|
and not VarIsNull(Fecha2) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
cxGridView.DataController.Filter.Options := [fcoCaseInsensitive, fcoSoftCompare];
|
|
|
|
|
|
FFiltro := AddFilterGrid(fboAnd);
|
|
|
|
|
|
|
|
|
|
|
|
Columna := (cxGridView as TcxGridDBTableView).GetColumnByFieldName('FECHA_FACTURA');
|
|
|
|
|
|
FFiltro.AddItem(Columna, foBetween, varArrayOf([Fecha1, Fecha2]), VarToStr(Fecha1) + ' and ' + VarToStr(Fecha2));
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewFacturasCliente.AnadirFiltroSituaciones;
|
|
|
|
|
|
var
|
|
|
|
|
|
FFiltro : TcxFilterCriteriaItemList;
|
|
|
|
|
|
begin
|
|
|
|
|
|
FFiltro := AddFilterGrid(fboAnd);
|
|
|
|
|
|
|
|
|
|
|
|
case cxGrid.ActiveLevel.Index of
|
2023-12-04 14:04:07 +00:00
|
|
|
|
0 : FFiltro.AddItem(cxGridViewTIPO, foNotEqual, CTE_TIPO_PROFORMA, CTE_TIPO_PROFORMA);
|
|
|
|
|
|
1 : Begin
|
|
|
|
|
|
FFiltro.AddItem(cxGridViewSITUACION, foEqual, CTE_PENDIENTE, CTE_PENDIENTE);
|
|
|
|
|
|
FFiltro.AddItem(cxGridViewTIPO, foNotEqual, CTE_TIPO_PROFORMA, CTE_TIPO_PROFORMA);
|
|
|
|
|
|
End;
|
|
|
|
|
|
2 : Begin
|
|
|
|
|
|
FFiltro.AddItem(cxGridViewSITUACION, foEqual, CTE_PARCIAMENTE_PAGADA, CTE_PARCIAMENTE_PAGADA);
|
|
|
|
|
|
FFiltro.AddItem(cxGridViewTIPO, foNotEqual, CTE_TIPO_PROFORMA, CTE_TIPO_PROFORMA);
|
|
|
|
|
|
End;
|
|
|
|
|
|
3 : Begin
|
|
|
|
|
|
FFiltro.AddItem(cxGridViewSITUACION, foEqual, CTE_PAGADA, CTE_PAGADA);
|
|
|
|
|
|
FFiltro.AddItem(cxGridViewTIPO, foNotEqual, CTE_TIPO_PROFORMA, CTE_TIPO_PROFORMA);
|
|
|
|
|
|
End;
|
|
|
|
|
|
4 : FFiltro.AddItem(cxGridViewTIPO, foEqual, CTE_TIPO_PROFORMA, CTE_TIPO_PROFORMA);
|
2011-11-14 17:40:41 +00:00
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewFacturasCliente.AnadirOtrosFiltros;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
|
|
|
|
|
|
AnadirFiltroSituaciones;
|
|
|
|
|
|
AnadirFiltroFechas;
|
|
|
|
|
|
|
|
|
|
|
|
//Finalmente activamos el filtro si tenemos algo
|
|
|
|
|
|
if cxGridView.DataController.Filter.IsEmpty
|
|
|
|
|
|
then cxGridView.DataController.Filter.Active := False
|
|
|
|
|
|
else cxGridView.DataController.Filter.Active := True;
|
|
|
|
|
|
cxGrid.ActiveLevel.GridView := cxGridView;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2022-06-23 15:49:41 +00:00
|
|
|
|
procedure TfrViewFacturasCliente.ConfigView;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2023-12-04 14:04:07 +00:00
|
|
|
|
//Para que nos filtre la pesta<74>a todas y quite las facturas proforma
|
|
|
|
|
|
AnadirOtrosFiltros;
|
|
|
|
|
|
|
2024-04-19 15:09:52 +00:00
|
|
|
|
cxGridViewTIENDA.Visible := True;
|
|
|
|
|
|
cxGridViewTIENDA.VisibleForCustomization := True;
|
|
|
|
|
|
actTienda.Visible := True;
|
2023-12-04 14:04:07 +00:00
|
|
|
|
|
2024-04-19 15:09:52 +00:00
|
|
|
|
cxGridViewAGENTE.Visible := False;
|
|
|
|
|
|
cxGridViewAGENTE.VisibleForCustomization := False;
|
|
|
|
|
|
actComercial.Visible := False;
|
|
|
|
|
|
|
|
|
|
|
|
cxGridViewDELEGACION.Visible := False;
|
|
|
|
|
|
cxGridViewDELEGACION.VisibleForCustomization := False;
|
|
|
|
|
|
actDelegacion.Visible := False;
|
|
|
|
|
|
|
|
|
|
|
|
cxGridViewFAC_PRO_GRADEN.Visible := False;
|
|
|
|
|
|
cxGridViewFAC_PRO_GRADEN.VisibleForCustomization := False;
|
2022-06-23 15:49:41 +00:00
|
|
|
|
|
2024-04-19 15:09:52 +00:00
|
|
|
|
//FILTRO DE EMPRESAS TIENDA
|
|
|
|
|
|
if (AppFactuGES.EmpresaActiva.ID = CTE_EMPRESA_ABETO) then
|
|
|
|
|
|
begin
|
2022-06-23 15:49:41 +00:00
|
|
|
|
cxGridViewTIENDA.Visible := False;
|
2023-02-10 17:16:11 +00:00
|
|
|
|
cxGridViewTIENDA.VisibleForCustomization := False;
|
2024-04-19 15:09:52 +00:00
|
|
|
|
actTienda.Visible := False;
|
|
|
|
|
|
end;
|
2023-02-10 17:16:11 +00:00
|
|
|
|
|
2024-04-19 15:09:52 +00:00
|
|
|
|
//FILTRO DE EMPRESAS COMERCIALES
|
|
|
|
|
|
if ((AppFactuGES.EmpresaActiva.ID = CTE_EMPRESA_ABETO)
|
|
|
|
|
|
or (AppFactuGES.EmpresaActiva.ID = CTE_EMPRESA_GRADEN)) then
|
|
|
|
|
|
begin
|
2023-02-10 17:16:11 +00:00
|
|
|
|
cxGridViewAGENTE.Visible := True;
|
|
|
|
|
|
cxGridViewAGENTE.VisibleForCustomization := True;
|
2024-04-19 15:09:52 +00:00
|
|
|
|
actComercial.Visible := True;
|
2023-02-10 17:16:11 +00:00
|
|
|
|
|
|
|
|
|
|
cxGridViewDELEGACION.Visible := True;
|
|
|
|
|
|
cxGridViewDELEGACION.VisibleForCustomization := True;
|
|
|
|
|
|
actDelegacion.Visible := True;
|
|
|
|
|
|
|
2024-04-19 15:09:52 +00:00
|
|
|
|
cxGridViewFAC_PRO_GRADEN.Visible := True;
|
|
|
|
|
|
cxGridViewFAC_PRO_GRADEN.VisibleForCustomization := True;
|
2023-02-10 17:16:11 +00:00
|
|
|
|
end;
|
2022-06-23 15:49:41 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
2011-11-14 17:40:41 +00:00
|
|
|
|
procedure TfrViewFacturasCliente.cxGridActiveTabChanged(Sender: TcxCustomGrid;
|
|
|
|
|
|
ALevel: TcxGridLevel);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
RefrescarFiltro;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewFacturasCliente.cxGridViewStylesGetContentStyle(
|
|
|
|
|
|
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
|
|
|
|
|
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
|
|
|
|
|
var
|
|
|
|
|
|
IndiceCol: Integer;
|
|
|
|
|
|
ASituacion: string;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
|
|
|
|
|
|
if Assigned(ARecord) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
IndiceCol := cxGridViewSITUACION.Index;
|
|
|
|
|
|
ASituacion := VarToStr(ARecord.DisplayTexts[IndiceCol]);
|
|
|
|
|
|
if (ASituacion = CTE_PAGADA) then
|
|
|
|
|
|
AStyle := cxStylePagada
|
|
|
|
|
|
else if (ASituacion = CTE_PENDIENTE) then
|
2012-02-07 17:19:35 +00:00
|
|
|
|
AStyle := cxStylePendientes;
|
2011-11-14 17:40:41 +00:00
|
|
|
|
|
|
|
|
|
|
IndiceCol := cxGridViewIMPORTE_TOTAL.Index;
|
|
|
|
|
|
if (Pos('-', ARecord.DisplayTexts[IndiceCol]) > 0) then
|
|
|
|
|
|
AStyle := cxStyleAbono;
|
2023-12-04 14:04:07 +00:00
|
|
|
|
|
|
|
|
|
|
IndiceCol := (Sender as TcxGridDBTableView).GetColumnByFieldName(fld_FacturasClienteTIPO).Index;
|
|
|
|
|
|
if (ARecord.Values[IndiceCol] = CTE_TIPO_PROFORMA) then
|
|
|
|
|
|
AStyle := cxStyleProforma;
|
|
|
|
|
|
|
2011-11-14 17:40:41 +00:00
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfrViewFacturasCliente.GetFacturas: IBizFacturaCliente;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := FFacturas;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewFacturasCliente.SetFacturas(const Value: IBizFacturaCliente);
|
|
|
|
|
|
begin
|
|
|
|
|
|
FFacturas := Value;
|
|
|
|
|
|
if Assigned(FFacturas) then
|
|
|
|
|
|
dsDataSource.DataTable := FFacturas.DataTable;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|