2011-11-14 17:40:41 +00:00
|
|
|
|
unit uViewDetallesPresupuestoCliente;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
|
Dialogs, uViewDetallesArticulos, cxStyles, cxCustomData, cxGraphics, cxFilter,
|
|
|
|
|
|
cxData, cxDataStorage, cxEdit, DB, cxDBData, ImgList, PngImageList,
|
|
|
|
|
|
uDADataTable, ActnList, ComCtrls, ToolWin, cxGridLevel, cxClasses, cxControls,
|
|
|
|
|
|
cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
|
|
|
|
|
cxGrid, cxImageComboBox, cxTextEdit, cxMaskEdit, cxCheckBox, cxCurrencyEdit,
|
|
|
|
|
|
Grids, DBGrids, StdCtrls, ExtCtrls, cxRichEdit, ExtActns, StdActns,
|
|
|
|
|
|
JvExStdCtrls, JvCombobox, JvColorCombo, TB2Item, TBX, TB2Dock, TB2Toolbar,
|
|
|
|
|
|
uControllerDetallesArticulos, uBizPresupuestosCliente, uDAInterfaces, Buttons,
|
|
|
|
|
|
Mask, DBCtrls, cxButtonEdit, cxDropDownEdit, Menus, cxGridCustomPopupMenu,
|
|
|
|
|
|
cxGridPopupMenu, cxDBLookupComboBox, cxCalc, cxEditRepositoryItems,
|
|
|
|
|
|
cxContainer, cxLookupEdit, cxDBLookupEdit, uBizDetallesPresupuestoCliente,
|
2019-01-31 18:04:25 +00:00
|
|
|
|
cxMemo, cxDBEdit, TBXExtItems;
|
2011-11-14 17:40:41 +00:00
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
IViewDetallesPresupuestoCliente = interface(IViewDetallesArticulos)
|
|
|
|
|
|
['{3AF39FF4-291E-4E87-AF9A-93C240A744CD}']
|
|
|
|
|
|
function GetPresupuesto: IBizPresupuestoCliente;
|
|
|
|
|
|
procedure SetPresupuesto(const Value: IBizPresupuestoCliente);
|
|
|
|
|
|
property Presupuesto: IBizPresupuestoCliente read GetPresupuesto write SetPresupuesto;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
TfrViewDetallesPresupuestoCliente = class(TfrViewDetallesArticulos, IViewDetallesPresupuestoCliente)
|
|
|
|
|
|
actAsignarDescuento: TAction;
|
|
|
|
|
|
TBXItem18: TTBXItem;
|
|
|
|
|
|
TBXSeparatorItem9: TTBXSeparatorItem;
|
|
|
|
|
|
DAPropiedades: TDADataSource;
|
2012-07-11 15:39:13 +00:00
|
|
|
|
cxGridViewPROPIEDAD: TcxGridDBColumn;
|
2011-11-14 17:40:41 +00:00
|
|
|
|
cxLookupComboBox1: TcxLookupComboBox;
|
|
|
|
|
|
DAValores: TDADataSource;
|
|
|
|
|
|
cxRichEdit1: TcxRichEdit;
|
|
|
|
|
|
cxGridViewTIPO_ARTICULO: TcxGridDBColumn;
|
|
|
|
|
|
TBXSubmenuItem1: TTBXSubmenuItem;
|
|
|
|
|
|
TBXSeparatorItem6: TTBXSeparatorItem;
|
|
|
|
|
|
TBXItem14: TTBXItem;
|
|
|
|
|
|
actCapituloCocina: TAction;
|
|
|
|
|
|
actCapituloArmarioF: TAction;
|
|
|
|
|
|
actCapituloBano: TAction;
|
|
|
|
|
|
TBXItem15: TTBXItem;
|
|
|
|
|
|
TBXItem16: TTBXItem;
|
|
|
|
|
|
actCapituloArmarioI: TAction;
|
|
|
|
|
|
TBXItem17: TTBXItem;
|
|
|
|
|
|
actCapituloElectrodomesticos: TAction;
|
|
|
|
|
|
actCapituloVarios: TAction;
|
|
|
|
|
|
TBXItem19: TTBXItem;
|
|
|
|
|
|
TBXItem20: TTBXItem;
|
|
|
|
|
|
TBXSeparatorItem7: TTBXSeparatorItem;
|
|
|
|
|
|
TBXSeparatorItem8: TTBXSeparatorItem;
|
|
|
|
|
|
TBXSeparatorItem10: TTBXSeparatorItem;
|
|
|
|
|
|
actCapituloImportes: TAction;
|
|
|
|
|
|
TBXSeparatorItem11: TTBXSeparatorItem;
|
|
|
|
|
|
TBXItem21: TTBXItem;
|
2012-07-11 15:39:13 +00:00
|
|
|
|
cxLookupComboBox2: TcxLookupComboBox;
|
2018-03-26 16:26:46 +00:00
|
|
|
|
edtPrecioPunto: TcxDBCurrencyEdit;
|
|
|
|
|
|
bRecalcularPrecioPunto: TButton;
|
2019-01-31 18:04:25 +00:00
|
|
|
|
TBXLabelItem1: TTBXLabelItem;
|
2011-11-14 17:40:41 +00:00
|
|
|
|
procedure actAsignarDescuentoExecute(Sender: TObject);
|
|
|
|
|
|
procedure actAsignarDescuentoUpdate(Sender: TObject);
|
|
|
|
|
|
procedure CustomViewShow(Sender: TObject);
|
|
|
|
|
|
procedure cxGridViewDESCRIPCIONGetPropertiesForEdit(Sender: TcxCustomGridTableItem; ARecord: TcxCustomGridRecord;
|
|
|
|
|
|
var AProperties: TcxCustomEditProperties);
|
|
|
|
|
|
procedure actCapituloBanoExecute(Sender: TObject);
|
|
|
|
|
|
procedure actCapituloArmarioFExecute(Sender: TObject);
|
|
|
|
|
|
procedure actCapituloArmarioIExecute(Sender: TObject);
|
|
|
|
|
|
procedure actCapituloCocinaExecute(Sender: TObject);
|
|
|
|
|
|
procedure actCapituloElectrodomesticosExecute(Sender: TObject);
|
|
|
|
|
|
procedure actCapituloVariosExecute(Sender: TObject);
|
|
|
|
|
|
procedure actAnadirExecute(Sender: TObject);
|
|
|
|
|
|
procedure actCapituloImportesExecute(Sender: TObject);
|
|
|
|
|
|
procedure CustomViewDestroy(Sender: TObject);
|
2012-07-11 15:39:13 +00:00
|
|
|
|
procedure cxGridViewPROPIEDADGetPropertiesForEdit(
|
|
|
|
|
|
Sender: TcxCustomGridTableItem; ARecord: TcxCustomGridRecord;
|
|
|
|
|
|
var AProperties: TcxCustomEditProperties);
|
2011-11-14 17:40:41 +00:00
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
procedure AnadirCapitulo(const Tipo: String;const Descripcion: String; const Descuento:Boolean = false);
|
|
|
|
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
FPresupuesto: IBizPresupuestoCliente;
|
|
|
|
|
|
FPropiedades: IBizPropiedades;
|
|
|
|
|
|
function GetPresupuesto: IBizPresupuestoCliente;
|
|
|
|
|
|
procedure SetPresupuesto(const Value: IBizPresupuestoCliente);
|
|
|
|
|
|
|
2013-05-18 15:22:15 +00:00
|
|
|
|
procedure ValidarCantidadInterno(var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); override;
|
2011-11-14 17:40:41 +00:00
|
|
|
|
procedure AnadirArticulosInterno; override;
|
|
|
|
|
|
procedure RellenarArticulosInterno; override;
|
|
|
|
|
|
function AnadirArticulo(pReferencia: String; TipoReferencia: TEnumReferencia): Boolean; override;
|
|
|
|
|
|
|
|
|
|
|
|
function EsTipoEditable(AItem: TcxCustomGridTableItem): Boolean; override;
|
|
|
|
|
|
|
|
|
|
|
|
public
|
|
|
|
|
|
property Presupuesto: IBizPresupuestoCliente read GetPresupuesto write SetPresupuesto;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
uses uControllerDetallesBase, uDetallesPresupuestoClienteController, schPresupuestosClienteClient_Intf,
|
|
|
|
|
|
uCalculosUtils;
|
|
|
|
|
|
|
|
|
|
|
|
{ TfrViewDetallesPresupuestoProveedor }
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDetallesPresupuestoCliente.actAnadirExecute(Sender: TObject);
|
|
|
|
|
|
var
|
|
|
|
|
|
AuxTipo: String;
|
|
|
|
|
|
begin
|
|
|
|
|
|
AuxTipo := '';
|
|
|
|
|
|
//En el caso de estar dentro de un capitulo almacenamos el tipo de articulo del capitulo
|
|
|
|
|
|
if FPresupuesto.Detalles.TIPO_DETALLE = TIPO_DETALLE_CONCEPTO then
|
|
|
|
|
|
AuxTipo := FPresupuesto.Detalles.TIPO_ARTICULO;
|
|
|
|
|
|
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
|
|
|
|
|
|
//Asignamos el tipo de articulo del capitulo
|
|
|
|
|
|
(Controller as IDetallesPresupuestoClienteController).SetTipoArticulo(Detalles, AuxTipo);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDetallesPresupuestoCliente.actAsignarDescuentoExecute(Sender: TObject);
|
2013-05-10 10:59:32 +00:00
|
|
|
|
{
|
|
|
|
|
|
var
|
2011-11-14 17:40:41 +00:00
|
|
|
|
AuxTop, AuxRow:Integer;
|
|
|
|
|
|
ADescuento: Variant;
|
|
|
|
|
|
}
|
|
|
|
|
|
begin
|
|
|
|
|
|
{
|
|
|
|
|
|
ADescuento := (Controller as IDetallesPresupuestoClienteController).PedirDescuento;
|
|
|
|
|
|
|
|
|
|
|
|
ShowHourglassCursor;
|
|
|
|
|
|
_FocusedView.BeginUpdate;
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
|
|
|
|
if Assigned(Controller) and Assigned(FPresupuesto.Detalles) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
AuxTop := cxGridView.Controller.TopRowIndex;
|
|
|
|
|
|
AuxRow := cxGridView.DataController.FocusedRowIndex;
|
|
|
|
|
|
|
|
|
|
|
|
(Controller as IDetallesPresupuestoClienteController).AsignarDescuento(FPresupuesto.Detalles, darListaSeleccionados, ADescuento);
|
|
|
|
|
|
|
|
|
|
|
|
_FocusedView.DataController.SelectRows(AuxRow,AuxRow);
|
|
|
|
|
|
_FocusedView.Controller.TopRowIndex := AuxTop;
|
|
|
|
|
|
end
|
|
|
|
|
|
finally
|
|
|
|
|
|
_FocusedView.EndUpdate;
|
|
|
|
|
|
HideHourglassCursor;
|
|
|
|
|
|
end;
|
|
|
|
|
|
}
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDetallesPresupuestoCliente.actAsignarDescuentoUpdate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
|
|
|
|
|
|
if not DADataSource.DataTable.IsEmpty then
|
|
|
|
|
|
(Sender as TAction).Enabled := not (DADataSource.DataTable.State in dsEditModes)
|
|
|
|
|
|
and (_FocusedView.DataController.GetSelectedCount > 0)
|
|
|
|
|
|
and (FPresupuesto.Detalles.TIPO_DETALLE = TIPO_DETALLE_CONCEPTO)
|
|
|
|
|
|
else
|
|
|
|
|
|
(Sender as TAction).Enabled := False;
|
2013-04-25 17:15:39 +00:00
|
|
|
|
|
2011-11-14 17:40:41 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDetallesPresupuestoCliente.actCapituloArmarioFExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
AnadirCapitulo(TIPO_CAPITULO_AF, 'FRENTE DE ARMARIO N<> ');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDetallesPresupuestoCliente.actCapituloArmarioIExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
AnadirCapitulo(TIPO_CAPITULO_AI, 'INTERIOR DE ARMARIO N<> ');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDetallesPresupuestoCliente.actCapituloBanoExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
AnadirCapitulo(TIPO_CAPITULO_B, 'MUEBLE DE BA<42>O N<> ');
|
|
|
|
|
|
AnadirCapitulo(TIPO_CAPITULO_V, 'IMPORTES ', True);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDetallesPresupuestoCliente.actCapituloCocinaExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
AnadirCapitulo(TIPO_CAPITULO_C_VACIO, 'MUEBLES DE COCINA ');
|
|
|
|
|
|
AnadirCapitulo(TIPO_CAPITULO_V, 'IMPORTES ', True);
|
|
|
|
|
|
AnadirCapitulo(TIPO_CAPITULO_V, 'AUMENTO POR ');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDetallesPresupuestoCliente.actCapituloElectrodomesticosExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
AnadirCapitulo(TIPO_CAPITULO_E, 'ELECTRODOM<4F>STICOS ');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDetallesPresupuestoCliente.actCapituloImportesExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
AnadirCapitulo(TIPO_CAPITULO_V, 'IMPORTES ');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDetallesPresupuestoCliente.actCapituloVariosExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
2013-06-07 16:09:30 +00:00
|
|
|
|
AnadirCapitulo(TIPO_CAPITULO_V, 'VARIOS ', true);
|
2011-11-14 17:40:41 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfrViewDetallesPresupuestoCliente.AnadirArticulo(pReferencia: String; TipoReferencia: TEnumReferencia): Boolean;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := (Controller as IDetallesPresupuestoClienteController).AnadirArticulo(Detalles, pReferencia, TipoReferencia, Presupuesto.Cliente.ID);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDetallesPresupuestoCliente.AnadirArticulosInterno;
|
|
|
|
|
|
begin
|
|
|
|
|
|
(Controller as IDetallesPresupuestoClienteController).AnadirArticulos(Detalles, Presupuesto.Cliente);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDetallesPresupuestoCliente.AnadirCapitulo(const Tipo: String;const Descripcion: String; const Descuento:Boolean = false);
|
|
|
|
|
|
var
|
|
|
|
|
|
bEsMultiSelect : Boolean;
|
|
|
|
|
|
begin
|
|
|
|
|
|
// Debo quitar el multiselect porque provoca que se quede seleccionado
|
|
|
|
|
|
// el registro actual y no el nuevo registro que voy a a<>adir
|
|
|
|
|
|
bEsMultiSelect := _FocusedView.OptionsSelection.MultiSelect;
|
|
|
|
|
|
if bEsMultiSelect then
|
|
|
|
|
|
_FocusedView.OptionsSelection.MultiSelect := False;
|
|
|
|
|
|
|
|
|
|
|
|
ShowHourglassCursor;
|
|
|
|
|
|
_FocusedView.BeginUpdate;
|
|
|
|
|
|
try
|
|
|
|
|
|
if _FocusedView.Controller.EditingController.IsEditing then
|
|
|
|
|
|
_FocusedView.Controller.EditingController.Edit.PostEditValue;
|
|
|
|
|
|
|
|
|
|
|
|
if Assigned(Controller) and Assigned(Detalles) then
|
|
|
|
|
|
(Controller as IDetallesPresupuestoClienteController).AnadirCapitulo(Tipo, Descripcion, Descuento, Detalles)
|
|
|
|
|
|
finally
|
|
|
|
|
|
_FocusedView.EndUpdate;
|
|
|
|
|
|
HideHourglassCursor;
|
|
|
|
|
|
|
|
|
|
|
|
// Dejo la propiedad MultiSelect como estaba
|
|
|
|
|
|
if bEsMultiSelect then
|
|
|
|
|
|
_FocusedView.OptionsSelection.MultiSelect := bEsMultiSelect;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDetallesPresupuestoCliente.CustomViewDestroy(Sender: TObject);
|
|
|
|
|
|
begin
|
2013-05-30 14:11:35 +00:00
|
|
|
|
cxGridViewVALORADO.Properties.OnEditValueChanged := Nil;
|
2011-11-14 17:40:41 +00:00
|
|
|
|
cxGridViewVISIBLE.Properties.OnEditValueChanged := Nil;
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDetallesPresupuestoCliente.CustomViewShow(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
if not Assigned(FPropiedades) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
FPropiedades := (Controller as IDetallesPresupuestoClienteController).DarPropiedades;
|
2013-04-25 17:15:39 +00:00
|
|
|
|
// FPropiedades.DataTable.Active := True;
|
2011-11-14 17:40:41 +00:00
|
|
|
|
DAPropiedades.DataTable := FPropiedades.DataTable;
|
|
|
|
|
|
DAValores.DataTable := FPropiedades.Valores.DataTable;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDetallesPresupuestoCliente.cxGridViewDESCRIPCIONGetPropertiesForEdit(
|
|
|
|
|
|
Sender: TcxCustomGridTableItem; ARecord: TcxCustomGridRecord;
|
|
|
|
|
|
var AProperties: TcxCustomEditProperties);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
|
|
|
|
|
|
//OJO sin esto no se refresca el filtro en tabla detalle "VALORES".
|
2012-07-11 15:39:13 +00:00
|
|
|
|
{ (cxGridViewID_PROPIEDAD.Properties as TcxLookupComboBoxProperties).ListSource.DataSet.Locate(fld_PropiedadesID, cxGridViewID_PROPIEDAD.DataBinding.Field.AsVariant,[]);
|
2011-11-14 17:40:41 +00:00
|
|
|
|
|
|
|
|
|
|
if (ARecord.DisplayTexts[cxGridViewTIPO.Index] = TIPO_DETALLE_CONCEPTO)
|
|
|
|
|
|
and ((ARecord.DisplayTexts[cxGridViewTIPO_ARTICULO.Index] = TIPO_CAPITULO_AF)
|
|
|
|
|
|
or (ARecord.DisplayTexts[cxGridViewTIPO_ARTICULO.Index] = TIPO_CAPITULO_AI)
|
|
|
|
|
|
or (ARecord.DisplayTexts[cxGridViewTIPO_ARTICULO.Index] = TIPO_CAPITULO_B)) then
|
|
|
|
|
|
AProperties := cxLookupComboBox1.Properties
|
|
|
|
|
|
else
|
|
|
|
|
|
AProperties := cxRichEdit1.Properties;
|
2012-07-11 15:39:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2013-04-25 17:15:39 +00:00
|
|
|
|
//Se desactiva la asociaci<63>n que habia de propiedades = familias, no saldr<64> combo directamente se escribe o rellena al elegir un articulo
|
2012-07-11 15:39:13 +00:00
|
|
|
|
//OJO sin esto no se refresca el filtro en tabla detalle "VALORES".
|
2013-04-25 17:15:39 +00:00
|
|
|
|
// DAPropiedades.DataTable.Locate(fld_PropiedadesDESCRIPCION, cxGridViewPROPIEDAD.DataBinding.Field.AsVariant,[]);
|
2012-07-11 15:39:13 +00:00
|
|
|
|
|
2013-04-25 17:15:39 +00:00
|
|
|
|
// if (ARecord.DisplayTexts[cxGridViewTIPO.Index] = TIPO_DETALLE_CONCEPTO)
|
|
|
|
|
|
// and (ARecord.DisplayTexts[cxGridViewPROPIEDAD.Index] <> '') then
|
|
|
|
|
|
// AProperties := cxLookupComboBox1.Properties
|
|
|
|
|
|
// else
|
2012-07-11 15:39:13 +00:00
|
|
|
|
AProperties := cxRichEdit1.Properties;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDetallesPresupuestoCliente.cxGridViewPROPIEDADGetPropertiesForEdit(
|
|
|
|
|
|
Sender: TcxCustomGridTableItem; ARecord: TcxCustomGridRecord;
|
|
|
|
|
|
var AProperties: TcxCustomEditProperties);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2013-04-25 17:15:39 +00:00
|
|
|
|
//Se desactiva la asociaci<63>n que habia de propiedades = familias, no saldr<64> combo directamente se escribe o rellena al elegir un articulo
|
|
|
|
|
|
// if (ARecord.DisplayTexts[cxGridViewTIPO.Index] = TIPO_DETALLE_CONCEPTO)
|
|
|
|
|
|
// then
|
|
|
|
|
|
// AProperties := cxLookupComboBox2.Properties
|
|
|
|
|
|
// else
|
2012-07-11 15:39:13 +00:00
|
|
|
|
AProperties := cxRichEdit1.Properties;
|
2011-11-14 17:40:41 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfrViewDetallesPresupuestoCliente.EsTipoEditable(AItem: TcxCustomGridTableItem): Boolean;
|
|
|
|
|
|
var
|
|
|
|
|
|
IndiceCol : Integer;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := True;
|
|
|
|
|
|
|
|
|
|
|
|
if (AItem.Index in [cxGridViewDESCUENTO.Index]) then
|
|
|
|
|
|
begin
|
2013-04-25 17:15:39 +00:00
|
|
|
|
//Esto es para que solo sea editable la columna dto en las lineas de tipo descuento (para hacer descuento por capitulo),
|
2013-09-25 17:13:02 +00:00
|
|
|
|
//adem<65>s descuentos a nivel de lineas de detalle
|
|
|
|
|
|
IndiceCol := cxGridView.GetColumnByFieldName(CAMPO_TIPO).Index;
|
|
|
|
|
|
if (AItem.GridView.Items[IndiceCol].EditValue <> TIPO_DETALLE_DESCUENTO)
|
|
|
|
|
|
and (AItem.GridView.Items[IndiceCol].EditValue <> TIPO_DETALLE_CONCEPTO) then
|
|
|
|
|
|
Result := False
|
2011-11-14 17:40:41 +00:00
|
|
|
|
end
|
2012-07-11 15:39:13 +00:00
|
|
|
|
else if (AItem.Index in [cxGridViewPROPIEDAD.Index, cxGridViewTIPO_ARTICULO.Index]) then
|
2011-11-14 17:40:41 +00:00
|
|
|
|
begin
|
|
|
|
|
|
IndiceCol := cxGridView.GetColumnByFieldName(CAMPO_TIPO).Index;
|
|
|
|
|
|
if ((AItem.GridView.Items[IndiceCol].EditValue = TIPO_DETALLE_SALTO) or
|
|
|
|
|
|
(AItem.GridView.Items[IndiceCol].EditValue = TIPO_DETALLE_SUBTOTAL) or
|
|
|
|
|
|
(AItem.GridView.Items[IndiceCol].EditValue = TIPO_DETALLE_DESCUENTO) or
|
|
|
|
|
|
(AItem.GridView.Items[IndiceCol].EditValue = TIPO_DETALLE_TITULO) or
|
|
|
|
|
|
(AItem.GridView.Items[IndiceCol].EditValue = TIPO_DETALLE_TITULO_OPCIONAL)) then
|
|
|
|
|
|
Result := False
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
IndiceCol := cxGridView.GetColumnByFieldName(fld_PresupuestosCliente_DetallesTIPO_ARTICULO).Index;
|
|
|
|
|
|
if ((AItem.GridView.Items[IndiceCol].EditValue <> TIPO_CAPITULO_AF) and
|
|
|
|
|
|
(AItem.GridView.Items[IndiceCol].EditValue <> TIPO_CAPITULO_AI) and
|
2012-07-11 15:39:13 +00:00
|
|
|
|
(AItem.GridView.Items[IndiceCol].EditValue <> TIPO_CAPITULO_C) and
|
|
|
|
|
|
(AItem.GridView.Items[IndiceCol].EditValue <> TIPO_CAPITULO_O) and
|
|
|
|
|
|
(AItem.GridView.Items[IndiceCol].EditValue <> TIPO_CAPITULO_V) and
|
|
|
|
|
|
(AItem.GridView.Items[IndiceCol].EditValue <> TIPO_CAPITULO_E) and
|
2011-11-14 17:40:41 +00:00
|
|
|
|
(AItem.GridView.Items[IndiceCol].EditValue <> TIPO_CAPITULO_B)) then
|
|
|
|
|
|
Result := False
|
|
|
|
|
|
end;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
Result := inherited EsTipoEditable(AItem);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfrViewDetallesPresupuestoCliente.GetPresupuesto: IBizPresupuestoCliente;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := FPresupuesto;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDetallesPresupuestoCliente.RellenarArticulosInterno;
|
|
|
|
|
|
begin
|
|
|
|
|
|
(Controller as IDetallesPresupuestoClienteController).AnadirArticulos(Detalles, Presupuesto.Cliente, False);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDetallesPresupuestoCliente.SetPresupuesto(const Value: IBizPresupuestoCliente);
|
|
|
|
|
|
begin
|
|
|
|
|
|
FPresupuesto := Value;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2013-05-18 15:22:15 +00:00
|
|
|
|
procedure TfrViewDetallesPresupuestoCliente.ValidarCantidadInterno(
|
|
|
|
|
|
var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if not VarIsNull(FPresupuesto.Cliente.DESCUENTO_LINEA) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
_FocusedView.BeginUpdate;
|
|
|
|
|
|
try
|
|
|
|
|
|
if (VarIsNull(DisplayValue)) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
cxGridView.DataController.GetItemByFieldName(CAMPO_DESCUENTO).EditValue := Null;
|
|
|
|
|
|
end
|
|
|
|
|
|
else begin
|
|
|
|
|
|
if VarIsNull(cxGridView.DataController.GetItemByFieldName(CAMPO_DESCUENTO).EditValue) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if (FPresupuesto.Cliente.DESCUENTO_LINEA <> 0) then
|
|
|
|
|
|
cxGridView.DataController.GetItemByFieldName(CAMPO_DESCUENTO).EditValue := FPresupuesto.Cliente.DESCUENTO_LINEA
|
|
|
|
|
|
else
|
|
|
|
|
|
cxGridView.DataController.GetItemByFieldName(CAMPO_DESCUENTO).EditValue := NULL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
_FocusedView.EndUpdate;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2011-11-14 17:40:41 +00:00
|
|
|
|
end.
|