2007-06-21 16:02:50 +00:00
|
|
|
|
unit uViewDetallesFamilias;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
|
Dialogs, uViewContenido, cxStyles, cxCustomData, cxGraphics, cxFilter,
|
|
|
|
|
|
cxData, cxDataStorage, cxEdit, DB, cxDBData, cxDropDownEdit, cxTextEdit,
|
|
|
|
|
|
cxSpinEdit, cxCurrencyEdit, ImgList, PngImageList, uDADataTable,
|
|
|
|
|
|
ExtActns, StdActns, ActnList, ComCtrls, ToolWin, cxGridLevel,
|
|
|
|
|
|
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
|
|
|
|
|
|
cxControls, cxGridCustomView, cxGrid, cxImageComboBox,
|
|
|
|
|
|
uBizImportesCabeceraBase, cxCheckBox, TB2Item, TBX, TB2Dock, TB2Toolbar,
|
|
|
|
|
|
JvExComCtrls, JvToolBar, cxMaskEdit;
|
|
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
IViewDetallesFamilias = interface(IViewContenido)
|
|
|
|
|
|
['{FFE0D3C1-F05C-4F28-9393-03F344CA6EBA}']
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
TfrViewDetallesFamilias = class(TfrViewContenido, IViewDetallesFamilias)
|
|
|
|
|
|
cxStyleRepository1: TcxStyleRepository;
|
|
|
|
|
|
cxStyle_IMPORTETOTAL: TcxStyle;
|
|
|
|
|
|
cxStyle_SUBTOTAL: TcxStyle;
|
|
|
|
|
|
TipoPngImageList: TPngImageList;
|
|
|
|
|
|
cxGridViewDESCRIPCION: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewCANTIDAD: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewIMPORTEUNIDAD: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewIMPORTETOTAL: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewTIPO: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewPOSICION: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewVISIBLE: TcxGridDBColumn;
|
|
|
|
|
|
actAnadirCap: TAction;
|
|
|
|
|
|
ToolButton1: TToolButton;
|
|
|
|
|
|
ToolButton2: TToolButton;
|
|
|
|
|
|
ToolButton3: TToolButton;
|
|
|
|
|
|
ToolButton4: TToolButton;
|
|
|
|
|
|
ToolButton5: TToolButton;
|
|
|
|
|
|
ToolButton6: TToolButton;
|
|
|
|
|
|
ToolButton7: TToolButton;
|
|
|
|
|
|
cxStyle_TITULO: TcxStyle;
|
|
|
|
|
|
ToolButton8: TToolButton;
|
|
|
|
|
|
ToolButton9: TToolButton;
|
|
|
|
|
|
actRecalcular: TAction;
|
2010-03-14 18:07:47 +00:00
|
|
|
|
cxGridViewVALORADO: TcxGridDBColumn;
|
2007-06-21 16:02:50 +00:00
|
|
|
|
procedure cxGridViewEditing(Sender: TcxCustomGridTableView;
|
|
|
|
|
|
AItem: TcxCustomGridTableItem; var AAllow: Boolean);
|
|
|
|
|
|
procedure cxGridViewTIPOStylesGetContentStyle(
|
|
|
|
|
|
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
|
|
|
|
|
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
|
|
|
|
|
procedure actAnadirCapExecute(Sender: TObject);
|
|
|
|
|
|
procedure actRecalcularExecute(Sender: TObject);
|
|
|
|
|
|
private
|
|
|
|
|
|
protected
|
|
|
|
|
|
public
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
uses uBizImportesDetalleBase, uDAInterfaces;
|
|
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDetallesFamilias.cxGridViewEditing(
|
|
|
|
|
|
Sender: TcxCustomGridTableView; AItem: TcxCustomGridTableItem;
|
|
|
|
|
|
var AAllow: Boolean);
|
|
|
|
|
|
var
|
2010-03-14 18:07:47 +00:00
|
|
|
|
IndiceCol, IndiceCol2 : Integer;
|
|
|
|
|
|
|
2007-06-21 16:02:50 +00:00
|
|
|
|
begin
|
|
|
|
|
|
IndiceCol := (Sender as TcxGridDBTableView).GetColumnByFieldName(fld_DESCRIPCION).Index;
|
|
|
|
|
|
if AItem.Index <= IndiceCol then
|
|
|
|
|
|
AAllow := True
|
|
|
|
|
|
else begin
|
|
|
|
|
|
IndiceCol := (Sender as TcxGridDBTableView).GetColumnByFieldName(fld_TIPODETALLE).Index;
|
|
|
|
|
|
if (UpperCase(AItem.GridView.Items[IndiceCol].EditValue) = TIPODETALLE_SUBTOTAL) then
|
|
|
|
|
|
AAllow := False
|
|
|
|
|
|
else begin
|
|
|
|
|
|
if (UpperCase(AItem.GridView.Items[IndiceCol].EditValue) = TIPODETALLE_TITULO) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
IndiceCol := (Sender as TcxGridDBTableView).GetColumnByFieldName(fld_VISIBLE).Index;
|
2010-03-14 18:07:47 +00:00
|
|
|
|
IndiceCol2 := (Sender as TcxGridDBTableView).GetColumnByFieldName(fld_VALORADO).Index;
|
|
|
|
|
|
if ((AItem.Index = IndiceCol) or (AItem.Index = IndiceCol2)) then
|
2007-06-21 16:02:50 +00:00
|
|
|
|
AAllow := True
|
|
|
|
|
|
else
|
2010-03-14 18:07:47 +00:00
|
|
|
|
AAllow := False;
|
2007-06-21 16:02:50 +00:00
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDetallesFamilias.cxGridViewTIPOStylesGetContentStyle(
|
|
|
|
|
|
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
|
|
|
|
|
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
|
|
|
|
|
var
|
|
|
|
|
|
IndiceCol : Integer;
|
|
|
|
|
|
ATipo : String;
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Assigned(ARecord) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
IndiceCol := (Sender as TcxGridDBTableView).GetColumnByFieldName(fld_TIPODETALLE).Index;
|
|
|
|
|
|
ATipo := VarToStr(ARecord.Values[IndiceCol]);
|
|
|
|
|
|
if ATipo = TIPODETALLE_SUBTOTAL then
|
|
|
|
|
|
AStyle := cxStyle_SUBTOTAL;
|
|
|
|
|
|
if ATipo = TIPODETALLE_TITULO then
|
|
|
|
|
|
AStyle := cxStyle_TITULO;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDetallesFamilias.actAnadirCapExecute(Sender: TObject);
|
|
|
|
|
|
var
|
|
|
|
|
|
AFieldTIPO : TDAField;
|
|
|
|
|
|
AFieldDES : TDAField;
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Assigned(DADataSource.DataTable) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
AFieldTIPO := DADataSource.DataTable.FindField(fld_TIPODETALLE);
|
|
|
|
|
|
AFieldDES := DADataSource.DataTable.FindField(fld_DESCRIPCION);
|
|
|
|
|
|
|
|
|
|
|
|
DADataSource.DataTable.Append;
|
|
|
|
|
|
AFieldDES.AsString := 'Cap<61>tulo de...';
|
|
|
|
|
|
AFieldTIPO.Value := TIPODETALLE_TITULO;
|
|
|
|
|
|
if DADataSource.DataTable.State in dsEditModes then
|
|
|
|
|
|
DADataSource.DataTable.Post;
|
|
|
|
|
|
DADataSource.DataTable.Next;
|
|
|
|
|
|
|
|
|
|
|
|
DADataSource.DataTable.Insert;
|
|
|
|
|
|
AFieldTIPO.Value := TIPODETALLE_CONCEPTO;
|
|
|
|
|
|
if DADataSource.DataTable.State in dsEditModes then
|
|
|
|
|
|
DADataSource.DataTable.Post;
|
|
|
|
|
|
DADataSource.DataTable.Next;
|
|
|
|
|
|
|
|
|
|
|
|
DADataSource.DataTable.Insert;
|
|
|
|
|
|
AFieldDES.AsString := 'Total del cap<61>tulo';
|
|
|
|
|
|
AFieldTIPO.Value := TIPODETALLE_SUBTOTAL;
|
|
|
|
|
|
if DADataSource.DataTable.State in dsEditModes then
|
|
|
|
|
|
DADataSource.DataTable.Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDetallesFamilias.actRecalcularExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
RecalcularTodo(DADataSource.DataTable);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|